paseo-follow-up 2.4.2 → 2.5.0
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/CHANGELOG.md +19 -0
- package/client/release-notes.tsx +98 -123
- package/client/tasks.tsx +38 -8
- package/client/updates.tsx +6 -6
- package/index.server.ts +17 -4
- package/package.json +1 -1
- package/server/agent-hook.mjs +1 -1
- package/server/agent-parity.ts +2 -2
- package/server/engine.ts +6 -2
- package/server/hook-source.ts +1 -1
- package/server/mcp-source.ts +3 -3
- package/server/mcp.mjs +3 -3
- package/server/obligations.ts +7 -5
- package/server/release-notes.ts +5 -5
- package/server/scheduled-tasks.ts +92 -0
- package/shared/attention.ts +4 -0
- package/shared/changelog.ts +33 -0
- package/shared/contracts.ts +4 -4
- package/shared/queue.ts +1 -1
- package/shared/task-due.ts +3 -1
- package/shared/task-trigger.ts +125 -1
- package/skills/follow-up/SKILL.md +1 -1
package/shared/task-trigger.ts
CHANGED
|
@@ -3,8 +3,81 @@ import type { ListObligation as Obligation, ListWorkspace as Workspace, ListPr a
|
|
|
3
3
|
import { deployed } from "./follow-up";
|
|
4
4
|
import { dueLabel } from "./task-due";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* A task's trigger: what sends it to its agent as a message. now, merge and deploy join the next message and follow
|
|
8
|
+
* Auto-send; at (a-scheduled-task-arrives-once-at-its-time) is a time someone named, the developer in the sheet or the
|
|
9
|
+
* agent for its own check-back, and goes out once at that time whether Auto-send is on or not (server/scheduled-tasks.ts).
|
|
10
|
+
* `sentAt` (it went out) and `notSent` (why it couldn't: the agent closed or archived) are Follow-up's, never an input.
|
|
11
|
+
*/
|
|
12
|
+
export const TRIGGER_EVENTS = ["now", "merge", "deploy", "at"] as const;
|
|
13
|
+
/** An at trigger is at least a minute out and at most this far: anything later is a re-check day. */
|
|
14
|
+
export const AT_MIN_MS = 60_000;
|
|
15
|
+
export const AT_MAX_DAYS = 30;
|
|
16
|
+
const triggerFields = { event: z.enum(TRIGGER_EVENTS), delayDays: z.number().int().min(0).max(3650).default(0), at: z.string().max(40).optional() };
|
|
17
|
+
export const taskTriggerSchema = z.object({ ...triggerFields, queuedAt: z.string().max(40).optional(), sentAt: z.string().max(40).optional(), notSent: z.string().max(200).optional() });
|
|
7
18
|
export type TaskTrigger = z.infer<typeof taskTriggerSchema>;
|
|
19
|
+
/** What a caller passes: `at` as an ISO time with its offset, or `inMinutes` from now; never sentAt or notSent. */
|
|
20
|
+
export const taskTriggerInputSchema = z.object({ ...triggerFields, inMinutes: z.number().int().min(1).max(AT_MAX_DAYS * 1440).optional() });
|
|
21
|
+
export type TaskTriggerInput = z.infer<typeof taskTriggerInputSchema>;
|
|
22
|
+
const OFFSET = /T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})$/;
|
|
23
|
+
/**
|
|
24
|
+
* The trigger to store for an input: an at trigger's time resolved (inMinutes from `now`), checked and kept in UTC.
|
|
25
|
+
* The same at as `existing` keeps whether it went out, so an ordinary update never sends it twice. Throws a sentence
|
|
26
|
+
* an agent can act on.
|
|
27
|
+
*/
|
|
28
|
+
export function storedTrigger(input: TaskTriggerInput | TaskTrigger | null | undefined, existing: TaskTrigger | null | undefined, now: number): TaskTrigger | null | undefined {
|
|
29
|
+
if (!input) return input;
|
|
30
|
+
const { inMinutes, ...rest } = input as TaskTriggerInput & Partial<Pick<TaskTrigger, "sentAt" | "notSent">>;
|
|
31
|
+
for (const k of ["queuedAt", "sentAt", "notSent"] as const) delete (rest as Partial<TaskTrigger>)[k];
|
|
32
|
+
if (rest.event !== "at") {
|
|
33
|
+
if (rest.at !== undefined || inMinutes !== undefined) throw new Error("at and inMinutes go with event \"at\".");
|
|
34
|
+
return { event: rest.event, delayDays: rest.delayDays ?? 0 };
|
|
35
|
+
}
|
|
36
|
+
// The same time passed back (an update that preserves its trigger) is the stored one, even once it's past or sent.
|
|
37
|
+
if (existing?.event === "at" && existing.at && rest.at !== undefined && Date.parse(rest.at) === Date.parse(existing.at)) return existing;
|
|
38
|
+
if (rest.delayDays) throw new Error("An at trigger has no delayDays: pass the time itself in at, or inMinutes.");
|
|
39
|
+
if ((rest.at === undefined) === (inMinutes === undefined)) throw new Error("An at trigger needs at (an ISO time with its offset, like 2026-11-26T12:15:00+02:00) or inMinutes, not both.");
|
|
40
|
+
const ms = inMinutes !== undefined ? now + inMinutes * 60_000 : OFFSET.test(rest.at!) ? Date.parse(rest.at!) : NaN;
|
|
41
|
+
if (!Number.isFinite(ms)) throw new Error("at is an ISO time with its offset, like 2026-11-26T12:15:00+02:00 or 2026-11-26T10:15:00Z, so the time is never a guess.");
|
|
42
|
+
if (ms < now + AT_MIN_MS - 1_000) throw new Error("That time is already here or past. Pick a time at least a minute out, or use event \"now\".");
|
|
43
|
+
if (ms > now + AT_MAX_DAYS * 86_400_000) throw new Error(`An at trigger is at most ${AT_MAX_DAYS} days out. Use recheck for a later day.`);
|
|
44
|
+
const at = new Date(Math.floor(ms / 1000) * 1000).toISOString();
|
|
45
|
+
return { event: "at", delayDays: 0, at };
|
|
46
|
+
}
|
|
47
|
+
/** An at trigger still waiting to go out: not sent and not refused. */
|
|
48
|
+
export function pendingAt(t: TaskTrigger | null | undefined): t is TaskTrigger & { at: string } { return t?.event === "at" && !!t.at && !t.queuedAt && !t.sentAt && !t.notSent; }
|
|
49
|
+
/** The message an at trigger sends: its header, the time as the agent reads it (ISO with offset) and what to do. */
|
|
50
|
+
export const SCHEDULED_HEADER = "Follow-up scheduled task";
|
|
51
|
+
export function scheduledText(o: Pick<Obligation, "id" | "title" | "evidence">, at: string, now: number): string {
|
|
52
|
+
const late = now - Date.parse(at) > 5 * 60_000 ? ` (late: it went out at ${new Date(now).toISOString()}, after Follow-up was down)` : "";
|
|
53
|
+
const evidence = (o.evidence ?? "").trim();
|
|
54
|
+
return [`${SCHEDULED_HEADER} ${o.id}, set for ${at}${late}: ${o.title}`,
|
|
55
|
+
...(evidence ? [`Where it stood: ${evidence.length > 600 ? `${evidence.slice(0, 600)}…` : evidence}`] : []),
|
|
56
|
+
"Check it now. Close it with update_obligation (status=done with evidence), or set a new time with trigger={event:\"at\", at or inMinutes} and end your turn."].join("\n");
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The time as the developer reads it, in their zone (the device's, where the client draws it): "12:15" today,
|
|
60
|
+
* "tomorrow 09:00", "Nov 28, 09:00". `timeZone` pins it (tests).
|
|
61
|
+
*/
|
|
62
|
+
export function clockLabel(iso: string, now: number, timeZone?: string): string {
|
|
63
|
+
const ms = Date.parse(iso);
|
|
64
|
+
if (!Number.isFinite(ms)) return "";
|
|
65
|
+
const day = (t: number) => new Date(t).toLocaleDateString("en-CA", { timeZone });
|
|
66
|
+
const time = new Date(ms).toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit", hourCycle: "h23", timeZone });
|
|
67
|
+
if (day(ms) === day(now)) return time;
|
|
68
|
+
if (day(ms) === day(now + 86_400_000)) return `tomorrow ${time}`;
|
|
69
|
+
if (day(ms) === day(now - 86_400_000)) return `yesterday ${time}`;
|
|
70
|
+
return `${new Date(ms).toLocaleDateString("en-US", { month: "short", day: "numeric", timeZone })}, ${time}`;
|
|
71
|
+
}
|
|
72
|
+
/** Words a time trigger's row starts with when it couldn't go out: never "Not sent", the sheet's word for no trigger. */
|
|
73
|
+
export const DIDNT_GO_OUT = "Didn't go out";
|
|
74
|
+
/** An at trigger's line on the task row: "Sends 12:15", then "Sent 12:15", or "Didn't go out · the agent was archived". */
|
|
75
|
+
export function atLabel(t: TaskTrigger, now: number, timeZone?: string): string {
|
|
76
|
+
if (t.notSent) return `${DIDNT_GO_OUT} · ${t.notSent}`;
|
|
77
|
+
if (t.sentAt) return `Sent ${clockLabel(t.sentAt, now, timeZone)}`;
|
|
78
|
+
if (t.queuedAt) return `Due ${clockLabel(t.at ?? "", now, timeZone)} · goes when the agent's turn ends`;
|
|
79
|
+
return `Sends ${clockLabel(t.at ?? "", now, timeZone)}`;
|
|
80
|
+
}
|
|
8
81
|
/** A merged PR whose repository has no deploy check here (invariant public-code-carries-no-host-identifiers). */
|
|
9
82
|
export const notSetUpEvidence = (repo: string) => `Deploy check not set up for ${repo}.`;
|
|
10
83
|
const timestamp = (value?: string | null) => value && Number.isFinite(Date.parse(value)) ? Date.parse(value) : null;
|
|
@@ -13,6 +86,8 @@ export function taskSchedule(o: Obligation, w: Workspace, now = Date.now()): { r
|
|
|
13
86
|
// due-by-fact: with no developer timing a task says what moves it ("Due · #231 merged", "After #232 merges",
|
|
14
87
|
// "Re-check Nov 25", "Stale · …"); it is never "Manual".
|
|
15
88
|
if (!o.enable_follow_up || !t) return { ready: false, dueAt: null, label: dueLabel(o, w, now) ?? "Open" };
|
|
89
|
+
// An at trigger isn't a batch: it goes out on its own at its time (server/scheduled-tasks.ts), so it is never "ready".
|
|
90
|
+
if (t.event === "at") return { ready: false, dueAt: pendingAt(t) ? t.at : null, label: atLabel(t, now) };
|
|
16
91
|
if (t.event === "now") return { ready: o.afterPrs.length === 0 && t.delayDays === 0, dueAt: null, label: "Now" };
|
|
17
92
|
const label = `${t.delayDays ? `${t.delayDays}d after ` : "After "}${t.event}`;
|
|
18
93
|
if (!o.afterPrs.length) return { ready: false, dueAt: null, label };
|
|
@@ -26,3 +101,52 @@ export function taskSchedule(o: Obligation, w: Workspace, now = Date.now()): { r
|
|
|
26
101
|
const due = Math.max(...times as number[]) + t.delayDays * 86_400_000;
|
|
27
102
|
return { ready: due <= now, dueAt: new Date(due).toISOString(), label };
|
|
28
103
|
}
|
|
104
|
+
|
|
105
|
+
/** The one line under the sheet's choices: what the selected one does. */
|
|
106
|
+
export const TRIGGER_HELP = {
|
|
107
|
+
manual: "Comes due when its PRs merge or deploy, or on its re-check date; the agent is reminded at the end of its turn.",
|
|
108
|
+
now: "Joins the next message to the agent, and follows your Auto-send choice.",
|
|
109
|
+
at: "Sends once at this time, even with Auto-send off.",
|
|
110
|
+
merge: "Joins the next message once the PRs merge, and follows your Auto-send choice.",
|
|
111
|
+
deploy: "Joins the next message once the PRs deploy, and follows your Auto-send choice.",
|
|
112
|
+
} as const;
|
|
113
|
+
/**
|
|
114
|
+
* The sheet's quick times (client/tasks.tsx, At a time): in 30 minutes, in an hour, tomorrow at 09:00 on the device's
|
|
115
|
+
* clock (the developer's zone). Each is a whole minute.
|
|
116
|
+
*/
|
|
117
|
+
export function atChoices(now: number): { label: string; at: number }[] {
|
|
118
|
+
const minute = (ms: number) => Math.ceil(ms / 60_000) * 60_000;
|
|
119
|
+
const tomorrow = new Date(now); tomorrow.setDate(tomorrow.getDate() + 1); tomorrow.setHours(9, 0, 0, 0);
|
|
120
|
+
return [{ label: "In 30 min", at: minute(now + 30 * 60_000) }, { label: "In 1 hour", at: minute(now + 60 * 60_000) }, { label: "Tomorrow 09:00", at: tomorrow.getTime() }];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A time typed in the sheet, on the device's clock: "2026-11-26 12:15" (or "…T12:15"), or just "14:30", which is today,
|
|
124
|
+
* or tomorrow once today's has passed. Null when it isn't one.
|
|
125
|
+
*/
|
|
126
|
+
export function parseLocalTime(text: string, now: number = Date.now()): number | null {
|
|
127
|
+
const short = /^\s*(\d{1,2}):(\d{2})\s*$/.exec(text);
|
|
128
|
+
if (short) {
|
|
129
|
+
const [h, mi] = short.slice(1).map(Number);
|
|
130
|
+
if (h > 23 || mi > 59) return null;
|
|
131
|
+
const t = new Date(now); t.setHours(h, mi, 0, 0);
|
|
132
|
+
if (t.getTime() <= now) t.setDate(t.getDate() + 1);
|
|
133
|
+
return t.getTime();
|
|
134
|
+
}
|
|
135
|
+
const m = /^\s*(\d{4})-(\d{2})-(\d{2})[ T](\d{1,2}):(\d{2})\s*$/.exec(text);
|
|
136
|
+
if (!m) return null;
|
|
137
|
+
const [y, mo, d, h, mi] = m.slice(1).map(Number);
|
|
138
|
+
const t = new Date(y, mo - 1, d, h, mi, 0, 0);
|
|
139
|
+
return t.getFullYear() === y && t.getMonth() === mo - 1 && t.getDate() === d && t.getHours() === h && t.getMinutes() === mi ? t.getTime() : null;
|
|
140
|
+
}
|
|
141
|
+
/** The same as typed text: what the sheet's field starts with. */
|
|
142
|
+
export function localTimeText(ms: number): string {
|
|
143
|
+
const d = new Date(ms); const p = (n: number) => String(n).padStart(2, "0");
|
|
144
|
+
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
|
145
|
+
}
|
|
146
|
+
/** Why a time can't be saved, in the server's own bounds (storedTrigger), or null. */
|
|
147
|
+
export function atProblem(at: number | null, now: number): string | null {
|
|
148
|
+
if (at === null) return `Write a time like 14:30, or a date and time like ${localTimeText(atChoices(now)[2].at)}.`;
|
|
149
|
+
if (at < now + AT_MIN_MS) return "Pick a time at least a minute from now.";
|
|
150
|
+
if (at > now + AT_MAX_DAYS * 86_400_000) return `Pick a time within ${AT_MAX_DAYS} days.`;
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
@@ -11,7 +11,7 @@ Register every PR this workspace produces with `register_pr` after submission. R
|
|
|
11
11
|
|
|
12
12
|
Maintain this sidebar during normal work without a developer reminder. Before ending a normal turn, reconcile the goal, owned PRs, stack relationships and substantive tasks, then call `sync_workspace` with a concise summary, even if no changes were needed. This confirms bookkeeping only; it never declares Done or starts repair/recovery work. The provider hooks restore these instructions at session start, on each prompt and after compaction, and allow one missed-sync continuation. Never transfer ownership or ask the developer to update the sidebar.
|
|
13
13
|
|
|
14
|
-
Record remaining implementation, decisions, deployment verification, migrations, and other post-merge work using `update_obligation`. Dependencies use `owner/repo#number` keys. Tasks are substantive follow-up, never approve/merge/deploy checklist entries: PRs already track their lifecycle. Use concise action titles, for example "Verify vendor resolution in production", and put dependencies in afterPrs rather than restating the merge steps. 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. Only set a trigger 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. Delivery still respects workspace Auto consent and production permissions. A deploy tag or merged PR alone never establishes deployment. When you end a turn waiting on work Follow-up can't see (a detached release, a reload window, a job that pings you later), declare it as a task with status `waiting` and a title that says what and when ("beta.68 installs in the 11:21 reload window"), then mark it done when the ping arrives: Home lists the workspace under Waiting with that title instead of asking the developer for anything. Record result evidence for done or waived obligations. Preserve fields while updating; leave an obligation blocked when the developer must act.
|
|
14
|
+
Record remaining implementation, decisions, deployment verification, migrations, and other post-merge work using `update_obligation`. Dependencies use `owner/repo#number` keys. Tasks are substantive follow-up, never approve/merge/deploy checklist entries: PRs already track their lifecycle. Use concise action titles, for example "Verify vendor resolution in production", and put dependencies in afterPrs rather than restating the merge steps. 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. Only set a trigger 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; 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. Delivery still respects workspace Auto consent and production permissions. A deploy tag or merged PR alone never establishes deployment. When you end a turn waiting on work Follow-up can't see (a detached release, a reload window, a job that pings you later), declare it as a task with status `waiting` and a title that says what and when ("beta.68 installs in the 11:21 reload window"), with a time trigger when nothing else will ping you, then mark it done when the ping (or the time) arrives: Home lists the workspace under Waiting with that title instead of asking the developer for anything. Record result evidence for done or waived obligations. Preserve fields while updating; leave an obligation blocked when the developer must act.
|
|
15
15
|
|
|
16
16
|
Ask the developer decisions you can't make yourself with `ask_question`: a short title, the question, lettered options A, B, C… each with what it means for them, and `recommend` set to the option you'd pick. Set `big` (a few plain words on why) only when building ahead would send something off this computer, set something people or programs outside the repo rely on, or most of the remaining work would build on the answer. Link the PR or task it is about. The reply states the developer's question mode: Stop (end your turn and wait), Work around (the default: build nothing the answer affects, keep working on the rest) or Keep building (build your recommendation and change course if they pick another; big questions still wait). Follow it exactly. The developer answers in Follow-up and the answer arrives in your chat as `Follow-up answer Q<n> …`, already recorded. If they answer in chat instead, call `record_answer`. Withdraw a question that no longer matters with `withdraw_question`. A task you mark blocked also becomes a question; update the task once the decision arrives.
|
|
17
17
|
|