@spotpatch/shared 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/annotation-C0Me9mN2.d.cts +102 -0
  2. package/dist/annotation-C0Me9mN2.d.ts +102 -0
  3. package/dist/chunk-C2PJ4UUU.js +195 -0
  4. package/dist/chunk-C2PJ4UUU.js.map +1 -0
  5. package/dist/chunk-DYTWEIES.js +89 -0
  6. package/dist/chunk-DYTWEIES.js.map +1 -0
  7. package/dist/{chunk-JGOIBOFI.js → chunk-FPDSZDP2.js} +16 -2
  8. package/dist/chunk-FPDSZDP2.js.map +1 -0
  9. package/dist/chunk-IUTOVI5G.js +584 -0
  10. package/dist/chunk-IUTOVI5G.js.map +1 -0
  11. package/dist/{chunk-JU5HIWX7.js → chunk-YQ5GL523.js} +8 -173
  12. package/dist/chunk-YQ5GL523.js.map +1 -0
  13. package/dist/contextual-ask-B0mCFn92.d.cts +1451 -0
  14. package/dist/contextual-ask-B0mCFn92.d.ts +1451 -0
  15. package/dist/contextual-ask-browser.cjs +200 -0
  16. package/dist/contextual-ask-browser.cjs.map +1 -0
  17. package/dist/contextual-ask-browser.d.cts +31 -0
  18. package/dist/contextual-ask-browser.d.ts +31 -0
  19. package/dist/contextual-ask-browser.js +66 -0
  20. package/dist/contextual-ask-browser.js.map +1 -0
  21. package/dist/contextual-ask-node.cjs +968 -0
  22. package/dist/contextual-ask-node.cjs.map +1 -0
  23. package/dist/contextual-ask-node.d.cts +14 -0
  24. package/dist/contextual-ask-node.d.ts +14 -0
  25. package/dist/contextual-ask-node.js +122 -0
  26. package/dist/contextual-ask-node.js.map +1 -0
  27. package/dist/{data-flow-runtime-oq9m21IP.d.cts → data-flow-runtime-D8HPSb2i.d.cts} +13 -13
  28. package/dist/{data-flow-runtime-BelOgo8s.d.ts → data-flow-runtime-vKeEaJgT.d.ts} +13 -13
  29. package/dist/data-flow-runtime.cjs +2 -0
  30. package/dist/data-flow-runtime.cjs.map +1 -1
  31. package/dist/data-flow-runtime.d.cts +2 -2
  32. package/dist/data-flow-runtime.d.ts +2 -2
  33. package/dist/data-flow-runtime.js +1 -1
  34. package/dist/{endpoints-GedF44M2.d.cts → endpoints-O3ohYyAo.d.cts} +7 -1
  35. package/dist/{endpoints-GedF44M2.d.ts → endpoints-O3ohYyAo.d.ts} +7 -1
  36. package/dist/error-code-DRz2eqcB.d.cts +63 -0
  37. package/dist/error-code-DRz2eqcB.d.ts +63 -0
  38. package/dist/external-agent-node.cjs +142 -121
  39. package/dist/external-agent-node.cjs.map +1 -1
  40. package/dist/external-agent-node.d.cts +27 -26
  41. package/dist/external-agent-node.d.ts +27 -26
  42. package/dist/external-agent-node.js +4 -2
  43. package/dist/external-agent-node.js.map +1 -1
  44. package/dist/{external-handoff-BNUyMfNb.d.ts → external-handoff-DighrWn8.d.ts} +30 -130
  45. package/dist/{external-handoff-BNUyMfNb.d.cts → external-handoff-DwtFFR6F.d.cts} +30 -130
  46. package/dist/external-handoff-browser.cjs +2 -0
  47. package/dist/external-handoff-browser.cjs.map +1 -1
  48. package/dist/external-handoff-browser.d.cts +4 -3
  49. package/dist/external-handoff-browser.d.ts +4 -3
  50. package/dist/external-handoff-browser.js +1 -1
  51. package/dist/index.cjs +1144 -422
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.cts +126 -178
  54. package/dist/index.d.ts +126 -178
  55. package/dist/index.js +97 -16
  56. package/dist/index.js.map +1 -1
  57. package/package.json +29 -2
  58. package/dist/chunk-JGOIBOFI.js.map +0 -1
  59. package/dist/chunk-JU5HIWX7.js.map +0 -1
  60. package/dist/{external-agent-control-BMoSq_xI.d.cts → external-agent-control-CRBbjDDk.d.cts} +46 -46
  61. package/dist/{external-agent-control-BMoSq_xI.d.ts → external-agent-control-CRBbjDDk.d.ts} +46 -46
package/dist/index.cjs CHANGED
@@ -27,6 +27,18 @@ __export(index_exports, {
27
27
  AGENT_JOB_STATUSES: () => AGENT_JOB_STATUSES,
28
28
  AGENT_WORKSPACE_SNAPSHOT_LIMITS: () => AGENT_WORKSPACE_SNAPSHOT_LIMITS,
29
29
  AGENT_WORKSPACE_STATES: () => AGENT_WORKSPACE_STATES,
30
+ ASK_ANSWER_WARNING_CODES: () => ASK_ANSWER_WARNING_CODES,
31
+ ASK_EXECUTOR_ANSWER_WARNING_CODES: () => ASK_EXECUTOR_ANSWER_WARNING_CODES,
32
+ ASK_FILE_COUNT_BUCKETS: () => ASK_FILE_COUNT_BUCKETS,
33
+ ASK_JOB_STATUSES: () => ASK_JOB_STATUSES,
34
+ ASK_READ_ACTIVITY_STATES: () => ASK_READ_ACTIVITY_STATES,
35
+ ASK_SOURCE_CONFIDENCES: () => ASK_SOURCE_CONFIDENCES,
36
+ CONTEXTUAL_ASK_ERROR_CODES: () => CONTEXTUAL_ASK_ERROR_CODES,
37
+ CONTEXTUAL_ASK_EXECUTOR_KINDS: () => CONTEXTUAL_ASK_EXECUTOR_KINDS,
38
+ CONTEXTUAL_ASK_EXECUTOR_STATES: () => CONTEXTUAL_ASK_EXECUTOR_STATES,
39
+ CONTEXTUAL_ASK_LIMITS: () => CONTEXTUAL_ASK_LIMITS,
40
+ CONTEXTUAL_ASK_PERMISSION_PROFILE: () => CONTEXTUAL_ASK_PERMISSION_PROFILE,
41
+ CONTEXTUAL_ASK_SCHEMA_VERSION: () => CONTEXTUAL_ASK_SCHEMA_VERSION,
30
42
  DATA_FLOW_ASSOCIATION_KINDS: () => DATA_FLOW_ASSOCIATION_KINDS,
31
43
  DATA_FLOW_DIAGNOSTIC_CODES: () => DATA_FLOW_DIAGNOSTIC_CODES,
32
44
  DATA_FLOW_EXECUTION_STATES: () => DATA_FLOW_EXECUTION_STATES,
@@ -97,7 +109,26 @@ __export(index_exports, {
97
109
  agentJobSnapshotSchema: () => agentJobSnapshotSchema,
98
110
  agentWorkspaceHealthRequestSchema: () => agentWorkspaceHealthRequestSchema,
99
111
  agentWorkspaceHealthSnapshotSchema: () => agentWorkspaceHealthSnapshotSchema,
112
+ askAnswerBlockSchema: () => askAnswerBlockSchema,
113
+ askAnswerDraftBlockSchema: () => askAnswerDraftBlockSchema,
114
+ askAnswerDraftSchema: () => askAnswerDraftSchema,
115
+ askAnswerResultSchema: () => askAnswerResultSchema,
116
+ askAnswerWarningSchema: () => askAnswerWarningSchema,
117
+ askDraftCitationSchema: () => askDraftCitationSchema,
118
+ askDraftOriginSchema: () => askDraftOriginSchema,
119
+ askJobActionRequestSchema: () => askJobActionRequestSchema,
120
+ askJobCreateRequestSchema: () => askJobCreateRequestSchema,
121
+ askJobEventSchema: () => askJobEventSchema,
122
+ askJobEventsRequestSchema: () => askJobEventsRequestSchema,
123
+ askJobResultResponseSchema: () => askJobResultResponseSchema,
124
+ askJobSnapshotSchema: () => askJobSnapshotSchema,
125
+ askSourceReferenceSchema: () => askSourceReferenceSchema,
100
126
  componentDataFlowReportSchema: () => componentDataFlowReportSchema,
127
+ contextualAskCapabilityRequestSchema: () => contextualAskCapabilityRequestSchema,
128
+ contextualAskCapabilitySchema: () => contextualAskCapabilitySchema,
129
+ contextualAskExecutorCapabilitySchema: () => contextualAskExecutorCapabilitySchema,
130
+ contextualAskExecutorPreferenceSchema: () => contextualAskExecutorPreferenceSchema,
131
+ contextualAskOptionsSchema: () => contextualAskOptionsSchema,
101
132
  dataDependencySchema: () => dataDependencySchema,
102
133
  dataFlowComponentReportRequestSchema: () => dataFlowComponentReportRequestSchema,
103
134
  dataFlowPageReportRequestSchema: () => dataFlowPageReportRequestSchema,
@@ -125,6 +156,7 @@ __export(index_exports, {
125
156
  externalHandoffSummarySchema: () => externalHandoffSummarySchema,
126
157
  formatSourceMarker: () => formatSourceMarker,
127
158
  getAgentJobEndpoint: () => getAgentJobEndpoint,
159
+ getAskJobEndpoint: () => getAskJobEndpoint,
128
160
  isErrorCode: () => isErrorCode,
129
161
  isSensitiveName: () => isSensitiveName,
130
162
  limitDataFlowReportCollections: () => limitDataFlowReportCollections,
@@ -142,8 +174,13 @@ __export(index_exports, {
142
174
  runtimeDataFlowConfigSchema: () => runtimeDataFlowConfigSchema,
143
175
  sanitizeUrl: () => sanitizeUrl,
144
176
  sourceContextRequestSchema: () => sourceContextRequestSchema,
145
- spotAnnotationRequestSchema: () => spotAnnotationRequestSchema,
146
- spotTargetContextRequestSchema: () => spotTargetContextRequestSchema
177
+ spotAnnotationRequestSchema: () => spotAnnotationSchema,
178
+ spotAskTaskEnvelopeSchema: () => spotAskTaskEnvelopeSchema,
179
+ spotChangeTaskEnvelopeSchema: () => spotChangeTaskEnvelopeSchema,
180
+ spotSelectionContextSchema: () => spotSelectionContextSchema,
181
+ spotSelectionTargetSchema: () => spotSelectionTargetSchema,
182
+ spotTargetContextRequestSchema: () => spotTargetContextSchema,
183
+ spotTaskEnvelopeSchema: () => spotTaskEnvelopeSchema
147
184
  });
148
185
  module.exports = __toCommonJS(index_exports);
149
186
 
@@ -214,6 +251,24 @@ var ERROR_CODES = {
214
251
  APPLY_CONFLICT: "APPLY_CONFLICT",
215
252
  INTERNAL_ERROR: "INTERNAL_ERROR"
216
253
  };
254
+ var CONTEXTUAL_ASK_ERROR_CODES = Object.freeze([
255
+ "ASK_DISABLED",
256
+ "ASK_SELECTION_REQUIRED",
257
+ "ASK_SELECTION_STALE",
258
+ "ASK_QUESTION_INVALID",
259
+ "ASK_EXECUTOR_UNAVAILABLE",
260
+ "ASK_TIMEOUT",
261
+ "ASK_CONSENT_REQUIRED",
262
+ "ASK_BUSY",
263
+ "ASK_IDEMPOTENCY_CONFLICT",
264
+ "ASK_SOURCE_SCOPE_DENIED",
265
+ "ASK_LIMIT_EXCEEDED",
266
+ "ASK_ANSWER_INVALID",
267
+ "ASK_WRITE_ATTEMPTED",
268
+ "ASK_CANCELLED",
269
+ "ASK_RESULT_EXPIRED",
270
+ "ASK_PROTOCOL_INCOMPATIBLE"
271
+ ]);
217
272
  var ERROR_CODE_VALUES = Object.freeze(Object.values(ERROR_CODES));
218
273
  function isErrorCode(value) {
219
274
  return typeof value === "string" && ERROR_CODE_VALUES.includes(value);
@@ -298,6 +353,534 @@ var SPOTPATCH_LOCALE_PREFERENCES = Object.freeze([
298
353
  ...SPOTPATCH_LOCALES
299
354
  ]);
300
355
 
356
+ // src/model/contextual-ask.ts
357
+ var import_zod2 = require("zod");
358
+
359
+ // src/protocol/contextual-ask-constants.ts
360
+ var CONTEXTUAL_ASK_SCHEMA_VERSION = 1;
361
+ var CONTEXTUAL_ASK_LIMITS = Object.freeze({
362
+ maximumTargets: 20,
363
+ maximumQuestionCharacters: 4e3,
364
+ maximumAnswerCharacters: 4e4,
365
+ maximumAnswerBlocks: 40,
366
+ maximumSources: 64,
367
+ maximumReadFiles: 32,
368
+ maximumReadBytesPerFile: 64 * 1024,
369
+ maximumReadBytesTotal: 512 * 1024,
370
+ maximumToolCalls: 48,
371
+ maximumModelTurns: 12,
372
+ jobTimeoutMs: 3e5,
373
+ resultTtlMs: 9e5,
374
+ maximumActiveJobsPerSession: 1,
375
+ maximumRetainedResultsPerSession: 1,
376
+ maximumRetainedEvents: 256,
377
+ maximumEventSubscribers: 4,
378
+ eventHeartbeatMs: 15e3,
379
+ maximumRequestBodyBytes: 256 * 1024,
380
+ maximumSearchQueryCharacters: 256,
381
+ maximumSearchResults: 64,
382
+ maximumSearchPreviewCharacters: 500,
383
+ capabilityTimeoutMs: 3e4,
384
+ maximumIdCharacters: 128,
385
+ maximumProfileIdCharacters: 64,
386
+ maximumLabelCharacters: 256,
387
+ maximumRelativePathCharacters: 1024,
388
+ maximumLanguageCharacters: 64,
389
+ maximumPhaseMessageCharacters: 1024,
390
+ maximumExecutors: 32,
391
+ contentHashHexCharacters: 64
392
+ });
393
+ var CONTEXTUAL_ASK_EXECUTOR_KINDS = Object.freeze([
394
+ "configured-key",
395
+ "managed-codex"
396
+ ]);
397
+ var CONTEXTUAL_ASK_EXECUTOR_STATES = Object.freeze([
398
+ "ready",
399
+ "degraded",
400
+ "unavailable"
401
+ ]);
402
+ var ASK_JOB_STATUSES = Object.freeze([
403
+ "queued",
404
+ "authorizing",
405
+ "running",
406
+ "cancelling",
407
+ "answered",
408
+ "cancelled",
409
+ "failed"
410
+ ]);
411
+ var ASK_ANSWER_WARNING_CODES = Object.freeze([
412
+ "insufficient-evidence",
413
+ "partial-context",
414
+ "source-truncated",
415
+ "source-stale"
416
+ ]);
417
+ var ASK_EXECUTOR_ANSWER_WARNING_CODES = Object.freeze([
418
+ "insufficient-evidence",
419
+ "partial-context"
420
+ ]);
421
+ var ASK_READ_ACTIVITY_STATES = Object.freeze([
422
+ "started",
423
+ "succeeded",
424
+ "failed"
425
+ ]);
426
+ var ASK_FILE_COUNT_BUCKETS = Object.freeze(["one", "few", "many"]);
427
+ var ASK_SOURCE_CONFIDENCES = Object.freeze([
428
+ "exact",
429
+ "probable",
430
+ "approximate"
431
+ ]);
432
+ var CONTEXTUAL_ASK_PERMISSION_PROFILE = "spotpatch-ask-readonly";
433
+
434
+ // src/model/context-schema.ts
435
+ var import_zod = require("zod");
436
+ var boundedString = (maximum) => import_zod.z.string().max(maximum);
437
+ var sourceRefSchema = import_zod.z.strictObject({
438
+ fileId: boundedString(128).optional(),
439
+ relativePath: boundedString(1024).optional(),
440
+ line: import_zod.z.number().int().positive().optional(),
441
+ column: import_zod.z.number().int().positive().optional(),
442
+ origin: import_zod.z.enum(["jsx-host", "react-fiber", "dom-ancestor", "none"]),
443
+ confidence: import_zod.z.enum(["exact", "probable", "approximate", "unknown"])
444
+ });
445
+ var matchedStyleRuleSchema = import_zod.z.strictObject({
446
+ selector: boundedString(2048),
447
+ declarations: boundedString(8192),
448
+ source: boundedString(1024).optional(),
449
+ media: boundedString(1024).optional()
450
+ });
451
+ var codeContextSchema = import_zod.z.strictObject({
452
+ relativePath: boundedString(1024),
453
+ language: import_zod.z.enum(["tsx", "jsx"]),
454
+ startLine: import_zod.z.number().int().positive(),
455
+ endLine: import_zod.z.number().int().positive(),
456
+ excerpt: boundedString(16e3),
457
+ boundary: import_zod.z.enum(["component", "nearby-lines"])
458
+ });
459
+ var pageContextSchema = import_zod.z.strictObject({
460
+ url: boundedString(2048),
461
+ pathname: boundedString(2048),
462
+ title: boundedString(1024),
463
+ viewportWidth: import_zod.z.number().nonnegative(),
464
+ viewportHeight: import_zod.z.number().nonnegative(),
465
+ devicePixelRatio: import_zod.z.number().positive()
466
+ });
467
+ var spotTargetContextSchema = import_zod.z.strictObject({
468
+ instruction: import_zod.z.string().trim().min(1).max(MAX_TARGET_INSTRUCTION_CHARACTERS),
469
+ page: pageContextSchema.optional(),
470
+ source: sourceRefSchema,
471
+ react: import_zod.z.strictObject({
472
+ supported: import_zod.z.boolean(),
473
+ version: boundedString(64).optional(),
474
+ componentName: boundedString(256).optional(),
475
+ componentSourceId: boundedString(128).optional(),
476
+ sourceVersion: boundedString(128).optional(),
477
+ componentStack: import_zod.z.array(boundedString(256)).max(64),
478
+ source: sourceRefSchema.optional()
479
+ }),
480
+ element: import_zod.z.strictObject({
481
+ tagName: boundedString(128),
482
+ selector: boundedString(2048),
483
+ sanitizedHtml: boundedString(8192),
484
+ textPreview: boundedString(2048).optional(),
485
+ role: boundedString(256).optional(),
486
+ rect: import_zod.z.strictObject({
487
+ x: import_zod.z.number(),
488
+ y: import_zod.z.number(),
489
+ width: import_zod.z.number().nonnegative(),
490
+ height: import_zod.z.number().nonnegative()
491
+ })
492
+ }),
493
+ styles: import_zod.z.strictObject({
494
+ classNames: import_zod.z.array(boundedString(512)).max(256),
495
+ inlineStyle: boundedString(8192).optional(),
496
+ matchedRules: import_zod.z.array(matchedStyleRuleSchema).max(256),
497
+ computed: import_zod.z.record(boundedString(256), boundedString(2048)),
498
+ warnings: import_zod.z.array(boundedString(1024)).max(64)
499
+ }),
500
+ code: codeContextSchema.optional(),
501
+ warnings: import_zod.z.array(boundedString(1024)).max(64)
502
+ });
503
+ var spotAnnotationSchema = import_zod.z.strictObject({
504
+ schemaVersion: import_zod.z.literal(3),
505
+ id: boundedString(128),
506
+ locale: import_zod.z.enum(SPOTPATCH_LOCALES),
507
+ page: pageContextSchema,
508
+ targets: import_zod.z.array(spotTargetContextSchema).min(1).max(MAX_ANNOTATION_TARGETS),
509
+ createdAt: import_zod.z.iso.datetime()
510
+ }).superRefine((annotation, context) => {
511
+ const total = annotation.targets.reduce(
512
+ (characters, target) => characters + target.instruction.length,
513
+ 0
514
+ );
515
+ if (total > MAX_ANNOTATION_INSTRUCTION_CHARACTERS) {
516
+ context.addIssue({
517
+ code: "custom",
518
+ message: "Combined target instructions exceed the annotation limit.",
519
+ path: ["targets"]
520
+ });
521
+ }
522
+ });
523
+
524
+ // src/model/contextual-ask.ts
525
+ var limits = CONTEXTUAL_ASK_LIMITS;
526
+ var contextualAskBoundedText = (maximum) => import_zod2.z.string().trim().min(1).max(maximum);
527
+ var contextualAskOpaqueIdSchema = import_zod2.z.string().min(1).max(limits.maximumIdCharacters).regex(/^[A-Za-z0-9_-]+$/u);
528
+ var profileIdSchema = import_zod2.z.string().min(1).max(limits.maximumProfileIdCharacters).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/u);
529
+ var contentHashSchema = import_zod2.z.string().length(limits.contentHashHexCharacters).regex(/^[a-f0-9]+$/u);
530
+ var contextualAskRelativePathSchema = import_zod2.z.string().min(1).max(limits.maximumRelativePathCharacters).refine(
531
+ (value) => !value.startsWith("/") && !value.includes("\\") && !Array.from(value).some((character) => {
532
+ const codePoint = character.codePointAt(0);
533
+ return codePoint !== void 0 && (codePoint <= 31 || codePoint === 127);
534
+ }) && !/^[A-Za-z]:/u.test(value) && value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== ".."),
535
+ { message: "Expected a safe project-relative POSIX path." }
536
+ );
537
+ var contextualAskExecutorPreferenceSchema = import_zod2.z.discriminatedUnion("kind", [
538
+ import_zod2.z.strictObject({
539
+ kind: import_zod2.z.literal("configured-key"),
540
+ providerProfileId: profileIdSchema,
541
+ modelProfileId: profileIdSchema
542
+ }),
543
+ import_zod2.z.strictObject({ kind: import_zod2.z.literal("managed-codex") })
544
+ ]);
545
+ var contextualAskOptionsSchema = import_zod2.z.union([
546
+ import_zod2.z.boolean(),
547
+ import_zod2.z.strictObject({
548
+ defaultExecutor: contextualAskExecutorPreferenceSchema.optional()
549
+ })
550
+ ]);
551
+ var spotSelectionTargetSchema = spotTargetContextSchema.omit({ instruction: true, page: true }).extend({
552
+ targetId: contextualAskOpaqueIdSchema,
553
+ page: pageContextSchema
554
+ }).strict();
555
+ var spotSelectionContextSchema = import_zod2.z.strictObject({
556
+ schemaVersion: import_zod2.z.literal(CONTEXTUAL_ASK_SCHEMA_VERSION),
557
+ selectionId: contextualAskOpaqueIdSchema,
558
+ locale: import_zod2.z.enum(SPOTPATCH_LOCALES),
559
+ targets: import_zod2.z.array(spotSelectionTargetSchema).min(1).max(limits.maximumTargets),
560
+ createdAt: import_zod2.z.iso.datetime()
561
+ }).superRefine((selection, context) => {
562
+ const targetIds = selection.targets.map((target) => target.targetId);
563
+ if (new Set(targetIds).size !== targetIds.length) {
564
+ context.addIssue({
565
+ code: "custom",
566
+ message: "Selection target IDs must be unique.",
567
+ path: ["targets"]
568
+ });
569
+ }
570
+ });
571
+ var askDraftOriginSchema = import_zod2.z.strictObject({
572
+ kind: import_zod2.z.literal("contextual-ask"),
573
+ askJobId: contextualAskOpaqueIdSchema,
574
+ question: contextualAskBoundedText(limits.maximumQuestionCharacters),
575
+ answerDigest: contextualAskBoundedText(limits.maximumQuestionCharacters),
576
+ sourceIds: import_zod2.z.array(contextualAskOpaqueIdSchema).max(limits.maximumSources)
577
+ }).superRefine((origin, context) => {
578
+ if (new Set(origin.sourceIds).size !== origin.sourceIds.length) {
579
+ context.addIssue({
580
+ code: "custom",
581
+ message: "Ask origin source IDs must be unique.",
582
+ path: ["sourceIds"]
583
+ });
584
+ }
585
+ });
586
+ var askTaskSchema = import_zod2.z.strictObject({
587
+ kind: import_zod2.z.literal("ask"),
588
+ question: contextualAskBoundedText(limits.maximumQuestionCharacters)
589
+ });
590
+ var changeInstructionSchema = import_zod2.z.strictObject({
591
+ targetId: contextualAskOpaqueIdSchema,
592
+ instruction: contextualAskBoundedText(MAX_TARGET_INSTRUCTION_CHARACTERS)
593
+ });
594
+ var changeTaskSchema = import_zod2.z.strictObject({
595
+ kind: import_zod2.z.literal("change"),
596
+ instructions: import_zod2.z.array(changeInstructionSchema).min(1).max(limits.maximumTargets),
597
+ origin: askDraftOriginSchema.optional()
598
+ });
599
+ var envelopeBaseShape = {
600
+ schemaVersion: import_zod2.z.literal(CONTEXTUAL_ASK_SCHEMA_VERSION),
601
+ taskId: contextualAskOpaqueIdSchema,
602
+ selection: spotSelectionContextSchema,
603
+ createdAt: import_zod2.z.iso.datetime()
604
+ };
605
+ var spotAskTaskEnvelopeSchema = import_zod2.z.strictObject({
606
+ ...envelopeBaseShape,
607
+ task: askTaskSchema
608
+ });
609
+ var spotChangeTaskEnvelopeSchema = import_zod2.z.strictObject({
610
+ ...envelopeBaseShape,
611
+ task: changeTaskSchema
612
+ }).superRefine((envelope, context) => {
613
+ const targetIds = envelope.selection.targets.map((target) => target.targetId);
614
+ const instructionIds = envelope.task.instructions.map(
615
+ (instruction) => instruction.targetId
616
+ );
617
+ if (new Set(instructionIds).size !== instructionIds.length || instructionIds.length !== targetIds.length || targetIds.some((targetId) => !instructionIds.includes(targetId))) {
618
+ context.addIssue({
619
+ code: "custom",
620
+ message: "Change instructions must map one-to-one to selection targets.",
621
+ path: ["task", "instructions"]
622
+ });
623
+ }
624
+ const total = envelope.task.instructions.reduce(
625
+ (characters, instruction) => characters + instruction.instruction.length,
626
+ 0
627
+ );
628
+ if (total > MAX_ANNOTATION_INSTRUCTION_CHARACTERS) {
629
+ context.addIssue({
630
+ code: "custom",
631
+ message: "Combined change instructions exceed the task limit.",
632
+ path: ["task", "instructions"]
633
+ });
634
+ }
635
+ });
636
+ var spotTaskEnvelopeSchema = import_zod2.z.union([
637
+ spotAskTaskEnvelopeSchema,
638
+ spotChangeTaskEnvelopeSchema
639
+ ]);
640
+ var askAnswerWarningSchema = import_zod2.z.strictObject({
641
+ code: import_zod2.z.enum(ASK_ANSWER_WARNING_CODES)
642
+ });
643
+ var askExecutorAnswerWarningSchema = import_zod2.z.strictObject({
644
+ code: import_zod2.z.enum(ASK_EXECUTOR_ANSWER_WARNING_CODES)
645
+ });
646
+ var askDraftCitationSchema = import_zod2.z.strictObject({
647
+ handleId: contextualAskOpaqueIdSchema,
648
+ startLine: import_zod2.z.number().int().positive(),
649
+ endLine: import_zod2.z.number().int().positive()
650
+ }).refine((citation) => citation.endLine >= citation.startLine, {
651
+ message: "Citation endLine must not precede startLine."
652
+ });
653
+ var draftCitationListSchema = import_zod2.z.array(askDraftCitationSchema).max(limits.maximumSources);
654
+ var draftParagraphBlockSchema = import_zod2.z.strictObject({
655
+ kind: import_zod2.z.literal("paragraph"),
656
+ text: contextualAskBoundedText(limits.maximumAnswerCharacters),
657
+ citations: draftCitationListSchema
658
+ });
659
+ var draftListBlockSchema = import_zod2.z.strictObject({
660
+ kind: import_zod2.z.literal("list"),
661
+ items: import_zod2.z.array(
662
+ import_zod2.z.strictObject({
663
+ text: contextualAskBoundedText(limits.maximumAnswerCharacters),
664
+ citations: draftCitationListSchema
665
+ })
666
+ ).min(1).max(limits.maximumAnswerBlocks)
667
+ });
668
+ var draftCodeBlockSchema = import_zod2.z.strictObject({
669
+ kind: import_zod2.z.literal("code"),
670
+ code: import_zod2.z.string().min(1).max(limits.maximumAnswerCharacters),
671
+ language: contextualAskBoundedText(limits.maximumLanguageCharacters).optional(),
672
+ citations: draftCitationListSchema
673
+ });
674
+ var askAnswerDraftBlockSchema = import_zod2.z.discriminatedUnion("kind", [
675
+ draftParagraphBlockSchema,
676
+ draftListBlockSchema,
677
+ draftCodeBlockSchema
678
+ ]);
679
+ function draftCharacters(blocks) {
680
+ return blocks.reduce((total, block) => {
681
+ if (block.kind === "paragraph") return total + block.text.length;
682
+ if (block.kind === "code") return total + block.code.length;
683
+ return total + block.items.reduce((itemTotal, item) => itemTotal + item.text.length, 0);
684
+ }, 0);
685
+ }
686
+ var askAnswerDraftSchema = import_zod2.z.strictObject({
687
+ blocks: import_zod2.z.array(askAnswerDraftBlockSchema).min(1).max(limits.maximumAnswerBlocks),
688
+ warnings: import_zod2.z.array(askExecutorAnswerWarningSchema).max(limits.maximumAnswerBlocks)
689
+ }).superRefine((answer, context) => {
690
+ if (draftCharacters(answer.blocks) > limits.maximumAnswerCharacters) {
691
+ context.addIssue({
692
+ code: "custom",
693
+ message: "Combined answer text exceeds the answer limit.",
694
+ path: ["blocks"]
695
+ });
696
+ }
697
+ const citations = answer.blocks.flatMap(
698
+ (block) => block.kind === "list" ? block.items.flatMap((item) => item.citations) : block.citations
699
+ );
700
+ if (citations.length === 0 && !answer.warnings.some((warning) => warning.code === "insufficient-evidence")) {
701
+ context.addIssue({
702
+ code: "custom",
703
+ message: "An uncited answer draft must declare insufficient evidence.",
704
+ path: ["warnings"]
705
+ });
706
+ }
707
+ const distinct = new Set(
708
+ citations.map(
709
+ (citation) => `${citation.handleId}:${String(citation.startLine)}:${String(citation.endLine)}`
710
+ )
711
+ );
712
+ if (distinct.size > limits.maximumSources) {
713
+ context.addIssue({
714
+ code: "custom",
715
+ message: "Answer references exceed the source limit.",
716
+ path: ["blocks"]
717
+ });
718
+ }
719
+ });
720
+ var sourceIdListSchema = import_zod2.z.array(contextualAskOpaqueIdSchema).max(limits.maximumSources);
721
+ var paragraphBlockSchema = import_zod2.z.strictObject({
722
+ kind: import_zod2.z.literal("paragraph"),
723
+ text: contextualAskBoundedText(limits.maximumAnswerCharacters),
724
+ sourceIds: sourceIdListSchema
725
+ });
726
+ var listBlockSchema = import_zod2.z.strictObject({
727
+ kind: import_zod2.z.literal("list"),
728
+ items: import_zod2.z.array(
729
+ import_zod2.z.strictObject({
730
+ text: contextualAskBoundedText(limits.maximumAnswerCharacters),
731
+ sourceIds: sourceIdListSchema
732
+ })
733
+ ).min(1).max(limits.maximumAnswerBlocks)
734
+ });
735
+ var codeBlockSchema = import_zod2.z.strictObject({
736
+ kind: import_zod2.z.literal("code"),
737
+ code: import_zod2.z.string().min(1).max(limits.maximumAnswerCharacters),
738
+ language: contextualAskBoundedText(limits.maximumLanguageCharacters).optional(),
739
+ sourceIds: sourceIdListSchema
740
+ });
741
+ var askAnswerBlockSchema = import_zod2.z.discriminatedUnion("kind", [
742
+ paragraphBlockSchema,
743
+ listBlockSchema,
744
+ codeBlockSchema
745
+ ]);
746
+ var askSourceReferenceSchema = import_zod2.z.strictObject({
747
+ sourceId: contextualAskOpaqueIdSchema,
748
+ label: contextualAskBoundedText(limits.maximumLabelCharacters),
749
+ relativePath: contextualAskRelativePathSchema,
750
+ fileId: contextualAskOpaqueIdSchema,
751
+ startLine: import_zod2.z.number().int().positive(),
752
+ endLine: import_zod2.z.number().int().positive(),
753
+ confidence: import_zod2.z.enum(ASK_SOURCE_CONFIDENCES),
754
+ targetIds: import_zod2.z.array(contextualAskOpaqueIdSchema).min(1).max(limits.maximumTargets),
755
+ sourceVersion: contextualAskBoundedText(limits.maximumIdCharacters).optional(),
756
+ contentHash: contentHashSchema
757
+ }).superRefine((source, context) => {
758
+ if (source.endLine < source.startLine) {
759
+ context.addIssue({
760
+ code: "custom",
761
+ message: "Source endLine must not precede startLine.",
762
+ path: ["endLine"]
763
+ });
764
+ }
765
+ if (new Set(source.targetIds).size !== source.targetIds.length) {
766
+ context.addIssue({
767
+ code: "custom",
768
+ message: "Source target IDs must be unique.",
769
+ path: ["targetIds"]
770
+ });
771
+ }
772
+ });
773
+ function resultBlockCharacters(blocks) {
774
+ return blocks.reduce((total, block) => {
775
+ if (block.kind === "paragraph") return total + block.text.length;
776
+ if (block.kind === "code") return total + block.code.length;
777
+ return total + block.items.reduce((itemTotal, item) => itemTotal + item.text.length, 0);
778
+ }, 0);
779
+ }
780
+ var askAnswerResultSchema = import_zod2.z.strictObject({
781
+ schemaVersion: import_zod2.z.literal(CONTEXTUAL_ASK_SCHEMA_VERSION),
782
+ jobId: contextualAskOpaqueIdSchema,
783
+ selectionId: contextualAskOpaqueIdSchema,
784
+ contextHash: contentHashSchema,
785
+ executor: import_zod2.z.strictObject({
786
+ executorId: contextualAskOpaqueIdSchema,
787
+ kind: import_zod2.z.enum(CONTEXTUAL_ASK_EXECUTOR_KINDS),
788
+ label: contextualAskBoundedText(limits.maximumLabelCharacters),
789
+ modelLabel: contextualAskBoundedText(limits.maximumLabelCharacters)
790
+ }),
791
+ blocks: import_zod2.z.array(askAnswerBlockSchema).min(1).max(limits.maximumAnswerBlocks),
792
+ sources: import_zod2.z.array(askSourceReferenceSchema).max(limits.maximumSources),
793
+ warnings: import_zod2.z.array(askAnswerWarningSchema).max(limits.maximumAnswerBlocks),
794
+ createdAt: import_zod2.z.iso.datetime(),
795
+ expiresAt: import_zod2.z.iso.datetime()
796
+ }).superRefine((answer, context) => {
797
+ if (Date.parse(answer.expiresAt) <= Date.parse(answer.createdAt)) {
798
+ context.addIssue({
799
+ code: "custom",
800
+ message: "Answer expiry must follow creation.",
801
+ path: ["expiresAt"]
802
+ });
803
+ }
804
+ if (resultBlockCharacters(answer.blocks) > limits.maximumAnswerCharacters) {
805
+ context.addIssue({
806
+ code: "custom",
807
+ message: "Combined answer text exceeds the answer limit.",
808
+ path: ["blocks"]
809
+ });
810
+ }
811
+ const sourceIds = answer.sources.map((source) => source.sourceId);
812
+ if (new Set(sourceIds).size !== sourceIds.length) {
813
+ context.addIssue({
814
+ code: "custom",
815
+ message: "Answer source IDs must be unique.",
816
+ path: ["sources"]
817
+ });
818
+ }
819
+ const available = new Set(sourceIds);
820
+ const references = answer.blocks.flatMap(
821
+ (block) => block.kind === "list" ? block.items.flatMap((item) => item.sourceIds) : block.sourceIds
822
+ );
823
+ if (references.length === 0 && !answer.warnings.some((warning) => warning.code === "insufficient-evidence")) {
824
+ context.addIssue({
825
+ code: "custom",
826
+ message: "An uncited answer must declare insufficient evidence.",
827
+ path: ["warnings"]
828
+ });
829
+ }
830
+ if (references.some((sourceId) => !available.has(sourceId))) {
831
+ context.addIssue({
832
+ code: "custom",
833
+ message: "Answer blocks reference an unknown source ID.",
834
+ path: ["blocks"]
835
+ });
836
+ }
837
+ if (sourceIds.some((sourceId) => !references.includes(sourceId))) {
838
+ context.addIssue({
839
+ code: "custom",
840
+ message: "Answer sources must be referenced by at least one block.",
841
+ path: ["sources"]
842
+ });
843
+ }
844
+ });
845
+ var contextualAskExecutorCapabilitySchema = import_zod2.z.strictObject({
846
+ executorId: contextualAskOpaqueIdSchema,
847
+ kind: import_zod2.z.enum(CONTEXTUAL_ASK_EXECUTOR_KINDS),
848
+ label: contextualAskBoundedText(limits.maximumLabelCharacters),
849
+ requestedModelLabel: contextualAskBoundedText(limits.maximumLabelCharacters),
850
+ effectiveModelLabel: contextualAskBoundedText(limits.maximumLabelCharacters),
851
+ state: import_zod2.z.enum(CONTEXTUAL_ASK_EXECUTOR_STATES),
852
+ providerDataConsentRequired: import_zod2.z.boolean(),
853
+ readOnlyProven: import_zod2.z.boolean(),
854
+ errorCode: import_zod2.z.enum(CONTEXTUAL_ASK_ERROR_CODES).optional()
855
+ }).superRefine((executor, context) => {
856
+ if (executor.state === "ready" && (!executor.readOnlyProven || executor.errorCode !== void 0) || executor.state !== "ready" && executor.errorCode === void 0) {
857
+ context.addIssue({
858
+ code: "custom",
859
+ message: "Executor capability fields are inconsistent."
860
+ });
861
+ }
862
+ });
863
+ var contextualAskCapabilitySchema = import_zod2.z.strictObject({
864
+ schemaVersion: import_zod2.z.literal(CONTEXTUAL_ASK_SCHEMA_VERSION),
865
+ enabled: import_zod2.z.boolean(),
866
+ executors: import_zod2.z.array(contextualAskExecutorCapabilitySchema).max(limits.maximumExecutors),
867
+ safety: import_zod2.z.strictObject({
868
+ selectionRequired: import_zod2.z.literal(true),
869
+ singleTurn: import_zod2.z.literal(true),
870
+ writesAllowed: import_zod2.z.literal(false),
871
+ historyStored: import_zod2.z.literal(false)
872
+ }),
873
+ checkedAt: import_zod2.z.iso.datetime()
874
+ }).superRefine((capability, context) => {
875
+ if (!capability.enabled && capability.executors.length > 0 || new Set(capability.executors.map((executor) => executor.executorId)).size !== capability.executors.length) {
876
+ context.addIssue({
877
+ code: "custom",
878
+ message: "Contextual Ask capability fields are inconsistent.",
879
+ path: ["executors"]
880
+ });
881
+ }
882
+ });
883
+
301
884
  // src/model/data-flow-adapters.ts
302
885
  var DATA_FLOW_QUERY_ADAPTER_MODULES = Object.freeze([
303
886
  "@tanstack/react-query",
@@ -341,7 +924,7 @@ var DATA_FLOW_TRPC_REQUEST_METHODS = Object.freeze([
341
924
  ]);
342
925
 
343
926
  // src/model/data-flow.ts
344
- var import_zod = require("zod");
927
+ var import_zod3 = require("zod");
345
928
 
346
929
  // src/model/data-flow-limits.ts
347
930
  var DEFAULT_DATA_FLOW_LIMITS = Object.freeze({
@@ -412,24 +995,24 @@ var DATA_FLOW_DIAGNOSTIC_CODES = Object.freeze([
412
995
  "DATA_FLOW_REDACTION_APPLIED",
413
996
  "DATA_FLOW_AI_DISABLED"
414
997
  ]);
415
- var boundedText = (maximum) => import_zod.z.string().trim().min(1).max(maximum);
998
+ var boundedText = (maximum) => import_zod3.z.string().trim().min(1).max(maximum);
416
999
  var opaqueIdSchema = boundedText(128).regex(/^[A-Za-z0-9_-]+$/u);
417
- var diagnosticCodeSchema = import_zod.z.enum(DATA_FLOW_DIAGNOSTIC_CODES);
418
- var evidenceSourceSchema = import_zod.z.strictObject({
1000
+ var diagnosticCodeSchema = import_zod3.z.enum(DATA_FLOW_DIAGNOSTIC_CODES);
1001
+ var evidenceSourceSchema = import_zod3.z.strictObject({
419
1002
  fileId: opaqueIdSchema,
420
1003
  displayPath: boundedText(1024),
421
- line: import_zod.z.number().int().positive(),
422
- column: import_zod.z.number().int().positive(),
1004
+ line: import_zod3.z.number().int().positive(),
1005
+ column: import_zod3.z.number().int().positive(),
423
1006
  sourceVersion: opaqueIdSchema
424
1007
  });
425
- var sanitizedObservedUrlSchema = import_zod.z.strictObject({
1008
+ var sanitizedObservedUrlSchema = import_zod3.z.strictObject({
426
1009
  origin: boundedText(512).optional(),
427
1010
  pathname: boundedText(2048),
428
- queryKeys: import_zod.z.array(boundedText(256)).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields)
1011
+ queryKeys: import_zod3.z.array(boundedText(256)).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields)
429
1012
  });
430
- var dataParameterSchema = import_zod.z.strictObject({
1013
+ var dataParameterSchema = import_zod3.z.strictObject({
431
1014
  path: boundedText(1024),
432
- position: import_zod.z.enum([
1015
+ position: import_zod3.z.enum([
433
1016
  "path",
434
1017
  "query",
435
1018
  "body",
@@ -442,34 +1025,34 @@ var dataParameterSchema = import_zod.z.strictObject({
442
1025
  type: boundedText(512).optional(),
443
1026
  source: boundedText(1024).optional(),
444
1027
  condition: boundedText(1024).optional(),
445
- sensitive: import_zod.z.boolean(),
446
- valueState: import_zod.z.literal("not-collected"),
447
- evidenceIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence)
1028
+ sensitive: import_zod3.z.boolean(),
1029
+ valueState: import_zod3.z.literal("not-collected"),
1030
+ evidenceIds: import_zod3.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence)
448
1031
  });
449
- var dataResponseSchema = import_zod.z.strictObject({
450
- consumedFields: import_zod.z.array(boundedText(1024)).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields)
1032
+ var dataResponseSchema = import_zod3.z.strictObject({
1033
+ consumedFields: import_zod3.z.array(boundedText(1024)).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields)
451
1034
  });
452
- var requestOriginSchema = import_zod.z.strictObject({
1035
+ var requestOriginSchema = import_zod3.z.strictObject({
453
1036
  componentSourceId: opaqueIdSchema.optional(),
454
1037
  triggerCallsiteId: opaqueIdSchema.optional(),
455
1038
  requestCallsiteId: opaqueIdSchema,
456
1039
  sourceVersion: opaqueIdSchema
457
1040
  });
458
- var capabilityReasonSchema = import_zod.z.strictObject({
1041
+ var capabilityReasonSchema = import_zod3.z.strictObject({
459
1042
  code: diagnosticCodeSchema,
460
- retryable: import_zod.z.boolean()
1043
+ retryable: import_zod3.z.boolean()
461
1044
  });
462
- var capabilitySchema = import_zod.z.strictObject({
463
- enabled: import_zod.z.boolean(),
464
- staticAnalysis: import_zod.z.enum(["available", "partial", "unavailable"]),
465
- runtimeObservation: import_zod.z.literal("dispatch-only"),
466
- responseShape: import_zod.z.literal("consumed-fields-only"),
467
- aiAssistance: import_zod.z.literal("disabled"),
468
- reasons: import_zod.z.array(capabilityReasonSchema).max(DEFAULT_DATA_FLOW_LIMITS.capabilityMaxReasons)
1045
+ var capabilitySchema = import_zod3.z.strictObject({
1046
+ enabled: import_zod3.z.boolean(),
1047
+ staticAnalysis: import_zod3.z.enum(["available", "partial", "unavailable"]),
1048
+ runtimeObservation: import_zod3.z.literal("dispatch-only"),
1049
+ responseShape: import_zod3.z.literal("consumed-fields-only"),
1050
+ aiAssistance: import_zod3.z.literal("disabled"),
1051
+ reasons: import_zod3.z.array(capabilityReasonSchema).max(DEFAULT_DATA_FLOW_LIMITS.capabilityMaxReasons)
469
1052
  });
470
- var evidenceSchema = import_zod.z.strictObject({
1053
+ var evidenceSchema = import_zod3.z.strictObject({
471
1054
  id: opaqueIdSchema,
472
- kind: import_zod.z.enum([
1055
+ kind: import_zod3.z.enum([
473
1056
  "source-anchor",
474
1057
  "import-resolution",
475
1058
  "symbol-edge",
@@ -482,49 +1065,49 @@ var evidenceSchema = import_zod.z.strictObject({
482
1065
  "diagnostic"
483
1066
  ]),
484
1067
  source: evidenceSourceSchema.optional(),
485
- adapter: import_zod.z.strictObject({ id: boundedText(128), version: boundedText(64) }).optional(),
1068
+ adapter: import_zod3.z.strictObject({ id: boundedText(128), version: boundedText(64) }).optional(),
486
1069
  summaryKey: boundedText(256)
487
1070
  });
488
- var diagnosticSchema = import_zod.z.strictObject({
1071
+ var diagnosticSchema = import_zod3.z.strictObject({
489
1072
  id: opaqueIdSchema,
490
1073
  code: diagnosticCodeSchema,
491
- severity: import_zod.z.enum(["info", "warning", "error"]),
492
- retryable: import_zod.z.boolean(),
493
- evidenceIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence)
1074
+ severity: import_zod3.z.enum(["info", "warning", "error"]),
1075
+ retryable: import_zod3.z.boolean(),
1076
+ evidenceIds: import_zod3.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence)
494
1077
  });
495
- var baselineSchema = import_zod.z.strictObject({
1078
+ var baselineSchema = import_zod3.z.strictObject({
496
1079
  registryEpoch: opaqueIdSchema,
497
1080
  analyzerVersion: boundedText(64),
498
1081
  adapterSetHash: boundedText(128),
499
- analyzedSourceVersions: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxModules)
1082
+ analyzedSourceVersions: import_zod3.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxModules)
500
1083
  });
501
- var completenessSchema = import_zod.z.strictObject({
502
- complete: import_zod.z.boolean(),
503
- visitedModules: import_zod.z.number().int().nonnegative(),
504
- visitedCallsites: import_zod.z.number().int().nonnegative(),
505
- frontierCount: import_zod.z.number().int().nonnegative(),
506
- truncatedBy: import_zod.z.enum(["depth", "modules", "callsites", "bytes", "timeout"]).optional()
1084
+ var completenessSchema = import_zod3.z.strictObject({
1085
+ complete: import_zod3.z.boolean(),
1086
+ visitedModules: import_zod3.z.number().int().nonnegative(),
1087
+ visitedCallsites: import_zod3.z.number().int().nonnegative(),
1088
+ frontierCount: import_zod3.z.number().int().nonnegative(),
1089
+ truncatedBy: import_zod3.z.enum(["depth", "modules", "callsites", "bytes", "timeout"]).optional()
507
1090
  });
508
- var dataDependencySchema = import_zod.z.strictObject({
1091
+ var dataDependencySchema = import_zod3.z.strictObject({
509
1092
  id: opaqueIdSchema,
510
- kind: import_zod.z.enum(["http", "graphql", "rpc", "server-action", "unknown"]),
511
- direction: import_zod.z.enum(["read", "write", "read-write", "unknown"]),
512
- execution: import_zod.z.enum(DATA_FLOW_EXECUTION_STATES),
513
- proof: import_zod.z.enum(DATA_FLOW_PROOF_STATES),
514
- association: import_zod.z.enum(DATA_FLOW_ASSOCIATION_KINDS),
1093
+ kind: import_zod3.z.enum(["http", "graphql", "rpc", "server-action", "unknown"]),
1094
+ direction: import_zod3.z.enum(["read", "write", "read-write", "unknown"]),
1095
+ execution: import_zod3.z.enum(DATA_FLOW_EXECUTION_STATES),
1096
+ proof: import_zod3.z.enum(DATA_FLOW_PROOF_STATES),
1097
+ association: import_zod3.z.enum(DATA_FLOW_ASSOCIATION_KINDS),
515
1098
  method: boundedText(32).optional(),
516
1099
  operation: boundedText(512).optional(),
517
1100
  url: sanitizedObservedUrlSchema.optional(),
518
- parameters: import_zod.z.array(dataParameterSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields),
1101
+ parameters: import_zod3.z.array(dataParameterSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields),
519
1102
  response: dataResponseSchema,
520
1103
  origin: requestOriginSchema.optional(),
521
- suppliedBindings: import_zod.z.array(boundedText(1024)).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
522
- locationIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
523
- evidenceIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence),
524
- observationIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.observationMaxEntries)
1104
+ suppliedBindings: import_zod3.z.array(boundedText(1024)).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
1105
+ locationIds: import_zod3.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
1106
+ evidenceIds: import_zod3.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence),
1107
+ observationIds: import_zod3.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.observationMaxEntries)
525
1108
  });
526
- var networkObservationSchema = import_zod.z.strictObject({
527
- schemaVersion: import_zod.z.literal(DATA_FLOW_SCHEMA_VERSION),
1109
+ var networkObservationSchema = import_zod3.z.strictObject({
1110
+ schemaVersion: import_zod3.z.literal(DATA_FLOW_SCHEMA_VERSION),
528
1111
  id: opaqueIdSchema,
529
1112
  pageEpoch: opaqueIdSchema,
530
1113
  routeEpoch: opaqueIdSchema,
@@ -533,48 +1116,48 @@ var networkObservationSchema = import_zod.z.strictObject({
533
1116
  componentSourceId: opaqueIdSchema.optional(),
534
1117
  triggerCallsiteId: opaqueIdSchema.optional(),
535
1118
  sourceVersion: opaqueIdSchema.optional(),
536
- transport: import_zod.z.enum(["fetch", "trpc", "xhr"]),
1119
+ transport: import_zod3.z.enum(["fetch", "trpc", "xhr"]),
537
1120
  method: boundedText(32),
538
1121
  operation: boundedText(512).optional(),
539
1122
  url: sanitizedObservedUrlSchema,
540
- outcome: import_zod.z.literal("dispatched"),
541
- freshness: import_zod.z.enum(DATA_FLOW_FRESHNESS_STATES),
542
- diagnosticIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence)
1123
+ outcome: import_zod3.z.literal("dispatched"),
1124
+ freshness: import_zod3.z.enum(DATA_FLOW_FRESHNESS_STATES),
1125
+ diagnosticIds: import_zod3.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence)
543
1126
  });
544
- var componentIdentitySchema = import_zod.z.strictObject({
1127
+ var componentIdentitySchema = import_zod3.z.strictObject({
545
1128
  componentSourceId: opaqueIdSchema.optional(),
546
1129
  displayName: boundedText(256).optional(),
547
1130
  source: evidenceSourceSchema
548
1131
  });
549
- var componentDataFlowReportSchema = import_zod.z.strictObject({
550
- schemaVersion: import_zod.z.literal(DATA_FLOW_SCHEMA_VERSION),
1132
+ var componentDataFlowReportSchema = import_zod3.z.strictObject({
1133
+ schemaVersion: import_zod3.z.literal(DATA_FLOW_SCHEMA_VERSION),
551
1134
  reportId: opaqueIdSchema,
552
1135
  baseline: baselineSchema,
553
1136
  capability: capabilitySchema,
554
1137
  component: componentIdentitySchema,
555
- dependencies: import_zod.z.array(dataDependencySchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
556
- evidence: import_zod.z.array(evidenceSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence),
557
- diagnostics: import_zod.z.array(diagnosticSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxDiagnostics),
1138
+ dependencies: import_zod3.z.array(dataDependencySchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
1139
+ evidence: import_zod3.z.array(evidenceSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence),
1140
+ diagnostics: import_zod3.z.array(diagnosticSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxDiagnostics),
558
1141
  completeness: completenessSchema
559
1142
  });
560
- var pageDataFlowReportSchema = import_zod.z.strictObject({
561
- schemaVersion: import_zod.z.literal(DATA_FLOW_SCHEMA_VERSION),
1143
+ var pageDataFlowReportSchema = import_zod3.z.strictObject({
1144
+ schemaVersion: import_zod3.z.literal(DATA_FLOW_SCHEMA_VERSION),
562
1145
  reportId: opaqueIdSchema,
563
1146
  baseline: baselineSchema,
564
1147
  capability: capabilitySchema,
565
- dependencies: import_zod.z.array(dataDependencySchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
566
- evidence: import_zod.z.array(evidenceSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence),
567
- diagnostics: import_zod.z.array(diagnosticSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxDiagnostics),
1148
+ dependencies: import_zod3.z.array(dataDependencySchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
1149
+ evidence: import_zod3.z.array(evidenceSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence),
1150
+ diagnostics: import_zod3.z.array(diagnosticSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxDiagnostics),
568
1151
  completeness: completenessSchema
569
1152
  });
570
- var runtimeDataFlowConfigSchema = import_zod.z.strictObject({
571
- enabled: import_zod.z.boolean(),
572
- runtime: import_zod.z.literal("dispatch"),
573
- limits: import_zod.z.strictObject({
574
- observationMaxEntries: import_zod.z.number().int().positive(),
575
- observationMaxBytes: import_zod.z.number().int().positive(),
576
- observationTtlMs: import_zod.z.number().int().positive(),
577
- reportMaxBytes: import_zod.z.number().int().positive()
1153
+ var runtimeDataFlowConfigSchema = import_zod3.z.strictObject({
1154
+ enabled: import_zod3.z.boolean(),
1155
+ runtime: import_zod3.z.literal("dispatch"),
1156
+ limits: import_zod3.z.strictObject({
1157
+ observationMaxEntries: import_zod3.z.number().int().positive(),
1158
+ observationMaxBytes: import_zod3.z.number().int().positive(),
1159
+ observationTtlMs: import_zod3.z.number().int().positive(),
1160
+ reportMaxBytes: import_zod3.z.number().int().positive()
578
1161
  })
579
1162
  });
580
1163
 
@@ -776,7 +1359,7 @@ function limitDataFlowReportCollections(report, options = {}) {
776
1359
  }
777
1360
 
778
1361
  // src/model/runtime-config.ts
779
- var import_zod2 = require("zod");
1362
+ var import_zod4 = require("zod");
780
1363
 
781
1364
  // src/protocol/endpoints.ts
782
1365
  var SPOTPATCH_API_BASE = "/__spotpatch/v1";
@@ -790,6 +1373,8 @@ var SPOTPATCH_ENDPOINTS = Object.freeze({
790
1373
  agentCapability: `${SPOTPATCH_API_BASE}/agent/capability`,
791
1374
  agentWorkspaceHealth: `${SPOTPATCH_API_BASE}/agent/workspace-health`,
792
1375
  agentJobs: `${SPOTPATCH_API_BASE}/agent/jobs`,
1376
+ askCapability: `${SPOTPATCH_API_BASE}/ask/capability`,
1377
+ askJobs: `${SPOTPATCH_API_BASE}/ask/jobs`,
793
1378
  externalHandoffCapability: `${SPOTPATCH_API_BASE}/external-handoff/capability`,
794
1379
  externalHandoffPublish: `${SPOTPATCH_API_BASE}/external-handoff/publish`,
795
1380
  externalHandoffStatus: `${SPOTPATCH_API_BASE}/external-handoff/status`,
@@ -804,6 +1389,17 @@ var SPOTPATCH_ENDPOINTS = Object.freeze({
804
1389
  function getAgentJobEndpoint(jobId, action) {
805
1390
  return `${SPOTPATCH_ENDPOINTS.agentJobs}/${encodeURIComponent(jobId)}/${action}`;
806
1391
  }
1392
+ function getAskJobEndpoint(jobId, action, options = {}) {
1393
+ const endpoint = `${SPOTPATCH_ENDPOINTS.askJobs}/${encodeURIComponent(jobId)}/${action}`;
1394
+ if (action !== "events" && options.afterSequence !== void 0) {
1395
+ throw new RangeError("afterSequence is only valid for the events endpoint.");
1396
+ }
1397
+ if (options.afterSequence === void 0) return endpoint;
1398
+ if (!Number.isSafeInteger(options.afterSequence) || options.afterSequence < 0) {
1399
+ throw new RangeError("afterSequence must be a non-negative safe integer.");
1400
+ }
1401
+ return `${endpoint}?afterSequence=${String(options.afterSequence)}`;
1402
+ }
807
1403
 
808
1404
  // src/model/editor.ts
809
1405
  var SPOTPATCH_EDITOR_PREFERENCES = ["auto", "vscode", "cursor"];
@@ -878,39 +1474,39 @@ var SPOTPATCH_NEXT_ROUTER_KINDS = Object.freeze([
878
1474
  "pages",
879
1475
  "hybrid"
880
1476
  ]);
881
- var boundedText2 = (maximum) => import_zod2.z.string().trim().min(1).max(maximum);
882
- var profileIdSchema = import_zod2.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/u);
883
- var runtimeAiModelSchema = import_zod2.z.strictObject({
884
- id: profileIdSchema,
1477
+ var boundedText2 = (maximum) => import_zod4.z.string().trim().min(1).max(maximum);
1478
+ var profileIdSchema2 = import_zod4.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/u);
1479
+ var runtimeAiModelSchema = import_zod4.z.strictObject({
1480
+ id: profileIdSchema2,
885
1481
  label: boundedText2(100)
886
1482
  });
887
- var runtimeAiProviderSchema = import_zod2.z.strictObject({
888
- id: profileIdSchema,
1483
+ var runtimeAiProviderSchema = import_zod4.z.strictObject({
1484
+ id: profileIdSchema2,
889
1485
  label: boundedText2(100),
890
- protocol: import_zod2.z.enum(["responses", "chat-completions"]),
891
- models: import_zod2.z.array(runtimeAiModelSchema).min(1).max(64),
892
- defaultModel: profileIdSchema
1486
+ protocol: import_zod4.z.enum(["responses", "chat-completions"]),
1487
+ models: import_zod4.z.array(runtimeAiModelSchema).min(1).max(64),
1488
+ defaultModel: profileIdSchema2
893
1489
  }).refine(
894
1490
  ({ defaultModel, models }) => models.some(({ id }) => id === defaultModel) && new Set(models.map(({ id }) => id)).size === models.length,
895
1491
  { message: "Runtime AI model profiles are inconsistent." }
896
1492
  );
897
- var runtimeAiConfigSchema = import_zod2.z.discriminatedUnion("enabled", [
898
- import_zod2.z.strictObject({ enabled: import_zod2.z.literal(false) }),
899
- import_zod2.z.strictObject({
900
- enabled: import_zod2.z.literal(true),
901
- providers: import_zod2.z.array(runtimeAiProviderSchema).min(1).max(32),
902
- defaultProvider: profileIdSchema,
903
- applyMode: import_zod2.z.enum(AGENT_APPLY_MODES)
1493
+ var runtimeAiConfigSchema = import_zod4.z.discriminatedUnion("enabled", [
1494
+ import_zod4.z.strictObject({ enabled: import_zod4.z.literal(false) }),
1495
+ import_zod4.z.strictObject({
1496
+ enabled: import_zod4.z.literal(true),
1497
+ providers: import_zod4.z.array(runtimeAiProviderSchema).min(1).max(32),
1498
+ defaultProvider: profileIdSchema2,
1499
+ applyMode: import_zod4.z.enum(AGENT_APPLY_MODES)
904
1500
  }).refine(
905
1501
  ({ defaultProvider, providers }) => providers.some(({ id }) => id === defaultProvider) && new Set(providers.map(({ id }) => id)).size === providers.length,
906
1502
  { message: "Runtime AI provider profiles are inconsistent." }
907
1503
  )
908
1504
  ]);
909
- var positiveInteger = import_zod2.z.number().int().positive();
1505
+ var positiveInteger = import_zod4.z.number().int().positive();
910
1506
  var runtimeConfigBaseShape = {
911
- apiBase: import_zod2.z.literal(SPOTPATCH_API_BASE),
1507
+ apiBase: import_zod4.z.literal(SPOTPATCH_API_BASE),
912
1508
  ai: runtimeAiConfigSchema,
913
- budget: import_zod2.z.strictObject({
1509
+ budget: import_zod4.z.strictObject({
914
1510
  totalCharacters: positiveInteger,
915
1511
  domCharacters: positiveInteger,
916
1512
  cssCharacters: positiveInteger,
@@ -918,29 +1514,30 @@ var runtimeConfigBaseShape = {
918
1514
  maxCodeLines: positiveInteger,
919
1515
  maxComponentDepth: positiveInteger
920
1516
  }),
921
- debug: import_zod2.z.boolean(),
1517
+ contextualAsk: import_zod4.z.strictObject({ enabled: import_zod4.z.boolean() }),
1518
+ debug: import_zod4.z.boolean(),
922
1519
  dataFlow: runtimeDataFlowConfigSchema,
923
- editor: import_zod2.z.enum(SPOTPATCH_EDITOR_PREFERENCES),
924
- externalAgent: import_zod2.z.strictObject({ enabled: import_zod2.z.boolean() }),
1520
+ editor: import_zod4.z.enum(SPOTPATCH_EDITOR_PREFERENCES),
1521
+ externalAgent: import_zod4.z.strictObject({ enabled: import_zod4.z.boolean() }),
925
1522
  frameworkVersion: boundedText2(64),
926
- locale: import_zod2.z.enum(SPOTPATCH_LOCALE_PREFERENCES),
927
- maxTargets: import_zod2.z.number().int().min(1).max(MAX_ANNOTATION_TARGETS),
928
- redact: import_zod2.z.boolean(),
929
- sessionId: import_zod2.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
930
- sessionToken: import_zod2.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
1523
+ locale: import_zod4.z.enum(SPOTPATCH_LOCALE_PREFERENCES),
1524
+ maxTargets: import_zod4.z.number().int().min(1).max(MAX_ANNOTATION_TARGETS),
1525
+ redact: import_zod4.z.boolean(),
1526
+ sessionId: import_zod4.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
1527
+ sessionToken: import_zod4.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
931
1528
  shortcut: boundedText2(128),
932
1529
  spotPatchVersion: boundedText2(64)
933
1530
  };
934
- var runtimeConfigSchema = import_zod2.z.discriminatedUnion("framework", [
935
- import_zod2.z.strictObject({
1531
+ var runtimeConfigSchema = import_zod4.z.discriminatedUnion("framework", [
1532
+ import_zod4.z.strictObject({
936
1533
  ...runtimeConfigBaseShape,
937
- framework: import_zod2.z.literal("vite")
1534
+ framework: import_zod4.z.literal("vite")
938
1535
  }),
939
- import_zod2.z.strictObject({
1536
+ import_zod4.z.strictObject({
940
1537
  ...runtimeConfigBaseShape,
941
- bundler: import_zod2.z.enum(SPOTPATCH_NEXT_BUNDLERS),
942
- framework: import_zod2.z.literal("next"),
943
- routerKind: import_zod2.z.enum(SPOTPATCH_NEXT_ROUTER_KINDS)
1538
+ bundler: import_zod4.z.enum(SPOTPATCH_NEXT_BUNDLERS),
1539
+ framework: import_zod4.z.literal("next"),
1540
+ routerKind: import_zod4.z.enum(SPOTPATCH_NEXT_ROUTER_KINDS)
944
1541
  })
945
1542
  ]);
946
1543
 
@@ -968,7 +1565,7 @@ function parseSourceMarker(value) {
968
1565
  }
969
1566
 
970
1567
  // src/protocol/external-agent-control.ts
971
- var import_zod3 = require("zod");
1568
+ var import_zod5 = require("zod");
972
1569
  var EXTERNAL_AGENT_CONTROL_SCHEMA_VERSION = 1;
973
1570
  var EXTERNAL_AGENT_MANAGED_ADAPTER_KINDS = Object.freeze(["codex"]);
974
1571
  var EXTERNAL_AGENT_MODES = Object.freeze(["inbox", "managed"]);
@@ -1093,9 +1690,9 @@ var EXTERNAL_AGENT_CONTROL_LIMITS = Object.freeze({
1093
1690
  maximumEventLineBytes: 64 * 1024,
1094
1691
  maximumResultDiffBytes: DEFAULT_AGENT_LIMITS.maxDiffBytes
1095
1692
  });
1096
- var isoTimestampSchema = import_zod3.z.iso.datetime();
1097
- var requestIdSchema = import_zod3.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u);
1098
- var safeRelativePathSchema = import_zod3.z.string().min(1).max(4096).superRefine((value, context) => {
1693
+ var isoTimestampSchema = import_zod5.z.iso.datetime();
1694
+ var requestIdSchema = import_zod5.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u);
1695
+ var safeRelativePathSchema = import_zod5.z.string().min(1).max(4096).superRefine((value, context) => {
1099
1696
  const segments = value.split("/");
1100
1697
  if (value.startsWith("/") || value.includes("\\") || segments.some(
1101
1698
  (segment) => segment.length === 0 || segment === "." || segment === ".."
@@ -1103,237 +1700,150 @@ var safeRelativePathSchema = import_zod3.z.string().min(1).max(4096).superRefine
1103
1700
  context.addIssue({ code: "custom", message: "Expected a safe relative path." });
1104
1701
  }
1105
1702
  });
1106
- var externalAgentErrorSchema = import_zod3.z.strictObject({
1107
- code: import_zod3.z.enum(EXTERNAL_AGENT_ERROR_CODES),
1108
- stage: import_zod3.z.enum(EXTERNAL_AGENT_ERROR_STAGES),
1109
- recoverability: import_zod3.z.enum(EXTERNAL_AGENT_ERROR_RECOVERABILITY),
1110
- action: import_zod3.z.enum(EXTERNAL_AGENT_ACTIONS)
1703
+ var externalAgentErrorSchema = import_zod5.z.strictObject({
1704
+ code: import_zod5.z.enum(EXTERNAL_AGENT_ERROR_CODES),
1705
+ stage: import_zod5.z.enum(EXTERNAL_AGENT_ERROR_STAGES),
1706
+ recoverability: import_zod5.z.enum(EXTERNAL_AGENT_ERROR_RECOVERABILITY),
1707
+ action: import_zod5.z.enum(EXTERNAL_AGENT_ACTIONS)
1111
1708
  });
1112
- var managedFileSummarySchema = import_zod3.z.strictObject({
1709
+ var managedFileSummarySchema = import_zod5.z.strictObject({
1113
1710
  path: safeRelativePathSchema,
1114
- additions: import_zod3.z.number().int().nonnegative(),
1115
- deletions: import_zod3.z.number().int().nonnegative()
1116
- });
1117
- var managedCheckSummarySchema = import_zod3.z.strictObject({
1118
- id: import_zod3.z.string().min(1).max(128).regex(/^[A-Za-z0-9._-]+$/u),
1119
- outcome: import_zod3.z.enum(EXTERNAL_AGENT_CHECK_OUTCOMES),
1120
- durationMs: import_zod3.z.number().int().nonnegative(),
1121
- exitCode: import_zod3.z.number().int().optional()
1122
- });
1123
- var managedTimingSummarySchema = import_zod3.z.strictObject({
1124
- preparing: import_zod3.z.number().int().nonnegative().optional(),
1125
- agent: import_zod3.z.number().int().nonnegative().optional(),
1126
- auditing: import_zod3.z.number().int().nonnegative().optional(),
1127
- validating: import_zod3.z.number().int().nonnegative().optional(),
1128
- applying: import_zod3.z.number().int().nonnegative().optional(),
1129
- total: import_zod3.z.number().int().nonnegative().optional()
1130
- });
1131
- var managedTaskStatusSchema = import_zod3.z.strictObject({
1132
- revision: import_zod3.z.number().int().positive(),
1133
- deliveryStatus: import_zod3.z.enum(EXTERNAL_AGENT_DELIVERY_STATUSES),
1134
- executionStatus: import_zod3.z.enum(EXTERNAL_AGENT_EXECUTION_STATUSES),
1135
- managedPhase: import_zod3.z.enum(EXTERNAL_AGENT_MANAGED_PHASES),
1136
- validationOutcome: import_zod3.z.enum(EXTERNAL_AGENT_VALIDATION_OUTCOMES).optional(),
1137
- files: import_zod3.z.array(managedFileSummarySchema).max(EXTERNAL_AGENT_CONTROL_LIMITS.maximumChangedFiles),
1138
- checks: import_zod3.z.array(managedCheckSummarySchema).max(EXTERNAL_AGENT_CONTROL_LIMITS.maximumChecks),
1711
+ additions: import_zod5.z.number().int().nonnegative(),
1712
+ deletions: import_zod5.z.number().int().nonnegative()
1713
+ });
1714
+ var managedCheckSummarySchema = import_zod5.z.strictObject({
1715
+ id: import_zod5.z.string().min(1).max(128).regex(/^[A-Za-z0-9._-]+$/u),
1716
+ outcome: import_zod5.z.enum(EXTERNAL_AGENT_CHECK_OUTCOMES),
1717
+ durationMs: import_zod5.z.number().int().nonnegative(),
1718
+ exitCode: import_zod5.z.number().int().optional()
1719
+ });
1720
+ var managedTimingSummarySchema = import_zod5.z.strictObject({
1721
+ preparing: import_zod5.z.number().int().nonnegative().optional(),
1722
+ agent: import_zod5.z.number().int().nonnegative().optional(),
1723
+ auditing: import_zod5.z.number().int().nonnegative().optional(),
1724
+ validating: import_zod5.z.number().int().nonnegative().optional(),
1725
+ applying: import_zod5.z.number().int().nonnegative().optional(),
1726
+ total: import_zod5.z.number().int().nonnegative().optional()
1727
+ });
1728
+ var managedTaskStatusSchema = import_zod5.z.strictObject({
1729
+ revision: import_zod5.z.number().int().positive(),
1730
+ deliveryStatus: import_zod5.z.enum(EXTERNAL_AGENT_DELIVERY_STATUSES),
1731
+ executionStatus: import_zod5.z.enum(EXTERNAL_AGENT_EXECUTION_STATUSES),
1732
+ managedPhase: import_zod5.z.enum(EXTERNAL_AGENT_MANAGED_PHASES),
1733
+ validationOutcome: import_zod5.z.enum(EXTERNAL_AGENT_VALIDATION_OUTCOMES).optional(),
1734
+ files: import_zod5.z.array(managedFileSummarySchema).max(EXTERNAL_AGENT_CONTROL_LIMITS.maximumChangedFiles),
1735
+ checks: import_zod5.z.array(managedCheckSummarySchema).max(EXTERNAL_AGENT_CONTROL_LIMITS.maximumChecks),
1139
1736
  timings: managedTimingSummarySchema,
1140
1737
  resultExpiresAt: isoTimestampSchema.optional()
1141
1738
  });
1142
- var externalAgentControlStatusSchema = import_zod3.z.strictObject({
1143
- schemaVersion: import_zod3.z.literal(EXTERNAL_AGENT_CONTROL_SCHEMA_VERSION),
1144
- sequence: import_zod3.z.number().int().nonnegative(),
1145
- mode: import_zod3.z.enum(EXTERNAL_AGENT_MODES),
1146
- adapter: import_zod3.z.strictObject({
1147
- kind: import_zod3.z.enum(EXTERNAL_AGENT_MANAGED_ADAPTER_KINDS),
1148
- maturity: import_zod3.z.literal("experimental"),
1149
- availability: import_zod3.z.enum(["available", "unavailable"])
1739
+ var externalAgentControlStatusSchema = import_zod5.z.strictObject({
1740
+ schemaVersion: import_zod5.z.literal(EXTERNAL_AGENT_CONTROL_SCHEMA_VERSION),
1741
+ sequence: import_zod5.z.number().int().nonnegative(),
1742
+ mode: import_zod5.z.enum(EXTERNAL_AGENT_MODES),
1743
+ adapter: import_zod5.z.strictObject({
1744
+ kind: import_zod5.z.enum(EXTERNAL_AGENT_MANAGED_ADAPTER_KINDS),
1745
+ maturity: import_zod5.z.literal("experimental"),
1746
+ availability: import_zod5.z.enum(["available", "unavailable"])
1150
1747
  }),
1151
- connectionState: import_zod3.z.enum(EXTERNAL_AGENT_CONNECTION_STATES),
1152
- authReadiness: import_zod3.z.enum(EXTERNAL_AGENT_AUTH_READINESS),
1153
- grantState: import_zod3.z.enum(EXTERNAL_AGENT_GRANT_STATES),
1154
- requestedModel: import_zod3.z.string().min(1).max(128).optional(),
1155
- effectiveModel: import_zod3.z.string().min(1).max(128).optional(),
1748
+ connectionState: import_zod5.z.enum(EXTERNAL_AGENT_CONNECTION_STATES),
1749
+ authReadiness: import_zod5.z.enum(EXTERNAL_AGENT_AUTH_READINESS),
1750
+ grantState: import_zod5.z.enum(EXTERNAL_AGENT_GRANT_STATES),
1751
+ requestedModel: import_zod5.z.string().min(1).max(128).optional(),
1752
+ effectiveModel: import_zod5.z.string().min(1).max(128).optional(),
1156
1753
  task: managedTaskStatusSchema.optional(),
1157
1754
  error: externalAgentErrorSchema.optional(),
1158
1755
  updatedAt: isoTimestampSchema
1159
1756
  });
1160
- var externalAgentControlStatusRequestSchema = import_zod3.z.strictObject({});
1161
- var externalAgentControlConnectRequestSchema = import_zod3.z.strictObject({
1757
+ var externalAgentControlStatusRequestSchema = import_zod5.z.strictObject({});
1758
+ var externalAgentControlConnectRequestSchema = import_zod5.z.strictObject({
1162
1759
  requestId: requestIdSchema,
1163
- adapterKind: import_zod3.z.literal("codex"),
1164
- profile: import_zod3.z.literal(EXTERNAL_AGENT_MANAGED_PROFILE)
1760
+ adapterKind: import_zod5.z.literal("codex"),
1761
+ profile: import_zod5.z.literal(EXTERNAL_AGENT_MANAGED_PROFILE)
1165
1762
  });
1166
- var externalAgentControlDisconnectRequestSchema = import_zod3.z.strictObject({
1763
+ var externalAgentControlDisconnectRequestSchema = import_zod5.z.strictObject({
1167
1764
  requestId: requestIdSchema,
1168
- adapterKind: import_zod3.z.literal("codex"),
1169
- revokeGrant: import_zod3.z.boolean()
1765
+ adapterKind: import_zod5.z.literal("codex"),
1766
+ revokeGrant: import_zod5.z.boolean()
1170
1767
  });
1171
- var externalAgentControlCancelRequestSchema = import_zod3.z.strictObject({
1768
+ var externalAgentControlCancelRequestSchema = import_zod5.z.strictObject({
1172
1769
  requestId: requestIdSchema,
1173
- revision: import_zod3.z.number().int().positive()
1770
+ revision: import_zod5.z.number().int().positive()
1174
1771
  });
1175
- var externalAgentEventsRequestSchema = import_zod3.z.strictObject({
1176
- afterSequence: import_zod3.z.number().int().nonnegative().optional()
1772
+ var externalAgentEventsRequestSchema = import_zod5.z.strictObject({
1773
+ afterSequence: import_zod5.z.number().int().nonnegative().optional()
1177
1774
  });
1178
- var externalAgentEventSchema = import_zod3.z.discriminatedUnion("type", [
1179
- import_zod3.z.strictObject({
1180
- type: import_zod3.z.literal("status"),
1775
+ var externalAgentEventSchema = import_zod5.z.discriminatedUnion("type", [
1776
+ import_zod5.z.strictObject({
1777
+ type: import_zod5.z.literal("status"),
1181
1778
  data: externalAgentControlStatusSchema
1182
1779
  }),
1183
- import_zod3.z.strictObject({
1184
- type: import_zod3.z.literal("heartbeat"),
1185
- sequence: import_zod3.z.number().int().nonnegative(),
1780
+ import_zod5.z.strictObject({
1781
+ type: import_zod5.z.literal("heartbeat"),
1782
+ sequence: import_zod5.z.number().int().nonnegative(),
1186
1783
  emittedAt: isoTimestampSchema
1187
1784
  })
1188
1785
  ]);
1189
- var externalAgentResultRequestSchema = import_zod3.z.strictObject({
1190
- revision: import_zod3.z.number().int().positive()
1191
- });
1192
- var externalAgentManagedResultSchema = import_zod3.z.strictObject({
1193
- revision: import_zod3.z.number().int().positive(),
1194
- diff: import_zod3.z.string().max(EXTERNAL_AGENT_CONTROL_LIMITS.maximumResultDiffBytes),
1195
- files: import_zod3.z.array(managedFileSummarySchema).max(EXTERNAL_AGENT_CONTROL_LIMITS.maximumChangedFiles),
1196
- checks: import_zod3.z.array(managedCheckSummarySchema).max(EXTERNAL_AGENT_CONTROL_LIMITS.maximumChecks),
1786
+ var externalAgentResultRequestSchema = import_zod5.z.strictObject({
1787
+ revision: import_zod5.z.number().int().positive()
1788
+ });
1789
+ var externalAgentManagedResultSchema = import_zod5.z.strictObject({
1790
+ revision: import_zod5.z.number().int().positive(),
1791
+ diff: import_zod5.z.string().max(EXTERNAL_AGENT_CONTROL_LIMITS.maximumResultDiffBytes),
1792
+ files: import_zod5.z.array(managedFileSummarySchema).max(EXTERNAL_AGENT_CONTROL_LIMITS.maximumChangedFiles),
1793
+ checks: import_zod5.z.array(managedCheckSummarySchema).max(EXTERNAL_AGENT_CONTROL_LIMITS.maximumChecks),
1197
1794
  timings: managedTimingSummarySchema,
1198
- validationOutcome: import_zod3.z.enum(EXTERNAL_AGENT_VALIDATION_OUTCOMES),
1795
+ validationOutcome: import_zod5.z.enum(EXTERNAL_AGENT_VALIDATION_OUTCOMES),
1199
1796
  expiresAt: isoTimestampSchema
1200
1797
  });
1201
1798
 
1202
1799
  // src/protocol/external-handoff.ts
1203
- var import_zod5 = require("zod");
1800
+ var import_zod7 = require("zod");
1204
1801
 
1205
1802
  // src/protocol/requests.ts
1206
- var import_zod4 = require("zod");
1207
- var runtimeBootstrapRequestSchema = import_zod4.z.strictObject({});
1208
- var sourceCoordinatesSchema = import_zod4.z.strictObject({
1209
- fileId: import_zod4.z.string().min(1).max(128),
1210
- line: import_zod4.z.number().int().positive(),
1211
- column: import_zod4.z.number().int().positive()
1803
+ var import_zod6 = require("zod");
1804
+ var runtimeBootstrapRequestSchema = import_zod6.z.strictObject({});
1805
+ var sourceCoordinatesSchema = import_zod6.z.strictObject({
1806
+ fileId: import_zod6.z.string().min(1).max(128),
1807
+ line: import_zod6.z.number().int().positive(),
1808
+ column: import_zod6.z.number().int().positive()
1212
1809
  });
1213
1810
  var sourceContextRequestSchema = sourceCoordinatesSchema.extend({
1214
- maxLines: import_zod4.z.number().int().positive()
1811
+ maxLines: import_zod6.z.number().int().positive()
1215
1812
  }).strict();
1216
1813
  var openEditorRequestSchema = sourceCoordinatesSchema.strict();
1217
1814
  var dataFlowSourceCoordinatesRequestSchema = sourceCoordinatesSchema.extend({
1218
- schemaVersion: import_zod4.z.literal(1),
1219
- sourceVersion: import_zod4.z.string().min(1).max(128).optional()
1815
+ schemaVersion: import_zod6.z.literal(1),
1816
+ sourceVersion: import_zod6.z.string().min(1).max(128).optional()
1220
1817
  }).strict();
1221
- var dataFlowComponentIdentityRequestSchema = import_zod4.z.strictObject({
1222
- schemaVersion: import_zod4.z.literal(1),
1223
- componentSourceId: import_zod4.z.string().min(1).max(128),
1224
- sourceVersion: import_zod4.z.string().min(1).max(128)
1818
+ var dataFlowComponentIdentityRequestSchema = import_zod6.z.strictObject({
1819
+ schemaVersion: import_zod6.z.literal(1),
1820
+ componentSourceId: import_zod6.z.string().min(1).max(128),
1821
+ sourceVersion: import_zod6.z.string().min(1).max(128)
1225
1822
  });
1226
- var dataFlowComponentReportRequestSchema = import_zod4.z.union([
1823
+ var dataFlowComponentReportRequestSchema = import_zod6.z.union([
1227
1824
  dataFlowSourceCoordinatesRequestSchema,
1228
1825
  dataFlowComponentIdentityRequestSchema
1229
1826
  ]);
1230
- var dataFlowPageReportRequestSchema = import_zod4.z.strictObject({
1231
- schemaVersion: import_zod4.z.literal(1),
1232
- targets: import_zod4.z.array(dataFlowComponentReportRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS)
1233
- });
1234
- var profileIdSchema2 = import_zod4.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
1235
- var boundedString = (maximum) => import_zod4.z.string().max(maximum);
1236
- var sourceRefSchema = import_zod4.z.strictObject({
1237
- fileId: boundedString(128).optional(),
1238
- relativePath: boundedString(1024).optional(),
1239
- line: import_zod4.z.number().int().positive().optional(),
1240
- column: import_zod4.z.number().int().positive().optional(),
1241
- origin: import_zod4.z.enum(["jsx-host", "react-fiber", "dom-ancestor", "none"]),
1242
- confidence: import_zod4.z.enum(["exact", "probable", "approximate", "unknown"])
1243
- });
1244
- var matchedStyleRuleSchema = import_zod4.z.strictObject({
1245
- selector: boundedString(2048),
1246
- declarations: boundedString(8192),
1247
- source: boundedString(1024).optional(),
1248
- media: boundedString(1024).optional()
1249
- });
1250
- var codeContextSchema = import_zod4.z.strictObject({
1251
- relativePath: boundedString(1024),
1252
- language: import_zod4.z.enum(["tsx", "jsx"]),
1253
- startLine: import_zod4.z.number().int().positive(),
1254
- endLine: import_zod4.z.number().int().positive(),
1255
- excerpt: boundedString(16e3),
1256
- boundary: import_zod4.z.enum(["component", "nearby-lines"])
1827
+ var dataFlowPageReportRequestSchema = import_zod6.z.strictObject({
1828
+ schemaVersion: import_zod6.z.literal(1),
1829
+ targets: import_zod6.z.array(dataFlowComponentReportRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS)
1257
1830
  });
1258
- var pageContextSchema = import_zod4.z.strictObject({
1259
- url: boundedString(2048),
1260
- pathname: boundedString(2048),
1261
- title: boundedString(1024),
1262
- viewportWidth: import_zod4.z.number().nonnegative(),
1263
- viewportHeight: import_zod4.z.number().nonnegative(),
1264
- devicePixelRatio: import_zod4.z.number().positive()
1265
- });
1266
- var spotTargetContextRequestSchema = import_zod4.z.strictObject({
1267
- instruction: import_zod4.z.string().trim().min(1).max(MAX_TARGET_INSTRUCTION_CHARACTERS),
1268
- page: pageContextSchema.optional(),
1269
- source: sourceRefSchema,
1270
- react: import_zod4.z.strictObject({
1271
- supported: import_zod4.z.boolean(),
1272
- version: boundedString(64).optional(),
1273
- componentName: boundedString(256).optional(),
1274
- componentSourceId: boundedString(128).optional(),
1275
- sourceVersion: boundedString(128).optional(),
1276
- componentStack: import_zod4.z.array(boundedString(256)).max(64),
1277
- source: sourceRefSchema.optional()
1278
- }),
1279
- element: import_zod4.z.strictObject({
1280
- tagName: boundedString(128),
1281
- selector: boundedString(2048),
1282
- sanitizedHtml: boundedString(8192),
1283
- textPreview: boundedString(2048).optional(),
1284
- role: boundedString(256).optional(),
1285
- rect: import_zod4.z.strictObject({
1286
- x: import_zod4.z.number(),
1287
- y: import_zod4.z.number(),
1288
- width: import_zod4.z.number().nonnegative(),
1289
- height: import_zod4.z.number().nonnegative()
1290
- })
1291
- }),
1292
- styles: import_zod4.z.strictObject({
1293
- classNames: import_zod4.z.array(boundedString(512)).max(256),
1294
- inlineStyle: boundedString(8192).optional(),
1295
- matchedRules: import_zod4.z.array(matchedStyleRuleSchema).max(256),
1296
- computed: import_zod4.z.record(boundedString(256), boundedString(2048)),
1297
- warnings: import_zod4.z.array(boundedString(1024)).max(64)
1298
- }),
1299
- code: codeContextSchema.optional(),
1300
- warnings: import_zod4.z.array(boundedString(1024)).max(64)
1831
+ var profileIdSchema3 = import_zod6.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
1832
+ var agentCapabilityRequestSchema = import_zod6.z.strictObject({
1833
+ providerProfileId: profileIdSchema3,
1834
+ modelProfileId: profileIdSchema3
1301
1835
  });
1302
- var spotAnnotationRequestSchema = import_zod4.z.strictObject({
1303
- schemaVersion: import_zod4.z.literal(3),
1304
- id: boundedString(128),
1305
- locale: import_zod4.z.enum(SPOTPATCH_LOCALES),
1306
- page: pageContextSchema,
1307
- targets: import_zod4.z.array(spotTargetContextRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS),
1308
- createdAt: import_zod4.z.iso.datetime()
1309
- }).superRefine((annotation, context) => {
1310
- const total = annotation.targets.reduce(
1311
- (characters, target) => characters + target.instruction.length,
1312
- 0
1313
- );
1314
- if (total > MAX_ANNOTATION_INSTRUCTION_CHARACTERS) {
1315
- context.addIssue({
1316
- code: "custom",
1317
- message: "Combined target instructions exceed the annotation limit.",
1318
- path: ["targets"]
1319
- });
1320
- }
1836
+ var agentWorkspaceHealthRequestSchema = import_zod6.z.strictObject({});
1837
+ var agentJobCreateRequestSchema = import_zod6.z.strictObject({
1838
+ annotation: spotAnnotationSchema,
1839
+ applyMode: import_zod6.z.enum(AGENT_APPLY_MODES).optional(),
1840
+ providerProfileId: profileIdSchema3,
1841
+ modelProfileId: profileIdSchema3,
1842
+ providerDataConsent: import_zod6.z.literal(true),
1843
+ trustedFastModeConsent: import_zod6.z.literal(true).optional(),
1844
+ workingTreeMode: import_zod6.z.enum(["require-clean", "include-local-changes"]).default("require-clean")
1321
1845
  });
1322
- var agentCapabilityRequestSchema = import_zod4.z.strictObject({
1323
- providerProfileId: profileIdSchema2,
1324
- modelProfileId: profileIdSchema2
1325
- });
1326
- var agentWorkspaceHealthRequestSchema = import_zod4.z.strictObject({});
1327
- var agentJobCreateRequestSchema = import_zod4.z.strictObject({
1328
- annotation: spotAnnotationRequestSchema,
1329
- applyMode: import_zod4.z.enum(AGENT_APPLY_MODES).optional(),
1330
- providerProfileId: profileIdSchema2,
1331
- modelProfileId: profileIdSchema2,
1332
- providerDataConsent: import_zod4.z.literal(true),
1333
- trustedFastModeConsent: import_zod4.z.literal(true).optional(),
1334
- workingTreeMode: import_zod4.z.enum(["require-clean", "include-local-changes"]).default("require-clean")
1335
- });
1336
- var agentJobActionRequestSchema = import_zod4.z.strictObject({});
1846
+ var agentJobActionRequestSchema = import_zod6.z.strictObject({});
1337
1847
 
1338
1848
  // src/protocol/external-handoff-constants.ts
1339
1849
  var EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION = 1;
@@ -1399,44 +1909,44 @@ var EXTERNAL_HANDOFF_LIMITS = Object.freeze({
1399
1909
  });
1400
1910
 
1401
1911
  // src/protocol/external-handoff.ts
1402
- var opaqueIdSchema2 = import_zod5.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u);
1403
- var isoTimestampSchema2 = import_zod5.z.iso.datetime();
1404
- var externalHandoffReportableDispatchPhaseSchema = import_zod5.z.enum(
1912
+ var opaqueIdSchema2 = import_zod7.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u);
1913
+ var isoTimestampSchema2 = import_zod7.z.iso.datetime();
1914
+ var externalHandoffReportableDispatchPhaseSchema = import_zod7.z.enum(
1405
1915
  EXTERNAL_HANDOFF_REPORTABLE_DISPATCH_PHASES
1406
1916
  );
1407
- var externalHandoffPageSummarySchema = import_zod5.z.strictObject({
1408
- origin: import_zod5.z.string().min(1).max(2048),
1409
- pathname: import_zod5.z.string().min(1).max(2048)
1917
+ var externalHandoffPageSummarySchema = import_zod7.z.strictObject({
1918
+ origin: import_zod7.z.string().min(1).max(2048),
1919
+ pathname: import_zod7.z.string().min(1).max(2048)
1410
1920
  });
1411
- var externalHandoffSummarySchema = import_zod5.z.strictObject({
1921
+ var externalHandoffSummarySchema = import_zod7.z.strictObject({
1412
1922
  sessionId: opaqueIdSchema2,
1413
- framework: import_zod5.z.enum(EXTERNAL_HANDOFF_FRAMEWORKS),
1414
- revision: import_zod5.z.number().int().positive(),
1923
+ framework: import_zod7.z.enum(EXTERNAL_HANDOFF_FRAMEWORKS),
1924
+ revision: import_zod7.z.number().int().positive(),
1415
1925
  cursor: opaqueIdSchema2,
1416
- targetCount: import_zod5.z.number().int().positive(),
1926
+ targetCount: import_zod7.z.number().int().positive(),
1417
1927
  page: externalHandoffPageSummarySchema,
1418
1928
  publishedAt: isoTimestampSchema2,
1419
1929
  expiresAt: isoTimestampSchema2,
1420
- state: import_zod5.z.enum(EXTERNAL_HANDOFF_STATES),
1421
- pickupCount: import_zod5.z.number().int().nonnegative().max(EXTERNAL_HANDOFF_LIMITS.maximumConnectorReceipts),
1930
+ state: import_zod7.z.enum(EXTERNAL_HANDOFF_STATES),
1931
+ pickupCount: import_zod7.z.number().int().nonnegative().max(EXTERNAL_HANDOFF_LIMITS.maximumConnectorReceipts),
1422
1932
  pickedUpAt: isoTimestampSchema2.optional()
1423
1933
  });
1424
- var externalHandoffSnapshotSchema = import_zod5.z.strictObject({
1425
- schemaVersion: import_zod5.z.literal(EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION),
1934
+ var externalHandoffSnapshotSchema = import_zod7.z.strictObject({
1935
+ schemaVersion: import_zod7.z.literal(EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION),
1426
1936
  cursor: opaqueIdSchema2,
1427
- session: import_zod5.z.strictObject({
1937
+ session: import_zod7.z.strictObject({
1428
1938
  id: opaqueIdSchema2,
1429
- framework: import_zod5.z.enum(EXTERNAL_HANDOFF_FRAMEWORKS)
1939
+ framework: import_zod7.z.enum(EXTERNAL_HANDOFF_FRAMEWORKS)
1430
1940
  }),
1431
- revision: import_zod5.z.number().int().positive(),
1941
+ revision: import_zod7.z.number().int().positive(),
1432
1942
  publishedAt: isoTimestampSchema2,
1433
1943
  expiresAt: isoTimestampSchema2,
1434
- annotation: spotAnnotationRequestSchema
1944
+ annotation: spotAnnotationSchema
1435
1945
  });
1436
- var activeAdapterSummarySchema = import_zod5.z.strictObject({
1437
- kind: import_zod5.z.enum(EXTERNAL_HANDOFF_ACTIVE_ADAPTER_KINDS),
1438
- state: import_zod5.z.enum(EXTERNAL_HANDOFF_ACTIVE_ADAPTER_STATES),
1439
- canDispatch: import_zod5.z.boolean(),
1946
+ var activeAdapterSummarySchema = import_zod7.z.strictObject({
1947
+ kind: import_zod7.z.enum(EXTERNAL_HANDOFF_ACTIVE_ADAPTER_KINDS),
1948
+ state: import_zod7.z.enum(EXTERNAL_HANDOFF_ACTIVE_ADAPTER_STATES),
1949
+ canDispatch: import_zod7.z.boolean(),
1440
1950
  connectedAt: isoTimestampSchema2,
1441
1951
  updatedAt: isoTimestampSchema2
1442
1952
  }).superRefine((value, context) => {
@@ -1448,83 +1958,258 @@ var activeAdapterSummarySchema = import_zod5.z.strictObject({
1448
1958
  });
1449
1959
  }
1450
1960
  });
1451
- var dispatchSummarySchema = import_zod5.z.strictObject({
1452
- adapterKind: import_zod5.z.enum(EXTERNAL_HANDOFF_ACTIVE_ADAPTER_KINDS),
1453
- revision: import_zod5.z.number().int().positive(),
1454
- phase: import_zod5.z.enum(EXTERNAL_HANDOFF_DISPATCH_PHASES),
1961
+ var dispatchSummarySchema = import_zod7.z.strictObject({
1962
+ adapterKind: import_zod7.z.enum(EXTERNAL_HANDOFF_ACTIVE_ADAPTER_KINDS),
1963
+ revision: import_zod7.z.number().int().positive(),
1964
+ phase: import_zod7.z.enum(EXTERNAL_HANDOFF_DISPATCH_PHASES),
1455
1965
  updatedAt: isoTimestampSchema2
1456
1966
  });
1457
- var externalHandoffCapabilityRequestSchema = import_zod5.z.strictObject({});
1458
- var externalHandoffPublishRequestSchema = import_zod5.z.strictObject({
1967
+ var externalHandoffCapabilityRequestSchema = import_zod7.z.strictObject({});
1968
+ var externalHandoffPublishRequestSchema = import_zod7.z.strictObject({
1459
1969
  requestId: opaqueIdSchema2,
1460
- annotation: spotAnnotationRequestSchema
1970
+ annotation: spotAnnotationSchema
1461
1971
  });
1462
- var externalHandoffStatusRequestSchema = import_zod5.z.strictObject({
1972
+ var externalHandoffStatusRequestSchema = import_zod7.z.strictObject({
1463
1973
  cursor: opaqueIdSchema2.optional()
1464
1974
  });
1465
- var externalHandoffResolveDeliveryRequestSchema = import_zod5.z.strictObject({
1975
+ var externalHandoffResolveDeliveryRequestSchema = import_zod7.z.strictObject({
1466
1976
  cursor: opaqueIdSchema2,
1467
- confirmation: import_zod5.z.literal("workspace-reviewed")
1468
- });
1469
- var externalHandoffCapabilitySchema = import_zod5.z.strictObject({
1470
- enabled: import_zod5.z.literal(true),
1471
- brokerReady: import_zod5.z.boolean(),
1472
- activeWaitCount: import_zod5.z.number().int().nonnegative().max(EXTERNAL_HANDOFF_LIMITS.maximumWaiters),
1473
- snapshotSchemaVersion: import_zod5.z.literal(EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION),
1474
- brokerProtocolVersion: import_zod5.z.literal(EXTERNAL_HANDOFF_BROKER_PROTOCOL_VERSION),
1977
+ confirmation: import_zod7.z.literal("workspace-reviewed")
1978
+ });
1979
+ var externalHandoffCapabilitySchema = import_zod7.z.strictObject({
1980
+ enabled: import_zod7.z.literal(true),
1981
+ brokerReady: import_zod7.z.boolean(),
1982
+ activeWaitCount: import_zod7.z.number().int().nonnegative().max(EXTERNAL_HANDOFF_LIMITS.maximumWaiters),
1983
+ snapshotSchemaVersion: import_zod7.z.literal(EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION),
1984
+ brokerProtocolVersion: import_zod7.z.literal(EXTERNAL_HANDOFF_BROKER_PROTOCOL_VERSION),
1475
1985
  activeAdapter: activeAdapterSummarySchema.nullable(),
1476
1986
  dispatch: dispatchSummarySchema.nullable()
1477
1987
  });
1478
- var externalHandoffPublishDeliverySchema = import_zod5.z.discriminatedUnion("mode", [
1479
- import_zod5.z.strictObject({ mode: import_zod5.z.literal("inbox") }),
1480
- import_zod5.z.strictObject({
1481
- mode: import_zod5.z.literal("active"),
1988
+ var externalHandoffPublishDeliverySchema = import_zod7.z.discriminatedUnion("mode", [
1989
+ import_zod7.z.strictObject({ mode: import_zod7.z.literal("inbox") }),
1990
+ import_zod7.z.strictObject({
1991
+ mode: import_zod7.z.literal("active"),
1482
1992
  adapter: activeAdapterSummarySchema,
1483
1993
  dispatch: dispatchSummarySchema
1484
1994
  })
1485
1995
  ]);
1486
- var externalHandoffPublishResultSchema = import_zod5.z.strictObject({
1996
+ var externalHandoffPublishResultSchema = import_zod7.z.strictObject({
1487
1997
  handoff: externalHandoffSummarySchema,
1488
1998
  delivery: externalHandoffPublishDeliverySchema,
1489
- replayed: import_zod5.z.boolean()
1999
+ replayed: import_zod7.z.boolean()
1490
2000
  });
1491
- var externalHandoffStatusResultSchema = import_zod5.z.strictObject({
2001
+ var externalHandoffStatusResultSchema = import_zod7.z.strictObject({
1492
2002
  handoff: externalHandoffSummarySchema,
1493
2003
  activeAdapter: activeAdapterSummarySchema.nullable(),
1494
2004
  dispatch: dispatchSummarySchema.nullable()
1495
2005
  });
1496
2006
 
2007
+ // src/protocol/contextual-ask.ts
2008
+ var import_zod8 = require("zod");
2009
+ var limits2 = CONTEXTUAL_ASK_LIMITS;
2010
+ var timestampSchema = import_zod8.z.iso.datetime();
2011
+ var contextualAskCapabilityRequestSchema = import_zod8.z.strictObject({});
2012
+ var askJobCreateRequestSchema = import_zod8.z.strictObject({
2013
+ schemaVersion: import_zod8.z.literal(CONTEXTUAL_ASK_SCHEMA_VERSION),
2014
+ requestId: contextualAskOpaqueIdSchema,
2015
+ envelope: spotAskTaskEnvelopeSchema,
2016
+ executorId: contextualAskOpaqueIdSchema,
2017
+ providerDataConsent: import_zod8.z.literal(true)
2018
+ });
2019
+ var askJobActionRequestSchema = import_zod8.z.strictObject({});
2020
+ var askJobEventsRequestSchema = import_zod8.z.strictObject({
2021
+ afterSequence: import_zod8.z.number().int().nonnegative().optional()
2022
+ });
2023
+ var askJobExecutorSnapshotSchema = import_zod8.z.strictObject({
2024
+ executorId: contextualAskOpaqueIdSchema,
2025
+ kind: import_zod8.z.enum(CONTEXTUAL_ASK_EXECUTOR_KINDS),
2026
+ label: contextualAskBoundedText(limits2.maximumLabelCharacters),
2027
+ modelLabel: contextualAskBoundedText(limits2.maximumLabelCharacters)
2028
+ });
2029
+ var askJobSnapshotSchema = import_zod8.z.strictObject({
2030
+ schemaVersion: import_zod8.z.literal(CONTEXTUAL_ASK_SCHEMA_VERSION),
2031
+ jobId: contextualAskOpaqueIdSchema,
2032
+ selectionId: contextualAskOpaqueIdSchema,
2033
+ status: import_zod8.z.enum(ASK_JOB_STATUSES),
2034
+ executor: askJobExecutorSnapshotSchema,
2035
+ phaseMessage: contextualAskBoundedText(
2036
+ limits2.maximumPhaseMessageCharacters
2037
+ ).optional(),
2038
+ createdAt: timestampSchema,
2039
+ updatedAt: timestampSchema,
2040
+ canCancel: import_zod8.z.boolean(),
2041
+ errorCode: import_zod8.z.enum(CONTEXTUAL_ASK_ERROR_CODES).optional()
2042
+ }).superRefine((snapshot, context) => {
2043
+ if (Date.parse(snapshot.updatedAt) < Date.parse(snapshot.createdAt)) {
2044
+ context.addIssue({
2045
+ code: "custom",
2046
+ message: "Job updatedAt must not precede createdAt.",
2047
+ path: ["updatedAt"]
2048
+ });
2049
+ }
2050
+ const cancellable = ["queued", "authorizing", "running"].includes(snapshot.status);
2051
+ if (snapshot.canCancel !== cancellable) {
2052
+ context.addIssue({
2053
+ code: "custom",
2054
+ message: "Job canCancel does not match its status.",
2055
+ path: ["canCancel"]
2056
+ });
2057
+ }
2058
+ if (snapshot.status === "failed" && snapshot.errorCode === void 0 || snapshot.status === "failed" && snapshot.errorCode === "ASK_CANCELLED" || snapshot.status === "cancelled" && snapshot.errorCode !== "ASK_CANCELLED" || snapshot.status !== "failed" && snapshot.status !== "cancelled" && snapshot.errorCode !== void 0) {
2059
+ context.addIssue({
2060
+ code: "custom",
2061
+ message: "Job errorCode does not match its terminal status.",
2062
+ path: ["errorCode"]
2063
+ });
2064
+ }
2065
+ });
2066
+ var askJobResultResponseSchema = import_zod8.z.strictObject({
2067
+ snapshot: askJobSnapshotSchema,
2068
+ result: askAnswerResultSchema.optional()
2069
+ }).superRefine((response, context) => {
2070
+ const answered = response.snapshot.status === "answered";
2071
+ if (answered !== (response.result !== void 0)) {
2072
+ context.addIssue({
2073
+ code: "custom",
2074
+ message: "Only an answered job must contain an answer result.",
2075
+ path: ["result"]
2076
+ });
2077
+ return;
2078
+ }
2079
+ if (response.result !== void 0 && (response.result.jobId !== response.snapshot.jobId || response.result.selectionId !== response.snapshot.selectionId || response.result.executor.executorId !== response.snapshot.executor.executorId)) {
2080
+ context.addIssue({
2081
+ code: "custom",
2082
+ message: "Answer result identity does not match the job snapshot.",
2083
+ path: ["result"]
2084
+ });
2085
+ }
2086
+ });
2087
+ var askJobEventBaseShape = {
2088
+ schemaVersion: import_zod8.z.literal(CONTEXTUAL_ASK_SCHEMA_VERSION),
2089
+ sequence: import_zod8.z.number().int().positive(),
2090
+ jobId: contextualAskOpaqueIdSchema,
2091
+ status: import_zod8.z.enum(ASK_JOB_STATUSES),
2092
+ timestamp: timestampSchema
2093
+ };
2094
+ var askJobSnapshotEventSchema = import_zod8.z.strictObject({
2095
+ ...askJobEventBaseShape,
2096
+ type: import_zod8.z.literal("snapshot"),
2097
+ snapshot: askJobSnapshotSchema
2098
+ });
2099
+ var askJobPhaseEventSchema = import_zod8.z.strictObject({
2100
+ ...askJobEventBaseShape,
2101
+ type: import_zod8.z.literal("phase"),
2102
+ message: contextualAskBoundedText(limits2.maximumPhaseMessageCharacters)
2103
+ });
2104
+ var askReadSourceActivitySchema = import_zod8.z.strictObject({
2105
+ kind: import_zod8.z.literal("source"),
2106
+ sourceId: contextualAskOpaqueIdSchema,
2107
+ relativePath: contextualAskRelativePathSchema
2108
+ });
2109
+ var askReadFileCountActivitySchema = import_zod8.z.strictObject({
2110
+ kind: import_zod8.z.literal("file-count"),
2111
+ bucket: import_zod8.z.enum(ASK_FILE_COUNT_BUCKETS)
2112
+ });
2113
+ var askJobReadActivityEventSchema = import_zod8.z.strictObject({
2114
+ ...askJobEventBaseShape,
2115
+ type: import_zod8.z.literal("read-activity"),
2116
+ activity: import_zod8.z.discriminatedUnion("kind", [
2117
+ askReadSourceActivitySchema,
2118
+ askReadFileCountActivitySchema
2119
+ ]),
2120
+ state: import_zod8.z.enum(ASK_READ_ACTIVITY_STATES)
2121
+ });
2122
+ var askJobAnswerReadyEventSchema = import_zod8.z.strictObject({
2123
+ ...askJobEventBaseShape,
2124
+ type: import_zod8.z.literal("answer-ready")
2125
+ });
2126
+ var askJobErrorEventSchema = import_zod8.z.strictObject({
2127
+ ...askJobEventBaseShape,
2128
+ type: import_zod8.z.literal("error"),
2129
+ errorCode: import_zod8.z.enum(CONTEXTUAL_ASK_ERROR_CODES)
2130
+ });
2131
+ var askJobEventSchema = import_zod8.z.discriminatedUnion("type", [
2132
+ askJobSnapshotEventSchema,
2133
+ askJobPhaseEventSchema,
2134
+ askJobReadActivityEventSchema,
2135
+ askJobAnswerReadyEventSchema,
2136
+ askJobErrorEventSchema
2137
+ ]).superRefine((event, context) => {
2138
+ if (event.type === "snapshot" && (event.snapshot.jobId !== event.jobId || event.snapshot.status !== event.status)) {
2139
+ context.addIssue({
2140
+ code: "custom",
2141
+ message: "Snapshot event identity does not match its envelope.",
2142
+ path: ["snapshot"]
2143
+ });
2144
+ }
2145
+ if (event.type === "read-activity" && event.status !== "running") {
2146
+ context.addIssue({
2147
+ code: "custom",
2148
+ message: "Read activity is only valid while a job is running.",
2149
+ path: ["status"]
2150
+ });
2151
+ }
2152
+ if (event.type === "phase" && ["answered", "cancelled", "failed"].includes(event.status)) {
2153
+ context.addIssue({
2154
+ code: "custom",
2155
+ message: "Phase events cannot report a terminal state.",
2156
+ path: ["status"]
2157
+ });
2158
+ }
2159
+ if (event.type === "answer-ready" && event.status !== "answered") {
2160
+ context.addIssue({
2161
+ code: "custom",
2162
+ message: "Answer-ready must report the answered state.",
2163
+ path: ["status"]
2164
+ });
2165
+ }
2166
+ if (event.type === "error" && !["failed", "cancelled"].includes(event.status)) {
2167
+ context.addIssue({
2168
+ code: "custom",
2169
+ message: "Error events must report a terminal error state.",
2170
+ path: ["status"]
2171
+ });
2172
+ }
2173
+ if (event.type === "error" && (event.status === "cancelled" && event.errorCode !== "ASK_CANCELLED" || event.status === "failed" && event.errorCode === "ASK_CANCELLED")) {
2174
+ context.addIssue({
2175
+ code: "custom",
2176
+ message: "Error event code does not match its status.",
2177
+ path: ["errorCode"]
2178
+ });
2179
+ }
2180
+ });
2181
+
1497
2182
  // src/protocol/agent-schemas.ts
1498
- var import_zod6 = require("zod");
1499
- var profileIdSchema3 = import_zod6.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
1500
- var boundedString2 = (maximum) => import_zod6.z.string().max(maximum);
1501
- var errorCodeSchema = import_zod6.z.enum(ERROR_CODES);
1502
- var agentCapabilitySnapshotSchema = import_zod6.z.strictObject({
1503
- providerProfileId: profileIdSchema3,
2183
+ var import_zod9 = require("zod");
2184
+ var profileIdSchema4 = import_zod9.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
2185
+ var boundedString2 = (maximum) => import_zod9.z.string().max(maximum);
2186
+ var errorCodeSchema = import_zod9.z.enum(ERROR_CODES);
2187
+ var agentCapabilitySnapshotSchema = import_zod9.z.strictObject({
2188
+ providerProfileId: profileIdSchema4,
1504
2189
  providerLabel: boundedString2(100),
1505
- modelProfileId: profileIdSchema3,
2190
+ modelProfileId: profileIdSchema4,
1506
2191
  modelLabel: boundedString2(100),
1507
- protocol: import_zod6.z.enum(["responses", "chat-completions"]),
1508
- state: import_zod6.z.enum(AGENT_CAPABILITY_STATES),
1509
- authenticated: import_zod6.z.boolean(),
1510
- modelAvailable: import_zod6.z.boolean(),
1511
- toolCalling: import_zod6.z.boolean(),
1512
- toolResultContinuation: import_zod6.z.boolean(),
1513
- streaming: import_zod6.z.boolean(),
1514
- checkedAt: import_zod6.z.iso.datetime().optional(),
2192
+ protocol: import_zod9.z.enum(["responses", "chat-completions"]),
2193
+ state: import_zod9.z.enum(AGENT_CAPABILITY_STATES),
2194
+ authenticated: import_zod9.z.boolean(),
2195
+ modelAvailable: import_zod9.z.boolean(),
2196
+ toolCalling: import_zod9.z.boolean(),
2197
+ toolResultContinuation: import_zod9.z.boolean(),
2198
+ streaming: import_zod9.z.boolean(),
2199
+ checkedAt: import_zod9.z.iso.datetime().optional(),
1515
2200
  errorCode: errorCodeSchema.optional()
1516
2201
  });
1517
- var agentWorkspaceHealthSnapshotSchema = import_zod6.z.strictObject({
1518
- state: import_zod6.z.enum(AGENT_WORKSPACE_STATES),
1519
- checkedAt: import_zod6.z.iso.datetime(),
1520
- changes: import_zod6.z.strictObject({
1521
- staged: import_zod6.z.number().int().nonnegative(),
1522
- unstaged: import_zod6.z.number().int().nonnegative(),
1523
- untracked: import_zod6.z.number().int().nonnegative(),
1524
- conflicted: import_zod6.z.number().int().nonnegative(),
1525
- total: import_zod6.z.number().int().nonnegative()
2202
+ var agentWorkspaceHealthSnapshotSchema = import_zod9.z.strictObject({
2203
+ state: import_zod9.z.enum(AGENT_WORKSPACE_STATES),
2204
+ checkedAt: import_zod9.z.iso.datetime(),
2205
+ changes: import_zod9.z.strictObject({
2206
+ staged: import_zod9.z.number().int().nonnegative(),
2207
+ unstaged: import_zod9.z.number().int().nonnegative(),
2208
+ untracked: import_zod9.z.number().int().nonnegative(),
2209
+ conflicted: import_zod9.z.number().int().nonnegative(),
2210
+ total: import_zod9.z.number().int().nonnegative()
1526
2211
  }),
1527
- canIncludeLocalChanges: import_zod6.z.boolean(),
2212
+ canIncludeLocalChanges: import_zod9.z.boolean(),
1528
2213
  errorCode: errorCodeSchema.optional()
1529
2214
  }).refine(
1530
2215
  ({ state, changes, canIncludeLocalChanges, errorCode }) => {
@@ -1542,42 +2227,42 @@ var agentWorkspaceHealthSnapshotSchema = import_zod6.z.strictObject({
1542
2227
  },
1543
2228
  { message: "Agent workspace health fields are inconsistent." }
1544
2229
  );
1545
- var agentChangedFileSchema = import_zod6.z.strictObject({
2230
+ var agentChangedFileSchema = import_zod9.z.strictObject({
1546
2231
  relativePath: boundedString2(1024),
1547
- kind: import_zod6.z.enum(AGENT_FILE_CHANGE_KINDS),
1548
- additions: import_zod6.z.number().int().nonnegative(),
1549
- deletions: import_zod6.z.number().int().nonnegative()
2232
+ kind: import_zod9.z.enum(AGENT_FILE_CHANGE_KINDS),
2233
+ additions: import_zod9.z.number().int().nonnegative(),
2234
+ deletions: import_zod9.z.number().int().nonnegative()
1550
2235
  });
1551
- var agentCheckResultSchema = import_zod6.z.strictObject({
1552
- checkId: profileIdSchema3,
2236
+ var agentCheckResultSchema = import_zod9.z.strictObject({
2237
+ checkId: profileIdSchema4,
1553
2238
  label: boundedString2(100),
1554
- status: import_zod6.z.enum(AGENT_CHECK_STATUSES),
1555
- durationMs: import_zod6.z.number().int().nonnegative(),
2239
+ status: import_zod9.z.enum(AGENT_CHECK_STATUSES),
2240
+ durationMs: import_zod9.z.number().int().nonnegative(),
1556
2241
  output: boundedString2(8e4)
1557
2242
  });
1558
- var agentJobSnapshotSchema = import_zod6.z.strictObject({
1559
- jobId: import_zod6.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
1560
- status: import_zod6.z.enum(AGENT_JOB_STATUSES),
1561
- providerProfileId: profileIdSchema3,
2243
+ var agentJobSnapshotSchema = import_zod9.z.strictObject({
2244
+ jobId: import_zod9.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
2245
+ status: import_zod9.z.enum(AGENT_JOB_STATUSES),
2246
+ providerProfileId: profileIdSchema4,
1562
2247
  providerLabel: boundedString2(100),
1563
- modelProfileId: profileIdSchema3,
2248
+ modelProfileId: profileIdSchema4,
1564
2249
  modelLabel: boundedString2(100),
1565
2250
  phaseMessage: boundedString2(1024),
1566
- createdAt: import_zod6.z.iso.datetime(),
1567
- updatedAt: import_zod6.z.iso.datetime(),
1568
- canCancel: import_zod6.z.boolean(),
1569
- canApply: import_zod6.z.boolean(),
1570
- canRevert: import_zod6.z.boolean(),
2251
+ createdAt: import_zod9.z.iso.datetime(),
2252
+ updatedAt: import_zod9.z.iso.datetime(),
2253
+ canCancel: import_zod9.z.boolean(),
2254
+ canApply: import_zod9.z.boolean(),
2255
+ canRevert: import_zod9.z.boolean(),
1571
2256
  errorCode: errorCodeSchema.optional()
1572
2257
  });
1573
- var agentJobResultSchema = import_zod6.z.strictObject({
1574
- jobId: import_zod6.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
2258
+ var agentJobResultSchema = import_zod9.z.strictObject({
2259
+ jobId: import_zod9.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
1575
2260
  summary: boundedString2(8e4),
1576
2261
  diff: boundedString2(1e6),
1577
- files: import_zod6.z.array(agentChangedFileSchema).max(100),
1578
- checks: import_zod6.z.array(agentCheckResultSchema).max(100)
2262
+ files: import_zod9.z.array(agentChangedFileSchema).max(100),
2263
+ checks: import_zod9.z.array(agentCheckResultSchema).max(100)
1579
2264
  });
1580
- var agentJobResultResponseSchema = import_zod6.z.strictObject({
2265
+ var agentJobResultResponseSchema = import_zod9.z.strictObject({
1581
2266
  snapshot: agentJobSnapshotSchema,
1582
2267
  result: agentJobResultSchema.optional()
1583
2268
  }).superRefine((value, context) => {
@@ -1589,44 +2274,44 @@ var agentJobResultResponseSchema = import_zod6.z.strictObject({
1589
2274
  });
1590
2275
  }
1591
2276
  });
1592
- var agentJobEventBaseSchema = import_zod6.z.strictObject({
1593
- schemaVersion: import_zod6.z.literal(2),
1594
- sequence: import_zod6.z.number().int().positive(),
1595
- jobId: import_zod6.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
1596
- status: import_zod6.z.enum(AGENT_JOB_STATUSES),
1597
- timestamp: import_zod6.z.iso.datetime()
2277
+ var agentJobEventBaseSchema = import_zod9.z.strictObject({
2278
+ schemaVersion: import_zod9.z.literal(2),
2279
+ sequence: import_zod9.z.number().int().positive(),
2280
+ jobId: import_zod9.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
2281
+ status: import_zod9.z.enum(AGENT_JOB_STATUSES),
2282
+ timestamp: import_zod9.z.iso.datetime()
1598
2283
  });
1599
- var agentJobEventSchema = import_zod6.z.discriminatedUnion("type", [
2284
+ var agentJobEventSchema = import_zod9.z.discriminatedUnion("type", [
1600
2285
  agentJobEventBaseSchema.extend({
1601
- type: import_zod6.z.literal("snapshot"),
1602
- data: import_zod6.z.strictObject({ snapshot: agentJobSnapshotSchema })
2286
+ type: import_zod9.z.literal("snapshot"),
2287
+ data: import_zod9.z.strictObject({ snapshot: agentJobSnapshotSchema })
1603
2288
  }),
1604
2289
  agentJobEventBaseSchema.extend({
1605
- type: import_zod6.z.literal("phase"),
1606
- data: import_zod6.z.strictObject({ message: boundedString2(1024) })
2290
+ type: import_zod9.z.literal("phase"),
2291
+ data: import_zod9.z.strictObject({ message: boundedString2(1024) })
1607
2292
  }),
1608
2293
  agentJobEventBaseSchema.extend({
1609
- type: import_zod6.z.literal("tool"),
1610
- data: import_zod6.z.strictObject({
1611
- turn: import_zod6.z.number().int().positive(),
2294
+ type: import_zod9.z.literal("tool"),
2295
+ data: import_zod9.z.strictObject({
2296
+ turn: import_zod9.z.number().int().positive(),
1612
2297
  toolCallId: boundedString2(256),
1613
2298
  toolName: boundedString2(100),
1614
- state: import_zod6.z.enum(["started", "succeeded", "failed"]),
2299
+ state: import_zod9.z.enum(["started", "succeeded", "failed"]),
1615
2300
  relativePath: boundedString2(1024).optional(),
1616
2301
  checkLabel: boundedString2(100).optional()
1617
2302
  })
1618
2303
  }),
1619
2304
  agentJobEventBaseSchema.extend({
1620
- type: import_zod6.z.literal("check"),
1621
- data: import_zod6.z.strictObject({ result: agentCheckResultSchema })
2305
+ type: import_zod9.z.literal("check"),
2306
+ data: import_zod9.z.strictObject({ result: agentCheckResultSchema })
1622
2307
  }),
1623
2308
  agentJobEventBaseSchema.extend({
1624
- type: import_zod6.z.literal("result-ready"),
1625
- data: import_zod6.z.strictObject({ hasResult: import_zod6.z.literal(true) })
2309
+ type: import_zod9.z.literal("result-ready"),
2310
+ data: import_zod9.z.strictObject({ hasResult: import_zod9.z.literal(true) })
1626
2311
  }),
1627
2312
  agentJobEventBaseSchema.extend({
1628
- type: import_zod6.z.literal("error"),
1629
- data: import_zod6.z.strictObject({
2313
+ type: import_zod9.z.literal("error"),
2314
+ data: import_zod9.z.strictObject({
1630
2315
  code: errorCodeSchema,
1631
2316
  message: boundedString2(1024)
1632
2317
  })
@@ -1662,6 +2347,18 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
1662
2347
  AGENT_JOB_STATUSES,
1663
2348
  AGENT_WORKSPACE_SNAPSHOT_LIMITS,
1664
2349
  AGENT_WORKSPACE_STATES,
2350
+ ASK_ANSWER_WARNING_CODES,
2351
+ ASK_EXECUTOR_ANSWER_WARNING_CODES,
2352
+ ASK_FILE_COUNT_BUCKETS,
2353
+ ASK_JOB_STATUSES,
2354
+ ASK_READ_ACTIVITY_STATES,
2355
+ ASK_SOURCE_CONFIDENCES,
2356
+ CONTEXTUAL_ASK_ERROR_CODES,
2357
+ CONTEXTUAL_ASK_EXECUTOR_KINDS,
2358
+ CONTEXTUAL_ASK_EXECUTOR_STATES,
2359
+ CONTEXTUAL_ASK_LIMITS,
2360
+ CONTEXTUAL_ASK_PERMISSION_PROFILE,
2361
+ CONTEXTUAL_ASK_SCHEMA_VERSION,
1665
2362
  DATA_FLOW_ASSOCIATION_KINDS,
1666
2363
  DATA_FLOW_DIAGNOSTIC_CODES,
1667
2364
  DATA_FLOW_EXECUTION_STATES,
@@ -1732,7 +2429,26 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
1732
2429
  agentJobSnapshotSchema,
1733
2430
  agentWorkspaceHealthRequestSchema,
1734
2431
  agentWorkspaceHealthSnapshotSchema,
2432
+ askAnswerBlockSchema,
2433
+ askAnswerDraftBlockSchema,
2434
+ askAnswerDraftSchema,
2435
+ askAnswerResultSchema,
2436
+ askAnswerWarningSchema,
2437
+ askDraftCitationSchema,
2438
+ askDraftOriginSchema,
2439
+ askJobActionRequestSchema,
2440
+ askJobCreateRequestSchema,
2441
+ askJobEventSchema,
2442
+ askJobEventsRequestSchema,
2443
+ askJobResultResponseSchema,
2444
+ askJobSnapshotSchema,
2445
+ askSourceReferenceSchema,
1735
2446
  componentDataFlowReportSchema,
2447
+ contextualAskCapabilityRequestSchema,
2448
+ contextualAskCapabilitySchema,
2449
+ contextualAskExecutorCapabilitySchema,
2450
+ contextualAskExecutorPreferenceSchema,
2451
+ contextualAskOptionsSchema,
1736
2452
  dataDependencySchema,
1737
2453
  dataFlowComponentReportRequestSchema,
1738
2454
  dataFlowPageReportRequestSchema,
@@ -1760,6 +2476,7 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
1760
2476
  externalHandoffSummarySchema,
1761
2477
  formatSourceMarker,
1762
2478
  getAgentJobEndpoint,
2479
+ getAskJobEndpoint,
1763
2480
  isErrorCode,
1764
2481
  isSensitiveName,
1765
2482
  limitDataFlowReportCollections,
@@ -1778,6 +2495,11 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
1778
2495
  sanitizeUrl,
1779
2496
  sourceContextRequestSchema,
1780
2497
  spotAnnotationRequestSchema,
1781
- spotTargetContextRequestSchema
2498
+ spotAskTaskEnvelopeSchema,
2499
+ spotChangeTaskEnvelopeSchema,
2500
+ spotSelectionContextSchema,
2501
+ spotSelectionTargetSchema,
2502
+ spotTargetContextRequestSchema,
2503
+ spotTaskEnvelopeSchema
1782
2504
  });
1783
2505
  //# sourceMappingURL=index.cjs.map