indusagi-coding-agent 0.2.3 → 0.2.5
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/CHANGELOG.md +25 -0
- package/LICENSE +661 -0
- package/README.md +95 -1
- package/dist/entry.js +3205 -1585
- package/dist/guardrails.js +47 -515
- package/dist/index.js +3232 -1671
- package/package.json +8 -7
- package/dist/types/addons/addons.test.d.ts +0 -21
- package/dist/types/addons/contract.d.ts +0 -640
- package/dist/types/addons/dispatch/event-dispatcher.d.ts +0 -140
- package/dist/types/addons/dispatch/index.d.ts +0 -23
- package/dist/types/addons/dispatch/tool-interceptor.d.ts +0 -128
- package/dist/types/addons/host.d.ts +0 -246
- package/dist/types/addons/index.d.ts +0 -51
- package/dist/types/addons/manifest.d.ts +0 -56
- package/dist/types/addons/sandbox.d.ts +0 -103
- package/dist/types/addons/surface.d.ts +0 -42
- package/dist/types/boot/auth-vault.d.ts +0 -29
- package/dist/types/boot/boot.d.ts +0 -26
- package/dist/types/boot/boot.test.d.ts +0 -15
- package/dist/types/boot/contract.d.ts +0 -236
- package/dist/types/boot/index.d.ts +0 -20
- package/dist/types/boot/invocation.d.ts +0 -40
- package/dist/types/boot/invocation.test.d.ts +0 -8
- package/dist/types/boot/runners/addon-wiring.d.ts +0 -103
- package/dist/types/boot/runners/addon-wiring.test.d.ts +0 -19
- package/dist/types/boot/runners/checkpoint.d.ts +0 -133
- package/dist/types/boot/runners/checkpoint.test.d.ts +0 -12
- package/dist/types/boot/runners/delegate-runner.d.ts +0 -89
- package/dist/types/boot/runners/delegate-runner.test.d.ts +0 -13
- package/dist/types/boot/runners/index.d.ts +0 -13
- package/dist/types/boot/runners/link-runner.d.ts +0 -20
- package/dist/types/boot/runners/memdir.d.ts +0 -103
- package/dist/types/boot/runners/memdir.test.d.ts +0 -12
- package/dist/types/boot/runners/oneshot-runner.d.ts +0 -19
- package/dist/types/boot/runners/read-state.d.ts +0 -82
- package/dist/types/boot/runners/read-state.test.d.ts +0 -10
- package/dist/types/boot/runners/registry.d.ts +0 -30
- package/dist/types/boot/runners/repl-runner.d.ts +0 -19
- package/dist/types/boot/runners/session-persist.test.d.ts +0 -10
- package/dist/types/boot/runners/session.d.ts +0 -65
- package/dist/types/boot/runners/session.test.d.ts +0 -10
- package/dist/types/boot/stages.d.ts +0 -92
- package/dist/types/boot/upgrade/apply.d.ts +0 -45
- package/dist/types/boot/upgrade/index.d.ts +0 -13
- package/dist/types/boot/upgrade/upgrades.d.ts +0 -126
- package/dist/types/briefing/briefing.test.d.ts +0 -15
- package/dist/types/briefing/compose.d.ts +0 -37
- package/dist/types/briefing/context-docs.d.ts +0 -38
- package/dist/types/briefing/context-docs.test.d.ts +0 -18
- package/dist/types/briefing/contract.d.ts +0 -686
- package/dist/types/briefing/index.d.ts +0 -29
- package/dist/types/briefing/macros.d.ts +0 -206
- package/dist/types/briefing/skills.d.ts +0 -67
- package/dist/types/capability-deck/bridge-ledger/index.d.ts +0 -25
- package/dist/types/capability-deck/bridge-ledger/key.d.ts +0 -65
- package/dist/types/capability-deck/bridge-ledger/ledger.d.ts +0 -129
- package/dist/types/capability-deck/bridge-ledger/network.d.ts +0 -115
- package/dist/types/capability-deck/builtin-bridge.d.ts +0 -114
- package/dist/types/capability-deck/capability-deck.test.d.ts +0 -18
- package/dist/types/capability-deck/cards/bg-process-card.d.ts +0 -99
- package/dist/types/capability-deck/cards/index.d.ts +0 -37
- package/dist/types/capability-deck/cards/memory-card.d.ts +0 -68
- package/dist/types/capability-deck/cards/plan-file.d.ts +0 -56
- package/dist/types/capability-deck/cards/plan-tools.d.ts +0 -97
- package/dist/types/capability-deck/cards/plan-tools.test.d.ts +0 -9
- package/dist/types/capability-deck/cards/saas-card.d.ts +0 -78
- package/dist/types/capability-deck/cards/task-card.d.ts +0 -106
- package/dist/types/capability-deck/cards/todo-card.d.ts +0 -78
- package/dist/types/capability-deck/cards/workflow-card.d.ts +0 -55
- package/dist/types/capability-deck/cards/workflow-card.test.d.ts +0 -12
- package/dist/types/capability-deck/checkpoint.int.test.d.ts +0 -25
- package/dist/types/capability-deck/contract.d.ts +0 -317
- package/dist/types/capability-deck/index.d.ts +0 -46
- package/dist/types/capability-deck/manifest.d.ts +0 -60
- package/dist/types/capability-deck/provision.d.ts +0 -76
- package/dist/types/capability-deck/read-edit-gate.int.test.d.ts +0 -21
- package/dist/types/channels/channels.test.d.ts +0 -15
- package/dist/types/channels/contract.d.ts +0 -489
- package/dist/types/channels/framer.d.ts +0 -49
- package/dist/types/channels/index.d.ts +0 -24
- package/dist/types/channels/link/dialog.d.ts +0 -138
- package/dist/types/channels/link/driver.d.ts +0 -81
- package/dist/types/channels/link/index.d.ts +0 -13
- package/dist/types/channels/link/server.d.ts +0 -70
- package/dist/types/channels/oneshot.d.ts +0 -37
- package/dist/types/channels/ops.d.ts +0 -89
- package/dist/types/channels/session-ops.d.ts +0 -80
- package/dist/types/conductor/bash-guard.d.ts +0 -106
- package/dist/types/conductor/bash-guard.test.d.ts +0 -17
- package/dist/types/conductor/catalog/catalog.d.ts +0 -87
- package/dist/types/conductor/catalog/index.d.ts +0 -14
- package/dist/types/conductor/catalog/matcher.d.ts +0 -47
- package/dist/types/conductor/conductor.d.ts +0 -189
- package/dist/types/conductor/conductor.test.d.ts +0 -10
- package/dist/types/conductor/contract.d.ts +0 -774
- package/dist/types/conductor/diagnostics.d.ts +0 -183
- package/dist/types/conductor/diagnostics.test.d.ts +0 -10
- package/dist/types/conductor/index.d.ts +0 -26
- package/dist/types/conductor/permission-gate.integration.test.d.ts +0 -22
- package/dist/types/conductor/permission-wiring.test.d.ts +0 -14
- package/dist/types/conductor/permissions.d.ts +0 -217
- package/dist/types/conductor/permissions.test.d.ts +0 -12
- package/dist/types/conductor/plan-mode.integration.test.d.ts +0 -23
- package/dist/types/conductor/post-edit-diagnostics.test.d.ts +0 -13
- package/dist/types/conductor/signal-hub/hub.d.ts +0 -83
- package/dist/types/conductor/signal-hub/index.d.ts +0 -19
- package/dist/types/conductor/signal-hub/translate.d.ts +0 -77
- package/dist/types/conductor/skill-parse/index.d.ts +0 -10
- package/dist/types/conductor/skill-parse/parse.d.ts +0 -67
- package/dist/types/conductor/submit.test.d.ts +0 -28
- package/dist/types/conductor/transcript-store/index.d.ts +0 -16
- package/dist/types/conductor/transcript-store/serialize.d.ts +0 -106
- package/dist/types/conductor/transcript-store/serialize.test.d.ts +0 -10
- package/dist/types/conductor/transcript-store/store.d.ts +0 -188
- package/dist/types/console/components/AgentsView.d.ts +0 -41
- package/dist/types/console/components/BackgroundAgents.d.ts +0 -63
- package/dist/types/console/components/BackgroundAgents.test.d.ts +0 -8
- package/dist/types/console/components/Banner.d.ts +0 -110
- package/dist/types/console/components/Composer.d.ts +0 -37
- package/dist/types/console/components/StatusBar.d.ts +0 -42
- package/dist/types/console/components/TerminalConsole.d.ts +0 -32
- package/dist/types/console/components/WorkingIndicator.d.ts +0 -44
- package/dist/types/console/components/WorkingIndicator.test.d.ts +0 -9
- package/dist/types/console/components/banner-sweep.d.ts +0 -55
- package/dist/types/console/components/banner.test.d.ts +0 -9
- package/dist/types/console/components/welcome.d.ts +0 -115
- package/dist/types/console/components/welcome.test.d.ts +0 -9
- package/dist/types/console/console.test.d.ts +0 -19
- package/dist/types/console/contract.d.ts +0 -598
- package/dist/types/console/index.d.ts +0 -34
- package/dist/types/console/input/complete.d.ts +0 -120
- package/dist/types/console/input/dir-reader.d.ts +0 -28
- package/dist/types/console/input/index.d.ts +0 -24
- package/dist/types/console/input/input.test.d.ts +0 -14
- package/dist/types/console/input/keymap.d.ts +0 -193
- package/dist/types/console/input/paste.d.ts +0 -131
- package/dist/types/console/mount.d.ts +0 -53
- package/dist/types/console/overlays/approval-queue.d.ts +0 -71
- package/dist/types/console/overlays/approval.d.ts +0 -104
- package/dist/types/console/overlays/approval.test.d.ts +0 -17
- package/dist/types/console/overlays/auth.d.ts +0 -31
- package/dist/types/console/overlays/boards.d.ts +0 -55
- package/dist/types/console/overlays/host.d.ts +0 -45
- package/dist/types/console/overlays/index.d.ts +0 -15
- package/dist/types/console/overlays/pickers.d.ts +0 -37
- package/dist/types/console/overlays/sessions.d.ts +0 -29
- package/dist/types/console/reducer.d.ts +0 -51
- package/dist/types/console/slash/builtins.d.ts +0 -33
- package/dist/types/console/slash/commands/dynamic.d.ts +0 -57
- package/dist/types/console/slash/commands/dynamic.test.d.ts +0 -9
- package/dist/types/console/slash/commands/integrations.d.ts +0 -28
- package/dist/types/console/slash/commands/integrations.test.d.ts +0 -18
- package/dist/types/console/slash/commands/shared.d.ts +0 -72
- package/dist/types/console/slash/commands/transcript.d.ts +0 -24
- package/dist/types/console/slash/commands/transcript.test.d.ts +0 -10
- package/dist/types/console/slash/commands/workbench.d.ts +0 -21
- package/dist/types/console/slash/commands/workbench.test.d.ts +0 -10
- package/dist/types/console/slash/index.d.ts +0 -34
- package/dist/types/console/slash/registry.d.ts +0 -90
- package/dist/types/console/slash/resolve.d.ts +0 -109
- package/dist/types/console/slash/slash.test.d.ts +0 -18
- package/dist/types/console/startup.d.ts +0 -119
- package/dist/types/console/theme/adapter.d.ts +0 -79
- package/dist/types/console/theme/index.d.ts +0 -18
- package/dist/types/console/theme/palette.d.ts +0 -77
- package/dist/types/console/theme/resolve.d.ts +0 -45
- package/dist/types/console/theme/theme.test.d.ts +0 -16
- package/dist/types/console/theme/tokens.d.ts +0 -62
- package/dist/types/entry.d.ts +0 -17
- package/dist/types/guardrails.d.ts +0 -33
- package/dist/types/index.d.ts +0 -24
- package/dist/types/insight/channel.d.ts +0 -45
- package/dist/types/insight/contract.d.ts +0 -411
- package/dist/types/insight/index.d.ts +0 -26
- package/dist/types/insight/insight.test.d.ts +0 -17
- package/dist/types/insight/recorder.d.ts +0 -63
- package/dist/types/insight/redaction.d.ts +0 -44
- package/dist/types/insight/replay.d.ts +0 -77
- package/dist/types/insight/sampling.d.ts +0 -84
- package/dist/types/insight/serialize.d.ts +0 -54
- package/dist/types/insight/sinks/console.d.ts +0 -36
- package/dist/types/insight/sinks/file.d.ts +0 -37
- package/dist/types/insight/sinks/index.d.ts +0 -16
- package/dist/types/insight/sinks/stream.d.ts +0 -53
- package/dist/types/kit/clipboard-image.d.ts +0 -40
- package/dist/types/kit/external-editor.d.ts +0 -35
- package/dist/types/kit/image.d.ts +0 -102
- package/dist/types/kit/index.d.ts +0 -29
- package/dist/types/kit/kit.test.d.ts +0 -13
- package/dist/types/kit/shell.d.ts +0 -50
- package/dist/types/kit/tool-fetch.d.ts +0 -165
- package/dist/types/launch/catalog.d.ts +0 -51
- package/dist/types/launch/contract.d.ts +0 -387
- package/dist/types/launch/credentials.d.ts +0 -112
- package/dist/types/launch/index.d.ts +0 -28
- package/dist/types/launch/invocation/attachments.d.ts +0 -72
- package/dist/types/launch/invocation/flags.d.ts +0 -59
- package/dist/types/launch/invocation/index.d.ts +0 -23
- package/dist/types/launch/invocation/read.d.ts +0 -52
- package/dist/types/launch/invocation/usage.d.ts +0 -25
- package/dist/types/launch/launch.test.d.ts +0 -20
- package/dist/types/launch/oauth.d.ts +0 -101
- package/dist/types/launch/packages.d.ts +0 -75
- package/dist/types/launch/packages.test.d.ts +0 -15
- package/dist/types/launch/pickers.d.ts +0 -97
- package/dist/types/runtime-bridge/bridges/_drive.d.ts +0 -74
- package/dist/types/runtime-bridge/bridges/builtins.d.ts +0 -77
- package/dist/types/runtime-bridge/bridges/claude-cli.d.ts +0 -37
- package/dist/types/runtime-bridge/bridges/codex-cli.d.ts +0 -27
- package/dist/types/runtime-bridge/bridges/index.d.ts +0 -15
- package/dist/types/runtime-bridge/bridges/indusagi-cli.d.ts +0 -36
- package/dist/types/runtime-bridge/broker.d.ts +0 -182
- package/dist/types/runtime-bridge/contract.d.ts +0 -436
- package/dist/types/runtime-bridge/index.d.ts +0 -21
- package/dist/types/runtime-bridge/runtime-bridge.test.d.ts +0 -17
- package/dist/types/runtime-bridge/sink.d.ts +0 -59
- package/dist/types/sessions/contract.d.ts +0 -79
- package/dist/types/sessions/index.d.ts +0 -11
- package/dist/types/sessions/library.d.ts +0 -95
- package/dist/types/sessions/sessions.test.d.ts +0 -11
- package/dist/types/settings/contract.d.ts +0 -175
- package/dist/types/settings/index.d.ts +0 -13
- package/dist/types/settings/manager.d.ts +0 -109
- package/dist/types/settings/settings.test.d.ts +0 -16
- package/dist/types/transcript-export/index.d.ts +0 -20
- package/dist/types/transcript-export/publish.d.ts +0 -81
- package/dist/types/transcript-export/sgr.d.ts +0 -90
- package/dist/types/transcript-export/template.d.ts +0 -64
- package/dist/types/transcript-export/theme-bridge.d.ts +0 -99
- package/dist/types/transcript-export/transcript-export.test.d.ts +0 -16
- package/dist/types/window-budget/budget/estimate.d.ts +0 -47
- package/dist/types/window-budget/budget/gate.d.ts +0 -37
- package/dist/types/window-budget/budget/index.d.ts +0 -14
- package/dist/types/window-budget/budget/slice.d.ts +0 -38
- package/dist/types/window-budget/condenser.d.ts +0 -73
- package/dist/types/window-budget/contract.d.ts +0 -182
- package/dist/types/window-budget/index.d.ts +0 -17
- package/dist/types/window-budget/microcompact.d.ts +0 -68
- package/dist/types/window-budget/microcompact.test.d.ts +0 -16
- package/dist/types/window-budget/rehydrate.d.ts +0 -56
- package/dist/types/window-budget/summarize/condense.d.ts +0 -70
- package/dist/types/window-budget/summarize/index.d.ts +0 -12
- package/dist/types/window-budget/summarize/prompt.d.ts +0 -56
- package/dist/types/window-budget/window-budget.test.d.ts +0 -18
- package/dist/types/workflow-engine/agent-runner.d.ts +0 -105
- package/dist/types/workflow-engine/agent-runner.test.d.ts +0 -8
- package/dist/types/workflow-engine/display.d.ts +0 -148
- package/dist/types/workflow-engine/display.test.d.ts +0 -1
- package/dist/types/workflow-engine/engine.d.ts +0 -183
- package/dist/types/workflow-engine/engine.test.d.ts +0 -1
- package/dist/types/workflow-engine/index.d.ts +0 -21
- package/dist/types/workflow-engine/parse.d.ts +0 -64
- package/dist/types/workflow-engine/parse.test.d.ts +0 -1
- package/dist/types/workflow-engine/structured-output.d.ts +0 -51
- package/dist/types/workflow-engine/structured-output.test.d.ts +0 -1
- package/dist/types/workspace/brand.d.ts +0 -26
- package/dist/types/workspace/index.d.ts +0 -11
- package/dist/types/workspace/locator.d.ts +0 -50
- package/dist/types/workspace/runtime-detect.d.ts +0 -56
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Launch contract — the FROZEN type surface of Phase 10 (command-line surface).
|
|
3
|
-
*
|
|
4
|
-
* This module is the single typed seam between a raw `argv` and a fully
|
|
5
|
-
* configured run. It owns the *application* command line: the declarative flag
|
|
6
|
-
* table, the parsed {@link Invocation} those flags fold into, the gathered
|
|
7
|
-
* `@file` {@link Attachments}, and the typed {@link CredentialFault} the
|
|
8
|
-
* api-key sign-in surface raises. It declares *only* shapes plus a few inert,
|
|
9
|
-
* pure helpers — no parsing, no readline, no I/O, no React. The reader
|
|
10
|
-
* ({@link readInvocation}), the usage renderer ({@link renderUsage}), the
|
|
11
|
-
* attachment gatherer ({@link gatherAttachments}), the model-catalog printer
|
|
12
|
-
* ({@link printModelCatalog}), the resume picker ({@link pickResumeTarget}),
|
|
13
|
-
* the settings browser ({@link browseSettings}), and the credential command
|
|
14
|
-
* ({@link runCredentialCommand}) are each written against the names declared
|
|
15
|
-
* here, so the file is intentionally small, append-mostly, and stable.
|
|
16
|
-
*
|
|
17
|
-
* Design stance:
|
|
18
|
-
* - There is exactly **one declarative {@link FlagSpec} table** ({@link FLAGS}).
|
|
19
|
-
* The reader walks it to bind tokens; {@link renderUsage} generates the help
|
|
20
|
-
* text *from the same table*. Help and parsing cannot drift, because there
|
|
21
|
-
* is no second hand-maintained help string to drift against.
|
|
22
|
-
* - {@link Invocation} is a **superset of the boot-layer minimal invocation**:
|
|
23
|
-
* it keeps `mode` / `prompt` / `flags` / `positionals` and adds the resolved,
|
|
24
|
-
* strongly-typed launch fields the runtime reads (model, account, system
|
|
25
|
-
* prompt, thinking effort, the tool/extension/mcp rosters, the output
|
|
26
|
-
* toggles). Boot routes on the thin shape; the launch layer enriches it.
|
|
27
|
-
* - Sign-in is **api-key only**. {@link runCredentialCommand} validates and
|
|
28
|
-
* stores keys per named account through the framework credential vault and
|
|
29
|
-
* {@link getEnvApiKey}; there is no OAuth verb and no OAuth route. Failures
|
|
30
|
-
* are a single typed {@link CredentialFault} union, never string sentinels.
|
|
31
|
-
* - `@file` arguments expand to one {@link Attachments} value: inlined prose
|
|
32
|
-
* plus base64 media, with the framework path resolver doing the lookup.
|
|
33
|
-
*
|
|
34
|
-
* Framework anchors (all from the `indusagi` package — the sibling rebuilt
|
|
35
|
-
* framework this app targets):
|
|
36
|
-
* - `ThinkingLevel`, `SessionInfo`, `SessionListProgress`, `resolveReadPath`
|
|
37
|
-
* ← `indusagi/agent`
|
|
38
|
-
* - `ImageContent`, `KnownProvider`, `ModelRegistry`, `getEnvApiKey`
|
|
39
|
-
* ← `indusagi/ai`
|
|
40
|
-
* - `Settings` ← `indusagi/shell-app`
|
|
41
|
-
*
|
|
42
|
-
* The launch layer never re-declares these; it composes them. The credential
|
|
43
|
-
* vault (`AuthVault`) is an app-owned forward declaration here because the
|
|
44
|
-
* framework publishes no credential-store type; Phase 2 supplies the concrete
|
|
45
|
-
* multi-account vault.
|
|
46
|
-
*/
|
|
47
|
-
import type { SessionInfo as ResumeRef, SessionListProgress, ThinkingLevel } from "indusagi/agent";
|
|
48
|
-
import type { ImageContent, KnownProvider, ModelRegistry, OAuthCredentials } from "indusagi/ai";
|
|
49
|
-
import type { Settings } from "indusagi/shell-app";
|
|
50
|
-
import type { RunnerId } from "../boot/contract";
|
|
51
|
-
/**
|
|
52
|
-
* Re-exported framework / boot vocabulary that launch consumers routinely need.
|
|
53
|
-
*
|
|
54
|
-
* {@link ResumeRef} is the launch-local alias for the framework session
|
|
55
|
-
* descriptor surfaced by the resume picker.
|
|
56
|
-
*/
|
|
57
|
-
export type { ResumeRef, ThinkingLevel, SessionListProgress, ImageContent, KnownProvider, ModelRegistry, OAuthCredentials, Settings, RunnerId, };
|
|
58
|
-
/**
|
|
59
|
-
* The three terminal output modes the launch layer can resolve to. These map
|
|
60
|
-
* one-to-one onto the boot {@link RunnerId} the orchestrator dispatches on:
|
|
61
|
-
*
|
|
62
|
-
* - `text` — interactive terminal or a single human-readable answer.
|
|
63
|
-
* - `json` — a single non-interactive request whose result is structured.
|
|
64
|
-
* - `rpc` — the headless line protocol for a driving parent process.
|
|
65
|
-
*
|
|
66
|
-
* `text` is the interactive default; `json` is selected by `--print` together
|
|
67
|
-
* with a structured output toggle, and `rpc` by `--json` / `--rpc`.
|
|
68
|
-
*/
|
|
69
|
-
export type OutputMode = "text" | "json" | "rpc";
|
|
70
|
-
/**
|
|
71
|
-
* The ordered reasoning-effort vocabulary accepted by `--thinking`, re-derived
|
|
72
|
-
* here as a single source of truth for the parser and the usage generator.
|
|
73
|
-
*
|
|
74
|
-
* `off` disables extended reasoning entirely; the remaining rungs ascend in
|
|
75
|
-
* effort. The tuple is `readonly` and ordered so the usage text can enumerate it
|
|
76
|
-
* and so {@link isThinkingEffort} can validate against it without a second list.
|
|
77
|
-
* It is a superset-compatible widening of the framework {@link ThinkingLevel}
|
|
78
|
-
* (which omits `off`); callers that hand a level to the framework drop `off`.
|
|
79
|
-
*/
|
|
80
|
-
export declare const THINKING_EFFORTS: readonly ["off", "minimal", "low", "medium", "high", "xhigh"];
|
|
81
|
-
/** One reasoning-effort rung from {@link THINKING_EFFORTS}. */
|
|
82
|
-
export type ThinkingEffort = (typeof THINKING_EFFORTS)[number];
|
|
83
|
-
/**
|
|
84
|
-
* Narrow an arbitrary string to a {@link ThinkingEffort}.
|
|
85
|
-
*
|
|
86
|
-
* Pure membership test against {@link THINKING_EFFORTS}; the model resolver
|
|
87
|
-
* reuses it to parse the `model:effort` shorthand without importing the parser.
|
|
88
|
-
*/
|
|
89
|
-
export declare function isThinkingEffort(value: string): value is ThinkingEffort;
|
|
90
|
-
/** Narrow an arbitrary string to an {@link OutputMode}. */
|
|
91
|
-
export declare function isOutputMode(value: string): value is OutputMode;
|
|
92
|
-
/**
|
|
93
|
-
* The closed roster of built-in tool names the `--tools` / `--no-tools` flags
|
|
94
|
-
* select against. A literal tuple (rather than the live tool map) so the launch
|
|
95
|
-
* layer can validate a `--tools` list before any tool module is constructed.
|
|
96
|
-
*/
|
|
97
|
-
export declare const TOOL_NAMES: readonly ["read", "write", "edit", "bash", "grep", "find", "ls", "task", "todo_read", "todo_write", "web_fetch", "web_search", "composio"];
|
|
98
|
-
/** One built-in tool identifier from {@link TOOL_NAMES}. */
|
|
99
|
-
export type ToolName = (typeof TOOL_NAMES)[number];
|
|
100
|
-
/** Narrow an arbitrary string to a known {@link ToolName}. */
|
|
101
|
-
export declare function isToolName(value: string): value is ToolName;
|
|
102
|
-
/**
|
|
103
|
-
* The value vocabulary a flag binds to its target field.
|
|
104
|
-
*
|
|
105
|
-
* - `boolean` — a bare switch; presence sets it true (e.g. `--print`).
|
|
106
|
-
* - `string` — consumes the following token as text (e.g. `--model`).
|
|
107
|
-
* - `number` — consumes the following token and coerces to a finite number.
|
|
108
|
-
* - `list` — accumulates; either repeated or one comma-separated token
|
|
109
|
-
* (e.g. `--mcp a --mcp b`, or `--tools read,bash`).
|
|
110
|
-
*/
|
|
111
|
-
export type FlagKind = "boolean" | "string" | "number" | "list";
|
|
112
|
-
/**
|
|
113
|
-
* The default value attached to a {@link FlagSpec}, narrowed by {@link FlagKind}:
|
|
114
|
-
* a boolean default for switches, a string for value flags, a number for numeric
|
|
115
|
-
* flags, and a string array for lists.
|
|
116
|
-
*/
|
|
117
|
-
export type FlagDefault = boolean | string | number | readonly string[];
|
|
118
|
-
/**
|
|
119
|
-
* One row of the single declarative flag table.
|
|
120
|
-
*
|
|
121
|
-
* Every recognised option is described here exactly once. The reader indexes the
|
|
122
|
-
* table by {@link name} and {@link aliases} to bind tokens to
|
|
123
|
-
* {@link Invocation.flags}; the usage generator walks the same rows to render the
|
|
124
|
-
* option reference. There is no second source of truth for either side.
|
|
125
|
-
*/
|
|
126
|
-
export interface FlagSpec {
|
|
127
|
-
/**
|
|
128
|
-
* Canonical long spelling, leading dashes included (e.g. `"--model"`). This is
|
|
129
|
-
* also the key the parsed value lands under in {@link Invocation.flags}, sans
|
|
130
|
-
* the leading dashes.
|
|
131
|
-
*/
|
|
132
|
-
readonly name: string;
|
|
133
|
-
/**
|
|
134
|
-
* Accepted alternate spellings — short forms (`"-m"`) and synonyms
|
|
135
|
-
* (`"--rpc"` for `"--json"`). All alias hits normalise to {@link name}.
|
|
136
|
-
*/
|
|
137
|
-
readonly aliases?: readonly string[];
|
|
138
|
-
/** The value vocabulary this flag binds (see {@link FlagKind}). */
|
|
139
|
-
readonly kind: FlagKind;
|
|
140
|
-
/** One-line description rendered verbatim in the generated usage text. */
|
|
141
|
-
readonly describe: string;
|
|
142
|
-
/**
|
|
143
|
-
* Optional default folded into {@link Invocation.flags} when the flag is
|
|
144
|
-
* absent. Its runtime type must match {@link kind}.
|
|
145
|
-
*/
|
|
146
|
-
readonly default?: FlagDefault;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* The fully parsed command line — the launch layer's enrichment of the thin
|
|
150
|
-
* boot {@link RunnerId}-routing shape into the complete, strongly-typed surface
|
|
151
|
-
* the runtime reads.
|
|
152
|
-
*
|
|
153
|
-
* The first four members ({@link mode}, {@link prompt}, {@link flags},
|
|
154
|
-
* {@link positionals}) are the superset of the boot-layer minimal invocation
|
|
155
|
-
* (`positionals` is the renamed `rest`); everything below is the resolved launch
|
|
156
|
-
* configuration. {@link flags} retains the loosely-typed bag for extension flags
|
|
157
|
-
* and round-tripping, while the named fields below give consumers a precise,
|
|
158
|
-
* pre-coerced view of the options that matter to the runtime. Treat every field
|
|
159
|
-
* as read-only.
|
|
160
|
-
*/
|
|
161
|
-
export interface Invocation {
|
|
162
|
-
/** Resolved terminal output mode; selects the boot runner. */
|
|
163
|
-
readonly mode: OutputMode;
|
|
164
|
-
/** First user message assembled from positionals, stdin, and attachments. */
|
|
165
|
-
readonly prompt?: string;
|
|
166
|
-
/** All parsed switches, keyed by canonical flag name (extension-flag escape hatch). */
|
|
167
|
-
readonly flags: Record<string, FlagValue>;
|
|
168
|
-
/** Positional tokens not consumed as flags (the boot layer's `rest`, renamed). */
|
|
169
|
-
readonly positionals: string[];
|
|
170
|
-
/** `@file` arguments expanded to inline prose plus base64 media, if any. */
|
|
171
|
-
readonly attachments?: Attachments;
|
|
172
|
-
/** Explicit model selector (`--model` / `-m`), provider-qualified or bare. */
|
|
173
|
-
readonly model?: string;
|
|
174
|
-
/** Model to fall back to when the selected model is overloaded mid-turn (`--fallback-model`). */
|
|
175
|
-
readonly fallbackModel?: string;
|
|
176
|
-
/** Named credential account to authenticate the run with (`--account`). */
|
|
177
|
-
readonly account?: string;
|
|
178
|
-
/** Working directory the run is scoped to (`--cwd`); absent means process cwd. */
|
|
179
|
-
readonly cwd?: string;
|
|
180
|
-
/** Replacement system prompt (`--system`); absent keeps the built-in. */
|
|
181
|
-
readonly system?: string;
|
|
182
|
-
/** Extra text appended after the system prompt (`--append-system`). */
|
|
183
|
-
readonly appendSystem?: string;
|
|
184
|
-
/** Reasoning-effort rung requested via `--thinking`. */
|
|
185
|
-
readonly thinking?: ThinkingEffort;
|
|
186
|
-
/** Explicit tool allow-list (`--tools`); absent means every built-in tool. */
|
|
187
|
-
readonly tools?: ToolName[];
|
|
188
|
-
/** Disable all tools for this run (`--no-tools`). */
|
|
189
|
-
readonly noTools: boolean;
|
|
190
|
-
/** External MCP server endpoints to attach (`--mcp`, repeatable / comma-joined). */
|
|
191
|
-
readonly mcp: string[];
|
|
192
|
-
/** Run a single request and exit, printing only the result (`--print` / `-p`). */
|
|
193
|
-
readonly print: boolean;
|
|
194
|
-
/** Force the interactive REPL even alongside a prompt (`--interactive` / `-i`). */
|
|
195
|
-
readonly interactive: boolean;
|
|
196
|
-
/** Asking for the usage banner (`--help` / `-h`). */
|
|
197
|
-
readonly help: boolean;
|
|
198
|
-
/** Asking for the version string (`--version` / `-v`). */
|
|
199
|
-
readonly version: boolean;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* The runtime value a parsed flag can carry in {@link Invocation.flags}: a
|
|
203
|
-
* boolean switch, a scalar value, a numeric value, or an accumulated list.
|
|
204
|
-
*/
|
|
205
|
-
export type FlagValue = boolean | string | number | string[];
|
|
206
|
-
/**
|
|
207
|
-
* The result of expanding the `@file` arguments collected on the command line.
|
|
208
|
-
*
|
|
209
|
-
* Text files are inlined into {@link prose} (each wrapped in a delimited block
|
|
210
|
-
* keyed by its path); image files are decoded to framework {@link ImageContent}
|
|
211
|
-
* and collected in {@link media}. Both are concatenated onto the first user
|
|
212
|
-
* message. An invocation with no `@file` arguments has no {@link Attachments} at
|
|
213
|
-
* all rather than an empty one.
|
|
214
|
-
*/
|
|
215
|
-
export interface Attachments {
|
|
216
|
-
/** Concatenated text of every inlined file, each wrapped with its path. */
|
|
217
|
-
readonly prose: string;
|
|
218
|
-
/** Base64 image content decoded from every image `@file` argument. */
|
|
219
|
-
readonly media: ImageContent[];
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Options for {@link gatherAttachments}: the cwd the framework path resolver
|
|
223
|
-
* resolves `@file` references against, and an optional progress sink.
|
|
224
|
-
*/
|
|
225
|
-
export interface AttachmentOptions {
|
|
226
|
-
/** Working directory `@file` references are resolved relative to. */
|
|
227
|
-
readonly cwd: string;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* The two verbs the credential command recognises as the first positional
|
|
231
|
-
* token. Anything else means the command does not own this invocation and the
|
|
232
|
-
* caller proceeds to normal launch.
|
|
233
|
-
*
|
|
234
|
-
* - `signin` — validate and store an api key for a provider / account.
|
|
235
|
-
* - `signout` — remove a stored credential for a provider / account.
|
|
236
|
-
*/
|
|
237
|
-
export type CredentialVerb = "signin" | "signout";
|
|
238
|
-
/**
|
|
239
|
-
* A provider entry in the credential directory — the facts the sign-in prompts
|
|
240
|
-
* print and validate against. {@link envKey} is the conventional environment
|
|
241
|
-
* variable {@link getEnvApiKey} reads; {@link docsUrl} is where the user obtains
|
|
242
|
-
* a key. These are external provider conventions, not derived data.
|
|
243
|
-
*/
|
|
244
|
-
export interface ProviderEntry {
|
|
245
|
-
/** Stable provider id matching the framework {@link KnownProvider} vocabulary. */
|
|
246
|
-
readonly id: KnownProvider | string;
|
|
247
|
-
/** Human-facing provider label for menus and prompts. */
|
|
248
|
-
readonly label: string;
|
|
249
|
-
/** Conventional api-key environment variable for this provider. */
|
|
250
|
-
readonly envKey: string;
|
|
251
|
-
/** Page where a user obtains an api key for this provider. */
|
|
252
|
-
readonly docsUrl: string;
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* The closed set of failure categories the credential command can raise.
|
|
256
|
-
* A consumer switches on {@link CredentialFault.kind}, never on message text:
|
|
257
|
-
*
|
|
258
|
-
* - `unknown-provider` — the named provider is not in the directory.
|
|
259
|
-
* - `invalid-key` — the supplied key failed format validation.
|
|
260
|
-
* - `invalid-account` — the account name failed the naming rules.
|
|
261
|
-
* - `name-collision` — the account name already exists for that provider.
|
|
262
|
-
* - `not-found` — sign-out targeted a credential that is not stored.
|
|
263
|
-
* - `vault` — the underlying credential store read/write failed.
|
|
264
|
-
* - `aborted` — the user cancelled an interactive prompt.
|
|
265
|
-
*/
|
|
266
|
-
export type CredentialFaultKind = "unknown-provider" | "invalid-key" | "invalid-account" | "name-collision" | "not-found" | "vault" | "aborted";
|
|
267
|
-
/**
|
|
268
|
-
* A typed credential failure. {@link kind} drives recovery; {@link hint} carries
|
|
269
|
-
* a single actionable next step for the human (e.g. the env-var to set), and
|
|
270
|
-
* {@link cause} preserves any wrapped error for diagnostics.
|
|
271
|
-
*/
|
|
272
|
-
export interface CredentialFault {
|
|
273
|
-
/** The failure category (the discriminant). */
|
|
274
|
-
readonly kind: CredentialFaultKind;
|
|
275
|
-
/** Human-readable summary of what failed. */
|
|
276
|
-
readonly message: string;
|
|
277
|
-
/** Optional single actionable suggestion for resolving the fault. */
|
|
278
|
-
readonly hint?: string;
|
|
279
|
-
/** Optional wrapped underlying error. */
|
|
280
|
-
readonly cause?: unknown;
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Construct a {@link CredentialFault}. A tiny inert helper so call sites raise a
|
|
284
|
-
* well-formed typed fault without re-spelling the shape.
|
|
285
|
-
*/
|
|
286
|
-
export declare function credentialFault(kind: CredentialFaultKind, message: string, extra?: {
|
|
287
|
-
hint?: string;
|
|
288
|
-
cause?: unknown;
|
|
289
|
-
}): CredentialFault;
|
|
290
|
-
/**
|
|
291
|
-
* The credential-vault surface the credential command depends on.
|
|
292
|
-
*
|
|
293
|
-
* The framework publishes no credential-store type, so the launch contract
|
|
294
|
-
* forward-declares the slice it needs: per-provider, per-account records keyed by
|
|
295
|
-
* an account name. A record stores *either* an api key or a set of
|
|
296
|
-
* browser-sign-in credentials; the vault refreshes an expired browser token
|
|
297
|
-
* before yielding a usable key. Phase 2 supplies the concrete multi-account
|
|
298
|
-
* vault; this interface lets the credential command compile and be unit-tested
|
|
299
|
-
* against an in-memory stand-in before then.
|
|
300
|
-
*/
|
|
301
|
-
export interface AuthVault {
|
|
302
|
-
/** Stored account names for a provider, in insertion order. */
|
|
303
|
-
listAccounts(provider: string): Promise<string[]>;
|
|
304
|
-
/** The default account name for a provider, if one is set. */
|
|
305
|
-
defaultAccount(provider: string): Promise<string | undefined>;
|
|
306
|
-
/** Persist an api key under a provider / account, optionally as the default. */
|
|
307
|
-
putApiKey(provider: string, account: string, apiKey: string, makeDefault?: boolean): Promise<void>;
|
|
308
|
-
/**
|
|
309
|
-
* Persist browser-sign-in credentials under a provider / account, optionally
|
|
310
|
-
* as the default.
|
|
311
|
-
*/
|
|
312
|
-
putOAuth(provider: string, account: string, credentials: OAuthCredentials, makeDefault?: boolean): Promise<void>;
|
|
313
|
-
/**
|
|
314
|
-
* Report whether a stored account holds an api key or browser-sign-in
|
|
315
|
-
* credentials, or `undefined` when nothing is stored there.
|
|
316
|
-
*/
|
|
317
|
-
authKind(provider: string, account: string): Promise<"apiKey" | "oauth" | undefined>;
|
|
318
|
-
/**
|
|
319
|
-
* Resolve a stored account to a live api-key string. An api-key record yields
|
|
320
|
-
* its key verbatim; a browser-sign-in record is refreshed through the
|
|
321
|
-
* framework (persisting any rotated token) before its usable key is returned.
|
|
322
|
-
* Resolves `undefined` when nothing usable is stored.
|
|
323
|
-
*/
|
|
324
|
-
readUsableKey(provider: string, account: string): Promise<string | undefined>;
|
|
325
|
-
/** Remove a stored credential; resolves false when nothing was removed. */
|
|
326
|
-
remove(provider: string, account?: string): Promise<boolean>;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Options for {@link runCredentialCommand}: the resolved vault and the directory
|
|
330
|
-
* the vault persists to. Injected so tests drive the command over an in-memory
|
|
331
|
-
* vault with no real disk writes.
|
|
332
|
-
*/
|
|
333
|
-
export interface CredentialCommandOptions {
|
|
334
|
-
/** The credential store to read and write. */
|
|
335
|
-
readonly vault: AuthVault;
|
|
336
|
-
/** Absolute directory the vault persists credentials under. */
|
|
337
|
-
readonly profileDir: string;
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* The filter applied when rendering the `--list-models` table. Every field is
|
|
341
|
-
* optional; an absent field matches everything. {@link search} is a plain
|
|
342
|
-
* case-insensitive substring test over the provider/model identifier — no fuzzy
|
|
343
|
-
* matcher and no external ranking.
|
|
344
|
-
*/
|
|
345
|
-
export interface CatalogFilter {
|
|
346
|
-
/** Restrict to a single provider id. */
|
|
347
|
-
readonly provider?: KnownProvider | string;
|
|
348
|
-
/** Keep only models that advertise a reasoning budget. */
|
|
349
|
-
readonly thinkingOnly?: boolean;
|
|
350
|
-
/** Keep only models that accept image input. */
|
|
351
|
-
readonly imagesOnly?: boolean;
|
|
352
|
-
/** Case-insensitive substring filter over the model identifier. */
|
|
353
|
-
readonly search?: string;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* A function that loads a set of resumable sessions, reporting incremental
|
|
357
|
-
* progress. The resume picker takes two: one for the current working
|
|
358
|
-
* directory and one for every directory, both shaped like the framework
|
|
359
|
-
* session lister.
|
|
360
|
-
*/
|
|
361
|
-
export type SessionLoader = (onProgress?: SessionListProgress) => Promise<ResumeRef[]>;
|
|
362
|
-
/**
|
|
363
|
-
* A launch-time error from the resume flow (the React-Ink picker failing to
|
|
364
|
-
* mount, or a session store read fault). Typed so the orchestrator can fall back
|
|
365
|
-
* to a fresh session rather than crash.
|
|
366
|
-
*/
|
|
367
|
-
export interface ResumeFault {
|
|
368
|
-
/** Human-readable summary of what failed. */
|
|
369
|
-
readonly message: string;
|
|
370
|
-
/** Optional wrapped underlying error. */
|
|
371
|
-
readonly cause?: unknown;
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Options for {@link browseSettings}: the resolved settings, the directories of
|
|
375
|
-
* user-authored resources to enumerate, the active cwd, and the profile
|
|
376
|
-
* directory. The browser renders a plain console listing of these — no TUI.
|
|
377
|
-
*/
|
|
378
|
-
export interface SettingsBrowseOptions {
|
|
379
|
-
/** The merged, resolved user settings. */
|
|
380
|
-
readonly settings: Settings;
|
|
381
|
-
/** Resolved absolute paths of discovered resources, grouped by category. */
|
|
382
|
-
readonly resolvedPaths: Readonly<Record<string, readonly string[]>>;
|
|
383
|
-
/** The active working directory. */
|
|
384
|
-
readonly cwd: string;
|
|
385
|
-
/** The profile directory the settings were loaded from. */
|
|
386
|
-
readonly profileDir: string;
|
|
387
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Credential command — `runCredentialCommand`.
|
|
3
|
-
*
|
|
4
|
-
* The top-level `signin` / `signout` surface. Sign-in supports two methods: a
|
|
5
|
-
* browser sign-in (OAuth) for the providers the framework registry exposes, and
|
|
6
|
-
* an api-key flow for every provider in the directory. When a provider is
|
|
7
|
-
* sign-in-capable the command prefers the browser flow but still lets the user
|
|
8
|
-
* pick an api key; for the rest it stores a key directly. The env-var override is
|
|
9
|
-
* consulted first via the framework {@link getEnvApiKey}, so a user who already
|
|
10
|
-
* exported (e.g.) `ANTHROPIC_API_KEY` can sign in without re-typing the secret.
|
|
11
|
-
*
|
|
12
|
-
* The command owns the first positional token only: it returns `handled: false`
|
|
13
|
-
* when that token is neither {@link CredentialVerb} so the caller falls through
|
|
14
|
-
* to a normal launch. Every failure is a typed {@link CredentialFault}; nothing
|
|
15
|
-
* is signalled by a string sentinel or a bare `process.exit`.
|
|
16
|
-
*
|
|
17
|
-
* I/O is injected. The default {@link CredentialIo} wraps `process.stdout` plus a
|
|
18
|
-
* `node:readline/promises` interface, but tests drive the whole flow over an
|
|
19
|
-
* in-memory stand-in with no real terminal and an in-memory vault.
|
|
20
|
-
*/
|
|
21
|
-
import { type CredentialCommandOptions, type CredentialFault, type CredentialVerb, type ProviderEntry } from "./contract";
|
|
22
|
-
/**
|
|
23
|
-
* The console seam the credential command reads and writes through.
|
|
24
|
-
*
|
|
25
|
-
* Pinned to the three operations the flow actually needs — emit a line, read a
|
|
26
|
-
* line of input, and read a secret line — so a test can capture output into an
|
|
27
|
-
* array and feed scripted answers without a real TTY.
|
|
28
|
-
*/
|
|
29
|
-
export interface CredentialIo {
|
|
30
|
-
/** Emit one line of human-facing text. */
|
|
31
|
-
print(line: string): void;
|
|
32
|
-
/** Prompt for and read one line of visible input. */
|
|
33
|
-
ask(prompt: string): Promise<string>;
|
|
34
|
-
/** Prompt for and read one line of secret input (key entry). */
|
|
35
|
-
askSecret(prompt: string): Promise<string>;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* The default {@link CredentialIo} backed by `process.stdout` and a
|
|
39
|
-
* `node:readline/promises` interface. Secret entry mutes echo while the line is
|
|
40
|
-
* typed by suppressing the terminal write of each keystroke.
|
|
41
|
-
*/
|
|
42
|
-
export declare function defaultCredentialIo(): CredentialIo;
|
|
43
|
-
/**
|
|
44
|
-
* The api-key provider directory: every provider the sign-in surface can store a
|
|
45
|
-
* key for, with its conventional env var and the page a user obtains a key from.
|
|
46
|
-
* These are external provider facts; {@link envKey} is the variable
|
|
47
|
-
* {@link getEnvApiKey} reads for the env-first shortcut.
|
|
48
|
-
*/
|
|
49
|
-
export declare const PROVIDER_DIRECTORY: readonly ProviderEntry[];
|
|
50
|
-
/** Look up a provider entry by id (case-insensitive over the directory). */
|
|
51
|
-
export declare function findProvider(id: string): ProviderEntry | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* The two ways a provider can be signed in to.
|
|
54
|
-
*
|
|
55
|
-
* - `oauth` — a browser sign-in driven by the framework registry.
|
|
56
|
-
* - `api-key` — paste / store a provider api key.
|
|
57
|
-
*/
|
|
58
|
-
export type SigninMethod = "oauth" | "api-key";
|
|
59
|
-
/** Narrow a `--method` value to a {@link SigninMethod}. */
|
|
60
|
-
export declare function asSigninMethod(value: string | undefined): SigninMethod | undefined;
|
|
61
|
-
/** Whether a provider id can be signed in to through the browser registry. */
|
|
62
|
-
export declare function isOAuthCapable(id: string): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Validate an api key against the format rules: non-empty, at least
|
|
65
|
-
* {@link MIN_KEY_LENGTH} characters, and free of placeholder markers. Returns a
|
|
66
|
-
* typed {@link CredentialFault} on rejection, or `undefined` when the key passes.
|
|
67
|
-
*/
|
|
68
|
-
export declare function validateApiKey(key: string): CredentialFault | undefined;
|
|
69
|
-
/**
|
|
70
|
-
* Validate an account name: at most {@link MAX_ACCOUNT_LENGTH} characters and
|
|
71
|
-
* matching {@link ACCOUNT_PATTERN}. Returns a typed fault on rejection, or
|
|
72
|
-
* `undefined` when the name is acceptable.
|
|
73
|
-
*/
|
|
74
|
-
export declare function validateAccountName(name: string): CredentialFault | undefined;
|
|
75
|
-
/**
|
|
76
|
-
* The outcome of {@link runCredentialCommand}.
|
|
77
|
-
*
|
|
78
|
-
* {@link handled} reports whether the first positional token was a recognised
|
|
79
|
-
* {@link CredentialVerb}; when `false`, the caller proceeds to a normal launch
|
|
80
|
-
* unchanged. {@link fault} carries a typed failure when the command was handled
|
|
81
|
-
* but did not complete.
|
|
82
|
-
*/
|
|
83
|
-
export interface CredentialResult {
|
|
84
|
-
/** Whether this invocation was a `signin` / `signout` command. */
|
|
85
|
-
readonly handled: boolean;
|
|
86
|
-
/** The verb that ran, when {@link handled} is true. */
|
|
87
|
-
readonly verb?: CredentialVerb;
|
|
88
|
-
/** The provider id the verb acted on, when one was resolved. */
|
|
89
|
-
readonly provider?: string;
|
|
90
|
-
/** A typed failure, present only when the handled command did not complete. */
|
|
91
|
-
readonly fault?: CredentialFault;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Run the api-key sign-in / sign-out command.
|
|
95
|
-
*
|
|
96
|
-
* Returns `{ handled: false }` immediately when `argv[0]` is neither verb, so the
|
|
97
|
-
* orchestrator can call this first and fall through on a miss. Otherwise it
|
|
98
|
-
* resolves the provider (prompting from the directory when none is named), runs
|
|
99
|
-
* the verb, and resolves a {@link CredentialResult} — never throwing for an
|
|
100
|
-
* expected failure, which surfaces as {@link CredentialResult.fault}.
|
|
101
|
-
*
|
|
102
|
-
* @param argv the raw token list following the program name
|
|
103
|
-
* @param opts the injected vault, profile directory, and (optionally) the io seam
|
|
104
|
-
*/
|
|
105
|
-
export declare function runCredentialCommand(argv: readonly string[], opts: CredentialCommandOptions & {
|
|
106
|
-
io?: CredentialIo;
|
|
107
|
-
}): Promise<CredentialResult>;
|
|
108
|
-
/**
|
|
109
|
-
* Render a {@link CredentialFault} as the single human-facing message the caller
|
|
110
|
-
* prints before exiting non-zero. Pure; no I/O.
|
|
111
|
-
*/
|
|
112
|
-
export declare function formatCredentialFault(fault: CredentialFault): string;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Launch subsystem — public barrel.
|
|
3
|
-
*
|
|
4
|
-
* Re-exports the frozen Phase-10 contract surface: the parsed
|
|
5
|
-
* {@link Invocation} and its {@link OutputMode} / {@link ThinkingEffort} /
|
|
6
|
-
* {@link ToolName} vocabularies, the declarative {@link FlagSpec} table types,
|
|
7
|
-
* the gathered {@link Attachments} shape, the typed {@link CredentialFault}
|
|
8
|
-
* union and its {@link AuthVault} seam, the model-catalog filter, and the resume
|
|
9
|
-
* / settings-browser option shapes. Behavior modules (the reader, the usage
|
|
10
|
-
* renderer, the credential command, the attachment gatherer, the catalog
|
|
11
|
-
* printer, the resume picker, the settings browser) attach their exports here as
|
|
12
|
-
* they land, so consumers import the launch surface from `src/launch` rather
|
|
13
|
-
* than reaching into individual modules.
|
|
14
|
-
*/
|
|
15
|
-
export type { OutputMode, ThinkingEffort, ToolName, FlagKind, FlagDefault, FlagSpec, Invocation, FlagValue, Attachments, AttachmentOptions, CredentialVerb, ProviderEntry, CredentialFaultKind, CredentialFault, AuthVault, CredentialCommandOptions, CatalogFilter, SessionLoader, ResumeFault, SettingsBrowseOptions, ResumeRef, ThinkingLevel, SessionListProgress, ImageContent, KnownProvider, ModelRegistry, OAuthCredentials, Settings, RunnerId, } from "./contract";
|
|
16
|
-
export { THINKING_EFFORTS, TOOL_NAMES, isThinkingEffort, isOutputMode, isToolName, credentialFault, } from "./contract";
|
|
17
|
-
export { FLAG_SPECS, FLAG_GROUPS, readInvocation, readFileReferences, renderUsage, gatherAttachments, AttachmentError, } from "./invocation";
|
|
18
|
-
export type { FlagGroup, GroupedFlagSpec, AttachmentErrorKind, } from "./invocation";
|
|
19
|
-
export { runPackageCommand, defaultPackageIo, PACKAGE_COMMANDS, } from "./packages";
|
|
20
|
-
export type { PackageCommand, PackageIo, PackageCommandOptions, PackageResult, } from "./packages";
|
|
21
|
-
export { runCredentialCommand, defaultCredentialIo, formatCredentialFault, validateApiKey, validateAccountName, findProvider, isOAuthCapable, asSigninMethod, PROVIDER_DIRECTORY, } from "./credentials";
|
|
22
|
-
export type { CredentialIo, CredentialResult, SigninMethod } from "./credentials";
|
|
23
|
-
export { registerBuiltInOAuthProviders, listLoginProviders, startOAuthLogin, openLoginUrl, hasRegisteredOAuthClientId, } from "./oauth";
|
|
24
|
-
export type { AuthKind, LoginProvider, OAuthLoginResult, } from "./oauth";
|
|
25
|
-
export { printModelCatalog, defaultCatalogIo, registrySource } from "./catalog";
|
|
26
|
-
export type { CatalogIo, CatalogModelSource } from "./catalog";
|
|
27
|
-
export { pickResumeTarget, browseSettings, mergeSessions, renderSettingsListing, defaultResumeDeps, defaultSettingsBrowseIo, } from "./pickers";
|
|
28
|
-
export type { ResumeDeps, ResumeOutcome, SettingsBrowseIo, } from "./pickers";
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The attachment gatherer — expands `@file` references into one
|
|
3
|
-
* {@link Attachments} value.
|
|
4
|
-
*
|
|
5
|
-
* Each `@file` token collected by the reader is resolved through the framework
|
|
6
|
-
* path resolver ({@link resolveReadPath}, which handles `~` expansion and the
|
|
7
|
-
* cwd), classified by extension, and folded into the result:
|
|
8
|
-
*
|
|
9
|
-
* - **text files** are read as UTF-8 and inlined into {@link Attachments.prose}
|
|
10
|
-
* wrapped in a delimited block keyed by the resolved path, so the model sees
|
|
11
|
-
* which file each block came from;
|
|
12
|
-
* - **image files** are read as bytes, base64-encoded, and collected as
|
|
13
|
-
* framework {@link ImageContent} in {@link Attachments.media}.
|
|
14
|
-
*
|
|
15
|
-
* Guard rails:
|
|
16
|
-
* - an unknown extension, an oversized file, a missing file, or a read error
|
|
17
|
-
* raises a typed {@link AttachmentError} (with a {@link AttachmentErrorKind}
|
|
18
|
-
* discriminant) rather than a string or a process exit;
|
|
19
|
-
* - size caps bound the inlined text and the decoded image before either is
|
|
20
|
-
* materialised onto the message;
|
|
21
|
-
* - an empty file is skipped silently — it contributes neither prose nor media.
|
|
22
|
-
*
|
|
23
|
-
* The `@file` syntax, the extension classification, and base64 image attachment
|
|
24
|
-
* are kept behaviours; only the typed-error model and the explicit caps are
|
|
25
|
-
* owned here.
|
|
26
|
-
*/
|
|
27
|
-
import type { Attachments, AttachmentOptions } from "../contract";
|
|
28
|
-
/**
|
|
29
|
-
* The closed set of attachment failure categories. A consumer switches on
|
|
30
|
-
* {@link AttachmentError.kind}, never on message text:
|
|
31
|
-
*
|
|
32
|
-
* - `unsupported` — the file extension is neither text nor image.
|
|
33
|
-
* - `too-large` — the file exceeds its kind's size cap.
|
|
34
|
-
* - `not-found` — the resolved path does not exist.
|
|
35
|
-
* - `read-failed` — the file could not be read or stat-ed.
|
|
36
|
-
*/
|
|
37
|
-
export type AttachmentErrorKind = "unsupported" | "too-large" | "not-found" | "read-failed";
|
|
38
|
-
/**
|
|
39
|
-
* A typed `@file` expansion failure. Carries the offending reference and the
|
|
40
|
-
* resolved path for diagnostics; {@link cause} preserves any wrapped error.
|
|
41
|
-
*/
|
|
42
|
-
export declare class AttachmentError extends Error {
|
|
43
|
-
/** The failure category (the discriminant). */
|
|
44
|
-
readonly kind: AttachmentErrorKind;
|
|
45
|
-
/** The raw `@file` reference as supplied on the command line. */
|
|
46
|
-
readonly reference: string;
|
|
47
|
-
/** The resolved absolute path, when resolution succeeded. */
|
|
48
|
-
readonly resolvedPath?: string;
|
|
49
|
-
/** The wrapped underlying error, if any. */
|
|
50
|
-
readonly cause?: unknown;
|
|
51
|
-
constructor(kind: AttachmentErrorKind, message: string, detail: {
|
|
52
|
-
reference: string;
|
|
53
|
-
resolvedPath?: string;
|
|
54
|
-
cause?: unknown;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Expand the `@file` references into a single {@link Attachments} value.
|
|
59
|
-
*
|
|
60
|
-
* Resolves each reference against {@link AttachmentOptions.cwd} via the framework
|
|
61
|
-
* resolver, classifies it by extension, enforces the per-kind size cap, and
|
|
62
|
-
* appends either a text block to the prose or an {@link ImageContent} to the
|
|
63
|
-
* media. References list is taken in order; the prose blocks are joined with a
|
|
64
|
-
* blank line between them. An empty references list yields an empty
|
|
65
|
-
* {@link Attachments} (the caller decides whether to attach it at all).
|
|
66
|
-
*
|
|
67
|
-
* @param references the raw `@file` paths (without the leading `@`)
|
|
68
|
-
* @param options the cwd the references resolve against
|
|
69
|
-
* @throws AttachmentError on an unsupported extension, an oversized file, a
|
|
70
|
-
* missing file, or a read failure
|
|
71
|
-
*/
|
|
72
|
-
export declare function gatherAttachments(references: readonly string[], options: AttachmentOptions): Promise<Attachments>;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The single declarative flag table.
|
|
3
|
-
*
|
|
4
|
-
* Every recognised command-line option is described here exactly once, as one
|
|
5
|
-
* {@link FlagSpec} row. Two consumers walk this same table:
|
|
6
|
-
*
|
|
7
|
-
* - the reader ({@link readInvocation}) indexes it by canonical name and alias
|
|
8
|
-
* to bind raw tokens into the parsed {@link Invocation}; and
|
|
9
|
-
* - the usage generator ({@link renderUsage}) enumerates it to render the
|
|
10
|
-
* option reference — there is no second, hand-maintained help string for it
|
|
11
|
-
* to drift against.
|
|
12
|
-
*
|
|
13
|
-
* Because both sides read the same rows, the help text and the parser cannot
|
|
14
|
-
* disagree about which flags exist, what they take, or what they mean. The order
|
|
15
|
-
* of the rows is the order options appear in the generated usage, grouped by the
|
|
16
|
-
* {@link FlagGroup} sidecar map below; keeping that order intentional is the only
|
|
17
|
-
* editorial concern when a row is added.
|
|
18
|
-
*
|
|
19
|
-
* Flag names and their semantics are a stable product contract (and largely an
|
|
20
|
-
* industry convention), so they are kept as-is; only the table that declares
|
|
21
|
-
* them and the code that reads it are owned here.
|
|
22
|
-
*/
|
|
23
|
-
import type { FlagSpec } from "../contract";
|
|
24
|
-
/**
|
|
25
|
-
* The heading a flag is filed under in the generated usage. Purely an editorial
|
|
26
|
-
* grouping for {@link renderUsage}; it has no effect on parsing.
|
|
27
|
-
*/
|
|
28
|
-
export type FlagGroup = "output" | "model" | "context" | "tools" | "meta";
|
|
29
|
-
/**
|
|
30
|
-
* A {@link FlagSpec} carrying its usage section. The extra {@link group} field is
|
|
31
|
-
* inert at parse time; the reader ignores it and only the renderer reads it.
|
|
32
|
-
*/
|
|
33
|
-
export interface GroupedFlagSpec extends FlagSpec {
|
|
34
|
-
/** The usage section this row is rendered under. */
|
|
35
|
-
readonly group: FlagGroup;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Human-readable titles for each {@link FlagGroup}, in render order. The usage
|
|
39
|
-
* generator walks this list, then within each group emits the matching rows from
|
|
40
|
-
* {@link FLAG_SPECS} in declaration order.
|
|
41
|
-
*/
|
|
42
|
-
export declare const FLAG_GROUPS: readonly {
|
|
43
|
-
readonly id: FlagGroup;
|
|
44
|
-
readonly title: string;
|
|
45
|
-
}[];
|
|
46
|
-
/**
|
|
47
|
-
* The one declarative option table. Every recognised flag is one row; the reader
|
|
48
|
-
* and the usage generator both index this and nothing else.
|
|
49
|
-
*
|
|
50
|
-
* Conventions:
|
|
51
|
-
* - {@link FlagSpec.name} is the canonical long spelling (leading dashes
|
|
52
|
-
* included) and also the key the parsed value lands under in
|
|
53
|
-
* {@link Invocation.flags} (sans the dashes).
|
|
54
|
-
* - {@link FlagSpec.aliases} hold short forms and synonyms; every alias hit
|
|
55
|
-
* normalises to {@link FlagSpec.name}.
|
|
56
|
-
* - {@link FlagSpec.kind} fixes the value vocabulary: `boolean` switches,
|
|
57
|
-
* `string` / `number` value flags, and accumulating `list` flags.
|
|
58
|
-
*/
|
|
59
|
-
export declare const FLAG_SPECS: readonly GroupedFlagSpec[];
|