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
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `init [dir]` — one command from installed binary to an agent that answers.
|
|
3
|
+
*
|
|
4
|
+
* Interactive at a terminal, flag-driven everywhere else, and the same flow either way: the
|
|
5
|
+
* questions live in `lib/init-flow.ts` as pure data, this file just asks them. Non-interactive
|
|
6
|
+
* runs (`--yes`, a pipe, CI) take each question's default and refuse — naming the missing flags —
|
|
7
|
+
* when a question has none, because inventing an agent name is not a default, it is a guess.
|
|
8
|
+
*
|
|
9
|
+
* Nothing is written over an existing file, there is no `--force`, and the wizard never asks for
|
|
10
|
+
* the API key itself: typing a secret into a prompt invites shoulder-surfing, and passing one as
|
|
11
|
+
* a flag writes it into shell history. The generated `.env` carries an empty `KEY=` line and the
|
|
12
|
+
* next-steps block says to fill it.
|
|
13
|
+
*
|
|
14
|
+
* Before exiting 0 the generated directory is validated with the *real* loader — the same
|
|
15
|
+
* sequence `validate` runs — so a template bug is this command's failure, never the user's first.
|
|
16
|
+
*/
|
|
17
|
+
import type { InitOptions } from "#lib/schema";
|
|
18
|
+
/** Which flag supplies each step, for the refusal that names what is missing. */
|
|
19
|
+
export type InitResult = {
|
|
20
|
+
readonly kind: "ok";
|
|
21
|
+
readonly manifestPath: string;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: "aborted";
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: "failed";
|
|
26
|
+
readonly code: number;
|
|
27
|
+
};
|
|
28
|
+
export declare function initCommand(options: InitOptions): Promise<number>;
|
|
29
|
+
/**
|
|
30
|
+
* The same flow, returning the created manifest's path — the picker's "create a new agent" chains
|
|
31
|
+
* straight into `run` through this, so there is exactly one wizard entry point.
|
|
32
|
+
*/
|
|
33
|
+
export declare function initInteractive(options: InitOptions): Promise<InitResult>;
|
|
34
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAkCH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,iFAAiF;AAEjF,MAAM,MAAM,UAAU,GAChB;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAQxD,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAOvE;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAE/E"}
|
package/dist/keymap.d.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keystrokes in, intents out. Pure, and free of any Ink import.
|
|
3
|
+
*
|
|
4
|
+
* The one contract worth stating explicitly, because Phase 1 established and measured it:
|
|
5
|
+
* **Ctrl-C cancels the turn, not the process.** Whether a keystroke means "cancel" or "exit"
|
|
6
|
+
* depends on whether a turn is in flight, so that decision belongs here — in a function that can be
|
|
7
|
+
* tested against both states — rather than in a component where it can only be tested by hand.
|
|
8
|
+
*/
|
|
9
|
+
import type { EditorState, Intent, KeyState } from "#lib/types";
|
|
10
|
+
export interface KeyContext {
|
|
11
|
+
/** A turn is in flight. */
|
|
12
|
+
readonly busy: boolean;
|
|
13
|
+
/** The input buffer is empty. */
|
|
14
|
+
readonly empty: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The cursor is on the first line, so ↑ means history rather than a line up.
|
|
17
|
+
*
|
|
18
|
+
* Position decides, because a multi-line buffer wants both and every editor resolves it this way:
|
|
19
|
+
* at the top of what you are composing there is nothing above to move to, so the arrow is free to
|
|
20
|
+
* mean the other thing. `^P`/`^N` stay unconditional history for anyone who would rather not think
|
|
21
|
+
* about where the cursor is.
|
|
22
|
+
*/
|
|
23
|
+
readonly firstLine: boolean;
|
|
24
|
+
readonly lastLine: boolean;
|
|
25
|
+
/** `^R` is open, so enter accepts a match and escape closes it. */
|
|
26
|
+
readonly searching: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* A first ^C has already been pressed at an idle prompt, so the next one leaves.
|
|
29
|
+
*
|
|
30
|
+
* Held by the caller rather than derived, because it is the one piece of keyboard state with a
|
|
31
|
+
* *clock* attached — it expires — and a pure function cannot own that. What it must not do is
|
|
32
|
+
* decide what an armed ^C means, which is why the flag comes in here and the decision stays below.
|
|
33
|
+
*/
|
|
34
|
+
readonly armed: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The transcript window is parked above the newest row, so escape means "come back down".
|
|
37
|
+
*
|
|
38
|
+
* Escape had nothing to do at an idle prompt and was claimed as `none` to keep control characters
|
|
39
|
+
* out of the buffer. A scrolled-away view is the one state where a reader plainly wants a way out
|
|
40
|
+
* of where they are, and escape is the key they will press.
|
|
41
|
+
*/
|
|
42
|
+
readonly scrolled: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The context for a given editor state.
|
|
46
|
+
*
|
|
47
|
+
* Exported and derived in one place so no renderer computes it by hand. `empty` was already this shape
|
|
48
|
+
* — editor state passed to the keymap as context — and the two line flags are the same idea; a caller
|
|
49
|
+
* that got `firstLine` wrong would make the arrows misbehave in a way no test of this module would see.
|
|
50
|
+
*/
|
|
51
|
+
export declare function keyContext(editor: EditorState, busy: boolean, session?: {
|
|
52
|
+
readonly armed?: boolean;
|
|
53
|
+
readonly scrolled?: boolean;
|
|
54
|
+
}): KeyContext;
|
|
55
|
+
export declare function keyToIntent(input: string, key: KeyState, context: KeyContext): Intent;
|
|
56
|
+
import type { SelectMove } from "#lib/select";
|
|
57
|
+
export type ListIntent = {
|
|
58
|
+
readonly kind: "move";
|
|
59
|
+
readonly move: SelectMove;
|
|
60
|
+
} | {
|
|
61
|
+
readonly kind: "choose";
|
|
62
|
+
} | {
|
|
63
|
+
readonly kind: "back";
|
|
64
|
+
} | {
|
|
65
|
+
readonly kind: "exit";
|
|
66
|
+
} | {
|
|
67
|
+
readonly kind: "none";
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* A checklist adds two verbs a single-select list does not have: tick a row, and finish.
|
|
71
|
+
*
|
|
72
|
+
* Space ticks and enter finishes, which is the convention every multi-select in a terminal uses — and
|
|
73
|
+
* getting it the other way round is the mistake that makes a picker feel broken, because enter on a
|
|
74
|
+
* highlighted row is such a strong habit that people submit with one thing ticked and never see the rest.
|
|
75
|
+
* `a` and `n` are all/none, worth having when the list is fifty rows long.
|
|
76
|
+
*/
|
|
77
|
+
export type CheckIntent = {
|
|
78
|
+
readonly kind: "move";
|
|
79
|
+
readonly move: SelectMove;
|
|
80
|
+
} | {
|
|
81
|
+
readonly kind: "toggle";
|
|
82
|
+
} | {
|
|
83
|
+
readonly kind: "all";
|
|
84
|
+
} | {
|
|
85
|
+
readonly kind: "none-selected";
|
|
86
|
+
} | {
|
|
87
|
+
readonly kind: "confirm";
|
|
88
|
+
} | {
|
|
89
|
+
readonly kind: "cancel";
|
|
90
|
+
} | {
|
|
91
|
+
readonly kind: "none";
|
|
92
|
+
};
|
|
93
|
+
export declare function keyToCheckIntent(input: string, key: KeyState): CheckIntent;
|
|
94
|
+
/**
|
|
95
|
+
* List navigation: arrows or j/k, g/G for ends, enter chooses, esc backs out, ^C/^D leave.
|
|
96
|
+
*
|
|
97
|
+
* A digit jumps the cursor — visibly and reversibly — and deliberately does not choose: a stray
|
|
98
|
+
* number must never launch an agent.
|
|
99
|
+
*/
|
|
100
|
+
export declare function keyToListIntent(input: string, key: KeyState): ListIntent;
|
|
101
|
+
export type WizardKeyIntent = {
|
|
102
|
+
readonly kind: "back";
|
|
103
|
+
} | {
|
|
104
|
+
readonly kind: "abort";
|
|
105
|
+
} | {
|
|
106
|
+
readonly kind: "commit";
|
|
107
|
+
} | {
|
|
108
|
+
readonly kind: "list";
|
|
109
|
+
readonly intent: ListIntent;
|
|
110
|
+
} | {
|
|
111
|
+
readonly kind: "edit";
|
|
112
|
+
readonly intent: Intent;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* The wizard's chrome keys are checked before delegation — Esc means "back a question" here,
|
|
116
|
+
* which is exactly why chat's `keyToIntent` (which claims Esc as none) is not reused raw.
|
|
117
|
+
*
|
|
118
|
+
* Text steps then get the full chat editor treatment (^A/^E, ^W, code-point cursor); select steps
|
|
119
|
+
* get the list navigation. A pasted blob collapses to its first line — a wizard answer is one
|
|
120
|
+
* line — and history chords mean nothing inside a question.
|
|
121
|
+
*/
|
|
122
|
+
export declare function keyToWizardIntent(input: string, key: KeyState, context: {
|
|
123
|
+
readonly select: boolean;
|
|
124
|
+
readonly empty: boolean;
|
|
125
|
+
}): WizardKeyIntent;
|
|
126
|
+
//# sourceMappingURL=keymap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../src/keymap.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAc,MAAM,YAAY,CAAA;AAE3E,MAAM,WAAW,UAAU;IACvB,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB;;;;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GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/B,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,WAAW,CAiB1E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,UAAU,CA2BxE;AAED,MAAM,MAAM,eAAe,GACrB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAAE,GACtD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAExD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC/D,eAAe,CA8CjB"}
|
package/dist/keys.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `keys` — press a chord and see what actually arrived.
|
|
3
|
+
*
|
|
4
|
+
* The instrument this repo did not have. Every previous round of keyboard work was diagnosed by reading
|
|
5
|
+
* Ink's parser and reasoning about what a terminal *probably* sends, which is exactly what CLAUDE.md says
|
|
6
|
+
* not to do — and it is how `⌥r` stayed broken through nine rounds while every test passed: the tests
|
|
7
|
+
* built `KeyState` objects by hand, so they proved the switch and never the delivery.
|
|
8
|
+
*
|
|
9
|
+
* Three layers per keystroke, so a failure names which one is wrong: the bytes the terminal wrote, Ink's
|
|
10
|
+
* reading of them, and the intent this repo's keymap resolved. Paste it into an issue and there is nothing
|
|
11
|
+
* left to guess about.
|
|
12
|
+
*/
|
|
13
|
+
export interface KeysCommandOptions {
|
|
14
|
+
readonly noEnhancedKeys?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function keysCommand(options?: KeysCommandOptions): Promise<number>;
|
|
17
|
+
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CACpC;AAED,wBAAsB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6DnF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which environment an agent actually runs under, and in what order.
|
|
3
|
+
*
|
|
4
|
+
* ## The bug this exists to fix
|
|
5
|
+
*
|
|
6
|
+
* A sandbox agent's own `.env` said `MODEL_ID=deepseek-v4-flash`. The agent ran a whole session
|
|
7
|
+
* on `deepseek-v4-pro`, because the binary was launched from a project checkout whose own `.env`
|
|
8
|
+
* happens to set that variable, Bun auto-loads a `.env` from the current directory into
|
|
9
|
+
* `process.env` before any of this code runs, and core's documented rule is that the real
|
|
10
|
+
* environment beats a `.env` beside the manifest.
|
|
11
|
+
*
|
|
12
|
+
* Every step of that is working as designed and the outcome is wrong. The rule exists so an
|
|
13
|
+
* **operator's explicit export** beats a committed file — `MODEL_ID=x <binary> run milo`, or a
|
|
14
|
+
* container's environment. A `.env` file sitting in whatever directory you happened to be standing
|
|
15
|
+
* in is not that. It is configuration for *that project*, and an agent that lives in the home
|
|
16
|
+
* sandbox has nothing to do with it.
|
|
17
|
+
*
|
|
18
|
+
* ## The order, stated
|
|
19
|
+
*
|
|
20
|
+
* 1. A variable genuinely exported into the environment.
|
|
21
|
+
* 2. The `.env` beside the agent's own manifest.
|
|
22
|
+
* 3. A `.env` in the directory the command was run from.
|
|
23
|
+
*
|
|
24
|
+
* Core still implements "real environment wins" exactly as documented. This decides what counts as
|
|
25
|
+
* the real environment before core sees it, which is CLI policy — the same place the home sandbox
|
|
26
|
+
* lives, and for the same reason: core is what an embedder runs other people's agents on, and a
|
|
27
|
+
* container's environment must keep winning there without any of this.
|
|
28
|
+
*
|
|
29
|
+
* ## The one case it gets wrong, stated too
|
|
30
|
+
*
|
|
31
|
+
* An export and the cwd `.env` that set a variable to the *same string* are indistinguishable from
|
|
32
|
+
* inside the process, so such a variable is treated as coming from the file and loses to the agent's
|
|
33
|
+
* own `.env`. That is a rare configuration and a mild wrong answer. The behaviour it replaces was a
|
|
34
|
+
* common configuration and a silent one: every sandbox agent reconfigured by whichever directory you
|
|
35
|
+
* were standing in.
|
|
36
|
+
*/
|
|
37
|
+
import { type EnvSource } from "@dispach/core";
|
|
38
|
+
/**
|
|
39
|
+
* The `.env` in a directory, or nothing.
|
|
40
|
+
*
|
|
41
|
+
* Exported because `config-env.ts` needs the same three layers this module resolves in order to say
|
|
42
|
+
* *which* of them a value came from, and two readers of one file is how two answers to one question
|
|
43
|
+
* come about.
|
|
44
|
+
*/
|
|
45
|
+
export declare function readDotEnv(dir: string): Record<string, string>;
|
|
46
|
+
export interface AmbientOptions {
|
|
47
|
+
/** Defaults to `process.env`. Injected by tests, which must never read the real environment. */
|
|
48
|
+
readonly env?: EnvSource;
|
|
49
|
+
readonly cwd?: string;
|
|
50
|
+
/** Defaults to real filesystem reads. */
|
|
51
|
+
readonly readDir?: (dir: string) => Record<string, string>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The environment to hand core for these manifests.
|
|
55
|
+
*
|
|
56
|
+
* Returns `process.env` unchanged whenever nothing is in tension — no cwd `.env`, or none of its
|
|
57
|
+
* variables collide with an agent's own file. The common case therefore costs two `existsSync`
|
|
58
|
+
* calls and changes nothing, which matters: this runs on the boot path.
|
|
59
|
+
*/
|
|
60
|
+
export declare function ambientEnv(manifestPaths: readonly string[], options?: AmbientOptions): EnvSource;
|
|
61
|
+
/**
|
|
62
|
+
* What was demoted, for the one line that says so.
|
|
63
|
+
*
|
|
64
|
+
* Separate from the value above because silence was half the original bug. A person who has just
|
|
65
|
+
* written `MODEL_ID` into a project `.env` and finds their agent ignoring it deserves the same
|
|
66
|
+
* sentence as the person who found their agent obeying it.
|
|
67
|
+
*/
|
|
68
|
+
export declare function demotedKeys(manifestPaths: readonly string[], options?: AmbientOptions): readonly string[];
|
|
69
|
+
//# sourceMappingURL=ambient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ambient.d.ts","sourceRoot":"","sources":["../../src/lib/ambient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,eAAe,CAAA;AAE3D;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAW9D;AAED,MAAM,WAAW,cAAc;IAC3B,gGAAgG;IAChG,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,yCAAyC;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC7D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACtB,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,OAAO,GAAE,cAAmB,GAC7B,SAAS,CAyBX;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACvB,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,OAAO,GAAE,cAAmB,GAC7B,SAAS,MAAM,EAAE,CAInB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The argument parser. Pure — argv in, a decision out, no I/O and no `process`.
|
|
3
|
+
*
|
|
4
|
+
* It replaces a parser that failed silently in four distinct ways, each of which is now a test:
|
|
5
|
+
*
|
|
6
|
+
* - **A value beginning with `-` was swallowed.** The old rule was "consume the next token unless
|
|
7
|
+
* it looks like a flag", so `--input "-5 degrees"` set `input` to boolean `true`, the caller's
|
|
8
|
+
* `typeof input === "string"` check failed, and the process opened an interactive session instead
|
|
9
|
+
* of running the one turn it was asked for. The rule here has no such hole: whether a flag
|
|
10
|
+
* consumes the next token is a property of the *flag*, declared in `commands.ts`, never a guess
|
|
11
|
+
* about the value.
|
|
12
|
+
* - **Unknown flags were ignored.** `--sesion local:x` ran against the default session silently.
|
|
13
|
+
* - **A non-numeric `--limit` fell back to the default.**
|
|
14
|
+
* - **`--help` with no command exited 1**, reporting failure for the one thing that had succeeded.
|
|
15
|
+
*
|
|
16
|
+
* Every problem found is collected rather than thrown on sight, so a line with two mistakes reports
|
|
17
|
+
* both. `HarnessError.details` already renders that shape.
|
|
18
|
+
*/
|
|
19
|
+
import { HarnessError } from "@dispach/core";
|
|
20
|
+
import type { ParseResult } from "#lib/schema";
|
|
21
|
+
/** Anything wrong with the command line itself. Distinct from anything wrong with a manifest. */
|
|
22
|
+
export declare class UsageError extends HarnessError {
|
|
23
|
+
static readonly ERROR_NAME = "UsageError";
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* `argv` is everything after the program name.
|
|
27
|
+
*
|
|
28
|
+
* The command comes first, before any flag, as with git and docker. That ordering is what makes the
|
|
29
|
+
* parse unambiguous: flag semantics depend on the command's spec, so the command has to be known
|
|
30
|
+
* before a single flag can be interpreted.
|
|
31
|
+
*/
|
|
32
|
+
export declare function parse(argv: readonly string[]): ParseResult;
|
|
33
|
+
//# sourceMappingURL=args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/lib/args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAA2B,YAAY,EAAE,MAAM,eAAe,CAAA;AAErE,OAAO,KAAK,EAAmC,WAAW,EAAE,MAAM,aAAa,CAAA;AAE/E,iGAAiG;AACjG,qBAAa,UAAW,SAAQ,YAAY;IACxC,gBAAyB,UAAU,gBAAe;CACrD;AA0ID;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,CAqP1D"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First run: if no server is up, put one up — and say so in one line.
|
|
3
|
+
*
|
|
4
|
+
* This is the most invasive thing the product does, and it is defensible only because of four
|
|
5
|
+
* properties, each of which is a line of code below rather than an intention:
|
|
6
|
+
*
|
|
7
|
+
* 1. **It is announced**, in one line, naming the command that undoes it.
|
|
8
|
+
* 2. **It is skipped for every command that does not want a host** — `CommandSpec.needsServer` is a
|
|
9
|
+
* required field so that decision is taken per command rather than inherited from a list in
|
|
10
|
+
* `index.ts` that a new command is silently absent from, or silently included in.
|
|
11
|
+
* 3. **It never runs inside a container**, which *is* the daemon, or under CI, or when the escape
|
|
12
|
+
* hatch is set. A service manager inside a container is a second supervisor arguing with the
|
|
13
|
+
* first.
|
|
14
|
+
* 4. **It never fails the command it was asked for.** A LaunchAgent needs a GUI session, so over
|
|
15
|
+
* SSH `launchctl bootstrap` returns 125 or 112 — and a listing command that died because a
|
|
16
|
+
* background service could not be installed would be a far worse product than one without any
|
|
17
|
+
* of this. Every failure degrades to a printed line.
|
|
18
|
+
*
|
|
19
|
+
* ## Why it does not start a service it cannot start
|
|
20
|
+
*
|
|
21
|
+
* On Linux the unit is written and not enabled — `systemctl --user` is not driven from here (see
|
|
22
|
+
* `service.ts`). Bootstrapping there would mean writing a file and reporting a running server,
|
|
23
|
+
* which is the exact failure this phase exists to remove, so on a platform whose manager cannot
|
|
24
|
+
* start what it installs the bootstrap **prints the command and writes nothing**.
|
|
25
|
+
*/
|
|
26
|
+
export interface BootstrapOptions {
|
|
27
|
+
/** From `CommandSpec.needsServer`. False short-circuits everything. */
|
|
28
|
+
readonly needsServer: boolean;
|
|
29
|
+
readonly platform?: string;
|
|
30
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
31
|
+
/** `--no-bootstrap`. */
|
|
32
|
+
readonly disabled?: boolean;
|
|
33
|
+
/** Injected by tests; the real one installs and starts the unit. */
|
|
34
|
+
readonly install?: () => Promise<BootstrapResult>;
|
|
35
|
+
/** The store to look for a live host in. `serve --store` has one, so this does too. */
|
|
36
|
+
readonly store?: string;
|
|
37
|
+
}
|
|
38
|
+
export type BootstrapResult = {
|
|
39
|
+
readonly kind: "started";
|
|
40
|
+
readonly label: string;
|
|
41
|
+
} | {
|
|
42
|
+
readonly kind: "manual";
|
|
43
|
+
readonly lines: readonly string[];
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: "failed";
|
|
46
|
+
readonly message: string;
|
|
47
|
+
readonly hint: string;
|
|
48
|
+
};
|
|
49
|
+
/** Why nothing was done, when nothing was done. Returned rather than logged, so a test can read it. */
|
|
50
|
+
export type BootstrapOutcome = {
|
|
51
|
+
readonly kind: "skipped";
|
|
52
|
+
readonly reason: SkipReason;
|
|
53
|
+
} | {
|
|
54
|
+
readonly kind: "already";
|
|
55
|
+
} | BootstrapResult;
|
|
56
|
+
export type SkipReason = "command-needs-no-server" | "disabled-by-flag" | "disabled-by-env" | "in-container" | "in-ci" | "is-the-service";
|
|
57
|
+
/**
|
|
58
|
+
* Why we are not doing this, checked before anything is read.
|
|
59
|
+
*
|
|
60
|
+
* Ordered cheapest-first and by *specificity*: `is-the-service` is checked before `in-container`
|
|
61
|
+
* because a service process is the one case where being wrong would be recursive, and the reason is
|
|
62
|
+
* worth reporting accurately when a test asks.
|
|
63
|
+
*/
|
|
64
|
+
export declare function skipReason(options: BootstrapOptions): SkipReason | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Put a server up if one is not already up.
|
|
67
|
+
*
|
|
68
|
+
* "Already up" is decided from the **lease table plus pid liveness**, which is the same witness
|
|
69
|
+
* every other surface uses — `liveHosts` filters on `process.kill(pid, 0)`, so a row left behind by
|
|
70
|
+
* a boot that died after claiming does not read as a running server. No HTTP probe: a lease with a
|
|
71
|
+
* live pid is a process hosting agents whether or not it serves HTTP, and a `run` REPL holding one
|
|
72
|
+
* is a reason not to install a second host underneath somebody.
|
|
73
|
+
*/
|
|
74
|
+
export declare function ensureServer(options: BootstrapOptions): Promise<BootstrapOutcome>;
|
|
75
|
+
/**
|
|
76
|
+
* The one line, and it is the whole justification for doing this at all.
|
|
77
|
+
*
|
|
78
|
+
* Written to **stderr**, so it never lands in the middle of `--json` output somebody is piping into
|
|
79
|
+
* `jq` — the announcement matters to a person and is noise to a script. Every branch names what to
|
|
80
|
+
* type next: the undo for a success, the do-it-yourself for a platform we do not drive, and the
|
|
81
|
+
* diagnostic command for a failure.
|
|
82
|
+
*/
|
|
83
|
+
export declare function announce(outcome: BootstrapOutcome): string | undefined;
|
|
84
|
+
//# sourceMappingURL=bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/lib/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAOH,MAAM,WAAW,gBAAgB;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,C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AG,SAAS,CAatE"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The browse list: a curated catalogue turned into rows, and rows turned back into skills.
|
|
3
|
+
*
|
|
4
|
+
* Pure and PURE-listed. The screen root renders it and the plain path prints it, so the *shape* of the
|
|
5
|
+
* list — which sources appear, in what order, under which headings, with what shown beside each entry —
|
|
6
|
+
* is decided once here and asserted without mounting Ink or reaching a network.
|
|
7
|
+
*
|
|
8
|
+
* Keeping this separate from the component is what makes `--plain` honest: a terminal and a pipe print
|
|
9
|
+
* the same list because both read the same rows, rather than the plain path reimplementing the ordering
|
|
10
|
+
* and drifting the first time a group is added.
|
|
11
|
+
*/
|
|
12
|
+
import type { CatalogueEntry } from "#lib/source-cache";
|
|
13
|
+
import type { SourceSpec } from "#lib/sources";
|
|
14
|
+
export interface BrowseRow {
|
|
15
|
+
/** `source` is a top-level heading, `group` a subheading; neither is selectable. */
|
|
16
|
+
readonly kind: "source" | "group" | "item";
|
|
17
|
+
readonly label: string;
|
|
18
|
+
/** Its own column, not appended to the label — the row is laid out, not concatenated. */
|
|
19
|
+
readonly meta?: string;
|
|
20
|
+
readonly description?: string;
|
|
21
|
+
/** The skill this row installs. Absent on a heading. */
|
|
22
|
+
readonly entry?: CatalogueEntry;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A source's entries, filtered by its curation and grouped for display.
|
|
26
|
+
*
|
|
27
|
+
* Curation is applied *here* rather than in `readCatalogue`, so `sources search` keeps seeing everything.
|
|
28
|
+
* A curated list is a recommendation; a search that could not find a named skill would be a restriction.
|
|
29
|
+
*/
|
|
30
|
+
export declare function curatedEntries(spec: SourceSpec, entries: readonly CatalogueEntry[]): readonly CatalogueEntry[];
|
|
31
|
+
export interface BrowseInput {
|
|
32
|
+
readonly spec: SourceSpec;
|
|
33
|
+
readonly entries: readonly CatalogueEntry[];
|
|
34
|
+
/** Already installed in the target agent, shown as such rather than offered twice. */
|
|
35
|
+
readonly installed?: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Every row, in display order: one heading per source, then per curated group where the source has them.
|
|
39
|
+
*
|
|
40
|
+
* An installed skill is listed with a note rather than removed, because a list whose contents change
|
|
41
|
+
* depending on which agent you picked is one you cannot learn.
|
|
42
|
+
*/
|
|
43
|
+
export declare function browseRows(inputs: readonly BrowseInput[]): readonly BrowseRow[];
|
|
44
|
+
/**
|
|
45
|
+
* First sentence, uncapped.
|
|
46
|
+
*
|
|
47
|
+
* The *column* decides the visible width now, in `lib/rows.ts`, so capping here as well would truncate
|
|
48
|
+
* twice — once at 96 characters and again at whatever the terminal has left, which is how a wide terminal
|
|
49
|
+
* ends up showing a short description with an ellipsis and empty space after it.
|
|
50
|
+
*/
|
|
51
|
+
export declare function summarise(description: string): string;
|
|
52
|
+
/** Which rows the cursor may land on, for the multi-select reducer. */
|
|
53
|
+
export declare function selectableOf(rows: readonly BrowseRow[]): readonly boolean[];
|
|
54
|
+
/** The skills behind a set of chosen row indices, in the order they appear on screen. */
|
|
55
|
+
export declare function chosenEntries(rows: readonly BrowseRow[], chosen: readonly number[]): readonly CatalogueEntry[];
|
|
56
|
+
/**
|
|
57
|
+
* The structural half of `skills.ts`'s `InstallOutcome`.
|
|
58
|
+
*
|
|
59
|
+
* Declared here rather than imported so this module stays free of the command that produces it —
|
|
60
|
+
* `skills.ts` reaches the filesystem, and importing it would drag that into every consumer of the row
|
|
61
|
+
* layout, including the pure tests.
|
|
62
|
+
*/
|
|
63
|
+
export interface InstallOutcomeLike {
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly ok: boolean;
|
|
66
|
+
readonly reason?: string;
|
|
67
|
+
readonly runnable: readonly string[];
|
|
68
|
+
}
|
|
69
|
+
export interface InstallReport {
|
|
70
|
+
readonly installed: readonly string[];
|
|
71
|
+
readonly failed: readonly {
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly reason: string;
|
|
74
|
+
}[];
|
|
75
|
+
/** Runnable files across every successful install, and how many skills brought them. */
|
|
76
|
+
readonly runnable: number;
|
|
77
|
+
readonly withCode: number;
|
|
78
|
+
readonly total: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* One report for a batch, as data.
|
|
82
|
+
*
|
|
83
|
+
* Both renderings read this — the text one the pipe and `init` print, and the card the browser shows
|
|
84
|
+
* inside its own frame. The alternative was each composing its own summary from the outcomes, and a
|
|
85
|
+
* terminal and a pipe disagreeing about what happened is exactly the class of failure the shared
|
|
86
|
+
* `browseRows` was introduced to end.
|
|
87
|
+
*/
|
|
88
|
+
export declare function installReport(outcomes: readonly InstallOutcomeLike[]): InstallReport;
|
|
89
|
+
//# sourceMappingURL=browse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browse.d.ts","sourceRoot":"","sources":["../../src/lib/browse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,WAAW,SAAS;IACtB,oFAAoF;IACpF,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,yFAAyF;IACzF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,KAAK,CAAC,EAAE,cAAc,CAAA;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC1B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,SAAS,cAAc,EAAE,GACnC,SAAS,cAAc,EAAE,CAU3B;AAOD,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,O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AAE,GAAG,aAAa,CAWpF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opening a URL in whatever the operating system thinks a browser is.
|
|
3
|
+
*
|
|
4
|
+
* Nothing in this repo opened a browser before, and the temptation is a dependency — there are
|
|
5
|
+
* several, and every one of them is this file plus a matrix of platforms nobody here runs. What it
|
|
6
|
+
* actually takes is one command per platform and an honest answer when there is no browser at all,
|
|
7
|
+
* which is the case that matters most: **a container has none**, and the container is where this
|
|
8
|
+
* runtime is deployed. So "could not open" is a first-class outcome with the URL printed beside it,
|
|
9
|
+
* not an error.
|
|
10
|
+
*
|
|
11
|
+
* Three properties, each of which was a decision:
|
|
12
|
+
*
|
|
13
|
+
* **It never blocks.** `open`/`xdg-open` hand off to a browser and exit, but `xdg-open` on a box
|
|
14
|
+
* with no desktop can sit there — and a command that hangs while claiming to have opened a page is
|
|
15
|
+
* worse than one that prints a link. Every call is bounded.
|
|
16
|
+
*
|
|
17
|
+
* **It never fails the command.** The URL is the deliverable; the browser is a convenience. A
|
|
18
|
+
* non-zero exit from `open` means the operator gets a link to click instead, which is exactly what
|
|
19
|
+
* they would have got from `web url`.
|
|
20
|
+
*
|
|
21
|
+
* **It refuses without a TTY.** A piped or scripted run must not sprout a browser window on
|
|
22
|
+
* somebody's screen — and in CI it would open nothing and waste a timeout finding out.
|
|
23
|
+
*/
|
|
24
|
+
import { spawnCaptureAsync } from "#lib/spawn";
|
|
25
|
+
/** Why a URL was not opened. Absent means it was. */
|
|
26
|
+
export type OpenRefusal =
|
|
27
|
+
/** No terminal, so nothing asked for a window. */
|
|
28
|
+
"not-a-terminal"
|
|
29
|
+
/** `--no-open`. */
|
|
30
|
+
| "asked-not-to"
|
|
31
|
+
/** No opener on this platform — a container, a bare server, an unrecognised OS. */
|
|
32
|
+
| "no-opener"
|
|
33
|
+
/** There is an opener and it said no. */
|
|
34
|
+
| "opener-failed";
|
|
35
|
+
export interface OpenOutcome {
|
|
36
|
+
readonly opened: boolean;
|
|
37
|
+
readonly refusal?: OpenRefusal;
|
|
38
|
+
/** What the opener said, when it said something worth repeating. */
|
|
39
|
+
readonly detail?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function openInBrowser(url: string, options?: {
|
|
42
|
+
readonly platform?: string;
|
|
43
|
+
readonly isTty?: boolean;
|
|
44
|
+
readonly noOpen?: boolean;
|
|
45
|
+
readonly spawn?: typeof spawnCaptureAsync;
|
|
46
|
+
}): Promise<OpenOutcome>;
|
|
47
|
+
/**
|
|
48
|
+
* What to print. One sentence, and it always ends with the URL.
|
|
49
|
+
*
|
|
50
|
+
* The URL is the deliverable in every branch — including success, because a browser that opened
|
|
51
|
+
* behind another window looks like nothing happened, and because a terminal that prints the link is
|
|
52
|
+
* one somebody can copy out of over SSH.
|
|
53
|
+
*/
|
|
54
|
+
export declare function openMessage(url: string, outcome: OpenOutcome): string;
|
|
55
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/lib/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE9C,qDAAqD;AACrD,MAAM,MAAM,WAAW;AACnB,kDAAkD;AAChD,gBAAgB;AAClB,mBAAmB;GACjB,cAAc;AAChB,mFAAmF;GACjF,WAAW;AACb,yCAAyC;GACvC,eAAe,CAAA;AAErB,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAA;IAC9B,oEAAoE;IACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAC3B;AAoBD,wBAAsB,aAAa,CAC/B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;IACL,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,iBAAiB,CAAA;CACvC,GACP,OAAO,CAAC,WAAW,CAAC,CAyBtB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,CAcrE"}
|