Conversation
Adds a new `scheduledtask` resource type so a scheduled task can be opened and viewed as a tab in Chat: - registry config (Calendar icon, label, tab/dropdown renderers) - add-resource dropdown listing (workspace jobs) - embedded detail viewer (status, schedule, next/last run, prompt, recent runs) - "Open in scheduled tasks" action + query invalidation - contract enum + route validation so the resource persists Agent-side mention/OpenResource wiring is left as a follow-up.
…sistence
Dedupes the placeholder-title set that the chat-resource route and the
server-side persistence merge each defined separately. They had already
drifted ('Log' was missing from persistence); a single shared
GENERIC_RESOURCE_TITLES keeps title-upgrade behavior consistent, including
the new 'Scheduled Task' placeholder.
…task viewer - Render a 'couldn't load' state when the schedules query errors, instead of falsely claiming the task was deleted (uses React Query isError) - Use a stable composite key for jobHistory rows so same-second timestamps don't collide
Adds a first-class 'scheduledtask' ChatContext kind so a scheduled-task resource maps to a real context (not a generic docs fallback), fixing the exhaustive RESOURCE_TO_CONTEXT map that broke the build: - ChatContext union + CHAT_CONTEXT_KIND_REGISTRY (Calendar chip) - resource→context mapping, context validity check, clipboard portability Agent-side consumption of the kind remains a follow-up.
…led tasks as a resource
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Greptile SummaryThis PR migrates the "jobs agent" to a "scheduled tasks agent" by renaming the underlying tool identifiers (
Confidence Score: 5/5Safe to merge — the rename is consistent across all layers and backward-compat aliases are in place for historical transcripts. The tool rename is applied consistently from the generated catalog, handler registration, schedule-execution prompt builder, and wasCompletedByTool check through to the UI display titles and resource extraction logic. The underlying executor functions are reused unchanged, so no behavioral regression is introduced. Backward-compat aliases for No files require special attention. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Agent as Scheduled Task Agent
participant Exec as schedule-execution.ts
participant Tools as register-handlers.ts
participant DB as workflowSchedule DB
participant UI as EmbeddedScheduledTask
Exec->>Agent: buildJobPrompt (instructs to call manage_scheduled_task / complete_scheduled_task)
Agent->>Tools: manage_scheduled_task (create/update/delete)
Tools->>DB: executeManageJob handler
DB-->>Tools: "{ jobId, title, ... }"
Tools-->>Agent: result
Agent->>Tools: complete_scheduled_task (if until_complete lifecycle)
Tools->>DB: executeCompleteJob handler
DB-->>Tools: "{ completed: true }"
Exec->>Exec: "wasCompletedByTool = toolCalls.some(tc => tc.name === 'complete_scheduled_task')"
Note over Exec: extractResourcesFromToolResult reads jobId from result
Exec->>UI: "{ type: 'scheduledtask', id: jobId, title }"
UI->>DB: useWorkspaceSchedules(workspaceId)
DB-->>UI: schedules[]
UI-->>UI: "find(s => s.id === scheduleId) → render details"
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Agent as Scheduled Task Agent
participant Exec as schedule-execution.ts
participant Tools as register-handlers.ts
participant DB as workflowSchedule DB
participant UI as EmbeddedScheduledTask
Exec->>Agent: buildJobPrompt (instructs to call manage_scheduled_task / complete_scheduled_task)
Agent->>Tools: manage_scheduled_task (create/update/delete)
Tools->>DB: executeManageJob handler
DB-->>Tools: "{ jobId, title, ... }"
Tools-->>Agent: result
Agent->>Tools: complete_scheduled_task (if until_complete lifecycle)
Tools->>DB: executeCompleteJob handler
DB-->>Tools: "{ completed: true }"
Exec->>Exec: "wasCompletedByTool = toolCalls.some(tc => tc.name === 'complete_scheduled_task')"
Note over Exec: extractResourcesFromToolResult reads jobId from result
Exec->>UI: "{ type: 'scheduledtask', id: jobId, title }"
UI->>DB: useWorkspaceSchedules(workspaceId)
DB-->>UI: schedules[]
UI-->>UI: "find(s => s.id === scheduleId) → render details"
Reviews (2): Last reviewed commit: "fix(scheduled-tasks): open on edit/creat..." | Re-trigger Greptile |
|
@greptile |
| case ManageScheduledTask.id: { | ||
| // Read-only ops never auto-open; only create/update surface the task. | ||
| const op = getOperation(params) | ||
| if (op === 'list' || op === 'get') return [] |
There was a problem hiding this comment.
Explicitly excluding the
delete operation prevents the UI from attempting to auto-open a deleted scheduled task if the API response shape ever changes to include a jobId field alongside the deleted array. Currently it works because the delete handler returns { deleted, notFound } with no jobId, but the intent is clearer and safer with an explicit guard.
| case ManageScheduledTask.id: { | |
| // Read-only ops never auto-open; only create/update surface the task. | |
| const op = getOperation(params) | |
| if (op === 'list' || op === 'get') return [] | |
| case ManageScheduledTask.id: { | |
| // Read-only ops never auto-open; only create/update surface the task. | |
| const op = getOperation(params) | |
| if (op === 'list' || op === 'get' || op === 'delete') return [] |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
Adds scheduled tasks agent
Companion: https://github.com/simstudioai/copilot/pull/313
Type of Change
Testing
Manual
Checklist