@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 CHANGED
@@ -1,11 +1,23 @@
1
- # @spotpatch/shared
1
+ <h1><a href="https://github.com/huanglvjing/spotpatch"><img src="https://raw.githubusercontent.com/huanglvjing/spotpatch/main/docs/assets/spotpatch-npm-icon.png" alt="SpotPatch" width="48" height="48" align="absmiddle" /></a> <code>@spotpatch/shared</code></h1>
2
2
 
3
- Immutable data models, bounded protocol schemas, constants, and error codes
4
- shared by the SpotPatch packages.
3
+ ## English
5
4
 
6
- Applications should install and configure
7
- [`@spotpatch/vite`](https://www.npmjs.com/package/@spotpatch/vite) instead of
8
- depending on this internal package directly.
5
+ The shared contract package for SpotPatch. It provides immutable data models, bounded protocol schemas, endpoint constants, error codes, runtime bootstrap types, Agent events, and AI configuration types used across Node and browser packages.
9
6
 
10
- See the [SpotPatch repository](https://github.com/huanglvjing/spotpatch) for the
11
- public API and protocol documentation.
7
+ Applications should install a framework adapter such as [`@spotpatch/vite`](https://www.npmjs.com/package/@spotpatch/vite) instead of depending on this package for UI integration. Changes to this package are versioned because they define compatibility between independently built SpotPatch packages.
8
+
9
+ Requires Node.js `>=20.19.0` when used in Node environments.
10
+
11
+ ## 简体中文
12
+
13
+ 这是 SpotPatch 的共享契约包,提供不可变数据模型、有界协议 Schema、端点常量、错误码、Runtime bootstrap 类型、Agent 事件和 AI 配置类型,供 Node 与浏览器包共同使用。
14
+
15
+ 业务应用应安装 [`@spotpatch/vite`](https://www.npmjs.com/package/@spotpatch/vite) 等框架适配器,而不是把本包当作 UI 接入。该包独立版本化,是因为它定义了不同 SpotPatch 构建产物之间的兼容契约。
16
+
17
+ 在 Node 环境中使用时要求 Node.js `>=20.19.0`。
18
+
19
+ ## Links / 链接
20
+
21
+ - [Repository / 仓库](https://github.com/huanglvjing/spotpatch)
22
+ - [Public models / 公共模型](https://github.com/huanglvjing/spotpatch/blob/main/docs/%E6%8A%80%E6%9C%AF%E6%96%B9%E6%A1%88/03-%E5%85%AC%E5%85%B1API%E4%B8%8E%E6%95%B0%E6%8D%AE%E6%A8%A1%E5%9E%8B.md)
23
+ - [MIT License / 许可证](https://github.com/huanglvjing/spotpatch/blob/main/LICENSE)
package/dist/index.cjs CHANGED
@@ -37,6 +37,8 @@ __export(index_exports, {
37
37
  SPOTPATCH_ENDPOINTS: () => SPOTPATCH_ENDPOINTS,
38
38
  SPOTPATCH_LOCALES: () => SPOTPATCH_LOCALES,
39
39
  SPOTPATCH_LOCALE_PREFERENCES: () => SPOTPATCH_LOCALE_PREFERENCES,
40
+ SPOTPATCH_NEXT_BUNDLERS: () => SPOTPATCH_NEXT_BUNDLERS,
41
+ SPOTPATCH_NEXT_ROUTER_KINDS: () => SPOTPATCH_NEXT_ROUTER_KINDS,
40
42
  SPOTPATCH_REPOSITORY_URL: () => SPOTPATCH_REPOSITORY_URL,
41
43
  SPOTPATCH_TOKEN_HEADER: () => SPOTPATCH_TOKEN_HEADER,
42
44
  SpotPatchError: () => SpotPatchError,
@@ -58,6 +60,8 @@ __export(index_exports, {
58
60
  openEditorRequestSchema: () => openEditorRequestSchema,
59
61
  parseSourceMarker: () => parseSourceMarker,
60
62
  redactSensitiveText: () => redactSensitiveText,
63
+ runtimeBootstrapRequestSchema: () => runtimeBootstrapRequestSchema,
64
+ runtimeConfigSchema: () => runtimeConfigSchema,
61
65
  sanitizeUrl: () => sanitizeUrl,
62
66
  sourceContextRequestSchema: () => sourceContextRequestSchema,
63
67
  spotAnnotationRequestSchema: () => spotAnnotationRequestSchema,
@@ -191,9 +195,98 @@ var SPOTPATCH_LOCALE_PREFERENCES = Object.freeze([
191
195
  ...SPOTPATCH_LOCALES
192
196
  ]);
193
197
 
198
+ // src/model/runtime-config.ts
199
+ var import_zod = require("zod");
200
+
201
+ // src/protocol/endpoints.ts
202
+ var SPOTPATCH_API_BASE = "/__spotpatch/v1";
203
+ var SPOTPATCH_TOKEN_HEADER = "X-SpotPatch-Token";
204
+ var SPOTPATCH_ENDPOINTS = Object.freeze({
205
+ bootstrap: `${SPOTPATCH_API_BASE}/bootstrap`,
206
+ sourceContext: `${SPOTPATCH_API_BASE}/source-context`,
207
+ openEditor: `${SPOTPATCH_API_BASE}/open-editor`,
208
+ agentCapability: `${SPOTPATCH_API_BASE}/agent/capability`,
209
+ agentWorkspaceHealth: `${SPOTPATCH_API_BASE}/agent/workspace-health`,
210
+ agentJobs: `${SPOTPATCH_API_BASE}/agent/jobs`
211
+ });
212
+ function getAgentJobEndpoint(jobId, action) {
213
+ return `${SPOTPATCH_ENDPOINTS.agentJobs}/${encodeURIComponent(jobId)}/${action}`;
214
+ }
215
+
194
216
  // src/model/editor.ts
195
217
  var SPOTPATCH_EDITOR_PREFERENCES = ["auto", "vscode", "cursor"];
196
218
 
219
+ // src/model/runtime-config.ts
220
+ var SPOTPATCH_NEXT_BUNDLERS = Object.freeze(["turbopack", "webpack"]);
221
+ var SPOTPATCH_NEXT_ROUTER_KINDS = Object.freeze([
222
+ "app",
223
+ "pages",
224
+ "hybrid"
225
+ ]);
226
+ var boundedText = (maximum) => import_zod.z.string().trim().min(1).max(maximum);
227
+ var profileIdSchema = import_zod.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/u);
228
+ var runtimeAiModelSchema = import_zod.z.strictObject({
229
+ id: profileIdSchema,
230
+ label: boundedText(100)
231
+ });
232
+ var runtimeAiProviderSchema = import_zod.z.strictObject({
233
+ id: profileIdSchema,
234
+ label: boundedText(100),
235
+ protocol: import_zod.z.enum(["responses", "chat-completions"]),
236
+ models: import_zod.z.array(runtimeAiModelSchema).min(1).max(64),
237
+ defaultModel: profileIdSchema
238
+ }).refine(
239
+ ({ defaultModel, models }) => models.some(({ id }) => id === defaultModel) && new Set(models.map(({ id }) => id)).size === models.length,
240
+ { message: "Runtime AI model profiles are inconsistent." }
241
+ );
242
+ var runtimeAiConfigSchema = import_zod.z.discriminatedUnion("enabled", [
243
+ import_zod.z.strictObject({ enabled: import_zod.z.literal(false) }),
244
+ import_zod.z.strictObject({
245
+ enabled: import_zod.z.literal(true),
246
+ providers: import_zod.z.array(runtimeAiProviderSchema).min(1).max(32),
247
+ defaultProvider: profileIdSchema,
248
+ applyMode: import_zod.z.enum(["review", "auto"])
249
+ }).refine(
250
+ ({ defaultProvider, providers }) => providers.some(({ id }) => id === defaultProvider) && new Set(providers.map(({ id }) => id)).size === providers.length,
251
+ { message: "Runtime AI provider profiles are inconsistent." }
252
+ )
253
+ ]);
254
+ var positiveInteger = import_zod.z.number().int().positive();
255
+ var runtimeConfigBaseShape = {
256
+ apiBase: import_zod.z.literal(SPOTPATCH_API_BASE),
257
+ ai: runtimeAiConfigSchema,
258
+ budget: import_zod.z.strictObject({
259
+ totalCharacters: positiveInteger,
260
+ domCharacters: positiveInteger,
261
+ cssCharacters: positiveInteger,
262
+ codeCharacters: positiveInteger,
263
+ maxCodeLines: positiveInteger,
264
+ maxComponentDepth: positiveInteger
265
+ }),
266
+ debug: import_zod.z.boolean(),
267
+ editor: import_zod.z.enum(SPOTPATCH_EDITOR_PREFERENCES),
268
+ frameworkVersion: boundedText(64),
269
+ locale: import_zod.z.enum(SPOTPATCH_LOCALE_PREFERENCES),
270
+ maxTargets: import_zod.z.number().int().min(1).max(MAX_ANNOTATION_TARGETS),
271
+ redact: import_zod.z.boolean(),
272
+ sessionId: import_zod.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
273
+ sessionToken: import_zod.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/u),
274
+ shortcut: boundedText(128),
275
+ spotPatchVersion: boundedText(64)
276
+ };
277
+ var runtimeConfigSchema = import_zod.z.discriminatedUnion("framework", [
278
+ import_zod.z.strictObject({
279
+ ...runtimeConfigBaseShape,
280
+ framework: import_zod.z.literal("vite")
281
+ }),
282
+ import_zod.z.strictObject({
283
+ ...runtimeConfigBaseShape,
284
+ bundler: import_zod.z.enum(SPOTPATCH_NEXT_BUNDLERS),
285
+ framework: import_zod.z.literal("next"),
286
+ routerKind: import_zod.z.enum(SPOTPATCH_NEXT_ROUTER_KINDS)
287
+ })
288
+ ]);
289
+
197
290
  // src/model/agent.ts
198
291
  var DEFAULT_AGENT_LIMITS = Object.freeze({
199
292
  maxTurns: 20,
@@ -275,102 +368,91 @@ function parseSourceMarker(value) {
275
368
  return Object.freeze({ fileId, line, column });
276
369
  }
277
370
 
278
- // src/protocol/endpoints.ts
279
- var SPOTPATCH_API_BASE = "/__spotpatch/v1";
280
- var SPOTPATCH_TOKEN_HEADER = "X-SpotPatch-Token";
281
- var SPOTPATCH_ENDPOINTS = Object.freeze({
282
- sourceContext: `${SPOTPATCH_API_BASE}/source-context`,
283
- openEditor: `${SPOTPATCH_API_BASE}/open-editor`,
284
- agentCapability: `${SPOTPATCH_API_BASE}/agent/capability`,
285
- agentWorkspaceHealth: `${SPOTPATCH_API_BASE}/agent/workspace-health`,
286
- agentJobs: `${SPOTPATCH_API_BASE}/agent/jobs`
287
- });
288
- function getAgentJobEndpoint(jobId, action) {
289
- return `${SPOTPATCH_ENDPOINTS.agentJobs}/${encodeURIComponent(jobId)}/${action}`;
290
- }
291
-
292
371
  // src/protocol/requests.ts
293
- var import_zod = require("zod");
294
- var sourceCoordinatesSchema = import_zod.z.strictObject({
295
- fileId: import_zod.z.string().min(1).max(128),
296
- line: import_zod.z.number().int().positive(),
297
- column: import_zod.z.number().int().positive()
372
+ var import_zod2 = require("zod");
373
+ var runtimeBootstrapRequestSchema = import_zod2.z.strictObject({});
374
+ var sourceCoordinatesSchema = import_zod2.z.strictObject({
375
+ fileId: import_zod2.z.string().min(1).max(128),
376
+ line: import_zod2.z.number().int().positive(),
377
+ column: import_zod2.z.number().int().positive()
298
378
  });
299
379
  var sourceContextRequestSchema = sourceCoordinatesSchema.extend({
300
- maxLines: import_zod.z.number().int().positive()
380
+ maxLines: import_zod2.z.number().int().positive()
301
381
  }).strict();
302
382
  var openEditorRequestSchema = sourceCoordinatesSchema.strict();
303
- var profileIdSchema = import_zod.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
304
- var boundedString = (maximum) => import_zod.z.string().max(maximum);
305
- var sourceRefSchema = import_zod.z.strictObject({
383
+ var profileIdSchema2 = import_zod2.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
384
+ var boundedString = (maximum) => import_zod2.z.string().max(maximum);
385
+ var sourceRefSchema = import_zod2.z.strictObject({
306
386
  fileId: boundedString(128).optional(),
307
387
  relativePath: boundedString(1024).optional(),
308
- line: import_zod.z.number().int().positive().optional(),
309
- column: import_zod.z.number().int().positive().optional(),
310
- origin: import_zod.z.enum(["jsx-host", "react-fiber", "dom-ancestor", "none"]),
311
- confidence: import_zod.z.enum(["exact", "probable", "approximate", "unknown"])
388
+ line: import_zod2.z.number().int().positive().optional(),
389
+ column: import_zod2.z.number().int().positive().optional(),
390
+ origin: import_zod2.z.enum(["jsx-host", "react-fiber", "dom-ancestor", "none"]),
391
+ confidence: import_zod2.z.enum(["exact", "probable", "approximate", "unknown"])
312
392
  });
313
- var matchedStyleRuleSchema = import_zod.z.strictObject({
393
+ var matchedStyleRuleSchema = import_zod2.z.strictObject({
314
394
  selector: boundedString(2048),
315
395
  declarations: boundedString(8192),
316
396
  source: boundedString(1024).optional(),
317
397
  media: boundedString(1024).optional()
318
398
  });
319
- var codeContextSchema = import_zod.z.strictObject({
399
+ var codeContextSchema = import_zod2.z.strictObject({
320
400
  relativePath: boundedString(1024),
321
- language: import_zod.z.enum(["tsx", "jsx"]),
322
- startLine: import_zod.z.number().int().positive(),
323
- endLine: import_zod.z.number().int().positive(),
401
+ language: import_zod2.z.enum(["tsx", "jsx"]),
402
+ startLine: import_zod2.z.number().int().positive(),
403
+ endLine: import_zod2.z.number().int().positive(),
324
404
  excerpt: boundedString(16e3),
325
- boundary: import_zod.z.enum(["component", "nearby-lines"])
405
+ boundary: import_zod2.z.enum(["component", "nearby-lines"])
326
406
  });
327
- var spotTargetContextRequestSchema = import_zod.z.strictObject({
328
- instruction: import_zod.z.string().trim().min(1).max(MAX_TARGET_INSTRUCTION_CHARACTERS),
407
+ var pageContextSchema = import_zod2.z.strictObject({
408
+ url: boundedString(2048),
409
+ pathname: boundedString(2048),
410
+ title: boundedString(1024),
411
+ viewportWidth: import_zod2.z.number().nonnegative(),
412
+ viewportHeight: import_zod2.z.number().nonnegative(),
413
+ devicePixelRatio: import_zod2.z.number().positive()
414
+ });
415
+ var spotTargetContextRequestSchema = import_zod2.z.strictObject({
416
+ instruction: import_zod2.z.string().trim().min(1).max(MAX_TARGET_INSTRUCTION_CHARACTERS),
417
+ page: pageContextSchema.optional(),
329
418
  source: sourceRefSchema,
330
- react: import_zod.z.strictObject({
331
- supported: import_zod.z.boolean(),
419
+ react: import_zod2.z.strictObject({
420
+ supported: import_zod2.z.boolean(),
332
421
  version: boundedString(64).optional(),
333
422
  componentName: boundedString(256).optional(),
334
- componentStack: import_zod.z.array(boundedString(256)).max(64),
423
+ componentStack: import_zod2.z.array(boundedString(256)).max(64),
335
424
  source: sourceRefSchema.optional()
336
425
  }),
337
- element: import_zod.z.strictObject({
426
+ element: import_zod2.z.strictObject({
338
427
  tagName: boundedString(128),
339
428
  selector: boundedString(2048),
340
429
  sanitizedHtml: boundedString(8192),
341
430
  textPreview: boundedString(2048).optional(),
342
431
  role: boundedString(256).optional(),
343
- rect: import_zod.z.strictObject({
344
- x: import_zod.z.number(),
345
- y: import_zod.z.number(),
346
- width: import_zod.z.number().nonnegative(),
347
- height: import_zod.z.number().nonnegative()
432
+ rect: import_zod2.z.strictObject({
433
+ x: import_zod2.z.number(),
434
+ y: import_zod2.z.number(),
435
+ width: import_zod2.z.number().nonnegative(),
436
+ height: import_zod2.z.number().nonnegative()
348
437
  })
349
438
  }),
350
- styles: import_zod.z.strictObject({
351
- classNames: import_zod.z.array(boundedString(512)).max(256),
439
+ styles: import_zod2.z.strictObject({
440
+ classNames: import_zod2.z.array(boundedString(512)).max(256),
352
441
  inlineStyle: boundedString(8192).optional(),
353
- matchedRules: import_zod.z.array(matchedStyleRuleSchema).max(256),
354
- computed: import_zod.z.record(boundedString(256), boundedString(2048)),
355
- warnings: import_zod.z.array(boundedString(1024)).max(64)
442
+ matchedRules: import_zod2.z.array(matchedStyleRuleSchema).max(256),
443
+ computed: import_zod2.z.record(boundedString(256), boundedString(2048)),
444
+ warnings: import_zod2.z.array(boundedString(1024)).max(64)
356
445
  }),
357
446
  code: codeContextSchema.optional(),
358
- warnings: import_zod.z.array(boundedString(1024)).max(64)
447
+ warnings: import_zod2.z.array(boundedString(1024)).max(64)
359
448
  });
360
- var spotAnnotationRequestSchema = import_zod.z.strictObject({
361
- schemaVersion: import_zod.z.literal(3),
449
+ var spotAnnotationRequestSchema = import_zod2.z.strictObject({
450
+ schemaVersion: import_zod2.z.literal(3),
362
451
  id: boundedString(128),
363
- locale: import_zod.z.enum(SPOTPATCH_LOCALES),
364
- page: import_zod.z.strictObject({
365
- url: boundedString(2048),
366
- pathname: boundedString(2048),
367
- title: boundedString(1024),
368
- viewportWidth: import_zod.z.number().nonnegative(),
369
- viewportHeight: import_zod.z.number().nonnegative(),
370
- devicePixelRatio: import_zod.z.number().positive()
371
- }),
372
- targets: import_zod.z.array(spotTargetContextRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS),
373
- createdAt: import_zod.z.iso.datetime()
452
+ locale: import_zod2.z.enum(SPOTPATCH_LOCALES),
453
+ page: pageContextSchema,
454
+ targets: import_zod2.z.array(spotTargetContextRequestSchema).min(1).max(MAX_ANNOTATION_TARGETS),
455
+ createdAt: import_zod2.z.iso.datetime()
374
456
  }).superRefine((annotation, context) => {
375
457
  const total = annotation.targets.reduce(
376
458
  (characters, target) => characters + target.instruction.length,
@@ -384,51 +466,51 @@ var spotAnnotationRequestSchema = import_zod.z.strictObject({
384
466
  });
385
467
  }
386
468
  });
387
- var agentCapabilityRequestSchema = import_zod.z.strictObject({
388
- providerProfileId: profileIdSchema,
389
- modelProfileId: profileIdSchema
469
+ var agentCapabilityRequestSchema = import_zod2.z.strictObject({
470
+ providerProfileId: profileIdSchema2,
471
+ modelProfileId: profileIdSchema2
390
472
  });
391
- var agentWorkspaceHealthRequestSchema = import_zod.z.strictObject({});
392
- var agentJobCreateRequestSchema = import_zod.z.strictObject({
473
+ var agentWorkspaceHealthRequestSchema = import_zod2.z.strictObject({});
474
+ var agentJobCreateRequestSchema = import_zod2.z.strictObject({
393
475
  annotation: spotAnnotationRequestSchema,
394
- providerProfileId: profileIdSchema,
395
- modelProfileId: profileIdSchema,
396
- providerDataConsent: import_zod.z.literal(true),
397
- workingTreeMode: import_zod.z.enum(["require-clean", "include-local-changes"]).default("require-clean")
476
+ providerProfileId: profileIdSchema2,
477
+ modelProfileId: profileIdSchema2,
478
+ providerDataConsent: import_zod2.z.literal(true),
479
+ workingTreeMode: import_zod2.z.enum(["require-clean", "include-local-changes"]).default("require-clean")
398
480
  });
399
- var agentJobActionRequestSchema = import_zod.z.strictObject({});
481
+ var agentJobActionRequestSchema = import_zod2.z.strictObject({});
400
482
 
401
483
  // src/protocol/agent-schemas.ts
402
- var import_zod2 = require("zod");
403
- var profileIdSchema2 = import_zod2.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
404
- var boundedString2 = (maximum) => import_zod2.z.string().max(maximum);
405
- var errorCodeSchema = import_zod2.z.enum(ERROR_CODES);
406
- var agentCapabilitySnapshotSchema = import_zod2.z.strictObject({
407
- providerProfileId: profileIdSchema2,
484
+ var import_zod3 = require("zod");
485
+ var profileIdSchema3 = import_zod3.z.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
486
+ var boundedString2 = (maximum) => import_zod3.z.string().max(maximum);
487
+ var errorCodeSchema = import_zod3.z.enum(ERROR_CODES);
488
+ var agentCapabilitySnapshotSchema = import_zod3.z.strictObject({
489
+ providerProfileId: profileIdSchema3,
408
490
  providerLabel: boundedString2(100),
409
- modelProfileId: profileIdSchema2,
491
+ modelProfileId: profileIdSchema3,
410
492
  modelLabel: boundedString2(100),
411
- protocol: import_zod2.z.enum(["responses", "chat-completions"]),
412
- state: import_zod2.z.enum(AGENT_CAPABILITY_STATES),
413
- authenticated: import_zod2.z.boolean(),
414
- modelAvailable: import_zod2.z.boolean(),
415
- toolCalling: import_zod2.z.boolean(),
416
- toolResultContinuation: import_zod2.z.boolean(),
417
- streaming: import_zod2.z.boolean(),
418
- checkedAt: import_zod2.z.iso.datetime().optional(),
493
+ protocol: import_zod3.z.enum(["responses", "chat-completions"]),
494
+ state: import_zod3.z.enum(AGENT_CAPABILITY_STATES),
495
+ authenticated: import_zod3.z.boolean(),
496
+ modelAvailable: import_zod3.z.boolean(),
497
+ toolCalling: import_zod3.z.boolean(),
498
+ toolResultContinuation: import_zod3.z.boolean(),
499
+ streaming: import_zod3.z.boolean(),
500
+ checkedAt: import_zod3.z.iso.datetime().optional(),
419
501
  errorCode: errorCodeSchema.optional()
420
502
  });
421
- var agentWorkspaceHealthSnapshotSchema = import_zod2.z.strictObject({
422
- state: import_zod2.z.enum(AGENT_WORKSPACE_STATES),
423
- checkedAt: import_zod2.z.iso.datetime(),
424
- changes: import_zod2.z.strictObject({
425
- staged: import_zod2.z.number().int().nonnegative(),
426
- unstaged: import_zod2.z.number().int().nonnegative(),
427
- untracked: import_zod2.z.number().int().nonnegative(),
428
- conflicted: import_zod2.z.number().int().nonnegative(),
429
- total: import_zod2.z.number().int().nonnegative()
503
+ var agentWorkspaceHealthSnapshotSchema = import_zod3.z.strictObject({
504
+ state: import_zod3.z.enum(AGENT_WORKSPACE_STATES),
505
+ checkedAt: import_zod3.z.iso.datetime(),
506
+ changes: import_zod3.z.strictObject({
507
+ staged: import_zod3.z.number().int().nonnegative(),
508
+ unstaged: import_zod3.z.number().int().nonnegative(),
509
+ untracked: import_zod3.z.number().int().nonnegative(),
510
+ conflicted: import_zod3.z.number().int().nonnegative(),
511
+ total: import_zod3.z.number().int().nonnegative()
430
512
  }),
431
- canIncludeLocalChanges: import_zod2.z.boolean(),
513
+ canIncludeLocalChanges: import_zod3.z.boolean(),
432
514
  errorCode: errorCodeSchema.optional()
433
515
  }).refine(
434
516
  ({ state, changes, canIncludeLocalChanges, errorCode }) => {
@@ -446,42 +528,42 @@ var agentWorkspaceHealthSnapshotSchema = import_zod2.z.strictObject({
446
528
  },
447
529
  { message: "Agent workspace health fields are inconsistent." }
448
530
  );
449
- var agentChangedFileSchema = import_zod2.z.strictObject({
531
+ var agentChangedFileSchema = import_zod3.z.strictObject({
450
532
  relativePath: boundedString2(1024),
451
- kind: import_zod2.z.enum(AGENT_FILE_CHANGE_KINDS),
452
- additions: import_zod2.z.number().int().nonnegative(),
453
- deletions: import_zod2.z.number().int().nonnegative()
533
+ kind: import_zod3.z.enum(AGENT_FILE_CHANGE_KINDS),
534
+ additions: import_zod3.z.number().int().nonnegative(),
535
+ deletions: import_zod3.z.number().int().nonnegative()
454
536
  });
455
- var agentCheckResultSchema = import_zod2.z.strictObject({
456
- checkId: profileIdSchema2,
537
+ var agentCheckResultSchema = import_zod3.z.strictObject({
538
+ checkId: profileIdSchema3,
457
539
  label: boundedString2(100),
458
- status: import_zod2.z.enum(AGENT_CHECK_STATUSES),
459
- durationMs: import_zod2.z.number().int().nonnegative(),
540
+ status: import_zod3.z.enum(AGENT_CHECK_STATUSES),
541
+ durationMs: import_zod3.z.number().int().nonnegative(),
460
542
  output: boundedString2(8e4)
461
543
  });
462
- var agentJobSnapshotSchema = import_zod2.z.strictObject({
463
- jobId: import_zod2.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
464
- status: import_zod2.z.enum(AGENT_JOB_STATUSES),
465
- providerProfileId: profileIdSchema2,
544
+ var agentJobSnapshotSchema = import_zod3.z.strictObject({
545
+ jobId: import_zod3.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
546
+ status: import_zod3.z.enum(AGENT_JOB_STATUSES),
547
+ providerProfileId: profileIdSchema3,
466
548
  providerLabel: boundedString2(100),
467
- modelProfileId: profileIdSchema2,
549
+ modelProfileId: profileIdSchema3,
468
550
  modelLabel: boundedString2(100),
469
551
  phaseMessage: boundedString2(1024),
470
- createdAt: import_zod2.z.iso.datetime(),
471
- updatedAt: import_zod2.z.iso.datetime(),
472
- canCancel: import_zod2.z.boolean(),
473
- canApply: import_zod2.z.boolean(),
474
- canRevert: import_zod2.z.boolean(),
552
+ createdAt: import_zod3.z.iso.datetime(),
553
+ updatedAt: import_zod3.z.iso.datetime(),
554
+ canCancel: import_zod3.z.boolean(),
555
+ canApply: import_zod3.z.boolean(),
556
+ canRevert: import_zod3.z.boolean(),
475
557
  errorCode: errorCodeSchema.optional()
476
558
  });
477
- var agentJobResultSchema = import_zod2.z.strictObject({
478
- jobId: import_zod2.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
559
+ var agentJobResultSchema = import_zod3.z.strictObject({
560
+ jobId: import_zod3.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
479
561
  summary: boundedString2(8e4),
480
562
  diff: boundedString2(1e6),
481
- files: import_zod2.z.array(agentChangedFileSchema).max(100),
482
- checks: import_zod2.z.array(agentCheckResultSchema).max(100)
563
+ files: import_zod3.z.array(agentChangedFileSchema).max(100),
564
+ checks: import_zod3.z.array(agentCheckResultSchema).max(100)
483
565
  });
484
- var agentJobResultResponseSchema = import_zod2.z.strictObject({
566
+ var agentJobResultResponseSchema = import_zod3.z.strictObject({
485
567
  snapshot: agentJobSnapshotSchema,
486
568
  result: agentJobResultSchema.optional()
487
569
  }).superRefine((value, context) => {
@@ -493,44 +575,44 @@ var agentJobResultResponseSchema = import_zod2.z.strictObject({
493
575
  });
494
576
  }
495
577
  });
496
- var agentJobEventBaseSchema = import_zod2.z.strictObject({
497
- schemaVersion: import_zod2.z.literal(2),
498
- sequence: import_zod2.z.number().int().positive(),
499
- jobId: import_zod2.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
500
- status: import_zod2.z.enum(AGENT_JOB_STATUSES),
501
- timestamp: import_zod2.z.iso.datetime()
578
+ var agentJobEventBaseSchema = import_zod3.z.strictObject({
579
+ schemaVersion: import_zod3.z.literal(2),
580
+ sequence: import_zod3.z.number().int().positive(),
581
+ jobId: import_zod3.z.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/),
582
+ status: import_zod3.z.enum(AGENT_JOB_STATUSES),
583
+ timestamp: import_zod3.z.iso.datetime()
502
584
  });
503
- var agentJobEventSchema = import_zod2.z.discriminatedUnion("type", [
585
+ var agentJobEventSchema = import_zod3.z.discriminatedUnion("type", [
504
586
  agentJobEventBaseSchema.extend({
505
- type: import_zod2.z.literal("snapshot"),
506
- data: import_zod2.z.strictObject({ snapshot: agentJobSnapshotSchema })
587
+ type: import_zod3.z.literal("snapshot"),
588
+ data: import_zod3.z.strictObject({ snapshot: agentJobSnapshotSchema })
507
589
  }),
508
590
  agentJobEventBaseSchema.extend({
509
- type: import_zod2.z.literal("phase"),
510
- data: import_zod2.z.strictObject({ message: boundedString2(1024) })
591
+ type: import_zod3.z.literal("phase"),
592
+ data: import_zod3.z.strictObject({ message: boundedString2(1024) })
511
593
  }),
512
594
  agentJobEventBaseSchema.extend({
513
- type: import_zod2.z.literal("tool"),
514
- data: import_zod2.z.strictObject({
515
- turn: import_zod2.z.number().int().positive(),
595
+ type: import_zod3.z.literal("tool"),
596
+ data: import_zod3.z.strictObject({
597
+ turn: import_zod3.z.number().int().positive(),
516
598
  toolCallId: boundedString2(256),
517
599
  toolName: boundedString2(100),
518
- state: import_zod2.z.enum(["started", "succeeded", "failed"]),
600
+ state: import_zod3.z.enum(["started", "succeeded", "failed"]),
519
601
  relativePath: boundedString2(1024).optional(),
520
602
  checkLabel: boundedString2(100).optional()
521
603
  })
522
604
  }),
523
605
  agentJobEventBaseSchema.extend({
524
- type: import_zod2.z.literal("check"),
525
- data: import_zod2.z.strictObject({ result: agentCheckResultSchema })
606
+ type: import_zod3.z.literal("check"),
607
+ data: import_zod3.z.strictObject({ result: agentCheckResultSchema })
526
608
  }),
527
609
  agentJobEventBaseSchema.extend({
528
- type: import_zod2.z.literal("result-ready"),
529
- data: import_zod2.z.strictObject({ hasResult: import_zod2.z.literal(true) })
610
+ type: import_zod3.z.literal("result-ready"),
611
+ data: import_zod3.z.strictObject({ hasResult: import_zod3.z.literal(true) })
530
612
  }),
531
613
  agentJobEventBaseSchema.extend({
532
- type: import_zod2.z.literal("error"),
533
- data: import_zod2.z.strictObject({
614
+ type: import_zod3.z.literal("error"),
615
+ data: import_zod3.z.strictObject({
534
616
  code: errorCodeSchema,
535
617
  message: boundedString2(1024)
536
618
  })
@@ -576,6 +658,8 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
576
658
  SPOTPATCH_ENDPOINTS,
577
659
  SPOTPATCH_LOCALES,
578
660
  SPOTPATCH_LOCALE_PREFERENCES,
661
+ SPOTPATCH_NEXT_BUNDLERS,
662
+ SPOTPATCH_NEXT_ROUTER_KINDS,
579
663
  SPOTPATCH_REPOSITORY_URL,
580
664
  SPOTPATCH_TOKEN_HEADER,
581
665
  SpotPatchError,
@@ -597,6 +681,8 @@ var SPOTPATCH_REPOSITORY_URL = "https://github.com/huanglvjing/spotpatch";
597
681
  openEditorRequestSchema,
598
682
  parseSourceMarker,
599
683
  redactSensitiveText,
684
+ runtimeBootstrapRequestSchema,
685
+ runtimeConfigSchema,
600
686
  sanitizeUrl,
601
687
  sourceContextRequestSchema,
602
688
  spotAnnotationRequestSchema,