pi-pstack-workflow-kit 0.1.0 → 0.1.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/README.md +33 -9
- package/lib/catalog.ts +53 -4
- package/lib/models.ts +10 -9
- package/lib/pool.ts +4 -6
- package/lib/state.ts +24 -24
- package/lib/transcript.ts +19 -15
- package/package.json +17 -20
- package/reference/PARITY.md +1 -1
- package/scripts/job-input.ts +38 -39
- package/scripts/run-job.mjs +9 -7
- package/skills/architect/SKILL.md +1 -1
- package/skills/arena/SKILL.md +1 -1
- package/skills/automate-me/SKILL.md +1 -1
- package/skills/benchmark-checklist/SKILL.md +1 -1
- package/skills/blast-radius/SKILL.md +1 -1
- package/skills/bro/SKILL.md +1 -1
- package/skills/check-compiler-errors/SKILL.md +1 -1
- package/skills/control-cli/SKILL.md +1 -1
- package/skills/control-ui/SKILL.md +1 -1
- package/skills/correct/SKILL.md +1 -1
- package/skills/create-formal-verification-skill/SKILL.md +1 -1
- package/skills/create-verification-skill/SKILL.md +1 -1
- package/skills/deslop/SKILL.md +1 -1
- package/skills/figure-it-out/SKILL.md +1 -1
- package/skills/fix-ci/SKILL.md +1 -1
- package/skills/fix-merge-conflicts/SKILL.md +1 -1
- package/skills/get-pr-comments/SKILL.md +1 -1
- package/skills/how/SKILL.md +1 -1
- package/skills/in-your-own-words/SKILL.md +1 -1
- package/skills/interrogate/SKILL.md +1 -1
- package/skills/ketchup/SKILL.md +1 -1
- package/skills/ketchup-video/SKILL.md +1 -1
- package/skills/loop-on-ci/SKILL.md +1 -1
- package/skills/maintain-formal-verification-skill/SKILL.md +1 -1
- package/skills/maintain-verification-skill/SKILL.md +1 -1
- package/skills/make-bot-ui/SKILL.md +1 -1
- package/skills/make-pr-easy-to-review/SKILL.md +1 -1
- package/skills/new-branch-and-pr/SKILL.md +1 -1
- package/skills/no-comments/SKILL.md +1 -1
- package/skills/poteto-help/SKILL.md +1 -1
- package/skills/poteto-mode/SKILL.md +1 -1
- package/skills/poteto-mode/playbooks/authoring-a-skill.md +1 -1
- package/skills/poteto-mode/playbooks/autonomous-run.md +1 -1
- package/skills/poteto-mode/playbooks/autopilot-full.md +1 -1
- package/skills/poteto-mode/playbooks/autopilot-stack.md +1 -1
- package/skills/poteto-mode/playbooks/babysit.md +1 -1
- package/skills/poteto-mode/playbooks/bug-fix.md +1 -1
- package/skills/poteto-mode/playbooks/eval.md +1 -1
- package/skills/poteto-mode/playbooks/feature.md +1 -1
- package/skills/poteto-mode/playbooks/hillclimb.md +1 -1
- package/skills/poteto-mode/playbooks/investigation.md +1 -1
- package/skills/poteto-mode/playbooks/multi-phase-plan.md +1 -1
- package/skills/poteto-mode/playbooks/opening-a-pr.md +1 -1
- package/skills/poteto-mode/playbooks/pause-safely.md +1 -1
- package/skills/poteto-mode/playbooks/perf-issue.md +1 -1
- package/skills/poteto-mode/playbooks/prototype.md +1 -1
- package/skills/poteto-mode/playbooks/refactoring.md +1 -1
- package/skills/poteto-mode/playbooks/runtime-forensics.md +1 -1
- package/skills/poteto-mode/playbooks/session-pickup.md +1 -1
- package/skills/poteto-mode/playbooks/shipping.md +1 -1
- package/skills/poteto-mode/playbooks/trace-forensics.md +1 -1
- package/skills/poteto-mode/playbooks/visual-parity.md +1 -1
- package/skills/poteto-mode/playbooks/worktree-cleanup.md +1 -1
- package/skills/pr-review-canvas/SKILL.md +1 -1
- package/skills/principle-attack-the-premise/SKILL.md +1 -1
- package/skills/principle-boundary-discipline/SKILL.md +1 -1
- package/skills/principle-build-the-lever/SKILL.md +1 -1
- package/skills/principle-encode-lessons-in-structure/SKILL.md +1 -1
- package/skills/principle-exhaust-the-design-space/SKILL.md +1 -1
- package/skills/principle-experience-first/SKILL.md +1 -1
- package/skills/principle-explain-the-number/SKILL.md +1 -1
- package/skills/principle-fix-root-causes/SKILL.md +1 -1
- package/skills/principle-foundational-thinking/SKILL.md +1 -1
- package/skills/principle-guard-the-context-window/SKILL.md +1 -1
- package/skills/principle-laziness-protocol/SKILL.md +1 -1
- package/skills/principle-make-operations-idempotent/SKILL.md +1 -1
- package/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +1 -1
- package/skills/principle-minimize-reader-load/SKILL.md +1 -1
- package/skills/principle-model-the-domain/SKILL.md +1 -1
- package/skills/principle-never-block-on-the-human/SKILL.md +1 -1
- package/skills/principle-outcome-oriented-execution/SKILL.md +1 -1
- package/skills/principle-prove-it-works/SKILL.md +1 -1
- package/skills/principle-redesign-from-first-principles/SKILL.md +1 -1
- package/skills/principle-separate-before-serializing-shared-state/SKILL.md +1 -1
- package/skills/principle-sequence-verifiable-units/SKILL.md +1 -1
- package/skills/principle-subtract-before-you-add/SKILL.md +1 -1
- package/skills/principle-test-behavior-not-implementation/SKILL.md +1 -1
- package/skills/principle-type-system-discipline/SKILL.md +1 -1
- package/skills/recall/SKILL.md +1 -1
- package/skills/reflect/SKILL.md +1 -1
- package/skills/review-and-ship/SKILL.md +1 -1
- package/skills/run-smoke-tests/SKILL.md +1 -1
- package/skills/setup-pstack/SKILL.md +1 -1
- package/skills/sharpen/SKILL.md +1 -1
- package/skills/show-me-your-work/SKILL.md +1 -1
- package/skills/statechart/SKILL.md +1 -1
- package/skills/swarm/SKILL.md +1 -1
- package/skills/tdd/SKILL.md +1 -1
- package/skills/teach/SKILL.md +1 -1
- package/skills/technical-writing/SKILL.md +1 -1
- package/skills/thermo-nuclear-code-quality-review/SKILL.md +1 -1
- package/skills/typescript-best-practices/SKILL.md +1 -1
- package/skills/unslop/SKILL.md +1 -1
- package/skills/verify-this/SKILL.md +1 -1
- package/skills/weekly-review/SKILL.md +1 -1
- package/skills/what-did-i-get-done/SKILL.md +1 -1
- package/skills/why/SKILL.md +1 -1
- package/skills/workflow-from-chats/SKILL.md +1 -1
- package/{extensions → src}/catalog-ui.ts +2 -2
- package/{extensions → src}/delegate.ts +40 -30
- package/{extensions → src}/forge.ts +18 -17
- package/{extensions → src}/git.ts +6 -1
- package/{extensions → src}/models.ts +87 -13
- package/{extensions → src}/parent-diff.ts +4 -3
- package/{extensions → src}/plan.ts +3 -3
- package/{extensions → src}/records.ts +8 -4
- package/{extensions → src}/support.ts +3 -2
- package/{extensions → src}/worktrees.ts +3 -3
- package/{extensions → src}/index.ts +0 -0
- package/{extensions → src}/session.ts +1 -1
|
@@ -9,4 +9,4 @@ Define the final state and exit predicate. Keep intermediate compatibility code
|
|
|
9
9
|
|
|
10
10
|
Read this leaf before applying it. In the final report, cite this principle only if it changed a specific decision and state that decision.
|
|
11
11
|
|
|
12
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
12
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -9,4 +9,4 @@ Define the observable claim. Execute the real artifact under matching conditions
|
|
|
9
9
|
|
|
10
10
|
Read this leaf before applying it. In the final report, cite this principle only if it changed a specific decision and state that decision.
|
|
11
11
|
|
|
12
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
12
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -9,4 +9,4 @@ Sketch the design with the new requirement present from the beginning. Compare w
|
|
|
9
9
|
|
|
10
10
|
Read this leaf before applying it. In the final report, cite this principle only if it changed a specific decision and state that decision.
|
|
11
11
|
|
|
12
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
12
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -9,4 +9,4 @@ List actors and shared writes. Partition ownership before considering locks or q
|
|
|
9
9
|
|
|
10
10
|
Read this leaf before applying it. In the final report, cite this principle only if it changed a specific decision and state that decision.
|
|
11
11
|
|
|
12
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
12
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -9,4 +9,4 @@ Divide work into small dependency-ordered changes. Verify each before proceeding
|
|
|
9
9
|
|
|
10
10
|
Read this leaf before applying it. In the final report, cite this principle only if it changed a specific decision and state that decision.
|
|
11
11
|
|
|
12
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
12
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -9,4 +9,4 @@ Find obsolete paths and tests, remove dead code in a checked slice, then add the
|
|
|
9
9
|
|
|
10
10
|
Read this leaf before applying it. In the final report, cite this principle only if it changed a specific decision and state that decision.
|
|
11
11
|
|
|
12
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
12
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -9,4 +9,4 @@ Assert the public result and relevant error cases. Change implementation details
|
|
|
9
9
|
|
|
10
10
|
Read this leaf before applying it. In the final report, cite this principle only if it changed a specific decision and state that decision.
|
|
11
11
|
|
|
12
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
12
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -9,4 +9,4 @@ Use discriminated unions, domain types and exhaustive cases. Parse external data
|
|
|
9
9
|
|
|
10
10
|
Read this leaf before applying it. In the final report, cite this principle only if it changed a specific decision and state that decision.
|
|
11
11
|
|
|
12
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
12
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
package/skills/recall/SKILL.md
CHANGED
|
@@ -7,4 +7,4 @@ description: "Reconstruct current context from relevant chat history and shared
|
|
|
7
7
|
|
|
8
8
|
Use `pstack_history` for current branch history, then read relevant Pi session records and shared project artifacts. Verify the current branch and status before summarizing. Do not invent unavailable historical context.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
package/skills/reflect/SKILL.md
CHANGED
|
@@ -7,4 +7,4 @@ description: "Capture lessons from a finished task. Use when: When a long task l
|
|
|
7
7
|
|
|
8
8
|
Review actual session decisions and results; propose a focused skill change preserving a repeatable success pattern. Validate the changed skill with a representative task before committing.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -7,4 +7,4 @@ description: "Perform a structured review, commit and open a PR. Use when: When
|
|
|
7
7
|
|
|
8
8
|
Review diff and behavior, fix verified issues, deslop, run checks, and commit/open a PR only within the operator’s scope. Do not conflate PR creation with permission to merge.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -7,4 +7,4 @@ description: "Run Playwright smoke tests and triage failures. Use when: When the
|
|
|
7
7
|
|
|
8
8
|
Find actual repository smoke test commands, use Playwright if configured, execute in an isolated environment, collect traces/screenshots and diagnose failing behavior.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -14,4 +14,4 @@ These are catalog references, not a mandatory call sequence. Read related instru
|
|
|
14
14
|
|
|
15
15
|
- `models`: writes. After model and budget confirmation
|
|
16
16
|
|
|
17
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
17
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
package/skills/sharpen/SKILL.md
CHANGED
|
@@ -8,4 +8,4 @@ disable-model-invocation: true
|
|
|
8
8
|
|
|
9
9
|
Return the rewritten prompt only unless asked to explain changes. Specify the evidence, verification methods and independent checks; settle runnable questions with prototypes during the eventual task, not during this rewrite.
|
|
10
10
|
|
|
11
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
11
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -13,4 +13,4 @@ These are catalog references, not a mandatory call sequence. Read related instru
|
|
|
13
13
|
|
|
14
14
|
- `decision-log`: writes. Store audit trail
|
|
15
15
|
|
|
16
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
16
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -7,4 +7,4 @@ description: "Turn a checked TLA+ model into a user-facing statechart. Use when:
|
|
|
7
7
|
|
|
8
8
|
Run the TLA+ checker first. Export reachable states and transitions, derive shortest violating traces with breadth-first search, and draw Mermaid state transitions with explicit violating states. Cite the checked model and output.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
package/skills/swarm/SKILL.md
CHANGED
|
@@ -13,4 +13,4 @@ These are catalog references, not a mandatory call sequence. Read related instru
|
|
|
13
13
|
|
|
14
14
|
- `cli-subagents`: parallel workers. parallel workers
|
|
15
15
|
|
|
16
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
16
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
package/skills/tdd/SKILL.md
CHANGED
|
@@ -7,4 +7,4 @@ description: "Write the failing test before the fix. Use when: For bugs with an
|
|
|
7
7
|
|
|
8
8
|
Run a new behavioral regression test and record its failure for the intended reason. Implement the smallest fix, rerun the same test and surrounding tests. Explain when a cheap test path does not exist; do not fabricate red.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
package/skills/teach/SKILL.md
CHANGED
|
@@ -14,4 +14,4 @@ These are catalog references, not a mandatory call sequence. Read related instru
|
|
|
14
14
|
- `how`: mechanics. mechanics
|
|
15
15
|
- `why`: motivation. motivation
|
|
16
16
|
|
|
17
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
17
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -7,4 +7,4 @@ description: "Apply a layered technical writing standard. Use when: For docs, RF
|
|
|
7
7
|
|
|
8
8
|
Choose tutorial, how-to, reference or explanation for the actual reader. Use stable terminology, clear prerequisites and tested examples; write PR descriptions with goal, changes and evidence. Apply global English and consistent instructions.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -7,4 +7,4 @@ description: "Perform a stringent maintainability review. Use when: When evaluat
|
|
|
7
7
|
|
|
8
8
|
Review actual changes for needless layers, coupling, type holes, mutation and reader load; classify only actionable findings with paths and evidence; use a read-only quality worker for independent review.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -7,4 +7,4 @@ description: "Apply type discipline in TypeScript. Use when: When reading or edi
|
|
|
7
7
|
|
|
8
8
|
Read applicable type-system-discipline and boundary-discipline. Use discriminants, narrow validated input at edges, prefer exhaustive switch cases, use module-level imports, and avoid `any` as an escape hatch. Run repository type checks.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
package/skills/unslop/SKILL.md
CHANGED
|
@@ -7,4 +7,4 @@ description: "Remove AI writing tells from prose. Use when: When composing or re
|
|
|
7
7
|
|
|
8
8
|
Preserve facts and intended tone. Remove generic transitions, unsupported attribution, formulaic parallelism, unnecessary qualifiers, filler and repetitive headings. Use direct active sentences and verify the revised text preserves meaning.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -14,4 +14,4 @@ These are catalog references, not a mandatory call sequence. Read related instru
|
|
|
14
14
|
- `kit-control-ui`: UI evidence. Team Kit verify-this supports UI artifacts
|
|
15
15
|
- `kit-control-cli`: terminal evidence. Team Kit verify-this supports terminal artifacts
|
|
16
16
|
|
|
17
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
17
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -7,4 +7,4 @@ description: "Summarize shipped work across the week. Use when: For a weekly eng
|
|
|
7
7
|
|
|
8
8
|
Use git/forge records for the named week and group shipped fixes, debt and features. Distinguish merged versus merely opened PRs.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -7,4 +7,4 @@ description: "Summarize authored commits over a time range. Use when: When writi
|
|
|
7
7
|
|
|
8
8
|
Query authored commits for the specified date range and branches; report concrete changes with commit/PR links and note coverage limits.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
package/skills/why/SKILL.md
CHANGED
|
@@ -7,4 +7,4 @@ description: "Find historical motivation from the record. Use when: When a desig
|
|
|
7
7
|
|
|
8
8
|
Inspect git history, blame, commit messages, and accessible PR discussion. Distinguish stated motivations from inference and gaps. Remain read-only.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -7,4 +7,4 @@ description: "Extract durable working preferences from chats. Use when: When rec
|
|
|
7
7
|
|
|
8
8
|
Read relevant authorized Pi sessions and extract repeated decisions and instructions into a durable Pi skill or AGENTS.md change; show evidence and validate.
|
|
9
9
|
|
|
10
|
-
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `
|
|
10
|
+
<!-- Generated by scripts/generate.py from scripts/catalog-source.json. Edit the source, then run `python3 scripts/generate.py`. -->
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
views,
|
|
12
12
|
workflowPrompt,
|
|
13
13
|
} from "../lib/catalog.ts";
|
|
14
|
-
import {
|
|
14
|
+
import { type Notify, result, stringEnum, text } from "./support.ts";
|
|
15
15
|
|
|
16
16
|
const ownCommands = new Set(["setup-pstack", "poteto-mode"]);
|
|
17
17
|
|
|
@@ -29,7 +29,7 @@ async function browse(pi: ExtensionAPI, ctx: ExtensionContext, start: string) {
|
|
|
29
29
|
const chosen = await ctx.ui.select(`${v.title}\n${v.caption}`, choices);
|
|
30
30
|
if (!chosen || chosen === "Exit") return;
|
|
31
31
|
if (chosen.startsWith("view:")) {
|
|
32
|
-
current = chosen.slice(5).split(" ")[0];
|
|
32
|
+
current = chosen.slice(5).split(" ")[0] ?? current;
|
|
33
33
|
continue;
|
|
34
34
|
}
|
|
35
35
|
const n = nativeNode(chosen.slice(5));
|
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { mkdir,
|
|
2
|
+
import { mkdir, readdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
|
|
5
5
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
6
|
-
import {
|
|
6
|
+
import { type Static, Type } from "typebox";
|
|
7
7
|
|
|
8
8
|
import { root } from "../lib/catalog.ts";
|
|
9
9
|
import {
|
|
10
|
+
type Budget,
|
|
10
11
|
crossJudge,
|
|
12
|
+
type Effort,
|
|
11
13
|
effort,
|
|
12
14
|
isRole,
|
|
13
15
|
judgeRole,
|
|
14
16
|
modelFor,
|
|
15
|
-
selectPanel,
|
|
16
|
-
type Budget,
|
|
17
|
-
type Effort,
|
|
18
17
|
type Role,
|
|
19
18
|
type RoleConfig,
|
|
19
|
+
selectPanel,
|
|
20
20
|
} from "../lib/models.ts";
|
|
21
21
|
import { pool, type PoolResult } from "../lib/pool.ts";
|
|
22
22
|
import { blindTranscript, readPaths } from "../lib/transcript.ts";
|
|
23
23
|
import { errorMessage } from "../lib/validation.ts";
|
|
24
24
|
import { gitIn } from "./git.ts";
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
import {
|
|
26
|
+
availableWorkerModels,
|
|
27
|
+
modelName,
|
|
28
|
+
readConfig,
|
|
29
|
+
workerExtensions,
|
|
30
|
+
workerIsolation,
|
|
31
|
+
} from "./models.ts";
|
|
32
|
+
import { type ParentDiff, saveParentDiff } from "./parent-diff.ts";
|
|
33
|
+
import { artifacts, fail, piBin, result, stringEnum } from "./support.ts";
|
|
28
34
|
import { createWorktree } from "./worktrees.ts";
|
|
29
35
|
|
|
30
36
|
const modes = ["single", "swarm", "arena", "interrogate"] as const;
|
|
@@ -56,7 +62,6 @@ const panelModelRoles: Partial<Record<Mode, Role>> = {
|
|
|
56
62
|
swarm: "swarm workers",
|
|
57
63
|
};
|
|
58
64
|
|
|
59
|
-
const piBin = process.env.PSTACK_PI_BIN ?? "pi";
|
|
60
65
|
const parameters = Type.Object({
|
|
61
66
|
mode: stringEnum(modes),
|
|
62
67
|
tasks: Type.Array(Type.String({ minLength: 1 }), { minItems: 1, maxItems: 8 }),
|
|
@@ -87,7 +92,7 @@ function resolveWorkers(
|
|
|
87
92
|
const choices = config.roles[modelRole];
|
|
88
93
|
const panel = p.mode === "arena" || p.mode === "interrogate";
|
|
89
94
|
if (panel && choices.length < 2) fail("Configure at least two panel seats in /setup-pstack");
|
|
90
|
-
const tasks = panel ? choices.
|
|
95
|
+
const tasks = panel ? choices.flatMap(() => p.tasks) : p.tasks;
|
|
91
96
|
const models = selectPanel(config, modelRole, tasks.length).map((m) => modelFor(m, parent));
|
|
92
97
|
assertReachable(available, models);
|
|
93
98
|
const judge = p.mode === "arena" ? crossJudge(config, parent, models, available) : undefined;
|
|
@@ -95,25 +100,25 @@ function resolveWorkers(
|
|
|
95
100
|
fail(
|
|
96
101
|
`Configure an available judge from another provider than the parent and all candidates in /setup-pstack. Configured pool: ${config.roles[judgeRole].join(", ") || "(empty)"}.`,
|
|
97
102
|
);
|
|
98
|
-
|
|
103
|
+
const workers = tasks.flatMap((task, i) =>
|
|
104
|
+
models.slice(i, i + 1).map((model) => ({ task, model })),
|
|
105
|
+
);
|
|
106
|
+
return { role, modelRole, readOnly, workers, judge };
|
|
99
107
|
}
|
|
100
108
|
|
|
101
109
|
export function workerArgs(options: {
|
|
102
110
|
model: string;
|
|
103
111
|
thinking: Effort;
|
|
104
112
|
readOnly: boolean;
|
|
113
|
+
extension?: string | undefined;
|
|
105
114
|
sessionDir: string;
|
|
106
115
|
sessionId: string;
|
|
107
116
|
prompt: string;
|
|
108
117
|
}) {
|
|
109
118
|
return [
|
|
110
119
|
"--print",
|
|
111
|
-
|
|
112
|
-
"
|
|
113
|
-
"--no-skills",
|
|
114
|
-
"--no-prompt-templates",
|
|
115
|
-
"--no-themes",
|
|
116
|
-
"--no-mcp",
|
|
120
|
+
...workerIsolation,
|
|
121
|
+
...(options.extension ? ["-e", options.extension] : []),
|
|
117
122
|
"--tools",
|
|
118
123
|
options.readOnly ? "read,grep,find,ls" : "read,grep,find,ls,bash,edit,write",
|
|
119
124
|
"--session-dir",
|
|
@@ -140,10 +145,11 @@ interface WorkerRequest {
|
|
|
140
145
|
interface RunnerOptions {
|
|
141
146
|
dir: string;
|
|
142
147
|
budget: Budget;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
extensions: ReadonlyMap<string, string>;
|
|
149
|
+
rubric: string | undefined;
|
|
150
|
+
base: string | undefined;
|
|
151
|
+
diff: ParentDiff | undefined;
|
|
152
|
+
signal: AbortSignal | undefined;
|
|
147
153
|
progress: (message: string) => void;
|
|
148
154
|
}
|
|
149
155
|
|
|
@@ -202,6 +208,7 @@ function createRunner(
|
|
|
202
208
|
model,
|
|
203
209
|
thinking: effort(modelRole, options.budget, model),
|
|
204
210
|
readOnly,
|
|
211
|
+
extension: options.extensions.get(model),
|
|
205
212
|
sessionDir,
|
|
206
213
|
sessionId: id,
|
|
207
214
|
prompt: await workerPrompt(request, options),
|
|
@@ -209,9 +216,9 @@ function createRunner(
|
|
|
209
216
|
options.progress(`Running ${id}`);
|
|
210
217
|
const run = await pi.exec(piBin, args, {
|
|
211
218
|
cwd: tree.path,
|
|
212
|
-
signal,
|
|
213
219
|
timeout: 30 * 60 * 1000,
|
|
214
220
|
maxBuffer: 4 * 1024 * 1024,
|
|
221
|
+
...(signal && { signal }),
|
|
215
222
|
});
|
|
216
223
|
const report = join(dir, `${id}.txt`);
|
|
217
224
|
await Promise.all([
|
|
@@ -223,7 +230,8 @@ function createRunner(
|
|
|
223
230
|
const sessions = (await readdir(sessionDir, { recursive: true })).filter((path) =>
|
|
224
231
|
path.endsWith(".jsonl"),
|
|
225
232
|
);
|
|
226
|
-
const
|
|
233
|
+
const [session, ...others] = sessions;
|
|
234
|
+
const transcript = session !== undefined && !others.length ? join(sessionDir, session) : null;
|
|
227
235
|
return {
|
|
228
236
|
id,
|
|
229
237
|
model,
|
|
@@ -293,7 +301,7 @@ function assertReachable(available: ReadonlySet<string>, models: string[]) {
|
|
|
293
301
|
const unreachable = [...new Set(models)].filter((model) => !available.has(model));
|
|
294
302
|
if (unreachable.length)
|
|
295
303
|
fail(
|
|
296
|
-
`Workers
|
|
304
|
+
`Workers load no extension except the one that provides their model. Unavailable in the current worker scope: ${unreachable.join(", ")}. Choose an available model in /setup-pstack.`,
|
|
297
305
|
);
|
|
298
306
|
}
|
|
299
307
|
|
|
@@ -307,9 +315,10 @@ export function registerDelegation(pi: ExtensionAPI, active: Set<string>) {
|
|
|
307
315
|
async execute(_id, p, signal, onUpdate, ctx) {
|
|
308
316
|
const config = await readConfig();
|
|
309
317
|
if (!ctx.model) fail("Select a parent model first");
|
|
310
|
-
const parent =
|
|
311
|
-
const
|
|
312
|
-
const
|
|
318
|
+
const parent = modelName(ctx.model);
|
|
319
|
+
const extensions = await workerExtensions(pi, ctx, signal);
|
|
320
|
+
const available = new Set(availableWorkerModels(ctx, extensions));
|
|
321
|
+
const { role, modelRole, readOnly, workers, judge } = resolveWorkers(
|
|
313
322
|
p,
|
|
314
323
|
config,
|
|
315
324
|
parent,
|
|
@@ -320,7 +329,7 @@ export function registerDelegation(pi: ExtensionAPI, active: Set<string>) {
|
|
|
320
329
|
(!ctx.hasUI ||
|
|
321
330
|
!(await ctx.ui.confirm(
|
|
322
331
|
"Authorize isolated write workers?",
|
|
323
|
-
`${
|
|
332
|
+
`${workers.length} worker(s), detached worktrees from ${p.base ?? "HEAD"}. Workers can execute shell commands; worktrees are not a security sandbox.`,
|
|
324
333
|
)))
|
|
325
334
|
)
|
|
326
335
|
fail("Write delegation not authorized");
|
|
@@ -331,12 +340,13 @@ export function registerDelegation(pi: ExtensionAPI, active: Set<string>) {
|
|
|
331
340
|
signal,
|
|
332
341
|
diff: await saveParentDiff(pi, ctx.cwd, dir, signal),
|
|
333
342
|
budget: config.budget,
|
|
343
|
+
extensions,
|
|
334
344
|
base: p.base,
|
|
335
345
|
rubric: p.rubric,
|
|
336
346
|
progress: (message) => onUpdate?.(result(message)),
|
|
337
347
|
});
|
|
338
|
-
const outputs = await pool(
|
|
339
|
-
run({ task, index, model
|
|
348
|
+
const outputs = await pool(workers, p.concurrency ?? 3, ({ task, model }, index) =>
|
|
349
|
+
run({ task, index, model, readOnly, role, modelRole }),
|
|
340
350
|
);
|
|
341
351
|
const judgment =
|
|
342
352
|
judge &&
|
|
@@ -33,7 +33,7 @@ const checksPass = (pr: PullRequestStatus) =>
|
|
|
33
33
|
: check.state === "SUCCESS",
|
|
34
34
|
);
|
|
35
35
|
const mergeReady = (proof: Proof, pr: PullRequestStatus) =>
|
|
36
|
-
!!proof.evidence
|
|
36
|
+
!!proof.evidence.trim() &&
|
|
37
37
|
proof.independent &&
|
|
38
38
|
proof.head === pr.headRefOid &&
|
|
39
39
|
pr.state === "OPEN" &&
|
|
@@ -67,20 +67,20 @@ function prUrl(value: unknown, number: number): value is string {
|
|
|
67
67
|
function isStatus(value: unknown, number: number): value is PullRequestStatus {
|
|
68
68
|
return (
|
|
69
69
|
isRecord(value) &&
|
|
70
|
-
value
|
|
71
|
-
prUrl(value
|
|
72
|
-
typeof value
|
|
73
|
-
/^[0-9a-f]{40}$/i.test(value
|
|
74
|
-
typeof value
|
|
75
|
-
typeof value
|
|
76
|
-
typeof value
|
|
77
|
-
typeof value
|
|
78
|
-
(value
|
|
79
|
-
(Array.isArray(value
|
|
80
|
-
value
|
|
70
|
+
value["number"] === number &&
|
|
71
|
+
prUrl(value["url"], number) &&
|
|
72
|
+
typeof value["headRefOid"] === "string" &&
|
|
73
|
+
/^[0-9a-f]{40}$/i.test(value["headRefOid"]) &&
|
|
74
|
+
typeof value["state"] === "string" &&
|
|
75
|
+
typeof value["isDraft"] === "boolean" &&
|
|
76
|
+
typeof value["mergeable"] === "string" &&
|
|
77
|
+
typeof value["mergeStateStatus"] === "string" &&
|
|
78
|
+
(value["statusCheckRollup"] === null ||
|
|
79
|
+
(Array.isArray(value["statusCheckRollup"]) &&
|
|
80
|
+
value["statusCheckRollup"].every(
|
|
81
81
|
(check: unknown) =>
|
|
82
82
|
isRecord(check) &&
|
|
83
|
-
[check
|
|
83
|
+
[check["status"], check["conclusion"], check["state"]].every(
|
|
84
84
|
(field) => field === undefined || typeof field === "string",
|
|
85
85
|
),
|
|
86
86
|
)))
|
|
@@ -95,9 +95,9 @@ async function fetchPr(
|
|
|
95
95
|
) {
|
|
96
96
|
const r = await pi.exec("gh", ["pr", "view", String(id), "--json", checksFields], {
|
|
97
97
|
cwd: ctx.cwd,
|
|
98
|
-
signal,
|
|
99
98
|
timeout: 30000,
|
|
100
99
|
maxBuffer: 4 * 1024 * 1024,
|
|
100
|
+
...(signal && { signal }),
|
|
101
101
|
});
|
|
102
102
|
if (r.truncated || r.killed) fail("gh pr view failed: output truncated or process stopped");
|
|
103
103
|
if (r.code !== 0) fail(`gh pr view failed: ${r.stderr}`);
|
|
@@ -125,9 +125,10 @@ async function previewPrefix(
|
|
|
125
125
|
const statuses = reads.flatMap((read) => (read.status === "fulfilled" ? [read.value] : []));
|
|
126
126
|
const prefix = verifiedPrefix(proofs, statuses);
|
|
127
127
|
const next = reads[prefix.length];
|
|
128
|
+
const unread = proofs[prefix.length];
|
|
128
129
|
const lookupFailure =
|
|
129
|
-
next?.status === "rejected"
|
|
130
|
-
? { number:
|
|
130
|
+
unread && next?.status === "rejected"
|
|
131
|
+
? { number: unread.number, error: errorMessage(next.reason) }
|
|
131
132
|
: undefined;
|
|
132
133
|
if (!prefix.length)
|
|
133
134
|
fail(
|
|
@@ -175,7 +176,7 @@ async function mergePrefix(
|
|
|
175
176
|
const r = await pi.exec(
|
|
176
177
|
"gh",
|
|
177
178
|
["pr", "merge", proof.url, "--merge", "--match-head-commit", proof.head],
|
|
178
|
-
{ cwd: ctx.cwd,
|
|
179
|
+
{ cwd: ctx.cwd, timeout: 60000, maxBuffer: 1024 * 1024, ...(signal && { signal }) },
|
|
179
180
|
);
|
|
180
181
|
if (r.code !== 0 || r.killed || r.truncated) return { ...uncertain, error: r.stderr };
|
|
181
182
|
|
|
@@ -9,7 +9,12 @@ export function gitIn(
|
|
|
9
9
|
maxBuffer = 4 * 1024 * 1024,
|
|
10
10
|
) {
|
|
11
11
|
async function probe(args: string[], at = cwd, limit = maxBuffer) {
|
|
12
|
-
const r = await pi.exec("git", args, {
|
|
12
|
+
const r = await pi.exec("git", args, {
|
|
13
|
+
cwd: at,
|
|
14
|
+
timeout: 30000,
|
|
15
|
+
maxBuffer: limit,
|
|
16
|
+
...(signal && { signal }),
|
|
17
|
+
});
|
|
13
18
|
return r.truncated || r.killed ? undefined : r;
|
|
14
19
|
}
|
|
15
20
|
async function run(args: string[], at = cwd) {
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
judgeRole,
|
|
13
13
|
panelRoles,
|
|
14
14
|
parseModelConfig,
|
|
15
|
-
roles,
|
|
16
|
-
validateConfig,
|
|
17
15
|
type Role,
|
|
18
16
|
type RoleConfig,
|
|
17
|
+
roles,
|
|
18
|
+
validateConfig,
|
|
19
19
|
} from "../lib/models.ts";
|
|
20
20
|
import { parseJson } from "../lib/validation.ts";
|
|
21
|
-
import { agentDir, atomicWrite, fail, hasErrorCode,
|
|
21
|
+
import { agentDir, atomicWrite, fail, hasErrorCode, type Notify, piBin, text } from "./support.ts";
|
|
22
22
|
|
|
23
23
|
const modelConfigPath = () => join(agentDir(), "pstack-models.json");
|
|
24
24
|
export async function readConfig(configPath = modelConfigPath()): Promise<RoleConfig> {
|
|
@@ -31,14 +31,88 @@ export async function readConfig(configPath = modelConfigPath()): Promise<RoleCo
|
|
|
31
31
|
}
|
|
32
32
|
return parseModelConfig(parseJson(source, "pstack model configuration"));
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
|
|
35
|
+
export const workerIsolation = [
|
|
36
|
+
"--no-approve",
|
|
37
|
+
"--no-extensions",
|
|
38
|
+
"--no-skills",
|
|
39
|
+
"--no-prompt-templates",
|
|
40
|
+
"--no-themes",
|
|
41
|
+
"--no-mcp",
|
|
42
|
+
];
|
|
43
|
+
const modelsInScope = (ctx: ExtensionContext) =>
|
|
44
|
+
ctx.scopedModels.length ? ctx.scopedModels.map((m) => m.model) : ctx.modelRegistry.getAvailable();
|
|
45
|
+
export const modelName = (m: { provider: string; id: string }) => `${m.provider}/${m.id}`;
|
|
46
|
+
|
|
47
|
+
async function listedModels(
|
|
48
|
+
pi: ExtensionAPI,
|
|
49
|
+
cwd: string,
|
|
50
|
+
signal?: AbortSignal,
|
|
51
|
+
extension?: string,
|
|
52
|
+
) {
|
|
53
|
+
const run = await pi.exec(
|
|
54
|
+
piBin,
|
|
55
|
+
[...workerIsolation, ...(extension ? ["-e", extension] : []), "--list-models"],
|
|
56
|
+
{ cwd, timeout: 30_000, ...(signal && { signal }) },
|
|
57
|
+
);
|
|
58
|
+
if (run.code !== 0 || run.killed) return undefined;
|
|
59
|
+
// Pi pads each row to the header's columns; ids can contain spaces, so split by position.
|
|
60
|
+
const [header = "", ...rows] = run.stdout.split("\n");
|
|
61
|
+
const [model, context] = [header.indexOf("model"), header.indexOf("context")];
|
|
62
|
+
return rows
|
|
63
|
+
.map((row) => ({ provider: row.slice(0, model).trim(), id: row.slice(model, context).trim() }))
|
|
64
|
+
.filter((listed) => listed.provider && listed.id)
|
|
65
|
+
.map((listed) => ({ provider: listed.provider, model: modelName(listed) }));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Maps each in-scope model of an extension-registered provider to the loaded extension a worker
|
|
70
|
+
* needs for it. Pi does not report which extension registered a provider, so every extension that
|
|
71
|
+
* registers a command is listed alone and compared with the listing without extensions.
|
|
72
|
+
*/
|
|
73
|
+
export async function workerExtensions(
|
|
74
|
+
pi: ExtensionAPI,
|
|
75
|
+
ctx: ExtensionContext,
|
|
76
|
+
signal?: AbortSignal,
|
|
77
|
+
) {
|
|
78
|
+
const registered = new Set(ctx.modelRegistry.getRegisteredProviderIds());
|
|
79
|
+
const wanted = new Set(
|
|
80
|
+
modelsInScope(ctx)
|
|
81
|
+
.filter((m) => registered.has(m.provider))
|
|
82
|
+
.map(modelName),
|
|
83
|
+
);
|
|
84
|
+
const loaded = [
|
|
85
|
+
...new Set(
|
|
86
|
+
pi
|
|
87
|
+
.getCommands()
|
|
88
|
+
.filter((command) => command.source === "extension")
|
|
89
|
+
.map((command) => command.sourceInfo.path),
|
|
90
|
+
),
|
|
91
|
+
];
|
|
92
|
+
if (!wanted.size || !loaded.length) return new Map<string, string>();
|
|
93
|
+
const [builtIn, ...listings] = await Promise.all(
|
|
94
|
+
[undefined, ...loaded].map((extension) => listedModels(pi, ctx.cwd, signal, extension)),
|
|
95
|
+
);
|
|
96
|
+
if (signal?.aborted) fail("Cancelled");
|
|
97
|
+
if (!builtIn) fail(`Could not list worker models: ${piBin} --list-models failed`);
|
|
98
|
+
const builtInProviders = new Set(builtIn.map((listed) => listed.provider));
|
|
99
|
+
return new Map(
|
|
100
|
+
loaded.flatMap((extension, i) =>
|
|
101
|
+
(listings[i] ?? [])
|
|
102
|
+
.filter((listed) => wanted.has(listed.model) && !builtInProviders.has(listed.provider))
|
|
103
|
+
.map((listed) => [listed.model, extension] as const),
|
|
104
|
+
),
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function availableWorkerModels(
|
|
109
|
+
ctx: ExtensionContext,
|
|
110
|
+
extensions: ReadonlyMap<string, string>,
|
|
111
|
+
) {
|
|
112
|
+
const registered = new Set(ctx.modelRegistry.getRegisteredProviderIds());
|
|
113
|
+
const ids = modelsInScope(ctx)
|
|
114
|
+
.filter((m) => !registered.has(m.provider) || extensions.has(modelName(m)))
|
|
115
|
+
.map(modelName);
|
|
42
116
|
return [...new Set(ids)].toSorted();
|
|
43
117
|
}
|
|
44
118
|
|
|
@@ -87,8 +161,8 @@ export function registerModelSetup(pi: ExtensionAPI, notify: Notify) {
|
|
|
87
161
|
pi.registerCommand("setup-pstack", {
|
|
88
162
|
description: "Configure pstack role models and reasoning budget",
|
|
89
163
|
handler: async (args, ctx) => {
|
|
90
|
-
const available = availableWorkerModels(ctx);
|
|
91
|
-
const parent = ctx.model &&
|
|
164
|
+
const available = availableWorkerModels(ctx, await workerExtensions(pi, ctx));
|
|
165
|
+
const parent = ctx.model && modelName(ctx.model);
|
|
92
166
|
const warning =
|
|
93
167
|
parent && !available.includes(parent)
|
|
94
168
|
? `auto and inherit-parent resolve to ${parent}, which is unavailable to workers in this session. Select an available model explicitly.`
|