@sixb/server 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/auth/experience.d.ts +5 -1
  2. package/dist/auth/experience.d.ts.map +1 -1
  3. package/dist/files/content.d.ts +0 -1
  4. package/dist/files/content.d.ts.map +1 -1
  5. package/dist/index.js +204 -136
  6. package/dist/index.js.map +24 -24
  7. package/dist/routes/agents.d.ts +48 -28
  8. package/dist/routes/agents.d.ts.map +1 -1
  9. package/dist/routes/auth.d.ts +3 -2
  10. package/dist/routes/auth.d.ts.map +1 -1
  11. package/dist/routes/datasets.d.ts +4 -1
  12. package/dist/routes/datasets.d.ts.map +1 -1
  13. package/dist/routes/files.d.ts.map +1 -1
  14. package/dist/routes/models.d.ts +1 -0
  15. package/dist/routes/models.d.ts.map +1 -1
  16. package/dist/routes/objects.d.ts +21 -4
  17. package/dist/routes/objects.d.ts.map +1 -1
  18. package/dist/routes/project.d.ts +2 -0
  19. package/dist/routes/project.d.ts.map +1 -1
  20. package/dist/routes/workflows.d.ts +3 -0
  21. package/dist/routes/workflows.d.ts.map +1 -1
  22. package/dist/routes/ws/events.d.ts.map +1 -1
  23. package/dist/routes/ws/subscription-hub.d.ts +5 -0
  24. package/dist/routes/ws/subscription-hub.d.ts.map +1 -1
  25. package/dist/schemas/agents.d.ts +222 -123
  26. package/dist/schemas/agents.d.ts.map +1 -1
  27. package/dist/schemas/ai-accounting.d.ts +10 -10
  28. package/dist/schemas/auth.d.ts +7 -0
  29. package/dist/schemas/auth.d.ts.map +1 -1
  30. package/dist/schemas/common.d.ts +8 -0
  31. package/dist/schemas/common.d.ts.map +1 -1
  32. package/dist/schemas/datasets.d.ts +18 -3
  33. package/dist/schemas/datasets.d.ts.map +1 -1
  34. package/dist/schemas/event-payloads.d.ts +39 -0
  35. package/dist/schemas/event-payloads.d.ts.map +1 -1
  36. package/dist/schemas/files.d.ts +1 -1
  37. package/dist/schemas/files.d.ts.map +1 -1
  38. package/dist/schemas/models.d.ts +10 -0
  39. package/dist/schemas/models.d.ts.map +1 -1
  40. package/dist/schemas/objects.d.ts +32 -0
  41. package/dist/schemas/objects.d.ts.map +1 -1
  42. package/dist/schemas/project.d.ts +8 -0
  43. package/dist/schemas/project.d.ts.map +1 -1
  44. package/dist/schemas/workflows.d.ts +17 -0
  45. package/dist/schemas/workflows.d.ts.map +1 -1
  46. package/dist/server.d.ts.map +1 -1
  47. package/package.json +6 -5
  48. package/src/auth/experience.ts +20 -2
  49. package/src/files/content.ts +43 -88
  50. package/src/routes/agents.ts +29 -9
  51. package/src/routes/auth.ts +84 -19
  52. package/src/routes/datasets.ts +12 -43
  53. package/src/routes/files.ts +3 -1
  54. package/src/routes/models.ts +3 -0
  55. package/src/routes/objects.ts +12 -2
  56. package/src/routes/project.ts +2 -1
  57. package/src/routes/workflows.ts +5 -0
  58. package/src/routes/ws/events.ts +5 -3
  59. package/src/routes/ws/subscription-hub.ts +20 -5
  60. package/src/schemas/agents.ts +28 -3
  61. package/src/schemas/auth.ts +5 -0
  62. package/src/schemas/common.ts +3 -0
  63. package/src/schemas/datasets.ts +23 -1
  64. package/src/schemas/event-payloads.ts +3 -1
  65. package/src/schemas/files.ts +7 -1
  66. package/src/schemas/models.ts +2 -0
  67. package/src/schemas/objects.ts +13 -0
  68. package/src/schemas/project.ts +4 -0
  69. package/src/server.ts +2 -1
@@ -421,6 +421,12 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
421
421
  type: "text";
422
422
  text: string;
423
423
  providerMetadata?: import("./common").JsonValue | undefined;
424
+ }>, z.ZodObject<{
425
+ type: z.ZodLiteral<"continuation">;
426
+ }, "strip", z.ZodTypeAny, {
427
+ type: "continuation";
428
+ }, {
429
+ type: "continuation";
424
430
  }>, z.ZodObject<{
425
431
  type: z.ZodLiteral<"reasoning">;
426
432
  text: z.ZodString;
@@ -511,18 +517,21 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
511
517
  objectTypeId: string;
512
518
  primaryId: string;
513
519
  }>;
520
+ label: z.ZodOptional<z.ZodString>;
514
521
  }, "strip", z.ZodTypeAny, {
515
522
  kind: "object";
516
523
  ref: {
517
524
  objectTypeId: string;
518
525
  primaryId: string;
519
526
  };
527
+ label?: string | undefined;
520
528
  }, {
521
529
  kind: "object";
522
530
  ref: {
523
531
  objectTypeId: string;
524
532
  primaryId: string;
525
533
  };
534
+ label?: string | undefined;
526
535
  }>, z.ZodObject<{
527
536
  kind: z.ZodLiteral<"app-state">;
528
537
  id: z.ZodString;
@@ -553,6 +562,7 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
553
562
  objectTypeId: string;
554
563
  primaryId: string;
555
564
  };
565
+ label?: string | undefined;
556
566
  } | {
557
567
  id: string;
558
568
  kind: "app-state";
@@ -569,6 +579,7 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
569
579
  objectTypeId: string;
570
580
  primaryId: string;
571
581
  };
582
+ label?: string | undefined;
572
583
  } | {
573
584
  id: string;
574
585
  kind: "app-state";
@@ -685,6 +696,7 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
685
696
  objectTypeId: string;
686
697
  primaryId: string;
687
698
  };
699
+ label?: string | undefined;
688
700
  } | {
689
701
  id: string;
690
702
  kind: "app-state";
@@ -738,6 +750,8 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
738
750
  providerMetadata?: import("./common").JsonValue | undefined;
739
751
  dynamic?: boolean | undefined;
740
752
  providerExecuted?: boolean | undefined;
753
+ } | {
754
+ type: "continuation";
741
755
  })[] | undefined;
742
756
  failurePhase?: "agent-loop" | "structured-finalizer" | undefined;
743
757
  }, {
@@ -781,6 +795,7 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
781
795
  objectTypeId: string;
782
796
  primaryId: string;
783
797
  };
798
+ label?: string | undefined;
784
799
  } | {
785
800
  id: string;
786
801
  kind: "app-state";
@@ -834,6 +849,8 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
834
849
  providerMetadata?: import("./common").JsonValue | undefined;
835
850
  dynamic?: boolean | undefined;
836
851
  providerExecuted?: boolean | undefined;
852
+ } | {
853
+ type: "continuation";
837
854
  })[] | undefined;
838
855
  failurePhase?: "agent-loop" | "structured-finalizer" | undefined;
839
856
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/schemas/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,wBAAwB,+GAA4B,CAAA;AAMjE,eAAO,MAAM,oBAAoB;;;;;;EAE/B,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;EAE3C,CAAA;AAEF,eAAO,MAAM,uBAAuB,iFAOlC,CAAA;AAEF,eAAO,MAAM,gCAAgC,6DAK3C,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;EAQlC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa3C,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;;;;GAI3B,CAAA;AAEd,eAAO,MAAM,2BAA2B,8DAA2B,CAAA;AAEnE,eAAO,MAAM,oCAAoC;;;;;;EAE/C,CAAA;AAEF,eAAO,MAAM,oCAAoC,8DAA2B,CAAA;AAuC5E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUnC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGlC,CAAA;AAEF,eA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AC,CAAC,GAC/C,UAAU,CAAC,0BAA0B,CAAC;IAIzC,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAIlD,+BAA+B,CAAC,QAAQ,EAAE,OAAO,GAAG,gCAAgC;IAIpF,gCAAgC,CAC9B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,2BAA2B,GACjC,6BAA6B;IAIhC,mBAAmB,IAAI,4BAA4B;IAInD,iBAAiB,IAAI,yBAAyB,GAAG,SAAS;IAI1D,sBAAsB,IAAI,uBAAuB;IAI3C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA+BtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAe5B;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkP/C;AAiED,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sixb/server",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "HTTP and WebSocket API server for Sixb",
5
5
  "keywords": [
6
6
  "sixb",
@@ -38,13 +38,14 @@
38
38
  "zod-to-json-schema": "^3.24.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@sixb/core": "0.1.17"
41
+ "@sixb/core": "0.1.18"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@sixb/auth-magic-link": "0.1.5",
45
- "@sixb/auth-oidc": "0.1.4",
46
- "@sixb/core": "0.1.17",
47
- "@sixb/sqlite": "0.1.17",
45
+ "@sixb/auth-oidc": "0.1.5",
46
+ "@sixb/cli-core": "0.1.7",
47
+ "@sixb/core": "0.1.18",
48
+ "@sixb/sqlite": "0.1.18",
48
49
  "@types/bun": "latest",
49
50
  "typescript": "^5.7.0"
50
51
  },
@@ -9,6 +9,11 @@ export interface SixbAuthExperienceOptions {
9
9
  readonly audience?: AuthSessionAudience
10
10
  }
11
11
 
12
+ /** The configured experience with the project's language, which its pages declare. */
13
+ export interface ProjectAuthExperience extends SixbAuthExperienceOptions {
14
+ readonly locale: string
15
+ }
16
+
12
17
  export type AuthExperiencePageState =
13
18
  | { readonly kind: "signIn" }
14
19
  | { readonly kind: "checkEmail" }
@@ -23,7 +28,7 @@ export interface AuthExperienceSubmission {
23
28
  }
24
29
 
25
30
  export async function customAuthExperienceResponse(
26
- options: SixbAuthExperienceOptions | undefined,
31
+ options: ProjectAuthExperience | undefined,
27
32
  input: {
28
33
  readonly audience: AuthSessionAudience
29
34
  readonly state: AuthExperiencePageState
@@ -62,7 +67,11 @@ export async function customAuthExperienceResponse(
62
67
  " "
63
68
  )
64
69
 
65
- return new Response(html.replace(AUTH_BOOTSTRAP_PLACEHOLDER, bootstrap), {
70
+ const page = withDocumentLanguage(
71
+ html.replace(AUTH_BOOTSTRAP_PLACEHOLDER, bootstrap),
72
+ options.locale
73
+ )
74
+ return new Response(page, {
66
75
  status: input.status ?? 200,
67
76
  headers: {
68
77
  "content-type": "text/html; charset=utf-8",
@@ -83,6 +92,15 @@ export async function customAuthExperienceResponse(
83
92
  })
84
93
  }
85
94
 
95
+ // The page is built without loading the project, so its language is set when it is served.
96
+ function withDocumentLanguage(html: string, locale: string): string {
97
+ return html.replace(
98
+ /<html\b([^>]*)>/i,
99
+ (_tag, attributes: string) =>
100
+ `<html${attributes.replace(/\s+lang\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/i, "")} lang="${locale}">`
101
+ )
102
+ }
103
+
86
104
  function normalizeCspOrigin(value: string): string {
87
105
  let url: URL
88
106
  try {
@@ -1,6 +1,11 @@
1
1
  import { createHash } from "node:crypto"
2
- import { type BlobInfo, type BlobStorage, type FileRef, isFileRef } from "@sixb/core"
2
+ import { type BlobInfo, type BlobStorage, type FileRef, fileNameFor } from "@sixb/core"
3
3
  import { BlobStorageError, supportsRangeRead } from "@sixb/core/blob-storage/server"
4
+ import {
5
+ canonicalMediaType,
6
+ resolveFileRefAtPath,
7
+ statFileRef,
8
+ } from "@sixb/core/internal/blob-storage"
4
9
  import { ZodError } from "zod"
5
10
 
6
11
  export type FileContentDisposition = "inline" | "attachment"
@@ -148,8 +153,8 @@ export function fileContentHeadResponses(options: FileContentResponsesOptions =
148
153
  export async function createFileContentResponse(
149
154
  input: FileContentResponseInput
150
155
  ): Promise<Response | null> {
151
- const stat = await input.blobStorage.stat(input.fileRef.blobId)
152
- if (!stat || !blobMatchesFileRef(stat, input.fileRef)) {
156
+ const stat = await statFileRef(input.blobStorage, input.fileRef)
157
+ if (!stat) {
153
158
  return null
154
159
  }
155
160
 
@@ -255,11 +260,6 @@ export async function createContextualFileContentResponse<TQuery extends FileCon
255
260
  }
256
261
  }
257
262
 
258
- export function resolveFileRefAtPath(root: unknown, path: string): FileRef | null {
259
- const value = resolveJsonPointer(root, path)
260
- return isFileRef(value) ? value : null
261
- }
262
-
263
263
  function fileContentNotFound(
264
264
  set: { status?: number | string },
265
265
  message: string
@@ -268,14 +268,6 @@ function fileContentNotFound(
268
268
  return { error: message }
269
269
  }
270
270
 
271
- function blobMatchesFileRef(stat: BlobInfo, fileRef: FileRef): boolean {
272
- return (
273
- stat.blobId === fileRef.blobId &&
274
- stat.digest === fileRef.digest &&
275
- stat.sizeBytes === fileRef.sizeBytes
276
- )
277
- }
278
-
279
271
  function matchesIfNoneMatch(header: string | null | undefined, etag: string): boolean {
280
272
  return (
281
273
  header?.trim() === "*" ||
@@ -283,43 +275,32 @@ function matchesIfNoneMatch(header: string | null | undefined, etag: string): bo
283
275
  )
284
276
  }
285
277
 
286
- function resolveJsonPointer(root: unknown, pointer: string): unknown {
287
- if (pointer === "") {
288
- return root
289
- }
290
-
291
- if (!pointer.startsWith("/")) {
292
- return undefined
293
- }
294
-
295
- let current = root
296
- for (const rawSegment of pointer.slice(1).split("/")) {
297
- const segment = decodeJsonPointerSegment(rawSegment)
298
- if (Array.isArray(current)) {
299
- const index = Number.parseInt(segment, 10)
300
- if (!Number.isInteger(index) || index < 0 || index.toString() !== segment) {
301
- return undefined
302
- }
303
- if (!Object.hasOwn(current, segment)) {
304
- return undefined
305
- }
306
- current = current[index]
307
- continue
308
- }
309
-
310
- if (typeof current !== "object" || current === null || !Object.hasOwn(current, segment)) {
311
- return undefined
312
- }
313
-
314
- current = (current as Record<string, unknown>)[segment]
315
- }
316
-
317
- return current
318
- }
319
-
320
- function decodeJsonPointerSegment(segment: string): string {
321
- return segment.replaceAll("~1", "/").replaceAll("~0", "~")
322
- }
278
+ /**
279
+ * The only types a browser displays instead of downloading: raster images, PDF, and plain-text
280
+ * formats. Everything else, including HTML, SVG, and XML, downloads.
281
+ */
282
+ const INLINE_MEDIA_TYPES: ReadonlySet<string> = new Set([
283
+ "application/json",
284
+ "application/pdf",
285
+ "image/avif",
286
+ "image/bmp",
287
+ "image/gif",
288
+ "image/jpeg",
289
+ "image/png",
290
+ "image/webp",
291
+ "text/markdown",
292
+ "text/plain",
293
+ ])
294
+
295
+ // Keeps any file from running script on the API origin, even when a browser renders it as a page.
296
+ // A sandboxed page cannot run script, but Chrome's PDF viewer does not render in one, so PDFs go
297
+ // without `sandbox`: `default-src 'none'` still blocks script, and `object-src 'self'` lets
298
+ // browsers that show a PDF as an embedded object load it. `style-src 'unsafe-inline'` lets
299
+ // browsers keep the styling of their built-in viewers. Video and audio play in media elements,
300
+ // which ignore the policy of the file they load.
301
+ const FILE_CONTENT_SECURITY_POLICY = "default-src 'none'; style-src 'unsafe-inline'; sandbox"
302
+ const PDF_CONTENT_SECURITY_POLICY =
303
+ "default-src 'none'; style-src 'unsafe-inline'; object-src 'self'"
323
304
 
324
305
  function fileContentHeaders(
325
306
  fileRef: FileRef,
@@ -327,15 +308,22 @@ function fileContentHeaders(
327
308
  requestedDisposition: FileContentDisposition | undefined,
328
309
  canReadRange: boolean
329
310
  ): Headers {
330
- const mediaType = fileRef.mediaType?.trim() || "application/octet-stream"
311
+ // Parsed again rather than trusted: stored references may predate media type validation.
312
+ const mediaType = canonicalMediaType(fileRef.mediaType) ?? "application/octet-stream"
313
+ // Canonical, so everything before the first ";" is the lowercased type/subtype.
314
+ const baseType = mediaType.split(";", 1)[0]
331
315
  const disposition =
332
- (requestedDisposition ?? "inline") === "inline" && canRenderInline(mediaType)
316
+ (requestedDisposition ?? "inline") === "inline" && INLINE_MEDIA_TYPES.has(baseType)
333
317
  ? "inline"
334
318
  : "attachment"
335
319
  const headers = new Headers()
336
320
  headers.set("content-type", mediaType)
337
321
  headers.set("content-length", stat.sizeBytes.toString())
338
322
  headers.set("content-disposition", contentDispositionHeader(disposition, fileNameFor(fileRef)))
323
+ headers.set(
324
+ "content-security-policy",
325
+ baseType === "application/pdf" ? PDF_CONTENT_SECURITY_POLICY : FILE_CONTENT_SECURITY_POLICY
326
+ )
339
327
  // Metadata belongs to the reference, not the blob; changing it must also invalidate caches.
340
328
  const representation = JSON.stringify([
341
329
  fileRef.digest,
@@ -424,39 +412,6 @@ function rangeNotSatisfiableResponse(sizeBytes: number): Response {
424
412
  return new Response(null, { status: 416, headers })
425
413
  }
426
414
 
427
- function canRenderInline(mediaType: string): boolean {
428
- const baseType = mediaType.split(";")[0]?.trim().toLowerCase()
429
- if (!baseType) {
430
- return false
431
- }
432
-
433
- if (
434
- baseType === "text/html" ||
435
- baseType === "image/svg+xml" ||
436
- baseType === "application/xhtml+xml"
437
- ) {
438
- return false
439
- }
440
-
441
- return (
442
- baseType === "application/pdf" ||
443
- baseType === "text/plain" ||
444
- baseType === "text/markdown" ||
445
- baseType === "application/json" ||
446
- baseType.startsWith("image/")
447
- )
448
- }
449
-
450
- function fileNameFor(fileRef: FileRef): string {
451
- const fromFileName = fileRef.fileName?.split(/[\\/]/).filter(Boolean).at(-1)
452
- if (fromFileName) {
453
- return fromFileName
454
- }
455
-
456
- const fromLogicalPath = fileRef.logicalPath?.split(/[\\/]/).filter(Boolean).at(-1)
457
- return fromLogicalPath || `${fileRef.blobId}.bin`
458
- }
459
-
460
415
  function contentDispositionHeader(disposition: FileContentDisposition, fileName: string): string {
461
416
  const asciiFileName = fileName.replace(/[^\x20-\x7e]/g, "_").replaceAll('"', "'")
462
417
  return `${disposition}; filename="${asciiFileName}"; filename*=UTF-8''${encodeURIComponent(fileName)}`
@@ -1,6 +1,17 @@
1
- import { AgentRequestError, type AgentRunView, type FileRef, type SixbHostView } from "@sixb/core"
2
- import { publishAgentRunCancel, publishAgentRunFinished } from "@sixb/core/internal/agents"
1
+ import {
2
+ AgentRequestError,
3
+ type AgentRequestErrorCode,
4
+ type AgentRunView,
5
+ type FileRef,
6
+ type SixbHostView,
7
+ } from "@sixb/core"
8
+ import {
9
+ isRetryableAgentRun,
10
+ publishAgentRunCancel,
11
+ publishAgentRunFinished,
12
+ } from "@sixb/core/internal/agents"
3
13
  import { agentRunStreamId } from "@sixb/core/internal/agents/streams"
14
+ import { resolveFileRefAtPath } from "@sixb/core/internal/blob-storage"
4
15
  import {
5
16
  type AgentContextCheckpointRecord,
6
17
  type AgentMessageRecord,
@@ -19,7 +30,6 @@ import {
19
30
  createFileContentResponse,
20
31
  fileContentGetResponses,
21
32
  fileContentHeadResponses,
22
- resolveFileRefAtPath,
23
33
  } from "../files/content"
24
34
  import { SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT } from "../openapi/security"
25
35
  import { OPENAPI_TAGS } from "../openapi/tags"
@@ -29,6 +39,7 @@ import {
29
39
  AgentMessageListResponseSchema,
30
40
  AgentMessageSchema,
31
41
  AgentMessagesQuerySchema,
42
+ AgentRequestErrorResponseSchema,
32
43
  AgentRunListQuerySchema,
33
44
  AgentRunListResponseSchema,
34
45
  AgentRunParamsSchema,
@@ -170,7 +181,9 @@ async function publishQueuedRunCancellation(
170
181
  function handleAgentRouteError(
171
182
  error: unknown,
172
183
  set: { status?: number | string; headers?: unknown }
173
- ): ReturnType<typeof handleRouteError> {
184
+ ):
185
+ | ReturnType<typeof handleRouteError>
186
+ | { readonly error: string; readonly code: AgentRequestErrorCode } {
174
187
  // A duplicate id is a conflict, not a bad request. Map it to a generic 409 rather than echoing the
175
188
  // provider's raw message (which leaks the id, project, and storage prefix).
176
189
  if (error instanceof AgentStorageError && error.code === "duplicate_id") {
@@ -203,12 +216,16 @@ function handleAgentRouteError(
203
216
  case "invalid_sandbox_params":
204
217
  case "agent_selector_removed":
205
218
  case "invalid_context":
219
+ case "invalid_attachment":
206
220
  case "invalid_model_selection":
221
+ case "invalid_locale":
222
+ case "invalid_message":
207
223
  case "model_not_found":
208
224
  set.status = 400
209
225
  break
210
226
  }
211
- return { error: error.message }
227
+ // The code lets clients react without parsing the English message.
228
+ return { error: error.message, code: error.code }
212
229
  }
213
230
 
214
231
  return handleRouteError(error, set)
@@ -594,8 +611,11 @@ export function registerAgentRoutes(app: Elysia, host: SixbHostView) {
594
611
  const requestInput = {
595
612
  threadId: thread.id,
596
613
  text: parsed.text,
614
+ continue: parsed.continue,
597
615
  model: parsed.model,
598
616
  reasoning: parsed.reasoning,
617
+ timeZone: parsed.timeZone,
618
+ locale: parsed.locale,
599
619
  attachments: parsed.attachments as readonly FileRef[] | undefined,
600
620
  context: parsed.context,
601
621
  messageId: parsed.messageId,
@@ -615,7 +635,7 @@ export function registerAgentRoutes(app: Elysia, host: SixbHostView) {
615
635
  body: PostAgentMessageBodySchema,
616
636
  response: {
617
637
  202: PostAgentMessageResponseSchema,
618
- 400: ErrorResponseSchema,
638
+ 400: AgentRequestErrorResponseSchema,
619
639
  403: ErrorResponseSchema,
620
640
  404: ErrorResponseSchema,
621
641
  409: ErrorResponseSchema,
@@ -747,9 +767,9 @@ export function registerAgentRoutes(app: Elysia, host: SixbHostView) {
747
767
  set.status = 404
748
768
  return { error: "Agent run not found" }
749
769
  }
750
- if (failedRun.status !== "failed") {
770
+ if (!isRetryableAgentRun(failedRun)) {
751
771
  set.status = 409
752
- return { error: "Only failed agent runs can be retried" }
772
+ return { error: "Only failed or interrupted agent runs can be retried" }
753
773
  }
754
774
 
755
775
  const { run } = await sixb.agent.runs.retry(failedRun.id)
@@ -773,7 +793,7 @@ export function registerAgentRoutes(app: Elysia, host: SixbHostView) {
773
793
  501: ErrorResponseSchema,
774
794
  },
775
795
  detail: {
776
- summary: "Retry a failed agent run",
796
+ summary: "Retry a failed or interrupted agent run",
777
797
  tags: [OPENAPI_TAGS.agentRuns.name],
778
798
  operationId: "retryAgentRun",
779
799
  security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,