@smithers-orchestrator/observability 0.16.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.
Files changed (202) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +44 -0
  3. package/src/MetricName.ts +1 -0
  4. package/src/MetricsServiceLive.js +9 -0
  5. package/src/ResolvedSmithersObservabilityOptions.ts +10 -0
  6. package/src/SmithersEvent.ts +603 -0
  7. package/src/SmithersLogFormat.ts +1 -0
  8. package/src/SmithersMetricDefinition.ts +15 -0
  9. package/src/SmithersMetricType.ts +1 -0
  10. package/src/SmithersMetricUnit.ts +8 -0
  11. package/src/SmithersObservability.js +6 -0
  12. package/src/SmithersObservabilityOptions.ts +10 -0
  13. package/src/SmithersObservabilityService.ts +15 -0
  14. package/src/_coreCorrelation/CorrelationContext.ts +10 -0
  15. package/src/_coreCorrelation/CorrelationContextLive.js +11 -0
  16. package/src/_coreCorrelation/CorrelationContextService.js +6 -0
  17. package/src/_coreCorrelation/CorrelationContextServiceShape.ts +14 -0
  18. package/src/_coreCorrelation/CorrelationPatch.ts +3 -0
  19. package/src/_coreCorrelation/_correlationStorage.js +4 -0
  20. package/src/_coreCorrelation/correlationContextFiberRef.js +2 -0
  21. package/src/_coreCorrelation/correlationContextToLogAnnotations.js +28 -0
  22. package/src/_coreCorrelation/getCurrentCorrelationContext.js +9 -0
  23. package/src/_coreCorrelation/getCurrentCorrelationContextEffect.js +11 -0
  24. package/src/_coreCorrelation/index.js +14 -0
  25. package/src/_coreCorrelation/mergeCorrelationContext.js +61 -0
  26. package/src/_coreCorrelation/runWithCorrelationContext.js +14 -0
  27. package/src/_coreCorrelation/updateCurrentCorrelationContext.js +19 -0
  28. package/src/_coreCorrelation/withCorrelationContext.js +15 -0
  29. package/src/_coreCorrelation/withCurrentCorrelationContext.js +13 -0
  30. package/src/_coreMetrics.js +510 -0
  31. package/src/_coreMetricsShape.ts +55 -0
  32. package/src/_corePrometheus.js +93 -0
  33. package/src/_corePrometheusShape.ts +11 -0
  34. package/src/_coreTracing.js +142 -0
  35. package/src/_coreTracingShape.ts +17 -0
  36. package/src/_smithersSpanAttributeAliases.js +19 -0
  37. package/src/_smithersTraceSpanStorage.js +3 -0
  38. package/src/annotateSmithersTrace.js +11 -0
  39. package/src/correlation.js +20 -0
  40. package/src/createSmithersObservabilityLayer.js +49 -0
  41. package/src/createSmithersOtelLayer.js +21 -0
  42. package/src/createSmithersRuntimeLayer.js +2 -0
  43. package/src/getCurrentSmithersTraceAnnotations.js +14 -0
  44. package/src/getCurrentSmithersTraceSpan.js +7 -0
  45. package/src/index.d.ts +1032 -0
  46. package/src/index.js +35 -0
  47. package/src/logging.js +91 -0
  48. package/src/makeSmithersSpanAttributes.js +20 -0
  49. package/src/metrics/SmithersMetricDefinition.ts +17 -0
  50. package/src/metrics/SmithersMetricType.ts +1 -0
  51. package/src/metrics/SmithersMetricUnit.ts +8 -0
  52. package/src/metrics/_asyncExternalWaitCounts.js +4 -0
  53. package/src/metrics/_buckets.js +43 -0
  54. package/src/metrics/_processStartMs.js +1 -0
  55. package/src/metrics/activeNodes.js +2 -0
  56. package/src/metrics/activeRuns.js +2 -0
  57. package/src/metrics/agentActionsTotal.js +2 -0
  58. package/src/metrics/agentDurationMs.js +3 -0
  59. package/src/metrics/agentErrorsTotal.js +2 -0
  60. package/src/metrics/agentEventsTotal.js +2 -0
  61. package/src/metrics/agentInvocationsTotal.js +2 -0
  62. package/src/metrics/agentRetriesTotal.js +2 -0
  63. package/src/metrics/agentSessionsTotal.js +2 -0
  64. package/src/metrics/agentTokensTotal.js +2 -0
  65. package/src/metrics/alertDeliveriesAttempted.js +2 -0
  66. package/src/metrics/alertDeliveriesSuppressed.js +2 -0
  67. package/src/metrics/alertsAcknowledgedTotal.js +2 -0
  68. package/src/metrics/alertsActive.js +2 -0
  69. package/src/metrics/alertsEscalatedTotal.js +2 -0
  70. package/src/metrics/alertsFiredTotal.js +2 -0
  71. package/src/metrics/alertsReopenedTotal.js +2 -0
  72. package/src/metrics/alertsResolvedTotal.js +2 -0
  73. package/src/metrics/alertsSilencedTotal.js +2 -0
  74. package/src/metrics/approvalPending.js +2 -0
  75. package/src/metrics/approvalWaitDuration.js +3 -0
  76. package/src/metrics/approvalsDenied.js +2 -0
  77. package/src/metrics/approvalsGranted.js +2 -0
  78. package/src/metrics/approvalsRequested.js +2 -0
  79. package/src/metrics/attemptDuration.js +3 -0
  80. package/src/metrics/attentionBacklog.js +2 -0
  81. package/src/metrics/cacheHits.js +2 -0
  82. package/src/metrics/cacheMisses.js +2 -0
  83. package/src/metrics/dbQueryDuration.js +3 -0
  84. package/src/metrics/dbRetries.js +2 -0
  85. package/src/metrics/dbTransactionDuration.js +3 -0
  86. package/src/metrics/dbTransactionRetries.js +2 -0
  87. package/src/metrics/dbTransactionRollbacks.js +2 -0
  88. package/src/metrics/devtoolsActiveSubscribers.js +2 -0
  89. package/src/metrics/devtoolsBackpressureDisconnectTotal.js +2 -0
  90. package/src/metrics/devtoolsDeltaBuildMs.js +3 -0
  91. package/src/metrics/devtoolsEventBytes.js +3 -0
  92. package/src/metrics/devtoolsEventTotal.js +2 -0
  93. package/src/metrics/devtoolsSnapshotBuildMs.js +3 -0
  94. package/src/metrics/devtoolsSubscribeTotal.js +2 -0
  95. package/src/metrics/errorsTotal.js +2 -0
  96. package/src/metrics/eventsEmittedTotal.js +2 -0
  97. package/src/metrics/externalWaitAsyncPending.js +2 -0
  98. package/src/metrics/gatewayApprovalDecisionsTotal.js +2 -0
  99. package/src/metrics/gatewayAuthEventsTotal.js +2 -0
  100. package/src/metrics/gatewayConnectionsActive.js +2 -0
  101. package/src/metrics/gatewayConnectionsClosedTotal.js +2 -0
  102. package/src/metrics/gatewayConnectionsTotal.js +2 -0
  103. package/src/metrics/gatewayCronTriggersTotal.js +2 -0
  104. package/src/metrics/gatewayErrorsTotal.js +2 -0
  105. package/src/metrics/gatewayHeartbeatTicksTotal.js +2 -0
  106. package/src/metrics/gatewayMessagesReceivedTotal.js +2 -0
  107. package/src/metrics/gatewayMessagesSentTotal.js +2 -0
  108. package/src/metrics/gatewayRpcCallsTotal.js +2 -0
  109. package/src/metrics/gatewayRpcDuration.js +3 -0
  110. package/src/metrics/gatewayRunsCompletedTotal.js +2 -0
  111. package/src/metrics/gatewayRunsStartedTotal.js +2 -0
  112. package/src/metrics/gatewaySignalsTotal.js +2 -0
  113. package/src/metrics/gatewayWebhooksReceivedTotal.js +2 -0
  114. package/src/metrics/gatewayWebhooksRejectedTotal.js +2 -0
  115. package/src/metrics/gatewayWebhooksVerifiedTotal.js +2 -0
  116. package/src/metrics/heartbeatDataSizeBytes.js +3 -0
  117. package/src/metrics/heartbeatIntervalMs.js +3 -0
  118. package/src/metrics/hotReloadDuration.js +3 -0
  119. package/src/metrics/hotReloadFailures.js +2 -0
  120. package/src/metrics/hotReloads.js +2 -0
  121. package/src/metrics/httpRequestDuration.js +3 -0
  122. package/src/metrics/httpRequests.js +2 -0
  123. package/src/metrics/index.js +151 -0
  124. package/src/metrics/metricsServiceAdapter.js +188 -0
  125. package/src/metrics/nodeDuration.js +3 -0
  126. package/src/metrics/nodeRetriesTotal.js +2 -0
  127. package/src/metrics/nodesFailed.js +2 -0
  128. package/src/metrics/nodesFinished.js +2 -0
  129. package/src/metrics/nodesStarted.js +2 -0
  130. package/src/metrics/processHeapUsedBytes.js +2 -0
  131. package/src/metrics/processMemoryRssBytes.js +2 -0
  132. package/src/metrics/processUptimeSeconds.js +2 -0
  133. package/src/metrics/promptSizeBytes.js +3 -0
  134. package/src/metrics/responseSizeBytes.js +3 -0
  135. package/src/metrics/rewindDurationMs.js +3 -0
  136. package/src/metrics/rewindFramesDeleted.js +3 -0
  137. package/src/metrics/rewindRollbackTotal.js +2 -0
  138. package/src/metrics/rewindSandboxesReverted.js +3 -0
  139. package/src/metrics/rewindTotal.js +2 -0
  140. package/src/metrics/runDuration.js +3 -0
  141. package/src/metrics/runsAncestryDepth.js +3 -0
  142. package/src/metrics/runsCancelledTotal.js +2 -0
  143. package/src/metrics/runsCarriedStateBytes.js +3 -0
  144. package/src/metrics/runsContinuedTotal.js +2 -0
  145. package/src/metrics/runsFailedTotal.js +2 -0
  146. package/src/metrics/runsFinishedTotal.js +2 -0
  147. package/src/metrics/runsResumedTotal.js +2 -0
  148. package/src/metrics/runsTotal.js +2 -0
  149. package/src/metrics/sandboxActive.js +2 -0
  150. package/src/metrics/sandboxBundleSizeBytes.js +3 -0
  151. package/src/metrics/sandboxCompletedTotal.js +2 -0
  152. package/src/metrics/sandboxCreatedTotal.js +2 -0
  153. package/src/metrics/sandboxDurationMs.js +3 -0
  154. package/src/metrics/sandboxPatchCount.js +3 -0
  155. package/src/metrics/sandboxTransportDurationMs.js +3 -0
  156. package/src/metrics/schedulerConcurrencyUtilization.js +2 -0
  157. package/src/metrics/schedulerQueueDepth.js +2 -0
  158. package/src/metrics/schedulerWaitDuration.js +3 -0
  159. package/src/metrics/scorerEventsFailed.js +2 -0
  160. package/src/metrics/scorerEventsFinished.js +2 -0
  161. package/src/metrics/scorerEventsStarted.js +2 -0
  162. package/src/metrics/smithersMetricCatalog.js +484 -0
  163. package/src/metrics/smithersMetricCatalogByKey.js +2 -0
  164. package/src/metrics/smithersMetricCatalogByName.js +2 -0
  165. package/src/metrics/smithersMetricCatalogByPrometheusName.js +2 -0
  166. package/src/metrics/supervisorPollDuration.js +3 -0
  167. package/src/metrics/supervisorPollsTotal.js +2 -0
  168. package/src/metrics/supervisorResumeLag.js +3 -0
  169. package/src/metrics/supervisorResumedTotal.js +2 -0
  170. package/src/metrics/supervisorSkippedTotal.js +2 -0
  171. package/src/metrics/supervisorStaleDetected.js +2 -0
  172. package/src/metrics/taskHeartbeatTimeoutTotal.js +2 -0
  173. package/src/metrics/taskHeartbeatsTotal.js +2 -0
  174. package/src/metrics/timerDelayDuration.js +3 -0
  175. package/src/metrics/timersCancelled.js +2 -0
  176. package/src/metrics/timersCreated.js +2 -0
  177. package/src/metrics/timersFired.js +2 -0
  178. package/src/metrics/timersPending.js +2 -0
  179. package/src/metrics/toPrometheusMetricName.js +8 -0
  180. package/src/metrics/tokensCacheReadTotal.js +2 -0
  181. package/src/metrics/tokensCacheWriteTotal.js +2 -0
  182. package/src/metrics/tokensContextWindowBucketTotal.js +2 -0
  183. package/src/metrics/tokensContextWindowPerCall.js +3 -0
  184. package/src/metrics/tokensInputPerCall.js +3 -0
  185. package/src/metrics/tokensInputTotal.js +2 -0
  186. package/src/metrics/tokensOutputPerCall.js +3 -0
  187. package/src/metrics/tokensOutputTotal.js +2 -0
  188. package/src/metrics/tokensReasoningTotal.js +2 -0
  189. package/src/metrics/toolCallErrorsTotal.js +2 -0
  190. package/src/metrics/toolCallsTotal.js +2 -0
  191. package/src/metrics/toolDuration.js +3 -0
  192. package/src/metrics/toolOutputTruncatedTotal.js +2 -0
  193. package/src/metrics/trackEvent.js +604 -0
  194. package/src/metrics/updateAsyncExternalWaitPending.js +14 -0
  195. package/src/metrics/updateProcessMetrics.js +17 -0
  196. package/src/metrics/vcsDuration.js +3 -0
  197. package/src/prometheusContentType.js +1 -0
  198. package/src/renderPrometheusMetrics.js +205 -0
  199. package/src/resolveSmithersObservabilityOptions.js +79 -0
  200. package/src/smithersMetrics.js +2 -0
  201. package/src/smithersSpanNames.js +6 -0
  202. package/src/withSmithersSpan.js +15 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 William Cory
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@smithers-orchestrator/observability",
3
+ "version": "0.16.0",
4
+ "description": "Concrete Smithers metrics, logging, tracing, and observability integrations",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "exports": {
8
+ ".": {
9
+ "types": "./src/index.d.ts",
10
+ "import": "./src/index.js",
11
+ "default": "./src/index.js"
12
+ },
13
+ "./metrics": {
14
+ "types": "./src/index.d.ts",
15
+ "import": "./src/metrics/index.js",
16
+ "default": "./src/metrics/index.js"
17
+ },
18
+ "./*": {
19
+ "types": "./src/index.d.ts",
20
+ "import": "./src/*.js",
21
+ "default": "./src/*.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "src/"
26
+ ],
27
+ "dependencies": {
28
+ "effect": "^3.21.0",
29
+ "@effect/opentelemetry": "^0.61.0",
30
+ "@effect/platform": "^0.96.0",
31
+ "@effect/platform-bun": "^0.89.0",
32
+ "@smithers-orchestrator/driver": "0.16.0",
33
+ "@smithers-orchestrator/agents": "0.16.0"
34
+ },
35
+ "devDependencies": {
36
+ "@types/bun": "latest",
37
+ "typescript": "~5.9.3"
38
+ },
39
+ "scripts": {
40
+ "build": "tsup --dts-only",
41
+ "test": "bun test tests",
42
+ "typecheck": "tsc -p tsconfig.json --noEmit"
43
+ }
44
+ }
@@ -0,0 +1 @@
1
+ export type MetricName = string;
@@ -0,0 +1,9 @@
1
+ import { MetricsService } from "./_coreMetrics.js";
2
+ import { Effect, Layer } from "effect";
3
+ import { metricsServiceAdapter } from "./metrics/index.js";
4
+ import { renderPrometheusMetrics } from "./renderPrometheusMetrics.js";
5
+ /** @type {Layer.Layer<MetricsService, never, never>} */
6
+ export const MetricsServiceLive = Layer.succeed(MetricsService, {
7
+ ...metricsServiceAdapter,
8
+ renderPrometheus: () => Effect.sync(renderPrometheusMetrics),
9
+ });
@@ -0,0 +1,10 @@
1
+ import type { LogLevel } from "effect";
2
+ import type { SmithersLogFormat } from "./SmithersLogFormat";
3
+
4
+ export type ResolvedSmithersObservabilityOptions = {
5
+ readonly enabled: boolean;
6
+ readonly endpoint: string;
7
+ readonly serviceName: string;
8
+ readonly logFormat: SmithersLogFormat;
9
+ readonly logLevel: LogLevel.LogLevel;
10
+ };
@@ -0,0 +1,603 @@
1
+ type RunStatus =
2
+ | "running"
3
+ | "waiting-approval"
4
+ | "waiting-event"
5
+ | "waiting-timer"
6
+ | "finished"
7
+ | "continued"
8
+ | "failed"
9
+ | "cancelled";
10
+
11
+ type RunState =
12
+ | "running"
13
+ | "waiting-approval"
14
+ | "waiting-event"
15
+ | "waiting-timer"
16
+ | "recovering"
17
+ | "stale"
18
+ | "orphaned"
19
+ | "failed"
20
+ | "cancelled"
21
+ | "succeeded"
22
+ | "unknown";
23
+
24
+ type AgentCliActionKind =
25
+ | "turn"
26
+ | "command"
27
+ | "tool"
28
+ | "file_change"
29
+ | "web_search"
30
+ | "todo_list"
31
+ | "reasoning"
32
+ | "warning"
33
+ | "note";
34
+
35
+ type AgentCliActionPhase = "started" | "updated" | "completed";
36
+ type AgentCliEventLevel = "debug" | "info" | "warning" | "error";
37
+
38
+ type AgentCliStartedEvent = {
39
+ type: "started";
40
+ engine: string;
41
+ title: string;
42
+ resume?: string;
43
+ detail?: Record<string, unknown>;
44
+ };
45
+
46
+ type AgentCliActionEvent = {
47
+ type: "action";
48
+ engine: string;
49
+ phase: AgentCliActionPhase;
50
+ entryType?: "thought" | "message";
51
+ action: {
52
+ id: string;
53
+ kind: AgentCliActionKind;
54
+ title: string;
55
+ detail?: Record<string, unknown>;
56
+ };
57
+ message?: string;
58
+ ok?: boolean;
59
+ level?: AgentCliEventLevel;
60
+ };
61
+
62
+ type AgentCliCompletedEvent = {
63
+ type: "completed";
64
+ engine: string;
65
+ ok: boolean;
66
+ answer?: string;
67
+ error?: string;
68
+ resume?: string;
69
+ usage?: Record<string, unknown>;
70
+ };
71
+
72
+ type AgentCliEvent = AgentCliStartedEvent | AgentCliActionEvent | AgentCliCompletedEvent;
73
+
74
+ export type SmithersEvent =
75
+ | {
76
+ type: "SupervisorStarted";
77
+ runId: string;
78
+ pollIntervalMs: number;
79
+ staleThresholdMs: number;
80
+ timestampMs: number;
81
+ }
82
+ | {
83
+ type: "SupervisorPollCompleted";
84
+ runId: string;
85
+ staleCount: number;
86
+ resumedCount: number;
87
+ skippedCount: number;
88
+ durationMs: number;
89
+ timestampMs: number;
90
+ }
91
+ | {
92
+ type: "RunAutoResumed";
93
+ runId: string;
94
+ lastHeartbeatAtMs: number | null;
95
+ staleDurationMs: number;
96
+ timestampMs: number;
97
+ }
98
+ | {
99
+ type: "RunAutoResumeSkipped";
100
+ runId: string;
101
+ reason: "pid-alive" | "missing-workflow" | "rate-limited";
102
+ timestampMs: number;
103
+ }
104
+ | { type: "RunStarted"; runId: string; timestampMs: number }
105
+ | {
106
+ type: "RunStatusChanged";
107
+ runId: string;
108
+ status: RunStatus;
109
+ timestampMs: number;
110
+ }
111
+ | {
112
+ type: "RunStateChanged";
113
+ runId: string;
114
+ before: RunState;
115
+ after: RunState;
116
+ timestampMs: number;
117
+ }
118
+ | { type: "RunFinished"; runId: string; timestampMs: number }
119
+ | { type: "RunFailed"; runId: string; error: unknown; timestampMs: number }
120
+ | { type: "RunCancelled"; runId: string; timestampMs: number }
121
+ | {
122
+ type: "RunContinuedAsNew";
123
+ runId: string;
124
+ newRunId: string;
125
+ iteration: number;
126
+ carriedStateSize: number;
127
+ ancestryDepth?: number;
128
+ timestampMs: number;
129
+ }
130
+ | {
131
+ type: "RunHijackRequested";
132
+ runId: string;
133
+ target?: string;
134
+ timestampMs: number;
135
+ }
136
+ | {
137
+ type: "RunHijacked";
138
+ runId: string;
139
+ nodeId: string;
140
+ iteration: number;
141
+ attempt: number;
142
+ engine: string;
143
+ mode: "native-cli" | "conversation";
144
+ resume?: string | null;
145
+ cwd: string;
146
+ timestampMs: number;
147
+ }
148
+ | {
149
+ type: "SandboxCreated";
150
+ runId: string;
151
+ sandboxId: string;
152
+ runtime: "bubblewrap" | "docker" | "codeplane";
153
+ configJson: string;
154
+ timestampMs: number;
155
+ }
156
+ | {
157
+ type: "SandboxShipped";
158
+ runId: string;
159
+ sandboxId: string;
160
+ runtime: "bubblewrap" | "docker" | "codeplane";
161
+ bundleSizeBytes: number;
162
+ timestampMs: number;
163
+ }
164
+ | {
165
+ type: "SandboxHeartbeat";
166
+ runId: string;
167
+ sandboxId: string;
168
+ remoteRunId?: string;
169
+ progress?: number;
170
+ timestampMs: number;
171
+ }
172
+ | {
173
+ type: "SandboxBundleReceived";
174
+ runId: string;
175
+ sandboxId: string;
176
+ bundleSizeBytes: number;
177
+ patchCount: number;
178
+ hasOutputs: boolean;
179
+ timestampMs: number;
180
+ }
181
+ | {
182
+ type: "SandboxCompleted";
183
+ runId: string;
184
+ sandboxId: string;
185
+ remoteRunId?: string;
186
+ runtime: "bubblewrap" | "docker" | "codeplane";
187
+ status: "finished" | "failed" | "cancelled";
188
+ durationMs: number;
189
+ timestampMs: number;
190
+ }
191
+ | {
192
+ type: "SandboxFailed";
193
+ runId: string;
194
+ sandboxId: string;
195
+ runtime: "bubblewrap" | "docker" | "codeplane";
196
+ error: unknown;
197
+ timestampMs: number;
198
+ }
199
+ | {
200
+ type: "SandboxDiffReviewRequested";
201
+ runId: string;
202
+ sandboxId: string;
203
+ patchCount: number;
204
+ totalDiffLines: number;
205
+ timestampMs: number;
206
+ }
207
+ | {
208
+ type: "SandboxDiffAccepted";
209
+ runId: string;
210
+ sandboxId: string;
211
+ patchCount: number;
212
+ timestampMs: number;
213
+ }
214
+ | {
215
+ type: "SandboxDiffRejected";
216
+ runId: string;
217
+ sandboxId: string;
218
+ reason?: string;
219
+ timestampMs: number;
220
+ }
221
+ | {
222
+ type: "FrameCommitted";
223
+ runId: string;
224
+ frameNo: number;
225
+ xmlHash: string;
226
+ timestampMs: number;
227
+ }
228
+ | {
229
+ type: "NodePending";
230
+ runId: string;
231
+ nodeId: string;
232
+ iteration: number;
233
+ timestampMs: number;
234
+ }
235
+ | {
236
+ type: "NodeStarted";
237
+ runId: string;
238
+ nodeId: string;
239
+ iteration: number;
240
+ attempt: number;
241
+ timestampMs: number;
242
+ }
243
+ | {
244
+ type: "TaskHeartbeat";
245
+ runId: string;
246
+ nodeId: string;
247
+ iteration: number;
248
+ attempt: number;
249
+ hasData: boolean;
250
+ dataSizeBytes: number;
251
+ intervalMs?: number;
252
+ timestampMs: number;
253
+ }
254
+ | {
255
+ type: "TaskHeartbeatTimeout";
256
+ runId: string;
257
+ nodeId: string;
258
+ iteration: number;
259
+ attempt: number;
260
+ lastHeartbeatAtMs: number;
261
+ timeoutMs: number;
262
+ timestampMs: number;
263
+ }
264
+ | {
265
+ type: "NodeFinished";
266
+ runId: string;
267
+ nodeId: string;
268
+ iteration: number;
269
+ attempt: number;
270
+ timestampMs: number;
271
+ }
272
+ | {
273
+ type: "NodeFailed";
274
+ runId: string;
275
+ nodeId: string;
276
+ iteration: number;
277
+ attempt: number;
278
+ error: unknown;
279
+ timestampMs: number;
280
+ }
281
+ | {
282
+ type: "NodeCancelled";
283
+ runId: string;
284
+ nodeId: string;
285
+ iteration: number;
286
+ attempt?: number;
287
+ reason?: string;
288
+ timestampMs: number;
289
+ }
290
+ | {
291
+ type: "NodeSkipped";
292
+ runId: string;
293
+ nodeId: string;
294
+ iteration: number;
295
+ timestampMs: number;
296
+ }
297
+ | {
298
+ type: "NodeRetrying";
299
+ runId: string;
300
+ nodeId: string;
301
+ iteration: number;
302
+ attempt: number;
303
+ timestampMs: number;
304
+ }
305
+ | {
306
+ type: "NodeWaitingApproval";
307
+ runId: string;
308
+ nodeId: string;
309
+ iteration: number;
310
+ timestampMs: number;
311
+ }
312
+ | {
313
+ type: "NodeWaitingTimer";
314
+ runId: string;
315
+ nodeId: string;
316
+ iteration: number;
317
+ firesAtMs: number;
318
+ timestampMs: number;
319
+ }
320
+ | {
321
+ type: "ApprovalRequested";
322
+ runId: string;
323
+ nodeId: string;
324
+ iteration: number;
325
+ timestampMs: number;
326
+ }
327
+ | {
328
+ type: "ApprovalGranted";
329
+ runId: string;
330
+ nodeId: string;
331
+ iteration: number;
332
+ timestampMs: number;
333
+ }
334
+ | {
335
+ type: "ApprovalAutoApproved";
336
+ runId: string;
337
+ nodeId: string;
338
+ iteration: number;
339
+ timestampMs: number;
340
+ }
341
+ | {
342
+ type: "ApprovalDenied";
343
+ runId: string;
344
+ nodeId: string;
345
+ iteration: number;
346
+ timestampMs: number;
347
+ }
348
+ | {
349
+ type: "ToolCallStarted";
350
+ runId: string;
351
+ nodeId: string;
352
+ iteration: number;
353
+ attempt: number;
354
+ toolName: string;
355
+ seq: number;
356
+ timestampMs: number;
357
+ }
358
+ | {
359
+ type: "ToolCallFinished";
360
+ runId: string;
361
+ nodeId: string;
362
+ iteration: number;
363
+ attempt: number;
364
+ toolName: string;
365
+ seq: number;
366
+ status: "success" | "error";
367
+ timestampMs: number;
368
+ }
369
+ | {
370
+ type: "NodeOutput";
371
+ runId: string;
372
+ nodeId: string;
373
+ iteration: number;
374
+ attempt: number;
375
+ text: string;
376
+ stream: "stdout" | "stderr";
377
+ timestampMs: number;
378
+ }
379
+ | {
380
+ type: "AgentEvent";
381
+ runId: string;
382
+ nodeId: string;
383
+ iteration: number;
384
+ attempt: number;
385
+ engine: string;
386
+ event: AgentCliEvent;
387
+ timestampMs: number;
388
+ }
389
+ | {
390
+ type: "RetryTaskStarted";
391
+ runId: string;
392
+ nodeId: string;
393
+ iteration: number;
394
+ resetDependents: boolean;
395
+ resetNodes: string[];
396
+ timestampMs: number;
397
+ }
398
+ | {
399
+ type: "RetryTaskFinished";
400
+ runId: string;
401
+ nodeId: string;
402
+ iteration: number;
403
+ resetNodes: string[];
404
+ success: boolean;
405
+ error?: string;
406
+ timestampMs: number;
407
+ }
408
+ | {
409
+ type: "RevertStarted";
410
+ runId: string;
411
+ nodeId: string;
412
+ iteration: number;
413
+ attempt: number;
414
+ jjPointer: string;
415
+ timestampMs: number;
416
+ }
417
+ | {
418
+ type: "RevertFinished";
419
+ runId: string;
420
+ nodeId: string;
421
+ iteration: number;
422
+ attempt: number;
423
+ jjPointer: string;
424
+ success: boolean;
425
+ error?: string;
426
+ timestampMs: number;
427
+ }
428
+ | {
429
+ type: "TimeTravelStarted";
430
+ runId: string;
431
+ nodeId: string;
432
+ iteration: number;
433
+ attempt: number;
434
+ jjPointer?: string;
435
+ timestampMs: number;
436
+ }
437
+ | {
438
+ type: "TimeTravelFinished";
439
+ runId: string;
440
+ nodeId: string;
441
+ iteration: number;
442
+ attempt: number;
443
+ jjPointer?: string;
444
+ success: boolean;
445
+ vcsRestored: boolean;
446
+ resetNodes: string[];
447
+ error?: string;
448
+ timestampMs: number;
449
+ }
450
+ | {
451
+ type: "TimeTravelJumped";
452
+ runId: string;
453
+ fromFrameNo: number;
454
+ toFrameNo: number;
455
+ timestampMs: number;
456
+ caller?: string;
457
+ }
458
+ | {
459
+ type: "WorkflowReloadDetected";
460
+ runId: string;
461
+ changedFiles: string[];
462
+ timestampMs: number;
463
+ }
464
+ | {
465
+ type: "WorkflowReloaded";
466
+ runId: string;
467
+ generation: number;
468
+ changedFiles: string[];
469
+ timestampMs: number;
470
+ }
471
+ | {
472
+ type: "WorkflowReloadFailed";
473
+ runId: string;
474
+ error: unknown;
475
+ changedFiles: string[];
476
+ timestampMs: number;
477
+ }
478
+ | {
479
+ type: "WorkflowReloadUnsafe";
480
+ runId: string;
481
+ reason: string;
482
+ changedFiles: string[];
483
+ timestampMs: number;
484
+ }
485
+ | {
486
+ type: "ScorerStarted";
487
+ runId: string;
488
+ nodeId: string;
489
+ scorerId: string;
490
+ scorerName: string;
491
+ timestampMs: number;
492
+ }
493
+ | {
494
+ type: "ScorerFinished";
495
+ runId: string;
496
+ nodeId: string;
497
+ scorerId: string;
498
+ scorerName: string;
499
+ score: number;
500
+ timestampMs: number;
501
+ }
502
+ | {
503
+ type: "ScorerFailed";
504
+ runId: string;
505
+ nodeId: string;
506
+ scorerId: string;
507
+ scorerName: string;
508
+ error: unknown;
509
+ timestampMs: number;
510
+ }
511
+ | {
512
+ type: "TokenUsageReported";
513
+ runId: string;
514
+ nodeId: string;
515
+ iteration: number;
516
+ attempt: number;
517
+ model: string;
518
+ agent: string;
519
+ inputTokens: number;
520
+ outputTokens: number;
521
+ cacheReadTokens?: number;
522
+ cacheWriteTokens?: number;
523
+ reasoningTokens?: number;
524
+ timestampMs: number;
525
+ }
526
+ | {
527
+ type: "SnapshotCaptured";
528
+ runId: string;
529
+ frameNo: number;
530
+ contentHash: string;
531
+ timestampMs: number;
532
+ }
533
+ | {
534
+ type: "RunForked";
535
+ runId: string;
536
+ parentRunId: string;
537
+ parentFrameNo: number;
538
+ branchLabel?: string;
539
+ timestampMs: number;
540
+ }
541
+ | {
542
+ type: "ReplayStarted";
543
+ runId: string;
544
+ parentRunId: string;
545
+ parentFrameNo: number;
546
+ restoreVcs: boolean;
547
+ timestampMs: number;
548
+ }
549
+ | {
550
+ type: "MemoryFactSet";
551
+ runId: string;
552
+ namespace: string;
553
+ key: string;
554
+ timestampMs: number;
555
+ }
556
+ | {
557
+ type: "MemoryRecalled";
558
+ runId: string;
559
+ namespace: string;
560
+ query: string;
561
+ resultCount: number;
562
+ timestampMs: number;
563
+ }
564
+ | {
565
+ type: "MemoryMessageSaved";
566
+ runId: string;
567
+ threadId: string;
568
+ role: string;
569
+ timestampMs: number;
570
+ }
571
+ | {
572
+ type: "OpenApiToolCalled";
573
+ runId: string;
574
+ operationId: string;
575
+ method: string;
576
+ path: string;
577
+ durationMs: number;
578
+ status: "success" | "error";
579
+ timestampMs: number;
580
+ }
581
+ | {
582
+ type: "TimerCreated";
583
+ runId: string;
584
+ timerId: string;
585
+ firesAtMs: number;
586
+ timerType: "duration" | "absolute";
587
+ timestampMs: number;
588
+ }
589
+ | {
590
+ type: "TimerFired";
591
+ runId: string;
592
+ timerId: string;
593
+ firesAtMs: number;
594
+ firedAtMs: number;
595
+ delayMs: number;
596
+ timestampMs: number;
597
+ }
598
+ | {
599
+ type: "TimerCancelled";
600
+ runId: string;
601
+ timerId: string;
602
+ timestampMs: number;
603
+ };
@@ -0,0 +1 @@
1
+ export type SmithersLogFormat = "json" | "pretty" | "string" | "logfmt";
@@ -0,0 +1,15 @@
1
+ import type { MetricLabels } from "./_corePrometheusShape.ts";
2
+ import type { SmithersMetricType } from "./SmithersMetricType.ts";
3
+ import type { SmithersMetricUnit } from "./SmithersMetricUnit.ts";
4
+
5
+ export type SmithersMetricDefinition = {
6
+ readonly key: string;
7
+ readonly name: string;
8
+ readonly prometheusName: string;
9
+ readonly type: SmithersMetricType;
10
+ readonly label: string;
11
+ readonly unit?: SmithersMetricUnit;
12
+ readonly labels?: readonly string[];
13
+ readonly defaultLabels?: readonly MetricLabels[];
14
+ readonly boundaries?: readonly number[];
15
+ };
@@ -0,0 +1 @@
1
+ export type SmithersMetricType = "counter" | "gauge" | "histogram";