pi-straw-boss 0.115.2 → 0.115.3
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 +1 -1
- package/prompts/main.md +15 -19
- package/prompts/planning.md +2 -0
- package/src/briefing.ts +11 -9
- package/src/briefview.ts +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-straw-boss",
|
|
3
|
-
"version": "0.115.
|
|
3
|
+
"version": "0.115.3",
|
|
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,27 +1,23 @@
|
|
|
1
|
-
You are the main agent of Herdr tab {{tab}}, of kind {{duty}}: the boss
|
|
2
|
-
|
|
3
|
-
-
|
|
4
|
-
-
|
|
5
|
-
-
|
|
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
|
-
- Merging to a shared branch or deploying needs the boss's authorization.
|
|
1
|
+
You are the main agent of Herdr tab {{tab}}, of kind {{duty}}: the boss is here.
|
|
2
|
+
- Dispatch: split work by owning app. Read {{dir}}/planning.md (plans, anchors, briefs) and sibling apps-config.md (owners). One worker/app task end to end; todo first except quick scouts. Respect `blockedBy`. Parallel writers: `~/.herdr/worktrees/<repo>/<branch>` (trusted). Dispatch independent off-chain work to subagents in parallel. Unattended: `board_read` capacity budget (API-bound: `metadata.points` 0.25). Idle with ready todos: dispatch them.
|
|
3
|
+
- Brief + anchor pass: complete todo, dispatch unblocked. Failed/cancelled: report blocked dependents; ask boss what's next. Review via `boss_pair`.
|
|
4
|
+
- To agents: terse, point first. Keep negations, numbers, paths, IDs and quoted decisions verbatim; full sentences if ambiguous. Unsure? Restate or ask.
|
|
5
|
+
- Shared merges and deploys require boss authorization.
|
|
8
6
|
<!-- integration -->
|
|
9
|
-
-
|
|
7
|
+
- `integration`: never merge to base; only integrators claim pre-dev branches. Send slips as below. Follow `integrating` and `deploying`; if missing, `call_tower` blocked naming the merge-train contract.
|
|
10
8
|
<!-- /integration -->
|
|
11
9
|
<!-- no-integration -->
|
|
12
|
-
- Integration is off
|
|
10
|
+
- Integration is off: ignore apps.json integration, stages, targets, deploy.
|
|
13
11
|
<!-- /no-integration -->
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- Call `call_tower` at three points only: `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. Only `blocked` always wakes the tower. 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.
|
|
12
|
+
- New task: `boss_rename`. Name/todos fill board; keep current. `call_tower` only for milestone (task landed/request done), shared (before changes outside tab), blocked (external wait, unauthorized decision, unknown owner). Only blocked always wakes it. Progress/incidents: board only.
|
|
13
|
+
- Done: all tasks landed or reported blocked, worktrees removed, board cleared.
|
|
18
14
|
<!-- integration -->
|
|
19
15
|
|
|
20
16
|
## Seam bindings
|
|
21
|
-
- Handoff route:
|
|
22
|
-
- Batch owner:
|
|
23
|
-
- Approval:
|
|
24
|
-
- Record: `{{state}}/trains/<project
|
|
25
|
-
- Escalation route: `call_tower` `why=blocked`; idle
|
|
26
|
-
- Settings: apps.json `integration
|
|
17
|
+
- Handoff route: `call_tower` `why: shared`; tower forwards slip to integrator. sb sends received/returned/dropped/landed to `coordinator` (sender's session ID).
|
|
18
|
+
- Batch owner: one integrator per project schedules; tower opens each departed `train` in `~/.herdr/worktrees/<repo>/train-<code>`.
|
|
19
|
+
- Approval: sender quotes boss (brief counts): `auth` for base, `pre-dev/<code>` and all strict deploy targets; `accept` for acceptance. Ask once naming missing approvals. Integrator groups by authorized strict targets; never asks.
|
|
20
|
+
- Record: under `{{state}}/trains/<project>/`, integrator owns `<app>.json`; train owns `<app>/<code>.json`.
|
|
21
|
+
- Escalation route: `call_tower` `why=blocked`; idle: `why=milestone`, reply false.
|
|
22
|
+
- Settings: apps.json `integration`: base, skill, stages, targets, accept, maxCars, maxWaitMin, maxTrains. `car:`/`app:` = app name; `tickets:` = tickets. `{{cli}}` commands: `train check --accept <evidence|none> --app-accept <integration.accept> --slip <slip>`; `train status`.
|
|
27
23
|
<!-- /integration -->
|
package/prompts/planning.md
CHANGED
|
@@ -43,6 +43,8 @@ After a passing anchor, get one fresh-context reviewer for shared contracts, aut
|
|
|
43
43
|
|
|
44
44
|
Dispatch and revise todos without asking the boss to confirm the plan. Before offering choices, read the owning app's instructions and its UI and architecture rules; exclude forbidden options and quote the rule that settles the design in the brief. Ask via question tool before blocked work: a requirement is unclear or contradicts the architecture, or you need authorization (shared merge, deploy).
|
|
45
45
|
|
|
46
|
+
Brief workers in English: goal, required behavior, context, reasons with their cause, scope, what others own, Reality anchor (acceptance check), and the boss's authorizations quoted verbatim. Leave diagnosis and code location to the worker. 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." Take pings to the boss; answer with `subagent_resume`.
|
|
47
|
+
|
|
46
48
|
## 5. When the boss adds work mid-plan
|
|
47
49
|
|
|
48
50
|
- Same project, any app: add a todo here and quote the boss verbatim in `description`. Another project: use `call_tower` with its `workspace` to open a main there.
|
package/src/briefing.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import type { SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import { roleView } from "./briefview.ts";
|
|
3
4
|
import type { MainDuty } from "./mainduty.ts";
|
|
4
5
|
import { cliCommand } from "./server/version.ts";
|
|
5
6
|
import { ENTRY, type Kit } from "./state.ts";
|
|
@@ -18,6 +19,7 @@ const sign = (text: string) => createHash("sha256").update(text).digest("hex").s
|
|
|
18
19
|
|
|
19
20
|
/** The role prompt: a system prompt section, set when a run starts, and a steer when the role or the kind changes during the session. */
|
|
20
21
|
export function createBriefing({ pi, cfg, s, role, guiDir, tell }: Kit, mainDuty: MainDuty) {
|
|
22
|
+
pi.registerMessageRenderer(ENTRY, roleView);
|
|
21
23
|
let prompts: Record<string, string> = {}, files: PromptSet | undefined;
|
|
22
24
|
/** The files of a role's prompt, in order: a main's is `main.md`, then its kind's addendum; a standing main's is `standing.md` alone (docs/specs/2026-11-26-standing-prompt.md: main.md's dispatch and done rules are not its own). */
|
|
23
25
|
const partsOf = (name: string, duty: string): string[] => (name !== "main" ? [name] : duty === "standing" || duty === "worker" ? [duty] : ["main", ...(duty === "integrator" ? ["integrator"] : [])]);
|
|
@@ -84,9 +86,11 @@ export function createBriefing({ pi, cfg, s, role, guiDir, tell }: Kit, mainDuty
|
|
|
84
86
|
[told, flight] = [fits ? d.briefed : undefined, flight === d ? undefined : flight];
|
|
85
87
|
rebrief();
|
|
86
88
|
},
|
|
87
|
-
/**
|
|
88
|
-
fresh(retries
|
|
89
|
-
|
|
89
|
+
/** Compaction keeps the system section. A tree move can instead expose an overriding steer from another branch. */
|
|
90
|
+
fresh(retries?: boolean) {
|
|
91
|
+
const now = stateOf();
|
|
92
|
+
if (retries !== undefined && !flight && told && same(told, now) && section?.text === wholeText(now)) return;
|
|
93
|
+
[told, flight, quiet] = [undefined, undefined, retries === false];
|
|
90
94
|
rebrief();
|
|
91
95
|
quiet = false;
|
|
92
96
|
},
|
|
@@ -94,13 +98,11 @@ export function createBriefing({ pi, cfg, s, role, guiDir, tell }: Kit, mainDuty
|
|
|
94
98
|
const now = stateOf();
|
|
95
99
|
if (now.name && !section && readyToPin(now.name, now.duty)) {
|
|
96
100
|
labels ??= labelsOf();
|
|
97
|
-
// A whole steer
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
const cut = path.findLastIndex((e) => e.type === "compaction"), compaction = path[cut], prior = path[at]?.type === "custom_message" ? path[at].details as Told : undefined;
|
|
101
|
-
const seen = compaction?.type !== "compaction" || path.some((e, i) => i <= at && i < cut && e.id === compaction.firstKeptEntryId) || at > cut;
|
|
101
|
+
// A signed whole steer matching the new section cannot override it with other text, whether kept or summarized. A stale, unsigned, provisional or delta steer still needs replacing.
|
|
102
|
+
const entry = branch().findLast((e) => e.type === "custom_message" && e.customType === ENTRY && (e.details as Partial<Told> | undefined)?.briefed);
|
|
103
|
+
const prior = entry?.type === "custom_message" ? entry.details as Told : undefined;
|
|
102
104
|
if (flight) told = undefined;
|
|
103
|
-
else if (prior) told =
|
|
105
|
+
else if (prior) told = prior.base === null && !prior.provisional && same(prior.briefed, now) && prior.sig === sign(wholeText(now)) ? now : undefined;
|
|
104
106
|
else told = told === undefined ? now : undefined;
|
|
105
107
|
section = { base: now, text: compose(now) };
|
|
106
108
|
}
|
package/src/briefview.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { keyText, type MessageRenderer } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { Text, TruncatedText } from "@earendil-works/pi-tui";
|
|
3
|
+
|
|
4
|
+
/** Only role steers fold. Tower digests share the custom type and keep pi's normal view. */
|
|
5
|
+
export const roleView: MessageRenderer<{ briefed?: { name?: string; duty?: string } }> = (msg, options, theme) => {
|
|
6
|
+
const { expanded, outputPad } = options, role = msg.details?.briefed;
|
|
7
|
+
if (!role || typeof msg.content !== "string") return undefined;
|
|
8
|
+
if (expanded) return new Text(msg.content, outputPad, 0);
|
|
9
|
+
const keys = (options as typeof options & { keyText?: typeof keyText }).keyText ?? keyText;
|
|
10
|
+
const key = keys("app.tools.expand"), lines = msg.content.split("\n").length;
|
|
11
|
+
const title = `[straw-boss] role: ${role.name ?? "none"}${role.duty ? ` · ${role.duty}` : ""}`;
|
|
12
|
+
return new TruncatedText(theme.fg("customMessageLabel", title) + theme.fg("dim", ` (${lines} lines${key ? `, ${key} to expand` : ""})`), outputPad, 0);
|
|
13
|
+
};
|