paseo-follow-up 2.4.2 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-follow-up",
3
3
  "private": false,
4
- "version": "2.4.2",
4
+ "version": "2.5.1",
5
5
  "description": "Every agent, one inbox. Follow-up brings what all your coding agents need from you into one ranked list, and follows their work through merge, deploy and after.",
6
6
  "type": "module",
7
7
  "files": [
@@ -216,7 +216,7 @@ function paragraphs(lease, contributor, workflow, directory) {
216
216
  "If you keep a Claude artifact (or doc) summarizing this workspace's goal, decisions and status, register its link once with set_spec after the first publish. Republish to the same URL; call set_spec again only if the link changes.",
217
217
  "Keep actual follow-up tasks current with update_obligation: production behavior checks, migrations and decisions, with concise titles, PR dependencies and evidence. Do not add merge/approval/deploy checklist tasks. Deployment-dependent work waits for verified serving revisions and existing production permissions. A task waiting on a PR or another agent is status=waiting; blocked is only for the developer. One decision, one card: ask it once with ask_question (task set to the task), then mark the task blocked with question=\"Q<n>\"; ask= is only for a decision you haven't asked, and need=action when the developer must do something and tell you (the card gets Done). Follow-up shows a blocked task and your turn-end needs_you about it as one item. Once it is answered, act on the answer and move the task.",
218
218
  "Stakeholder replies are follow-up too. When asked to update a requester, capture the original Slack threadUrl, recipient and explicit developer authorization in the task's communication field; referenced messages alone do not authorize posting. Use a concise progress task now and, when needed, a verify-and-reply task with purpose=verified after the relevant deployed PRs. Read existing thread replies and refresh evidence before posting; distinguish fixed, deployed and verified. Record the actual sent replyUrl and result before marking done. If posting is unavailable or its outcome is uncertain, keep the task blocked and check the thread before any retry; never claim a draft was sent. Auto authorizes delivery to you, not external messages. Communication-only requests do not authorize repairs, benchmarks, migrations or other production writes.",
219
- "A task comes due by itself when its afterPrs reach dependencyStage, or on its recheck date (update_obligation recheck=\"YYYY-MM-DD\"; a task with no PRs defaults to 3 days after your last update). At your turn\u2019s end Follow-up names due tasks: do each and close it with evidence, or keep it with a new recheck and why. A trigger={event:\"now\"|\"merge\"|\"deploy\",delayDays:0} also sends a task to you as a message; set one only from the developer\u2019s requested timing; never infer timing from a title or enable_follow_up alone. Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null removes it. Auto controls delivery, not timing or production permissions.",
219
+ "A task comes due by itself when its afterPrs reach dependencyStage, or on its recheck date (update_obligation recheck=\"YYYY-MM-DD\"; a task with no PRs defaults to 3 days after your last update). At your turn\u2019s end Follow-up names due tasks: do each and close it with evidence, or keep it with a new recheck and why. A trigger={event:\"now\"|\"merge\"|\"deploy\",delayDays:0} also sends a task to you as a message; set one only from the developer\u2019s requested timing; never infer timing from a title or enable_follow_up alone. trigger={event:\"at\",at:\"<ISO time with offset>\"} or {event:\"at\",inMinutes:30} sends it to you once at that time, Auto-send on or off: set it from a time the developer named, or yourself on a waiting task to check back on something Follow-up can\u2019t see (a registry, a release window, a reply); never a sleep loop or a timer of your own (CI: wait_for_checks). Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null removes it. Auto controls delivery, not timing or production permissions.",
220
220
  batchParagraph(workflow) + " For post-deploy tasks, verify the currently serving revision contains every dependency and record behavioral results separately. Acknowledge the header's batch ID with acknowledge_batch before finishing: completed with the result, or blocked with the reason (humanOnly=true when only a person can move it, such as a stale review the reviewer must re-review or dismiss). Verify the entire goal and post-merge work before declare_done; acknowledge a completion batch first. " + mergeLine(workflow),
221
221
  "Before ending this turn, reconcile the sidebar with what you actually did and call sync_workspace with a short summary, including when no changes are needed. Acknowledge any assigned batch. When the entire goal is fulfilled, use declare_done; otherwise preserve remaining work. Do not launch recovery, start queued repairs, merge, toggle merge-when-ready, or archive as part of this bookkeeping. Auto still governs separate follow-up sends. Subagents report to the main agent instead of claiming workspace ownership.",
222
222
  `Prefer the native follow-up MCP tools. For a full historical record, use workspace_status with detail=full. CLI compatibility fallback: FOLLOW_UP_CLIENT_ENTRY=${quote(lease.clientEntry)} node ${quote(join(directory, "mcp.mjs"))} call <tool> '<json>' --compact. Omit --compact only when an existing script needs the full response. Never ask the developer to maintain the sidebar or run this bridge.`,
@@ -5,7 +5,7 @@ import { ONBOARDING_ACTIONS, ONBOARDING_STEPS } from "../shared/onboarding";
5
5
  import { setPrWorkflowInputSchema } from "../shared/pr-workflow";
6
6
  import { prStatsInputSchema, setPrStatsInputSchema, statsRepoName } from "../shared/pr-stats-settings";
7
7
  import { reviewerListSchema } from "../shared/reviewers";
8
- import { taskTriggerSchema } from "../shared/task-trigger";
8
+ import { taskTriggerInputSchema } from "../shared/task-trigger";
9
9
  import { UPDATE_MODES } from "../shared/updates";
10
10
  import { briefChoiceSchema, reportKindSchema } from "../shared/contracts";
11
11
  import { actionChangeSchema, settingsChangeSchema } from "../shared/dispatch";
@@ -126,7 +126,7 @@ export const RPC_TOOLS: readonly RpcTool[] = [
126
126
  { name: "set_workspace_spec", rpc: "follow.workspace-spec", kind: "planned",
127
127
  input: z.strictObject({ workspaceId: id.optional(), action: z.enum(["set", "remove", "reset"]).optional(), url: z.string().trim().min(1).max(2000).optional(), title: z.string().trim().max(120).nullable().optional(), ...confirm }) },
128
128
  { name: "set_task_trigger", rpc: "follow.set-task-trigger", kind: "planned",
129
- input: z.strictObject({ workspaceId: id.optional(), obligationId: id.optional(), expectedRevision: z.number().int().nonnegative().optional(), trigger: taskTriggerSchema.nullable().optional(), afterPrs: z.array(id).optional(), ...confirm }),
129
+ input: z.strictObject({ workspaceId: id.optional(), obligationId: id.optional(), expectedRevision: z.number().int().nonnegative().optional(), trigger: taskTriggerInputSchema.strict().nullable().optional(), afterPrs: z.array(id).optional(), ...confirm }),
130
130
  toRpc: a => ({ workspaceId: a.workspaceId, obligationId: a.obligationId, expectedRevision: a.expectedRevision, trigger: a.trigger ?? null, afterPrs: a.afterPrs ?? [] }) },
131
131
  // Linked items: the list sheet (read, Add link, remove, Undo) for any workspace
132
132
  { name: "link_items", rpc: "follow.linked-items", kind: "read", input: z.strictObject({ workspaceId: id }) },
package/server/daemon.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { daemonUrl } from "../shared/daemon-url.mjs";
1
2
  import { imageSupport, imagesLeftOff } from "./image-support";
2
3
  import { taskAgentStates } from "../shared/task-status";
3
4
  import { settleWithin, type Deadline } from "./teardown";
@@ -117,7 +118,7 @@ export async function daemonOptions(): Promise<Record<string, unknown>> {
117
118
  let url = process.env.PASEO_DAEMON_URL;
118
119
  if (!url) {
119
120
  const config = JSON.parse(await readFile(join(paseoHome, "config.json"), "utf8"));
120
- url = `ws://${config.daemon?.listen ?? "127.0.0.1:6767"}/ws`;
121
+ url = daemonUrl(config);
121
122
  }
122
123
  return { url, clientId: "follow-up-worker", clientType: "cli", reconnect: { enabled: false }, connectTimeoutMs: 10_000, suppressSendErrors: true, ...(password ? { password } : {}) };
123
124
  }
package/server/engine.ts CHANGED
@@ -15,6 +15,7 @@ import { ACTIVE_SCOPE_MIGRATION, followsByDefault, migrateActiveScope } from "..
15
15
  import { replyRecorded } from "../shared/communication";
16
16
  import { DeliveryDeferred, ConversationGone } from "./delivery";
17
17
  import type { CheckWatches } from "./check-watches";
18
+ import type { ScheduledTasks } from "./scheduled-tasks";
18
19
  import type { MessageQueue, Resolution, Target } from "./message-queue";
19
20
  import type { ImageRef } from "../shared/images";
20
21
  import { PASEO_UNREACHABLE, deliveryOf, type NewQueueItem, type QueueItem, type QueueItemInput } from "../shared/queue";
@@ -414,9 +415,12 @@ export class Engine {
414
415
  * never from a read of their own (waiting-for-checks-adds-no-github-read). A nudge's pass judges only its workspaces.
415
416
  */
416
417
  checkWatches: Pick<CheckWatches, "watched" | "evaluate"> | null = null;
418
+ /** Scheduled tasks (server/scheduled-tasks.ts): a task's time trigger fires from the pass its due time started. */
419
+ scheduledTasks: Pick<ScheduledTasks, "evaluate"> | null = null;
417
420
  private async afterPass(affected?: ReadonlySet<string>): Promise<void> {
418
- if (!this.checkWatches || this.stopped) return;
419
- await this.checkWatches.evaluate(affected).catch(error => console.warn(`[follow-up] couldn't check the waits for checks: ${error instanceof Error ? error.message : String(error)}`));
421
+ if (this.stopped) return;
422
+ if (this.checkWatches) await this.checkWatches.evaluate(affected).catch(error => console.warn(`[follow-up] couldn't check the waits for checks: ${error instanceof Error ? error.message : String(error)}`));
423
+ if (this.scheduledTasks && !this.stopped) await this.scheduledTasks.evaluate(affected).catch(error => console.warn(`[follow-up] couldn't send the scheduled tasks: ${error instanceof Error ? error.message : String(error)}`));
420
424
  }
421
425
  /**
422
426
  * A nudge's discovery (a-nudge-costs-its-workspace): only the nudged workspaces and their dirty agents (the kept turn
@@ -218,7 +218,7 @@ export const hookSource: string = [
218
218
  " \"If you keep a Claude artifact (or doc) summarizing this workspace's goal, decisions and status, register its link once with set_spec after the first publish. Republish to the same URL; call set_spec again only if the link changes.\",",
219
219
  " \"Keep actual follow-up tasks current with update_obligation: production behavior checks, migrations and decisions, with concise titles, PR dependencies and evidence. Do not add merge/approval/deploy checklist tasks. Deployment-dependent work waits for verified serving revisions and existing production permissions. A task waiting on a PR or another agent is status=waiting; blocked is only for the developer. One decision, one card: ask it once with ask_question (task set to the task), then mark the task blocked with question=\\\"Q<n>\\\"; ask= is only for a decision you haven't asked, and need=action when the developer must do something and tell you (the card gets Done). Follow-up shows a blocked task and your turn-end needs_you about it as one item. Once it is answered, act on the answer and move the task.\",",
220
220
  " \"Stakeholder replies are follow-up too. When asked to update a requester, capture the original Slack threadUrl, recipient and explicit developer authorization in the task's communication field; referenced messages alone do not authorize posting. Use a concise progress task now and, when needed, a verify-and-reply task with purpose=verified after the relevant deployed PRs. Read existing thread replies and refresh evidence before posting; distinguish fixed, deployed and verified. Record the actual sent replyUrl and result before marking done. If posting is unavailable or its outcome is uncertain, keep the task blocked and check the thread before any retry; never claim a draft was sent. Auto authorizes delivery to you, not external messages. Communication-only requests do not authorize repairs, benchmarks, migrations or other production writes.\",",
221
- " \"A task comes due by itself when its afterPrs reach dependencyStage, or on its recheck date (update_obligation recheck=\\\"YYYY-MM-DD\\\"; a task with no PRs defaults to 3 days after your last update). At your turn\\u2019s end Follow-up names due tasks: do each and close it with evidence, or keep it with a new recheck and why. A trigger={event:\\\"now\\\"|\\\"merge\\\"|\\\"deploy\\\",delayDays:0} also sends a task to you as a message; set one only from the developer\\u2019s requested timing; never infer timing from a title or enable_follow_up alone. Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null removes it. Auto controls delivery, not timing or production permissions.\",",
221
+ " \"A task comes due by itself when its afterPrs reach dependencyStage, or on its recheck date (update_obligation recheck=\\\"YYYY-MM-DD\\\"; a task with no PRs defaults to 3 days after your last update). At your turn\\u2019s end Follow-up names due tasks: do each and close it with evidence, or keep it with a new recheck and why. A trigger={event:\\\"now\\\"|\\\"merge\\\"|\\\"deploy\\\",delayDays:0} also sends a task to you as a message; set one only from the developer\\u2019s requested timing; never infer timing from a title or enable_follow_up alone. trigger={event:\\\"at\\\",at:\\\"<ISO time with offset>\\\"} or {event:\\\"at\\\",inMinutes:30} sends it to you once at that time, Auto-send on or off: set it from a time the developer named, or yourself on a waiting task to check back on something Follow-up can\\u2019t see (a registry, a release window, a reply); never a sleep loop or a timer of your own (CI: wait_for_checks). Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null removes it. Auto controls delivery, not timing or production permissions.\",",
222
222
  " batchParagraph(workflow) + \" For post-deploy tasks, verify the currently serving revision contains every dependency and record behavioral results separately. Acknowledge the header's batch ID with acknowledge_batch before finishing: completed with the result, or blocked with the reason (humanOnly=true when only a person can move it, such as a stale review the reviewer must re-review or dismiss). Verify the entire goal and post-merge work before declare_done; acknowledge a completion batch first. \" + mergeLine(workflow),",
223
223
  " \"Before ending this turn, reconcile the sidebar with what you actually did and call sync_workspace with a short summary, including when no changes are needed. Acknowledge any assigned batch. When the entire goal is fulfilled, use declare_done; otherwise preserve remaining work. Do not launch recovery, start queued repairs, merge, toggle merge-when-ready, or archive as part of this bookkeeping. Auto still governs separate follow-up sends. Subagents report to the main agent instead of claiming workspace ownership.\",",
224
224
  " `Prefer the native follow-up MCP tools. For a full historical record, use workspace_status with detail=full. CLI compatibility fallback: FOLLOW_UP_CLIENT_ENTRY=${quote(lease.clientEntry)} node ${quote(join(directory, \"mcp.mjs\"))} call <tool> '<json>' --compact. Omit --compact only when an existing script needs the full response. Never ask the developer to maintain the sidebar or run this bridge.`,",
@@ -8,6 +8,16 @@ export const mcpSource: string = [
8
8
  "import { existsSync, realpathSync } from \"node:fs\";",
9
9
  "import { join, delimiter } from \"node:path\";",
10
10
  "import { homedir } from \"node:os\";",
11
+ "// A copy of shared/daemon-url.mjs (the 2.5 bridge runs as one file with no build-time inlining);",
12
+ "// tests/daemon-url.test.ts keeps it equal to the shared resolver.",
13
+ "function daemonUrl(config, override) {",
14
+ " if (override) return override;",
15
+ " const listen = config.daemon?.listen ?? \"127.0.0.1:6767\";",
16
+ " if (listen.startsWith(\"pipe://\") || listen.startsWith(\"unix://\")) return `ws+unix://${listen.slice(7)}:/ws`;",
17
+ " if (listen.startsWith(\"\\\\\\\\.\\\\pipe\\\\\") || listen.startsWith(\"/\") || listen.startsWith(\"~\")) return `ws+unix://${listen}:/ws`;",
18
+ " const main = listen.split(\",\", 1)[0].trim();",
19
+ " return `ws://${/^\\d+$/.test(main) ? `127.0.0.1:${main}` : main}/ws`;",
20
+ "}",
11
21
  "",
12
22
  "/** Set by the worker's prelude (shared/legacy.ts withRuntimePrelude); absent when a test imports this file. */",
13
23
  "const runtime = globalThis.followUpRuntime ?? {};",
@@ -19,14 +29,14 @@ export const mcpSource: string = [
19
29
  "const integer = { type: \"integer\", minimum: 1 };",
20
30
  "const array = { type: \"array\", items: string };",
21
31
  "const communication = { type: \"object\", properties: { threadUrl: string, recipient: string, purpose: { type: \"string\", enum: [\"progress\", \"verified\"] }, authorization: string, replyUrl: { type: [\"string\", \"null\"] } }, required: [\"threadUrl\", \"recipient\"], additionalProperties: false };",
22
- "const trigger = { type: [\"object\", \"null\"], properties: { event: { type: \"string\", enum: [\"now\", \"merge\", \"deploy\"] }, delayDays: { type: \"integer\", minimum: 0, maximum: 3650 } }, required: [\"event\"], additionalProperties: false };",
32
+ "const trigger = { type: [\"object\", \"null\"], properties: { event: { type: \"string\", enum: [\"now\", \"merge\", \"deploy\", \"at\"] }, delayDays: { type: \"integer\", minimum: 0, maximum: 3650 }, at: { type: \"string\", description: \"event at: an ISO time with its offset, like 2026-11-26T12:15:00+02:00\" }, inMinutes: { type: \"integer\", minimum: 1, maximum: 43200, description: \"event at: this many minutes from now, instead of at\" } }, required: [\"event\"], additionalProperties: false };",
23
33
  "const tools = [",
24
34
  " [\"workspace_status\", \"Read the tracked workspace's durable goal, PRs, tasks, work queue and optional recovery history. Read after compaction. Returns current work by default; detail=full includes complete evidence/history. Normal follow-up does not require recovery.\", \"follow.agent-status\", { detail: { type: \"string\", enum: [\"summary\", \"full\"] } }, []],",
25
35
  " [\"sync_workspace\", \"Silently confirm the sidebar matches your work before finishing, after registering owned PRs and substantive tasks. Call even when no changes are needed. Keep the summary in this tool; never announce sync or recap sidebar/plugin status to the developer. Does not declare Done, run recovery, or start repairs. Tracked root agents only.\", \"follow.sync\", { summary: { ...string, minLength: 1, maxLength: 1000 } }, [\"summary\"]],",
26
36
  " [\"enroll_workspace\", \"Refine this developer-activated workspace's goal. Ownership is initialized by Track this workspace or the project’s default-tracking setting. This tool cannot activate another workspace. Never ask the developer to enter this. Keep the goal concise; new scope reopens completion.\", \"follow.enroll\", { goal: string }, [\"goal\"]],",
27
37
  " [\"register_pr\", \"Register a PR produced by this workspace. Call after every submission. Register parents first; repeat to update its stack or parent after restacking. Supply a disposition for a deliberately closed PR. Set agentMerges: true when you merge this PR yourself (no human review): Follow-up then never asks the developer to add reviewers or merge it, and the workspace reads as waiting on you; set it false to hand the merge back. In a repository set to No review (set_pr_workflow review \\\"none\\\") every PR counts as agentMerges unless you set it false.\", \"follow.register-pr\", { repo: string, number: integer, stack: string, parentNumber: { type: [\"integer\", \"null\"], minimum: 1 }, disposition: string, agentMerges: boolean }, [\"repo\", \"number\", \"stack\"]],",
28
38
  " [\"exclude_stack\", \"Correct an unrelated stack registration. Preserve its PRs and requirements in an exclusion audit; future registration is blocked. reason must cite the scope/ownership evidence. obligationIds may include related tasks without PR dependencies. Keep external dependencies separate from owned work.\", \"follow.exclude-stack\", { stack: string, reason: string, obligationIds: array }, [\"stack\", \"reason\"]],",
29
- " [\"update_obligation\", \"Record concrete follow-up: verification, migrations, decisions or stakeholder replies. Never add approve/merge/deploy checklist tasks. afterPrs uses owner/repo#number keys. A task comes due by itself when its afterPrs reach dependencyStage, or on recheck (\\\"YYYY-MM-DD\\\"; a task with no PRs defaults to 3 days after your last update); at your turn's end Follow-up names due tasks: do them and close with evidence, or keep them with a new recheck and why. trigger={event:\\\"now\\\"|\\\"merge\\\"|\\\"deploy\\\",delayDays:0} also sends the task to you as a message; set it only from the developer’s requested timing; never infer timing from a title or enable_follow_up alone. Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null removes it. Auto controls delivery, not timing or production permissions. For Slack replies, communication records the original threadUrl, recipient, purpose (progress or verified), explicit developer authorization and sent replyUrl. Empty authorization never queues a reply; Auto does not authorize external posts. Use a verify-and-reply task after deployment for the final update. Read the thread first; mark blocked when posting is unavailable or uncertain, never treat a draft as sent. Done requires replyUrl and evidence; preserve fields when updating. status=working records you as the agent doing it; pass workingAgentId when another agent (your subagent) is.\", \"follow.obligation\", { id: string, workingAgentId: string, title: string, status: { type: \"string\", enum: [\"pending\", \"waiting\", \"working\", \"blocked\", \"done\", \"waived\"] }, afterPrs: array, dependencyStage: { type: \"string\", enum: [\"merged\", \"deployed\"] }, evidence: string, ask: { ...string, description: \"With blocked, only for a decision you haven't asked: the question the developer must answer (waiting on a PR or agent is status=waiting). Asked already with ask_question? Pass question instead.\" }, question: { type: \"string\", pattern: \"^Q\\\\d+$\", description: \"With blocked: the question (Q<n>) this task waits on, asked with ask_question (task set to this task). No second card is made.\" }, need: { type: \"string\", enum: [\"decision\", \"action\"], description: \"With blocked and ask: decision (they choose; the card takes their answer) or action (they do something and report back, e.g. share a page, approve, log in; the card has Done). Left out: read from the ask.\" }, enable_follow_up: boolean, communication, trigger, recheck: { type: \"string\", description: \"When to look at this task again: \\\"YYYY-MM-DD\\\". Set it when you keep a due task open, with why in evidence.\" }, new: { type: \"boolean\", description: \"Add a separate task even though a similar open one exists.\" } }, [\"title\", \"status\"]],",
39
+ " [\"update_obligation\", \"Record concrete follow-up: verification, migrations, decisions or stakeholder replies. Never add approve/merge/deploy checklist tasks. afterPrs uses owner/repo#number keys. A task comes due by itself when its afterPrs reach dependencyStage, or on recheck (\\\"YYYY-MM-DD\\\"; a task with no PRs defaults to 3 days after your last update); at your turn's end Follow-up names due tasks: do them and close with evidence, or keep them with a new recheck and why. trigger={event:\\\"now\\\"|\\\"merge\\\"|\\\"deploy\\\",delayDays:0} also sends the task to you as a message; set it only from the developer’s requested timing; never infer timing from a title or enable_follow_up alone. trigger={event:\\\"at\\\",at:\\\"<ISO time with offset>\\\"} or {event:\\\"at\\\",inMinutes:30} sends it to you once at that time, Auto-send on or off: set it from a time the developer named, or yourself on a waiting task to check back on something Follow-up can't see (a registry, a release window, a reply); never a sleep loop or a timer of your own (CI: wait_for_checks). Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null removes it. Auto controls delivery, not timing or production permissions. For Slack replies, communication records the original threadUrl, recipient, purpose (progress or verified), explicit developer authorization and sent replyUrl. Empty authorization never queues a reply; Auto does not authorize external posts. Use a verify-and-reply task after deployment for the final update. Read the thread first; mark blocked when posting is unavailable or uncertain, never treat a draft as sent. Done requires replyUrl and evidence; preserve fields when updating. status=working records you as the agent doing it; pass workingAgentId when another agent (your subagent) is.\", \"follow.obligation\", { id: string, workingAgentId: string, title: string, status: { type: \"string\", enum: [\"pending\", \"waiting\", \"working\", \"blocked\", \"done\", \"waived\"] }, afterPrs: array, dependencyStage: { type: \"string\", enum: [\"merged\", \"deployed\"] }, evidence: string, ask: { ...string, description: \"With blocked, only for a decision you haven't asked: the question the developer must answer (waiting on a PR or agent is status=waiting). Asked already with ask_question? Pass question instead.\" }, question: { type: \"string\", pattern: \"^Q\\\\d+$\", description: \"With blocked: the question (Q<n>) this task waits on, asked with ask_question (task set to this task). No second card is made.\" }, need: { type: \"string\", enum: [\"decision\", \"action\"], description: \"With blocked and ask: decision (they choose; the card takes their answer) or action (they do something and report back, e.g. share a page, approve, log in; the card has Done). Left out: read from the ask.\" }, enable_follow_up: boolean, communication, trigger, recheck: { type: \"string\", description: \"When to look at this task again: \\\"YYYY-MM-DD\\\". Set it when you keep a due task open, with why in evidence.\" }, new: { type: \"boolean\", description: \"Add a separate task even though a similar open one exists.\" } }, [\"title\", \"status\"]],",
30
40
  " [\"acknowledge_batch\", \"Record a follow-up result. Complete only after verifying all tasks; blocked surfaces the reason to the developer. in_progress when you or your own subagent are already working on these tasks (say where it stands): not a failure, and Follow-up won't send the same tasks again until that work ends or they change on GitHub. Blocked with humanOnly=true when nothing is left for an agent and only a person can move it (a reviewer must re-review or dismiss a stale review, access must be granted): the developer gets a PR item, not an agent failure. When only part of it waits on a person (one thread needs the reviewer's call), name that part in waitingOn with any outcome and carry on with the rest: the developer gets it as a person item, and later messages tell you to leave it. Always acknowledge before ending a repair turn. Keep the result within 2000 characters.\", \"follow.acknowledge\", { batchId: string, outcome: { type: \"string\", enum: [\"completed\", \"blocked\", \"in_progress\"] }, result: { ...string, maxLength: 2000 }, humanOnly: { type: \"boolean\" }, waitingOn: { ...string, maxLength: 500 } }, [\"batchId\", \"outcome\", \"result\"]],",
31
41
  " [\"ask_question\", \"Ask the developer a decision you can't make yourself. Give a short title, the question, lettered options A, B, C… with what each means for them, and recommend the option you'd pick. Set big only when building ahead would send something off this computer, set something people or programs outside the repo rely on, or most remaining work would build on it. Link a PR (owner/repo#number) or task id when it is about one. When a task waits on this decision, set task, then mark it blocked with update_obligation question=\\\"Q<n>\\\" (not ask): one decision, one card. The reply says the question mode and exactly what to do until the answer arrives. Asking something already open returns the open question (\\\"Already open as Q18\\\") instead of a second one; to change an open question's options, ask again with supersedes=\\\"Q18\\\". At the end of the turn point at it with needs_you questions=[\\\"Q18\\\"], don't restate it. URLs and owner/repo#123 in the question, background and options are clickable for the developer. Every card already ends with a built-in \\\"Something else\\\" choice where the developer writes their own answer; don't add an \\\"Other\\\" option yourself.\", \"follow.ask-question\", { title: { ...string, maxLength: 120 }, question: { ...string, maxLength: 2000 }, options: { type: \"array\", maxItems: 26, items: { type: \"object\", properties: { letter: { type: \"string\", pattern: \"^[A-Z]$\" }, label: { ...string, maxLength: 200 }, consequence: { ...string, maxLength: 600 } }, required: [\"letter\", \"label\"], additionalProperties: false } }, recommend: string, big: string, background: string, links: { type: \"array\", maxItems: 10, items: { type: \"object\", properties: { url: string, path: string, label: string }, additionalProperties: false } }, pr: string, task: string, supersedes: { type: \"string\", pattern: \"^Q\\\\d+$\" } }, [\"title\", \"question\"]],",
32
42
  " [\"record_answer\", \"Record the developer's answer when they answered a question in chat instead of in Follow-up. choice is an option letter, \\\"other\\\" when they chose none of your options (words is then required: their answer), or their short answer when there were no options; words is what they said.\", \"follow.record-answer\", { id: string, choice: string, words: string }, [\"id\", \"choice\"]],",
@@ -140,7 +150,7 @@ export const mcpSource: string = [
140
150
  " [\"run_recovery\", \"Run recovery on a workspace, like Run recovery: a separate agent reads its history for missed PRs and tasks. { workspaceId }.\" + ask, \"follow.agent-act\", { workspaceId: string, ...planned }, []],",
141
151
  " [\"refresh\", \"Refresh PR status now, like Refresh. Cheap; use when status looks stale.\", \"follow.agent-act\", { workspaceId: string }, []],",
142
152
  " [\"set_workspace_spec\", \"Set, remove or reset any workspace's spec link: { workspaceId, action set|remove|reset, url, title }.\" + ask, \"follow.agent-act\", { workspaceId: string, action: string, url: string, title: { type: [\"string\", \"null\"] }, ...planned }, []],",
143
- " [\"set_task_trigger\", \"Schedule a task to run now, on merge or on deploy (trigger { event, delayDays } or null), with afterPrs: { workspaceId, obligationId, expectedRevision, trigger, afterPrs }.\" + ask, \"follow.agent-act\", { workspaceId: string, obligationId: string, expectedRevision: { type: \"integer\", minimum: 0 }, trigger, afterPrs: array, ...planned }, []],",
153
+ " [\"set_task_trigger\", \"Schedule a task to run now, on merge, on deploy or at a time (trigger { event, delayDays } or { event: \\\"at\\\", at | inMinutes } or null), with afterPrs: { workspaceId, obligationId, expectedRevision, trigger, afterPrs }.\" + ask, \"follow.agent-act\", { workspaceId: string, obligationId: string, expectedRevision: { type: \"integer\", minimum: 0 }, trigger, afterPrs: array, ...planned }, []],",
144
154
  " [\"pr_controls\", \"Read a PR's merge controls as the PR sheet shows them (Send to Paseo pairing, Graphite in Chrome): { workspaceId, prKey }.\" + read, \"follow.agent-act\", { workspaceId: string, prKey }, [\"workspaceId\", \"prKey\"]],",
145
155
  " [\"browser_status\", \"Read whether Send to Paseo is paired and which repositories it may control.\" + read, \"follow.agent-act\", {}, []],",
146
156
  " [\"release_notes\", \"Read Follow-up's release notes: the installed version, the version it updated from (previous) and when (updatedAt, ms), and every shipped version's notes, newest first. What's new shows the notes after previous, once per device, unless enable_whats_new is off (set_updates).\" + read, \"follow.agent-act\", {}, []],",
@@ -376,7 +386,7 @@ export const mcpSource: string = [
376
386
  " let password = process.env.PASEO_PASSWORD;",
377
387
  " if (!password && process.env.PASEO_PASSWORD_FILE) password = (await readFile(process.env.PASEO_PASSWORD_FILE, \"utf8\")).trim();",
378
388
  " if (!password && home === join(homedir(), \".paseo\")) password = await readFile(join(homedir(), \"paseo-hub/secrets/daemon-password\"), \"utf8\").then(s => s.trim()).catch(() => undefined);",
379
- " const client = new DaemonClient({ url: process.env.PASEO_DAEMON_URL ?? `ws://${config.daemon?.listen ?? \"127.0.0.1:6767\"}/ws`, clientId: \"follow-up-mcp\", clientType: \"cli\", reconnect: { enabled: false }, connectTimeoutMs: 10000, suppressSendErrors: true, ...(password ? { password } : {}) });",
389
+ " const client = new DaemonClient({ url: daemonUrl(config, process.env.PASEO_DAEMON_URL), clientId: \"follow-up-mcp\", clientType: \"cli\", reconnect: { enabled: false }, connectTimeoutMs: 10000, suppressSendErrors: true, ...(password ? { password } : {}) });",
380
390
  " try {",
381
391
  " await client.connect();",
382
392
  " let last;",
package/server/mcp.mjs CHANGED
@@ -6,6 +6,16 @@ import { readFile, stat } from "node:fs/promises";
6
6
  import { existsSync, realpathSync } from "node:fs";
7
7
  import { join, delimiter } from "node:path";
8
8
  import { homedir } from "node:os";
9
+ // A copy of shared/daemon-url.mjs (the 2.5 bridge runs as one file with no build-time inlining);
10
+ // tests/daemon-url.test.ts keeps it equal to the shared resolver.
11
+ function daemonUrl(config, override) {
12
+ if (override) return override;
13
+ const listen = config.daemon?.listen ?? "127.0.0.1:6767";
14
+ if (listen.startsWith("pipe://") || listen.startsWith("unix://")) return `ws+unix://${listen.slice(7)}:/ws`;
15
+ if (listen.startsWith("\\\\.\\pipe\\") || listen.startsWith("/") || listen.startsWith("~")) return `ws+unix://${listen}:/ws`;
16
+ const main = listen.split(",", 1)[0].trim();
17
+ return `ws://${/^\d+$/.test(main) ? `127.0.0.1:${main}` : main}/ws`;
18
+ }
9
19
 
10
20
  /** Set by the worker's prelude (shared/legacy.ts withRuntimePrelude); absent when a test imports this file. */
11
21
  const runtime = globalThis.followUpRuntime ?? {};
@@ -17,14 +27,14 @@ const boolean = { type: "boolean" };
17
27
  const integer = { type: "integer", minimum: 1 };
18
28
  const array = { type: "array", items: string };
19
29
  const communication = { type: "object", properties: { threadUrl: string, recipient: string, purpose: { type: "string", enum: ["progress", "verified"] }, authorization: string, replyUrl: { type: ["string", "null"] } }, required: ["threadUrl", "recipient"], additionalProperties: false };
20
- const trigger = { type: ["object", "null"], properties: { event: { type: "string", enum: ["now", "merge", "deploy"] }, delayDays: { type: "integer", minimum: 0, maximum: 3650 } }, required: ["event"], additionalProperties: false };
30
+ const trigger = { type: ["object", "null"], properties: { event: { type: "string", enum: ["now", "merge", "deploy", "at"] }, delayDays: { type: "integer", minimum: 0, maximum: 3650 }, at: { type: "string", description: "event at: an ISO time with its offset, like 2026-11-26T12:15:00+02:00" }, inMinutes: { type: "integer", minimum: 1, maximum: 43200, description: "event at: this many minutes from now, instead of at" } }, required: ["event"], additionalProperties: false };
21
31
  const tools = [
22
32
  ["workspace_status", "Read the tracked workspace's durable goal, PRs, tasks, work queue and optional recovery history. Read after compaction. Returns current work by default; detail=full includes complete evidence/history. Normal follow-up does not require recovery.", "follow.agent-status", { detail: { type: "string", enum: ["summary", "full"] } }, []],
23
33
  ["sync_workspace", "Silently confirm the sidebar matches your work before finishing, after registering owned PRs and substantive tasks. Call even when no changes are needed. Keep the summary in this tool; never announce sync or recap sidebar/plugin status to the developer. Does not declare Done, run recovery, or start repairs. Tracked root agents only.", "follow.sync", { summary: { ...string, minLength: 1, maxLength: 1000 } }, ["summary"]],
24
34
  ["enroll_workspace", "Refine this developer-activated workspace's goal. Ownership is initialized by Track this workspace or the project’s default-tracking setting. This tool cannot activate another workspace. Never ask the developer to enter this. Keep the goal concise; new scope reopens completion.", "follow.enroll", { goal: string }, ["goal"]],
25
35
  ["register_pr", "Register a PR produced by this workspace. Call after every submission. Register parents first; repeat to update its stack or parent after restacking. Supply a disposition for a deliberately closed PR. Set agentMerges: true when you merge this PR yourself (no human review): Follow-up then never asks the developer to add reviewers or merge it, and the workspace reads as waiting on you; set it false to hand the merge back. In a repository set to No review (set_pr_workflow review \"none\") every PR counts as agentMerges unless you set it false.", "follow.register-pr", { repo: string, number: integer, stack: string, parentNumber: { type: ["integer", "null"], minimum: 1 }, disposition: string, agentMerges: boolean }, ["repo", "number", "stack"]],
26
36
  ["exclude_stack", "Correct an unrelated stack registration. Preserve its PRs and requirements in an exclusion audit; future registration is blocked. reason must cite the scope/ownership evidence. obligationIds may include related tasks without PR dependencies. Keep external dependencies separate from owned work.", "follow.exclude-stack", { stack: string, reason: string, obligationIds: array }, ["stack", "reason"]],
27
- ["update_obligation", "Record concrete follow-up: verification, migrations, decisions or stakeholder replies. Never add approve/merge/deploy checklist tasks. afterPrs uses owner/repo#number keys. A task comes due by itself when its afterPrs reach dependencyStage, or on recheck (\"YYYY-MM-DD\"; a task with no PRs defaults to 3 days after your last update); at your turn's end Follow-up names due tasks: do them and close with evidence, or keep them with a new recheck and why. trigger={event:\"now\"|\"merge\"|\"deploy\",delayDays:0} also sends the task to you as a message; set it only from the developer’s requested timing; never infer timing from a title or enable_follow_up alone. Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null removes it. Auto controls delivery, not timing or production permissions. For Slack replies, communication records the original threadUrl, recipient, purpose (progress or verified), explicit developer authorization and sent replyUrl. Empty authorization never queues a reply; Auto does not authorize external posts. Use a verify-and-reply task after deployment for the final update. Read the thread first; mark blocked when posting is unavailable or uncertain, never treat a draft as sent. Done requires replyUrl and evidence; preserve fields when updating. status=working records you as the agent doing it; pass workingAgentId when another agent (your subagent) is.", "follow.obligation", { id: string, workingAgentId: string, title: string, status: { type: "string", enum: ["pending", "waiting", "working", "blocked", "done", "waived"] }, afterPrs: array, dependencyStage: { type: "string", enum: ["merged", "deployed"] }, evidence: string, ask: { ...string, description: "With blocked, only for a decision you haven't asked: the question the developer must answer (waiting on a PR or agent is status=waiting). Asked already with ask_question? Pass question instead." }, question: { type: "string", pattern: "^Q\\d+$", description: "With blocked: the question (Q<n>) this task waits on, asked with ask_question (task set to this task). No second card is made." }, need: { type: "string", enum: ["decision", "action"], description: "With blocked and ask: decision (they choose; the card takes their answer) or action (they do something and report back, e.g. share a page, approve, log in; the card has Done). Left out: read from the ask." }, enable_follow_up: boolean, communication, trigger, recheck: { type: "string", description: "When to look at this task again: \"YYYY-MM-DD\". Set it when you keep a due task open, with why in evidence." }, new: { type: "boolean", description: "Add a separate task even though a similar open one exists." } }, ["title", "status"]],
37
+ ["update_obligation", "Record concrete follow-up: verification, migrations, decisions or stakeholder replies. Never add approve/merge/deploy checklist tasks. afterPrs uses owner/repo#number keys. A task comes due by itself when its afterPrs reach dependencyStage, or on recheck (\"YYYY-MM-DD\"; a task with no PRs defaults to 3 days after your last update); at your turn's end Follow-up names due tasks: do them and close with evidence, or keep them with a new recheck and why. trigger={event:\"now\"|\"merge\"|\"deploy\",delayDays:0} also sends the task to you as a message; set it only from the developer’s requested timing; never infer timing from a title or enable_follow_up alone. trigger={event:\"at\",at:\"<ISO time with offset>\"} or {event:\"at\",inMinutes:30} sends it to you once at that time, Auto-send on or off: set it from a time the developer named, or yourself on a waiting task to check back on something Follow-up can't see (a registry, a release window, a reply); never a sleep loop or a timer of your own (CI: wait_for_checks). Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null removes it. Auto controls delivery, not timing or production permissions. For Slack replies, communication records the original threadUrl, recipient, purpose (progress or verified), explicit developer authorization and sent replyUrl. Empty authorization never queues a reply; Auto does not authorize external posts. Use a verify-and-reply task after deployment for the final update. Read the thread first; mark blocked when posting is unavailable or uncertain, never treat a draft as sent. Done requires replyUrl and evidence; preserve fields when updating. status=working records you as the agent doing it; pass workingAgentId when another agent (your subagent) is.", "follow.obligation", { id: string, workingAgentId: string, title: string, status: { type: "string", enum: ["pending", "waiting", "working", "blocked", "done", "waived"] }, afterPrs: array, dependencyStage: { type: "string", enum: ["merged", "deployed"] }, evidence: string, ask: { ...string, description: "With blocked, only for a decision you haven't asked: the question the developer must answer (waiting on a PR or agent is status=waiting). Asked already with ask_question? Pass question instead." }, question: { type: "string", pattern: "^Q\\d+$", description: "With blocked: the question (Q<n>) this task waits on, asked with ask_question (task set to this task). No second card is made." }, need: { type: "string", enum: ["decision", "action"], description: "With blocked and ask: decision (they choose; the card takes their answer) or action (they do something and report back, e.g. share a page, approve, log in; the card has Done). Left out: read from the ask." }, enable_follow_up: boolean, communication, trigger, recheck: { type: "string", description: "When to look at this task again: \"YYYY-MM-DD\". Set it when you keep a due task open, with why in evidence." }, new: { type: "boolean", description: "Add a separate task even though a similar open one exists." } }, ["title", "status"]],
28
38
  ["acknowledge_batch", "Record a follow-up result. Complete only after verifying all tasks; blocked surfaces the reason to the developer. in_progress when you or your own subagent are already working on these tasks (say where it stands): not a failure, and Follow-up won't send the same tasks again until that work ends or they change on GitHub. Blocked with humanOnly=true when nothing is left for an agent and only a person can move it (a reviewer must re-review or dismiss a stale review, access must be granted): the developer gets a PR item, not an agent failure. When only part of it waits on a person (one thread needs the reviewer's call), name that part in waitingOn with any outcome and carry on with the rest: the developer gets it as a person item, and later messages tell you to leave it. Always acknowledge before ending a repair turn. Keep the result within 2000 characters.", "follow.acknowledge", { batchId: string, outcome: { type: "string", enum: ["completed", "blocked", "in_progress"] }, result: { ...string, maxLength: 2000 }, humanOnly: { type: "boolean" }, waitingOn: { ...string, maxLength: 500 } }, ["batchId", "outcome", "result"]],
29
39
  ["ask_question", "Ask the developer a decision you can't make yourself. Give a short title, the question, lettered options A, B, C… with what each means for them, and recommend the option you'd pick. Set big only when building ahead would send something off this computer, set something people or programs outside the repo rely on, or most remaining work would build on it. Link a PR (owner/repo#number) or task id when it is about one. When a task waits on this decision, set task, then mark it blocked with update_obligation question=\"Q<n>\" (not ask): one decision, one card. The reply says the question mode and exactly what to do until the answer arrives. Asking something already open returns the open question (\"Already open as Q18\") instead of a second one; to change an open question's options, ask again with supersedes=\"Q18\". At the end of the turn point at it with needs_you questions=[\"Q18\"], don't restate it. URLs and owner/repo#123 in the question, background and options are clickable for the developer. Every card already ends with a built-in \"Something else\" choice where the developer writes their own answer; don't add an \"Other\" option yourself.", "follow.ask-question", { title: { ...string, maxLength: 120 }, question: { ...string, maxLength: 2000 }, options: { type: "array", maxItems: 26, items: { type: "object", properties: { letter: { type: "string", pattern: "^[A-Z]$" }, label: { ...string, maxLength: 200 }, consequence: { ...string, maxLength: 600 } }, required: ["letter", "label"], additionalProperties: false } }, recommend: string, big: string, background: string, links: { type: "array", maxItems: 10, items: { type: "object", properties: { url: string, path: string, label: string }, additionalProperties: false } }, pr: string, task: string, supersedes: { type: "string", pattern: "^Q\\d+$" } }, ["title", "question"]],
30
40
  ["record_answer", "Record the developer's answer when they answered a question in chat instead of in Follow-up. choice is an option letter, \"other\" when they chose none of your options (words is then required: their answer), or their short answer when there were no options; words is what they said.", "follow.record-answer", { id: string, choice: string, words: string }, ["id", "choice"]],
@@ -138,7 +148,7 @@ const actionTools = [
138
148
  ["run_recovery", "Run recovery on a workspace, like Run recovery: a separate agent reads its history for missed PRs and tasks. { workspaceId }." + ask, "follow.agent-act", { workspaceId: string, ...planned }, []],
139
149
  ["refresh", "Refresh PR status now, like Refresh. Cheap; use when status looks stale.", "follow.agent-act", { workspaceId: string }, []],
140
150
  ["set_workspace_spec", "Set, remove or reset any workspace's spec link: { workspaceId, action set|remove|reset, url, title }." + ask, "follow.agent-act", { workspaceId: string, action: string, url: string, title: { type: ["string", "null"] }, ...planned }, []],
141
- ["set_task_trigger", "Schedule a task to run now, on merge or on deploy (trigger { event, delayDays } or null), with afterPrs: { workspaceId, obligationId, expectedRevision, trigger, afterPrs }." + ask, "follow.agent-act", { workspaceId: string, obligationId: string, expectedRevision: { type: "integer", minimum: 0 }, trigger, afterPrs: array, ...planned }, []],
151
+ ["set_task_trigger", "Schedule a task to run now, on merge, on deploy or at a time (trigger { event, delayDays } or { event: \"at\", at | inMinutes } or null), with afterPrs: { workspaceId, obligationId, expectedRevision, trigger, afterPrs }." + ask, "follow.agent-act", { workspaceId: string, obligationId: string, expectedRevision: { type: "integer", minimum: 0 }, trigger, afterPrs: array, ...planned }, []],
142
152
  ["pr_controls", "Read a PR's merge controls as the PR sheet shows them (Send to Paseo pairing, Graphite in Chrome): { workspaceId, prKey }." + read, "follow.agent-act", { workspaceId: string, prKey }, ["workspaceId", "prKey"]],
143
153
  ["browser_status", "Read whether Send to Paseo is paired and which repositories it may control." + read, "follow.agent-act", {}, []],
144
154
  ["release_notes", "Read Follow-up's release notes: the installed version, the version it updated from (previous) and when (updatedAt, ms), and every shipped version's notes, newest first. What's new shows the notes after previous, once per device, unless enable_whats_new is off (set_updates)." + read, "follow.agent-act", {}, []],
@@ -374,7 +384,7 @@ async function call(method, input) {
374
384
  let password = process.env.PASEO_PASSWORD;
375
385
  if (!password && process.env.PASEO_PASSWORD_FILE) password = (await readFile(process.env.PASEO_PASSWORD_FILE, "utf8")).trim();
376
386
  if (!password && home === join(homedir(), ".paseo")) password = await readFile(join(homedir(), "paseo-hub/secrets/daemon-password"), "utf8").then(s => s.trim()).catch(() => undefined);
377
- const client = new DaemonClient({ url: process.env.PASEO_DAEMON_URL ?? `ws://${config.daemon?.listen ?? "127.0.0.1:6767"}/ws`, clientId: "follow-up-mcp", clientType: "cli", reconnect: { enabled: false }, connectTimeoutMs: 10000, suppressSendErrors: true, ...(password ? { password } : {}) });
387
+ const client = new DaemonClient({ url: daemonUrl(config, process.env.PASEO_DAEMON_URL), clientId: "follow-up-mcp", clientType: "cli", reconnect: { enabled: false }, connectTimeoutMs: 10000, suppressSendErrors: true, ...(password ? { password } : {}) });
378
388
  try {
379
389
  await client.connect();
380
390
  let last;
@@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto";
2
2
  import type { Obligation, Workspace } from "../shared/model";
3
3
  import { lifecycleOnly } from "../shared/follow-up";
4
4
  import { communicationKey, communicationSchema, replyRecorded, type Communication } from "../shared/communication";
5
- import type { TaskTrigger } from "../shared/task-trigger";
5
+ import { storedTrigger, type TaskTrigger, type TaskTriggerInput } from "../shared/task-trigger";
6
6
  import { currentQuestion } from "../shared/questions";
7
7
  import { RECHECK_DAYS } from "../shared/task-due";
8
8
  import { sameTask, similarLines, similarOpen } from "../shared/task-dup";
@@ -16,7 +16,7 @@ type Update = {
16
16
  /** While blocked: what the ask wants of the developer, a decision or an action they take and report back. */
17
17
  need?: "decision" | "action";
18
18
  dependencyStage?: "merged" | "deployed"; enable_follow_up?: boolean; communication?: Pick<Communication, "threadUrl" | "recipient"> & Partial<Communication>;
19
- trigger?: TaskTrigger | null;
19
+ trigger?: TaskTriggerInput | TaskTrigger | null;
20
20
  /** due-by-fact: when to look at it again, "YYYY-MM-DD" or an ISO time. An open task with no PRs gets RECHECK_DAYS out by default. */
21
21
  recheck?: string;
22
22
  /** The clock (tests); defaults to Date.now(). */
@@ -68,14 +68,16 @@ export function updateObligation(w: Workspace, input: Update): Obligation {
68
68
  const destination = communication ? communicationSchema.parse({ ...existing?.communication, ...communication }) : existing?.communication;
69
69
  if (destination?.replyUrl && !replyRecorded(destination)) throw new Error("The reply receipt must be a different message in the original Slack workspace/channel/thread.");
70
70
  if (destination && status === "done" && !replyRecorded(destination)) throw new Error("A draft is not a sent reply. Record communication.replyUrl before completing this task; use blocked when posting is unavailable or uncertain.");
71
- const trigger = input.trigger === undefined ? existing?.trigger : input.trigger;
71
+ const now = input.now ?? Date.now();
72
+ // An at trigger's time is resolved and checked here (inMinutes from now, an ISO time with its offset); the same time
73
+ // again keeps whether it already went out (a-scheduled-task-arrives-once-at-its-time).
74
+ const trigger = input.trigger === undefined ? existing?.trigger : storedTrigger(input.trigger, existing?.trigger, now);
72
75
  if (trigger?.event === "now" && (afterPrs.length || trigger.delayDays)) throw new Error("Now requires no PR dependencies or delay. Choose a merge/deploy trigger for delayed work.");
73
- if (trigger && trigger.event !== "now" && !afterPrs.length) throw new Error("Select at least one owned PR for a merge/deploy trigger.");
76
+ if (trigger && (trigger.event === "merge" || trigger.event === "deploy") && !afterPrs.length) throw new Error("Select at least one owned PR for a merge/deploy trigger.");
74
77
  const stage = trigger?.event === "merge" ? "merged" : trigger?.event === "deploy" ? "deployed" : dependencyStage ?? existing?.dependencyStage ?? "deployed";
75
78
  const followUp = enable_follow_up ?? (input.trigger !== undefined ? !!trigger : existing?.enable_follow_up ?? false);
76
79
  // due-by-fact: every open task knows what moves it. With no PRs that is a re-check date: the agent's, else
77
80
  // RECHECK_DAYS from this update (an update is the agent looking at it). A finished task records when.
78
- const now = input.now ?? Date.now();
79
81
  const recheck = input.recheck === undefined ? undefined : /^\d{4}-\d{2}-\d{2}$/.test(input.recheck) ? Date.parse(`${input.recheck}T00:00:00Z`) : Date.parse(input.recheck);
80
82
  if (recheck !== undefined && !Number.isFinite(recheck)) throw new Error("recheck is a date: \"YYYY-MM-DD\" or an ISO time.");
81
83
  const finished = ["done", "waived"].includes(status);
@@ -3,7 +3,7 @@ import type { ZodType } from "zod";
3
3
  import { readFile, writeFile, rename, mkdir } from "node:fs/promises";
4
4
  import { join } from "node:path";
5
5
  import { compareVersions } from "../shared/version";
6
- import { parseChangelog, LEGACY_BASELINE, type InstallKind, type ReleaseNote } from "../shared/changelog";
6
+ import { parseChangelog, releasesUrl, LEGACY_BASELINE, type InstallKind, type ReleaseNote } from "../shared/changelog";
7
7
 
8
8
  /**
9
9
  * Follow-up's own install, as Paseo describes it: where it lives, which version, and from what source. Read from the
@@ -24,12 +24,12 @@ export function describeSelf(rows: readonly PluginRow[]): Omit<SelfInstall, "ver
24
24
  return { id: row.id, path: row.path, version: row.installation?.currentRevision ?? null, installKind, status: row.status ?? null, error: row.error ?? null, registry };
25
25
  }
26
26
 
27
- /** The installed package's version, its display name (the manifest's `name`) and CHANGELOG.md, read from the plugin's own folder. */
28
- export async function readPackage(path: string): Promise<{ version: string | null; name: string | null; notes: ReleaseNote[] }> {
29
- const pkg = await readFile(join(path, "package.json"), "utf8").then(t => JSON.parse(t) as { version?: string }, () => null);
27
+ /** The installed package's version, its display name (the manifest's `name`), CHANGELOG.md and release pages, read from the plugin's own folder. */
28
+ export async function readPackage(path: string): Promise<{ version: string | null; name: string | null; notes: ReleaseNote[]; releases: string | null }> {
29
+ const pkg = await readFile(join(path, "package.json"), "utf8").then(t => JSON.parse(t) as { version?: string; repository?: unknown }, () => null);
30
30
  const manifest = await readFile(join(path, "paseo-plugin.json"), "utf8").then(t => JSON.parse(t) as { name?: unknown }, () => null);
31
31
  const notes = await readFile(join(path, "CHANGELOG.md"), "utf8").then(parseChangelog, () => []);
32
- return { version: pkg?.version ?? null, name: typeof manifest?.name === "string" && manifest.name.trim() ? manifest.name.trim() : null, notes };
32
+ return { version: pkg?.version ?? null, name: typeof manifest?.name === "string" && manifest.name.trim() ? manifest.name.trim() : null, notes, releases: releasesUrl(pkg?.repository) };
33
33
  }
34
34
 
35
35
  /** versions.json: which version this host runs, the one before it, and the host-wide What's new record. */
@@ -0,0 +1,92 @@
1
+ import type { MessageQueue, Resolution } from "./message-queue";
2
+ import type { QueueItem } from "../shared/queue";
3
+ import type { State, Workspace } from "../shared/model";
4
+ import { followUpObligations } from "../shared/follow-up";
5
+ import { pendingAt, scheduledText } from "../shared/task-trigger";
6
+
7
+ /** What the channel needs to know about the agent when the message goes: nothing here loads it. */
8
+ export type ScheduledAgent = { status: string; archived: boolean; workspaceId: string | null } | null;
9
+ export const scheduledItemId = (workspaceId: string, obligationId: string, at: string) => `scheduled:${workspaceId}:${obligationId}:${at}`;
10
+ /** Why a time trigger didn't go out, as the task row says it ("Not sent · the agent was archived"). */
11
+ export const NOT_SENT = { archived: "the agent was archived", closed: "the agent was closed", workspace: "the workspace was archived", none: "the workspace has no main agent" } as const;
12
+
13
+ /**
14
+ * Scheduled tasks (a-scheduled-task-arrives-once-at-its-time): a task whose trigger is a time goes to its main agent
15
+ * once, at that time, whether Auto-send is on or not: someone named the time (the developer in the sheet, or the agent
16
+ * for its own check-back). `evaluate` runs after each engine pass, whose untouched-pass skip already ends at the
17
+ * earliest due time (engine nextDue), so it fires within a tick and never before. A due trigger is saved as one
18
+ * `scheduled` queue message first (a-message-is-saved-before-sent-and-arrives-once) and then marked `queuedAt` on the
19
+ * task, so a crash between the two re-enqueues the same id, which the queue returns as it is. A closed or archived
20
+ * agent gets nothing, and the task row says why (`notSent`); a worker down at the time fires once, late, on its first
21
+ * pass. The channel resolves the agent when it goes, waits for a running turn to end, and sends to an idle one even
22
+ * when Paseo unloaded it: it asked for this message, as with wait_for_checks (the one exception to invariant 1).
23
+ */
24
+ export class ScheduledTasks {
25
+ private queue: MessageQueue | null = null;
26
+ /** Fired triggers (tests). */
27
+ readonly fired: { workspaceId: string; obligationId: string; at: string; sent: boolean; why: string }[] = [];
28
+ constructor(private deps: {
29
+ snapshot: () => Promise<State>;
30
+ mutateWorkspace: (id: string, work: (w: Workspace) => void) => Promise<unknown>;
31
+ agent: (agentId: string) => Promise<ScheduledAgent>;
32
+ now?: () => number;
33
+ }) {}
34
+ private now(): number { return (this.deps.now ?? Date.now)(); }
35
+
36
+ /** After an engine pass: every due time trigger in those workspaces (all when `ids` is absent). */
37
+ async evaluate(ids?: ReadonlySet<string>): Promise<void> {
38
+ const state = await this.deps.snapshot();
39
+ const now = this.now();
40
+ for (const w of state.workspaces) {
41
+ if (ids && !ids.has(w.id) || !w.enable_tracking) continue;
42
+ const due = followUpObligations(w).filter(o => o.enable_follow_up && !["done", "waived"].includes(o.status) && pendingAt(o.trigger) && Date.parse(o.trigger!.at!) <= now);
43
+ for (const o of due) await this.fire(w, o.id, o.trigger!.at!, now);
44
+ }
45
+ }
46
+
47
+ private async fire(w: Workspace, obligationId: string, at: string, now: number): Promise<void> {
48
+ const o = w.obligations.find(x => x.id === obligationId)!;
49
+ const agent = w.archived ? null : await this.deps.agent(w.mainAgentId).catch(() => undefined);
50
+ // Unknown (Paseo unreachable): try on the next pass; never a guess either way.
51
+ if (agent === undefined) return;
52
+ const why = w.archived ? NOT_SENT.workspace : !w.mainAgentId ? NOT_SENT.none : !agent || agent.archived ? NOT_SENT.archived : agent.status === "closed" ? NOT_SENT.closed : null;
53
+ if (!why && this.queue) {
54
+ this.queue.enqueue({ id: scheduledItemId(w.id, o.id, at), kind: "scheduled", key: w.id, ref: { workspaceId: w.id, obligationId: o.id, agentId: w.mainAgentId, at },
55
+ messageId: `scheduled-${o.id}-${Date.parse(at).toString(36)}`, text: scheduledText(o, at, now), priority: "now", state: "queued" });
56
+ }
57
+ if (!why && !this.queue) return;
58
+ await this.mark(w.id, o.id, at, t => { if (why) t.notSent = why; else t.queuedAt = new Date(now).toISOString(); });
59
+ this.fired.push({ workspaceId: w.id, obligationId: o.id, at, sent: !why, why: why ?? "queued" });
60
+ }
61
+
62
+ /** Writes onto the task's trigger only while it is still the same time (an edit since wins). */
63
+ private async mark(workspaceId: string, obligationId: string, at: string, edit: (t: NonNullable<Workspace["obligations"][number]["trigger"]>) => void): Promise<void> {
64
+ await this.deps.mutateWorkspace(workspaceId, w => {
65
+ const o = w.obligations.find(x => x.id === obligationId);
66
+ if (o?.trigger?.event === "at" && o.trigger.at === at) edit(o.trigger);
67
+ }).catch(error => console.warn(`[follow-up] couldn't record a scheduled task: ${error instanceof Error ? error.message : String(error)}`));
68
+ }
69
+
70
+ /** The queue's `scheduled` channel: the main agent, resolved when it goes; never woken from closed or archived. */
71
+ attachQueue(queue: MessageQueue): void {
72
+ this.queue = queue;
73
+ queue.register("scheduled", {
74
+ resolve: async (item): Promise<Resolution> => {
75
+ let agent: ScheduledAgent;
76
+ try { agent = await this.deps.agent(item.ref.agentId!); }
77
+ catch { return { defer: "Paseo unreachable" }; }
78
+ if (!agent || agent.archived) return { cancel: NOT_SENT.archived };
79
+ if (agent.status === "closed") return { cancel: NOT_SENT.closed };
80
+ if (item.state === "queued" && ["running", "initializing"].includes(agent.status)) return { defer: "waits for the agent's turn to end" };
81
+ return { target: { workspaceId: agent.workspaceId, recipients: [item.ref.agentId!] } };
82
+ },
83
+ // The task row mirrors the message: Sent once it left, Not sent (and why) if it was cancelled.
84
+ project: async (item: QueueItem) => {
85
+ const { workspaceId, obligationId, at } = item.ref;
86
+ if (!workspaceId || !obligationId || !at) return;
87
+ if (item.state === "sent") await this.mark(workspaceId, obligationId, at, t => { t.sentAt = item.envelope?.at ?? new Date(this.now()).toISOString(); });
88
+ else if (item.state === "cancelled") await this.mark(workspaceId, obligationId, at, t => { t.notSent = (item.reason ?? "it was cancelled").slice(0, 200); });
89
+ },
90
+ });
91
+ }
92
+ }
@@ -9,6 +9,7 @@ import { IDLE_REASON, MAIN_WAIT, NO_PROGRESS_CAP, QUIET_WAIT, holdsQueue, mainWa
9
9
  import { workingLine } from "./task-status";
10
10
  import { owedTask } from "./task-view";
11
11
  import { taskDue } from "./task-due";
12
+ import { clockLabel, pendingAt } from "./task-trigger";
12
13
  import { followUpObligations, recoveryBatch } from "./follow-up";
13
14
  import { orderedStacks, prLink, settledForDisplay, type PrLink } from "./presentation";
14
15
  import { downstackScan, githubApproved, graphiteReady, isGithubFlow, mergeBlockers, prActionBlocks } from "./pr-actions";
@@ -502,6 +503,9 @@ export function liveLine(w: Workspace, now = Date.now()): { icon: LiveIcon; text
502
503
  // A wait the agent declared (a waiting task: a release, a reload window, a detached job) says what it waits on. The
503
504
  // waiting icon, Home's Waiting group and the brief's "Waiting on others" already say it waits, so the line doesn't.
504
505
  // With what moves it ("· after #232 merges"), so the line never reads as if that task were happening now.
506
+ // A wait with its own check-back time names the time (the soonest one): "Registry publish · checks back 12:15".
507
+ const timed = followUpObligations(w).filter(o => o.status === "waiting" && o.enable_follow_up && pendingAt(o.trigger)).sort((a, b) => a.trigger!.at!.localeCompare(b.trigger!.at!))[0];
508
+ if (timed) return { icon: "waiting", text: `${timed.title} · checks back ${clockLabel(timed.trigger!.at!, now)}`, since: null };
505
509
  const waiting = followUpObligations(w).find(o => o.status === "waiting");
506
510
  if (waiting) { const d = taskDue(waiting, w, now); const moves = d && !d.due ? d.label : null; return { icon: "waiting", text: moves ? `${waiting.title} · ${moves[0].toLowerCase()}${moves.slice(1)}` : waiting.title, since: null }; }
507
511
  // GitHub off (works-without-github): nothing is retrying and the statuses below are from before, so the line says
@@ -234,6 +234,8 @@ export const releaseNotesViewSchema = z.object({
234
234
  enable_whats_new: z.boolean().default(true),
235
235
  /** Every shipped release note, newest first. */
236
236
  notes: z.array(releaseNoteSchema),
237
+ /** The GitHub release pages (`releasesUrl` of package.json's repository), where the full changelogs live; null if none. */
238
+ releases: z.string().nullable().default(null),
237
239
  });
238
240
  export type ReleaseNotesView = z.infer<typeof releaseNotesViewSchema>;
239
241
 
@@ -252,6 +254,37 @@ export function recentNotes(view: Pick<ReleaseNotesView, "version" | "previous"
252
254
  return since.length ? since : view.notes.filter(n => n.version === notesVersion(view.version));
253
255
  }
254
256
 
257
+ /** A version in the notes feed: its curated notes, and whether it is the one this host runs. */
258
+ export type FeedNote = ReleaseNote & { installed: boolean };
259
+ /**
260
+ * What's new and the release notes are one scroll, like Paseo's own (invariant 120, `notes-read-like-one-feed`): every
261
+ * stable version's curated notes, newest first, each with its number and date, the running version marked Installed.
262
+ * `notes` are the installed package's (none newer than it is shown from there); `pending` are an update's notes, from
263
+ * the updater, for versions out but not installed, shown above it. Betas never appear: they ship no curated notes, and
264
+ * what they carried reaches people in the next stable's section. A major's rc counts as its major (`notesVersion`).
265
+ */
266
+ export function notesFeed(notes: readonly ReleaseNote[], installed: string, pending: readonly ReleaseNote[] = []): FeedNote[] {
267
+ const running = notesVersion(installed);
268
+ const stable = (n: ReleaseNote) => parseVersion(n.version)?.pre.length === 0 && hasContent(n);
269
+ const byVersion = new Map<string, ReleaseNote>();
270
+ for (const n of notes) if (stable(n) && compareVersions(n.version, running) <= 0) byVersion.set(n.version, n);
271
+ for (const n of pending) if (stable(n) && compareVersions(n.version, running) > 0 && !byVersion.has(n.version)) byVersion.set(n.version, n);
272
+ return [...byVersion.values()].sort((a, b) => compareVersions(b.version, a.version)).map(n => ({ ...n, installed: n.version === running }));
273
+ }
274
+
275
+ /**
276
+ * The GitHub release pages for a package.json `repository` (an object with `url`, or a string: a URL, `git@`, or the
277
+ * `github:owner/repo` and `owner/repo` shorthands), where each version's full changelog lives. null when it isn't GitHub.
278
+ */
279
+ export function releasesUrl(repository: unknown): string | null {
280
+ const raw = typeof repository === "string" ? repository : typeof (repository as { url?: unknown } | null)?.url === "string" ? (repository as { url: string }).url : null;
281
+ if (!raw) return null;
282
+ const m = /^(?:git\+)?(?:https?:\/\/|git:\/\/|ssh:\/\/git@)github\.com\/([\w.-]+)\/([\w.-]+?)(?:\.git)?\/?$/.exec(raw)
283
+ ?? /^git@github\.com:([\w.-]+)\/([\w.-]+?)(?:\.git)?$/.exec(raw)
284
+ ?? /^(?:github:)?([\w-][\w.-]*)\/([\w.-]+?)(?:\.git)?$/.exec(raw);
285
+ return m ? `https://github.com/${m[1]}/${m[2]}/releases` : null;
286
+ }
287
+
255
288
  /** "just now", "12m ago", "2h ago", "3 days ago". */
256
289
  export function agoText(ms: number): string {
257
290
  const m = Math.floor(ms / 60_000);
@@ -22,7 +22,7 @@ import { briefSchema } from "./brief";
22
22
  import { idSchema, textSchema, workspaceSchema } from "./model";
23
23
  import { listEntrySchema } from "./list";
24
24
  import { communicationSchema } from "./communication";
25
- import { taskTriggerSchema } from "./task-trigger";
25
+ import { taskTriggerInputSchema } from "./task-trigger";
26
26
  import { QUESTION_MODES, questionSchema } from "./questions";
27
27
  import { specSchema } from "./spec";
28
28
  import { HOME_GROUPS } from "./home";
@@ -53,7 +53,7 @@ export const agentStatusRpc = defineRpc({ name: "follow.agent-status", input: z.
53
53
  export const syncWorkspaceRpc = defineRpc({ name: "follow.sync", input: z.strictObject({ agentId: idSchema, summary: z.string().trim().min(1).max(1000) }), output: z.object({ workspaceId: idSchema, synced: z.literal(true) }) });
54
54
  export const enrollRpc = defineRpc({ name: "follow.enroll", input: z.strictObject({ workspaceId: idSchema.optional(), agentId: idSchema, goal: textSchema }), output: workspaceSchema });
55
55
  export const registerPrRpc = defineRpc({ name: "follow.register-pr", input: z.strictObject({ agentId: idSchema, repo: z.string().regex(/^[\w.-]+\/[\w.-]+$/), number: z.number().int().positive(), stack: textSchema, parentNumber: z.number().int().positive().nullable().optional(), disposition: z.string().max(2000).optional(), agentMerges: z.boolean().optional() }), output: workspaceSchema });
56
- export const obligationRpc = defineRpc({ name: "follow.obligation", input: z.strictObject({ agentId: idSchema, workingAgentId: idSchema.optional(), id: idSchema.optional(), title: textSchema, status: z.enum(["pending", "waiting", "working", "blocked", "done", "waived"]), afterPrs: z.array(idSchema).optional(), dependencyStage: z.enum(["merged", "deployed"]).optional(), evidence: z.string().max(4000).optional(), ask: z.string().trim().min(1).max(1000).optional(), question: z.string().regex(/^Q\d+$/).optional(), need: z.enum(["decision", "action"]).optional(), enable_follow_up: z.boolean().optional(), communication: agentCommunicationSchema.optional(), trigger: taskTriggerSchema.strict().nullable().optional(), recheck: z.string().trim().min(1).max(40).optional(), new: z.boolean().optional() }), output: workspaceSchema.extend({ updatedObligationId: idSchema, note: z.string().optional() }) });
56
+ export const obligationRpc = defineRpc({ name: "follow.obligation", input: z.strictObject({ agentId: idSchema, workingAgentId: idSchema.optional(), id: idSchema.optional(), title: textSchema, status: z.enum(["pending", "waiting", "working", "blocked", "done", "waived"]), afterPrs: z.array(idSchema).optional(), dependencyStage: z.enum(["merged", "deployed"]).optional(), evidence: z.string().max(4000).optional(), ask: z.string().trim().min(1).max(1000).optional(), question: z.string().regex(/^Q\d+$/).optional(), need: z.enum(["decision", "action"]).optional(), enable_follow_up: z.boolean().optional(), communication: agentCommunicationSchema.optional(), trigger: taskTriggerInputSchema.strict().nullable().optional(), recheck: z.string().trim().min(1).max(40).optional(), new: z.boolean().optional() }), output: workspaceSchema.extend({ updatedObligationId: idSchema, note: z.string().optional() }) });
57
57
  export const declareDoneRpc = defineRpc({ name: "follow.done", input: z.strictObject({ agentId: idSchema, summary: textSchema }), output: z.object({ workspace: workspaceSchema, blockers: z.array(z.string()), unconfirmed: z.array(z.string()).default([]), alreadyDone: z.boolean().default(false), next: z.string().default("") }) });
58
58
  export const acknowledgeRpc = defineRpc({ name: "follow.acknowledge", input: z.strictObject({ agentId: idSchema, batchId: idSchema, /** in_progress: the agent or its own subagent is already on it (Batch.inProgress). */ outcome: z.enum(["completed", "blocked", "in_progress"]), result: textSchema, /** With blocked: only a person can move what is still open (Batch.humanOnly). */ humanOnly: z.boolean().optional(), /** The part only a person can move, with any outcome (Batch.waitingOn). */ waitingOn: z.string().max(500).optional() }), output: workspaceSchema });
59
59
  export const controlRpc = defineRpc({ name: "follow.control", input: z.object({ workspaceId: idSchema, enable_auto_sends: z.boolean().optional(), clearHold: z.boolean().optional(), retryBatchId: idSchema.optional(), /** Retry one capped task (Q49): its key. */ retryTask: z.string().max(400).optional(), /** Auto per task: a task key and whether Follow-up sends it. */ taskAuto: z.object({ key: z.string().max(400), auto: z.boolean() }).optional(), /** The developer's "Make main agent": one of the workspace's other root agents. */ mainAgentId: idSchema.optional(),
@@ -124,8 +124,8 @@ export const renameWorkspaceRpc = defineRpc({ name: "follow.rename-workspace", i
124
124
  export const usageRpc = defineRpc({ name: "follow.usage", input: z.object({}), output: usageSchema });
125
125
  // Trust bypass agents: how many permission prompts were approved today, and the newest few (tool and a short summary).
126
126
  export const trustBypassRpc = defineRpc({ name: "follow.trust-bypass", input: z.object({}), output: z.object({ today: z.number().int().nonnegative(), recent: z.array(z.object({ at: z.string(), agentId: z.string(), tool: z.string(), summary: z.string(), mode: z.string() })).max(20) }) });
127
- export const refineTasksRpc = defineRpc({ name: "follow.refine-tasks", input: z.object({ workspaceId: idSchema, tasks: z.array(z.object({ id: idSchema, title: textSchema, afterPrs: z.array(idSchema), dependencyStage: z.enum(["merged", "deployed"]), enable_follow_up: z.boolean(), communication: communicationSchema.optional(), trigger: taskTriggerSchema.nullable().optional() })).max(SCALE.perWorkspace) }), output: workspaceSchema });
128
- export const taskTriggerRpc = defineRpc({ name: "follow.set-task-trigger", input: z.object({ workspaceId: idSchema, obligationId: idSchema, expectedRevision: z.number().int().nonnegative(), trigger: taskTriggerSchema.nullable(), afterPrs: z.array(idSchema) }), output: workspaceSchema });
127
+ export const refineTasksRpc = defineRpc({ name: "follow.refine-tasks", input: z.object({ workspaceId: idSchema, tasks: z.array(z.object({ id: idSchema, title: textSchema, afterPrs: z.array(idSchema), dependencyStage: z.enum(["merged", "deployed"]), enable_follow_up: z.boolean(), communication: communicationSchema.optional(), trigger: taskTriggerInputSchema.nullable().optional() })).max(SCALE.perWorkspace) }), output: workspaceSchema });
128
+ export const taskTriggerRpc = defineRpc({ name: "follow.set-task-trigger", input: z.object({ workspaceId: idSchema, obligationId: idSchema, expectedRevision: z.number().int().nonnegative(), trigger: taskTriggerInputSchema.strict().nullable(), afterPrs: z.array(idSchema) }), output: workspaceSchema });
129
129
 
130
130
  // Narrow integration: no inventory, messages, paths, or credentials cross this RPC.
131
131
  export const prOwnerRpc = defineRpc({ name: "follow.pr-owner", input: z.strictObject({ repo: z.string().regex(/^[\w.-]+\/[\w.-]+$/), number: z.number().int().positive() }), output: z.object({ owner: z.object({ workspaceId: idSchema, agentId: idSchema }).nullable() }) });
@@ -0,0 +1,2 @@
1
+ /** Shared by the worker and the generated standalone bridge. */
2
+ export function daemonUrl(config: { daemon?: { listen?: string } }, override?: string): string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * One config-to-URL rule for the worker and standalone bridge (inlined by scripts/build.mjs).
3
+ * Match Paseo's getMainListenAddress: socket/pipe paths are literal; TCP lists use the trimmed first entry.
4
+ */
5
+ export function daemonUrl(config, override) {
6
+ if (override) return override;
7
+ const listen = config.daemon?.listen ?? "127.0.0.1:6767";
8
+ if (listen.startsWith("pipe://") || listen.startsWith("unix://")) return `ws+unix://${listen.slice(7)}:/ws`;
9
+ if (listen.startsWith("\\\\.\\pipe\\") || listen.startsWith("/") || listen.startsWith("~")) return `ws+unix://${listen}:/ws`;
10
+ const main = listen.split(",", 1)[0].trim();
11
+ return `ws://${/^\d+$/.test(main) ? `127.0.0.1:${main}` : main}/ws`;
12
+ }
package/shared/queue.ts CHANGED
@@ -10,7 +10,7 @@ import { imageRefSchema, MAX_IMAGES } from "./images";
10
10
  * runs the prompt (agent-manager recordSubmittedPrompt). So a send that left without a confirmation is never resent
11
11
  * blind: the agent's chat is read for it first.
12
12
  */
13
- export const QUEUE_KINDS = ["answer", "brief", "repair", "recovery", "message", "checks"] as const;
13
+ export const QUEUE_KINDS = ["answer", "brief", "repair", "recovery", "message", "checks", "scheduled"] as const;
14
14
  export type QueueKind = typeof QUEUE_KINDS[number];
15
15
 
16
16
  /**
@@ -2,6 +2,7 @@ import type { Obligation, Workspace } from "./model";
2
2
  import type { ListObligation, ListWorkspace } from "./list";
3
3
  import { deployState } from "./follow-up";
4
4
  import { blockedOnDeveloper, waitsOnDeveloper } from "./questions";
5
+ import { pendingAt } from "./task-trigger";
5
6
 
6
7
  // ---------- due by fact (invariant due-by-fact) ----------
7
8
  //
@@ -55,7 +56,8 @@ type Questions = Pick<ListWorkspace, "questions">["questions"];
55
56
  export function dueApplies(o: Pick<Obligation, "status" | "ask" | "coveredBy" | "enable_follow_up" | "trigger">, questions: Questions): boolean {
56
57
  if (o.status === "done" || o.status === "waived") return false;
57
58
  if (waitsOnDeveloper(o, questions)) return false;
58
- return !(o.enable_follow_up && o.trigger);
59
+ // An at trigger that went out (or couldn't) hands the task back to due by fact: the agent heard, and its re-check stands.
60
+ return !(o.enable_follow_up && o.trigger) || o.trigger.event === "at" && !pendingAt(o.trigger);
59
61
  }
60
62
 
61
63
  /**