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,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How tall each piece of the chat frame is, so the conversation gets exactly the rows that are left.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this has to be arithmetic and not flexbox
|
|
5
|
+
*
|
|
6
|
+
* On the alternate screen the layout has a hard ceiling: the terminal's height, with no scrollback to
|
|
7
|
+
* absorb an overshoot. One row too many and Ink's own output scrolls the buffer, which leaves the status
|
|
8
|
+
* line halfway up the display and the composer where the status line was — a corrupt frame rather than a
|
|
9
|
+
* cramped one. Yoga will not save us here, because the thing that overflows is *our* choice of how many
|
|
10
|
+
* transcript rows to hand it.
|
|
11
|
+
*
|
|
12
|
+
* So every piece of chrome reports its height, the sum is subtracted from the terminal, and the
|
|
13
|
+
* conversation gets the remainder. `bodyRows` spends one further row as a margin, in the direction that
|
|
14
|
+
* cannot be seen.
|
|
15
|
+
*
|
|
16
|
+
* ## The drift this invites, and how it is caught
|
|
17
|
+
*
|
|
18
|
+
* These functions restate each component's geometry, which means a component that grows a row without
|
|
19
|
+
* changing its function here would make the frame one row too tall. That is a real hazard and it is
|
|
20
|
+
* pinned by frame tests: each function is asserted against the line count of the actual render, so the
|
|
21
|
+
* two cannot disagree for longer than one test run. Deriving the number *from* a render is not available
|
|
22
|
+
* — the layout has to be decided before anything is drawn.
|
|
23
|
+
*
|
|
24
|
+
* Pure: editor state, palette matches and live text in, row counts out.
|
|
25
|
+
*/
|
|
26
|
+
import type { Palette } from "#lib/palette";
|
|
27
|
+
import type { EditorState, LiveTurn } from "#lib/types";
|
|
28
|
+
/**
|
|
29
|
+
* The composer, including its border and the newline hint it shows once a message has two lines.
|
|
30
|
+
*
|
|
31
|
+
* One form, both states. There used to be a `roomy` landing variant three rows taller, which existed
|
|
32
|
+
* because the composer sat directly under the banner with the slack below it — the padding was what kept
|
|
33
|
+
* its border off the text above. With the slack above it (decision 11.98, reversed) there is nothing to
|
|
34
|
+
* separate it from, and 11.90's own argument now applies to both states rather than one: every row the
|
|
35
|
+
* composer takes is a row of conversation, and this is the function that charges for them.
|
|
36
|
+
*/
|
|
37
|
+
export declare function promptRows(editor: EditorState, columns: number): number;
|
|
38
|
+
/** The slash-command list: its matches, its overflow notices, and the line naming its keys. */
|
|
39
|
+
export declare function paletteRows(palette: Palette | undefined, maxRows: number): number;
|
|
40
|
+
/** `^R`'s match list plus its query line. Zero when the search is closed. */
|
|
41
|
+
export declare function searchRows(editor: EditorState, maxRows: number): number;
|
|
42
|
+
export interface ChatFrame {
|
|
43
|
+
/**
|
|
44
|
+
* Rows the brand mark **may** use above the one-line header, or 0 once it has collapsed.
|
|
45
|
+
*
|
|
46
|
+
* An allowance, not a height, and the caller must charge the conversation for what the mark *actually*
|
|
47
|
+
* draws — `wordmark` degrades through its tiers and usually takes far less. Charging the allowance was
|
|
48
|
+
* the first version and it wasted eleven rows on a thirty-row terminal: the mark drew five, the
|
|
49
|
+
* transcript was billed sixteen, and the banner ended up scrolled to a mid-wrap fragment of a store path
|
|
50
|
+
* with a third of the screen blank.
|
|
51
|
+
*
|
|
52
|
+
* Floored so a landing screen always keeps enough transcript for the banner. That is where the boot notes
|
|
53
|
+
* and every load warning are written, and a picture hiding them is the trimmed-catalogue failure with
|
|
54
|
+
* better typography: true of what is on screen, false of what is the case.
|
|
55
|
+
*/
|
|
56
|
+
readonly brand: number;
|
|
57
|
+
/**
|
|
58
|
+
* Rows for the brand mark and the conversation together, before either is measured.
|
|
59
|
+
*
|
|
60
|
+
* Returned so the split happens once, in the caller that knows the mark's rendered height.
|
|
61
|
+
*/
|
|
62
|
+
readonly body: number;
|
|
63
|
+
/** Rows the conversation may draw if the mark takes none — its scroll counter already deducted. */
|
|
64
|
+
readonly transcript: number;
|
|
65
|
+
/** Rows a pane over the conversation may draw. It replaces the transcript rather than sharing. */
|
|
66
|
+
readonly pane: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The row budget for one frame.
|
|
70
|
+
*
|
|
71
|
+
* A pane and the transcript are alternatives, not neighbours. Rendered together the pane took a fixed
|
|
72
|
+
* sixteen rows and pushed the conversation off the top of a full screen — and on a surface with no
|
|
73
|
+
* scrollback, "off the top" means gone. Whichever is in front gets the body.
|
|
74
|
+
*/
|
|
75
|
+
export declare function chatFrame(inputs: {
|
|
76
|
+
readonly rows: number;
|
|
77
|
+
readonly columns: number;
|
|
78
|
+
readonly editor: EditorState;
|
|
79
|
+
readonly live: LiveTurn | undefined;
|
|
80
|
+
readonly showReasoning: boolean;
|
|
81
|
+
readonly palette: Palette | undefined;
|
|
82
|
+
readonly searchMaxRows: number;
|
|
83
|
+
readonly paletteMaxRows: number;
|
|
84
|
+
/** A confirmation question, which is one line above the composer. */
|
|
85
|
+
readonly confirming: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Nothing has been sent yet, so the brand mark is up.
|
|
88
|
+
*
|
|
89
|
+
* It used to mean a roomier composer as well, and no longer does: the composer is one form in both
|
|
90
|
+
* states now that the slack sits above it. What is left is the wordmark's allowance, which is the only
|
|
91
|
+
* thing on the frame that a landing screen still spends rows on.
|
|
92
|
+
*/
|
|
93
|
+
readonly landing: boolean;
|
|
94
|
+
/** The one-line hint under the composer, shown only while landing. */
|
|
95
|
+
readonly hint: boolean;
|
|
96
|
+
}): ChatFrame;
|
|
97
|
+
/**
|
|
98
|
+
* The conversation's rows once the brand mark has taken what it actually needs.
|
|
99
|
+
*
|
|
100
|
+
* Separate from `chatFrame` because it needs the mark's *rendered* height, which only the caller has — and
|
|
101
|
+
* one function rather than an inline subtraction at the call site, so there is no second idea of whether the
|
|
102
|
+
* gap row is included.
|
|
103
|
+
*/
|
|
104
|
+
/**
|
|
105
|
+
* Which buffer row a screen cell is on, or `undefined` if the cell is not in the transcript.
|
|
106
|
+
*
|
|
107
|
+
* The one place the frame's vertical arithmetic is read backwards, and it belongs here because this module
|
|
108
|
+
* is where that arithmetic already lives. A caller deriving it would restate the brand's height, the gap,
|
|
109
|
+
* the header and the scroll-hint row — four numbers that are only correct together.
|
|
110
|
+
*
|
|
111
|
+
* Above the transcript, in order: the wordmark and its gap (landing only), the one-line header, and the
|
|
112
|
+
* scroll-hint row `Transcript` always draws even when it is blank. Below it, everything is chrome. A cell
|
|
113
|
+
* outside the window returns `undefined` rather than clamping, because clamping would make a click on the
|
|
114
|
+
* status line select the last row of the conversation.
|
|
115
|
+
*/
|
|
116
|
+
export declare function transcriptHit(point: {
|
|
117
|
+
readonly column: number;
|
|
118
|
+
readonly row: number;
|
|
119
|
+
}, layout: {
|
|
120
|
+
readonly brandLines: number;
|
|
121
|
+
/** The window `Transcript` was handed: `from` inclusive, `to` exclusive. */
|
|
122
|
+
readonly from: number;
|
|
123
|
+
readonly to: number;
|
|
124
|
+
}): {
|
|
125
|
+
readonly row: number;
|
|
126
|
+
readonly column: number;
|
|
127
|
+
} | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Which offset in the message a screen cell is on, or `undefined` if the cell is not in the composer.
|
|
130
|
+
*
|
|
131
|
+
* The composer's position is computable because the frame is bottom-anchored (decision 11.120): the status
|
|
132
|
+
* line is the last row, the landing hint sits above it, and the composer occupies exactly `promptRows`
|
|
133
|
+
* above that. Counting down from the top would mean knowing the height of every optional block in between
|
|
134
|
+
* — the live pane, the palette, the history search, the confirm line — and being wrong about any one of
|
|
135
|
+
* them would put the caret on the wrong row.
|
|
136
|
+
*
|
|
137
|
+
* Horizontally: one border column, one of `paddingX`, then the two-column prompt gutter. `PROMPT_PADDING`
|
|
138
|
+
* is the pair of borders *and* the pair of paddings, so half of it is the left inset — which is why the
|
|
139
|
+
* text does not start at `PROMPT_PADDING`.
|
|
140
|
+
*
|
|
141
|
+
* The returned offset is a code-point index into `editor.value`, which is what the reducer's `cursor` and
|
|
142
|
+
* `anchor` are: a caller never has to know that rows were involved.
|
|
143
|
+
*/
|
|
144
|
+
export declare function composerHit(point: {
|
|
145
|
+
readonly column: number;
|
|
146
|
+
readonly row: number;
|
|
147
|
+
}, inputs: {
|
|
148
|
+
readonly editor: EditorState;
|
|
149
|
+
readonly columns: number;
|
|
150
|
+
/** The terminal's height, which is the frame's height. */
|
|
151
|
+
readonly rows: number;
|
|
152
|
+
/** Whether the one-line landing hint is drawn under the composer. */
|
|
153
|
+
readonly hint: boolean;
|
|
154
|
+
}): number | undefined;
|
|
155
|
+
export declare function transcriptRowsAfterBrand(frame: ChatFrame, brandLines: number): number;
|
|
156
|
+
//# sourceMappingURL=chat-frame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-frame.d.ts","sourceRoot":"","sources":["../../src/lib/chat-frame.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAUH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAG3C,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAgBvD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAwBvE;AAED,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAOjF;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAIvE;AAED,MAAM,WAAW,SAAS;IACtB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,mGAAmG;IACnG,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,kGAAkG;IAClG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAA;IAC/B,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,qEAAqE;IACrE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CACzB,GAAG,SAAS,CAqCZ;AAED;;;;;;GAMG;AACH;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CACzB,KAAK,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EACxD,MAAM,EAAE;IACJ,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CACtB,GACF;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAU/D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CACvB,KAAK,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EACxD,MAAM,EAAE;IACJ,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CACzB,GACF,MAAM,GAAG,SAAS,CA8BpB;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAGrF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Putting text on the system clipboard.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this has to exist at all
|
|
5
|
+
*
|
|
6
|
+
* `cmd+c` cannot reach a terminal application. The terminal's own Edit > Copy claims it first, and finds no
|
|
7
|
+
* native selection to copy because mouse tracking disabled the terminal's selection in order to deliver the
|
|
8
|
+
* drag events. The reference CLI says the same thing in its own words and draws the same conclusion: copy
|
|
9
|
+
* on mouse-up, so `cmd+v` then works and the chord nobody can intercept is the one that matters.
|
|
10
|
+
*
|
|
11
|
+
* ## Why not OSC 52
|
|
12
|
+
*
|
|
13
|
+
* There is an escape sequence for this — `OSC 52` asks the terminal to set the clipboard — and it is
|
|
14
|
+
* refused, truncated, or silently ignored by enough terminals that a copy would sometimes do nothing with
|
|
15
|
+
* no way to tell. A subprocess either runs or reports why. It is also the only form that works over ssh
|
|
16
|
+
* *without* the remote terminal cooperating, which is a real advantage OSC 52 has; the trade is taken
|
|
17
|
+
* knowingly, and a failure says which command was missing.
|
|
18
|
+
*/
|
|
19
|
+
export interface CopyResult {
|
|
20
|
+
readonly copied: boolean;
|
|
21
|
+
/** Which command did it, for a message that names what happened rather than asserting success. */
|
|
22
|
+
readonly using?: string;
|
|
23
|
+
readonly problem?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Copy `text` to the clipboard, or say why not.
|
|
27
|
+
*
|
|
28
|
+
* Never throws and never reports success it did not have: a copy that silently failed leaves somebody
|
|
29
|
+
* pasting the *previous* contents of their clipboard, which looks like the wrong text was selected.
|
|
30
|
+
*/
|
|
31
|
+
export declare function copyToClipboard(text: string): Promise<CopyResult>;
|
|
32
|
+
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/lib/clipboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAeH,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,kGAAkG;IAClG,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAuBvE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command table — data only, no rendering and no parsing.
|
|
3
|
+
*
|
|
4
|
+
* One source of truth for three consumers: `args.ts` parses against it, `help.ts` renders from it,
|
|
5
|
+
* and error messages look flags up in it to say which command *does* accept a flag. Before this
|
|
6
|
+
* existed the usage text was a hand-maintained string with no link to the parser, and it had
|
|
7
|
+
* already drifted — `agents` accepted flags it never documented.
|
|
8
|
+
*
|
|
9
|
+
* Nothing here contains the product name. Command names come from `BRAND.slug`, so a rename stays
|
|
10
|
+
* the one-commit operation hard rule 3 requires.
|
|
11
|
+
*/
|
|
12
|
+
import type { CommandSpec, FlagSpec } from "#lib/schema";
|
|
13
|
+
/** Accepted by every command, so the render mode is answered the same way everywhere. */
|
|
14
|
+
export declare const GLOBAL_FLAGS: readonly FlagSpec[];
|
|
15
|
+
export declare const COMMANDS: readonly CommandSpec[];
|
|
16
|
+
export declare function findCommand(name: string): CommandSpec | undefined;
|
|
17
|
+
/** Every flag a command accepts: its own plus the global ones. */
|
|
18
|
+
export declare function flagsFor(command: CommandSpec): readonly FlagSpec[];
|
|
19
|
+
/**
|
|
20
|
+
* Commands other than `exclude` that declare `flag`.
|
|
21
|
+
*
|
|
22
|
+
* Turns "unknown flag --json" — true but useless, since `--json` plainly exists — into a message
|
|
23
|
+
* that names where it does work.
|
|
24
|
+
*/
|
|
25
|
+
export declare function commandsAccepting(flag: string, exclude: string): readonly string[];
|
|
26
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/lib/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAW,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEjE,yFAAyF;AACzF,eAAO,MAAM,YAAY,EAAE,SAAS,QAAQ,EAgB3C,CAAA;AA6BD,eAAO,MAAM,QAAQ,EAAE,SAAS,WAAW,EAk+B1C,CAAA;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEjE;AAED,kEAAkE;AAClE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,QAAQ,EAAE,CAElE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAIlF"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The composer's visual rows and where the caret sits on them. Pure, so the layout is arithmetic.
|
|
3
|
+
*
|
|
4
|
+
* ## Why the input box needs its own wrapping at all
|
|
5
|
+
*
|
|
6
|
+
* It rendered each logical line with `wrap="truncate"` and no wrapping of its own, which is half of the
|
|
7
|
+
* rule `lib/wrap.ts` states and the half that does not work. Ink truncates to the width Yoga measured,
|
|
8
|
+
* and a `<Box>` with no explicit width takes its *content* width — so a long message made the box wider
|
|
9
|
+
* than the terminal, and what happened next was the terminal's decision rather than ours. Measured at 100
|
|
10
|
+
* columns: VS Code cut the line at the border and took the caret with it, so you could not see what you
|
|
11
|
+
* were typing; Warp wrapped the over-wide row and the tail landed on top of the right-hand border. One
|
|
12
|
+
* cause, two symptoms, and neither reproducible in the other terminal.
|
|
13
|
+
*
|
|
14
|
+
* So the composer wraps its own text, exactly as the transcript and the live pane do, and every row is
|
|
15
|
+
* drawn `wrap="truncate"` as a backstop rather than as the layout.
|
|
16
|
+
*
|
|
17
|
+
* ## One column is reserved, deliberately
|
|
18
|
+
*
|
|
19
|
+
* The caret is drawn as an inverse cell, so it needs a cell — including when it sits at the end of a line
|
|
20
|
+
* that exactly fills the row. Wrapping to `columns - 1` buys that cell once, for every row, with no
|
|
21
|
+
* special case; the alternative is an extra visual row that appears and disappears as you type past the
|
|
22
|
+
* edge, which moves the whole frame on a surface that has no room to move.
|
|
23
|
+
*
|
|
24
|
+
* ## One derivation, two callers
|
|
25
|
+
*
|
|
26
|
+
* `LineCursor` draws these rows and `chat-frame.promptRows` counts them. That is the pairing the repo has
|
|
27
|
+
* been bitten by before — a component that grows a row without the frame arithmetic knowing is a frame
|
|
28
|
+
* taller than the terminal, which on the alternate buffer is corruption rather than crowding. Here the
|
|
29
|
+
* count is `layout.rows.length` plus the notices, by construction.
|
|
30
|
+
*/
|
|
31
|
+
import type { EditorState } from "#lib/types";
|
|
32
|
+
export interface ComposerRow {
|
|
33
|
+
/** What is painted, hanging indent included. Never wider than the window. */
|
|
34
|
+
readonly text: string;
|
|
35
|
+
/** Where the caret sits in this row, or `undefined` when it is on another row. */
|
|
36
|
+
readonly caret: number | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Buffer-absolute code-point offsets of the source this row draws, `start` inclusive and `end` not.
|
|
39
|
+
*
|
|
40
|
+
* Absolute rather than line-relative, which is the only form a selection can use: `wrapRows` reports
|
|
41
|
+
* offsets into a single *line*, and a selection is a range over the whole buffer. Adding the line's own
|
|
42
|
+
* start here is the one place that translation belongs — a renderer recomputing it would need the
|
|
43
|
+
* split, the tab expansion and the wrap all over again to get the same number.
|
|
44
|
+
*/
|
|
45
|
+
readonly start: number;
|
|
46
|
+
readonly end: number;
|
|
47
|
+
/** Columns of `text` that are re-applied indent, which no selection may highlight. */
|
|
48
|
+
readonly lead: number;
|
|
49
|
+
}
|
|
50
|
+
/** A run of a row that is drawn the same way: selected or not, caret or not. */
|
|
51
|
+
export interface RowSegment {
|
|
52
|
+
readonly text: string;
|
|
53
|
+
readonly selected: boolean;
|
|
54
|
+
/** The single cell the caret inverts. Never wider than one code point. */
|
|
55
|
+
readonly caret: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface ComposerLayout {
|
|
58
|
+
/** Every visual row of the buffer, in order. At least one, even for an empty buffer. */
|
|
59
|
+
readonly rows: readonly ComposerRow[];
|
|
60
|
+
/** Index into `rows` holding the caret. */
|
|
61
|
+
readonly caretRow: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Every visual row of `editor`'s buffer at `columns`, and which one the caret is on.
|
|
65
|
+
*
|
|
66
|
+
* `columns` is the width available *inside* whatever draws it — a caller with a border and padding
|
|
67
|
+
* subtracts those first, because this cannot see them.
|
|
68
|
+
*/
|
|
69
|
+
export declare function composerLayout(editor: EditorState, columns: number): ComposerLayout;
|
|
70
|
+
/**
|
|
71
|
+
* One row, split into the runs a renderer can paint in one go.
|
|
72
|
+
*
|
|
73
|
+
* Built as runs rather than as three slices because the caret can sit anywhere — including inside the
|
|
74
|
+
* selection — and slicing for both produces overlapping ranges that have to be reconciled. Walking the row
|
|
75
|
+
* once and grouping adjacent code points by how they are drawn has no such case, and the caret staying
|
|
76
|
+
* exactly one cell wide is a property of the walk rather than something to remember.
|
|
77
|
+
*
|
|
78
|
+
* The indent is never selected. Those columns are chrome the wrap re-applied; highlighting them would
|
|
79
|
+
* suggest text is included that no offset in the buffer corresponds to.
|
|
80
|
+
*/
|
|
81
|
+
export declare function rowSegments(row: ComposerRow, selection: {
|
|
82
|
+
readonly start: number;
|
|
83
|
+
readonly end: number;
|
|
84
|
+
} | undefined): readonly RowSegment[];
|
|
85
|
+
//# sourceMappingURL=composer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composer.d.ts","sourceRoot":"","sources":["../../src/lib/composer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAM7C,MAAM,WAAW,WAAW;IACxB,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,sFAAsF;IACtF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACxB;AAED,gFAAgF;AAChF,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAC1B;AAED,MAAM,WAAW,cAAc;IAC3B,wFAAwF;IACxF,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAA;IACrC,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CA6CnF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACvB,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GACxE,SAAS,UAAU,EAAE,CAwBvB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three writes `config` performs, separated from how any surface prints them.
|
|
3
|
+
*
|
|
4
|
+
* The plain actions and the editor both go through here, which is the same argument the phase made one
|
|
5
|
+
* level down: `editManifest` is the only thing that writes `agent.yaml` because three writers meant the
|
|
6
|
+
* guarantee depended on which caller you were. Two *callers* of that writer would have the same problem
|
|
7
|
+
* one step up — the editor validating a handle differently from `config allow`, or writing a secret
|
|
8
|
+
* without tightening the file's mode.
|
|
9
|
+
*
|
|
10
|
+
* Each function does the effect and returns a sentence. Refusals throw `HarnessError`, so a caller that
|
|
11
|
+
* prints to a terminal and a caller that shows a line in a frame both get the same words.
|
|
12
|
+
*/
|
|
13
|
+
export interface Applied {
|
|
14
|
+
/** One line saying what happened, for whichever surface asked. */
|
|
15
|
+
readonly note: string;
|
|
16
|
+
/** The source editor could not place the path, so the document was re-serialised. */
|
|
17
|
+
readonly reflowed: boolean;
|
|
18
|
+
/** What was there before, so a caller can offer the undo. */
|
|
19
|
+
readonly before: unknown;
|
|
20
|
+
}
|
|
21
|
+
/** The `.env` beside a manifest. */
|
|
22
|
+
export declare function envPathOf(manifestPath: string): string;
|
|
23
|
+
export declare function applySet(manifestPath: string, path: string, raw: string): Promise<Applied>;
|
|
24
|
+
/**
|
|
25
|
+
* Add, remove or replace a channel's inbound allowlist.
|
|
26
|
+
*
|
|
27
|
+
* `handles` is the whole list, because the whole list is what gets written: the field lives inside a
|
|
28
|
+
* sequence entry and the source editor matches `key:` at an indent, so one entry's key is not
|
|
29
|
+
* addressable. Every handle is checked against the service that issues it first — an impossible one
|
|
30
|
+
* matches nobody, and the only symptom is a bot that is connected, healthy and silently refusing the
|
|
31
|
+
* person it was set up for.
|
|
32
|
+
*/
|
|
33
|
+
export declare function applyAllow(manifestPath: string, channelId: string, handles: readonly string[]): Promise<Applied>;
|
|
34
|
+
/**
|
|
35
|
+
* Put a value in the `.env` beside the manifest, at 0600.
|
|
36
|
+
*
|
|
37
|
+
* Written 0600 whichever way the file arrived: under a service manager this is the *only* path
|
|
38
|
+
* credentials take — launchd hands a job almost no environment and a plist carries none on purpose — so
|
|
39
|
+
* tightening it is right even when this command did not create it. `writeFileSync`'s mode applies only
|
|
40
|
+
* when it creates the file, which is why the check afterwards is not redundant.
|
|
41
|
+
*/
|
|
42
|
+
export declare function applySecret(manifestPath: string, name: string, value: string): Applied;
|
|
43
|
+
/**
|
|
44
|
+
* A handle, validated against the service that issues it.
|
|
45
|
+
*
|
|
46
|
+
* Telegram's rule is shared with `init` rather than restated, because a check only one surface performs
|
|
47
|
+
* is a check the two disagree about. An unknown channel type passes through: guessing at another
|
|
48
|
+
* service's identifier format would refuse handles that are perfectly valid.
|
|
49
|
+
*/
|
|
50
|
+
export declare function checkedHandle(raw: string, type: string): string;
|
|
51
|
+
//# sourceMappingURL=config-apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-apply.d.ts","sourceRoot":"","sources":["../../src/lib/config-apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,MAAM,WAAW,OAAO;IACpB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAC3B;AAED,oCAAoC;AACpC,wBAAgB,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAsB,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQhG;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC5B,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,SAAS,MAAM,EAAE,GAC3B,OAAO,CAAC,OAAO,CAAC,CA6ClB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CA6BtF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAqB/D"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The config editor as a pure reducer: what the rows are, where the cursor is, what is being typed.
|
|
3
|
+
*
|
|
4
|
+
* Same grain as `lib/wizard.ts` and `lib/select.ts` — the screen root owns one `useInput` and the
|
|
5
|
+
* arithmetic lives here, so navigating a list and rejecting a bad handle are assertable as data rather
|
|
6
|
+
* than by driving a terminal.
|
|
7
|
+
*
|
|
8
|
+
* ## Why a row is not just a setting
|
|
9
|
+
*
|
|
10
|
+
* The catalogue in core answers "what fields exist". An editor has to answer "what can I change from
|
|
11
|
+
* here", and three of those are not dotted paths:
|
|
12
|
+
*
|
|
13
|
+
* - **A secret.** `.env` is a protected path precisely so the agent cannot write it, which leaves the
|
|
14
|
+
* person as the only actor who can — and the editor is where they are. Masked as it is typed.
|
|
15
|
+
* - **`allowFrom`, once per channel.** It lives inside a list entry, so `channels[].allowFrom` is one
|
|
16
|
+
* catalogue row and *n* editable ones. Expanded here, keyed by the channel's declared id.
|
|
17
|
+
* - **A heading.** Unselectable, and the cursor must step over it in the direction it was moving —
|
|
18
|
+
* parking on one draws no cursor at all, which reads as a broken keyboard rather than a skipped row.
|
|
19
|
+
*
|
|
20
|
+
* ## Why every confirmed edit is written immediately
|
|
21
|
+
*
|
|
22
|
+
* There is no staged set and no unsaved state. Each confirmation goes through the same `editManifest`
|
|
23
|
+
* call `config set` makes, so every state the file is ever in is valid, a closed pane cannot discard
|
|
24
|
+
* work, and two edits that are individually fine cannot combine into an invalid document nobody
|
|
25
|
+
* reviewed. The cost is stated rather than hidden: there is no cancel-all, and undo is `config set`
|
|
26
|
+
* with the old value, which the row still shows until the write lands.
|
|
27
|
+
*/
|
|
28
|
+
import type { Setting } from "@dispach/core";
|
|
29
|
+
import type { EditorState } from "#lib/types";
|
|
30
|
+
/** One line of the editor. Only three kinds are selectable. */
|
|
31
|
+
export type EditorRow =
|
|
32
|
+
/** A dotted path, edited as the text that would appear in the file. */
|
|
33
|
+
{
|
|
34
|
+
readonly kind: "setting";
|
|
35
|
+
readonly setting: Setting;
|
|
36
|
+
readonly value: unknown;
|
|
37
|
+
}
|
|
38
|
+
/** One channel's inbound allowlist, edited as space-separated handles. */
|
|
39
|
+
| {
|
|
40
|
+
readonly kind: "allow";
|
|
41
|
+
readonly channelId: string;
|
|
42
|
+
readonly channelType: string;
|
|
43
|
+
readonly handles: readonly string[];
|
|
44
|
+
}
|
|
45
|
+
/** An env variable the manifest depends on. Never displays its value, only whether it is set. */
|
|
46
|
+
| {
|
|
47
|
+
readonly kind: "secret";
|
|
48
|
+
readonly name: string;
|
|
49
|
+
readonly why: string;
|
|
50
|
+
readonly present: boolean;
|
|
51
|
+
}
|
|
52
|
+
/** A group label. Never selectable. */
|
|
53
|
+
| {
|
|
54
|
+
readonly kind: "heading";
|
|
55
|
+
readonly label: string;
|
|
56
|
+
};
|
|
57
|
+
export interface ConfigEditorState {
|
|
58
|
+
readonly rows: readonly EditorRow[];
|
|
59
|
+
readonly cursor: number;
|
|
60
|
+
readonly mode: "browse" | "editing";
|
|
61
|
+
/** The buffer while editing. Empty and unused while browsing. */
|
|
62
|
+
readonly editor: EditorState;
|
|
63
|
+
/**
|
|
64
|
+
* The result of the last write, or why one was refused. Cleared as soon as anything is typed.
|
|
65
|
+
*
|
|
66
|
+
* `| undefined` rather than merely optional: under `exactOptionalPropertyTypes` an omitted key and an
|
|
67
|
+
* explicit `undefined` are different types, and this one is *cleared* far more often than it is left
|
|
68
|
+
* out — a spread that had to omit the key to reset it would be unreadable.
|
|
69
|
+
*/
|
|
70
|
+
readonly note?: string | undefined;
|
|
71
|
+
/** Set while a write is in flight, so the row cannot be confirmed twice. */
|
|
72
|
+
readonly busy: boolean;
|
|
73
|
+
}
|
|
74
|
+
export declare function isSelectable(row: EditorRow | undefined): boolean;
|
|
75
|
+
/** A stable identity for a row, for React keys and for tests. */
|
|
76
|
+
export declare function rowKey(row: EditorRow): string;
|
|
77
|
+
/** The path or name a row writes to, for a caller reporting what happened. */
|
|
78
|
+
export declare function rowTarget(row: EditorRow): string;
|
|
79
|
+
export declare function firstSelectable(rows: readonly EditorRow[]): number;
|
|
80
|
+
export declare function openEditor(rows: readonly EditorRow[]): ConfigEditorState;
|
|
81
|
+
/**
|
|
82
|
+
* Move the cursor, stepping over headings in the direction of travel.
|
|
83
|
+
*
|
|
84
|
+
* Walk that way, then reverse, then stay put — and read the direction off the *indices* rather than the
|
|
85
|
+
* kind of move, because `first` travels backwards to row 0 and must then search forwards. A cursor that
|
|
86
|
+
* runs out of list stays where it is; it never lands on a row where enter does nothing.
|
|
87
|
+
*/
|
|
88
|
+
export declare function moveCursor(state: ConfigEditorState, to: number): ConfigEditorState;
|
|
89
|
+
/** The row the cursor is on, or `undefined` for an empty list. */
|
|
90
|
+
export declare function current(state: ConfigEditorState): EditorRow | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* What a row's value looks like in the buffer when editing starts.
|
|
93
|
+
*
|
|
94
|
+
* A secret starts **empty**, never seeded with what is there: the point of the masked field is that the
|
|
95
|
+
* value is not on screen, and pre-filling it would put it in the frame in every sense that matters.
|
|
96
|
+
*/
|
|
97
|
+
export declare function seedFor(row: EditorRow): string;
|
|
98
|
+
export declare function beginEdit(state: ConfigEditorState): ConfigEditorState;
|
|
99
|
+
export declare function cancelEdit(state: ConfigEditorState): ConfigEditorState;
|
|
100
|
+
/** Replace the buffer, which is what the host does after applying a keystroke to it. */
|
|
101
|
+
export declare function typing(state: ConfigEditorState, editor: EditorState): ConfigEditorState;
|
|
102
|
+
export declare function beginWrite(state: ConfigEditorState): ConfigEditorState;
|
|
103
|
+
/**
|
|
104
|
+
* A write finished. `rows` is re-read from the file rather than patched in place.
|
|
105
|
+
*
|
|
106
|
+
* Patching would drift: `editManifest` validates and may normalise, an `allowFrom` write rewrites the
|
|
107
|
+
* whole `channels` list, and a secret changes a row's `present` without touching the manifest at all.
|
|
108
|
+
* Re-reading is one source of truth and costs a file read nobody notices.
|
|
109
|
+
*/
|
|
110
|
+
export declare function settle(state: ConfigEditorState, rows: readonly EditorRow[], note: string): ConfigEditorState;
|
|
111
|
+
/** A write was refused. The buffer stays, so the value can be corrected rather than retyped. */
|
|
112
|
+
export declare function refuse(state: ConfigEditorState, note: string): ConfigEditorState;
|
|
113
|
+
//# sourceMappingURL=config-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-editor.d.ts","sourceRoot":"","sources":["../../src/lib/config-editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,+DAA+D;AAC/D,MAAM,MAAM,SAAS;AACjB,uEAAuE;AACrE;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE;AAClF,0EAA0E;GACxE;IACI,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACtC;AACH,iGAAiG;GAC/F;IACI,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC5B;AACH,uCAAuC;GACrC;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1D,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,CAAA;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAA;IACnC,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CACzB;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAEhE;AAED,iEAAiE;AACjE,wBAAgB,MAAM,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAW7C;AAED,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAWhD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,CAGlE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,GAAG,iBAAiB,CAQxE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,GAAG,iBAAiB,CAelF;AAED,kEAAkE;AAClE,wBAAgB,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAEvE;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAc9C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAG,iBAAiB,CAUrE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,iBAAiB,CAGtE;AAED,wFAAwF;AACxF,wBAAgB,MAAM,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,WAAW,GAAG,iBAAiB,CAGvF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,iBAAiB,CAEtE;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAClB,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,SAAS,SAAS,EAAE,EAC1B,IAAI,EAAE,MAAM,GACb,iBAAiB,CAUnB;AAED,gGAAgG;AAChG,wBAAgB,MAAM,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAEhF"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a variable an agent depends on is actually set, from that agent's point of view.
|
|
3
|
+
*
|
|
4
|
+
* `ambientEnv` is **not** this. It layers the *cwd*'s `.env` against an agent's — demoting a colliding
|
|
5
|
+
* variable so a project checkout cannot silently change which model a sandbox agent runs on — and it
|
|
6
|
+
* returns `process.env` unchanged whenever nothing is in tension. It never *adds* the agent's own file.
|
|
7
|
+
*
|
|
8
|
+
* The agent's `.env` is merged by `loadManifest`, through core's `layeredEnv`, and that is the answer a
|
|
9
|
+
* question about this agent needs. Reading `process.env` alone reported a variable as unset while the
|
|
10
|
+
* file beside the manifest plainly had it — the same class of mistake `serve` made once, reporting
|
|
11
|
+
* "unauthenticated" for a token sitting next to the manifest. It showed up here as an editor row that
|
|
12
|
+
* still read `(not set)` immediately after somebody set it, which is the "did that work?" failure this
|
|
13
|
+
* whole surface exists to remove.
|
|
14
|
+
*
|
|
15
|
+
* Precedence is core's, unchanged: the real environment wins, because an operator's export has to beat
|
|
16
|
+
* a file for a container to be able to configure the agent it runs.
|
|
17
|
+
*/
|
|
18
|
+
import { type EnvSource } from "@dispach/core";
|
|
19
|
+
import { type AmbientOptions } from "#lib/ambient";
|
|
20
|
+
/** The environment this agent will actually see: its own `.env` under the ambient one. */
|
|
21
|
+
export declare function agentEnv(manifestPath: string): EnvSource;
|
|
22
|
+
/** Whether `name` has a non-empty value. Empty counts as unset: it fails a load exactly as absent does. */
|
|
23
|
+
export declare function isSet(env: EnvSource, name: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Where a value came from, which is a different question from whether it is set.
|
|
26
|
+
*
|
|
27
|
+
* Three layers can supply one variable and the winner is not obvious from any of them:
|
|
28
|
+
*
|
|
29
|
+
* 1. the real environment — an operator's export, or a container's `environment:` block
|
|
30
|
+
* 2. the `.env` beside the agent's manifest
|
|
31
|
+
* 3. a `.env` in the directory the command was run from, demoted beneath (2) by `ambientEnv`
|
|
32
|
+
*
|
|
33
|
+
* Every one of those is correct on its own, and the composition is unreadable. It produced a real
|
|
34
|
+
* confusion in a container: `docker compose` passes `MODEL_ID` and friends as process environment,
|
|
35
|
+
* so an agent scaffolded inside that container silently ran on the *mounted*
|
|
36
|
+
* agent's model, and the `0600` `.env` that `init` had just written was ignored for exactly those
|
|
37
|
+
* keys — with nothing anywhere saying so.
|
|
38
|
+
*
|
|
39
|
+
* The precedence is not the bug and is not changed here. What was missing is a sentence, and the
|
|
40
|
+
* recorded lesson from the last time this surfaced is that *a warning explained the surprise and
|
|
41
|
+
* did not remove it* — so this reports rather than intervenes.
|
|
42
|
+
*/
|
|
43
|
+
export type EnvOrigin =
|
|
44
|
+
/** The real environment won: an export, or a container's own configuration. */
|
|
45
|
+
{
|
|
46
|
+
readonly kind: "export";
|
|
47
|
+
}
|
|
48
|
+
/** The `.env` beside the manifest won. */
|
|
49
|
+
| {
|
|
50
|
+
readonly kind: "agent";
|
|
51
|
+
readonly path: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Either an export or the cwd's `.env`, and **they cannot be told apart**.
|
|
55
|
+
*
|
|
56
|
+
* Bun auto-loads a `.env` from the current directory into `process.env` before any of this code
|
|
57
|
+
* runs, so once the two agree on a string there is no evidence left distinguishing them. Said
|
|
58
|
+
* rather than guessed: naming one would be a coin toss printed as a fact.
|
|
59
|
+
*/
|
|
60
|
+
| {
|
|
61
|
+
readonly kind: "ambiguous";
|
|
62
|
+
readonly path: string;
|
|
63
|
+
} | {
|
|
64
|
+
readonly kind: "unset";
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Which layer supplies `name` for this agent.
|
|
68
|
+
*
|
|
69
|
+
* Mirrors `ambientEnv`'s precedence by *calling* it rather than by restating it — the demotion rule
|
|
70
|
+
* is subtle (a cwd variable is demoted only when the agent's own file also sets it *and* the values
|
|
71
|
+
* match), and a second implementation of that would drift on the first edit.
|
|
72
|
+
*/
|
|
73
|
+
export declare function sourceOf(manifestPath: string, name: string, options?: AmbientOptions): EnvOrigin;
|
|
74
|
+
/**
|
|
75
|
+
* The phrase for a status line — short, because it rides after a value somebody is already reading.
|
|
76
|
+
*
|
|
77
|
+
* Returns `undefined` for the ordinary case, which is the whole point: a line that always carries a
|
|
78
|
+
* provenance note is a line nobody reads it on. The agent's own `.env` winning is what an author
|
|
79
|
+
* expects, so only the surprising sources say anything.
|
|
80
|
+
*/
|
|
81
|
+
export declare function describeOrigin(origin: EnvOrigin): string | undefined;
|
|
82
|
+
/** One env-backed field, the variable behind it, and where the value came from. */
|
|
83
|
+
export interface Provenance {
|
|
84
|
+
readonly field: string;
|
|
85
|
+
readonly variable: string;
|
|
86
|
+
readonly origin: EnvOrigin;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The env-backed fields worth saying something about, and only when there is something to say.
|
|
90
|
+
*
|
|
91
|
+
* Two fields, chosen because they are the two that produced a real confusion in a container:
|
|
92
|
+
* `docker compose` passes `MODEL_ID` and `MODEL_API_KEY` as process environment, and the ambient
|
|
93
|
+
* environment deliberately beats the agent's own file so an operator can configure the agent their
|
|
94
|
+
* container runs. So an agent scaffolded in that container ran on the *mounted*
|
|
95
|
+
* agent's model and ignored the `0600` `.env` init had just written.
|
|
96
|
+
*
|
|
97
|
+
* The model id is included **only when the manifest writes it as a variable**. A generated manifest
|
|
98
|
+
* carries it literally (which is why `readManifestHeader` can list agents without credentials), and
|
|
99
|
+
* a literal has no provenance to report — printing "from the environment" about a value nothing read
|
|
100
|
+
* from the environment would be worse than silence. `apiKeyEnv` is always a variable name by hard
|
|
101
|
+
* rule 10, so it is always askable.
|
|
102
|
+
*/
|
|
103
|
+
export declare function envProvenance(input: {
|
|
104
|
+
readonly manifestPath: string;
|
|
105
|
+
/** The raw, unexpanded `model.main.id` — `readManifestHeader().modelId`. */
|
|
106
|
+
readonly rawModelId: string | undefined;
|
|
107
|
+
readonly apiKeyEnv: string | undefined;
|
|
108
|
+
readonly options?: AmbientOptions;
|
|
109
|
+
}): readonly Provenance[];
|
|
110
|
+
//# sourceMappingURL=config-env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-env.d.ts","sourceRoot":"","sources":["../../src/lib/config-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAE,KAAK,SAAS,EAA2B,MAAM,eAAe,CAAA;AACvE,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,cAAc,CAAA;AAE1E,0FAA0F;AAC1F,wBAAgB,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAaxD;AAED,2GAA2G;AAC3G,wBAAgB,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG3D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,SAAS;AACjB,+EAA+E;AAC7E;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE;AAC7B,0CAA0C;GACxC;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACnD;;;;;;GAMG;GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAA;AAEhC;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACpB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,cAAmB,GAC7B,SAAS,CA4BX;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAWpE;AAED,mFAAmF;AACnF,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;CAC7B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CACpC,GAAG,SAAS,UAAU,EAAE,CAkBxB"}
|