dsh-pstack 0.2.0-beta.1 → 0.2.0-beta.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/LICENSE +2 -3
- package/README.md +135 -84
- package/README.zh.md +185 -0
- package/cordis.patch.yml +97 -27
- package/dist/host-contract-CUPSpeNk.d.mts +22 -0
- package/dist/index.d.mts +49 -238
- package/dist/index.mjs +250 -123
- package/dist/models.d.mts +44 -0
- package/dist/models.mjs +201 -0
- package/dist/paths-BT77khwm.mjs +48 -0
- package/dist/pstack/LICENSE +21 -0
- package/dist/pstack/README.md +291 -0
- package/dist/pstack/agents/poteto-agent.md +9 -0
- package/{assets → dist/pstack}/docs/guide/01-setup.md +13 -11
- package/{assets → dist/pstack}/docs/guide/02-poteto-mode.md +4 -4
- package/{assets → dist/pstack}/docs/guide/04-design.md +4 -4
- package/{assets → dist/pstack}/docs/guide/05-build-and-clean.md +2 -2
- package/{assets → dist/pstack}/docs/guide/06-verify-and-ship.md +13 -3
- package/{assets → dist/pstack}/docs/guide/07-overnight.md +15 -13
- package/{assets → dist/pstack}/docs/guide/09-make-it-yours.md +6 -2
- package/{assets → dist/pstack}/docs/guide/10-recipes-and-pitfalls.md +7 -5
- package/{assets → dist/pstack}/docs/guide/README.md +1 -1
- package/dist/pstack/docs/harness/dsh.md +98 -0
- package/{assets → dist/pstack}/skills/architect/SKILL.md +12 -12
- package/dist/pstack/skills/arena/SKILL.md +50 -0
- package/{assets → dist/pstack}/skills/automate-me/SKILL.md +14 -14
- package/{assets → dist/pstack}/skills/benchmark-checklist/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/blast-radius/SKILL.md +4 -6
- package/{assets → dist/pstack}/skills/correct/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/create-formal-verification-skill/SKILL.md +4 -2
- package/{assets → dist/pstack}/skills/create-verification-skill/SKILL.md +5 -5
- package/dist/pstack/skills/figure-it-out/SKILL.md +54 -0
- package/dist/pstack/skills/how/SKILL.md +38 -0
- package/{assets → dist/pstack}/skills/in-your-own-words/SKILL.md +1 -1
- package/dist/pstack/skills/interrogate/SKILL.md +33 -0
- package/{assets → dist/pstack}/skills/ketchup/SKILL.md +3 -5
- package/dist/pstack/skills/ketchup-video/SKILL.md +29 -0
- package/{assets → dist/pstack}/skills/maintain-formal-verification-skill/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/maintain-verification-skill/SKILL.md +3 -3
- package/dist/pstack/skills/make-bot-ui/SKILL.md +117 -0
- package/dist/pstack/skills/no-comments/SKILL.md +26 -0
- package/{assets → dist/pstack}/skills/poteto-help/SKILL.md +34 -31
- package/{assets → dist/pstack}/skills/poteto-help/references/prompting.md +1 -1
- package/{assets → dist/pstack}/skills/poteto-help/references/recipes.md +3 -3
- package/{assets → dist/pstack}/skills/poteto-mode/SKILL.md +20 -19
- package/dist/pstack/skills/poteto-mode/playbooks/authoring-a-skill.md +12 -0
- package/dist/pstack/skills/poteto-mode/playbooks/autonomous-run.md +13 -0
- package/dist/pstack/skills/poteto-mode/playbooks/autopilot-full.md +25 -0
- package/dist/pstack/skills/poteto-mode/playbooks/autopilot-stack.md +8 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/babysit.md +4 -4
- package/dist/pstack/skills/poteto-mode/playbooks/bug-fix.md +15 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/eval.md +3 -3
- package/dist/pstack/skills/poteto-mode/playbooks/feature.md +21 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/hillclimb.md +3 -3
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/investigation.md +2 -2
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/multi-phase-plan.md +23 -23
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/opening-a-pr.md +6 -6
- package/dist/pstack/skills/poteto-mode/playbooks/orchestrate.md +25 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/pause-safely.md +2 -2
- package/dist/pstack/skills/poteto-mode/playbooks/perf-issue.md +25 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/prototype.md +4 -4
- package/dist/pstack/skills/poteto-mode/playbooks/refactoring.md +16 -0
- package/dist/pstack/skills/poteto-mode/playbooks/runtime-forensics.md +11 -0
- package/dist/pstack/skills/poteto-mode/playbooks/session-pickup.md +11 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/shipping.md +2 -2
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/trace-forensics.md +2 -2
- package/dist/pstack/skills/poteto-mode/playbooks/visual-parity.md +11 -0
- package/dist/pstack/skills/poteto-mode/playbooks/worktree-cleanup.md +12 -0
- package/{assets → dist/pstack}/skills/poteto-mode/scripts/check-plan.mjs +6 -8
- package/dist/pstack/skills/poteto-mode/scripts/check-plan.test.mjs +128 -0
- package/{assets/skills/poteto-mode/scripts/check-plan.test.mjs → dist/pstack/skills/poteto-mode/scripts/expect.mjs} +12 -101
- package/dist/pstack/skills/poteto-mode/scripts/support.mjs +93 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/cli.mjs +123 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/cli.test.mjs +217 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.mjs +119 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/github.mjs +626 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/github.test.mjs +521 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/policy.mjs +657 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/policy.test.mjs +523 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/render.mjs +106 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/types.mjs +9 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/watch-pr.mjs +5 -0
- package/{assets → dist/pstack}/skills/poteto-mode/scripts/worktree-audit.mjs +15 -22
- package/dist/pstack/skills/poteto-mode/scripts/worktree-audit.test.mjs +134 -0
- package/{assets → dist/pstack}/skills/principle-attack-the-premise/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-boundary-discipline/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-encode-lessons-in-structure/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-exhaust-the-design-space/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-experience-first/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-explain-the-number/SKILL.md +3 -2
- package/{assets → dist/pstack}/skills/principle-fix-root-causes/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-laziness-protocol/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-make-operations-idempotent/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-minimize-reader-load/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-model-the-domain/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-never-block-on-the-human/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-outcome-oriented-execution/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-prove-it-works/SKILL.md +2 -2
- package/{assets → dist/pstack}/skills/principle-redesign-from-first-principles/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-separate-before-serializing-shared-state/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-sequence-verifiable-units/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-subtract-before-you-add/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-test-behavior-not-implementation/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-type-system-discipline/SKILL.md +1 -1
- package/dist/pstack/skills/recall/SKILL.md +37 -0
- package/dist/pstack/skills/reflect/SKILL.md +71 -0
- package/{assets → dist/pstack}/skills/reflect/references/divergent-reviewer.md +4 -4
- package/{assets → dist/pstack}/skills/reflect/references/judgment-reviewer.md +2 -2
- package/{assets → dist/pstack}/skills/reflect/references/synthesizer.md +5 -5
- package/{assets → dist/pstack}/skills/reflect/references/tooling-reviewer.md +2 -2
- package/dist/pstack/skills/setup-pstack/SKILL.md +80 -0
- package/{assets → dist/pstack}/skills/sharpen/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/show-me-your-work/SKILL.md +8 -8
- package/{assets → dist/pstack}/skills/show-me-your-work/scripts/log.mjs +1 -3
- package/dist/pstack/skills/show-me-your-work/scripts/log.test.mjs +56 -0
- package/dist/pstack/skills/statechart/SKILL.md +82 -0
- package/dist/pstack/skills/statechart/references/render.md +93 -0
- package/dist/pstack/skills/statechart/scripts/backends/cfg.mjs +31 -0
- package/dist/pstack/skills/statechart/scripts/backends/mermaid.mjs +186 -0
- package/dist/pstack/skills/statechart/scripts/backends/plain-text.mjs +62 -0
- package/dist/pstack/skills/statechart/scripts/backends/report.mjs +84 -0
- package/dist/pstack/skills/statechart/scripts/frontends/config.mjs +268 -0
- package/dist/pstack/skills/statechart/scripts/frontends/dot.mjs +67 -0
- package/dist/pstack/skills/statechart/scripts/frontends/marks.mjs +94 -0
- package/dist/pstack/skills/statechart/scripts/frontends/messages.mjs +48 -0
- package/dist/pstack/skills/statechart/scripts/frontends/spec.mjs +101 -0
- package/dist/pstack/skills/statechart/scripts/frontends/trace.mjs +39 -0
- package/dist/pstack/skills/statechart/scripts/frontends/value.mjs +180 -0
- package/dist/pstack/skills/statechart/scripts/frontends/verdict.mjs +40 -0
- package/dist/pstack/skills/statechart/scripts/frontends/view.mjs +99 -0
- package/dist/pstack/skills/statechart/scripts/ir.mjs +277 -0
- package/dist/pstack/skills/statechart/scripts/passes/annotate.mjs +92 -0
- package/dist/pstack/skills/statechart/scripts/passes/label.mjs +210 -0
- package/dist/pstack/skills/statechart/scripts/passes/lift.mjs +84 -0
- package/dist/pstack/skills/statechart/scripts/passes/loop-check.mjs +47 -0
- package/dist/pstack/skills/statechart/scripts/passes/paths.mjs +72 -0
- package/dist/pstack/skills/statechart/scripts/passes/reach.mjs +135 -0
- package/dist/pstack/skills/statechart/scripts/passes/region-check.mjs +82 -0
- package/dist/pstack/skills/statechart/scripts/passes/regions.mjs +268 -0
- package/dist/pstack/skills/statechart/scripts/pipeline.mjs +72 -0
- package/dist/pstack/skills/statechart/scripts/run.mjs +440 -0
- package/dist/pstack/skills/statechart/scripts/statechart.mjs +155 -0
- package/dist/pstack/skills/statechart/scripts/statechart.test.mjs +198 -0
- package/dist/pstack/skills/statechart/scripts/worker.mjs +31 -0
- package/dist/pstack/skills/swarm/SKILL.md +43 -0
- package/{assets → dist/pstack}/skills/tdd/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/teach/SKILL.md +2 -2
- package/{assets → dist/pstack}/skills/technical-writing/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/typescript-best-practices/SKILL.md +3 -6
- package/{assets → dist/pstack}/skills/why/SKILL.md +8 -8
- package/dist/script.d.mts +9 -111
- package/dist/script.mjs +32 -329
- package/dist/skill.d.mts +38 -0
- package/dist/skill.mjs +183 -0
- package/dist/skills/authored/decision-audit/SKILL.md +99 -0
- package/dist/skills/authored/decision-audit/SKILL.zh.md +99 -0
- package/dist/skills/authored/decision-audit/references/recover-commit.md +17 -0
- package/dist/skills/authored/decision-audit/references/recover-commit.zh.md +17 -0
- package/dist/skills/authored/decision-write/SKILL.md +131 -0
- package/dist/skills/authored/decision-write/SKILL.zh.md +131 -0
- package/dist/skills/authored/decision-write/references/land.md +48 -0
- package/dist/skills/authored/decision-write/references/land.zh.md +48 -0
- package/dist/skills/authored/setup-project-docs/SKILL.md +58 -0
- package/dist/skills/authored/setup-project-docs/SKILL.zh.md +58 -0
- package/dist/skills/authored/setup-project-docs/references/decision-conventions.md +11 -0
- package/dist/skills/authored/setup-project-docs/references/decision-conventions.zh.md +11 -0
- package/dist/skills/vendored/retro/SKILL.md +44 -0
- package/dist/skills/vendored/retro/agents/openai.yaml +5 -0
- package/dist/skills/vendored/writing-for-agents/SKILL-MECHANICS.md +22 -0
- package/dist/skills/vendored/writing-for-agents/SKILL.md +81 -0
- package/dist/skills/vendored/writing-for-agents/agents/openai.yaml +3 -0
- package/dist/subagent.d.mts +56 -193
- package/dist/subagent.mjs +443 -741
- package/locale/en.json +3 -2
- package/locale/zh.json +3 -2
- package/package.json +63 -66
- package/assets/agents/poteto-agent.md +0 -8
- package/assets/docs/harness/dsh.md +0 -60
- package/assets/docs/pstack-models.example.md +0 -54
- package/assets/skills/arena/SKILL.md +0 -50
- package/assets/skills/figure-it-out/SKILL.md +0 -54
- package/assets/skills/how/SKILL.md +0 -38
- package/assets/skills/interrogate/SKILL.md +0 -71
- package/assets/skills/interrogate/references/code-quality-review.md +0 -47
- package/assets/skills/interrogate/references/lead-judgment.md +0 -39
- package/assets/skills/interrogate/references/reviewer-prompt.md +0 -62
- package/assets/skills/interrogate/references/rubric.md +0 -77
- package/assets/skills/no-comments/SKILL.md +0 -26
- package/assets/skills/poteto-mode/playbooks/authoring-a-skill.md +0 -12
- package/assets/skills/poteto-mode/playbooks/autonomous-run.md +0 -15
- package/assets/skills/poteto-mode/playbooks/autopilot-full.md +0 -25
- package/assets/skills/poteto-mode/playbooks/autopilot-stack.md +0 -12
- package/assets/skills/poteto-mode/playbooks/bug-fix.md +0 -15
- package/assets/skills/poteto-mode/playbooks/feature.md +0 -21
- package/assets/skills/poteto-mode/playbooks/orchestrate.md +0 -112
- package/assets/skills/poteto-mode/playbooks/perf-issue.md +0 -25
- package/assets/skills/poteto-mode/playbooks/refactoring.md +0 -16
- package/assets/skills/poteto-mode/playbooks/runtime-forensics.md +0 -11
- package/assets/skills/poteto-mode/playbooks/session-pickup.md +0 -11
- package/assets/skills/poteto-mode/playbooks/visual-parity.md +0 -11
- package/assets/skills/poteto-mode/playbooks/worktree-cleanup.md +0 -20
- package/assets/skills/poteto-mode/scripts/orch/orch.mjs +0 -4282
- package/assets/skills/poteto-mode/scripts/orch/orch.test.mjs +0 -2042
- package/assets/skills/poteto-mode/scripts/watch-pr/cli.test.mjs +0 -5101
- package/assets/skills/poteto-mode/scripts/watch-pr/github.test.mjs +0 -1177
- package/assets/skills/poteto-mode/scripts/watch-pr/policy.test.mjs +0 -1441
- package/assets/skills/poteto-mode/scripts/watch-pr/watch-pr.mjs +0 -4601
- package/assets/skills/recall/SKILL.md +0 -37
- package/assets/skills/reflect/SKILL.md +0 -69
- package/assets/skills/setup-pstack/SKILL.md +0 -67
- package/assets/skills/swarm/SKILL.md +0 -43
- package/dist/frontmatter-BQX3ekwP.mjs +0 -229
- package/dist/frontmatter-BQX3ekwP.mjs.map +0 -1
- package/dist/history.d.mts +0 -429
- package/dist/history.mjs +0 -1129
- package/dist/history.mjs.map +0 -1
- package/dist/host-contract-o47JH_r8.d.mts +0 -527
- package/dist/index.mjs.map +0 -1
- package/dist/paths-D_JlVmBk.mjs +0 -42
- package/dist/paths-D_JlVmBk.mjs.map +0 -1
- package/dist/script.mjs.map +0 -1
- package/dist/subagent.mjs.map +0 -1
- /package/{static/icon.png → assets/logo.png} +0 -0
- /package/{assets → dist/pstack}/agents/comment-sicko.md +0 -0
- /package/{assets → dist/pstack}/docs/guide/03-understand.md +0 -0
- /package/{assets → dist/pstack}/docs/guide/08-principles.md +0 -0
- /package/{assets → dist/pstack}/docs/guide/images/design.jpg +0 -0
- /package/{assets → dist/pstack}/docs/guide/images/overnight.jpg +0 -0
- /package/{assets → dist/pstack}/docs/guide/images/recipes.jpg +0 -0
- /package/{assets → dist/pstack}/docs/guide/images/router.jpg +0 -0
- /package/{assets → dist/pstack}/docs/guide/images/understanding.jpg +0 -0
- /package/{assets → dist/pstack}/docs/guide/images/verification.jpg +0 -0
- /package/{assets → dist/pstack}/skills/architect/references/design-red-flags.md +0 -0
- /package/{assets → dist/pstack}/skills/architect/references/rationale-template.md +0 -0
- /package/{assets → dist/pstack}/skills/architect/references/runner-prompt.md +0 -0
- /package/{assets → dist/pstack}/skills/bro/SKILL.md +0 -0
- /package/{assets → dist/pstack}/skills/create-verification-skill/references/feature-map-example/README.md +0 -0
- /package/{assets → dist/pstack}/skills/create-verification-skill/references/feature-map-example/create-note.md +0 -0
- /package/{assets → dist/pstack}/skills/create-verification-skill/references/feature-map-example/search.md +0 -0
- /package/{assets → dist/pstack}/skills/how/references/explainer-prompt.md +0 -0
- /package/{assets → dist/pstack}/skills/how/references/explorer-prompt.md +0 -0
- /package/{assets → dist/pstack}/skills/poteto-mode/references/bugbot-triage.md +0 -0
- /package/{assets → dist/pstack}/skills/principle-build-the-lever/SKILL.md +0 -0
- /package/{assets → dist/pstack}/skills/principle-foundational-thinking/SKILL.md +0 -0
- /package/{assets → dist/pstack}/skills/principle-guard-the-context-window/SKILL.md +0 -0
- /package/{assets → dist/pstack}/skills/show-me-your-work/references/decision-log-template.tsv +0 -0
- /package/{assets → dist/pstack}/skills/typescript-best-practices/references/patterns.md +0 -0
- /package/{assets → dist/pstack}/skills/unslop/SKILL.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/epistemics.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/investigator-prompt.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/source-playbook.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/code-archaeology.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/databricks.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/datadog.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/incident-postmortem.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/linear.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/notion.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/sentry.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/slack.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/synthesizer-prompt.md +0 -0
package/dist/script.mjs
CHANGED
|
@@ -1,202 +1,47 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as PORT_ROOT } from "./paths-BT77khwm.mjs";
|
|
2
2
|
import { isAbsolute, join, resolve } from "node:path";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const AUTHORED_ROOT = "scripts/runtime/";
|
|
7
|
-
/** `TEST_SUPPORT` as entry sources, so a test entry declares what it imports. */
|
|
8
|
-
const TEST_SUPPORT_ROOTS = [{
|
|
9
|
-
kind: "authored",
|
|
10
|
-
path: `${AUTHORED_ROOT}tests/expect.ts`
|
|
11
|
-
}, {
|
|
12
|
-
kind: "authored",
|
|
13
|
-
path: `${AUTHORED_ROOT}tests/support.ts`
|
|
14
|
-
}];
|
|
15
|
-
const upstreamScript = (path) => ({
|
|
16
|
-
kind: "upstream",
|
|
17
|
-
path: `skills/poteto-mode/scripts/${path}`
|
|
18
|
-
});
|
|
19
|
-
/** CLI artifacts, in the order the reviews and the prose name them. */
|
|
20
|
-
const RUNTIME_CLIS = [
|
|
4
|
+
// src/internal/script-registry.ts
|
|
5
|
+
const SCRIPT_ENTRIES = [
|
|
21
6
|
{
|
|
22
7
|
id: "check-plan",
|
|
23
|
-
|
|
24
|
-
entry: upstreamScript("check-plan.mjs"),
|
|
25
|
-
out: "check-plan.mjs",
|
|
26
|
-
assetPath: "skills/poteto-mode/scripts/check-plan.mjs",
|
|
27
|
-
executable: true,
|
|
28
|
-
sources: [upstreamScript("check-plan.mjs")],
|
|
29
|
-
summary: "plan-shape checker"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
id: "orch",
|
|
33
|
-
kind: "cli",
|
|
34
|
-
entry: upstreamScript("orch/orch.ts"),
|
|
35
|
-
out: "orch/orch.mjs",
|
|
36
|
-
assetPath: "skills/poteto-mode/scripts/orch/orch.mjs",
|
|
37
|
-
executable: true,
|
|
38
|
-
sources: [upstreamScript("orch/orch.ts"), upstreamScript("orch/store.ts")],
|
|
39
|
-
summary: "orchestration bookkeeping store"
|
|
8
|
+
assetPath: "skills/poteto-mode/scripts/check-plan.mjs"
|
|
40
9
|
},
|
|
41
10
|
{
|
|
42
11
|
id: "watch-pr",
|
|
43
|
-
|
|
44
|
-
entry: upstreamScript("watch-pr/watch-pr"),
|
|
45
|
-
out: "watch-pr/watch-pr.mjs",
|
|
46
|
-
assetPath: "skills/poteto-mode/scripts/watch-pr/watch-pr.mjs",
|
|
47
|
-
executable: true,
|
|
48
|
-
sources: [
|
|
49
|
-
upstreamScript("watch-pr/watch-pr"),
|
|
50
|
-
upstreamScript("watch-pr/cli.ts"),
|
|
51
|
-
upstreamScript("watch-pr/github.ts"),
|
|
52
|
-
upstreamScript("watch-pr/policy.ts"),
|
|
53
|
-
upstreamScript("watch-pr/render.ts"),
|
|
54
|
-
upstreamScript("watch-pr/types.ts")
|
|
55
|
-
],
|
|
56
|
-
summary: "pull-request watcher"
|
|
12
|
+
assetPath: "skills/poteto-mode/scripts/watch-pr/watch-pr.mjs"
|
|
57
13
|
},
|
|
58
14
|
{
|
|
59
15
|
id: "worktree-audit",
|
|
60
|
-
|
|
61
|
-
entry: {
|
|
62
|
-
kind: "authored",
|
|
63
|
-
path: `${AUTHORED_ROOT}worktree-audit.ts`
|
|
64
|
-
},
|
|
65
|
-
out: "worktree-audit.mjs",
|
|
66
|
-
assetPath: "skills/poteto-mode/scripts/worktree-audit.mjs",
|
|
67
|
-
executable: true,
|
|
68
|
-
sources: [{
|
|
69
|
-
kind: "authored",
|
|
70
|
-
path: `${AUTHORED_ROOT}worktree-audit.ts`
|
|
71
|
-
}],
|
|
72
|
-
summary: "read-only worktree audit"
|
|
16
|
+
assetPath: "skills/poteto-mode/scripts/worktree-audit.mjs"
|
|
73
17
|
},
|
|
74
18
|
{
|
|
75
19
|
id: "log",
|
|
76
|
-
|
|
77
|
-
entry: {
|
|
78
|
-
kind: "authored",
|
|
79
|
-
path: `${AUTHORED_ROOT}log.ts`
|
|
80
|
-
},
|
|
81
|
-
out: "log.mjs",
|
|
82
|
-
assetPath: "skills/show-me-your-work/scripts/log.mjs",
|
|
83
|
-
executable: true,
|
|
84
|
-
sources: [{
|
|
85
|
-
kind: "authored",
|
|
86
|
-
path: `${AUTHORED_ROOT}log.ts`
|
|
87
|
-
}],
|
|
88
|
-
summary: "decision-log row appender"
|
|
89
|
-
}
|
|
90
|
-
];
|
|
91
|
-
/** Test bundles, run by `node --test` from a copy with no install step. */
|
|
92
|
-
const RUNTIME_TESTS = [
|
|
93
|
-
{
|
|
94
|
-
id: "check-plan-test",
|
|
95
|
-
kind: "test",
|
|
96
|
-
entry: upstreamScript("check-plan.test.ts"),
|
|
97
|
-
out: "check-plan.test.mjs",
|
|
98
|
-
assetPath: "skills/poteto-mode/scripts/check-plan.test.mjs",
|
|
99
|
-
executable: false,
|
|
100
|
-
sources: [upstreamScript("check-plan.test.ts")],
|
|
101
|
-
summary: "check-plan tests"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
id: "orch-test",
|
|
105
|
-
kind: "test",
|
|
106
|
-
entry: upstreamScript("orch/orch.test.ts"),
|
|
107
|
-
out: "orch/orch.test.mjs",
|
|
108
|
-
assetPath: "skills/poteto-mode/scripts/orch/orch.test.mjs",
|
|
109
|
-
executable: false,
|
|
110
|
-
sources: [
|
|
111
|
-
upstreamScript("orch/orch.test.ts"),
|
|
112
|
-
upstreamScript("orch/store.ts"),
|
|
113
|
-
...TEST_SUPPORT_ROOTS
|
|
114
|
-
],
|
|
115
|
-
summary: "orch tests"
|
|
20
|
+
assetPath: "skills/show-me-your-work/scripts/log.mjs"
|
|
116
21
|
},
|
|
117
22
|
{
|
|
118
|
-
id: "
|
|
119
|
-
|
|
120
|
-
entry: upstreamScript("watch-pr/cli.test.ts"),
|
|
121
|
-
out: "watch-pr/cli.test.mjs",
|
|
122
|
-
assetPath: "skills/poteto-mode/scripts/watch-pr/cli.test.mjs",
|
|
123
|
-
executable: false,
|
|
124
|
-
sources: [
|
|
125
|
-
upstreamScript("watch-pr/cli.test.ts"),
|
|
126
|
-
upstreamScript("watch-pr/cli.ts"),
|
|
127
|
-
upstreamScript("watch-pr/github.ts"),
|
|
128
|
-
upstreamScript("watch-pr/policy.ts"),
|
|
129
|
-
upstreamScript("watch-pr/render.ts"),
|
|
130
|
-
upstreamScript("watch-pr/types.ts"),
|
|
131
|
-
upstreamScript("watch-pr/fakes.test-helper.ts"),
|
|
132
|
-
...TEST_SUPPORT_ROOTS
|
|
133
|
-
],
|
|
134
|
-
summary: "watch-pr argument and rendering tests"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
id: "watch-pr-github-test",
|
|
138
|
-
kind: "test",
|
|
139
|
-
entry: upstreamScript("watch-pr/github.test.ts"),
|
|
140
|
-
out: "watch-pr/github.test.mjs",
|
|
141
|
-
assetPath: "skills/poteto-mode/scripts/watch-pr/github.test.mjs",
|
|
142
|
-
executable: false,
|
|
143
|
-
sources: [
|
|
144
|
-
upstreamScript("watch-pr/github.test.ts"),
|
|
145
|
-
upstreamScript("watch-pr/github.ts"),
|
|
146
|
-
upstreamScript("watch-pr/types.ts"),
|
|
147
|
-
upstreamScript("watch-pr/fakes.test-helper.ts"),
|
|
148
|
-
...TEST_SUPPORT_ROOTS
|
|
149
|
-
],
|
|
150
|
-
summary: "watch-pr GitHub reader tests"
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
id: "watch-pr-policy-test",
|
|
154
|
-
kind: "test",
|
|
155
|
-
entry: upstreamScript("watch-pr/policy.test.ts"),
|
|
156
|
-
out: "watch-pr/policy.test.mjs",
|
|
157
|
-
assetPath: "skills/poteto-mode/scripts/watch-pr/policy.test.mjs",
|
|
158
|
-
executable: false,
|
|
159
|
-
sources: [
|
|
160
|
-
upstreamScript("watch-pr/policy.test.ts"),
|
|
161
|
-
upstreamScript("watch-pr/policy.ts"),
|
|
162
|
-
upstreamScript("watch-pr/github.ts"),
|
|
163
|
-
upstreamScript("watch-pr/types.ts"),
|
|
164
|
-
upstreamScript("watch-pr/fakes.test-helper.ts"),
|
|
165
|
-
...TEST_SUPPORT_ROOTS
|
|
166
|
-
],
|
|
167
|
-
summary: "watch-pr policy and queue tests"
|
|
23
|
+
id: "statechart",
|
|
24
|
+
assetPath: "skills/statechart/scripts/statechart.mjs"
|
|
168
25
|
}
|
|
169
26
|
];
|
|
170
|
-
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region src/script.ts
|
|
27
|
+
// src/script.ts
|
|
173
28
|
/**
|
|
174
29
|
* `pstack_script`: run a bundled pstack script through the Host's own runtime.
|
|
175
30
|
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* So the entry point is a tool, not a command. The tool spawns the artefact with
|
|
181
|
-
* `process.execPath` — whichever binary is already running this Host, Node or
|
|
182
|
-
* Electron — and passes `ELECTRON_RUN_AS_NODE=1` only when it is Electron. That is
|
|
183
|
-
* what makes the npm CLI and the Desktop build behave the same without depending on
|
|
184
|
-
* anything in `PATH`.
|
|
31
|
+
* The `id` is a closed enum over the shipped artefacts and resolves from this package,
|
|
32
|
+
* so a call cannot reach a script the package does not contain. It is not a shell: no
|
|
33
|
+
* `sh -c`, no glob expansion, no way to name another executable.
|
|
185
34
|
*
|
|
186
|
-
* The
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* expansion by a shell, and no way to name another executable.
|
|
35
|
+
* The child is spawned with `process.execPath` — whichever binary runs this Host, Node or
|
|
36
|
+
* Electron — and `ELECTRON_RUN_AS_NODE=1` only under Electron. That makes the npm CLI and
|
|
37
|
+
* the Desktop build behave the same without `node` on `PATH`.
|
|
190
38
|
*/
|
|
191
39
|
/** Model-facing tool name. */
|
|
192
40
|
const TOOL_NAME = "pstack_script";
|
|
193
41
|
/** The shipped scripts this tool may run, in display order. */
|
|
194
|
-
const SCRIPT_IDS =
|
|
195
|
-
/** Default wall-clock limit for a foreground run. */
|
|
42
|
+
const SCRIPT_IDS = SCRIPT_ENTRIES.map((entry) => entry.id);
|
|
196
43
|
const DEFAULT_TIMEOUT_MS = 12e4;
|
|
197
|
-
/** Bounds a caller may set for one foreground run. */
|
|
198
44
|
const MAX_TIMEOUT_MS = 6e5;
|
|
199
|
-
/** Default cap on captured bytes per stream. */
|
|
200
45
|
const DEFAULT_OUTPUT_LIMIT_BYTES = 65536;
|
|
201
46
|
/** Raised for an argument problem, before anything is spawned. */
|
|
202
47
|
var ScriptInputError = class extends Error {
|
|
@@ -214,20 +59,11 @@ var ScriptMissingError = class extends Error {
|
|
|
214
59
|
};
|
|
215
60
|
/** Absolute path of one shipped artefact. */
|
|
216
61
|
function scriptPath(id) {
|
|
217
|
-
const entry =
|
|
62
|
+
const entry = SCRIPT_ENTRIES.find((candidate) => candidate.id === id);
|
|
218
63
|
if (entry === void 0) throw new ScriptInputError(`unknown script id "${String(id)}"`);
|
|
219
|
-
return join(
|
|
64
|
+
return join(PORT_ROOT, ...entry.assetPath.split("/"));
|
|
220
65
|
}
|
|
221
|
-
/**
|
|
222
|
-
* The environment a child gets.
|
|
223
|
-
*
|
|
224
|
-
* The one rule is the Electron selector. Under Electron, `process.execPath` is the
|
|
225
|
-
* Desktop binary, which starts a browser window unless `ELECTRON_RUN_AS_NODE=1` tells
|
|
226
|
-
* it to behave as Node. Under plain Node the variable is inert — Node ignores it —
|
|
227
|
-
* so setting it unconditionally would also work; it is conditional here so the
|
|
228
|
-
* environment of a normal run stays exactly the caller's, and the one code path that
|
|
229
|
-
* needs it is visible.
|
|
230
|
-
*/
|
|
66
|
+
/** The environment a child gets: the Electron selector, and otherwise the caller's. */
|
|
231
67
|
function scriptEnvironment(base = process.env, versions = process.versions) {
|
|
232
68
|
if (versions.electron === void 0) return { ...base };
|
|
233
69
|
return {
|
|
@@ -279,33 +115,13 @@ function parseScriptArgs(raw) {
|
|
|
279
115
|
...outputLimitBytes === void 0 ? {} : { outputLimitBytes }
|
|
280
116
|
};
|
|
281
117
|
}
|
|
282
|
-
/**
|
|
283
|
-
* Resolve the directory the child runs in.
|
|
284
|
-
*
|
|
285
|
-
* The tool's `cwd` argument is documented as resolving against "this session's
|
|
286
|
-
* directory", so `sessionCwd` — the value `ctx.workingDirectory.ensure()` returns —
|
|
287
|
-
* is the base, not the Host process's working directory.
|
|
288
|
-
*
|
|
289
|
-
* - omitted -> the session directory
|
|
290
|
-
* - relative -> joined onto the session directory
|
|
291
|
-
* - absolute -> used as-is
|
|
292
|
-
*
|
|
293
|
-
* With no Session (a call outside an Agent) there is no session directory to
|
|
294
|
-
* anchor to; the argument is then passed through and `resolve` normalises it
|
|
295
|
-
* against the Host process, which is the only directory that exists.
|
|
296
|
-
*/
|
|
118
|
+
/** Resolve the directory the child runs in, relative to the caller-established session directory. */
|
|
297
119
|
function resolveWorkingDirectory(requested, sessionCwd) {
|
|
298
120
|
if (requested === void 0) return sessionCwd;
|
|
299
121
|
if (isAbsolute(requested)) return resolve(requested);
|
|
300
122
|
return sessionCwd === void 0 ? resolve(requested) : resolve(join(sessionCwd, requested));
|
|
301
123
|
}
|
|
302
|
-
/**
|
|
303
|
-
* Run one script in the foreground.
|
|
304
|
-
*
|
|
305
|
-
* A nonzero exit, a signal, a timeout, and truncated output are all returned rather
|
|
306
|
-
* than raised: the caller needs to see what the script said before it failed, and an
|
|
307
|
-
* exception would discard the captured output.
|
|
308
|
-
*/
|
|
124
|
+
/** Run one script in the foreground. A nonzero exit, signal, timeout, and truncation are returned, not thrown. */
|
|
309
125
|
async function runForeground(args, options = {}) {
|
|
310
126
|
const path = scriptPath(args.id);
|
|
311
127
|
const started = Date.now();
|
|
@@ -361,7 +177,7 @@ async function runForeground(args, options = {}) {
|
|
|
361
177
|
resolve({
|
|
362
178
|
kind: "foreground",
|
|
363
179
|
id: args.id,
|
|
364
|
-
exitCode: code ??
|
|
180
|
+
exitCode: code ?? 1,
|
|
365
181
|
signal,
|
|
366
182
|
timedOut,
|
|
367
183
|
stdout,
|
|
@@ -373,13 +189,7 @@ async function runForeground(args, options = {}) {
|
|
|
373
189
|
});
|
|
374
190
|
});
|
|
375
191
|
}
|
|
376
|
-
/**
|
|
377
|
-
* Start a script as a background job.
|
|
378
|
-
*
|
|
379
|
-
* `jobs` is required and passing nothing is a refusal with a reason. A job whose
|
|
380
|
-
* output nobody can read would be worse than a failed call: the model would report a
|
|
381
|
-
* task as started and no notice would ever arrive.
|
|
382
|
-
*/
|
|
192
|
+
/** Start a script as a background job. `jobs` absent is a refusal with a reason. */
|
|
383
193
|
async function runBackground(args, options) {
|
|
384
194
|
const jobs = options.jobs;
|
|
385
195
|
if (jobs === void 0) throw new ScriptInputError("background: true needs the Host jobs service, and this composition has none. Run the call in the foreground (omit background), or ask the operator to mount a job controller.");
|
|
@@ -387,38 +197,6 @@ async function runBackground(args, options) {
|
|
|
387
197
|
const execPath = options.execPath ?? process.execPath;
|
|
388
198
|
const environment = options.environment ?? scriptEnvironment();
|
|
389
199
|
const cwd = options.cwd;
|
|
390
|
-
/**
|
|
391
|
-
* Settles when the child either started or failed to start, or when the registry
|
|
392
|
-
* never invoked the producer at all.
|
|
393
|
-
*
|
|
394
|
-
* `run` fills this in, so the caller can await the real startup outcome instead of
|
|
395
|
-
* guessing at one with a timer. `child_process` emits exactly one of `spawn` or
|
|
396
|
-
* `error`:
|
|
397
|
-
*
|
|
398
|
-
* - `spawn` fires once the child has been created, before any stdio or exit event.
|
|
399
|
-
* - `error` fires instead when creation failed (ENOENT, EACCES, EMFILE), and no
|
|
400
|
-
* `spawn` ever follows.
|
|
401
|
-
*
|
|
402
|
-
* So these two events are mutually exclusive and jointly exhaustive for "did it
|
|
403
|
-
* start", which is exactly the question the tool has to answer. Measured on this
|
|
404
|
-
* Node: a missing binary reports ENOENT through `error`, while a real binary —
|
|
405
|
-
* including one that exits immediately or runs slowly — reports `spawn` with no
|
|
406
|
-
* error.
|
|
407
|
-
*
|
|
408
|
-
* `state` exists because the promise must never be able to hang. Two cases would
|
|
409
|
-
* otherwise leave it pending forever:
|
|
410
|
-
*
|
|
411
|
-
* - a registry that registers a job without calling `run` (a stub, or a future
|
|
412
|
-
* controller with a different contract). `dsh-jobs-local` does call it
|
|
413
|
-
* synchronously (`hooks = spec.run(handle)`), but the tool cannot assume which
|
|
414
|
-
* implementation it is talking to — and hanging is far worse than reporting
|
|
415
|
-
* "started", because the model never gets an answer at all.
|
|
416
|
-
* - `run` throwing synchronously, which would skip both event handlers.
|
|
417
|
-
*
|
|
418
|
-
* Both are treated as "started" only in the sense of "do not claim a failure we did
|
|
419
|
-
* not observe": a genuinely failed job still settles as `failed` through `done`, and
|
|
420
|
-
* the Host's job tools report that.
|
|
421
|
-
*/
|
|
422
200
|
let reportStarted;
|
|
423
201
|
const state = {
|
|
424
202
|
settled: false,
|
|
@@ -458,21 +236,17 @@ async function runBackground(args, options) {
|
|
|
458
236
|
child.stdout?.on("data", (chunk) => job.append(chunk.toString("utf8"), { channel: "stdout" }));
|
|
459
237
|
child.stderr?.on("data", (chunk) => job.append(chunk.toString("utf8"), { channel: "stderr" }));
|
|
460
238
|
child.once("spawn", () => settleStarted(null));
|
|
461
|
-
child.once("error", (error) =>
|
|
462
|
-
settleStarted(error.code ?? "spawn-failed");
|
|
463
|
-
});
|
|
239
|
+
child.once("error", (error) => settleStarted(error.code ?? "spawn-failed"));
|
|
464
240
|
return {
|
|
465
241
|
cancel: (reason) => {
|
|
466
242
|
child.kill("SIGTERM");
|
|
467
243
|
if (reason !== void 0) job.updateProgress(`cancelling: ${reason}`);
|
|
468
244
|
},
|
|
469
245
|
done: new Promise((settle) => {
|
|
470
|
-
child.once("error", (error) => {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
});
|
|
475
|
-
});
|
|
246
|
+
child.once("error", (error) => settle({
|
|
247
|
+
status: "failed",
|
|
248
|
+
detail: error.code ?? "spawn-failed"
|
|
249
|
+
}));
|
|
476
250
|
child.once("close", (code, signal) => {
|
|
477
251
|
if (signal !== null) settle({
|
|
478
252
|
status: "killed",
|
|
@@ -488,12 +262,6 @@ async function runBackground(args, options) {
|
|
|
488
262
|
};
|
|
489
263
|
}
|
|
490
264
|
});
|
|
491
|
-
/**
|
|
492
|
-
* Turn a reported start failure into the tool error.
|
|
493
|
-
*
|
|
494
|
-
* The code only. A foreground run is how the caller sees the actual error, and
|
|
495
|
-
* naming the code keeps host paths out of the model's context.
|
|
496
|
-
*/
|
|
497
265
|
const failStart = (reason) => {
|
|
498
266
|
throw new ScriptMissingError(`background job ${jobId} failed to start (${reason}). Run the same script in the foreground to see its error.`);
|
|
499
267
|
};
|
|
@@ -518,21 +286,7 @@ async function runBackground(args, options) {
|
|
|
518
286
|
status: view.status
|
|
519
287
|
};
|
|
520
288
|
}
|
|
521
|
-
/**
|
|
522
|
-
* Render one captured stream as a fenced block, byte for byte.
|
|
523
|
-
*
|
|
524
|
-
* `trimEnd` used to run here, which is wrong for two reasons:
|
|
525
|
-
*
|
|
526
|
-
* - A stream of only whitespace passed the `!== ""` test and then rendered as an
|
|
527
|
-
* empty-looking `stdout:` line, so a reader concluded the script printed nothing.
|
|
528
|
-
* - `check-plan`'s contract includes exact line counts and blank-line separators, so
|
|
529
|
-
* a trimmed block is a different document — and the model reads this text as the
|
|
530
|
-
* script's output.
|
|
531
|
-
*
|
|
532
|
-
* A fence keeps every byte visible, including trailing blank lines. The fence is
|
|
533
|
-
* lengthened past the longest backtick run in the content so it can never be closed
|
|
534
|
-
* early by the content itself. Nothing inside is escaped or reinterpreted.
|
|
535
|
-
*/
|
|
289
|
+
/** Render one captured stream as a fence that the content cannot close early. */
|
|
536
290
|
function renderCapturedStream(text) {
|
|
537
291
|
if (text === "") return [];
|
|
538
292
|
const longestRun = Math.max(0, ...(text.match(/`+/g) ?? []).map((run) => run.length));
|
|
@@ -580,7 +334,6 @@ const TOOL_DESCRIPTION = [
|
|
|
580
334
|
"refused with a reason instead of hanging. Background runs return a job id and a settlement notice",
|
|
581
335
|
"arrives later — do not poll."
|
|
582
336
|
].join("\n");
|
|
583
|
-
/** The model-facing JSON Schema for `parameters`. */
|
|
584
337
|
function buildScriptParameters() {
|
|
585
338
|
return {
|
|
586
339
|
type: "object",
|
|
@@ -616,19 +369,6 @@ function buildScriptParameters() {
|
|
|
616
369
|
required: ["id"]
|
|
617
370
|
};
|
|
618
371
|
}
|
|
619
|
-
/**
|
|
620
|
-
* The declared shape of one outcome, exported so tests can validate real results.
|
|
621
|
-
*
|
|
622
|
-
* Split by `kind` instead of one flat object. The flat form could only require
|
|
623
|
-
* `kind` and `id`, so a foreground result that omitted `exitCode` was still
|
|
624
|
-
* "valid" and the schema proved nothing about the fields the model reads.
|
|
625
|
-
*
|
|
626
|
-
* `signal` is nullable because `child_process` reports `null` whenever the child
|
|
627
|
-
* exited on its own — that is every successful run. Declaring it `string` made
|
|
628
|
-
* the registry reject the tool's own normal output: `createSuccessResult()`
|
|
629
|
-
* validates before rendering, so **every** clean exit surfaced to the model as
|
|
630
|
-
* `tool "pstack_script" returned invalid output`.
|
|
631
|
-
*/
|
|
632
372
|
const OUTPUT_SCHEMA = { oneOf: [{
|
|
633
373
|
type: "object",
|
|
634
374
|
additionalProperties: false,
|
|
@@ -713,22 +453,6 @@ function createPstackScriptTool(host) {
|
|
|
713
453
|
}]
|
|
714
454
|
},
|
|
715
455
|
isConcurrencySafe: () => false,
|
|
716
|
-
/**
|
|
717
|
-
* The Host's last-resort budget for one call.
|
|
718
|
-
*
|
|
719
|
-
* `DEFAULT_TIMEOUT_MS` is the tool's own timer for a foreground run, and it fires
|
|
720
|
-
* first in every normal case: it kills the child and returns a `timedOut` result the
|
|
721
|
-
* model can read. This budget is larger on purpose, so it only ever wins when the
|
|
722
|
-
* tool's own machinery failed to return at all — a hung `await`, a timer that never
|
|
723
|
-
* ran — and the alternative would be a session blocked with no answer.
|
|
724
|
-
*
|
|
725
|
-
* `MAX_TIMEOUT_MS` rather than a new number: it is already the ceiling the tool
|
|
726
|
-
* accepts for a caller-supplied `timeoutMs`, so the Host budget can never be the
|
|
727
|
-
* thing that cuts short a run the caller was allowed to request.
|
|
728
|
-
*
|
|
729
|
-
* It does not bound a background job. The wrapper disposes its timer when `execute`
|
|
730
|
-
* settles, which is milliseconds after `jobs.start` returns.
|
|
731
|
-
*/
|
|
732
456
|
timeoutMs: MAX_TIMEOUT_MS,
|
|
733
457
|
async execute(rawArgs, exec) {
|
|
734
458
|
const args = parseScriptArgs(rawArgs);
|
|
@@ -748,27 +472,9 @@ function createPstackScriptTool(host) {
|
|
|
748
472
|
}
|
|
749
473
|
/** Cordis row name, used by Loader diagnostics. */
|
|
750
474
|
const name = "pstack-script";
|
|
751
|
-
/**
|
|
752
|
-
* The hard dependencies.
|
|
753
|
-
*
|
|
754
|
-
* `tools` is the registry this row registers into; `workingDirectory` is what
|
|
755
|
-
* turns the tool's `cwd` argument and its omitted case into the Session's
|
|
756
|
-
* directory. Both are always present in a profile that has an Agent at all.
|
|
757
|
-
*
|
|
758
|
-
* `jobs` is deliberately absent: a composition without a job controller still
|
|
759
|
-
* registers the tool, and only `background: true` is refused. Declaring `jobs`
|
|
760
|
-
* here would keep the whole fiber inactive in every profile that has no job
|
|
761
|
-
* controller, which is most of them.
|
|
762
|
-
*/
|
|
475
|
+
/** Hard dependencies: the tool registry and the session directory. `jobs` is optional and read per call. */
|
|
763
476
|
const inject = ["tools", "workingDirectory"];
|
|
764
|
-
/**
|
|
765
|
-
* Register `pstack_script` for this row.
|
|
766
|
-
*
|
|
767
|
-
* `inject` is what makes `ctx.tools` readable at all: without it Cordis runs
|
|
768
|
-
* `apply` immediately and the service proxy throws
|
|
769
|
-
* `cannot get property "tools" without inject`, so the row would register nothing
|
|
770
|
-
* in any profile.
|
|
771
|
-
*/
|
|
477
|
+
/** Register `pstack_script` for this row. */
|
|
772
478
|
function apply(ctx) {
|
|
773
479
|
ctx.tools.register(createPstackScriptTool({
|
|
774
480
|
tools: ctx.tools,
|
|
@@ -776,7 +482,4 @@ function apply(ctx) {
|
|
|
776
482
|
getJobs: () => ctx.get?.("jobs")
|
|
777
483
|
}));
|
|
778
484
|
}
|
|
779
|
-
//#endregion
|
|
780
485
|
export { DEFAULT_OUTPUT_LIMIT_BYTES, DEFAULT_TIMEOUT_MS, MAX_TIMEOUT_MS, OUTPUT_SCHEMA, SCRIPT_IDS, ScriptInputError, ScriptMissingError, TOOL_NAME, apply, buildScriptParameters, createPstackScriptTool, inject, name, parseScriptArgs, renderCapturedStream, renderScriptOutcome, resolveWorkingDirectory, runBackground, runForeground, scriptEnvironment, scriptPath };
|
|
781
|
-
|
|
782
|
-
//# sourceMappingURL=script.mjs.map
|
package/dist/skill.d.mts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { _ as ToolsHost, g as ToolDefinition, l as SkillDefinition, p as SkillResourceBase, t as Agent } from "./host-contract-CUPSpeNk.mjs";
|
|
2
|
+
/** Model-facing tool name. */
|
|
3
|
+
export declare const TOOL_NAME = "pstack_skill";
|
|
4
|
+
/** Cordis row name, used by Loader diagnostics. */
|
|
5
|
+
export declare const name = "pstack-skill";
|
|
6
|
+
/** The tool registry and the skill registry. */
|
|
7
|
+
export declare const inject: string[];
|
|
8
|
+
/** The slice of `ctx.skills` this tool reads. */
|
|
9
|
+
export interface SkillsHost {
|
|
10
|
+
get(name: string, options?: {
|
|
11
|
+
readonly cwd?: string;
|
|
12
|
+
readonly signal?: AbortSignal;
|
|
13
|
+
readonly scope?: Agent;
|
|
14
|
+
}): Promise<SkillDefinition | undefined>;
|
|
15
|
+
}
|
|
16
|
+
export interface PstackSkillHost {
|
|
17
|
+
readonly skills: SkillsHost;
|
|
18
|
+
readonly tools: ToolsHost;
|
|
19
|
+
}
|
|
20
|
+
export interface SkillResourceResult {
|
|
21
|
+
readonly path: string;
|
|
22
|
+
readonly content: string;
|
|
23
|
+
}
|
|
24
|
+
export interface LoadSkillResult {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly provider: string;
|
|
27
|
+
readonly resourceBase?: SkillResourceBase;
|
|
28
|
+
readonly content: string;
|
|
29
|
+
readonly resource?: SkillResourceResult;
|
|
30
|
+
}
|
|
31
|
+
/** Render one loaded skill in the canonical `<skill_content>` shape. */
|
|
32
|
+
export declare function renderLoadedSkill(result: LoadSkillResult): string;
|
|
33
|
+
/** Read one resource below a directory skill, refusing traversal and absolute paths. */
|
|
34
|
+
export declare function readSkillResource(definition: SkillDefinition, resource: string): Promise<SkillResourceResult>;
|
|
35
|
+
/** Build the tool definition. Exported so tests can drive `execute` directly. */
|
|
36
|
+
export declare function createPstackSkillTool(skills: SkillsHost): ToolDefinition;
|
|
37
|
+
/** Register `pstack_skill` on one row. */
|
|
38
|
+
export declare function apply(ctx: PstackSkillHost): void;
|