@osfactory/otel-hook 0.7.0 → 0.9.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/dist/testing.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/config/schema.ts
2
- import { z as z4 } from "zod";
2
+ import { z as z5 } from "zod";
3
3
 
4
4
  // src/model/primitives.ts
5
5
  import { z } from "zod";
@@ -135,8 +135,112 @@ var resolvePrivacyPolicy = (policy) => {
135
135
  return { policy: parsed, notes: [] };
136
136
  };
137
137
 
138
- // src/config/resource-attributes.ts
138
+ // src/config/destinations.ts
139
139
  import { z as z3 } from "zod";
140
+
141
+ // src/config/header-value.ts
142
+ var isUnsafeHeaderValue = (value) => [...value].some((char) => {
143
+ const code = char.codePointAt(0) ?? 0;
144
+ return code < 32 && code !== 9 || code === 127 || code > 255;
145
+ });
146
+
147
+ // src/config/otlp-headers.ts
148
+ var MAX_OTLP_HEADERS = 32;
149
+ var OTLP_HEADER_VARIABLES = Object.freeze({
150
+ generic: "OTEL_EXPORTER_OTLP_HEADERS",
151
+ traces: "OTEL_EXPORTER_OTLP_TRACES_HEADERS",
152
+ logs: "OTEL_EXPORTER_OTLP_LOGS_HEADERS"
153
+ });
154
+
155
+ // src/config/destinations.ts
156
+ var DEFAULT_DESTINATION_NAME = "default";
157
+ var DESTINATION_NAME_PATTERN = /^[a-z0-9][a-z0-9_-]{0,62}$/;
158
+ var MAX_EXPORT_DESTINATIONS = 16;
159
+ var MAX_DESTINATION_HEADERS = MAX_OTLP_HEADERS;
160
+ var HEADER_ENV_REFERENCE_PREFIX = "env:";
161
+ var HEADER_NAME_PATTERN = /^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/;
162
+ var ENV_VARIABLE_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
163
+ var MAX_HEADER_VALUE_LENGTH = 8192;
164
+ var exportSignalSchema = z3.enum(["traces", "logs"]);
165
+ var headerValueSchema = z3.string().min(1).max(MAX_HEADER_VALUE_LENGTH).refine(
166
+ (value) => !isUnsafeHeaderValue(value),
167
+ "header values may not contain line breaks, control characters, or characters beyond Latin-1"
168
+ ).refine(
169
+ (value) => !value.startsWith(HEADER_ENV_REFERENCE_PREFIX) || ENV_VARIABLE_NAME_PATTERN.test(value.slice(HEADER_ENV_REFERENCE_PREFIX.length)),
170
+ "an env: header reference must name an environment variable, e.g. env:COLLECTOR_TOKEN"
171
+ );
172
+ var endpointSchema = z3.string().url().max(2048);
173
+ var exportDestinationSchema = z3.strictObject({
174
+ /** Unique, lowercase, filesystem-safe. `default` is reserved for the single-endpoint settings. */
175
+ name: z3.string().regex(DESTINATION_NAME_PATTERN, "destination names are lowercase letters, digits, _ and -"),
176
+ /** Default true. A disabled destination is neither sent to nor drained. */
177
+ enabled: z3.boolean().optional(),
178
+ /**
179
+ * Traces URL, with the same meaning as `exporter.endpoint`: the logs URL is
180
+ * derived from it (`/v1/traces` becomes `/v1/logs`) unless `logsEndpoint` is set.
181
+ */
182
+ endpoint: endpointSchema.optional(),
183
+ /** Per-signal override of `endpoint` for traces. */
184
+ tracesEndpoint: endpointSchema.optional(),
185
+ /** Per-signal override of the derived logs URL. */
186
+ logsEndpoint: endpointSchema.optional(),
187
+ /** Defaults to `exporter.protocol`. */
188
+ protocol: z3.enum(["http/protobuf", "http/json", "none"]).optional(),
189
+ /**
190
+ * Header name to value. A value of the form `env:NAME` is read from that
191
+ * environment variable at send time, so a credential never has to be written
192
+ * into the file. Values never appear in a snapshot, a diagnostic, or `doctor`.
193
+ */
194
+ headers: z3.record(z3.string().regex(HEADER_NAME_PATTERN, "not a valid header name"), headerValueSchema).refine(
195
+ (headers) => Object.keys(headers).length <= MAX_DESTINATION_HEADERS,
196
+ `at most ${String(MAX_DESTINATION_HEADERS)} headers per destination`
197
+ ).optional(),
198
+ /**
199
+ * Which signals this destination receives. Default: both. The logs signal is
200
+ * still governed by `exporter.logs.enabled`, which stays the one opt-in for a
201
+ * second stream leaving the host.
202
+ */
203
+ signals: z3.array(exportSignalSchema).min(1).max(2).readonly().optional()
204
+ }).refine(
205
+ (destination) => destination.endpoint !== void 0 || destination.tracesEndpoint !== void 0 || destination.logsEndpoint !== void 0,
206
+ "a destination needs an endpoint, or a tracesEndpoint / logsEndpoint"
207
+ );
208
+ var exportDestinationsSchema = z3.array(exportDestinationSchema).max(MAX_EXPORT_DESTINATIONS).readonly().superRefine((destinations, context) => {
209
+ const seen = /* @__PURE__ */ new Set();
210
+ destinations.forEach((destination, index) => {
211
+ if (destination.name === DEFAULT_DESTINATION_NAME) {
212
+ context.addIssue({
213
+ code: "custom",
214
+ path: [index, "name"],
215
+ message: 'the name "default" is reserved for exporter.endpoint and the OTEL_EXPORTER_OTLP_* variables'
216
+ });
217
+ }
218
+ if (seen.has(destination.name)) {
219
+ context.addIssue({
220
+ code: "custom",
221
+ path: [index, "name"],
222
+ message: `duplicate destination name "${destination.name}"`
223
+ });
224
+ }
225
+ seen.add(destination.name);
226
+ });
227
+ });
228
+ var spoolPolicySchema = z3.strictObject({
229
+ /** Total bytes of queued batches. Default 16 MiB. */
230
+ maxBytes: z3.number().int().min(1024).max(1073741824),
231
+ /** A batch older than this is dropped instead of sent. Default 72 hours. */
232
+ maxAgeMillis: z3.number().int().min(1e3).max(30 * 24 * 60 * 60 * 1e3),
233
+ /** Number of queued batches. Default 500. */
234
+ maxBatches: z3.number().int().min(1).max(65536)
235
+ });
236
+ var DEFAULT_SPOOL_POLICY = Object.freeze({
237
+ maxBytes: 16 * 1024 * 1024,
238
+ maxAgeMillis: 72 * 60 * 60 * 1e3,
239
+ maxBatches: 500
240
+ });
241
+
242
+ // src/config/resource-attributes.ts
243
+ import { z as z4 } from "zod";
140
244
  var MAX_RESOURCE_ATTRIBUTES = 64;
141
245
  var MAX_RESOURCE_ATTRIBUTE_KEY_LENGTH = 255;
142
246
  var MAX_RESOURCE_ATTRIBUTE_VALUE_LENGTH = 2048;
@@ -181,12 +285,12 @@ var checkResourceAttributeKey = (key) => {
181
285
  }
182
286
  return void 0;
183
287
  };
184
- var resourceAttributeValueSchema = z3.union([
185
- z3.string().max(MAX_RESOURCE_ATTRIBUTE_VALUE_LENGTH),
186
- z3.number().finite(),
187
- z3.boolean()
288
+ var resourceAttributeValueSchema = z4.union([
289
+ z4.string().max(MAX_RESOURCE_ATTRIBUTE_VALUE_LENGTH),
290
+ z4.number().finite(),
291
+ z4.boolean()
188
292
  ]);
189
- var resourceAttributesSchema = z3.record(z3.string(), resourceAttributeValueSchema).superRefine((value, ctx) => {
293
+ var resourceAttributesSchema = z4.record(z4.string(), resourceAttributeValueSchema).superRefine((value, ctx) => {
190
294
  const keys = Object.keys(value);
191
295
  if (keys.length > MAX_RESOURCE_ATTRIBUTES) {
192
296
  ctx.addIssue({
@@ -208,36 +312,36 @@ var resourceAttributesSchema = z3.record(z3.string(), resourceAttributeValueSche
208
312
  var EMPTY_RESOURCE_ATTRIBUTES = Object.freeze({});
209
313
 
210
314
  // src/config/schema.ts
211
- var logsPolicySchema = z4.strictObject({
212
- enabled: z4.boolean(),
315
+ var logsPolicySchema = z5.strictObject({
316
+ enabled: z5.boolean(),
213
317
  /**
214
318
  * Full URL for the logs signal.
215
319
  *
216
320
  * Absent, it is derived from `endpoint`: a trailing `/v1/traces` becomes
217
321
  * `/v1/logs`, and an endpoint with no signal path has `/v1/logs` appended.
218
322
  */
219
- endpoint: z4.string().url().max(2048).optional(),
220
- includeContent: z4.boolean(),
221
- maxBatchSize: z4.number().int().min(1).max(4096)
323
+ endpoint: z5.string().url().max(2048).optional(),
324
+ includeContent: z5.boolean(),
325
+ maxBatchSize: z5.number().int().min(1).max(4096)
222
326
  });
223
327
  var DEFAULT_LOGS_POLICY = Object.freeze({
224
328
  enabled: false,
225
329
  includeContent: false,
226
330
  maxBatchSize: 128
227
331
  });
228
- var exporterPolicySchema = z4.strictObject({
229
- enabled: z4.boolean(),
230
- protocol: z4.enum(["http/protobuf", "http/json", "none"]),
231
- endpoint: z4.string().url().max(2048).optional(),
332
+ var exporterPolicySchema = z5.strictObject({
333
+ enabled: z5.boolean(),
334
+ protocol: z5.enum(["http/protobuf", "http/json", "none"]),
335
+ endpoint: z5.string().url().max(2048).optional(),
232
336
  /**
233
337
  * Header names only. Values are supplied separately at construction time and
234
338
  * are never part of a resolved-config snapshot, which is logged and exported.
235
339
  */
236
- headerNames: z4.array(nonEmptyStringSchema).max(32).readonly(),
237
- timeoutMillis: z4.number().int().min(1).max(6e5),
238
- maxBatchSize: z4.number().int().min(1).max(4096),
239
- maxQueueSize: z4.number().int().min(1).max(65536),
240
- maxRetryAttempts: z4.number().int().min(0).max(10),
340
+ headerNames: z5.array(nonEmptyStringSchema).max(32).readonly(),
341
+ timeoutMillis: z5.number().int().min(1).max(6e5),
342
+ maxBatchSize: z5.number().int().min(1).max(4096),
343
+ maxQueueSize: z5.number().int().min(1).max(65536),
344
+ maxRetryAttempts: z5.number().int().min(0).max(10),
241
345
  serviceName: nonEmptyStringSchema,
242
346
  serviceNamespace: nonEmptyStringSchema.optional(),
243
347
  /**
@@ -254,32 +358,52 @@ var exporterPolicySchema = z4.strictObject({
254
358
  * headers, timeout, protocol, service identity, and resource attributes above —
255
359
  * a second top-level section would invite two of each to drift apart.
256
360
  */
257
- logs: logsPolicySchema
361
+ logs: logsPolicySchema,
362
+ /**
363
+ * Additional OTLP destinations, each sent every batch in parallel.
364
+ *
365
+ * Absent (the default), the exporter has exactly one destination — the
366
+ * single-endpoint settings above, named `default` — and behaves exactly as it
367
+ * did before this list existed. See `destinations.ts`.
368
+ *
369
+ * Merged as one leaf: a higher layer that sets the list replaces it whole,
370
+ * because "the union of two partial lists" has no answer an operator could
371
+ * predict.
372
+ */
373
+ destinations: exportDestinationsSchema.optional(),
374
+ /**
375
+ * Per-destination retry spool bounds, each optional and merged per leaf; any
376
+ * bound left unset takes its value from `DEFAULT_SPOOL_POLICY`.
377
+ */
378
+ spool: spoolPolicySchema.partial().optional()
258
379
  });
259
- var detectionPolicySchema = z4.strictObject({
380
+ var detectionPolicySchema = z5.strictObject({
260
381
  /** Detections below this confidence resolve to the unknown provider. */
261
382
  minimumConfidence: detectionConfidenceSchema,
262
383
  /** When false, an ambiguous detection is an error rather than unknown. */
263
- allowAmbiguousFallback: z4.boolean(),
384
+ allowAmbiguousFallback: z5.boolean(),
264
385
  /** Optional allow-list of provider ids; empty means "any registered". */
265
- allowedProviderIds: z4.array(nonEmptyStringSchema).max(32).readonly()
386
+ allowedProviderIds: z5.array(nonEmptyStringSchema).max(32).readonly()
266
387
  });
267
- var diagnosticsPolicySchema = z4.strictObject({
268
- logLevel: z4.enum(["silent", "error", "warn", "info", "debug"]),
388
+ var diagnosticsPolicySchema = z5.strictObject({
389
+ logLevel: z5.enum(["silent", "error", "warn", "info", "debug"]),
269
390
  /** Emit `error.raised` events for contained failures. */
270
- emitErrorEvents: z4.boolean()
391
+ emitErrorEvents: z5.boolean()
271
392
  });
272
- var otelHookConfigSchema = z4.strictObject({
393
+ var otelHookConfigSchema = z5.strictObject({
273
394
  exporter: exporterPolicySchema,
274
395
  privacy: privacyPolicySchema,
275
396
  detection: detectionPolicySchema,
276
397
  diagnostics: diagnosticsPolicySchema
277
398
  });
278
- var otelHookConfigPatchSchema = z4.strictObject({
399
+ var otelHookConfigPatchSchema = z5.strictObject({
279
400
  // `logs` is unwrapped and re-partialled for the same reason `privacy.limits` is:
280
401
  // merging happens per leaf, so a layer must be able to set `logs.enabled` alone
281
402
  // without also restating the endpoint and the batch size.
282
- exporter: exporterPolicySchema.omit({ logs: true }).partial().extend({ logs: logsPolicySchema.partial().optional() }).optional(),
403
+ exporter: exporterPolicySchema.omit({ logs: true, spool: true }).partial().extend({
404
+ logs: logsPolicySchema.partial().optional(),
405
+ spool: spoolPolicySchema.partial().optional()
406
+ }).optional(),
283
407
  privacy: privacyPolicySchema.omit({ limits: true }).partial().extend({ limits: privacyPolicySchema.shape.limits.partial().optional() }).optional(),
284
408
  detection: detectionPolicySchema.partial().optional(),
285
409
  diagnostics: diagnosticsPolicySchema.partial().optional()
@@ -313,15 +437,15 @@ var DEFAULT_CONFIG = Object.freeze({
313
437
  });
314
438
 
315
439
  // src/model/identity.ts
316
- import { z as z5 } from "zod";
317
- var workspaceKeySourceSchema = z5.enum([
440
+ import { z as z6 } from "zod";
441
+ var workspaceKeySourceSchema = z6.enum([
318
442
  "git-remote",
319
443
  "git-root",
320
444
  "working-directory",
321
445
  "explicit",
322
446
  "unknown"
323
447
  ]);
324
- var workspaceIdentitySchema = z5.strictObject({
448
+ var workspaceIdentitySchema = z6.strictObject({
325
449
  workspaceId: workspaceIdSchema,
326
450
  keySource: workspaceKeySourceSchema,
327
451
  /** Repository name only; never an owner path or URL with credentials. */
@@ -335,7 +459,7 @@ var unknownWorkspaceIdentity = () => workspaceIdentitySchema.parse({
335
459
  workspaceId: UNKNOWN_WORKSPACE_ID,
336
460
  keySource: "unknown"
337
461
  });
338
- var sourceProvenanceSchema = z5.strictObject({
462
+ var sourceProvenanceSchema = z6.strictObject({
339
463
  providerId: resolvedProviderIdSchema,
340
464
  providerVersion: nonEmptyStringSchema.optional(),
341
465
  adapterId: nonEmptyStringSchema,
@@ -346,7 +470,7 @@ var sourceProvenanceSchema = z5.strictObject({
346
470
  transport: sourceTransportSchema
347
471
  }).readonly();
348
472
  var consumerAttributesSchema = attributesSchema.readonly();
349
- var invocationIdentitySchema = z5.strictObject({
473
+ var invocationIdentitySchema = z6.strictObject({
350
474
  invocationId: invocationIdSchema,
351
475
  sessionId: sessionIdSchema,
352
476
  /** Set when this invocation runs beneath another agent invocation. */
@@ -360,7 +484,7 @@ var invocationIdentitySchema = z5.strictObject({
360
484
  startedAt: epochMillisSchema,
361
485
  consumerAttributes: consumerAttributesSchema
362
486
  }).readonly();
363
- var identityClaimFieldsSchema = z5.strictObject({
487
+ var identityClaimFieldsSchema = z6.strictObject({
364
488
  invocationId: invocationIdSchema.optional(),
365
489
  sessionId: sessionIdSchema.optional(),
366
490
  parentInvocationId: invocationIdSchema.optional(),
@@ -369,7 +493,7 @@ var identityClaimFieldsSchema = z5.strictObject({
369
493
  workspace: workspaceIdentitySchema.optional(),
370
494
  startedAt: epochMillisSchema.optional()
371
495
  });
372
- var identityClaimSchema = z5.strictObject({
496
+ var identityClaimSchema = z6.strictObject({
373
497
  /** Non-sensitive label, e.g. `adapter:acme-cli` or `env:OTEL_HOOK_SESSION_ID`. */
374
498
  source: nonEmptyStringSchema,
375
499
  confidence: detectionConfidenceSchema,
@@ -493,7 +617,7 @@ var resolveInvocationIdentity = (input) => {
493
617
  import { createHash } from "crypto";
494
618
 
495
619
  // src/model/extensions.ts
496
- import { z as z6 } from "zod";
620
+ import { z as z7 } from "zod";
497
621
  var EXTENSION_KEY_PATTERN = /^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*(?:\.[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*)+$/;
498
622
  var RESERVED_EXTENSION_NAMESPACES = Object.freeze([
499
623
  "otelhook",
@@ -504,7 +628,7 @@ var MAX_EXTENSION_ENTRIES = 64;
504
628
  var extensionKeyNamespace = (key) => key.slice(0, key.indexOf("."));
505
629
  var isReservedExtensionNamespace = (key) => RESERVED_EXTENSION_NAMESPACES.includes(extensionKeyNamespace(key));
506
630
  var isValidExtensionKey = (key) => EXTENSION_KEY_PATTERN.test(key) && !isReservedExtensionNamespace(key);
507
- var extensionsSchema = z6.record(z6.string(), attributeValueSchema).check((ctx) => {
631
+ var extensionsSchema = z7.record(z7.string(), attributeValueSchema).check((ctx) => {
508
632
  const keys = Object.keys(ctx.value);
509
633
  if (keys.length > MAX_EXTENSION_ENTRIES) {
510
634
  ctx.issues.push({
@@ -879,14 +1003,14 @@ var createPrivacyService = (policyInput) => {
879
1003
  };
880
1004
 
881
1005
  // src/providers/adapter.ts
882
- import { z as z13 } from "zod";
1006
+ import { z as z14 } from "zod";
883
1007
 
884
1008
  // src/model/events.ts
885
- import { z as z12 } from "zod";
1009
+ import { z as z13 } from "zod";
886
1010
 
887
1011
  // src/errors/taxonomy.ts
888
- import { z as z7 } from "zod";
889
- var otelHookErrorCodeSchema = z7.enum([
1012
+ import { z as z8 } from "zod";
1013
+ var otelHookErrorCodeSchema = z8.enum([
890
1014
  /** Input was not usable at all (empty stdin, unparsable JSON). */
891
1015
  "invalid-input",
892
1016
  /** Input parsed but failed canonical schema validation. */
@@ -922,8 +1046,8 @@ var otelHookErrorCodeSchema = z7.enum([
922
1046
  /** Anything unanticipated. Always reported, never fatal to the host. */
923
1047
  "internal-error"
924
1048
  ]);
925
- var errorSeveritySchema = z7.enum(["warning", "error"]);
926
- var errorPhaseSchema = z7.enum([
1049
+ var errorSeveritySchema = z8.enum(["warning", "error"]);
1050
+ var errorPhaseSchema = z8.enum([
927
1051
  "configuration",
928
1052
  "detection",
929
1053
  "identity",
@@ -934,7 +1058,7 @@ var errorPhaseSchema = z7.enum([
934
1058
  "export",
935
1059
  "shutdown"
936
1060
  ]);
937
- var failurePostureSchema = z7.enum(["fail-open", "fail-closed-attribution"]);
1061
+ var failurePostureSchema = z8.enum(["fail-open", "fail-closed-attribution"]);
938
1062
  var ERROR_TAXONOMY = Object.freeze({
939
1063
  "invalid-input": {
940
1064
  code: "invalid-input",
@@ -1059,7 +1183,7 @@ var ERROR_TAXONOMY = Object.freeze({
1059
1183
  }
1060
1184
  });
1061
1185
  var describeErrorCode = (code) => ERROR_TAXONOMY[code];
1062
- var attributionOutcomeSchema = z7.enum([
1186
+ var attributionOutcomeSchema = z8.enum([
1063
1187
  /** Identity resolved; events carry provider and session identity. */
1064
1188
  "attributed",
1065
1189
  /** Identity could not be established safely; nothing was attributed. */
@@ -1069,7 +1193,7 @@ var attributionOutcomeSchema = z7.enum([
1069
1193
  /** Input was recognized but intentionally carried no telemetry. */
1070
1194
  "not-applicable"
1071
1195
  ]);
1072
- var attributionReasonSchema = z7.enum([
1196
+ var attributionReasonSchema = z8.enum([
1073
1197
  "provider-unknown",
1074
1198
  "provider-detection-ambiguous",
1075
1199
  "identity-conflict",
@@ -1081,8 +1205,8 @@ var attributionReasonSchema = z7.enum([
1081
1205
  ]);
1082
1206
 
1083
1207
  // src/model/content.ts
1084
- import { z as z8 } from "zod";
1085
- var contentKindSchema = z8.enum([
1208
+ import { z as z9 } from "zod";
1209
+ var contentKindSchema = z9.enum([
1086
1210
  "prompt",
1087
1211
  "response",
1088
1212
  "reasoning",
@@ -1092,47 +1216,47 @@ var contentKindSchema = z8.enum([
1092
1216
  "system-instruction",
1093
1217
  "attachment"
1094
1218
  ]);
1095
- var contentRoleSchema = z8.enum(["user", "assistant", "system", "tool", "unknown"]);
1096
- var contentDisclosureSchema = z8.enum(["omitted", "masked", "redacted", "raw"]);
1219
+ var contentRoleSchema = z9.enum(["user", "assistant", "system", "tool", "unknown"]);
1220
+ var contentDisclosureSchema = z9.enum(["omitted", "masked", "redacted", "raw"]);
1097
1221
  var CONTENT_HASH_PATTERN = /^sha256:[0-9a-f]{64}$/;
1098
- var contentFactSchema = z8.strictObject({
1222
+ var contentFactSchema = z9.strictObject({
1099
1223
  kind: contentKindSchema,
1100
1224
  role: contentRoleSchema.optional(),
1101
1225
  /** Unicode code point count of the original content. */
1102
- characterLength: z8.number().int().min(0),
1226
+ characterLength: z9.number().int().min(0),
1103
1227
  /** UTF-8 byte length of the original content. */
1104
- byteLength: z8.number().int().min(0),
1228
+ byteLength: z9.number().int().min(0),
1105
1229
  /** Stable salted digest of the original content. */
1106
- contentHash: z8.string().regex(CONTENT_HASH_PATTERN),
1230
+ contentHash: z9.string().regex(CONTENT_HASH_PATTERN),
1107
1231
  disclosure: contentDisclosureSchema,
1108
1232
  /** Disclosed text, bounded by the privacy policy. Absent when omitted. */
1109
- text: z8.string().optional(),
1233
+ text: z9.string().optional(),
1110
1234
  /** True when `text` was cut short by the configured string bound. */
1111
- truncated: z8.boolean(),
1235
+ truncated: z9.boolean(),
1112
1236
  /** Number of secret-looking spans replaced while producing `text`. */
1113
- secretsRedacted: z8.number().int().min(0),
1237
+ secretsRedacted: z9.number().int().min(0),
1114
1238
  /** Optional non-sensitive label, e.g. a MIME type or tool name. */
1115
1239
  label: nonEmptyStringSchema.optional()
1116
1240
  });
1117
- var contentFactsSchema = z8.array(contentFactSchema).max(64);
1241
+ var contentFactsSchema = z9.array(contentFactSchema).max(64);
1118
1242
  var isContentFactConsistent = (fact) => fact.disclosure === "omitted" ? fact.text === void 0 : fact.text !== void 0;
1119
1243
  var isUnavailableContentFact = (fact) => fact.disclosure === "omitted" && fact.text === void 0 && fact.characterLength === 0 && fact.byteLength === 0;
1120
1244
 
1121
1245
  // src/model/target.ts
1122
- import { z as z9 } from "zod";
1123
- var targetSourceSchema = z9.enum(["tool-path", "shell-cwd", "session-cwd"]);
1246
+ import { z as z10 } from "zod";
1247
+ var targetSourceSchema = z10.enum(["tool-path", "shell-cwd", "session-cwd"]);
1124
1248
  var MAX_TARGET_HINT_PATHS = 8;
1125
1249
  var MAX_TARGET_PATH_LENGTH = 4096;
1126
- var localPathSchema = z9.string().min(1).max(MAX_TARGET_PATH_LENGTH).refine((value) => !value.includes("\0"), "path must not contain NUL");
1127
- var targetHintSchema = z9.strictObject({
1250
+ var localPathSchema = z10.string().min(1).max(MAX_TARGET_PATH_LENGTH).refine((value) => !value.includes("\0"), "path must not contain NUL");
1251
+ var targetHintSchema = z10.strictObject({
1128
1252
  source: targetSourceSchema,
1129
- paths: z9.array(localPathSchema).min(1).max(MAX_TARGET_HINT_PATHS).readonly(),
1253
+ paths: z10.array(localPathSchema).min(1).max(MAX_TARGET_HINT_PATHS).readonly(),
1130
1254
  /** Absolute directory that relative `paths` resolve against. */
1131
1255
  baseDirectory: localPathSchema.optional()
1132
1256
  }).readonly();
1133
1257
  var sessionCwdHint = (cwd) => cwd === void 0 || cwd.length === 0 ? void 0 : { source: "session-cwd", paths: [cwd] };
1134
- var worktreeKindSchema = z9.enum(["main", "linked"]);
1135
- var workspaceTargetSchema = z9.strictObject({
1258
+ var worktreeKindSchema = z10.enum(["main", "linked"]);
1259
+ var workspaceTargetSchema = z10.strictObject({
1136
1260
  workspaceId: workspaceIdSchema,
1137
1261
  /** Branch checked out in that worktree; absent on a detached HEAD. */
1138
1262
  vcsBranchName: nonEmptyStringSchema.optional(),
@@ -1142,18 +1266,18 @@ var workspaceTargetSchema = z9.strictObject({
1142
1266
  worktreeKind: worktreeKindSchema.optional()
1143
1267
  }).readonly();
1144
1268
  var SUBAGENT_ID_PATTERN = /^[A-Za-z0-9_.:@+=-]{1,256}$/;
1145
- var subagentIdSchema = z9.string().regex(SUBAGENT_ID_PATTERN);
1269
+ var subagentIdSchema = z10.string().regex(SUBAGENT_ID_PATTERN);
1146
1270
 
1147
1271
  // src/model/usage.ts
1148
- import { z as z10 } from "zod";
1149
- var usageTemporalitySchema = z10.enum(["delta", "cumulative"]);
1150
- var cacheCreationAccountingSchema = z10.enum([
1272
+ import { z as z11 } from "zod";
1273
+ var usageTemporalitySchema = z11.enum(["delta", "cumulative"]);
1274
+ var cacheCreationAccountingSchema = z11.enum([
1151
1275
  "included-in-input",
1152
1276
  "disjoint-from-input",
1153
1277
  "not-reported"
1154
1278
  ]);
1155
- var providerTotalAgreementSchema = z10.enum(["unreported", "agrees", "disagrees"]);
1156
- var usageReportSchema = z10.strictObject({
1279
+ var providerTotalAgreementSchema = z11.enum(["unreported", "agrees", "disagrees"]);
1280
+ var usageReportSchema = z11.strictObject({
1157
1281
  temporality: usageTemporalitySchema,
1158
1282
  /** Inclusive input tokens. */
1159
1283
  inputTokens: tokenCountSchema.optional(),
@@ -1170,7 +1294,7 @@ var usageReportSchema = z10.strictObject({
1170
1294
  /** Total exactly as the provider reported it, if it reported one. */
1171
1295
  providerTotalTokens: tokenCountSchema.optional()
1172
1296
  });
1173
- var canonicalUsageSchema = z10.strictObject({
1297
+ var canonicalUsageSchema = z11.strictObject({
1174
1298
  temporality: usageTemporalitySchema,
1175
1299
  inputTokens: tokenCountSchema,
1176
1300
  cachedInputTokens: tokenCountSchema,
@@ -1371,24 +1495,24 @@ var toReport = (usage) => ({
1371
1495
  });
1372
1496
 
1373
1497
  // src/model/version.ts
1374
- import { z as z11 } from "zod";
1498
+ import { z as z12 } from "zod";
1375
1499
  var CANONICAL_SCHEMA_VERSION = 1;
1376
- var canonicalSchemaVersionSchema = z11.literal(CANONICAL_SCHEMA_VERSION);
1500
+ var canonicalSchemaVersionSchema = z12.literal(CANONICAL_SCHEMA_VERSION);
1377
1501
 
1378
1502
  // src/model/events.ts
1379
- var modelDescriptorSchema = z12.strictObject({
1503
+ var modelDescriptorSchema = z13.strictObject({
1380
1504
  modelId: nonEmptyStringSchema,
1381
1505
  /** Vendor of the model, e.g. `anthropic`. Distinct from the agent provider. */
1382
1506
  vendor: nonEmptyStringSchema.optional(),
1383
1507
  family: nonEmptyStringSchema.optional()
1384
1508
  });
1385
- var costFactsSchema = z12.strictObject({
1509
+ var costFactsSchema = z13.strictObject({
1386
1510
  /** ISO 4217 code. */
1387
- currency: z12.string().length(3),
1388
- amount: z12.number().min(0).finite(),
1389
- source: z12.enum(["provider-reported", "computed"])
1511
+ currency: z13.string().length(3),
1512
+ amount: z13.number().min(0).finite(),
1513
+ source: z13.enum(["provider-reported", "computed"])
1390
1514
  });
1391
- var canonicalEventTypeSchema = z12.enum([
1515
+ var canonicalEventTypeSchema = z13.enum([
1392
1516
  "session.start",
1393
1517
  "session.end",
1394
1518
  "prompt.submitted",
@@ -1402,7 +1526,7 @@ var canonicalEventTypeSchema = z12.enum([
1402
1526
  "error.raised"
1403
1527
  ]);
1404
1528
  var CANONICAL_EVENT_TYPES = canonicalEventTypeSchema.options;
1405
- var outcomeSchema = z12.enum(["ok", "error", "cancelled", "timeout", "denied", "unknown"]);
1529
+ var outcomeSchema = z13.enum(["ok", "error", "cancelled", "timeout", "denied", "unknown"]);
1406
1530
  var baseEventFields = {
1407
1531
  schemaVersion: canonicalSchemaVersionSchema,
1408
1532
  eventId: eventIdSchema,
@@ -1421,10 +1545,10 @@ var baseEventFields = {
1421
1545
  subagentId: subagentIdSchema.optional(),
1422
1546
  extensions: extensionsSchema.default(emptyExtensions)
1423
1547
  };
1424
- var event = (shape) => z12.strictObject({ ...baseEventFields, ...shape });
1548
+ var event = (shape) => z13.strictObject({ ...baseEventFields, ...shape });
1425
1549
  var sessionStartEventSchema = event({
1426
- type: z12.literal("session.start"),
1427
- sessionKind: z12.enum(["interactive", "non-interactive", "unknown"]),
1550
+ type: z13.literal("session.start"),
1551
+ sessionKind: z13.enum(["interactive", "non-interactive", "unknown"]),
1428
1552
  agentName: nonEmptyStringSchema.optional(),
1429
1553
  agentVersion: nonEmptyStringSchema.optional(),
1430
1554
  model: modelDescriptorSchema.optional(),
@@ -1432,30 +1556,30 @@ var sessionStartEventSchema = event({
1432
1556
  target: workspaceTargetSchema.optional()
1433
1557
  });
1434
1558
  var sessionEndEventSchema = event({
1435
- type: z12.literal("session.end"),
1436
- reason: z12.enum(["completed", "aborted", "error", "timeout", "unknown"]),
1559
+ type: z13.literal("session.end"),
1560
+ reason: z13.enum(["completed", "aborted", "error", "timeout", "unknown"]),
1437
1561
  durationMillis: durationMillisSchema.optional(),
1438
1562
  /** Session totals, typically cumulative. */
1439
1563
  usage: canonicalUsageSchema.optional(),
1440
1564
  cost: costFactsSchema.optional()
1441
1565
  });
1442
1566
  var promptSubmittedEventSchema = event({
1443
- type: z12.literal("prompt.submitted"),
1444
- promptSource: z12.enum(["user", "automation", "resumed", "unknown"]),
1567
+ type: z13.literal("prompt.submitted"),
1568
+ promptSource: z13.enum(["user", "automation", "resumed", "unknown"]),
1445
1569
  content: contentFactSchema.optional(),
1446
- turnIndex: z12.number().int().min(0).optional(),
1570
+ turnIndex: z13.number().int().min(0).optional(),
1447
1571
  /** The git worktree the session runs in, resolved by the core (ADR 0008). */
1448
1572
  target: workspaceTargetSchema.optional()
1449
1573
  });
1450
1574
  var generationStartEventSchema = event({
1451
- type: z12.literal("generation.start"),
1575
+ type: z13.literal("generation.start"),
1452
1576
  generationId: nonEmptyStringSchema,
1453
1577
  model: modelDescriptorSchema,
1454
1578
  requestedMaxOutputTokens: tokenCountSchema.optional(),
1455
1579
  inputContent: contentFactsSchema.optional()
1456
1580
  });
1457
1581
  var generationEndEventSchema = event({
1458
- type: z12.literal("generation.end"),
1582
+ type: z13.literal("generation.end"),
1459
1583
  generationId: nonEmptyStringSchema,
1460
1584
  model: modelDescriptorSchema,
1461
1585
  outcome: outcomeSchema,
@@ -1465,7 +1589,7 @@ var generationEndEventSchema = event({
1465
1589
  cost: costFactsSchema.optional(),
1466
1590
  outputContent: contentFactsSchema.optional()
1467
1591
  });
1468
- var toolKindSchema = z12.enum([
1592
+ var toolKindSchema = z13.enum([
1469
1593
  "read",
1470
1594
  "write",
1471
1595
  "execute",
@@ -1476,7 +1600,7 @@ var toolKindSchema = z12.enum([
1476
1600
  "unknown"
1477
1601
  ]);
1478
1602
  var toolStartEventSchema = event({
1479
- type: z12.literal("tool.start"),
1603
+ type: z13.literal("tool.start"),
1480
1604
  toolCallId: nonEmptyStringSchema,
1481
1605
  toolName: nonEmptyStringSchema,
1482
1606
  toolKind: toolKindSchema,
@@ -1486,53 +1610,53 @@ var toolStartEventSchema = event({
1486
1610
  target: workspaceTargetSchema.optional()
1487
1611
  });
1488
1612
  var toolEndEventSchema = event({
1489
- type: z12.literal("tool.end"),
1613
+ type: z13.literal("tool.end"),
1490
1614
  toolCallId: nonEmptyStringSchema,
1491
1615
  toolName: nonEmptyStringSchema,
1492
1616
  outcome: outcomeSchema,
1493
1617
  durationMillis: durationMillisSchema.optional(),
1494
1618
  /** Present when the host asked for or recorded a permission decision. */
1495
- permissionDecision: z12.enum(["allowed", "denied", "deferred", "not-required"]).optional(),
1619
+ permissionDecision: z13.enum(["allowed", "denied", "deferred", "not-required"]).optional(),
1496
1620
  output: contentFactSchema.optional(),
1497
1621
  /** The git worktree this call targeted, resolved by the core (ADR 0008). */
1498
1622
  target: workspaceTargetSchema.optional()
1499
1623
  });
1500
1624
  var subagentStartEventSchema = event({
1501
- type: z12.literal("subagent.start"),
1625
+ type: z13.literal("subagent.start"),
1502
1626
  subagentInvocationId: invocationIdSchema,
1503
1627
  subagentType: nonEmptyStringSchema.optional(),
1504
1628
  /** 0 for the top-level agent; 1 for its direct children. */
1505
- delegationDepth: z12.number().int().min(0).max(64),
1629
+ delegationDepth: z13.number().int().min(0).max(64),
1506
1630
  model: modelDescriptorSchema.optional()
1507
1631
  });
1508
1632
  var subagentEndEventSchema = event({
1509
- type: z12.literal("subagent.end"),
1633
+ type: z13.literal("subagent.end"),
1510
1634
  subagentInvocationId: invocationIdSchema,
1511
1635
  outcome: outcomeSchema,
1512
1636
  durationMillis: durationMillisSchema.optional(),
1513
1637
  usage: canonicalUsageSchema.optional()
1514
1638
  });
1515
1639
  var compactionPerformedEventSchema = event({
1516
- type: z12.literal("compaction.performed"),
1517
- trigger: z12.enum(["automatic", "manual", "unknown"]),
1640
+ type: z13.literal("compaction.performed"),
1641
+ trigger: z13.enum(["automatic", "manual", "unknown"]),
1518
1642
  /** Provider-reported context size before and after compaction, if known. */
1519
1643
  contextTokensBefore: tokenCountSchema.optional(),
1520
1644
  contextTokensAfter: tokenCountSchema.optional(),
1521
- droppedMessageCount: z12.number().int().min(0).optional(),
1645
+ droppedMessageCount: z13.number().int().min(0).optional(),
1522
1646
  usage: canonicalUsageSchema.optional()
1523
1647
  });
1524
1648
  var errorRaisedEventSchema = event({
1525
- type: z12.literal("error.raised"),
1649
+ type: z13.literal("error.raised"),
1526
1650
  errorCode: otelHookErrorCodeSchema,
1527
1651
  severity: errorSeveritySchema,
1528
1652
  phase: errorPhaseSchema,
1529
- retryable: z12.boolean(),
1653
+ retryable: z13.boolean(),
1530
1654
  /** Error text is content: it is described, never embedded verbatim by default. */
1531
1655
  message: contentFactSchema.optional(),
1532
1656
  /** Non-sensitive, provider-agnostic short label. */
1533
1657
  detail: nonEmptyStringSchema.optional()
1534
1658
  });
1535
- var canonicalEventSchema = z12.discriminatedUnion("type", [
1659
+ var canonicalEventSchema = z13.discriminatedUnion("type", [
1536
1660
  sessionStartEventSchema,
1537
1661
  sessionEndEventSchema,
1538
1662
  promptSubmittedEventSchema,
@@ -1550,26 +1674,26 @@ var TARGETED = new Set(TARGETED_EVENT_TYPES);
1550
1674
  var isTargetedEvent = (event3) => TARGETED.has(event3.type);
1551
1675
 
1552
1676
  // src/providers/adapter.ts
1553
- var providerDetectionSchema = z13.strictObject({
1677
+ var providerDetectionSchema = z14.strictObject({
1554
1678
  providerId: resolvedProviderIdSchema,
1555
1679
  confidence: detectionConfidenceSchema,
1556
1680
  /**
1557
1681
  * Short, non-sensitive justifications, e.g. `"payload.hook_event_name present"`.
1558
1682
  * Reasons are exported in diagnostics, so they must not quote payload values.
1559
1683
  */
1560
- reasons: z13.array(z13.string().min(1).max(160)).max(8),
1684
+ reasons: z14.array(z14.string().min(1).max(160)).max(8),
1561
1685
  providerVersion: nonEmptyStringSchema.optional(),
1562
1686
  /** The provider's own name for this event, when the payload states one. */
1563
1687
  sourceEventName: nonEmptyStringSchema.optional()
1564
1688
  });
1565
- var deliveryIdentifierSupportSchema = z13.enum(["none", "partial", "all"]);
1689
+ var deliveryIdentifierSupportSchema = z14.enum(["none", "partial", "all"]);
1566
1690
  var DELIVERY_COMPONENT_PATTERN = /^[A-Za-z0-9_.:@+=-]{1,256}$/;
1567
- var deliveryComponentSchema = z13.string().regex(
1691
+ var deliveryComponentSchema = z14.string().regex(
1568
1692
  DELIVERY_COMPONENT_PATTERN,
1569
1693
  "delivery component must be identifier-shaped: no whitespace, no path separators"
1570
1694
  );
1571
1695
  var MAX_DELIVERY_COMPONENTS = 8;
1572
- var providerDeliveryClaimSchema = z13.strictObject({
1696
+ var providerDeliveryClaimSchema = z14.strictObject({
1573
1697
  /**
1574
1698
  * The provider's own session/conversation id. Scopes the callback identity, so
1575
1699
  * two sessions reusing one tool-call id never collide.
@@ -1581,26 +1705,26 @@ var providerDeliveryClaimSchema = z13.strictObject({
1581
1705
  * Identifier-shaped payload fields that, together with `sourceEventName`,
1582
1706
  * name this callback within the session exactly once.
1583
1707
  */
1584
- components: z13.array(deliveryComponentSchema).min(1).max(MAX_DELIVERY_COMPONENTS).readonly(),
1708
+ components: z14.array(deliveryComponentSchema).min(1).max(MAX_DELIVERY_COMPONENTS).readonly(),
1585
1709
  /**
1586
1710
  * Short, non-sensitive justifications, e.g. `"payload.tool_use_id names one
1587
1711
  * tool call"`. Evidence reaches diagnostics, so it must name fields, never
1588
1712
  * quote their values.
1589
1713
  */
1590
- evidence: z13.array(z13.string().min(1).max(160)).min(1).max(4).readonly()
1714
+ evidence: z14.array(z14.string().min(1).max(160)).min(1).max(4).readonly()
1591
1715
  });
1592
1716
  var DELIVERY_GAP_REASON_PATTERN = /^[^\n\r\t\\/]{1,240}$/;
1593
- var deliveryGapReasonSchema = z13.string().regex(
1717
+ var deliveryGapReasonSchema = z14.string().regex(
1594
1718
  DELIVERY_GAP_REASON_PATTERN,
1595
1719
  "delivery gap reason must be one line of prose: no path separators, no control characters"
1596
1720
  );
1597
1721
  var MAX_DELIVERY_GAPS = 48;
1598
- var providerDeliveryGapsSchema = z13.record(deliveryComponentSchema, deliveryGapReasonSchema).refine((gaps) => Object.keys(gaps).length <= MAX_DELIVERY_GAPS, {
1722
+ var providerDeliveryGapsSchema = z14.record(deliveryComponentSchema, deliveryGapReasonSchema).refine((gaps) => Object.keys(gaps).length <= MAX_DELIVERY_GAPS, {
1599
1723
  message: `at most ${String(MAX_DELIVERY_GAPS)} delivery gaps may be declared`
1600
1724
  });
1601
- var providerCapabilitiesSchema = z13.strictObject({
1725
+ var providerCapabilitiesSchema = z14.strictObject({
1602
1726
  /** Event types the adapter can produce. */
1603
- lifecycleEvents: z13.array(canonicalEventTypeSchema).max(32).readonly(),
1727
+ lifecycleEvents: z14.array(canonicalEventTypeSchema).max(32).readonly(),
1604
1728
  usageTemporality: usageTemporalitySchema,
1605
1729
  /**
1606
1730
  * Which accumulator series a `cumulative` report continues — that is, which
@@ -1619,32 +1743,32 @@ var providerCapabilitiesSchema = z13.strictObject({
1619
1743
  * Subagent snapshots keep their own series regardless: a delegated agent's
1620
1744
  * counter is not a point on the parent session's curve.
1621
1745
  */
1622
- cumulativeUsageSeries: z13.enum(["event-scope", "session-lifetime"]).optional(),
1623
- reportsCachedInput: z13.boolean(),
1624
- reportsCacheCreation: z13.boolean(),
1746
+ cumulativeUsageSeries: z14.enum(["event-scope", "session-lifetime"]).optional(),
1747
+ reportsCachedInput: z14.boolean(),
1748
+ reportsCacheCreation: z14.boolean(),
1625
1749
  cacheCreationAccounting: cacheCreationAccountingSchema,
1626
- reportsReasoningOutput: z13.boolean(),
1627
- reportsProviderTotal: z13.boolean(),
1628
- reportsCost: z13.boolean(),
1629
- emitsSubagentEvents: z13.boolean(),
1630
- emitsCompactionEvents: z13.boolean(),
1750
+ reportsReasoningOutput: z14.boolean(),
1751
+ reportsProviderTotal: z14.boolean(),
1752
+ reportsCost: z14.boolean(),
1753
+ emitsSubagentEvents: z14.boolean(),
1754
+ emitsCompactionEvents: z14.boolean(),
1631
1755
  /** True when the provider reads a structured response from stdout. */
1632
- requiresHookResponse: z13.boolean(),
1756
+ requiresHookResponse: z14.boolean(),
1633
1757
  /** How much of this provider's hook traffic is replay-identifiable. */
1634
1758
  deliveryIdentifier: deliveryIdentifierSupportSchema
1635
1759
  });
1636
- var providerHookResponseSchema = z13.strictObject({
1760
+ var providerHookResponseSchema = z14.strictObject({
1637
1761
  /**
1638
1762
  * Always 0. A telemetry hook that can fail the host agent is a liability, so
1639
1763
  * the type forbids expressing anything else (ADR 0004).
1640
1764
  */
1641
- exitCode: z13.literal(0),
1765
+ exitCode: z14.literal(0),
1642
1766
  /** Protocol response text. Omit to write nothing at all. */
1643
- stdout: z13.string().max(8192).optional(),
1767
+ stdout: z14.string().max(8192).optional(),
1644
1768
  /** Non-sensitive diagnostic text for stderr. */
1645
- stderr: z13.string().max(8192).optional(),
1769
+ stderr: z14.string().max(8192).optional(),
1646
1770
  /** Declares which of the two stdout contracts this response follows. */
1647
- contract: z13.enum(["silent", "provider-protocol"])
1771
+ contract: z14.enum(["silent", "provider-protocol"])
1648
1772
  });
1649
1773
  var SILENT_HOOK_RESPONSE = Object.freeze({
1650
1774
  exitCode: 0,
@@ -1689,14 +1813,14 @@ var unknownDetection = (reasons = ["no adapter recognized the input"]) => provid
1689
1813
  });
1690
1814
 
1691
1815
  // src/errors/index.ts
1692
- import { z as z14 } from "zod";
1693
- var otelHookErrorInfoSchema = z14.strictObject({
1816
+ import { z as z15 } from "zod";
1817
+ var otelHookErrorInfoSchema = z15.strictObject({
1694
1818
  code: otelHookErrorCodeSchema,
1695
1819
  severity: errorSeveritySchema,
1696
1820
  phase: errorPhaseSchema,
1697
1821
  posture: failurePostureSchema,
1698
- retryable: z14.boolean(),
1699
- message: z14.string().min(1).max(512),
1822
+ retryable: z15.boolean(),
1823
+ message: z15.string().min(1).max(512),
1700
1824
  details: attributesSchema.optional(),
1701
1825
  occurredAt: epochMillisSchema.optional()
1702
1826
  });
@@ -1966,35 +2090,35 @@ var CLAUDE_CODE_CAPABILITIES = Object.freeze({
1966
2090
  });
1967
2091
 
1968
2092
  // src/providers/claude/schema.ts
1969
- import { z as z15 } from "zod";
2093
+ import { z as z16 } from "zod";
1970
2094
  var commonFields = {
1971
- session_id: z15.string().min(1),
1972
- transcript_path: z15.string().min(1).optional(),
1973
- cwd: z15.string().min(1).optional(),
1974
- permission_mode: z15.string().min(1).optional(),
2095
+ session_id: z16.string().min(1),
2096
+ transcript_path: z16.string().min(1).optional(),
2097
+ cwd: z16.string().min(1).optional(),
2098
+ permission_mode: z16.string().min(1).optional(),
1975
2099
  /** Correlates a hook firing with the user prompt that triggered it (Claude Code v2.1.196+). */
1976
- prompt_id: z15.string().min(1).optional(),
2100
+ prompt_id: z16.string().min(1).optional(),
1977
2101
  /** Present when the hook fired while running inside a subagent. */
1978
- agent_id: z15.string().min(1).optional(),
1979
- agent_type: z15.string().min(1).optional()
2102
+ agent_id: z16.string().min(1).optional(),
2103
+ agent_type: z16.string().min(1).optional()
1980
2104
  };
1981
- var claudeCacheCreationSchema = z15.object({
1982
- ephemeral_5m_input_tokens: z15.number().int().min(0).optional(),
1983
- ephemeral_1h_input_tokens: z15.number().int().min(0).optional()
1984
- });
1985
- var claudeUsageIterationSchema = z15.object({
1986
- input_tokens: z15.number().int().min(0).optional(),
1987
- output_tokens: z15.number().int().min(0).optional(),
1988
- cache_creation_input_tokens: z15.number().int().min(0).optional(),
1989
- cache_read_input_tokens: z15.number().int().min(0).optional()
1990
- });
1991
- var claudeUsageSchema = z15.object({
1992
- input_tokens: z15.number().int().min(0),
1993
- output_tokens: z15.number().int().min(0),
1994
- cache_creation_input_tokens: z15.number().int().min(0).optional(),
1995
- cache_read_input_tokens: z15.number().int().min(0).optional(),
2105
+ var claudeCacheCreationSchema = z16.object({
2106
+ ephemeral_5m_input_tokens: z16.number().int().min(0).optional(),
2107
+ ephemeral_1h_input_tokens: z16.number().int().min(0).optional()
2108
+ });
2109
+ var claudeUsageIterationSchema = z16.object({
2110
+ input_tokens: z16.number().int().min(0).optional(),
2111
+ output_tokens: z16.number().int().min(0).optional(),
2112
+ cache_creation_input_tokens: z16.number().int().min(0).optional(),
2113
+ cache_read_input_tokens: z16.number().int().min(0).optional()
2114
+ });
2115
+ var claudeUsageSchema = z16.object({
2116
+ input_tokens: z16.number().int().min(0),
2117
+ output_tokens: z16.number().int().min(0),
2118
+ cache_creation_input_tokens: z16.number().int().min(0).optional(),
2119
+ cache_read_input_tokens: z16.number().int().min(0).optional(),
1996
2120
  cache_creation: claudeCacheCreationSchema.optional(),
1997
- iterations: z15.array(claudeUsageIterationSchema).optional(),
2121
+ iterations: z16.array(claudeUsageIterationSchema).optional(),
1998
2122
  /**
1999
2123
  * Counters the canonical model has a home for but Claude Code never reports:
2000
2124
  * 0 of 4,999 real usage objects carried either (finding 5).
@@ -2003,112 +2127,112 @@ var claudeUsageSchema = z15.object({
2003
2127
  * that a harness attaching one gets told it was excluded, instead of watching
2004
2128
  * it vanish. See `CLAUDE_EXCLUDED_USAGE_COUNTERS`.
2005
2129
  */
2006
- total_tokens: z15.number().int().min(0).optional(),
2007
- reasoning_output_tokens: z15.number().int().min(0).optional()
2130
+ total_tokens: z16.number().int().min(0).optional(),
2131
+ reasoning_output_tokens: z16.number().int().min(0).optional()
2008
2132
  });
2009
- var sessionStartPayloadSchema = z15.object({
2133
+ var sessionStartPayloadSchema = z16.object({
2010
2134
  ...commonFields,
2011
- hook_event_name: z15.literal("SessionStart"),
2135
+ hook_event_name: z16.literal("SessionStart"),
2012
2136
  /** Matcher values: startup | resume | clear | compact | fork. Forward-compatible: any string. */
2013
- source: z15.string().min(1).optional(),
2014
- model: z15.string().min(1).optional(),
2015
- session_title: z15.string().min(1).optional()
2137
+ source: z16.string().min(1).optional(),
2138
+ model: z16.string().min(1).optional(),
2139
+ session_title: z16.string().min(1).optional()
2016
2140
  });
2017
- var sessionEndPayloadSchema = z15.object({
2141
+ var sessionEndPayloadSchema = z16.object({
2018
2142
  ...commonFields,
2019
- hook_event_name: z15.literal("SessionEnd"),
2143
+ hook_event_name: z16.literal("SessionEnd"),
2020
2144
  /** Current Claude Code field; values include clear, logout, prompt_input_exit, and other. */
2021
- reason: z15.string().min(1).optional(),
2145
+ reason: z16.string().min(1).optional(),
2022
2146
  /** Compatibility alias emitted by older wrappers and hook integrations. */
2023
- end_reason: z15.string().min(1).optional()
2147
+ end_reason: z16.string().min(1).optional()
2024
2148
  });
2025
- var userPromptSubmitPayloadSchema = z15.object({
2149
+ var userPromptSubmitPayloadSchema = z16.object({
2026
2150
  ...commonFields,
2027
- hook_event_name: z15.literal("UserPromptSubmit"),
2028
- prompt: z15.string()
2151
+ hook_event_name: z16.literal("UserPromptSubmit"),
2152
+ prompt: z16.string()
2029
2153
  });
2030
- var preToolUsePayloadSchema = z15.object({
2154
+ var preToolUsePayloadSchema = z16.object({
2031
2155
  ...commonFields,
2032
- hook_event_name: z15.literal("PreToolUse"),
2033
- tool_name: z15.string().min(1),
2034
- tool_input: z15.unknown(),
2035
- tool_use_id: z15.string().min(1)
2156
+ hook_event_name: z16.literal("PreToolUse"),
2157
+ tool_name: z16.string().min(1),
2158
+ tool_input: z16.unknown(),
2159
+ tool_use_id: z16.string().min(1)
2036
2160
  });
2037
- var postToolUsePayloadSchema = z15.object({
2161
+ var postToolUsePayloadSchema = z16.object({
2038
2162
  ...commonFields,
2039
- hook_event_name: z15.literal("PostToolUse"),
2040
- tool_name: z15.string().min(1),
2041
- tool_input: z15.unknown().optional(),
2042
- tool_response: z15.unknown(),
2043
- tool_use_id: z15.string().min(1)
2163
+ hook_event_name: z16.literal("PostToolUse"),
2164
+ tool_name: z16.string().min(1),
2165
+ tool_input: z16.unknown().optional(),
2166
+ tool_response: z16.unknown(),
2167
+ tool_use_id: z16.string().min(1)
2044
2168
  });
2045
- var postToolUseFailurePayloadSchema = z15.object({
2169
+ var postToolUseFailurePayloadSchema = z16.object({
2046
2170
  ...commonFields,
2047
- hook_event_name: z15.literal("PostToolUseFailure"),
2048
- tool_name: z15.string().min(1),
2049
- tool_input: z15.unknown().optional(),
2050
- tool_error: z15.unknown(),
2051
- tool_use_id: z15.string().min(1)
2171
+ hook_event_name: z16.literal("PostToolUseFailure"),
2172
+ tool_name: z16.string().min(1),
2173
+ tool_input: z16.unknown().optional(),
2174
+ tool_error: z16.unknown(),
2175
+ tool_use_id: z16.string().min(1)
2052
2176
  });
2053
- var permissionRequestPayloadSchema = z15.object({
2177
+ var permissionRequestPayloadSchema = z16.object({
2054
2178
  ...commonFields,
2055
- hook_event_name: z15.literal("PermissionRequest"),
2056
- tool_name: z15.string().min(1),
2057
- tool_input: z15.unknown().optional(),
2058
- tool_use_id: z15.string().min(1)
2179
+ hook_event_name: z16.literal("PermissionRequest"),
2180
+ tool_name: z16.string().min(1),
2181
+ tool_input: z16.unknown().optional(),
2182
+ tool_use_id: z16.string().min(1)
2059
2183
  });
2060
- var subagentStartPayloadSchema = z15.object({
2184
+ var subagentStartPayloadSchema = z16.object({
2061
2185
  ...commonFields,
2062
- hook_event_name: z15.literal("SubagentStart"),
2063
- agent_type: z15.string().min(1),
2064
- agent_id: z15.string().min(1)
2186
+ hook_event_name: z16.literal("SubagentStart"),
2187
+ agent_type: z16.string().min(1),
2188
+ agent_id: z16.string().min(1)
2065
2189
  });
2066
- var subagentStopPayloadSchema = z15.object({
2190
+ var subagentStopPayloadSchema = z16.object({
2067
2191
  ...commonFields,
2068
- hook_event_name: z15.literal("SubagentStop"),
2069
- agent_type: z15.string().min(1),
2070
- agent_id: z15.string().min(1),
2071
- last_assistant_message: z15.string().optional(),
2192
+ hook_event_name: z16.literal("SubagentStop"),
2193
+ agent_type: z16.string().min(1),
2194
+ agent_id: z16.string().min(1),
2195
+ last_assistant_message: z16.string().optional(),
2072
2196
  /** True when this stop fired because a hook continued the subagent's turn. */
2073
- stop_hook_active: z15.boolean().optional(),
2197
+ stop_hook_active: z16.boolean().optional(),
2074
2198
  usage: claudeUsageSchema.optional()
2075
2199
  });
2076
- var preCompactPayloadSchema = z15.object({
2200
+ var preCompactPayloadSchema = z16.object({
2077
2201
  ...commonFields,
2078
- hook_event_name: z15.literal("PreCompact"),
2202
+ hook_event_name: z16.literal("PreCompact"),
2079
2203
  /** Upstream values: manual | auto. Forward-compatible: any string. */
2080
- trigger: z15.string().min(1).optional(),
2204
+ trigger: z16.string().min(1).optional(),
2081
2205
  /** Compatibility alias emitted by older wrappers and hook integrations. */
2082
- compact_trigger: z15.string().min(1).optional(),
2206
+ compact_trigger: z16.string().min(1).optional(),
2083
2207
  /**
2084
2208
  * Harness-supplied, never upstream. Reported as an explicit exclusion rather
2085
2209
  * than carried across the process boundary: see `events.ts`.
2086
2210
  */
2087
- context_tokens_before: z15.number().int().min(0).optional(),
2088
- estimated_tokens_removed: z15.number().int().min(0).optional()
2211
+ context_tokens_before: z16.number().int().min(0).optional(),
2212
+ estimated_tokens_removed: z16.number().int().min(0).optional()
2089
2213
  });
2090
- var postCompactPayloadSchema = z15.object({
2214
+ var postCompactPayloadSchema = z16.object({
2091
2215
  ...commonFields,
2092
- hook_event_name: z15.literal("PostCompact"),
2093
- trigger: z15.string().min(1).optional(),
2094
- compact_trigger: z15.string().min(1).optional(),
2216
+ hook_event_name: z16.literal("PostCompact"),
2217
+ trigger: z16.string().min(1).optional(),
2218
+ compact_trigger: z16.string().min(1).optional(),
2095
2219
  /** Harness-supplied, never upstream; accepted here because one callback carries both. */
2096
- context_tokens_before: z15.number().int().min(0).optional(),
2097
- context_tokens_after: z15.number().int().min(0).optional(),
2098
- dropped_message_count: z15.number().int().min(0).optional(),
2220
+ context_tokens_before: z16.number().int().min(0).optional(),
2221
+ context_tokens_after: z16.number().int().min(0).optional(),
2222
+ dropped_message_count: z16.number().int().min(0).optional(),
2099
2223
  usage: claudeUsageSchema.optional()
2100
2224
  });
2101
- var stopPayloadSchema = z15.object({
2225
+ var stopPayloadSchema = z16.object({
2102
2226
  ...commonFields,
2103
- hook_event_name: z15.literal("Stop"),
2227
+ hook_event_name: z16.literal("Stop"),
2104
2228
  /**
2105
2229
  * Interactive Stop field (Claude Code ≥ 2.1.47). Print / `-p` / Agent SDK
2106
2230
  * result messages use `result` instead; `events.ts` reads both (and camelCase
2107
2231
  * `lastAssistantMessage`) through `extractClaudeAssistantText`.
2108
2232
  */
2109
- last_assistant_message: z15.string().optional(),
2233
+ last_assistant_message: z16.string().optional(),
2110
2234
  /** Print / `-p` JSON result field; accepted so a harness can attach it as-is. */
2111
- result: z15.string().optional(),
2235
+ result: z16.string().optional(),
2112
2236
  /**
2113
2237
  * True when this stop fired because a hook continued the turn.
2114
2238
  *
@@ -2116,22 +2240,22 @@ var stopPayloadSchema = z15.object({
2116
2240
  * stop from a continuation stop, which is what lets `delivery.ts` deduplicate
2117
2241
  * the former without suppressing the latter.
2118
2242
  */
2119
- stop_hook_active: z15.boolean().optional(),
2243
+ stop_hook_active: z16.boolean().optional(),
2120
2244
  usage: claudeUsageSchema.optional()
2121
2245
  });
2122
- var stopFailurePayloadSchema = z15.object({
2246
+ var stopFailurePayloadSchema = z16.object({
2123
2247
  ...commonFields,
2124
- hook_event_name: z15.literal("StopFailure"),
2248
+ hook_event_name: z16.literal("StopFailure"),
2125
2249
  /**
2126
2250
  * Matcher values: rate_limit | overloaded | authentication_failed |
2127
2251
  * oauth_org_not_allowed | billing_error | invalid_request | model_not_found
2128
2252
  * | server_error | max_output_tokens | unknown.
2129
2253
  */
2130
- error_type: z15.string().min(1),
2131
- error_message: z15.string().optional(),
2254
+ error_type: z16.string().min(1),
2255
+ error_message: z16.string().optional(),
2132
2256
  usage: claudeUsageSchema.optional()
2133
2257
  });
2134
- var claudeHookPayloadSchema = z15.discriminatedUnion("hook_event_name", [
2258
+ var claudeHookPayloadSchema = z16.discriminatedUnion("hook_event_name", [
2135
2259
  sessionStartPayloadSchema,
2136
2260
  sessionEndPayloadSchema,
2137
2261
  userPromptSubmitPayloadSchema,
@@ -2161,15 +2285,15 @@ var CLAUDE_HOOK_EVENT_NAMES = [
2161
2285
  "Stop",
2162
2286
  "StopFailure"
2163
2287
  ];
2164
- var claudeIdentityFieldsSchema = z15.object({
2165
- session_id: z15.string().min(1),
2166
- hook_event_name: z15.string().min(1),
2167
- cwd: z15.string().min(1).optional(),
2168
- prompt_id: z15.string().min(1).optional(),
2169
- agent_id: z15.string().min(1).optional(),
2170
- tool_use_id: z15.string().min(1).optional(),
2288
+ var claudeIdentityFieldsSchema = z16.object({
2289
+ session_id: z16.string().min(1),
2290
+ hook_event_name: z16.string().min(1),
2291
+ cwd: z16.string().min(1).optional(),
2292
+ prompt_id: z16.string().min(1).optional(),
2293
+ agent_id: z16.string().min(1).optional(),
2294
+ tool_use_id: z16.string().min(1).optional(),
2171
2295
  /** Read by `delivery.ts` to tell a once-per-prompt stop from a continuation. */
2172
- stop_hook_active: z15.boolean().optional()
2296
+ stop_hook_active: z16.boolean().optional()
2173
2297
  });
2174
2298
 
2175
2299
  // src/providers/claude/usage.ts
@@ -2957,7 +3081,7 @@ var createClaudeCodeAdapter = (options = {}) => ({
2957
3081
  });
2958
3082
 
2959
3083
  // src/providers/cursor/payload.ts
2960
- import { z as z16 } from "zod";
3084
+ import { z as z17 } from "zod";
2961
3085
  var CURSOR_PROVIDER_ID = "cursor";
2962
3086
  var CURSOR_HOOK_EVENT_NAMES = [
2963
3087
  "sessionStart",
@@ -2992,23 +3116,23 @@ var CURSOR_DECISION_EVENTS = Object.freeze({
2992
3116
  subagentStart: "permission",
2993
3117
  beforeSubmitPrompt: "continue"
2994
3118
  });
2995
- var modelParamSchema = z16.object({
2996
- id: z16.string(),
2997
- value: z16.string()
3119
+ var modelParamSchema = z17.object({
3120
+ id: z17.string(),
3121
+ value: z17.string()
2998
3122
  });
2999
- var attachmentSchema = z16.object({
3000
- type: z16.string().optional(),
3001
- file_path: z16.string().optional()
3123
+ var attachmentSchema = z17.object({
3124
+ type: z17.string().optional(),
3125
+ file_path: z17.string().optional()
3002
3126
  });
3003
- var fileEditSchema = z16.object({
3004
- old_string: z16.string().optional(),
3005
- new_string: z16.string().optional()
3127
+ var fileEditSchema = z17.object({
3128
+ old_string: z17.string().optional(),
3129
+ new_string: z17.string().optional()
3006
3130
  });
3007
3131
  var usageFields = {
3008
- input_tokens: z16.number().int().min(0).optional(),
3009
- output_tokens: z16.number().int().min(0).optional(),
3010
- cache_read_tokens: z16.number().int().min(0).optional(),
3011
- cache_write_tokens: z16.number().int().min(0).optional()
3132
+ input_tokens: z17.number().int().min(0).optional(),
3133
+ output_tokens: z17.number().int().min(0).optional(),
3134
+ cache_read_tokens: z17.number().int().min(0).optional(),
3135
+ cache_write_tokens: z17.number().int().min(0).optional()
3012
3136
  };
3013
3137
  var envelopeShape = {
3014
3138
  // Not `.min(1)`: see `cursorSessionId`. A payload naming neither
@@ -3016,136 +3140,136 @@ var envelopeShape = {
3016
3140
  // `recognizeCursorPayload`'s post-parse check — but rejecting it here would
3017
3141
  // fail the whole discriminated union on a field the adapter can source from
3018
3142
  // either name.
3019
- conversation_id: z16.string().optional(),
3020
- generation_id: z16.string().optional(),
3021
- session_id: z16.string().optional(),
3022
- model: z16.string().optional(),
3023
- model_id: z16.string().optional(),
3024
- model_params: z16.array(modelParamSchema).max(64).optional(),
3025
- cursor_version: z16.string().optional(),
3026
- workspace_roots: z16.array(z16.string()).max(64).optional(),
3027
- cwd: z16.string().optional(),
3143
+ conversation_id: z17.string().optional(),
3144
+ generation_id: z17.string().optional(),
3145
+ session_id: z17.string().optional(),
3146
+ model: z17.string().optional(),
3147
+ model_id: z17.string().optional(),
3148
+ model_params: z17.array(modelParamSchema).max(64).optional(),
3149
+ cursor_version: z17.string().optional(),
3150
+ workspace_roots: z17.array(z17.string()).max(64).optional(),
3151
+ cwd: z17.string().optional(),
3028
3152
  /** Never propagated. */
3029
- user_email: z16.string().nullish(),
3153
+ user_email: z17.string().nullish(),
3030
3154
  /** Never propagated. */
3031
- transcript_path: z16.string().nullish()
3155
+ transcript_path: z17.string().nullish()
3032
3156
  };
3033
- var event2 = (name, shape) => z16.object({ ...envelopeShape, hook_event_name: z16.literal(name), ...shape });
3157
+ var event2 = (name, shape) => z17.object({ ...envelopeShape, hook_event_name: z17.literal(name), ...shape });
3034
3158
  var sessionStartPayloadSchema2 = event2("sessionStart", {
3035
- is_background_agent: z16.boolean().optional(),
3036
- composer_mode: z16.string().optional()
3159
+ is_background_agent: z17.boolean().optional(),
3160
+ composer_mode: z17.string().optional()
3037
3161
  });
3038
3162
  var sessionEndPayloadSchema2 = event2("sessionEnd", {
3039
- reason: z16.string().optional(),
3040
- duration_ms: z16.number().min(0).optional(),
3041
- is_background_agent: z16.boolean().optional(),
3042
- final_status: z16.string().optional(),
3043
- error_message: z16.string().optional()
3163
+ reason: z17.string().optional(),
3164
+ duration_ms: z17.number().min(0).optional(),
3165
+ is_background_agent: z17.boolean().optional(),
3166
+ final_status: z17.string().optional(),
3167
+ error_message: z17.string().optional()
3044
3168
  });
3045
3169
  var beforeSubmitPromptPayloadSchema = event2("beforeSubmitPrompt", {
3046
- prompt: z16.string().optional(),
3047
- attachments: z16.array(attachmentSchema).max(256).optional(),
3048
- composer_mode: z16.string().optional()
3170
+ prompt: z17.string().optional(),
3171
+ attachments: z17.array(attachmentSchema).max(256).optional(),
3172
+ composer_mode: z17.string().optional()
3049
3173
  });
3050
3174
  var afterAgentResponsePayloadSchema = event2("afterAgentResponse", {
3051
- text: z16.string().optional(),
3175
+ text: z17.string().optional(),
3052
3176
  ...usageFields
3053
3177
  });
3054
3178
  var afterAgentThoughtPayloadSchema = event2("afterAgentThought", {
3055
- text: z16.string().optional(),
3056
- duration_ms: z16.number().min(0).optional()
3179
+ text: z17.string().optional(),
3180
+ duration_ms: z17.number().min(0).optional()
3057
3181
  });
3058
3182
  var preToolUsePayloadSchema2 = event2("preToolUse", {
3059
- tool_name: z16.string().min(1),
3060
- tool_input: z16.unknown().optional(),
3061
- tool_use_id: z16.string().optional(),
3062
- agent_message: z16.string().optional()
3183
+ tool_name: z17.string().min(1),
3184
+ tool_input: z17.unknown().optional(),
3185
+ tool_use_id: z17.string().optional(),
3186
+ agent_message: z17.string().optional()
3063
3187
  });
3064
3188
  var postToolUsePayloadSchema2 = event2("postToolUse", {
3065
- tool_name: z16.string().min(1),
3066
- tool_input: z16.unknown().optional(),
3067
- tool_output: z16.unknown().optional(),
3068
- tool_use_id: z16.string().optional(),
3069
- duration: z16.number().min(0).optional()
3189
+ tool_name: z17.string().min(1),
3190
+ tool_input: z17.unknown().optional(),
3191
+ tool_output: z17.unknown().optional(),
3192
+ tool_use_id: z17.string().optional(),
3193
+ duration: z17.number().min(0).optional()
3070
3194
  });
3071
3195
  var postToolUseFailurePayloadSchema2 = event2("postToolUseFailure", {
3072
- tool_name: z16.string().min(1),
3073
- tool_input: z16.unknown().optional(),
3074
- tool_use_id: z16.string().optional(),
3075
- error_message: z16.string().optional(),
3076
- failure_type: z16.string().optional(),
3077
- duration: z16.number().min(0).optional(),
3078
- is_interrupt: z16.boolean().optional()
3196
+ tool_name: z17.string().min(1),
3197
+ tool_input: z17.unknown().optional(),
3198
+ tool_use_id: z17.string().optional(),
3199
+ error_message: z17.string().optional(),
3200
+ failure_type: z17.string().optional(),
3201
+ duration: z17.number().min(0).optional(),
3202
+ is_interrupt: z17.boolean().optional()
3079
3203
  });
3080
3204
  var beforeShellExecutionPayloadSchema = event2("beforeShellExecution", {
3081
- command: z16.string(),
3082
- sandbox: z16.boolean().optional()
3205
+ command: z17.string(),
3206
+ sandbox: z17.boolean().optional()
3083
3207
  });
3084
3208
  var afterShellExecutionPayloadSchema = event2("afterShellExecution", {
3085
- command: z16.string(),
3086
- output: z16.string().optional(),
3087
- duration: z16.number().min(0).optional(),
3088
- sandbox: z16.boolean().optional()
3209
+ command: z17.string(),
3210
+ output: z17.string().optional(),
3211
+ duration: z17.number().min(0).optional(),
3212
+ sandbox: z17.boolean().optional()
3089
3213
  });
3090
3214
  var beforeMcpExecutionPayloadSchema = event2("beforeMCPExecution", {
3091
- tool_name: z16.string().min(1),
3092
- tool_input: z16.unknown().optional(),
3093
- url: z16.string().optional(),
3094
- command: z16.string().optional()
3215
+ tool_name: z17.string().min(1),
3216
+ tool_input: z17.unknown().optional(),
3217
+ url: z17.string().optional(),
3218
+ command: z17.string().optional()
3095
3219
  });
3096
3220
  var afterMcpExecutionPayloadSchema = event2("afterMCPExecution", {
3097
- tool_name: z16.string().min(1),
3098
- tool_input: z16.unknown().optional(),
3099
- result_json: z16.string().optional(),
3100
- duration: z16.number().min(0).optional()
3221
+ tool_name: z17.string().min(1),
3222
+ tool_input: z17.unknown().optional(),
3223
+ result_json: z17.string().optional(),
3224
+ duration: z17.number().min(0).optional()
3101
3225
  });
3102
3226
  var beforeReadFilePayloadSchema = event2("beforeReadFile", {
3103
- file_path: z16.string(),
3104
- content: z16.string().optional(),
3105
- attachments: z16.array(attachmentSchema).max(256).optional()
3227
+ file_path: z17.string(),
3228
+ content: z17.string().optional(),
3229
+ attachments: z17.array(attachmentSchema).max(256).optional()
3106
3230
  });
3107
3231
  var afterFileEditPayloadSchema = event2("afterFileEdit", {
3108
- file_path: z16.string(),
3109
- edits: z16.array(fileEditSchema).max(1024).optional()
3232
+ file_path: z17.string(),
3233
+ edits: z17.array(fileEditSchema).max(1024).optional()
3110
3234
  });
3111
3235
  var subagentStartPayloadSchema2 = event2("subagentStart", {
3112
- subagent_id: z16.string().optional(),
3113
- subagent_type: z16.string().optional(),
3114
- task: z16.string().optional(),
3115
- parent_conversation_id: z16.string().optional(),
3116
- tool_call_id: z16.string().optional(),
3117
- subagent_model: z16.string().optional(),
3118
- is_parallel_worker: z16.boolean().optional(),
3119
- git_branch: z16.string().optional()
3236
+ subagent_id: z17.string().optional(),
3237
+ subagent_type: z17.string().optional(),
3238
+ task: z17.string().optional(),
3239
+ parent_conversation_id: z17.string().optional(),
3240
+ tool_call_id: z17.string().optional(),
3241
+ subagent_model: z17.string().optional(),
3242
+ is_parallel_worker: z17.boolean().optional(),
3243
+ git_branch: z17.string().optional()
3120
3244
  });
3121
3245
  var subagentStopPayloadSchema2 = event2("subagentStop", {
3122
- subagent_type: z16.string().optional(),
3123
- status: z16.string().optional(),
3124
- task: z16.string().optional(),
3125
- description: z16.string().optional(),
3126
- summary: z16.string().optional(),
3127
- duration_ms: z16.number().min(0).optional(),
3128
- message_count: z16.number().int().min(0).optional(),
3129
- tool_call_count: z16.number().int().min(0).optional(),
3130
- loop_count: z16.number().int().min(0).optional(),
3131
- modified_files: z16.array(z16.string()).max(1024).optional(),
3132
- agent_transcript_path: z16.string().nullish()
3246
+ subagent_type: z17.string().optional(),
3247
+ status: z17.string().optional(),
3248
+ task: z17.string().optional(),
3249
+ description: z17.string().optional(),
3250
+ summary: z17.string().optional(),
3251
+ duration_ms: z17.number().min(0).optional(),
3252
+ message_count: z17.number().int().min(0).optional(),
3253
+ tool_call_count: z17.number().int().min(0).optional(),
3254
+ loop_count: z17.number().int().min(0).optional(),
3255
+ modified_files: z17.array(z17.string()).max(1024).optional(),
3256
+ agent_transcript_path: z17.string().nullish()
3133
3257
  });
3134
3258
  var preCompactPayloadSchema2 = event2("preCompact", {
3135
- trigger: z16.string().optional(),
3136
- context_usage_percent: z16.number().optional(),
3137
- context_tokens: z16.number().int().min(0).optional(),
3138
- context_window_size: z16.number().int().min(0).optional(),
3139
- message_count: z16.number().int().min(0).optional(),
3140
- messages_to_compact: z16.number().int().min(0).optional(),
3141
- is_first_compaction: z16.boolean().optional()
3259
+ trigger: z17.string().optional(),
3260
+ context_usage_percent: z17.number().optional(),
3261
+ context_tokens: z17.number().int().min(0).optional(),
3262
+ context_window_size: z17.number().int().min(0).optional(),
3263
+ message_count: z17.number().int().min(0).optional(),
3264
+ messages_to_compact: z17.number().int().min(0).optional(),
3265
+ is_first_compaction: z17.boolean().optional()
3142
3266
  });
3143
3267
  var stopPayloadSchema2 = event2("stop", {
3144
- status: z16.string().optional(),
3145
- loop_count: z16.number().int().min(0).optional(),
3268
+ status: z17.string().optional(),
3269
+ loop_count: z17.number().int().min(0).optional(),
3146
3270
  ...usageFields
3147
3271
  });
3148
- var cursorPayloadSchema = z16.discriminatedUnion("hook_event_name", [
3272
+ var cursorPayloadSchema = z17.discriminatedUnion("hook_event_name", [
3149
3273
  sessionStartPayloadSchema2,
3150
3274
  sessionEndPayloadSchema2,
3151
3275
  beforeSubmitPromptPayloadSchema,
@@ -3921,105 +4045,105 @@ var createCursorAdapter = (options = {}) => {
3921
4045
  };
3922
4046
 
3923
4047
  // src/providers/codex/payload.ts
3924
- import { z as z17 } from "zod";
3925
- var permissionModeSchema = z17.enum([
4048
+ import { z as z18 } from "zod";
4049
+ var permissionModeSchema = z18.enum([
3926
4050
  "default",
3927
4051
  "acceptEdits",
3928
4052
  "plan",
3929
4053
  "dontAsk",
3930
4054
  "bypassPermissions"
3931
4055
  ]);
3932
- var codexUsageSchema = z17.object({
3933
- input_tokens: z17.number().int().min(0).optional(),
3934
- cached_input_tokens: z17.number().int().min(0).optional(),
3935
- output_tokens: z17.number().int().min(0).optional(),
3936
- reasoning_output_tokens: z17.number().int().min(0).optional(),
3937
- total_tokens: z17.number().int().min(0).optional()
4056
+ var codexUsageSchema = z18.object({
4057
+ input_tokens: z18.number().int().min(0).optional(),
4058
+ cached_input_tokens: z18.number().int().min(0).optional(),
4059
+ output_tokens: z18.number().int().min(0).optional(),
4060
+ reasoning_output_tokens: z18.number().int().min(0).optional(),
4061
+ total_tokens: z18.number().int().min(0).optional()
3938
4062
  });
3939
4063
  var baseFields = {
3940
- session_id: z17.string().min(1).max(256),
3941
- cwd: z17.string().min(1).max(4096).optional(),
3942
- model: z17.string().min(1).max(256).optional(),
4064
+ session_id: z18.string().min(1).max(256),
4065
+ cwd: z18.string().min(1).max(4096).optional(),
4066
+ model: z18.string().min(1).max(256).optional(),
3943
4067
  permission_mode: permissionModeSchema.optional(),
3944
- transcript_path: z17.string().min(1).max(4096).optional(),
3945
- codex_version: z17.string().min(1).max(64).optional(),
4068
+ transcript_path: z18.string().min(1).max(4096).optional(),
4069
+ codex_version: z18.string().min(1).max(64).optional(),
3946
4070
  /** Not part of the documented protocol; lets tests and replay stay deterministic. */
3947
- occurred_at: z17.number().int().min(0).optional()
4071
+ occurred_at: z18.number().int().min(0).optional()
3948
4072
  };
3949
- var codexSessionStartPayloadSchema = z17.object({
4073
+ var codexSessionStartPayloadSchema = z18.object({
3950
4074
  ...baseFields,
3951
- hook_event_name: z17.literal("SessionStart"),
3952
- source: z17.enum(["startup", "resume", "clear", "compact"]).optional()
4075
+ hook_event_name: z18.literal("SessionStart"),
4076
+ source: z18.enum(["startup", "resume", "clear", "compact"]).optional()
3953
4077
  });
3954
- var codexUserPromptSubmitPayloadSchema = z17.object({
4078
+ var codexUserPromptSubmitPayloadSchema = z18.object({
3955
4079
  ...baseFields,
3956
- hook_event_name: z17.literal("UserPromptSubmit"),
3957
- turn_id: z17.string().min(1).max(256).optional(),
3958
- prompt: z17.string().max(1e6).optional()
4080
+ hook_event_name: z18.literal("UserPromptSubmit"),
4081
+ turn_id: z18.string().min(1).max(256).optional(),
4082
+ prompt: z18.string().max(1e6).optional()
3959
4083
  });
3960
- var codexPreToolUsePayloadSchema = z17.object({
4084
+ var codexPreToolUsePayloadSchema = z18.object({
3961
4085
  ...baseFields,
3962
- hook_event_name: z17.literal("PreToolUse"),
3963
- turn_id: z17.string().min(1).max(256).optional(),
3964
- tool_name: z17.string().min(1).max(256),
3965
- tool_call_id: z17.string().min(1).max(256).optional(),
3966
- tool_input: z17.unknown().optional()
4086
+ hook_event_name: z18.literal("PreToolUse"),
4087
+ turn_id: z18.string().min(1).max(256).optional(),
4088
+ tool_name: z18.string().min(1).max(256),
4089
+ tool_call_id: z18.string().min(1).max(256).optional(),
4090
+ tool_input: z18.unknown().optional()
3967
4091
  });
3968
- var codexPermissionRequestPayloadSchema = z17.object({
4092
+ var codexPermissionRequestPayloadSchema = z18.object({
3969
4093
  ...baseFields,
3970
- hook_event_name: z17.literal("PermissionRequest"),
3971
- turn_id: z17.string().min(1).max(256).optional(),
3972
- tool_name: z17.string().min(1).max(256).optional(),
3973
- tool_call_id: z17.string().min(1).max(256).optional(),
3974
- tool_input: z17.unknown().optional()
4094
+ hook_event_name: z18.literal("PermissionRequest"),
4095
+ turn_id: z18.string().min(1).max(256).optional(),
4096
+ tool_name: z18.string().min(1).max(256).optional(),
4097
+ tool_call_id: z18.string().min(1).max(256).optional(),
4098
+ tool_input: z18.unknown().optional()
3975
4099
  });
3976
- var codexPostToolUsePayloadSchema = z17.object({
4100
+ var codexPostToolUsePayloadSchema = z18.object({
3977
4101
  ...baseFields,
3978
- hook_event_name: z17.literal("PostToolUse"),
3979
- turn_id: z17.string().min(1).max(256).optional(),
3980
- tool_name: z17.string().min(1).max(256),
3981
- tool_call_id: z17.string().min(1).max(256).optional(),
3982
- tool_input: z17.unknown().optional(),
3983
- tool_response: z17.unknown().optional(),
3984
- permission_decision: z17.enum(["allowed", "denied", "deferred"]).optional(),
3985
- duration_ms: z17.number().min(0).optional()
4102
+ hook_event_name: z18.literal("PostToolUse"),
4103
+ turn_id: z18.string().min(1).max(256).optional(),
4104
+ tool_name: z18.string().min(1).max(256),
4105
+ tool_call_id: z18.string().min(1).max(256).optional(),
4106
+ tool_input: z18.unknown().optional(),
4107
+ tool_response: z18.unknown().optional(),
4108
+ permission_decision: z18.enum(["allowed", "denied", "deferred"]).optional(),
4109
+ duration_ms: z18.number().min(0).optional()
3986
4110
  });
3987
- var codexPreCompactPayloadSchema = z17.object({
4111
+ var codexPreCompactPayloadSchema = z18.object({
3988
4112
  ...baseFields,
3989
- hook_event_name: z17.literal("PreCompact"),
3990
- trigger: z17.enum(["auto", "manual"]).optional(),
3991
- context_tokens_before: z17.number().int().min(0).optional()
4113
+ hook_event_name: z18.literal("PreCompact"),
4114
+ trigger: z18.enum(["auto", "manual"]).optional(),
4115
+ context_tokens_before: z18.number().int().min(0).optional()
3992
4116
  });
3993
- var codexPostCompactPayloadSchema = z17.object({
4117
+ var codexPostCompactPayloadSchema = z18.object({
3994
4118
  ...baseFields,
3995
- hook_event_name: z17.literal("PostCompact"),
3996
- trigger: z17.enum(["auto", "manual"]).optional(),
3997
- context_tokens_after: z17.number().int().min(0).optional(),
3998
- dropped_message_count: z17.number().int().min(0).optional(),
4119
+ hook_event_name: z18.literal("PostCompact"),
4120
+ trigger: z18.enum(["auto", "manual"]).optional(),
4121
+ context_tokens_after: z18.number().int().min(0).optional(),
4122
+ dropped_message_count: z18.number().int().min(0).optional(),
3999
4123
  usage: codexUsageSchema.optional()
4000
4124
  });
4001
- var codexSubagentStartPayloadSchema = z17.object({
4125
+ var codexSubagentStartPayloadSchema = z18.object({
4002
4126
  ...baseFields,
4003
- hook_event_name: z17.literal("SubagentStart"),
4004
- turn_id: z17.string().min(1).max(256).optional(),
4005
- subagent_id: z17.string().min(1).max(256),
4006
- subagent_type: z17.string().min(1).max(256).optional()
4127
+ hook_event_name: z18.literal("SubagentStart"),
4128
+ turn_id: z18.string().min(1).max(256).optional(),
4129
+ subagent_id: z18.string().min(1).max(256),
4130
+ subagent_type: z18.string().min(1).max(256).optional()
4007
4131
  });
4008
- var codexSubagentStopPayloadSchema = z17.object({
4132
+ var codexSubagentStopPayloadSchema = z18.object({
4009
4133
  ...baseFields,
4010
- hook_event_name: z17.literal("SubagentStop"),
4011
- turn_id: z17.string().min(1).max(256).optional(),
4012
- subagent_id: z17.string().min(1).max(256),
4013
- status: z17.enum(["completed", "failed", "cancelled"]).optional(),
4134
+ hook_event_name: z18.literal("SubagentStop"),
4135
+ turn_id: z18.string().min(1).max(256).optional(),
4136
+ subagent_id: z18.string().min(1).max(256),
4137
+ status: z18.enum(["completed", "failed", "cancelled"]).optional(),
4014
4138
  usage: codexUsageSchema.optional()
4015
4139
  });
4016
- var codexStopPayloadSchema = z17.object({
4140
+ var codexStopPayloadSchema = z18.object({
4017
4141
  ...baseFields,
4018
- hook_event_name: z17.literal("Stop"),
4019
- turn_id: z17.string().min(1).max(256).optional(),
4020
- stop_reason: z17.string().min(1).max(256).optional(),
4142
+ hook_event_name: z18.literal("Stop"),
4143
+ turn_id: z18.string().min(1).max(256).optional(),
4144
+ stop_reason: z18.string().min(1).max(256).optional(),
4021
4145
  usage: codexUsageSchema.optional(),
4022
- duration_ms: z17.number().min(0).optional()
4146
+ duration_ms: z18.number().min(0).optional()
4023
4147
  });
4024
4148
  var CODEX_HOOK_EVENT_NAMES = [
4025
4149
  "SessionStart",
@@ -4033,7 +4157,7 @@ var CODEX_HOOK_EVENT_NAMES = [
4033
4157
  "SubagentStop",
4034
4158
  "Stop"
4035
4159
  ];
4036
- var codexHookPayloadSchema = z17.discriminatedUnion("hook_event_name", [
4160
+ var codexHookPayloadSchema = z18.discriminatedUnion("hook_event_name", [
4037
4161
  codexSessionStartPayloadSchema,
4038
4162
  codexUserPromptSubmitPayloadSchema,
4039
4163
  codexPreToolUsePayloadSchema,
@@ -4045,9 +4169,9 @@ var codexHookPayloadSchema = z17.discriminatedUnion("hook_event_name", [
4045
4169
  codexSubagentStopPayloadSchema,
4046
4170
  codexStopPayloadSchema
4047
4171
  ]);
4048
- var codexHookEnvelopeSchema = z17.object({
4049
- session_id: z17.string().min(1),
4050
- hook_event_name: z17.enum(CODEX_HOOK_EVENT_NAMES)
4172
+ var codexHookEnvelopeSchema = z18.object({
4173
+ session_id: z18.string().min(1),
4174
+ hook_event_name: z18.enum(CODEX_HOOK_EVENT_NAMES)
4051
4175
  });
4052
4176
 
4053
4177
  // src/providers/codex/delivery.ts
@@ -4666,7 +4790,7 @@ var geminiCorrelationSeed = (input) => {
4666
4790
  };
4667
4791
 
4668
4792
  // src/providers/gemini/schema.ts
4669
- import { z as z18 } from "zod";
4793
+ import { z as z19 } from "zod";
4670
4794
  var GEMINI_HOOK_EVENT_NAMES = [
4671
4795
  "SessionStart",
4672
4796
  "SessionEnd",
@@ -4680,113 +4804,113 @@ var GEMINI_HOOK_EVENT_NAMES = [
4680
4804
  "PreCompress",
4681
4805
  "Notification"
4682
4806
  ];
4683
- var baseHookInputSchema = z18.object({
4684
- session_id: z18.string().min(1),
4685
- transcript_path: z18.string().optional(),
4686
- cwd: z18.string().optional(),
4687
- timestamp: z18.string().min(1).optional()
4688
- });
4689
- var llmMessageSchema = z18.object({
4690
- role: z18.enum(["user", "model", "system"]).optional(),
4691
- content: z18.union([z18.string(), z18.array(z18.unknown())]).optional()
4807
+ var baseHookInputSchema = z19.object({
4808
+ session_id: z19.string().min(1),
4809
+ transcript_path: z19.string().optional(),
4810
+ cwd: z19.string().optional(),
4811
+ timestamp: z19.string().min(1).optional()
4812
+ });
4813
+ var llmMessageSchema = z19.object({
4814
+ role: z19.enum(["user", "model", "system"]).optional(),
4815
+ content: z19.union([z19.string(), z19.array(z19.unknown())]).optional()
4692
4816
  }).loose();
4693
- var llmRequestConfigSchema = z18.object({
4694
- temperature: z18.number().optional(),
4695
- maxOutputTokens: z18.number().int().min(0).optional()
4817
+ var llmRequestConfigSchema = z19.object({
4818
+ temperature: z19.number().optional(),
4819
+ maxOutputTokens: z19.number().int().min(0).optional()
4696
4820
  }).loose();
4697
- var geminiLlmRequestSchema = z18.object({
4698
- model: z18.string().min(1).optional(),
4699
- messages: z18.array(llmMessageSchema).optional(),
4821
+ var geminiLlmRequestSchema = z19.object({
4822
+ model: z19.string().min(1).optional(),
4823
+ messages: z19.array(llmMessageSchema).optional(),
4700
4824
  config: llmRequestConfigSchema.optional(),
4701
- toolConfig: z18.unknown().optional()
4825
+ toolConfig: z19.unknown().optional()
4702
4826
  }).loose();
4703
- var geminiUsageMetadataSchema = z18.object({
4704
- promptTokenCount: z18.number().int().min(0).optional(),
4705
- cachedContentTokenCount: z18.number().int().min(0).optional(),
4706
- candidatesTokenCount: z18.number().int().min(0).optional(),
4707
- thoughtsTokenCount: z18.number().int().min(0).optional(),
4708
- totalTokenCount: z18.number().int().min(0).optional()
4827
+ var geminiUsageMetadataSchema = z19.object({
4828
+ promptTokenCount: z19.number().int().min(0).optional(),
4829
+ cachedContentTokenCount: z19.number().int().min(0).optional(),
4830
+ candidatesTokenCount: z19.number().int().min(0).optional(),
4831
+ thoughtsTokenCount: z19.number().int().min(0).optional(),
4832
+ totalTokenCount: z19.number().int().min(0).optional()
4709
4833
  }).loose();
4710
- var geminiCandidateSchema = z18.object({
4711
- content: z18.object({
4712
- role: z18.string().optional(),
4713
- parts: z18.array(z18.unknown()).optional()
4834
+ var geminiCandidateSchema = z19.object({
4835
+ content: z19.object({
4836
+ role: z19.string().optional(),
4837
+ parts: z19.array(z19.unknown()).optional()
4714
4838
  }).loose().optional(),
4715
- finishReason: z18.string().optional(),
4716
- index: z18.number().int().min(0).optional()
4839
+ finishReason: z19.string().optional(),
4840
+ index: z19.number().int().min(0).optional()
4717
4841
  }).loose();
4718
- var geminiLlmResponseSchema = z18.object({
4842
+ var geminiLlmResponseSchema = z19.object({
4719
4843
  /** Whole-response text, set by the translator from `getResponseText`. */
4720
- text: z18.string().optional(),
4721
- candidates: z18.array(geminiCandidateSchema).optional(),
4844
+ text: z19.string().optional(),
4845
+ candidates: z19.array(geminiCandidateSchema).optional(),
4722
4846
  usageMetadata: geminiUsageMetadataSchema.optional()
4723
4847
  }).loose();
4724
- var geminiMcpContextSchema = z18.object({
4725
- server_name: z18.string().optional(),
4726
- tool_name: z18.string().optional()
4848
+ var geminiMcpContextSchema = z19.object({
4849
+ server_name: z19.string().optional(),
4850
+ tool_name: z19.string().optional()
4727
4851
  }).loose();
4728
- var geminiToolResponseSchema = z18.object({
4729
- llmContent: z18.unknown().optional(),
4730
- returnDisplay: z18.unknown().optional(),
4731
- error: z18.unknown().optional()
4852
+ var geminiToolResponseSchema = z19.object({
4853
+ llmContent: z19.unknown().optional(),
4854
+ returnDisplay: z19.unknown().optional(),
4855
+ error: z19.unknown().optional()
4732
4856
  }).loose();
4733
4857
  var sessionStartInputSchema = baseHookInputSchema.extend({
4734
- hook_event_name: z18.literal("SessionStart"),
4735
- source: z18.enum(["startup", "resume", "clear"]).optional()
4858
+ hook_event_name: z19.literal("SessionStart"),
4859
+ source: z19.enum(["startup", "resume", "clear"]).optional()
4736
4860
  });
4737
4861
  var sessionEndInputSchema = baseHookInputSchema.extend({
4738
- hook_event_name: z18.literal("SessionEnd"),
4739
- reason: z18.enum(["exit", "clear", "logout", "prompt_input_exit", "other"]).optional()
4862
+ hook_event_name: z19.literal("SessionEnd"),
4863
+ reason: z19.enum(["exit", "clear", "logout", "prompt_input_exit", "other"]).optional()
4740
4864
  });
4741
4865
  var beforeAgentInputSchema = baseHookInputSchema.extend({
4742
- hook_event_name: z18.literal("BeforeAgent"),
4743
- prompt: z18.string().optional()
4866
+ hook_event_name: z19.literal("BeforeAgent"),
4867
+ prompt: z19.string().optional()
4744
4868
  });
4745
4869
  var afterAgentInputSchema = baseHookInputSchema.extend({
4746
- hook_event_name: z18.literal("AfterAgent"),
4747
- prompt: z18.string().optional(),
4748
- prompt_response: z18.string().optional(),
4749
- stop_hook_active: z18.boolean().optional()
4870
+ hook_event_name: z19.literal("AfterAgent"),
4871
+ prompt: z19.string().optional(),
4872
+ prompt_response: z19.string().optional(),
4873
+ stop_hook_active: z19.boolean().optional()
4750
4874
  });
4751
4875
  var beforeModelInputSchema = baseHookInputSchema.extend({
4752
- hook_event_name: z18.literal("BeforeModel"),
4876
+ hook_event_name: z19.literal("BeforeModel"),
4753
4877
  llm_request: geminiLlmRequestSchema
4754
4878
  });
4755
4879
  var afterModelInputSchema = baseHookInputSchema.extend({
4756
- hook_event_name: z18.literal("AfterModel"),
4880
+ hook_event_name: z19.literal("AfterModel"),
4757
4881
  llm_request: geminiLlmRequestSchema,
4758
4882
  llm_response: geminiLlmResponseSchema
4759
4883
  });
4760
4884
  var beforeToolSelectionInputSchema = baseHookInputSchema.extend({
4761
- hook_event_name: z18.literal("BeforeToolSelection"),
4885
+ hook_event_name: z19.literal("BeforeToolSelection"),
4762
4886
  llm_request: geminiLlmRequestSchema
4763
4887
  });
4764
4888
  var beforeToolInputSchema = baseHookInputSchema.extend({
4765
- hook_event_name: z18.literal("BeforeTool"),
4766
- tool_name: z18.string().min(1),
4767
- tool_input: z18.unknown().optional(),
4889
+ hook_event_name: z19.literal("BeforeTool"),
4890
+ tool_name: z19.string().min(1),
4891
+ tool_input: z19.unknown().optional(),
4768
4892
  mcp_context: geminiMcpContextSchema.optional(),
4769
- original_request_name: z18.string().min(1).optional()
4893
+ original_request_name: z19.string().min(1).optional()
4770
4894
  });
4771
4895
  var afterToolInputSchema = baseHookInputSchema.extend({
4772
- hook_event_name: z18.literal("AfterTool"),
4773
- tool_name: z18.string().min(1),
4774
- tool_input: z18.unknown().optional(),
4896
+ hook_event_name: z19.literal("AfterTool"),
4897
+ tool_name: z19.string().min(1),
4898
+ tool_input: z19.unknown().optional(),
4775
4899
  tool_response: geminiToolResponseSchema.optional(),
4776
4900
  mcp_context: geminiMcpContextSchema.optional(),
4777
- original_request_name: z18.string().min(1).optional()
4901
+ original_request_name: z19.string().min(1).optional()
4778
4902
  });
4779
4903
  var preCompressInputSchema = baseHookInputSchema.extend({
4780
- hook_event_name: z18.literal("PreCompress"),
4781
- trigger: z18.enum(["auto", "manual"]).optional()
4904
+ hook_event_name: z19.literal("PreCompress"),
4905
+ trigger: z19.enum(["auto", "manual"]).optional()
4782
4906
  });
4783
4907
  var notificationInputSchema = baseHookInputSchema.extend({
4784
- hook_event_name: z18.literal("Notification"),
4785
- notification_type: z18.string().optional(),
4786
- message: z18.string().optional(),
4787
- details: z18.unknown().optional()
4908
+ hook_event_name: z19.literal("Notification"),
4909
+ notification_type: z19.string().optional(),
4910
+ message: z19.string().optional(),
4911
+ details: z19.unknown().optional()
4788
4912
  });
4789
- var geminiHookInputSchema = z18.discriminatedUnion("hook_event_name", [
4913
+ var geminiHookInputSchema = z19.discriminatedUnion("hook_event_name", [
4790
4914
  sessionStartInputSchema,
4791
4915
  sessionEndInputSchema,
4792
4916
  beforeAgentInputSchema,
@@ -5231,7 +5355,7 @@ var normalizeUsageOrWarn = (usage, warnings) => {
5231
5355
  };
5232
5356
 
5233
5357
  // src/providers/antigravity/payload.ts
5234
- import { z as z19 } from "zod";
5358
+ import { z as z20 } from "zod";
5235
5359
  var ANTIGRAVITY_HOOK_EVENT_NAMES = [
5236
5360
  "PreInvocation",
5237
5361
  "PostInvocation",
@@ -5239,48 +5363,48 @@ var ANTIGRAVITY_HOOK_EVENT_NAMES = [
5239
5363
  "PostToolUse",
5240
5364
  "Stop"
5241
5365
  ];
5242
- var hookEventNameSchema = z19.enum(ANTIGRAVITY_HOOK_EVENT_NAMES);
5243
- var antigravityWeakShapeSchema = z19.object({ hookEventName: hookEventNameSchema }).passthrough();
5366
+ var hookEventNameSchema = z20.enum(ANTIGRAVITY_HOOK_EVENT_NAMES);
5367
+ var antigravityWeakShapeSchema = z20.object({ hookEventName: hookEventNameSchema }).passthrough();
5244
5368
  var commonFields2 = {
5245
- conversationId: z19.string().min(1),
5246
- workspacePaths: z19.array(z19.string().min(1)).max(64),
5247
- invocationNum: z19.number().int().min(0),
5369
+ conversationId: z20.string().min(1),
5370
+ workspacePaths: z20.array(z20.string().min(1)).max(64),
5371
+ invocationNum: z20.number().int().min(0),
5248
5372
  /** Never disclosed: a real filesystem path. Accepted, never propagated. */
5249
- transcriptPath: z19.string().min(1).optional(),
5373
+ transcriptPath: z20.string().min(1).optional(),
5250
5374
  /** Never disclosed: a real filesystem path. Accepted, never propagated. */
5251
- artifactDirectoryPath: z19.string().min(1).optional()
5375
+ artifactDirectoryPath: z20.string().min(1).optional()
5252
5376
  };
5253
- var preInvocationPayloadSchema = z19.object({
5254
- hookEventName: z19.literal("PreInvocation"),
5377
+ var preInvocationPayloadSchema = z20.object({
5378
+ hookEventName: z20.literal("PreInvocation"),
5255
5379
  ...commonFields2,
5256
- agentVersion: z19.string().min(1).optional()
5380
+ agentVersion: z20.string().min(1).optional()
5257
5381
  });
5258
- var postInvocationPayloadSchema = z19.object({
5259
- hookEventName: z19.literal("PostInvocation"),
5382
+ var postInvocationPayloadSchema = z20.object({
5383
+ hookEventName: z20.literal("PostInvocation"),
5260
5384
  ...commonFields2,
5261
- agentVersion: z19.string().min(1).optional()
5385
+ agentVersion: z20.string().min(1).optional()
5262
5386
  });
5263
- var preToolUsePayloadSchema3 = z19.object({
5264
- hookEventName: z19.literal("PreToolUse"),
5387
+ var preToolUsePayloadSchema3 = z20.object({
5388
+ hookEventName: z20.literal("PreToolUse"),
5265
5389
  ...commonFields2,
5266
- stepIdx: z19.number().int().min(0),
5267
- toolName: z19.string().min(1),
5268
- toolInput: z19.unknown().optional()
5390
+ stepIdx: z20.number().int().min(0),
5391
+ toolName: z20.string().min(1),
5392
+ toolInput: z20.unknown().optional()
5269
5393
  });
5270
- var postToolUsePayloadSchema3 = z19.object({
5271
- hookEventName: z19.literal("PostToolUse"),
5394
+ var postToolUsePayloadSchema3 = z20.object({
5395
+ hookEventName: z20.literal("PostToolUse"),
5272
5396
  ...commonFields2,
5273
- stepIdx: z19.number().int().min(0),
5274
- toolName: z19.string().min(1),
5275
- toolResponse: z19.unknown().optional(),
5276
- isError: z19.boolean().optional()
5397
+ stepIdx: z20.number().int().min(0),
5398
+ toolName: z20.string().min(1),
5399
+ toolResponse: z20.unknown().optional(),
5400
+ isError: z20.boolean().optional()
5277
5401
  });
5278
- var stopPayloadSchema3 = z19.object({
5279
- hookEventName: z19.literal("Stop"),
5402
+ var stopPayloadSchema3 = z20.object({
5403
+ hookEventName: z20.literal("Stop"),
5280
5404
  ...commonFields2,
5281
- fullyIdle: z19.boolean()
5405
+ fullyIdle: z20.boolean()
5282
5406
  });
5283
- var antigravityHookPayloadSchema = z19.discriminatedUnion("hookEventName", [
5407
+ var antigravityHookPayloadSchema = z20.discriminatedUnion("hookEventName", [
5284
5408
  preInvocationPayloadSchema,
5285
5409
  postInvocationPayloadSchema,
5286
5410
  preToolUsePayloadSchema3,
@@ -5573,7 +5697,7 @@ var createFixedClock = (options = {}) => {
5573
5697
  };
5574
5698
 
5575
5699
  // src/runtime/hook.ts
5576
- import { z as z21 } from "zod";
5700
+ import { z as z22 } from "zod";
5577
5701
 
5578
5702
  // src/runtime/delivery.ts
5579
5703
  var PROVIDER_SCOPE_PREFIX = "provider-session";
@@ -5640,15 +5764,15 @@ var createDeterministicIdGenerator = (options = {}) => {
5640
5764
  };
5641
5765
 
5642
5766
  // src/runtime/ports.ts
5643
- import { z as z20 } from "zod";
5644
- var appliedDeliverySchema = z20.strictObject({
5645
- callbackId: z20.string().regex(/^[A-Za-z0-9_-]{1,128}$/),
5767
+ import { z as z21 } from "zod";
5768
+ var appliedDeliverySchema = z21.strictObject({
5769
+ callbackId: z21.string().regex(/^[A-Za-z0-9_-]{1,128}$/),
5646
5770
  /** How many of that delivery's observations are folded in, counted from one. */
5647
- applications: z20.number().int().min(1).max(4096)
5771
+ applications: z21.number().int().min(1).max(4096)
5648
5772
  });
5649
- var stateValueSchema = z20.discriminatedUnion("kind", [
5650
- z20.strictObject({
5651
- kind: z20.literal("usage-cumulative"),
5773
+ var stateValueSchema = z21.discriminatedUnion("kind", [
5774
+ z21.strictObject({
5775
+ kind: z21.literal("usage-cumulative"),
5652
5776
  usage: canonicalUsageSchema,
5653
5777
  /**
5654
5778
  * Optional: absent on every record written before this field existed, which
@@ -5657,22 +5781,22 @@ var stateValueSchema = z20.discriminatedUnion("kind", [
5657
5781
  */
5658
5782
  appliedDelivery: appliedDeliverySchema.optional()
5659
5783
  }),
5660
- z20.strictObject({
5661
- kind: z20.literal("sequence"),
5784
+ z21.strictObject({
5785
+ kind: z21.literal("sequence"),
5662
5786
  next: sequenceNumberSchema
5663
5787
  }),
5664
- z20.strictObject({
5665
- kind: z20.literal("attributes"),
5788
+ z21.strictObject({
5789
+ kind: z21.literal("attributes"),
5666
5790
  attributes: attributesSchema
5667
5791
  })
5668
5792
  ]);
5669
- var stateRecordSchema = z20.strictObject({
5793
+ var stateRecordSchema = z21.strictObject({
5670
5794
  /** Incremented on each write; lets callers detect lost updates. */
5671
- revision: z20.number().int().min(0),
5795
+ revision: z21.number().int().min(0),
5672
5796
  updatedAt: epochMillisSchema,
5673
5797
  value: stateValueSchema
5674
5798
  });
5675
- var logLevelSchema = z20.enum(["silent", "error", "warn", "info", "debug"]);
5799
+ var logLevelSchema = z21.enum(["silent", "error", "warn", "info", "debug"]);
5676
5800
  var LOG_LEVEL_RANK = Object.freeze({
5677
5801
  silent: 0,
5678
5802
  error: 1,
@@ -5806,7 +5930,7 @@ var withOptionalSessionLock = async (store, sessionId, fn, options) => {
5806
5930
  };
5807
5931
 
5808
5932
  // src/runtime/hook.ts
5809
- var usageScopeSchema = z21.enum(["session", "generation", "subagent"]);
5933
+ var usageScopeSchema = z22.enum(["session", "generation", "subagent"]);
5810
5934
  var classifyDurability = (input) => {
5811
5935
  if (!input.attempted) {
5812
5936
  return "nothing-to-deliver";
@@ -6679,11 +6803,11 @@ var createRecordingLogger = (level = "debug") => {
6679
6803
  };
6680
6804
 
6681
6805
  // src/testing/fixture-adapter.ts
6682
- import { z as z22 } from "zod";
6683
- var syntheticPayloadSchema = z22.object({
6684
- provider: z22.string().min(1),
6685
- sessionId: z22.string().min(1),
6686
- event: z22.enum([
6806
+ import { z as z23 } from "zod";
6807
+ var syntheticPayloadSchema = z23.object({
6808
+ provider: z23.string().min(1),
6809
+ sessionId: z23.string().min(1),
6810
+ event: z23.enum([
6687
6811
  "session.start",
6688
6812
  "prompt",
6689
6813
  "generation",
@@ -6693,15 +6817,15 @@ var syntheticPayloadSchema = z22.object({
6693
6817
  "session.end",
6694
6818
  "noop"
6695
6819
  ]),
6696
- requestId: z22.string().min(1).optional(),
6697
- model: z22.string().min(1).optional(),
6698
- promptText: z22.string().optional(),
6699
- toolName: z22.string().min(1).optional(),
6700
- toolInput: z22.unknown().optional(),
6701
- workspaceKey: z22.string().min(1).optional(),
6702
- occurredAt: z22.number().int().min(0).optional(),
6820
+ requestId: z23.string().min(1).optional(),
6821
+ model: z23.string().min(1).optional(),
6822
+ promptText: z23.string().optional(),
6823
+ toolName: z23.string().min(1).optional(),
6824
+ toolInput: z23.unknown().optional(),
6825
+ workspaceKey: z23.string().min(1).optional(),
6826
+ occurredAt: z23.number().int().min(0).optional(),
6703
6827
  usage: usageReportSchema.optional(),
6704
- agentVersion: z22.string().min(1).optional()
6828
+ agentVersion: z23.string().min(1).optional()
6705
6829
  });
6706
6830
  var SYNTHETIC_PROVIDER_ID = "fixture";
6707
6831
  var DEFAULT_FIXTURE_CAPABILITIES = Object.freeze({