indusagi-coding-agent 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/LICENSE +661 -0
- package/README.md +95 -1
- package/dist/entry.js +3205 -1585
- package/dist/guardrails.js +47 -515
- package/dist/index.js +3232 -1671
- package/package.json +8 -7
- package/dist/types/addons/addons.test.d.ts +0 -21
- package/dist/types/addons/contract.d.ts +0 -640
- package/dist/types/addons/dispatch/event-dispatcher.d.ts +0 -140
- package/dist/types/addons/dispatch/index.d.ts +0 -23
- package/dist/types/addons/dispatch/tool-interceptor.d.ts +0 -128
- package/dist/types/addons/host.d.ts +0 -246
- package/dist/types/addons/index.d.ts +0 -51
- package/dist/types/addons/manifest.d.ts +0 -56
- package/dist/types/addons/sandbox.d.ts +0 -103
- package/dist/types/addons/surface.d.ts +0 -42
- package/dist/types/boot/auth-vault.d.ts +0 -29
- package/dist/types/boot/boot.d.ts +0 -26
- package/dist/types/boot/boot.test.d.ts +0 -15
- package/dist/types/boot/contract.d.ts +0 -236
- package/dist/types/boot/index.d.ts +0 -20
- package/dist/types/boot/invocation.d.ts +0 -40
- package/dist/types/boot/invocation.test.d.ts +0 -8
- package/dist/types/boot/runners/addon-wiring.d.ts +0 -103
- package/dist/types/boot/runners/addon-wiring.test.d.ts +0 -19
- package/dist/types/boot/runners/checkpoint.d.ts +0 -133
- package/dist/types/boot/runners/checkpoint.test.d.ts +0 -12
- package/dist/types/boot/runners/delegate-runner.d.ts +0 -89
- package/dist/types/boot/runners/delegate-runner.test.d.ts +0 -13
- package/dist/types/boot/runners/index.d.ts +0 -13
- package/dist/types/boot/runners/link-runner.d.ts +0 -20
- package/dist/types/boot/runners/memdir.d.ts +0 -103
- package/dist/types/boot/runners/memdir.test.d.ts +0 -12
- package/dist/types/boot/runners/oneshot-runner.d.ts +0 -19
- package/dist/types/boot/runners/read-state.d.ts +0 -82
- package/dist/types/boot/runners/read-state.test.d.ts +0 -10
- package/dist/types/boot/runners/registry.d.ts +0 -30
- package/dist/types/boot/runners/repl-runner.d.ts +0 -19
- package/dist/types/boot/runners/session-persist.test.d.ts +0 -10
- package/dist/types/boot/runners/session.d.ts +0 -65
- package/dist/types/boot/runners/session.test.d.ts +0 -10
- package/dist/types/boot/stages.d.ts +0 -92
- package/dist/types/boot/upgrade/apply.d.ts +0 -45
- package/dist/types/boot/upgrade/index.d.ts +0 -13
- package/dist/types/boot/upgrade/upgrades.d.ts +0 -126
- package/dist/types/briefing/briefing.test.d.ts +0 -15
- package/dist/types/briefing/compose.d.ts +0 -37
- package/dist/types/briefing/context-docs.d.ts +0 -38
- package/dist/types/briefing/context-docs.test.d.ts +0 -18
- package/dist/types/briefing/contract.d.ts +0 -686
- package/dist/types/briefing/index.d.ts +0 -29
- package/dist/types/briefing/macros.d.ts +0 -206
- package/dist/types/briefing/skills.d.ts +0 -67
- package/dist/types/capability-deck/bridge-ledger/index.d.ts +0 -25
- package/dist/types/capability-deck/bridge-ledger/key.d.ts +0 -65
- package/dist/types/capability-deck/bridge-ledger/ledger.d.ts +0 -129
- package/dist/types/capability-deck/bridge-ledger/network.d.ts +0 -115
- package/dist/types/capability-deck/builtin-bridge.d.ts +0 -114
- package/dist/types/capability-deck/capability-deck.test.d.ts +0 -18
- package/dist/types/capability-deck/cards/bg-process-card.d.ts +0 -99
- package/dist/types/capability-deck/cards/index.d.ts +0 -37
- package/dist/types/capability-deck/cards/memory-card.d.ts +0 -68
- package/dist/types/capability-deck/cards/plan-file.d.ts +0 -56
- package/dist/types/capability-deck/cards/plan-tools.d.ts +0 -97
- package/dist/types/capability-deck/cards/plan-tools.test.d.ts +0 -9
- package/dist/types/capability-deck/cards/saas-card.d.ts +0 -78
- package/dist/types/capability-deck/cards/task-card.d.ts +0 -106
- package/dist/types/capability-deck/cards/todo-card.d.ts +0 -78
- package/dist/types/capability-deck/cards/workflow-card.d.ts +0 -55
- package/dist/types/capability-deck/cards/workflow-card.test.d.ts +0 -12
- package/dist/types/capability-deck/checkpoint.int.test.d.ts +0 -25
- package/dist/types/capability-deck/contract.d.ts +0 -317
- package/dist/types/capability-deck/index.d.ts +0 -46
- package/dist/types/capability-deck/manifest.d.ts +0 -60
- package/dist/types/capability-deck/provision.d.ts +0 -76
- package/dist/types/capability-deck/read-edit-gate.int.test.d.ts +0 -21
- package/dist/types/channels/channels.test.d.ts +0 -15
- package/dist/types/channels/contract.d.ts +0 -489
- package/dist/types/channels/framer.d.ts +0 -49
- package/dist/types/channels/index.d.ts +0 -24
- package/dist/types/channels/link/dialog.d.ts +0 -138
- package/dist/types/channels/link/driver.d.ts +0 -81
- package/dist/types/channels/link/index.d.ts +0 -13
- package/dist/types/channels/link/server.d.ts +0 -70
- package/dist/types/channels/oneshot.d.ts +0 -37
- package/dist/types/channels/ops.d.ts +0 -89
- package/dist/types/channels/session-ops.d.ts +0 -80
- package/dist/types/conductor/bash-guard.d.ts +0 -106
- package/dist/types/conductor/bash-guard.test.d.ts +0 -17
- package/dist/types/conductor/catalog/catalog.d.ts +0 -87
- package/dist/types/conductor/catalog/index.d.ts +0 -14
- package/dist/types/conductor/catalog/matcher.d.ts +0 -47
- package/dist/types/conductor/conductor.d.ts +0 -189
- package/dist/types/conductor/conductor.test.d.ts +0 -10
- package/dist/types/conductor/contract.d.ts +0 -774
- package/dist/types/conductor/diagnostics.d.ts +0 -183
- package/dist/types/conductor/diagnostics.test.d.ts +0 -10
- package/dist/types/conductor/index.d.ts +0 -26
- package/dist/types/conductor/permission-gate.integration.test.d.ts +0 -22
- package/dist/types/conductor/permission-wiring.test.d.ts +0 -14
- package/dist/types/conductor/permissions.d.ts +0 -217
- package/dist/types/conductor/permissions.test.d.ts +0 -12
- package/dist/types/conductor/plan-mode.integration.test.d.ts +0 -23
- package/dist/types/conductor/post-edit-diagnostics.test.d.ts +0 -13
- package/dist/types/conductor/signal-hub/hub.d.ts +0 -83
- package/dist/types/conductor/signal-hub/index.d.ts +0 -19
- package/dist/types/conductor/signal-hub/translate.d.ts +0 -77
- package/dist/types/conductor/skill-parse/index.d.ts +0 -10
- package/dist/types/conductor/skill-parse/parse.d.ts +0 -67
- package/dist/types/conductor/submit.test.d.ts +0 -28
- package/dist/types/conductor/transcript-store/index.d.ts +0 -16
- package/dist/types/conductor/transcript-store/serialize.d.ts +0 -106
- package/dist/types/conductor/transcript-store/serialize.test.d.ts +0 -10
- package/dist/types/conductor/transcript-store/store.d.ts +0 -188
- package/dist/types/console/components/AgentsView.d.ts +0 -41
- package/dist/types/console/components/BackgroundAgents.d.ts +0 -63
- package/dist/types/console/components/BackgroundAgents.test.d.ts +0 -8
- package/dist/types/console/components/Banner.d.ts +0 -110
- package/dist/types/console/components/Composer.d.ts +0 -37
- package/dist/types/console/components/StatusBar.d.ts +0 -42
- package/dist/types/console/components/TerminalConsole.d.ts +0 -32
- package/dist/types/console/components/WorkingIndicator.d.ts +0 -44
- package/dist/types/console/components/WorkingIndicator.test.d.ts +0 -9
- package/dist/types/console/components/banner-sweep.d.ts +0 -55
- package/dist/types/console/components/banner.test.d.ts +0 -9
- package/dist/types/console/components/welcome.d.ts +0 -115
- package/dist/types/console/components/welcome.test.d.ts +0 -9
- package/dist/types/console/console.test.d.ts +0 -19
- package/dist/types/console/contract.d.ts +0 -598
- package/dist/types/console/index.d.ts +0 -34
- package/dist/types/console/input/complete.d.ts +0 -120
- package/dist/types/console/input/dir-reader.d.ts +0 -28
- package/dist/types/console/input/index.d.ts +0 -24
- package/dist/types/console/input/input.test.d.ts +0 -14
- package/dist/types/console/input/keymap.d.ts +0 -193
- package/dist/types/console/input/paste.d.ts +0 -131
- package/dist/types/console/mount.d.ts +0 -53
- package/dist/types/console/overlays/approval-queue.d.ts +0 -71
- package/dist/types/console/overlays/approval.d.ts +0 -104
- package/dist/types/console/overlays/approval.test.d.ts +0 -17
- package/dist/types/console/overlays/auth.d.ts +0 -31
- package/dist/types/console/overlays/boards.d.ts +0 -55
- package/dist/types/console/overlays/host.d.ts +0 -45
- package/dist/types/console/overlays/index.d.ts +0 -15
- package/dist/types/console/overlays/pickers.d.ts +0 -37
- package/dist/types/console/overlays/sessions.d.ts +0 -29
- package/dist/types/console/reducer.d.ts +0 -51
- package/dist/types/console/slash/builtins.d.ts +0 -33
- package/dist/types/console/slash/commands/dynamic.d.ts +0 -57
- package/dist/types/console/slash/commands/dynamic.test.d.ts +0 -9
- package/dist/types/console/slash/commands/integrations.d.ts +0 -28
- package/dist/types/console/slash/commands/integrations.test.d.ts +0 -18
- package/dist/types/console/slash/commands/shared.d.ts +0 -72
- package/dist/types/console/slash/commands/transcript.d.ts +0 -24
- package/dist/types/console/slash/commands/transcript.test.d.ts +0 -10
- package/dist/types/console/slash/commands/workbench.d.ts +0 -21
- package/dist/types/console/slash/commands/workbench.test.d.ts +0 -10
- package/dist/types/console/slash/index.d.ts +0 -34
- package/dist/types/console/slash/registry.d.ts +0 -90
- package/dist/types/console/slash/resolve.d.ts +0 -109
- package/dist/types/console/slash/slash.test.d.ts +0 -18
- package/dist/types/console/startup.d.ts +0 -119
- package/dist/types/console/theme/adapter.d.ts +0 -79
- package/dist/types/console/theme/index.d.ts +0 -18
- package/dist/types/console/theme/palette.d.ts +0 -77
- package/dist/types/console/theme/resolve.d.ts +0 -45
- package/dist/types/console/theme/theme.test.d.ts +0 -16
- package/dist/types/console/theme/tokens.d.ts +0 -62
- package/dist/types/entry.d.ts +0 -17
- package/dist/types/guardrails.d.ts +0 -33
- package/dist/types/index.d.ts +0 -24
- package/dist/types/insight/channel.d.ts +0 -45
- package/dist/types/insight/contract.d.ts +0 -411
- package/dist/types/insight/index.d.ts +0 -26
- package/dist/types/insight/insight.test.d.ts +0 -17
- package/dist/types/insight/recorder.d.ts +0 -63
- package/dist/types/insight/redaction.d.ts +0 -44
- package/dist/types/insight/replay.d.ts +0 -77
- package/dist/types/insight/sampling.d.ts +0 -84
- package/dist/types/insight/serialize.d.ts +0 -54
- package/dist/types/insight/sinks/console.d.ts +0 -36
- package/dist/types/insight/sinks/file.d.ts +0 -37
- package/dist/types/insight/sinks/index.d.ts +0 -16
- package/dist/types/insight/sinks/stream.d.ts +0 -53
- package/dist/types/kit/clipboard-image.d.ts +0 -40
- package/dist/types/kit/external-editor.d.ts +0 -35
- package/dist/types/kit/image.d.ts +0 -102
- package/dist/types/kit/index.d.ts +0 -29
- package/dist/types/kit/kit.test.d.ts +0 -13
- package/dist/types/kit/shell.d.ts +0 -50
- package/dist/types/kit/tool-fetch.d.ts +0 -165
- package/dist/types/launch/catalog.d.ts +0 -51
- package/dist/types/launch/contract.d.ts +0 -387
- package/dist/types/launch/credentials.d.ts +0 -112
- package/dist/types/launch/index.d.ts +0 -28
- package/dist/types/launch/invocation/attachments.d.ts +0 -72
- package/dist/types/launch/invocation/flags.d.ts +0 -59
- package/dist/types/launch/invocation/index.d.ts +0 -23
- package/dist/types/launch/invocation/read.d.ts +0 -52
- package/dist/types/launch/invocation/usage.d.ts +0 -25
- package/dist/types/launch/launch.test.d.ts +0 -20
- package/dist/types/launch/oauth.d.ts +0 -101
- package/dist/types/launch/packages.d.ts +0 -75
- package/dist/types/launch/packages.test.d.ts +0 -15
- package/dist/types/launch/pickers.d.ts +0 -97
- package/dist/types/runtime-bridge/bridges/_drive.d.ts +0 -74
- package/dist/types/runtime-bridge/bridges/builtins.d.ts +0 -77
- package/dist/types/runtime-bridge/bridges/claude-cli.d.ts +0 -37
- package/dist/types/runtime-bridge/bridges/codex-cli.d.ts +0 -27
- package/dist/types/runtime-bridge/bridges/index.d.ts +0 -15
- package/dist/types/runtime-bridge/bridges/indusagi-cli.d.ts +0 -36
- package/dist/types/runtime-bridge/broker.d.ts +0 -182
- package/dist/types/runtime-bridge/contract.d.ts +0 -436
- package/dist/types/runtime-bridge/index.d.ts +0 -21
- package/dist/types/runtime-bridge/runtime-bridge.test.d.ts +0 -17
- package/dist/types/runtime-bridge/sink.d.ts +0 -59
- package/dist/types/sessions/contract.d.ts +0 -79
- package/dist/types/sessions/index.d.ts +0 -11
- package/dist/types/sessions/library.d.ts +0 -95
- package/dist/types/sessions/sessions.test.d.ts +0 -11
- package/dist/types/settings/contract.d.ts +0 -175
- package/dist/types/settings/index.d.ts +0 -13
- package/dist/types/settings/manager.d.ts +0 -109
- package/dist/types/settings/settings.test.d.ts +0 -16
- package/dist/types/transcript-export/index.d.ts +0 -20
- package/dist/types/transcript-export/publish.d.ts +0 -81
- package/dist/types/transcript-export/sgr.d.ts +0 -90
- package/dist/types/transcript-export/template.d.ts +0 -64
- package/dist/types/transcript-export/theme-bridge.d.ts +0 -99
- package/dist/types/transcript-export/transcript-export.test.d.ts +0 -16
- package/dist/types/window-budget/budget/estimate.d.ts +0 -47
- package/dist/types/window-budget/budget/gate.d.ts +0 -37
- package/dist/types/window-budget/budget/index.d.ts +0 -14
- package/dist/types/window-budget/budget/slice.d.ts +0 -38
- package/dist/types/window-budget/condenser.d.ts +0 -73
- package/dist/types/window-budget/contract.d.ts +0 -182
- package/dist/types/window-budget/index.d.ts +0 -17
- package/dist/types/window-budget/microcompact.d.ts +0 -68
- package/dist/types/window-budget/microcompact.test.d.ts +0 -16
- package/dist/types/window-budget/rehydrate.d.ts +0 -56
- package/dist/types/window-budget/summarize/condense.d.ts +0 -70
- package/dist/types/window-budget/summarize/index.d.ts +0 -12
- package/dist/types/window-budget/summarize/prompt.d.ts +0 -56
- package/dist/types/window-budget/window-budget.test.d.ts +0 -18
- package/dist/types/workflow-engine/agent-runner.d.ts +0 -105
- package/dist/types/workflow-engine/agent-runner.test.d.ts +0 -8
- package/dist/types/workflow-engine/display.d.ts +0 -148
- package/dist/types/workflow-engine/display.test.d.ts +0 -1
- package/dist/types/workflow-engine/engine.d.ts +0 -183
- package/dist/types/workflow-engine/engine.test.d.ts +0 -1
- package/dist/types/workflow-engine/index.d.ts +0 -21
- package/dist/types/workflow-engine/parse.d.ts +0 -64
- package/dist/types/workflow-engine/parse.test.d.ts +0 -1
- package/dist/types/workflow-engine/structured-output.d.ts +0 -51
- package/dist/types/workflow-engine/structured-output.test.d.ts +0 -1
- package/dist/types/workspace/brand.d.ts +0 -26
- package/dist/types/workspace/index.d.ts +0 -11
- package/dist/types/workspace/locator.d.ts +0 -50
- package/dist/types/workspace/runtime-detect.d.ts +0 -56
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 5 runtime-bridge — behavioral tests.
|
|
3
|
-
*
|
|
4
|
-
* Exercises the provider-routing layer end to end with **no real CLI spawned**:
|
|
5
|
-
* every external exchange is driven over a hand-written fake {@link ChildTransport}
|
|
6
|
-
* that replays scripted {@link ChildMessage}s. Four properties are pinned:
|
|
7
|
-
*
|
|
8
|
-
* (1) the single {@link BridgeEventSink} maps a {@link NormalizedEvent} sequence
|
|
9
|
-
* onto the right framework {@link AssistantMessageEventStream} events;
|
|
10
|
-
* (2) the `claude-cli` {@link RuntimeBridge}, driven over a fake transport,
|
|
11
|
-
* produces a text + finish event stream;
|
|
12
|
-
* (3) {@link RuntimeBroker.route} (and the dispatch half, `exchange`) picks the
|
|
13
|
-
* external bridge for a model carrying an {@link ExternalRuntimeSpec} and the
|
|
14
|
-
* framework path otherwise;
|
|
15
|
-
* (4) `requiresCredential` reflects the spec's `authMode`.
|
|
16
|
-
*/
|
|
17
|
-
export {};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The single {@link BridgeEventSink} implementation — the one place the
|
|
3
|
-
* imperative push-stream idiom every bridge shares is written down.
|
|
4
|
-
*
|
|
5
|
-
* Each external runtime emits its own wire dialect; a bridge's parser maps that
|
|
6
|
-
* dialect onto the provider-neutral {@link NormalizedEvent} union and drives a
|
|
7
|
-
* sink. This module owns everything else:
|
|
8
|
-
*
|
|
9
|
-
* - the accumulating {@link AssistantMessage} `partial` that every framework
|
|
10
|
-
* event carries (built in-place exactly like the framework's own producers,
|
|
11
|
-
* so a runtime-backed turn is indistinguishable from a network turn to the
|
|
12
|
-
* consumer);
|
|
13
|
-
* - the content-block index bookkeeping (a block's index is its position in
|
|
14
|
-
* `partial.content`, opened lazily on first emission of its kind);
|
|
15
|
-
* - the lazily-started lifecycle (`start` is implicit on first emission, and
|
|
16
|
-
* idempotent) and the terminal `finishSuccess` / `finishError` settle;
|
|
17
|
-
* - the `NormalizedEvent -> framework event` mapping, in {@link emit}, so the
|
|
18
|
-
* per-bridge code stays a pure parser.
|
|
19
|
-
*
|
|
20
|
-
* The framework push surface this writes through —
|
|
21
|
-
* `pushStart / pushTextStart / pushTextDelta / pushTextEnd /
|
|
22
|
-
* pushThinkingStart / pushThinkingDelta / pushThinkingEnd /
|
|
23
|
-
* pushToolCallStart / pushToolCallDelta / pushToolCallEnd /
|
|
24
|
-
* pushDone / pushError` on {@link AssistantMessageEventStream} — is consumed
|
|
25
|
-
* verbatim from the framework; this module never re-derives event shapes.
|
|
26
|
-
*
|
|
27
|
-
* Streaming contract honored (matching the framework's own adapters): a text or
|
|
28
|
-
* thinking block opens with a `*_start` once the block has been appended to
|
|
29
|
-
* `partial.content`, streams `*_delta`s while the running content accumulates
|
|
30
|
-
* in-place, and closes with a `*_end` carrying the final content. A tool call is
|
|
31
|
-
* a single self-contained block (`start -> delta(args) -> end`). The terminal
|
|
32
|
-
* `done` / `error` event carries the fully-accumulated message.
|
|
33
|
-
*/
|
|
34
|
-
import type { AssistantMessage, BridgeEventSink } from "./contract";
|
|
35
|
-
/**
|
|
36
|
-
* The model-identity fields stamped onto every `partial` {@link AssistantMessage}
|
|
37
|
-
* the sink emits. A bridge supplies these from the bound {@link Model} so a
|
|
38
|
-
* runtime-backed turn reports the same `api` / `provider` / `model` triple a
|
|
39
|
-
* network turn would — keeping the accumulated message uniform regardless of
|
|
40
|
-
* which path produced it.
|
|
41
|
-
*/
|
|
42
|
-
export interface BridgeMessageSeed {
|
|
43
|
-
/** The bound model's `api` dialect identifier. */
|
|
44
|
-
readonly api: AssistantMessage["api"];
|
|
45
|
-
/** The bound model's provider slug. */
|
|
46
|
-
readonly provider: AssistantMessage["provider"];
|
|
47
|
-
/** The bound model's id (the value stamped into `AssistantMessage.model`). */
|
|
48
|
-
readonly model: string;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Construct a {@link BridgeEventSink} seeded with the bound model's identity.
|
|
52
|
-
* The single sanctioned way a bridge obtains a sink: it creates one, drives it
|
|
53
|
-
* with {@link NormalizedEvent}s (or the convenience emitters), and returns
|
|
54
|
-
* {@link BridgeEventSink.stream}. The imperative push idiom lives entirely
|
|
55
|
-
* inside the returned sink.
|
|
56
|
-
*
|
|
57
|
-
* @param seed the bound model's `api` / `provider` / `model` identity
|
|
58
|
-
*/
|
|
59
|
-
export declare function createBridgeSink(seed: BridgeMessageSeed): BridgeEventSink;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session Library contract — the value types the library surface speaks in.
|
|
3
|
-
*
|
|
4
|
-
* The library sits on top of the conductor's persistent transcript store: it
|
|
5
|
-
* enumerates the session files a workspace has accumulated, opens one back into
|
|
6
|
-
* a live {@link TranscriptStore}, and projects the resulting node tree into the
|
|
7
|
-
* flat shapes a navigator and a forking picker consume.
|
|
8
|
-
*
|
|
9
|
-
* These records are the *catalog/navigation* projections — the minimum a chooser
|
|
10
|
-
* UI needs. They deliberately hold no framework message objects: text is already
|
|
11
|
-
* reduced to a short preview, and identity is carried by stable string ids so a
|
|
12
|
-
* caller can list, rename, delete, walk, and fork without rehydrating payloads.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* One persisted session as the library catalogs it — what a chooser shows in a
|
|
16
|
-
* list before anything is opened.
|
|
17
|
-
*
|
|
18
|
-
* `id` is the bare session identifier (the filename stem the conductor's
|
|
19
|
-
* filesystem backend writes to); `path` is its absolute on-disk location. The
|
|
20
|
-
* remaining fields are best-effort enrichments filled when the library is asked
|
|
21
|
-
* to peek inside a file: a derived `name`, file `lastModified`/`size`, the
|
|
22
|
-
* `messageCount` of conversational nodes, and a short `preview` of the opening
|
|
23
|
-
* user turn. Any of them may be absent when only a shallow listing was taken.
|
|
24
|
-
*/
|
|
25
|
-
export interface SavedSession {
|
|
26
|
-
/** Bare session identifier — the filename stem, no extension or directory. */
|
|
27
|
-
readonly id: string;
|
|
28
|
-
/** Absolute on-disk path the session persists to. */
|
|
29
|
-
readonly path: string;
|
|
30
|
-
/** Human-facing label for the session, when one could be derived. */
|
|
31
|
-
readonly name?: string;
|
|
32
|
-
/** Last-modified wall-clock time of the file, in epoch milliseconds. */
|
|
33
|
-
readonly lastModified?: number;
|
|
34
|
-
/** Byte size of the session file on disk. */
|
|
35
|
-
readonly size?: number;
|
|
36
|
-
/** Count of conversational (user/assistant/tool) nodes in the transcript. */
|
|
37
|
-
readonly messageCount?: number;
|
|
38
|
-
/** Short single-line excerpt of the opening turn, for at-a-glance recognition. */
|
|
39
|
-
readonly preview?: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* One row in the flattened view of a loaded transcript tree.
|
|
43
|
-
*
|
|
44
|
-
* The conductor stores a branchable tree of nodes; a navigator wants a single
|
|
45
|
-
* ordered list it can render and select against. Each {@link BranchNode} names
|
|
46
|
-
* its `id`, its `parent` link (so a caller can still reconstruct the tree),
|
|
47
|
-
* a render-ready `label`, the indentation `depth` from the root, and two flags:
|
|
48
|
-
* `isLeaf` for a tip of the tree and `isCurrent` for the node the active head
|
|
49
|
-
* points at.
|
|
50
|
-
*/
|
|
51
|
-
export interface BranchNode {
|
|
52
|
-
/** Stable id of the underlying transcript node. */
|
|
53
|
-
readonly id: string;
|
|
54
|
-
/** Parent node id, or `null` for a transcript root. */
|
|
55
|
-
readonly parent: string | null;
|
|
56
|
-
/** Render-ready, depth-indented one-line label. */
|
|
57
|
-
readonly label: string;
|
|
58
|
-
/** Distance from the root (a root is depth 0). */
|
|
59
|
-
readonly depth: number;
|
|
60
|
-
/** True when this node has no children — a tip of the tree. */
|
|
61
|
-
readonly isLeaf: boolean;
|
|
62
|
-
/** True when the active head currently points at this node. */
|
|
63
|
-
readonly isCurrent: boolean;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* A past user turn offered as a fork point.
|
|
67
|
-
*
|
|
68
|
-
* To re-ask or re-edit an earlier prompt, a caller picks one of these and the
|
|
69
|
-
* conductor branches the transcript at `entryId`. `text` is the full prompt
|
|
70
|
-
* text; `preview` is the trimmed single-line form a picker renders.
|
|
71
|
-
*/
|
|
72
|
-
export interface PriorTurn {
|
|
73
|
-
/** Id of the transcript node this user turn lives on (the fork target). */
|
|
74
|
-
readonly entryId: string;
|
|
75
|
-
/** Full text of the user prompt. */
|
|
76
|
-
readonly text: string;
|
|
77
|
-
/** Trimmed single-line excerpt of {@link text}, for display. */
|
|
78
|
-
readonly preview: string;
|
|
79
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sessions subsystem — public barrel.
|
|
3
|
-
*
|
|
4
|
-
* Exposes the {@link SessionLibrary} (the catalog-and-navigation layer over the
|
|
5
|
-
* conductor's persisted transcripts) and its value contract — the
|
|
6
|
-
* {@link SavedSession} catalog row, the {@link BranchNode} navigator row, and
|
|
7
|
-
* the {@link PriorTurn} fork candidate. Consumers import the session-library
|
|
8
|
-
* surface from `src/sessions` rather than reaching into the individual modules.
|
|
9
|
-
*/
|
|
10
|
-
export type { SavedSession, BranchNode, PriorTurn } from "./contract";
|
|
11
|
-
export { SessionLibrary, type SessionLibraryOptions } from "./library";
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SessionLibrary — the catalog-and-navigation layer over persisted transcripts.
|
|
3
|
-
*
|
|
4
|
-
* The conductor owns a single session at a time as a {@link TranscriptStore}.
|
|
5
|
-
* The library owns the *collection*: it scans the workspace `sessions/`
|
|
6
|
-
* directory for the NDJSON files the conductor's filesystem backend writes,
|
|
7
|
-
* lists them as {@link SavedSession} catalog rows, opens any one back into a
|
|
8
|
-
* live store via the store's own loader + {@link replay} reducer, and offers the
|
|
9
|
-
* two read projections a chooser UI needs — a flattened {@link BranchNode} tree
|
|
10
|
-
* for a branch navigator and a {@link PriorTurn} list for re-asking an earlier
|
|
11
|
-
* prompt. It also performs the two file-level mutations a manager needs:
|
|
12
|
-
* renaming and deleting a session on disk.
|
|
13
|
-
*
|
|
14
|
-
* The library never re-implements transcript parsing or message serialization —
|
|
15
|
-
* it delegates entirely to the conductor's transcript-store surface
|
|
16
|
-
* ({@link TranscriptStore}, {@link fsBackend}, {@link replay}). Its own logic is
|
|
17
|
-
* purely the directory enumeration, the tree flatten, and the text reduction.
|
|
18
|
-
*/
|
|
19
|
-
import { TranscriptStore } from "../conductor";
|
|
20
|
-
import type { BranchNode, PriorTurn, SavedSession } from "./contract";
|
|
21
|
-
/** Construction inputs — just the directory sessions live under. */
|
|
22
|
-
export interface SessionLibraryOptions {
|
|
23
|
-
/** Absolute path to the workspace `sessions/` directory. */
|
|
24
|
-
readonly sessionsDir: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The collection-level handle over a workspace's persisted sessions.
|
|
28
|
-
*
|
|
29
|
-
* Construct it with the resolved `sessionsDir` (from the workspace locator),
|
|
30
|
-
* then call {@link list} / {@link open} / {@link rename} / {@link remove} to
|
|
31
|
-
* manage files, and {@link tree} / {@link priorTurns} to project a loaded
|
|
32
|
-
* transcript for navigation and forking.
|
|
33
|
-
*/
|
|
34
|
-
export declare class SessionLibrary {
|
|
35
|
-
#private;
|
|
36
|
-
constructor(options: SessionLibraryOptions);
|
|
37
|
-
/** The sessions directory this library is rooted at. */
|
|
38
|
-
get directory(): string;
|
|
39
|
-
/**
|
|
40
|
-
* Enumerate persisted sessions as catalog rows, newest-modified first.
|
|
41
|
-
*
|
|
42
|
-
* Scans the directory for `*.ndjson` files and `stat`s each for its size and
|
|
43
|
-
* modification time. When `deep` is set, it also opens each file to fill in
|
|
44
|
-
* `messageCount` and the opening-turn `preview`; otherwise it returns the
|
|
45
|
-
* shallow rows (id/path/size/lastModified) so a large directory lists fast.
|
|
46
|
-
* A missing directory yields an empty list rather than an error.
|
|
47
|
-
*/
|
|
48
|
-
list(options?: {
|
|
49
|
-
readonly deep?: boolean;
|
|
50
|
-
}): Promise<SavedSession[]>;
|
|
51
|
-
/**
|
|
52
|
-
* Open a persisted session back into a live, hydrated {@link TranscriptStore},
|
|
53
|
-
* or return `null` when no file with that id exists.
|
|
54
|
-
*
|
|
55
|
-
* Delegates to the store's own static opener, which reads the backend and
|
|
56
|
-
* rebuilds state through the {@link replay} reducer — the library adds nothing
|
|
57
|
-
* to the rehydration beyond binding the filesystem backend.
|
|
58
|
-
*/
|
|
59
|
-
open(id: string): Promise<TranscriptStore | null>;
|
|
60
|
-
/**
|
|
61
|
-
* Rename a session file from one id to another, returning the new absolute
|
|
62
|
-
* path. The on-disk identifier *is* the filename stem, so this is a plain file
|
|
63
|
-
* move; the in-file head still names the old id, which the store tolerates on
|
|
64
|
-
* the next load (the head's leaf is what matters, not its session label).
|
|
65
|
-
*
|
|
66
|
-
* @throws if the source file is missing or the target id already exists.
|
|
67
|
-
*/
|
|
68
|
-
rename(fromId: string, toId: string): Promise<string>;
|
|
69
|
-
/**
|
|
70
|
-
* Delete a session file. Returns `true` when a file was removed, `false` when
|
|
71
|
-
* there was nothing to delete — never throws on an already-absent session.
|
|
72
|
-
*/
|
|
73
|
-
remove(id: string): Promise<boolean>;
|
|
74
|
-
/** Absolute path a session id persists to. */
|
|
75
|
-
pathOf(id: string): string;
|
|
76
|
-
/**
|
|
77
|
-
* Flatten a loaded transcript into an ordered {@link BranchNode} list for a
|
|
78
|
-
* tree navigator.
|
|
79
|
-
*
|
|
80
|
-
* Walks every node from each root downward in a stable depth-first order,
|
|
81
|
-
* emitting one row per node with its render label, depth indentation, leaf
|
|
82
|
-
* flag, and a current-marker derived from the store's active head. A node is a
|
|
83
|
-
* leaf when no other node names it as `parent`.
|
|
84
|
-
*/
|
|
85
|
-
tree(store: TranscriptStore): BranchNode[];
|
|
86
|
-
/**
|
|
87
|
-
* Extract the user prompts along a loaded transcript's active branch as fork
|
|
88
|
-
* candidates, in chronological order.
|
|
89
|
-
*
|
|
90
|
-
* Reads the root→leaf branch the store currently points at (the conversation
|
|
91
|
-
* the agent would replay) and keeps only the user-role nodes that carry real
|
|
92
|
-
* text, projecting each to a {@link PriorTurn} a forking picker can offer.
|
|
93
|
-
*/
|
|
94
|
-
priorTurns(store: TranscriptStore): PriorTurn[];
|
|
95
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SessionLibrary behavioral tests.
|
|
3
|
-
*
|
|
4
|
-
* Exercises the catalog-and-navigation layer end-to-end against a real temp
|
|
5
|
-
* `sessions/` directory: we seed a couple of sessions by driving real
|
|
6
|
-
* {@link TranscriptStore}s over a filesystem backend (so the on-disk NDJSON is
|
|
7
|
-
* the genuine format), then assert the library lists them, opens them, flattens
|
|
8
|
-
* the branch tree, and extracts prior user turns. File mutations (rename/remove)
|
|
9
|
-
* are checked too. No network, no framework agent — just disk + the store.
|
|
10
|
-
*/
|
|
11
|
-
export {};
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Settings subsystem — the typed surface of the user-tunable preferences an
|
|
3
|
-
* interactive coding-agent session reads at startup and while it runs.
|
|
4
|
-
*
|
|
5
|
-
* This module declares *only* shapes and frozen defaults — no I/O, no class, no
|
|
6
|
-
* filesystem. It is the single place every preference key is named, typed, and
|
|
7
|
-
* given a fallback. The two-tier manager ({@link "./manager"}) is written
|
|
8
|
-
* against the {@link Preferences} record declared here, and any console surface
|
|
9
|
-
* that toggles a preference reads its value through the same record.
|
|
10
|
-
*
|
|
11
|
-
* Design stance:
|
|
12
|
-
* - Every key is optional on the record so a partially-written file is a
|
|
13
|
-
* legal {@link Preferences} value; the manager fills the gaps from
|
|
14
|
-
* {@link DEFAULT_PREFERENCES} when a reader asks for a concrete value.
|
|
15
|
-
* - Reasoning-effort vocabulary is borrowed from the framework
|
|
16
|
-
* ({@link ThinkingLevel}) rather than re-declared, so the agent and the UI
|
|
17
|
-
* speak the same words.
|
|
18
|
-
* - The other small string unions ({@link ColourScheme} is a free string,
|
|
19
|
-
* while {@link EscapeAction}) pin the surfaces a console reads.
|
|
20
|
-
*/
|
|
21
|
-
import type { ThinkingLevel } from "indusagi/agent";
|
|
22
|
-
/** Re-exported framework reasoning vocabulary, surfaced through this contract. */
|
|
23
|
-
export type { ThinkingLevel };
|
|
24
|
-
/**
|
|
25
|
-
* What a double-tap of the escape key does in the interactive console.
|
|
26
|
-
*
|
|
27
|
-
* - `tree` — open the turn history as a navigable tree of branches.
|
|
28
|
-
* - `fork` — open the prior-turn picker to branch off an earlier turn.
|
|
29
|
-
* - `clear` — wipe the composer buffer.
|
|
30
|
-
*
|
|
31
|
-
* The legacy `rewind` / `branch` aliases are still accepted and treated as
|
|
32
|
-
* `fork` / `tree` respectively so an older preference file keeps working.
|
|
33
|
-
*/
|
|
34
|
-
export type EscapeAction = "tree" | "fork" | "clear" | "rewind" | "branch";
|
|
35
|
-
/** Every {@link EscapeAction} value, as a frozen tuple for menus and guards. */
|
|
36
|
-
export declare const ESCAPE_ACTIONS: readonly EscapeAction[];
|
|
37
|
-
/** Narrow an arbitrary value to a known {@link EscapeAction}. */
|
|
38
|
-
export declare function isEscapeAction(value: unknown): value is EscapeAction;
|
|
39
|
-
/**
|
|
40
|
-
* How a queue of pending turns (steering corrections or follow-up prompts) is
|
|
41
|
-
* drained back into the run.
|
|
42
|
-
*
|
|
43
|
-
* - `all` — release every queued turn at once on the next handoff.
|
|
44
|
-
* - `one-at-a-time` — release a single queued turn per handoff.
|
|
45
|
-
*/
|
|
46
|
-
export type DeliveryMode = "all" | "one-at-a-time";
|
|
47
|
-
/** Every {@link DeliveryMode} value, as a frozen tuple for menus and guards. */
|
|
48
|
-
export declare const DELIVERY_MODES: readonly DeliveryMode[];
|
|
49
|
-
/** Narrow an arbitrary value to a known {@link DeliveryMode}. */
|
|
50
|
-
export declare function isDeliveryMode(value: unknown): value is DeliveryMode;
|
|
51
|
-
/**
|
|
52
|
-
* How aggressively the per-tool permission gate auto-allows tool calls before it
|
|
53
|
-
* falls back to asking (or denying):
|
|
54
|
-
*
|
|
55
|
-
* - `default` — consult the allow/ask/deny rules; read-only tools are
|
|
56
|
-
* auto-allowed, anything else with no matching allow rule
|
|
57
|
-
* falls through to `ask`.
|
|
58
|
-
* - `acceptEdits` — additionally auto-allow filesystem edits/writes (the
|
|
59
|
-
* mutating edit/write/multiedit tools), leaving everything
|
|
60
|
-
* else on the `default` path.
|
|
61
|
-
* - `bypass` — allow every tool with no prompt (the unsafe "trust all"
|
|
62
|
-
* mode; `bypassPermissions` is accepted as an alias).
|
|
63
|
-
* - `plan` — deny every mutating tool outright (read-only research only)
|
|
64
|
-
* so the agent can plan without touching the workspace.
|
|
65
|
-
*/
|
|
66
|
-
export type PermissionMode = "default" | "acceptEdits" | "bypass" | "plan" | "bypassPermissions";
|
|
67
|
-
/** The canonical {@link PermissionMode} values, as a frozen tuple for menus/guards. */
|
|
68
|
-
export declare const PERMISSION_MODES: readonly PermissionMode[];
|
|
69
|
-
/** Narrow an arbitrary value to a known {@link PermissionMode} (folds the alias). */
|
|
70
|
-
export declare function isPermissionMode(value: unknown): value is PermissionMode;
|
|
71
|
-
/**
|
|
72
|
-
* The declarative permission policy a session reads at startup.
|
|
73
|
-
*
|
|
74
|
-
* `allow`/`ask`/`deny` are ordered lists of induscode-style rule strings — a bare
|
|
75
|
-
* tool name (`"Bash"`) or a tool name with an argument specifier
|
|
76
|
-
* (`"Bash(npm run test:*)"`). Across tiers the three lists are concatenated, and
|
|
77
|
-
* `deny` wins over `ask` wins over `allow`. `defaultMode` seeds the session's
|
|
78
|
-
* permission mode when no flag overrides it. Every field is optional so an empty
|
|
79
|
-
* `{}` (or an absent `permissions` key) keeps today's allow-all behavior.
|
|
80
|
-
*/
|
|
81
|
-
export interface PermissionSettings {
|
|
82
|
-
/** Rule strings that auto-allow a matching tool call (lowest precedence). */
|
|
83
|
-
allow?: string[];
|
|
84
|
-
/** Rule strings that force a matching tool call to prompt for approval. */
|
|
85
|
-
ask?: string[];
|
|
86
|
-
/** Rule strings that hard-block a matching tool call (highest precedence). */
|
|
87
|
-
deny?: string[];
|
|
88
|
-
/** The permission mode the session opens in when no flag overrides it. */
|
|
89
|
-
defaultMode?: PermissionMode;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Every preference an interactive coding-agent session reads, as one flat,
|
|
93
|
-
* fully-optional record.
|
|
94
|
-
*
|
|
95
|
-
* A value of this type may be the empty object (a brand-new install), a sparse
|
|
96
|
-
* project override, or a fully-populated global file — all three are legal.
|
|
97
|
-
* Concrete reads always go through the manager, which layers the project file
|
|
98
|
-
* over the global file over {@link DEFAULT_PREFERENCES}, so a reader never sees
|
|
99
|
-
* `undefined` for a key with a default.
|
|
100
|
-
*/
|
|
101
|
-
export interface Preferences {
|
|
102
|
-
/** Named colour scheme the console renders with (e.g. `"midnight"`). */
|
|
103
|
-
colourScheme?: string;
|
|
104
|
-
/** Whether inline image content is rendered in the transcript. */
|
|
105
|
-
showImages?: boolean;
|
|
106
|
-
/** Whether the model's reasoning / thinking text is shown as it streams. */
|
|
107
|
-
showReasoning?: boolean;
|
|
108
|
-
/** When true, the reasoning block is folded away even if the model emits one. */
|
|
109
|
-
hideThinking?: boolean;
|
|
110
|
-
/** Whether oversized images are shrunk to fit before being handed to a provider. */
|
|
111
|
-
imageAutoResize?: boolean;
|
|
112
|
-
/** When true, image content is withheld from providers entirely. */
|
|
113
|
-
blockImages?: boolean;
|
|
114
|
-
/** Whether discovered skills are surfaced as their own slash commands. */
|
|
115
|
-
enableSkillCommands?: boolean;
|
|
116
|
-
/** How queued steering corrections are released back into the run. */
|
|
117
|
-
steeringMode?: DeliveryMode;
|
|
118
|
-
/** How queued follow-up prompts are released back into the run. */
|
|
119
|
-
followUpMode?: DeliveryMode;
|
|
120
|
-
/** Prefer a condensed changelog after the console updates itself. */
|
|
121
|
-
collapseChangelog?: boolean;
|
|
122
|
-
/** Reveal the terminal's own cursor instead of the software-drawn caret. */
|
|
123
|
-
showHardwareCursor?: boolean;
|
|
124
|
-
/** Horizontal padding, in columns, around the prompt editor. */
|
|
125
|
-
editorPaddingX?: number;
|
|
126
|
-
/** Glob / id patterns selecting which models appear in the picker; empty means all. */
|
|
127
|
-
enabledModels?: string[];
|
|
128
|
-
/** Provider id the session defaults to when none is named (e.g. `"anthropic"`). */
|
|
129
|
-
defaultProvider?: string;
|
|
130
|
-
/** Model id the session opens with under {@link defaultProvider}. */
|
|
131
|
-
defaultModel?: string;
|
|
132
|
-
/** Reasoning effort the session requests by default. */
|
|
133
|
-
defaultThinkingLevel?: ThinkingLevel;
|
|
134
|
-
/** Suppress the banner / tips shown on a normal interactive launch. */
|
|
135
|
-
quietStartup?: boolean;
|
|
136
|
-
/**
|
|
137
|
-
* The last product version whose full masthead the user has already seen. The
|
|
138
|
-
* banner auto-condenses to a one-line header when this equals the running
|
|
139
|
-
* version (and nothing else demands the full block); it is rewritten to the
|
|
140
|
-
* running version after the full masthead is shown, so a launch only shows the
|
|
141
|
-
* big wordmark on the first sight of a version or a version bump.
|
|
142
|
-
*/
|
|
143
|
-
lastSeenVersion?: string;
|
|
144
|
-
/** Opt-in static colour-sweep flourish tinting the startup wordmark / emblem. */
|
|
145
|
-
logoSweep?: boolean;
|
|
146
|
-
/** When set, motion-flavoured flourishes (e.g. the logo sweep) are suppressed. */
|
|
147
|
-
reducedMotion?: boolean;
|
|
148
|
-
/** Whether the window-budget manager compacts the transcript automatically. */
|
|
149
|
-
autoCompact?: boolean;
|
|
150
|
-
/** What a double-escape does in the console. */
|
|
151
|
-
doubleEscapeAction?: EscapeAction;
|
|
152
|
-
/** Extension-package sources the launcher installs and loads (npm / git / local). */
|
|
153
|
-
extensionPackages?: string[];
|
|
154
|
-
/**
|
|
155
|
-
* The declarative tool-permission policy: ordered allow/ask/deny rule lists and
|
|
156
|
-
* the opening permission mode. Across the project/global tiers the rule lists
|
|
157
|
-
* are concatenated (not overridden) and `deny > ask > allow` decides; an absent
|
|
158
|
-
* value (or an empty object) preserves today's allow-all behavior.
|
|
159
|
-
*/
|
|
160
|
-
permissions?: PermissionSettings;
|
|
161
|
-
}
|
|
162
|
-
/** The set of legal preference keys, derived from {@link Preferences}. */
|
|
163
|
-
export type SettingKey = keyof Preferences;
|
|
164
|
-
/**
|
|
165
|
-
* The fallback value for every preference, used whenever neither the project
|
|
166
|
-
* nor the global tier supplies a key.
|
|
167
|
-
*
|
|
168
|
-
* Frozen so it can be shared without a defensive copy; the manager spreads it
|
|
169
|
-
* rather than mutating it. Every key in {@link Preferences} appears here with a
|
|
170
|
-
* concrete (non-`undefined`) value, which is what lets a typed reader resolve a
|
|
171
|
-
* guaranteed result.
|
|
172
|
-
*/
|
|
173
|
-
export declare const DEFAULT_PREFERENCES: Required<Preferences>;
|
|
174
|
-
/** Every preference key, as a frozen tuple for iteration and validation. */
|
|
175
|
-
export declare const SETTING_KEYS: readonly SettingKey[];
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Settings subsystem — public barrel.
|
|
3
|
-
*
|
|
4
|
-
* One import site for the typed {@link Preferences} record and its
|
|
5
|
-
* {@link SettingKey} / {@link EscapeAction} / {@link ThinkingLevel}
|
|
6
|
-
* vocabularies, the frozen {@link DEFAULT_PREFERENCES}, and the two-tier
|
|
7
|
-
* {@link PreferenceStore} reader/writer. Console surfaces and boot stages depend
|
|
8
|
-
* on this module rather than reaching into the individual files.
|
|
9
|
-
*/
|
|
10
|
-
export type { Preferences, SettingKey, EscapeAction, DeliveryMode, ThinkingLevel, PermissionMode, PermissionSettings, } from "./contract";
|
|
11
|
-
export { DEFAULT_PREFERENCES, SETTING_KEYS, ESCAPE_ACTIONS, isEscapeAction, DELIVERY_MODES, isDeliveryMode, PERMISSION_MODES, isPermissionMode, } from "./contract";
|
|
12
|
-
export { PreferenceStore } from "./manager";
|
|
13
|
-
export type { PreferenceLocations } from "./manager";
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Settings manager — the two-tier reader/writer over the preference record.
|
|
3
|
-
*
|
|
4
|
-
* Two files back the same {@link Preferences} shape:
|
|
5
|
-
*
|
|
6
|
-
* - the **global** file, one per machine, living in the resolved workspace
|
|
7
|
-
* profile directory ({@link Workspace.settingsPath});
|
|
8
|
-
* - the **project** file, one per checkout, living beside the working tree in
|
|
9
|
-
* a brand-named config directory.
|
|
10
|
-
*
|
|
11
|
-
* A read layers the project tier over the global tier over
|
|
12
|
-
* {@link DEFAULT_PREFERENCES}: a key set in the project file wins, then the
|
|
13
|
-
* global file, then the built-in default — so a reader of {@link PreferenceStore.get}
|
|
14
|
-
* always receives a concrete value. A write through {@link PreferenceStore.set}
|
|
15
|
-
* lands in the **project** tier only; the global file is left untouched, which
|
|
16
|
-
* keeps a per-checkout override from silently leaking machine-wide.
|
|
17
|
-
*
|
|
18
|
-
* Loading is tolerant: a missing file is the empty record, and a corrupt file
|
|
19
|
-
* (bad JSON, or a JSON value that is not an object) degrades to the empty record
|
|
20
|
-
* rather than throwing, so one mangled file never blocks startup.
|
|
21
|
-
*
|
|
22
|
-
* Construction is injectable. {@link PreferenceStore.fromWorkspace} resolves the
|
|
23
|
-
* two paths from a {@link Workspace} and the working directory; {@link PreferenceStore.atPaths}
|
|
24
|
-
* pins both paths directly, which is what the tests drive against a temp dir so
|
|
25
|
-
* the real home is never read or written.
|
|
26
|
-
*/
|
|
27
|
-
import type { Workspace } from "../boot/contract";
|
|
28
|
-
import { type Preferences, type SettingKey } from "./contract";
|
|
29
|
-
/**
|
|
30
|
-
* The resolved location of the two preference tiers.
|
|
31
|
-
*
|
|
32
|
-
* Both are absolute paths. The {@link global} file is machine-wide; the
|
|
33
|
-
* {@link project} file is per-checkout. Either may be absent on disk — the
|
|
34
|
-
* store treats a missing file as the empty record.
|
|
35
|
-
*/
|
|
36
|
-
export interface PreferenceLocations {
|
|
37
|
-
/** Machine-wide preference file (the global tier). */
|
|
38
|
-
readonly global: string;
|
|
39
|
-
/** Per-checkout preference file (the project tier). */
|
|
40
|
-
readonly project: string;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Two-tier preference store: project-over-global-over-default on read, and a
|
|
44
|
-
* project-tier write on save.
|
|
45
|
-
*
|
|
46
|
-
* Construct via {@link fromWorkspace} (resolve from the workspace + cwd) or
|
|
47
|
-
* {@link atPaths} (pin both files explicitly, as the tests do). Internally the
|
|
48
|
-
* two tiers are held in memory and refreshed from disk on construction and on
|
|
49
|
-
* {@link reload}; {@link set} stages a change into the in-memory project tier
|
|
50
|
-
* and {@link save} flushes it.
|
|
51
|
-
*/
|
|
52
|
-
export declare class PreferenceStore {
|
|
53
|
-
private readonly locations;
|
|
54
|
-
private globalTier;
|
|
55
|
-
private projectTier;
|
|
56
|
-
private constructor();
|
|
57
|
-
/**
|
|
58
|
-
* Build a store whose two tiers are pinned to explicit absolute paths.
|
|
59
|
-
*
|
|
60
|
-
* The direct seam used by tests: point both files at a temp dir and the real
|
|
61
|
-
* home is never touched. Neither file needs to exist yet.
|
|
62
|
-
*/
|
|
63
|
-
static atPaths(locations: PreferenceLocations): PreferenceStore;
|
|
64
|
-
/**
|
|
65
|
-
* Build a store from a resolved {@link Workspace} (global tier) and a working
|
|
66
|
-
* directory (project tier).
|
|
67
|
-
*
|
|
68
|
-
* The global file is {@link Workspace.settingsPath}; the project file is
|
|
69
|
-
* `<cwd>/<brand profile dir>/settings.json`, so a checkout carries its own
|
|
70
|
-
* overrides next to its source. `cwd` defaults to the process working
|
|
71
|
-
* directory.
|
|
72
|
-
*/
|
|
73
|
-
static fromWorkspace(workspace: Workspace, cwd?: string): PreferenceStore;
|
|
74
|
-
/** The two resolved file locations this store reads and writes. */
|
|
75
|
-
paths(): PreferenceLocations;
|
|
76
|
-
/** Re-read both tiers from disk, discarding any unsaved staged change. */
|
|
77
|
-
reload(): void;
|
|
78
|
-
/**
|
|
79
|
-
* Read one preference, resolved across the tiers.
|
|
80
|
-
*
|
|
81
|
-
* Precedence is project → global → {@link DEFAULT_PREFERENCES}: the first tier
|
|
82
|
-
* that defines the key (with a non-`undefined` value) wins. The return type is
|
|
83
|
-
* the concrete default-backed type for the key, so callers never branch on
|
|
84
|
-
* `undefined`.
|
|
85
|
-
*/
|
|
86
|
-
get<K extends SettingKey>(key: K): Required<Preferences>[K];
|
|
87
|
-
/**
|
|
88
|
-
* Stage a preference into the in-memory **project** tier.
|
|
89
|
-
*
|
|
90
|
-
* Does not write to disk on its own — call {@link save} to persist. Setting a
|
|
91
|
-
* key to `undefined` clears the project-tier override for it, letting the
|
|
92
|
-
* value fall back to the global tier or the default on the next read.
|
|
93
|
-
*/
|
|
94
|
-
set<K extends SettingKey>(key: K, value: Preferences[K]): void;
|
|
95
|
-
/** The fully-resolved snapshot: defaults under global under project. */
|
|
96
|
-
snapshot(): Required<Preferences>;
|
|
97
|
-
/** The raw in-memory project tier (the keys a checkout overrides). */
|
|
98
|
-
projectOverrides(): Preferences;
|
|
99
|
-
/** The raw in-memory global tier (machine-wide keys). */
|
|
100
|
-
globalDefaults(): Preferences;
|
|
101
|
-
/**
|
|
102
|
-
* Persist the staged in-memory **project** tier to its file.
|
|
103
|
-
*
|
|
104
|
-
* Writes the project tier only; the global file is never rewritten here, so a
|
|
105
|
-
* per-checkout `set` cannot mutate machine-wide preferences. Creates the
|
|
106
|
-
* containing directory if it is missing.
|
|
107
|
-
*/
|
|
108
|
-
save(): void;
|
|
109
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Settings subsystem — unit tests.
|
|
3
|
-
*
|
|
4
|
-
* Everything runs against a temp directory pinned through
|
|
5
|
-
* {@link PreferenceStore.atPaths}; the real home is never read or written. The
|
|
6
|
-
* tests pin the public store behaviour:
|
|
7
|
-
*
|
|
8
|
-
* 1. Defaults load: a store over two non-existent files resolves every key to
|
|
9
|
-
* its {@link DEFAULT_PREFERENCES} value.
|
|
10
|
-
* 2. Precedence: a key present in both tiers reads from the project tier, and
|
|
11
|
-
* a key present only globally still resolves; a corrupt project file falls
|
|
12
|
-
* back to defaults without throwing.
|
|
13
|
-
* 3. Round-trip: a `set` + `save` writes the project file, and a fresh store
|
|
14
|
-
* over the same paths reads the persisted value back.
|
|
15
|
-
*/
|
|
16
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transcript-export subsystem — public barrel.
|
|
3
|
-
*
|
|
4
|
-
* The HTML transcript publisher and its supporting machinery: the table-driven
|
|
5
|
-
* SGR painter ({@link paintSgr}) that turns terminal-styled output into safe HTML
|
|
6
|
-
* spans, the {@link ThemeBridge} that computes export colors from an
|
|
7
|
-
* {@link ExportTheme} via a WCAG luminance LUT, the regenerated page-shell
|
|
8
|
-
* {@link PAGE_SHELL} template with its `{{TOKEN}}` slots and {@link fill} helper,
|
|
9
|
-
* and {@link publishTranscript} which renders a session transcript to a
|
|
10
|
-
* standalone HTML document using `marked`, `highlight.js`, and the painter.
|
|
11
|
-
*
|
|
12
|
-
* Consumers import the publish surface from `src/transcript-export` rather than
|
|
13
|
-
* reaching into individual modules.
|
|
14
|
-
*/
|
|
15
|
-
export { paintSgr, tokenizeSgr, foldSgr, SGR_CODE_TABLE } from "./sgr";
|
|
16
|
-
export { DefaultThemeBridge, createThemeBridge, buildLuminanceLut, parseColor, formatColor, } from "./theme-bridge";
|
|
17
|
-
export { PAGE_SHELL, PAGE_STYLES, CLIENT_SCRIPT, fill, type SlotValues, } from "./template";
|
|
18
|
-
export { publishTranscript, type PublishEntry, type PublishMessage, type PublishRole, type MessagePart, } from "./publish";
|
|
19
|
-
export { FALLBACK_EXPORT_THEME, SHELL_SLOTS, SGR_INITIAL_STATE, briefingFault, } from "../briefing/contract";
|
|
20
|
-
export type { ExportTheme, ThemeBridge, ThemeMode, LuminanceLut, Rgb, SgrState, SgrToken, SgrMutation, PublishOptions, WidgetRender, TranscriptPart, ShellSlot, } from "../briefing/contract";
|