@spotpatch/shared 1.11.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.
- package/dist/annotation-C0Me9mN2.d.cts +102 -0
- package/dist/annotation-C0Me9mN2.d.ts +102 -0
- package/dist/{chunk-RK46Y7LD.js → chunk-5CHYMRNS.js} +3 -2
- package/dist/chunk-5CHYMRNS.js.map +1 -0
- package/dist/chunk-C2PJ4UUU.js +195 -0
- package/dist/chunk-C2PJ4UUU.js.map +1 -0
- package/dist/chunk-DYTWEIES.js +89 -0
- package/dist/chunk-DYTWEIES.js.map +1 -0
- package/dist/{chunk-JGOIBOFI.js → chunk-FPDSZDP2.js} +16 -2
- package/dist/chunk-FPDSZDP2.js.map +1 -0
- package/dist/chunk-IUTOVI5G.js +584 -0
- package/dist/chunk-IUTOVI5G.js.map +1 -0
- package/dist/{chunk-JU5HIWX7.js → chunk-YQ5GL523.js} +8 -173
- package/dist/chunk-YQ5GL523.js.map +1 -0
- package/dist/contextual-ask-B0mCFn92.d.cts +1451 -0
- package/dist/contextual-ask-B0mCFn92.d.ts +1451 -0
- package/dist/contextual-ask-browser.cjs +200 -0
- package/dist/contextual-ask-browser.cjs.map +1 -0
- package/dist/contextual-ask-browser.d.cts +31 -0
- package/dist/contextual-ask-browser.d.ts +31 -0
- package/dist/contextual-ask-browser.js +66 -0
- package/dist/contextual-ask-browser.js.map +1 -0
- package/dist/contextual-ask-node.cjs +968 -0
- package/dist/contextual-ask-node.cjs.map +1 -0
- package/dist/contextual-ask-node.d.cts +14 -0
- package/dist/contextual-ask-node.d.ts +14 -0
- package/dist/contextual-ask-node.js +122 -0
- package/dist/contextual-ask-node.js.map +1 -0
- package/dist/{data-flow-runtime-oKZOBYAB.d.ts → data-flow-runtime-D8HPSb2i.d.cts} +14 -13
- package/dist/{data-flow-runtime-BiouPr1G.d.cts → data-flow-runtime-vKeEaJgT.d.ts} +14 -13
- package/dist/data-flow-runtime.cjs +4 -1
- package/dist/data-flow-runtime.cjs.map +1 -1
- package/dist/data-flow-runtime.d.cts +2 -2
- package/dist/data-flow-runtime.d.ts +2 -2
- package/dist/data-flow-runtime.js +2 -2
- package/dist/{endpoints-GedF44M2.d.cts → endpoints-O3ohYyAo.d.cts} +7 -1
- package/dist/{endpoints-GedF44M2.d.ts → endpoints-O3ohYyAo.d.ts} +7 -1
- package/dist/error-code-DRz2eqcB.d.cts +63 -0
- package/dist/error-code-DRz2eqcB.d.ts +63 -0
- package/dist/external-agent-node.cjs +142 -121
- package/dist/external-agent-node.cjs.map +1 -1
- package/dist/external-agent-node.d.cts +28 -27
- package/dist/external-agent-node.d.ts +28 -27
- package/dist/external-agent-node.js +4 -2
- package/dist/external-agent-node.js.map +1 -1
- package/dist/{external-handoff--lT9XQEw.d.ts → external-handoff-DighrWn8.d.ts} +33 -133
- package/dist/{external-handoff--lT9XQEw.d.cts → external-handoff-DwtFFR6F.d.cts} +33 -133
- package/dist/external-handoff-browser.cjs +2 -0
- package/dist/external-handoff-browser.cjs.map +1 -1
- package/dist/external-handoff-browser.d.cts +4 -3
- package/dist/external-handoff-browser.d.ts +4 -3
- package/dist/external-handoff-browser.js +1 -1
- package/dist/index.cjs +1146 -423
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -158
- package/dist/index.d.ts +106 -158
- package/dist/index.js +98 -17
- package/dist/index.js.map +1 -1
- package/package.json +29 -2
- package/dist/chunk-JGOIBOFI.js.map +0 -1
- package/dist/chunk-JU5HIWX7.js.map +0 -1
- package/dist/chunk-RK46Y7LD.js.map +0 -1
- package/dist/{external-agent-control-BB-oicmw.d.cts → external-agent-control-CRBbjDDk.d.cts} +31 -31
- package/dist/{external-agent-control-BB-oicmw.d.ts → external-agent-control-CRBbjDDk.d.ts} +31 -31
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: () =>
|
|
146
|
-
|
|
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
|
|
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({
|
|
@@ -357,7 +940,8 @@ var DEFAULT_DATA_FLOW_LIMITS = Object.freeze({
|
|
|
357
940
|
graphMaxModules: 50,
|
|
358
941
|
graphMaxCallsites: 100,
|
|
359
942
|
analysisTimeoutMs: 2e3,
|
|
360
|
-
reportMaxFields: 100
|
|
943
|
+
reportMaxFields: 100,
|
|
944
|
+
sourceMaxComponents: 256
|
|
361
945
|
});
|
|
362
946
|
var DATA_FLOW_URL_QUERY_KEY_LIMIT = DEFAULT_DATA_FLOW_LIMITS.reportMaxFields;
|
|
363
947
|
var DEFAULT_RUNTIME_DATA_FLOW_LIMITS = Object.freeze({
|
|
@@ -411,24 +995,24 @@ var DATA_FLOW_DIAGNOSTIC_CODES = Object.freeze([
|
|
|
411
995
|
"DATA_FLOW_REDACTION_APPLIED",
|
|
412
996
|
"DATA_FLOW_AI_DISABLED"
|
|
413
997
|
]);
|
|
414
|
-
var boundedText = (maximum) =>
|
|
998
|
+
var boundedText = (maximum) => import_zod3.z.string().trim().min(1).max(maximum);
|
|
415
999
|
var opaqueIdSchema = boundedText(128).regex(/^[A-Za-z0-9_-]+$/u);
|
|
416
|
-
var diagnosticCodeSchema =
|
|
417
|
-
var evidenceSourceSchema =
|
|
1000
|
+
var diagnosticCodeSchema = import_zod3.z.enum(DATA_FLOW_DIAGNOSTIC_CODES);
|
|
1001
|
+
var evidenceSourceSchema = import_zod3.z.strictObject({
|
|
418
1002
|
fileId: opaqueIdSchema,
|
|
419
1003
|
displayPath: boundedText(1024),
|
|
420
|
-
line:
|
|
421
|
-
column:
|
|
1004
|
+
line: import_zod3.z.number().int().positive(),
|
|
1005
|
+
column: import_zod3.z.number().int().positive(),
|
|
422
1006
|
sourceVersion: opaqueIdSchema
|
|
423
1007
|
});
|
|
424
|
-
var sanitizedObservedUrlSchema =
|
|
1008
|
+
var sanitizedObservedUrlSchema = import_zod3.z.strictObject({
|
|
425
1009
|
origin: boundedText(512).optional(),
|
|
426
1010
|
pathname: boundedText(2048),
|
|
427
|
-
queryKeys:
|
|
1011
|
+
queryKeys: import_zod3.z.array(boundedText(256)).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields)
|
|
428
1012
|
});
|
|
429
|
-
var dataParameterSchema =
|
|
1013
|
+
var dataParameterSchema = import_zod3.z.strictObject({
|
|
430
1014
|
path: boundedText(1024),
|
|
431
|
-
position:
|
|
1015
|
+
position: import_zod3.z.enum([
|
|
432
1016
|
"path",
|
|
433
1017
|
"query",
|
|
434
1018
|
"body",
|
|
@@ -441,34 +1025,34 @@ var dataParameterSchema = import_zod.z.strictObject({
|
|
|
441
1025
|
type: boundedText(512).optional(),
|
|
442
1026
|
source: boundedText(1024).optional(),
|
|
443
1027
|
condition: boundedText(1024).optional(),
|
|
444
|
-
sensitive:
|
|
445
|
-
valueState:
|
|
446
|
-
evidenceIds:
|
|
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)
|
|
447
1031
|
});
|
|
448
|
-
var dataResponseSchema =
|
|
449
|
-
consumedFields:
|
|
1032
|
+
var dataResponseSchema = import_zod3.z.strictObject({
|
|
1033
|
+
consumedFields: import_zod3.z.array(boundedText(1024)).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields)
|
|
450
1034
|
});
|
|
451
|
-
var requestOriginSchema =
|
|
1035
|
+
var requestOriginSchema = import_zod3.z.strictObject({
|
|
452
1036
|
componentSourceId: opaqueIdSchema.optional(),
|
|
453
1037
|
triggerCallsiteId: opaqueIdSchema.optional(),
|
|
454
1038
|
requestCallsiteId: opaqueIdSchema,
|
|
455
1039
|
sourceVersion: opaqueIdSchema
|
|
456
1040
|
});
|
|
457
|
-
var capabilityReasonSchema =
|
|
1041
|
+
var capabilityReasonSchema = import_zod3.z.strictObject({
|
|
458
1042
|
code: diagnosticCodeSchema,
|
|
459
|
-
retryable:
|
|
1043
|
+
retryable: import_zod3.z.boolean()
|
|
460
1044
|
});
|
|
461
|
-
var capabilitySchema =
|
|
462
|
-
enabled:
|
|
463
|
-
staticAnalysis:
|
|
464
|
-
runtimeObservation:
|
|
465
|
-
responseShape:
|
|
466
|
-
aiAssistance:
|
|
467
|
-
reasons:
|
|
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)
|
|
468
1052
|
});
|
|
469
|
-
var evidenceSchema =
|
|
1053
|
+
var evidenceSchema = import_zod3.z.strictObject({
|
|
470
1054
|
id: opaqueIdSchema,
|
|
471
|
-
kind:
|
|
1055
|
+
kind: import_zod3.z.enum([
|
|
472
1056
|
"source-anchor",
|
|
473
1057
|
"import-resolution",
|
|
474
1058
|
"symbol-edge",
|
|
@@ -481,49 +1065,49 @@ var evidenceSchema = import_zod.z.strictObject({
|
|
|
481
1065
|
"diagnostic"
|
|
482
1066
|
]),
|
|
483
1067
|
source: evidenceSourceSchema.optional(),
|
|
484
|
-
adapter:
|
|
1068
|
+
adapter: import_zod3.z.strictObject({ id: boundedText(128), version: boundedText(64) }).optional(),
|
|
485
1069
|
summaryKey: boundedText(256)
|
|
486
1070
|
});
|
|
487
|
-
var diagnosticSchema =
|
|
1071
|
+
var diagnosticSchema = import_zod3.z.strictObject({
|
|
488
1072
|
id: opaqueIdSchema,
|
|
489
1073
|
code: diagnosticCodeSchema,
|
|
490
|
-
severity:
|
|
491
|
-
retryable:
|
|
492
|
-
evidenceIds:
|
|
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)
|
|
493
1077
|
});
|
|
494
|
-
var baselineSchema =
|
|
1078
|
+
var baselineSchema = import_zod3.z.strictObject({
|
|
495
1079
|
registryEpoch: opaqueIdSchema,
|
|
496
1080
|
analyzerVersion: boundedText(64),
|
|
497
1081
|
adapterSetHash: boundedText(128),
|
|
498
|
-
analyzedSourceVersions:
|
|
1082
|
+
analyzedSourceVersions: import_zod3.z.array(opaqueIdSchema).max(DEFAULT_DATA_FLOW_LIMITS.graphMaxModules)
|
|
499
1083
|
});
|
|
500
|
-
var completenessSchema =
|
|
501
|
-
complete:
|
|
502
|
-
visitedModules:
|
|
503
|
-
visitedCallsites:
|
|
504
|
-
frontierCount:
|
|
505
|
-
truncatedBy:
|
|
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()
|
|
506
1090
|
});
|
|
507
|
-
var dataDependencySchema =
|
|
1091
|
+
var dataDependencySchema = import_zod3.z.strictObject({
|
|
508
1092
|
id: opaqueIdSchema,
|
|
509
|
-
kind:
|
|
510
|
-
direction:
|
|
511
|
-
execution:
|
|
512
|
-
proof:
|
|
513
|
-
association:
|
|
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),
|
|
514
1098
|
method: boundedText(32).optional(),
|
|
515
1099
|
operation: boundedText(512).optional(),
|
|
516
1100
|
url: sanitizedObservedUrlSchema.optional(),
|
|
517
|
-
parameters:
|
|
1101
|
+
parameters: import_zod3.z.array(dataParameterSchema).max(DEFAULT_DATA_FLOW_LIMITS.reportMaxFields),
|
|
518
1102
|
response: dataResponseSchema,
|
|
519
1103
|
origin: requestOriginSchema.optional(),
|
|
520
|
-
suppliedBindings:
|
|
521
|
-
locationIds:
|
|
522
|
-
evidenceIds:
|
|
523
|
-
observationIds:
|
|
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)
|
|
524
1108
|
});
|
|
525
|
-
var networkObservationSchema =
|
|
526
|
-
schemaVersion:
|
|
1109
|
+
var networkObservationSchema = import_zod3.z.strictObject({
|
|
1110
|
+
schemaVersion: import_zod3.z.literal(DATA_FLOW_SCHEMA_VERSION),
|
|
527
1111
|
id: opaqueIdSchema,
|
|
528
1112
|
pageEpoch: opaqueIdSchema,
|
|
529
1113
|
routeEpoch: opaqueIdSchema,
|
|
@@ -532,48 +1116,48 @@ var networkObservationSchema = import_zod.z.strictObject({
|
|
|
532
1116
|
componentSourceId: opaqueIdSchema.optional(),
|
|
533
1117
|
triggerCallsiteId: opaqueIdSchema.optional(),
|
|
534
1118
|
sourceVersion: opaqueIdSchema.optional(),
|
|
535
|
-
transport:
|
|
1119
|
+
transport: import_zod3.z.enum(["fetch", "trpc", "xhr"]),
|
|
536
1120
|
method: boundedText(32),
|
|
537
1121
|
operation: boundedText(512).optional(),
|
|
538
1122
|
url: sanitizedObservedUrlSchema,
|
|
539
|
-
outcome:
|
|
540
|
-
freshness:
|
|
541
|
-
diagnosticIds:
|
|
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)
|
|
542
1126
|
});
|
|
543
|
-
var componentIdentitySchema =
|
|
1127
|
+
var componentIdentitySchema = import_zod3.z.strictObject({
|
|
544
1128
|
componentSourceId: opaqueIdSchema.optional(),
|
|
545
1129
|
displayName: boundedText(256).optional(),
|
|
546
1130
|
source: evidenceSourceSchema
|
|
547
1131
|
});
|
|
548
|
-
var componentDataFlowReportSchema =
|
|
549
|
-
schemaVersion:
|
|
1132
|
+
var componentDataFlowReportSchema = import_zod3.z.strictObject({
|
|
1133
|
+
schemaVersion: import_zod3.z.literal(DATA_FLOW_SCHEMA_VERSION),
|
|
550
1134
|
reportId: opaqueIdSchema,
|
|
551
1135
|
baseline: baselineSchema,
|
|
552
1136
|
capability: capabilitySchema,
|
|
553
1137
|
component: componentIdentitySchema,
|
|
554
|
-
dependencies:
|
|
555
|
-
evidence:
|
|
556
|
-
diagnostics:
|
|
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),
|
|
557
1141
|
completeness: completenessSchema
|
|
558
1142
|
});
|
|
559
|
-
var pageDataFlowReportSchema =
|
|
560
|
-
schemaVersion:
|
|
1143
|
+
var pageDataFlowReportSchema = import_zod3.z.strictObject({
|
|
1144
|
+
schemaVersion: import_zod3.z.literal(DATA_FLOW_SCHEMA_VERSION),
|
|
561
1145
|
reportId: opaqueIdSchema,
|
|
562
1146
|
baseline: baselineSchema,
|
|
563
1147
|
capability: capabilitySchema,
|
|
564
|
-
dependencies:
|
|
565
|
-
evidence:
|
|
566
|
-
diagnostics:
|
|
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),
|
|
567
1151
|
completeness: completenessSchema
|
|
568
1152
|
});
|
|
569
|
-
var runtimeDataFlowConfigSchema =
|
|
570
|
-
enabled:
|
|
571
|
-
runtime:
|
|
572
|
-
limits:
|
|
573
|
-
observationMaxEntries:
|
|
574
|
-
observationMaxBytes:
|
|
575
|
-
observationTtlMs:
|
|
576
|
-
reportMaxBytes:
|
|
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()
|
|
577
1161
|
})
|
|
578
1162
|
});
|
|
579
1163
|
|
|
@@ -775,7 +1359,7 @@ function limitDataFlowReportCollections(report, options = {}) {
|
|
|
775
1359
|
}
|
|
776
1360
|
|
|
777
1361
|
// src/model/runtime-config.ts
|
|
778
|
-
var
|
|
1362
|
+
var import_zod4 = require("zod");
|
|
779
1363
|
|
|
780
1364
|
// src/protocol/endpoints.ts
|
|
781
1365
|
var SPOTPATCH_API_BASE = "/__spotpatch/v1";
|
|
@@ -789,6 +1373,8 @@ var SPOTPATCH_ENDPOINTS = Object.freeze({
|
|
|
789
1373
|
agentCapability: `${SPOTPATCH_API_BASE}/agent/capability`,
|
|
790
1374
|
agentWorkspaceHealth: `${SPOTPATCH_API_BASE}/agent/workspace-health`,
|
|
791
1375
|
agentJobs: `${SPOTPATCH_API_BASE}/agent/jobs`,
|
|
1376
|
+
askCapability: `${SPOTPATCH_API_BASE}/ask/capability`,
|
|
1377
|
+
askJobs: `${SPOTPATCH_API_BASE}/ask/jobs`,
|
|
792
1378
|
externalHandoffCapability: `${SPOTPATCH_API_BASE}/external-handoff/capability`,
|
|
793
1379
|
externalHandoffPublish: `${SPOTPATCH_API_BASE}/external-handoff/publish`,
|
|
794
1380
|
externalHandoffStatus: `${SPOTPATCH_API_BASE}/external-handoff/status`,
|
|
@@ -803,6 +1389,17 @@ var SPOTPATCH_ENDPOINTS = Object.freeze({
|
|
|
803
1389
|
function getAgentJobEndpoint(jobId, action) {
|
|
804
1390
|
return `${SPOTPATCH_ENDPOINTS.agentJobs}/${encodeURIComponent(jobId)}/${action}`;
|
|
805
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
|
+
}
|
|
806
1403
|
|
|
807
1404
|
// src/model/editor.ts
|
|
808
1405
|
var SPOTPATCH_EDITOR_PREFERENCES = ["auto", "vscode", "cursor"];
|
|
@@ -877,39 +1474,39 @@ var SPOTPATCH_NEXT_ROUTER_KINDS = Object.freeze([
|
|
|
877
1474
|
"pages",
|
|
878
1475
|
"hybrid"
|
|
879
1476
|
]);
|
|
880
|
-
var boundedText2 = (maximum) =>
|
|
881
|
-
var
|
|
882
|
-
var runtimeAiModelSchema =
|
|
883
|
-
id:
|
|
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,
|
|
884
1481
|
label: boundedText2(100)
|
|
885
1482
|
});
|
|
886
|
-
var runtimeAiProviderSchema =
|
|
887
|
-
id:
|
|
1483
|
+
var runtimeAiProviderSchema = import_zod4.z.strictObject({
|
|
1484
|
+
id: profileIdSchema2,
|
|
888
1485
|
label: boundedText2(100),
|
|
889
|
-
protocol:
|
|
890
|
-
models:
|
|
891
|
-
defaultModel:
|
|
1486
|
+
protocol: import_zod4.z.enum(["responses", "chat-completions"]),
|
|
1487
|
+
models: import_zod4.z.array(runtimeAiModelSchema).min(1).max(64),
|
|
1488
|
+
defaultModel: profileIdSchema2
|
|
892
1489
|
}).refine(
|
|
893
1490
|
({ defaultModel, models }) => models.some(({ id }) => id === defaultModel) && new Set(models.map(({ id }) => id)).size === models.length,
|
|
894
1491
|
{ message: "Runtime AI model profiles are inconsistent." }
|
|
895
1492
|
);
|
|
896
|
-
var runtimeAiConfigSchema =
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
enabled:
|
|
900
|
-
providers:
|
|
901
|
-
defaultProvider:
|
|
902
|
-
applyMode:
|
|
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)
|
|
903
1500
|
}).refine(
|
|
904
1501
|
({ defaultProvider, providers }) => providers.some(({ id }) => id === defaultProvider) && new Set(providers.map(({ id }) => id)).size === providers.length,
|
|
905
1502
|
{ message: "Runtime AI provider profiles are inconsistent." }
|
|
906
1503
|
)
|
|
907
1504
|
]);
|
|
908
|
-
var positiveInteger =
|
|
1505
|
+
var positiveInteger = import_zod4.z.number().int().positive();
|
|
909
1506
|
var runtimeConfigBaseShape = {
|
|
910
|
-
apiBase:
|
|
1507
|
+
apiBase: import_zod4.z.literal(SPOTPATCH_API_BASE),
|
|
911
1508
|
ai: runtimeAiConfigSchema,
|
|
912
|
-
budget:
|
|
1509
|
+
budget: import_zod4.z.strictObject({
|
|
913
1510
|
totalCharacters: positiveInteger,
|
|
914
1511
|
domCharacters: positiveInteger,
|
|
915
1512
|
cssCharacters: positiveInteger,
|
|
@@ -917,29 +1514,30 @@ var runtimeConfigBaseShape = {
|
|
|
917
1514
|
maxCodeLines: positiveInteger,
|
|
918
1515
|
maxComponentDepth: positiveInteger
|
|
919
1516
|
}),
|
|
920
|
-
|
|
1517
|
+
contextualAsk: import_zod4.z.strictObject({ enabled: import_zod4.z.boolean() }),
|
|
1518
|
+
debug: import_zod4.z.boolean(),
|
|
921
1519
|
dataFlow: runtimeDataFlowConfigSchema,
|
|
922
|
-
editor:
|
|
923
|
-
externalAgent:
|
|
1520
|
+
editor: import_zod4.z.enum(SPOTPATCH_EDITOR_PREFERENCES),
|
|
1521
|
+
externalAgent: import_zod4.z.strictObject({ enabled: import_zod4.z.boolean() }),
|
|
924
1522
|
frameworkVersion: boundedText2(64),
|
|
925
|
-
locale:
|
|
926
|
-
maxTargets:
|
|
927
|
-
redact:
|
|
928
|
-
sessionId:
|
|
929
|
-
sessionToken:
|
|
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),
|
|
930
1528
|
shortcut: boundedText2(128),
|
|
931
1529
|
spotPatchVersion: boundedText2(64)
|
|
932
1530
|
};
|
|
933
|
-
var runtimeConfigSchema =
|
|
934
|
-
|
|
1531
|
+
var runtimeConfigSchema = import_zod4.z.discriminatedUnion("framework", [
|
|
1532
|
+
import_zod4.z.strictObject({
|
|
935
1533
|
...runtimeConfigBaseShape,
|
|
936
|
-
framework:
|
|
1534
|
+
framework: import_zod4.z.literal("vite")
|
|
937
1535
|
}),
|
|
938
|
-
|
|
1536
|
+
import_zod4.z.strictObject({
|
|
939
1537
|
...runtimeConfigBaseShape,
|
|
940
|
-
bundler:
|
|
941
|
-
framework:
|
|
942
|
-
routerKind:
|
|
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)
|
|
943
1541
|
})
|
|
944
1542
|
]);
|
|
945
1543
|
|
|
@@ -967,7 +1565,7 @@ function parseSourceMarker(value) {
|
|
|
967
1565
|
}
|
|
968
1566
|
|
|
969
1567
|
// src/protocol/external-agent-control.ts
|
|
970
|
-
var
|
|
1568
|
+
var import_zod5 = require("zod");
|
|
971
1569
|
var EXTERNAL_AGENT_CONTROL_SCHEMA_VERSION = 1;
|
|
972
1570
|
var EXTERNAL_AGENT_MANAGED_ADAPTER_KINDS = Object.freeze(["codex"]);
|
|
973
1571
|
var EXTERNAL_AGENT_MODES = Object.freeze(["inbox", "managed"]);
|
|
@@ -1092,9 +1690,9 @@ var EXTERNAL_AGENT_CONTROL_LIMITS = Object.freeze({
|
|
|
1092
1690
|
maximumEventLineBytes: 64 * 1024,
|
|
1093
1691
|
maximumResultDiffBytes: DEFAULT_AGENT_LIMITS.maxDiffBytes
|
|
1094
1692
|
});
|
|
1095
|
-
var isoTimestampSchema =
|
|
1096
|
-
var requestIdSchema =
|
|
1097
|
-
var safeRelativePathSchema =
|
|
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) => {
|
|
1098
1696
|
const segments = value.split("/");
|
|
1099
1697
|
if (value.startsWith("/") || value.includes("\\") || segments.some(
|
|
1100
1698
|
(segment) => segment.length === 0 || segment === "." || segment === ".."
|
|
@@ -1102,237 +1700,150 @@ var safeRelativePathSchema = import_zod3.z.string().min(1).max(4096).superRefine
|
|
|
1102
1700
|
context.addIssue({ code: "custom", message: "Expected a safe relative path." });
|
|
1103
1701
|
}
|
|
1104
1702
|
});
|
|
1105
|
-
var externalAgentErrorSchema =
|
|
1106
|
-
code:
|
|
1107
|
-
stage:
|
|
1108
|
-
recoverability:
|
|
1109
|
-
action:
|
|
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)
|
|
1110
1708
|
});
|
|
1111
|
-
var managedFileSummarySchema =
|
|
1709
|
+
var managedFileSummarySchema = import_zod5.z.strictObject({
|
|
1112
1710
|
path: safeRelativePathSchema,
|
|
1113
|
-
additions:
|
|
1114
|
-
deletions:
|
|
1115
|
-
});
|
|
1116
|
-
var managedCheckSummarySchema =
|
|
1117
|
-
id:
|
|
1118
|
-
outcome:
|
|
1119
|
-
durationMs:
|
|
1120
|
-
exitCode:
|
|
1121
|
-
});
|
|
1122
|
-
var managedTimingSummarySchema =
|
|
1123
|
-
preparing:
|
|
1124
|
-
agent:
|
|
1125
|
-
auditing:
|
|
1126
|
-
validating:
|
|
1127
|
-
applying:
|
|
1128
|
-
total:
|
|
1129
|
-
});
|
|
1130
|
-
var managedTaskStatusSchema =
|
|
1131
|
-
revision:
|
|
1132
|
-
deliveryStatus:
|
|
1133
|
-
executionStatus:
|
|
1134
|
-
managedPhase:
|
|
1135
|
-
validationOutcome:
|
|
1136
|
-
files:
|
|
1137
|
-
checks:
|
|
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),
|
|
1138
1736
|
timings: managedTimingSummarySchema,
|
|
1139
1737
|
resultExpiresAt: isoTimestampSchema.optional()
|
|
1140
1738
|
});
|
|
1141
|
-
var externalAgentControlStatusSchema =
|
|
1142
|
-
schemaVersion:
|
|
1143
|
-
sequence:
|
|
1144
|
-
mode:
|
|
1145
|
-
adapter:
|
|
1146
|
-
kind:
|
|
1147
|
-
maturity:
|
|
1148
|
-
availability:
|
|
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"])
|
|
1149
1747
|
}),
|
|
1150
|
-
connectionState:
|
|
1151
|
-
authReadiness:
|
|
1152
|
-
grantState:
|
|
1153
|
-
requestedModel:
|
|
1154
|
-
effectiveModel:
|
|
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(),
|
|
1155
1753
|
task: managedTaskStatusSchema.optional(),
|
|
1156
1754
|
error: externalAgentErrorSchema.optional(),
|
|
1157
1755
|
updatedAt: isoTimestampSchema
|
|
1158
1756
|
});
|
|
1159
|
-
var externalAgentControlStatusRequestSchema =
|
|
1160
|
-
var externalAgentControlConnectRequestSchema =
|
|
1757
|
+
var externalAgentControlStatusRequestSchema = import_zod5.z.strictObject({});
|
|
1758
|
+
var externalAgentControlConnectRequestSchema = import_zod5.z.strictObject({
|
|
1161
1759
|
requestId: requestIdSchema,
|
|
1162
|
-
adapterKind:
|
|
1163
|
-
profile:
|
|
1760
|
+
adapterKind: import_zod5.z.literal("codex"),
|
|
1761
|
+
profile: import_zod5.z.literal(EXTERNAL_AGENT_MANAGED_PROFILE)
|
|
1164
1762
|
});
|
|
1165
|
-
var externalAgentControlDisconnectRequestSchema =
|
|
1763
|
+
var externalAgentControlDisconnectRequestSchema = import_zod5.z.strictObject({
|
|
1166
1764
|
requestId: requestIdSchema,
|
|
1167
|
-
adapterKind:
|
|
1168
|
-
revokeGrant:
|
|
1765
|
+
adapterKind: import_zod5.z.literal("codex"),
|
|
1766
|
+
revokeGrant: import_zod5.z.boolean()
|
|
1169
1767
|
});
|
|
1170
|
-
var externalAgentControlCancelRequestSchema =
|
|
1768
|
+
var externalAgentControlCancelRequestSchema = import_zod5.z.strictObject({
|
|
1171
1769
|
requestId: requestIdSchema,
|
|
1172
|
-
revision:
|
|
1770
|
+
revision: import_zod5.z.number().int().positive()
|
|
1173
1771
|
});
|
|
1174
|
-
var externalAgentEventsRequestSchema =
|
|
1175
|
-
afterSequence:
|
|
1772
|
+
var externalAgentEventsRequestSchema = import_zod5.z.strictObject({
|
|
1773
|
+
afterSequence: import_zod5.z.number().int().nonnegative().optional()
|
|
1176
1774
|
});
|
|
1177
|
-
var externalAgentEventSchema =
|
|
1178
|
-
|
|
1179
|
-
type:
|
|
1775
|
+
var externalAgentEventSchema = import_zod5.z.discriminatedUnion("type", [
|
|
1776
|
+
import_zod5.z.strictObject({
|
|
1777
|
+
type: import_zod5.z.literal("status"),
|
|
1180
1778
|
data: externalAgentControlStatusSchema
|
|
1181
1779
|
}),
|
|
1182
|
-
|
|
1183
|
-
type:
|
|
1184
|
-
sequence:
|
|
1780
|
+
import_zod5.z.strictObject({
|
|
1781
|
+
type: import_zod5.z.literal("heartbeat"),
|
|
1782
|
+
sequence: import_zod5.z.number().int().nonnegative(),
|
|
1185
1783
|
emittedAt: isoTimestampSchema
|
|
1186
1784
|
})
|
|
1187
1785
|
]);
|
|
1188
|
-
var externalAgentResultRequestSchema =
|
|
1189
|
-
revision:
|
|
1190
|
-
});
|
|
1191
|
-
var externalAgentManagedResultSchema =
|
|
1192
|
-
revision:
|
|
1193
|
-
diff:
|
|
1194
|
-
files:
|
|
1195
|
-
checks:
|
|
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),
|
|
1196
1794
|
timings: managedTimingSummarySchema,
|
|
1197
|
-
validationOutcome:
|
|
1795
|
+
validationOutcome: import_zod5.z.enum(EXTERNAL_AGENT_VALIDATION_OUTCOMES),
|
|
1198
1796
|
expiresAt: isoTimestampSchema
|
|
1199
1797
|
});
|
|
1200
1798
|
|
|
1201
1799
|
// src/protocol/external-handoff.ts
|
|
1202
|
-
var
|
|
1800
|
+
var import_zod7 = require("zod");
|
|
1203
1801
|
|
|
1204
1802
|
// src/protocol/requests.ts
|
|
1205
|
-
var
|
|
1206
|
-
var runtimeBootstrapRequestSchema =
|
|
1207
|
-
var sourceCoordinatesSchema =
|
|
1208
|
-
fileId:
|
|
1209
|
-
line:
|
|
1210
|
-
column:
|
|
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()
|
|
1211
1809
|
});
|
|
1212
1810
|
var sourceContextRequestSchema = sourceCoordinatesSchema.extend({
|
|
1213
|
-
maxLines:
|
|
1811
|
+
maxLines: import_zod6.z.number().int().positive()
|
|
1214
1812
|
}).strict();
|
|
1215
1813
|
var openEditorRequestSchema = sourceCoordinatesSchema.strict();
|
|
1216
1814
|
var dataFlowSourceCoordinatesRequestSchema = sourceCoordinatesSchema.extend({
|
|
1217
|
-
schemaVersion:
|
|
1218
|
-
sourceVersion:
|
|
1815
|
+
schemaVersion: import_zod6.z.literal(1),
|
|
1816
|
+
sourceVersion: import_zod6.z.string().min(1).max(128).optional()
|
|
1219
1817
|
}).strict();
|
|
1220
|
-
var dataFlowComponentIdentityRequestSchema =
|
|
1221
|
-
schemaVersion:
|
|
1222
|
-
componentSourceId:
|
|
1223
|
-
sourceVersion:
|
|
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)
|
|
1224
1822
|
});
|
|
1225
|
-
var dataFlowComponentReportRequestSchema =
|
|
1823
|
+
var dataFlowComponentReportRequestSchema = import_zod6.z.union([
|
|
1226
1824
|
dataFlowSourceCoordinatesRequestSchema,
|
|
1227
1825
|
dataFlowComponentIdentityRequestSchema
|
|
1228
1826
|
]);
|
|
1229
|
-
var dataFlowPageReportRequestSchema =
|
|
1230
|
-
schemaVersion:
|
|
1231
|
-
targets:
|
|
1232
|
-
});
|
|
1233
|
-
var profileIdSchema2 = import_zod4.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
|
|
1234
|
-
var boundedString = (maximum) => import_zod4.z.string().max(maximum);
|
|
1235
|
-
var sourceRefSchema = import_zod4.z.strictObject({
|
|
1236
|
-
fileId: boundedString(128).optional(),
|
|
1237
|
-
relativePath: boundedString(1024).optional(),
|
|
1238
|
-
line: import_zod4.z.number().int().positive().optional(),
|
|
1239
|
-
column: import_zod4.z.number().int().positive().optional(),
|
|
1240
|
-
origin: import_zod4.z.enum(["jsx-host", "react-fiber", "dom-ancestor", "none"]),
|
|
1241
|
-
confidence: import_zod4.z.enum(["exact", "probable", "approximate", "unknown"])
|
|
1242
|
-
});
|
|
1243
|
-
var matchedStyleRuleSchema = import_zod4.z.strictObject({
|
|
1244
|
-
selector: boundedString(2048),
|
|
1245
|
-
declarations: boundedString(8192),
|
|
1246
|
-
source: boundedString(1024).optional(),
|
|
1247
|
-
media: boundedString(1024).optional()
|
|
1248
|
-
});
|
|
1249
|
-
var codeContextSchema = import_zod4.z.strictObject({
|
|
1250
|
-
relativePath: boundedString(1024),
|
|
1251
|
-
language: import_zod4.z.enum(["tsx", "jsx"]),
|
|
1252
|
-
startLine: import_zod4.z.number().int().positive(),
|
|
1253
|
-
endLine: import_zod4.z.number().int().positive(),
|
|
1254
|
-
excerpt: boundedString(16e3),
|
|
1255
|
-
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)
|
|
1256
1830
|
});
|
|
1257
|
-
var
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
viewportWidth: import_zod4.z.number().nonnegative(),
|
|
1262
|
-
viewportHeight: import_zod4.z.number().nonnegative(),
|
|
1263
|
-
devicePixelRatio: import_zod4.z.number().positive()
|
|
1264
|
-
});
|
|
1265
|
-
var spotTargetContextRequestSchema = import_zod4.z.strictObject({
|
|
1266
|
-
instruction: import_zod4.z.string().trim().min(1).max(MAX_TARGET_INSTRUCTION_CHARACTERS),
|
|
1267
|
-
page: pageContextSchema.optional(),
|
|
1268
|
-
source: sourceRefSchema,
|
|
1269
|
-
react: import_zod4.z.strictObject({
|
|
1270
|
-
supported: import_zod4.z.boolean(),
|
|
1271
|
-
version: boundedString(64).optional(),
|
|
1272
|
-
componentName: boundedString(256).optional(),
|
|
1273
|
-
componentSourceId: boundedString(128).optional(),
|
|
1274
|
-
sourceVersion: boundedString(128).optional(),
|
|
1275
|
-
componentStack: import_zod4.z.array(boundedString(256)).max(64),
|
|
1276
|
-
source: sourceRefSchema.optional()
|
|
1277
|
-
}),
|
|
1278
|
-
element: import_zod4.z.strictObject({
|
|
1279
|
-
tagName: boundedString(128),
|
|
1280
|
-
selector: boundedString(2048),
|
|
1281
|
-
sanitizedHtml: boundedString(8192),
|
|
1282
|
-
textPreview: boundedString(2048).optional(),
|
|
1283
|
-
role: boundedString(256).optional(),
|
|
1284
|
-
rect: import_zod4.z.strictObject({
|
|
1285
|
-
x: import_zod4.z.number(),
|
|
1286
|
-
y: import_zod4.z.number(),
|
|
1287
|
-
width: import_zod4.z.number().nonnegative(),
|
|
1288
|
-
height: import_zod4.z.number().nonnegative()
|
|
1289
|
-
})
|
|
1290
|
-
}),
|
|
1291
|
-
styles: import_zod4.z.strictObject({
|
|
1292
|
-
classNames: import_zod4.z.array(boundedString(512)).max(256),
|
|
1293
|
-
inlineStyle: boundedString(8192).optional(),
|
|
1294
|
-
matchedRules: import_zod4.z.array(matchedStyleRuleSchema).max(256),
|
|
1295
|
-
computed: import_zod4.z.record(boundedString(256), boundedString(2048)),
|
|
1296
|
-
warnings: import_zod4.z.array(boundedString(1024)).max(64)
|
|
1297
|
-
}),
|
|
1298
|
-
code: codeContextSchema.optional(),
|
|
1299
|
-
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
|
|
1300
1835
|
});
|
|
1301
|
-
var
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
(characters, target) => characters + target.instruction.length,
|
|
1311
|
-
0
|
|
1312
|
-
);
|
|
1313
|
-
if (total > MAX_ANNOTATION_INSTRUCTION_CHARACTERS) {
|
|
1314
|
-
context.addIssue({
|
|
1315
|
-
code: "custom",
|
|
1316
|
-
message: "Combined target instructions exceed the annotation limit.",
|
|
1317
|
-
path: ["targets"]
|
|
1318
|
-
});
|
|
1319
|
-
}
|
|
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")
|
|
1320
1845
|
});
|
|
1321
|
-
var
|
|
1322
|
-
providerProfileId: profileIdSchema2,
|
|
1323
|
-
modelProfileId: profileIdSchema2
|
|
1324
|
-
});
|
|
1325
|
-
var agentWorkspaceHealthRequestSchema = import_zod4.z.strictObject({});
|
|
1326
|
-
var agentJobCreateRequestSchema = import_zod4.z.strictObject({
|
|
1327
|
-
annotation: spotAnnotationRequestSchema,
|
|
1328
|
-
applyMode: import_zod4.z.enum(AGENT_APPLY_MODES).optional(),
|
|
1329
|
-
providerProfileId: profileIdSchema2,
|
|
1330
|
-
modelProfileId: profileIdSchema2,
|
|
1331
|
-
providerDataConsent: import_zod4.z.literal(true),
|
|
1332
|
-
trustedFastModeConsent: import_zod4.z.literal(true).optional(),
|
|
1333
|
-
workingTreeMode: import_zod4.z.enum(["require-clean", "include-local-changes"]).default("require-clean")
|
|
1334
|
-
});
|
|
1335
|
-
var agentJobActionRequestSchema = import_zod4.z.strictObject({});
|
|
1846
|
+
var agentJobActionRequestSchema = import_zod6.z.strictObject({});
|
|
1336
1847
|
|
|
1337
1848
|
// src/protocol/external-handoff-constants.ts
|
|
1338
1849
|
var EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION = 1;
|
|
@@ -1398,44 +1909,44 @@ var EXTERNAL_HANDOFF_LIMITS = Object.freeze({
|
|
|
1398
1909
|
});
|
|
1399
1910
|
|
|
1400
1911
|
// src/protocol/external-handoff.ts
|
|
1401
|
-
var opaqueIdSchema2 =
|
|
1402
|
-
var isoTimestampSchema2 =
|
|
1403
|
-
var externalHandoffReportableDispatchPhaseSchema =
|
|
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(
|
|
1404
1915
|
EXTERNAL_HANDOFF_REPORTABLE_DISPATCH_PHASES
|
|
1405
1916
|
);
|
|
1406
|
-
var externalHandoffPageSummarySchema =
|
|
1407
|
-
origin:
|
|
1408
|
-
pathname:
|
|
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)
|
|
1409
1920
|
});
|
|
1410
|
-
var externalHandoffSummarySchema =
|
|
1921
|
+
var externalHandoffSummarySchema = import_zod7.z.strictObject({
|
|
1411
1922
|
sessionId: opaqueIdSchema2,
|
|
1412
|
-
framework:
|
|
1413
|
-
revision:
|
|
1923
|
+
framework: import_zod7.z.enum(EXTERNAL_HANDOFF_FRAMEWORKS),
|
|
1924
|
+
revision: import_zod7.z.number().int().positive(),
|
|
1414
1925
|
cursor: opaqueIdSchema2,
|
|
1415
|
-
targetCount:
|
|
1926
|
+
targetCount: import_zod7.z.number().int().positive(),
|
|
1416
1927
|
page: externalHandoffPageSummarySchema,
|
|
1417
1928
|
publishedAt: isoTimestampSchema2,
|
|
1418
1929
|
expiresAt: isoTimestampSchema2,
|
|
1419
|
-
state:
|
|
1420
|
-
pickupCount:
|
|
1930
|
+
state: import_zod7.z.enum(EXTERNAL_HANDOFF_STATES),
|
|
1931
|
+
pickupCount: import_zod7.z.number().int().nonnegative().max(EXTERNAL_HANDOFF_LIMITS.maximumConnectorReceipts),
|
|
1421
1932
|
pickedUpAt: isoTimestampSchema2.optional()
|
|
1422
1933
|
});
|
|
1423
|
-
var externalHandoffSnapshotSchema =
|
|
1424
|
-
schemaVersion:
|
|
1934
|
+
var externalHandoffSnapshotSchema = import_zod7.z.strictObject({
|
|
1935
|
+
schemaVersion: import_zod7.z.literal(EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION),
|
|
1425
1936
|
cursor: opaqueIdSchema2,
|
|
1426
|
-
session:
|
|
1937
|
+
session: import_zod7.z.strictObject({
|
|
1427
1938
|
id: opaqueIdSchema2,
|
|
1428
|
-
framework:
|
|
1939
|
+
framework: import_zod7.z.enum(EXTERNAL_HANDOFF_FRAMEWORKS)
|
|
1429
1940
|
}),
|
|
1430
|
-
revision:
|
|
1941
|
+
revision: import_zod7.z.number().int().positive(),
|
|
1431
1942
|
publishedAt: isoTimestampSchema2,
|
|
1432
1943
|
expiresAt: isoTimestampSchema2,
|
|
1433
|
-
annotation:
|
|
1944
|
+
annotation: spotAnnotationSchema
|
|
1434
1945
|
});
|
|
1435
|
-
var activeAdapterSummarySchema =
|
|
1436
|
-
kind:
|
|
1437
|
-
state:
|
|
1438
|
-
canDispatch:
|
|
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(),
|
|
1439
1950
|
connectedAt: isoTimestampSchema2,
|
|
1440
1951
|
updatedAt: isoTimestampSchema2
|
|
1441
1952
|
}).superRefine((value, context) => {
|
|
@@ -1447,83 +1958,258 @@ var activeAdapterSummarySchema = import_zod5.z.strictObject({
|
|
|
1447
1958
|
});
|
|
1448
1959
|
}
|
|
1449
1960
|
});
|
|
1450
|
-
var dispatchSummarySchema =
|
|
1451
|
-
adapterKind:
|
|
1452
|
-
revision:
|
|
1453
|
-
phase:
|
|
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),
|
|
1454
1965
|
updatedAt: isoTimestampSchema2
|
|
1455
1966
|
});
|
|
1456
|
-
var externalHandoffCapabilityRequestSchema =
|
|
1457
|
-
var externalHandoffPublishRequestSchema =
|
|
1967
|
+
var externalHandoffCapabilityRequestSchema = import_zod7.z.strictObject({});
|
|
1968
|
+
var externalHandoffPublishRequestSchema = import_zod7.z.strictObject({
|
|
1458
1969
|
requestId: opaqueIdSchema2,
|
|
1459
|
-
annotation:
|
|
1970
|
+
annotation: spotAnnotationSchema
|
|
1460
1971
|
});
|
|
1461
|
-
var externalHandoffStatusRequestSchema =
|
|
1972
|
+
var externalHandoffStatusRequestSchema = import_zod7.z.strictObject({
|
|
1462
1973
|
cursor: opaqueIdSchema2.optional()
|
|
1463
1974
|
});
|
|
1464
|
-
var externalHandoffResolveDeliveryRequestSchema =
|
|
1975
|
+
var externalHandoffResolveDeliveryRequestSchema = import_zod7.z.strictObject({
|
|
1465
1976
|
cursor: opaqueIdSchema2,
|
|
1466
|
-
confirmation:
|
|
1467
|
-
});
|
|
1468
|
-
var externalHandoffCapabilitySchema =
|
|
1469
|
-
enabled:
|
|
1470
|
-
brokerReady:
|
|
1471
|
-
activeWaitCount:
|
|
1472
|
-
snapshotSchemaVersion:
|
|
1473
|
-
brokerProtocolVersion:
|
|
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),
|
|
1474
1985
|
activeAdapter: activeAdapterSummarySchema.nullable(),
|
|
1475
1986
|
dispatch: dispatchSummarySchema.nullable()
|
|
1476
1987
|
});
|
|
1477
|
-
var externalHandoffPublishDeliverySchema =
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
mode:
|
|
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"),
|
|
1481
1992
|
adapter: activeAdapterSummarySchema,
|
|
1482
1993
|
dispatch: dispatchSummarySchema
|
|
1483
1994
|
})
|
|
1484
1995
|
]);
|
|
1485
|
-
var externalHandoffPublishResultSchema =
|
|
1996
|
+
var externalHandoffPublishResultSchema = import_zod7.z.strictObject({
|
|
1486
1997
|
handoff: externalHandoffSummarySchema,
|
|
1487
1998
|
delivery: externalHandoffPublishDeliverySchema,
|
|
1488
|
-
replayed:
|
|
1999
|
+
replayed: import_zod7.z.boolean()
|
|
1489
2000
|
});
|
|
1490
|
-
var externalHandoffStatusResultSchema =
|
|
2001
|
+
var externalHandoffStatusResultSchema = import_zod7.z.strictObject({
|
|
1491
2002
|
handoff: externalHandoffSummarySchema,
|
|
1492
2003
|
activeAdapter: activeAdapterSummarySchema.nullable(),
|
|
1493
2004
|
dispatch: dispatchSummarySchema.nullable()
|
|
1494
2005
|
});
|
|
1495
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
|
+
|
|
1496
2182
|
// src/protocol/agent-schemas.ts
|
|
1497
|
-
var
|
|
1498
|
-
var
|
|
1499
|
-
var boundedString2 = (maximum) =>
|
|
1500
|
-
var errorCodeSchema =
|
|
1501
|
-
var agentCapabilitySnapshotSchema =
|
|
1502
|
-
providerProfileId:
|
|
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,
|
|
1503
2189
|
providerLabel: boundedString2(100),
|
|
1504
|
-
modelProfileId:
|
|
2190
|
+
modelProfileId: profileIdSchema4,
|
|
1505
2191
|
modelLabel: boundedString2(100),
|
|
1506
|
-
protocol:
|
|
1507
|
-
state:
|
|
1508
|
-
authenticated:
|
|
1509
|
-
modelAvailable:
|
|
1510
|
-
toolCalling:
|
|
1511
|
-
toolResultContinuation:
|
|
1512
|
-
streaming:
|
|
1513
|
-
checkedAt:
|
|
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(),
|
|
1514
2200
|
errorCode: errorCodeSchema.optional()
|
|
1515
2201
|
});
|
|
1516
|
-
var agentWorkspaceHealthSnapshotSchema =
|
|
1517
|
-
state:
|
|
1518
|
-
checkedAt:
|
|
1519
|
-
changes:
|
|
1520
|
-
staged:
|
|
1521
|
-
unstaged:
|
|
1522
|
-
untracked:
|
|
1523
|
-
conflicted:
|
|
1524
|
-
total:
|
|
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()
|
|
1525
2211
|
}),
|
|
1526
|
-
canIncludeLocalChanges:
|
|
2212
|
+
canIncludeLocalChanges: import_zod9.z.boolean(),
|
|
1527
2213
|
errorCode: errorCodeSchema.optional()
|
|
1528
2214
|
}).refine(
|
|
1529
2215
|
({ state, changes, canIncludeLocalChanges, errorCode }) => {
|
|
@@ -1541,42 +2227,42 @@ var agentWorkspaceHealthSnapshotSchema = import_zod6.z.strictObject({
|
|
|
1541
2227
|
},
|
|
1542
2228
|
{ message: "Agent workspace health fields are inconsistent." }
|
|
1543
2229
|
);
|
|
1544
|
-
var agentChangedFileSchema =
|
|
2230
|
+
var agentChangedFileSchema = import_zod9.z.strictObject({
|
|
1545
2231
|
relativePath: boundedString2(1024),
|
|
1546
|
-
kind:
|
|
1547
|
-
additions:
|
|
1548
|
-
deletions:
|
|
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()
|
|
1549
2235
|
});
|
|
1550
|
-
var agentCheckResultSchema =
|
|
1551
|
-
checkId:
|
|
2236
|
+
var agentCheckResultSchema = import_zod9.z.strictObject({
|
|
2237
|
+
checkId: profileIdSchema4,
|
|
1552
2238
|
label: boundedString2(100),
|
|
1553
|
-
status:
|
|
1554
|
-
durationMs:
|
|
2239
|
+
status: import_zod9.z.enum(AGENT_CHECK_STATUSES),
|
|
2240
|
+
durationMs: import_zod9.z.number().int().nonnegative(),
|
|
1555
2241
|
output: boundedString2(8e4)
|
|
1556
2242
|
});
|
|
1557
|
-
var agentJobSnapshotSchema =
|
|
1558
|
-
jobId:
|
|
1559
|
-
status:
|
|
1560
|
-
providerProfileId:
|
|
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,
|
|
1561
2247
|
providerLabel: boundedString2(100),
|
|
1562
|
-
modelProfileId:
|
|
2248
|
+
modelProfileId: profileIdSchema4,
|
|
1563
2249
|
modelLabel: boundedString2(100),
|
|
1564
2250
|
phaseMessage: boundedString2(1024),
|
|
1565
|
-
createdAt:
|
|
1566
|
-
updatedAt:
|
|
1567
|
-
canCancel:
|
|
1568
|
-
canApply:
|
|
1569
|
-
canRevert:
|
|
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(),
|
|
1570
2256
|
errorCode: errorCodeSchema.optional()
|
|
1571
2257
|
});
|
|
1572
|
-
var agentJobResultSchema =
|
|
1573
|
-
jobId:
|
|
2258
|
+
var agentJobResultSchema = import_zod9.z.strictObject({
|
|
2259
|
+
jobId: import_zod9.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
|
|
1574
2260
|
summary: boundedString2(8e4),
|
|
1575
2261
|
diff: boundedString2(1e6),
|
|
1576
|
-
files:
|
|
1577
|
-
checks:
|
|
2262
|
+
files: import_zod9.z.array(agentChangedFileSchema).max(100),
|
|
2263
|
+
checks: import_zod9.z.array(agentCheckResultSchema).max(100)
|
|
1578
2264
|
});
|
|
1579
|
-
var agentJobResultResponseSchema =
|
|
2265
|
+
var agentJobResultResponseSchema = import_zod9.z.strictObject({
|
|
1580
2266
|
snapshot: agentJobSnapshotSchema,
|
|
1581
2267
|
result: agentJobResultSchema.optional()
|
|
1582
2268
|
}).superRefine((value, context) => {
|
|
@@ -1588,44 +2274,44 @@ var agentJobResultResponseSchema = import_zod6.z.strictObject({
|
|
|
1588
2274
|
});
|
|
1589
2275
|
}
|
|
1590
2276
|
});
|
|
1591
|
-
var agentJobEventBaseSchema =
|
|
1592
|
-
schemaVersion:
|
|
1593
|
-
sequence:
|
|
1594
|
-
jobId:
|
|
1595
|
-
status:
|
|
1596
|
-
timestamp:
|
|
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()
|
|
1597
2283
|
});
|
|
1598
|
-
var agentJobEventSchema =
|
|
2284
|
+
var agentJobEventSchema = import_zod9.z.discriminatedUnion("type", [
|
|
1599
2285
|
agentJobEventBaseSchema.extend({
|
|
1600
|
-
type:
|
|
1601
|
-
data:
|
|
2286
|
+
type: import_zod9.z.literal("snapshot"),
|
|
2287
|
+
data: import_zod9.z.strictObject({ snapshot: agentJobSnapshotSchema })
|
|
1602
2288
|
}),
|
|
1603
2289
|
agentJobEventBaseSchema.extend({
|
|
1604
|
-
type:
|
|
1605
|
-
data:
|
|
2290
|
+
type: import_zod9.z.literal("phase"),
|
|
2291
|
+
data: import_zod9.z.strictObject({ message: boundedString2(1024) })
|
|
1606
2292
|
}),
|
|
1607
2293
|
agentJobEventBaseSchema.extend({
|
|
1608
|
-
type:
|
|
1609
|
-
data:
|
|
1610
|
-
turn:
|
|
2294
|
+
type: import_zod9.z.literal("tool"),
|
|
2295
|
+
data: import_zod9.z.strictObject({
|
|
2296
|
+
turn: import_zod9.z.number().int().positive(),
|
|
1611
2297
|
toolCallId: boundedString2(256),
|
|
1612
2298
|
toolName: boundedString2(100),
|
|
1613
|
-
state:
|
|
2299
|
+
state: import_zod9.z.enum(["started", "succeeded", "failed"]),
|
|
1614
2300
|
relativePath: boundedString2(1024).optional(),
|
|
1615
2301
|
checkLabel: boundedString2(100).optional()
|
|
1616
2302
|
})
|
|
1617
2303
|
}),
|
|
1618
2304
|
agentJobEventBaseSchema.extend({
|
|
1619
|
-
type:
|
|
1620
|
-
data:
|
|
2305
|
+
type: import_zod9.z.literal("check"),
|
|
2306
|
+
data: import_zod9.z.strictObject({ result: agentCheckResultSchema })
|
|
1621
2307
|
}),
|
|
1622
2308
|
agentJobEventBaseSchema.extend({
|
|
1623
|
-
type:
|
|
1624
|
-
data:
|
|
2309
|
+
type: import_zod9.z.literal("result-ready"),
|
|
2310
|
+
data: import_zod9.z.strictObject({ hasResult: import_zod9.z.literal(true) })
|
|
1625
2311
|
}),
|
|
1626
2312
|
agentJobEventBaseSchema.extend({
|
|
1627
|
-
type:
|
|
1628
|
-
data:
|
|
2313
|
+
type: import_zod9.z.literal("error"),
|
|
2314
|
+
data: import_zod9.z.strictObject({
|
|
1629
2315
|
code: errorCodeSchema,
|
|
1630
2316
|
message: boundedString2(1024)
|
|
1631
2317
|
})
|
|
@@ -1661,6 +2347,18 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
|
|
|
1661
2347
|
AGENT_JOB_STATUSES,
|
|
1662
2348
|
AGENT_WORKSPACE_SNAPSHOT_LIMITS,
|
|
1663
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,
|
|
1664
2362
|
DATA_FLOW_ASSOCIATION_KINDS,
|
|
1665
2363
|
DATA_FLOW_DIAGNOSTIC_CODES,
|
|
1666
2364
|
DATA_FLOW_EXECUTION_STATES,
|
|
@@ -1731,7 +2429,26 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
|
|
|
1731
2429
|
agentJobSnapshotSchema,
|
|
1732
2430
|
agentWorkspaceHealthRequestSchema,
|
|
1733
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,
|
|
1734
2446
|
componentDataFlowReportSchema,
|
|
2447
|
+
contextualAskCapabilityRequestSchema,
|
|
2448
|
+
contextualAskCapabilitySchema,
|
|
2449
|
+
contextualAskExecutorCapabilitySchema,
|
|
2450
|
+
contextualAskExecutorPreferenceSchema,
|
|
2451
|
+
contextualAskOptionsSchema,
|
|
1735
2452
|
dataDependencySchema,
|
|
1736
2453
|
dataFlowComponentReportRequestSchema,
|
|
1737
2454
|
dataFlowPageReportRequestSchema,
|
|
@@ -1759,6 +2476,7 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
|
|
|
1759
2476
|
externalHandoffSummarySchema,
|
|
1760
2477
|
formatSourceMarker,
|
|
1761
2478
|
getAgentJobEndpoint,
|
|
2479
|
+
getAskJobEndpoint,
|
|
1762
2480
|
isErrorCode,
|
|
1763
2481
|
isSensitiveName,
|
|
1764
2482
|
limitDataFlowReportCollections,
|
|
@@ -1777,6 +2495,11 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
|
|
|
1777
2495
|
sanitizeUrl,
|
|
1778
2496
|
sourceContextRequestSchema,
|
|
1779
2497
|
spotAnnotationRequestSchema,
|
|
1780
|
-
|
|
2498
|
+
spotAskTaskEnvelopeSchema,
|
|
2499
|
+
spotChangeTaskEnvelopeSchema,
|
|
2500
|
+
spotSelectionContextSchema,
|
|
2501
|
+
spotSelectionTargetSchema,
|
|
2502
|
+
spotTargetContextRequestSchema,
|
|
2503
|
+
spotTaskEnvelopeSchema
|
|
1781
2504
|
});
|
|
1782
2505
|
//# sourceMappingURL=index.cjs.map
|