@spotpatch/shared 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -8
- package/dist/index.cjs +223 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -20
- package/dist/index.d.ts +66 -20
- package/dist/index.js +219 -137
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,6 +36,8 @@ var ERROR_CODES = {
|
|
|
36
36
|
WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED",
|
|
37
37
|
TOOL_DENIED: "TOOL_DENIED",
|
|
38
38
|
TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID",
|
|
39
|
+
TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID",
|
|
40
|
+
TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT",
|
|
39
41
|
TOOL_PATH_DENIED: "TOOL_PATH_DENIED",
|
|
40
42
|
PATCH_REJECTED: "PATCH_REJECTED",
|
|
41
43
|
VALIDATION_FAILED: "VALIDATION_FAILED",
|
|
@@ -122,9 +124,97 @@ var SPOTPATCH_LOCALE_PREFERENCES = Object.freeze([
|
|
|
122
124
|
...SPOTPATCH_LOCALES
|
|
123
125
|
]);
|
|
124
126
|
|
|
127
|
+
// src/model/runtime-config.ts
|
|
128
|
+
import { z } from "zod";
|
|
129
|
+
|
|
130
|
+
// src/protocol/endpoints.ts
|
|
131
|
+
var SPOTPATCH_API_BASE = "/__spotpatch/v1";
|
|
132
|
+
var SPOTPATCH_TOKEN_HEADER = "X-SpotPatch-Token";
|
|
133
|
+
var SPOTPATCH_ENDPOINTS = Object.freeze({
|
|
134
|
+
bootstrap: `${SPOTPATCH_API_BASE}/bootstrap`,
|
|
135
|
+
sourceContext: `${SPOTPATCH_API_BASE}/source-context`,
|
|
136
|
+
openEditor: `${SPOTPATCH_API_BASE}/open-editor`,
|
|
137
|
+
agentCapability: `${SPOTPATCH_API_BASE}/agent/capability`,
|
|
138
|
+
agentWorkspaceHealth: `${SPOTPATCH_API_BASE}/agent/workspace-health`,
|
|
139
|
+
agentJobs: `${SPOTPATCH_API_BASE}/agent/jobs`
|
|
140
|
+
});
|
|
141
|
+
function getAgentJobEndpoint(jobId, action) {
|
|
142
|
+
return `${SPOTPATCH_ENDPOINTS.agentJobs}/${encodeURIComponent(jobId)}/${action}`;
|
|
143
|
+
}
|
|
144
|
+
|
|
125
145
|
// src/model/editor.ts
|
|
126
146
|
var SPOTPATCH_EDITOR_PREFERENCES = ["auto", "vscode", "cursor"];
|
|
127
147
|
|
|
148
|
+
// src/model/runtime-config.ts
|
|
149
|
+
var SPOTPATCH_NEXT_BUNDLERS = Object.freeze(["turbopack", "webpack"]);
|
|
150
|
+
var SPOTPATCH_NEXT_ROUTER_KINDS = Object.freeze([
|
|
151
|
+
"app",
|
|
152
|
+
"pages",
|
|
153
|
+
"hybrid"
|
|
154
|
+
]);
|
|
155
|
+
var boundedText = (maximum) => z.string().trim().min(1).max(maximum);
|
|
156
|
+
var profileIdSchema = z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/u);
|
|
157
|
+
var runtimeAiModelSchema = z.strictObject({
|
|
158
|
+
id: profileIdSchema,
|
|
159
|
+
label: boundedText(100)
|
|
160
|
+
});
|
|
161
|
+
var runtimeAiProviderSchema = z.strictObject({
|
|
162
|
+
id: profileIdSchema,
|
|
163
|
+
label: boundedText(100),
|
|
164
|
+
protocol: z.enum(["responses", "chat-completions"]),
|
|
165
|
+
models: z.array(runtimeAiModelSchema).min(1).max(64),
|
|
166
|
+
defaultModel: profileIdSchema
|
|
167
|
+
}).refine(
|
|
168
|
+
({ defaultModel, models }) => models.some(({ id }) => id === defaultModel) && new Set(models.map(({ id }) => id)).size === models.length,
|
|
169
|
+
{ message: "Runtime AI model profiles are inconsistent." }
|
|
170
|
+
);
|
|
171
|
+
var runtimeAiConfigSchema = z.discriminatedUnion("enabled", [
|
|
172
|
+
z.strictObject({ enabled: z.literal(false) }),
|
|
173
|
+
z.strictObject({
|
|
174
|
+
enabled: z.literal(true),
|
|
175
|
+
providers: z.array(runtimeAiProviderSchema).min(1).max(32),
|
|
176
|
+
defaultProvider: profileIdSchema,
|
|
177
|
+
applyMode: z.enum(["review", "auto"])
|
|
178
|
+
}).refine(
|
|
179
|
+
({ defaultProvider, providers }) => providers.some(({ id }) => id === defaultProvider) && new Set(providers.map(({ id }) => id)).size === providers.length,
|
|
180
|
+
{ message: "Runtime AI provider profiles are inconsistent." }
|
|
181
|
+
)
|
|
182
|
+
]);
|
|
183
|
+
var positiveInteger = z.number().int().positive();
|
|
184
|
+
var runtimeConfigBaseShape = {
|
|
185
|
+
apiBase: z.literal(SPOTPATCH_API_BASE),
|
|
186
|
+
ai: runtimeAiConfigSchema,
|
|
187
|
+
budget: z.strictObject({
|
|
188
|
+
totalCharacters: positiveInteger,
|
|
189
|
+
domCharacters: positiveInteger,
|
|
190
|
+
cssCharacters: positiveInteger,
|
|
191
|
+
codeCharacters: positiveInteger,
|
|
192
|
+
maxCodeLines: positiveInteger,
|
|
193
|
+
maxComponentDepth: positiveInteger
|
|
194
|
+
}),
|
|
195
|
+
debug: z.boolean(),
|
|
196
|
+
editor: z.enum(SPOTPATCH_EDITOR_PREFERENCES),
|
|
197
|
+
frameworkVersion: boundedText(64),
|
|
198
|
+
locale: z.enum(SPOTPATCH_LOCALE_PREFERENCES),
|
|
199
|
+
maxTargets: z.number().int().min(1).max(MAX_ANNOTATION_TARGETS),
|
|
200
|
+
redact: z.boolean(),
|
|
201
|
+
sessionToken: z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
|
|
202
|
+
shortcut: boundedText(128),
|
|
203
|
+
spotPatchVersion: boundedText(64)
|
|
204
|
+
};
|
|
205
|
+
var runtimeConfigSchema = z.discriminatedUnion("framework", [
|
|
206
|
+
z.strictObject({
|
|
207
|
+
...runtimeConfigBaseShape,
|
|
208
|
+
framework: z.literal("vite")
|
|
209
|
+
}),
|
|
210
|
+
z.strictObject({
|
|
211
|
+
...runtimeConfigBaseShape,
|
|
212
|
+
bundler: z.enum(SPOTPATCH_NEXT_BUNDLERS),
|
|
213
|
+
framework: z.literal("next"),
|
|
214
|
+
routerKind: z.enum(SPOTPATCH_NEXT_ROUTER_KINDS)
|
|
215
|
+
})
|
|
216
|
+
]);
|
|
217
|
+
|
|
128
218
|
// src/model/agent.ts
|
|
129
219
|
var DEFAULT_AGENT_LIMITS = Object.freeze({
|
|
130
220
|
maxTurns: 20,
|
|
@@ -206,102 +296,89 @@ function parseSourceMarker(value) {
|
|
|
206
296
|
return Object.freeze({ fileId, line, column });
|
|
207
297
|
}
|
|
208
298
|
|
|
209
|
-
// src/protocol/endpoints.ts
|
|
210
|
-
var SPOTPATCH_API_BASE = "/__spotpatch/v1";
|
|
211
|
-
var SPOTPATCH_TOKEN_HEADER = "X-SpotPatch-Token";
|
|
212
|
-
var SPOTPATCH_ENDPOINTS = Object.freeze({
|
|
213
|
-
sourceContext: `${SPOTPATCH_API_BASE}/source-context`,
|
|
214
|
-
openEditor: `${SPOTPATCH_API_BASE}/open-editor`,
|
|
215
|
-
agentCapability: `${SPOTPATCH_API_BASE}/agent/capability`,
|
|
216
|
-
agentWorkspaceHealth: `${SPOTPATCH_API_BASE}/agent/workspace-health`,
|
|
217
|
-
agentJobs: `${SPOTPATCH_API_BASE}/agent/jobs`
|
|
218
|
-
});
|
|
219
|
-
function getAgentJobEndpoint(jobId, action) {
|
|
220
|
-
return `${SPOTPATCH_ENDPOINTS.agentJobs}/${encodeURIComponent(jobId)}/${action}`;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
299
|
// src/protocol/requests.ts
|
|
224
|
-
import { z } from "zod";
|
|
225
|
-
var
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
300
|
+
import { z as z2 } from "zod";
|
|
301
|
+
var runtimeBootstrapRequestSchema = z2.strictObject({});
|
|
302
|
+
var sourceCoordinatesSchema = z2.strictObject({
|
|
303
|
+
fileId: z2.string().min(1).max(128),
|
|
304
|
+
line: z2.number().int().positive(),
|
|
305
|
+
column: z2.number().int().positive()
|
|
229
306
|
});
|
|
230
307
|
var sourceContextRequestSchema = sourceCoordinatesSchema.extend({
|
|
231
|
-
maxLines:
|
|
308
|
+
maxLines: z2.number().int().positive()
|
|
232
309
|
}).strict();
|
|
233
310
|
var openEditorRequestSchema = sourceCoordinatesSchema.strict();
|
|
234
|
-
var
|
|
235
|
-
var boundedString = (maximum) =>
|
|
236
|
-
var sourceRefSchema =
|
|
311
|
+
var profileIdSchema2 = z2.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
|
|
312
|
+
var boundedString = (maximum) => z2.string().max(maximum);
|
|
313
|
+
var sourceRefSchema = z2.strictObject({
|
|
237
314
|
fileId: boundedString(128).optional(),
|
|
238
315
|
relativePath: boundedString(1024).optional(),
|
|
239
|
-
line:
|
|
240
|
-
column:
|
|
241
|
-
origin:
|
|
242
|
-
confidence:
|
|
316
|
+
line: z2.number().int().positive().optional(),
|
|
317
|
+
column: z2.number().int().positive().optional(),
|
|
318
|
+
origin: z2.enum(["jsx-host", "react-fiber", "dom-ancestor", "none"]),
|
|
319
|
+
confidence: z2.enum(["exact", "probable", "approximate", "unknown"])
|
|
243
320
|
});
|
|
244
|
-
var matchedStyleRuleSchema =
|
|
321
|
+
var matchedStyleRuleSchema = z2.strictObject({
|
|
245
322
|
selector: boundedString(2048),
|
|
246
323
|
declarations: boundedString(8192),
|
|
247
324
|
source: boundedString(1024).optional(),
|
|
248
325
|
media: boundedString(1024).optional()
|
|
249
326
|
});
|
|
250
|
-
var codeContextSchema =
|
|
327
|
+
var codeContextSchema = z2.strictObject({
|
|
251
328
|
relativePath: boundedString(1024),
|
|
252
|
-
language:
|
|
253
|
-
startLine:
|
|
254
|
-
endLine:
|
|
329
|
+
language: z2.enum(["tsx", "jsx"]),
|
|
330
|
+
startLine: z2.number().int().positive(),
|
|
331
|
+
endLine: z2.number().int().positive(),
|
|
255
332
|
excerpt: boundedString(16e3),
|
|
256
|
-
boundary:
|
|
333
|
+
boundary: z2.enum(["component", "nearby-lines"])
|
|
257
334
|
});
|
|
258
|
-
var spotTargetContextRequestSchema =
|
|
259
|
-
instruction:
|
|
335
|
+
var spotTargetContextRequestSchema = z2.strictObject({
|
|
336
|
+
instruction: z2.string().trim().min(1).max(MAX_TARGET_INSTRUCTION_CHARACTERS),
|
|
260
337
|
source: sourceRefSchema,
|
|
261
|
-
react:
|
|
262
|
-
supported:
|
|
338
|
+
react: z2.strictObject({
|
|
339
|
+
supported: z2.boolean(),
|
|
263
340
|
version: boundedString(64).optional(),
|
|
264
341
|
componentName: boundedString(256).optional(),
|
|
265
|
-
componentStack:
|
|
342
|
+
componentStack: z2.array(boundedString(256)).max(64),
|
|
266
343
|
source: sourceRefSchema.optional()
|
|
267
344
|
}),
|
|
268
|
-
element:
|
|
345
|
+
element: z2.strictObject({
|
|
269
346
|
tagName: boundedString(128),
|
|
270
347
|
selector: boundedString(2048),
|
|
271
348
|
sanitizedHtml: boundedString(8192),
|
|
272
349
|
textPreview: boundedString(2048).optional(),
|
|
273
350
|
role: boundedString(256).optional(),
|
|
274
|
-
rect:
|
|
275
|
-
x:
|
|
276
|
-
y:
|
|
277
|
-
width:
|
|
278
|
-
height:
|
|
351
|
+
rect: z2.strictObject({
|
|
352
|
+
x: z2.number(),
|
|
353
|
+
y: z2.number(),
|
|
354
|
+
width: z2.number().nonnegative(),
|
|
355
|
+
height: z2.number().nonnegative()
|
|
279
356
|
})
|
|
280
357
|
}),
|
|
281
|
-
styles:
|
|
282
|
-
classNames:
|
|
358
|
+
styles: z2.strictObject({
|
|
359
|
+
classNames: z2.array(boundedString(512)).max(256),
|
|
283
360
|
inlineStyle: boundedString(8192).optional(),
|
|
284
|
-
matchedRules:
|
|
285
|
-
computed:
|
|
286
|
-
warnings:
|
|
361
|
+
matchedRules: z2.array(matchedStyleRuleSchema).max(256),
|
|
362
|
+
computed: z2.record(boundedString(256), boundedString(2048)),
|
|
363
|
+
warnings: z2.array(boundedString(1024)).max(64)
|
|
287
364
|
}),
|
|
288
365
|
code: codeContextSchema.optional(),
|
|
289
|
-
warnings:
|
|
366
|
+
warnings: z2.array(boundedString(1024)).max(64)
|
|
290
367
|
});
|
|
291
|
-
var spotAnnotationRequestSchema =
|
|
292
|
-
schemaVersion:
|
|
368
|
+
var spotAnnotationRequestSchema = z2.strictObject({
|
|
369
|
+
schemaVersion: z2.literal(3),
|
|
293
370
|
id: boundedString(128),
|
|
294
|
-
locale:
|
|
295
|
-
page:
|
|
371
|
+
locale: z2.enum(SPOTPATCH_LOCALES),
|
|
372
|
+
page: z2.strictObject({
|
|
296
373
|
url: boundedString(2048),
|
|
297
374
|
pathname: boundedString(2048),
|
|
298
375
|
title: boundedString(1024),
|
|
299
|
-
viewportWidth:
|
|
300
|
-
viewportHeight:
|
|
301
|
-
devicePixelRatio:
|
|
376
|
+
viewportWidth: z2.number().nonnegative(),
|
|
377
|
+
viewportHeight: z2.number().nonnegative(),
|
|
378
|
+
devicePixelRatio: z2.number().positive()
|
|
302
379
|
}),
|
|
303
|
-
targets:
|
|
304
|
-
createdAt:
|
|
380
|
+
targets: z2.array(spotTargetContextRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS),
|
|
381
|
+
createdAt: z2.iso.datetime()
|
|
305
382
|
}).superRefine((annotation, context) => {
|
|
306
383
|
const total = annotation.targets.reduce(
|
|
307
384
|
(characters, target) => characters + target.instruction.length,
|
|
@@ -315,51 +392,51 @@ var spotAnnotationRequestSchema = z.strictObject({
|
|
|
315
392
|
});
|
|
316
393
|
}
|
|
317
394
|
});
|
|
318
|
-
var agentCapabilityRequestSchema =
|
|
319
|
-
providerProfileId:
|
|
320
|
-
modelProfileId:
|
|
395
|
+
var agentCapabilityRequestSchema = z2.strictObject({
|
|
396
|
+
providerProfileId: profileIdSchema2,
|
|
397
|
+
modelProfileId: profileIdSchema2
|
|
321
398
|
});
|
|
322
|
-
var agentWorkspaceHealthRequestSchema =
|
|
323
|
-
var agentJobCreateRequestSchema =
|
|
399
|
+
var agentWorkspaceHealthRequestSchema = z2.strictObject({});
|
|
400
|
+
var agentJobCreateRequestSchema = z2.strictObject({
|
|
324
401
|
annotation: spotAnnotationRequestSchema,
|
|
325
|
-
providerProfileId:
|
|
326
|
-
modelProfileId:
|
|
327
|
-
providerDataConsent:
|
|
328
|
-
workingTreeMode:
|
|
402
|
+
providerProfileId: profileIdSchema2,
|
|
403
|
+
modelProfileId: profileIdSchema2,
|
|
404
|
+
providerDataConsent: z2.literal(true),
|
|
405
|
+
workingTreeMode: z2.enum(["require-clean", "include-local-changes"]).default("require-clean")
|
|
329
406
|
});
|
|
330
|
-
var agentJobActionRequestSchema =
|
|
407
|
+
var agentJobActionRequestSchema = z2.strictObject({});
|
|
331
408
|
|
|
332
409
|
// src/protocol/agent-schemas.ts
|
|
333
|
-
import { z as
|
|
334
|
-
var
|
|
335
|
-
var boundedString2 = (maximum) =>
|
|
336
|
-
var errorCodeSchema =
|
|
337
|
-
var agentCapabilitySnapshotSchema =
|
|
338
|
-
providerProfileId:
|
|
410
|
+
import { z as z3 } from "zod";
|
|
411
|
+
var profileIdSchema3 = z3.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
|
|
412
|
+
var boundedString2 = (maximum) => z3.string().max(maximum);
|
|
413
|
+
var errorCodeSchema = z3.enum(ERROR_CODES);
|
|
414
|
+
var agentCapabilitySnapshotSchema = z3.strictObject({
|
|
415
|
+
providerProfileId: profileIdSchema3,
|
|
339
416
|
providerLabel: boundedString2(100),
|
|
340
|
-
modelProfileId:
|
|
417
|
+
modelProfileId: profileIdSchema3,
|
|
341
418
|
modelLabel: boundedString2(100),
|
|
342
|
-
protocol:
|
|
343
|
-
state:
|
|
344
|
-
authenticated:
|
|
345
|
-
modelAvailable:
|
|
346
|
-
toolCalling:
|
|
347
|
-
toolResultContinuation:
|
|
348
|
-
streaming:
|
|
349
|
-
checkedAt:
|
|
419
|
+
protocol: z3.enum(["responses", "chat-completions"]),
|
|
420
|
+
state: z3.enum(AGENT_CAPABILITY_STATES),
|
|
421
|
+
authenticated: z3.boolean(),
|
|
422
|
+
modelAvailable: z3.boolean(),
|
|
423
|
+
toolCalling: z3.boolean(),
|
|
424
|
+
toolResultContinuation: z3.boolean(),
|
|
425
|
+
streaming: z3.boolean(),
|
|
426
|
+
checkedAt: z3.iso.datetime().optional(),
|
|
350
427
|
errorCode: errorCodeSchema.optional()
|
|
351
428
|
});
|
|
352
|
-
var agentWorkspaceHealthSnapshotSchema =
|
|
353
|
-
state:
|
|
354
|
-
checkedAt:
|
|
355
|
-
changes:
|
|
356
|
-
staged:
|
|
357
|
-
unstaged:
|
|
358
|
-
untracked:
|
|
359
|
-
conflicted:
|
|
360
|
-
total:
|
|
429
|
+
var agentWorkspaceHealthSnapshotSchema = z3.strictObject({
|
|
430
|
+
state: z3.enum(AGENT_WORKSPACE_STATES),
|
|
431
|
+
checkedAt: z3.iso.datetime(),
|
|
432
|
+
changes: z3.strictObject({
|
|
433
|
+
staged: z3.number().int().nonnegative(),
|
|
434
|
+
unstaged: z3.number().int().nonnegative(),
|
|
435
|
+
untracked: z3.number().int().nonnegative(),
|
|
436
|
+
conflicted: z3.number().int().nonnegative(),
|
|
437
|
+
total: z3.number().int().nonnegative()
|
|
361
438
|
}),
|
|
362
|
-
canIncludeLocalChanges:
|
|
439
|
+
canIncludeLocalChanges: z3.boolean(),
|
|
363
440
|
errorCode: errorCodeSchema.optional()
|
|
364
441
|
}).refine(
|
|
365
442
|
({ state, changes, canIncludeLocalChanges, errorCode }) => {
|
|
@@ -377,42 +454,42 @@ var agentWorkspaceHealthSnapshotSchema = z2.strictObject({
|
|
|
377
454
|
},
|
|
378
455
|
{ message: "Agent workspace health fields are inconsistent." }
|
|
379
456
|
);
|
|
380
|
-
var agentChangedFileSchema =
|
|
457
|
+
var agentChangedFileSchema = z3.strictObject({
|
|
381
458
|
relativePath: boundedString2(1024),
|
|
382
|
-
kind:
|
|
383
|
-
additions:
|
|
384
|
-
deletions:
|
|
459
|
+
kind: z3.enum(AGENT_FILE_CHANGE_KINDS),
|
|
460
|
+
additions: z3.number().int().nonnegative(),
|
|
461
|
+
deletions: z3.number().int().nonnegative()
|
|
385
462
|
});
|
|
386
|
-
var agentCheckResultSchema =
|
|
387
|
-
checkId:
|
|
463
|
+
var agentCheckResultSchema = z3.strictObject({
|
|
464
|
+
checkId: profileIdSchema3,
|
|
388
465
|
label: boundedString2(100),
|
|
389
|
-
status:
|
|
390
|
-
durationMs:
|
|
466
|
+
status: z3.enum(AGENT_CHECK_STATUSES),
|
|
467
|
+
durationMs: z3.number().int().nonnegative(),
|
|
391
468
|
output: boundedString2(8e4)
|
|
392
469
|
});
|
|
393
|
-
var agentJobSnapshotSchema =
|
|
394
|
-
jobId:
|
|
395
|
-
status:
|
|
396
|
-
providerProfileId:
|
|
470
|
+
var agentJobSnapshotSchema = z3.strictObject({
|
|
471
|
+
jobId: z3.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
|
|
472
|
+
status: z3.enum(AGENT_JOB_STATUSES),
|
|
473
|
+
providerProfileId: profileIdSchema3,
|
|
397
474
|
providerLabel: boundedString2(100),
|
|
398
|
-
modelProfileId:
|
|
475
|
+
modelProfileId: profileIdSchema3,
|
|
399
476
|
modelLabel: boundedString2(100),
|
|
400
477
|
phaseMessage: boundedString2(1024),
|
|
401
|
-
createdAt:
|
|
402
|
-
updatedAt:
|
|
403
|
-
canCancel:
|
|
404
|
-
canApply:
|
|
405
|
-
canRevert:
|
|
478
|
+
createdAt: z3.iso.datetime(),
|
|
479
|
+
updatedAt: z3.iso.datetime(),
|
|
480
|
+
canCancel: z3.boolean(),
|
|
481
|
+
canApply: z3.boolean(),
|
|
482
|
+
canRevert: z3.boolean(),
|
|
406
483
|
errorCode: errorCodeSchema.optional()
|
|
407
484
|
});
|
|
408
|
-
var agentJobResultSchema =
|
|
409
|
-
jobId:
|
|
485
|
+
var agentJobResultSchema = z3.strictObject({
|
|
486
|
+
jobId: z3.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
|
|
410
487
|
summary: boundedString2(8e4),
|
|
411
488
|
diff: boundedString2(1e6),
|
|
412
|
-
files:
|
|
413
|
-
checks:
|
|
489
|
+
files: z3.array(agentChangedFileSchema).max(100),
|
|
490
|
+
checks: z3.array(agentCheckResultSchema).max(100)
|
|
414
491
|
});
|
|
415
|
-
var agentJobResultResponseSchema =
|
|
492
|
+
var agentJobResultResponseSchema = z3.strictObject({
|
|
416
493
|
snapshot: agentJobSnapshotSchema,
|
|
417
494
|
result: agentJobResultSchema.optional()
|
|
418
495
|
}).superRefine((value, context) => {
|
|
@@ -424,43 +501,44 @@ var agentJobResultResponseSchema = z2.strictObject({
|
|
|
424
501
|
});
|
|
425
502
|
}
|
|
426
503
|
});
|
|
427
|
-
var agentJobEventBaseSchema =
|
|
428
|
-
schemaVersion:
|
|
429
|
-
sequence:
|
|
430
|
-
jobId:
|
|
431
|
-
status:
|
|
432
|
-
timestamp:
|
|
504
|
+
var agentJobEventBaseSchema = z3.strictObject({
|
|
505
|
+
schemaVersion: z3.literal(2),
|
|
506
|
+
sequence: z3.number().int().positive(),
|
|
507
|
+
jobId: z3.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
|
|
508
|
+
status: z3.enum(AGENT_JOB_STATUSES),
|
|
509
|
+
timestamp: z3.iso.datetime()
|
|
433
510
|
});
|
|
434
|
-
var agentJobEventSchema =
|
|
511
|
+
var agentJobEventSchema = z3.discriminatedUnion("type", [
|
|
435
512
|
agentJobEventBaseSchema.extend({
|
|
436
|
-
type:
|
|
437
|
-
data:
|
|
513
|
+
type: z3.literal("snapshot"),
|
|
514
|
+
data: z3.strictObject({ snapshot: agentJobSnapshotSchema })
|
|
438
515
|
}),
|
|
439
516
|
agentJobEventBaseSchema.extend({
|
|
440
|
-
type:
|
|
441
|
-
data:
|
|
517
|
+
type: z3.literal("phase"),
|
|
518
|
+
data: z3.strictObject({ message: boundedString2(1024) })
|
|
442
519
|
}),
|
|
443
520
|
agentJobEventBaseSchema.extend({
|
|
444
|
-
type:
|
|
445
|
-
data:
|
|
521
|
+
type: z3.literal("tool"),
|
|
522
|
+
data: z3.strictObject({
|
|
523
|
+
turn: z3.number().int().positive(),
|
|
446
524
|
toolCallId: boundedString2(256),
|
|
447
525
|
toolName: boundedString2(100),
|
|
448
|
-
state:
|
|
526
|
+
state: z3.enum(["started", "succeeded", "failed"]),
|
|
449
527
|
relativePath: boundedString2(1024).optional(),
|
|
450
528
|
checkLabel: boundedString2(100).optional()
|
|
451
529
|
})
|
|
452
530
|
}),
|
|
453
531
|
agentJobEventBaseSchema.extend({
|
|
454
|
-
type:
|
|
455
|
-
data:
|
|
532
|
+
type: z3.literal("check"),
|
|
533
|
+
data: z3.strictObject({ result: agentCheckResultSchema })
|
|
456
534
|
}),
|
|
457
535
|
agentJobEventBaseSchema.extend({
|
|
458
|
-
type:
|
|
459
|
-
data:
|
|
536
|
+
type: z3.literal("result-ready"),
|
|
537
|
+
data: z3.strictObject({ hasResult: z3.literal(true) })
|
|
460
538
|
}),
|
|
461
539
|
agentJobEventBaseSchema.extend({
|
|
462
|
-
type:
|
|
463
|
-
data:
|
|
540
|
+
type: z3.literal("error"),
|
|
541
|
+
data: z3.strictObject({
|
|
464
542
|
code: errorCodeSchema,
|
|
465
543
|
message: boundedString2(1024)
|
|
466
544
|
})
|
|
@@ -505,6 +583,8 @@ export {
|
|
|
505
583
|
SPOTPATCH_ENDPOINTS,
|
|
506
584
|
SPOTPATCH_LOCALES,
|
|
507
585
|
SPOTPATCH_LOCALE_PREFERENCES,
|
|
586
|
+
SPOTPATCH_NEXT_BUNDLERS,
|
|
587
|
+
SPOTPATCH_NEXT_ROUTER_KINDS,
|
|
508
588
|
SPOTPATCH_REPOSITORY_URL,
|
|
509
589
|
SPOTPATCH_TOKEN_HEADER,
|
|
510
590
|
SpotPatchError,
|
|
@@ -526,6 +606,8 @@ export {
|
|
|
526
606
|
openEditorRequestSchema,
|
|
527
607
|
parseSourceMarker,
|
|
528
608
|
redactSensitiveText,
|
|
609
|
+
runtimeBootstrapRequestSchema,
|
|
610
|
+
runtimeConfigSchema,
|
|
529
611
|
sanitizeUrl,
|
|
530
612
|
sourceContextRequestSchema,
|
|
531
613
|
spotAnnotationRequestSchema,
|