dispach 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +596 -0
- package/dist/App-dxqm39zx.js +11 -0
- package/dist/App-dxqm39zx.js.map +25 -0
- package/dist/ConfigEditor-7v5nebvy.js +6 -0
- package/dist/ConfigEditor-7v5nebvy.js.map +11 -0
- package/dist/KeyProbe-vjhmdpx6.js +5 -0
- package/dist/KeyProbe-vjhmdpx6.js.map +11 -0
- package/dist/Picker-jxaesaxy.js +5 -0
- package/dist/Picker-jxaesaxy.js.map +10 -0
- package/dist/SessionPicker-z2t0p4b5.js +5 -0
- package/dist/SessionPicker-z2t0p4b5.js.map +11 -0
- package/dist/SkillBrowser-yyf2gy0q.js +5 -0
- package/dist/SkillBrowser-yyf2gy0q.js.map +11 -0
- package/dist/WizardApp-12ndxgqv.js +5 -0
- package/dist/WizardApp-12ndxgqv.js.map +13 -0
- package/dist/agents.d.ts +9 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/browse.d.ts +63 -0
- package/dist/browse.d.ts.map +1 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +34 -0
- package/dist/client.js.map +11 -0
- package/dist/components/App.d.ts +28 -0
- package/dist/components/App.d.ts.map +1 -0
- package/dist/components/Banner.d.ts +16 -0
- package/dist/components/Banner.d.ts.map +1 -0
- package/dist/components/Brandmark.d.ts +31 -0
- package/dist/components/Brandmark.d.ts.map +1 -0
- package/dist/components/CheckList.d.ts +38 -0
- package/dist/components/CheckList.d.ts.map +1 -0
- package/dist/components/CommandOutput.d.ts +29 -0
- package/dist/components/CommandOutput.d.ts.map +1 -0
- package/dist/components/ConfigEditor.d.ts +64 -0
- package/dist/components/ConfigEditor.d.ts.map +1 -0
- package/dist/components/HistorySearch.d.ts +23 -0
- package/dist/components/HistorySearch.d.ts.map +1 -0
- package/dist/components/KeyProbe.d.ts +36 -0
- package/dist/components/KeyProbe.d.ts.map +1 -0
- package/dist/components/LineCursor.d.ts +55 -0
- package/dist/components/LineCursor.d.ts.map +1 -0
- package/dist/components/Live.d.ts +17 -0
- package/dist/components/Live.d.ts.map +1 -0
- package/dist/components/Palette.d.ts +21 -0
- package/dist/components/Palette.d.ts.map +1 -0
- package/dist/components/Picker.d.ts +23 -0
- package/dist/components/Picker.d.ts.map +1 -0
- package/dist/components/Prompt.d.ts +20 -0
- package/dist/components/Prompt.d.ts.map +1 -0
- package/dist/components/Screen.d.ts +39 -0
- package/dist/components/Screen.d.ts.map +1 -0
- package/dist/components/SelectList.d.ts +34 -0
- package/dist/components/SelectList.d.ts.map +1 -0
- package/dist/components/SessionPicker.d.ts +26 -0
- package/dist/components/SessionPicker.d.ts.map +1 -0
- package/dist/components/SkillBrowser.d.ts +39 -0
- package/dist/components/SkillBrowser.d.ts.map +1 -0
- package/dist/components/Spinner.d.ts +13 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/StatusBar.d.ts +11 -0
- package/dist/components/StatusBar.d.ts.map +1 -0
- package/dist/components/SummaryCard.d.ts +11 -0
- package/dist/components/SummaryCard.d.ts.map +1 -0
- package/dist/components/TextField.d.ts +39 -0
- package/dist/components/TextField.d.ts.map +1 -0
- package/dist/components/Transcript.d.ts +23 -0
- package/dist/components/Transcript.d.ts.map +1 -0
- package/dist/components/WizardApp.d.ts +18 -0
- package/dist/components/WizardApp.d.ts.map +1 -0
- package/dist/components/WizardFrame.d.ts +19 -0
- package/dist/components/WizardFrame.d.ts.map +1 -0
- package/dist/config-yz0nz51b.js +24 -0
- package/dist/config-yz0nz51b.js.map +10 -0
- package/dist/config.d.ts +71 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/credential-wgt4gvcz.js +19 -0
- package/dist/credential-wgt4gvcz.js.map +10 -0
- package/dist/credential.d.ts +68 -0
- package/dist/credential.d.ts.map +1 -0
- package/dist/daemon.d.ts +47 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/editor.d.ts +81 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/hooks/useElapsed.d.ts +10 -0
- package/dist/hooks/useElapsed.d.ts.map +1 -0
- package/dist/hooks/useTerminalSize.d.ts +14 -0
- package/dist/hooks/useTerminalSize.d.ts.map +1 -0
- package/dist/hooks/useTurn.d.ts +41 -0
- package/dist/hooks/useTurn.d.ts.map +1 -0
- package/dist/index-2cvtz0fy.js +903 -0
- package/dist/index-2cvtz0fy.js.map +194 -0
- package/dist/index-3nwfz9jq.js +12 -0
- package/dist/index-3nwfz9jq.js.map +11 -0
- package/dist/index-6b7qvh1x.js +6 -0
- package/dist/index-6b7qvh1x.js.map +10 -0
- package/dist/index-6z0yr17z.js +12 -0
- package/dist/index-6z0yr17z.js.map +11 -0
- package/dist/index-7da4fqcr.js +7 -0
- package/dist/index-7da4fqcr.js.map +11 -0
- package/dist/index-8bmhd2hj.js +6 -0
- package/dist/index-8bmhd2hj.js.map +10 -0
- package/dist/index-9d011p3q.js +6 -0
- package/dist/index-9d011p3q.js.map +10 -0
- package/dist/index-9f9pp2ef.js +6 -0
- package/dist/index-9f9pp2ef.js.map +10 -0
- package/dist/index-9nsfs0vy.js +6 -0
- package/dist/index-9nsfs0vy.js.map +10 -0
- package/dist/index-9pj1ws0p.js +77 -0
- package/dist/index-9pj1ws0p.js.map +12 -0
- package/dist/index-b5wwtxzk.js +66 -0
- package/dist/index-b5wwtxzk.js.map +12 -0
- package/dist/index-b8zwg8a3.js +6 -0
- package/dist/index-b8zwg8a3.js.map +10 -0
- package/dist/index-bry9bzt3.js +427 -0
- package/dist/index-bry9bzt3.js.map +11 -0
- package/dist/index-bwckzbf8.js +6 -0
- package/dist/index-bwckzbf8.js.map +10 -0
- package/dist/index-cx3vz7sf.js +6 -0
- package/dist/index-cx3vz7sf.js.map +11 -0
- package/dist/index-e8n70sgj.js +6 -0
- package/dist/index-e8n70sgj.js.map +11 -0
- package/dist/index-fvhg0xyd.js +167 -0
- package/dist/index-fvhg0xyd.js.map +19 -0
- package/dist/index-gbnc99j8.js +14 -0
- package/dist/index-gbnc99j8.js.map +13 -0
- package/dist/index-h2yds678.js +7 -0
- package/dist/index-h2yds678.js.map +11 -0
- package/dist/index-j97vttdt.js +10 -0
- package/dist/index-j97vttdt.js.map +10 -0
- package/dist/index-jk0def33.js +6 -0
- package/dist/index-jk0def33.js.map +12 -0
- package/dist/index-jym27m75.js +6 -0
- package/dist/index-jym27m75.js.map +10 -0
- package/dist/index-mgdgx22q.js +10 -0
- package/dist/index-mgdgx22q.js.map +10 -0
- package/dist/index-mrtb5y08.js +6 -0
- package/dist/index-mrtb5y08.js.map +11 -0
- package/dist/index-my5cjx00.js +6 -0
- package/dist/index-my5cjx00.js.map +10 -0
- package/dist/index-qc2vrq9z.js +7 -0
- package/dist/index-qc2vrq9z.js.map +11 -0
- package/dist/index-rqbtm761.js +6 -0
- package/dist/index-rqbtm761.js.map +10 -0
- package/dist/index-rqzg861g.js +6 -0
- package/dist/index-rqzg861g.js.map +10 -0
- package/dist/index-t1xvacym.js +6 -0
- package/dist/index-t1xvacym.js.map +11 -0
- package/dist/index-xgqzk5cq.js +9 -0
- package/dist/index-xgqzk5cq.js.map +12 -0
- package/dist/index-xqyms08r.js +6 -0
- package/dist/index-xqyms08r.js.map +10 -0
- package/dist/index-yr25dnf5.js +6 -0
- package/dist/index-yr25dnf5.js.map +10 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +527 -0
- package/dist/index.js.map +48 -0
- package/dist/init.d.ts +34 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/keymap.d.ts +126 -0
- package/dist/keymap.d.ts.map +1 -0
- package/dist/keys.d.ts +17 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/lib/ambient.d.ts +69 -0
- package/dist/lib/ambient.d.ts.map +1 -0
- package/dist/lib/args.d.ts +33 -0
- package/dist/lib/args.d.ts.map +1 -0
- package/dist/lib/bootstrap.d.ts +84 -0
- package/dist/lib/bootstrap.d.ts.map +1 -0
- package/dist/lib/browse.d.ts +89 -0
- package/dist/lib/browse.d.ts.map +1 -0
- package/dist/lib/browser.d.ts +55 -0
- package/dist/lib/browser.d.ts.map +1 -0
- package/dist/lib/chat-frame.d.ts +156 -0
- package/dist/lib/chat-frame.d.ts.map +1 -0
- package/dist/lib/clipboard.d.ts +32 -0
- package/dist/lib/clipboard.d.ts.map +1 -0
- package/dist/lib/commands.d.ts +26 -0
- package/dist/lib/commands.d.ts.map +1 -0
- package/dist/lib/composer.d.ts +85 -0
- package/dist/lib/composer.d.ts.map +1 -0
- package/dist/lib/config-apply.d.ts +51 -0
- package/dist/lib/config-apply.d.ts.map +1 -0
- package/dist/lib/config-editor.d.ts +113 -0
- package/dist/lib/config-editor.d.ts.map +1 -0
- package/dist/lib/config-env.d.ts +110 -0
- package/dist/lib/config-env.d.ts.map +1 -0
- package/dist/lib/config-rows.d.ts +37 -0
- package/dist/lib/config-rows.d.ts.map +1 -0
- package/dist/lib/config-view.d.ts +133 -0
- package/dist/lib/config-view.d.ts.map +1 -0
- package/dist/lib/confirm.d.ts +86 -0
- package/dist/lib/confirm.d.ts.map +1 -0
- package/dist/lib/const.d.ts +213 -0
- package/dist/lib/const.d.ts.map +1 -0
- package/dist/lib/csi.d.ts +70 -0
- package/dist/lib/csi.d.ts.map +1 -0
- package/dist/lib/curated.d.ts +44 -0
- package/dist/lib/curated.d.ts.map +1 -0
- package/dist/lib/daemon-plan.d.ts +151 -0
- package/dist/lib/daemon-plan.d.ts.map +1 -0
- package/dist/lib/dotenv-edit.d.ts +30 -0
- package/dist/lib/dotenv-edit.d.ts.map +1 -0
- package/dist/lib/env.d.ts +10 -0
- package/dist/lib/env.d.ts.map +1 -0
- package/dist/lib/exit.d.ts +170 -0
- package/dist/lib/exit.d.ts.map +1 -0
- package/dist/lib/help.d.ts +10 -0
- package/dist/lib/help.d.ts.map +1 -0
- package/dist/lib/init-flow.d.ts +539 -0
- package/dist/lib/init-flow.d.ts.map +1 -0
- package/dist/lib/init-skills.d.ts +46 -0
- package/dist/lib/init-skills.d.ts.map +1 -0
- package/dist/lib/keyboard.d.ts +76 -0
- package/dist/lib/keyboard.d.ts.map +1 -0
- package/dist/lib/keys-view.d.ts +57 -0
- package/dist/lib/keys-view.d.ts.map +1 -0
- package/dist/lib/launchd.d.ts +151 -0
- package/dist/lib/launchd.d.ts.map +1 -0
- package/dist/lib/lifecycle.d.ts +126 -0
- package/dist/lib/lifecycle.d.ts.map +1 -0
- package/dist/lib/log-follow.d.ts +71 -0
- package/dist/lib/log-follow.d.ts.map +1 -0
- package/dist/lib/mouse.d.ts +84 -0
- package/dist/lib/mouse.d.ts.map +1 -0
- package/dist/lib/multiselect.d.ts +37 -0
- package/dist/lib/multiselect.d.ts.map +1 -0
- package/dist/lib/origins.d.ts +40 -0
- package/dist/lib/origins.d.ts.map +1 -0
- package/dist/lib/output.d.ts +29 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/palette.d.ts +69 -0
- package/dist/lib/palette.d.ts.map +1 -0
- package/dist/lib/probe.d.ts +158 -0
- package/dist/lib/probe.d.ts.map +1 -0
- package/dist/lib/providers.d.ts +63 -0
- package/dist/lib/providers.d.ts.map +1 -0
- package/dist/lib/provision.d.ts +163 -0
- package/dist/lib/provision.d.ts.map +1 -0
- package/dist/lib/remove-plan.d.ts +120 -0
- package/dist/lib/remove-plan.d.ts.map +1 -0
- package/dist/lib/render.d.ts +78 -0
- package/dist/lib/render.d.ts.map +1 -0
- package/dist/lib/resume.d.ts +69 -0
- package/dist/lib/resume.d.ts.map +1 -0
- package/dist/lib/rows.d.ts +69 -0
- package/dist/lib/rows.d.ts.map +1 -0
- package/dist/lib/sandbox.d.ts +101 -0
- package/dist/lib/sandbox.d.ts.map +1 -0
- package/dist/lib/schema.d.ts +491 -0
- package/dist/lib/schema.d.ts.map +1 -0
- package/dist/lib/screen.d.ts +102 -0
- package/dist/lib/screen.d.ts.map +1 -0
- package/dist/lib/scroll.d.ts +64 -0
- package/dist/lib/scroll.d.ts.map +1 -0
- package/dist/lib/select.d.ts +23 -0
- package/dist/lib/select.d.ts.map +1 -0
- package/dist/lib/service-env.d.ts +38 -0
- package/dist/lib/service-env.d.ts.map +1 -0
- package/dist/lib/service.d.ts +102 -0
- package/dist/lib/service.d.ts.map +1 -0
- package/dist/lib/session-commands.d.ts +229 -0
- package/dist/lib/session-commands.d.ts.map +1 -0
- package/dist/lib/session-key.d.ts +55 -0
- package/dist/lib/session-key.d.ts.map +1 -0
- package/dist/lib/sessions-view.d.ts +31 -0
- package/dist/lib/sessions-view.d.ts.map +1 -0
- package/dist/lib/source-cache.d.ts +105 -0
- package/dist/lib/source-cache.d.ts.map +1 -0
- package/dist/lib/source.d.ts +281 -0
- package/dist/lib/source.d.ts.map +1 -0
- package/dist/lib/sources.d.ts +107 -0
- package/dist/lib/sources.d.ts.map +1 -0
- package/dist/lib/spawn.d.ts +56 -0
- package/dist/lib/spawn.d.ts.map +1 -0
- package/dist/lib/stdin-tap.d.ts +41 -0
- package/dist/lib/stdin-tap.d.ts.map +1 -0
- package/dist/lib/subcommand.d.ts +57 -0
- package/dist/lib/subcommand.d.ts.map +1 -0
- package/dist/lib/systemd.d.ts +60 -0
- package/dist/lib/systemd.d.ts.map +1 -0
- package/dist/lib/templates.d.ts +35 -0
- package/dist/lib/templates.d.ts.map +1 -0
- package/dist/lib/terminal.d.ts +98 -0
- package/dist/lib/terminal.d.ts.map +1 -0
- package/dist/lib/text-selection.d.ts +75 -0
- package/dist/lib/text-selection.d.ts.map +1 -0
- package/dist/lib/theme.d.ts +90 -0
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/lib/types.d.ts +467 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/warnings.d.ts +79 -0
- package/dist/lib/warnings.d.ts.map +1 -0
- package/dist/lib/width.d.ts +39 -0
- package/dist/lib/width.d.ts.map +1 -0
- package/dist/lib/wizard.d.ts +95 -0
- package/dist/lib/wizard.d.ts.map +1 -0
- package/dist/lib/wordmark.d.ts +60 -0
- package/dist/lib/wordmark.d.ts.map +1 -0
- package/dist/lib/wrap.d.ts +74 -0
- package/dist/lib/wrap.d.ts.map +1 -0
- package/dist/memory.d.ts +25 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/model.d.ts +47 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/plugins.d.ts +15 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/remove.d.ts +52 -0
- package/dist/remove.d.ts.map +1 -0
- package/dist/run.d.ts +42 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/schedules.d.ts +41 -0
- package/dist/schedules.d.ts.map +1 -0
- package/dist/serve.d.ts +41 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/sessions.d.ts +13 -0
- package/dist/sessions.d.ts.map +1 -0
- package/dist/skills.d.ts +80 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/soul.d.ts +19 -0
- package/dist/soul.d.ts.map +1 -0
- package/dist/sources.d.ts +32 -0
- package/dist/sources.d.ts.map +1 -0
- package/dist/start.d.ts +26 -0
- package/dist/start.d.ts.map +1 -0
- package/dist/stop.d.ts +58 -0
- package/dist/stop.d.ts.map +1 -0
- package/dist/terminal-setup.d.ts +31 -0
- package/dist/terminal-setup.d.ts.map +1 -0
- package/dist/tools.d.ts +22 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/transcript.d.ts +124 -0
- package/dist/transcript.d.ts.map +1 -0
- package/dist/validate.d.ts +36 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/web-w7r68df1.js +14 -0
- package/dist/web-w7r68df1.js.map +11 -0
- package/dist/web.d.ts +36 -0
- package/dist/web.d.ts.map +1 -0
- package/dist/wire.d.ts +10 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +33 -0
- package/dist/wire.js.map +10 -0
- package/dist/workspace.d.ts +19 -0
- package/dist/workspace.d.ts.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where an installed skill came from, recorded beside the skills rather than inside them.
|
|
3
|
+
*
|
|
4
|
+
* ## Why not in the skill's own frontmatter
|
|
5
|
+
*
|
|
6
|
+
* `metadata` is the spec's extension point and would accept it, and writing there would still be the
|
|
7
|
+
* wrong move: decision 6.1's compliance claim is checked by vendoring a skill from `anthropics/skills`
|
|
8
|
+
* **unmodified**, and a copy this tool has edited is no longer that. Provenance is a fact about the
|
|
9
|
+
* copy, not about the skill.
|
|
10
|
+
*
|
|
11
|
+
* ## Why not in the agent's state directory
|
|
12
|
+
*
|
|
13
|
+
* `<agentDir>/<stateDir>/` is a cache — `skills.idx.json` lives there and is safe to delete. This is
|
|
14
|
+
* not cache: it is the answer to "where did this folder of somebody else's code come from", which is
|
|
15
|
+
* worth committing alongside the skills it describes. So it sits at `<skills dir>/.origins.json`, one
|
|
16
|
+
* file for the whole directory rather than one per skill, and the loader never sees it because
|
|
17
|
+
* `loadSkills` scans `<dir>/*/SKILL.md` and a file is not a directory.
|
|
18
|
+
*
|
|
19
|
+
* Hidden by a leading dot to keep it out of the way, and surfaced by `skills list` so it is not hidden
|
|
20
|
+
* *information* — a distinction this codebase has already had to make once, for boot warnings emitted
|
|
21
|
+
* into an empty room.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ORIGINS_FILE = ".origins.json";
|
|
24
|
+
export interface Origin {
|
|
25
|
+
/** The source's nickname at the time of installing. */
|
|
26
|
+
readonly source: string;
|
|
27
|
+
readonly url: string;
|
|
28
|
+
/** Path inside the repository — what to read to see the upstream copy. */
|
|
29
|
+
readonly repoPath: string;
|
|
30
|
+
/** Short commit the copy was taken from. What makes "has upstream changed?" answerable. */
|
|
31
|
+
readonly commit: string;
|
|
32
|
+
readonly ref?: string;
|
|
33
|
+
readonly installedAt: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function originsPath(skillsDir: string): string;
|
|
36
|
+
export declare function readOrigins(skillsDir: string): Readonly<Record<string, Origin>>;
|
|
37
|
+
export declare function recordOrigins(skillsDir: string, added: Readonly<Record<string, Origin>>): void;
|
|
38
|
+
/** Called by `remove`, so a deleted skill does not leave a claim about a directory that is gone. */
|
|
39
|
+
export declare function forgetOrigin(skillsDir: string, name: string): void;
|
|
40
|
+
//# sourceMappingURL=origins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origins.d.ts","sourceRoot":"","sources":["../../src/lib/origins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH,eAAO,MAAM,YAAY,kBAAkB,CAAA;AAE3C,MAAM,WAAW,MAAM;IACnB,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC/B;AASD,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAW/E;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAM9F;AAED,oGAAoG;AACpG,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAQlE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How output is rendered, resolved once per process.
|
|
3
|
+
*
|
|
4
|
+
* This mirrors the reasoning behind decision 3.5, which forbids the tool dialect from changing with
|
|
5
|
+
* the model: behaviour that shifts silently with the environment cannot be reasoned about. So the
|
|
6
|
+
* resolution is total and ordered, and it returns *why* it chose — the reason is printable, which is
|
|
7
|
+
* what turns "it wasn't interactive and I don't know why" into a question with an answer.
|
|
8
|
+
*
|
|
9
|
+
* Measured, not assumed: importing Ink and React costs ~65 ms under Bun and ~170-210 ms under Node,
|
|
10
|
+
* against a ~70 ms total runtime for `validate --json`. Nothing on a non-rich path may import them,
|
|
11
|
+
* which is why this returns a mode rather than a renderer.
|
|
12
|
+
*/
|
|
13
|
+
import type { ModeDecision, ModeInputs } from "#lib/schema";
|
|
14
|
+
/**
|
|
15
|
+
* Total and ordered. Every branch is reachable and every input is consulted, so no combination of
|
|
16
|
+
* flags and environment lands somewhere undocumented.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveMode(inputs: ModeInputs): ModeDecision;
|
|
19
|
+
/**
|
|
20
|
+
* Deliberately not consulted: `FORCE_COLOR`. It says how much colour a stream can carry, not
|
|
21
|
+
* whether a human is watching, and honouring it here would turn a CI job that wanted coloured logs
|
|
22
|
+
* into one driving a cursor around a file. Ink's own colour depth still respects it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveModeFromProcess(flags: {
|
|
25
|
+
readonly json: boolean;
|
|
26
|
+
readonly plain: boolean;
|
|
27
|
+
readonly oneShot: boolean;
|
|
28
|
+
}): ModeDecision;
|
|
29
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE3D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,YAAY,CAmB5D;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC1C,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC5B,GAAG,YAAY,CAOf"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The slash-command palette: what a partially typed `/word` could mean.
|
|
3
|
+
*
|
|
4
|
+
* ## Generated, not listed
|
|
5
|
+
*
|
|
6
|
+
* The entries come from two tables that already exist. `SESSION_COMMANDS` holds the verbs that only make
|
|
7
|
+
* sense inside a session — `/help`, `/reset`, `/exit` — and `COMMANDS` holds the whole CLI, with every
|
|
8
|
+
* flag, every `choices` value and every summary already written down for `--help`.
|
|
9
|
+
*
|
|
10
|
+
* Reading `COMMANDS` rather than a second list is the load-bearing decision. A flag added to the CLI
|
|
11
|
+
* appears in the TUI with nothing to remember, which is the discipline `session-commands.ts`'s own header
|
|
12
|
+
* argues for after watching `/help` drift in both directions when it was a string in a component. A
|
|
13
|
+
* command that should not be offered in a session declares `inSession: "hidden"` — hiding by omission
|
|
14
|
+
* from a hand-written list is the same drift wearing a different hat, and a required field means a new
|
|
15
|
+
* command cannot be silently absent instead.
|
|
16
|
+
*
|
|
17
|
+
* ## Pure
|
|
18
|
+
*
|
|
19
|
+
* Derived from the editor's value, so the only state the renderer adds is a cursor index. No filesystem,
|
|
20
|
+
* no process, no renderer — PURE-listed, and the matching rules are asserted as data.
|
|
21
|
+
*/
|
|
22
|
+
import type { CommandSpec } from "#lib/schema";
|
|
23
|
+
export interface PaletteEntry {
|
|
24
|
+
/** With the slash, as it would be typed. */
|
|
25
|
+
readonly word: string;
|
|
26
|
+
readonly summary: string;
|
|
27
|
+
/**
|
|
28
|
+
* `session` — dispatched by `resolveSessionCommand`.
|
|
29
|
+
* `view` — a bespoke screen.
|
|
30
|
+
* `output` — run the command and show what it printed.
|
|
31
|
+
*/
|
|
32
|
+
readonly kind: "session" | "view" | "output";
|
|
33
|
+
/** Present for a CLI command, so a host can read its flags and actions. */
|
|
34
|
+
readonly spec?: CommandSpec;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Every entry a session offers, session verbs first.
|
|
38
|
+
*
|
|
39
|
+
* Session verbs lead because they are the ones with no shell equivalent and the ones typed most: `/help`
|
|
40
|
+
* and `/exit` at the top of an unfiltered list is what makes the palette answer "what can I do here"
|
|
41
|
+
* rather than "what commands exist".
|
|
42
|
+
*/
|
|
43
|
+
export declare function paletteEntries(): readonly PaletteEntry[];
|
|
44
|
+
export interface Palette {
|
|
45
|
+
/** What has been typed after the slash, lowercased. */
|
|
46
|
+
readonly query: string;
|
|
47
|
+
readonly matches: readonly PaletteEntry[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The palette for a buffer, or `undefined` when the buffer is not a slash command being typed.
|
|
51
|
+
*
|
|
52
|
+
* Open only while the *whole* buffer is one `/word` under construction. Two consequences, both
|
|
53
|
+
* deliberate: a message that merely mentions a path never opens it, and once arguments are being typed
|
|
54
|
+
* the list closes, because there is nothing left to complete and a list covering the line would hide
|
|
55
|
+
* what is being written.
|
|
56
|
+
*/
|
|
57
|
+
export declare function paletteFor(value: string, entries?: readonly PaletteEntry[]): Palette | undefined;
|
|
58
|
+
/** The entry a cursor is on, clamped, or `undefined` when nothing matches. */
|
|
59
|
+
export declare function paletteSelection(palette: Palette, index: number): PaletteEntry | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* The command names a typed slash line may use, without the leading slash.
|
|
62
|
+
*
|
|
63
|
+
* `resolveSessionCommand` takes this list, and it defaulted to empty at the one call site that mattered
|
|
64
|
+
* — so a typed `/config get x` was prose and the same command chosen from the palette ran. Derived from
|
|
65
|
+
* the palette rather than from `COMMANDS` directly, because the palette is what the person was just
|
|
66
|
+
* shown: anything offered there has to be typeable, and anything typeable has to be offered.
|
|
67
|
+
*/
|
|
68
|
+
export declare function offeredCommands(): readonly string[];
|
|
69
|
+
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/lib/palette.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAG9C,MAAM,WAAW,YAAY;IACzB,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAA;IAC5C,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAC9B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,SAAS,YAAY,EAAE,CAkBxD;AAED,MAAM,WAAW,OAAO;IACpB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAA;CAC5C;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,SAAS,YAAY,EAAqB,GACpD,OAAO,GAAG,SAAS,CAOrB;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAG1F;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,SAAS,MAAM,EAAE,CAInD"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an endpoint will tell you about itself, and what it will only tell you by refusing.
|
|
3
|
+
*
|
|
4
|
+
* Pure: every function here takes bytes an endpoint sent and returns a finding. The network lives in
|
|
5
|
+
* `model.ts`, which is what makes the interesting half — *which* of four techniques answered, and
|
|
6
|
+
* whether the answer is a floor or a ceiling — testable against recorded responses rather than
|
|
7
|
+
* against somebody's API key.
|
|
8
|
+
*
|
|
9
|
+
* ## Floors and ceilings are different claims and must never be merged
|
|
10
|
+
*
|
|
11
|
+
* A request that **succeeds** at 100,000 tokens proves the window is *at least* 100,000. It says
|
|
12
|
+
* nothing about the number above it. A request that is **refused with a number in the message** proves
|
|
13
|
+
* the window is *exactly* that number, because the endpoint just said so.
|
|
14
|
+
*
|
|
15
|
+
* The registry's existing comment is honest about being a floor — *"A floor, not a ceiling… Claiming
|
|
16
|
+
* only what was shown"* — and that honesty is precisely how `deepseek-v4-pro` came to be declared at
|
|
17
|
+
* 393,216 against a published 1,048,576 and stayed there. So a floor is reported as a floor, and
|
|
18
|
+
* `--write` refuses to put one in a manifest without being told to: writing a floor as though it were
|
|
19
|
+
* a measurement recreates the bug this phase exists to fix, one generation later.
|
|
20
|
+
*
|
|
21
|
+
* ## Why the techniques are ordered
|
|
22
|
+
*
|
|
23
|
+
* Cheapest first, and every one of them is worth trying because they fail independently:
|
|
24
|
+
*
|
|
25
|
+
* 1. **`GET /models`** — free. Some gateways publish a context length; OpenAI does not, vLLM does.
|
|
26
|
+
* 2. **An over-range `max_tokens`** — free, because the request is refused before a token is
|
|
27
|
+
* generated. This is the one that yields a *ceiling* on the output limit, and sometimes on the
|
|
28
|
+
* window, because the refusal is generated from the endpoint's own configuration.
|
|
29
|
+
* 3. **Caching by effect** — two small calls. The only way to answer a question no endpoint answers
|
|
30
|
+
* directly. It was written on the suspicion that `promptCache: "none"` on every `deepseek-*` row
|
|
31
|
+
* meant the cache-stable prefix had never been exercised, and the first live run **refuted that**:
|
|
32
|
+
* DeepSeek reported 1024 of 1115 prompt tokens cached with no cache-control markers sent, which is
|
|
33
|
+
* exactly what the registry's own comment already said — *"`none` is a statement about the
|
|
34
|
+
* runtime's job, not the provider's behaviour"*. The technique stays because confirming a comment
|
|
35
|
+
* with a number is the point, and because an endpoint that stops caching would otherwise be
|
|
36
|
+
* invisible.
|
|
37
|
+
* 4. **A prompt-size search** — expensive, behind `--window`, and the only technique that can raise a
|
|
38
|
+
* floor when the endpoint refuses to say anything.
|
|
39
|
+
*/
|
|
40
|
+
/** Whether a number bounds the window from above, from below, or not at all. */
|
|
41
|
+
export type Bound = "ceiling" | "floor";
|
|
42
|
+
export type Technique = "metadata" | "refusal" | "search";
|
|
43
|
+
export interface WindowFinding {
|
|
44
|
+
readonly technique: Technique;
|
|
45
|
+
readonly tokens: number;
|
|
46
|
+
readonly bound: Bound;
|
|
47
|
+
/** One line naming what was observed, for a report a person has to believe. */
|
|
48
|
+
readonly detail: string;
|
|
49
|
+
}
|
|
50
|
+
export interface CacheFinding {
|
|
51
|
+
/**
|
|
52
|
+
* `undefined` means the endpoint reported no cache field at all — which is not the same as
|
|
53
|
+
* reporting a zero hit, and the two must not be collapsed. A missing field means the question was
|
|
54
|
+
* not answered; a zero means it was answered "no hit on this call", which on a second identical
|
|
55
|
+
* call is evidence of no caching.
|
|
56
|
+
*/
|
|
57
|
+
readonly cached: number | undefined;
|
|
58
|
+
readonly promptTokens: number;
|
|
59
|
+
/** The usage field that carried it — vendors spell this three different ways. */
|
|
60
|
+
readonly field: string | undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A context length published by `GET /models`, for the row naming this model.
|
|
64
|
+
*
|
|
65
|
+
* Matched on the row rather than taken from the first entry: an endpoint serving several models
|
|
66
|
+
* returns several rows, and the first one is somebody else's window. A gateway that returns the id in
|
|
67
|
+
* a different shape than the manifest spells it — a vendor prefix, an Ollama tag — is handled by the
|
|
68
|
+
* same suffix rule the capability registry uses, because the two are answering the same question
|
|
69
|
+
* about the same string.
|
|
70
|
+
*/
|
|
71
|
+
export declare function contextFromModels(payload: unknown, modelId: string): WindowFinding | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* A number an endpoint named while refusing.
|
|
74
|
+
*
|
|
75
|
+
* Deliberately narrow. Every candidate is a *labelled* number — "maximum context length is 128000",
|
|
76
|
+
* "max_tokens must be <= 8192" — because an error message is full of numbers that mean nothing here:
|
|
77
|
+
* an HTTP status, a request id, a rate-limit window. A parser that grabbed the largest integer in the
|
|
78
|
+
* string would eventually write a request id into somebody's manifest as a context window.
|
|
79
|
+
*
|
|
80
|
+
* Returns the *largest* labelled match rather than the first: a message naming both the window and
|
|
81
|
+
* the tokens already used ("128000 tokens, however you requested 130000") reads in either order, and
|
|
82
|
+
* the window is the larger of the pair in every real message seen.
|
|
83
|
+
*/
|
|
84
|
+
export declare function ceilingFromRefusal(message: string): number | undefined;
|
|
85
|
+
/** What a `usage` object says about cache hits, in whichever of the three spellings it uses. */
|
|
86
|
+
export declare function cacheFromUsage(usage: unknown): CacheFinding | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* The verdict two identical calls support, and nothing stronger.
|
|
89
|
+
*
|
|
90
|
+
* A hit on the second call proves caching. No hit proves nothing on its own — the prefix may be under
|
|
91
|
+
* the endpoint's minimum cacheable size, which for the vendors documenting one is in the hundreds of
|
|
92
|
+
* tokens — so the negative verdict names that possibility instead of asserting `promptCache: "none"`.
|
|
93
|
+
* Writing an unsupported negative into a registry row is how the current rows got there.
|
|
94
|
+
*/
|
|
95
|
+
export declare function cacheVerdict(first: CacheFinding | undefined, second: CacheFinding | undefined, minimumPrefix: number): {
|
|
96
|
+
readonly supported: boolean | undefined;
|
|
97
|
+
readonly detail: string;
|
|
98
|
+
};
|
|
99
|
+
export interface RoleProbe {
|
|
100
|
+
readonly role: string;
|
|
101
|
+
readonly modelId: string;
|
|
102
|
+
readonly baseUrl: string;
|
|
103
|
+
/** What the manifest and registry currently believe, for the comparison line. */
|
|
104
|
+
readonly declared: number;
|
|
105
|
+
readonly declaredSource: string;
|
|
106
|
+
readonly findings: readonly WindowFinding[];
|
|
107
|
+
readonly cache: {
|
|
108
|
+
readonly supported: boolean | undefined;
|
|
109
|
+
readonly detail: string;
|
|
110
|
+
};
|
|
111
|
+
/** An `outputCeiling` the refusal named, when it named one separately from the window. */
|
|
112
|
+
readonly outputCeiling: number | undefined;
|
|
113
|
+
readonly failures: readonly string[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The strongest claim the findings support.
|
|
117
|
+
*
|
|
118
|
+
* A ceiling beats a floor however large the floor is, because they are different claims rather than
|
|
119
|
+
* competing estimates: a floor of 900,000 and a ceiling of 128,000 means the search was measuring
|
|
120
|
+
* something other than the window, and taking the larger would publish a number the endpoint has
|
|
121
|
+
* already contradicted. Among findings of the same kind the largest wins — a bigger floor is a
|
|
122
|
+
* stronger floor, and two ceilings that disagree are an endpoint contradicting itself, where the
|
|
123
|
+
* higher one is the one it refused *with*.
|
|
124
|
+
*/
|
|
125
|
+
export declare function bestFinding(findings: readonly WindowFinding[]): WindowFinding | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* A paste-ready registry row for `capabilities.ts`.
|
|
128
|
+
*
|
|
129
|
+
* Printed rather than written, deliberately: changing a shipped default affects every agent that ever
|
|
130
|
+
* runs that model, and the one thing worse than a wrong number in the registry is a wrong number that
|
|
131
|
+
* arrived there without anybody reading it. `--write` touches the manifest, which is one agent.
|
|
132
|
+
*/
|
|
133
|
+
export declare function registryRow(modelId: string, tokens: number, outputCeiling: number | undefined): string;
|
|
134
|
+
/**
|
|
135
|
+
* The comment `--write` leaves beside the number it writes.
|
|
136
|
+
*
|
|
137
|
+
* This is the whole of decision 3.8's "measured" case: there is no schema field saying a number was
|
|
138
|
+
* measured, because a field like that is settable by hand and would turn a fact into a claim. A dated
|
|
139
|
+
* comment naming the endpoint is for the person reading the file in six months, and nothing parses it.
|
|
140
|
+
*/
|
|
141
|
+
export declare function measuredComment(host: string, isoDate: string, detail: string): string;
|
|
142
|
+
/**
|
|
143
|
+
* What a `--window` search will spend, in tokens, before it runs.
|
|
144
|
+
*
|
|
145
|
+
* Tokens rather than dollars, and that is a deliberate departure from the plan as written. Pricing is
|
|
146
|
+
* per-vendor, changes without notice, and a table of it in this repo would be wrong within a quarter —
|
|
147
|
+
* a confidently wrong dollar figure is worse than an honest token count the person can multiply by a
|
|
148
|
+
* number they actually know. `--price` accepts that number when they want the arithmetic done.
|
|
149
|
+
*
|
|
150
|
+
* The doubling search sends each size once, so the total is the sum of the sizes, which is a hair
|
|
151
|
+
* under twice the largest — the standard geometric-series result, stated because a reader checking the
|
|
152
|
+
* estimate against the requests will otherwise expect the sum of a linear scan.
|
|
153
|
+
*/
|
|
154
|
+
export declare function searchCost(start: number, ceiling: number): {
|
|
155
|
+
requests: number;
|
|
156
|
+
tokens: number;
|
|
157
|
+
};
|
|
158
|
+
//# sourceMappingURL=probe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../../src/lib/probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,gFAAgF;AAChF,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,OAAO,CAAA;AAEvC,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAA;AAEzD,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,YAAY;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CACrC;AAqCD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAkC9F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA0BtE;AAED,gGAAgG;AAChG,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAYvE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,YAAY,GAAG,SAAS,EAC/B,MAAM,EAAE,YAAY,GAAG,SAAS,EAChC,aAAa,EAAE,MAAM,GACtB;IAAE,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAwBtE;AAED,MAAM,WAAW,SAAS;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAA;IAC3C,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IACpF,0FAA0F;IAC1F,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1C,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CACvC;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,aAAa,GAAG,SAAS,CAOzF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACvB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GAAG,SAAS,GAClC,MAAM,CAgBR;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAErF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAY/F"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which tool providers this binary can supply.
|
|
3
|
+
*
|
|
4
|
+
* One table, consumed by every command that boots a runtime, because the alternative is each command
|
|
5
|
+
* registering its own set — and then `validate` accepts a manifest that `run` refuses, or the reverse.
|
|
6
|
+
* A provider missing from one call site is exactly the class of drift the command table exists to stop.
|
|
7
|
+
*
|
|
8
|
+
* `packages/core` cannot import a provider (hard rule 2), so the binary is where the wiring lives.
|
|
9
|
+
* Phase 9 moves this to the plugin loader and reads it from `plugins` in the manifest; the shape is
|
|
10
|
+
* already the shape a loader would produce.
|
|
11
|
+
*
|
|
12
|
+
* No Ink and no React here — this sits on the shared path that `validate --json` runs through, where
|
|
13
|
+
* a rendering import costs more than the whole command.
|
|
14
|
+
*/
|
|
15
|
+
import type { BuiltInPlugins, ChannelFactory, ScriptRunner, ToolProviderFactory } from "@dispach/core";
|
|
16
|
+
export declare const TOOL_PROVIDERS: Readonly<Record<string, ToolProviderFactory>>;
|
|
17
|
+
/**
|
|
18
|
+
* How a skill's script runs, from the one package allowed to start a process.
|
|
19
|
+
*
|
|
20
|
+
* Supplied by every command that builds a runtime, and unconditionally — unlike a tool provider, which a
|
|
21
|
+
* manifest has to select. There is no grant here to be careful with: a script only becomes callable once
|
|
22
|
+
* a skill ships one *and* that skill activates, and both of those are the workspace's decision. Omitting
|
|
23
|
+
* it would mean a skill's `scripts/` is silently never discovered, which reads to whoever wrote the skill
|
|
24
|
+
* as the runtime being broken.
|
|
25
|
+
*
|
|
26
|
+
* `env` is `process.env` rather than the manifest's, because this is constructed before any manifest is
|
|
27
|
+
* loaded. It is used for the `PATH` walk in `has()`; the *run* inherits the process environment the same
|
|
28
|
+
* way `exec` does.
|
|
29
|
+
*/
|
|
30
|
+
export declare function scriptRunner(): ScriptRunner;
|
|
31
|
+
/** For an error that has to say what *is* available. */
|
|
32
|
+
export declare const PROVIDER_IDS: readonly string[];
|
|
33
|
+
/**
|
|
34
|
+
* Which channel types this binary can supply, keyed by the `type` a manifest names.
|
|
35
|
+
*
|
|
36
|
+
* Registered by every command that loads a manifest, not only by `serve`. A `channels:` entry has to
|
|
37
|
+
* validate the same way everywhere or `validate` would refuse a manifest `serve` runs happily —
|
|
38
|
+
* the asymmetry the tool-provider table already exists to prevent.
|
|
39
|
+
*/
|
|
40
|
+
export declare const CHANNELS: Readonly<Record<string, ChannelFactory>>;
|
|
41
|
+
export declare const CHANNEL_IDS: readonly string[];
|
|
42
|
+
/**
|
|
43
|
+
* Plugins this binary can resolve by name, keyed by the specifier a manifest writes.
|
|
44
|
+
*
|
|
45
|
+
* The three tables above are what this binary supplies *by default* — every command passes them, so
|
|
46
|
+
* an agent that names no plugins behaves exactly as it did before Phase 9A. This table is what lets a
|
|
47
|
+
* manifest ask for the same capabilities by name, and it layers **over** the defaults so a future
|
|
48
|
+
* third-party plugin can replace one.
|
|
49
|
+
*
|
|
50
|
+
* **Built in rather than imported at runtime, for a structural reason.** A module imported both
|
|
51
|
+
* statically and dynamically makes `bun build --splitting` emit its exports twice and the bundle stops
|
|
52
|
+
* parsing — `SyntaxError: Duplicate export`, which `bun test` walks straight past because tests import
|
|
53
|
+
* source. The imports above are static, so the loader must never `import()` these same packages by
|
|
54
|
+
* name. Registering them here keeps each module imported exactly one way, and `boundaries.test.ts`
|
|
55
|
+
* enforces the rule generally.
|
|
56
|
+
*
|
|
57
|
+
* Keyed by package name because a manifest should name the package it means. The short name
|
|
58
|
+
* (`telegram`, `system`) is what the plugin registers its channel or provider under, and that is a
|
|
59
|
+
* different namespace on purpose: one plugin can register several.
|
|
60
|
+
*/
|
|
61
|
+
export declare const BUILT_IN_PLUGINS: BuiltInPlugins;
|
|
62
|
+
export declare const BUILT_IN_PLUGIN_SPECS: readonly string[];
|
|
63
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/lib/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EACR,cAAc,EACd,cAAc,EACd,YAAY,EACZ,mBAAmB,EACtB,MAAM,eAAe,CAAA;AAKtB,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAWxE,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,IAAI,YAAY,CAE3C;AAED,wDAAwD;AACxD,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAAgC,CAAA;AAE1E;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAE7D,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAA0B,CAAA;AAEnE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAK9B,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAAkC,CAAA"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writing an agent to disk — the one path, shared by `init` and by `POST /v1/agents`.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this module exists at all
|
|
5
|
+
*
|
|
6
|
+
* Provisioning has two front doors now: a wizard at a terminal and an HTTP route a browser or a
|
|
7
|
+
* platform calls. They must produce **byte-identical** agents, and the only way to promise that is
|
|
8
|
+
* for there to be one writer. Two would be the shape this repo keeps paying for — right when
|
|
9
|
+
* written, divergent at the next change, with the symptom being an agent that works when created
|
|
10
|
+
* one way and not the other.
|
|
11
|
+
*
|
|
12
|
+
* `complete` and `fillDefaults` moved here from `init.ts` for that reason: they *are* the funnel
|
|
13
|
+
* both paths pass through, and `complete`'s own comments are a monument to what happens when a
|
|
14
|
+
* default lives anywhere else (`apiKeyEnv` was dropped from generated manifests entirely when its
|
|
15
|
+
* question was removed, and `--schedules daily` was accepted and lost in two separate literals).
|
|
16
|
+
*
|
|
17
|
+
* ## What the HTTP path is allowed to decide, and what it is not
|
|
18
|
+
*
|
|
19
|
+
* **Not the directory.** `dir` and `dirChoice` are refused over the wire and the agent always lands
|
|
20
|
+
* in the sandbox. Where an agent lives on disk is the operator's decision, not a caller's — and a
|
|
21
|
+
* route that honoured a path would write wherever it was pointed, which is a very short step from
|
|
22
|
+
* a request that overwrites something. The route is loopback-gated in this phase, and that gate is
|
|
23
|
+
* not a reason to also hand over the filesystem.
|
|
24
|
+
*
|
|
25
|
+
* **Not which variables hold secrets.** A secret answer is written into the `.env` at `0600` once
|
|
26
|
+
* and no route ever reads it back. `SECRET_STEPS` is what a client masks; nothing here echoes one.
|
|
27
|
+
*/
|
|
28
|
+
import { type GeneratedFile, type InitAnswers, type InitStep, type Question, type QuestionDefaults } from "#lib/init-flow";
|
|
29
|
+
export declare const FLAG_FOR: Record<InitStep, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Non-interactive: every unanswered question takes its default, and a question with no default is
|
|
32
|
+
* a refusal, not a guess. All gaps report at once — with `--preset custom` that is the endpoint
|
|
33
|
+
* flags too, not just the names — and the refusal says *why* the questions could not be asked,
|
|
34
|
+
* which is the mode decision's `because` string doing its first useful work.
|
|
35
|
+
*/
|
|
36
|
+
export declare function fillDefaults(partial: Partial<Record<InitStep, string>>, because: string, defaults: QuestionDefaults): void;
|
|
37
|
+
export declare function complete(partial: Partial<Record<InitStep, string>>, defaults: QuestionDefaults): InitAnswers;
|
|
38
|
+
/**
|
|
39
|
+
* Write a planned agent, refusing rather than overwriting.
|
|
40
|
+
*
|
|
41
|
+
* Per-target checks rather than "directory not empty": a fresh `git init`'d directory must work,
|
|
42
|
+
* and the refusal names every collision at once rather than one per run.
|
|
43
|
+
*
|
|
44
|
+
* `.env` alone gets `0600`. It holds every credential this agent has — the model key, a bot token,
|
|
45
|
+
* a Composio key — and the default `0644` made all of them readable by anything running on the
|
|
46
|
+
* machine. That matters more under a service manager, which hands a job almost no environment and
|
|
47
|
+
* whose unit carries no secrets by design, so this file is the *only* path credentials arrive by.
|
|
48
|
+
*/
|
|
49
|
+
export declare function writeAgentFiles(targetDir: string, files: readonly GeneratedFile[]): void;
|
|
50
|
+
/**
|
|
51
|
+
* What opens a step that is not always asked.
|
|
52
|
+
*
|
|
53
|
+
* `telegramToken` is a question only for somebody who said `telegram: connected`, and
|
|
54
|
+
* `nextQuestion` expresses that as a `continue` a client cannot see. This is the same fact,
|
|
55
|
+
* declared — so a browser can render the whole question set and reveal a field when the choice
|
|
56
|
+
* that opens it is made, without re-implementing the walk. A hard-coded condition in the page
|
|
57
|
+
* would be the two-hand-kept-lists shape that `GET /v1/provision` exists to prevent.
|
|
58
|
+
*
|
|
59
|
+
* **Evaluate it transitively.** A step is askable when its requirement is met *and* the step named
|
|
60
|
+
* in that requirement is itself askable. `webKey` requires `web: search`; `web` requires nothing,
|
|
61
|
+
* so the recursion terminates at the default path. Only the nearest opening choice is recorded,
|
|
62
|
+
* because attributing a step to every ancestor would be a second encoding of `STEP_ORDER`'s shape.
|
|
63
|
+
*/
|
|
64
|
+
export interface StepRequirement {
|
|
65
|
+
readonly step: InitStep;
|
|
66
|
+
/** The canonical answer — the choice's `value`, never a menu index. See `canonical`. */
|
|
67
|
+
readonly value: string;
|
|
68
|
+
}
|
|
69
|
+
/** One question, as a client that is not a terminal needs to see it. */
|
|
70
|
+
export interface ProvisionStep {
|
|
71
|
+
readonly step: InitStep;
|
|
72
|
+
readonly prompt: string;
|
|
73
|
+
/**
|
|
74
|
+
* The offered default, as a value a client can use. Empty means the answer is required unless
|
|
75
|
+
* `optional`.
|
|
76
|
+
*
|
|
77
|
+
* **Canonical, never the wizard's own `fallback`.** A `Question` for a menu carries `"1"` —
|
|
78
|
+
* a 1-based index, which `validateAnswer` accepts from a terminal and which matches no
|
|
79
|
+
* `choices[].value` at all. Served raw it gave a `<select>` no selectable default; worse, the
|
|
80
|
+
* walk fed it back to itself, `presetById("1")` answered `undefined`, and `model` and `baseUrl`
|
|
81
|
+
* were therefore served with **empty** defaults where the terminal offers a real model id.
|
|
82
|
+
*/
|
|
83
|
+
readonly fallback: string;
|
|
84
|
+
/** An empty answer is a real answer. See `Question.optional`. */
|
|
85
|
+
readonly optional: boolean;
|
|
86
|
+
/** Mask it, never echo it, never log it. Derived from `SECRET_STEPS`, not restated. */
|
|
87
|
+
readonly secret: boolean;
|
|
88
|
+
/** Absent means always asked. See `StepRequirement`. */
|
|
89
|
+
readonly requires?: StepRequirement;
|
|
90
|
+
readonly choices?: readonly {
|
|
91
|
+
readonly value: string;
|
|
92
|
+
readonly label: string;
|
|
93
|
+
/** The dim half of a row — a reason, not a second label. See `Question.options`. */
|
|
94
|
+
readonly hint?: string;
|
|
95
|
+
}[];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* One question, for a client that is not a terminal.
|
|
99
|
+
*
|
|
100
|
+
* Exported so the forwarding can be tested against a question carrying a `hint` — only the location
|
|
101
|
+
* question has one today, and that one is filtered out of the served list, so a test over the real
|
|
102
|
+
* walk would assert this by having no data. `secret` is read from `SECRET_STEPS` rather than
|
|
103
|
+
* restated, which is the half that must not drift: a second list of which answers are credentials
|
|
104
|
+
* is the one worth getting wrong.
|
|
105
|
+
*/
|
|
106
|
+
export declare function toProvisionStep(question: Question, opened?: StepRequirement): ProvisionStep;
|
|
107
|
+
/**
|
|
108
|
+
* Every question the wizard can ask, in asking order, with its choices and what opens it.
|
|
109
|
+
*
|
|
110
|
+
* **Walked from `nextQuestion` rather than written down**, which is the whole reason this is safe to
|
|
111
|
+
* serve: the terminal's order, prompts, defaults and choice lists come from the same walk, so a
|
|
112
|
+
* browser cannot render a stale form. A hand-kept list here would be the "two lists" shape that has
|
|
113
|
+
* already cost this repo several rounds — `NO_MANIFEST`, `DOCUMENTED_CTRL_LETTERS`,
|
|
114
|
+
* `THRESHOLD_ORDER`, each right when written and wrong at the next addition.
|
|
115
|
+
*
|
|
116
|
+
* ## Why one walk is not enough
|
|
117
|
+
*
|
|
118
|
+
* `nextQuestion` skips a question whose opening answer was not given, so following the **default**
|
|
119
|
+
* path lists thirteen of the eighteen askable steps and omits every credential but the model key:
|
|
120
|
+
* `telegramToken`, `telegramAllow`, `webBackend`, `webKey`, `composioKey`. A browser built on that
|
|
121
|
+
* could ask for a Telegram agent and not for its token, and would write an agent whose `.env` has
|
|
122
|
+
* to be filled at a terminal before it can start — which is the opposite of what provisioning from
|
|
123
|
+
* a browser is for.
|
|
124
|
+
*
|
|
125
|
+
* So the default path is walked first and its finds carry no `requires`; then every choice it
|
|
126
|
+
* offered is walked as a **branch**, and a step seen for the first time there is attributed to the
|
|
127
|
+
* branch that opened it. Breadth-first, so a step reachable two ways is attributed to the
|
|
128
|
+
* shallowest — and each `step=value` pair is walked at most once, which is what bounds this to
|
|
129
|
+
* roughly twenty short walks rather than a combinatorial explosion.
|
|
130
|
+
*
|
|
131
|
+
* The seed carries the **whole path** taken to reach a branch, not just its own answer: seeded with
|
|
132
|
+
* `webBackend` alone, `nextQuestion` skips it, because it is a question only for somebody who
|
|
133
|
+
* already said `web: search`.
|
|
134
|
+
*
|
|
135
|
+
* Ordering is restored from `STEP_ORDER` at the end, because a branch's finds are discovered after
|
|
136
|
+
* the default path has run past them and "in asking order" is what the wire promises.
|
|
137
|
+
*
|
|
138
|
+
* `REFUSED_STEPS` is omitted rather than offered: a question the route rejects is a field that
|
|
139
|
+
* cannot be submitted, which is worse than not asking.
|
|
140
|
+
*/
|
|
141
|
+
export declare function provisionSteps(defaults: QuestionDefaults): readonly ProvisionStep[];
|
|
142
|
+
export interface ProvisionRequest {
|
|
143
|
+
/** A subset of the steps. Anything absent takes its default, as `init --yes` does. */
|
|
144
|
+
readonly answers: Readonly<Record<string, string>>;
|
|
145
|
+
readonly defaults: QuestionDefaults;
|
|
146
|
+
}
|
|
147
|
+
export interface ProvisionResult {
|
|
148
|
+
readonly agentId: string;
|
|
149
|
+
readonly dir: string;
|
|
150
|
+
readonly manifestPath: string;
|
|
151
|
+
/** Relative paths written, so a caller can report what it made without re-reading the disk. */
|
|
152
|
+
readonly files: readonly string[];
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Validate a partial answer set, fill the rest from defaults, and write the agent.
|
|
156
|
+
*
|
|
157
|
+
* The HTTP twin of `init --yes --name x --preset y`, and deliberately built from the same three
|
|
158
|
+
* calls in the same order: `validateAnswer` per supplied step, `fillDefaults` for the rest,
|
|
159
|
+
* `complete` as the funnel. A route that assembled answers any other way would be a second
|
|
160
|
+
* definition of what a valid agent is.
|
|
161
|
+
*/
|
|
162
|
+
export declare function provisionAgent(input: ProvisionRequest): ProvisionResult;
|
|
163
|
+
//# sourceMappingURL=provision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provision.d.ts","sourceRoot":"","sources":["../../src/lib/provision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH,OAAO,EAEH,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,QAAQ,EAKb,KAAK,QAAQ,EACb,KAAK,gBAAgB,EAIxB,MAAM,gBAAgB,CAAA;AAEvB,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAgC7C,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,EAC1C,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,gBAAgB,GAC3B,IAAI,CA4BN;AAED,wBAAgB,QAAQ,CACpB,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,EAC1C,QAAQ,EAAE,gBAAgB,GAC3B,WAAW,CAsHb;AAeD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAoBxF;AAID;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,wFAAwF;IACxF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACzB;AAED,wEAAwE;AACxE,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB;;;;;;;;;OASG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,uFAAuF;IACvF,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS;QACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;QACtB,oFAAoF;QACpF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KACzB,EAAE,CAAA;CACN;AAiFD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,aAAa,CAwB3F;AAKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,aAAa,EAAE,CAyDnF;AAED,MAAM,WAAW,gBAAgB;IAC7B,sFAAsF;IACtF,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAClD,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;CACtC;AAED,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,gBAAgB,GAAG,eAAe,CAoFvE"}
|