operon-agents-core 0.1.0-alpha.2 → 0.1.0-alpha.21
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/dist/agent/agent.d.ts +8 -7
- package/dist/agent/compose-hooks.d.ts +10 -1
- package/dist/agent/compose-hooks.js +61 -6
- package/dist/agent/concurrency.js +1 -1
- package/dist/agent/context-report.d.ts +2 -2
- package/dist/agent/durable-state.d.ts +22 -0
- package/dist/agent/durable-state.js +54 -0
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/agent/instruction-context.d.ts +6 -6
- package/dist/agent/instruction-context.js +23 -23
- package/dist/agent/profile-builtins.js +1 -1
- package/dist/agent/run-support.d.ts +1 -1
- package/dist/agent/run-support.js +6 -5
- package/dist/agent/runner.d.ts +25 -22
- package/dist/agent/runner.js +217 -121
- package/dist/agent/session.d.ts +262 -156
- package/dist/agent/session.js +590 -418
- package/dist/agent/subagent-tools.js +3 -3
- package/dist/agent/subagent.js +28 -13
- package/dist/agent/toolset.d.ts +1 -0
- package/dist/agent/toolset.js +13 -7
- package/dist/agent/workflow/journal.d.ts +2 -2
- package/dist/agent/workflow/journal.js +2 -2
- package/dist/agent/workflow/manager.d.ts +1 -1
- package/dist/agent/workflow/manager.js +1 -1
- package/dist/agent/workflow/prompt.js +2 -2
- package/dist/agent/workflow/sandbox.d.ts +1 -1
- package/dist/agent/workflow/sandbox.js +1 -1
- package/dist/agent/workflow/tool.js +30 -43
- package/dist/agent/worktree.d.ts +8 -8
- package/dist/agent/worktree.js +15 -15
- package/dist/capabilities/assembler.d.ts +29 -5
- package/dist/capabilities/assembler.js +85 -9
- package/dist/capabilities/background/code-task.d.ts +43 -0
- package/dist/capabilities/background/code-task.js +75 -0
- package/dist/capabilities/background/command-task.d.ts +9 -2
- package/dist/capabilities/background/command-task.js +22 -6
- package/dist/capabilities/background/index.d.ts +6 -1
- package/dist/capabilities/background/index.js +26 -20
- package/dist/capabilities/background/manager.d.ts +57 -1
- package/dist/capabilities/background/manager.js +210 -45
- package/dist/capabilities/background/persist-disk.d.ts +1 -1
- package/dist/capabilities/background/persist-disk.js +1 -1
- package/dist/capabilities/background/persist.js +4 -2
- package/dist/capabilities/background/projections.d.ts +16 -0
- package/dist/capabilities/background/projections.js +86 -0
- package/dist/capabilities/background/stall-watchdog.d.ts +41 -0
- package/dist/capabilities/background/stall-watchdog.js +85 -0
- package/dist/capabilities/background/task.d.ts +8 -7
- package/dist/capabilities/background/tools.js +33 -7
- package/dist/capabilities/capability-data.d.ts +52 -0
- package/dist/capabilities/capability-data.js +88 -0
- package/dist/capabilities/capability-state.d.ts +2 -4
- package/dist/capabilities/capability-state.js +5 -23
- package/dist/capabilities/capability.d.ts +203 -38
- package/dist/capabilities/compaction/index.js +10 -4
- package/dist/capabilities/compaction/service.d.ts +20 -5
- package/dist/capabilities/compaction/service.js +27 -11
- package/dist/capabilities/goal/goal-store.d.ts +76 -12
- package/dist/capabilities/goal/goal-store.js +137 -53
- package/dist/capabilities/goal/index.d.ts +1 -1
- package/dist/capabilities/goal/index.js +30 -7
- package/dist/capabilities/index.d.ts +9 -6
- package/dist/capabilities/index.js +4 -3
- package/dist/capabilities/plan/index.js +22 -5
- package/dist/capabilities/plan/plan-mode.d.ts +30 -9
- package/dist/capabilities/plan/plan-mode.js +57 -32
- package/dist/capabilities/plan/tools.js +1 -1
- package/dist/capabilities/skills/flow-provider.js +3 -3
- package/dist/capabilities/skills/index.d.ts +13 -1
- package/dist/capabilities/skills/index.js +30 -21
- package/dist/capabilities/skills/parser.d.ts +2 -2
- package/dist/capabilities/skills/parser.js +3 -3
- package/dist/capabilities/skills/registry.d.ts +5 -6
- package/dist/capabilities/skills/registry.js +6 -9
- package/dist/capabilities/skills/scanner.d.ts +3 -3
- package/dist/capabilities/skills/scanner.js +14 -14
- package/dist/capabilities/skills/service.d.ts +2 -1
- package/dist/capabilities/skills/service.js +3 -3
- package/dist/capabilities/skills/skill-tool.d.ts +2 -0
- package/dist/capabilities/skills/skill-tool.js +1 -1
- package/dist/capabilities/task/index.js +2 -1
- package/dist/capabilities/task/persist-disk.d.ts +1 -1
- package/dist/capabilities/task/persist-disk.js +1 -1
- package/dist/capabilities/task/persist.js +1 -1
- package/dist/capabilities/todo/index.js +11 -6
- package/dist/capabilities/todo/injector.js +2 -1
- package/dist/capabilities/todo/todo-store.d.ts +28 -7
- package/dist/capabilities/todo/todo-store.js +44 -11
- package/dist/capabilities/todo/tools.js +8 -3
- package/dist/capabilities/tool-provider.d.ts +3 -3
- package/dist/capabilities/user-hooks/engine.d.ts +3 -3
- package/dist/capabilities/user-hooks/engine.js +7 -7
- package/dist/capabilities/user-hooks/index.js +2 -1
- package/dist/capabilities/workflow/index.d.ts +5 -3
- package/dist/capabilities/workflow/index.js +3 -2
- package/dist/commands/index.js +34 -32
- package/dist/config/index.d.ts +1 -1
- package/dist/config/provider-manager.js +0 -28
- package/dist/config/schema.d.ts +53 -4
- package/dist/config/schema.js +53 -1
- package/dist/events/events.d.ts +43 -11
- package/dist/events/events.js +1 -0
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.js +1 -1
- package/dist/events/projection.d.ts +49 -1
- package/dist/events/projection.js +144 -19
- package/dist/events/publisher.js +2 -21
- package/dist/home.d.ts +1 -1
- package/dist/home.js +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/internal.d.ts +5 -2
- package/dist/internal.js +5 -2
- package/dist/llm/define-model.d.ts +4 -0
- package/dist/llm/define-model.js +63 -25
- package/dist/llm/index.d.ts +1 -0
- package/dist/llm/index.js +1 -0
- package/dist/llm/model.d.ts +2 -0
- package/dist/llm/provider.d.ts +17 -0
- package/dist/llm/provider.js +14 -0
- package/dist/llm/retry.js +1 -1
- package/dist/loop/context.d.ts +21 -1
- package/dist/loop/context.js +47 -9
- package/dist/loop/events.d.ts +5 -1
- package/dist/loop/index.d.ts +2 -2
- package/dist/loop/index.js +1 -1
- package/dist/loop/interruption.d.ts +9 -4
- package/dist/loop/interruption.js +11 -25
- package/dist/loop/run-turn.d.ts +16 -3
- package/dist/loop/run-turn.js +13 -4
- package/dist/loop/steer.d.ts +78 -12
- package/dist/loop/steer.js +101 -38
- package/dist/loop/tool-call.d.ts +13 -2
- package/dist/loop/tool-call.js +135 -5
- package/dist/loop/turn-step.d.ts +13 -2
- package/dist/loop/turn-step.js +29 -7
- package/dist/loop/types.d.ts +6 -0
- package/dist/mcp/auth-tool.d.ts +3 -1
- package/dist/mcp/auth-tool.js +2 -2
- package/dist/mcp/capability.d.ts +13 -0
- package/dist/mcp/capability.js +36 -17
- package/dist/mcp/config-loader.d.ts +5 -5
- package/dist/mcp/config-loader.js +17 -17
- package/dist/mcp/credentials.d.ts +35 -0
- package/dist/mcp/credentials.js +2 -0
- package/dist/mcp/filter.d.ts +2 -2
- package/dist/mcp/index.d.ts +4 -3
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/manager.d.ts +108 -6
- package/dist/mcp/manager.js +262 -18
- package/dist/mcp/oauth/callback-server.d.ts +10 -1
- package/dist/mcp/oauth/callback-server.js +82 -16
- package/dist/mcp/oauth/index.d.ts +2 -2
- package/dist/mcp/oauth/provider.d.ts +18 -0
- package/dist/mcp/oauth/provider.js +31 -1
- package/dist/mcp/oauth/service.d.ts +9 -3
- package/dist/mcp/oauth/service.js +29 -4
- package/dist/mcp/sdk-transport.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/permission/auto-approver/prompts-data.d.ts +1 -1
- package/dist/permission/auto-approver/prompts-data.js +1 -1
- package/dist/permission/manager.d.ts +5 -3
- package/dist/permission/manager.js +7 -3
- package/dist/permission/policies.d.ts +2 -2
- package/dist/permission/policies.js +4 -4
- package/dist/plugins/fields.d.ts +14 -0
- package/dist/plugins/fields.js +30 -0
- package/dist/plugins/hooks.d.ts +2 -2
- package/dist/plugins/hooks.js +12 -12
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/manager.d.ts +8 -3
- package/dist/plugins/manager.js +18 -7
- package/dist/plugins/manifest.d.ts +2 -2
- package/dist/plugins/manifest.js +101 -91
- package/dist/plugins/marketplace.js +76 -57
- package/dist/plugins/store.d.ts +3 -3
- package/dist/plugins/store.js +6 -6
- package/dist/protocol/index.d.ts +1 -1
- package/dist/store/catalog-store.d.ts +4 -1
- package/dist/store/catalog-store.js +5 -1
- package/dist/store/checkpointing-store.d.ts +41 -0
- package/dist/store/checkpointing-store.js +86 -0
- package/dist/store/disk-store.d.ts +8 -0
- package/dist/store/disk-store.js +127 -5
- package/dist/store/index.d.ts +3 -2
- package/dist/store/index.js +2 -1
- package/dist/store/log-store.d.ts +9 -1
- package/dist/store/log-store.js +68 -4
- package/dist/store/migrate.d.ts +8 -2
- package/dist/store/migrate.js +9 -2
- package/dist/store/origin.d.ts +31 -6
- package/dist/store/origin.js +0 -14
- package/dist/store/pg.d.ts +1 -0
- package/dist/store/pg.js +37 -2
- package/dist/store/redis.d.ts +1 -0
- package/dist/store/redis.js +30 -0
- package/dist/store/repository.d.ts +13 -1
- package/dist/store/repository.js +45 -2
- package/dist/store/session-catalog.d.ts +4 -0
- package/dist/store/session-catalog.js +6 -0
- package/dist/store/storage.js +3 -0
- package/dist/store/store.d.ts +97 -34
- package/dist/store/store.js +64 -10
- package/dist/telemetry/appender.d.ts +43 -0
- package/dist/telemetry/appender.js +46 -0
- package/dist/telemetry/events.d.ts +142 -0
- package/dist/telemetry/events.js +141 -0
- package/dist/telemetry/index.d.ts +10 -0
- package/dist/telemetry/index.js +6 -0
- package/dist/telemetry/projection.d.ts +23 -0
- package/dist/telemetry/projection.js +185 -0
- package/dist/telemetry/redact.d.ts +20 -0
- package/dist/telemetry/redact.js +40 -0
- package/dist/telemetry/service.d.ts +49 -0
- package/dist/telemetry/service.js +137 -0
- package/dist/testing.d.ts +58 -0
- package/dist/testing.js +123 -0
- package/dist/tool/background.d.ts +9 -6
- package/dist/tool/background.js +7 -1
- package/dist/tool/builtin/ask-user-question.js +6 -5
- package/dist/tool/builtin/bash.d.ts +6 -0
- package/dist/tool/builtin/bash.js +79 -42
- package/dist/tool/builtin/edit.js +82 -109
- package/dist/tool/builtin/glob.js +13 -13
- package/dist/tool/builtin/grep.js +13 -13
- package/dist/tool/builtin/read.js +25 -15
- package/dist/tool/builtin/write.js +49 -33
- package/dist/tool/define.d.ts +14 -8
- package/dist/tool/define.js +8 -2
- package/dist/tool/{machine-base.d.ts → environment-base.d.ts} +37 -37
- package/dist/tool/{machine-base.js → environment-base.js} +45 -119
- package/dist/tool/{machine-local.d.ts → environment-local.d.ts} +9 -8
- package/dist/tool/{machine-local.js → environment-local.js} +60 -81
- package/dist/tool/{machine-null.d.ts → environment-null.d.ts} +9 -9
- package/dist/tool/{machine-null.js → environment-null.js} +9 -9
- package/dist/tool/{machine-ssh.d.ts → environment-ssh.d.ts} +33 -18
- package/dist/tool/{machine-ssh.js → environment-ssh.js} +118 -149
- package/dist/tool/{machine.d.ts → environment.d.ts} +53 -82
- package/dist/tool/environment.js +2 -0
- package/dist/tool/file-freshness.d.ts +33 -19
- package/dist/tool/file-freshness.js +39 -30
- package/dist/tool/filesystem-tools.d.ts +1 -1
- package/dist/tool/filesystem-tools.js +1 -1
- package/dist/tool/git-context.d.ts +2 -2
- package/dist/tool/git-context.js +8 -8
- package/dist/tool/index.d.ts +12 -12
- package/dist/tool/index.js +12 -10
- package/dist/tool/policies/path-access.d.ts +4 -4
- package/dist/tool/policies/path-access.js +12 -12
- package/dist/tool/questions.d.ts +8 -0
- package/dist/tool/search/catalog.d.ts +37 -0
- package/dist/tool/search/catalog.js +182 -0
- package/dist/tool/search/deferral.d.ts +3 -2
- package/dist/tool/search/loaded.d.ts +32 -0
- package/dist/tool/search/loaded.js +96 -0
- package/dist/tool/search/search-tool.d.ts +2 -6
- package/dist/tool/search/search-tool.js +16 -15
- package/dist/tool/shell-env.js +4 -0
- package/dist/tool/support/bash-paths.js +38 -7
- package/dist/tool/support/{machine-ops.d.ts → environment-ops.d.ts} +12 -14
- package/dist/tool/support/{machine-ops.js → environment-ops.js} +21 -2
- package/dist/tool/support/git-worktree.d.ts +3 -3
- package/dist/tool/support/git-worktree.js +6 -6
- package/dist/tool/support/rg-locator.d.ts +6 -6
- package/dist/tool/support/rg-locator.js +6 -6
- package/dist/tool/support/ripgrep-run.d.ts +5 -5
- package/dist/tool/support/ripgrep-run.js +3 -3
- package/dist/tool/support/tool-path.d.ts +3 -3
- package/dist/tool/support/tool-path.js +7 -7
- package/dist/tool/types.d.ts +54 -10
- package/dist/tool/web/fetch-url.js +1 -1
- package/dist/tool/web/web-search.js +1 -1
- package/dist/tool/workspace-spec.d.ts +3 -3
- package/dist/tool/workspace-spec.js +27 -27
- package/dist/tracing/bridge.d.ts +9 -1
- package/dist/tracing/bridge.js +307 -77
- package/dist/tracing/index.d.ts +2 -2
- package/dist/tracing/otel.d.ts +28 -1
- package/dist/tracing/otel.js +150 -38
- package/dist/tracing/processor.d.ts +22 -0
- package/dist/tracing/processor.js +2 -0
- package/dist/tracing/spans.d.ts +54 -0
- package/dist/tracing/spans.js +5 -0
- package/package.json +6 -2
- package/dist/tool/machine.js +0 -15
- package/dist/tool/search/activation.d.ts +0 -13
- package/dist/tool/search/activation.js +0 -31
package/dist/store/store.js
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
/** True for the self-contained history resets a shard can be replayed from. */
|
|
2
|
+
export function isCheckpointRecord(record) {
|
|
3
|
+
return record.type === "context.replace" || record.type === "context.apply_compaction";
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The audit shard: records about the session that nothing restores, replays or projects from —
|
|
7
|
+
* approvals, permission-mode changes, an extension's own records (`SessionContext.record`), and
|
|
8
|
+
* the engine's diagnostics. It is an ordinary shard to the backends (so a fork copies it and a
|
|
9
|
+
* delete removes it), but a read without an address leaves it out, and writing to it is best
|
|
10
|
+
* effort: losing an audit record never changes what the session does.
|
|
11
|
+
*/
|
|
12
|
+
export const AUDIT_ADDRESS = "audit";
|
|
13
|
+
/** Append `body` to the audit shard; `about` names the conversation shard it concerns. */
|
|
14
|
+
export function appendAudit(store, body, about) {
|
|
15
|
+
return store.appendRecord({ ...body, address: AUDIT_ADDRESS, ...(about !== undefined ? { about } : {}) });
|
|
16
|
+
}
|
|
17
|
+
/** The audit shard's records in append order (its leading `metadata` record left out). */
|
|
18
|
+
export async function readAudit(store) {
|
|
19
|
+
const out = [];
|
|
20
|
+
for await (const record of store.readRecords({ address: AUDIT_ADDRESS })) {
|
|
21
|
+
if (record.type !== "metadata")
|
|
22
|
+
out.push(record);
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
/** Where capability `owner`'s current state for journal `address` is kept in KV state. */
|
|
27
|
+
export function durableStateKey(owner, address) {
|
|
28
|
+
return `durable:${owner}:${address}`;
|
|
29
|
+
}
|
|
30
|
+
/** The session's own current state in KV: its runtime permission state, and its running usage
|
|
31
|
+
* (the root agent's turns only — see `SessionSummary.usage`). */
|
|
32
|
+
export const SESSION_PERMISSION_KEY = "session:permission";
|
|
33
|
+
export const SESSION_USAGE_KEY = "session:usage";
|
|
34
|
+
/** KV key under which a store indexes a shard's newest checkpoint. An index, not state:
|
|
35
|
+
* stale or missing, the reader falls back to the shard's head. */
|
|
36
|
+
export function checkpointIndexKey(address) {
|
|
37
|
+
return `checkpoint:${address}`;
|
|
38
|
+
}
|
|
1
39
|
export const DEFAULT_ADDRESS = "main";
|
|
2
40
|
/** Append one message. */
|
|
3
41
|
export function foldAppend(state, message, origin) {
|
|
@@ -12,11 +50,29 @@ export function foldReplace(state, messages, origins) {
|
|
|
12
50
|
while (state.origins.length < state.messages.length)
|
|
13
51
|
state.origins.push(undefined);
|
|
14
52
|
}
|
|
15
|
-
/**
|
|
16
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Drop the first `cutoff` messages and prepend the summary in their place — the LIVE splice, as
|
|
55
|
+
* the `history.compacted` event describes it to a consumer already holding the history. Replay
|
|
56
|
+
* of a record does not use this: the record is self-contained (see `foldCompactionRecord`).
|
|
57
|
+
*/
|
|
58
|
+
export function foldCompaction(state, cutoff, summary, summaryTimestamp, loadedTools) {
|
|
17
59
|
const clamped = Math.min(cutoff, state.messages.length);
|
|
18
60
|
state.messages.splice(0, clamped, summaryMessage(summary, summaryTimestamp));
|
|
19
|
-
state.origins.splice(0, clamped,
|
|
61
|
+
state.origins.splice(0, clamped, compactionSummaryOrigin(loadedTools));
|
|
62
|
+
}
|
|
63
|
+
/** Reset to `[summary, ...kept]` — a compaction record replayed on its own. */
|
|
64
|
+
export function foldCompactionRecord(state, record) {
|
|
65
|
+
if (!Array.isArray(record.kept)) {
|
|
66
|
+
// Written before compaction records were self-contained (wire version < 3). Not upgraded:
|
|
67
|
+
// its meaning depends on every message before it, which a checkpoint replay never reads.
|
|
68
|
+
throw new Error("context.apply_compaction without `kept`: this session log predates self-contained compaction records and cannot be replayed.");
|
|
69
|
+
}
|
|
70
|
+
foldReplace(state, [summaryMessage(record.summary, record.summaryTimestamp), ...record.kept], [compactionSummaryOrigin(record.loadedTools), ...(record.keptOrigins ?? record.kept.map(() => null))]);
|
|
71
|
+
}
|
|
72
|
+
export function compactionSummaryOrigin(loadedTools) {
|
|
73
|
+
return loadedTools !== undefined && loadedTools.length > 0
|
|
74
|
+
? { kind: "compaction_summary", loadedTools: [...loadedTools] }
|
|
75
|
+
: { kind: "compaction_summary" };
|
|
20
76
|
}
|
|
21
77
|
export function reduceHistory(records) {
|
|
22
78
|
const state = { messages: [], origins: [] };
|
|
@@ -33,18 +89,16 @@ export function reduceHistory(records) {
|
|
|
33
89
|
foldReplace(state, record.messages, record.origins);
|
|
34
90
|
break;
|
|
35
91
|
case "context.apply_compaction":
|
|
36
|
-
|
|
92
|
+
foldCompactionRecord(state, record);
|
|
37
93
|
break;
|
|
38
|
-
// Audit / bookkeeping — not reduced into history.
|
|
39
|
-
// `
|
|
40
|
-
// journaled as `context.append_message`
|
|
41
|
-
//
|
|
42
|
-
case "inbox.received":
|
|
94
|
+
// Audit / bookkeeping — not reduced into history. A queued steer (`event.lifecycle` /
|
|
95
|
+
// `steer.queued`) is the accepted input, not the seen input: what the model saw is
|
|
96
|
+
// journaled as `context.append_message` when a turn drains it. Folding the record here
|
|
97
|
+
// would double-count, or resurrect a message no turn ever took.
|
|
43
98
|
case "metadata":
|
|
44
99
|
case "usage.record":
|
|
45
100
|
case "permission.record_approval":
|
|
46
101
|
case "permission.set_mode":
|
|
47
|
-
case "config.update":
|
|
48
102
|
case "agent.handoff":
|
|
49
103
|
case "agent.handoff.accepted":
|
|
50
104
|
case "guardrail.blocked":
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { TelemetryPrimitive } from "./events.ts";
|
|
2
|
+
/** One event on the wire: name + merged (context ⊕ payload) properties + service clock. */
|
|
3
|
+
export interface TelemetryEvent {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly properties: Readonly<Record<string, TelemetryPrimitive>>;
|
|
6
|
+
/** Epoch millis from the service clock. */
|
|
7
|
+
readonly timestamp: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Where events go. Plain objects, not scoped services: the service holds a list and fans out.
|
|
11
|
+
*
|
|
12
|
+
* Contract: `track` is synchronous and must not throw (the service isolates a throw, but an
|
|
13
|
+
* appender that relies on that is a bug). Anything async — batching, HTTP — belongs in `flush`
|
|
14
|
+
* and `shutdown`. `shutdown` drains; after it `track` may drop.
|
|
15
|
+
*/
|
|
16
|
+
export interface TelemetryAppender {
|
|
17
|
+
track(event: TelemetryEvent): void;
|
|
18
|
+
flush(): Promise<void>;
|
|
19
|
+
shutdown(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/** The default. A service with only this attached costs one array iteration per `track`. */
|
|
22
|
+
export declare const nullTelemetryAppender: TelemetryAppender;
|
|
23
|
+
export interface ConsoleAppenderOptions {
|
|
24
|
+
readonly write?: (line: string) => void;
|
|
25
|
+
}
|
|
26
|
+
/** Dev echo: one line per event. Does not redact — it is for the developer's own terminal. */
|
|
27
|
+
export declare class ConsoleAppender implements TelemetryAppender {
|
|
28
|
+
private readonly write;
|
|
29
|
+
constructor(options?: ConsoleAppenderOptions);
|
|
30
|
+
track(event: TelemetryEvent): void;
|
|
31
|
+
flush(): Promise<void>;
|
|
32
|
+
shutdown(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
/** Test seam and buffer: keeps every event it sees. */
|
|
35
|
+
export declare class MemoryAppender implements TelemetryAppender {
|
|
36
|
+
readonly events: TelemetryEvent[];
|
|
37
|
+
flushCount: number;
|
|
38
|
+
shutdownCount: number;
|
|
39
|
+
track(event: TelemetryEvent): void;
|
|
40
|
+
flush(): Promise<void>;
|
|
41
|
+
shutdown(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=appender.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** The default. A service with only this attached costs one array iteration per `track`. */
|
|
2
|
+
export const nullTelemetryAppender = Object.freeze({
|
|
3
|
+
track() {
|
|
4
|
+
/* no-op */
|
|
5
|
+
},
|
|
6
|
+
flush() {
|
|
7
|
+
return Promise.resolve();
|
|
8
|
+
},
|
|
9
|
+
shutdown() {
|
|
10
|
+
return Promise.resolve();
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
/** Dev echo: one line per event. Does not redact — it is for the developer's own terminal. */
|
|
14
|
+
export class ConsoleAppender {
|
|
15
|
+
write;
|
|
16
|
+
constructor(options = {}) {
|
|
17
|
+
this.write = options.write ?? ((line) => console.error(line));
|
|
18
|
+
}
|
|
19
|
+
track(event) {
|
|
20
|
+
this.write(`[telemetry] ${event.name} ${JSON.stringify(event.properties)}`);
|
|
21
|
+
}
|
|
22
|
+
flush() {
|
|
23
|
+
return Promise.resolve();
|
|
24
|
+
}
|
|
25
|
+
shutdown() {
|
|
26
|
+
return Promise.resolve();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Test seam and buffer: keeps every event it sees. */
|
|
30
|
+
export class MemoryAppender {
|
|
31
|
+
events = [];
|
|
32
|
+
flushCount = 0;
|
|
33
|
+
shutdownCount = 0;
|
|
34
|
+
track(event) {
|
|
35
|
+
this.events.push(event);
|
|
36
|
+
}
|
|
37
|
+
flush() {
|
|
38
|
+
this.flushCount += 1;
|
|
39
|
+
return Promise.resolve();
|
|
40
|
+
}
|
|
41
|
+
shutdown() {
|
|
42
|
+
this.shutdownCount += 1;
|
|
43
|
+
return Promise.resolve();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=appender.js.map
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telemetry event registry — the single source of truth for what the framework counts.
|
|
3
|
+
*
|
|
4
|
+
* Every event is declared once, with a payload interface AND a description for every property.
|
|
5
|
+
* Two type-level devices keep the registry from rotting:
|
|
6
|
+
*
|
|
7
|
+
* - `properties: { [K in keyof P]-?: string }` — a payload property without a description does
|
|
8
|
+
* not compile. Documentation is part of the type.
|
|
9
|
+
* - `Exact<Expected, Actual>` on `track()` — an extra property at the call site does not compile.
|
|
10
|
+
* TypeScript's structural subtyping would otherwise let "one more field" through, and that is
|
|
11
|
+
* precisely how user data leaks into analytics.
|
|
12
|
+
*
|
|
13
|
+
* Red lines (see docs/telemetry.md §2): properties are counts, durations, enums and framework-owned
|
|
14
|
+
* ids. Never prompts, tool args/results, paths, urls, model output. `session_id` / `address` /
|
|
15
|
+
* `agent` are CONTEXT — stamped by the service, never passed at a call site.
|
|
16
|
+
*/
|
|
17
|
+
export type TelemetryPrimitive = string | number | boolean | null;
|
|
18
|
+
/** A payload: primitives only; `undefined` means "absent" and is dropped before fan-out. */
|
|
19
|
+
export type TelemetryProperties = Record<string, TelemetryPrimitive | undefined>;
|
|
20
|
+
/** Where the event's identity comes from. `session` events get `session_id` from context. */
|
|
21
|
+
export type TelemetryEventScope = "session" | "global";
|
|
22
|
+
/** Property names reserved for context. The registry rejects them as payload keys. */
|
|
23
|
+
export declare const RESERVED_TELEMETRY_KEYS: readonly string[];
|
|
24
|
+
/** Property names that are a content leak by construction. The registry test rejects them. */
|
|
25
|
+
export declare const FORBIDDEN_TELEMETRY_KEYS: readonly string[];
|
|
26
|
+
export interface TelemetryEventDefinition<P extends TelemetryProperties = TelemetryProperties> {
|
|
27
|
+
readonly owner: string;
|
|
28
|
+
readonly comment: string;
|
|
29
|
+
readonly scope: TelemetryEventScope;
|
|
30
|
+
/** One human-readable line per payload property; `-?` makes optional properties mandatory here. */
|
|
31
|
+
readonly properties: {
|
|
32
|
+
readonly [K in keyof P]-?: string;
|
|
33
|
+
};
|
|
34
|
+
/** Phantom carrier for the payload type; never set at runtime. */
|
|
35
|
+
readonly payload?: P;
|
|
36
|
+
}
|
|
37
|
+
export interface TelemetryEventSpec<P extends TelemetryProperties> {
|
|
38
|
+
readonly owner: string;
|
|
39
|
+
readonly comment: string;
|
|
40
|
+
readonly properties: {
|
|
41
|
+
readonly [K in keyof P]-?: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** A context-free event (a product-level "app opened", say). */
|
|
45
|
+
export declare function defineEvent<P extends TelemetryProperties>(spec: TelemetryEventSpec<P>): TelemetryEventDefinition<P>;
|
|
46
|
+
/** An event that belongs to a session: `session_id` arrives from context, never from the payload. */
|
|
47
|
+
export declare function defineSessionEvent<P extends TelemetryProperties>(spec: TelemetryEventSpec<P>): TelemetryEventDefinition<P>;
|
|
48
|
+
export type TelemetryRegistry = Readonly<Record<string, TelemetryEventDefinition>>;
|
|
49
|
+
export type PayloadOf<D> = D extends TelemetryEventDefinition<infer P> ? P : never;
|
|
50
|
+
/**
|
|
51
|
+
* Exact-match check: `Actual` must be assignable to `Expected` AND carry no key `Expected` lacks.
|
|
52
|
+
* Resolves to `never` on violation, which makes the `track()` argument uninhabitable — a compile
|
|
53
|
+
* error at the call site rather than a silently wider payload.
|
|
54
|
+
*/
|
|
55
|
+
export type Exact<Expected, Actual> = Actual extends Expected ? (Exclude<keyof Actual, keyof Expected> extends never ? Actual : never) : never;
|
|
56
|
+
export type SessionStartedEvent = {
|
|
57
|
+
/** `true` when the session was reopened from a store rather than created. */
|
|
58
|
+
resumed: boolean;
|
|
59
|
+
};
|
|
60
|
+
export type TurnStartedEvent = {
|
|
61
|
+
turn_id: string;
|
|
62
|
+
/** `PromptOrigin.kind` (`user`, `user_follow_up`, `cron_job`, …) or `unknown`. */
|
|
63
|
+
origin: string;
|
|
64
|
+
};
|
|
65
|
+
export type TurnFinishedEvent = {
|
|
66
|
+
turn_id: string;
|
|
67
|
+
reason: "completed" | "cancelled" | "failed";
|
|
68
|
+
duration_ms: number;
|
|
69
|
+
step_count: number;
|
|
70
|
+
tool_call_count: number;
|
|
71
|
+
input_tokens: number;
|
|
72
|
+
output_tokens: number;
|
|
73
|
+
cache_read_tokens: number;
|
|
74
|
+
cache_write_tokens: number;
|
|
75
|
+
/** Model id of the last assistant message in the turn; `null` when no model answered. */
|
|
76
|
+
model: string | null;
|
|
77
|
+
};
|
|
78
|
+
export type ToolCallEvent = {
|
|
79
|
+
turn_id: string | null;
|
|
80
|
+
tool_name: string;
|
|
81
|
+
outcome: "success" | "error";
|
|
82
|
+
duration_ms: number;
|
|
83
|
+
};
|
|
84
|
+
export type ToolSuspendedEvent = {
|
|
85
|
+
turn_id: string | null;
|
|
86
|
+
tool_name: string;
|
|
87
|
+
/** Whether the suspension carried an input request (approval / question) for the host. */
|
|
88
|
+
has_request: boolean;
|
|
89
|
+
};
|
|
90
|
+
export type StepRetryEvent = {
|
|
91
|
+
turn_id: string;
|
|
92
|
+
attempt: number;
|
|
93
|
+
max_attempts: number;
|
|
94
|
+
delay_ms: number;
|
|
95
|
+
/** Short, enum-ish retry reason (first 64 chars), or `null`. */
|
|
96
|
+
reason: string | null;
|
|
97
|
+
};
|
|
98
|
+
export type SubagentSpawnedEvent = {
|
|
99
|
+
/** Sub-agent profile name (`coder`, `explore`, …). */
|
|
100
|
+
agent_name: string;
|
|
101
|
+
/** Nesting depth: number of address segments below the root agent. */
|
|
102
|
+
depth: number;
|
|
103
|
+
};
|
|
104
|
+
export type CompactionEvent = {
|
|
105
|
+
before_tokens: number;
|
|
106
|
+
after_tokens: number;
|
|
107
|
+
compacted_count: number;
|
|
108
|
+
};
|
|
109
|
+
export type GuardrailBlockedEvent = {
|
|
110
|
+
stage: "input" | "output" | "tool_input" | "tool_output";
|
|
111
|
+
guardrail: string;
|
|
112
|
+
};
|
|
113
|
+
export type SkillActivatedEvent = {
|
|
114
|
+
skill_name: string;
|
|
115
|
+
trigger: "user-slash" | "model-tool" | "nested-skill";
|
|
116
|
+
};
|
|
117
|
+
export type SteerQueuedEvent = {
|
|
118
|
+
channel: "steering" | "follow_up";
|
|
119
|
+
/** `PromptOrigin.kind` of the queued message. */
|
|
120
|
+
origin: string;
|
|
121
|
+
};
|
|
122
|
+
export type TurnErrorEvent = {
|
|
123
|
+
turn_id: string | null;
|
|
124
|
+
/** Error text after redaction, capped at 200 chars. */
|
|
125
|
+
message: string;
|
|
126
|
+
};
|
|
127
|
+
export declare const FRAMEWORK_TELEMETRY_EVENTS: {
|
|
128
|
+
readonly session_started: TelemetryEventDefinition<SessionStartedEvent>;
|
|
129
|
+
readonly turn_started: TelemetryEventDefinition<TurnStartedEvent>;
|
|
130
|
+
readonly turn_finished: TelemetryEventDefinition<TurnFinishedEvent>;
|
|
131
|
+
readonly tool_call: TelemetryEventDefinition<ToolCallEvent>;
|
|
132
|
+
readonly tool_suspended: TelemetryEventDefinition<ToolSuspendedEvent>;
|
|
133
|
+
readonly step_retry: TelemetryEventDefinition<StepRetryEvent>;
|
|
134
|
+
readonly subagent_spawned: TelemetryEventDefinition<SubagentSpawnedEvent>;
|
|
135
|
+
readonly compaction: TelemetryEventDefinition<CompactionEvent>;
|
|
136
|
+
readonly guardrail_blocked: TelemetryEventDefinition<GuardrailBlockedEvent>;
|
|
137
|
+
readonly skill_activated: TelemetryEventDefinition<SkillActivatedEvent>;
|
|
138
|
+
readonly steer_queued: TelemetryEventDefinition<SteerQueuedEvent>;
|
|
139
|
+
readonly turn_error: TelemetryEventDefinition<TurnErrorEvent>;
|
|
140
|
+
};
|
|
141
|
+
export type FrameworkTelemetryEvents = typeof FRAMEWORK_TELEMETRY_EVENTS;
|
|
142
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telemetry event registry — the single source of truth for what the framework counts.
|
|
3
|
+
*
|
|
4
|
+
* Every event is declared once, with a payload interface AND a description for every property.
|
|
5
|
+
* Two type-level devices keep the registry from rotting:
|
|
6
|
+
*
|
|
7
|
+
* - `properties: { [K in keyof P]-?: string }` — a payload property without a description does
|
|
8
|
+
* not compile. Documentation is part of the type.
|
|
9
|
+
* - `Exact<Expected, Actual>` on `track()` — an extra property at the call site does not compile.
|
|
10
|
+
* TypeScript's structural subtyping would otherwise let "one more field" through, and that is
|
|
11
|
+
* precisely how user data leaks into analytics.
|
|
12
|
+
*
|
|
13
|
+
* Red lines (see docs/telemetry.md §2): properties are counts, durations, enums and framework-owned
|
|
14
|
+
* ids. Never prompts, tool args/results, paths, urls, model output. `session_id` / `address` /
|
|
15
|
+
* `agent` are CONTEXT — stamped by the service, never passed at a call site.
|
|
16
|
+
*/
|
|
17
|
+
/** Property names reserved for context. The registry rejects them as payload keys. */
|
|
18
|
+
export const RESERVED_TELEMETRY_KEYS = ["session_id", "address", "agent", "distinct_id"];
|
|
19
|
+
/** Property names that are a content leak by construction. The registry test rejects them. */
|
|
20
|
+
export const FORBIDDEN_TELEMETRY_KEYS = ["args", "arguments", "result", "content", "path", "cwd", "url", "prompt", "text", "output"];
|
|
21
|
+
/** A context-free event (a product-level "app opened", say). */
|
|
22
|
+
export function defineEvent(spec) {
|
|
23
|
+
return { ...spec, scope: "global" };
|
|
24
|
+
}
|
|
25
|
+
/** An event that belongs to a session: `session_id` arrives from context, never from the payload. */
|
|
26
|
+
export function defineSessionEvent(spec) {
|
|
27
|
+
return { ...spec, scope: "session" };
|
|
28
|
+
}
|
|
29
|
+
export const FRAMEWORK_TELEMETRY_EVENTS = {
|
|
30
|
+
session_started: defineSessionEvent({
|
|
31
|
+
owner: "operon-agents",
|
|
32
|
+
comment: "A session's root agent started for the first time in this process.",
|
|
33
|
+
properties: {
|
|
34
|
+
resumed: "true when the session was reopened from a store rather than created fresh",
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
turn_started: defineSessionEvent({
|
|
38
|
+
owner: "operon-agents",
|
|
39
|
+
comment: "A turn began. Pair with turn_finished on turn_id.",
|
|
40
|
+
properties: {
|
|
41
|
+
turn_id: "Per-session turn id; pair with session_id (context) to locate the turn",
|
|
42
|
+
origin: "PromptOrigin.kind that triggered the turn (user, user_follow_up, cron_job, …) or unknown",
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
turn_finished: defineSessionEvent({
|
|
46
|
+
owner: "operon-agents",
|
|
47
|
+
comment: "A turn ended, for any reason. One per turn_started.",
|
|
48
|
+
properties: {
|
|
49
|
+
turn_id: "Per-session turn id; pair with session_id (context) to locate the turn",
|
|
50
|
+
reason: "Why the turn ended; mirrors AgentEvent turn.ended.reason",
|
|
51
|
+
duration_ms: "Wall-clock from turn.started to turn.ended",
|
|
52
|
+
step_count: "LLM steps taken (turn.step.started count)",
|
|
53
|
+
tool_call_count: "tool.call.started count within the turn",
|
|
54
|
+
input_tokens: "Sum of assistant-message usage.input over the turn",
|
|
55
|
+
output_tokens: "Sum of assistant-message usage.output over the turn",
|
|
56
|
+
cache_read_tokens: "Sum of assistant-message usage.cacheRead over the turn",
|
|
57
|
+
cache_write_tokens: "Sum of assistant-message usage.cacheWrite over the turn",
|
|
58
|
+
model: "Model id of the last assistant message in the turn, or null",
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
tool_call: defineSessionEvent({
|
|
62
|
+
owner: "operon-agents",
|
|
63
|
+
comment: "A tool call completed (success or error). Emitted on tool.result.",
|
|
64
|
+
properties: {
|
|
65
|
+
turn_id: "Turn the call ran in, or null when it ran outside a turn",
|
|
66
|
+
tool_name: "Tool identifier (builtin name or MCP server-prefixed name); never its arguments",
|
|
67
|
+
outcome: "success or error, from tool.result.isError",
|
|
68
|
+
duration_ms: "Wall-clock from tool.call.started to tool.result",
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
tool_suspended: defineSessionEvent({
|
|
72
|
+
owner: "operon-agents",
|
|
73
|
+
comment: "A tool paused the turn waiting on the host (approval, question, detach).",
|
|
74
|
+
properties: {
|
|
75
|
+
turn_id: "Turn the tool ran in, or null",
|
|
76
|
+
tool_name: "Tool identifier",
|
|
77
|
+
has_request: "true when the suspension carried an input request for the host",
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
step_retry: defineSessionEvent({
|
|
81
|
+
owner: "operon-agents",
|
|
82
|
+
comment: "An LLM step is being retried after a transient failure.",
|
|
83
|
+
properties: {
|
|
84
|
+
turn_id: "Turn the step belongs to",
|
|
85
|
+
attempt: "1-based attempt number about to run",
|
|
86
|
+
max_attempts: "Configured retry ceiling",
|
|
87
|
+
delay_ms: "Backoff before this attempt",
|
|
88
|
+
reason: "Short retry reason (first 64 chars) or null",
|
|
89
|
+
},
|
|
90
|
+
}),
|
|
91
|
+
subagent_spawned: defineSessionEvent({
|
|
92
|
+
owner: "operon-agents",
|
|
93
|
+
comment: "A sub-agent started under the root agent.",
|
|
94
|
+
properties: {
|
|
95
|
+
agent_name: "Sub-agent profile name (coder, explore, plan, or a custom profile)",
|
|
96
|
+
depth: "Nesting depth below the root agent (1 = direct child)",
|
|
97
|
+
},
|
|
98
|
+
}),
|
|
99
|
+
compaction: defineSessionEvent({
|
|
100
|
+
owner: "operon-agents",
|
|
101
|
+
comment: "Context compaction completed.",
|
|
102
|
+
properties: {
|
|
103
|
+
before_tokens: "Context tokens before compaction",
|
|
104
|
+
after_tokens: "Context tokens after compaction",
|
|
105
|
+
compacted_count: "Number of messages folded into the summary",
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
guardrail_blocked: defineSessionEvent({
|
|
109
|
+
owner: "operon-agents",
|
|
110
|
+
comment: "A guardrail blocked input, output, or a tool call.",
|
|
111
|
+
properties: {
|
|
112
|
+
stage: "Which stage was blocked: input, output, tool_input, tool_output",
|
|
113
|
+
guardrail: "Guardrail name",
|
|
114
|
+
},
|
|
115
|
+
}),
|
|
116
|
+
skill_activated: defineSessionEvent({
|
|
117
|
+
owner: "operon-agents",
|
|
118
|
+
comment: "A skill was activated.",
|
|
119
|
+
properties: {
|
|
120
|
+
skill_name: "Skill name as registered; never its arguments or path",
|
|
121
|
+
trigger: "How it was activated: user-slash, model-tool, nested-skill",
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
steer_queued: defineSessionEvent({
|
|
125
|
+
owner: "operon-agents",
|
|
126
|
+
comment: "A steer or follow-up message was queued for a running turn.",
|
|
127
|
+
properties: {
|
|
128
|
+
channel: "steering (interrupt the current step) or follow_up (after the turn)",
|
|
129
|
+
origin: "PromptOrigin.kind of the queued message",
|
|
130
|
+
},
|
|
131
|
+
}),
|
|
132
|
+
turn_error: defineSessionEvent({
|
|
133
|
+
owner: "operon-agents",
|
|
134
|
+
comment: "A live error event surfaced on the session stream.",
|
|
135
|
+
properties: {
|
|
136
|
+
turn_id: "Active turn at the address the error surfaced on, or null",
|
|
137
|
+
message: "Error text after redaction, capped at 200 chars",
|
|
138
|
+
},
|
|
139
|
+
}),
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { defineEvent, defineSessionEvent, FRAMEWORK_TELEMETRY_EVENTS, RESERVED_TELEMETRY_KEYS, FORBIDDEN_TELEMETRY_KEYS, } from "./events.ts";
|
|
2
|
+
export type { TelemetryPrimitive, TelemetryProperties, TelemetryEventScope, TelemetryEventDefinition, TelemetryEventSpec, TelemetryRegistry, PayloadOf, Exact, FrameworkTelemetryEvents, SessionStartedEvent, TurnStartedEvent, TurnFinishedEvent, ToolCallEvent, ToolSuspendedEvent, StepRetryEvent, SubagentSpawnedEvent, CompactionEvent, GuardrailBlockedEvent, SkillActivatedEvent, SteerQueuedEvent, TurnErrorEvent, } from "./events.ts";
|
|
3
|
+
export { nullTelemetryAppender, ConsoleAppender, MemoryAppender } from "./appender.ts";
|
|
4
|
+
export type { TelemetryAppender, TelemetryEvent, ConsoleAppenderOptions } from "./appender.ts";
|
|
5
|
+
export { createTelemetryService, noopTelemetryService } from "./service.ts";
|
|
6
|
+
export type { TelemetryService, TelemetryServiceOptions, TelemetryContext } from "./service.ts";
|
|
7
|
+
export { redactTelemetryString, redactTelemetryProperties, capTelemetryText, REDACTED_EMAIL, REDACTED_URL, REDACTED_PATH } from "./redact.ts";
|
|
8
|
+
export { subscribeTelemetryProjection } from "./projection.ts";
|
|
9
|
+
export type { TelemetryProjectionOptions } from "./projection.ts";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { defineEvent, defineSessionEvent, FRAMEWORK_TELEMETRY_EVENTS, RESERVED_TELEMETRY_KEYS, FORBIDDEN_TELEMETRY_KEYS, } from "./events.js";
|
|
2
|
+
export { nullTelemetryAppender, ConsoleAppender, MemoryAppender } from "./appender.js";
|
|
3
|
+
export { createTelemetryService, noopTelemetryService } from "./service.js";
|
|
4
|
+
export { redactTelemetryString, redactTelemetryProperties, capTelemetryText, REDACTED_EMAIL, REDACTED_URL, REDACTED_PATH } from "./redact.js";
|
|
5
|
+
export { subscribeTelemetryProjection } from "./projection.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in projection: the `AgentEvent` stream → registry events.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `tracing/bridge.ts` in shape (subscribe to a session's sink, keep per-address state,
|
|
5
|
+
* emit on lifecycle boundaries) but counts instead of building a tree. One subscription per
|
|
6
|
+
* session; sub-agents are told apart by `address`, which is stamped as a property here rather
|
|
7
|
+
* than by nested context views.
|
|
8
|
+
*
|
|
9
|
+
* Owns its own clock: `AgentEvent` carries no timestamp.
|
|
10
|
+
*
|
|
11
|
+
* Deliberately NOT projected: `assistant.delta`, `thinking.delta`, `tool.call.delta`,
|
|
12
|
+
* `content.part`, `history.*`, `log` — content or volume, never a count.
|
|
13
|
+
*/
|
|
14
|
+
import type { EventSink } from "../events/index.ts";
|
|
15
|
+
import type { FrameworkTelemetryEvents } from "./events.ts";
|
|
16
|
+
import type { TelemetryService } from "./service.ts";
|
|
17
|
+
export interface TelemetryProjectionOptions {
|
|
18
|
+
readonly now?: () => number;
|
|
19
|
+
/** Reported on `session_started`. The opener knows; the stream does not. */
|
|
20
|
+
readonly resumed?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function subscribeTelemetryProjection(sink: EventSink, telemetry: TelemetryService<FrameworkTelemetryEvents>, options?: TelemetryProjectionOptions): () => void;
|
|
23
|
+
//# sourceMappingURL=projection.d.ts.map
|