@spotpatch/shared 1.4.0 → 1.6.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 +20 -8
- package/dist/index.cjs +228 -142
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -13
- package/dist/index.d.ts +69 -13
- package/dist/index.js +224 -142
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -124,9 +124,98 @@ var SPOTPATCH_LOCALE_PREFERENCES = Object.freeze([
|
|
|
124
124
|
...SPOTPATCH_LOCALES
|
|
125
125
|
]);
|
|
126
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
|
+
|
|
127
145
|
// src/model/editor.ts
|
|
128
146
|
var SPOTPATCH_EDITOR_PREFERENCES = ["auto", "vscode", "cursor"];
|
|
129
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
|
+
sessionId: z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
|
|
202
|
+
sessionToken: z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
|
|
203
|
+
shortcut: boundedText(128),
|
|
204
|
+
spotPatchVersion: boundedText(64)
|
|
205
|
+
};
|
|
206
|
+
var runtimeConfigSchema = z.discriminatedUnion("framework", [
|
|
207
|
+
z.strictObject({
|
|
208
|
+
...runtimeConfigBaseShape,
|
|
209
|
+
framework: z.literal("vite")
|
|
210
|
+
}),
|
|
211
|
+
z.strictObject({
|
|
212
|
+
...runtimeConfigBaseShape,
|
|
213
|
+
bundler: z.enum(SPOTPATCH_NEXT_BUNDLERS),
|
|
214
|
+
framework: z.literal("next"),
|
|
215
|
+
routerKind: z.enum(SPOTPATCH_NEXT_ROUTER_KINDS)
|
|
216
|
+
})
|
|
217
|
+
]);
|
|
218
|
+
|
|
130
219
|
// src/model/agent.ts
|
|
131
220
|
var DEFAULT_AGENT_LIMITS = Object.freeze({
|
|
132
221
|
maxTurns: 20,
|
|
@@ -208,102 +297,91 @@ function parseSourceMarker(value) {
|
|
|
208
297
|
return Object.freeze({ fileId, line, column });
|
|
209
298
|
}
|
|
210
299
|
|
|
211
|
-
// src/protocol/endpoints.ts
|
|
212
|
-
var SPOTPATCH_API_BASE = "/__spotpatch/v1";
|
|
213
|
-
var SPOTPATCH_TOKEN_HEADER = "X-SpotPatch-Token";
|
|
214
|
-
var SPOTPATCH_ENDPOINTS = Object.freeze({
|
|
215
|
-
sourceContext: `${SPOTPATCH_API_BASE}/source-context`,
|
|
216
|
-
openEditor: `${SPOTPATCH_API_BASE}/open-editor`,
|
|
217
|
-
agentCapability: `${SPOTPATCH_API_BASE}/agent/capability`,
|
|
218
|
-
agentWorkspaceHealth: `${SPOTPATCH_API_BASE}/agent/workspace-health`,
|
|
219
|
-
agentJobs: `${SPOTPATCH_API_BASE}/agent/jobs`
|
|
220
|
-
});
|
|
221
|
-
function getAgentJobEndpoint(jobId, action) {
|
|
222
|
-
return `${SPOTPATCH_ENDPOINTS.agentJobs}/${encodeURIComponent(jobId)}/${action}`;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
300
|
// src/protocol/requests.ts
|
|
226
|
-
import { z } from "zod";
|
|
227
|
-
var
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
301
|
+
import { z as z2 } from "zod";
|
|
302
|
+
var runtimeBootstrapRequestSchema = z2.strictObject({});
|
|
303
|
+
var sourceCoordinatesSchema = z2.strictObject({
|
|
304
|
+
fileId: z2.string().min(1).max(128),
|
|
305
|
+
line: z2.number().int().positive(),
|
|
306
|
+
column: z2.number().int().positive()
|
|
231
307
|
});
|
|
232
308
|
var sourceContextRequestSchema = sourceCoordinatesSchema.extend({
|
|
233
|
-
maxLines:
|
|
309
|
+
maxLines: z2.number().int().positive()
|
|
234
310
|
}).strict();
|
|
235
311
|
var openEditorRequestSchema = sourceCoordinatesSchema.strict();
|
|
236
|
-
var
|
|
237
|
-
var boundedString = (maximum) =>
|
|
238
|
-
var sourceRefSchema =
|
|
312
|
+
var profileIdSchema2 = z2.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
|
|
313
|
+
var boundedString = (maximum) => z2.string().max(maximum);
|
|
314
|
+
var sourceRefSchema = z2.strictObject({
|
|
239
315
|
fileId: boundedString(128).optional(),
|
|
240
316
|
relativePath: boundedString(1024).optional(),
|
|
241
|
-
line:
|
|
242
|
-
column:
|
|
243
|
-
origin:
|
|
244
|
-
confidence:
|
|
317
|
+
line: z2.number().int().positive().optional(),
|
|
318
|
+
column: z2.number().int().positive().optional(),
|
|
319
|
+
origin: z2.enum(["jsx-host", "react-fiber", "dom-ancestor", "none"]),
|
|
320
|
+
confidence: z2.enum(["exact", "probable", "approximate", "unknown"])
|
|
245
321
|
});
|
|
246
|
-
var matchedStyleRuleSchema =
|
|
322
|
+
var matchedStyleRuleSchema = z2.strictObject({
|
|
247
323
|
selector: boundedString(2048),
|
|
248
324
|
declarations: boundedString(8192),
|
|
249
325
|
source: boundedString(1024).optional(),
|
|
250
326
|
media: boundedString(1024).optional()
|
|
251
327
|
});
|
|
252
|
-
var codeContextSchema =
|
|
328
|
+
var codeContextSchema = z2.strictObject({
|
|
253
329
|
relativePath: boundedString(1024),
|
|
254
|
-
language:
|
|
255
|
-
startLine:
|
|
256
|
-
endLine:
|
|
330
|
+
language: z2.enum(["tsx", "jsx"]),
|
|
331
|
+
startLine: z2.number().int().positive(),
|
|
332
|
+
endLine: z2.number().int().positive(),
|
|
257
333
|
excerpt: boundedString(16e3),
|
|
258
|
-
boundary:
|
|
334
|
+
boundary: z2.enum(["component", "nearby-lines"])
|
|
259
335
|
});
|
|
260
|
-
var
|
|
261
|
-
|
|
336
|
+
var pageContextSchema = z2.strictObject({
|
|
337
|
+
url: boundedString(2048),
|
|
338
|
+
pathname: boundedString(2048),
|
|
339
|
+
title: boundedString(1024),
|
|
340
|
+
viewportWidth: z2.number().nonnegative(),
|
|
341
|
+
viewportHeight: z2.number().nonnegative(),
|
|
342
|
+
devicePixelRatio: z2.number().positive()
|
|
343
|
+
});
|
|
344
|
+
var spotTargetContextRequestSchema = z2.strictObject({
|
|
345
|
+
instruction: z2.string().trim().min(1).max(MAX_TARGET_INSTRUCTION_CHARACTERS),
|
|
346
|
+
page: pageContextSchema.optional(),
|
|
262
347
|
source: sourceRefSchema,
|
|
263
|
-
react:
|
|
264
|
-
supported:
|
|
348
|
+
react: z2.strictObject({
|
|
349
|
+
supported: z2.boolean(),
|
|
265
350
|
version: boundedString(64).optional(),
|
|
266
351
|
componentName: boundedString(256).optional(),
|
|
267
|
-
componentStack:
|
|
352
|
+
componentStack: z2.array(boundedString(256)).max(64),
|
|
268
353
|
source: sourceRefSchema.optional()
|
|
269
354
|
}),
|
|
270
|
-
element:
|
|
355
|
+
element: z2.strictObject({
|
|
271
356
|
tagName: boundedString(128),
|
|
272
357
|
selector: boundedString(2048),
|
|
273
358
|
sanitizedHtml: boundedString(8192),
|
|
274
359
|
textPreview: boundedString(2048).optional(),
|
|
275
360
|
role: boundedString(256).optional(),
|
|
276
|
-
rect:
|
|
277
|
-
x:
|
|
278
|
-
y:
|
|
279
|
-
width:
|
|
280
|
-
height:
|
|
361
|
+
rect: z2.strictObject({
|
|
362
|
+
x: z2.number(),
|
|
363
|
+
y: z2.number(),
|
|
364
|
+
width: z2.number().nonnegative(),
|
|
365
|
+
height: z2.number().nonnegative()
|
|
281
366
|
})
|
|
282
367
|
}),
|
|
283
|
-
styles:
|
|
284
|
-
classNames:
|
|
368
|
+
styles: z2.strictObject({
|
|
369
|
+
classNames: z2.array(boundedString(512)).max(256),
|
|
285
370
|
inlineStyle: boundedString(8192).optional(),
|
|
286
|
-
matchedRules:
|
|
287
|
-
computed:
|
|
288
|
-
warnings:
|
|
371
|
+
matchedRules: z2.array(matchedStyleRuleSchema).max(256),
|
|
372
|
+
computed: z2.record(boundedString(256), boundedString(2048)),
|
|
373
|
+
warnings: z2.array(boundedString(1024)).max(64)
|
|
289
374
|
}),
|
|
290
375
|
code: codeContextSchema.optional(),
|
|
291
|
-
warnings:
|
|
376
|
+
warnings: z2.array(boundedString(1024)).max(64)
|
|
292
377
|
});
|
|
293
|
-
var spotAnnotationRequestSchema =
|
|
294
|
-
schemaVersion:
|
|
378
|
+
var spotAnnotationRequestSchema = z2.strictObject({
|
|
379
|
+
schemaVersion: z2.literal(3),
|
|
295
380
|
id: boundedString(128),
|
|
296
|
-
locale:
|
|
297
|
-
page:
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
title: boundedString(1024),
|
|
301
|
-
viewportWidth: z.number().nonnegative(),
|
|
302
|
-
viewportHeight: z.number().nonnegative(),
|
|
303
|
-
devicePixelRatio: z.number().positive()
|
|
304
|
-
}),
|
|
305
|
-
targets: z.array(spotTargetContextRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS),
|
|
306
|
-
createdAt: z.iso.datetime()
|
|
381
|
+
locale: z2.enum(SPOTPATCH_LOCALES),
|
|
382
|
+
page: pageContextSchema,
|
|
383
|
+
targets: z2.array(spotTargetContextRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS),
|
|
384
|
+
createdAt: z2.iso.datetime()
|
|
307
385
|
}).superRefine((annotation, context) => {
|
|
308
386
|
const total = annotation.targets.reduce(
|
|
309
387
|
(characters, target) => characters + target.instruction.length,
|
|
@@ -317,51 +395,51 @@ var spotAnnotationRequestSchema = z.strictObject({
|
|
|
317
395
|
});
|
|
318
396
|
}
|
|
319
397
|
});
|
|
320
|
-
var agentCapabilityRequestSchema =
|
|
321
|
-
providerProfileId:
|
|
322
|
-
modelProfileId:
|
|
398
|
+
var agentCapabilityRequestSchema = z2.strictObject({
|
|
399
|
+
providerProfileId: profileIdSchema2,
|
|
400
|
+
modelProfileId: profileIdSchema2
|
|
323
401
|
});
|
|
324
|
-
var agentWorkspaceHealthRequestSchema =
|
|
325
|
-
var agentJobCreateRequestSchema =
|
|
402
|
+
var agentWorkspaceHealthRequestSchema = z2.strictObject({});
|
|
403
|
+
var agentJobCreateRequestSchema = z2.strictObject({
|
|
326
404
|
annotation: spotAnnotationRequestSchema,
|
|
327
|
-
providerProfileId:
|
|
328
|
-
modelProfileId:
|
|
329
|
-
providerDataConsent:
|
|
330
|
-
workingTreeMode:
|
|
405
|
+
providerProfileId: profileIdSchema2,
|
|
406
|
+
modelProfileId: profileIdSchema2,
|
|
407
|
+
providerDataConsent: z2.literal(true),
|
|
408
|
+
workingTreeMode: z2.enum(["require-clean", "include-local-changes"]).default("require-clean")
|
|
331
409
|
});
|
|
332
|
-
var agentJobActionRequestSchema =
|
|
410
|
+
var agentJobActionRequestSchema = z2.strictObject({});
|
|
333
411
|
|
|
334
412
|
// src/protocol/agent-schemas.ts
|
|
335
|
-
import { z as
|
|
336
|
-
var
|
|
337
|
-
var boundedString2 = (maximum) =>
|
|
338
|
-
var errorCodeSchema =
|
|
339
|
-
var agentCapabilitySnapshotSchema =
|
|
340
|
-
providerProfileId:
|
|
413
|
+
import { z as z3 } from "zod";
|
|
414
|
+
var profileIdSchema3 = z3.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
|
|
415
|
+
var boundedString2 = (maximum) => z3.string().max(maximum);
|
|
416
|
+
var errorCodeSchema = z3.enum(ERROR_CODES);
|
|
417
|
+
var agentCapabilitySnapshotSchema = z3.strictObject({
|
|
418
|
+
providerProfileId: profileIdSchema3,
|
|
341
419
|
providerLabel: boundedString2(100),
|
|
342
|
-
modelProfileId:
|
|
420
|
+
modelProfileId: profileIdSchema3,
|
|
343
421
|
modelLabel: boundedString2(100),
|
|
344
|
-
protocol:
|
|
345
|
-
state:
|
|
346
|
-
authenticated:
|
|
347
|
-
modelAvailable:
|
|
348
|
-
toolCalling:
|
|
349
|
-
toolResultContinuation:
|
|
350
|
-
streaming:
|
|
351
|
-
checkedAt:
|
|
422
|
+
protocol: z3.enum(["responses", "chat-completions"]),
|
|
423
|
+
state: z3.enum(AGENT_CAPABILITY_STATES),
|
|
424
|
+
authenticated: z3.boolean(),
|
|
425
|
+
modelAvailable: z3.boolean(),
|
|
426
|
+
toolCalling: z3.boolean(),
|
|
427
|
+
toolResultContinuation: z3.boolean(),
|
|
428
|
+
streaming: z3.boolean(),
|
|
429
|
+
checkedAt: z3.iso.datetime().optional(),
|
|
352
430
|
errorCode: errorCodeSchema.optional()
|
|
353
431
|
});
|
|
354
|
-
var agentWorkspaceHealthSnapshotSchema =
|
|
355
|
-
state:
|
|
356
|
-
checkedAt:
|
|
357
|
-
changes:
|
|
358
|
-
staged:
|
|
359
|
-
unstaged:
|
|
360
|
-
untracked:
|
|
361
|
-
conflicted:
|
|
362
|
-
total:
|
|
432
|
+
var agentWorkspaceHealthSnapshotSchema = z3.strictObject({
|
|
433
|
+
state: z3.enum(AGENT_WORKSPACE_STATES),
|
|
434
|
+
checkedAt: z3.iso.datetime(),
|
|
435
|
+
changes: z3.strictObject({
|
|
436
|
+
staged: z3.number().int().nonnegative(),
|
|
437
|
+
unstaged: z3.number().int().nonnegative(),
|
|
438
|
+
untracked: z3.number().int().nonnegative(),
|
|
439
|
+
conflicted: z3.number().int().nonnegative(),
|
|
440
|
+
total: z3.number().int().nonnegative()
|
|
363
441
|
}),
|
|
364
|
-
canIncludeLocalChanges:
|
|
442
|
+
canIncludeLocalChanges: z3.boolean(),
|
|
365
443
|
errorCode: errorCodeSchema.optional()
|
|
366
444
|
}).refine(
|
|
367
445
|
({ state, changes, canIncludeLocalChanges, errorCode }) => {
|
|
@@ -379,42 +457,42 @@ var agentWorkspaceHealthSnapshotSchema = z2.strictObject({
|
|
|
379
457
|
},
|
|
380
458
|
{ message: "Agent workspace health fields are inconsistent." }
|
|
381
459
|
);
|
|
382
|
-
var agentChangedFileSchema =
|
|
460
|
+
var agentChangedFileSchema = z3.strictObject({
|
|
383
461
|
relativePath: boundedString2(1024),
|
|
384
|
-
kind:
|
|
385
|
-
additions:
|
|
386
|
-
deletions:
|
|
462
|
+
kind: z3.enum(AGENT_FILE_CHANGE_KINDS),
|
|
463
|
+
additions: z3.number().int().nonnegative(),
|
|
464
|
+
deletions: z3.number().int().nonnegative()
|
|
387
465
|
});
|
|
388
|
-
var agentCheckResultSchema =
|
|
389
|
-
checkId:
|
|
466
|
+
var agentCheckResultSchema = z3.strictObject({
|
|
467
|
+
checkId: profileIdSchema3,
|
|
390
468
|
label: boundedString2(100),
|
|
391
|
-
status:
|
|
392
|
-
durationMs:
|
|
469
|
+
status: z3.enum(AGENT_CHECK_STATUSES),
|
|
470
|
+
durationMs: z3.number().int().nonnegative(),
|
|
393
471
|
output: boundedString2(8e4)
|
|
394
472
|
});
|
|
395
|
-
var agentJobSnapshotSchema =
|
|
396
|
-
jobId:
|
|
397
|
-
status:
|
|
398
|
-
providerProfileId:
|
|
473
|
+
var agentJobSnapshotSchema = z3.strictObject({
|
|
474
|
+
jobId: z3.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
|
|
475
|
+
status: z3.enum(AGENT_JOB_STATUSES),
|
|
476
|
+
providerProfileId: profileIdSchema3,
|
|
399
477
|
providerLabel: boundedString2(100),
|
|
400
|
-
modelProfileId:
|
|
478
|
+
modelProfileId: profileIdSchema3,
|
|
401
479
|
modelLabel: boundedString2(100),
|
|
402
480
|
phaseMessage: boundedString2(1024),
|
|
403
|
-
createdAt:
|
|
404
|
-
updatedAt:
|
|
405
|
-
canCancel:
|
|
406
|
-
canApply:
|
|
407
|
-
canRevert:
|
|
481
|
+
createdAt: z3.iso.datetime(),
|
|
482
|
+
updatedAt: z3.iso.datetime(),
|
|
483
|
+
canCancel: z3.boolean(),
|
|
484
|
+
canApply: z3.boolean(),
|
|
485
|
+
canRevert: z3.boolean(),
|
|
408
486
|
errorCode: errorCodeSchema.optional()
|
|
409
487
|
});
|
|
410
|
-
var agentJobResultSchema =
|
|
411
|
-
jobId:
|
|
488
|
+
var agentJobResultSchema = z3.strictObject({
|
|
489
|
+
jobId: z3.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
|
|
412
490
|
summary: boundedString2(8e4),
|
|
413
491
|
diff: boundedString2(1e6),
|
|
414
|
-
files:
|
|
415
|
-
checks:
|
|
492
|
+
files: z3.array(agentChangedFileSchema).max(100),
|
|
493
|
+
checks: z3.array(agentCheckResultSchema).max(100)
|
|
416
494
|
});
|
|
417
|
-
var agentJobResultResponseSchema =
|
|
495
|
+
var agentJobResultResponseSchema = z3.strictObject({
|
|
418
496
|
snapshot: agentJobSnapshotSchema,
|
|
419
497
|
result: agentJobResultSchema.optional()
|
|
420
498
|
}).superRefine((value, context) => {
|
|
@@ -426,44 +504,44 @@ var agentJobResultResponseSchema = z2.strictObject({
|
|
|
426
504
|
});
|
|
427
505
|
}
|
|
428
506
|
});
|
|
429
|
-
var agentJobEventBaseSchema =
|
|
430
|
-
schemaVersion:
|
|
431
|
-
sequence:
|
|
432
|
-
jobId:
|
|
433
|
-
status:
|
|
434
|
-
timestamp:
|
|
507
|
+
var agentJobEventBaseSchema = z3.strictObject({
|
|
508
|
+
schemaVersion: z3.literal(2),
|
|
509
|
+
sequence: z3.number().int().positive(),
|
|
510
|
+
jobId: z3.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
|
|
511
|
+
status: z3.enum(AGENT_JOB_STATUSES),
|
|
512
|
+
timestamp: z3.iso.datetime()
|
|
435
513
|
});
|
|
436
|
-
var agentJobEventSchema =
|
|
514
|
+
var agentJobEventSchema = z3.discriminatedUnion("type", [
|
|
437
515
|
agentJobEventBaseSchema.extend({
|
|
438
|
-
type:
|
|
439
|
-
data:
|
|
516
|
+
type: z3.literal("snapshot"),
|
|
517
|
+
data: z3.strictObject({ snapshot: agentJobSnapshotSchema })
|
|
440
518
|
}),
|
|
441
519
|
agentJobEventBaseSchema.extend({
|
|
442
|
-
type:
|
|
443
|
-
data:
|
|
520
|
+
type: z3.literal("phase"),
|
|
521
|
+
data: z3.strictObject({ message: boundedString2(1024) })
|
|
444
522
|
}),
|
|
445
523
|
agentJobEventBaseSchema.extend({
|
|
446
|
-
type:
|
|
447
|
-
data:
|
|
448
|
-
turn:
|
|
524
|
+
type: z3.literal("tool"),
|
|
525
|
+
data: z3.strictObject({
|
|
526
|
+
turn: z3.number().int().positive(),
|
|
449
527
|
toolCallId: boundedString2(256),
|
|
450
528
|
toolName: boundedString2(100),
|
|
451
|
-
state:
|
|
529
|
+
state: z3.enum(["started", "succeeded", "failed"]),
|
|
452
530
|
relativePath: boundedString2(1024).optional(),
|
|
453
531
|
checkLabel: boundedString2(100).optional()
|
|
454
532
|
})
|
|
455
533
|
}),
|
|
456
534
|
agentJobEventBaseSchema.extend({
|
|
457
|
-
type:
|
|
458
|
-
data:
|
|
535
|
+
type: z3.literal("check"),
|
|
536
|
+
data: z3.strictObject({ result: agentCheckResultSchema })
|
|
459
537
|
}),
|
|
460
538
|
agentJobEventBaseSchema.extend({
|
|
461
|
-
type:
|
|
462
|
-
data:
|
|
539
|
+
type: z3.literal("result-ready"),
|
|
540
|
+
data: z3.strictObject({ hasResult: z3.literal(true) })
|
|
463
541
|
}),
|
|
464
542
|
agentJobEventBaseSchema.extend({
|
|
465
|
-
type:
|
|
466
|
-
data:
|
|
543
|
+
type: z3.literal("error"),
|
|
544
|
+
data: z3.strictObject({
|
|
467
545
|
code: errorCodeSchema,
|
|
468
546
|
message: boundedString2(1024)
|
|
469
547
|
})
|
|
@@ -508,6 +586,8 @@ export {
|
|
|
508
586
|
SPOTPATCH_ENDPOINTS,
|
|
509
587
|
SPOTPATCH_LOCALES,
|
|
510
588
|
SPOTPATCH_LOCALE_PREFERENCES,
|
|
589
|
+
SPOTPATCH_NEXT_BUNDLERS,
|
|
590
|
+
SPOTPATCH_NEXT_ROUTER_KINDS,
|
|
511
591
|
SPOTPATCH_REPOSITORY_URL,
|
|
512
592
|
SPOTPATCH_TOKEN_HEADER,
|
|
513
593
|
SpotPatchError,
|
|
@@ -529,6 +609,8 @@ export {
|
|
|
529
609
|
openEditorRequestSchema,
|
|
530
610
|
parseSourceMarker,
|
|
531
611
|
redactSensitiveText,
|
|
612
|
+
runtimeBootstrapRequestSchema,
|
|
613
|
+
runtimeConfigSchema,
|
|
532
614
|
sanitizeUrl,
|
|
533
615
|
sourceContextRequestSchema,
|
|
534
616
|
spotAnnotationRequestSchema,
|