dsh-pstack 0.0.0-stage → 0.2.0-beta.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/LICENSE +22 -0
- package/README.md +133 -2
- package/assets/agents/comment-sicko.md +32 -0
- package/assets/agents/poteto-agent.md +8 -0
- package/assets/docs/guide/01-setup.md +64 -0
- package/assets/docs/guide/02-poteto-mode.md +139 -0
- package/assets/docs/guide/03-understand.md +79 -0
- package/assets/docs/guide/04-design.md +133 -0
- package/assets/docs/guide/05-build-and-clean.md +83 -0
- package/assets/docs/guide/06-verify-and-ship.md +152 -0
- package/assets/docs/guide/07-overnight.md +120 -0
- package/assets/docs/guide/08-principles.md +72 -0
- package/assets/docs/guide/09-make-it-yours.md +96 -0
- package/assets/docs/guide/10-recipes-and-pitfalls.md +180 -0
- package/assets/docs/guide/README.md +38 -0
- package/assets/docs/guide/images/design.jpg +0 -0
- package/assets/docs/guide/images/overnight.jpg +0 -0
- package/assets/docs/guide/images/recipes.jpg +0 -0
- package/assets/docs/guide/images/router.jpg +0 -0
- package/assets/docs/guide/images/understanding.jpg +0 -0
- package/assets/docs/guide/images/verification.jpg +0 -0
- package/assets/docs/harness/dsh.md +60 -0
- package/assets/docs/pstack-models.example.md +54 -0
- package/assets/skills/architect/SKILL.md +81 -0
- package/assets/skills/architect/references/design-red-flags.md +57 -0
- package/assets/skills/architect/references/rationale-template.md +35 -0
- package/assets/skills/architect/references/runner-prompt.md +20 -0
- package/assets/skills/arena/SKILL.md +50 -0
- package/assets/skills/automate-me/SKILL.md +106 -0
- package/assets/skills/benchmark-checklist/SKILL.md +39 -0
- package/assets/skills/blast-radius/SKILL.md +52 -0
- package/assets/skills/bro/SKILL.md +7 -0
- package/assets/skills/correct/SKILL.md +32 -0
- package/assets/skills/create-formal-verification-skill/SKILL.md +43 -0
- package/assets/skills/create-verification-skill/SKILL.md +46 -0
- package/assets/skills/create-verification-skill/references/feature-map-example/README.md +47 -0
- package/assets/skills/create-verification-skill/references/feature-map-example/create-note.md +39 -0
- package/assets/skills/create-verification-skill/references/feature-map-example/search.md +45 -0
- package/assets/skills/figure-it-out/SKILL.md +54 -0
- package/assets/skills/how/SKILL.md +38 -0
- package/assets/skills/how/references/explainer-prompt.md +55 -0
- package/assets/skills/how/references/explorer-prompt.md +35 -0
- package/assets/skills/in-your-own-words/SKILL.md +7 -0
- package/assets/skills/interrogate/SKILL.md +71 -0
- package/assets/skills/interrogate/references/code-quality-review.md +47 -0
- package/assets/skills/interrogate/references/lead-judgment.md +39 -0
- package/assets/skills/interrogate/references/reviewer-prompt.md +62 -0
- package/assets/skills/interrogate/references/rubric.md +77 -0
- package/assets/skills/ketchup/SKILL.md +45 -0
- package/assets/skills/maintain-formal-verification-skill/SKILL.md +60 -0
- package/assets/skills/maintain-verification-skill/SKILL.md +41 -0
- package/assets/skills/no-comments/SKILL.md +26 -0
- package/assets/skills/poteto-help/SKILL.md +162 -0
- package/assets/skills/poteto-help/references/prompting.md +51 -0
- package/assets/skills/poteto-help/references/recipes.md +51 -0
- package/assets/skills/poteto-mode/SKILL.md +151 -0
- package/assets/skills/poteto-mode/playbooks/authoring-a-skill.md +12 -0
- package/assets/skills/poteto-mode/playbooks/autonomous-run.md +15 -0
- package/assets/skills/poteto-mode/playbooks/autopilot-full.md +25 -0
- package/assets/skills/poteto-mode/playbooks/autopilot-stack.md +12 -0
- package/assets/skills/poteto-mode/playbooks/babysit.md +23 -0
- package/assets/skills/poteto-mode/playbooks/bug-fix.md +15 -0
- package/assets/skills/poteto-mode/playbooks/eval.md +25 -0
- package/assets/skills/poteto-mode/playbooks/feature.md +21 -0
- package/assets/skills/poteto-mode/playbooks/hillclimb.md +21 -0
- package/assets/skills/poteto-mode/playbooks/investigation.md +14 -0
- package/assets/skills/poteto-mode/playbooks/multi-phase-plan.md +155 -0
- package/assets/skills/poteto-mode/playbooks/opening-a-pr.md +34 -0
- package/assets/skills/poteto-mode/playbooks/orchestrate.md +112 -0
- package/assets/skills/poteto-mode/playbooks/pause-safely.md +10 -0
- package/assets/skills/poteto-mode/playbooks/perf-issue.md +25 -0
- package/assets/skills/poteto-mode/playbooks/prototype.md +14 -0
- package/assets/skills/poteto-mode/playbooks/refactoring.md +16 -0
- package/assets/skills/poteto-mode/playbooks/runtime-forensics.md +11 -0
- package/assets/skills/poteto-mode/playbooks/session-pickup.md +11 -0
- package/assets/skills/poteto-mode/playbooks/shipping.md +12 -0
- package/assets/skills/poteto-mode/playbooks/trace-forensics.md +14 -0
- package/assets/skills/poteto-mode/playbooks/visual-parity.md +11 -0
- package/assets/skills/poteto-mode/playbooks/worktree-cleanup.md +20 -0
- package/assets/skills/poteto-mode/references/bugbot-triage.md +142 -0
- package/assets/skills/poteto-mode/scripts/check-plan.mjs +220 -0
- package/assets/skills/poteto-mode/scripts/check-plan.test.mjs +343 -0
- package/assets/skills/poteto-mode/scripts/orch/orch.mjs +4282 -0
- package/assets/skills/poteto-mode/scripts/orch/orch.test.mjs +2042 -0
- package/assets/skills/poteto-mode/scripts/watch-pr/cli.test.mjs +5101 -0
- package/assets/skills/poteto-mode/scripts/watch-pr/github.test.mjs +1177 -0
- package/assets/skills/poteto-mode/scripts/watch-pr/policy.test.mjs +1441 -0
- package/assets/skills/poteto-mode/scripts/watch-pr/watch-pr.mjs +4601 -0
- package/assets/skills/poteto-mode/scripts/worktree-audit.mjs +675 -0
- package/assets/skills/principle-attack-the-premise/SKILL.md +21 -0
- package/assets/skills/principle-boundary-discipline/SKILL.md +34 -0
- package/assets/skills/principle-build-the-lever/SKILL.md +23 -0
- package/assets/skills/principle-encode-lessons-in-structure/SKILL.md +11 -0
- package/assets/skills/principle-exhaust-the-design-space/SKILL.md +9 -0
- package/assets/skills/principle-experience-first/SKILL.md +19 -0
- package/assets/skills/principle-explain-the-number/SKILL.md +17 -0
- package/assets/skills/principle-fix-root-causes/SKILL.md +21 -0
- package/assets/skills/principle-foundational-thinking/SKILL.md +21 -0
- package/assets/skills/principle-guard-the-context-window/SKILL.md +12 -0
- package/assets/skills/principle-laziness-protocol/SKILL.md +10 -0
- package/assets/skills/principle-make-operations-idempotent/SKILL.md +22 -0
- package/assets/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +14 -0
- package/assets/skills/principle-minimize-reader-load/SKILL.md +18 -0
- package/assets/skills/principle-model-the-domain/SKILL.md +24 -0
- package/assets/skills/principle-never-block-on-the-human/SKILL.md +15 -0
- package/assets/skills/principle-outcome-oriented-execution/SKILL.md +21 -0
- package/assets/skills/principle-prove-it-works/SKILL.md +24 -0
- package/assets/skills/principle-redesign-from-first-principles/SKILL.md +16 -0
- package/assets/skills/principle-separate-before-serializing-shared-state/SKILL.md +16 -0
- package/assets/skills/principle-sequence-verifiable-units/SKILL.md +17 -0
- package/assets/skills/principle-subtract-before-you-add/SKILL.md +18 -0
- package/assets/skills/principle-test-behavior-not-implementation/SKILL.md +20 -0
- package/assets/skills/principle-type-system-discipline/SKILL.md +13 -0
- package/assets/skills/recall/SKILL.md +37 -0
- package/assets/skills/reflect/SKILL.md +69 -0
- package/assets/skills/reflect/references/divergent-reviewer.md +38 -0
- package/assets/skills/reflect/references/judgment-reviewer.md +37 -0
- package/assets/skills/reflect/references/synthesizer.md +56 -0
- package/assets/skills/reflect/references/tooling-reviewer.md +48 -0
- package/assets/skills/setup-pstack/SKILL.md +67 -0
- package/assets/skills/sharpen/SKILL.md +16 -0
- package/assets/skills/show-me-your-work/SKILL.md +84 -0
- package/assets/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
- package/assets/skills/show-me-your-work/scripts/log.mjs +108 -0
- package/assets/skills/swarm/SKILL.md +43 -0
- package/assets/skills/tdd/SKILL.md +42 -0
- package/assets/skills/teach/SKILL.md +23 -0
- package/assets/skills/technical-writing/SKILL.md +108 -0
- package/assets/skills/typescript-best-practices/SKILL.md +34 -0
- package/assets/skills/typescript-best-practices/references/patterns.md +328 -0
- package/assets/skills/unslop/SKILL.md +62 -0
- package/assets/skills/why/SKILL.md +100 -0
- package/assets/skills/why/references/epistemics.md +71 -0
- package/assets/skills/why/references/investigator-prompt.md +84 -0
- package/assets/skills/why/references/source-playbook.md +17 -0
- package/assets/skills/why/references/sources/code-archaeology.md +51 -0
- package/assets/skills/why/references/sources/databricks.md +70 -0
- package/assets/skills/why/references/sources/datadog.md +97 -0
- package/assets/skills/why/references/sources/incident-postmortem.md +5 -0
- package/assets/skills/why/references/sources/linear.md +48 -0
- package/assets/skills/why/references/sources/notion.md +55 -0
- package/assets/skills/why/references/sources/sentry.md +66 -0
- package/assets/skills/why/references/sources/slack.md +17 -0
- package/assets/skills/why/references/synthesizer-prompt.md +129 -0
- package/cordis.patch.yml +39 -0
- package/dist/frontmatter-BQX3ekwP.mjs +229 -0
- package/dist/frontmatter-BQX3ekwP.mjs.map +1 -0
- package/dist/history.d.mts +429 -0
- package/dist/history.mjs +1129 -0
- package/dist/history.mjs.map +1 -0
- package/dist/host-contract-o47JH_r8.d.mts +527 -0
- package/dist/index.d.mts +278 -0
- package/dist/index.mjs +272 -0
- package/dist/index.mjs.map +1 -0
- package/dist/paths-D_JlVmBk.mjs +42 -0
- package/dist/paths-D_JlVmBk.mjs.map +1 -0
- package/dist/script.d.mts +193 -0
- package/dist/script.mjs +782 -0
- package/dist/script.mjs.map +1 -0
- package/dist/subagent.d.mts +336 -0
- package/dist/subagent.mjs +1402 -0
- package/dist/subagent.mjs.map +1 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +106 -3
- package/static/icon.png +0 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { a as JobsHost, g as ToolDefinition, i as JobId, o as JsonSchemaNode, u as SessionId, v as ToolsHost, y as WorkingDirectoryHost } from "./host-contract-o47JH_r8.mjs";
|
|
2
|
+
//#region src/script.d.ts
|
|
3
|
+
/** Model-facing tool name. */
|
|
4
|
+
export declare const TOOL_NAME = "pstack_script";
|
|
5
|
+
/** The shipped scripts this tool may run, in display order. */
|
|
6
|
+
export declare const SCRIPT_IDS: string[];
|
|
7
|
+
export type ScriptId = (typeof SCRIPT_IDS)[number];
|
|
8
|
+
/** Default wall-clock limit for a foreground run. */
|
|
9
|
+
export declare const DEFAULT_TIMEOUT_MS = 120000;
|
|
10
|
+
/** Bounds a caller may set for one foreground run. */
|
|
11
|
+
export declare const MAX_TIMEOUT_MS = 600000;
|
|
12
|
+
/** Default cap on captured bytes per stream. */
|
|
13
|
+
export declare const DEFAULT_OUTPUT_LIMIT_BYTES: number;
|
|
14
|
+
/** Raised for an argument problem, before anything is spawned. */
|
|
15
|
+
export declare class ScriptInputError extends Error {
|
|
16
|
+
constructor(message: string);
|
|
17
|
+
}
|
|
18
|
+
/** Raised when a shipped artefact is missing from this install. */
|
|
19
|
+
export declare class ScriptMissingError extends Error {
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
}
|
|
22
|
+
/** One parsed call. */
|
|
23
|
+
export interface ScriptArgs {
|
|
24
|
+
readonly id: ScriptId;
|
|
25
|
+
readonly args: readonly string[];
|
|
26
|
+
readonly cwd?: string;
|
|
27
|
+
readonly background: boolean;
|
|
28
|
+
readonly timeoutMs?: number;
|
|
29
|
+
readonly outputLimitBytes?: number;
|
|
30
|
+
}
|
|
31
|
+
/** What a foreground run produced. */
|
|
32
|
+
export interface ScriptResult {
|
|
33
|
+
readonly kind: "foreground";
|
|
34
|
+
readonly id: ScriptId;
|
|
35
|
+
readonly exitCode: number;
|
|
36
|
+
readonly signal: NodeJS.Signals | null;
|
|
37
|
+
readonly timedOut: boolean;
|
|
38
|
+
readonly stdout: string;
|
|
39
|
+
readonly stderr: string;
|
|
40
|
+
/** True when a stream was cut off at the limit. */
|
|
41
|
+
readonly stdoutTruncated: boolean;
|
|
42
|
+
readonly stderrTruncated: boolean;
|
|
43
|
+
readonly durationMs: number;
|
|
44
|
+
}
|
|
45
|
+
/** What a background run produced. */
|
|
46
|
+
export interface ScriptJobResult {
|
|
47
|
+
readonly kind: "background";
|
|
48
|
+
readonly id: ScriptId;
|
|
49
|
+
readonly jobId: JobId;
|
|
50
|
+
readonly status: string;
|
|
51
|
+
}
|
|
52
|
+
/** Either outcome, as the model sees it. */
|
|
53
|
+
export type ScriptOutcome = ScriptResult | ScriptJobResult;
|
|
54
|
+
/** Absolute path of one shipped artefact. */
|
|
55
|
+
export declare function scriptPath(id: ScriptId): string;
|
|
56
|
+
/**
|
|
57
|
+
* The environment a child gets.
|
|
58
|
+
*
|
|
59
|
+
* The one rule is the Electron selector. Under Electron, `process.execPath` is the
|
|
60
|
+
* Desktop binary, which starts a browser window unless `ELECTRON_RUN_AS_NODE=1` tells
|
|
61
|
+
* it to behave as Node. Under plain Node the variable is inert — Node ignores it —
|
|
62
|
+
* so setting it unconditionally would also work; it is conditional here so the
|
|
63
|
+
* environment of a normal run stays exactly the caller's, and the one code path that
|
|
64
|
+
* needs it is visible.
|
|
65
|
+
*/
|
|
66
|
+
export declare function scriptEnvironment(base?: NodeJS.ProcessEnv, versions?: {
|
|
67
|
+
readonly electron?: string;
|
|
68
|
+
}): NodeJS.ProcessEnv;
|
|
69
|
+
/** Validate the raw tool arguments. */
|
|
70
|
+
export declare function parseScriptArgs(raw: unknown): ScriptArgs;
|
|
71
|
+
/**
|
|
72
|
+
* Resolve the directory the child runs in.
|
|
73
|
+
*
|
|
74
|
+
* The tool's `cwd` argument is documented as resolving against "this session's
|
|
75
|
+
* directory", so `sessionCwd` — the value `ctx.workingDirectory.ensure()` returns —
|
|
76
|
+
* is the base, not the Host process's working directory.
|
|
77
|
+
*
|
|
78
|
+
* - omitted -> the session directory
|
|
79
|
+
* - relative -> joined onto the session directory
|
|
80
|
+
* - absolute -> used as-is
|
|
81
|
+
*
|
|
82
|
+
* With no Session (a call outside an Agent) there is no session directory to
|
|
83
|
+
* anchor to; the argument is then passed through and `resolve` normalises it
|
|
84
|
+
* against the Host process, which is the only directory that exists.
|
|
85
|
+
*/
|
|
86
|
+
export declare function resolveWorkingDirectory(requested: string | undefined, sessionCwd: string | undefined): string | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Run one script in the foreground.
|
|
89
|
+
*
|
|
90
|
+
* A nonzero exit, a signal, a timeout, and truncated output are all returned rather
|
|
91
|
+
* than raised: the caller needs to see what the script said before it failed, and an
|
|
92
|
+
* exception would discard the captured output.
|
|
93
|
+
*/
|
|
94
|
+
export declare function runForeground(args: ScriptArgs, options?: {
|
|
95
|
+
readonly execPath?: string;
|
|
96
|
+
readonly environment?: NodeJS.ProcessEnv;
|
|
97
|
+
/** Already resolved by the caller; see `resolveWorkingDirectory`. */
|
|
98
|
+
readonly cwd?: string;
|
|
99
|
+
readonly signal?: AbortSignal;
|
|
100
|
+
}): Promise<ScriptResult>;
|
|
101
|
+
/**
|
|
102
|
+
* Start a script as a background job.
|
|
103
|
+
*
|
|
104
|
+
* `jobs` is required and passing nothing is a refusal with a reason. A job whose
|
|
105
|
+
* output nobody can read would be worse than a failed call: the model would report a
|
|
106
|
+
* task as started and no notice would ever arrive.
|
|
107
|
+
*/
|
|
108
|
+
export declare function runBackground(args: ScriptArgs, options: {
|
|
109
|
+
readonly jobs?: JobsHost | undefined;
|
|
110
|
+
readonly caller?: SessionId;
|
|
111
|
+
readonly execPath?: string;
|
|
112
|
+
readonly environment?: NodeJS.ProcessEnv;
|
|
113
|
+
readonly cwd?: string;
|
|
114
|
+
}): Promise<ScriptJobResult>;
|
|
115
|
+
/**
|
|
116
|
+
* Render one captured stream as a fenced block, byte for byte.
|
|
117
|
+
*
|
|
118
|
+
* `trimEnd` used to run here, which is wrong for two reasons:
|
|
119
|
+
*
|
|
120
|
+
* - A stream of only whitespace passed the `!== ""` test and then rendered as an
|
|
121
|
+
* empty-looking `stdout:` line, so a reader concluded the script printed nothing.
|
|
122
|
+
* - `check-plan`'s contract includes exact line counts and blank-line separators, so
|
|
123
|
+
* a trimmed block is a different document — and the model reads this text as the
|
|
124
|
+
* script's output.
|
|
125
|
+
*
|
|
126
|
+
* A fence keeps every byte visible, including trailing blank lines. The fence is
|
|
127
|
+
* lengthened past the longest backtick run in the content so it can never be closed
|
|
128
|
+
* early by the content itself. Nothing inside is escaped or reinterpreted.
|
|
129
|
+
*/
|
|
130
|
+
export declare function renderCapturedStream(text: string): readonly string[];
|
|
131
|
+
/** Render one outcome for the model. */
|
|
132
|
+
export declare function renderScriptOutcome(outcome: ScriptOutcome): string;
|
|
133
|
+
/** The model-facing JSON Schema for `parameters`. */
|
|
134
|
+
export declare function buildScriptParameters(): Record<string, unknown>;
|
|
135
|
+
/**
|
|
136
|
+
* The declared shape of one outcome, exported so tests can validate real results.
|
|
137
|
+
*
|
|
138
|
+
* Split by `kind` instead of one flat object. The flat form could only require
|
|
139
|
+
* `kind` and `id`, so a foreground result that omitted `exitCode` was still
|
|
140
|
+
* "valid" and the schema proved nothing about the fields the model reads.
|
|
141
|
+
*
|
|
142
|
+
* `signal` is nullable because `child_process` reports `null` whenever the child
|
|
143
|
+
* exited on its own — that is every successful run. Declaring it `string` made
|
|
144
|
+
* the registry reject the tool's own normal output: `createSuccessResult()`
|
|
145
|
+
* validates before rendering, so **every** clean exit surfaced to the model as
|
|
146
|
+
* `tool "pstack_script" returned invalid output`.
|
|
147
|
+
*/
|
|
148
|
+
export declare const OUTPUT_SCHEMA: JsonSchemaNode;
|
|
149
|
+
/** The slices of the Cordis context this tool needs. */
|
|
150
|
+
export interface PstackScriptHost {
|
|
151
|
+
readonly tools: ToolsHost;
|
|
152
|
+
/** Resolves the Session's current directory; see `WorkingDirectoryHost`. */
|
|
153
|
+
readonly workingDirectory: WorkingDirectoryHost;
|
|
154
|
+
/**
|
|
155
|
+
* Optional, and read per call rather than snapshotted.
|
|
156
|
+
*
|
|
157
|
+
* A profile may mount a job controller after this row, so a value read once in
|
|
158
|
+
* `apply` would stay `undefined` forever. `ctx.get("jobs")` is rc.3's
|
|
159
|
+
* optional-service read: it returns `undefined` instead of throwing when the
|
|
160
|
+
* service is absent, which is why `jobs` is not declared in `inject`.
|
|
161
|
+
*/
|
|
162
|
+
readonly getJobs?: () => JobsHost | undefined;
|
|
163
|
+
}
|
|
164
|
+
/** Build the tool for one row. */
|
|
165
|
+
export declare function createPstackScriptTool(host: PstackScriptHost): ToolDefinition;
|
|
166
|
+
/** Cordis row name, used by Loader diagnostics. */
|
|
167
|
+
export declare const name = "pstack-script";
|
|
168
|
+
/**
|
|
169
|
+
* The hard dependencies.
|
|
170
|
+
*
|
|
171
|
+
* `tools` is the registry this row registers into; `workingDirectory` is what
|
|
172
|
+
* turns the tool's `cwd` argument and its omitted case into the Session's
|
|
173
|
+
* directory. Both are always present in a profile that has an Agent at all.
|
|
174
|
+
*
|
|
175
|
+
* `jobs` is deliberately absent: a composition without a job controller still
|
|
176
|
+
* registers the tool, and only `background: true` is refused. Declaring `jobs`
|
|
177
|
+
* here would keep the whole fiber inactive in every profile that has no job
|
|
178
|
+
* controller, which is most of them.
|
|
179
|
+
*/
|
|
180
|
+
export declare const inject: string[];
|
|
181
|
+
/**
|
|
182
|
+
* Register `pstack_script` for this row.
|
|
183
|
+
*
|
|
184
|
+
* `inject` is what makes `ctx.tools` readable at all: without it Cordis runs
|
|
185
|
+
* `apply` immediately and the service proxy throws
|
|
186
|
+
* `cannot get property "tools" without inject`, so the row would register nothing
|
|
187
|
+
* in any profile.
|
|
188
|
+
*/
|
|
189
|
+
export declare function apply(ctx: PstackScriptHost & {
|
|
190
|
+
get?: (name: string) => JobsHost | undefined;
|
|
191
|
+
}): void;
|
|
192
|
+
//#endregion
|
|
193
|
+
//# sourceMappingURL=script.d.mts.map
|