@smthrs/observability 0.34.0 → 0.35.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/package.json +1 -1
- package/src/SmithersEvent.ts +46 -1
- package/src/index.d.ts +51 -2
- package/src/index.js +2 -1
- package/src/logging.js +17 -1
- package/src/metrics/index.d.ts +38 -1
package/package.json
CHANGED
package/src/SmithersEvent.ts
CHANGED
|
@@ -25,6 +25,7 @@ type RunState =
|
|
|
25
25
|
| "failed"
|
|
26
26
|
| "cancelled"
|
|
27
27
|
| "succeeded"
|
|
28
|
+
| "succeeded-with-failures"
|
|
28
29
|
| "unknown";
|
|
29
30
|
|
|
30
31
|
type AgentCliActionKind =
|
|
@@ -77,6 +78,15 @@ type AgentCliCompletedEvent = {
|
|
|
77
78
|
|
|
78
79
|
type AgentCliEvent = AgentCliStartedEvent | AgentCliActionEvent | AgentCliCompletedEvent;
|
|
79
80
|
|
|
81
|
+
export type RunCancellationSource = {
|
|
82
|
+
kind: "signal" | "rpc" | "cli" | "engine";
|
|
83
|
+
detail?: string;
|
|
84
|
+
signal?: string;
|
|
85
|
+
clientPid?: number;
|
|
86
|
+
requestId?: string;
|
|
87
|
+
clientIdentity?: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
80
90
|
export type SmithersEvent =
|
|
81
91
|
| {
|
|
82
92
|
type: "SupervisorStarted";
|
|
@@ -121,6 +131,20 @@ export type SmithersEvent =
|
|
|
121
131
|
after: RunState;
|
|
122
132
|
timestampMs: number;
|
|
123
133
|
}
|
|
134
|
+
| {
|
|
135
|
+
type: "RunConcurrencySaturated";
|
|
136
|
+
runId: string;
|
|
137
|
+
requestedDemand: number;
|
|
138
|
+
effectiveCap: number;
|
|
139
|
+
remediationCommand: string;
|
|
140
|
+
/** Present when a lifecycle-linked descendant caused the owner's budget to saturate. */
|
|
141
|
+
descendantRunId?: string;
|
|
142
|
+
/** Which owner budget bound admission. Historical events omit this. */
|
|
143
|
+
budget?: "run" | "subtree";
|
|
144
|
+
/** Present when `budget` is `subtree`. */
|
|
145
|
+
subtreeGroupId?: string;
|
|
146
|
+
timestampMs: number;
|
|
147
|
+
}
|
|
124
148
|
| {
|
|
125
149
|
type: "RunFinished";
|
|
126
150
|
runId: string;
|
|
@@ -135,7 +159,13 @@ export type SmithersEvent =
|
|
|
135
159
|
failedChildKeys?: readonly string[];
|
|
136
160
|
}
|
|
137
161
|
| { type: "RunFailed"; runId: string; error: unknown; timestampMs: number }
|
|
138
|
-
| {
|
|
162
|
+
| {
|
|
163
|
+
type: "RunCancelled";
|
|
164
|
+
runId: string;
|
|
165
|
+
timestampMs: number;
|
|
166
|
+
/** Missing only on historical or unattributed cancellation events. */
|
|
167
|
+
source?: RunCancellationSource;
|
|
168
|
+
}
|
|
139
169
|
| {
|
|
140
170
|
type: "RunContinuedAsNew";
|
|
141
171
|
runId: string;
|
|
@@ -365,6 +395,17 @@ export type SmithersEvent =
|
|
|
365
395
|
error: unknown;
|
|
366
396
|
timestampMs: number;
|
|
367
397
|
}
|
|
398
|
+
| {
|
|
399
|
+
type: "NodeStalled";
|
|
400
|
+
runId: string;
|
|
401
|
+
nodeId: string;
|
|
402
|
+
iteration: number;
|
|
403
|
+
attempt: number;
|
|
404
|
+
identicalFailures: number;
|
|
405
|
+
signature: string;
|
|
406
|
+
error: unknown;
|
|
407
|
+
timestampMs: number;
|
|
408
|
+
}
|
|
368
409
|
| {
|
|
369
410
|
type: "NodeCancelled";
|
|
370
411
|
runId: string;
|
|
@@ -685,10 +726,14 @@ export type SmithersEvent =
|
|
|
685
726
|
model: string;
|
|
686
727
|
agent: string;
|
|
687
728
|
inputTokens: number;
|
|
729
|
+
/** Non-cached input tokens. Falls back to inputTokens when the provider omits the breakdown. */
|
|
730
|
+
freshInputTokens?: number;
|
|
688
731
|
outputTokens: number;
|
|
689
732
|
cacheReadTokens?: number;
|
|
690
733
|
cacheWriteTokens?: number;
|
|
691
734
|
reasoningTokens?: number;
|
|
735
|
+
/** Estimated USD cost from Smithers' built-in model price table. */
|
|
736
|
+
costUsd?: number;
|
|
692
737
|
timestampMs: number;
|
|
693
738
|
}
|
|
694
739
|
| {
|
package/src/index.d.ts
CHANGED
|
@@ -133,7 +133,7 @@ type AgentSessionTranscriptEvent = {
|
|
|
133
133
|
};
|
|
134
134
|
|
|
135
135
|
type RunStatus = "running" | "waiting-approval" | "waiting-event" | "waiting-timer" | "waiting-quota" | "paused" | "finished" | "continued" | "failed" | "cancelled";
|
|
136
|
-
type RunState = "running" | "waiting-approval" | "waiting-event" | "waiting-timer" | "waiting-quota" | "paused" | "recovering" | "stale" | "orphaned" | "failed" | "cancelled" | "succeeded" | "unknown";
|
|
136
|
+
type RunState = "running" | "waiting-approval" | "waiting-event" | "waiting-timer" | "waiting-quota" | "paused" | "recovering" | "stale" | "orphaned" | "failed" | "cancelled" | "succeeded" | "succeeded-with-failures" | "unknown";
|
|
137
137
|
type AgentCliActionKind = "turn" | "command" | "tool" | "file_change" | "web_search" | "todo_list" | "reasoning" | "warning" | "note";
|
|
138
138
|
type AgentCliActionPhase = "started" | "updated" | "completed";
|
|
139
139
|
type AgentCliEventLevel = "debug" | "info" | "warning" | "error";
|
|
@@ -169,6 +169,14 @@ type AgentCliCompletedEvent = {
|
|
|
169
169
|
usage?: Record<string, unknown>;
|
|
170
170
|
};
|
|
171
171
|
type AgentCliEvent = AgentCliStartedEvent | AgentCliActionEvent | AgentCliCompletedEvent;
|
|
172
|
+
type RunCancellationSource$1 = {
|
|
173
|
+
kind: "signal" | "rpc" | "cli" | "engine";
|
|
174
|
+
detail?: string;
|
|
175
|
+
signal?: string;
|
|
176
|
+
clientPid?: number;
|
|
177
|
+
requestId?: string;
|
|
178
|
+
clientIdentity?: string;
|
|
179
|
+
};
|
|
172
180
|
type SmithersEvent$2 = {
|
|
173
181
|
type: "SupervisorStarted";
|
|
174
182
|
runId: string;
|
|
@@ -209,6 +217,19 @@ type SmithersEvent$2 = {
|
|
|
209
217
|
before: RunState;
|
|
210
218
|
after: RunState;
|
|
211
219
|
timestampMs: number;
|
|
220
|
+
} | {
|
|
221
|
+
type: "RunConcurrencySaturated";
|
|
222
|
+
runId: string;
|
|
223
|
+
requestedDemand: number;
|
|
224
|
+
effectiveCap: number;
|
|
225
|
+
remediationCommand: string;
|
|
226
|
+
/** Present when a lifecycle-linked descendant caused the owner's budget to saturate. */
|
|
227
|
+
descendantRunId?: string;
|
|
228
|
+
/** Which owner budget bound admission. Historical events omit this. */
|
|
229
|
+
budget?: "run" | "subtree";
|
|
230
|
+
/** Present when `budget` is `subtree`. */
|
|
231
|
+
subtreeGroupId?: string;
|
|
232
|
+
timestampMs: number;
|
|
212
233
|
} | {
|
|
213
234
|
type: "RunFinished";
|
|
214
235
|
runId: string;
|
|
@@ -230,6 +251,8 @@ type SmithersEvent$2 = {
|
|
|
230
251
|
type: "RunCancelled";
|
|
231
252
|
runId: string;
|
|
232
253
|
timestampMs: number;
|
|
254
|
+
/** Missing only on historical or unattributed cancellation events. */
|
|
255
|
+
source?: RunCancellationSource$1;
|
|
233
256
|
} | {
|
|
234
257
|
type: "RunContinuedAsNew";
|
|
235
258
|
runId: string;
|
|
@@ -433,6 +456,16 @@ type SmithersEvent$2 = {
|
|
|
433
456
|
attempt: number;
|
|
434
457
|
error: unknown;
|
|
435
458
|
timestampMs: number;
|
|
459
|
+
} | {
|
|
460
|
+
type: "NodeStalled";
|
|
461
|
+
runId: string;
|
|
462
|
+
nodeId: string;
|
|
463
|
+
iteration: number;
|
|
464
|
+
attempt: number;
|
|
465
|
+
identicalFailures: number;
|
|
466
|
+
signature: string;
|
|
467
|
+
error: unknown;
|
|
468
|
+
timestampMs: number;
|
|
436
469
|
} | {
|
|
437
470
|
type: "NodeCancelled";
|
|
438
471
|
runId: string;
|
|
@@ -719,10 +752,14 @@ type SmithersEvent$2 = {
|
|
|
719
752
|
model: string;
|
|
720
753
|
agent: string;
|
|
721
754
|
inputTokens: number;
|
|
755
|
+
/** Non-cached input tokens. Falls back to inputTokens when the provider omits the breakdown. */
|
|
756
|
+
freshInputTokens?: number;
|
|
722
757
|
outputTokens: number;
|
|
723
758
|
cacheReadTokens?: number;
|
|
724
759
|
cacheWriteTokens?: number;
|
|
725
760
|
reasoningTokens?: number;
|
|
761
|
+
/** Estimated USD cost from Smithers' built-in model price table. */
|
|
762
|
+
costUsd?: number;
|
|
726
763
|
timestampMs: number;
|
|
727
764
|
} | {
|
|
728
765
|
type: "SnapshotCaptured";
|
|
@@ -1289,6 +1326,17 @@ type CorrelationContext$1 = CorrelationContext$5;
|
|
|
1289
1326
|
declare function updateCurrentCorrelationContext(patch: CorrelationPatch$1): void;
|
|
1290
1327
|
type CorrelationPatch$1 = CorrelationPatch$5;
|
|
1291
1328
|
|
|
1329
|
+
/**
|
|
1330
|
+
* Scope imperative Smithers logs to one host-owned Effect runner. Unlike
|
|
1331
|
+
* {@link setSmithersLogRunner}, this is concurrency-safe: parallel embedded
|
|
1332
|
+
* engine instances keep their loggers isolated across awaits and timers.
|
|
1333
|
+
*
|
|
1334
|
+
* @template T
|
|
1335
|
+
* @param {SmithersLogRunner} runner
|
|
1336
|
+
* @param {() => T} execute
|
|
1337
|
+
* @returns {T}
|
|
1338
|
+
*/
|
|
1339
|
+
declare function runWithSmithersLogRunner<T>(runner: SmithersLogRunner, execute: () => T): T;
|
|
1292
1340
|
/**
|
|
1293
1341
|
* Install the Effect runtime used by fire-and-forget observability logs.
|
|
1294
1342
|
* Returns a restore function so tests and embedded hosts can scope overrides.
|
|
@@ -1334,10 +1382,11 @@ type MetricLabels = MetricLabels$1;
|
|
|
1334
1382
|
type MetricsServiceShape = MetricsServiceShape$3;
|
|
1335
1383
|
type MetricsSnapshot = MetricsSnapshot$1;
|
|
1336
1384
|
type ResolvedSmithersObservabilityOptions = ResolvedSmithersObservabilityOptions$2;
|
|
1385
|
+
type RunCancellationSource = RunCancellationSource$1;
|
|
1337
1386
|
type SmithersEvent = SmithersEvent$2;
|
|
1338
1387
|
type SmithersLogFormat = SmithersLogFormat$1;
|
|
1339
1388
|
type SmithersMetricDefinition = SmithersMetricDefinition$2;
|
|
1340
1389
|
type SmithersObservabilityOptions = SmithersObservabilityOptions$4;
|
|
1341
1390
|
type SmithersObservabilityService = SmithersObservabilityService$2;
|
|
1342
1391
|
|
|
1343
|
-
export { type CorrelationContext, CorrelationContextLive, type CorrelationContextPatch, CorrelationContextService, type CorrelationPatch, type MetricLabels, MetricsService, MetricsServiceLive, type MetricsServiceShape, type MetricsSnapshot, type ResolvedSmithersObservabilityOptions, type SmithersEvent, type SmithersLogFormat, type SmithersMetricDefinition, SmithersObservability, type SmithersObservabilityOptions, type SmithersObservabilityService, TracingService, TracingServiceLive, activeNodes, activeRuns, annotateSmithersTrace, approvalPending, approvalWaitDuration, approvalsDenied, approvalsGranted, approvalsRequested, attemptDuration, cacheHits, cacheMisses, correlationContextFiberRef, correlationContextToLogAnnotations, createSmithersObservabilityLayer, createSmithersOtelLayer, createSmithersRuntimeLayer, dbQueryDuration, dbRetries, dbTransactionDuration, dbTransactionRetries, dbTransactionRollbacks, errorsTotal, eventsEmittedTotal, externalWaitAsyncPending, getCurrentCorrelationContext, getCurrentCorrelationContextEffect, getCurrentSmithersTraceAnnotations, getCurrentSmithersTraceSpan, hotReloadDuration, hotReloadFailures, hotReloads, httpRequestDuration, httpRequests, logDebug, logError, logInfo, logWarning, makeSmithersSpanAttributes, mergeCorrelationContext, metricsServiceAdapter, nodeDuration, nodeRetriesTotal, nodesFailed, nodesFinished, nodesStarted, processHeapUsedBytes, processMemoryRssBytes, processUptimeSeconds, prometheusContentType, promptSizeBytes, renderPrometheusMetrics, replaysStarted, resolveSmithersObservabilityOptions, responseSizeBytes, rewindDurationMs, rewindFramesDeleted, rewindRollbackTotal, rewindSandboxesReverted, rewindTotal, runDuration, runForksCreated, runWithCorrelationContext, runsAncestryDepth, runsCancelledTotal, runsCarriedStateBytes, runsContinuedTotal, runsFailedTotal, runsFinishedTotal, runsResumedTotal, runsTotal, sandboxActive, sandboxBundleSizeBytes, sandboxCompletedTotal, sandboxCreatedTotal, sandboxDurationMs, sandboxPatchCount, sandboxTransportDurationMs, schedulerConcurrencyUtilization, schedulerQueueDepth, schedulerWaitDuration, scorerEventsFailed, scorerEventsFinished, scorerEventsStarted, setSmithersLogRunner, smithersMetricCatalog, smithersMetrics, smithersSpanNames, snapshotDuration, snapshotsCaptured, timerDelayDuration, timersCancelled, timersCreated, timersFired, timersPending, toPrometheusMetricName, tokensCacheReadTotal, tokensCacheWriteTotal, tokensContextWindowBucketTotal, tokensContextWindowPerCall, tokensInputPerCall, tokensInputTotal, tokensOutputPerCall, tokensOutputTotal, tokensReasoningTotal, toolCallErrorsTotal, toolCallsTotal, toolDuration, toolOutputTruncatedTotal, trackEvent as trackSmithersEvent, updateCurrentCorrelationContext, updateProcessMetrics, vcsDuration, withCorrelationContext, withCurrentCorrelationContext, withSmithersSpan };
|
|
1392
|
+
export { type CorrelationContext, CorrelationContextLive, type CorrelationContextPatch, CorrelationContextService, type CorrelationPatch, type MetricLabels, MetricsService, MetricsServiceLive, type MetricsServiceShape, type MetricsSnapshot, type ResolvedSmithersObservabilityOptions, type RunCancellationSource, type SmithersEvent, type SmithersLogFormat, type SmithersMetricDefinition, SmithersObservability, type SmithersObservabilityOptions, type SmithersObservabilityService, TracingService, TracingServiceLive, activeNodes, activeRuns, annotateSmithersTrace, approvalPending, approvalWaitDuration, approvalsDenied, approvalsGranted, approvalsRequested, attemptDuration, cacheHits, cacheMisses, correlationContextFiberRef, correlationContextToLogAnnotations, createSmithersObservabilityLayer, createSmithersOtelLayer, createSmithersRuntimeLayer, dbQueryDuration, dbRetries, dbTransactionDuration, dbTransactionRetries, dbTransactionRollbacks, errorsTotal, eventsEmittedTotal, externalWaitAsyncPending, getCurrentCorrelationContext, getCurrentCorrelationContextEffect, getCurrentSmithersTraceAnnotations, getCurrentSmithersTraceSpan, hotReloadDuration, hotReloadFailures, hotReloads, httpRequestDuration, httpRequests, logDebug, logError, logInfo, logWarning, makeSmithersSpanAttributes, mergeCorrelationContext, metricsServiceAdapter, nodeDuration, nodeRetriesTotal, nodesFailed, nodesFinished, nodesStarted, processHeapUsedBytes, processMemoryRssBytes, processUptimeSeconds, prometheusContentType, promptSizeBytes, renderPrometheusMetrics, replaysStarted, resolveSmithersObservabilityOptions, responseSizeBytes, rewindDurationMs, rewindFramesDeleted, rewindRollbackTotal, rewindSandboxesReverted, rewindTotal, runDuration, runForksCreated, runWithCorrelationContext, runWithSmithersLogRunner, runsAncestryDepth, runsCancelledTotal, runsCarriedStateBytes, runsContinuedTotal, runsFailedTotal, runsFinishedTotal, runsResumedTotal, runsTotal, sandboxActive, sandboxBundleSizeBytes, sandboxCompletedTotal, sandboxCreatedTotal, sandboxDurationMs, sandboxPatchCount, sandboxTransportDurationMs, schedulerConcurrencyUtilization, schedulerQueueDepth, schedulerWaitDuration, scorerEventsFailed, scorerEventsFinished, scorerEventsStarted, setSmithersLogRunner, smithersMetricCatalog, smithersMetrics, smithersSpanNames, snapshotDuration, snapshotsCaptured, timerDelayDuration, timersCancelled, timersCreated, timersFired, timersPending, toPrometheusMetricName, tokensCacheReadTotal, tokensCacheWriteTotal, tokensContextWindowBucketTotal, tokensContextWindowPerCall, tokensInputPerCall, tokensInputTotal, tokensOutputPerCall, tokensOutputTotal, tokensReasoningTotal, toolCallErrorsTotal, toolCallsTotal, toolDuration, toolOutputTruncatedTotal, trackEvent as trackSmithersEvent, updateCurrentCorrelationContext, updateProcessMetrics, vcsDuration, withCorrelationContext, withCurrentCorrelationContext, withSmithersSpan };
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/** @typedef {import("./_coreMetricsShape.ts").MetricsServiceShape} MetricsServiceShape */
|
|
6
6
|
/** @typedef {import("./_coreMetricsShape.ts").MetricsSnapshot} MetricsSnapshot */
|
|
7
7
|
/** @typedef {import("./ResolvedSmithersObservabilityOptions.ts").ResolvedSmithersObservabilityOptions} ResolvedSmithersObservabilityOptions */
|
|
8
|
+
/** @typedef {import("./SmithersEvent.ts").RunCancellationSource} RunCancellationSource */
|
|
8
9
|
/** @typedef {import("./SmithersEvent.ts").SmithersEvent} SmithersEvent */
|
|
9
10
|
/** @typedef {import("./SmithersLogFormat.ts").SmithersLogFormat} SmithersLogFormat */
|
|
10
11
|
/** @typedef {import("./SmithersMetricDefinition.ts").SmithersMetricDefinition} SmithersMetricDefinition */
|
|
@@ -133,4 +134,4 @@ export {
|
|
|
133
134
|
withCurrentCorrelationContext,
|
|
134
135
|
} from "./correlation.js";
|
|
135
136
|
export { updateCurrentCorrelationContext } from "./correlation.js";
|
|
136
|
-
export { logDebug, logInfo, logWarning, logError, setSmithersLogRunner } from "./logging.js";
|
|
137
|
+
export { logDebug, logInfo, logWarning, logError, runWithSmithersLogRunner, setSmithersLogRunner } from "./logging.js";
|
package/src/logging.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Effect, Logger, LogLevel } from "effect";
|
|
2
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
3
|
import { getCurrentSmithersTraceAnnotations } from "./getCurrentSmithersTraceAnnotations.js";
|
|
3
4
|
import {
|
|
4
5
|
correlationContextToLogAnnotations,
|
|
@@ -17,6 +18,7 @@ const LOG_LEVEL_WARNING = 3;
|
|
|
17
18
|
const LOG_LEVEL_ERROR = 4;
|
|
18
19
|
const LOG_RUNNER_KEY = Symbol.for("smithers.observability.logRunner");
|
|
19
20
|
const defaultLoggerLayer = Logger.layer([Logger.consoleLogFmt]);
|
|
21
|
+
const runnerStorage = new AsyncLocalStorage();
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* Resolve the minimum imperative log level. The environment value is an
|
|
@@ -77,7 +79,21 @@ const defaultRunner = {
|
|
|
77
79
|
|
|
78
80
|
/** @returns {SmithersLogRunner} */
|
|
79
81
|
function getLogRunner() {
|
|
80
|
-
return getRunnerState().runner ?? defaultRunner;
|
|
82
|
+
return runnerStorage.getStore() ?? getRunnerState().runner ?? defaultRunner;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Scope imperative Smithers logs to one host-owned Effect runner. Unlike
|
|
87
|
+
* {@link setSmithersLogRunner}, this is concurrency-safe: parallel embedded
|
|
88
|
+
* engine instances keep their loggers isolated across awaits and timers.
|
|
89
|
+
*
|
|
90
|
+
* @template T
|
|
91
|
+
* @param {SmithersLogRunner} runner
|
|
92
|
+
* @param {() => T} execute
|
|
93
|
+
* @returns {T}
|
|
94
|
+
*/
|
|
95
|
+
export function runWithSmithersLogRunner(runner, execute) {
|
|
96
|
+
return runnerStorage.run(runner, execute);
|
|
81
97
|
}
|
|
82
98
|
|
|
83
99
|
/**
|
package/src/metrics/index.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ type AgentSessionTranscriptEvent = {
|
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
type RunStatus = "running" | "waiting-approval" | "waiting-event" | "waiting-timer" | "waiting-quota" | "paused" | "finished" | "continued" | "failed" | "cancelled";
|
|
123
|
-
type RunState = "running" | "waiting-approval" | "waiting-event" | "waiting-timer" | "waiting-quota" | "paused" | "recovering" | "stale" | "orphaned" | "failed" | "cancelled" | "succeeded" | "unknown";
|
|
123
|
+
type RunState = "running" | "waiting-approval" | "waiting-event" | "waiting-timer" | "waiting-quota" | "paused" | "recovering" | "stale" | "orphaned" | "failed" | "cancelled" | "succeeded" | "succeeded-with-failures" | "unknown";
|
|
124
124
|
type AgentCliActionKind = "turn" | "command" | "tool" | "file_change" | "web_search" | "todo_list" | "reasoning" | "warning" | "note";
|
|
125
125
|
type AgentCliActionPhase = "started" | "updated" | "completed";
|
|
126
126
|
type AgentCliEventLevel = "debug" | "info" | "warning" | "error";
|
|
@@ -156,6 +156,14 @@ type AgentCliCompletedEvent = {
|
|
|
156
156
|
usage?: Record<string, unknown>;
|
|
157
157
|
};
|
|
158
158
|
type AgentCliEvent = AgentCliStartedEvent | AgentCliActionEvent | AgentCliCompletedEvent;
|
|
159
|
+
type RunCancellationSource$1 = {
|
|
160
|
+
kind: "signal" | "rpc" | "cli" | "engine";
|
|
161
|
+
detail?: string;
|
|
162
|
+
signal?: string;
|
|
163
|
+
clientPid?: number;
|
|
164
|
+
requestId?: string;
|
|
165
|
+
clientIdentity?: string;
|
|
166
|
+
};
|
|
159
167
|
type SmithersEvent$2 = {
|
|
160
168
|
type: "SupervisorStarted";
|
|
161
169
|
runId: string;
|
|
@@ -196,6 +204,19 @@ type SmithersEvent$2 = {
|
|
|
196
204
|
before: RunState;
|
|
197
205
|
after: RunState;
|
|
198
206
|
timestampMs: number;
|
|
207
|
+
} | {
|
|
208
|
+
type: "RunConcurrencySaturated";
|
|
209
|
+
runId: string;
|
|
210
|
+
requestedDemand: number;
|
|
211
|
+
effectiveCap: number;
|
|
212
|
+
remediationCommand: string;
|
|
213
|
+
/** Present when a lifecycle-linked descendant caused the owner's budget to saturate. */
|
|
214
|
+
descendantRunId?: string;
|
|
215
|
+
/** Which owner budget bound admission. Historical events omit this. */
|
|
216
|
+
budget?: "run" | "subtree";
|
|
217
|
+
/** Present when `budget` is `subtree`. */
|
|
218
|
+
subtreeGroupId?: string;
|
|
219
|
+
timestampMs: number;
|
|
199
220
|
} | {
|
|
200
221
|
type: "RunFinished";
|
|
201
222
|
runId: string;
|
|
@@ -217,6 +238,8 @@ type SmithersEvent$2 = {
|
|
|
217
238
|
type: "RunCancelled";
|
|
218
239
|
runId: string;
|
|
219
240
|
timestampMs: number;
|
|
241
|
+
/** Missing only on historical or unattributed cancellation events. */
|
|
242
|
+
source?: RunCancellationSource$1;
|
|
220
243
|
} | {
|
|
221
244
|
type: "RunContinuedAsNew";
|
|
222
245
|
runId: string;
|
|
@@ -420,6 +443,16 @@ type SmithersEvent$2 = {
|
|
|
420
443
|
attempt: number;
|
|
421
444
|
error: unknown;
|
|
422
445
|
timestampMs: number;
|
|
446
|
+
} | {
|
|
447
|
+
type: "NodeStalled";
|
|
448
|
+
runId: string;
|
|
449
|
+
nodeId: string;
|
|
450
|
+
iteration: number;
|
|
451
|
+
attempt: number;
|
|
452
|
+
identicalFailures: number;
|
|
453
|
+
signature: string;
|
|
454
|
+
error: unknown;
|
|
455
|
+
timestampMs: number;
|
|
423
456
|
} | {
|
|
424
457
|
type: "NodeCancelled";
|
|
425
458
|
runId: string;
|
|
@@ -706,10 +739,14 @@ type SmithersEvent$2 = {
|
|
|
706
739
|
model: string;
|
|
707
740
|
agent: string;
|
|
708
741
|
inputTokens: number;
|
|
742
|
+
/** Non-cached input tokens. Falls back to inputTokens when the provider omits the breakdown. */
|
|
743
|
+
freshInputTokens?: number;
|
|
709
744
|
outputTokens: number;
|
|
710
745
|
cacheReadTokens?: number;
|
|
711
746
|
cacheWriteTokens?: number;
|
|
712
747
|
reasoningTokens?: number;
|
|
748
|
+
/** Estimated USD cost from Smithers' built-in model price table. */
|
|
749
|
+
costUsd?: number;
|
|
713
750
|
timestampMs: number;
|
|
714
751
|
} | {
|
|
715
752
|
type: "SnapshotCaptured";
|