indusagi-coding-agent 0.2.4 → 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/LICENSE +661 -0
- package/README.md +95 -1
- package/dist/entry.js +1559 -1100
- package/dist/guardrails.js +26 -509
- package/dist/index.js +1581 -1155
- 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/heap.d.ts +0 -31
- 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 -109
- 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/server-mode.d.ts +0 -71
- package/dist/types/boot/runners/session-persist.test.d.ts +0 -10
- package/dist/types/boot/runners/session.d.ts +0 -88
- package/dist/types/boot/runners/session.test.d.ts +0 -15
- package/dist/types/boot/server-token.d.ts +0 -97
- 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 -318
- 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 -213
- package/dist/types/conductor/conductor.test.d.ts +0 -10
- package/dist/types/conductor/contract.d.ts +0 -838
- 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 -287
- 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 -18
- package/dist/types/conductor/quota-error.d.ts +0 -35
- 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/auth-status.d.ts +0 -28
- 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 -27
- 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 -611
- 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 -183
- package/dist/types/console/mount.d.ts +0 -53
- package/dist/types/console/overlays/approval-queue.d.ts +0 -88
- 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/login.d.ts +0 -68
- package/dist/types/launch/oauth.d.ts +0 -101
- package/dist/types/launch/oauth.test.d.ts +0 -20
- 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 -76
- 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 -124
- 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,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Approval queue — the headless, pure serializer behind the approval overlay.
|
|
3
|
-
*
|
|
4
|
-
* The permission gate may reach an `ask` decision while another approval prompt is
|
|
5
|
-
* already on screen (e.g. a turn that batches several tool calls). The UI shows ONE
|
|
6
|
-
* prompt at a time, so the pending requests are held in an ordered queue: each
|
|
7
|
-
* `enqueue` parks a request, the HEAD is the prompt currently shown, and `settle`
|
|
8
|
-
* resolves the head's parked promise then advances to the next. This module is a
|
|
9
|
-
* pure reducer over an immutable {@link ApprovalQueueState} plus a couple of tiny
|
|
10
|
-
* helpers — no React, no Ink, no timers — so the queue logic is unit-testable in
|
|
11
|
-
* isolation (the overlay component only renders the head and dispatches settles).
|
|
12
|
-
*
|
|
13
|
-
* Each queued entry carries the parked promise's `resolve` (the gate awaits it) and
|
|
14
|
-
* the request itself. Settling resolves with an {@link ApprovalChoice}; an
|
|
15
|
-
* abort/clear settles every outstanding entry with `"deny"` so a cancelled turn
|
|
16
|
-
* never hangs on a pending prompt.
|
|
17
|
-
*/
|
|
18
|
-
import type { ApprovalChoice, PermissionMode } from "../../conductor";
|
|
19
|
-
import type { ApprovalRequest } from "./approval";
|
|
20
|
-
/** One parked approval request awaiting the user's choice. */
|
|
21
|
-
export interface ApprovalEntry {
|
|
22
|
-
/** A stable id, unique within the queue's lifetime, used to settle the right one. */
|
|
23
|
-
readonly id: string;
|
|
24
|
-
/** The pending request the prompt renders. */
|
|
25
|
-
readonly request: ApprovalRequest;
|
|
26
|
-
/** Fulfil the gate's parked promise with the user's choice. Called exactly once. */
|
|
27
|
-
readonly resolve: (choice: ApprovalChoice) => void;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* The immutable queue state. The array is ordered oldest-first; the head (index 0)
|
|
31
|
-
* is the request currently prompted. An empty queue means no prompt is showing.
|
|
32
|
-
*/
|
|
33
|
-
export interface ApprovalQueueState {
|
|
34
|
-
/** The parked entries, oldest first; `[0]` is the active prompt. */
|
|
35
|
-
readonly entries: readonly ApprovalEntry[];
|
|
36
|
-
}
|
|
37
|
-
/** The empty queue — no approval prompt pending. */
|
|
38
|
-
export declare const EMPTY_APPROVAL_QUEUE: ApprovalQueueState;
|
|
39
|
-
/**
|
|
40
|
-
* The closed action union the queue reducer folds:
|
|
41
|
-
* - `enqueue` — park a new request at the tail.
|
|
42
|
-
* - `settle` — resolve the entry matching `id` with `choice` and drop it.
|
|
43
|
-
* - `clear` — drop EVERY entry (the caller resolves each with `"deny"`).
|
|
44
|
-
*/
|
|
45
|
-
export type ApprovalQueueEvent = {
|
|
46
|
-
readonly type: "enqueue";
|
|
47
|
-
readonly entry: ApprovalEntry;
|
|
48
|
-
} | {
|
|
49
|
-
readonly type: "settle";
|
|
50
|
-
readonly id: string;
|
|
51
|
-
} | {
|
|
52
|
-
readonly type: "clear";
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Fold one {@link ApprovalQueueEvent} over the queue, returning a fresh state.
|
|
56
|
-
*
|
|
57
|
-
* Pure and total: it never resolves a promise itself (the caller does that around
|
|
58
|
-
* a `settle`/`clear`), it only mutates the ordered entry list. `enqueue` appends;
|
|
59
|
-
* `settle` removes the entry with the matching `id` (a no-op when absent, e.g. a
|
|
60
|
-
* double-settle); `clear` empties the queue.
|
|
61
|
-
*
|
|
62
|
-
* @param state the prior queue state
|
|
63
|
-
* @param event the action to apply
|
|
64
|
-
*/
|
|
65
|
-
export declare function approvalQueueReducer(state: ApprovalQueueState, event: ApprovalQueueEvent): ApprovalQueueState;
|
|
66
|
-
/**
|
|
67
|
-
* The active prompt — the head entry — or `undefined` when the queue is empty.
|
|
68
|
-
*
|
|
69
|
-
* @param state the queue state
|
|
70
|
-
*/
|
|
71
|
-
export declare function activeApproval(state: ApprovalQueueState): ApprovalEntry | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* Whether switching INTO `mode` mid-prompt should release (auto-allow) every
|
|
74
|
-
* PARKED approval request.
|
|
75
|
-
*
|
|
76
|
-
* Only `bypass` qualifies: a parked entry already passed the deny-rule and
|
|
77
|
-
* catastrophic-blocklist scans before it reached `ask`, and under bypass the
|
|
78
|
-
* engine allows everything not denied — so settling the parked prompts with
|
|
79
|
-
* `allow-once` matches exactly what the mode now means, and the run resumes
|
|
80
|
-
* instead of idling behind a prompt the user just declared moot. Every other
|
|
81
|
-
* mode keeps the prompts parked: `default`/`acceptEdits` still want the answer,
|
|
82
|
-
* and `plan` must not auto-ALLOW a mutating call (the user can still deny).
|
|
83
|
-
*
|
|
84
|
-
* Pure; the component wires it to the actual settle.
|
|
85
|
-
*
|
|
86
|
-
* @param mode the permission mode just switched into
|
|
87
|
-
*/
|
|
88
|
-
export declare function modeReleasesApprovals(mode: PermissionMode): boolean;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Approval overlay — the interactive tool-permission prompt.
|
|
3
|
-
*
|
|
4
|
-
* This group owns the single modal kind raised when the permission gate reaches an
|
|
5
|
-
* `ask` decision for a tool call: it shows the pending request (tool name, a short
|
|
6
|
-
* rendering of the arguments, and any suggested allow-rule) and lets the user pick
|
|
7
|
-
* one of three outcomes — allow this one call, allow it for the rest of the session
|
|
8
|
-
* (which the gate turns into a session allow-rule), or deny it. It is mounted
|
|
9
|
-
* unconditionally by {@link import("./host").OverlayHost}, which routes by
|
|
10
|
-
* {@link ModalState.kind}; this component renders a dialog body only for its own
|
|
11
|
-
* `approval` kind and is otherwise inert.
|
|
12
|
-
*
|
|
13
|
-
* The wiring is a parked promise: when the React layer builds the conductor's
|
|
14
|
-
* approval resolver it returns a promise and stashes the request (plus the
|
|
15
|
-
* promise's `resolve`) under {@link ModalState.payload}. This overlay reads that
|
|
16
|
-
* payload, renders the choices, and on a pick calls `payload.resolve(choice)` then
|
|
17
|
-
* closes the modal — handing control back to the gate, which proceeds or denies. An
|
|
18
|
-
* Esc (the dialog's own close) resolves `"deny"` so a dismissed prompt never hangs
|
|
19
|
-
* the in-flight turn. The actual select UI reuses the framework `ThemeDialog`
|
|
20
|
-
* (a labelled, navigable pick-from-list with descriptions), so the overlay needs no
|
|
21
|
-
* bespoke key handling.
|
|
22
|
-
*
|
|
23
|
-
* React/Ink are obtained the same way the other overlays do (default React export
|
|
24
|
-
* from `indusagi/react-host`, `Box`/`Text` from `indusagi/react-host/ink`).
|
|
25
|
-
*/
|
|
26
|
-
import { type ThemeDialogItem } from "indusagi/react-ink";
|
|
27
|
-
import type { ApprovalChoice } from "../../conductor";
|
|
28
|
-
import type { OverlayGroupProps } from "./pickers";
|
|
29
|
-
/**
|
|
30
|
-
* The pending tool-permission request a prompt is raised for. Mirrors the
|
|
31
|
-
* arguments the conductor's approval resolver is handed for an `ask` decision.
|
|
32
|
-
*/
|
|
33
|
-
export interface ApprovalRequest {
|
|
34
|
-
/** The tool the model asked to run (e.g. `"Bash"`, `"Edit"`). */
|
|
35
|
-
readonly toolName: string;
|
|
36
|
-
/** The validated arguments the tool would run with. */
|
|
37
|
-
readonly input: unknown;
|
|
38
|
-
/**
|
|
39
|
-
* Optional human-readable allow-rule suggestions the prompt surfaces (e.g.
|
|
40
|
-
* `"Bash(npm run test:*)"`), so the user knows what an "allow always" remembers.
|
|
41
|
-
*/
|
|
42
|
-
readonly suggestions?: readonly string[];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* The opaque {@link ModalState.payload} the `approval` overlay narrows: the pending
|
|
46
|
-
* request plus the resolver of the parked approval promise. The overlay calls
|
|
47
|
-
* `resolve(choice)` exactly once, then closes the modal.
|
|
48
|
-
*/
|
|
49
|
-
export interface ApprovalPayload {
|
|
50
|
-
/** The pending request to render. */
|
|
51
|
-
readonly request: ApprovalRequest;
|
|
52
|
-
/** Fulfil the parked approval promise with the user's choice. */
|
|
53
|
-
readonly resolve: (choice: ApprovalChoice) => void;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* The three offerable outcomes, in listing order. The `id` is the
|
|
57
|
-
* {@link ApprovalChoice} the gate consumes; `label`/`description` are what the
|
|
58
|
-
* prompt shows. Kept as data (not an `if`-ladder) so the choice→resolution mapping
|
|
59
|
-
* is a pure table the headless test asserts against.
|
|
60
|
-
*/
|
|
61
|
-
export declare const APPROVAL_CHOICES: readonly (ThemeDialogItem & {
|
|
62
|
-
id: ApprovalChoice;
|
|
63
|
-
})[];
|
|
64
|
-
/** The {@link ApprovalChoice} a dismissed (Esc) prompt resolves to. */
|
|
65
|
-
export declare const DISMISS_CHOICE: ApprovalChoice;
|
|
66
|
-
/**
|
|
67
|
-
* Map a selected dialog `id` back to the {@link ApprovalChoice} the gate consumes.
|
|
68
|
-
*
|
|
69
|
-
* Pure and total: a recognised id maps to itself; anything unrecognised falls back
|
|
70
|
-
* to {@link DISMISS_CHOICE} (`"deny"`) so a stray selection can never silently
|
|
71
|
-
* allow a tool. This is the unit the headless test pins.
|
|
72
|
-
*
|
|
73
|
-
* @param id the `id` the {@link ThemeDialog} reported on select
|
|
74
|
-
*/
|
|
75
|
-
export declare function choiceFromId(id: string): ApprovalChoice;
|
|
76
|
-
/**
|
|
77
|
-
* Narrow the opaque modal payload into a typed {@link ApprovalPayload}, or
|
|
78
|
-
* `undefined` when it is not a well-formed approval request (a defensive guard —
|
|
79
|
-
* the overlay renders nothing rather than crash on a malformed payload).
|
|
80
|
-
*
|
|
81
|
-
* @param payload the opaque {@link ModalState.payload}
|
|
82
|
-
*/
|
|
83
|
-
export declare function readApprovalPayload(payload: unknown): ApprovalPayload | undefined;
|
|
84
|
-
/**
|
|
85
|
-
* Render a tool call's arguments as a single short, human-readable line for the
|
|
86
|
-
* prompt body. A shell `command` (or any `command` field) shows verbatim;
|
|
87
|
-
* otherwise a compact JSON encoding is used. Long values are elided so the prompt
|
|
88
|
-
* never floods the terminal.
|
|
89
|
-
*
|
|
90
|
-
* @param input the validated tool arguments
|
|
91
|
-
*/
|
|
92
|
-
export declare function summarizeInput(input: unknown): string;
|
|
93
|
-
/**
|
|
94
|
-
* The approval overlay group: the single `approval` modal kind.
|
|
95
|
-
*
|
|
96
|
-
* Renders the prompt body when the active modal is `approval` and its payload is a
|
|
97
|
-
* well-formed {@link ApprovalPayload}; every other kind (and a malformed payload)
|
|
98
|
-
* yields nothing. Unlike the session/auth groups this does NOT require the runtime
|
|
99
|
-
* services bundle — the payload carries everything the prompt needs — so it works
|
|
100
|
-
* on any mount path that wired a resolver.
|
|
101
|
-
*
|
|
102
|
-
* @param props the forwarded overlay props (modal, services, theme, dispatch, closer)
|
|
103
|
-
*/
|
|
104
|
-
export declare function ApprovalOverlays(props: OverlayGroupProps): JSX.Element | null;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Approval overlay — headless unit tests for the pure logic behind the prompt.
|
|
3
|
-
*
|
|
4
|
-
* Rendering an Ink dialog headlessly is brittle, so these tests pin the two pure
|
|
5
|
-
* pieces the interactive overlay is built from — exactly the bar the task sets:
|
|
6
|
-
*
|
|
7
|
-
* 1. The choice→resolution mapping ({@link choiceFromId}) + the payload narrowing
|
|
8
|
-
* ({@link readApprovalPayload}) + the argument summary ({@link summarizeInput}):
|
|
9
|
-
* a selected dialog row maps to the {@link ApprovalChoice} the gate consumes, a
|
|
10
|
-
* malformed payload is rejected, and a stray id falls back to `deny`.
|
|
11
|
-
* 2. The queue reducer ({@link approvalQueueReducer}) + head selector
|
|
12
|
-
* ({@link activeApproval}): requests serialise oldest-first, a settle drops the
|
|
13
|
-
* matching entry (and a double-settle is inert), and a clear empties the queue.
|
|
14
|
-
*
|
|
15
|
-
* No React, no Ink, no conductor — just the exported functions.
|
|
16
|
-
*/
|
|
17
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth overlays — the sign-in / sign-out and plugin dialogs.
|
|
3
|
-
*
|
|
4
|
-
* This group owns the four modal kinds tied to credentials and host-supplied
|
|
5
|
-
* overlays: the provider sign-in launcher (`signIn`), the sign-out confirmation
|
|
6
|
-
* (`signOut`), the in-flight OAuth device/redirect flow (`oauth`), and a
|
|
7
|
-
* plugin-supplied select/confirm/input/custom overlay (`plugin`). It is mounted
|
|
8
|
-
* unconditionally by {@link import("./host").OverlayHost}, which routes by
|
|
9
|
-
* {@link ModalState.kind}; this component renders a dialog body only for one of
|
|
10
|
-
* its own kinds and is otherwise inert.
|
|
11
|
-
*
|
|
12
|
-
* Each kind drives an {@link OverlayServices} handle then returns to the
|
|
13
|
-
* composer: `signIn` enumerates the merged provider directory and hands a
|
|
14
|
-
* browser provider off to the `oauth` kind (api-key providers post a status and
|
|
15
|
-
* close); `signOut` lists the saved accounts across providers and removes the
|
|
16
|
-
* chosen one through the vault; `oauth` runs the framework login flow, threading
|
|
17
|
-
* its url/prompt/progress callbacks into a local overlay state the dialog reads;
|
|
18
|
-
* `plugin` presents the host-supplied surface name and closes. React/Ink are
|
|
19
|
-
* obtained the same way the surface component is (default React export from
|
|
20
|
-
* `indusagi/react-host`, `Box`/`Text` from `indusagi/react-host/ink`).
|
|
21
|
-
*/
|
|
22
|
-
import type { OverlayGroupProps } from "./pickers";
|
|
23
|
-
/**
|
|
24
|
-
* The auth overlay group: sign-in, sign-out, OAuth, and plugin overlays.
|
|
25
|
-
*
|
|
26
|
-
* Renders a dialog body only when the active modal kind is one of this group's
|
|
27
|
-
* own; every other kind (and an absent {@link OverlayServices}) yields nothing.
|
|
28
|
-
*
|
|
29
|
-
* @param props the forwarded overlay props
|
|
30
|
-
*/
|
|
31
|
-
export declare function AuthOverlays(props: OverlayGroupProps): JSX.Element | null;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Saffron picker boards — the themed `/settings` and `/model` overlays styled to
|
|
3
|
-
* the "IndusCode Saffron · Settings · Config" design.
|
|
4
|
-
*
|
|
5
|
-
* The framework ships plain (un-themed) `SettingsDialog` / `ModelDialog`. These
|
|
6
|
-
* boards are the console's own theme-aware replacements for those two pickers: a
|
|
7
|
-
* saffron tab-pill header, a teal-bordered search box with a magnifier and a
|
|
8
|
-
* block caret, a two-column list whose values are tinted by kind (on/true →
|
|
9
|
-
* green, off/false → dim, everything else → teal), a windowed "↓ N more" hint,
|
|
10
|
-
* and a top-ruled footer of key hints. They reuse the framework's pure
|
|
11
|
-
* {@link matchesSearchQuery} / {@link wrapSelectionIndex} helpers (and the
|
|
12
|
-
* {@link SettingsDialogItem} shape) so only the *presentation* is re-authored,
|
|
13
|
-
* not the filter/navigation logic.
|
|
14
|
-
*
|
|
15
|
-
* All colour comes through the framework {@link InkThemeAdapter} the overlay
|
|
16
|
-
* group already holds, so the boards recolour with the active scheme; the one
|
|
17
|
-
* raw-hex touch is the chalk tab-pill (dark text on the accent fill), which has
|
|
18
|
-
* no theme role to resolve against.
|
|
19
|
-
*/
|
|
20
|
-
import { type InkThemeAdapter, type SettingsDialogItem } from "indusagi/react-ink";
|
|
21
|
-
import type { Model } from "indusagi/ai";
|
|
22
|
-
/** What the {@link SettingsBoard} renders. */
|
|
23
|
-
export interface SettingsBoardProps {
|
|
24
|
-
/** The framework adapter that turns token roles into terminal colours. */
|
|
25
|
-
readonly theme: InkThemeAdapter;
|
|
26
|
-
/** The settings rows to present and cycle. */
|
|
27
|
-
readonly items: readonly SettingsDialogItem[];
|
|
28
|
-
/** Invoked when the board is dismissed. */
|
|
29
|
-
readonly onClose: () => void;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* The saffron `/settings` board: a filterable, value-cycling settings list in the
|
|
33
|
-
* design's look. Up/Down move (wrapping), Left/Right or Enter cycle the value,
|
|
34
|
-
* typing filters, Ctrl+U clears, Esc closes.
|
|
35
|
-
*/
|
|
36
|
-
export declare function SettingsBoard({ theme, items, onClose }: SettingsBoardProps): JSX.Element;
|
|
37
|
-
/** What the {@link ModelBoard} renders. */
|
|
38
|
-
export interface ModelBoardProps {
|
|
39
|
-
/** The framework adapter that turns token roles into terminal colours. */
|
|
40
|
-
readonly theme: InkThemeAdapter;
|
|
41
|
-
/** The selectable models. */
|
|
42
|
-
readonly models: readonly Model<any>[];
|
|
43
|
-
/** Optional initial search query. */
|
|
44
|
-
readonly search?: string;
|
|
45
|
-
/** Invoked with the chosen model. */
|
|
46
|
-
readonly onSelect: (model: Model<any>) => void | Promise<void>;
|
|
47
|
-
/** Invoked when the board is dismissed. */
|
|
48
|
-
readonly onClose: () => void;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* The saffron `/model` board: a filterable model list in the design's look.
|
|
52
|
-
* Up/Down move (wrapping), Enter selects, typing filters, Ctrl+U clears, Esc
|
|
53
|
-
* closes.
|
|
54
|
-
*/
|
|
55
|
-
export declare function ModelBoard({ theme, models, onClose, onSelect, search }: ModelBoardProps): JSX.Element;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OverlayHost — the single mount point for every modal overlay.
|
|
3
|
-
*
|
|
4
|
-
* The console surface raises overlays by writing a {@link ModalState} into the
|
|
5
|
-
* reducer; this component is the one place that turns that state into a rendered
|
|
6
|
-
* dialog. Rather than a hand-written `switch` over {@link ModalKind}, it mounts
|
|
7
|
-
* three group components unconditionally and forwards each the same props — the
|
|
8
|
-
* active {@link ModalState}, the {@link OverlayServices} runtime, the theme
|
|
9
|
-
* adapter, the {@link ConsoleDispatch}, and a `closeModal` callback. Each group
|
|
10
|
-
* owns a disjoint slice of the kind space and renders a body only for its own
|
|
11
|
-
* kinds:
|
|
12
|
-
*
|
|
13
|
-
* - {@link PickerOverlays} — `models`, `scopedModels`, `theme`, `settings`.
|
|
14
|
-
* - {@link SessionOverlays} — `sessions`, `tree`, `userTurns`.
|
|
15
|
-
* - {@link AuthOverlays} — `signIn`, `signOut`, `oauth`, `plugin`.
|
|
16
|
-
* - {@link ApprovalOverlays} — `approval` (the tool-permission prompt).
|
|
17
|
-
*
|
|
18
|
-
* When no overlay is raised (`kind === "none"`) the host renders nothing, so the
|
|
19
|
-
* composer keeps focus and the groups are never mounted needlessly.
|
|
20
|
-
*/
|
|
21
|
-
import type { ConsoleDispatch, InkThemeAdapter, ModalState, OverlayServices } from "../contract";
|
|
22
|
-
/**
|
|
23
|
-
* The props the console surface threads into {@link OverlayHost}.
|
|
24
|
-
*
|
|
25
|
-
* The same five fields are forwarded verbatim to each overlay group; the host
|
|
26
|
-
* adds no routing logic of its own beyond the `none` short-circuit.
|
|
27
|
-
*/
|
|
28
|
-
export interface OverlayHostProps {
|
|
29
|
-
/** The active modal overlay (kind + opaque payload). */
|
|
30
|
-
readonly modal: ModalState;
|
|
31
|
-
/** The runtime handles overlays drive; absent on headless mount paths. */
|
|
32
|
-
readonly services?: OverlayServices;
|
|
33
|
-
/** The framework adapter that turns token roles into terminal colours. */
|
|
34
|
-
readonly theme: InkThemeAdapter;
|
|
35
|
-
/** Dispatch a reducer event to mutate console state. */
|
|
36
|
-
readonly dispatch: ConsoleDispatch;
|
|
37
|
-
/** Drop the active overlay back to the composer. */
|
|
38
|
-
readonly closeModal: () => void;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Render the active modal overlay, or nothing when none is raised.
|
|
42
|
-
*
|
|
43
|
-
* @param props the modal state, runtime services, theme, dispatch, and closer
|
|
44
|
-
*/
|
|
45
|
-
export declare function OverlayHost(props: OverlayHostProps): JSX.Element | null;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Overlays subsystem — public barrel.
|
|
3
|
-
*
|
|
4
|
-
* Re-exports the single overlay mount point ({@link OverlayHost}) plus the three
|
|
5
|
-
* group components it forwards to ({@link PickerOverlays}, {@link SessionOverlays},
|
|
6
|
-
* {@link AuthOverlays}) and the shared prop shapes. The console surface imports
|
|
7
|
-
* the overlay host from `src/console/overlays` rather than reaching into the
|
|
8
|
-
* individual modules; the dialog bodies are filled by a later pass.
|
|
9
|
-
*/
|
|
10
|
-
export { OverlayHost, type OverlayHostProps } from "./host";
|
|
11
|
-
export { PickerOverlays, type OverlayGroupProps } from "./pickers";
|
|
12
|
-
export { SessionOverlays } from "./sessions";
|
|
13
|
-
export { AuthOverlays } from "./auth";
|
|
14
|
-
export { ApprovalOverlays, choiceFromId, readApprovalPayload, summarizeInput, APPROVAL_CHOICES, DISMISS_CHOICE, type ApprovalRequest, type ApprovalPayload, } from "./approval";
|
|
15
|
-
export { approvalQueueReducer, activeApproval, modeReleasesApprovals, EMPTY_APPROVAL_QUEUE, type ApprovalEntry, type ApprovalQueueState, type ApprovalQueueEvent, } from "./approval-queue";
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Picker overlays — the selection dialogs raised over the transcript.
|
|
3
|
-
*
|
|
4
|
-
* This group owns the four modal kinds that present a list to pick from: the
|
|
5
|
-
* single-model picker (`models`), the per-scope model picker (`scopedModels`),
|
|
6
|
-
* the colour-scheme picker (`theme`), and the settings list (`settings`). It is
|
|
7
|
-
* mounted unconditionally by {@link import("./host").OverlayHost}; the host
|
|
8
|
-
* routes by {@link ModalState.kind}, so this component only renders a dialog
|
|
9
|
-
* body for one of its own kinds and is otherwise inert.
|
|
10
|
-
*/
|
|
11
|
-
import type { ConsoleDispatch, InkThemeAdapter, ModalState, OverlayServices } from "../contract";
|
|
12
|
-
/**
|
|
13
|
-
* The props every overlay group receives, forwarded verbatim from
|
|
14
|
-
* {@link import("./host").OverlayHost}.
|
|
15
|
-
*/
|
|
16
|
-
export interface OverlayGroupProps {
|
|
17
|
-
/** The active modal overlay (kind + opaque payload). */
|
|
18
|
-
readonly modal: ModalState;
|
|
19
|
-
/** The runtime handles overlays drive; absent on headless mount paths. */
|
|
20
|
-
readonly services?: OverlayServices;
|
|
21
|
-
/** The framework adapter that turns token roles into terminal colours. */
|
|
22
|
-
readonly theme: InkThemeAdapter;
|
|
23
|
-
/** Dispatch a reducer event to mutate console state. */
|
|
24
|
-
readonly dispatch: ConsoleDispatch;
|
|
25
|
-
/** Drop the active overlay back to the composer. */
|
|
26
|
-
readonly closeModal: () => void;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* The picker overlay group: models, scoped models, theme, and settings.
|
|
30
|
-
*
|
|
31
|
-
* Renders the framework dialog matching the active modal kind, and nothing for
|
|
32
|
-
* any kind owned by another group. With no runtime services attached (headless
|
|
33
|
-
* and test mounts) every kind renders nothing.
|
|
34
|
-
*
|
|
35
|
-
* @param props the forwarded overlay props
|
|
36
|
-
*/
|
|
37
|
-
export declare function PickerOverlays(props: OverlayGroupProps): JSX.Element | null;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session overlays — the transcript navigation dialogs.
|
|
3
|
-
*
|
|
4
|
-
* This group owns the three modal kinds that browse persisted or in-flight
|
|
5
|
-
* transcript state: the session resume/list picker (`sessions`), the
|
|
6
|
-
* transcript-tree navigator (`tree`), and the prior-user-turn picker
|
|
7
|
-
* (`userTurns`) used when branching or forking. It is mounted unconditionally
|
|
8
|
-
* by {@link import("./host").OverlayHost}, which routes by
|
|
9
|
-
* {@link ModalState.kind}; this component renders a dialog body only for one of
|
|
10
|
-
* its own kinds and is otherwise inert.
|
|
11
|
-
*
|
|
12
|
-
* Each body maps the app's session vocabulary onto the framework dialog prop
|
|
13
|
-
* shapes: a {@link import("../../sessions").SavedSession} becomes a
|
|
14
|
-
* `SessionInfo`, a {@link import("../../sessions").BranchNode} becomes a
|
|
15
|
-
* `SessionTreeOption`, and a {@link import("../../sessions").PriorTurn} becomes
|
|
16
|
-
* a `UserMessageOption`. Async catalog/tree/turn loads run in `useEffect`; every
|
|
17
|
-
* confirm drives the matching service then closes the modal. When the runtime
|
|
18
|
-
* {@link OverlayServices} bundle is absent, the group renders nothing.
|
|
19
|
-
*/
|
|
20
|
-
import type { OverlayGroupProps } from "./pickers";
|
|
21
|
-
/**
|
|
22
|
-
* The session overlay group: sessions, tree, and prior-turn pickers.
|
|
23
|
-
*
|
|
24
|
-
* Renders the dialog body matching the active modal kind, or nothing for a kind
|
|
25
|
-
* this group does not own (or when no runtime services are wired in).
|
|
26
|
-
*
|
|
27
|
-
* @param props the forwarded overlay props (modal, services, theme, dispatch, closer)
|
|
28
|
-
*/
|
|
29
|
-
export declare function SessionOverlays(props: OverlayGroupProps): JSX.Element | null;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Console reducer — the single pure fold over {@link ConsoleState}.
|
|
3
|
-
*
|
|
4
|
-
* The whole terminal surface is reduced from one immutable {@link ConsoleState}
|
|
5
|
-
* value, mutated only by dispatching a {@link ConsoleEvent} into
|
|
6
|
-
* {@link consoleReducer}. This module is the one place those transitions live:
|
|
7
|
-
* it is a pure function (no React, no I/O, no timers) that, given a prior state
|
|
8
|
-
* and an event, returns a *fresh* state — it never mutates its input. That makes
|
|
9
|
-
* every transition unit-testable in isolation and keeps the surface component a
|
|
10
|
-
* thin shell that only wires events in and renders the result out.
|
|
11
|
-
*
|
|
12
|
-
* The transitions fall into a few families, mirroring the {@link ConsoleEvent}
|
|
13
|
-
* grouping:
|
|
14
|
-
*
|
|
15
|
-
* - **Composer edits** (`buffer:*`, `caret:*`) splice and navigate the live
|
|
16
|
-
* input buffer, keeping the caret clamped into `[0, buffer.length]`.
|
|
17
|
-
* - **History recall** (`history:*`) walks the submitted-input ring, stashing
|
|
18
|
-
* the live buffer on the way in and restoring it on the way out.
|
|
19
|
-
* - **Transcript view** (`rows:*`, `block:append`) appends and patches the
|
|
20
|
-
* rendered rows projected from the conductor's {@link SessionSignal} stream
|
|
21
|
-
* (the surface translates each signal into a row event).
|
|
22
|
-
* - **Overlays / status / theme / toggles / busy** flip the small UI-local
|
|
23
|
-
* flags the surface reads to decide what chrome to render.
|
|
24
|
-
*
|
|
25
|
-
* Live session data (messages, usage, model) is *not* stored here — it is read
|
|
26
|
-
* straight from the conductor snapshot — so this state stays purely UI-local and
|
|
27
|
-
* the reducer never needs to know about the agent loop.
|
|
28
|
-
*/
|
|
29
|
-
import { type ConsoleEvent, type ConsoleState } from "./contract";
|
|
30
|
-
/**
|
|
31
|
-
* Fold a {@link ConsoleEvent} into a {@link ConsoleState}, returning a fresh
|
|
32
|
-
* state.
|
|
33
|
-
*
|
|
34
|
-
* Pure and total: every event has a defined transition, and the input state is
|
|
35
|
-
* never mutated. The `switch` is exhaustive over the event union, so adding an
|
|
36
|
-
* event without handling it is a compile error.
|
|
37
|
-
*
|
|
38
|
-
* @param state the prior console state
|
|
39
|
-
* @param event the action to apply
|
|
40
|
-
*/
|
|
41
|
-
export declare function consoleReducer(state: ConsoleState, event: ConsoleEvent): ConsoleState;
|
|
42
|
-
/**
|
|
43
|
-
* Build the initial {@link ConsoleState} a console mounts with.
|
|
44
|
-
*
|
|
45
|
-
* Starts from the frozen {@link EMPTY_CONSOLE_STATE} seed and overlays any
|
|
46
|
-
* caller-supplied UI preferences (scheme, the display toggles). Pure and
|
|
47
|
-
* deterministic — no runtime is consulted — so the first render is stable.
|
|
48
|
-
*
|
|
49
|
-
* @param overrides optional UI-local preferences to seed
|
|
50
|
-
*/
|
|
51
|
-
export declare function initConsoleState(overrides?: Partial<ConsoleState>): ConsoleState;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The built-in slash catalog — the single ordered source of truth.
|
|
3
|
-
*
|
|
4
|
-
* The catalog is assembled from three static topic groups, each its own module
|
|
5
|
-
* under `./commands/`: transcript/session control, the workbench pickers
|
|
6
|
-
* (model/models-for/theme/settings/help/keys/whats-new/debug), and the
|
|
7
|
-
* integration bridges (login/logout/mcp/memory/composio/copy/export/share). On
|
|
8
|
-
* top of those it splices in the *dynamic* rows — one `/skill:<name>` per
|
|
9
|
-
* discovered Agent-Skills capability card and one `/<template-name>` per
|
|
10
|
-
* discovered prompt-template macro — produced by {@link buildDynamicCommands}.
|
|
11
|
-
*
|
|
12
|
-
* There is no command `if`-ladder anywhere: adding a static command is appending
|
|
13
|
-
* a row to one of the groups, and the dynamic rows are discovered at module load
|
|
14
|
-
* from the standard skill/macro roots (returning nothing, never an error, when
|
|
15
|
-
* those roots are absent). The registry index, the completion matcher, and the
|
|
16
|
-
* family grouping are all *derived* from {@link SLASH_COMMANDS} (see
|
|
17
|
-
* `registry.ts`).
|
|
18
|
-
*
|
|
19
|
-
* Listing order is intentional: transcript controls first (the verbs a new user
|
|
20
|
-
* meets), then the workbench pickers, then the integration bridges, and finally
|
|
21
|
-
* the discovered skills and templates.
|
|
22
|
-
*/
|
|
23
|
-
import type { SlashCommand } from "../contract";
|
|
24
|
-
/** The family labels the catalog groups commands under (for `/help`). */
|
|
25
|
-
export { FAMILY } from "./commands/shared";
|
|
26
|
-
/**
|
|
27
|
-
* The built-in catalog — every command row in listing order.
|
|
28
|
-
*
|
|
29
|
-
* Consumers fold this into a {@link SlashRegistry} via `buildRegistry`; the index
|
|
30
|
-
* by name/alias, the family grouping, and the completion matcher are all derived
|
|
31
|
-
* from this one array.
|
|
32
|
-
*/
|
|
33
|
-
export declare const SLASH_COMMANDS: readonly SlashCommand[];
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dynamic slash commands — capability cards and prompt templates as registry rows.
|
|
3
|
-
*
|
|
4
|
-
* The static catalog (`./builtins`) is hand-maintained, but two command families
|
|
5
|
-
* are *discovered* at startup rather than written by hand: the Agent-Skills
|
|
6
|
-
* capability cards ({@link SkillCard}s loaded from `SKILL.md` files) and the
|
|
7
|
-
* user/project prompt templates ({@link Macro}s loaded from `*.md` macro files).
|
|
8
|
-
* This module turns whatever was discovered into ordinary {@link SlashCommand}
|
|
9
|
-
* rows so they sit in the same registry as the built-ins, complete the same way,
|
|
10
|
-
* and resolve through the same dispatcher.
|
|
11
|
-
*
|
|
12
|
-
* Two row shapes are produced:
|
|
13
|
-
*
|
|
14
|
-
* - `/skill:<name>` — invoking it submits an Agent-Skills *invocation block*
|
|
15
|
-
* (`<skill name="…" location="…">body</skill>`) as a normal turn, which is
|
|
16
|
-
* exactly what the agent loop recognises to load and run that skill. The
|
|
17
|
-
* trailing argument string becomes the skill body, so `/skill:commit tidy the
|
|
18
|
-
* diff` runs the `commit` card against "tidy the diff".
|
|
19
|
-
* - `/<template-name>` — invoking it expands the macro body against the
|
|
20
|
-
* trailing arguments (the single-pass `$arg` model from the briefing layer)
|
|
21
|
-
* and submits the result as a normal turn.
|
|
22
|
-
*
|
|
23
|
-
* Both return a `{ kind: "prompt" }` outcome so the dispatcher hands the produced
|
|
24
|
-
* text to the conductor as a turn; neither reaches into a backend the console
|
|
25
|
-
* does not own. When nothing was discovered, {@link buildDynamicCommands} returns
|
|
26
|
-
* an empty array, so splicing it into the catalog is always safe.
|
|
27
|
-
*/
|
|
28
|
-
import type { Macro, SkillCard } from "../../../briefing";
|
|
29
|
-
import type { SlashCommand } from "../../contract";
|
|
30
|
-
/**
|
|
31
|
-
* The discovered material a dynamic catalog is built from.
|
|
32
|
-
*
|
|
33
|
-
* Both fields are optional and default to empty: a caller that only loaded
|
|
34
|
-
* skills passes `{ skills }`, one that only loaded templates passes `{ templates }`,
|
|
35
|
-
* and a caller with neither passes `{}` (or nothing) and gets back `[]`.
|
|
36
|
-
*/
|
|
37
|
-
export interface DynamicCommandSources {
|
|
38
|
-
/** Capability cards discovered from `SKILL.md` files. */
|
|
39
|
-
readonly skills?: readonly SkillCard[];
|
|
40
|
-
/** Prompt templates discovered from `*.md` macro files. */
|
|
41
|
-
readonly templates?: readonly Macro[];
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Project discovered skills and templates into {@link SlashCommand} rows.
|
|
45
|
-
*
|
|
46
|
-
* Skill rows are listed first (namespaced under `skill:`), then the template
|
|
47
|
-
* rows. A name claimed by an earlier row — including any of the static built-ins
|
|
48
|
-
* a caller will concatenate these ahead of — is the registry's problem to reject
|
|
49
|
-
* at assembly time; this function only suppresses *self*-collisions so a template
|
|
50
|
-
* whose name duplicates a skill's `skill:`-prefixed token (impossible) or another
|
|
51
|
-
* template (first wins) cannot crash the build. When no sources are supplied the
|
|
52
|
-
* result is an empty array, never an error.
|
|
53
|
-
*
|
|
54
|
-
* @param sources the discovered skills and templates
|
|
55
|
-
* @returns the dynamic command rows, skills first then templates
|
|
56
|
-
*/
|
|
57
|
-
export declare function buildDynamicCommands(sources?: DynamicCommandSources): SlashCommand[];
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dynamic command group — focused tests.
|
|
3
|
-
*
|
|
4
|
-
* The builder turns discovered capability cards and prompt-template macros into
|
|
5
|
-
* {@link SlashCommand} rows. Each row's `run` is driven against a scripted
|
|
6
|
-
* {@link SlashContext} so its produced outcome (a `prompt` carrying the skill
|
|
7
|
-
* invocation block or the expanded template) is asserted directly.
|
|
8
|
-
*/
|
|
9
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration slash commands — auth launchers, the external bridges, and the
|
|
3
|
-
* clipboard / export / share I/O verbs.
|
|
4
|
-
*
|
|
5
|
-
* This group is the console's seam onto everything that lives *outside* a single
|
|
6
|
-
* turn: signing in and out of a provider, wiring the MCP and memory surfaces,
|
|
7
|
-
* connecting an external SaaS bridge, and moving the transcript out of the
|
|
8
|
-
* terminal (clipboard, HTML export, a share link). The handlers do real work
|
|
9
|
-
* where a backing capability exists — they render the live transcript to HTML
|
|
10
|
-
* through the {@link publishTranscript} publisher, drive an {@link MCPClientPool}
|
|
11
|
-
* over the workspace MCP config, reflect the working-memory card from the
|
|
12
|
-
* capability deck, and reach the Composio catalog through the SaaS gateway — and
|
|
13
|
-
* fall back to an *informative* status (never a dead placeholder) when a backend
|
|
14
|
-
* is unreachable in the current environment.
|
|
15
|
-
*
|
|
16
|
-
* The two family commands (`/memory`, `/composio`) are built from
|
|
17
|
-
* {@link SubCommand} tables via {@link familyRunner}, so their verb dispatch is a
|
|
18
|
-
* lookup, not an `if`-ladder. Overlay surfaces (`mcp`, `memory`, `composio`)
|
|
19
|
-
* carry the *gathered* text into the plugin modal payload, so the dialog renders
|
|
20
|
-
* the real state the command collected rather than a fixed line.
|
|
21
|
-
*/
|
|
22
|
-
import type { SlashCommand } from "../../contract";
|
|
23
|
-
/**
|
|
24
|
-
* The integration command group: auth launchers, the MCP/memory/composio
|
|
25
|
-
* bridges, and the clipboard / export / share I/O verbs. Appended to the slash
|
|
26
|
-
* registry by the integrator alongside the other groups.
|
|
27
|
-
*/
|
|
28
|
-
export declare const integrationCommands: SlashCommand[];
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration slash commands — focused behavioral tests.
|
|
3
|
-
*
|
|
4
|
-
* Each handler is exercised through a scripted fake {@link SlashContext} that
|
|
5
|
-
* records the overlay requests (`openModal`) and status toasts (`setStatus`) the
|
|
6
|
-
* handlers raise. The coverage walks every command and family verb:
|
|
7
|
-
* 1. The auth/bridge launchers (`/login`, `/logout`, `/mcp`) open the right
|
|
8
|
-
* modal kind, and a named `/login` threads the provider into the payload.
|
|
9
|
-
* 2. `/memory` reflects the real working-memory card (status / tools / on /
|
|
10
|
-
* off) and carries the gathered text into the plugin overlay.
|
|
11
|
-
* 3. `/composio` reports the missing-key state specifically when no
|
|
12
|
-
* `COMPOSIO_API_KEY` is configured, and warns on a missing connect target.
|
|
13
|
-
* 4. `/copy` extracts the newest assistant prose and writes it through the
|
|
14
|
-
* injected clipboard, warning when there is nothing to copy.
|
|
15
|
-
* 5. `/export` renders the live transcript to an HTML file (and warns on an
|
|
16
|
-
* empty transcript); `/share` reuses that path and degrades informatively.
|
|
17
|
-
*/
|
|
18
|
-
export {};
|