@spotpatch/shared 1.8.0 → 1.10.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 (39) hide show
  1. package/dist/chunk-2LVIH7OA.js +75 -0
  2. package/dist/chunk-2LVIH7OA.js.map +1 -0
  3. package/dist/chunk-MOGITGPP.js +431 -0
  4. package/dist/chunk-MOGITGPP.js.map +1 -0
  5. package/dist/chunk-RK46Y7LD.js +34 -0
  6. package/dist/chunk-RK46Y7LD.js.map +1 -0
  7. package/dist/chunk-ZCG3DLSW.js +28 -0
  8. package/dist/chunk-ZCG3DLSW.js.map +1 -0
  9. package/dist/data-flow-runtime-BMm3F-eV.d.cts +658 -0
  10. package/dist/data-flow-runtime-Dp-xznQW.d.ts +658 -0
  11. package/dist/data-flow-runtime.cjs +78 -0
  12. package/dist/data-flow-runtime.cjs.map +1 -0
  13. package/dist/data-flow-runtime.d.cts +3 -0
  14. package/dist/data-flow-runtime.d.ts +3 -0
  15. package/dist/data-flow-runtime.js +13 -0
  16. package/dist/data-flow-runtime.js.map +1 -0
  17. package/dist/endpoints-BT-Bl1WS.d.cts +20 -0
  18. package/dist/endpoints-BT-Bl1WS.d.ts +20 -0
  19. package/dist/external-agent-node.cjs +692 -0
  20. package/dist/external-agent-node.cjs.map +1 -0
  21. package/dist/external-agent-node.d.cts +556 -0
  22. package/dist/external-agent-node.d.ts +556 -0
  23. package/dist/external-agent-node.js +210 -0
  24. package/dist/external-agent-node.js.map +1 -0
  25. package/dist/external-handoff-CWoooqhp.d.cts +720 -0
  26. package/dist/external-handoff-CWoooqhp.d.ts +720 -0
  27. package/dist/external-handoff-browser.cjs +163 -0
  28. package/dist/external-handoff-browser.cjs.map +1 -0
  29. package/dist/external-handoff-browser.d.cts +32 -0
  30. package/dist/external-handoff-browser.d.ts +32 -0
  31. package/dist/external-handoff-browser.js +58 -0
  32. package/dist/external-handoff-browser.js.map +1 -0
  33. package/dist/index.cjs +938 -154
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +212 -110
  36. package/dist/index.d.ts +212 -110
  37. package/dist/index.js +616 -302
  38. package/dist/index.js.map +1 -1
  39. package/package.json +45 -2
package/dist/index.cjs CHANGED
@@ -27,8 +27,33 @@ __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
+ DATA_FLOW_ASSOCIATION_KINDS: () => DATA_FLOW_ASSOCIATION_KINDS,
31
+ DATA_FLOW_DIAGNOSTIC_CODES: () => DATA_FLOW_DIAGNOSTIC_CODES,
32
+ DATA_FLOW_EXECUTION_STATES: () => DATA_FLOW_EXECUTION_STATES,
33
+ DATA_FLOW_FRESHNESS_STATES: () => DATA_FLOW_FRESHNESS_STATES,
34
+ DATA_FLOW_PROOF_STATES: () => DATA_FLOW_PROOF_STATES,
35
+ DATA_FLOW_QUERY_ADAPTER_MODULES: () => DATA_FLOW_QUERY_ADAPTER_MODULES,
36
+ DATA_FLOW_QUERY_HOOK_NAMES: () => DATA_FLOW_QUERY_HOOK_NAMES,
37
+ DATA_FLOW_SCHEMA_VERSION: () => DATA_FLOW_SCHEMA_VERSION,
38
+ DATA_FLOW_TRPC_CLIENT_FACTORY_NAMES: () => DATA_FLOW_TRPC_CLIENT_FACTORY_NAMES,
39
+ DATA_FLOW_TRPC_PROXY_FACTORY_NAMES: () => DATA_FLOW_TRPC_PROXY_FACTORY_NAMES,
40
+ DATA_FLOW_TRPC_REQUEST_METHODS: () => DATA_FLOW_TRPC_REQUEST_METHODS,
41
+ DATA_FLOW_TRPC_ROOT_FACTORY_NAMES: () => DATA_FLOW_TRPC_ROOT_FACTORY_NAMES,
42
+ DATA_FLOW_URL_QUERY_KEY_LIMIT: () => DATA_FLOW_URL_QUERY_KEY_LIMIT,
30
43
  DEFAULT_AGENT_LIMITS: () => DEFAULT_AGENT_LIMITS,
44
+ DEFAULT_DATA_FLOW_LIMITS: () => DEFAULT_DATA_FLOW_LIMITS,
45
+ DEFAULT_RUNTIME_DATA_FLOW_LIMITS: () => DEFAULT_RUNTIME_DATA_FLOW_LIMITS,
31
46
  ERROR_CODES: () => ERROR_CODES,
47
+ ERROR_CODE_VALUES: () => ERROR_CODE_VALUES,
48
+ EXTERNAL_HANDOFF_ACTIVE_ADAPTER_KINDS: () => EXTERNAL_HANDOFF_ACTIVE_ADAPTER_KINDS,
49
+ EXTERNAL_HANDOFF_ACTIVE_ADAPTER_STATES: () => EXTERNAL_HANDOFF_ACTIVE_ADAPTER_STATES,
50
+ EXTERNAL_HANDOFF_BROKER_PROTOCOL_VERSION: () => EXTERNAL_HANDOFF_BROKER_PROTOCOL_VERSION,
51
+ EXTERNAL_HANDOFF_DISPATCH_PHASES: () => EXTERNAL_HANDOFF_DISPATCH_PHASES,
52
+ EXTERNAL_HANDOFF_FRAMEWORKS: () => EXTERNAL_HANDOFF_FRAMEWORKS,
53
+ EXTERNAL_HANDOFF_LIMITS: () => EXTERNAL_HANDOFF_LIMITS,
54
+ EXTERNAL_HANDOFF_REPORTABLE_DISPATCH_PHASES: () => EXTERNAL_HANDOFF_REPORTABLE_DISPATCH_PHASES,
55
+ EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION: () => EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION,
56
+ EXTERNAL_HANDOFF_STATES: () => EXTERNAL_HANDOFF_STATES,
32
57
  MAX_ANNOTATION_INSTRUCTION_CHARACTERS: () => MAX_ANNOTATION_INSTRUCTION_CHARACTERS,
33
58
  MAX_ANNOTATION_TARGETS: () => MAX_ANNOTATION_TARGETS,
34
59
  MAX_TARGET_INSTRUCTION_CHARACTERS: () => MAX_TARGET_INSTRUCTION_CHARACTERS,
@@ -43,6 +68,7 @@ __export(index_exports, {
43
68
  SPOTPATCH_REPOSITORY_URL: () => SPOTPATCH_REPOSITORY_URL,
44
69
  SPOTPATCH_TOKEN_HEADER: () => SPOTPATCH_TOKEN_HEADER,
45
70
  SpotPatchError: () => SpotPatchError,
71
+ activeAdapterSummarySchema: () => activeAdapterSummarySchema,
46
72
  agentCapabilityRequestSchema: () => agentCapabilityRequestSchema,
47
73
  agentCapabilitySnapshotSchema: () => agentCapabilitySnapshotSchema,
48
74
  agentChangedFileSchema: () => agentChangedFileSchema,
@@ -55,14 +81,35 @@ __export(index_exports, {
55
81
  agentJobSnapshotSchema: () => agentJobSnapshotSchema,
56
82
  agentWorkspaceHealthRequestSchema: () => agentWorkspaceHealthRequestSchema,
57
83
  agentWorkspaceHealthSnapshotSchema: () => agentWorkspaceHealthSnapshotSchema,
84
+ componentDataFlowReportSchema: () => componentDataFlowReportSchema,
85
+ dataDependencySchema: () => dataDependencySchema,
86
+ dataFlowComponentReportRequestSchema: () => dataFlowComponentReportRequestSchema,
87
+ dataFlowPageReportRequestSchema: () => dataFlowPageReportRequestSchema,
88
+ dispatchSummarySchema: () => dispatchSummarySchema,
89
+ externalHandoffCapabilityRequestSchema: () => externalHandoffCapabilityRequestSchema,
90
+ externalHandoffCapabilitySchema: () => externalHandoffCapabilitySchema,
91
+ externalHandoffPublishDeliverySchema: () => externalHandoffPublishDeliverySchema,
92
+ externalHandoffPublishRequestSchema: () => externalHandoffPublishRequestSchema,
93
+ externalHandoffPublishResultSchema: () => externalHandoffPublishResultSchema,
94
+ externalHandoffReportableDispatchPhaseSchema: () => externalHandoffReportableDispatchPhaseSchema,
95
+ externalHandoffResolveDeliveryRequestSchema: () => externalHandoffResolveDeliveryRequestSchema,
96
+ externalHandoffSnapshotSchema: () => externalHandoffSnapshotSchema,
97
+ externalHandoffStatusRequestSchema: () => externalHandoffStatusRequestSchema,
98
+ externalHandoffStatusResultSchema: () => externalHandoffStatusResultSchema,
99
+ externalHandoffSummarySchema: () => externalHandoffSummarySchema,
58
100
  formatSourceMarker: () => formatSourceMarker,
59
101
  getAgentJobEndpoint: () => getAgentJobEndpoint,
102
+ isErrorCode: () => isErrorCode,
60
103
  isSensitiveName: () => isSensitiveName,
104
+ limitDataFlowReportCollections: () => limitDataFlowReportCollections,
105
+ networkObservationSchema: () => networkObservationSchema,
61
106
  openEditorRequestSchema: () => openEditorRequestSchema,
107
+ pageDataFlowReportSchema: () => pageDataFlowReportSchema,
62
108
  parseSourceMarker: () => parseSourceMarker,
63
109
  redactSensitiveText: () => redactSensitiveText,
64
110
  runtimeBootstrapRequestSchema: () => runtimeBootstrapRequestSchema,
65
111
  runtimeConfigSchema: () => runtimeConfigSchema,
112
+ runtimeDataFlowConfigSchema: () => runtimeDataFlowConfigSchema,
66
113
  sanitizeUrl: () => sanitizeUrl,
67
114
  sourceContextRequestSchema: () => sourceContextRequestSchema,
68
115
  spotAnnotationRequestSchema: () => spotAnnotationRequestSchema,
@@ -89,6 +136,9 @@ var ERROR_CODES = {
89
136
  SOURCE_OUTSIDE_ROOT: "SOURCE_OUTSIDE_ROOT",
90
137
  SOURCE_TOO_LARGE: "SOURCE_TOO_LARGE",
91
138
  EDITOR_OPEN_FAILED: "EDITOR_OPEN_FAILED",
139
+ DATA_FLOW_DISABLED: "DATA_FLOW_DISABLED",
140
+ DATA_FLOW_SOURCE_STALE: "DATA_FLOW_SOURCE_STALE",
141
+ DATA_FLOW_ANALYSIS_CANCELLED: "DATA_FLOW_ANALYSIS_CANCELLED",
92
142
  AI_DISABLED: "AI_DISABLED",
93
143
  PROVIDER_NOT_CONFIGURED: "PROVIDER_NOT_CONFIGURED",
94
144
  PROVIDER_AUTH_FAILED: "PROVIDER_AUTH_FAILED",
@@ -99,6 +149,24 @@ var ERROR_CODES = {
99
149
  AGENT_BUSY: "AGENT_BUSY",
100
150
  AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED",
101
151
  AGENT_CANCELLED: "AGENT_CANCELLED",
152
+ EXTERNAL_HANDOFF_DISABLED: "EXTERNAL_HANDOFF_DISABLED",
153
+ EXTERNAL_HANDOFF_UNAVAILABLE: "EXTERNAL_HANDOFF_UNAVAILABLE",
154
+ HANDOFF_VALIDATION_FAILED: "HANDOFF_VALIDATION_FAILED",
155
+ HANDOFF_SOURCE_STALE: "HANDOFF_SOURCE_STALE",
156
+ HANDOFF_NOT_FOUND: "HANDOFF_NOT_FOUND",
157
+ HANDOFF_EXPIRED: "HANDOFF_EXPIRED",
158
+ HANDOFF_CURSOR_INVALID: "HANDOFF_CURSOR_INVALID",
159
+ HANDOFF_RESPONSE_TOO_LARGE: "HANDOFF_RESPONSE_TOO_LARGE",
160
+ BRIDGE_UNAUTHORIZED: "BRIDGE_UNAUTHORIZED",
161
+ BRIDGE_PROTOCOL_MISMATCH: "BRIDGE_PROTOCOL_MISMATCH",
162
+ BRIDGE_BUSY: "BRIDGE_BUSY",
163
+ EXTERNAL_AGENT_BUSY: "EXTERNAL_AGENT_BUSY",
164
+ ACTIVE_ADAPTER_CONFLICT: "ACTIVE_ADAPTER_CONFLICT",
165
+ ACTIVE_ADAPTER_LEASE_INVALID: "ACTIVE_ADAPTER_LEASE_INVALID",
166
+ ACTIVE_DISPATCH_INVALID: "ACTIVE_DISPATCH_INVALID",
167
+ SESSION_NOT_FOUND: "SESSION_NOT_FOUND",
168
+ SESSION_AMBIGUOUS: "SESSION_AMBIGUOUS",
169
+ SESSION_CLOSED: "SESSION_CLOSED",
102
170
  WORKTREE_DIRTY: "WORKTREE_DIRTY",
103
171
  WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY",
104
172
  WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS",
@@ -116,6 +184,10 @@ var ERROR_CODES = {
116
184
  APPLY_CONFLICT: "APPLY_CONFLICT",
117
185
  INTERNAL_ERROR: "INTERNAL_ERROR"
118
186
  };
187
+ var ERROR_CODE_VALUES = Object.freeze(Object.values(ERROR_CODES));
188
+ function isErrorCode(value) {
189
+ return typeof value === "string" && ERROR_CODE_VALUES.includes(value);
190
+ }
119
191
 
120
192
  // src/security/redaction.ts
121
193
  var INLINE_DATA_PATTERN = /data:[^\s"'<>]*;base64,[a-z0-9+/_=-]+/giu;
@@ -196,9 +268,485 @@ var SPOTPATCH_LOCALE_PREFERENCES = Object.freeze([
196
268
  ...SPOTPATCH_LOCALES
197
269
  ]);
198
270
 
199
- // src/model/runtime-config.ts
271
+ // src/model/data-flow-adapters.ts
272
+ var DATA_FLOW_QUERY_ADAPTER_MODULES = Object.freeze([
273
+ "@tanstack/react-query",
274
+ "react-query"
275
+ ]);
276
+ var DATA_FLOW_QUERY_HOOK_NAMES = Object.freeze([
277
+ "useInfiniteQuery",
278
+ "useMutation",
279
+ "useQuery"
280
+ ]);
281
+ var DATA_FLOW_TRPC_CLIENT_FACTORY_NAMES = Object.freeze([
282
+ "createTRPCClient",
283
+ "createTRPCProxyClient"
284
+ ]);
285
+ var DATA_FLOW_TRPC_PROXY_FACTORY_NAMES = Object.freeze([
286
+ "createTRPCNext",
287
+ "createTRPCReact"
288
+ ]);
289
+ var DATA_FLOW_TRPC_ROOT_FACTORY_NAMES = Object.freeze([
290
+ ...DATA_FLOW_TRPC_CLIENT_FACTORY_NAMES,
291
+ ...DATA_FLOW_TRPC_PROXY_FACTORY_NAMES,
292
+ "createTRPCContext",
293
+ "createTRPCOptionsProxy"
294
+ ]);
295
+ var DATA_FLOW_TRPC_REQUEST_METHODS = Object.freeze([
296
+ "infiniteQueryOptions",
297
+ "mutate",
298
+ "mutateAsync",
299
+ "mutationOptions",
300
+ "query",
301
+ "queryOptions",
302
+ "refetch",
303
+ "subscribe",
304
+ "subscriptionOptions",
305
+ "useInfiniteQuery",
306
+ "useMutation",
307
+ "useQuery",
308
+ "useSubscription",
309
+ "useSuspenseInfiniteQuery",
310
+ "useSuspenseQuery"
311
+ ]);
312
+
313
+ // src/model/data-flow.ts
200
314
  var import_zod = require("zod");
201
315
 
316
+ // src/model/data-flow-limits.ts
317
+ var DEFAULT_DATA_FLOW_LIMITS = Object.freeze({
318
+ observationMaxEntries: 100,
319
+ observationMaxBytes: 256 * 1024,
320
+ observationTtlMs: 3e5,
321
+ protocolRequestMaxBytes: 32 * 1024,
322
+ reportMaxBytes: 128 * 1024,
323
+ reportMaxEvidence: 200,
324
+ reportMaxDiagnostics: 256,
325
+ capabilityMaxReasons: 64,
326
+ graphMaxDepth: 5,
327
+ graphMaxModules: 50,
328
+ graphMaxCallsites: 100,
329
+ analysisTimeoutMs: 2e3,
330
+ reportMaxFields: 100
331
+ });
332
+ var DATA_FLOW_URL_QUERY_KEY_LIMIT = DEFAULT_DATA_FLOW_LIMITS.reportMaxFields;
333
+ var DEFAULT_RUNTIME_DATA_FLOW_LIMITS = Object.freeze({
334
+ observationMaxEntries: DEFAULT_DATA_FLOW_LIMITS.observationMaxEntries,
335
+ observationMaxBytes: DEFAULT_DATA_FLOW_LIMITS.observationMaxBytes,
336
+ observationTtlMs: DEFAULT_DATA_FLOW_LIMITS.observationTtlMs,
337
+ reportMaxBytes: DEFAULT_DATA_FLOW_LIMITS.reportMaxBytes
338
+ });
339
+
340
+ // src/model/data-flow-version.ts
341
+ var DATA_FLOW_SCHEMA_VERSION = 1;
342
+
343
+ // src/model/data-flow.ts
344
+ var DATA_FLOW_EXECUTION_STATES = Object.freeze([
345
+ "observed",
346
+ "declared-not-observed",
347
+ "not-applicable",
348
+ "unknown"
349
+ ]);
350
+ var DATA_FLOW_PROOF_STATES = Object.freeze([
351
+ "proven",
352
+ "candidate",
353
+ "unavailable",
354
+ "conflict"
355
+ ]);
356
+ var DATA_FLOW_ASSOCIATION_KINDS = Object.freeze([
357
+ "direct",
358
+ "transitive",
359
+ "upstream",
360
+ "possible",
361
+ "unassigned",
362
+ "unknown"
363
+ ]);
364
+ var DATA_FLOW_FRESHNESS_STATES = Object.freeze([
365
+ "current",
366
+ "stale-source",
367
+ "stale-route",
368
+ "expired"
369
+ ]);
370
+ var DATA_FLOW_DIAGNOSTIC_CODES = Object.freeze([
371
+ "DATA_FLOW_CAPABILITY_DISABLED",
372
+ "DATA_FLOW_CAPABILITY_PRELUDE_UNAVAILABLE",
373
+ "DATA_FLOW_CAPABILITY_UNSUPPORTED_FRAMEWORK",
374
+ "DATA_FLOW_SOURCE_UNAVAILABLE",
375
+ "DATA_FLOW_SOURCE_STALE",
376
+ "DATA_FLOW_ANALYSIS_TIMEOUT",
377
+ "DATA_FLOW_ANALYSIS_TRUNCATED",
378
+ "DATA_FLOW_ANALYSIS_UNRESOLVED_CALL",
379
+ "DATA_FLOW_OBSERVATION_UNASSIGNED",
380
+ "DATA_FLOW_OBSERVATION_DROPPED",
381
+ "DATA_FLOW_REDACTION_APPLIED",
382
+ "DATA_FLOW_AI_DISABLED"
383
+ ]);
384
+ var boundedText = (maximum) => import_zod.z.string().trim().min(1).max(maximum);
385
+ var opaqueIdSchema = boundedText(128).regex(/^[A-Za-z0-9_-]+$/u);
386
+ var diagnosticCodeSchema = import_zod.z.enum(DATA_FLOW_DIAGNOSTIC_CODES);
387
+ var evidenceSourceSchema = import_zod.z.strictObject({
388
+ fileId: opaqueIdSchema,
389
+ displayPath: boundedText(1024),
390
+ line: import_zod.z.number().int().positive(),
391
+ column: import_zod.z.number().int().positive(),
392
+ sourceVersion: opaqueIdSchema
393
+ });
394
+ var sanitizedObservedUrlSchema = import_zod.z.strictObject({
395
+ origin: boundedText(512).optional(),
396
+ pathname: boundedText(2048),
397
+ queryKeys: import_zod.z.array(boundedText(256)).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields)
398
+ });
399
+ var dataParameterSchema = import_zod.z.strictObject({
400
+ path: boundedText(1024),
401
+ position: import_zod.z.enum([
402
+ "path",
403
+ "query",
404
+ "body",
405
+ "header",
406
+ "cookie",
407
+ "variable",
408
+ "form",
409
+ "unknown"
410
+ ]),
411
+ type: boundedText(512).optional(),
412
+ source: boundedText(1024).optional(),
413
+ condition: boundedText(1024).optional(),
414
+ sensitive: import_zod.z.boolean(),
415
+ valueState: import_zod.z.literal("not-collected"),
416
+ evidenceIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence)
417
+ });
418
+ var dataResponseSchema = import_zod.z.strictObject({
419
+ consumedFields: import_zod.z.array(boundedText(1024)).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields)
420
+ });
421
+ var requestOriginSchema = import_zod.z.strictObject({
422
+ componentSourceId: opaqueIdSchema.optional(),
423
+ triggerCallsiteId: opaqueIdSchema.optional(),
424
+ requestCallsiteId: opaqueIdSchema,
425
+ sourceVersion: opaqueIdSchema
426
+ });
427
+ var capabilityReasonSchema = import_zod.z.strictObject({
428
+ code: diagnosticCodeSchema,
429
+ retryable: import_zod.z.boolean()
430
+ });
431
+ var capabilitySchema = import_zod.z.strictObject({
432
+ enabled: import_zod.z.boolean(),
433
+ staticAnalysis: import_zod.z.enum(["available", "partial", "unavailable"]),
434
+ runtimeObservation: import_zod.z.literal("dispatch-only"),
435
+ responseShape: import_zod.z.literal("consumed-fields-only"),
436
+ aiAssistance: import_zod.z.literal("disabled"),
437
+ reasons: import_zod.z.array(capabilityReasonSchema).max(DEFAULT_DATA_FLOW_LIMITS.capabilityMaxReasons)
438
+ });
439
+ var evidenceSchema = import_zod.z.strictObject({
440
+ id: opaqueIdSchema,
441
+ kind: import_zod.z.enum([
442
+ "source-anchor",
443
+ "import-resolution",
444
+ "symbol-edge",
445
+ "trigger-edge",
446
+ "call-edge",
447
+ "data-binding",
448
+ "adapter-rule",
449
+ "runtime-observation",
450
+ "runtime-reference",
451
+ "diagnostic"
452
+ ]),
453
+ source: evidenceSourceSchema.optional(),
454
+ adapter: import_zod.z.strictObject({ id: boundedText(128), version: boundedText(64) }).optional(),
455
+ summaryKey: boundedText(256)
456
+ });
457
+ var diagnosticSchema = import_zod.z.strictObject({
458
+ id: opaqueIdSchema,
459
+ code: diagnosticCodeSchema,
460
+ severity: import_zod.z.enum(["info", "warning", "error"]),
461
+ retryable: import_zod.z.boolean(),
462
+ evidenceIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence)
463
+ });
464
+ var baselineSchema = import_zod.z.strictObject({
465
+ registryEpoch: opaqueIdSchema,
466
+ analyzerVersion: boundedText(64),
467
+ adapterSetHash: boundedText(128),
468
+ analyzedSourceVersions: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxModules)
469
+ });
470
+ var completenessSchema = import_zod.z.strictObject({
471
+ complete: import_zod.z.boolean(),
472
+ visitedModules: import_zod.z.number().int().nonnegative(),
473
+ visitedCallsites: import_zod.z.number().int().nonnegative(),
474
+ frontierCount: import_zod.z.number().int().nonnegative(),
475
+ truncatedBy: import_zod.z.enum(["depth", "modules", "callsites", "bytes", "timeout"]).optional()
476
+ });
477
+ var dataDependencySchema = import_zod.z.strictObject({
478
+ id: opaqueIdSchema,
479
+ kind: import_zod.z.enum(["http", "graphql", "rpc", "server-action", "unknown"]),
480
+ direction: import_zod.z.enum(["read", "write", "read-write", "unknown"]),
481
+ execution: import_zod.z.enum(DATA_FLOW_EXECUTION_STATES),
482
+ proof: import_zod.z.enum(DATA_FLOW_PROOF_STATES),
483
+ association: import_zod.z.enum(DATA_FLOW_ASSOCIATION_KINDS),
484
+ method: boundedText(32).optional(),
485
+ operation: boundedText(512).optional(),
486
+ url: sanitizedObservedUrlSchema.optional(),
487
+ parameters: import_zod.z.array(dataParameterSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields),
488
+ response: dataResponseSchema,
489
+ origin: requestOriginSchema.optional(),
490
+ suppliedBindings: import_zod.z.array(boundedText(1024)).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
491
+ locationIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
492
+ evidenceIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence),
493
+ observationIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.observationMaxEntries)
494
+ });
495
+ var networkObservationSchema = import_zod.z.strictObject({
496
+ schemaVersion: import_zod.z.literal(DATA_FLOW_SCHEMA_VERSION),
497
+ id: opaqueIdSchema,
498
+ pageEpoch: opaqueIdSchema,
499
+ routeEpoch: opaqueIdSchema,
500
+ requestCallsiteId: opaqueIdSchema.optional(),
501
+ invocationId: opaqueIdSchema.optional(),
502
+ componentSourceId: opaqueIdSchema.optional(),
503
+ triggerCallsiteId: opaqueIdSchema.optional(),
504
+ sourceVersion: opaqueIdSchema.optional(),
505
+ transport: import_zod.z.enum(["fetch", "trpc", "xhr"]),
506
+ method: boundedText(32),
507
+ operation: boundedText(512).optional(),
508
+ url: sanitizedObservedUrlSchema,
509
+ outcome: import_zod.z.literal("dispatched"),
510
+ freshness: import_zod.z.enum(DATA_FLOW_FRESHNESS_STATES),
511
+ diagnosticIds: import_zod.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence)
512
+ });
513
+ var componentIdentitySchema = import_zod.z.strictObject({
514
+ componentSourceId: opaqueIdSchema.optional(),
515
+ displayName: boundedText(256).optional(),
516
+ source: evidenceSourceSchema
517
+ });
518
+ var componentDataFlowReportSchema = import_zod.z.strictObject({
519
+ schemaVersion: import_zod.z.literal(DATA_FLOW_SCHEMA_VERSION),
520
+ reportId: opaqueIdSchema,
521
+ baseline: baselineSchema,
522
+ capability: capabilitySchema,
523
+ component: componentIdentitySchema,
524
+ dependencies: import_zod.z.array(dataDependencySchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
525
+ evidence: import_zod.z.array(evidenceSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence),
526
+ diagnostics: import_zod.z.array(diagnosticSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxDiagnostics),
527
+ completeness: completenessSchema
528
+ });
529
+ var pageDataFlowReportSchema = import_zod.z.strictObject({
530
+ schemaVersion: import_zod.z.literal(DATA_FLOW_SCHEMA_VERSION),
531
+ reportId: opaqueIdSchema,
532
+ baseline: baselineSchema,
533
+ capability: capabilitySchema,
534
+ dependencies: import_zod.z.array(dataDependencySchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites),
535
+ evidence: import_zod.z.array(evidenceSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence),
536
+ diagnostics: import_zod.z.array(diagnosticSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxDiagnostics),
537
+ completeness: completenessSchema
538
+ });
539
+ var runtimeDataFlowConfigSchema = import_zod.z.strictObject({
540
+ enabled: import_zod.z.boolean(),
541
+ runtime: import_zod.z.literal("dispatch"),
542
+ limits: import_zod.z.strictObject({
543
+ observationMaxEntries: import_zod.z.number().int().positive(),
544
+ observationMaxBytes: import_zod.z.number().int().positive(),
545
+ observationTtlMs: import_zod.z.number().int().positive(),
546
+ reportMaxBytes: import_zod.z.number().int().positive()
547
+ })
548
+ });
549
+
550
+ // src/model/data-flow-budget.ts
551
+ function prefix(values, maximum) {
552
+ return Object.freeze(values.slice(0, Math.max(0, maximum)));
553
+ }
554
+ function limitDependency(dependency) {
555
+ const queryKeys = dependency.url === void 0 ? void 0 : prefix(dependency.url.queryKeys, DEFAULT_DATA_FLOW_LIMITS.reportMaxFields);
556
+ const parameters = prefix(
557
+ dependency.parameters,
558
+ DEFAULT_DATA_FLOW_LIMITS.reportMaxFields
559
+ ).map(
560
+ (parameter) => Object.freeze({
561
+ ...parameter,
562
+ evidenceIds: prefix(
563
+ parameter.evidenceIds,
564
+ DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence
565
+ )
566
+ })
567
+ );
568
+ const consumedFields = prefix(
569
+ dependency.response.consumedFields,
570
+ DEFAULT_DATA_FLOW_LIMITS.reportMaxFields
571
+ );
572
+ const suppliedBindings = prefix(
573
+ dependency.suppliedBindings,
574
+ DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites
575
+ );
576
+ const locationIds = prefix(
577
+ dependency.locationIds,
578
+ DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites
579
+ );
580
+ const evidenceIds = prefix(
581
+ dependency.evidenceIds,
582
+ DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence
583
+ );
584
+ const observationIds = prefix(
585
+ dependency.observationIds,
586
+ DEFAULT_DATA_FLOW_LIMITS.observationMaxEntries
587
+ );
588
+ const trimmed = queryKeys?.length !== dependency.url?.queryKeys.length || parameters.length !== dependency.parameters.length || parameters.some(
589
+ (parameter, index) => parameter.evidenceIds.length !== dependency.parameters[index]?.evidenceIds.length
590
+ ) || consumedFields.length !== dependency.response.consumedFields.length || suppliedBindings.length !== dependency.suppliedBindings.length || locationIds.length !== dependency.locationIds.length || evidenceIds.length !== dependency.evidenceIds.length || observationIds.length !== dependency.observationIds.length;
591
+ if (!trimmed) return Object.freeze({ dependency, trimmed: false });
592
+ return Object.freeze({
593
+ dependency: Object.freeze({
594
+ ...dependency,
595
+ ...dependency.url === void 0 ? {} : {
596
+ url: Object.freeze({
597
+ ...dependency.url,
598
+ queryKeys: queryKeys ?? Object.freeze([])
599
+ })
600
+ },
601
+ parameters: Object.freeze(parameters),
602
+ response: Object.freeze({ consumedFields }),
603
+ suppliedBindings,
604
+ locationIds,
605
+ evidenceIds,
606
+ observationIds
607
+ }),
608
+ trimmed: true
609
+ });
610
+ }
611
+ function referencedEvidenceIds(dependencies, diagnostics) {
612
+ return Object.freeze([
613
+ .../* @__PURE__ */ new Set([
614
+ ...dependencies.flatMap((dependency) => [
615
+ ...dependency.evidenceIds,
616
+ ...dependency.parameters.flatMap((parameter) => parameter.evidenceIds)
617
+ ]),
618
+ ...diagnostics.flatMap((diagnostic) => diagnostic.evidenceIds)
619
+ ])
620
+ ]);
621
+ }
622
+ function prioritizeEvidence(evidence, referencedIds, retainUnreferenced) {
623
+ const byId = new Map(evidence.map((entry) => [entry.id, entry]));
624
+ const ordered = [];
625
+ const retained = /* @__PURE__ */ new Set();
626
+ for (const id of referencedIds) {
627
+ const entry = byId.get(id);
628
+ if (entry !== void 0 && !retained.has(id)) {
629
+ ordered.push(entry);
630
+ retained.add(id);
631
+ }
632
+ }
633
+ if (retainUnreferenced) {
634
+ for (const entry of evidence) {
635
+ if (!retained.has(entry.id)) ordered.push(entry);
636
+ }
637
+ }
638
+ return prefix(ordered, DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence);
639
+ }
640
+ function pruneEvidenceReferences(dependency, retainedIds) {
641
+ return Object.freeze({
642
+ ...dependency,
643
+ parameters: Object.freeze(
644
+ dependency.parameters.map(
645
+ (parameter) => Object.freeze({
646
+ ...parameter,
647
+ evidenceIds: Object.freeze(
648
+ parameter.evidenceIds.filter((id) => retainedIds.has(id))
649
+ )
650
+ })
651
+ )
652
+ ),
653
+ evidenceIds: Object.freeze(
654
+ dependency.evidenceIds.filter((id) => retainedIds.has(id))
655
+ )
656
+ });
657
+ }
658
+ function truncationCode(mode) {
659
+ return mode === "analysis" ? "DATA_FLOW_ANALYSIS_TRUNCATED" : "DATA_FLOW_OBSERVATION_DROPPED";
660
+ }
661
+ function limitDataFlowReportCollections(report, options = {}) {
662
+ const maximumDependencies = Math.min(
663
+ Math.max(
664
+ 0,
665
+ options.maximumDependencies ?? DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites
666
+ ),
667
+ DEFAULT_DATA_FLOW_LIMITS.graphMaxCallsites
668
+ );
669
+ const dependencyResults = prefix(report.dependencies, maximumDependencies).map(
670
+ limitDependency
671
+ );
672
+ const dependencies = dependencyResults.map(({ dependency }) => dependency);
673
+ const analyzedSourceVersions = prefix(
674
+ report.baseline.analyzedSourceVersions,
675
+ DEFAULT_DATA_FLOW_LIMITS.graphMaxModules
676
+ );
677
+ const collectionTrimmed = report.dependencies.length > dependencies.length || dependencyResults.some(({ trimmed }) => trimmed) || report.baseline.analyzedSourceVersions.length > analyzedSourceVersions.length || report.capability.reasons.length > DEFAULT_DATA_FLOW_LIMITS.capabilityMaxReasons || report.evidence.length > DEFAULT_DATA_FLOW_LIMITS.reportMaxEvidence || report.diagnostics.length > DEFAULT_DATA_FLOW_LIMITS.reportMaxDiagnostics;
678
+ const truncated = options.forceTruncation === true || collectionTrimmed;
679
+ if (!truncated) return report;
680
+ const mode = options.mode ?? "analysis";
681
+ const code = truncationCode(mode);
682
+ const diagnosticId = `${report.reportId}_collection_${mode}`;
683
+ const reasons = Object.freeze([
684
+ ...report.capability.reasons.filter((reason) => reason.code !== code).slice(0, DEFAULT_DATA_FLOW_LIMITS.capabilityMaxReasons - 1),
685
+ Object.freeze({ code, retryable: false })
686
+ ]);
687
+ const diagnostics = Object.freeze([
688
+ ...report.diagnostics.filter((diagnostic) => diagnostic.id !== diagnosticId).slice(0, DEFAULT_DATA_FLOW_LIMITS.reportMaxDiagnostics - 1),
689
+ Object.freeze({
690
+ id: diagnosticId,
691
+ code,
692
+ severity: "warning",
693
+ retryable: false,
694
+ evidenceIds: Object.freeze([])
695
+ })
696
+ ]);
697
+ const referencedIds = referencedEvidenceIds(dependencies, diagnostics);
698
+ const evidence = prioritizeEvidence(
699
+ report.evidence,
700
+ referencedIds,
701
+ report.dependencies.length === dependencies.length
702
+ );
703
+ const retainedEvidenceIds = new Set(evidence.map(({ id }) => id));
704
+ const prunedDependencies = Object.freeze(
705
+ dependencies.map(
706
+ (dependency) => pruneEvidenceReferences(dependency, retainedEvidenceIds)
707
+ )
708
+ );
709
+ const prunedDiagnostics = Object.freeze(
710
+ diagnostics.map(
711
+ (diagnostic) => Object.freeze({
712
+ ...diagnostic,
713
+ evidenceIds: Object.freeze(
714
+ diagnostic.evidenceIds.filter((id) => retainedEvidenceIds.has(id))
715
+ )
716
+ })
717
+ )
718
+ );
719
+ const removedDependencies = report.dependencies.length - dependencies.length;
720
+ const removedModules = report.baseline.analyzedSourceVersions.length - analyzedSourceVersions.length;
721
+ const derivedTruncation = removedModules > 0 && removedDependencies === 0 ? "modules" : "callsites";
722
+ return Object.freeze({
723
+ ...report,
724
+ baseline: Object.freeze({
725
+ ...report.baseline,
726
+ analyzedSourceVersions
727
+ }),
728
+ capability: Object.freeze({
729
+ ...report.capability,
730
+ ...mode === "analysis" && report.capability.staticAnalysis === "available" ? { staticAnalysis: "partial" } : {},
731
+ reasons
732
+ }),
733
+ dependencies: prunedDependencies,
734
+ evidence,
735
+ diagnostics: prunedDiagnostics,
736
+ ...mode === "analysis" ? {
737
+ completeness: Object.freeze({
738
+ ...report.completeness,
739
+ complete: false,
740
+ frontierCount: report.completeness.frontierCount + removedDependencies + removedModules + (collectionTrimmed && removedDependencies === 0 && removedModules === 0 ? 1 : 0),
741
+ truncatedBy: options.truncatedBy ?? report.completeness.truncatedBy ?? derivedTruncation
742
+ })
743
+ } : {}
744
+ });
745
+ }
746
+
747
+ // src/model/runtime-config.ts
748
+ var import_zod2 = require("zod");
749
+
202
750
  // src/protocol/endpoints.ts
203
751
  var SPOTPATCH_API_BASE = "/__spotpatch/v1";
204
752
  var SPOTPATCH_TOKEN_HEADER = "X-SpotPatch-Token";
@@ -206,9 +754,15 @@ var SPOTPATCH_ENDPOINTS = Object.freeze({
206
754
  bootstrap: `${SPOTPATCH_API_BASE}/bootstrap`,
207
755
  sourceContext: `${SPOTPATCH_API_BASE}/source-context`,
208
756
  openEditor: `${SPOTPATCH_API_BASE}/open-editor`,
757
+ dataFlowComponentReport: `${SPOTPATCH_API_BASE}/data-flow/component-report`,
758
+ dataFlowPageReport: `${SPOTPATCH_API_BASE}/data-flow/page-report`,
209
759
  agentCapability: `${SPOTPATCH_API_BASE}/agent/capability`,
210
760
  agentWorkspaceHealth: `${SPOTPATCH_API_BASE}/agent/workspace-health`,
211
- agentJobs: `${SPOTPATCH_API_BASE}/agent/jobs`
761
+ agentJobs: `${SPOTPATCH_API_BASE}/agent/jobs`,
762
+ externalHandoffCapability: `${SPOTPATCH_API_BASE}/external-handoff/capability`,
763
+ externalHandoffPublish: `${SPOTPATCH_API_BASE}/external-handoff/publish`,
764
+ externalHandoffStatus: `${SPOTPATCH_API_BASE}/external-handoff/status`,
765
+ externalHandoffResolveDelivery: `${SPOTPATCH_API_BASE}/external-handoff/resolve-delivery`
212
766
  });
213
767
  function getAgentJobEndpoint(jobId, action) {
214
768
  return `${SPOTPATCH_ENDPOINTS.agentJobs}/${encodeURIComponent(jobId)}/${action}`;
@@ -287,39 +841,39 @@ var SPOTPATCH_NEXT_ROUTER_KINDS = Object.freeze([
287
841
  "pages",
288
842
  "hybrid"
289
843
  ]);
290
- var boundedText = (maximum) => import_zod.z.string().trim().min(1).max(maximum);
291
- var profileIdSchema = import_zod.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/u);
292
- var runtimeAiModelSchema = import_zod.z.strictObject({
844
+ var boundedText2 = (maximum) => import_zod2.z.string().trim().min(1).max(maximum);
845
+ var profileIdSchema = import_zod2.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/u);
846
+ var runtimeAiModelSchema = import_zod2.z.strictObject({
293
847
  id: profileIdSchema,
294
- label: boundedText(100)
848
+ label: boundedText2(100)
295
849
  });
296
- var runtimeAiProviderSchema = import_zod.z.strictObject({
850
+ var runtimeAiProviderSchema = import_zod2.z.strictObject({
297
851
  id: profileIdSchema,
298
- label: boundedText(100),
299
- protocol: import_zod.z.enum(["responses", "chat-completions"]),
300
- models: import_zod.z.array(runtimeAiModelSchema).min(1).max(64),
852
+ label: boundedText2(100),
853
+ protocol: import_zod2.z.enum(["responses", "chat-completions"]),
854
+ models: import_zod2.z.array(runtimeAiModelSchema).min(1).max(64),
301
855
  defaultModel: profileIdSchema
302
856
  }).refine(
303
857
  ({ defaultModel, models }) => models.some(({ id }) => id === defaultModel) && new Set(models.map(({ id }) => id)).size === models.length,
304
858
  { message: "Runtime AI model profiles are inconsistent." }
305
859
  );
306
- var runtimeAiConfigSchema = import_zod.z.discriminatedUnion("enabled", [
307
- import_zod.z.strictObject({ enabled: import_zod.z.literal(false) }),
308
- import_zod.z.strictObject({
309
- enabled: import_zod.z.literal(true),
310
- providers: import_zod.z.array(runtimeAiProviderSchema).min(1).max(32),
860
+ var runtimeAiConfigSchema = import_zod2.z.discriminatedUnion("enabled", [
861
+ import_zod2.z.strictObject({ enabled: import_zod2.z.literal(false) }),
862
+ import_zod2.z.strictObject({
863
+ enabled: import_zod2.z.literal(true),
864
+ providers: import_zod2.z.array(runtimeAiProviderSchema).min(1).max(32),
311
865
  defaultProvider: profileIdSchema,
312
- applyMode: import_zod.z.enum(AGENT_APPLY_MODES)
866
+ applyMode: import_zod2.z.enum(AGENT_APPLY_MODES)
313
867
  }).refine(
314
868
  ({ defaultProvider, providers }) => providers.some(({ id }) => id === defaultProvider) && new Set(providers.map(({ id }) => id)).size === providers.length,
315
869
  { message: "Runtime AI provider profiles are inconsistent." }
316
870
  )
317
871
  ]);
318
- var positiveInteger = import_zod.z.number().int().positive();
872
+ var positiveInteger = import_zod2.z.number().int().positive();
319
873
  var runtimeConfigBaseShape = {
320
- apiBase: import_zod.z.literal(SPOTPATCH_API_BASE),
874
+ apiBase: import_zod2.z.literal(SPOTPATCH_API_BASE),
321
875
  ai: runtimeAiConfigSchema,
322
- budget: import_zod.z.strictObject({
876
+ budget: import_zod2.z.strictObject({
323
877
  totalCharacters: positiveInteger,
324
878
  domCharacters: positiveInteger,
325
879
  cssCharacters: positiveInteger,
@@ -327,27 +881,29 @@ var runtimeConfigBaseShape = {
327
881
  maxCodeLines: positiveInteger,
328
882
  maxComponentDepth: positiveInteger
329
883
  }),
330
- debug: import_zod.z.boolean(),
331
- editor: import_zod.z.enum(SPOTPATCH_EDITOR_PREFERENCES),
332
- frameworkVersion: boundedText(64),
333
- locale: import_zod.z.enum(SPOTPATCH_LOCALE_PREFERENCES),
334
- maxTargets: import_zod.z.number().int().min(1).max(MAX_ANNOTATION_TARGETS),
335
- redact: import_zod.z.boolean(),
336
- sessionId: import_zod.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
337
- sessionToken: import_zod.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
338
- shortcut: boundedText(128),
339
- spotPatchVersion: boundedText(64)
884
+ debug: import_zod2.z.boolean(),
885
+ dataFlow: runtimeDataFlowConfigSchema,
886
+ editor: import_zod2.z.enum(SPOTPATCH_EDITOR_PREFERENCES),
887
+ externalAgent: import_zod2.z.strictObject({ enabled: import_zod2.z.boolean() }),
888
+ frameworkVersion: boundedText2(64),
889
+ locale: import_zod2.z.enum(SPOTPATCH_LOCALE_PREFERENCES),
890
+ maxTargets: import_zod2.z.number().int().min(1).max(MAX_ANNOTATION_TARGETS),
891
+ redact: import_zod2.z.boolean(),
892
+ sessionId: import_zod2.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
893
+ sessionToken: import_zod2.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
894
+ shortcut: boundedText2(128),
895
+ spotPatchVersion: boundedText2(64)
340
896
  };
341
- var runtimeConfigSchema = import_zod.z.discriminatedUnion("framework", [
342
- import_zod.z.strictObject({
897
+ var runtimeConfigSchema = import_zod2.z.discriminatedUnion("framework", [
898
+ import_zod2.z.strictObject({
343
899
  ...runtimeConfigBaseShape,
344
- framework: import_zod.z.literal("vite")
900
+ framework: import_zod2.z.literal("vite")
345
901
  }),
346
- import_zod.z.strictObject({
902
+ import_zod2.z.strictObject({
347
903
  ...runtimeConfigBaseShape,
348
- bundler: import_zod.z.enum(SPOTPATCH_NEXT_BUNDLERS),
349
- framework: import_zod.z.literal("next"),
350
- routerKind: import_zod.z.enum(SPOTPATCH_NEXT_ROUTER_KINDS)
904
+ bundler: import_zod2.z.enum(SPOTPATCH_NEXT_BUNDLERS),
905
+ framework: import_zod2.z.literal("next"),
906
+ routerKind: import_zod2.z.enum(SPOTPATCH_NEXT_ROUTER_KINDS)
351
907
  })
352
908
  ]);
353
909
 
@@ -374,91 +930,113 @@ function parseSourceMarker(value) {
374
930
  return Object.freeze({ fileId, line, column });
375
931
  }
376
932
 
933
+ // src/protocol/external-handoff.ts
934
+ var import_zod4 = require("zod");
935
+
377
936
  // src/protocol/requests.ts
378
- var import_zod2 = require("zod");
379
- var runtimeBootstrapRequestSchema = import_zod2.z.strictObject({});
380
- var sourceCoordinatesSchema = import_zod2.z.strictObject({
381
- fileId: import_zod2.z.string().min(1).max(128),
382
- line: import_zod2.z.number().int().positive(),
383
- column: import_zod2.z.number().int().positive()
937
+ var import_zod3 = require("zod");
938
+ var runtimeBootstrapRequestSchema = import_zod3.z.strictObject({});
939
+ var sourceCoordinatesSchema = import_zod3.z.strictObject({
940
+ fileId: import_zod3.z.string().min(1).max(128),
941
+ line: import_zod3.z.number().int().positive(),
942
+ column: import_zod3.z.number().int().positive()
384
943
  });
385
944
  var sourceContextRequestSchema = sourceCoordinatesSchema.extend({
386
- maxLines: import_zod2.z.number().int().positive()
945
+ maxLines: import_zod3.z.number().int().positive()
387
946
  }).strict();
388
947
  var openEditorRequestSchema = sourceCoordinatesSchema.strict();
389
- var profileIdSchema2 = import_zod2.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
390
- var boundedString = (maximum) => import_zod2.z.string().max(maximum);
391
- var sourceRefSchema = import_zod2.z.strictObject({
948
+ var dataFlowSourceCoordinatesRequestSchema = sourceCoordinatesSchema.extend({
949
+ schemaVersion: import_zod3.z.literal(1),
950
+ sourceVersion: import_zod3.z.string().min(1).max(128).optional()
951
+ }).strict();
952
+ var dataFlowComponentIdentityRequestSchema = import_zod3.z.strictObject({
953
+ schemaVersion: import_zod3.z.literal(1),
954
+ componentSourceId: import_zod3.z.string().min(1).max(128),
955
+ sourceVersion: import_zod3.z.string().min(1).max(128)
956
+ });
957
+ var dataFlowComponentReportRequestSchema = import_zod3.z.union([
958
+ dataFlowSourceCoordinatesRequestSchema,
959
+ dataFlowComponentIdentityRequestSchema
960
+ ]);
961
+ var dataFlowPageReportRequestSchema = import_zod3.z.strictObject({
962
+ schemaVersion: import_zod3.z.literal(1),
963
+ targets: import_zod3.z.array(dataFlowComponentReportRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS)
964
+ });
965
+ var profileIdSchema2 = import_zod3.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
966
+ var boundedString = (maximum) => import_zod3.z.string().max(maximum);
967
+ var sourceRefSchema = import_zod3.z.strictObject({
392
968
  fileId: boundedString(128).optional(),
393
969
  relativePath: boundedString(1024).optional(),
394
- line: import_zod2.z.number().int().positive().optional(),
395
- column: import_zod2.z.number().int().positive().optional(),
396
- origin: import_zod2.z.enum(["jsx-host", "react-fiber", "dom-ancestor", "none"]),
397
- confidence: import_zod2.z.enum(["exact", "probable", "approximate", "unknown"])
970
+ line: import_zod3.z.number().int().positive().optional(),
971
+ column: import_zod3.z.number().int().positive().optional(),
972
+ origin: import_zod3.z.enum(["jsx-host", "react-fiber", "dom-ancestor", "none"]),
973
+ confidence: import_zod3.z.enum(["exact", "probable", "approximate", "unknown"])
398
974
  });
399
- var matchedStyleRuleSchema = import_zod2.z.strictObject({
975
+ var matchedStyleRuleSchema = import_zod3.z.strictObject({
400
976
  selector: boundedString(2048),
401
977
  declarations: boundedString(8192),
402
978
  source: boundedString(1024).optional(),
403
979
  media: boundedString(1024).optional()
404
980
  });
405
- var codeContextSchema = import_zod2.z.strictObject({
981
+ var codeContextSchema = import_zod3.z.strictObject({
406
982
  relativePath: boundedString(1024),
407
- language: import_zod2.z.enum(["tsx", "jsx"]),
408
- startLine: import_zod2.z.number().int().positive(),
409
- endLine: import_zod2.z.number().int().positive(),
983
+ language: import_zod3.z.enum(["tsx", "jsx"]),
984
+ startLine: import_zod3.z.number().int().positive(),
985
+ endLine: import_zod3.z.number().int().positive(),
410
986
  excerpt: boundedString(16e3),
411
- boundary: import_zod2.z.enum(["component", "nearby-lines"])
987
+ boundary: import_zod3.z.enum(["component", "nearby-lines"])
412
988
  });
413
- var pageContextSchema = import_zod2.z.strictObject({
989
+ var pageContextSchema = import_zod3.z.strictObject({
414
990
  url: boundedString(2048),
415
991
  pathname: boundedString(2048),
416
992
  title: boundedString(1024),
417
- viewportWidth: import_zod2.z.number().nonnegative(),
418
- viewportHeight: import_zod2.z.number().nonnegative(),
419
- devicePixelRatio: import_zod2.z.number().positive()
993
+ viewportWidth: import_zod3.z.number().nonnegative(),
994
+ viewportHeight: import_zod3.z.number().nonnegative(),
995
+ devicePixelRatio: import_zod3.z.number().positive()
420
996
  });
421
- var spotTargetContextRequestSchema = import_zod2.z.strictObject({
422
- instruction: import_zod2.z.string().trim().min(1).max(MAX_TARGET_INSTRUCTION_CHARACTERS),
997
+ var spotTargetContextRequestSchema = import_zod3.z.strictObject({
998
+ instruction: import_zod3.z.string().trim().min(1).max(MAX_TARGET_INSTRUCTION_CHARACTERS),
423
999
  page: pageContextSchema.optional(),
424
1000
  source: sourceRefSchema,
425
- react: import_zod2.z.strictObject({
426
- supported: import_zod2.z.boolean(),
1001
+ react: import_zod3.z.strictObject({
1002
+ supported: import_zod3.z.boolean(),
427
1003
  version: boundedString(64).optional(),
428
1004
  componentName: boundedString(256).optional(),
429
- componentStack: import_zod2.z.array(boundedString(256)).max(64),
1005
+ componentSourceId: boundedString(128).optional(),
1006
+ sourceVersion: boundedString(128).optional(),
1007
+ componentStack: import_zod3.z.array(boundedString(256)).max(64),
430
1008
  source: sourceRefSchema.optional()
431
1009
  }),
432
- element: import_zod2.z.strictObject({
1010
+ element: import_zod3.z.strictObject({
433
1011
  tagName: boundedString(128),
434
1012
  selector: boundedString(2048),
435
1013
  sanitizedHtml: boundedString(8192),
436
1014
  textPreview: boundedString(2048).optional(),
437
1015
  role: boundedString(256).optional(),
438
- rect: import_zod2.z.strictObject({
439
- x: import_zod2.z.number(),
440
- y: import_zod2.z.number(),
441
- width: import_zod2.z.number().nonnegative(),
442
- height: import_zod2.z.number().nonnegative()
1016
+ rect: import_zod3.z.strictObject({
1017
+ x: import_zod3.z.number(),
1018
+ y: import_zod3.z.number(),
1019
+ width: import_zod3.z.number().nonnegative(),
1020
+ height: import_zod3.z.number().nonnegative()
443
1021
  })
444
1022
  }),
445
- styles: import_zod2.z.strictObject({
446
- classNames: import_zod2.z.array(boundedString(512)).max(256),
1023
+ styles: import_zod3.z.strictObject({
1024
+ classNames: import_zod3.z.array(boundedString(512)).max(256),
447
1025
  inlineStyle: boundedString(8192).optional(),
448
- matchedRules: import_zod2.z.array(matchedStyleRuleSchema).max(256),
449
- computed: import_zod2.z.record(boundedString(256), boundedString(2048)),
450
- warnings: import_zod2.z.array(boundedString(1024)).max(64)
1026
+ matchedRules: import_zod3.z.array(matchedStyleRuleSchema).max(256),
1027
+ computed: import_zod3.z.record(boundedString(256), boundedString(2048)),
1028
+ warnings: import_zod3.z.array(boundedString(1024)).max(64)
451
1029
  }),
452
1030
  code: codeContextSchema.optional(),
453
- warnings: import_zod2.z.array(boundedString(1024)).max(64)
1031
+ warnings: import_zod3.z.array(boundedString(1024)).max(64)
454
1032
  });
455
- var spotAnnotationRequestSchema = import_zod2.z.strictObject({
456
- schemaVersion: import_zod2.z.literal(3),
1033
+ var spotAnnotationRequestSchema = import_zod3.z.strictObject({
1034
+ schemaVersion: import_zod3.z.literal(3),
457
1035
  id: boundedString(128),
458
- locale: import_zod2.z.enum(SPOTPATCH_LOCALES),
1036
+ locale: import_zod3.z.enum(SPOTPATCH_LOCALES),
459
1037
  page: pageContextSchema,
460
- targets: import_zod2.z.array(spotTargetContextRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS),
461
- createdAt: import_zod2.z.iso.datetime()
1038
+ targets: import_zod3.z.array(spotTargetContextRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS),
1039
+ createdAt: import_zod3.z.iso.datetime()
462
1040
  }).superRefine((annotation, context) => {
463
1041
  const total = annotation.targets.reduce(
464
1042
  (characters, target) => characters + target.instruction.length,
@@ -472,53 +1050,212 @@ var spotAnnotationRequestSchema = import_zod2.z.strictObject({
472
1050
  });
473
1051
  }
474
1052
  });
475
- var agentCapabilityRequestSchema = import_zod2.z.strictObject({
1053
+ var agentCapabilityRequestSchema = import_zod3.z.strictObject({
476
1054
  providerProfileId: profileIdSchema2,
477
1055
  modelProfileId: profileIdSchema2
478
1056
  });
479
- var agentWorkspaceHealthRequestSchema = import_zod2.z.strictObject({});
480
- var agentJobCreateRequestSchema = import_zod2.z.strictObject({
1057
+ var agentWorkspaceHealthRequestSchema = import_zod3.z.strictObject({});
1058
+ var agentJobCreateRequestSchema = import_zod3.z.strictObject({
481
1059
  annotation: spotAnnotationRequestSchema,
482
- applyMode: import_zod2.z.enum(AGENT_APPLY_MODES).optional(),
1060
+ applyMode: import_zod3.z.enum(AGENT_APPLY_MODES).optional(),
483
1061
  providerProfileId: profileIdSchema2,
484
1062
  modelProfileId: profileIdSchema2,
485
- providerDataConsent: import_zod2.z.literal(true),
486
- trustedFastModeConsent: import_zod2.z.literal(true).optional(),
487
- workingTreeMode: import_zod2.z.enum(["require-clean", "include-local-changes"]).default("require-clean")
1063
+ providerDataConsent: import_zod3.z.literal(true),
1064
+ trustedFastModeConsent: import_zod3.z.literal(true).optional(),
1065
+ workingTreeMode: import_zod3.z.enum(["require-clean", "include-local-changes"]).default("require-clean")
1066
+ });
1067
+ var agentJobActionRequestSchema = import_zod3.z.strictObject({});
1068
+
1069
+ // src/protocol/external-handoff-constants.ts
1070
+ var EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION = 1;
1071
+ var EXTERNAL_HANDOFF_BROKER_PROTOCOL_VERSION = 2;
1072
+ var EXTERNAL_HANDOFF_STATES = Object.freeze([
1073
+ "available",
1074
+ "expired",
1075
+ "superseded"
1076
+ ]);
1077
+ var EXTERNAL_HANDOFF_FRAMEWORKS = Object.freeze(["vite", "next"]);
1078
+ var EXTERNAL_HANDOFF_ACTIVE_ADAPTER_KINDS = Object.freeze([
1079
+ "claude-channel",
1080
+ "codex-app-server"
1081
+ ]);
1082
+ var EXTERNAL_HANDOFF_ACTIVE_ADAPTER_STATES = Object.freeze([
1083
+ "ready",
1084
+ "busy",
1085
+ "blocked"
1086
+ ]);
1087
+ var EXTERNAL_HANDOFF_DISPATCH_PHASES = Object.freeze([
1088
+ "queued",
1089
+ "dispatching",
1090
+ "dispatched",
1091
+ "working",
1092
+ "completed",
1093
+ "failed",
1094
+ "delivery-unknown"
1095
+ ]);
1096
+ var EXTERNAL_HANDOFF_REPORTABLE_DISPATCH_PHASES = Object.freeze([
1097
+ "dispatching",
1098
+ "dispatched",
1099
+ "working",
1100
+ "completed",
1101
+ "failed",
1102
+ "delivery-unknown"
1103
+ ]);
1104
+ var EXTERNAL_HANDOFF_LIMITS = Object.freeze({
1105
+ maximumSnapshotBytes: 256 * 1024,
1106
+ maximumPublishBodyBytes: 256 * 1024,
1107
+ maximumBrokerRequestBytes: 8 * 1024,
1108
+ maximumDescriptorBytes: 8 * 1024,
1109
+ maximumHistorySummaries: 8,
1110
+ maximumConnectorReceipts: 64,
1111
+ handoffTtlMs: 15 * 60 * 1e3,
1112
+ defaultWaitMs: 2e4,
1113
+ maximumWaitMs: 25e3,
1114
+ maximumWaiters: 8,
1115
+ maximumDescriptorsPerScan: 32,
1116
+ maximumProjectAncestors: 64,
1117
+ maximumBrokerHeaderBytes: 8 * 1024,
1118
+ maximumBrokerSockets: 32,
1119
+ brokerDiscoveryTimeoutMs: 750,
1120
+ brokerRequestTimeoutMs: 2e3,
1121
+ brokerWaitGraceMs: 2e3,
1122
+ maximumSetupConfigBytes: 1024 * 1024,
1123
+ maximumRequestIdRecords: 16,
1124
+ requestIdTtlMs: 15 * 60 * 1e3,
1125
+ activeHeartbeatIntervalMs: 3e3,
1126
+ activeLeaseDurationMs: 1e4,
1127
+ activeTransportWriteTimeoutMs: 5e3,
1128
+ activeDispatchTimeoutMs: 30 * 60 * 1e3,
1129
+ activeStatusPollMs: 1e3
1130
+ });
1131
+
1132
+ // src/protocol/external-handoff.ts
1133
+ var opaqueIdSchema2 = import_zod4.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u);
1134
+ var isoTimestampSchema = import_zod4.z.iso.datetime();
1135
+ var externalHandoffReportableDispatchPhaseSchema = import_zod4.z.enum(
1136
+ EXTERNAL_HANDOFF_REPORTABLE_DISPATCH_PHASES
1137
+ );
1138
+ var externalHandoffPageSummarySchema = import_zod4.z.strictObject({
1139
+ origin: import_zod4.z.string().min(1).max(2048),
1140
+ pathname: import_zod4.z.string().min(1).max(2048)
1141
+ });
1142
+ var externalHandoffSummarySchema = import_zod4.z.strictObject({
1143
+ sessionId: opaqueIdSchema2,
1144
+ framework: import_zod4.z.enum(EXTERNAL_HANDOFF_FRAMEWORKS),
1145
+ revision: import_zod4.z.number().int().positive(),
1146
+ cursor: opaqueIdSchema2,
1147
+ targetCount: import_zod4.z.number().int().positive(),
1148
+ page: externalHandoffPageSummarySchema,
1149
+ publishedAt: isoTimestampSchema,
1150
+ expiresAt: isoTimestampSchema,
1151
+ state: import_zod4.z.enum(EXTERNAL_HANDOFF_STATES),
1152
+ pickupCount: import_zod4.z.number().int().nonnegative().max(EXTERNAL_HANDOFF_LIMITS.maximumConnectorReceipts),
1153
+ pickedUpAt: isoTimestampSchema.optional()
1154
+ });
1155
+ var externalHandoffSnapshotSchema = import_zod4.z.strictObject({
1156
+ schemaVersion: import_zod4.z.literal(EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION),
1157
+ cursor: opaqueIdSchema2,
1158
+ session: import_zod4.z.strictObject({
1159
+ id: opaqueIdSchema2,
1160
+ framework: import_zod4.z.enum(EXTERNAL_HANDOFF_FRAMEWORKS)
1161
+ }),
1162
+ revision: import_zod4.z.number().int().positive(),
1163
+ publishedAt: isoTimestampSchema,
1164
+ expiresAt: isoTimestampSchema,
1165
+ annotation: spotAnnotationRequestSchema
1166
+ });
1167
+ var activeAdapterSummarySchema = import_zod4.z.strictObject({
1168
+ kind: import_zod4.z.enum(EXTERNAL_HANDOFF_ACTIVE_ADAPTER_KINDS),
1169
+ state: import_zod4.z.enum(EXTERNAL_HANDOFF_ACTIVE_ADAPTER_STATES),
1170
+ canDispatch: import_zod4.z.boolean(),
1171
+ connectedAt: isoTimestampSchema,
1172
+ updatedAt: isoTimestampSchema
1173
+ }).superRefine((value, context) => {
1174
+ if (value.canDispatch !== (value.state === "ready")) {
1175
+ context.addIssue({
1176
+ code: "custom",
1177
+ message: "canDispatch must match the ready state.",
1178
+ path: ["canDispatch"]
1179
+ });
1180
+ }
1181
+ });
1182
+ var dispatchSummarySchema = import_zod4.z.strictObject({
1183
+ adapterKind: import_zod4.z.enum(EXTERNAL_HANDOFF_ACTIVE_ADAPTER_KINDS),
1184
+ revision: import_zod4.z.number().int().positive(),
1185
+ phase: import_zod4.z.enum(EXTERNAL_HANDOFF_DISPATCH_PHASES),
1186
+ updatedAt: isoTimestampSchema
1187
+ });
1188
+ var externalHandoffCapabilityRequestSchema = import_zod4.z.strictObject({});
1189
+ var externalHandoffPublishRequestSchema = import_zod4.z.strictObject({
1190
+ requestId: opaqueIdSchema2,
1191
+ annotation: spotAnnotationRequestSchema
1192
+ });
1193
+ var externalHandoffStatusRequestSchema = import_zod4.z.strictObject({
1194
+ cursor: opaqueIdSchema2.optional()
1195
+ });
1196
+ var externalHandoffResolveDeliveryRequestSchema = import_zod4.z.strictObject({
1197
+ cursor: opaqueIdSchema2,
1198
+ confirmation: import_zod4.z.literal("workspace-reviewed")
1199
+ });
1200
+ var externalHandoffCapabilitySchema = import_zod4.z.strictObject({
1201
+ enabled: import_zod4.z.literal(true),
1202
+ brokerReady: import_zod4.z.boolean(),
1203
+ activeWaitCount: import_zod4.z.number().int().nonnegative().max(EXTERNAL_HANDOFF_LIMITS.maximumWaiters),
1204
+ snapshotSchemaVersion: import_zod4.z.literal(EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION),
1205
+ brokerProtocolVersion: import_zod4.z.literal(EXTERNAL_HANDOFF_BROKER_PROTOCOL_VERSION),
1206
+ activeAdapter: activeAdapterSummarySchema.nullable(),
1207
+ dispatch: dispatchSummarySchema.nullable()
1208
+ });
1209
+ var externalHandoffPublishDeliverySchema = import_zod4.z.discriminatedUnion("mode", [
1210
+ import_zod4.z.strictObject({ mode: import_zod4.z.literal("inbox") }),
1211
+ import_zod4.z.strictObject({
1212
+ mode: import_zod4.z.literal("active"),
1213
+ adapter: activeAdapterSummarySchema,
1214
+ dispatch: dispatchSummarySchema
1215
+ })
1216
+ ]);
1217
+ var externalHandoffPublishResultSchema = import_zod4.z.strictObject({
1218
+ handoff: externalHandoffSummarySchema,
1219
+ delivery: externalHandoffPublishDeliverySchema,
1220
+ replayed: import_zod4.z.boolean()
1221
+ });
1222
+ var externalHandoffStatusResultSchema = import_zod4.z.strictObject({
1223
+ handoff: externalHandoffSummarySchema,
1224
+ activeAdapter: activeAdapterSummarySchema.nullable(),
1225
+ dispatch: dispatchSummarySchema.nullable()
488
1226
  });
489
- var agentJobActionRequestSchema = import_zod2.z.strictObject({});
490
1227
 
491
1228
  // src/protocol/agent-schemas.ts
492
- var import_zod3 = require("zod");
493
- var profileIdSchema3 = import_zod3.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
494
- var boundedString2 = (maximum) => import_zod3.z.string().max(maximum);
495
- var errorCodeSchema = import_zod3.z.enum(ERROR_CODES);
496
- var agentCapabilitySnapshotSchema = import_zod3.z.strictObject({
1229
+ var import_zod5 = require("zod");
1230
+ var profileIdSchema3 = import_zod5.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
1231
+ var boundedString2 = (maximum) => import_zod5.z.string().max(maximum);
1232
+ var errorCodeSchema = import_zod5.z.enum(ERROR_CODES);
1233
+ var agentCapabilitySnapshotSchema = import_zod5.z.strictObject({
497
1234
  providerProfileId: profileIdSchema3,
498
1235
  providerLabel: boundedString2(100),
499
1236
  modelProfileId: profileIdSchema3,
500
1237
  modelLabel: boundedString2(100),
501
- protocol: import_zod3.z.enum(["responses", "chat-completions"]),
502
- state: import_zod3.z.enum(AGENT_CAPABILITY_STATES),
503
- authenticated: import_zod3.z.boolean(),
504
- modelAvailable: import_zod3.z.boolean(),
505
- toolCalling: import_zod3.z.boolean(),
506
- toolResultContinuation: import_zod3.z.boolean(),
507
- streaming: import_zod3.z.boolean(),
508
- checkedAt: import_zod3.z.iso.datetime().optional(),
1238
+ protocol: import_zod5.z.enum(["responses", "chat-completions"]),
1239
+ state: import_zod5.z.enum(AGENT_CAPABILITY_STATES),
1240
+ authenticated: import_zod5.z.boolean(),
1241
+ modelAvailable: import_zod5.z.boolean(),
1242
+ toolCalling: import_zod5.z.boolean(),
1243
+ toolResultContinuation: import_zod5.z.boolean(),
1244
+ streaming: import_zod5.z.boolean(),
1245
+ checkedAt: import_zod5.z.iso.datetime().optional(),
509
1246
  errorCode: errorCodeSchema.optional()
510
1247
  });
511
- var agentWorkspaceHealthSnapshotSchema = import_zod3.z.strictObject({
512
- state: import_zod3.z.enum(AGENT_WORKSPACE_STATES),
513
- checkedAt: import_zod3.z.iso.datetime(),
514
- changes: import_zod3.z.strictObject({
515
- staged: import_zod3.z.number().int().nonnegative(),
516
- unstaged: import_zod3.z.number().int().nonnegative(),
517
- untracked: import_zod3.z.number().int().nonnegative(),
518
- conflicted: import_zod3.z.number().int().nonnegative(),
519
- total: import_zod3.z.number().int().nonnegative()
1248
+ var agentWorkspaceHealthSnapshotSchema = import_zod5.z.strictObject({
1249
+ state: import_zod5.z.enum(AGENT_WORKSPACE_STATES),
1250
+ checkedAt: import_zod5.z.iso.datetime(),
1251
+ changes: import_zod5.z.strictObject({
1252
+ staged: import_zod5.z.number().int().nonnegative(),
1253
+ unstaged: import_zod5.z.number().int().nonnegative(),
1254
+ untracked: import_zod5.z.number().int().nonnegative(),
1255
+ conflicted: import_zod5.z.number().int().nonnegative(),
1256
+ total: import_zod5.z.number().int().nonnegative()
520
1257
  }),
521
- canIncludeLocalChanges: import_zod3.z.boolean(),
1258
+ canIncludeLocalChanges: import_zod5.z.boolean(),
522
1259
  errorCode: errorCodeSchema.optional()
523
1260
  }).refine(
524
1261
  ({ state, changes, canIncludeLocalChanges, errorCode }) => {
@@ -536,42 +1273,42 @@ var agentWorkspaceHealthSnapshotSchema = import_zod3.z.strictObject({
536
1273
  },
537
1274
  { message: "Agent workspace health fields are inconsistent." }
538
1275
  );
539
- var agentChangedFileSchema = import_zod3.z.strictObject({
1276
+ var agentChangedFileSchema = import_zod5.z.strictObject({
540
1277
  relativePath: boundedString2(1024),
541
- kind: import_zod3.z.enum(AGENT_FILE_CHANGE_KINDS),
542
- additions: import_zod3.z.number().int().nonnegative(),
543
- deletions: import_zod3.z.number().int().nonnegative()
1278
+ kind: import_zod5.z.enum(AGENT_FILE_CHANGE_KINDS),
1279
+ additions: import_zod5.z.number().int().nonnegative(),
1280
+ deletions: import_zod5.z.number().int().nonnegative()
544
1281
  });
545
- var agentCheckResultSchema = import_zod3.z.strictObject({
1282
+ var agentCheckResultSchema = import_zod5.z.strictObject({
546
1283
  checkId: profileIdSchema3,
547
1284
  label: boundedString2(100),
548
- status: import_zod3.z.enum(AGENT_CHECK_STATUSES),
549
- durationMs: import_zod3.z.number().int().nonnegative(),
1285
+ status: import_zod5.z.enum(AGENT_CHECK_STATUSES),
1286
+ durationMs: import_zod5.z.number().int().nonnegative(),
550
1287
  output: boundedString2(8e4)
551
1288
  });
552
- var agentJobSnapshotSchema = import_zod3.z.strictObject({
553
- jobId: import_zod3.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
554
- status: import_zod3.z.enum(AGENT_JOB_STATUSES),
1289
+ var agentJobSnapshotSchema = import_zod5.z.strictObject({
1290
+ jobId: import_zod5.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
1291
+ status: import_zod5.z.enum(AGENT_JOB_STATUSES),
555
1292
  providerProfileId: profileIdSchema3,
556
1293
  providerLabel: boundedString2(100),
557
1294
  modelProfileId: profileIdSchema3,
558
1295
  modelLabel: boundedString2(100),
559
1296
  phaseMessage: boundedString2(1024),
560
- createdAt: import_zod3.z.iso.datetime(),
561
- updatedAt: import_zod3.z.iso.datetime(),
562
- canCancel: import_zod3.z.boolean(),
563
- canApply: import_zod3.z.boolean(),
564
- canRevert: import_zod3.z.boolean(),
1297
+ createdAt: import_zod5.z.iso.datetime(),
1298
+ updatedAt: import_zod5.z.iso.datetime(),
1299
+ canCancel: import_zod5.z.boolean(),
1300
+ canApply: import_zod5.z.boolean(),
1301
+ canRevert: import_zod5.z.boolean(),
565
1302
  errorCode: errorCodeSchema.optional()
566
1303
  });
567
- var agentJobResultSchema = import_zod3.z.strictObject({
568
- jobId: import_zod3.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
1304
+ var agentJobResultSchema = import_zod5.z.strictObject({
1305
+ jobId: import_zod5.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
569
1306
  summary: boundedString2(8e4),
570
1307
  diff: boundedString2(1e6),
571
- files: import_zod3.z.array(agentChangedFileSchema).max(100),
572
- checks: import_zod3.z.array(agentCheckResultSchema).max(100)
1308
+ files: import_zod5.z.array(agentChangedFileSchema).max(100),
1309
+ checks: import_zod5.z.array(agentCheckResultSchema).max(100)
573
1310
  });
574
- var agentJobResultResponseSchema = import_zod3.z.strictObject({
1311
+ var agentJobResultResponseSchema = import_zod5.z.strictObject({
575
1312
  snapshot: agentJobSnapshotSchema,
576
1313
  result: agentJobResultSchema.optional()
577
1314
  }).superRefine((value, context) => {
@@ -583,44 +1320,44 @@ var agentJobResultResponseSchema = import_zod3.z.strictObject({
583
1320
  });
584
1321
  }
585
1322
  });
586
- var agentJobEventBaseSchema = import_zod3.z.strictObject({
587
- schemaVersion: import_zod3.z.literal(2),
588
- sequence: import_zod3.z.number().int().positive(),
589
- jobId: import_zod3.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
590
- status: import_zod3.z.enum(AGENT_JOB_STATUSES),
591
- timestamp: import_zod3.z.iso.datetime()
1323
+ var agentJobEventBaseSchema = import_zod5.z.strictObject({
1324
+ schemaVersion: import_zod5.z.literal(2),
1325
+ sequence: import_zod5.z.number().int().positive(),
1326
+ jobId: import_zod5.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
1327
+ status: import_zod5.z.enum(AGENT_JOB_STATUSES),
1328
+ timestamp: import_zod5.z.iso.datetime()
592
1329
  });
593
- var agentJobEventSchema = import_zod3.z.discriminatedUnion("type", [
1330
+ var agentJobEventSchema = import_zod5.z.discriminatedUnion("type", [
594
1331
  agentJobEventBaseSchema.extend({
595
- type: import_zod3.z.literal("snapshot"),
596
- data: import_zod3.z.strictObject({ snapshot: agentJobSnapshotSchema })
1332
+ type: import_zod5.z.literal("snapshot"),
1333
+ data: import_zod5.z.strictObject({ snapshot: agentJobSnapshotSchema })
597
1334
  }),
598
1335
  agentJobEventBaseSchema.extend({
599
- type: import_zod3.z.literal("phase"),
600
- data: import_zod3.z.strictObject({ message: boundedString2(1024) })
1336
+ type: import_zod5.z.literal("phase"),
1337
+ data: import_zod5.z.strictObject({ message: boundedString2(1024) })
601
1338
  }),
602
1339
  agentJobEventBaseSchema.extend({
603
- type: import_zod3.z.literal("tool"),
604
- data: import_zod3.z.strictObject({
605
- turn: import_zod3.z.number().int().positive(),
1340
+ type: import_zod5.z.literal("tool"),
1341
+ data: import_zod5.z.strictObject({
1342
+ turn: import_zod5.z.number().int().positive(),
606
1343
  toolCallId: boundedString2(256),
607
1344
  toolName: boundedString2(100),
608
- state: import_zod3.z.enum(["started", "succeeded", "failed"]),
1345
+ state: import_zod5.z.enum(["started", "succeeded", "failed"]),
609
1346
  relativePath: boundedString2(1024).optional(),
610
1347
  checkLabel: boundedString2(100).optional()
611
1348
  })
612
1349
  }),
613
1350
  agentJobEventBaseSchema.extend({
614
- type: import_zod3.z.literal("check"),
615
- data: import_zod3.z.strictObject({ result: agentCheckResultSchema })
1351
+ type: import_zod5.z.literal("check"),
1352
+ data: import_zod5.z.strictObject({ result: agentCheckResultSchema })
616
1353
  }),
617
1354
  agentJobEventBaseSchema.extend({
618
- type: import_zod3.z.literal("result-ready"),
619
- data: import_zod3.z.strictObject({ hasResult: import_zod3.z.literal(true) })
1355
+ type: import_zod5.z.literal("result-ready"),
1356
+ data: import_zod5.z.strictObject({ hasResult: import_zod5.z.literal(true) })
620
1357
  }),
621
1358
  agentJobEventBaseSchema.extend({
622
- type: import_zod3.z.literal("error"),
623
- data: import_zod3.z.strictObject({
1359
+ type: import_zod5.z.literal("error"),
1360
+ data: import_zod5.z.strictObject({
624
1361
  code: errorCodeSchema,
625
1362
  message: boundedString2(1024)
626
1363
  })
@@ -656,8 +1393,33 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
656
1393
  AGENT_JOB_STATUSES,
657
1394
  AGENT_WORKSPACE_SNAPSHOT_LIMITS,
658
1395
  AGENT_WORKSPACE_STATES,
1396
+ DATA_FLOW_ASSOCIATION_KINDS,
1397
+ DATA_FLOW_DIAGNOSTIC_CODES,
1398
+ DATA_FLOW_EXECUTION_STATES,
1399
+ DATA_FLOW_FRESHNESS_STATES,
1400
+ DATA_FLOW_PROOF_STATES,
1401
+ DATA_FLOW_QUERY_ADAPTER_MODULES,
1402
+ DATA_FLOW_QUERY_HOOK_NAMES,
1403
+ DATA_FLOW_SCHEMA_VERSION,
1404
+ DATA_FLOW_TRPC_CLIENT_FACTORY_NAMES,
1405
+ DATA_FLOW_TRPC_PROXY_FACTORY_NAMES,
1406
+ DATA_FLOW_TRPC_REQUEST_METHODS,
1407
+ DATA_FLOW_TRPC_ROOT_FACTORY_NAMES,
1408
+ DATA_FLOW_URL_QUERY_KEY_LIMIT,
659
1409
  DEFAULT_AGENT_LIMITS,
1410
+ DEFAULT_DATA_FLOW_LIMITS,
1411
+ DEFAULT_RUNTIME_DATA_FLOW_LIMITS,
660
1412
  ERROR_CODES,
1413
+ ERROR_CODE_VALUES,
1414
+ EXTERNAL_HANDOFF_ACTIVE_ADAPTER_KINDS,
1415
+ EXTERNAL_HANDOFF_ACTIVE_ADAPTER_STATES,
1416
+ EXTERNAL_HANDOFF_BROKER_PROTOCOL_VERSION,
1417
+ EXTERNAL_HANDOFF_DISPATCH_PHASES,
1418
+ EXTERNAL_HANDOFF_FRAMEWORKS,
1419
+ EXTERNAL_HANDOFF_LIMITS,
1420
+ EXTERNAL_HANDOFF_REPORTABLE_DISPATCH_PHASES,
1421
+ EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION,
1422
+ EXTERNAL_HANDOFF_STATES,
661
1423
  MAX_ANNOTATION_INSTRUCTION_CHARACTERS,
662
1424
  MAX_ANNOTATION_TARGETS,
663
1425
  MAX_TARGET_INSTRUCTION_CHARACTERS,
@@ -672,6 +1434,7 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
672
1434
  SPOTPATCH_REPOSITORY_URL,
673
1435
  SPOTPATCH_TOKEN_HEADER,
674
1436
  SpotPatchError,
1437
+ activeAdapterSummarySchema,
675
1438
  agentCapabilityRequestSchema,
676
1439
  agentCapabilitySnapshotSchema,
677
1440
  agentChangedFileSchema,
@@ -684,14 +1447,35 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
684
1447
  agentJobSnapshotSchema,
685
1448
  agentWorkspaceHealthRequestSchema,
686
1449
  agentWorkspaceHealthSnapshotSchema,
1450
+ componentDataFlowReportSchema,
1451
+ dataDependencySchema,
1452
+ dataFlowComponentReportRequestSchema,
1453
+ dataFlowPageReportRequestSchema,
1454
+ dispatchSummarySchema,
1455
+ externalHandoffCapabilityRequestSchema,
1456
+ externalHandoffCapabilitySchema,
1457
+ externalHandoffPublishDeliverySchema,
1458
+ externalHandoffPublishRequestSchema,
1459
+ externalHandoffPublishResultSchema,
1460
+ externalHandoffReportableDispatchPhaseSchema,
1461
+ externalHandoffResolveDeliveryRequestSchema,
1462
+ externalHandoffSnapshotSchema,
1463
+ externalHandoffStatusRequestSchema,
1464
+ externalHandoffStatusResultSchema,
1465
+ externalHandoffSummarySchema,
687
1466
  formatSourceMarker,
688
1467
  getAgentJobEndpoint,
1468
+ isErrorCode,
689
1469
  isSensitiveName,
1470
+ limitDataFlowReportCollections,
1471
+ networkObservationSchema,
690
1472
  openEditorRequestSchema,
1473
+ pageDataFlowReportSchema,
691
1474
  parseSourceMarker,
692
1475
  redactSensitiveText,
693
1476
  runtimeBootstrapRequestSchema,
694
1477
  runtimeConfigSchema,
1478
+ runtimeDataFlowConfigSchema,
695
1479
  sanitizeUrl,
696
1480
  sourceContextRequestSchema,
697
1481
  spotAnnotationRequestSchema,