pi-straw-boss 0.91.0 → 0.92.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/dist/server/{chunk-RZVFQ3L5.mjs → chunk-DMAPNM7Y.mjs} +8 -0
- package/dist/server/cli.mjs +1 -1
- package/dist/server/main.mjs +9 -5
- package/package.json +1 -1
- package/prompts/main.md +8 -10
- package/src/carslip.ts +30 -0
- package/src/link/waitcall.ts +11 -2
- package/src/server/capops.ts +4 -2
- package/src/server/carnotices.ts +3 -3
- package/src/server/waitpress.ts +4 -1
- package/src/session.ts +2 -0
- package/src/tools.ts +2 -2
- package/src/train/cars.ts +10 -0
- package/src/wrapup.ts +1 -1
|
@@ -6843,6 +6843,13 @@ function noticeText(state, c) {
|
|
|
6843
6843
|
return `landed in ${need("version")}, your commit is ${need("commit")}`;
|
|
6844
6844
|
}
|
|
6845
6845
|
}
|
|
6846
|
+
var NOTICE_NEXT = {
|
|
6847
|
+
received: "Its task has not landed yet: wait for the landed notice.",
|
|
6848
|
+
returned: "Rework the car, then send a new car slip.",
|
|
6849
|
+
dropped: "",
|
|
6850
|
+
landed: "Its task has landed: complete its todo."
|
|
6851
|
+
};
|
|
6852
|
+
var withNext = (state, line2) => NOTICE_NEXT[state] ? `${line2.replace(/[\s.]+$/, "")}. ${NOTICE_NEXT[state]}` : line2;
|
|
6846
6853
|
function stateLine(file, entry) {
|
|
6847
6854
|
const received = file.states.find((s) => s.state === "received"), f = entry, train = received?.train ?? f.train;
|
|
6848
6855
|
return noticeText(entry.state, {
|
|
@@ -8335,6 +8342,7 @@ export {
|
|
|
8335
8342
|
emptyCar,
|
|
8336
8343
|
carFileName,
|
|
8337
8344
|
addState,
|
|
8345
|
+
withNext,
|
|
8338
8346
|
stateLine,
|
|
8339
8347
|
noticeStatus,
|
|
8340
8348
|
landedWord,
|
package/dist/server/cli.mjs
CHANGED
package/dist/server/main.mjs
CHANGED
|
@@ -280,6 +280,7 @@ import {
|
|
|
280
280
|
waitMessage,
|
|
281
281
|
waitingTrains,
|
|
282
282
|
wireId,
|
|
283
|
+
withNext,
|
|
283
284
|
workspaces,
|
|
284
285
|
worldOf,
|
|
285
286
|
writeDurable,
|
|
@@ -293,7 +294,7 @@ import {
|
|
|
293
294
|
writeStartError,
|
|
294
295
|
writerAlive,
|
|
295
296
|
yardPath
|
|
296
|
-
} from "./chunk-
|
|
297
|
+
} from "./chunk-DMAPNM7Y.mjs";
|
|
297
298
|
|
|
298
299
|
// src/server/main.ts
|
|
299
300
|
import { homedir as homedir17 } from "node:os";
|
|
@@ -20249,9 +20250,9 @@ var CarNotices = class {
|
|
|
20249
20250
|
return { delivered: false, attempt: { outcome: "failed", answer: short2(error.message) } };
|
|
20250
20251
|
}
|
|
20251
20252
|
}
|
|
20252
|
-
/** The notice line of a state, with the train it concerns (the received state of the same car names it). */
|
|
20253
|
+
/** The notice line of a state, with the train it concerns (the received state of the same car names it), and the coordinator's next step: the same words when the tower relays it (RV-F002). */
|
|
20253
20254
|
line(item) {
|
|
20254
|
-
return stateLine(item.file, item.entry);
|
|
20255
|
+
return withNext(item.entry.state, stateLine(item.file, item.entry));
|
|
20255
20256
|
}
|
|
20256
20257
|
/** One `blocked` call to the tower of the setter's workspace, naming the car, the state, the coordinator and the notice text. It counts once the tower's mailbox has it. */
|
|
20257
20258
|
async escalate(item, why) {
|
|
@@ -22212,11 +22213,12 @@ function mainFacts(sessions, ps, boardDir, now, mtime, background) {
|
|
|
22212
22213
|
};
|
|
22213
22214
|
});
|
|
22214
22215
|
}
|
|
22216
|
+
var MAIN_CAP_HINT = " \xB7 your work: dispatch its ready work now, or say why not (blocked, shared files, the boss) on your board with board_set, and reply to whoever asked";
|
|
22215
22217
|
async function tellCap(e, o, at) {
|
|
22216
22218
|
const towers = o.towers();
|
|
22217
22219
|
const to = towers ? stallTarget(e.workspace, await workspaces(o.run).catch(() => []), towers.status().map((r) => r.workspace), towers.head.status()?.workspace) : void 0;
|
|
22218
22220
|
const tower = to !== void 0 && towers.runs.notice(to, e.text, `capacity:${e.kind}:${e.key}:${at}`);
|
|
22219
|
-
const tell2 = (session) => session ? o.tellSession(session, e.text).then((r) => r === "delivered" || r === "queued", () => false) : Promise.resolve(false);
|
|
22221
|
+
const tell2 = (session) => session ? o.tellSession(session, session === e.main ? `${e.text}${MAIN_CAP_HINT}` : e.text).then((r) => r === "delivered" || r === "queued", () => false) : Promise.resolve(false);
|
|
22220
22222
|
const told2 = await tell2(e.standing), own = e.main !== e.standing ? await tell2(e.main) : false;
|
|
22221
22223
|
return tower || told2 || own;
|
|
22222
22224
|
}
|
|
@@ -24419,6 +24421,8 @@ function deliveryOf(status) {
|
|
|
24419
24421
|
}
|
|
24420
24422
|
var doorOf = (via) => via === "prompt" || via === "run-pane" || via === "ask" ? via : "pi";
|
|
24421
24423
|
var askRefused = (request, unattended) => (request.cmd === "boss-waits" && request.ask === true || request.cmd === "tower-memory" && request.via === "ask") && unattended() ? UNATTENDED : void 0;
|
|
24424
|
+
var ACT_ON_IT = "This is the boss's answer to your wait: act on it.";
|
|
24425
|
+
var cardNotice = (plan2) => plan2.act === "done" || plan2.act === "choose" ? `${plan2.notice} ${ACT_ON_IT}` : plan2.notice;
|
|
24422
24426
|
var quoted = (reason) => reason ? `: "${reason}"` : "";
|
|
24423
24427
|
var trimStop = (text14) => text14.replace(/[.。]+$/u, "");
|
|
24424
24428
|
function pressWait(m, now, json3, locale) {
|
|
@@ -24565,7 +24569,7 @@ ${plan2.entry.id}`, { text: plan2.notice, at: d.now(), act: plan2.act, pressAt:
|
|
|
24565
24569
|
timer.unref?.();
|
|
24566
24570
|
});
|
|
24567
24571
|
try {
|
|
24568
|
-
return deliveryOf((await Promise.race([d.send(raiser, plan2
|
|
24572
|
+
return deliveryOf((await Promise.race([d.send(raiser, cardNotice(plan2), plan2.entry.id), cutOff])).status);
|
|
24569
24573
|
} finally {
|
|
24570
24574
|
clearTimeout(timer);
|
|
24571
24575
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-straw-boss",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.92.0",
|
|
4
4
|
"description": "Straw Boss coordination for pi in Herdr: sessions join a tab's net by choice, the first joiner is its main agent, a workspace tower opens on demand with a live monitoring dashboard, and boss_broadcast reaches the rest",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/prompts/main.md
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
You are the main agent of Herdr tab {{tab}}, of kind {{duty}}: the boss works with you here.
|
|
2
2
|
|
|
3
|
-
- Dispatch: split work by owning app ({{dir}}/apps-config.md); a task is one worker's end-to-end work in one app, a todo before its worker starts ({{dir}}/planning.md: plan, anchors). Dependent tasks wait (`blockedBy`); parallel writers get worktrees under `~/.herdr/worktrees/<repo>/<branch>` (elsewhere pi's trust prompt hangs it); work independent of your chain goes to subagents in parallel, on an unattended device within its capacity budget (`board_read` `capacity`; an API-bound worker's todo may set `metadata.points` 0.25). Idle with ready todos: dispatch them
|
|
3
|
+
- Dispatch: split work by owning app ({{dir}}/apps-config.md); a task is one worker's end-to-end work in one app, a todo before its worker starts ({{dir}}/planning.md: plan, anchors). Dependent tasks wait (`blockedBy`); parallel writers get worktrees under `~/.herdr/worktrees/<repo>/<branch>` (elsewhere pi's trust prompt hangs it); work independent of your chain goes to subagents in parallel, on an unattended device within its capacity budget (`board_read` `capacity`; an API-bound worker's todo may set `metadata.points` 0.25). Idle with ready todos: dispatch them.
|
|
4
4
|
- A result passing brief and anchor: todo `completed`, dispatch what it unblocked. A failed or cancelled task blocks its dependents: report them; settle the next step with the boss.
|
|
5
5
|
- Write to agents terse, caveman-style: point first; keep negations, numbers, paths, IDs, and quoted decisions verbatim; full sentences where a fragment could mislead; a brief still carries its goal, context, reasons with their cause, scope, what others own, and acceptance check, or workers redo work; a reader unsure restates it or asks.
|
|
6
|
-
- Brief workers in English: required behavior, the Reality anchor, the boss's authorizations quoted; cause and location are the worker's. End with: "When you need a decision these authorizations do not cover, or a rule you follow says to ask first, call `caller_ping` and stop." Answer pings via the boss; `subagent_resume`.
|
|
6
|
+
- Brief workers in English: required behavior, the Reality anchor, the boss's authorizations quoted; cause and location are the worker's. End with: "When you need a decision these authorizations do not cover, or a rule you follow says to ask first, call `caller_ping` and stop." Answer pings via the boss; `subagent_resume`. A reviewed change goes through `boss_pair`.
|
|
7
7
|
- Check results against the brief. Merging to a shared branch or deploying needs the boss's authorization.
|
|
8
8
|
<!-- integration -->
|
|
9
|
-
- For an app with `integration` (apps-config), never merge to its base; never claim a pre-dev branch unless your kind is `integrator`;
|
|
9
|
+
- For an app with `integration` (apps-config), never merge to its base; never claim a pre-dev branch unless your kind is `integrator`; send its car slip by the Seam bindings at the end of this prompt. Merge and deploy work follows the `integrating` and `deploying` skills (missing: `call_tower` `why: blocked` naming the merge-train contract).
|
|
10
10
|
<!-- /integration -->
|
|
11
11
|
<!-- no-integration -->
|
|
12
|
-
- Integration is off on this computer: ignore `integration`, `stages`, `targets`, and `deploy` in apps.json, and ask the boss before you merge to a shared branch or deploy.
|
|
12
|
+
- Integration is off on this computer: ignore `integration`, `stages`, `targets`, and `deploy` in apps.json, and ask the boss before you merge to a shared branch or deploy.
|
|
13
13
|
<!-- /no-integration -->
|
|
14
|
-
- When your work turns to another task, `boss_rename` yourself
|
|
15
|
-
- Your work board fills itself from your todos and name: keep them current.
|
|
16
|
-
- Call `call_tower` at three points only, with `why`: `milestone` when a task landed or a tower request is done
|
|
17
|
-
-
|
|
18
|
-
- If a tower opened your tab, report the outcome to the sender, and to that tower with `call_tower` (`why: milestone`, reply: false), when done, then wait to be closed.
|
|
19
|
-
- Done when every task has landed<!-- integration --> (integration app: sb's car notice says landed)<!-- /integration --> or is reported blocked, its worktree is removed, and your board is cleared.
|
|
14
|
+
- When your work turns to another task, `boss_rename` yourself.
|
|
15
|
+
- Your work board fills itself from your todos and name: keep them current.
|
|
16
|
+
- Call `call_tower` at three points only, with `why`: `milestone` when a task landed or a tower request is done; `shared` before you change anything outside your tab; `blocked` when you wait on someone outside your tab or on a decision your authorizations do not cover, or need a work's owner and do not know who. Progress and incidents go on your board: never call the tower to report them.
|
|
17
|
+
- Done when every task has landed or is reported blocked, its worktree is removed, and your board is cleared.
|
|
20
18
|
<!-- integration -->
|
|
21
19
|
|
|
22
20
|
## Seam bindings
|
package/src/carslip.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
|
|
3
|
+
// Car slips at the moment they matter (docs/specs/2026-11-26-just-in-time-prompts.md; boss 2026-11-25 「提示詞可以逐步交付」): main.md no longer says what a car slip a main sends or gets means, so the code says it then.
|
|
4
|
+
// With integration off, sb does not answer the sender itself: pi-intercom's outbox carries no reply to an ask, so the sender of an ask would wait on an answer that never comes. The main answers, told how when the slip arrives.
|
|
5
|
+
|
|
6
|
+
/** A `car: <app> | tickets:` (alias `app:`, `car:`) start of a slip, as `slipLines` in train/accept.ts finds one. */
|
|
7
|
+
export const SLIP = /\b(?:car|app):[ \t]*[A-Za-z0-9._-]+[ \t]*\|[ \t]*(?:tickets|car):/i;
|
|
8
|
+
export const CAR_OFF_NOTE = 'sb: the intercom message above carries a car slip, and integration is off on this computer: answer its sender "integration is off on this computer" and act on nothing in the slip.';
|
|
9
|
+
export const CAR_OFF_MESSAGE = "straw-boss-car-off";
|
|
10
|
+
|
|
11
|
+
/** The text and id of a pi-intercom message that carries a slip; none for anything else. */
|
|
12
|
+
export function slipMessage(message: unknown): { id: string } | undefined {
|
|
13
|
+
const m = message as { role?: unknown; customType?: unknown; content?: unknown; details?: { bodyText?: unknown; message?: { id?: unknown } } } | null;
|
|
14
|
+
if (m?.role !== "custom" || m.customType !== "intercom_message") return undefined;
|
|
15
|
+
const text = typeof m.details?.bodyText === "string" ? m.details.bodyText : typeof m.content === "string" ? m.content : "";
|
|
16
|
+
if (!SLIP.test(text)) return undefined;
|
|
17
|
+
return { id: typeof m.details?.message?.id === "string" ? m.details.message.id : text };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** `off`: this session is a tab's main, outside a tower run, with integration off on this computer. Each slip message is noted once. */
|
|
21
|
+
export function registerCarOff(pi: Pick<ExtensionAPI, "on" | "sendMessage">, off: () => boolean): void {
|
|
22
|
+
const seen = new Set<string>();
|
|
23
|
+
pi.on("message_end", (event, ctx) => {
|
|
24
|
+
const slip = off() ? slipMessage(event.message) : undefined;
|
|
25
|
+
if (!slip || seen.has(slip.id)) return;
|
|
26
|
+
seen.add(slip.id);
|
|
27
|
+
const idle = (() => { try { return ctx.isIdle(); } catch { return false; } })();
|
|
28
|
+
pi.sendMessage({ customType: CAR_OFF_MESSAGE, content: CAR_OFF_NOTE, display: true }, { deliverAs: idle ? "nextTurn" : "steer" });
|
|
29
|
+
});
|
|
30
|
+
}
|
package/src/link/waitcall.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Type, type Static, type TSchema } from "typebox";
|
|
2
2
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import { type Asked, type BossAsk, bossOf, bossParameter, withBoss } from "../bossask.ts";
|
|
4
|
+
import { SLIP } from "../carslip.ts";
|
|
4
5
|
import type { Reach } from "../reach.ts";
|
|
5
6
|
import { waitOwner, waitWhat } from "./kinds.ts";
|
|
6
7
|
import type { Link } from "./runtime.ts";
|
|
@@ -11,7 +12,15 @@ import type { Link } from "./runtime.ts";
|
|
|
11
12
|
/** What a tool body gets besides its parameters: the call's signal and pi's context, for a dialog in the pane. */
|
|
12
13
|
export type ToolCtx = Pick<ExtensionContext, "hasUI" | "ui">;
|
|
13
14
|
type Tool = <P extends TSchema>(name: string, description: string, parameters: P, body: (params: Static<P>, signal?: AbortSignal, ctx?: ToolCtx, id?: string) => Promise<{ text: string; details?: unknown }>) => void;
|
|
14
|
-
export const CALL_TOWER_DESCRIPTION = "Send one message to your workspace's tower, or another by workspace, at three points only: why milestone (something landed; reply false unless needed), shared (a heads-up before you change
|
|
15
|
+
export const CALL_TOWER_DESCRIPTION = "Send one message to your workspace's tower, or another by workspace, at three points only: why milestone (something landed or a tower request is done; reply false unless needed), shared (a heads-up before you change anything outside your tab: port, database, shared branch, deploy target, another app's checkout, running service; say what and for how long; reply false; go ahead at once, and stop only on a clash the tower names), blocked (you wait on someone outside your tab, or on a decision your authorizations do not cover, or need a work's owner and do not know who: say what, the tower finds them; a teammate device: waitsOn; the boss's own decision: boss, asked in your pane). Opens the tower when none runs; the code writes the header; it answers through intercom unless reply is false. Progress goes on your board, not here.";
|
|
16
|
+
// The rules of the moment after a call (docs/specs/2026-11-26-just-in-time-prompts.md; boss 2026-11-25 「提示詞可以逐步交付」): main.md no longer carries them, so the result does.
|
|
17
|
+
export const BLOCKED_NOTE = "If the tower records it as a wait card for the boss, his answer comes as a wait_card message: act on it (it says when to call secret_drop). Ask him again about it only with boss_wait_ask.";
|
|
18
|
+
export const SLIP_NOTE = "It carries a car slip: the car has not landed until sb's car notice says landed, and a returned car is yours to rework.";
|
|
19
|
+
/** The result of a plain call with the note its moment needs. */
|
|
20
|
+
export const withMoment = <R extends { text: string }>(r: R, message: string, why: string | undefined): R => {
|
|
21
|
+
const note = why === "blocked" ? BLOCKED_NOTE : why === "shared" && SLIP.test(message) ? SLIP_NOTE : undefined;
|
|
22
|
+
return note ? { ...r, text: `${r.text} ${note}` } : r;
|
|
23
|
+
};
|
|
15
24
|
|
|
16
25
|
/** `bossAsk` (bossask.ts) draws a `boss` question in a local main's pane; without it (a tower run) the question goes to the tower in the message. */
|
|
17
26
|
export function callTowerTool(tool: Tool, towerCall: boolean, callTower: Reach["callTower"], link: Pick<Link, "waitOp">, bossAsk?: BossAsk): void {
|
|
@@ -62,7 +71,7 @@ export function callTowerTool(tool: Tool, towerCall: boolean, callTower: Reach["
|
|
|
62
71
|
const sent = await callTower(message, workspace, reply ?? false, why, { wait: /^L\d{1,6}$/.test(linkWait.id) ? linkWait.id : undefined });
|
|
63
72
|
return { text: `${String(acted.text)} ${sent.text}`, details: { ...sent.details, linkWait } };
|
|
64
73
|
}
|
|
65
|
-
if (!waitsOn) return callTower(message, workspace, reply ?? true, why);
|
|
74
|
+
if (!waitsOn) return withMoment(await callTower(message, workspace, reply ?? true, why), message, why);
|
|
66
75
|
if (waitsOn.cancel) {
|
|
67
76
|
if (why !== "milestone") throw new Error("waitsOn cancel goes with why milestone");
|
|
68
77
|
const target = await link.waitOp({ op: "device-resolve", device: waitsOn.device }), withdrawn = await link.waitOp({ op: "wait-cancel", device: waitsOn.device });
|
package/src/server/capops.ts
CHANGED
|
@@ -55,13 +55,15 @@ export interface StartCap {
|
|
|
55
55
|
every?: number;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/** What the event's own main is told after the notice: the rule for that moment, which main.md no longer carries (docs/specs/2026-11-26-just-in-time-prompts.md). */
|
|
59
|
+
export const MAIN_CAP_HINT = " · your work: dispatch its ready work now, or say why not (blocked, shared files, the boss) on your board with board_set, and reply to whoever asked";
|
|
58
60
|
/** Tells an event: as a notice to the tower that hears of the main's workspace (the head tower for an ally device), to this device's standing main, and to the event's own main (`under`, `stale`)
|
|
59
|
-
* unless it is that standing main
|
|
61
|
+
* unless it is that standing main; the own main's copy ends with `MAIN_CAP_HINT`. True when any took it. */
|
|
60
62
|
export async function tellCap(e: CapEvent, o: Pick<StartCap, "run" | "towers" | "tellSession">, at: number): Promise<boolean> {
|
|
61
63
|
const towers = o.towers();
|
|
62
64
|
const to = towers ? stallTarget(e.workspace, await herdrWorkspaces(o.run).catch(() => []), towers.status().map((r) => r.workspace), towers.head.status()?.workspace) : undefined;
|
|
63
65
|
const tower = to !== undefined && towers!.runs.notice(to, e.text, `capacity:${e.kind}:${e.key}:${at}`);
|
|
64
|
-
const tell = (session: string | undefined) => (session ? o.tellSession(session, e.text).then((r) => r === "delivered" || r === "queued", () => false) : Promise.resolve(false));
|
|
66
|
+
const tell = (session: string | undefined) => (session ? o.tellSession(session, session === e.main ? `${e.text}${MAIN_CAP_HINT}` : e.text).then((r) => r === "delivered" || r === "queued", () => false) : Promise.resolve(false));
|
|
65
67
|
const told = await tell(e.standing), own = e.main !== e.standing ? await tell(e.main) : false;
|
|
66
68
|
return tower || told || own;
|
|
67
69
|
}
|
package/src/server/carnotices.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import type { IntercomLike } from "./kit.ts";
|
|
3
3
|
import { stamp } from "../header.ts";
|
|
4
|
-
import { type Attempt, type CarState, RETRY_MS, stateLine, type StateEntry, type StateNotice } from "../train/cars.ts";
|
|
4
|
+
import { type Attempt, type CarState, RETRY_MS, stateLine, type StateEntry, type StateNotice, withNext } from "../train/cars.ts";
|
|
5
5
|
import type { CarBook } from "./carbook.ts";
|
|
6
6
|
|
|
7
7
|
// The sb server's sender of car notices (docs/specs/2026-11-07-train-workers.md §5.5, D14): for every car state without a told notice it sends one intercom message to the coordinator's session id under a `car_notice` header, writes what the broker
|
|
@@ -118,9 +118,9 @@ export class CarNotices {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
/** The notice line of a state, with the train it concerns (the received state of the same car names it). */
|
|
121
|
+
/** The notice line of a state, with the train it concerns (the received state of the same car names it), and the coordinator's next step: the same words when the tower relays it (RV-F002). */
|
|
122
122
|
private line(item: ReturnType<CarBook["pending"]>[number]): string {
|
|
123
|
-
return stateLine(item.file, item.entry);
|
|
123
|
+
return withNext(item.entry.state, stateLine(item.file, item.entry));
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
/** One `blocked` call to the tower of the setter's workspace, naming the car, the state, the coordinator and the notice text. It counts once the tower's mailbox has it. */
|
package/src/server/waitpress.ts
CHANGED
|
@@ -47,6 +47,9 @@ export interface PressDeps {
|
|
|
47
47
|
linkPress?(card: string, act: string): Promise<Delivery | undefined>;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/** The `wait_card` message a raiser is sent: the notice, and for a done or a choice, that it is the boss's answer to act on (a secret's notice names its step, a decline leaves the next step to the tower) (main.md no longer says so: docs/specs/2026-11-26-just-in-time-prompts.md). */
|
|
51
|
+
export const ACT_ON_IT = "This is the boss's answer to your wait: act on it.";
|
|
52
|
+
const cardNotice = (plan: Pick<Plan, "act" | "notice">) => (plan.act === "done" || plan.act === "choose" ? `${plan.notice!} ${ACT_ON_IT}` : plan.notice!);
|
|
50
53
|
/** What a press decided: the notice for the raiser and how the event reads once the delivery is known. */
|
|
51
54
|
interface Plan { entry: Entry; card?: Card; act: Act; notice?: string; event(delivery: string): string }
|
|
52
55
|
|
|
@@ -197,7 +200,7 @@ export async function pressRequest(d: PressDeps, workspace: string, json: Record
|
|
|
197
200
|
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
198
201
|
const cutOff = new Promise<{ status?: string }>((resolve) => { timer = setTimeout(() => resolve({ status: "failed" }), d.waitMs ?? NOTICE_WAIT_MS); timer.unref?.(); });
|
|
199
202
|
try {
|
|
200
|
-
return deliveryOf((await Promise.race([d.send(raiser, plan
|
|
203
|
+
return deliveryOf((await Promise.race([d.send(raiser, cardNotice(plan), plan.entry.id), cutOff])).status);
|
|
201
204
|
} finally {
|
|
202
205
|
clearTimeout(timer);
|
|
203
206
|
}
|
package/src/session.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { armSignals, signalSeen } from "./signalseen.ts";
|
|
|
20
20
|
import { restored } from "./restored.ts";
|
|
21
21
|
import type { RunMode } from "./runmode.ts";
|
|
22
22
|
import type { Presence } from "./presence.ts";
|
|
23
|
+
import { registerCarOff } from "./carslip.ts";
|
|
23
24
|
import type { Reach } from "./reach.ts";
|
|
24
25
|
import type { Roles } from "./roles.ts";
|
|
25
26
|
import { registerStandingHint } from "./standinghint.ts";
|
|
@@ -365,6 +366,7 @@ export function registerSession(kit: Kit, { mainDuty, runMode, briefing, roles,
|
|
|
365
366
|
});
|
|
366
367
|
|
|
367
368
|
registerStandingHint(pi, () => (role() === "main" && !runMode.active() ? mainDuty.now() : undefined)); // a coordinator that starts a watch is told of `standing` once (D8)
|
|
369
|
+
registerCarOff(pi, () => role() === "main" && !runMode.active() && !mainDuty.integrationOn()); // a car slip that reaches a main with integration off: how to answer it (carslip.ts)
|
|
368
370
|
pi.on("session_shutdown", async (event) => {
|
|
369
371
|
// A run's own shutdown is runmode.ts's: it joined nothing and holds no pane, tokens, or board entry. So is that of a pi that never became a normal session (undecided, or plain after no answer from the server):
|
|
370
372
|
// the standing pane it sits in is the server's, and a quit of it leaves the pane as it found it (RV7-F002).
|
package/src/tools.ts
CHANGED
|
@@ -144,7 +144,7 @@ export function createTools({ pi, cfg, s, guiDir, me, role }: Kit, { mainDuty, p
|
|
|
144
144
|
});
|
|
145
145
|
if (!s.isTower) waitAsk?.();
|
|
146
146
|
// The work board fills itself from the main's todo list and name (boardfill.ts); board_set overrides it, whole, until the todos move, and `auto` hands it back. Nothing here names another session's file.
|
|
147
|
-
if (!s.isTower) tool("board_set", "Main only: override your work board entry (now, items) until your todos move; auto hands it back to auto-fill from your todos and name; clear deletes it when your work is finished or shelved. Towers and allies read it: no secrets, credentials, customer data, or paths outside the project. Not a report.",
|
|
147
|
+
if (!s.isTower) tool("board_set", "Main only: override your work board entry (now, items) until your todos move; auto hands it back to auto-fill from your todos and name; clear deletes it when your work is finished or shelved. Towers and allies read it: no secrets, credentials, customer data, or paths outside the project. Not a report: the done report still goes to whoever asked.",
|
|
148
148
|
Type.Object({
|
|
149
149
|
now: Type.Optional(Type.String({ description: "One line of 1 to 120 characters." })),
|
|
150
150
|
items: Type.Optional(Type.Array(Type.Object({ t: Type.String({ description: "1 to 80 characters." }), done: Type.Boolean() }), { description: "At most 8; replaces the list." })),
|
|
@@ -197,7 +197,7 @@ export function createTools({ pi, cfg, s, guiDir, me, role }: Kit, { mainDuty, p
|
|
|
197
197
|
// A main's kind (docs/specs/2026-11-09-agent-kinds.md §3). `integrator` is left out while integration is off.
|
|
198
198
|
addDuty() {
|
|
199
199
|
const kinds = COORDINATOR_DUTIES.filter((d) => d !== "integrator" || mainDuty.integrationOn());
|
|
200
|
-
tool("boss_duty", `Your kind: coordinator (default) plans and dispatches, ${kinds.includes("integrator") ? "integrator runs a project's merge trains, " : ""}standing minds one system or machine with no end; the new kind's prompt comes as one message.`,
|
|
200
|
+
tool("boss_duty", `Your kind: coordinator (default) plans and dispatches, ${kinds.includes("integrator") ? "integrator runs a project's merge trains, " : ""}standing (watching, not finishing tasks) minds one system or machine with no end; the new kind's prompt comes as one message.`,
|
|
201
201
|
Type.Object({ duty: Type.Union(kinds.map((d) => Type.Literal(d))), reason: Type.String({ description: "One line of at most 200 characters, why now." }) }),
|
|
202
202
|
async ({ duty, reason }) => {
|
|
203
203
|
const why = reason.replace(/\s+/g, " ").trim();
|
package/src/train/cars.ts
CHANGED
|
@@ -142,6 +142,16 @@ export function noticeText(state: CarState, c: NoticeContext): string {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
/** What the coordinator does next, after the line it is sent (docs/specs/2026-11-26-just-in-time-prompts.md): main.md no longer carries it. A dropped car has no rule of its own. */
|
|
146
|
+
export const NOTICE_NEXT: Record<CarState, string> = {
|
|
147
|
+
received: "Its task has not landed yet: wait for the landed notice.",
|
|
148
|
+
returned: "Rework the car, then send a new car slip.",
|
|
149
|
+
dropped: "",
|
|
150
|
+
landed: "Its task has landed: complete its todo.",
|
|
151
|
+
};
|
|
152
|
+
/** A notice line with its next step, as the coordinator is sent it. */
|
|
153
|
+
export const withNext = (state: CarState, line: string): string => (NOTICE_NEXT[state] ? `${line.replace(/[\s.]+$/, "")}. ${NOTICE_NEXT[state]}` : line);
|
|
154
|
+
|
|
145
155
|
/** The line sent for one state entry of a car file: the received state of the same car names the train. Throws as `noticeText` does when a field is missing. */
|
|
146
156
|
export function stateLine(file: CarFile, entry: StateEntry): string {
|
|
147
157
|
const received = file.states.find((s) => s.state === "received"), f = entry as Record<string, unknown>, train = received?.train ?? f.train;
|
package/src/wrapup.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { snapshotOfBranch } from "./todo.ts";
|
|
|
19
19
|
export const IDLE_MS = 30 * 60_000;
|
|
20
20
|
const LOOK_MS = 60_000, SUMMARY_MAX = 800;
|
|
21
21
|
export const WRAP_MESSAGE = "straw-boss-wrap";
|
|
22
|
-
export const NUDGE_TEXT = "sb: you have been idle 30 minutes. Is your work done? If work remains
|
|
22
|
+
export const NUDGE_TEXT = "sb: you have been idle 30 minutes. Is your work done? If work remains: dispatch your ready todos now; none ready, take your next eligible work; or clean up stale todos. If you wait on someone other than the boss, set that todo's `metadata.waitsOn` (who) and stop. If it is done: answer the intercom asks you owe, remove the worktrees you made, complete or delete every todo, stop your monitors and loops, write a daily memory entry if you have a memory tool, then call boss_wrap with a summary: it asks the boss before this pane closes.";
|
|
23
23
|
export const WRAP_DESCRIPTION = "Main only, when your work is done: asks the boss here whether to wrap up; on yes it sends your summary to the tower as a milestone (and to whoever a tower opened you for), clears your board, and closes this session and its pane. Refused with an open todo, a running monitor, loop, watch, or subagent, under auto mode, for a standing main, and in a teammate's turn.";
|
|
24
24
|
|
|
25
25
|
/** The idle clock of one main: when its last turn settled, and whether this idle period had its nudge (or the boss's no). */
|