agentfootprint 7.6.1 → 7.8.0
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/CLAUDE.md +2 -1
- package/dist/adapters/llm/AnthropicProvider.js +15 -7
- package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BedrockProvider.js +5 -4
- package/dist/adapters/llm/BedrockProvider.js.map +1 -1
- package/dist/adapters/llm/BrowserAnthropicProvider.js +14 -7
- package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BrowserOpenAIProvider.js +13 -10
- package/dist/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/OpenAIProvider.js +8 -6
- package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/core/Agent.js +10 -0
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/LLMCall.js +10 -1
- package/dist/core/LLMCall.js.map +1 -1
- package/dist/core/RunnerBase.js +42 -12
- package/dist/core/RunnerBase.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +7 -3
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildAgentMessageApiChart.js +18 -1
- package/dist/core/agent/buildAgentMessageApiChart.js.map +1 -1
- package/dist/core/agent/buildMessageApiChart.js +4 -1
- package/dist/core/agent/buildMessageApiChart.js.map +1 -1
- package/dist/core/agent/stages/callLLM.js +18 -2
- package/dist/core/agent/stages/callLLM.js.map +1 -1
- package/dist/core-flow/Parallel.js +9 -1
- package/dist/core-flow/Parallel.js.map +1 -1
- package/dist/esm/adapters/llm/AnthropicProvider.d.ts +36 -3
- package/dist/esm/adapters/llm/AnthropicProvider.js +15 -7
- package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BedrockProvider.d.ts +3 -3
- package/dist/esm/adapters/llm/BedrockProvider.js +5 -4
- package/dist/esm/adapters/llm/BedrockProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.d.ts +16 -3
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js +14 -7
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.d.ts +5 -5
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +13 -10
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OpenAIProvider.d.ts +3 -3
- package/dist/esm/adapters/llm/OpenAIProvider.js +8 -6
- package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/types.d.ts +95 -2
- package/dist/esm/core/Agent.js +10 -0
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/LLMCall.js +10 -1
- package/dist/esm/core/LLMCall.js.map +1 -1
- package/dist/esm/core/RunnerBase.d.ts +22 -1
- package/dist/esm/core/RunnerBase.js +42 -12
- package/dist/esm/core/RunnerBase.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.d.ts +7 -3
- package/dist/esm/core/agent/buildAgentChart.js +7 -3
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildAgentMessageApiChart.js +18 -1
- package/dist/esm/core/agent/buildAgentMessageApiChart.js.map +1 -1
- package/dist/esm/core/agent/buildMessageApiChart.js +4 -1
- package/dist/esm/core/agent/buildMessageApiChart.js.map +1 -1
- package/dist/esm/core/agent/stages/callLLM.js +18 -2
- package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
- package/dist/esm/core/runner.d.ts +40 -5
- package/dist/esm/core-flow/Parallel.js +9 -1
- package/dist/esm/core-flow/Parallel.js.map +1 -1
- package/dist/esm/index.js +9 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/context-bisect/types.d.ts +9 -0
- package/dist/esm/lib/context-bisect/types.js.map +1 -1
- package/dist/esm/lib/recorded-chat/recordedChat.js +10 -1
- package/dist/esm/lib/recorded-chat/recordedChat.js.map +1 -1
- package/dist/esm/lib/recorded-chat/types.d.ts +10 -0
- package/dist/esm/observe.d.ts +3 -1
- package/dist/esm/observe.js +13 -1
- package/dist/esm/observe.js.map +1 -1
- package/dist/esm/providers.d.ts +1 -1
- package/dist/esm/recorders/core/EmitBridge.d.ts +9 -3
- package/dist/esm/recorders/core/EmitBridge.js +4 -3
- package/dist/esm/recorders/core/EmitBridge.js.map +1 -1
- package/dist/esm/recorders/core/ResilienceRecorder.d.ts +32 -0
- package/dist/esm/recorders/core/ResilienceRecorder.js +41 -0
- package/dist/esm/recorders/core/ResilienceRecorder.js.map +1 -0
- package/dist/esm/recorders/core/resilienceHooks.d.ts +34 -0
- package/dist/esm/recorders/core/resilienceHooks.js +74 -0
- package/dist/esm/recorders/core/resilienceHooks.js.map +1 -0
- package/dist/esm/recorders/core/typedEmit.d.ts +1 -2
- package/dist/esm/recorders/observability/BoundaryRecorder.d.ts +176 -12
- package/dist/esm/recorders/observability/BoundaryRecorder.js +119 -8
- package/dist/esm/recorders/observability/BoundaryRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/FlowchartRecorder.d.ts +13 -2
- package/dist/esm/recorders/observability/FlowchartRecorder.js +14 -3
- package/dist/esm/recorders/observability/FlowchartRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/localObservability.d.ts +66 -6
- package/dist/esm/recorders/observability/localObservability.js +27 -7
- package/dist/esm/recorders/observability/localObservability.js.map +1 -1
- package/dist/esm/recorders/observability/recordRun.d.ts +143 -0
- package/dist/esm/recorders/observability/recordRun.js +133 -0
- package/dist/esm/recorders/observability/recordRun.js.map +1 -0
- package/dist/esm/recorders/observability/trace.d.ts +65 -13
- package/dist/esm/recorders/observability/trace.js +36 -9
- package/dist/esm/recorders/observability/trace.js.map +1 -1
- package/dist/esm/reliability/buildReliabilityGateChart.d.ts +23 -9
- package/dist/esm/reliability/buildReliabilityGateChart.js +37 -10
- package/dist/esm/reliability/buildReliabilityGateChart.js.map +1 -1
- package/dist/esm/resilience/withCircuitBreaker.d.ts +15 -5
- package/dist/esm/resilience/withCircuitBreaker.js +14 -7
- package/dist/esm/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/esm/resilience/withFallback.d.ts +7 -1
- package/dist/esm/resilience/withFallback.js +30 -11
- package/dist/esm/resilience/withFallback.js.map +1 -1
- package/dist/esm/resilience/withRetry.d.ts +10 -5
- package/dist/esm/resilience/withRetry.js +53 -3
- package/dist/esm/resilience/withRetry.js.map +1 -1
- package/dist/esm/tool-providers/index.js +2 -2
- package/dist/esm/tool-providers/index.js.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/context-bisect/types.js.map +1 -1
- package/dist/lib/recorded-chat/recordedChat.js +10 -1
- package/dist/lib/recorded-chat/recordedChat.js.map +1 -1
- package/dist/observe.js +16 -2
- package/dist/observe.js.map +1 -1
- package/dist/recorders/core/EmitBridge.js +4 -3
- package/dist/recorders/core/EmitBridge.js.map +1 -1
- package/dist/recorders/core/ResilienceRecorder.js +45 -0
- package/dist/recorders/core/ResilienceRecorder.js.map +1 -0
- package/dist/recorders/core/resilienceHooks.js +78 -0
- package/dist/recorders/core/resilienceHooks.js.map +1 -0
- package/dist/recorders/observability/BoundaryRecorder.js +119 -8
- package/dist/recorders/observability/BoundaryRecorder.js.map +1 -1
- package/dist/recorders/observability/FlowchartRecorder.js +14 -3
- package/dist/recorders/observability/FlowchartRecorder.js.map +1 -1
- package/dist/recorders/observability/localObservability.js +27 -7
- package/dist/recorders/observability/localObservability.js.map +1 -1
- package/dist/recorders/observability/recordRun.js +137 -0
- package/dist/recorders/observability/recordRun.js.map +1 -0
- package/dist/recorders/observability/trace.js +36 -9
- package/dist/recorders/observability/trace.js.map +1 -1
- package/dist/reliability/buildReliabilityGateChart.js +37 -10
- package/dist/reliability/buildReliabilityGateChart.js.map +1 -1
- package/dist/resilience/withCircuitBreaker.js +14 -7
- package/dist/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/resilience/withFallback.js +30 -11
- package/dist/resilience/withFallback.js.map +1 -1
- package/dist/resilience/withRetry.js +53 -3
- package/dist/resilience/withRetry.js.map +1 -1
- package/dist/tool-providers/index.js +2 -2
- package/dist/tool-providers/index.js.map +1 -1
- package/dist/types/adapters/llm/AnthropicProvider.d.ts +36 -3
- package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BedrockProvider.d.ts +3 -3
- package/dist/types/adapters/llm/BedrockProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts +16 -3
- package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts +5 -5
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts +3 -3
- package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/types.d.ts +95 -2
- package/dist/types/adapters/types.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/LLMCall.d.ts.map +1 -1
- package/dist/types/core/RunnerBase.d.ts +22 -1
- package/dist/types/core/RunnerBase.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts +7 -3
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentMessageApiChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildMessageApiChart.d.ts.map +1 -1
- package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
- package/dist/types/core/runner.d.ts +40 -5
- package/dist/types/core/runner.d.ts.map +1 -1
- package/dist/types/core-flow/Parallel.d.ts.map +1 -1
- package/dist/types/lib/context-bisect/types.d.ts +9 -0
- package/dist/types/lib/context-bisect/types.d.ts.map +1 -1
- package/dist/types/lib/recorded-chat/recordedChat.d.ts.map +1 -1
- package/dist/types/lib/recorded-chat/types.d.ts +10 -0
- package/dist/types/lib/recorded-chat/types.d.ts.map +1 -1
- package/dist/types/observe.d.ts +3 -1
- package/dist/types/observe.d.ts.map +1 -1
- package/dist/types/providers.d.ts +1 -1
- package/dist/types/providers.d.ts.map +1 -1
- package/dist/types/recorders/core/EmitBridge.d.ts +9 -3
- package/dist/types/recorders/core/EmitBridge.d.ts.map +1 -1
- package/dist/types/recorders/core/ResilienceRecorder.d.ts +33 -0
- package/dist/types/recorders/core/ResilienceRecorder.d.ts.map +1 -0
- package/dist/types/recorders/core/resilienceHooks.d.ts +35 -0
- package/dist/types/recorders/core/resilienceHooks.d.ts.map +1 -0
- package/dist/types/recorders/core/typedEmit.d.ts +1 -2
- package/dist/types/recorders/core/typedEmit.d.ts.map +1 -1
- package/dist/types/recorders/observability/BoundaryRecorder.d.ts +176 -12
- package/dist/types/recorders/observability/BoundaryRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/FlowchartRecorder.d.ts +13 -2
- package/dist/types/recorders/observability/FlowchartRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/localObservability.d.ts +66 -6
- package/dist/types/recorders/observability/localObservability.d.ts.map +1 -1
- package/dist/types/recorders/observability/recordRun.d.ts +144 -0
- package/dist/types/recorders/observability/recordRun.d.ts.map +1 -0
- package/dist/types/recorders/observability/trace.d.ts +65 -13
- package/dist/types/recorders/observability/trace.d.ts.map +1 -1
- package/dist/types/reliability/buildReliabilityGateChart.d.ts +23 -9
- package/dist/types/reliability/buildReliabilityGateChart.d.ts.map +1 -1
- package/dist/types/resilience/withCircuitBreaker.d.ts +15 -5
- package/dist/types/resilience/withCircuitBreaker.d.ts.map +1 -1
- package/dist/types/resilience/withFallback.d.ts +7 -1
- package/dist/types/resilience/withFallback.d.ts.map +1 -1
- package/dist/types/resilience/withRetry.d.ts +10 -5
- package/dist/types/resilience/withRetry.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ResilienceRecorder — forwards the provider-decorator telemetry family
|
|
3
|
+
* to the dispatcher.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: Factory (GoF) returning an EmitBridge instance.
|
|
6
|
+
* Role: Bridges the three events the resilience decorators source
|
|
7
|
+
* (`fallback.triggered` / `error.retried` / `error.recovered`,
|
|
8
|
+
* emitted in-run by `resilienceHooks` via `typedEmit`) to the
|
|
9
|
+
* EventDispatcher so typed consumer listeners
|
|
10
|
+
* (`agent.on('agentfootprint.error.retried', …)`) fire. Without
|
|
11
|
+
* this bridge those emits hit the footprintjs emit channel but
|
|
12
|
+
* never reach the dispatcher.
|
|
13
|
+
* Emits: agentfootprint.fallback.triggered
|
|
14
|
+
* agentfootprint.error.retried
|
|
15
|
+
* agentfootprint.error.recovered
|
|
16
|
+
*
|
|
17
|
+
* Matched on EXACT full event names rather than the broader
|
|
18
|
+
* `agentfootprint.error.` prefix. `error.fatal` is dispatched directly by
|
|
19
|
+
* ErrorBridge (from footprintjs's `onRunFailed`, never via `$emit`), so a
|
|
20
|
+
* broad prefix would be harmless today — the exact names close the
|
|
21
|
+
* double-dispatch trap outright if that ever changes.
|
|
22
|
+
*
|
|
23
|
+
* NOTE: this is the DECORATOR family (fixed `maxAttempts` + exponential
|
|
24
|
+
* backoff). The rules-based reliability loop's dynamic decisions ride the
|
|
25
|
+
* `reliability.*` family and its own bridge — the two legitimately
|
|
26
|
+
* interleave in one stage but stay distinct. See docs/MENTAL_MODEL.md §14.
|
|
27
|
+
*/
|
|
28
|
+
import { EmitBridge, type EmitBridgeOptions } from './EmitBridge.js';
|
|
29
|
+
export type ResilienceRecorderOptions = Omit<EmitBridgeOptions, 'id' | 'prefix'> & {
|
|
30
|
+
readonly id?: string;
|
|
31
|
+
};
|
|
32
|
+
export declare function resilienceRecorder(options: ResilienceRecorderOptions): EmitBridge;
|
|
33
|
+
//# sourceMappingURL=ResilienceRecorder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResilienceRecorder.d.ts","sourceRoot":"","sources":["../../../../src/recorders/core/ResilienceRecorder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAErE,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,QAAQ,CAAC,GAAG;IACjF,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,UAAU,CAWjF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* resilienceHooks — turns a resilience decorator's `ResilienceReport`
|
|
3
|
+
* into an already-declared typed event, emitted from inside the run.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: Adapter (GoF) — one translation function, fact → event.
|
|
6
|
+
* Role: The seam between `src/resilience/` (which knows nothing about
|
|
7
|
+
* runs, scopes or events) and the in-run LLM call sites (which
|
|
8
|
+
* hold a live scope). The decorator REPORTS; this maps the
|
|
9
|
+
* report to `typedEmit`, so correlation ids come from
|
|
10
|
+
* footprintjs's traversal rather than being synthesized.
|
|
11
|
+
* Emits: agentfootprint.fallback.triggered
|
|
12
|
+
* agentfootprint.error.retried
|
|
13
|
+
* agentfootprint.error.recovered
|
|
14
|
+
*
|
|
15
|
+
* Why here and not in the decorators: a decorator is constructed by the
|
|
16
|
+
* consumer BEFORE any run exists, so it can never reach a scope. Passing
|
|
17
|
+
* the hooks object per call is what lets the report cross that boundary.
|
|
18
|
+
*
|
|
19
|
+
* Every declared payload field is filled from a report field of the same
|
|
20
|
+
* name — nothing is synthesized. `FallbackTriggeredPayload.kind` is the
|
|
21
|
+
* literal `'provider'`; its `'tool'`/`'skill'` arms stay unused.
|
|
22
|
+
*/
|
|
23
|
+
import type { LLMCallHooks } from '../../adapters/types.js';
|
|
24
|
+
import { type EmitableScope } from './typedEmit.js';
|
|
25
|
+
/**
|
|
26
|
+
* Build the per-call hooks object for one stage. Hoist it once per stage
|
|
27
|
+
* rather than per attempt — it is stateless and safe to reuse across
|
|
28
|
+
* reliability-loop iterations.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const providerHooks = resilienceHooks(scope);
|
|
32
|
+
* const response = await provider.complete(request, providerHooks);
|
|
33
|
+
*/
|
|
34
|
+
export declare function resilienceHooks(scope: EmitableScope): LLMCallHooks;
|
|
35
|
+
//# sourceMappingURL=resilienceHooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resilienceHooks.d.ts","sourceRoot":"","sources":["../../../../src/recorders/core/resilienceHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CAuClE"}
|
|
@@ -14,7 +14,7 @@ import type { AgentfootprintEventMap, AgentfootprintEventType } from '../../even
|
|
|
14
14
|
* footprintjs's `TypedScope<T>`, whose `$emit(name, payload?: unknown)` is
|
|
15
15
|
* wider than this.
|
|
16
16
|
*/
|
|
17
|
-
interface EmitableScope {
|
|
17
|
+
export interface EmitableScope {
|
|
18
18
|
$emit(name: string, payload?: unknown): void;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
@@ -31,5 +31,4 @@ interface EmitableScope {
|
|
|
31
31
|
* });
|
|
32
32
|
*/
|
|
33
33
|
export declare function typedEmit<K extends AgentfootprintEventType>(scope: EmitableScope, type: K, payload: AgentfootprintEventMap[K]['payload']): void;
|
|
34
|
-
export {};
|
|
35
34
|
//# sourceMappingURL=typedEmit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typedEmit.d.ts","sourceRoot":"","sources":["../../../../src/recorders/core/typedEmit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEhG;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"typedEmit.d.ts","sourceRoot":"","sources":["../../../../src/recorders/core/typedEmit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEhG;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9C;AA4BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,uBAAuB,EACzD,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAC5C,IAAI,CAGN"}
|
|
@@ -53,11 +53,35 @@
|
|
|
53
53
|
* design follows the React Fiber + OpenTelemetry pattern:
|
|
54
54
|
* **producers self-describe; consumers dispatch on type**.
|
|
55
55
|
*
|
|
56
|
+
* WIRING — THREE PARTS, ALL AT RECORD TIME
|
|
57
|
+
* ────────────────────────────────────────
|
|
58
|
+
* This recorder hears half a run per connection, and the half it misses
|
|
59
|
+
* cannot be reconstructed afterwards. All three go on BEFORE `run()`:
|
|
60
|
+
*
|
|
61
|
+
* 1. `runner.attach(boundary)` — the footprintjs control-flow channel:
|
|
62
|
+
* run / subflow entry and exit, forks, decisions, loops. Without it
|
|
63
|
+
* there are no boundaries at all.
|
|
64
|
+
* 2. `boundary.subscribe(runner)` — the agentfootprint typed stream:
|
|
65
|
+
* `llm.*`, `tool.*`, `context.injected`. Without it the boundaries
|
|
66
|
+
* have no content: no model calls, no tool calls, no injections.
|
|
67
|
+
* 3. `{ getCommitCount }` — where each boundary sits on the commit
|
|
68
|
+
* axis. Without it every event is stamped `commitIdxBefore: 0` and
|
|
69
|
+
* the step strip cannot be rebuilt from the recording later. This
|
|
70
|
+
* one fails SILENTLY — the events all look fine.
|
|
71
|
+
*
|
|
72
|
+
* There is no after-the-fact fix for any of the three: a completed run
|
|
73
|
+
* leaves a snapshot and a commit log, and neither says where a boundary
|
|
74
|
+
* opened relative to the commits. `recordRun(runner)` does all three and
|
|
75
|
+
* hands back `{ snapshot, events, structure }` — reach for it first, and
|
|
76
|
+
* wire by hand only when you need a shape it doesn't produce.
|
|
77
|
+
*
|
|
56
78
|
* @example
|
|
57
79
|
* ```typescript
|
|
58
80
|
* import { boundaryRecorder, EventDispatcher } from 'agentfootprint';
|
|
59
81
|
*
|
|
60
|
-
* const boundary = boundaryRecorder(
|
|
82
|
+
* const boundary = boundaryRecorder({
|
|
83
|
+
* getCommitCount: () => executor.getCommitCount(), // the commit axis
|
|
84
|
+
* });
|
|
61
85
|
* const dispatcher = new EventDispatcher();
|
|
62
86
|
* executor.attachCombinedRecorder(boundary); // wires FlowRecorder side
|
|
63
87
|
* boundary.subscribe(dispatcher); // wires typed-event side
|
|
@@ -88,7 +112,8 @@ interface FlowRunFailedEvent {
|
|
|
88
112
|
};
|
|
89
113
|
readonly traversalContext?: TraversalContext;
|
|
90
114
|
}
|
|
91
|
-
import type {
|
|
115
|
+
import type { AgentfootprintEvent } from '../../events/registry.js';
|
|
116
|
+
import type { Unsubscribe } from '../../events/dispatcher.js';
|
|
92
117
|
import type { ContextSlot } from '../../events/types.js';
|
|
93
118
|
/** Fields every domain event carries. */
|
|
94
119
|
interface DomainEventBase {
|
|
@@ -269,6 +294,45 @@ export interface DomainContextInjectedEvent extends DomainEventBase {
|
|
|
269
294
|
}
|
|
270
295
|
/** Discriminated union covering every observable moment in a run. */
|
|
271
296
|
export type DomainEvent = DomainRunEvent | DomainSubflowEvent | DomainCompositionEvent | DomainForkBranchEvent | DomainDecisionBranchEvent | DomainLoopIterationEvent | DomainLLMStartEvent | DomainLLMEndEvent | DomainToolStartEvent | DomainToolEndEvent | DomainContextInjectedEvent;
|
|
297
|
+
/**
|
|
298
|
+
* The `DomainEvent` fields that carry captured run CONTENT — what the
|
|
299
|
+
* agent read, produced, and handed across a boundary — as opposed to
|
|
300
|
+
* run STRUCTURE (where a boundary was, when, of what kind). These are
|
|
301
|
+
* the fields `snapshot: 'lean'` drops.
|
|
302
|
+
*
|
|
303
|
+
* They are also exactly the fields `buildStepGraphFromEvents` turns
|
|
304
|
+
* into StepNode content (`entryPayload` / `exitPayload` /
|
|
305
|
+
* `contentSummary` / `assistantText` / `toolArgs` / `toolResult`) —
|
|
306
|
+
* which is why dropping them is opt-in rather than the default.
|
|
307
|
+
*
|
|
308
|
+
* When you add a field to a `Domain*Event`, decide:
|
|
309
|
+
* - Does it hold data the agent handled (unbounded, redaction-
|
|
310
|
+
* relevant)? → add it HERE
|
|
311
|
+
* - Does it say where/when/what-kind the boundary was? → leave it out
|
|
312
|
+
*
|
|
313
|
+
* Forgetting to add one means a lean snapshot still ships that content
|
|
314
|
+
* — silently, since nothing else references the field.
|
|
315
|
+
*
|
|
316
|
+
* Two free-text fields deliberately stay OUT of this set: `rationale`
|
|
317
|
+
* on `decision.branch` and `reason` on `context.injected`. They are
|
|
318
|
+
* short capture-time annotations saying WHY a boundary happened, and a
|
|
319
|
+
* lean bundle loses most of its explanatory value without them — but a
|
|
320
|
+
* decider that interpolates run values into its rationale does put that
|
|
321
|
+
* text in a lean artifact. Lean means "no captured payloads", not "no
|
|
322
|
+
* free text at all"; say so wherever lean is offered as a redaction
|
|
323
|
+
* story.
|
|
324
|
+
*/
|
|
325
|
+
declare const CONTENT_FIELDS: readonly ["payload", "args", "result", "content", "contentSummary"];
|
|
326
|
+
type ContentField = (typeof CONTENT_FIELDS)[number];
|
|
327
|
+
/**
|
|
328
|
+
* A `DomainEvent` with its content fields removed — the shape
|
|
329
|
+
* `toSnapshot()` emits under `snapshot: 'lean'`.
|
|
330
|
+
*
|
|
331
|
+
* Distributive by construction (`T extends unknown ? … : never`) so the
|
|
332
|
+
* union survives the `Omit` and `type` still narrows for consumers.
|
|
333
|
+
*/
|
|
334
|
+
type StripContent<T> = T extends unknown ? Omit<T, ContentField> : never;
|
|
335
|
+
export type LeanDomainEvent = StripContent<DomainEvent>;
|
|
272
336
|
/**
|
|
273
337
|
* Per-boundary rollup returned by
|
|
274
338
|
* `BoundaryRecorder.aggregateForBoundary` and
|
|
@@ -314,18 +378,82 @@ export interface BoundaryAggregate {
|
|
|
314
378
|
/** `endedAtMs - startedAtMs`. Undefined while in flight. */
|
|
315
379
|
readonly durationMs?: number;
|
|
316
380
|
}
|
|
381
|
+
/**
|
|
382
|
+
* Anything that can hand out every typed event as it fires — the one
|
|
383
|
+
* capability `BoundaryRecorder.subscribe()` needs.
|
|
384
|
+
*
|
|
385
|
+
* A `Runner` satisfies this (`runner.on('*', …)`) and so does the
|
|
386
|
+
* internal `EventDispatcher`, which is the point: wiring the recorder's
|
|
387
|
+
* typed half never requires reaching past the public runner for a
|
|
388
|
+
* dispatcher it doesn't hand out.
|
|
389
|
+
*/
|
|
390
|
+
export interface TypedEventSource {
|
|
391
|
+
on(type: '*', listener: (event: AgentfootprintEvent) => void): Unsubscribe;
|
|
392
|
+
}
|
|
317
393
|
export interface BoundaryRecorderOptions {
|
|
318
394
|
readonly id?: string;
|
|
319
395
|
/**
|
|
320
|
-
* Live commit-count accessor —
|
|
321
|
-
*
|
|
396
|
+
* Live commit-count accessor — `() => runner.getCommitCount()` on an
|
|
397
|
+
* agentfootprint runner, or `() => executor.getCommitCount()` on a raw
|
|
398
|
+
* footprintjs executor (5.1+). When provided:
|
|
322
399
|
* - Every DomainEvent gains `commitIdxBefore` / `commitIdxAfter`.
|
|
323
400
|
* - `recorder.boundaryIndex` is populated with open/close ranges
|
|
324
401
|
* keyed on each subflow's entry event.
|
|
325
|
-
*
|
|
326
|
-
*
|
|
402
|
+
*
|
|
403
|
+
* **Omitting it produces a recording whose step strip cannot be
|
|
404
|
+
* rebuilt.** Every event is stamped `commitIdxBefore: 0`, so every
|
|
405
|
+
* boundary claims to have opened at the same instant; `boundaryIndex`
|
|
406
|
+
* is deliberately left EMPTY rather than filled with zero-width
|
|
407
|
+
* `[0, 0]` ranges that would read as real. Offline, a consumer
|
|
408
|
+
* replaying this bundle sees no positions to place, so the strip stays
|
|
409
|
+
* quiet — the honest outcome, and an unrecoverable one: the commit log
|
|
410
|
+
* records what each stage WROTE, never when a boundary was crossed
|
|
411
|
+
* relative to it, so nothing downstream can derive the axis after the
|
|
412
|
+
* fact. There is no error and the events otherwise look complete,
|
|
413
|
+
* which is exactly why this is called out here.
|
|
414
|
+
*
|
|
415
|
+
* Sample it live — a closure over the runner, not a captured number.
|
|
416
|
+
* The count is meaningless before the run starts and must be read at
|
|
417
|
+
* the moment each boundary fires. Phase 5 Layer 2.
|
|
327
418
|
*/
|
|
328
419
|
readonly getCommitCount?: () => number;
|
|
420
|
+
/**
|
|
421
|
+
* How much of each event `toSnapshot()` carries into
|
|
422
|
+
* `runtimeSnapshot.recorders`.
|
|
423
|
+
*
|
|
424
|
+
* - `'full'` (default) — every field, content included. Required by
|
|
425
|
+
* `buildStepGraphFromEvents()`: an offline `<Replay>` restores its
|
|
426
|
+
* entry/exit payloads, assistant text, tool args and tool results
|
|
427
|
+
* from this bundle and nowhere else.
|
|
428
|
+
* - `'lean'` — boundary STRUCTURE only. Drops the five content
|
|
429
|
+
* fields (`payload`, `args`, `result`, `content`,
|
|
430
|
+
* `contentSummary`); keeps every field that says WHERE, WHEN and
|
|
431
|
+
* OF WHAT KIND each boundary was, so the commit-range index
|
|
432
|
+
* rebuilds range for range offline. Sized on one demo turn (4
|
|
433
|
+
* ReAct iterations, 4 LLM calls, 3 tool calls, run end to end on
|
|
434
|
+
* a mock provider): the bundle this method returned was 69.7 KB
|
|
435
|
+
* raw / 4.6 KB gzipped, its lean projection 21.7 KB / 1.9 KB —
|
|
436
|
+
* content was 69% of the raw bytes, and a consumer rebuilding
|
|
437
|
+
* only the index reads none of it. Same run measured twice; that
|
|
438
|
+
* turn's content was the entry/exit payloads, since only the
|
|
439
|
+
* boundary side of this recorder was attached — a run that also
|
|
440
|
+
* `subscribe()`s the typed-event side carries tool args, tool
|
|
441
|
+
* results and assistant text in there too. (The replay fixture
|
|
442
|
+
* the suite measures reports a much larger full bundle — it
|
|
443
|
+
* stands in for each subflow's missing entry seed with that
|
|
444
|
+
* subflow's final state, so it serializes the state twice per
|
|
445
|
+
* boundary. Don't quote it.)
|
|
446
|
+
*
|
|
447
|
+
* Same reasoning as `BoundaryRangeLabel`: a stored artifact shouldn't
|
|
448
|
+
* become a second, redaction-bypassing copy of everything the agent
|
|
449
|
+
* read and wrote. Consumers that DO want content join back on
|
|
450
|
+
* `runtimeStageId` against the run's own snapshot.
|
|
451
|
+
*
|
|
452
|
+
* `'full'` stays the default because this bundle has carried content
|
|
453
|
+
* since it shipped (v2.x, 2026-04-27) and offline consumers depend on
|
|
454
|
+
* that silently — a lean default would quietly empty their replays.
|
|
455
|
+
*/
|
|
456
|
+
readonly snapshot?: 'full' | 'lean';
|
|
329
457
|
}
|
|
330
458
|
/**
|
|
331
459
|
* Stripped projection used as the LABEL for the commit-range index.
|
|
@@ -390,6 +518,10 @@ export declare class BoundaryRecorder implements CombinedRecorder {
|
|
|
390
518
|
* zero-width [0,0] ranges would mislead consumers querying the
|
|
391
519
|
* index. Multi-panel review flagged this footgun. */
|
|
392
520
|
private readonly hasCommitTracking;
|
|
521
|
+
/** Snapshot verbosity — see `BoundaryRecorderOptions.snapshot`. Only
|
|
522
|
+
* `toSnapshot()` reads it; the live event stream from `getEvents()`
|
|
523
|
+
* is always full, so in-process consumers are never affected. */
|
|
524
|
+
private readonly snapshotMode;
|
|
393
525
|
/**
|
|
394
526
|
* Tracks whether the most recent `llm.end` had toolCalls. Used to
|
|
395
527
|
* classify the NEXT `llm.start` as `'tool→llm'` (vs `'user→llm'` if
|
|
@@ -458,14 +590,21 @@ export declare class BoundaryRecorder implements CombinedRecorder {
|
|
|
458
590
|
onDecision(event: FlowDecisionEvent): void;
|
|
459
591
|
onLoop(event: FlowLoopEvent): void;
|
|
460
592
|
/**
|
|
461
|
-
* Subscribe to the
|
|
462
|
-
*
|
|
593
|
+
* Subscribe to the run's typed events and emit a domain event for each
|
|
594
|
+
* `llm.*` / `tool.*` / `context.injected` one. This is the recorder's
|
|
595
|
+
* SECOND half — `runner.attach(...)` supplies the boundaries, this
|
|
596
|
+
* supplies what happened inside them. Wire both, before the run.
|
|
597
|
+
*
|
|
598
|
+
* Takes anything that offers a wildcard subscription, which a public
|
|
599
|
+
* `Runner` does as readily as the internal `EventDispatcher` — so a
|
|
600
|
+
* consumer never has to reach past `runner.on` for a dispatcher it
|
|
601
|
+
* isn't given.
|
|
463
602
|
*
|
|
464
603
|
* Returns an unsubscribe function; safe to call multiple times (each
|
|
465
604
|
* call adds a new subscription). Most consumers call this once at
|
|
466
605
|
* recorder construction and dispose with the returned function.
|
|
467
606
|
*/
|
|
468
|
-
subscribe(
|
|
607
|
+
subscribe(source: TypedEventSource): Unsubscribe;
|
|
469
608
|
private ingestTypedEvent;
|
|
470
609
|
/** All events in capture order (the canonical projection). */
|
|
471
610
|
getEvents(): DomainEvent[];
|
|
@@ -535,12 +674,37 @@ export declare class BoundaryRecorder implements CombinedRecorder {
|
|
|
535
674
|
*/
|
|
536
675
|
aggregateAllBoundaries(): readonly BoundaryAggregate[];
|
|
537
676
|
/** Snapshot bundle — included in `executor.getSnapshot()` if the
|
|
538
|
-
* executor implements the snapshot extension protocol.
|
|
677
|
+
* executor implements the snapshot extension protocol.
|
|
678
|
+
*
|
|
679
|
+
* Under `snapshot: 'lean'` the bundle carries structure only, and
|
|
680
|
+
* `meta.mode` says so. That field is the whole point: an offline
|
|
681
|
+
* consumer holding a lean bundle can then SAY "this recording carries
|
|
682
|
+
* structure only" instead of drawing empty detail panels, because
|
|
683
|
+
* `buildStepGraphFromEvents()` restores step content from this bundle
|
|
684
|
+
* and nowhere else. `description` still carries the same fact in
|
|
685
|
+
* prose for a human reading the JSON — but prose is not something
|
|
686
|
+
* code branches on, and the readers that had to string-match it
|
|
687
|
+
* didn't.
|
|
688
|
+
*
|
|
689
|
+
* `meta` reaches `getSnapshot().recorders[i].meta` on footprintjs
|
|
690
|
+
* 9.12+, which copies it through; older engines rebuild the row
|
|
691
|
+
* without it and the field is dropped in transit. It is always on the
|
|
692
|
+
* value THIS method returns, so a producer holding the recorder
|
|
693
|
+
* (`recordRun`) can read it either way.
|
|
694
|
+
*
|
|
695
|
+
* `data` is annotated rather than inferred: a lean event is a
|
|
696
|
+
* structural SUPERtype of a full one, so inference collapses the
|
|
697
|
+
* union to `LeanDomainEvent[]` and full-mode callers silently lose
|
|
698
|
+
* `payload` / `content` / … from the type. Narrow on the mode you
|
|
699
|
+
* configured. */
|
|
539
700
|
toSnapshot(): {
|
|
540
701
|
name: string;
|
|
541
702
|
description: string;
|
|
542
|
-
preferredOperation:
|
|
543
|
-
data: DomainEvent[];
|
|
703
|
+
preferredOperation: 'translate';
|
|
704
|
+
data: DomainEvent[] | LeanDomainEvent[];
|
|
705
|
+
meta: {
|
|
706
|
+
readonly mode: 'full' | 'lean';
|
|
707
|
+
};
|
|
544
708
|
};
|
|
545
709
|
}
|
|
546
710
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoundaryRecorder.d.ts","sourceRoot":"","sources":["../../../../src/recorders/observability/BoundaryRecorder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BoundaryRecorder.d.ts","sourceRoot":"","sources":["../../../../src/recorders/observability/BoundaryRecorder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B,KAAK,CAAC,EAAE,cAAc,CAAC;QACvB,IAAI,CAAC,EAAE,cAAc,CAAC;KACvB;IAQD,4EAA4E;IAC5E,iBAAiB,IAAI;QACnB,YAAY,EAAE,kBAAkB,EAAE,CAAC;QACnC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;QAC/B,KAAK,EAAE,kBAAkB,EAAE,CAAC;KAC7B;IAaD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAY3E;;;;;;;;;;OAUG;IACH,sBAAsB,IAAI,SAAS,iBAAiB,EAAE;IAkBtD;;;;;;;;;;;;;;;;;;;;;;;sBAuBkB;IAClB,UAAU,IAAI;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,kBAAkB,EAAE,WAAW,CAAC;QAChC,IAAI,EAAE,WAAW,EAAE,GAAG,eAAe,EAAE,CAAC;QACxC,IAAI,EAAE;YAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KAC1C;CAYF"}
|
|
@@ -181,7 +181,9 @@ export interface FlowchartHandle {
|
|
|
181
181
|
/**
|
|
182
182
|
* Attach a live FlowchartRecorder to a runner.
|
|
183
183
|
*
|
|
184
|
-
* 1. Creates a `BoundaryRecorder` (the unified domain event log)
|
|
184
|
+
* 1. Creates a `BoundaryRecorder` (the unified domain event log) with
|
|
185
|
+
* commit tracking, so every boundary records WHERE on the commit
|
|
186
|
+
* axis it happened.
|
|
185
187
|
* 2. Attaches it to the executor's FlowRecorder channel via
|
|
186
188
|
* `runnerAttach` — captures run / subflow / fork / decision / loop.
|
|
187
189
|
* 3. Subscribes it to the dispatcher — captures llm.* / tool.* /
|
|
@@ -189,9 +191,18 @@ export interface FlowchartHandle {
|
|
|
189
191
|
* 4. Wires `onUpdate` so the consumer sees a fresh derived StepGraph
|
|
190
192
|
* on every event.
|
|
191
193
|
*
|
|
194
|
+
* @param getCommitCount where each boundary sits on the run's commit
|
|
195
|
+
* axis — the runner's `getCommitCount()`, sampled live. Optional only
|
|
196
|
+
* because a caller may have no runner to sample; omitting it stamps
|
|
197
|
+
* every boundary `commitIdxBefore: 0`, which reads as "all boundaries
|
|
198
|
+
* opened at once" and leaves an offline step strip with nothing to
|
|
199
|
+
* place. Nothing downstream can repair it — the commit log records
|
|
200
|
+
* what stages wrote, never when a boundary was crossed — so the
|
|
201
|
+
* runner always passes it.
|
|
202
|
+
*
|
|
192
203
|
* @internal Called from `RunnerBase.enable.flowchart`.
|
|
193
204
|
*/
|
|
194
|
-
export declare function attachFlowchart(runnerAttach: (recorder: CombinedRecorder) => () => void, dispatcher: EventDispatcher, options?: FlowchartOptions): FlowchartHandle;
|
|
205
|
+
export declare function attachFlowchart(runnerAttach: (recorder: CombinedRecorder) => () => void, dispatcher: EventDispatcher, options?: FlowchartOptions, getCommitCount?: () => number): FlowchartHandle;
|
|
195
206
|
/**
|
|
196
207
|
* Project a `BoundaryRecorder`'s event stream into a `StepGraph`.
|
|
197
208
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowchartRecorder.d.ts","sourceRoot":"","sources":["../../../../src/recorders/observability/FlowchartRecorder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACL,gBAAgB,EAEhB,KAAK,WAAW,EAEjB,MAAM,uBAAuB,CAAC;AAI/B;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EACT,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,GACT,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AC5B,eAAe,CAmCjB;AAwED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,GAAG,SAAS,CAyTlF"}
|
|
@@ -3,10 +3,24 @@
|
|
|
3
3
|
* render it live, and snapshot it for offline replay.
|
|
4
4
|
*
|
|
5
5
|
* One handle, two outputs:
|
|
6
|
-
* - LIVE — `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* - LIVE — `onLive(graph)` fires per event with a fresh `StepGraph`; hand
|
|
7
|
+
* it to your own renderer, or read `handle.getSnapshot()` /
|
|
8
|
+
* `handle.boundary` whenever you like.
|
|
9
|
+
* - OFFLINE— `getTrace()` (any time) and `onRecorded(trace)` (auto, at run
|
|
10
|
+
* exit) freeze the model into a JSON-lossless `Trace`.
|
|
11
|
+
*
|
|
12
|
+
* This handle is NOT a Lens recorder. `<Lens recorder={…} />` wants a
|
|
13
|
+
* `LensRecorder` — a different object with a different surface — and passing
|
|
14
|
+
* this one gives a component with none of the members it calls. To put a run
|
|
15
|
+
* in front of Lens, record it and hand the recording over:
|
|
16
|
+
*
|
|
17
|
+
* const stop = recordRun(agent); // agentfootprint/observe
|
|
18
|
+
* await agent.run({ message });
|
|
19
|
+
* const recording = stop.toRecording(); // { snapshot, events, structure }
|
|
20
|
+
*
|
|
21
|
+
* // …in the viewer:
|
|
22
|
+
* const { recorder, runner } = observeRecording(recording); // lens
|
|
23
|
+
* <Lens recorder={recorder} runner={runner} />
|
|
10
24
|
*
|
|
11
25
|
* Contrast with `enable.observability({ strategy })` (Tier-4 / Monitor), which
|
|
12
26
|
* ships each event to a vendor and FORGETS. localObservability KEEPS the model
|
|
@@ -22,7 +36,7 @@ import type { DomainEvent } from './BoundaryRecorder.js';
|
|
|
22
36
|
import { type FlowchartHandle, type StepGraph } from './FlowchartRecorder.js';
|
|
23
37
|
import { type SerializeTraceOptions, type Trace } from './trace.js';
|
|
24
38
|
export interface LocalObservabilityOptions {
|
|
25
|
-
/** LIVE recording — called with a fresh StepGraph on every event
|
|
39
|
+
/** LIVE recording — called with a fresh StepGraph on every event. */
|
|
26
40
|
readonly onLive?: (graph: StepGraph) => void;
|
|
27
41
|
/** At run exit — called once with the finalized recording (a Trace, auto-serialized) to replay offline. */
|
|
28
42
|
readonly onRecorded?: (trace: Trace) => void;
|
|
@@ -33,6 +47,52 @@ export interface LocalObservabilityOptions {
|
|
|
33
47
|
* Pass `redactContent` for a ready-made redactor.
|
|
34
48
|
*/
|
|
35
49
|
readonly redact?: (event: DomainEvent) => DomainEvent;
|
|
50
|
+
/**
|
|
51
|
+
* Carry the run's footprintjs snapshot (state + commit log + recorder
|
|
52
|
+
* data) in the Trace. Default `false`.
|
|
53
|
+
*
|
|
54
|
+
* A Trace WITHOUT it draws a chart and a timeline and nothing else: the
|
|
55
|
+
* commit axis, ExplainableShell's memory and provenance panels, and
|
|
56
|
+
* WhereFrom all read the commit log, which lives in the snapshot and
|
|
57
|
+
* appears nowhere in the event log. Turn this on and the Trace can feed
|
|
58
|
+
* them.
|
|
59
|
+
*
|
|
60
|
+
* Off by default because of `redact`, not because of size. `redact` is a
|
|
61
|
+
* per-DOMAIN-EVENT function — it cannot reach inside a snapshot, whose
|
|
62
|
+
* `sharedState` is the run's raw working memory. Filling this field
|
|
63
|
+
* automatically would have widened what a carefully redacted Trace
|
|
64
|
+
* exports without a line of code changing at any call site, which is the
|
|
65
|
+
* kind of quiet trust-boundary move a library has no business making.
|
|
66
|
+
* When you turn it on, redaction for the snapshot half is footprintjs's
|
|
67
|
+
* `setRedactionPolicy()` at run time — the run's own policy, applied when
|
|
68
|
+
* the values were written.
|
|
69
|
+
*
|
|
70
|
+
* For a viewer, prefer `recordRun()`: `{ snapshot, events, structure }`
|
|
71
|
+
* is the shape the UIs consume, and it is explicit about carrying state.
|
|
72
|
+
*/
|
|
73
|
+
readonly includeSnapshot?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The three things a live runner knows that a recorder cannot see for
|
|
77
|
+
* itself. Each one lights a different surface of the stored Trace, and a
|
|
78
|
+
* missing one degrades exactly that surface:
|
|
79
|
+
*
|
|
80
|
+
* - `getStructure` → the chart. Nothing else can draw it.
|
|
81
|
+
* - `getSnapshot` → state, commit log, every attached recorder's data.
|
|
82
|
+
* - `getCommitCount` → where each boundary sits on the commit axis.
|
|
83
|
+
*
|
|
84
|
+
* All three are read lazily, at the moment they are needed, because all
|
|
85
|
+
* three answer differently before, during and after a run.
|
|
86
|
+
*
|
|
87
|
+
* @internal Supplied by `RunnerBase.enable.localObservability`.
|
|
88
|
+
*/
|
|
89
|
+
export interface RunAccess {
|
|
90
|
+
/** `() => runner.getSpec().buildTimeStructure` — the static chart. */
|
|
91
|
+
readonly getStructure?: () => unknown;
|
|
92
|
+
/** `() => runner.getLastSnapshot()` — the footprintjs run snapshot. */
|
|
93
|
+
readonly getSnapshot?: () => unknown;
|
|
94
|
+
/** `() => runner.getCommitCount()` — sampled live on every boundary. */
|
|
95
|
+
readonly getCommitCount?: () => number;
|
|
36
96
|
}
|
|
37
97
|
/** A `FlowchartHandle` (live) plus `getTrace()` (offline snapshot). */
|
|
38
98
|
export interface LocalObservabilityHandle extends FlowchartHandle {
|
|
@@ -45,5 +105,5 @@ export interface LocalObservabilityHandle extends FlowchartHandle {
|
|
|
45
105
|
*
|
|
46
106
|
* @internal Called from `RunnerBase.enable.localObservability`.
|
|
47
107
|
*/
|
|
48
|
-
export declare function attachLocalObservability(runnerAttach: (recorder: CombinedRecorder) => () => void, dispatcher: EventDispatcher, options?: LocalObservabilityOptions, now?: () => number,
|
|
108
|
+
export declare function attachLocalObservability(runnerAttach: (recorder: CombinedRecorder) => () => void, dispatcher: EventDispatcher, options?: LocalObservabilityOptions, now?: () => number, access?: RunAccess): LocalObservabilityHandle;
|
|
49
109
|
//# sourceMappingURL=localObservability.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localObservability.d.ts","sourceRoot":"","sources":["../../../../src/recorders/observability/localObservability.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"localObservability.d.ts","sourceRoot":"","sources":["../../../../src/recorders/observability/localObservability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAmB,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAAkB,KAAK,qBAAqB,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEpF,MAAM,WAAW,yBAAyB;IACxC,qEAAqE;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAC7C,2GAA2G;IAC3G,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC7C;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,WAAW,CAAC;IACtD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,SAAS;IACxB,sEAAsE;IACtE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC;IACtC,uEAAuE;IACvE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC;IACrC,wEAAwE;IACxE,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