pi-straw-boss 0.119.0 → 0.120.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-straw-boss",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.120.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/planning.md
CHANGED
|
@@ -28,9 +28,9 @@ Fan-out and orchestrator-worker: one todo per task.
|
|
|
28
28
|
|
|
29
29
|
## 3. Name the anchors
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Pick the lightest check that fails today:
|
|
32
32
|
|
|
33
|
-
- **testing** (code): smallest red-first test. Run repo-wide
|
|
33
|
+
- **testing** (code): smallest red-first test. Run repo-wide checks once at the shared checkpoint or before merge.<!-- integration --> In an `integration` app, see below.<!-- /integration -->
|
|
34
34
|
- **pseudo-human**: operate the real interface; capture screenshots and measurements.
|
|
35
35
|
- **human**: the boss tests or judges feel, wording or a business rule.
|
|
36
36
|
- **adversarial-review**: fresh-context challenge against requirements for read-only work without an executable check.
|
|
@@ -43,13 +43,13 @@ Contributors record green runs by SHA. The checkpoint reuses only runs tied to t
|
|
|
43
43
|
Car slip = handoff. Follow `integrating`'s Principle: before handoff clear P0/P1 review, test your change and run the project skill's `Light checks`. `Full gates` run once, by the integrator, on the integrated pre-dev head. Before sending the slip, run `integration.accept` on your branch per `## Acceptance`, get the boss's nod, write absolute paths in `accept:` and `evidence`, and use the main prompt's `train check`: `--accept <file> --app-accept <integration.accept> --slip <slip>` (`--accept none` for empty `integration.accept`); a `human` anchor is this acceptance, not the train's.
|
|
44
44
|
|
|
45
45
|
<!-- /integration -->
|
|
46
|
-
After the anchor passes,
|
|
46
|
+
After the anchor passes, use one fresh-context reviewer for shared contracts, authorization or permission data, migrations, security, or work carried by two or more workers. Otherwise review your diff against the brief.
|
|
47
47
|
|
|
48
48
|
## 4. Start
|
|
49
49
|
|
|
50
50
|
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).
|
|
51
51
|
|
|
52
|
-
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.
|
|
52
|
+
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. Name your checkpoints in each brief; `item` automatically adds join anchors. Workers diagnose and locate the change. 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`.
|
|
53
53
|
|
|
54
54
|
## 5. When the boss adds work mid-plan
|
|
55
55
|
|
|
@@ -35,6 +35,9 @@ The simple mode has no persistent specialists (`subagent_send`, `subagent_stop`)
|
|
|
35
35
|
|
|
36
36
|
Name coordinated children `<task>-<role>[-n]`, for example `login-api`.
|
|
37
37
|
|
|
38
|
+
State which checkpoints you keep in each brief. With `item`, sb appends the todo's check to the child's task and lists the checks you keep from todos directly blocked by it.
|
|
39
|
+
Unless the child's own check requires a full suite, whole-project type-check or build, run those yourself on the joined changes.
|
|
40
|
+
|
|
38
41
|
## Where workers show
|
|
39
42
|
|
|
40
43
|
A worker launched with `item` is drawn under its todo by pi-todo-ledger; one launched without it is drawn in the ledger's group of other workers. Without a ledger, they show in the built-in Subagents box above the editor: one row each, name · model · state · time. The sb GUI and board show every worker under the session that launched it.
|
|
@@ -53,7 +56,7 @@ For an ended run or an expired delivery, use the `subagent_resume` arguments in
|
|
|
53
56
|
## Cancel, resume, list
|
|
54
57
|
|
|
55
58
|
- `subagent_cancel({ id | name })` ends a running child. Its intent is recorded first, so no fallback model starts; one `cancelled` result follows. `confirmed`: done; `requested`: the launch is still settling; `unconfirmed`: retry or report. Never close a pane or kill a process by hand to cancel.
|
|
56
|
-
- `subagent_resume({ sessionPath, name?, message?, autoExit? })` continues a finished, failed or cancelled child in a new pane: answer its `caller_ping`, or send follow-up work. It keeps the stored model and tools.
|
|
59
|
+
- `subagent_resume({ sessionPath, name?, message?, autoExit?, item? })` continues a finished, failed or cancelled child in a new pane: answer its `caller_ping`, or send follow-up work. It keeps the stored model and tools. Pass `item` to include the checks from your current ledger in this follow-up.
|
|
57
60
|
- `subagents_list` lists the roles you can launch and where each comes from.
|
|
58
61
|
|
|
59
62
|
## A worker ended without a result
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { newestOf } from "../branchscan.ts";
|
|
2
|
+
import { itemKey } from "../peertargets.ts";
|
|
3
|
+
import { v1Of } from "../todoledger.ts";
|
|
4
|
+
|
|
5
|
+
interface Row { id: number; uid?: string; subject: string; status: string; anchor?: string; metadata?: { anchor?: unknown }; blockedBy?: number[] }
|
|
6
|
+
interface Branch { getBranch(): readonly unknown[]; getSessionId(): string }
|
|
7
|
+
const rule = "Run only what covers your diff, once after your last edit; full suites and whole-project type-checks or builds are the parent's unless your check names them.";
|
|
8
|
+
const parent = "Parent runs these; do not run them:";
|
|
9
|
+
const clip = (s: string, max: number) => s.length <= max ? s : `${s.slice(0, max - 1).trimEnd()}…`;
|
|
10
|
+
function anchor(row: Row): string {
|
|
11
|
+
const value = row.anchor ?? row.metadata?.anchor;
|
|
12
|
+
return typeof value === "string" ? value.trim() : "";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Keep room for both owners, the omitted-row count, and the rule even if one subject or command is very long. */
|
|
16
|
+
function render(item: Row, joins: Row[]): string | undefined {
|
|
17
|
+
const own = anchor(item);
|
|
18
|
+
if (!own && !joins.length) return undefined;
|
|
19
|
+
const lines: string[] = [];
|
|
20
|
+
let room = 600 - 2 - rule.length; // includes the two newlines separating the block from the task
|
|
21
|
+
const line = (text: string) => { lines.push(text); room -= text.length + 1; };
|
|
22
|
+
line(`Your check: ${clip(own || "Not set on this todo.", joins.length ? 175 : room - parent.length - "Your check: \n\n".length)}`);
|
|
23
|
+
line(parent);
|
|
24
|
+
for (const [i, row] of joins.entries()) {
|
|
25
|
+
const remaining = joins.length - i, omitted = `… +${remaining} more`;
|
|
26
|
+
const limit = room - 1 - (remaining > 1 ? omitted.length + 1 : 0);
|
|
27
|
+
const check = anchor(row), subject = row.subject.trim() || `#${row.id}`;
|
|
28
|
+
const full = `- ${subject}${check ? `: ${check}` : ""}`;
|
|
29
|
+
if (full.length <= limit) line(full);
|
|
30
|
+
else if (i > 0) { line(omitted); break; }
|
|
31
|
+
else {
|
|
32
|
+
const name = clip(subject, check ? Math.floor(limit / 2) : limit - 2);
|
|
33
|
+
line(`- ${name}${check ? `: ${clip(check, limit - name.length - 4)}` : ""}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return [...lines, rule].join("\n");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Each call reads the launcher's current ledger branch; never look in a child's old session or match another session's local todo number. */
|
|
40
|
+
export function createBriefChecks() {
|
|
41
|
+
const latest = newestOf(v1Of);
|
|
42
|
+
return (item: string, branch: Branch): string | undefined => {
|
|
43
|
+
const key = itemKey(item);
|
|
44
|
+
if (!key) return undefined;
|
|
45
|
+
if ("session" in key && key.session.toLowerCase() !== branch.getSessionId().slice(0, 8).toLowerCase()) return undefined;
|
|
46
|
+
const ledger = latest(branch.getBranch()) as { tasks: Row[] } | undefined; // v1Of checked every row
|
|
47
|
+
const row = ledger?.tasks.find(t => "uid" in key ? t.uid === key.uid : t.id === key.id);
|
|
48
|
+
if (!ledger || !row || row.status === "deleted") return undefined;
|
|
49
|
+
return render(row, ledger.tasks.filter(t => t.status !== "deleted" && t.blockedBy?.includes(row.id)));
|
|
50
|
+
};
|
|
51
|
+
}
|
package/src/host/surface.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ExtensionAPI, ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { SubagentParams } from "@nubl/maestro/pi/subagents/catalog";
|
|
3
|
+
import { createBriefChecks } from "./brief-checks.ts";
|
|
2
4
|
import { RUN_END_EVENT, runEndOf } from "./run-end.ts";
|
|
3
5
|
|
|
4
6
|
// sb's simple host (docs/how-it-works.md#the-subagent-host): Maestro registers its whole surface, and this API in front of Pi keeps only what the
|
|
@@ -61,13 +63,19 @@ export interface SimpleDeps {
|
|
|
61
63
|
|
|
62
64
|
/** The API Maestro registers through: drops the tools and commands above, refuses the dropped parameters before Maestro sees the call, and tells each run's end (run-end.ts). */
|
|
63
65
|
export function simpleApi(pi: ExtensionAPI, deps: SimpleDeps): ExtensionAPI {
|
|
66
|
+
const checkBlock = createBriefChecks();
|
|
64
67
|
let modelCatalog: string | undefined, steerRegistered = false;
|
|
65
68
|
const registerTool = (tool: ToolDefinition) => {
|
|
66
69
|
if (DROPPED_TOOLS.includes(tool.name)) return;
|
|
67
70
|
const dropped = Object.keys(DROPPED_PARAMS[tool.name] ?? {});
|
|
68
|
-
const launch = tool.name === "subagent", list = tool.name === "subagents_list";
|
|
71
|
+
const launch = tool.name === "subagent", resume = tool.name === "subagent_resume", list = tool.name === "subagents_list";
|
|
72
|
+
// Resume has no Maestro item parameter. sb uses the launch item's schema for the brief, not to rebind the old run.
|
|
73
|
+
const parameters = resume ? {
|
|
74
|
+
...tool.parameters,
|
|
75
|
+
properties: { ...(tool.parameters as Schema).properties, item: { ...SubagentParams.properties.item, description: "Todo uid or <session8>#<id> supplying the checks for this follow-up." } },
|
|
76
|
+
} : dropped.length ? simpleSchema(tool.parameters, dropped) : tool.parameters;
|
|
69
77
|
if (launch && !steerRegistered && !(process.env.PI_SUBAGENT_ID && process.env.PI_DENY_TOOLS?.split(",").some(n => n.trim() === "subagent_steer"))) { steerRegistered = true; deps.registerSteer?.(); }
|
|
70
|
-
const description = launch ? SUBAGENT_DESCRIPTION :
|
|
78
|
+
const description = launch ? SUBAGENT_DESCRIPTION : resume ? RESUME_DESCRIPTION : list ? `${tool.description} See authenticated models and task-category shortlists here before choosing a model.` : tool.description;
|
|
71
79
|
let promptGuidelines = tool.promptGuidelines;
|
|
72
80
|
if (launch && promptGuidelines?.length) {
|
|
73
81
|
// Maestro's buildSubagentRoutingGuidelines puts the catalog last. session_start re-registers this tool with the scoped catalog.
|
|
@@ -79,13 +87,15 @@ export function simpleApi(pi: ExtensionAPI, deps: SimpleDeps): ExtensionAPI {
|
|
|
79
87
|
const refusal = droppedParamError(tool.name, params);
|
|
80
88
|
if (refusal) throw new Error(refusal);
|
|
81
89
|
const agent = (params as { agent?: unknown }).agent;
|
|
82
|
-
if (
|
|
90
|
+
if (launch && typeof agent === "string" && agent && deps.persistentRole(agent, params as Record<string, unknown>))
|
|
83
91
|
throw new Error(`sb's subagent host runs in simple mode: role \`${agent}\` is defined as a persistent specialist, which it does not run. Launch it with a bare subagent and the role's instructions in the task, or use another role.`);
|
|
84
|
-
const
|
|
92
|
+
const input = params as Record<string, unknown>, key = launch ? "task" : "message";
|
|
93
|
+
const block = typeof input.item === "string" && (launch || resume) ? checkBlock(input.item, ctx.sessionManager) : undefined;
|
|
94
|
+
const result = await tool.execute(id, block ? { ...input, [key]: input[key] ? `${input[key]}\n\n${block}` : block } : params, signal, onUpdate, ctx);
|
|
85
95
|
if (!list || !modelCatalog || result.isError) return result;
|
|
86
96
|
return { ...result, content: [...result.content, { type: "text", text: modelCatalog }] };
|
|
87
97
|
};
|
|
88
|
-
pi.registerTool({ ...tool, description, promptGuidelines,
|
|
98
|
+
pi.registerTool({ ...tool, description, promptGuidelines, parameters, execute } as ToolDefinition);
|
|
89
99
|
};
|
|
90
100
|
const registerCommand: ExtensionAPI["registerCommand"] = (name, options) => {
|
|
91
101
|
if (DROPPED_COMMANDS.includes(name)) return;
|