pi-herdr-agents 0.0.1
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/AGENTS.md +116 -0
- package/CONTEXT.md +159 -0
- package/LICENSE +21 -0
- package/README.md +874 -0
- package/RELEASING.md +139 -0
- package/agents/adversarial-reviewer.md +80 -0
- package/agents/claude-reviewer.md +23 -0
- package/agents/planner.md +539 -0
- package/agents/poteto.md +32 -0
- package/agents/reviewer.md +164 -0
- package/agents/scout.md +106 -0
- package/agents/visual-tester.md +224 -0
- package/agents/worker.md +132 -0
- package/config.json.example +8 -0
- package/docs/README.md +42 -0
- package/docs/adr/0001-btw-ephemeral-side-questions.md +142 -0
- package/docs/adr/0002-agent-workflow-skill-runtime-taxonomy.md +265 -0
- package/docs/adr/0003-installable-role-packs.md +135 -0
- package/docs/adr/0004-require-active-user-approval-for-workflow-execution.md +17 -0
- package/docs/adr/0005-parent-owns-workflow-script-authority.md +17 -0
- package/docs/adr/0006-limit-v1-execution-effects-to-isolated-worktrees.md +18 -0
- package/docs/adr/0007-require-fresh-review-for-workflow-scripts.md +19 -0
- package/docs/orchestrated-review-workflow-plan.md +479 -0
- package/docs/research/pdw-architecture-assessment.md +525 -0
- package/docs/research/pi-workflows-sol-advisor.md +255 -0
- package/docs/research/worktree-subagent-orchestration.md +317 -0
- package/docs/worktree-subagents.md +196 -0
- package/examples/role-pack/extension.ts +18 -0
- package/examples/role-pack/package.json +16 -0
- package/examples/role-pack/roles/example-reviewer.md +12 -0
- package/package.json +58 -0
- package/pi-extension/subagents/activity.ts +511 -0
- package/pi-extension/subagents/completion.ts +177 -0
- package/pi-extension/subagents/herdr.ts +541 -0
- package/pi-extension/subagents/index.ts +4730 -0
- package/pi-extension/subagents/lifecycle.ts +477 -0
- package/pi-extension/subagents/model-config.ts +95 -0
- package/pi-extension/subagents/plan-skill.md +262 -0
- package/pi-extension/subagents/plugin/.claude-plugin/plugin.json +5 -0
- package/pi-extension/subagents/plugin/hooks/hooks.json +15 -0
- package/pi-extension/subagents/plugin/hooks/on-stop.sh +68 -0
- package/pi-extension/subagents/runtime-routing.ts +313 -0
- package/pi-extension/subagents/session.ts +216 -0
- package/pi-extension/subagents/status.ts +513 -0
- package/pi-extension/subagents/subagent-done.ts +326 -0
- package/pi-extension/subagents/terminal.ts +163 -0
- package/pi-extension/subagents/workflow-worker.js +56 -0
- package/pi-extension/subagents/workflow.ts +1210 -0
- package/skills/orchestrate/SKILL.md +184 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Repository instructions for agents
|
|
2
|
+
|
|
3
|
+
These instructions apply to humans and coding agents changing `pi-herdr-agents`.
|
|
4
|
+
|
|
5
|
+
## What this package is
|
|
6
|
+
|
|
7
|
+
`pi-herdr-agents` (Pi Herdr Agents) is a Pi extension that launches asynchronous child agents and approved read-only review workflows exclusively in Herdr. Ordinary runs use dedicated Herdr panes/tabs. Writing tasks may opt into one isolated Herdr-managed Git worktree per branch.
|
|
8
|
+
|
|
9
|
+
The extension is fire-and-forget: `subagent` returns an acknowledgement, and completion is delivered to the parent automatically. Never add polling guidance that tells callers to sleep, tail sessions, or repeatedly check status.
|
|
10
|
+
|
|
11
|
+
## Read these first
|
|
12
|
+
|
|
13
|
+
- [`README.md`](./README.md) — canonical installation, API, configuration, lifecycle, and agent-authoring reference
|
|
14
|
+
- [`docs/README.md`](docs/README.md) — map of shipped contracts, active design, ADRs, and background research
|
|
15
|
+
- [`CONTEXT.md`](CONTEXT.md) — workflow domain language and prototype evidence; read it before changing workflow design
|
|
16
|
+
- [`docs/adr/0003-installable-role-packs.md`](docs/adr/0003-installable-role-packs.md) — installable role-pack discovery, precedence, and collision contract
|
|
17
|
+
- [`docs/worktree-subagents.md`](docs/worktree-subagents.md) — canonical worktree operating, review, recovery, and cleanup guide
|
|
18
|
+
- [`RELEASING.md`](RELEASING.md) — release checks and publishing procedure
|
|
19
|
+
|
|
20
|
+
Bundled role prompts live in [`agents/`](agents/). The native `/skill:orchestrate` workflow authoring skill lives at [`skills/orchestrate/SKILL.md`](skills/orchestrate/SKILL.md). The `/plan` orchestration prompt lives at [`pi-extension/subagents/plan-skill.md`](pi-extension/subagents/plan-skill.md).
|
|
21
|
+
|
|
22
|
+
## Code map
|
|
23
|
+
|
|
24
|
+
- `pi-extension/subagents/index.ts` — public tools/commands, agent discovery, launch/watch lifecycle, completion delivery, worktree manifests and handoffs
|
|
25
|
+
- `pi-extension/subagents/herdr.ts` — Herdr CLI argument construction and response parsing
|
|
26
|
+
- `pi-extension/subagents/terminal.ts` — terminal adapter used by the lifecycle
|
|
27
|
+
- `pi-extension/subagents/lifecycle.ts`, `status.ts`, `activity.ts` — process/turn state and widget projection
|
|
28
|
+
- `pi-extension/subagents/completion.ts`, `session.ts`, `subagent-done.ts` — child completion, transcript handling, `caller_ping`, and `subagent_done`
|
|
29
|
+
- `pi-extension/subagents/workflow.ts`, `workflow-worker.js` — workflow preparation, ownership, journal, lifecycle, and Worker execution
|
|
30
|
+
- `CONTEXT.md` — domain glossary and validated prototype evidence for active design
|
|
31
|
+
- `docs/adr/` — hard-to-reverse architectural decisions
|
|
32
|
+
- `docs/research/` — evidence and alternatives, never the shipped contract
|
|
33
|
+
- `test/test.ts` — unit tests for public subagent extension seams
|
|
34
|
+
- `test/workflow.test.ts` — unit tests for workflow preparation, execution, and cancellation
|
|
35
|
+
- `test/package-skill.test.js` — bundled skill and package manifest contract test
|
|
36
|
+
- `test/integration/` — real Herdr and Pi lifecycle tests using the deterministic provider by default
|
|
37
|
+
|
|
38
|
+
## Worktree contract
|
|
39
|
+
|
|
40
|
+
Preserve these invariants when changing worktree behavior:
|
|
41
|
+
|
|
42
|
+
1. `worktree: { branch, base? }` is opt-in per `subagent` call.
|
|
43
|
+
2. `cwd` selects the source repository; the child starts at the created worktree root.
|
|
44
|
+
3. `base` resolves to an exact commit before creation and defaults to committed `HEAD`.
|
|
45
|
+
4. Parent uncommitted/untracked files are not copied.
|
|
46
|
+
5. An ownership manifest is written before Herdr resource creation.
|
|
47
|
+
6. Herdr creates the workspace without stealing focus; launch targets the returned root pane explicitly.
|
|
48
|
+
7. Successful, failed, and help-requesting runs retain their worktree workspace.
|
|
49
|
+
8. Completion reports reviewable Git state; inspection failures are unknown, never guessed clean or conflict-free.
|
|
50
|
+
9. The extension does not push, create PRs, merge, cherry-pick, switch the parent checkout, or remove worktrees/branches automatically.
|
|
51
|
+
10. Ordinary non-worktree subagent behavior remains unchanged.
|
|
52
|
+
|
|
53
|
+
Read [`docs/worktree-subagents.md`](docs/worktree-subagents.md) before changing any of these semantics.
|
|
54
|
+
|
|
55
|
+
## Orchestration guidance
|
|
56
|
+
|
|
57
|
+
- Use ordinary panes for read-only scouts and reviewers.
|
|
58
|
+
- Use unique worktree branches for independent parallel writing tasks.
|
|
59
|
+
- Keep overlapping or dependent writing tasks sequential unless the dependency is committed and used as the next exact base.
|
|
60
|
+
- Tell worktree workers whether to commit. A good default is: edit, test, commit, report the SHA, and do not push/merge/remove.
|
|
61
|
+
- The parent owns review, integration, publication, and cleanup.
|
|
62
|
+
- Do not use `subagent_resume` as if it reattached worktree ownership; v1 resumes into an ordinary pane.
|
|
63
|
+
|
|
64
|
+
## Documentation synchronization
|
|
65
|
+
|
|
66
|
+
When behavior changes, update every affected surface in the same commit:
|
|
67
|
+
|
|
68
|
+
- public tool parameters, role-pack protocol, or lifecycle → `README.md`
|
|
69
|
+
- role-pack discovery, precedence, or collision policy → `docs/adr/0003-installable-role-packs.md`
|
|
70
|
+
- worktree behavior, handoff, recovery, or cleanup → `docs/worktree-subagents.md`
|
|
71
|
+
- agent operating expectations → relevant files in `agents/`
|
|
72
|
+
- `/plan` orchestration policy → `pi-extension/subagents/plan-skill.md`
|
|
73
|
+
- contributor/release verification → this file, `.pi/skills/run-integration-tests/SKILL.md`, or `RELEASING.md`
|
|
74
|
+
- domain terminology → `CONTEXT.md`
|
|
75
|
+
- hard-to-reverse workflow trade-offs → the relevant ADR; do not create an ADR for every design question
|
|
76
|
+
- active orchestrated-review design → `docs/orchestrated-review-workflow-plan.md`
|
|
77
|
+
- architectural evidence and alternatives only → research docs, clearly marked when later decisions supersede them
|
|
78
|
+
|
|
79
|
+
Do not copy the full worktree guide into every role prompt. Keep canonical detail in the guide and add only the role-specific rule an agent needs while running.
|
|
80
|
+
|
|
81
|
+
## Verification
|
|
82
|
+
|
|
83
|
+
For normal changes:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm test
|
|
87
|
+
npm run lint
|
|
88
|
+
npm pack --dry-run
|
|
89
|
+
git diff --check
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Run LSP diagnostics on every changed TypeScript file; lint and tests do not catch every TypeScript error.
|
|
93
|
+
|
|
94
|
+
For Herdr or lifecycle changes, run the deterministic suite from inside Herdr. Run only one integration suite at a time on a Herdr instance; concurrent suites compete for terminal focus and process capacity and can cause false timeouts or leaked test resources.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npm run test:integration
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Use `PI_TEST_MODEL="openai-codex/gpt-5.6-luna" PI_TEST_TIMEOUT=180000 npm run test:integration:live` only for optional provider-compatibility smoke coverage. Do not use skipped Herdr tests as passing evidence.
|
|
101
|
+
|
|
102
|
+
Before committing:
|
|
103
|
+
|
|
104
|
+
- inspect `git status` and the final diff;
|
|
105
|
+
- confirm the package preview includes `skills/orchestrate/SKILL.md` and `pi-extension/subagents/workflow-worker.js`, while excluding plans, journals, sessions, prototypes, generated evidence, and local config;
|
|
106
|
+
- run `npm pack --dry-run` when package contents or documentation paths changed;
|
|
107
|
+
- confirm that no generated plans, journals, sessions, provider configuration, test scripts, or review artifacts are staged; and
|
|
108
|
+
- confirm that no accidental empty directory exists at the repository root:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
test -z "$(find . -mindepth 1 -maxdepth 1 -type d -empty -print)"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Release safety
|
|
115
|
+
|
|
116
|
+
Do not bump `package.json` merely to land documentation or implementation work. A version change on `main` triggers the release workflow. Never commit npm credentials, generated review artifacts, session artifacts, or local `config.json`.
|
package/CONTEXT.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Feature Delivery
|
|
2
|
+
|
|
3
|
+
This context defines language for the shipped first-flow workflow runtime and deferred follow-up. [`README.md`](./README.md) is authoritative for shipped behavior; [`docs/orchestrated-review-workflow-plan.md`](./docs/orchestrated-review-workflow-plan.md) records the shipped implementation and deferred work. The workflow coordinates existing subagent roles without becoming a general-purpose workflow engine.
|
|
4
|
+
|
|
5
|
+
## Language
|
|
6
|
+
|
|
7
|
+
**Feature-delivery workflow**:
|
|
8
|
+
A bounded, user-approved plan that coordinates work needed to deliver one feature and ends in reviewable evidence.
|
|
9
|
+
_Avoid_: General task graph, orchestrator agent
|
|
10
|
+
|
|
11
|
+
**Workflow script**:
|
|
12
|
+
The per-run `workflow.js` containing a runner-validated JSON metadata block and the user-approved executable strategy.
|
|
13
|
+
_Avoid_: Execution plan, generic script, inferred policy
|
|
14
|
+
|
|
15
|
+
**Workflow metadata**:
|
|
16
|
+
The JSON block at the start of a workflow script that the runner parses and validates before loading any executable JavaScript.
|
|
17
|
+
_Avoid_: Evaluated metadata, inferred policy
|
|
18
|
+
|
|
19
|
+
**Approved runtime**:
|
|
20
|
+
A mandatory exact `provider/model` reference and thinking level declared in workflow metadata; every execution node must resolve to one of these approved runtimes. Missing values fail preparation rather than inheriting parent or role defaults. The first workflow supports Pi-backed agents only; existing public Claude subagents remain unchanged.
|
|
21
|
+
_Avoid_: Runtime tiers, silent fallback, inherited runtime, v1 Claude workflow adapter
|
|
22
|
+
|
|
23
|
+
**Run journal**:
|
|
24
|
+
The runner-owned append-only `run.jsonl` that starts with approval binding the workflow-script hash, canonical repository identity, and committed base, then records observed node calls and results. Exactly one terminal event contains the bounded runtime envelope; a following delivery event references it without duplicating the task result.
|
|
25
|
+
_Avoid_: User-authored plan, mutable audit log, duplicated result
|
|
26
|
+
|
|
27
|
+
**Terminal lifecycle**:
|
|
28
|
+
Completed read and review panes close after result capture while child session files and run evidence remain. Writer-worktree retention belongs to a deferred writer workflow.
|
|
29
|
+
_Avoid_: Retaining every clean pane, deleting review evidence
|
|
30
|
+
|
|
31
|
+
**Restart boundary**:
|
|
32
|
+
Workflow ownership survives Pi lifecycle transitions handled inside the same process, including `/reload`. A full process restart performs interruption reconciliation only: it marks a stale run interrupted, retains sessions, journals, branches, and worktrees as evidence, and requires a newly approved run. There is no replay, restart of children, cleanup, or history surface.
|
|
33
|
+
_Avoid_: Automatic replay, durable workflow manager, lost-artifact claim
|
|
34
|
+
|
|
35
|
+
**Execution artifact directory**:
|
|
36
|
+
The project-local `.pi/plans/<run>/` directory that keeps its workflow script and run journal together.
|
|
37
|
+
_Avoid_: Session-only state, runner-global artifacts
|
|
38
|
+
|
|
39
|
+
**Execution run**:
|
|
40
|
+
One immutable orchestration attempt with its own unique artifact directory; a retry or revised plan creates a new run that can reference its predecessor. Approval binds the canonical repository root, Git common directory, and committed base SHA. Read-only execution nodes share a run-owned checkout pinned to that identity.
|
|
41
|
+
_Avoid_: Overwritten feature directory, mutable run history, parent-checkout reads, SHA-only repository ambiguity
|
|
42
|
+
|
|
43
|
+
**Execution source**:
|
|
44
|
+
A user-selected PRD, ticket set, URL, or combination that the orchestration skill reads before preparation. Local paths must resolve inside the approved repository; remote or tracker content is materialized into the exact approved script or prompt evidence rather than fetched by workflow children. Metadata source strings are provenance, not runtime read authority.
|
|
45
|
+
_Avoid_: Required ticket conversion, fixed ticket graph, runtime refetch, path escape
|
|
46
|
+
|
|
47
|
+
**Orchestration skill**:
|
|
48
|
+
The user-facing native Pi skill bundled with this package that accepts an execution source, derives a workflow script, and invokes the runner only after approval.
|
|
49
|
+
_Avoid_: Extension command, separate skill package, raw runner API
|
|
50
|
+
|
|
51
|
+
**Source resolution**:
|
|
52
|
+
The orchestration skill reads an execution source through capabilities already available to the parent; the extension has no built-in tracker client and stops when the source is inaccessible.
|
|
53
|
+
_Avoid_: Required tracker integration, silent fallback
|
|
54
|
+
|
|
55
|
+
**Execution node**:
|
|
56
|
+
A bounded planned subagent run that may cover one, part of one, or several source tickets while retaining source traceability. The shipped first flow accepts only `kind: "review"`; `read` and `write` remain deferred kinds for later workflows.
|
|
57
|
+
_Avoid_: Ticket, untracked child run, inferred effect, first-flow read/write node
|
|
58
|
+
|
|
59
|
+
**Writer lane (deferred)**:
|
|
60
|
+
A possible later single write node and retained worktree; it is not part of the first review-only workflow and requires separate evidence and approval.
|
|
61
|
+
_Avoid_: First-flow writer, parallel writers, shared-checkout writer
|
|
62
|
+
|
|
63
|
+
**Read-only fan-out**:
|
|
64
|
+
The shipped first flow runs bounded parallel review nodes, then one fresh synthesis node. A later writer workflow may define separate pre-write and post-write review stages.
|
|
65
|
+
_Avoid_: Unbounded fan-out, first-flow writer, reviewing through a writer
|
|
66
|
+
|
|
67
|
+
**Code-oriented orchestration**:
|
|
68
|
+
The parent writes JavaScript against a narrow capability API so intermediate subagent results stay in code and only the final useful result returns to the parent context, similar in shape to Cloudflare Code Mode.
|
|
69
|
+
_Avoid_: Direct parent turn per child result, broad generated tool API, security-equivalence claim
|
|
70
|
+
|
|
71
|
+
**Workflow SDK**:
|
|
72
|
+
The extension-private JavaScript API that workflow scripts use to launch and await policy-checked execution nodes through the existing subagent lifecycle. V1 exposes only `agent()` and `log()`; scripts use ordinary JavaScript control flow and `Promise.all`.
|
|
73
|
+
_Avoid_: Public `subagent()` tool, third-party package API, speculative helper framework
|
|
74
|
+
|
|
75
|
+
**Tool derivation**:
|
|
76
|
+
The runner computes each node's effective tools from its resolved role, the hard maximum for its declared kind, and extension deny rules; `agent()` has no script-controlled `tools` option. Workflow children receive the exact derived list without public child-control tools such as `caller_ping`.
|
|
77
|
+
_Avoid_: Script-granted capability, duplicated tool policy, public child-control tool
|
|
78
|
+
|
|
79
|
+
**Agent result**:
|
|
80
|
+
The explicit success-or-failure value returned by `agent()`, preserving output, retryability, session reference, and any Git handoff without collapsing operational failure to `null`.
|
|
81
|
+
_Avoid_: Nullable result, prose-only failure
|
|
82
|
+
|
|
83
|
+
**Runtime envelope**:
|
|
84
|
+
The runner-owned final wrapper containing only operational facts such as run ID, terminal runtime state, returned task result, and a runtime error when present.
|
|
85
|
+
_Avoid_: Review verdict, delivery semantics, task-specific state machine
|
|
86
|
+
|
|
87
|
+
**Task result**:
|
|
88
|
+
Any JSON-compatible value returned by `workflow.js`; the parent-authored script chooses its task-specific shape and vocabulary.
|
|
89
|
+
_Avoid_: Global verdict enum, mandatory review receipt type, workflow DSL
|
|
90
|
+
|
|
91
|
+
**Workflow runtime**:
|
|
92
|
+
A native Node Worker thread containing the restricted `vm` that executes an approved workflow script with only the Workflow SDK. The Worker protects Pi's main event loop from accidental asynchronous infinite loops; neither the Worker nor `vm` is a security boundary.
|
|
93
|
+
_Avoid_: Main-thread workflow execution, untrusted-code sandbox, normal Node module execution
|
|
94
|
+
|
|
95
|
+
**First-flow effect boundary**:
|
|
96
|
+
An execution node may only inspect or review one runner-owned detached checkout pinned to the approved repository identity and committed base. It cannot write files, create commits, mutate the parent checkout, integrate work, or mutate external systems.
|
|
97
|
+
_Avoid_: Writer node, ticket mutation, deployment, publishing, messaging, PR action, late-bound base
|
|
98
|
+
|
|
99
|
+
**Fresh review**:
|
|
100
|
+
Independent read-only review nodes with fresh contexts and the exact source or candidate evidence; the bundled authoring skill requires them in every first-flow script.
|
|
101
|
+
_Avoid_: Worker self-review, inherited-context review
|
|
102
|
+
|
|
103
|
+
**Review-policy boundary**:
|
|
104
|
+
The bundled skill authors review fan-out and synthesis, and exact-script approval binds that task strategy; the runner enforces operational capabilities and evidence without a fixed review receipt or data-flow state machine.
|
|
105
|
+
_Avoid_: Hidden task semantics, runner-certified review completeness
|
|
106
|
+
|
|
107
|
+
**Review workflow**:
|
|
108
|
+
The first product flow: an approved JavaScript run fans out to independent read-only reviewers, then passes every explicit result to one fresh review synthesizer.
|
|
109
|
+
_Avoid_: Parent-scheduled review nodes, prose-only aggregation
|
|
110
|
+
|
|
111
|
+
**Review synthesis**:
|
|
112
|
+
The final fresh read-only review node that receives every explicit reviewer success or failure plus exact source evidence, deduplicates or resolves findings, and returns one review verdict.
|
|
113
|
+
_Avoid_: Filtered failures, mechanical worst-verdict rule, parent-side synthesis
|
|
114
|
+
|
|
115
|
+
**Parent-guided recovery**:
|
|
116
|
+
Current runtime child failures are explicit non-retryable evidence. The parent can approve a new smaller workflow for missing coverage. The bundled skill also contains one dormant same-role replacement branch, used only when a required failure explicitly has `retryable: true`; it never infers retryability from prose or runtime error text.
|
|
117
|
+
_Avoid_: Error-text retry classification, silent model fallback, unbounded retries
|
|
118
|
+
|
|
119
|
+
**Incomplete review**:
|
|
120
|
+
A review-workflow task-result state chosen by the script when a declared reviewer fails; it is not a runner-owned terminal state.
|
|
121
|
+
_Avoid_: Hidden missing coverage, runtime-wide review semantics
|
|
122
|
+
|
|
123
|
+
**Ready for integration (deferred)**:
|
|
124
|
+
A possible later writer-workflow result containing retained commits, verification, and review evidence. It is not a first-flow result and cannot claim automatic acceptance.
|
|
125
|
+
_Avoid_: First-flow handoff, ship verdict, automatic integration
|
|
126
|
+
|
|
127
|
+
**Run assembly (deferred)**:
|
|
128
|
+
A possible later post-writing step that combines writer commits on a run-owned branch without modifying the parent checkout; adoption requires a separate end-to-end prototype.
|
|
129
|
+
_Avoid_: First-flow assembly, parent integration, automatic conflict repair
|
|
130
|
+
|
|
131
|
+
**Delivery verdict (deferred)**:
|
|
132
|
+
A possible later delivery workflow's task-specific recommendation, assembled in JavaScript from review evidence and accepted or rejected by the parent; its vocabulary would remain outside the runtime contract.
|
|
133
|
+
_Avoid_: First-flow verdict requirement, runtime-wide verdict enum, automatic acceptance, worker self-acceptance
|
|
134
|
+
|
|
135
|
+
**Workflow-script authority**:
|
|
136
|
+
The parent is the only actor that may author or revise a workflow script; children can only return findings or recommendations.
|
|
137
|
+
_Avoid_: Child-authored workflow script, self-modifying workflow
|
|
138
|
+
|
|
139
|
+
**Execution approval**:
|
|
140
|
+
An explicit `APPROVE <8-character SHA-256 prefix>` authorization entered by the user after preparation in the same active parent session to execute one exact workflow-script revision once. Preparation also binds resolved role behavior and tools; any change requires preparation and approval again. Parent-guided recovery creates a new run.
|
|
141
|
+
_Avoid_: Pre-prepare approval, cross-session approval, friendly-ID mapping, reusable approval, implicit approval
|
|
142
|
+
|
|
143
|
+
**Preflight discovery**:
|
|
144
|
+
A parent-directed, read-only investigation after an orchestration request and before execution approval; it is not workflow execution.
|
|
145
|
+
_Avoid_: Unapproved node, workflow execution
|
|
146
|
+
|
|
147
|
+
## Prototype evidence
|
|
148
|
+
|
|
149
|
+
### JavaScript review workflow — validated
|
|
150
|
+
|
|
151
|
+
- **Question:** Can JavaScript await real Pi-backed Herdr children internally, fan review out, synthesize every final result, and return one value without public subagent steers?
|
|
152
|
+
- **Primary source:** branch `prototype/js-review-workflow`, commit `4622e08731d31ccda1c33eb01cff5610d86d0166`
|
|
153
|
+
- **Run:** `npm run prototype:review-workflow`
|
|
154
|
+
- **Observed:** three parallel Luna reviewers and one Luna synthesizer completed; the prototype's synthetic replacement is historical evidence only and is not part of the shipped flow; every real child used only read-only tools; no child result entered the parent session; completed panes closed; the exact-base shared checkout was disposed; sessions and a 15-event journal remained.
|
|
155
|
+
- **VM result:** `agent.constructor(...)` reached the host `process`, confirming that Node `vm` is not a security boundary.
|
|
156
|
+
- **Event-loop result:** a separate Node 26.3 probe showed that the VM timeout stops a synchronous infinite loop but not one started after `await`; production workflow code must run in a terminable Worker thread rather than Pi's main event loop.
|
|
157
|
+
- **Self-hosting result:** child `pi -ne -e subagent-done.ts` avoided duplicate loading of the repository and globally installed subagent extensions.
|
|
158
|
+
- **Answered later:** cancel-all is shipped as `herdr_workflow cancel` under a process-global terminal gate: active panes capture Herdr process identities before close, checkout dispose requires confirmed exit, and unconfirmed termination retains the checkout and ends `failed` with `cancel_termination_failed`.
|
|
159
|
+
- **Not answered:** writer review visibility; typed retryability remains deferred, while real launch-failure classification is covered by the shipped workflow failure envelope and same-process `/reload` ownership is covered by the process-global workflow owner.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 HazAT
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|