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,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bash command parser/classifier + catastrophic-command blocklist.
|
|
3
|
-
*
|
|
4
|
-
* The permission engine ({@link "./permissions"}) matches a tool call against
|
|
5
|
-
* induscode-style `Bash(...)` allow/ask/deny rules. For most tools the call is a
|
|
6
|
-
* single atomic action, so a rule's argument specifier matches against one
|
|
7
|
-
* subject string. The shell tool is different: `a && b; c | d` is FOUR commands
|
|
8
|
-
* in one call, and a coarse "match the whole command string" check is trivially
|
|
9
|
-
* bypassed — a benign-looking prefix can smuggle a destructive tail past an
|
|
10
|
-
* allow rule (`npm test && rm -rf /`), or hide a blocked binary behind a wrapper
|
|
11
|
-
* (`env X=1 rm -rf /`, `sudo rm -rf /`) or quoting.
|
|
12
|
-
*
|
|
13
|
-
* This module makes bash matching real. It is split in two concerns:
|
|
14
|
-
*
|
|
15
|
-
* 1. **A parser/classifier** — {@link parseBashCommand} splits a shell command
|
|
16
|
-
* string into its constituent *simple* commands across the control
|
|
17
|
-
* operators (`;`, `&&`, `||`, `|`, newlines) and `( … )` subshells /
|
|
18
|
-
* `$( … )` / `` ` … ` `` command substitutions, strips benign leading
|
|
19
|
-
* wrappers (`env VAR=x`, `nice`, `nohup`, `timeout N`, `xargs`, `command`,
|
|
20
|
-
* `builtin`, and `sudo`/`doas` — the last recorded as an *elevation* flag),
|
|
21
|
-
* and returns each base command + its raw argument string. Quoting is
|
|
22
|
-
* handled well enough that `"rm -rf /"` cannot hide behind quotes or a
|
|
23
|
-
* wrapper. The split is quote-aware so an operator *inside* a quoted string
|
|
24
|
-
* (`echo "a && b"`) is NOT treated as a command boundary.
|
|
25
|
-
*
|
|
26
|
-
* 2. **A catastrophic blocklist** — {@link isCatastrophicCommand} matches a
|
|
27
|
-
* single parsed sub-command against a conservative set of always-deny
|
|
28
|
-
* patterns (root-targeting `rm -rf`, fork bombs, `curl … | sh` of remote
|
|
29
|
-
* scripts, `dd of=/dev/…`, `mkfs`, `chmod -R 777 /`, redirect-to-raw-disk).
|
|
30
|
-
* It is deliberately narrow so normal dev commands (`rm -rf node_modules`,
|
|
31
|
-
* `rm -rf ./dist`, `curl … -o file`) are NOT blocked. This is
|
|
32
|
-
* defense-in-depth, NOT a hard security boundary — the OS sandbox and the
|
|
33
|
-
* permission gate are the real boundary.
|
|
34
|
-
*
|
|
35
|
-
* Everything here is pure, synchronous, and side-effect free so the classifier
|
|
36
|
-
* and the blocklist are exhaustively unit-testable, and the permission engine
|
|
37
|
-
* can fold them into its decision without any I/O.
|
|
38
|
-
*/
|
|
39
|
-
/**
|
|
40
|
-
* One simple command extracted from a (possibly compound) shell string.
|
|
41
|
-
*
|
|
42
|
-
* `rm -rf /tmp` parses to `{ name: "rm", args: ["-rf", "/tmp"], elevated: false,
|
|
43
|
-
* raw: "rm -rf /tmp" }`. The `name` is the base binary AFTER benign wrappers are
|
|
44
|
-
* stripped; `args` are its tokens (quotes removed); `raw` is the original
|
|
45
|
-
* sub-command slice (wrappers included) so a caller can echo exactly what the
|
|
46
|
-
* model asked for; `elevated` is true when a `sudo`/`doas` wrapper was stripped.
|
|
47
|
-
*/
|
|
48
|
-
export interface ParsedCommand {
|
|
49
|
-
/** The base binary, lower-cased for stable comparison (e.g. `"rm"`). */
|
|
50
|
-
readonly name: string;
|
|
51
|
-
/** The argument tokens after the binary, with surrounding quotes removed. */
|
|
52
|
-
readonly args: readonly string[];
|
|
53
|
-
/** Whether a `sudo`/`doas` elevation wrapper preceded this command. */
|
|
54
|
-
readonly elevated: boolean;
|
|
55
|
-
/** The original sub-command slice (wrappers included), trimmed. */
|
|
56
|
-
readonly raw: string;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Parse a (possibly compound) shell command string into the flat list of every
|
|
60
|
-
* simple command it runs — across operators, subshells, and command
|
|
61
|
-
* substitutions, with benign wrappers stripped.
|
|
62
|
-
*
|
|
63
|
-
* The result is order-preserving and exhaustive enough that the permission
|
|
64
|
-
* engine can evaluate a `Bash(...)` rule (and the catastrophic blocklist)
|
|
65
|
-
* against EACH sub-command independently: a deny on any sub-command denies the
|
|
66
|
-
* whole call, and an allow must cover every sub-command to auto-allow.
|
|
67
|
-
*
|
|
68
|
-
* @returns one {@link ParsedCommand} per simple command; an empty array for an
|
|
69
|
-
* empty/whitespace command string.
|
|
70
|
-
*/
|
|
71
|
-
export declare function parseBashCommand(command: string): ParsedCommand[];
|
|
72
|
-
/**
|
|
73
|
-
* Classify a SINGLE parsed sub-command against the catastrophic blocklist.
|
|
74
|
-
*
|
|
75
|
-
* @returns the byte-stable deny reason when the command is catastrophic, else
|
|
76
|
-
* `undefined`. Use {@link evaluateCatastrophic} for a whole compound call (it
|
|
77
|
-
* also runs the cross-sub-command `curl | sh` correlation).
|
|
78
|
-
*/
|
|
79
|
-
export declare function catastrophicReason(cmd: ParsedCommand): string | undefined;
|
|
80
|
-
/** Convenience boolean form of {@link catastrophicReason}. */
|
|
81
|
-
export declare function isCatastrophicCommand(cmd: ParsedCommand): boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Evaluate the catastrophic blocklist over a WHOLE bash command string.
|
|
84
|
-
*
|
|
85
|
-
* Parses the (possibly compound) command, runs the per-sub-command blocklist on
|
|
86
|
-
* each leaf, AND runs the cross-sub-command `curl | sh` correlation. Returns a
|
|
87
|
-
* byte-stable deny message when ANY check fires, else `undefined`.
|
|
88
|
-
*
|
|
89
|
-
* This is what the permission engine calls for the bash tool: a catastrophic
|
|
90
|
-
* command is denied REGARDLESS of allow/ask/deny rules or mode (it is not even
|
|
91
|
-
* `bypass`-able, mirroring the original always-block guard).
|
|
92
|
-
*/
|
|
93
|
-
export declare function evaluateCatastrophic(command: string): string | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* Render the rule-matching SUBJECT for each sub-command of a bash call: the base
|
|
96
|
-
* command joined with its argument tokens (wrappers stripped). The permission
|
|
97
|
-
* engine matches an induscode `Bash(...)` specifier against EACH of these — an
|
|
98
|
-
* allow rule must cover them all to auto-allow, a deny on any one denies the
|
|
99
|
-
* whole call.
|
|
100
|
-
*
|
|
101
|
-
* For `npm test && rm important.txt` this yields `["npm test", "rm
|
|
102
|
-
* important.txt"]`, so `Bash(npm test)` allows the first but not the second.
|
|
103
|
-
* Returns the original command (single element) when nothing parses, so a tool
|
|
104
|
-
* call always has at least one subject to match against.
|
|
105
|
-
*/
|
|
106
|
-
export declare function bashSubcommandSubjects(command: string): string[];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bash command parser/classifier + catastrophic blocklist — unit tests.
|
|
3
|
-
*
|
|
4
|
-
* Pins the parser ({@link parseBashCommand}) across the four concerns that make
|
|
5
|
-
* coarse whole-string matching trivially bypassable:
|
|
6
|
-
* - **compound** splitting on `;`, `&&`, `||`, `|`, `&`, newlines,
|
|
7
|
-
* - benign **wrapper** stripping (`env VAR=x`, `nohup`, `timeout N`, `nice -n
|
|
8
|
-
* N`, `xargs`, `command`, and `sudo`/`doas` as elevation),
|
|
9
|
-
* - **subshell / command-substitution** descent (`( … )`, `$( … )`, `` ` … ` ``),
|
|
10
|
-
* - **quote-aware** tokenization so an operator inside a quote is not a
|
|
11
|
-
* boundary and a quoted/escaped binary cannot hide from the classifier,
|
|
12
|
-
* plus the documented bypass cases. Then the catastrophic blocklist
|
|
13
|
-
* ({@link evaluateCatastrophic}) — `rm -rf /` and root-ish targets, fork bombs,
|
|
14
|
-
* `curl | sh`, raw-disk writes, `mkfs`, `chmod -R 777 /` — alongside the
|
|
15
|
-
* negative cases proving normal dev commands are NOT blocked. No I/O.
|
|
16
|
-
*/
|
|
17
|
-
export {};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model catalog — `ModelCatalog`.
|
|
3
|
-
*
|
|
4
|
-
* A transform pipeline over the framework model list. The framework publishes
|
|
5
|
-
* its catalog per provider via `getModels(provider)` from `indusagi/ai`; each
|
|
6
|
-
* entry is a rich {@link Model} record. This module **re-derives** that data
|
|
7
|
-
* into the conductor's own normalized shape — a {@link CatalogCard} — through a
|
|
8
|
-
* validate → normalize → key pipeline, then exposes a small lookup surface
|
|
9
|
-
* (`all`, `byProvider`, `get`) keyed by a canonical `"provider/modelId"` id.
|
|
10
|
-
*
|
|
11
|
-
* This replaces pi's `model-registry` / `ModelRegistry`. It is intentionally
|
|
12
|
-
* *not* a re-export of the framework registry: the field order and shape are
|
|
13
|
-
* the conductor's, the data is run back through a zod gate, and the public
|
|
14
|
-
* methods read differently. The full framework {@link Model} is retained on each
|
|
15
|
-
* card so the conductor can hand a complete model object to the agent without a
|
|
16
|
-
* second registry round-trip.
|
|
17
|
-
*/
|
|
18
|
-
import { type KnownProvider, type Model } from "indusagi/ai";
|
|
19
|
-
import type { ModelCardRef } from "../contract";
|
|
20
|
-
/**
|
|
21
|
-
* One normalized entry in the catalog.
|
|
22
|
-
*
|
|
23
|
-
* Extends the lightweight {@link ModelCardRef} identity projection with the
|
|
24
|
-
* extra capability facets the matcher filters on, plus the original framework
|
|
25
|
-
* {@link Model}. `ref` is the slice a UI lists/labels with; `model` is the full
|
|
26
|
-
* record the conductor binds to the agent.
|
|
27
|
-
*/
|
|
28
|
-
export interface CatalogCard {
|
|
29
|
-
/** Canonical `"provider/modelId"` identifier — the catalog key. */
|
|
30
|
-
readonly id: string;
|
|
31
|
-
/** Owning provider slug. */
|
|
32
|
-
readonly provider: KnownProvider | string;
|
|
33
|
-
/** Provider-scoped model id (e.g. `"claude-sonnet-4"`). */
|
|
34
|
-
readonly modelId: string;
|
|
35
|
-
/** Human-readable display name. */
|
|
36
|
-
readonly name: string;
|
|
37
|
-
/** Whether the model exposes a reasoning/thinking budget. */
|
|
38
|
-
readonly reasoning: boolean;
|
|
39
|
-
/** Whether the model accepts image input. */
|
|
40
|
-
readonly acceptsImages: boolean;
|
|
41
|
-
/** Context window size in tokens (0 when the framework omits it). */
|
|
42
|
-
readonly contextTokens: number;
|
|
43
|
-
/** The framework model record, retained verbatim for binding. */
|
|
44
|
-
readonly model: Model<Model<string>["api"]>;
|
|
45
|
-
}
|
|
46
|
-
/** Project a {@link CatalogCard} down to its public {@link ModelCardRef} slice. */
|
|
47
|
-
export declare function toCardRef(card: CatalogCard): ModelCardRef;
|
|
48
|
-
/** Compose the canonical catalog key from a provider + model id. */
|
|
49
|
-
export declare function canonicalId(provider: string, modelId: string): string;
|
|
50
|
-
/** Injection seam for tests: how the catalog sources its raw data. */
|
|
51
|
-
export interface CatalogSource {
|
|
52
|
-
/** Enumerate the providers to scan. */
|
|
53
|
-
readonly providers: () => readonly (KnownProvider | string)[];
|
|
54
|
-
/** Pull the raw model list for one provider. */
|
|
55
|
-
readonly models: (provider: string) => readonly Model<string>[];
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* A normalized, validated view of the framework model list.
|
|
59
|
-
*
|
|
60
|
-
* Construct once (the build pipeline runs eagerly in the constructor) and query
|
|
61
|
-
* many times. The instance is immutable after construction; call
|
|
62
|
-
* {@link ModelCatalog.refreshed} to rebuild against the current framework state.
|
|
63
|
-
*/
|
|
64
|
-
export declare class ModelCatalog {
|
|
65
|
-
#private;
|
|
66
|
-
/**
|
|
67
|
-
* @param source raw-data seam; defaults to the live `indusagi/ai` registry.
|
|
68
|
-
*/
|
|
69
|
-
constructor(source?: CatalogSource);
|
|
70
|
-
/** Total number of cards in the catalog. */
|
|
71
|
-
get size(): number;
|
|
72
|
-
/** Every card, in insertion order (provider scan order). */
|
|
73
|
-
all(): readonly CatalogCard[];
|
|
74
|
-
/** Cards owned by one provider (empty array if the provider has none). */
|
|
75
|
-
byProvider(provider: KnownProvider | string): readonly CatalogCard[];
|
|
76
|
-
/** The providers that contributed at least one card, in scan order. */
|
|
77
|
-
providers(): readonly string[];
|
|
78
|
-
/**
|
|
79
|
-
* Look up one card by its canonical `"provider/modelId"` id. Also accepts a
|
|
80
|
-
* bare provider-scoped model id when it is unambiguous across providers.
|
|
81
|
-
*/
|
|
82
|
-
get(id: string): CatalogCard | undefined;
|
|
83
|
-
/** True when the canonical id resolves to a card. */
|
|
84
|
-
has(id: string): boolean;
|
|
85
|
-
/** Rebuild against the current framework state, returning a fresh catalog. */
|
|
86
|
-
refreshed(source?: CatalogSource): ModelCatalog;
|
|
87
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model catalog subsystem — public barrel.
|
|
3
|
-
*
|
|
4
|
-
* Bundles the {@link ModelCatalog} (a normalized, validated transform over the
|
|
5
|
-
* framework model list) and the {@link ModelMatcher} (a scored-candidate query
|
|
6
|
-
* resolver). Consumers import both — plus the {@link CatalogCard} shape and the
|
|
7
|
-
* `canonicalId` / `toCardRef` helpers — from `src/conductor/catalog` rather than
|
|
8
|
-
* reaching into the individual modules.
|
|
9
|
-
*
|
|
10
|
-
* This pairing replaces pi's `model-registry` + `model-resolver`; the catalog
|
|
11
|
-
* key, card shape, and resolution algorithm are all the conductor's own.
|
|
12
|
-
*/
|
|
13
|
-
export { ModelCatalog, canonicalId, toCardRef, type CatalogCard, type CatalogSource, } from "./catalog";
|
|
14
|
-
export { ModelMatcher, type ResolveInput, } from "./matcher";
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model matcher — `ModelMatcher`.
|
|
3
|
-
*
|
|
4
|
-
* A scored-candidate resolver over a {@link ModelCatalog}. Given a free-form
|
|
5
|
-
* query (a string, or a structured {@link MatchQuery}), it produces the single
|
|
6
|
-
* best-matching {@link ModelCardRef}, or `undefined` when nothing clears the bar.
|
|
7
|
-
*
|
|
8
|
-
* It is an independent implementation: resolution is a *prioritized scoring
|
|
9
|
-
* pipeline*, not a chain of single-purpose match helpers with recursive
|
|
10
|
-
* colon-splitting. Each candidate card is scored against the query by a set of
|
|
11
|
-
* independent strategy probes (exact-canonical, exact-id, provider-prefix,
|
|
12
|
-
* alias-substring, glob), the capability filters gate the field, and the highest
|
|
13
|
-
* scorer (with deterministic tie-breaks) wins. Every helper name here is fresh.
|
|
14
|
-
*/
|
|
15
|
-
import type { MatchQuery, ModelCardRef } from "../contract";
|
|
16
|
-
import { type CatalogCard, type ModelCatalog } from "./catalog";
|
|
17
|
-
/** Either a raw selector string or the structured {@link MatchQuery}. */
|
|
18
|
-
export type ResolveInput = string | MatchQuery;
|
|
19
|
-
/**
|
|
20
|
-
* Resolves model queries against a {@link ModelCatalog} by scored candidates.
|
|
21
|
-
*
|
|
22
|
-
* Construct once with a catalog, then call {@link ModelMatcher.resolve} per
|
|
23
|
-
* query. The matcher holds no mutable state; it is safe to share.
|
|
24
|
-
*/
|
|
25
|
-
export declare class ModelMatcher {
|
|
26
|
-
#private;
|
|
27
|
-
constructor(catalog: ModelCatalog);
|
|
28
|
-
/**
|
|
29
|
-
* Resolve a query to the single best {@link ModelCardRef}, or `undefined`.
|
|
30
|
-
*
|
|
31
|
-
* Pipeline:
|
|
32
|
-
* 1. lift the input to a {@link MatchQuery};
|
|
33
|
-
* 2. honor an explicit `provider`+`modelId` *pin* (highest tier) up front;
|
|
34
|
-
* 3. gate every card through {@link clearsConstraints};
|
|
35
|
-
* 4. with no pattern, return the leading surviving candidate (default pick);
|
|
36
|
-
* 5. otherwise score each survivor via {@link probePattern} + {@link tieBonus}
|
|
37
|
-
* and return the top scorer (deterministic tie-break by tier, bonus, id).
|
|
38
|
-
*/
|
|
39
|
-
resolve(input: ResolveInput): ModelCardRef | undefined;
|
|
40
|
-
/** As {@link resolve}, but returns the full {@link CatalogCard}. */
|
|
41
|
-
resolveCard(input: ResolveInput): CatalogCard | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Resolve, returning *all* surviving candidates ranked best-first (the field
|
|
44
|
-
* a "did you mean" picker would show). Useful for ambiguous selectors.
|
|
45
|
-
*/
|
|
46
|
-
resolveAll(input: ResolveInput): readonly ModelCardRef[];
|
|
47
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SessionConductor — the product-level orchestrator over the framework `Agent`.
|
|
3
|
-
*
|
|
4
|
-
* The framework `Agent` (from `indusagi/agent`) is a raw LLM conversation loop:
|
|
5
|
-
* it streams a fine-grained {@link AgentEvent} surface and owns a flat message
|
|
6
|
-
* list. The {@link SessionConductor} wraps one such agent and turns it into a
|
|
7
|
-
* *coding-agent session*: it drives turns, projects the loop's events down to the
|
|
8
|
-
* stable {@link SessionSignal} stream (via {@link translateAgentEvent} + the
|
|
9
|
-
* {@link SignalHub}), persists every produced message into a branchable
|
|
10
|
-
* {@link TranscriptStore}, retries transient model faults, condenses the
|
|
11
|
-
* transcript when it nears the window, and resolves an immutable
|
|
12
|
-
* {@link ConductorState} per turn.
|
|
13
|
-
*
|
|
14
|
-
* This replaces pi's `AgentSession`, but with a deliberately different internal
|
|
15
|
-
* model (the clean-room divergence):
|
|
16
|
-
* - **Immutable state reducer.** The conductor never mutates a state object in
|
|
17
|
-
* place. Each transition runs through {@link reduceState}, which returns a
|
|
18
|
-
* fresh {@link ConductorState}; `snapshot()` hands out that value.
|
|
19
|
-
* - **Ordered in-flight tool list.** Live tool calls are tracked as an ordered
|
|
20
|
-
* array (start appends, end removes), not pi's `Set<string>` of pending ids.
|
|
21
|
-
* - **Typed discriminated faults.** Failures surface as a {@link ConductorFault}
|
|
22
|
-
* on a `{ kind: "fault" }` signal — never as a fabricated assistant message
|
|
23
|
-
* and never as a string sentinel.
|
|
24
|
-
* - **Pluggable condense seam.** Auto-compaction emits a `{ kind: "compacted" }`
|
|
25
|
-
* signal and calls an injectable {@link CondenseFn}; the real window-budget
|
|
26
|
-
* engine lands in Phase 3, so the default here is a no-op.
|
|
27
|
-
*
|
|
28
|
-
* Everything heavy is injectable so tests run with no network and no disk: pass a
|
|
29
|
-
* scripted fake {@link AgentLike} (same submit/subscribe/event surface), an
|
|
30
|
-
* in-memory {@link TranscriptStore}, a {@link SignalHub}, and a {@link ModelMatcher}
|
|
31
|
-
* over a stubbed {@link ModelCatalog}.
|
|
32
|
-
*/
|
|
33
|
-
import type { AgentEvent, AgentMessage, AgentTool, ThinkingLevel } from "indusagi/agent";
|
|
34
|
-
import { type Model, type Usage } from "indusagi/ai";
|
|
35
|
-
import { type ConductorFault, type ConductorPhase, type ConductorState, type SessionConductor, type SessionConductorOptions, type SessionHead } from "./contract";
|
|
36
|
-
import { ModelMatcher } from "./catalog";
|
|
37
|
-
import { SignalHub } from "./signal-hub";
|
|
38
|
-
import { TranscriptStore } from "./transcript-store";
|
|
39
|
-
import { DiagnosticsEngine, type DiagnosticsConfig } from "./diagnostics";
|
|
40
|
-
/**
|
|
41
|
-
* The slice of the framework `Agent` the conductor drives.
|
|
42
|
-
*
|
|
43
|
-
* The real `Agent` from `indusagi/agent` satisfies this structurally; tests pass
|
|
44
|
-
* a scripted fake exposing the same submit/subscribe/event surface with no
|
|
45
|
-
* network. Keeping the dependency to an interface (not the concrete class) is what
|
|
46
|
-
* makes the conductor unit-testable.
|
|
47
|
-
*/
|
|
48
|
-
export interface AgentLike {
|
|
49
|
-
/** Subscribe to the raw framework event stream; returns an unsubscribe thunk. */
|
|
50
|
-
subscribe(fn: (event: AgentEvent) => void): () => void;
|
|
51
|
-
/** Run one prompt turn to settlement. */
|
|
52
|
-
prompt(input: string): Promise<void>;
|
|
53
|
-
/** Cancel the in-flight turn, if any. */
|
|
54
|
-
abort(): void;
|
|
55
|
-
/** The agent's current state (message list, bound model, streaming flag). */
|
|
56
|
-
readonly state: {
|
|
57
|
-
readonly messages: AgentMessage[];
|
|
58
|
-
readonly model: Model<Model<string>["api"]>;
|
|
59
|
-
readonly isStreaming: boolean;
|
|
60
|
-
};
|
|
61
|
-
/** Replace the agent's message list (used on resume). */
|
|
62
|
-
replaceMessages(messages: AgentMessage[]): void;
|
|
63
|
-
/** Bind a different model for subsequent turns. */
|
|
64
|
-
setModel(model: Model<Model<string>["api"]>): void;
|
|
65
|
-
/** Seed/replace the system prompt. */
|
|
66
|
-
setSystemPrompt(prompt: string): void;
|
|
67
|
-
/** Set the tools available to the loop. */
|
|
68
|
-
setTools(tools: AgentTool[]): void;
|
|
69
|
-
/**
|
|
70
|
-
* Apply a reasoning effort to the loop, when the underlying agent supports it.
|
|
71
|
-
* Optional: a scripted fake may omit it, in which case the conductor stores the
|
|
72
|
-
* level and applies it on the next model bind.
|
|
73
|
-
*/
|
|
74
|
-
setThinkingLevel?(level: ThinkingLevel): void;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Options handed to a {@link CondenseFn} on each invocation.
|
|
78
|
-
*
|
|
79
|
-
* Every field is optional so a scripted/no-op hook can ignore the bag entirely:
|
|
80
|
-
* - `force` — a manual `/compact` (fold to the last user turn) vs the
|
|
81
|
-
* budget-gated auto path.
|
|
82
|
-
* - `model` — the model bound to the live session, forwarded so the
|
|
83
|
-
* summarizer can write a *real* digest instead of the
|
|
84
|
-
* no-model local stub. Omitted when no model is bound.
|
|
85
|
-
* - `contextTokens` — the conductor's latest provider-reported context
|
|
86
|
-
* occupancy, an optional anchor for the slice planner.
|
|
87
|
-
*/
|
|
88
|
-
export interface CondenseOpts {
|
|
89
|
-
readonly force?: boolean;
|
|
90
|
-
readonly model?: Model<any>;
|
|
91
|
-
readonly contextTokens?: number;
|
|
92
|
-
/**
|
|
93
|
-
* Cancellation for a manual `/compact`. A hook MAY honor it mid-summarization;
|
|
94
|
-
* the conductor always checks it after the hook returns and discards the
|
|
95
|
-
* result when aborted, so even a hook that ignores the signal cancels cleanly.
|
|
96
|
-
*/
|
|
97
|
-
readonly signal?: AbortSignal;
|
|
98
|
-
/**
|
|
99
|
-
* The bound model's credential, resolved through the session's per-call key
|
|
100
|
-
* resolver. Forwarded so the summarizer authenticates exactly like a turn —
|
|
101
|
-
* server-tier sessions have no env-var fallback for this.
|
|
102
|
-
*/
|
|
103
|
-
readonly apiKey?: string;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* The pluggable condense hook. Given the active branch's messages (and an options
|
|
107
|
-
* bag), it returns the (smaller) message list to replace it with. The live
|
|
108
|
-
* window-budget engine is wired in `boot/runners/session.ts`; the
|
|
109
|
-
* {@link noopCondense} default is an identity transform that ignores the opts.
|
|
110
|
-
*/
|
|
111
|
-
export type CondenseFn = (messages: AgentMessage[], opts?: CondenseOpts) => AgentMessage[] | Promise<AgentMessage[]>;
|
|
112
|
-
/** The default condense hook: returns the input unchanged (no-op), ignoring opts. */
|
|
113
|
-
export declare const noopCondense: CondenseFn;
|
|
114
|
-
/** Tuning for the transient-fault auto-retry. */
|
|
115
|
-
export interface RetryPolicy {
|
|
116
|
-
/** Maximum retry attempts after the first try (default 2). */
|
|
117
|
-
readonly maxAttempts: number;
|
|
118
|
-
/** Base backoff in ms; doubled per attempt (default 250). */
|
|
119
|
-
readonly baseDelayMs: number;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Injectable collaborators. Every field is optional; the factory supplies a live
|
|
123
|
-
* default (a real `Agent`, an in-memory `TranscriptStore`, a fresh `SignalHub`, a
|
|
124
|
-
* matcher over the live catalog). Tests override exactly what they need.
|
|
125
|
-
*/
|
|
126
|
-
export interface ConductorDeps {
|
|
127
|
-
/** The framework agent (or a scripted fake). */
|
|
128
|
-
readonly agent?: AgentLike;
|
|
129
|
-
/** Where the transcript persists. */
|
|
130
|
-
readonly store?: TranscriptStore;
|
|
131
|
-
/** The product-signal fan-out. */
|
|
132
|
-
readonly hub?: SignalHub;
|
|
133
|
-
/** Resolves model ids/patterns to catalog cards. */
|
|
134
|
-
readonly matcher?: ModelMatcher;
|
|
135
|
-
/** The condense hook used by the auto-compaction seam. */
|
|
136
|
-
readonly condense?: CondenseFn;
|
|
137
|
-
/** Auto-retry tuning. */
|
|
138
|
-
readonly retry?: RetryPolicy;
|
|
139
|
-
/**
|
|
140
|
-
* Legacy branch-length condense threshold. The auto path is now token-gated
|
|
141
|
-
* ({@link isOverBudget}), so this field is accepted but no longer governs when
|
|
142
|
-
* auto-compaction fires; kept for back-compat with callers that pass it.
|
|
143
|
-
*/
|
|
144
|
-
readonly compactAt?: number;
|
|
145
|
-
/** Sleep primitive (injected so tests don't actually wait). */
|
|
146
|
-
readonly sleep?: (ms: number) => Promise<void>;
|
|
147
|
-
/**
|
|
148
|
-
* Post-edit live-diagnostics control. Pass a ready {@link DiagnosticsEngine} to
|
|
149
|
-
* inject one directly (tests), a {@link DiagnosticsConfig} to tune the default
|
|
150
|
-
* engine, or omit it to get the default: ON when `workspace` has a
|
|
151
|
-
* `tsconfig.json` (eslint runner added when an eslint config is present),
|
|
152
|
-
* otherwise inert. Set `{ enabled: false }` to opt out entirely.
|
|
153
|
-
*/
|
|
154
|
-
readonly diagnostics?: DiagnosticsEngine | DiagnosticsConfig;
|
|
155
|
-
}
|
|
156
|
-
/** The transitions the reducer understands — fresh vocabulary, all typed. */
|
|
157
|
-
type StateAction = {
|
|
158
|
-
readonly type: "phase";
|
|
159
|
-
readonly phase: ConductorPhase;
|
|
160
|
-
} | {
|
|
161
|
-
readonly type: "head";
|
|
162
|
-
readonly head: SessionHead;
|
|
163
|
-
} | {
|
|
164
|
-
readonly type: "usage";
|
|
165
|
-
readonly usage: Usage;
|
|
166
|
-
readonly contextTokens: number;
|
|
167
|
-
} | {
|
|
168
|
-
readonly type: "model";
|
|
169
|
-
readonly modelId: string;
|
|
170
|
-
} | {
|
|
171
|
-
readonly type: "fault";
|
|
172
|
-
readonly fault: ConductorFault;
|
|
173
|
-
} | {
|
|
174
|
-
readonly type: "settled";
|
|
175
|
-
};
|
|
176
|
-
/**
|
|
177
|
-
* Pure transition over {@link ConductorState}. Always returns a brand-new object;
|
|
178
|
-
* the previous state is never mutated. `settled` clears a stale fault and returns
|
|
179
|
-
* to `idle`; `fault` records the fault and flips to `faulted`.
|
|
180
|
-
*/
|
|
181
|
-
export declare function reduceState(prev: ConductorState, action: StateAction): ConductorState;
|
|
182
|
-
/**
|
|
183
|
-
* Construct a {@link SessionConductor}.
|
|
184
|
-
*
|
|
185
|
-
* Resolves (or accepts) every collaborator, then returns the orchestrator:
|
|
186
|
-
* - **Agent** — `deps.agent` if supplied (the scripted-fake seam tests use),
|
|
187
|
-
* else a live framework `Agent` bound to the model `options.modelId` resolves
|
|
188
|
-
* to via the {@link ModelMatcher} over the {@link ModelCatalog}.
|
|
189
|
-
* - **Store** — `deps.store` if supplied, else a fresh in-memory
|
|
190
|
-
* {@link TranscriptStore} for a new session id.
|
|
191
|
-
* - **Hub / matcher / condense / retry** — defaulted from `deps` or fresh.
|
|
192
|
-
*
|
|
193
|
-
* The conductor's public verbs (`submit`, `subscribe`, `abort`, `snapshot`,
|
|
194
|
-
* `resume`, `cycleModel`) all read against this assembly.
|
|
195
|
-
*
|
|
196
|
-
* @param options session configuration (`modelId` required; system/tools/thinking/
|
|
197
|
-
* workspace/autoCompact optional)
|
|
198
|
-
* @param deps injectable collaborators; all optional, live defaults supplied
|
|
199
|
-
*/
|
|
200
|
-
export declare function createSessionConductor(options: SessionConductorOptions, deps?: ConductorDeps): SessionConductor;
|
|
201
|
-
/**
|
|
202
|
-
* Return the framework model unchanged, or — when a gateway base URL is set
|
|
203
|
-
* ("server mode") — a CLONE with its `baseUrl` swapped to the gateway so the
|
|
204
|
-
* request flows through the quota-enforcing indus-server. Never mutates the
|
|
205
|
-
* shared catalog card (always spreads into a fresh object). When
|
|
206
|
-
* `gatewayBaseUrl` is `undefined` the model is returned by reference, keeping
|
|
207
|
-
* the local-key path byte-for-byte unchanged.
|
|
208
|
-
*/
|
|
209
|
-
export declare function withGatewayBaseUrl<M extends {
|
|
210
|
-
baseUrl: string;
|
|
211
|
-
provider: string;
|
|
212
|
-
}>(model: M, gatewayBaseUrls: Record<string, string> | undefined): M;
|
|
213
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 2 conductor — core behavioral tests.
|
|
3
|
-
*
|
|
4
|
-
* Covers the pure, framework-independent surface of the conductor: the
|
|
5
|
-
* framework-event -> product-signal projector, the immutable state reducer, the
|
|
6
|
-
* typed fault constructor, the signal fan-out hub, and the re-derived skill-block
|
|
7
|
-
* parser. (The full submit() turn loop is exercised against the framework Agent
|
|
8
|
-
* by higher-level integration; these unit tests need no network and no disk.)
|
|
9
|
-
*/
|
|
10
|
-
export {};
|