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,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token derivation — expand a raw {@link ThemePalette} into the semantic
|
|
3
|
-
* {@link ThemeTokens} the console actually renders against.
|
|
4
|
-
*
|
|
5
|
-
* The console body never names a hex or a palette stop; it names a *role*
|
|
6
|
-
* (`signal`, `frame`, `bodyText`, `alarm`, …). This module is the one place the
|
|
7
|
-
* thirteen roles are bound to ramp stops. The mapping is pure and total: every
|
|
8
|
-
* key of {@link ThemeTokens} is assigned exactly once from a {@link ThemePalette}
|
|
9
|
-
* field, so a ramp that is missing a stop fails to type-check rather than
|
|
10
|
-
* producing an undefined colour at render time.
|
|
11
|
-
*
|
|
12
|
-
* Role → stop assignments (identical structure for both schemes; the schemes
|
|
13
|
-
* differ only in the underlying ramp):
|
|
14
|
-
*
|
|
15
|
-
* - `signal` ← `primary` (the dominant accent: focus, selection)
|
|
16
|
-
* - `frame` ← `tertiary` (default structural border lines)
|
|
17
|
-
* - `quietFrame` ← `muted` (de-emphasised separators)
|
|
18
|
-
* - `promptSurface` ← `secondary` (the composer's active tint)
|
|
19
|
-
* - `cardAccent` ← `secondary` (row gutters and headers)
|
|
20
|
-
* - `bodyText` ← `body` (default answer foreground)
|
|
21
|
-
* - `mutedText` ← `muted` (timestamps, hints, metadata)
|
|
22
|
-
* - `inkText` ← `ink` (high-contrast text on an accent)
|
|
23
|
-
* - `notice` ← `tertiary` (informational tone)
|
|
24
|
-
* - `affirm` ← `affirm` (success tone)
|
|
25
|
-
* - `caution` ← `caution` (warning tone)
|
|
26
|
-
* - `alarm` ← `alarm` (error/fault tone)
|
|
27
|
-
* - `pending` ← `primary` (busy/in-flight tone)
|
|
28
|
-
*
|
|
29
|
-
* Rich-render roles (markdown / diff / syntax highlighting) are derived from the
|
|
30
|
-
* same nine stops so the rebuild's new styled-transcript / colored-diff /
|
|
31
|
-
* fenced-code surfaces recolour with the scheme and need no extra palette stop:
|
|
32
|
-
*
|
|
33
|
-
* - `codeInline` ← `primary` (inline code accent)
|
|
34
|
-
* - `heading` ← `primary` (heading accent)
|
|
35
|
-
* - `blockquoteBar` ← `muted` (dim quote bar)
|
|
36
|
-
* - `diffAddedBg` ← `affirm` darkened toward ink (added-line tint)
|
|
37
|
-
* - `diffRemovedBg` ← `alarm` darkened toward ink (removed-line tint)
|
|
38
|
-
* - `diffAddedText` ← `affirm` (added foreground / `+`)
|
|
39
|
-
* - `diffRemovedText` ← `alarm` (removed foreground / `-`)
|
|
40
|
-
* - `synKeyword` ← `primary` (keywords)
|
|
41
|
-
* - `synString` ← `affirm` (strings)
|
|
42
|
-
* - `synNumber` ← `caution` (numbers)
|
|
43
|
-
* - `synComment` ← `muted` (comments)
|
|
44
|
-
* - `synType` ← `tertiary` (types / classes)
|
|
45
|
-
*
|
|
46
|
-
* Deriving the two diff backgrounds (rather than adding raw stops) keeps the
|
|
47
|
-
* {@link ThemePalette} a flat nine-stop ramp while guaranteeing every scheme —
|
|
48
|
-
* including the color-blind variants — gets a legible `+`/`-` tint that tracks
|
|
49
|
-
* its own success/alarm hue.
|
|
50
|
-
*/
|
|
51
|
-
import type { ThemePalette, ThemeTokens } from "../contract";
|
|
52
|
-
/**
|
|
53
|
-
* Map a raw accent ramp onto the closed semantic token set.
|
|
54
|
-
*
|
|
55
|
-
* Pure and deterministic: the same palette always yields the same tokens, and
|
|
56
|
-
* the returned object is a fresh frozen value the resolver can cache. The role
|
|
57
|
-
* assignments are shared by both schemes — only the ramp handed in differs.
|
|
58
|
-
*
|
|
59
|
-
* @param palette the raw nine-stop ramp for a scheme
|
|
60
|
-
* @returns the full semantic token map (status + rich-render roles)
|
|
61
|
-
*/
|
|
62
|
-
export declare function deriveTokens(palette: ThemePalette): ThemeTokens;
|
package/dist/types/entry.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Process entry point — the bin the OS launches.
|
|
4
|
-
*
|
|
5
|
-
* Responsibilities, in order:
|
|
6
|
-
* 1. Set `process.title` to the brand's primary bin name so the process is
|
|
7
|
-
* identifiable in `ps` / activity monitors.
|
|
8
|
-
* 2. Install exactly one console filter that suppresses the transport-layer
|
|
9
|
-
* `[MCP]` noise the MCP stack emits on stdout/stderr (unless the brand's
|
|
10
|
-
* debug env var is set, in which case nothing is filtered).
|
|
11
|
-
* 3. Hand the sliced `argv` to {@link boot} and adopt its resolved exit code.
|
|
12
|
-
*
|
|
13
|
-
* The boot call is guarded by an `import.meta` entry check so importing this
|
|
14
|
-
* module (e.g. from a test) does not launch the agent — only running it as the
|
|
15
|
-
* program entry does.
|
|
16
|
-
*/
|
|
17
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thin guardrails entry — the headless, library-consumable surface of the
|
|
3
|
-
* indusagi coding agent.
|
|
4
|
-
*
|
|
5
|
-
* This barrel re-exports ONLY the deterministic guardrail primitives (the
|
|
6
|
-
* permission rule engine, the bash blocklist, prompt assembly, deck
|
|
7
|
-
* provisioning, and the read-before-edit / checkpoint stores). It deliberately
|
|
8
|
-
* imports from the LEAF modules — never the root `src/index.ts` barrel — so a
|
|
9
|
-
* consumer can pull in the guardrails without dragging in the Ink/React console
|
|
10
|
-
* tree (`export * as consoleUi from "./console"` lives only on the root barrel).
|
|
11
|
-
*
|
|
12
|
-
* Reachable from a published install as `indusagi-coding-agent/guardrails`.
|
|
13
|
-
*/
|
|
14
|
-
export { resolveRuleDecision, makeRule, createPermissionGate, READ_ONLY_TOOL_NAMES, EDIT_TOOL_NAMES, } from "./conductor/permissions";
|
|
15
|
-
export type { PermissionRule, PermissionMode, PermissionBehavior, PermissionDecision, } from "./conductor/permissions";
|
|
16
|
-
export { evaluateCatastrophic, bashSubcommandSubjects } from "./conductor/bash-guard";
|
|
17
|
-
export { composeBriefing } from "./briefing/compose";
|
|
18
|
-
export { gatherContextDocs } from "./briefing/context-docs";
|
|
19
|
-
export type { AgentTool, BriefingContext, ContextDoc } from "./briefing/contract";
|
|
20
|
-
export { provisionDeck } from "./capability-deck/provision";
|
|
21
|
-
export { createReadStateStore, READ_STATE_HANDLE_KEY, ReadStateStore } from "./boot/runners/read-state";
|
|
22
|
-
export { createCheckpointStore, CHECKPOINT_HANDLE_KEY, CheckpointStore } from "./boot/runners/checkpoint";
|
|
23
|
-
/**
|
|
24
|
-
* The byte-stable refusal emitted when an edit/write is attempted on a file the
|
|
25
|
-
* agent has not read this session.
|
|
26
|
-
*
|
|
27
|
-
* Surfaced here as the guardrails contract for consumers (e.g. eval fixtures)
|
|
28
|
-
* that assert the refusal verbatim. The literal is intentionally duplicated
|
|
29
|
-
* rather than re-exported because the upstream message lives only as a private
|
|
30
|
-
* module-local const in the framework's read-state gate — it is not part of any
|
|
31
|
-
* public barrel. A reword on either side must update both sites, by design.
|
|
32
|
-
*/
|
|
33
|
-
export declare const READ_BEFORE_EDIT_MESSAGE = "File has not been read yet. Read it first before writing to it.";
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Package root barrel — the public library surface of the indusagi coding agent.
|
|
3
|
-
*
|
|
4
|
-
* The terminal binary is `entry.ts` (the `indus` / `indusagi` bin). This barrel
|
|
5
|
-
* exposes each subsystem as a namespace for embedding or testing. The agent
|
|
6
|
-
* depends only on the `indusagi` framework package.
|
|
7
|
-
*/
|
|
8
|
-
export * as boot from "./boot";
|
|
9
|
-
export * as workspace from "./workspace";
|
|
10
|
-
export * as conductor from "./conductor";
|
|
11
|
-
export * as windowBudget from "./window-budget";
|
|
12
|
-
export * as capabilityDeck from "./capability-deck";
|
|
13
|
-
export * as runtimeBridge from "./runtime-bridge";
|
|
14
|
-
export * as addons from "./addons";
|
|
15
|
-
export * as consoleUi from "./console";
|
|
16
|
-
export * as channels from "./channels";
|
|
17
|
-
export * as briefing from "./briefing";
|
|
18
|
-
export * as transcriptExport from "./transcript-export";
|
|
19
|
-
export * as launch from "./launch";
|
|
20
|
-
export * as insight from "./insight";
|
|
21
|
-
export * as kit from "./kit";
|
|
22
|
-
export * as settings from "./settings";
|
|
23
|
-
export * as sessions from "./sessions";
|
|
24
|
-
export { VERSION } from "./workspace";
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Signal channel — the in-memory pipe between the recorder and the sinks.
|
|
3
|
-
*
|
|
4
|
-
* The recorder *pushes* {@link Signal}s the instant a probe opens, updates, or
|
|
5
|
-
* closes; a {@link Sink} *pulls* a {@link SignalStream} (an
|
|
6
|
-
* `AsyncIterable<Signal>`) and drains it at its own pace. A
|
|
7
|
-
* {@link SignalChannel} bridges those two models: it is an unbounded
|
|
8
|
-
* push-to-pull queue with back-pressure expressed by pull latency.
|
|
9
|
-
*
|
|
10
|
-
* Mechanics: when a consumer is parked in `next()` awaiting a value, an emitted
|
|
11
|
-
* signal resolves its promise immediately (no buffering). When no consumer is
|
|
12
|
-
* waiting, the signal is appended to an internal buffer and handed out in FIFO
|
|
13
|
-
* order on the next pull. Closing the channel makes the iterator finish once the
|
|
14
|
-
* buffer drains. The channel multiplexes: every call to {@link stream} returns an
|
|
15
|
-
* independent iterator, and each emitted signal is fanned out to all of them, so
|
|
16
|
-
* the console, file, and network sinks can each drain the same trail.
|
|
17
|
-
*/
|
|
18
|
-
import { SignalEmit, SignalStream } from "./contract";
|
|
19
|
-
/**
|
|
20
|
-
* A fan-out push-to-pull pipe of {@link Signal}s.
|
|
21
|
-
*
|
|
22
|
-
* The recorder holds the {@link SignalChannel.emit} end; each sink holds a
|
|
23
|
-
* {@link SignalStream} obtained from {@link SignalChannel.stream}. Producers
|
|
24
|
-
* never block: emitting onto a channel with no parked consumer just buffers.
|
|
25
|
-
*/
|
|
26
|
-
export interface SignalChannel {
|
|
27
|
-
/** Push one signal to every attached subscriber. A no-op once closed. */
|
|
28
|
-
readonly emit: SignalEmit;
|
|
29
|
-
/** Attach a new independent consumer; returns its pull-model stream. */
|
|
30
|
-
stream(): SignalStream;
|
|
31
|
-
/** How many subscribers are currently attached. */
|
|
32
|
-
readonly size: number;
|
|
33
|
-
/** Whether {@link close} has been called. */
|
|
34
|
-
readonly closed: boolean;
|
|
35
|
-
/** Finish every attached stream once its buffer drains. Idempotent. */
|
|
36
|
-
close(): void;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Create a fresh, empty {@link SignalChannel}.
|
|
40
|
-
*
|
|
41
|
-
* The returned channel starts with no subscribers; call {@link SignalChannel.stream}
|
|
42
|
-
* once per sink before emitting if those sinks must observe the first signal.
|
|
43
|
-
* (A subscriber only receives signals emitted after it attaches.)
|
|
44
|
-
*/
|
|
45
|
-
export declare function createChannel(): SignalChannel;
|
|
@@ -1,411 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Insight contract — the FROZEN type surface of the unified tracing system.
|
|
3
|
-
*
|
|
4
|
-
* `insight/` is the single observability plane of the coding agent. It collapses
|
|
5
|
-
* what used to be two overlapping tracing systems into one with a fresh, OTel-free
|
|
6
|
-
* vocabulary:
|
|
7
|
-
*
|
|
8
|
-
* - a {@link Trail} is a whole trace (the tree of work for one logical activity);
|
|
9
|
-
* - a {@link Probe} is one immutable timed segment within a trail (a span);
|
|
10
|
-
* - a {@link Signal} is one lifecycle event on the wire (open / update / close);
|
|
11
|
-
* - a {@link Recorder} mints trails and probes through a {@link SampleGate};
|
|
12
|
-
* - a {@link Sink} drains a stream of signals somewhere (console / file / network);
|
|
13
|
-
* - a {@link SecretRedactor} scrubs sensitive values before they reach a sink.
|
|
14
|
-
*
|
|
15
|
-
* This module declares *only* shapes plus a handful of inert, pure constants and
|
|
16
|
-
* guards — no I/O, no timers, no batching, no network. Every behaviour module in
|
|
17
|
-
* `insight/` (the recorder, the flush buffer, the sinks, the redactor, the agent
|
|
18
|
-
* bridges, the session rehydrator, the ledger, and the dashboard panel) is written
|
|
19
|
-
* against the names declared here, so this file is intentionally small,
|
|
20
|
-
* append-mostly, and stable.
|
|
21
|
-
*
|
|
22
|
-
* Design stance:
|
|
23
|
-
* - A {@link Probe} is a plain frozen value object, never a class instance and
|
|
24
|
-
* never mutated in place. The lifecycle (open -> note -> close) is expressed by
|
|
25
|
-
* producing *new* probe values; the behavioural face is the functional
|
|
26
|
-
* {@link ProbeHandle} (a small bag of closures: `note` / `child` / `fail` /
|
|
27
|
-
* `close`). There is no `BaseSpan` / `DefaultSpan` / `NoopSpan` inheritance
|
|
28
|
-
* shape: a sampled-out handle is the single frozen {@link NOOP_HANDLE} value.
|
|
29
|
-
* - Ids follow the W3C Trace Context sizing (128-bit trail ids, 64-bit probe
|
|
30
|
-
* ids) without depending on any OTel SDK. {@link TrailId} / {@link ProbeId}
|
|
31
|
-
* are nominal-ish branded strings so a probe id is never mistaken for a trail
|
|
32
|
-
* id at a call site.
|
|
33
|
-
* - The wire form is a closed {@link Signal} union discriminated by `phase`.
|
|
34
|
-
* A sink consumes signals; it never reaches into recorder internals.
|
|
35
|
-
* - Redaction is an attribute *processor* contract ({@link SecretRedactor}),
|
|
36
|
-
* applied by the pipeline before a signal reaches a sink, with the agent's
|
|
37
|
-
* own patterns and its own {@link REDACTED_TOKEN}.
|
|
38
|
-
*
|
|
39
|
-
* Nothing here imports the framework; `insight/` is framework-agnostic at the
|
|
40
|
-
* contract layer. The agent/ai-coupled bridges live in sibling modules and depend
|
|
41
|
-
* on `indusagi/agent` + `indusagi/ai` there, not here.
|
|
42
|
-
*/
|
|
43
|
-
/**
|
|
44
|
-
* A branded string naming a {@link Trail}.
|
|
45
|
-
*
|
|
46
|
-
* Lowercase hex, 32 chars (128 bits) by convention — the W3C Trace Context
|
|
47
|
-
* trace-id width. The brand is a phantom marker that exists only in the type
|
|
48
|
-
* system; at runtime a {@link TrailId} is just a `string`.
|
|
49
|
-
*/
|
|
50
|
-
export type TrailId = string & {
|
|
51
|
-
readonly __brand: "TrailId";
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* A branded string naming a {@link Probe}.
|
|
55
|
-
*
|
|
56
|
-
* Lowercase hex, 16 chars (64 bits) by convention — the W3C Trace Context
|
|
57
|
-
* span-id width. Distinct from {@link TrailId} so the two cannot be transposed.
|
|
58
|
-
*/
|
|
59
|
-
export type ProbeId = string & {
|
|
60
|
-
readonly __brand: "ProbeId";
|
|
61
|
-
};
|
|
62
|
-
/** The byte widths the id minter uses, kept as the single source of truth. */
|
|
63
|
-
export declare const ID_WIDTHS: {
|
|
64
|
-
/** A trail id is 16 random bytes -> 32 hex chars (128-bit). */
|
|
65
|
-
readonly trail: 16;
|
|
66
|
-
/** A probe id is 8 random bytes -> 16 hex chars (64-bit). */
|
|
67
|
-
readonly probe: 8;
|
|
68
|
-
};
|
|
69
|
-
/** Coerce a raw string into a {@link TrailId}. Inert — performs no validation. */
|
|
70
|
-
export declare function asTrailId(raw: string): TrailId;
|
|
71
|
-
/** Coerce a raw string into a {@link ProbeId}. Inert — performs no validation. */
|
|
72
|
-
export declare function asProbeId(raw: string): ProbeId;
|
|
73
|
-
/**
|
|
74
|
-
* The kind of work a {@link Probe} records.
|
|
75
|
-
*
|
|
76
|
-
* A small, closed set chosen for a coding agent rather than a generic span tree:
|
|
77
|
-
* - `run` — a whole agent run / top-level invocation (the trail root).
|
|
78
|
-
* - `turn` — one request/response turn inside a run.
|
|
79
|
-
* - `tool` — a single tool or side-effecting action execution.
|
|
80
|
-
* - `model` — a single model / LLM generation call.
|
|
81
|
-
* - `custom` — anything a caller wants to time that does not fit above.
|
|
82
|
-
*/
|
|
83
|
-
export type ProbeKind = "run" | "turn" | "tool" | "model" | "custom";
|
|
84
|
-
/** The closed set of {@link ProbeKind} values, ordered for display / iteration. */
|
|
85
|
-
export declare const PROBE_KINDS: readonly ProbeKind[];
|
|
86
|
-
/**
|
|
87
|
-
* The lifecycle status of a {@link Probe}.
|
|
88
|
-
*
|
|
89
|
-
* `open` while in flight; on close it becomes one of the two terminal states.
|
|
90
|
-
*/
|
|
91
|
-
export type ProbeStatus = "open" | "ok" | "error";
|
|
92
|
-
/** The two terminal {@link ProbeStatus} values a close may carry. */
|
|
93
|
-
export type ProbeOutcome = "ok" | "error";
|
|
94
|
-
/**
|
|
95
|
-
* A captured failure attached to a probe.
|
|
96
|
-
*
|
|
97
|
-
* Intentionally minimal and serializable — a message plus optional name and a
|
|
98
|
-
* pre-rendered stack string. A redactor may rewrite any of these fields.
|
|
99
|
-
*/
|
|
100
|
-
export interface ProbeFault {
|
|
101
|
-
/** Human-readable failure summary. Always present. */
|
|
102
|
-
readonly message: string;
|
|
103
|
-
/** The error constructor / category name, when known. */
|
|
104
|
-
readonly name?: string;
|
|
105
|
-
/** A pre-rendered stack trace, when captured. */
|
|
106
|
-
readonly stack?: string;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* An arbitrary structured annotation bag attached to a probe.
|
|
110
|
-
*
|
|
111
|
-
* A frozen, read-only map of JSON-ish values. The pipeline runs every bag
|
|
112
|
-
* through a {@link SecretRedactor} before it reaches a {@link Sink}.
|
|
113
|
-
*/
|
|
114
|
-
export type ProbeAttributes = Readonly<Record<string, unknown>>;
|
|
115
|
-
/**
|
|
116
|
-
* An immutable timed segment within a {@link Trail}.
|
|
117
|
-
*
|
|
118
|
-
* Every field is `readonly`; a probe value is frozen at construction and never
|
|
119
|
-
* mutated in place. Transitions (note / close) are modelled as *new* frozen
|
|
120
|
-
* values derived from a prior one, which keeps the data model trivially
|
|
121
|
-
* serializable. A probe with `endedAt === undefined` is still in flight.
|
|
122
|
-
*/
|
|
123
|
-
export interface Probe {
|
|
124
|
-
/** This probe's own id, unique within its trail. */
|
|
125
|
-
readonly id: ProbeId;
|
|
126
|
-
/** The trail this probe belongs to; shared by all of its kin. */
|
|
127
|
-
readonly trailId: TrailId;
|
|
128
|
-
/** The enclosing probe's {@link ProbeId}, or `null` for a trail root. */
|
|
129
|
-
readonly parentId: ProbeId | null;
|
|
130
|
-
/** What kind of work this probe records. */
|
|
131
|
-
readonly kind: ProbeKind;
|
|
132
|
-
/** Human-readable label for the probe. */
|
|
133
|
-
readonly name: string;
|
|
134
|
-
/** Wall-clock start, in epoch milliseconds. */
|
|
135
|
-
readonly startedAt: number;
|
|
136
|
-
/** Wall-clock end, in epoch milliseconds; `undefined` while still open. */
|
|
137
|
-
readonly endedAt?: number;
|
|
138
|
-
/** Lifecycle status. */
|
|
139
|
-
readonly status: ProbeStatus;
|
|
140
|
-
/** Arbitrary structured annotations; a frozen, read-only bag. */
|
|
141
|
-
readonly attributes: ProbeAttributes;
|
|
142
|
-
/** Present only once a probe has failed. */
|
|
143
|
-
readonly fault?: ProbeFault;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* The exported, serializable form of a *closed* {@link Probe}.
|
|
147
|
-
*
|
|
148
|
-
* Structurally a {@link Probe} guaranteed terminal: `endedAt` is a number (not
|
|
149
|
-
* `undefined`) and `status` is one of the two {@link ProbeOutcome} values. This
|
|
150
|
-
* is what a close {@link Signal} carries and what a {@link Sink} persists; it
|
|
151
|
-
* never appears for a probe still in flight.
|
|
152
|
-
*/
|
|
153
|
-
export interface ClosedProbe extends Probe {
|
|
154
|
-
readonly endedAt: number;
|
|
155
|
-
readonly status: ProbeOutcome;
|
|
156
|
-
}
|
|
157
|
-
/** Type guard: narrow a {@link Probe} to a terminal {@link ClosedProbe}. */
|
|
158
|
-
export declare function isClosedProbe(probe: Probe): probe is ClosedProbe;
|
|
159
|
-
/**
|
|
160
|
-
* The behavioural face of a single in-flight {@link Probe}.
|
|
161
|
-
*
|
|
162
|
-
* Where {@link Probe} is the immutable data, a {@link ProbeHandle} is the small
|
|
163
|
-
* bag of closures a caller actually uses. Each operation derives the next frozen
|
|
164
|
-
* probe value and emits a {@link Signal} onto an injected emit closure. There is
|
|
165
|
-
* no class hierarchy: a sampled-in handle is a plain object of closures and a
|
|
166
|
-
* sampled-out handle is the single frozen {@link NOOP_HANDLE}.
|
|
167
|
-
*
|
|
168
|
-
* Forgiving lifecycle: `note`, `child`, and `fail` are no-ops after `close`, and
|
|
169
|
-
* `close` itself is idempotent (first call wins). This makes double-close in a
|
|
170
|
-
* `finally` block harmless.
|
|
171
|
-
*/
|
|
172
|
-
export interface ProbeHandle {
|
|
173
|
-
/** The trail this handle's probe belongs to. Stable across the trail. */
|
|
174
|
-
readonly trailId: TrailId;
|
|
175
|
-
/** This probe's own id. The empty {@link ProbeId} for the {@link NOOP_HANDLE}. */
|
|
176
|
-
readonly id: ProbeId;
|
|
177
|
-
/** Whether this handle does real work (`true`) or is the sampled-out no-op. */
|
|
178
|
-
readonly sampled: boolean;
|
|
179
|
-
/** Amend the probe's attributes (last-writer-wins); emits an `update` signal. */
|
|
180
|
-
note(attributes: ProbeAttributes): void;
|
|
181
|
-
/** Open a child probe under this one, sharing the trail; returns its handle. */
|
|
182
|
-
child(kind: ProbeKind, name: string, attributes?: ProbeAttributes): ProbeHandle;
|
|
183
|
-
/** Record a failure (sets the closing status to `error`). Does not close. */
|
|
184
|
-
fail(error: unknown): void;
|
|
185
|
-
/** Close the probe; emits a `close` signal carrying the {@link ClosedProbe}. */
|
|
186
|
-
close(outcome?: ProbeOutcome): void;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* The single shared sampled-out handle.
|
|
190
|
-
*
|
|
191
|
-
* A frozen no-op satisfying {@link ProbeHandle}: it emits nothing, allocates
|
|
192
|
-
* nothing per call, and returns *itself* from `child` so an entire sampled-out
|
|
193
|
-
* subtree costs nothing. This is the whole no-op story — there is no class to
|
|
194
|
-
* subclass.
|
|
195
|
-
*/
|
|
196
|
-
export declare const NOOP_HANDLE: ProbeHandle;
|
|
197
|
-
/**
|
|
198
|
-
* The lifecycle phase a {@link Signal} reports.
|
|
199
|
-
*
|
|
200
|
-
* - `open` — a probe was just opened (carries the fresh open {@link Probe}).
|
|
201
|
-
* - `update` — an open probe gained attributes or a fault (carries the new
|
|
202
|
-
* value, still open).
|
|
203
|
-
* - `close` — a probe reached a terminal state (carries a {@link ClosedProbe}).
|
|
204
|
-
*/
|
|
205
|
-
export type SignalPhase = "open" | "update" | "close";
|
|
206
|
-
/** A probe-open event on the wire. */
|
|
207
|
-
export interface OpenSignal {
|
|
208
|
-
readonly phase: "open";
|
|
209
|
-
/** The freshly opened, still-in-flight probe. */
|
|
210
|
-
readonly probe: Probe;
|
|
211
|
-
/** Emission clock, epoch ms. */
|
|
212
|
-
readonly at: number;
|
|
213
|
-
}
|
|
214
|
-
/** A probe-update event on the wire (attributes amended or a fault recorded). */
|
|
215
|
-
export interface UpdateSignal {
|
|
216
|
-
readonly phase: "update";
|
|
217
|
-
/** The derived probe value; still open. */
|
|
218
|
-
readonly probe: Probe;
|
|
219
|
-
/** Emission clock, epoch ms. */
|
|
220
|
-
readonly at: number;
|
|
221
|
-
}
|
|
222
|
-
/** A probe-close event on the wire (terminal). */
|
|
223
|
-
export interface CloseSignal {
|
|
224
|
-
readonly phase: "close";
|
|
225
|
-
/** The terminal probe value a sink persists. */
|
|
226
|
-
readonly probe: ClosedProbe;
|
|
227
|
-
/** Emission clock, epoch ms. */
|
|
228
|
-
readonly at: number;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* The closed union of trace events, discriminated by `phase`.
|
|
232
|
-
*
|
|
233
|
-
* This is the only thing that crosses the pipeline: the recorder emits
|
|
234
|
-
* {@link Signal}s, the flush buffer batches them, the redactor scrubs the
|
|
235
|
-
* carried probe attributes, and every {@link Sink} consumes them. Renaming a
|
|
236
|
-
* recorder internal never changes this surface.
|
|
237
|
-
*/
|
|
238
|
-
export type Signal = OpenSignal | UpdateSignal | CloseSignal;
|
|
239
|
-
/** Type guard: narrow a {@link Signal} to a terminal {@link CloseSignal}. */
|
|
240
|
-
export declare function isCloseSignal(signal: Signal): signal is CloseSignal;
|
|
241
|
-
/**
|
|
242
|
-
* The emit closure a recorder hands to its probe handles.
|
|
243
|
-
*
|
|
244
|
-
* A handle calls this once per lifecycle transition; the recorder routes it to
|
|
245
|
-
* the redactor and flush buffer. Kept as a bare function so the contract layer
|
|
246
|
-
* stays I/O-free.
|
|
247
|
-
*/
|
|
248
|
-
export type SignalEmit = (signal: Signal) => void;
|
|
249
|
-
/**
|
|
250
|
-
* Admission control for trail roots.
|
|
251
|
-
*
|
|
252
|
-
* A {@link SampleGate} decides, once per *trail*, whether work is recorded
|
|
253
|
-
* (returning live handles) or collapsed to {@link NOOP_HANDLE}. The decision is
|
|
254
|
-
* keyed on the trail name so that named activities can be sampled at different
|
|
255
|
-
* rates; the verdict is sticky for the whole trail — a probe never disagrees
|
|
256
|
-
* with its enclosing trail about whether it is sampled.
|
|
257
|
-
*/
|
|
258
|
-
export interface SampleGate {
|
|
259
|
-
/**
|
|
260
|
-
* Decide whether a new trail with the given root name is recorded.
|
|
261
|
-
*
|
|
262
|
-
* `true` admits the trail (live handles); `false` collapses it to no-ops.
|
|
263
|
-
*/
|
|
264
|
-
admit(rootName: string): boolean;
|
|
265
|
-
}
|
|
266
|
-
/** The two well-known fixed gates the recorder can fall back to. */
|
|
267
|
-
export interface FixedGates {
|
|
268
|
-
/** A gate that admits every trail. */
|
|
269
|
-
readonly always: SampleGate;
|
|
270
|
-
/** A gate that rejects every trail. */
|
|
271
|
-
readonly never: SampleGate;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* An async iterable stream of signals handed to a {@link Sink}.
|
|
275
|
-
*
|
|
276
|
-
* The pipeline owns production; a sink owns consumption. Modelling the boundary
|
|
277
|
-
* as an async iterable (rather than a callback) lets a sink apply natural
|
|
278
|
-
* back-pressure simply by awaiting between pulls.
|
|
279
|
-
*/
|
|
280
|
-
export type SignalStream = AsyncIterable<Signal>;
|
|
281
|
-
/**
|
|
282
|
-
* A terminal consumer of trace signals.
|
|
283
|
-
*
|
|
284
|
-
* A sink {@link Sink.drain | drains} a {@link SignalStream} to completion,
|
|
285
|
-
* writing each signal somewhere — the terminal, an NDJSON file, a network
|
|
286
|
-
* endpoint, an in-memory buffer for tests. `drain` resolves when the stream is
|
|
287
|
-
* exhausted (or rejects if the underlying writer fails); it is the sink's whole
|
|
288
|
-
* obligation.
|
|
289
|
-
*/
|
|
290
|
-
export interface Sink {
|
|
291
|
-
/** A short identifier used in diagnostics and config (e.g. `"console"`). */
|
|
292
|
-
readonly id: string;
|
|
293
|
-
/** Consume the stream to completion, writing each signal to the target. */
|
|
294
|
-
drain(stream: SignalStream): Promise<void>;
|
|
295
|
-
}
|
|
296
|
-
/** Inputs for opening a fresh trail root. */
|
|
297
|
-
export interface OpenTrailInput {
|
|
298
|
-
/** Human-readable label for the root probe (the activity name). */
|
|
299
|
-
readonly name: string;
|
|
300
|
-
/** The root probe's kind; defaults to `run` when omitted. */
|
|
301
|
-
readonly kind?: ProbeKind;
|
|
302
|
-
/** Pre-assigned trail id; one is minted when omitted. */
|
|
303
|
-
readonly trailId?: TrailId;
|
|
304
|
-
/** Initial annotations on the root probe. */
|
|
305
|
-
readonly attributes?: ProbeAttributes;
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* The single recorder facade the agent talks to.
|
|
309
|
-
*
|
|
310
|
-
* A {@link Recorder} mints trails and routes their signals through the pipeline.
|
|
311
|
-
* It owns the {@link SampleGate}, the {@link SecretRedactor}, and the configured
|
|
312
|
-
* {@link Sink}s; callers only ever see {@link ProbeHandle}s. The two opening
|
|
313
|
-
* methods differ only in whether a parent trail already exists:
|
|
314
|
-
* - {@link Recorder.openTrail} starts a *new* trail and returns its root
|
|
315
|
-
* handle (or {@link NOOP_HANDLE} when the gate rejects it);
|
|
316
|
-
* - {@link Recorder.scope} returns a per-trail recorder view bound to one
|
|
317
|
-
* trail id, used by the bridges and rehydrator that already know the trail.
|
|
318
|
-
*/
|
|
319
|
-
export interface Recorder {
|
|
320
|
-
/** The service name stamped on emitted signals (e.g. for a dashboard panel). */
|
|
321
|
-
readonly service: string;
|
|
322
|
-
/** Whether this recorder records at all (a disabled recorder is all no-ops). */
|
|
323
|
-
readonly enabled: boolean;
|
|
324
|
-
/** Open a brand-new trail; returns its root {@link ProbeHandle}. */
|
|
325
|
-
openTrail(input: OpenTrailInput): ProbeHandle;
|
|
326
|
-
/** Bind a {@link TrailRecorder} view to an existing trail id. */
|
|
327
|
-
scope(trailId: TrailId): TrailRecorder;
|
|
328
|
-
/** Flush any buffered signals to all sinks and resolve when settled. */
|
|
329
|
-
flush(): Promise<void>;
|
|
330
|
-
/** Flush, then detach all sinks; the recorder is unusable afterwards. */
|
|
331
|
-
shutdown(): Promise<void>;
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* A recorder view bound to one trail.
|
|
335
|
-
*
|
|
336
|
-
* Bridges and the session rehydrator obtain a {@link TrailRecorder} via
|
|
337
|
-
* {@link Recorder.scope} so they can open probes onto a known trail without
|
|
338
|
-
* re-minting the trail id on every event. `open` adds a root-level probe to the
|
|
339
|
-
* bound trail; `child` adds a probe under a known parent.
|
|
340
|
-
*/
|
|
341
|
-
export interface TrailRecorder {
|
|
342
|
-
/** The trail this view is bound to. */
|
|
343
|
-
readonly trailId: TrailId;
|
|
344
|
-
/** Whether the bound trail is sampled in (false -> every call is a no-op). */
|
|
345
|
-
readonly sampled: boolean;
|
|
346
|
-
/** Open a probe at the trail root level; returns its handle. */
|
|
347
|
-
open(kind: ProbeKind, name: string, attributes?: ProbeAttributes): ProbeHandle;
|
|
348
|
-
/** Open a probe under the given parent probe id; returns its handle. */
|
|
349
|
-
child(parentId: ProbeId, kind: ProbeKind, name: string, attributes?: ProbeAttributes): ProbeHandle;
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* The token a {@link SecretRedactor} substitutes for a removed value.
|
|
353
|
-
*
|
|
354
|
-
* A single, distinctive sentinel so redacted output is greppable and never
|
|
355
|
-
* collides with a plausible real value.
|
|
356
|
-
*/
|
|
357
|
-
export declare const REDACTED_TOKEN: "[insight:scrubbed]";
|
|
358
|
-
/** The literal type of {@link REDACTED_TOKEN}. */
|
|
359
|
-
export type RedactedToken = typeof REDACTED_TOKEN;
|
|
360
|
-
/**
|
|
361
|
-
* A single redaction rule.
|
|
362
|
-
*
|
|
363
|
-
* A rule fires when either the attribute *key* matches {@link RedactionRule.key}
|
|
364
|
-
* (case-insensitive substring or regex) or a string *value* matches
|
|
365
|
-
* {@link RedactionRule.value}; the matched span is replaced with the
|
|
366
|
-
* {@link REDACTED_TOKEN}. Rules are evaluated in order and are additive.
|
|
367
|
-
*/
|
|
368
|
-
export interface RedactionRule {
|
|
369
|
-
/** A label for diagnostics (e.g. `"bearer-token"`). */
|
|
370
|
-
readonly id: string;
|
|
371
|
-
/** Matches against attribute keys; a string is a case-insensitive substring. */
|
|
372
|
-
readonly key?: string | RegExp;
|
|
373
|
-
/** Matches against string values; the matched run is replaced. */
|
|
374
|
-
readonly value?: RegExp;
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Options that bound a {@link SecretRedactor}.
|
|
378
|
-
*/
|
|
379
|
-
export interface RedactionOptions {
|
|
380
|
-
/** Hard cap on retained string length; longer values are truncated. */
|
|
381
|
-
readonly maxStringLength?: number;
|
|
382
|
-
/** Attribute keys dropped entirely rather than tokenized. */
|
|
383
|
-
readonly omitKeys?: readonly string[];
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* The attribute-processor contract applied before signals reach a sink.
|
|
387
|
-
*
|
|
388
|
-
* A {@link SecretRedactor} owns the agent's own patterns ({@link RedactionRule}s)
|
|
389
|
-
* and the {@link REDACTED_TOKEN}. The pipeline calls {@link SecretRedactor.scrub}
|
|
390
|
-
* on every probe carried by a {@link Signal}; the redactor returns a new probe
|
|
391
|
-
* with a scrubbed attribute bag and a scrubbed {@link ProbeFault}, leaving the
|
|
392
|
-
* original frozen value untouched.
|
|
393
|
-
*/
|
|
394
|
-
export interface SecretRedactor {
|
|
395
|
-
/** The rules this redactor applies, in evaluation order. */
|
|
396
|
-
readonly rules: readonly RedactionRule[];
|
|
397
|
-
/** Scrub a single value (string / object / array), recursively. */
|
|
398
|
-
scrubValue(value: unknown): unknown;
|
|
399
|
-
/** Scrub a probe's attribute bag, returning a new frozen bag. */
|
|
400
|
-
scrubAttributes(attributes: ProbeAttributes): ProbeAttributes;
|
|
401
|
-
/** Scrub a whole probe (attributes + fault), returning a new frozen probe. */
|
|
402
|
-
scrub(probe: Probe): Probe;
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* A redactor that performs no redaction.
|
|
406
|
-
*
|
|
407
|
-
* The frozen identity processor used when redaction is disabled: every method
|
|
408
|
-
* returns its input unchanged. Distinct from a configured {@link SecretRedactor}
|
|
409
|
-
* with an empty rule set only in intent — both are safe defaults.
|
|
410
|
-
*/
|
|
411
|
-
export declare const PASSTHRU_REDACTOR: SecretRedactor;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Insight subsystem — public barrel.
|
|
3
|
-
*
|
|
4
|
-
* `insight/` is the agent's single observability plane. It re-exports the FROZEN
|
|
5
|
-
* contract: the id model ({@link TrailId} / {@link ProbeId}), the immutable
|
|
6
|
-
* {@link Probe} value and its functional {@link ProbeHandle} (with the shared
|
|
7
|
-
* sampled-out {@link NOOP_HANDLE}), the wire {@link Signal} union, the
|
|
8
|
-
* {@link SampleGate} admission contract, the {@link Sink} drain interface, the
|
|
9
|
-
* {@link Recorder} / {@link TrailRecorder} facades, and the
|
|
10
|
-
* {@link SecretRedactor} attribute processor (with its {@link REDACTED_TOKEN}).
|
|
11
|
-
*
|
|
12
|
-
* Behaviour modules (the recorder, the flush buffer, the console / file / stream
|
|
13
|
-
* sinks, the redactor implementation, the agent and stream bridges, the session
|
|
14
|
-
* rehydrator, the ledger, and the dashboard panel) are added to this barrel as
|
|
15
|
-
* they land; consumers import the insight surface from `src/insight` rather than
|
|
16
|
-
* reaching into individual modules.
|
|
17
|
-
*/
|
|
18
|
-
export type { TrailId, ProbeId, ProbeKind, ProbeStatus, ProbeOutcome, ProbeFault, ProbeAttributes, Probe, ClosedProbe, ProbeHandle, SignalPhase, OpenSignal, UpdateSignal, CloseSignal, Signal, SignalEmit, SampleGate, FixedGates, SignalStream, Sink, OpenTrailInput, Recorder, TrailRecorder, RedactedToken, RedactionRule, RedactionOptions, SecretRedactor, } from "./contract";
|
|
19
|
-
export { ID_WIDTHS, asTrailId, asProbeId, PROBE_KINDS, isClosedProbe, NOOP_HANDLE, isCloseSignal, REDACTED_TOKEN, PASSTHRU_REDACTOR, } from "./contract";
|
|
20
|
-
export { alwaysGate, neverGate, ratioGate, isRatioGate, hash32, trailScore, FIXED_GATES, type RatioGate, } from "./sampling";
|
|
21
|
-
export { createChannel, type SignalChannel } from "./channel";
|
|
22
|
-
export { createRecorder, mintTrailId, mintProbeId, faultOf, type RecorderOptions, type InsightRecorder, } from "./recorder";
|
|
23
|
-
export { createRedactor, DEFAULT_REDACTOR, DEFAULT_REDACTION_RULES, } from "./redaction";
|
|
24
|
-
export { encodeRecord, decodeRecord, signalToRecord, recordIsClose, RECORD_VERSION, LINE_FEED, type TraceRecord, } from "./serialize";
|
|
25
|
-
export { createConsoleSink, createFileSink, createStreamSink, createCollectorSink, type ConsoleSinkOptions, type LineWriter, type FileSinkOptions, type StreamSinkOptions, type SignalWriter, type CollectorSink, } from "./sinks/index";
|
|
26
|
-
export { readLines, readRecords, replaySignals, replayProbes, replayTrails, type ChunkSource, type ReplayOptions, type ReplayedTrail, } from "./replay";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 11 insight — behavioral tests for the unified tracing plane.
|
|
3
|
-
*
|
|
4
|
-
* Four independent surfaces, all driven in-memory (plus one tmpdir round-trip)
|
|
5
|
-
* with no real stdio and no framework imports:
|
|
6
|
-
*
|
|
7
|
-
* 1. a Recorder with an always-admitting gate opens a run Probe, a child probe,
|
|
8
|
-
* and closes both; the channel is collected and the open/close Signals are
|
|
9
|
-
* asserted for parent linkage and non-decreasing timing;
|
|
10
|
-
* 2. a never-admitting SampleGate collapses a trail to NOOP_HANDLE (no signals),
|
|
11
|
-
* and the ratio gate verdict is deterministic for a given trail id;
|
|
12
|
-
* 3. a FileSink writes one NDJSON record per closed probe into a tmpdir; the
|
|
13
|
-
* lines parse and replay reconstructs the probes;
|
|
14
|
-
* 4. a SecretRedactor replaces an api-key-ish value with the contract token,
|
|
15
|
-
* leaves plain prose alone, and returns a fresh (non-mutated) object.
|
|
16
|
-
*/
|
|
17
|
-
export {};
|