@osfactory/otel-hook 0.9.0 → 0.11.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/README.md +124 -4
- package/dist/{adapter-BJiz6lqM.d.ts → adapter-DiLknaTF.d.ts} +14 -2
- package/dist/cli.js +2272 -730
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +13 -4
- package/dist/config.js +128 -23
- package/dist/config.js.map +1 -1
- package/dist/{destinations-C6Bm89W6.d.ts → destinations-BIl3gGzx.d.ts} +12 -2
- package/dist/diagnostics.d.ts +1 -1
- package/dist/diagnostics.js.map +1 -1
- package/dist/{events-B3MHoJTD.d.ts → events-CSD_YiJ2.d.ts} +2 -0
- package/dist/{export-destinations-d8tZV0G4.d.ts → export-destinations-QWKGGEjk.d.ts} +131 -6
- package/dist/{filesystem-store-r-nNA3BA.d.ts → filesystem-store-D3SCNmbX.d.ts} +1 -1
- package/dist/{hook-zA1b4cWd.d.ts → hook-BOecWGSz.d.ts} +10 -5
- package/dist/index.d.ts +16 -16
- package/dist/index.js +1808 -251
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +4 -4
- package/dist/install.js +31 -2
- package/dist/install.js.map +1 -1
- package/dist/integration.d.ts +37 -12
- package/dist/integration.js +3271 -1551
- package/dist/integration.js.map +1 -1
- package/dist/lifecycle.d.ts +55 -4
- package/dist/lifecycle.js +277 -4
- package/dist/lifecycle.js.map +1 -1
- package/dist/{memory-Bl9ANVff.d.ts → memory-Cs51jyRk.d.ts} +2 -2
- package/dist/{semconv-fPRb-dpU.d.ts → metric-model-DDnWxL9d.d.ts} +154 -2
- package/dist/model.d.ts +1 -1
- package/dist/model.js +7 -0
- package/dist/model.js.map +1 -1
- package/dist/{payload-Ci8_ERm6.d.ts → payload-ChtrEX6A.d.ts} +41 -2
- package/dist/{ports-n7KFOpKo.d.ts → ports-CeqLq31i.d.ts} +87 -2
- package/dist/providers.d.ts +146 -10
- package/dist/providers.js +397 -13
- package/dist/providers.js.map +1 -1
- package/dist/{registry-B8ZHc2bc.d.ts → registry-CcJNF3WY.d.ts} +2 -2
- package/dist/runtime.d.ts +8 -8
- package/dist/runtime.js +1404 -1219
- package/dist/runtime.js.map +1 -1
- package/dist/{schema-BxiVsU-d.d.ts → schema-DMnoU1V_.d.ts} +93 -1
- package/dist/state.d.ts +4 -4
- package/dist/state.js +630 -39
- package/dist/state.js.map +1 -1
- package/dist/telemetry.d.ts +6 -6
- package/dist/telemetry.js +872 -19
- package/dist/telemetry.js.map +1 -1
- package/dist/testing.d.ts +11 -9
- package/dist/testing.js +264 -34
- package/dist/testing.js.map +1 -1
- package/package.json +3 -1
|
@@ -28,6 +28,33 @@ declare const logsPolicySchema: z.ZodObject<{
|
|
|
28
28
|
}, z.core.$strict>;
|
|
29
29
|
type LogsPolicy = z.infer<typeof logsPolicySchema>;
|
|
30
30
|
declare const DEFAULT_LOGS_POLICY: LogsPolicy;
|
|
31
|
+
/**
|
|
32
|
+
* Policy for hook-derived metrics (issue #69).
|
|
33
|
+
*
|
|
34
|
+
* Off by default, like logs: an upgrade must not start a new stream to a
|
|
35
|
+
* collector nobody sized for it. `enabled` governs the `default` destination
|
|
36
|
+
* (the single-endpoint settings); an `exporter.destinations[]` entry receives
|
|
37
|
+
* metrics when its `signals` list names `metrics`. Metrics carry no content, so
|
|
38
|
+
* listing the signal is the whole opt-in.
|
|
39
|
+
*
|
|
40
|
+
* - `temporality`: `cumulative` (default) exports running totals per series,
|
|
41
|
+
* kept in the state store across hook processes, so a receiver that merges
|
|
42
|
+
* counters by keeping the largest value stays correct. `delta` exports what one
|
|
43
|
+
* callback observed and keeps no state.
|
|
44
|
+
* - `includeSessionId`: put `session.id` on every data point (default true). Turn
|
|
45
|
+
* it off where per-session series are too many for the backend.
|
|
46
|
+
*/
|
|
47
|
+
declare const metricsPolicySchema: z.ZodObject<{
|
|
48
|
+
enabled: z.ZodBoolean;
|
|
49
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
50
|
+
temporality: z.ZodEnum<{
|
|
51
|
+
delta: "delta";
|
|
52
|
+
cumulative: "cumulative";
|
|
53
|
+
}>;
|
|
54
|
+
includeSessionId: z.ZodBoolean;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
type MetricsPolicy = z.infer<typeof metricsPolicySchema>;
|
|
57
|
+
declare const DEFAULT_METRICS_POLICY: MetricsPolicy;
|
|
31
58
|
/**
|
|
32
59
|
* Runtime exporter policy.
|
|
33
60
|
*
|
|
@@ -57,12 +84,22 @@ declare const exporterPolicySchema: z.ZodObject<{
|
|
|
57
84
|
includeContent: z.ZodBoolean;
|
|
58
85
|
maxBatchSize: z.ZodNumber;
|
|
59
86
|
}, z.core.$strict>;
|
|
87
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
88
|
+
enabled: z.ZodBoolean;
|
|
89
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
90
|
+
temporality: z.ZodEnum<{
|
|
91
|
+
delta: "delta";
|
|
92
|
+
cumulative: "cumulative";
|
|
93
|
+
}>;
|
|
94
|
+
includeSessionId: z.ZodBoolean;
|
|
95
|
+
}, z.core.$strict>>;
|
|
60
96
|
destinations: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
61
97
|
name: z.ZodString;
|
|
62
98
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
63
99
|
endpoint: z.ZodOptional<z.ZodString>;
|
|
64
100
|
tracesEndpoint: z.ZodOptional<z.ZodString>;
|
|
65
101
|
logsEndpoint: z.ZodOptional<z.ZodString>;
|
|
102
|
+
metricsEndpoint: z.ZodOptional<z.ZodString>;
|
|
66
103
|
protocol: z.ZodOptional<z.ZodEnum<{
|
|
67
104
|
none: "none";
|
|
68
105
|
"http/protobuf": "http/protobuf";
|
|
@@ -72,6 +109,7 @@ declare const exporterPolicySchema: z.ZodObject<{
|
|
|
72
109
|
signals: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
73
110
|
traces: "traces";
|
|
74
111
|
logs: "logs";
|
|
112
|
+
metrics: "metrics";
|
|
75
113
|
}>>>>;
|
|
76
114
|
}, z.core.$strict>>>>;
|
|
77
115
|
spool: z.ZodOptional<z.ZodObject<{
|
|
@@ -103,6 +141,22 @@ declare const diagnosticsPolicySchema: z.ZodObject<{
|
|
|
103
141
|
emitErrorEvents: z.ZodBoolean;
|
|
104
142
|
}, z.core.$strict>;
|
|
105
143
|
type DiagnosticsPolicy = z.infer<typeof diagnosticsPolicySchema>;
|
|
144
|
+
/**
|
|
145
|
+
* Per-provider behaviour that is not part of an adapter's parse.
|
|
146
|
+
*
|
|
147
|
+
* `claudeCode.readTranscriptUsage` is the one sanctioned exception to "no
|
|
148
|
+
* transcript reads in the hook" (docs/claude-code-usage-contract.md, finding 8).
|
|
149
|
+
* When true, the hook runtime — never the adapter — reads the session transcript
|
|
150
|
+
* named by a Claude Code `Stop` / `StopFailure` payload, bounded, and attaches the
|
|
151
|
+
* turn's model and summed token usage before the adapter parses it. Off by
|
|
152
|
+
* default: without it, otel-hook reads no file a hook payload names.
|
|
153
|
+
*/
|
|
154
|
+
declare const providersPolicySchema: z.ZodObject<{
|
|
155
|
+
claudeCode: z.ZodOptional<z.ZodObject<{
|
|
156
|
+
readTranscriptUsage: z.ZodBoolean;
|
|
157
|
+
}, z.core.$strict>>;
|
|
158
|
+
}, z.core.$strict>;
|
|
159
|
+
type ProvidersPolicy = z.infer<typeof providersPolicySchema>;
|
|
106
160
|
declare const otelHookConfigSchema: z.ZodObject<{
|
|
107
161
|
exporter: z.ZodObject<{
|
|
108
162
|
enabled: z.ZodBoolean;
|
|
@@ -126,12 +180,22 @@ declare const otelHookConfigSchema: z.ZodObject<{
|
|
|
126
180
|
includeContent: z.ZodBoolean;
|
|
127
181
|
maxBatchSize: z.ZodNumber;
|
|
128
182
|
}, z.core.$strict>;
|
|
183
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
184
|
+
enabled: z.ZodBoolean;
|
|
185
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
186
|
+
temporality: z.ZodEnum<{
|
|
187
|
+
delta: "delta";
|
|
188
|
+
cumulative: "cumulative";
|
|
189
|
+
}>;
|
|
190
|
+
includeSessionId: z.ZodBoolean;
|
|
191
|
+
}, z.core.$strict>>;
|
|
129
192
|
destinations: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
130
193
|
name: z.ZodString;
|
|
131
194
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
132
195
|
endpoint: z.ZodOptional<z.ZodString>;
|
|
133
196
|
tracesEndpoint: z.ZodOptional<z.ZodString>;
|
|
134
197
|
logsEndpoint: z.ZodOptional<z.ZodString>;
|
|
198
|
+
metricsEndpoint: z.ZodOptional<z.ZodString>;
|
|
135
199
|
protocol: z.ZodOptional<z.ZodEnum<{
|
|
136
200
|
none: "none";
|
|
137
201
|
"http/protobuf": "http/protobuf";
|
|
@@ -141,6 +205,7 @@ declare const otelHookConfigSchema: z.ZodObject<{
|
|
|
141
205
|
signals: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
142
206
|
traces: "traces";
|
|
143
207
|
logs: "logs";
|
|
208
|
+
metrics: "metrics";
|
|
144
209
|
}>>>>;
|
|
145
210
|
}, z.core.$strict>>>>;
|
|
146
211
|
spool: z.ZodOptional<z.ZodObject<{
|
|
@@ -190,6 +255,11 @@ declare const otelHookConfigSchema: z.ZodObject<{
|
|
|
190
255
|
}>;
|
|
191
256
|
emitErrorEvents: z.ZodBoolean;
|
|
192
257
|
}, z.core.$strict>;
|
|
258
|
+
providers: z.ZodOptional<z.ZodObject<{
|
|
259
|
+
claudeCode: z.ZodOptional<z.ZodObject<{
|
|
260
|
+
readTranscriptUsage: z.ZodBoolean;
|
|
261
|
+
}, z.core.$strict>>;
|
|
262
|
+
}, z.core.$strict>>;
|
|
193
263
|
}, z.core.$strict>;
|
|
194
264
|
type OtelHookConfig = z.infer<typeof otelHookConfigSchema>;
|
|
195
265
|
/** Partial overlay accepted from a configuration layer. */
|
|
@@ -216,6 +286,7 @@ declare const otelHookConfigPatchSchema: z.ZodObject<{
|
|
|
216
286
|
endpoint: z.ZodOptional<z.ZodString>;
|
|
217
287
|
tracesEndpoint: z.ZodOptional<z.ZodString>;
|
|
218
288
|
logsEndpoint: z.ZodOptional<z.ZodString>;
|
|
289
|
+
metricsEndpoint: z.ZodOptional<z.ZodString>;
|
|
219
290
|
protocol: z.ZodOptional<z.ZodEnum<{
|
|
220
291
|
none: "none";
|
|
221
292
|
"http/protobuf": "http/protobuf";
|
|
@@ -225,6 +296,7 @@ declare const otelHookConfigPatchSchema: z.ZodObject<{
|
|
|
225
296
|
signals: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
226
297
|
traces: "traces";
|
|
227
298
|
logs: "logs";
|
|
299
|
+
metrics: "metrics";
|
|
228
300
|
}>>>>;
|
|
229
301
|
}, z.core.$strict>>>>>;
|
|
230
302
|
logs: z.ZodOptional<z.ZodObject<{
|
|
@@ -233,6 +305,15 @@ declare const otelHookConfigPatchSchema: z.ZodObject<{
|
|
|
233
305
|
includeContent: z.ZodOptional<z.ZodBoolean>;
|
|
234
306
|
maxBatchSize: z.ZodOptional<z.ZodNumber>;
|
|
235
307
|
}, z.core.$strict>>;
|
|
308
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
309
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
310
|
+
endpoint: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
311
|
+
temporality: z.ZodOptional<z.ZodEnum<{
|
|
312
|
+
delta: "delta";
|
|
313
|
+
cumulative: "cumulative";
|
|
314
|
+
}>>;
|
|
315
|
+
includeSessionId: z.ZodOptional<z.ZodBoolean>;
|
|
316
|
+
}, z.core.$strict>>;
|
|
236
317
|
spool: z.ZodOptional<z.ZodObject<{
|
|
237
318
|
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
238
319
|
maxAgeMillis: z.ZodOptional<z.ZodNumber>;
|
|
@@ -280,11 +361,22 @@ declare const otelHookConfigPatchSchema: z.ZodObject<{
|
|
|
280
361
|
}>>;
|
|
281
362
|
emitErrorEvents: z.ZodOptional<z.ZodBoolean>;
|
|
282
363
|
}, z.core.$strict>>;
|
|
364
|
+
providers: z.ZodOptional<z.ZodObject<{
|
|
365
|
+
claudeCode: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
366
|
+
readTranscriptUsage: z.ZodOptional<z.ZodBoolean>;
|
|
367
|
+
}, z.core.$strict>>>;
|
|
368
|
+
}, z.core.$strict>>;
|
|
283
369
|
}, z.core.$strict>;
|
|
284
370
|
type OtelHookConfigPatch = z.infer<typeof otelHookConfigPatchSchema>;
|
|
285
371
|
declare const DEFAULT_EXPORTER_POLICY: ExporterPolicy;
|
|
286
372
|
declare const DEFAULT_DETECTION_POLICY: DetectionPolicy;
|
|
287
373
|
declare const DEFAULT_DIAGNOSTICS_POLICY: DiagnosticsPolicy;
|
|
374
|
+
declare const DEFAULT_PROVIDERS_POLICY: ProvidersPolicy;
|
|
288
375
|
declare const DEFAULT_CONFIG: OtelHookConfig;
|
|
376
|
+
/** Whether the runtime may read Claude Code transcripts at `Stop` (default false). */
|
|
377
|
+
declare const readsClaudeTranscriptUsage: (config: OtelHookConfig) => boolean;
|
|
378
|
+
|
|
379
|
+
/** The metrics policy in force, defaults filled in. */
|
|
380
|
+
declare const effectiveMetricsPolicy: (exporter: ExporterPolicy) => MetricsPolicy;
|
|
289
381
|
|
|
290
|
-
export { DEFAULT_CONFIG as D, type ExporterPolicy as E, type LogsPolicy as L, type OtelHookConfig as O, DEFAULT_DETECTION_POLICY as a, DEFAULT_DIAGNOSTICS_POLICY as b, DEFAULT_EXPORTER_POLICY as c, DEFAULT_LOGS_POLICY as d, type DetectionPolicy as
|
|
382
|
+
export { DEFAULT_CONFIG as D, type ExporterPolicy as E, type LogsPolicy as L, type MetricsPolicy as M, type OtelHookConfig as O, type ProvidersPolicy as P, DEFAULT_DETECTION_POLICY as a, DEFAULT_DIAGNOSTICS_POLICY as b, DEFAULT_EXPORTER_POLICY as c, DEFAULT_LOGS_POLICY as d, DEFAULT_METRICS_POLICY as e, DEFAULT_PROVIDERS_POLICY as f, type DetectionPolicy as g, type DiagnosticsPolicy as h, type OtelHookConfigPatch as i, detectionPolicySchema as j, diagnosticsPolicySchema as k, effectiveMetricsPolicy as l, exporterPolicySchema as m, logsPolicySchema as n, metricsPolicySchema as o, otelHookConfigPatchSchema as p, otelHookConfigSchema as q, providersPolicySchema as r, readsClaudeTranscriptUsage as s };
|
package/dist/state.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { S as StoreNamespace } from './keys-Dej5bN3L.js';
|
|
2
|
-
import { L as LockingStateStore } from './filesystem-store-
|
|
3
|
-
export { F as FilesystemStateStore, a as FilesystemStateStoreOptions, S as StateStoreDependencies, c as createFilesystemStateStore, i as isLockingStateStore, w as withOptionalSessionLock } from './filesystem-store-
|
|
4
|
-
import { C as Clock } from './ports-
|
|
2
|
+
import { L as LockingStateStore } from './filesystem-store-D3SCNmbX.js';
|
|
3
|
+
export { F as FilesystemStateStore, a as FilesystemStateStoreOptions, S as StateStoreDependencies, c as createFilesystemStateStore, i as isLockingStateStore, w as withOptionalSessionLock } from './filesystem-store-D3SCNmbX.js';
|
|
4
|
+
import { C as Clock } from './ports-CeqLq31i.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './errors.js';
|
|
7
7
|
import './primitives-CJ8-rn-f.js';
|
|
8
8
|
import './taxonomy-DwhTtuWd.js';
|
|
9
|
-
import './events-
|
|
9
|
+
import './events-CSD_YiJ2.js';
|
|
10
10
|
|
|
11
11
|
type BoundedMemoryStateStoreOptions = {
|
|
12
12
|
readonly clock: Clock;
|