pi-straw-boss 0.107.1 → 0.108.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 +1 -1
- package/prompts/planning.md +16 -11
- package/src/planhint.ts +16 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-straw-boss",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.108.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
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# Planning work
|
|
2
2
|
|
|
3
|
-
Revise the plan when the work changes.
|
|
4
|
-
|
|
5
3
|
## 1. Name the graph
|
|
6
4
|
|
|
7
5
|
The page shows it beside your kind. Take the first case that matches:
|
|
@@ -26,21 +24,28 @@ For fan-out and orchestrator-worker, one todo per task:
|
|
|
26
24
|
|
|
27
25
|
## 3. Name the anchors
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
Use the lightest check that reaches the change and can fail before it:
|
|
30
28
|
|
|
31
|
-
- **testing
|
|
32
|
-
- **pseudo-human**:
|
|
33
|
-
- **human**: the boss
|
|
34
|
-
- **adversarial-review**:
|
|
29
|
+
- **testing** (code): smallest red-first test. Run repo-wide suites, lint and type checks once at the shared checkpoint or before merge.<!-- integration --> In an `integration` app, see below.<!-- /integration -->
|
|
30
|
+
- **pseudo-human**: operate the real interface; capture screenshots and measurements.
|
|
31
|
+
- **human**: the boss tests or judges feel, wording or a business rule.
|
|
32
|
+
- **adversarial-review**: fresh-context challenge against requirements for read-only work without an executable check.
|
|
35
33
|
|
|
36
|
-
Tasks
|
|
34
|
+
Tasks with one anchor share one checkpoint todo, `blockedBy` all contributors; workers hand it evidence. Keep distinct or cheaper local checks in place.
|
|
37
35
|
|
|
38
36
|
<!-- integration -->
|
|
39
|
-
|
|
37
|
+
For `integration`, 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.
|
|
40
38
|
|
|
41
39
|
<!-- /integration -->
|
|
42
|
-
|
|
40
|
+
After a passing anchor, get one fresh-context reviewer for shared contracts, authorization or permission data, or migrations. Otherwise review your diff against the brief.
|
|
43
41
|
|
|
44
42
|
## 4. Start
|
|
45
43
|
|
|
46
|
-
Dispatch without asking the boss to confirm the plan
|
|
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
|
+
|
|
46
|
+
## 5. When the boss adds work mid-plan
|
|
47
|
+
|
|
48
|
+
- 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.
|
|
49
|
+
- Finish your current step at a safe boundary, then take the insert first. Leave displaced work pending with a note; do not delete it.
|
|
50
|
+
- Keep dispatched workers running. Stop or redirect one only for shared files or if the new request invalidates its brief. For shared files, set `blockedBy` and name the worktree in `description`.
|
|
51
|
+
- Tell the boss in one line where the insert went; don't ask for confirmation. Use `boss_rename` if the tab's focus changes.
|
package/src/planhint.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { readFileSync } from "node:fs";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
import { type Todo, todosOf } from "./items.ts";
|
|
5
|
-
import {
|
|
5
|
+
import { snapshotOfBranch } from "./todo.ts";
|
|
6
6
|
|
|
7
7
|
// The planning rule at the moment it is missed (docs/specs/2026-11-26-plan-graph-jit.md; boss 2026-11-26 「sb 在派工當下送規則」): a coordinator or standing main whose `todo` create leaves it with open
|
|
8
8
|
// todos and none names a graph gets planning.md §1 and §2 on that result, condensed from the file itself, so the wording has one source. Once, and once more only after its open todos named a graph
|
|
@@ -40,18 +40,25 @@ const openOf = (list: readonly Todo[]) => list.filter((t) => t.status !== "compl
|
|
|
40
40
|
|
|
41
41
|
/** `kind`: this session's main kind now (none while it is no main or runs a tower run); `planning`: the folder of planning.md (its §1-§2 hold no integration blocks), or its text for a test, read at the moment the block is sent. */
|
|
42
42
|
export function registerPlanHint(pi: ExtensionAPI, kind: () => string | undefined, planning: string | (() => string)): void {
|
|
43
|
-
let armed = true
|
|
44
|
-
pi.on("session_start", () =>
|
|
43
|
+
let armed = true, insertArmed = true;
|
|
44
|
+
pi.on("session_start", () => { armed = insertArmed = true; });
|
|
45
|
+
pi.on("input", ({ source }) => { if (source !== "extension") insertArmed = true; });
|
|
45
46
|
pi.on("tool_result", (event, ctx) => {
|
|
46
47
|
const k = kind();
|
|
47
48
|
if (event.toolName !== "todo" || event.isError || (k !== "coordinator" && k !== "standing")) return;
|
|
48
|
-
|
|
49
|
+
let snapshot = event.details, list = todosOf(snapshot);
|
|
50
|
+
if (!list && ctx) list = todosOf(snapshot = snapshotOfBranch(ctx.sessionManager.getBranch()));
|
|
49
51
|
if (!list) return;
|
|
50
52
|
const open = openOf(list), missing = open.length > 0 && !open.some((t) => t.graph);
|
|
51
|
-
if (!missing)
|
|
52
|
-
if (!
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
if (!missing) armed = true;
|
|
54
|
+
if (!creates(event.input) || (event.details as { error?: string } | undefined)?.error) return;
|
|
55
|
+
// A successful create allocates consecutive ids ending just before nextId, including a batch.
|
|
56
|
+
const firstNew = (snapshot as { nextId: number }).nextId - (Array.isArray(event.input.tasks) ? event.input.tasks.length : 1);
|
|
57
|
+
const insert = insertArmed && open.some((t) => t.id < firstNew && t.status === "in_progress");
|
|
58
|
+
if (!(armed && missing) && !insert) return;
|
|
59
|
+
const doc = typeof planning === "string" ? readFileSync(join(planning, "planning.md"), "utf8") : planning(), content = [...event.content];
|
|
60
|
+
if (armed && missing) { content.push({ type: "text", text: planHint(doc) }); armed = false; }
|
|
61
|
+
if (insert) { content.push({ type: "text", text: section(doc, 5).replace(/\n- /g, "\n").replace(": - ", ":\n") }); insertArmed = false; }
|
|
62
|
+
return { content };
|
|
56
63
|
});
|
|
57
64
|
}
|