@case-framework/survey-assistant 0.2.3 → 0.4.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 +12 -4
- package/dist/{authoring-references-ChDTVnms.mjs → authoring-references-yyYC4Ydi.mjs} +2 -2
- package/dist/{authoring-references-ChDTVnms.mjs.map → authoring-references-yyYC4Ydi.mjs.map} +1 -1
- package/dist/capabilities-default.d.mts +1 -1
- package/dist/capabilities-default.mjs +1 -1
- package/dist/{constants-BK1-g6pR.d.mts → constants-k1b_evIb.d.mts} +7 -4
- package/dist/constants-k1b_evIb.d.mts.map +1 -0
- package/dist/{controller-proxy-DY36XFV3.mjs → controller-proxy-jWIPOZAv.mjs} +18 -8
- package/dist/controller-proxy-jWIPOZAv.mjs.map +1 -0
- package/dist/{controller-proxy-CIDRd8Wu.d.mts → controller-proxy-quQjtA7j.d.mts} +5 -2
- package/dist/controller-proxy-quQjtA7j.d.mts.map +1 -0
- package/dist/{engine-CWTuN3o2.mjs → engine-BvfUx_Jx.mjs} +85 -12
- package/dist/engine-BvfUx_Jx.mjs.map +1 -0
- package/dist/engine.d.mts +2 -2
- package/dist/engine.mjs +3 -3
- package/dist/{form-authoring-DCd9XfXf.mjs → form-authoring-BQh40yDb.mjs} +2 -2
- package/dist/{form-authoring-DCd9XfXf.mjs.map → form-authoring-BQh40yDb.mjs.map} +1 -1
- package/dist/index-8x1Eqlnz.d.mts +741 -0
- package/dist/index-8x1Eqlnz.d.mts.map +1 -0
- package/dist/{index-SPHf3OoJ.d.mts → index-BDp6S7r9.d.mts} +14 -5
- package/dist/index-BDp6S7r9.d.mts.map +1 -0
- package/dist/{index-Bp5W_oPa.d.mts → index-biZnRl-h.d.mts} +26 -24
- package/dist/index-biZnRl-h.d.mts.map +1 -0
- package/dist/{index-CPOQgkTN.d.mts → index-r8HVcn5b.d.mts} +9 -4
- package/dist/index-r8HVcn5b.d.mts.map +1 -0
- package/dist/lifecycle-DWv5CiSu.d.mts +523 -0
- package/dist/lifecycle-DWv5CiSu.d.mts.map +1 -0
- package/dist/{memory-thread-repository-acbz6HZJ.mjs → memory-thread-repository-xBZOog_q.mjs} +49 -21
- package/dist/memory-thread-repository-xBZOog_q.mjs.map +1 -0
- package/dist/{protocol-DATvkr1S.mjs → protocol-DJUP4gc0.mjs} +10 -4
- package/dist/protocol-DJUP4gc0.mjs.map +1 -0
- package/dist/protocol.d.mts +2 -1
- package/dist/protocol.mjs +1 -1
- package/dist/{react-3kSE6WtS.mjs → react-CY6N7lVi.mjs} +30 -8
- package/dist/react-CY6N7lVi.mjs.map +1 -0
- package/dist/react-integration.d.mts +1 -1
- package/dist/react-integration.mjs +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.mjs +2 -2
- package/dist/{request-context-BEjnaaFr.mjs → request-context-DixY5DYu.mjs} +3 -3
- package/dist/request-context-DixY5DYu.mjs.map +1 -0
- package/dist/server-agent.d.mts +26 -24
- package/dist/server-agent.d.mts.map +1 -1
- package/dist/server-agent.mjs +7 -6
- package/dist/server-agent.mjs.map +1 -1
- package/dist/server-runtime.d.mts +341 -8
- package/dist/server-runtime.d.mts.map +1 -1
- package/dist/server-runtime.mjs +321 -23
- package/dist/server-runtime.mjs.map +1 -1
- package/dist/server-tasks.d.mts +1 -1
- package/dist/server-tasks.mjs +8 -6
- package/dist/server-tasks.mjs.map +1 -1
- package/dist/server-tools.d.mts +1 -1
- package/dist/server-tools.mjs +1 -1
- package/dist/server.d.mts +8 -8
- package/dist/server.d.mts.map +1 -1
- package/dist/server.mjs +3 -3
- package/dist/storage-postgres.d.mts +1 -1
- package/dist/{tasks-DIZgr4nD.d.mts → tasks-BWmTMXoK.d.mts} +3 -3
- package/dist/{tasks-DIZgr4nD.d.mts.map → tasks-BWmTMXoK.d.mts.map} +1 -1
- package/dist/{thread-documents-C3kf0Vds.d.mts → thread-documents-Dvo6XS7o.d.mts} +1 -1
- package/dist/{thread-documents-C3kf0Vds.d.mts.map → thread-documents-Dvo6XS7o.d.mts.map} +1 -1
- package/dist/{thread-handlers-DZ1WsorO.d.mts → thread-handlers-D8gkLfU6.d.mts} +15 -7
- package/dist/{thread-handlers-DZ1WsorO.d.mts.map → thread-handlers-D8gkLfU6.d.mts.map} +1 -1
- package/dist/{tools-GDd5_GUh.mjs → tools-TXI8bfzZ.mjs} +28 -9
- package/dist/tools-TXI8bfzZ.mjs.map +1 -0
- package/dist/ui.css +2 -2
- package/dist/ui.d.mts +94 -10
- package/dist/ui.d.mts.map +1 -1
- package/dist/ui.mjs +561 -203
- package/dist/ui.mjs.map +1 -1
- package/docs/integration.md +84 -63
- package/package.json +25 -19
- package/dist/constants-BK1-g6pR.d.mts.map +0 -1
- package/dist/controller-proxy-CIDRd8Wu.d.mts.map +0 -1
- package/dist/controller-proxy-DY36XFV3.mjs.map +0 -1
- package/dist/engine-CWTuN3o2.mjs.map +0 -1
- package/dist/index-Bp5W_oPa.d.mts.map +0 -1
- package/dist/index-CPOQgkTN.d.mts.map +0 -1
- package/dist/index-EDL1V168.d.mts +0 -1257
- package/dist/index-EDL1V168.d.mts.map +0 -1
- package/dist/index-SPHf3OoJ.d.mts.map +0 -1
- package/dist/memory-thread-repository-acbz6HZJ.mjs.map +0 -1
- package/dist/protocol-DATvkr1S.mjs.map +0 -1
- package/dist/react-3kSE6WtS.mjs.map +0 -1
- package/dist/request-context-BEjnaaFr.mjs.map +0 -1
- package/dist/tools-GDd5_GUh.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-EDL1V168.d.mts","names":[],"sources":["../src/protocol/errors.ts","../src/protocol/content.ts","../src/protocol/document.ts","../src/protocol/operations.ts","../src/protocol/threads.ts","../src/protocol/tasks.ts","../src/protocol/models.ts","../src/protocol/lifecycle.ts"],"mappings":";;;;;;cAEa,8BAAA,EAA8B,CAAA,CAAA,OAAA;;;;;;;KAQ/B,wBAAA,GAA2B,CAAA,CAAE,KAAA,QAAa,8BAAA;AAAA,cAEzC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AoB,CAAA,CAAE,KAAA,QAAa,uBAAA;AAAA,KACnC,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA;AAAA,KACnC,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,4BAAA;AAAA,KACxC,2BAAA,GAA8B,CAAA,CAAE,KAAA,QAAa,iCAAA;AAAA,KAC7C,YAAA,GAAe,CAAA,CAAE,KAAA,QAAa,kBAAA;AAAA,cAI7B,qCAAA,EAAqC,CAAA,CAAA,OAAA,CAAA,oBAAA,WAAA,CAAA,CAAA,IAAA,CAAA,iBAAA,CAAA,oBAAA;AAAA,KACtC,+BAAA,GAAkC,eAAA;AAAA,KAClC,0BAAA,GAA6B,iBAAA;AAAA,KAC7B,0BAAA,GAA6B,iBAAA;AAAA,KAC7B,+BAAA,GAAkC,sBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-SPHf3OoJ.d.mts","names":[],"sources":["../src/react/session-state.ts","../src/react/turn-authorization.ts","../src/react/transport.ts","../src/react/thread-client.ts","../src/react/client-error.ts","../src/react/model-catalog.ts","../src/react/use-survey-assistant-session.ts"],"mappings":";;;;;;KAAY,2BAAA;AAAA,KAUA,2BAAA;EACN,IAAA;AAAA;EACA,IAAA;AAAA;EACA,IAAA;AAAA;EACA,IAAA;AAAA;EACA,IAAA;AAAA;EACA,IAAA;AAAA;EACA,IAAA;AAAA;EACA,IAAA;EAAe,aAAA;AAAA;AAAA,cAER,2BAAA;EAA+B,WAAA;EAAA;AAAA;EAI1C,WAAA;EACA,KAAA,EAAO,2BAAA;AAAA;AAAA,cAKI,iCAAA,GACX,MAAA,EAAQ,2BAAA,EACR,KAAA,EAAO,2BAAA,KACN,2BAAA;;;cCPU,+BAAA,GAAmC,MAAA;AAAA,cAOnC,oBAAA,GAAwB,MAAA,cAAkB,eAAA;AAAA,cAK1C,uBAAA,GAA2B,QAAA,EAAU,SAAA,OAAc,eAAA;AAAA,KAuBpD,uBAAA;EACN,MA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KX,SAAA,GAAY,8BAAA;AAAA;AAAA,UAGG,sBAAA;EACf,sBAAA,EAAwB,MAAA,SAAe,iBAAA;EACvC,kBAAA;EACA,YAAA;EACA,KAAA,EAAO,KAAA;EACP,WAAA;EACA,iBAAA,EAAmB,iBAAA;EACnB,QAAA,EAAU,SAAA;EACV,KAAA,EAAO,2BAAA;EACP,MAAA,EAAQ,UAAA;EACR,IAAA;EACA,MAAA,CAAO,OAAA,EAAS,4BAAA;EAChB,KAAA;AAAA;AAAA,cAGW,yBAAA;EAA6B,GAAA;EAAA,WAAA;EAAA,UAAA;EAAA,eAAA;EAAA,OAAA;EAAA,eAAA;EAAA,aAAA;EAAA,kBAAA;EAAA,kBAAA;EAAA,UAAA,EAAA,oBAAA;EAAA,QAAA;EAAA,QAAA,EAAA;AAAA,GAavC,6BAAA,KAAgC,sBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-thread-repository-acbz6HZJ.mjs","names":[],"sources":["../src/server/execution-timeout.ts","../src/server/turn-stream.ts","../src/server/thread-documents.ts","../src/server/handler.ts","../src/server/thread-handlers.ts","../src/server/memory-thread-repository.ts"],"sourcesContent":["import type { UIMessageChunk } from \"ai\";\n\nexport type SurveyAssistantExecutionTimeoutKind = \"first-response\" | \"idle\" | \"max-duration\";\n\nexport interface SurveyAssistantExecutionTimeoutOptions {\n firstResponseTimeoutMs: number;\n idleTimeoutMs: number;\n maxDurationMs: number;\n requestSignal: AbortSignal;\n}\n\nexport interface SurveyAssistantExecutionTimeout {\n readonly signal: AbortSignal;\n readonly timeoutKind: SurveyAssistantExecutionTimeoutKind | null;\n dispose(): void;\n recordActivity(): void;\n}\n\nconst timeoutMessages: Record<SurveyAssistantExecutionTimeoutKind, string> = {\n \"first-response\": \"The survey assistant timed out while waiting for its first response.\",\n idle: \"The survey assistant timed out after it stopped producing activity.\",\n \"max-duration\": \"The survey assistant reached its maximum execution duration.\",\n};\n\nexport const getSurveyAssistantExecutionTimeoutMessage = (\n kind: SurveyAssistantExecutionTimeoutKind,\n) => timeoutMessages[kind];\n\nexport const isSurveyAssistantExecutionActivityChunk = (chunk: UIMessageChunk): boolean =>\n chunk.type !== \"start\" &&\n chunk.type !== \"start-step\" &&\n chunk.type !== \"finish\" &&\n chunk.type !== \"finish-step\" &&\n chunk.type !== \"abort\" &&\n chunk.type !== \"error\";\n\nexport const createSurveyAssistantExecutionTimeout = ({\n firstResponseTimeoutMs,\n idleTimeoutMs,\n maxDurationMs,\n requestSignal,\n}: SurveyAssistantExecutionTimeoutOptions): SurveyAssistantExecutionTimeout => {\n const timeoutController = new AbortController();\n let activityTimer: ReturnType<typeof setTimeout> | undefined;\n let hardCapTimer: ReturnType<typeof setTimeout> | undefined;\n let timeoutKind: SurveyAssistantExecutionTimeoutKind | null = null;\n\n const unrefTimer = (timer: ReturnType<typeof setTimeout>) => {\n if (typeof timer === \"object\" && \"unref\" in timer) timer.unref();\n };\n\n const clearActivityTimer = () => {\n if (activityTimer !== undefined) clearTimeout(activityTimer);\n activityTimer = undefined;\n };\n const dispose = () => {\n clearActivityTimer();\n if (hardCapTimer !== undefined) clearTimeout(hardCapTimer);\n hardCapTimer = undefined;\n };\n const abortForTimeout = (kind: SurveyAssistantExecutionTimeoutKind) => {\n if (timeoutController.signal.aborted || requestSignal.aborted) return;\n timeoutKind = kind;\n dispose();\n timeoutController.abort(\n new DOMException(getSurveyAssistantExecutionTimeoutMessage(kind), \"TimeoutError\"),\n );\n };\n const scheduleActivityTimeout = (\n durationMs: number,\n kind: Extract<SurveyAssistantExecutionTimeoutKind, \"first-response\" | \"idle\">,\n ) => {\n clearActivityTimer();\n activityTimer = setTimeout(() => abortForTimeout(kind), durationMs);\n unrefTimer(activityTimer);\n };\n\n if (!requestSignal.aborted) {\n hardCapTimer = setTimeout(() => abortForTimeout(\"max-duration\"), maxDurationMs);\n unrefTimer(hardCapTimer);\n scheduleActivityTimeout(firstResponseTimeoutMs, \"first-response\");\n }\n\n const signal = AbortSignal.any([requestSignal, timeoutController.signal]);\n\n return {\n signal,\n get timeoutKind() {\n return timeoutKind;\n },\n dispose,\n recordActivity() {\n if (signal.aborted) return;\n scheduleActivityTimeout(idleTimeoutMs, \"idle\");\n },\n };\n};\n","import {\n SURVEY_ASSISTANT_TURN_FINAL_PART_TYPE,\n type SurveyAssistantTurnFinal,\n type SurveyAssistantTurnTerminationReason,\n} from \"../protocol\";\nimport type { TurnSurveyDraft } from \"../engine\";\nimport type { UIMessageChunk } from \"ai\";\nimport { isSurveyAssistantExecutionActivityChunk } from \"./execution-timeout\";\n\nconst createTurnFinalChunk = (turnFinal: SurveyAssistantTurnFinal): UIMessageChunk => ({\n type: SURVEY_ASSISTANT_TURN_FINAL_PART_TYPE,\n id: turnFinal.turnId,\n data: turnFinal,\n});\n\nexport interface SurveyAssistantTurnStreamOptions {\n stream: ReadableStream<UIMessageChunk>;\n turnDraft: TurnSurveyDraft;\n signal?: AbortSignal;\n onUnexpectedError?: (error: unknown) => string;\n onActivity?: () => void;\n onSettled?: () => void;\n getAbortErrorText?: () => string | undefined;\n getAbortTerminationReason?: () => SurveyAssistantTurnTerminationReason | undefined;\n turnStartedAt?: number;\n}\n\nconst getFinishTerminationReason = (\n finishReason: Extract<UIMessageChunk, { type: \"finish\" }>[\"finishReason\"],\n): SurveyAssistantTurnTerminationReason => {\n switch (finishReason) {\n // The AI SDK reports the agent loop's step cap this way; it isn't a literal tool-call error.\n case \"tool-calls\":\n return \"max-steps\";\n case \"length\":\n return \"length-limit\";\n case \"content-filter\":\n return \"content-filter\";\n case \"error\":\n return \"provider-error\";\n default:\n return \"incomplete-response\";\n }\n};\n\nexport const createSurveyAssistantTurnStream = ({\n turnDraft,\n getAbortErrorText,\n getAbortTerminationReason,\n onActivity,\n onSettled,\n onUnexpectedError = () => \"The survey assistant stream ended unexpectedly.\",\n signal,\n stream,\n turnStartedAt,\n}: SurveyAssistantTurnStreamOptions): ReadableStream<UIMessageChunk> => {\n const reader = stream.getReader();\n let settled = false;\n\n const settle = () => {\n if (settled) {\n return;\n }\n settled = true;\n onSettled?.();\n };\n\n return new ReadableStream<UIMessageChunk>({\n async start(controller) {\n let emittedTurnFinal = false;\n let sawFinish = false;\n let emittedAbortError = false;\n let finishReason: Extract<UIMessageChunk, { type: \"finish\" }>[\"finishReason\"];\n\n const emitTurnFinal = (\n status: SurveyAssistantTurnFinal[\"status\"],\n terminationReason?: SurveyAssistantTurnTerminationReason,\n ) => {\n if (emittedTurnFinal) {\n return;\n }\n emittedTurnFinal = true;\n const completedAt = Date.now();\n controller.enqueue(\n createTurnFinalChunk(\n turnDraft.finalize(status, new Date(completedAt).toISOString(), {\n ...(turnStartedAt === undefined\n ? {}\n : {\n startedAt: new Date(turnStartedAt).toISOString(),\n durationMs: Math.max(0, completedAt - turnStartedAt),\n }),\n ...(terminationReason ? { terminationReason } : {}),\n }),\n ),\n );\n };\n const emitAbortOutcome = () => {\n const errorText = getAbortErrorText?.();\n emitTurnFinal(\n errorText ? \"failed\" : \"aborted\",\n getAbortTerminationReason?.() ?? (errorText ? \"incomplete-response\" : \"client-abort\"),\n );\n if (errorText && !emittedAbortError) {\n emittedAbortError = true;\n controller.enqueue({ type: \"error\", errorText });\n }\n };\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n\n if (isSurveyAssistantExecutionActivityChunk(value)) onActivity?.();\n\n if (value.type === SURVEY_ASSISTANT_TURN_FINAL_PART_TYPE) {\n emitTurnFinal(\"failed\");\n controller.enqueue({\n type: \"error\",\n errorText: \"The survey assistant returned an invalid duplicate turn final.\",\n });\n await reader.cancel(\"duplicate turn final\");\n break;\n }\n if (value.type === \"error\") {\n emitTurnFinal(\"failed\", \"provider-error\");\n controller.enqueue(value);\n continue;\n }\n if (value.type === \"abort\") {\n const timeoutErrorText = getAbortErrorText?.();\n emitAbortOutcome();\n if (!timeoutErrorText) controller.enqueue(value);\n continue;\n }\n if (value.type === \"finish\") {\n sawFinish = true;\n finishReason = value.finishReason;\n }\n controller.enqueue(value);\n }\n\n if (!emittedTurnFinal) {\n if (signal?.aborted) {\n emitAbortOutcome();\n } else {\n emitTurnFinal(\n sawFinish && (finishReason === undefined || finishReason === \"stop\")\n ? \"completed\"\n : \"failed\",\n sawFinish && finishReason !== undefined && finishReason !== \"stop\"\n ? getFinishTerminationReason(finishReason)\n : !sawFinish\n ? \"incomplete-response\"\n : undefined,\n );\n }\n }\n controller.close();\n } catch (error) {\n try {\n if (signal?.aborted) emitAbortOutcome();\n else emitTurnFinal(\"failed\", \"stream-error\");\n if (!signal?.aborted) {\n controller.enqueue({ type: \"error\", errorText: onUnexpectedError(error) });\n }\n controller.close();\n } catch {\n // The client disconnected; finalization still occurred server-side.\n }\n } finally {\n reader.releaseLock();\n settle();\n }\n },\n async cancel(reason) {\n const completedAt = Date.now();\n turnDraft.finalize(\"aborted\", new Date(completedAt).toISOString(), {\n ...(turnStartedAt === undefined\n ? {}\n : {\n startedAt: new Date(turnStartedAt).toISOString(),\n durationMs: Math.max(0, completedAt - turnStartedAt),\n }),\n terminationReason: \"client-abort\",\n });\n settle();\n await reader.cancel(reason);\n },\n });\n};\n","import type { UIMessage } from \"ai\";\nimport { createHash } from \"node:crypto\";\nimport {\n SURVEY_ASSISTANT_ATTACHMENT_PART_TYPE,\n type SurveyAssistantAttachmentReference,\n} from \"../protocol\";\n\nexport interface SurveyAssistantThreadDocument {\n id: string;\n name: string;\n mediaType: string;\n bytes: number;\n contentHash: string;\n createdAt: string;\n}\n\nexport interface SurveyAssistantThreadDocumentContent extends SurveyAssistantThreadDocument {\n data: string;\n}\n\nexport interface SurveyAssistantModelAttachment {\n filename: string;\n mediaType: string;\n data: string;\n contentHash: string;\n}\n\nexport interface SurveyAssistantAttachmentAccess {\n documents: SurveyAssistantThreadDocument[];\n /** Attachments submitted in the current user message; already present as model context. */\n currentDocumentIds?: string[];\n selectedAttachments: SurveyAssistantModelAttachment[];\n load(documentIds: string[]): Promise<SurveyAssistantModelAttachment[]>;\n}\n\nexport interface SurveyAssistantThreadDocumentRepository {\n put(input: {\n resourceId: string;\n threadId: string;\n name: string;\n mediaType: string;\n data: string;\n bytes: number;\n }): Promise<SurveyAssistantThreadDocument>;\n list(input: { resourceId: string; threadId: string }): Promise<SurveyAssistantThreadDocument[]>;\n read(input: {\n resourceId: string;\n threadId: string;\n documentId: string;\n }): Promise<SurveyAssistantThreadDocumentContent | null>;\n deleteThread(input: { resourceId: string; threadId: string }): Promise<void>;\n}\n\nconst parseFileDataUrl = (url: string) => {\n const match = /^data:([^;,]+);base64,([A-Za-z0-9+/]*={0,2})$/.exec(url);\n return match ? { mediaType: match[1], data: match[2] } : null;\n};\n\nconst getBase64Bytes = (data: string) => {\n const padding = data.endsWith(\"==\") ? 2 : data.endsWith(\"=\") ? 1 : 0;\n return Math.max(0, Math.floor((data.length * 3) / 4) - padding);\n};\n\nconst getAttachmentContentHash = (data: string) => createHash(\"sha256\").update(data).digest(\"hex\");\n\nconst createAttachmentReferencePart = ({\n document,\n filename,\n mediaType,\n parsedData,\n}: {\n document?: SurveyAssistantThreadDocument;\n filename?: string;\n mediaType: string;\n parsedData?: string;\n}) => ({\n type: SURVEY_ASSISTANT_ATTACHMENT_PART_TYPE,\n data: {\n ...(document ? { documentId: document.id } : {}),\n filename: filename?.trim() || document?.name || \"Attached document\",\n mediaType: document?.mediaType || mediaType,\n bytes: document?.bytes ?? (parsedData ? getBase64Bytes(parsedData) : 0),\n } satisfies SurveyAssistantAttachmentReference,\n});\n\nconst createDocumentIndex = (documents: SurveyAssistantThreadDocument[]) =>\n new Map(\n documents.map((document) => [`${document.mediaType}\\u0000${document.contentHash}`, document]),\n );\n\n/**\n * Replaces current-turn file data with small repository references before the\n * message is handed to Mastra for persistence. The provider-bound attachment\n * processor re-injects the authorized repository copy transiently.\n */\nexport const replaceCurrentSurveyAssistantAttachmentsWithReferences = ({\n documents,\n messages,\n}: {\n documents: SurveyAssistantThreadDocument[];\n messages: UIMessage[];\n}): UIMessage[] => {\n const current = getCurrentUserMessage(messages);\n if (!current) return messages;\n const documentIndex = createDocumentIndex(documents);\n\n return messages.map((message) => {\n if (message !== current) return message;\n let changed = false;\n const parts = message.parts.map((part) => {\n if (part.type !== \"file\") return part;\n changed = true;\n const parsed = typeof part.url === \"string\" ? parseFileDataUrl(part.url) : null;\n const mediaType = parsed?.mediaType || part.mediaType;\n const document = parsed\n ? documentIndex.get(`${mediaType}\\u0000${getAttachmentContentHash(parsed.data)}`)\n : undefined;\n return createAttachmentReferencePart({\n document,\n filename: part.filename,\n mediaType,\n parsedData: parsed?.data,\n });\n });\n return changed ? { ...message, parts } : message;\n }) as UIMessage[];\n};\n\nexport const registerSurveyAssistantThreadAttachments = async ({\n messages,\n repository,\n resourceId,\n threadId,\n}: {\n messages: UIMessage[];\n repository: SurveyAssistantThreadDocumentRepository;\n resourceId: string;\n threadId: string;\n}) => {\n const registered: SurveyAssistantThreadDocument[] = [];\n\n const currentMessage = getCurrentUserMessage(messages);\n for (const message of currentMessage ? [currentMessage] : []) {\n for (const part of message.parts) {\n if (part.type !== \"file\" || typeof part.url !== \"string\") continue;\n const parsed = parseFileDataUrl(part.url);\n if (!parsed) continue;\n\n registered.push(\n await repository.put({\n resourceId,\n threadId,\n name: part.filename?.trim() || \"Attached document\",\n mediaType: parsed.mediaType,\n data: parsed.data,\n bytes: getBase64Bytes(parsed.data),\n }),\n );\n }\n }\n\n return registered;\n};\n\nconst getCurrentUserMessage = (messages: UIMessage[]) => {\n for (let index = messages.length - 1; index >= 0; index -= 1) {\n const message = messages[index];\n if (message?.role === \"user\") return message;\n }\n return undefined;\n};\n\nexport const removeHistoricalSurveyAssistantAttachments = (messages: UIMessage[]) => {\n const current = getCurrentUserMessage(messages);\n return messages.map((message) => {\n if (message === current) return message;\n const parts = message.parts.filter((part) => part.type !== \"file\");\n return parts.length === message.parts.length ? message : { ...message, parts };\n });\n};\n\n/**\n * Excludes the exact repository documents already loaded for the current turn.\n * Message parts are references by this stage and are not a deduplication source.\n */\nexport const getSurveyAssistantReplayableDocuments = (\n documents: SurveyAssistantThreadDocument[],\n currentDocumentIds: ReadonlySet<string>,\n) => documents.filter((document) => !currentDocumentIds.has(document.id));\n\nexport const loadSurveyAssistantThreadAttachments = async ({\n currentDocumentIds = new Set<string>(),\n documents,\n repository,\n resourceId,\n threadId,\n}: {\n currentDocumentIds?: ReadonlySet<string>;\n documents: SurveyAssistantThreadDocument[];\n repository: SurveyAssistantThreadDocumentRepository;\n resourceId: string;\n threadId: string;\n}): Promise<SurveyAssistantModelAttachment[]> => {\n const replayableDocuments = getSurveyAssistantReplayableDocuments(documents, currentDocumentIds);\n\n return loadSurveyAssistantDocuments({\n documents: replayableDocuments,\n repository,\n resourceId,\n threadId,\n });\n};\n\nexport const loadSurveyAssistantDocuments = async ({\n documents,\n repository,\n resourceId,\n threadId,\n}: {\n documents: SurveyAssistantThreadDocument[];\n repository: SurveyAssistantThreadDocumentRepository;\n resourceId: string;\n threadId: string;\n}): Promise<SurveyAssistantModelAttachment[]> => {\n const attachments: SurveyAssistantModelAttachment[] = [];\n for (const document of documents) {\n const content = await repository.read({\n resourceId,\n threadId,\n documentId: document.id,\n });\n if (!content) continue;\n attachments.push({\n filename: content.name,\n mediaType: content.mediaType,\n data: content.data,\n contentHash: content.contentHash,\n });\n }\n\n return attachments;\n};\n","import { handleChatStream } from \"@mastra/ai-sdk\";\nimport type { AgentExecutionOptions } from \"@mastra/core/agent\";\nimport type { Mastra } from \"@mastra/core/mastra\";\nimport { createUIMessageStreamResponse, type UIMessage, type UIMessageChunk } from \"ai\";\nimport {\n SurveyAssistantCapabilityMismatchError,\n TurnSurveyDraft,\n type SurveyAssistantCapabilitySet,\n} from \"../engine\";\nimport {\n serializeSurveyAssistantError,\n type SurveyAssistantErrorCode,\n type SurveyAssistantTurnTerminationReason,\n type SurveyDocumentSnapshot,\n} from \"../protocol\";\nimport {\n buildSurveyAssistantRequestContext,\n parseSurveyAssistantPreviousApplyOutcome,\n parseSurveyAssistantPreviousSettledVersion,\n parseSurveyAssistantSnapshot,\n type SurveyAssistantModelSelection,\n type SurveyAssistantIdentityContext,\n} from \"./request-context\";\nimport { SURVEY_ASSISTANT_AGENT_ID } from \"./constants\";\nimport {\n readSurveyAssistantRequestJson,\n SurveyAssistantRequestError,\n SURVEY_ASSISTANT_DEFAULT_REQUEST_LIMITS,\n type SurveyAssistantRequestLimits,\n validateSurveyAssistantMessages,\n} from \"./request-guardrails\";\nimport { createSurveyAssistantTurnStream } from \"./turn-stream\";\nimport {\n createSurveyAssistantExecutionTimeout,\n getSurveyAssistantExecutionTimeoutMessage,\n type SurveyAssistantExecutionTimeoutKind,\n} from \"./execution-timeout\";\nimport {\n registerSurveyAssistantThreadAttachments,\n loadSurveyAssistantDocuments,\n getSurveyAssistantReplayableDocuments,\n removeHistoricalSurveyAssistantAttachments,\n replaceCurrentSurveyAssistantAttachmentsWithReferences,\n type SurveyAssistantAttachmentAccess,\n type SurveyAssistantModelAttachment,\n type SurveyAssistantThreadDocumentRepository,\n} from \"./thread-documents\";\n\nconst DEFAULT_MAX_STEPS = 48;\nconst DEFAULT_MAX_CONCURRENT_REQUESTS = 4;\nconst DEFAULT_FIRST_RESPONSE_TIMEOUT_MS = 15 * 60 * 1_000;\nconst DEFAULT_IDLE_TIMEOUT_MS = 5 * 60 * 1_000;\nconst DEFAULT_MAX_DURATION_MS = 60 * 60 * 1_000;\nconst MAX_USER_ERROR_MESSAGE_LENGTH = 700;\nconst MAX_ERROR_CAUSE_DEPTH = 5;\n\ntype ProviderOptions = AgentExecutionOptions[\"providerOptions\"];\n\nconst getTimeoutTerminationReason = (\n kind: SurveyAssistantExecutionTimeoutKind,\n): SurveyAssistantTurnTerminationReason => {\n switch (kind) {\n case \"first-response\":\n return \"first-response-timeout\";\n case \"idle\":\n return \"idle-timeout\";\n case \"max-duration\":\n return \"max-duration\";\n }\n};\n\nexport interface SurveyAssistantAuthorizationInput {\n request: Request;\n requestedResourceId?: string;\n requestedThreadId?: string;\n requestedSurveyId?: string;\n}\n\nexport type SurveyAssistantAuthorizedIdentity = SurveyAssistantIdentityContext;\n\nexport type SurveyAssistantAuthorize = (\n input: SurveyAssistantAuthorizationInput,\n) => Promise<SurveyAssistantAuthorizedIdentity> | SurveyAssistantAuthorizedIdentity;\n\nexport interface SurveyAssistantModelResolutionInput {\n identity: SurveyAssistantAuthorizedIdentity;\n request: Request;\n requestedModelId?: string;\n}\n\nexport type SurveyAssistantResolveModel = (\n input: SurveyAssistantModelResolutionInput,\n) =>\n | Promise<SurveyAssistantModelSelection | null | undefined>\n | SurveyAssistantModelSelection\n | null\n | undefined;\n\nexport class SurveyAssistantAuthorizationError extends Error {\n readonly status: number;\n\n constructor(message = \"The survey assistant request is not authorized.\", status = 403) {\n super(message);\n this.name = \"SurveyAssistantAuthorizationError\";\n this.status = status;\n }\n}\n\nexport interface SurveyAssistantTurnMetrics {\n durationMs?: number;\n snapshotBytes: number;\n toolCalls: number;\n inputTokens?: number;\n outputTokens?: number;\n totalTokens?: number;\n reasoningTokens?: number;\n cachedInputTokens?: number;\n terminationReason?: SurveyAssistantTurnTerminationReason;\n}\n\nexport interface SurveyAssistantStreamErrorContext {\n resourceId: string;\n surveyId?: string;\n threadId: string;\n}\n\nexport interface SurveyAssistantChatHandlerOptions {\n mastra: Mastra | (() => Mastra | Promise<Mastra>);\n authorize: SurveyAssistantAuthorize;\n activeTools: readonly string[];\n agentId?: string;\n trustedCapabilities?: SurveyAssistantCapabilitySet;\n isEnabled?: (request: Request) => boolean | Promise<boolean>;\n getReadinessError?: (request: Request) => string | null | Promise<string | null>;\n firstResponseTimeoutMs?: number;\n idleTimeoutMs?: number;\n maxConcurrentRequests?: number;\n maxDurationMs?: number;\n maxSteps?: number;\n providerName?: string;\n providerOptions?: ProviderOptions;\n sendReasoning?: boolean;\n formatStreamError?: (error: unknown, context: SurveyAssistantStreamErrorContext) => string;\n onStreamError?: (error: unknown, context: SurveyAssistantStreamErrorContext) => void;\n onTurnMetrics?: (input: {\n identity: SurveyAssistantAuthorizedIdentity;\n metrics: SurveyAssistantTurnMetrics;\n provider?: string;\n turnId: string;\n }) => void;\n /** Optional overrides; omitted values use the safe package defaults. */\n requestLimits?: Partial<SurveyAssistantRequestLimits>;\n resolveModel?: SurveyAssistantResolveModel;\n threadDocuments?: SurveyAssistantThreadDocumentRepository;\n}\n\ntype SurveyAssistantChatParams = {\n messages?: unknown;\n snapshot?: unknown;\n previousSettledVersion?: unknown;\n previousApplyOutcome?: unknown;\n id?: unknown;\n resourceId?: unknown;\n modelId?: unknown;\n threadId?: unknown;\n surveyId?: unknown;\n trigger?: \"submit-message\" | \"regenerate-message\";\n} & Record<string, unknown>;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst optionalRequestedId = (value: unknown) => {\n if (typeof value !== \"string\") return undefined;\n const normalized = value.trim();\n return normalized.length > 0 && normalized.length <= 240 ? normalized : undefined;\n};\n\nconst validateAuthorizedIdentity = (\n identity: SurveyAssistantAuthorizedIdentity,\n): SurveyAssistantAuthorizedIdentity => {\n if (\n !identity ||\n (identity.authority !== \"authenticated-host\" &&\n identity.authority !== \"experimental-client-request\") ||\n typeof identity.resourceId !== \"string\" ||\n identity.resourceId.trim().length === 0 ||\n identity.resourceId.length > 240 ||\n (identity.surveyId !== undefined && !optionalRequestedId(identity.surveyId)) ||\n typeof identity.threadId !== \"string\" ||\n identity.threadId.trim().length === 0 ||\n identity.threadId.length > 240\n ) {\n throw new SurveyAssistantAuthorizationError(\n \"The host returned an invalid survey assistant identity.\",\n 500,\n );\n }\n\n return {\n authority: identity.authority,\n resourceId: identity.resourceId.trim(),\n ...(identity.surveyId ? { surveyId: optionalRequestedId(identity.surveyId) } : {}),\n threadId: identity.threadId.trim(),\n };\n};\n\nconst validateModelSelection = (\n selection: SurveyAssistantModelSelection | null | undefined,\n): SurveyAssistantModelSelection | null => {\n if (!selection) return null;\n const id = optionalRequestedId(selection.id);\n const modelValue: unknown = selection.model;\n const stringModel = typeof modelValue === \"string\" ? optionalRequestedId(modelValue) : undefined;\n const objectModel = (() => {\n if (!isRecord(modelValue)) return undefined;\n const url = modelValue.url;\n const apiKey = modelValue.apiKey;\n const headers = modelValue.headers;\n if (\n (url !== undefined && typeof url !== \"string\") ||\n (apiKey !== undefined && typeof apiKey !== \"string\") ||\n (headers !== undefined &&\n (!isRecord(headers) || Object.values(headers).some((value) => typeof value !== \"string\")))\n ) {\n return undefined;\n }\n const shared = {\n ...(url === undefined ? {} : { url }),\n ...(apiKey === undefined ? {} : { apiKey }),\n ...(headers === undefined ? {} : { headers: headers as Record<string, string> }),\n };\n const compatibleId = optionalRequestedId(modelValue.id);\n if (compatibleId) {\n return { id: compatibleId, ...shared } as SurveyAssistantModelSelection[\"model\"];\n }\n const providerId = optionalRequestedId(modelValue.providerId);\n const modelId = optionalRequestedId(modelValue.modelId);\n if (providerId && modelId) {\n return {\n providerId,\n modelId,\n ...shared,\n } as SurveyAssistantModelSelection[\"model\"];\n }\n return undefined;\n })();\n return id && (stringModel || objectModel) ? { id, model: stringModel ?? objectModel! } : null;\n};\n\nconst readNumber = (value: unknown): number | undefined =>\n typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n\nconst recordTurnStreamPart = (metrics: SurveyAssistantTurnMetrics, part: unknown) => {\n if (!isRecord(part)) return;\n if (part.type === \"tool-call\") metrics.toolCalls += 1;\n if (part.type !== \"finish\") return;\n\n const payload = isRecord(part.payload) ? part.payload : undefined;\n const output = isRecord(payload?.output) ? payload.output : undefined;\n const usage = isRecord(output?.usage) ? output.usage : undefined;\n if (!usage) return;\n\n metrics.inputTokens = readNumber(usage.inputTokens);\n metrics.outputTokens = readNumber(usage.outputTokens);\n metrics.totalTokens = readNumber(usage.totalTokens);\n metrics.reasoningTokens = readNumber(usage.reasoningTokens);\n metrics.cachedInputTokens = readNumber(usage.cachedInputTokens);\n};\n\nconst unwrapStreamError = (error: unknown) => {\n if (isRecord(error) && error.error !== undefined) return error.error;\n return error;\n};\n\nconst describeErrorLevel = (value: unknown): Record<string, unknown> => {\n if (value instanceof Error) {\n const properties = Object.fromEntries(\n Object.getOwnPropertyNames(value)\n .filter((key) => key !== \"stack\")\n .map((key) => [key, (value as unknown as Record<string, unknown>)[key]]),\n );\n return { name: value.name, message: value.message, stack: value.stack, ...properties };\n }\n\n if (isRecord(value)) {\n return {\n constructorName: value.constructor?.name,\n ...Object.fromEntries(Object.getOwnPropertyNames(value).map((key) => [key, value[key]])),\n };\n }\n\n return { value };\n};\n\nexport const describeSurveyAssistantStreamError = (error: unknown) => {\n const levels: Record<string, unknown>[] = [];\n let current: unknown = unwrapStreamError(error);\n\n for (\n let depth = 0;\n depth < MAX_ERROR_CAUSE_DEPTH && current !== undefined && current !== null;\n depth += 1\n ) {\n const level = describeErrorLevel(current);\n levels.push(level);\n current = level.cause;\n }\n\n return levels.length === 1 ? levels[0] : { levels };\n};\n\nconst clampUserErrorMessage = (message: string) => {\n const normalized = message.replace(/\\s+/g, \" \").trim();\n return normalized.length <= MAX_USER_ERROR_MESSAGE_LENGTH\n ? normalized\n : `${normalized.slice(0, MAX_USER_ERROR_MESSAGE_LENGTH - 1)}…`;\n};\n\nconst getProviderModelName = (message: string) =>\n message.match(/\\bmodel\\s+[`'\"]([^`'\"]+)[`'\"]/i)?.[1]?.trim();\n\nconst classifyStreamError = (message: string, statusCode?: number): SurveyAssistantErrorCode => {\n if (statusCode === 401 || statusCode === 403) return \"authorization_failed\";\n if (statusCode === 429) return \"rate_limited\";\n if (\n /\\bmodel\\b[\\s\\S]{0,160}\\b(?:limited preview|not available)\\b/i.test(message) ||\n /\\blimited preview\\b[\\s\\S]{0,160}\\bmodel\\b/i.test(message)\n ) {\n return \"model_unavailable\";\n }\n if (/\\b(?:rate limit|too many requests|request limit)\\b/i.test(message)) {\n return \"rate_limited\";\n }\n if (\n /\\b(?:invalid api key|incorrect api key|authentication|unauthorized|forbidden)\\b/i.test(message)\n ) {\n return \"authorization_failed\";\n }\n if (\n /\\b(?:attachment|document|file)\\b[\\s\\S]{0,120}\\b(?:missing|unavailable|not found|failed)\\b/i.test(\n message,\n )\n ) {\n return \"attachment_unavailable\";\n }\n return \"request_failed\";\n};\n\nconst formatKnownProviderError = (message: string) => {\n const normalized = clampUserErrorMessage(message);\n if (\n /\\bmodel\\b[\\s\\S]{0,160}\\b(?:limited preview|not available)\\b/i.test(normalized) ||\n /\\blimited preview\\b[\\s\\S]{0,160}\\bmodel\\b/i.test(normalized)\n ) {\n const modelName = getProviderModelName(normalized);\n return `The configured model${modelName ? ` \\`${modelName}\\`` : \"\"} is not available on this account.`;\n }\n if (/\\b(?:rate limit|too many requests|request limit)\\b/i.test(normalized)) {\n return \"The AI provider is temporarily limiting requests.\";\n }\n if (\n /\\b(?:invalid api key|incorrect api key|authentication|unauthorized|forbidden)\\b/i.test(\n normalized,\n )\n ) {\n return \"The AI provider rejected the assistant credentials.\";\n }\n return \"The AI provider could not complete the request.\";\n};\n\nconst parseProviderResponseBodyMessage = (responseBody: unknown) => {\n if (typeof responseBody !== \"string\" || responseBody.trim().length === 0) return undefined;\n try {\n const parsed = JSON.parse(responseBody) as unknown;\n if (isRecord(parsed) && isRecord(parsed.error) && typeof parsed.error.message === \"string\") {\n return parsed.error.message;\n }\n } catch {\n return responseBody;\n }\n return responseBody;\n};\n\nconst extractUserErrorMessageFromLevel = (level: Record<string, unknown>) => {\n if (\n isRecord(level.data) &&\n isRecord(level.data.error) &&\n typeof level.data.error.message === \"string\"\n ) {\n return level.data.error.message;\n }\n return (\n parseProviderResponseBodyMessage(level.responseBody) ??\n (typeof level.message === \"string\" ? level.message : undefined)\n );\n};\n\nexport const formatSurveyAssistantStreamError = (error: unknown) => {\n const describedError = describeSurveyAssistantStreamError(error);\n const levels = Array.isArray(describedError.levels) ? describedError.levels : [describedError];\n const messageLevel = levels.find(\n (level): level is Record<string, unknown> =>\n isRecord(level) && Boolean(extractUserErrorMessageFromLevel(level)),\n );\n const statusLevel = levels.find(\n (level): level is Record<string, unknown> => isRecord(level) && level.statusCode !== undefined,\n );\n const statusCode = Number(statusLevel?.statusCode);\n const detail = messageLevel ? extractUserErrorMessageFromLevel(messageLevel) : undefined;\n const formattedDetail = detail ? formatKnownProviderError(detail) : undefined;\n return serializeSurveyAssistantError({\n code: classifyStreamError(\n formattedDetail ?? \"\",\n Number.isFinite(statusCode) ? statusCode : undefined,\n ),\n ...(formattedDetail ? { detail: formattedDetail } : {}),\n });\n};\n\nconst requestErrorResponse = (error: unknown, fallback: string) => {\n const requestError =\n error instanceof SurveyAssistantRequestError\n ? error\n : new SurveyAssistantRequestError(fallback);\n return Response.json(\n { code: \"request_failed\", error: requestError.message },\n { status: requestError.status },\n );\n};\n\nexport const createSurveyAssistantChatHandler = (options: SurveyAssistantChatHandlerOptions) => {\n const requestLimits: SurveyAssistantRequestLimits = {\n ...SURVEY_ASSISTANT_DEFAULT_REQUEST_LIMITS,\n ...options.requestLimits,\n };\n for (const [name, value] of Object.entries(requestLimits)) {\n if (\n name !== \"acceptedAttachmentTypes\" &&\n (!Number.isSafeInteger(value) || (value as number) <= 0)\n ) {\n throw new Error(`Survey assistant request limit \"${name}\" must be a positive integer.`);\n }\n }\n if (typeof requestLimits.acceptedAttachmentTypes?.has !== \"function\") {\n throw new Error(\"Survey assistant accepted attachment types must be a set.\");\n }\n const maxConcurrentRequests =\n Number.isInteger(options.maxConcurrentRequests) && (options.maxConcurrentRequests ?? 0) > 0\n ? options.maxConcurrentRequests!\n : DEFAULT_MAX_CONCURRENT_REQUESTS;\n const firstResponseTimeoutMs =\n Number.isFinite(options.firstResponseTimeoutMs) && (options.firstResponseTimeoutMs ?? 0) > 0\n ? options.firstResponseTimeoutMs!\n : DEFAULT_FIRST_RESPONSE_TIMEOUT_MS;\n const idleTimeoutMs =\n Number.isFinite(options.idleTimeoutMs) && (options.idleTimeoutMs ?? 0) > 0\n ? options.idleTimeoutMs!\n : DEFAULT_IDLE_TIMEOUT_MS;\n const maxSteps =\n Number.isInteger(options.maxSteps) && (options.maxSteps ?? 0) > 0\n ? options.maxSteps!\n : DEFAULT_MAX_STEPS;\n const maxDurationMs =\n Number.isFinite(options.maxDurationMs) && (options.maxDurationMs ?? 0) > 0\n ? options.maxDurationMs!\n : DEFAULT_MAX_DURATION_MS;\n let activeRequestCount = 0;\n\n const acquireRequestSlot = () => {\n if (activeRequestCount >= maxConcurrentRequests) return null;\n activeRequestCount += 1;\n let released = false;\n return () => {\n if (released) return;\n released = true;\n activeRequestCount = Math.max(0, activeRequestCount - 1);\n };\n };\n\n return async (request: Request): Promise<Response> => {\n if (options.isEnabled && !(await options.isEnabled(request))) {\n return Response.json(\n { code: \"authorization_failed\", error: \"Survey assistant is disabled.\" },\n { status: 404 },\n );\n }\n\n let rawParams: unknown;\n try {\n rawParams = await readSurveyAssistantRequestJson(request, requestLimits.maxRequestBytes);\n } catch (error) {\n return requestErrorResponse(error, \"The survey assistant request could not be read.\");\n }\n\n const params = isRecord(rawParams)\n ? (rawParams as SurveyAssistantChatParams)\n : ({} satisfies SurveyAssistantChatParams);\n\n let identity: SurveyAssistantAuthorizedIdentity;\n try {\n identity = validateAuthorizedIdentity(\n await options.authorize({\n request,\n requestedResourceId: optionalRequestedId(params.resourceId),\n requestedThreadId: optionalRequestedId(params.threadId ?? params.id),\n requestedSurveyId: optionalRequestedId(params.surveyId),\n }),\n );\n } catch (error) {\n const authorizationError =\n error instanceof SurveyAssistantAuthorizationError\n ? error\n : new SurveyAssistantAuthorizationError();\n return Response.json(\n { code: \"authorization_failed\", error: authorizationError.message },\n { status: authorizationError.status },\n );\n }\n\n let messages: UIMessage[];\n try {\n messages = validateSurveyAssistantMessages(params.messages, requestLimits);\n } catch (error) {\n return requestErrorResponse(error, \"The survey assistant messages are invalid.\");\n }\n\n let modelSelection: SurveyAssistantModelSelection | undefined;\n if (options.resolveModel) {\n const requestedModelId = optionalRequestedId(params.modelId);\n if (params.modelId !== undefined && !requestedModelId) {\n return Response.json(\n { code: \"model_unavailable\", error: \"Invalid survey assistant model selection.\" },\n { status: 400 },\n );\n }\n\n try {\n modelSelection =\n validateModelSelection(\n await options.resolveModel({ identity, request, requestedModelId }),\n ) ?? undefined;\n } catch (error) {\n options.onStreamError?.(error, {\n resourceId: identity.resourceId,\n surveyId: identity.surveyId,\n threadId: identity.threadId,\n });\n return Response.json(\n {\n code: \"model_unavailable\",\n error: \"The survey assistant model catalog is unavailable.\",\n },\n { status: 503 },\n );\n }\n if (!modelSelection) {\n return Response.json(\n {\n code: \"model_unavailable\",\n error: \"The selected survey assistant model is not available.\",\n },\n { status: 400 },\n );\n }\n }\n\n let snapshot: SurveyDocumentSnapshot | null;\n let previousSettledVersion;\n let previousApplyOutcome;\n try {\n snapshot = parseSurveyAssistantSnapshot(params.snapshot);\n previousSettledVersion = parseSurveyAssistantPreviousSettledVersion(\n params.previousSettledVersion,\n );\n previousApplyOutcome = parseSurveyAssistantPreviousApplyOutcome(params.previousApplyOutcome);\n } catch {\n return Response.json(\n { code: \"request_failed\", error: \"Invalid survey assistant document context.\" },\n { status: 400 },\n );\n }\n\n const readinessError = await options.getReadinessError?.(request);\n if (readinessError) {\n return Response.json({ code: \"request_failed\", error: readinessError }, { status: 503 });\n }\n\n const releaseRequestSlot = acquireRequestSlot();\n if (!releaseRequestSlot) {\n return Response.json(\n {\n code: \"rate_limited\",\n error: \"The survey assistant is handling too many requests. Try again shortly.\",\n },\n { status: 429 },\n );\n }\n\n const turnDraft = new TurnSurveyDraft();\n let requestContext;\n try {\n let attachmentAccess: SurveyAssistantAttachmentAccess | undefined;\n let modelAttachments: SurveyAssistantModelAttachment[] = [];\n if (options.threadDocuments) {\n const repository = options.threadDocuments;\n const registered = await registerSurveyAssistantThreadAttachments({\n messages,\n repository,\n resourceId: identity.resourceId,\n threadId: identity.threadId,\n });\n const manifest = await repository.list({\n resourceId: identity.resourceId,\n threadId: identity.threadId,\n });\n modelAttachments = await loadSurveyAssistantDocuments({\n documents: registered,\n repository,\n resourceId: identity.resourceId,\n threadId: identity.threadId,\n });\n messages = replaceCurrentSurveyAssistantAttachmentsWithReferences({\n documents: registered,\n messages,\n });\n messages = removeHistoricalSurveyAssistantAttachments(messages);\n const registeredIds = new Set(registered.map((document) => document.id));\n const replayableDocuments = getSurveyAssistantReplayableDocuments(manifest, registeredIds);\n const documents = [...registered, ...replayableDocuments];\n if (documents.length > 0) {\n attachmentAccess = {\n documents,\n currentDocumentIds: registered.map((document) => document.id),\n selectedAttachments: [],\n load: (documentIds) =>\n loadSurveyAssistantDocuments({\n documents: documents.filter((document) => documentIds.includes(document.id)),\n repository,\n resourceId: identity.resourceId,\n threadId: identity.threadId,\n }),\n };\n }\n }\n requestContext = buildSurveyAssistantRequestContext({\n turnDraft,\n identity,\n snapshot,\n previousSettledVersion,\n previousApplyOutcome,\n trustedCapabilities: options.trustedCapabilities,\n attachmentAccess,\n modelAttachments,\n modelSelection,\n });\n } catch (error) {\n releaseRequestSlot();\n if (error instanceof SurveyAssistantRequestError) {\n return requestErrorResponse(error, \"The thread attachments could not be prepared.\");\n }\n if (error instanceof SurveyAssistantCapabilityMismatchError) {\n return Response.json({ error: error.message, code: error.code }, { status: 409 });\n }\n options.onStreamError?.(error, {\n resourceId: identity.resourceId,\n surveyId: identity.surveyId,\n threadId: identity.threadId,\n });\n return Response.json(\n {\n code: \"attachment_unavailable\",\n error: \"The survey assistant could not prepare the thread's reference documents.\",\n },\n { status: 503 },\n );\n }\n\n const metrics: SurveyAssistantTurnMetrics = {\n snapshotBytes: snapshot ? new TextEncoder().encode(JSON.stringify(snapshot)).byteLength : 0,\n toolCalls: 0,\n };\n const streamErrorContext = {\n resourceId: identity.resourceId,\n surveyId: identity.surveyId,\n threadId: identity.threadId,\n };\n const executionStartedAt = Date.now();\n const executionTimeout = createSurveyAssistantExecutionTimeout({\n firstResponseTimeoutMs,\n idleTimeoutMs,\n maxDurationMs,\n requestSignal: request.signal,\n });\n const executionSignal = executionTimeout.signal;\n const finalizeExecutionTurn = (\n status: \"completed\" | \"failed\" | \"aborted\",\n terminationReason?: SurveyAssistantTurnTerminationReason,\n ) => {\n const completedAt = Date.now();\n return turnDraft.finalize(status, new Date(completedAt).toISOString(), {\n startedAt: new Date(executionStartedAt).toISOString(),\n durationMs: Math.max(0, completedAt - executionStartedAt),\n ...(terminationReason ? { terminationReason } : {}),\n });\n };\n const handleStreamError = (error: unknown) => {\n options.onStreamError?.(error, streamErrorContext);\n return (\n options.formatStreamError?.(error, streamErrorContext) ??\n formatSurveyAssistantStreamError(error)\n );\n };\n\n let stream: ReadableStream<UIMessageChunk>;\n try {\n const mastra = typeof options.mastra === \"function\" ? await options.mastra() : options.mastra;\n stream = (await handleChatStream({\n mastra,\n agentId: options.agentId ?? SURVEY_ASSISTANT_AGENT_ID,\n version: \"v6\",\n params: {\n messages,\n ...(params.trigger ? { trigger: params.trigger } : {}),\n requestContext,\n runId: turnDraft.turnId,\n abortSignal: executionSignal,\n onAbort: () => {\n finalizeExecutionTurn(\n executionTimeout.timeoutKind ? \"failed\" : \"aborted\",\n executionTimeout.timeoutKind\n ? getTimeoutTerminationReason(executionTimeout.timeoutKind)\n : \"client-abort\",\n );\n },\n onError: () => {\n finalizeExecutionTurn(\"failed\", \"provider-error\");\n },\n memory: {\n thread: identity.threadId,\n resource: identity.resourceId,\n },\n },\n defaultOptions: {\n activeTools: [...options.activeTools],\n maxSteps,\n ...(options.providerOptions ? { providerOptions: options.providerOptions } : {}),\n },\n sendReasoning: options.sendReasoning ?? true,\n messageMetadata: ({ part }: { part: unknown }) => {\n recordTurnStreamPart(metrics, part);\n return undefined;\n },\n onError: (error: unknown) => {\n finalizeExecutionTurn(\"failed\", \"provider-error\");\n return handleStreamError(error);\n },\n } as never)) as ReadableStream<UIMessageChunk>;\n } catch (error) {\n finalizeExecutionTurn(\n executionTimeout.timeoutKind ? \"failed\" : executionSignal.aborted ? \"aborted\" : \"failed\",\n executionTimeout.timeoutKind\n ? getTimeoutTerminationReason(executionTimeout.timeoutKind)\n : executionSignal.aborted\n ? \"client-abort\"\n : \"provider-error\",\n );\n executionTimeout.dispose();\n releaseRequestSlot();\n return Response.json(\n {\n error: executionTimeout.timeoutKind\n ? getSurveyAssistantExecutionTimeoutMessage(executionTimeout.timeoutKind)\n : handleStreamError(error),\n },\n { status: 503 },\n );\n }\n\n const turnStream = createSurveyAssistantTurnStream({\n stream,\n turnDraft,\n signal: executionSignal,\n getAbortErrorText: () =>\n executionTimeout.timeoutKind\n ? getSurveyAssistantExecutionTimeoutMessage(executionTimeout.timeoutKind)\n : undefined,\n getAbortTerminationReason: () =>\n executionTimeout.timeoutKind\n ? getTimeoutTerminationReason(executionTimeout.timeoutKind)\n : request.signal.aborted\n ? \"client-abort\"\n : undefined,\n onActivity: executionTimeout.recordActivity,\n onUnexpectedError: handleStreamError,\n onSettled: () => {\n executionTimeout.dispose();\n releaseRequestSlot();\n metrics.durationMs = Date.now() - executionStartedAt;\n metrics.terminationReason = turnDraft.final?.terminationReason;\n try {\n options.onTurnMetrics?.({\n identity,\n metrics,\n provider: options.providerName,\n turnId: turnDraft.turnId,\n });\n } catch (error) {\n try {\n options.onStreamError?.(error, streamErrorContext);\n } catch {\n // Host observability hooks must not break an already-settled stream.\n }\n }\n },\n turnStartedAt: executionStartedAt,\n });\n\n return createUIMessageStreamResponse({ stream: turnStream });\n };\n};\n","import {\n createSurveyAssistantThreadInputSchema,\n updateSurveyAssistantThreadInputSchema,\n type SurveyAssistantThread,\n} from \"../protocol\";\nimport { readSurveyAssistantRequestJson, SurveyAssistantRequestError } from \"./request-guardrails\";\n\nconst DEFAULT_TITLE = \"New chat\";\nconst MAX_THREAD_MUTATION_BYTES = 16 * 1024;\nconst MANUAL_TITLE_METADATA_KEY = \"surveyAssistant.manualTitle\";\nconst AUTOMATIC_TITLE_METADATA_KEY = \"surveyAssistant.automaticTitle\";\n\nexport interface SurveyAssistantThreadIdentity {\n resourceId: string;\n metadata: Record<string, string>;\n}\n\nexport interface CreateSurveyAssistantThreadHandlersOptions {\n authorize(\n request: Request,\n ): SurveyAssistantThreadIdentity | Promise<SurveyAssistantThreadIdentity>;\n repository: SurveyAssistantThreadRepository;\n}\n\nexport interface SurveyAssistantStoredThread {\n id: string;\n title?: string;\n resourceId: string;\n createdAt: Date;\n updatedAt: Date;\n metadata?: Record<string, unknown>;\n}\n\nexport interface SurveyAssistantThreadRepository {\n create(input: {\n resourceId: string;\n title: string;\n metadata: Record<string, unknown>;\n }): Promise<SurveyAssistantStoredThread>;\n get(threadId: string): Promise<SurveyAssistantStoredThread | null>;\n list(\n resourceId: string,\n metadata: Record<string, string>,\n ): Promise<SurveyAssistantStoredThread[]>;\n readMessages(threadId: string, resourceId: string): Promise<unknown[]>;\n delete(threadId: string): Promise<void>;\n update(input: {\n id: string;\n title: string;\n metadata: Record<string, unknown>;\n }): Promise<SurveyAssistantStoredThread>;\n}\n\nconst getMetadataString = (metadata: Record<string, unknown> | undefined, key: string) => {\n const value = metadata?.[key];\n return typeof value === \"string\" && value.trim() ? value.trim() : undefined;\n};\n\nconst getRawTitle = (thread: SurveyAssistantStoredThread) => thread.title?.trim() || DEFAULT_TITLE;\n\nconst getAutomaticTitle = (thread: SurveyAssistantStoredThread, manualTitle: string): string => {\n const rawTitle = thread.title?.trim();\n if (rawTitle && rawTitle !== manualTitle) return rawTitle;\n return getMetadataString(thread.metadata, AUTOMATIC_TITLE_METADATA_KEY) ?? DEFAULT_TITLE;\n};\n\nconst asThread = (thread: SurveyAssistantStoredThread): SurveyAssistantThread => {\n const manualTitle = getMetadataString(thread.metadata, MANUAL_TITLE_METADATA_KEY);\n\n return {\n id: thread.id,\n title: manualTitle ?? getRawTitle(thread),\n titleMode: manualTitle ? \"manual\" : \"automatic\",\n createdAt: thread.createdAt.toISOString(),\n updatedAt: thread.updatedAt.toISOString(),\n };\n};\n\nconst json = (body: unknown, status = 200) => Response.json(body, { status });\n\nconst errorResponse = (error: unknown) => {\n const status =\n typeof error === \"object\" &&\n error !== null &&\n \"status\" in error &&\n typeof error.status === \"number\"\n ? error.status\n : error instanceof SurveyAssistantRequestError ||\n error instanceof SyntaxError ||\n (error instanceof Error && error.name === \"ZodError\")\n ? 400\n : 500;\n const message =\n error instanceof SurveyAssistantRequestError\n ? error.message\n : status === 401 || status === 403 || status === 404\n ? status === 404\n ? \"Chat not found.\"\n : \"The chat request is not authorized.\"\n : status >= 500\n ? \"The chat request could not be completed.\"\n : \"The chat request is invalid.\";\n return json(\n {\n code:\n status === 401 || status === 403 || status === 404\n ? \"authorization_failed\"\n : \"request_failed\",\n error: message,\n },\n status,\n );\n};\n\nconst ownsThread = (thread: SurveyAssistantStoredThread, identity: SurveyAssistantThreadIdentity) =>\n thread.resourceId === identity.resourceId &&\n Object.entries(identity.metadata).every(([key, value]) => thread.metadata?.[key] === value);\n\nconst getOwnedThread = async (\n repository: SurveyAssistantThreadRepository,\n identity: SurveyAssistantThreadIdentity,\n threadId: string,\n) => {\n const thread = await repository.get(threadId);\n return thread && ownsThread(thread, identity) ? thread : null;\n};\n\nexport const createSurveyAssistantThreadHandlers = ({\n authorize,\n repository,\n}: CreateSurveyAssistantThreadHandlersOptions) => {\n const list = async (request: Request) => {\n try {\n const identity = await authorize(request);\n const storedThreads = await repository.list(identity.resourceId, identity.metadata);\n const threads = storedThreads\n .filter(\n (thread) =>\n ownsThread(thread, identity) && typeof thread.metadata?.archivedAt !== \"string\",\n )\n .map(asThread);\n return json({ threads });\n } catch (error) {\n return errorResponse(error);\n }\n };\n\n const create = async (request: Request) => {\n try {\n const [identity, input] = await Promise.all([\n authorize(request),\n readSurveyAssistantRequestJson(request, MAX_THREAD_MUTATION_BYTES),\n ]);\n const parsed = createSurveyAssistantThreadInputSchema.parse(input);\n const metadata = { ...identity.metadata };\n if (parsed.title) {\n metadata[MANUAL_TITLE_METADATA_KEY] = parsed.title;\n metadata[AUTOMATIC_TITLE_METADATA_KEY] = DEFAULT_TITLE;\n }\n const thread = await repository.create({\n resourceId: identity.resourceId,\n title: parsed.title ?? DEFAULT_TITLE,\n metadata,\n });\n return json({ thread: asThread(thread) }, 201);\n } catch (error) {\n return errorResponse(error);\n }\n };\n\n const read = async (request: Request, threadId: string) => {\n try {\n const identity = await authorize(request);\n const thread = await getOwnedThread(repository, identity, threadId);\n if (!thread || typeof thread.metadata?.archivedAt === \"string\") {\n return json({ error: \"Chat not found.\" }, 404);\n }\n return json({\n thread: asThread(thread),\n messages: await repository.readMessages(threadId, identity.resourceId),\n });\n } catch (error) {\n return errorResponse(error);\n }\n };\n\n const update = async (request: Request, threadId: string) => {\n try {\n const [identity, input] = await Promise.all([\n authorize(request),\n readSurveyAssistantRequestJson(request, MAX_THREAD_MUTATION_BYTES),\n ]);\n const thread = await getOwnedThread(repository, identity, threadId);\n if (!thread || typeof thread.metadata?.archivedAt === \"string\") {\n return json({ error: \"Chat not found.\" }, 404);\n }\n const parsed = updateSurveyAssistantThreadInputSchema.parse(input);\n const metadata = { ...(thread.metadata ?? identity.metadata) };\n let title: string;\n\n if (parsed.mode === \"automatic\") {\n const manualTitle = getMetadataString(metadata, MANUAL_TITLE_METADATA_KEY);\n title =\n parsed.title ??\n (manualTitle ? getAutomaticTitle(thread, manualTitle) : getRawTitle(thread));\n metadata[MANUAL_TITLE_METADATA_KEY] = null;\n metadata[AUTOMATIC_TITLE_METADATA_KEY] = null;\n } else {\n const previousManualTitle = getMetadataString(metadata, MANUAL_TITLE_METADATA_KEY);\n const automaticTitle = previousManualTitle\n ? getAutomaticTitle(thread, previousManualTitle)\n : getRawTitle(thread);\n title = parsed.title;\n metadata[MANUAL_TITLE_METADATA_KEY] = title;\n metadata[AUTOMATIC_TITLE_METADATA_KEY] = automaticTitle;\n }\n\n const updated = await repository.update({\n id: thread.id,\n title,\n metadata,\n });\n return json({ thread: asThread(updated) });\n } catch (error) {\n return errorResponse(error);\n }\n };\n\n const deleteThread = async (request: Request, threadId: string) => {\n try {\n const identity = await authorize(request);\n const thread = await getOwnedThread(repository, identity, threadId);\n if (!thread) return json({ error: \"Chat not found.\" }, 404);\n await repository.delete(thread.id);\n return new Response(null, { status: 204 });\n } catch (error) {\n return errorResponse(error);\n }\n };\n\n return { create, delete: deleteThread, list, read, update };\n};\n","import { toAISdkMessages } from \"@mastra/ai-sdk/ui\";\nimport type { MastraMemory } from \"@mastra/core/memory\";\nimport type { SurveyAssistantThreadDocumentRepository } from \"./thread-documents\";\nimport type { SurveyAssistantThreadRepository } from \"./thread-handlers\";\n\ntype ThreadMemory = Pick<\n MastraMemory,\n \"createThread\" | \"deleteThread\" | \"getThreadById\" | \"listThreads\" | \"recall\" | \"updateThread\"\n>;\n\nexport interface CreateMastraMemoryThreadRepositoryOptions {\n getMemory(): ThreadMemory | Promise<ThreadMemory>;\n /** Maximum recent messages returned when hydrating a transcript. */\n maxMessagesPerTranscript?: number;\n /** Maximum recent threads returned by the history endpoint. */\n maxThreadsPerList?: number;\n threadDocuments?: SurveyAssistantThreadDocumentRepository;\n}\n\nexport const createMastraMemoryThreadRepository = ({\n getMemory,\n maxMessagesPerTranscript = 1_000,\n maxThreadsPerList = 100,\n threadDocuments,\n}: CreateMastraMemoryThreadRepositoryOptions): SurveyAssistantThreadRepository => ({\n async create({ metadata, resourceId, title }) {\n return (await getMemory()).createThread({ metadata, resourceId, title, saveThread: true });\n },\n async get(threadId) {\n return (await getMemory()).getThreadById({ threadId });\n },\n async list(resourceId, metadata) {\n const result = await (\n await getMemory()\n ).listThreads({\n filter: { metadata, resourceId },\n orderBy: { field: \"updatedAt\", direction: \"DESC\" },\n perPage: Math.max(1, Math.min(1_000, maxThreadsPerList)),\n });\n return result.threads;\n },\n async readMessages(threadId, resourceId) {\n const result = await (\n await getMemory()\n ).recall({\n threadId,\n resourceId,\n perPage: Math.max(1, Math.min(5_000, maxMessagesPerTranscript)),\n orderBy: { field: \"createdAt\", direction: \"DESC\" },\n });\n return toAISdkMessages([...result.messages].reverse(), { version: \"v6\" });\n },\n async delete(threadId) {\n const memory = await getMemory();\n const thread = await memory.getThreadById({ threadId });\n if (thread && threadDocuments) {\n await threadDocuments.deleteThread({ resourceId: thread.resourceId, threadId });\n }\n await memory.deleteThread(threadId);\n },\n async update({ id, metadata, title }) {\n return (await getMemory()).updateThread({ id, metadata, title });\n },\n});\n"],"mappings":";;;;;;;;;;;AAkBA,MAAM,kBAAuE;CAC3E,kBAAkB;CAClB,MAAM;CACN,gBAAgB;CACjB;AAED,MAAa,6CACX,SACG,gBAAgB;AAErB,MAAa,2CAA2C,UACtD,MAAM,SAAS,WACf,MAAM,SAAS,gBACf,MAAM,SAAS,YACf,MAAM,SAAS,iBACf,MAAM,SAAS,WACf,MAAM,SAAS;AAEjB,MAAa,yCAAyC,EACpD,wBACA,eACA,eACA,oBAC6E;CAC7E,MAAM,oBAAoB,IAAI,iBAAiB;CAC/C,IAAI;CACJ,IAAI;CACJ,IAAI,cAA0D;CAE9D,MAAM,cAAc,UAAyC;AAC3D,MAAI,OAAO,UAAU,YAAY,WAAW,MAAO,OAAM,OAAO;;CAGlE,MAAM,2BAA2B;AAC/B,MAAI,kBAAkB,KAAA,EAAW,cAAa,cAAc;AAC5D,kBAAgB,KAAA;;CAElB,MAAM,gBAAgB;AACpB,sBAAoB;AACpB,MAAI,iBAAiB,KAAA,EAAW,cAAa,aAAa;AAC1D,iBAAe,KAAA;;CAEjB,MAAM,mBAAmB,SAA8C;AACrE,MAAI,kBAAkB,OAAO,WAAW,cAAc,QAAS;AAC/D,gBAAc;AACd,WAAS;AACT,oBAAkB,MAChB,IAAI,aAAa,0CAA0C,KAAK,EAAE,eAAe,CAClF;;CAEH,MAAM,2BACJ,YACA,SACG;AACH,sBAAoB;AACpB,kBAAgB,iBAAiB,gBAAgB,KAAK,EAAE,WAAW;AACnE,aAAW,cAAc;;AAG3B,KAAI,CAAC,cAAc,SAAS;AAC1B,iBAAe,iBAAiB,gBAAgB,eAAe,EAAE,cAAc;AAC/E,aAAW,aAAa;AACxB,0BAAwB,wBAAwB,iBAAiB;;CAGnE,MAAM,SAAS,YAAY,IAAI,CAAC,eAAe,kBAAkB,OAAO,CAAC;AAEzE,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UAAQ,MAAM,WAAW,EAAE,aAAa;GAAE;GAAU;GAAY;GAAO,YAAY;GAAM,CAAC;;CAE5F,MAAM,IAAI,UAAU;AAClB,UAAQ,MAAM,WAAW,EAAE,cAAc,EAAE,UAAU,CAAC;;CAExD,MAAM,KAAK,YAAY,UAAU;AAQ/B,UAAO,OANL,MAAM,WAAW,EACjB,YAAY;GACZ,QAAQ;IAAE;IAAU;IAAY;GAChC,SAAS;IAAE,OAAO;IAAa,WAAW;IAAQ;GAClD,SAAS,KAAK,IAAI,GAAG,KAAK,IAAI,KAAO,kBAAkB,CAAC;GACzD,CAAC,EACY;;CAEhB,MAAM,aAAa,UAAU,YAAY;AASvC,SAAO,gBAAgB,CAAC,IAAG,OAPzB,MAAM,WAAW,EACjB,OAAO;GACP;GACA;GACA,SAAS,KAAK,IAAI,GAAG,KAAK,IAAI,KAAO,yBAAyB,CAAC;GAC/D,SAAS;IAAE,OAAO;IAAa,WAAW;IAAQ;GACnD,CAAC,EACgC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,MAAM,CAAC;;CAE3E,MAAM,OAAO,UAAU;EACrB,MAAM,SAAS,MAAM,WAAW;EAChC,MAAM,SAAS,MAAM,OAAO,cAAc,EAAE,UAAU,CAAC;AACvD,MAAI,UAAU,gBACZ,OAAM,gBAAgB,aAAa;GAAE,YAAY,OAAO;GAAY;GAAU,CAAC;AAEjF,QAAM,OAAO,aAAa,SAAS;;CAErC,MAAM,OAAO,EAAE,IAAI,UAAU,SAAS;AACpC,UAAQ,MAAM,WAAW,EAAE,aAAa;GAAE;GAAI;GAAU;GAAO,CAAC;;CAEnE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-DATvkr1S.mjs","names":[],"sources":["../src/protocol/errors.ts","../src/protocol/content.ts","../src/protocol/operations.ts","../src/protocol/capabilities.ts","../src/protocol/document.ts","../src/protocol/threads.ts","../src/protocol/tasks.ts","../src/protocol/models.ts","../src/protocol/lifecycle.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const surveyAssistantErrorCodeSchema = z.enum([\n \"attachment_unavailable\",\n \"authorization_failed\",\n \"model_unavailable\",\n \"rate_limited\",\n \"request_failed\",\n]);\n\nexport type SurveyAssistantErrorCode = z.infer<typeof surveyAssistantErrorCodeSchema>;\n\nexport const surveyAssistantErrorInfoSchema = z.object({\n code: surveyAssistantErrorCodeSchema,\n detail: z.string().optional(),\n});\n\nexport type SurveyAssistantErrorInfo = z.infer<typeof surveyAssistantErrorInfoSchema>;\n\nconst ERROR_PREFIX = \"case-survey-assistant-error:\";\n\nexport const serializeSurveyAssistantError = (error: SurveyAssistantErrorInfo): string =>\n `${ERROR_PREFIX}${JSON.stringify(surveyAssistantErrorInfoSchema.parse(error))}`;\n\nexport const parseSurveyAssistantError = (value: unknown): SurveyAssistantErrorInfo => {\n if (typeof value === \"object\" && value !== null && \"code\" in value) {\n const parsed = surveyAssistantErrorInfoSchema.safeParse({\n code: value.code,\n detail:\n \"detail\" in value && typeof value.detail === \"string\"\n ? value.detail\n : \"message\" in value && typeof value.message === \"string\"\n ? value.message\n : undefined,\n });\n if (parsed.success) return parsed.data;\n }\n\n const message =\n value instanceof Error\n ? value.message\n : typeof value === \"string\"\n ? value\n : typeof value === \"object\" && value !== null && \"message\" in value\n ? String(value.message)\n : \"\";\n\n if (message.startsWith(ERROR_PREFIX)) {\n try {\n const parsed = surveyAssistantErrorInfoSchema.safeParse(\n JSON.parse(message.slice(ERROR_PREFIX.length)),\n );\n if (parsed.success) return parsed.data;\n } catch {\n // Fall through to the stable generic category.\n }\n }\n\n return {\n code: \"request_failed\",\n ...(message.trim() ? { detail: message.trim() } : {}),\n };\n};\n","import { z } from \"zod\";\nimport type { Content, JsonValue as CoreJsonValue } from \"@case-framework/survey-core\";\n\nexport const jsonValueSchema: z.ZodType<CoreJsonValue> = z.lazy(() =>\n z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(jsonValueSchema),\n z.record(z.string(), jsonValueSchema),\n ]),\n);\n\nconst contentAttributesSchema = z.record(z.string(), jsonValueSchema);\n\nconst richTextStyleSchema = z.object({\n weight: z.enum([\"strong\", \"normal\"]).optional(),\n italic: z.enum([\"italic\", \"normal\"]).optional(),\n underline: z.enum([\"underline\", \"none\"]).optional(),\n color: z.enum([\"primary\", \"accent\", \"default\"]).optional(),\n});\n\nconst richTextTextInlineSchema = z.object({\n type: z.literal(\"text\"),\n text: z.string().max(20_000),\n style: richTextStyleSchema.optional(),\n attrs: contentAttributesSchema.optional(),\n});\n\nconst richTextTemplateInlineSchema = z.object({\n type: z.literal(\"template\"),\n key: z.string().min(1).max(240),\n style: richTextStyleSchema.optional(),\n attrs: contentAttributesSchema.optional(),\n});\n\nconst richTextLineBreakInlineSchema = z.object({\n type: z.literal(\"lineBreak\"),\n attrs: contentAttributesSchema.optional(),\n});\n\nconst richTextLinkChildInlineSchema = z.discriminatedUnion(\"type\", [\n richTextTextInlineSchema,\n richTextTemplateInlineSchema,\n richTextLineBreakInlineSchema,\n]);\n\nconst richTextLinkInlineSchema = z.object({\n type: z.literal(\"link\"),\n href: z.string().min(1).max(2000),\n target: z.string().max(120).nullable().optional(),\n rel: z.string().max(240).nullable().optional(),\n title: z.string().max(1000).nullable().optional(),\n attrs: contentAttributesSchema.optional(),\n children: z.array(richTextLinkChildInlineSchema).max(200),\n});\n\nconst richTextInlineExtensionSchema = z.object({\n type: z.literal(\"inlineExtension\"),\n name: z.string().min(1).max(120),\n attrs: contentAttributesSchema.optional(),\n});\n\nconst richTextInlineSchema = z.discriminatedUnion(\"type\", [\n richTextTextInlineSchema,\n richTextTemplateInlineSchema,\n richTextLinkInlineSchema,\n richTextLineBreakInlineSchema,\n richTextInlineExtensionSchema,\n]);\n\nconst textAlignmentSchema = z.enum([\"left\", \"center\", \"right\", \"justify\"]);\n\nconst richTextParagraphBlockSchema = z.object({\n type: z.literal(\"paragraph\"),\n children: z.array(richTextInlineSchema).max(500),\n alignment: textAlignmentSchema.optional(),\n attrs: contentAttributesSchema.optional(),\n});\n\nconst richTextHeadingBlockSchema = z.object({\n type: z.literal(\"heading\"),\n level: z.union([z.literal(1), z.literal(2)]),\n children: z.array(richTextInlineSchema).max(500),\n alignment: textAlignmentSchema.optional(),\n attrs: contentAttributesSchema.optional(),\n});\n\nconst richTextListItemBlockSchema = z.object({\n type: z.literal(\"listItem\"),\n children: z.array(richTextParagraphBlockSchema).max(100),\n attrs: contentAttributesSchema.optional(),\n});\n\nconst richTextBulletListBlockSchema = z.object({\n type: z.literal(\"bulletList\"),\n items: z.array(richTextListItemBlockSchema).max(100),\n attrs: contentAttributesSchema.optional(),\n});\n\nconst richTextImageDimensionSchema = z.union([\n z.object({ unit: z.literal(\"px\"), value: z.number().finite().nonnegative() }),\n z.object({ unit: z.literal(\"%\"), value: z.number().finite().nonnegative() }),\n]);\n\nconst richTextImageSourceSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"asset\"), assetId: z.string().min(1).max(240) }),\n z.object({ type: z.literal(\"external\"), url: z.string().min(1).max(2000) }),\n]);\n\nconst richTextImageBlockSchema = z.object({\n type: z.literal(\"image\"),\n source: richTextImageSourceSchema,\n alt: z.string().max(2000).optional(),\n caption: z.array(richTextParagraphBlockSchema).max(20).optional(),\n size: z\n .object({\n width: richTextImageDimensionSchema.optional(),\n height: richTextImageDimensionSchema.optional(),\n maxWidth: richTextImageDimensionSchema.optional(),\n maxHeight: richTextImageDimensionSchema.optional(),\n })\n .optional(),\n alignment: textAlignmentSchema.optional(),\n attrs: contentAttributesSchema.optional(),\n});\n\nconst richTextInfoBoxBlockSchema = z.object({\n type: z.literal(\"infoBox\"),\n tone: z.enum([\"info\", \"warning\"]).optional(),\n title: z.array(richTextInlineSchema).max(100).optional(),\n collapsible: z.boolean().optional(),\n defaultOpen: z.boolean().optional(),\n children: z.array(richTextParagraphBlockSchema).max(100),\n attrs: contentAttributesSchema.optional(),\n});\n\nconst richTextSeparatorBlockSchema = z.object({\n type: z.literal(\"separator\"),\n attrs: contentAttributesSchema.optional(),\n});\n\nconst richTextBlockExtensionSchema = z.object({\n type: z.literal(\"blockExtension\"),\n name: z.string().min(1).max(120),\n attrs: contentAttributesSchema.optional(),\n});\n\nconst richTextBlockSchema = z.discriminatedUnion(\"type\", [\n richTextParagraphBlockSchema,\n richTextHeadingBlockSchema,\n richTextBulletListBlockSchema,\n richTextImageBlockSchema,\n richTextInfoBoxBlockSchema,\n richTextSeparatorBlockSchema,\n richTextBlockExtensionSchema,\n]);\n\nexport const surveyContentSchema: z.ZodType<Content> = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"md\"), content: z.string().max(20_000) }),\n z.object({ type: z.literal(\"plain\"), content: z.string().max(20_000) }),\n z.object({\n type: z.literal(\"richText\"),\n version: z.literal(1),\n doc: z.object({\n type: z.literal(\"doc\"),\n blocks: z.array(richTextBlockSchema).max(200),\n }),\n }),\n]) as z.ZodType<Content>;\n\nexport type SurveyContent = z.infer<typeof surveyContentSchema>;\nexport type JsonValue = z.infer<typeof jsonValueSchema>;\n","import { z } from \"zod\";\nimport type {\n JsonPatchOperation as CoreJsonPatchOperation,\n RawSurveyAsset,\n RawSurveyItem,\n RichTextImageDimension,\n SurveyContentImageSource,\n} from \"@case-framework/survey-core\";\nimport { SURVEY_EDITOR_ITEM_COLORS } from \"@case-framework/survey-core/editor/colors\";\nimport { jsonValueSchema, surveyContentSchema, type SurveyContent } from \"./content\";\n\ninterface OperationBase {\n id?: string;\n}\n\ninterface ItemTranslation {\n locale: string;\n contentKey: string;\n plainText?: string;\n content?: SurveyContent;\n}\n\ninterface CreateItemOperation extends OperationBase {\n kind: \"create-item\";\n target: { parentItemId: string; index?: number };\n item: Omit<RawSurveyItem, \"id\"> & { id?: string };\n translations?: ItemTranslation[];\n}\n\ninterface UpdateItemKeyOperation extends OperationBase {\n kind: \"update-item-key\";\n itemId: string;\n key: string;\n}\n\ninterface UpdateItemLabelOperation extends OperationBase {\n kind: \"update-item-label\";\n itemId: string;\n itemLabel: string;\n}\n\ntype ItemColor = (typeof SURVEY_EDITOR_ITEM_COLORS)[number];\n\ninterface UpdateItemColorOperation extends OperationBase {\n kind: \"update-item-color\";\n itemId: string;\n color: ItemColor;\n}\n\ninterface UpdateItemTranslationOperation extends OperationBase, ItemTranslation {\n kind: \"update-item-translation\";\n itemId: string;\n}\n\ninterface UpdatePlacedImageOperation extends OperationBase {\n kind: \"update-placed-image\";\n itemId: string;\n locale: string;\n contentKey: string;\n /** Zero-based index among image blocks in this rich-text content value. */\n imageIndex: number;\n /** Optional guard that prevents editing a different image after content changed. */\n expectedAssetId?: string;\n changes: {\n source?: SurveyContentImageSource;\n alt?: string | null;\n caption?: string | null;\n width?: RichTextImageDimension | null;\n height?: RichTextImageDimension | null;\n maxWidth?: RichTextImageDimension | null;\n maxHeight?: RichTextImageDimension | null;\n alignment?: \"left\" | \"center\" | \"right\" | null;\n };\n}\n\ninterface PatchItemConfigOperation extends OperationBase {\n kind: \"patch-item-config\";\n itemId: string;\n /** JSON Patch paths are relative to the item's config root. */\n patches: CoreJsonPatchOperation[];\n}\n\ninterface FormTarget {\n itemId: string;\n /** When present, target the inline embedded form on this choice option. */\n optionId?: string;\n}\n\ninterface UpsertFormFieldGroupOperation extends OperationBase {\n kind: \"upsert-form-field-group\";\n target: FormTarget;\n index?: number;\n group: Record<string, unknown> & { id: string };\n translations?: ItemTranslation[];\n}\n\ninterface RemoveFormFieldGroupOperation extends OperationBase {\n kind: \"remove-form-field-group\";\n target: FormTarget;\n groupId: string;\n}\n\ninterface ReorderFormFieldGroupsOperation extends OperationBase {\n kind: \"reorder-form-field-groups\";\n target: FormTarget;\n groupIds: string[];\n}\n\ninterface UpsertFormFieldOperation extends OperationBase {\n kind: \"upsert-form-field\";\n target: FormTarget;\n groupId: string;\n index?: number;\n field: Record<string, unknown> & { id: string; key: string; type: string };\n translations?: ItemTranslation[];\n}\n\ninterface RemoveFormFieldOperation extends OperationBase {\n kind: \"remove-form-field\";\n target: FormTarget;\n fieldId: string;\n}\n\ninterface MoveFormFieldOperation extends OperationBase {\n kind: \"move-form-field\";\n target: FormTarget;\n fieldId: string;\n targetGroupId: string;\n index?: number;\n}\n\ninterface SetEmbeddedFormOperation extends OperationBase {\n kind: \"set-embedded-form\";\n itemId: string;\n optionId: string;\n form: Record<string, unknown> & { id: string; fieldGroups: unknown[] };\n translations?: ItemTranslation[];\n}\n\ninterface RemoveEmbeddedFormOperation extends OperationBase {\n kind: \"remove-embedded-form\";\n itemId: string;\n optionId: string;\n}\n\ninterface ChoiceOptionInput {\n id?: string;\n key?: string;\n label: string;\n}\n\ninterface AddChoiceOptionOperation extends OperationBase {\n kind: \"add-choice-option\";\n itemId: string;\n locale?: string;\n index?: number;\n option: ChoiceOptionInput;\n}\n\ninterface UpdateChoiceOptionLabelOperation extends OperationBase {\n kind: \"update-choice-option-label\";\n itemId: string;\n optionId: string;\n locale?: string;\n label: string;\n}\n\ninterface RemoveChoiceOptionOperation extends OperationBase {\n kind: \"remove-choice-option\";\n itemId: string;\n optionId: string;\n}\n\ninterface ReorderChoiceOptionsOperation extends OperationBase {\n kind: \"reorder-choice-options\";\n itemId: string;\n optionIds: string[];\n}\n\ninterface RemoveItemOperation extends OperationBase {\n kind: \"remove-item\";\n itemId: string;\n includeChildren?: boolean;\n}\n\ninterface MoveItemOperation extends OperationBase {\n kind: \"move-item\";\n itemId: string;\n target: { parentItemId: string; index?: number };\n}\n\ninterface ReorderItemsOperation extends OperationBase {\n kind: \"reorder-items\";\n parentItemId: string;\n itemIds: string[];\n}\n\ninterface UpdateSurveyMetadataOperation extends OperationBase {\n kind: \"update-survey-metadata\";\n values: Record<string, string | null>;\n}\n\ninterface UpdateSurveyPaginationOperation extends OperationBase {\n kind: \"update-survey-pagination\";\n value: { large: number; small: number } | null;\n}\n\ninterface UpdateSurveyTranslationOperation\n extends OperationBase, Omit<ItemTranslation, \"contentKey\"> {\n kind: \"update-survey-translation\";\n surface: \"surveyCardContent\" | \"navigationContent\" | \"validationMessages\";\n contentKey: string;\n}\n\ninterface AddSurveyLocaleOperation extends OperationBase {\n kind: \"add-survey-locale\";\n locale: string;\n}\n\ninterface RemoveSurveyLocaleOperation extends OperationBase {\n kind: \"remove-survey-locale\";\n locale: string;\n}\n\ninterface SetImageAssetOperation extends OperationBase {\n kind: \"set-image-asset\";\n assetId: string;\n asset: RawSurveyAsset;\n}\n\ninterface UpdateImageAssetMetadataOperation extends OperationBase {\n kind: \"update-image-asset-metadata\";\n assetId: string;\n metadata: {\n name?: string | null;\n filename?: string | null;\n alt?: string | null;\n width?: number | null;\n height?: number | null;\n };\n}\n\ninterface RemoveImageAssetOperation extends OperationBase {\n kind: \"remove-image-asset\";\n assetId: string;\n}\n\ninterface SurveyPatchOperation extends OperationBase {\n kind: \"survey-json-patch\";\n patches: CoreJsonPatchOperation[];\n}\n\ntype SurveyOperationShape =\n | CreateItemOperation\n | UpdateItemKeyOperation\n | UpdateItemLabelOperation\n | UpdateItemColorOperation\n | UpdateItemTranslationOperation\n | UpdatePlacedImageOperation\n | PatchItemConfigOperation\n | UpsertFormFieldGroupOperation\n | RemoveFormFieldGroupOperation\n | ReorderFormFieldGroupsOperation\n | UpsertFormFieldOperation\n | RemoveFormFieldOperation\n | MoveFormFieldOperation\n | SetEmbeddedFormOperation\n | RemoveEmbeddedFormOperation\n | AddChoiceOptionOperation\n | UpdateChoiceOptionLabelOperation\n | RemoveChoiceOptionOperation\n | ReorderChoiceOptionsOperation\n | RemoveItemOperation\n | MoveItemOperation\n | ReorderItemsOperation\n | UpdateSurveyMetadataOperation\n | UpdateSurveyPaginationOperation\n | UpdateSurveyTranslationOperation\n | AddSurveyLocaleOperation\n | RemoveSurveyLocaleOperation\n | SetImageAssetOperation\n | UpdateImageAssetMetadataOperation\n | RemoveImageAssetOperation\n | SurveyPatchOperation;\n\nexport type SurveyOperationKind = SurveyOperationShape[\"kind\"];\n\ninterface SurveyValidationIssueShape {\n severity: \"error\" | \"warning\";\n code: string;\n message: string;\n operationIndex?: number;\n operationId?: string;\n itemId?: string;\n}\n\ninterface SurveyValidationResultShape {\n valid: boolean;\n issues: SurveyValidationIssueShape[];\n warnings: SurveyValidationIssueShape[];\n normalizedOperations: SurveyOperationShape[];\n}\n\nconst operationIdSchema = z\n .string()\n .min(1)\n .max(120)\n .optional()\n .describe(\"Optional client/model supplied id for correlating validation issues.\");\nconst itemIdentifierSchema = z\n .string()\n .min(1)\n .max(240)\n .describe(\"Survey item id, key, or fullKey.\");\nconst itemKeySchema = z\n .string()\n .min(1)\n .max(120)\n .describe(\"New item key. It must be unique among siblings.\");\n\nconst itemTranslationSchema = z\n .object({\n locale: z.string().min(1).max(40),\n contentKey: z\n .string()\n .min(1)\n .max(240)\n .describe('Item translation content key, for example \"label\" or \"content\".'),\n plainText: z\n .string()\n .max(20_000)\n .optional()\n .describe(\"Simple text content to persist for the translation key.\"),\n content: surveyContentSchema\n .optional()\n .describe(\n 'Structured survey content to persist for the translation key. Use { \"type\": \"richText\", \"version\": 1, \"doc\": ... } for formatted text.',\n ),\n })\n .refine(\n (translation) => translation.plainText !== undefined || translation.content !== undefined,\n {\n message: \"Provide either plainText or content for a translation.\",\n },\n );\n\nconst choiceOptionInputSchema = z.object({\n id: z\n .string()\n .min(1)\n .max(120)\n .optional()\n .describe(\"Optional stable option id. If omitted, the validator derives a unique id.\"),\n key: z\n .string()\n .min(1)\n .max(120)\n .optional()\n .describe(\"Optional coding key. If omitted, the validator derives a unique key.\"),\n label: z\n .string()\n .min(1)\n .max(1000)\n .describe(\n \"Respondent-visible option label as a plain string. Do not pass a translation object here; add-choice-option creates the matching translation in its locale.\",\n ),\n});\n\nconst rawSurveyItemForCreateSchema = z\n .object({\n id: z.string().min(1).max(120).optional(),\n key: itemKeySchema,\n itemType: z.string().min(1).max(120),\n metadata: z.record(z.string(), z.string()).optional(),\n config: z\n .unknown()\n .optional()\n .describe(\n 'Optional item-type config. For choiceItem, provide response options as config.options, for example [{ \"label\": \"Fuji\" }, { \"label\": \"Gala\" }]. Use config.maxSelection: 1 for single choice, null for unlimited multiple choice / select-all-that-apply, or a number greater than 1 for capped multiple choice. Put an inline embeddedForm directly on a new choice option; default an eligible one-field embeddedForm to authoringMode \"simple\" and use \"custom\" for blank or structured follow-ups. For formItem, use authoringMode \"simple\" only with one field group containing one field; use \"custom\" for blank or multi-field forms. The validator converts option labels into options.<optionId>.label translations.',\n ),\n validations: z.record(z.string(), z.any()).optional(),\n displayConditions: z.any().optional(),\n disabledConditions: z.any().optional(),\n prefills: z.array(z.any()).optional(),\n })\n .passthrough();\n\nconst jsonPointerPathSchema = z\n .string()\n .max(500)\n .describe(\n 'JSON Pointer path into the survey document, for example \"/surveyItems/1/config/options/0/key\" or \"/translations/en/itemTranslations/<itemId>/title\".',\n );\n\nexport const jsonPatchOperationSchema: z.ZodType<CoreJsonPatchOperation> = z.discriminatedUnion(\n \"op\",\n [\n z.object({ op: z.literal(\"add\"), path: jsonPointerPathSchema, value: jsonValueSchema }),\n z.object({ op: z.literal(\"replace\"), path: jsonPointerPathSchema, value: jsonValueSchema }),\n z.object({ op: z.literal(\"test\"), path: jsonPointerPathSchema, value: jsonValueSchema }),\n z.object({ op: z.literal(\"remove\"), path: jsonPointerPathSchema }),\n z.object({ op: z.literal(\"move\"), from: jsonPointerPathSchema, path: jsonPointerPathSchema }),\n z.object({ op: z.literal(\"copy\"), from: jsonPointerPathSchema, path: jsonPointerPathSchema }),\n ],\n) as z.ZodType<CoreJsonPatchOperation>;\n\nexport const createItemOperationSchema: z.ZodType<CreateItemOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"create-item\"),\n target: z.object({\n parentItemId: z\n .string()\n .max(240)\n .describe(\n \"Parent group item id, key, or fullKey where the new item should be inserted. Use the root group id/key for top-level items.\",\n ),\n index: z.number().int().min(0).optional(),\n }),\n item: rawSurveyItemForCreateSchema,\n translations: z\n .array(itemTranslationSchema)\n .optional()\n .describe(\n 'Operation-level item translations for visible content, for example [{ \"locale\": \"en\", \"contentKey\": \"title\", \"plainText\": \"Question text\" }]. Put this property inside the create-item operation beside target and item, never beside the survey_change operations array. For formatted content, use the \"content\" field with a richText object. Form select/dropdown option labels must be translations at fields.<fieldId>.options.<optionId>.label.',\n ),\n}) as z.ZodType<CreateItemOperation>;\n\nexport const updateItemKeyOperationSchema: z.ZodType<UpdateItemKeyOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"update-item-key\"),\n itemId: itemIdentifierSchema,\n key: itemKeySchema,\n});\n\nexport const updateItemLabelOperationSchema: z.ZodType<UpdateItemLabelOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"update-item-label\"),\n itemId: itemIdentifierSchema,\n itemLabel: z.string().max(200),\n});\n\nexport const updateItemColorOperationSchema: z.ZodType<UpdateItemColorOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"update-item-color\"),\n itemId: itemIdentifierSchema,\n color: z\n .enum(SURVEY_EDITOR_ITEM_COLORS)\n .describe(\"One of the Survey Editor's supported item-color swatches.\"),\n});\n\nexport const updateItemTranslationOperationSchema: z.ZodType<UpdateItemTranslationOperation> = z\n .object({\n id: operationIdSchema,\n kind: z.literal(\"update-item-translation\"),\n itemId: itemIdentifierSchema,\n locale: z.string().min(1).max(40),\n contentKey: z\n .string()\n .min(1)\n .max(240)\n .describe('Item translation content key, for example \"label\".'),\n plainText: z\n .string()\n .max(20_000)\n .optional()\n .describe(\"Simple text content to persist for the translation key.\"),\n content: surveyContentSchema\n .optional()\n .describe(\n 'Structured survey content to persist for the translation key. Use { \"type\": \"richText\", \"version\": 1, \"doc\": ... } for formatted text.',\n ),\n })\n .refine((operation) => operation.plainText !== undefined || operation.content !== undefined, {\n message: \"Provide either plainText or content for update-item-translation.\",\n }) as z.ZodType<UpdateItemTranslationOperation>;\n\nconst placedImageDimensionSchema: z.ZodType<RichTextImageDimension> = z.union([\n z.object({ unit: z.literal(\"px\"), value: z.number().finite().nonnegative() }),\n z.object({ unit: z.literal(\"%\"), value: z.number().finite().nonnegative().max(100) }),\n]);\n\nconst placedImageSourceSchema: z.ZodType<SurveyContentImageSource> = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"asset\"), assetId: z.string().min(1).max(240) }),\n z.object({ type: z.literal(\"external\"), url: z.string().min(1).max(2000) }),\n]);\n\nexport const updatePlacedImageOperationSchema: z.ZodType<UpdatePlacedImageOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"update-placed-image\"),\n itemId: itemIdentifierSchema,\n locale: z.string().min(1).max(40),\n contentKey: z.string().min(1).max(240),\n imageIndex: z\n .number()\n .int()\n .nonnegative()\n .describe(\"Zero-based index among image blocks in the selected rich-text content value.\"),\n expectedAssetId: z.string().min(1).max(240).optional(),\n changes: z\n .object({\n source: placedImageSourceSchema.optional(),\n alt: z.string().max(2000).nullable().optional(),\n caption: z.string().max(20_000).nullable().optional(),\n width: placedImageDimensionSchema.nullable().optional(),\n height: placedImageDimensionSchema.nullable().optional(),\n maxWidth: placedImageDimensionSchema.nullable().optional(),\n maxHeight: placedImageDimensionSchema.nullable().optional(),\n alignment: z.enum([\"left\", \"center\", \"right\"]).nullable().optional(),\n })\n .refine((changes) => Object.values(changes).some((value) => value !== undefined), {\n message: \"Provide at least one placed-image property to change.\",\n }),\n});\n\nexport const patchItemConfigOperationSchema: z.ZodType<PatchItemConfigOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"patch-item-config\"),\n itemId: itemIdentifierSchema,\n patches: z\n .array(jsonPatchOperationSchema)\n .min(1)\n .max(100)\n .describe(\n 'JSON Patch operations relative to this item\\'s config root, for example [{ \"op\": \"replace\", \"path\": \"/max\", \"value\": 7 }]. Inspect the item first and do not include /surveyItems/<index>/config in these paths.',\n ),\n});\n\nconst formTargetSchema: z.ZodType<FormTarget> = z.object({\n itemId: itemIdentifierSchema,\n optionId: z\n .string()\n .min(1)\n .max(240)\n .optional()\n .describe(\"Choice option id when targeting an inline embedded form.\"),\n});\n\nconst formTranslationsSchema = z\n .array(itemTranslationSchema)\n .max(100)\n .optional()\n .describe(\n \"Translations written atomically with this form structure change. Put this property inside the form operation object, never beside the survey_change operations array. Content keys are relative to the form; embedded-form prefixes are added automatically.\",\n );\n\nconst formFieldInputSchema = z\n .object({\n id: z.string().min(1).max(120),\n key: z.string().min(1).max(120),\n type: z.enum([\"input\", \"textarea\", \"number\", \"datepicker\", \"switch\", \"select\", \"slider\"]),\n controller: z.record(z.string(), z.unknown()),\n required: z.boolean().optional(),\n validations: z.array(z.record(z.string(), z.unknown())).optional(),\n })\n .passthrough();\n\nconst formFieldGroupInputSchema = z\n .object({\n id: z.string().min(1).max(120),\n layout: z\n .object({\n base: z.number().int().min(1).max(4),\n xs: z.number().int().min(1).max(4),\n sm: z.number().int().min(1).max(4),\n md: z.number().int().min(1).max(4),\n xl: z.number().int().min(1).max(4),\n })\n .describe(\n \"Responsive column counts from 1 to 4. Use 1 at every breakpoint for a lone full-width field.\",\n )\n .optional(),\n fields: z.array(formFieldInputSchema).max(200).optional(),\n hasDisplayCondition: z.boolean().optional(),\n })\n .passthrough();\n\nexport const upsertFormFieldGroupOperationSchema: z.ZodType<UpsertFormFieldGroupOperation> =\n z.object({\n id: operationIdSchema,\n kind: z.literal(\"upsert-form-field-group\"),\n target: formTargetSchema,\n index: z.number().int().min(0).optional(),\n group: formFieldGroupInputSchema,\n translations: formTranslationsSchema,\n }) as z.ZodType<UpsertFormFieldGroupOperation>;\n\nexport const removeFormFieldGroupOperationSchema: z.ZodType<RemoveFormFieldGroupOperation> =\n z.object({\n id: operationIdSchema,\n kind: z.literal(\"remove-form-field-group\"),\n target: formTargetSchema,\n groupId: z.string().min(1).max(240),\n });\n\nexport const reorderFormFieldGroupsOperationSchema: z.ZodType<ReorderFormFieldGroupsOperation> =\n z.object({\n id: operationIdSchema,\n kind: z.literal(\"reorder-form-field-groups\"),\n target: formTargetSchema,\n groupIds: z\n .array(z.string().min(1).max(240))\n .min(1)\n .max(100)\n .describe(\n \"Complete desired order containing every existing form-field group id exactly once.\",\n ),\n });\n\nexport const upsertFormFieldOperationSchema: z.ZodType<UpsertFormFieldOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"upsert-form-field\"),\n target: formTargetSchema,\n groupId: z.string().min(1).max(240),\n index: z.number().int().min(0).optional(),\n field: formFieldInputSchema,\n translations: formTranslationsSchema,\n}) as z.ZodType<UpsertFormFieldOperation>;\n\nexport const removeFormFieldOperationSchema: z.ZodType<RemoveFormFieldOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"remove-form-field\"),\n target: formTargetSchema,\n fieldId: z.string().min(1).max(240),\n});\n\nexport const moveFormFieldOperationSchema: z.ZodType<MoveFormFieldOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"move-form-field\"),\n target: formTargetSchema,\n fieldId: z.string().min(1).max(240),\n targetGroupId: z.string().min(1).max(240),\n index: z.number().int().min(0).optional(),\n});\n\nexport const setEmbeddedFormOperationSchema: z.ZodType<SetEmbeddedFormOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"set-embedded-form\"),\n itemId: itemIdentifierSchema,\n optionId: z.string().min(1).max(240),\n form: z\n .object({\n id: z.string().min(1).max(120),\n authoringMode: z\n .enum([\"simple\", \"custom\"])\n .optional()\n .describe(\n 'Use \"simple\" only for exactly one field group containing exactly one field; omitted or malformed simple mode normalizes to \"custom\".',\n ),\n fieldGroups: z.array(formFieldGroupInputSchema).max(100),\n })\n .passthrough(),\n translations: formTranslationsSchema,\n}) as z.ZodType<SetEmbeddedFormOperation>;\n\nexport const removeEmbeddedFormOperationSchema: z.ZodType<RemoveEmbeddedFormOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"remove-embedded-form\"),\n itemId: itemIdentifierSchema,\n optionId: z.string().min(1).max(240),\n});\n\nexport const addChoiceOptionOperationSchema: z.ZodType<AddChoiceOptionOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"add-choice-option\"),\n itemId: itemIdentifierSchema,\n locale: z.string().min(1).max(40).optional(),\n index: z.number().int().min(0).optional(),\n option: choiceOptionInputSchema,\n});\n\nexport const updateChoiceOptionLabelOperationSchema: z.ZodType<UpdateChoiceOptionLabelOperation> =\n z.object({\n id: operationIdSchema,\n kind: z.literal(\"update-choice-option-label\"),\n itemId: itemIdentifierSchema,\n optionId: z\n .string()\n .min(1)\n .max(240)\n .describe(\"Existing choice option id, key, or current visible label.\"),\n locale: z.string().min(1).max(40).optional(),\n label: z.string().min(1).max(1000).describe(\"New respondent-visible option label.\"),\n });\n\nexport const removeChoiceOptionOperationSchema: z.ZodType<RemoveChoiceOptionOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"remove-choice-option\"),\n itemId: itemIdentifierSchema,\n optionId: z\n .string()\n .min(1)\n .max(240)\n .describe(\"Existing choice option id, key, or current visible label.\"),\n});\n\nexport const reorderChoiceOptionsOperationSchema: z.ZodType<ReorderChoiceOptionsOperation> =\n z.object({\n id: operationIdSchema,\n kind: z.literal(\"reorder-choice-options\"),\n itemId: itemIdentifierSchema,\n optionIds: z\n .array(z.string().min(1).max(240))\n .min(1)\n .max(100)\n .describe(\n \"Complete desired order of existing choice options. Entries can be option ids, keys, or current visible labels.\",\n ),\n });\n\nexport const removeItemOperationSchema: z.ZodType<RemoveItemOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"remove-item\"),\n itemId: itemIdentifierSchema,\n includeChildren: z\n .boolean()\n .optional()\n .describe(\"Must be true when removing a group item that has children.\"),\n});\n\nexport const moveItemOperationSchema: z.ZodType<MoveItemOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"move-item\"),\n itemId: itemIdentifierSchema,\n target: z\n .object({\n parentItemId: itemIdentifierSchema,\n index: z.number().int().min(0).optional(),\n })\n .describe(\n \"A different parent group and optional insertion index. Omit unchanged placements; use reorder-items for sibling order within the current parent.\",\n ),\n});\n\nexport const reorderItemsOperationSchema: z.ZodType<ReorderItemsOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"reorder-items\"),\n parentItemId: itemIdentifierSchema,\n itemIds: z\n .array(itemIdentifierSchema)\n .min(1)\n .max(200)\n .describe(\n \"Complete desired order containing every existing direct child of the parent group exactly once.\",\n ),\n});\n\nexport const updateSurveyMetadataOperationSchema: z.ZodType<UpdateSurveyMetadataOperation> =\n z.object({\n id: operationIdSchema,\n kind: z.literal(\"update-survey-metadata\"),\n values: z.record(z.string().min(1).max(240), z.string().max(20_000).nullable()),\n });\n\nexport const updateSurveyPaginationOperationSchema: z.ZodType<UpdateSurveyPaginationOperation> =\n z.object({\n id: operationIdSchema,\n kind: z.literal(\"update-survey-pagination\"),\n value: z\n .object({\n large: z.number().int().min(1).max(1000),\n small: z.number().int().min(1).max(1000),\n })\n .nullable(),\n });\n\nexport const updateSurveyTranslationOperationSchema: z.ZodType<UpdateSurveyTranslationOperation> = z\n .object({\n id: operationIdSchema,\n kind: z.literal(\"update-survey-translation\"),\n locale: z.string().min(1).max(40),\n surface: z.enum([\"surveyCardContent\", \"navigationContent\", \"validationMessages\"]),\n contentKey: z.string().min(1).max(240),\n plainText: z.string().max(20_000).optional(),\n content: surveyContentSchema.optional(),\n })\n .refine((operation) => operation.plainText !== undefined || operation.content !== undefined, {\n message: \"Provide either plainText or content for update-survey-translation.\",\n }) as z.ZodType<UpdateSurveyTranslationOperation>;\n\nconst surveyLocaleSchema = z.string().trim().min(1).max(40);\n\nexport const addSurveyLocaleOperationSchema: z.ZodType<AddSurveyLocaleOperation> = z\n .object({\n id: operationIdSchema,\n kind: z.literal(\"add-survey-locale\"),\n locale: surveyLocaleSchema.describe(\"New, currently absent survey locale code.\"),\n })\n .describe(\"Register an empty survey locale through the editor locale-management API.\");\n\nexport const removeSurveyLocaleOperationSchema: z.ZodType<RemoveSurveyLocaleOperation> = z\n .object({\n id: operationIdSchema,\n kind: z.literal(\"remove-survey-locale\"),\n locale: surveyLocaleSchema.describe(\"Exact existing survey locale code to remove.\"),\n })\n .describe(\n \"Destructively remove a survey locale and all survey-level and item-level translations stored for it.\",\n );\n\nconst imageAssetMetadataSchema = z.object({\n name: z.string().max(500).optional(),\n filename: z.string().max(500).optional(),\n alt: z.string().max(2000).optional(),\n width: z.number().int().positive().optional(),\n height: z.number().int().positive().optional(),\n});\n\nconst rawSurveyImageAssetSchema: z.ZodType<RawSurveyAsset> = z.object({\n kind: z.literal(\"image\"),\n source: z.object({\n type: z.literal(\"embedded\"),\n mediaType: z.string().regex(/^image\\//),\n encoding: z.literal(\"base64\"),\n data: z.string().min(1).max(8_000_000),\n }),\n metadata: imageAssetMetadataSchema.optional(),\n});\n\nexport const setImageAssetOperationSchema: z.ZodType<SetImageAssetOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"set-image-asset\"),\n assetId: z.string().min(1).max(240),\n asset: rawSurveyImageAssetSchema,\n});\n\nexport const updateImageAssetMetadataOperationSchema: z.ZodType<UpdateImageAssetMetadataOperation> =\n z.object({\n id: operationIdSchema,\n kind: z.literal(\"update-image-asset-metadata\"),\n assetId: z.string().min(1).max(240),\n metadata: z.object({\n name: z.string().max(500).nullable().optional(),\n filename: z.string().max(500).nullable().optional(),\n alt: z.string().max(2000).nullable().optional(),\n width: z.number().int().positive().nullable().optional(),\n height: z.number().int().positive().nullable().optional(),\n }),\n });\n\nexport const removeImageAssetOperationSchema: z.ZodType<RemoveImageAssetOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"remove-image-asset\"),\n assetId: z.string().min(1).max(240),\n});\n\nexport const surveyPatchOperationSchema: z.ZodType<SurveyPatchOperation> = z.object({\n id: operationIdSchema,\n kind: z.literal(\"survey-json-patch\"),\n patches: z\n .array(jsonPatchOperationSchema)\n .min(1)\n .max(100)\n .describe(\n \"Batch of JSON Patch operations applied to the survey document. Use this for raw survey edits such as reordering group items, editing item config, survey metadata, template values, translations/locales, or maxItemsPerPage.\",\n ),\n});\n\n// Public annotations keep declaration output compact. Runtime values are still\n// the concrete Zod objects required by discriminatedUnion.\nconst asDiscriminable = <T>(schema: z.ZodType<T>) => schema as unknown as z.ZodObject;\n\nexport const surveyOperationSchemasByKind = {\n \"create-item\": createItemOperationSchema,\n \"update-item-key\": updateItemKeyOperationSchema,\n \"update-item-label\": updateItemLabelOperationSchema,\n \"update-item-color\": updateItemColorOperationSchema,\n \"update-item-translation\": updateItemTranslationOperationSchema,\n \"update-placed-image\": updatePlacedImageOperationSchema,\n \"patch-item-config\": patchItemConfigOperationSchema,\n \"upsert-form-field-group\": upsertFormFieldGroupOperationSchema,\n \"remove-form-field-group\": removeFormFieldGroupOperationSchema,\n \"reorder-form-field-groups\": reorderFormFieldGroupsOperationSchema,\n \"upsert-form-field\": upsertFormFieldOperationSchema,\n \"remove-form-field\": removeFormFieldOperationSchema,\n \"move-form-field\": moveFormFieldOperationSchema,\n \"set-embedded-form\": setEmbeddedFormOperationSchema,\n \"remove-embedded-form\": removeEmbeddedFormOperationSchema,\n \"add-choice-option\": addChoiceOptionOperationSchema,\n \"update-choice-option-label\": updateChoiceOptionLabelOperationSchema,\n \"remove-choice-option\": removeChoiceOptionOperationSchema,\n \"reorder-choice-options\": reorderChoiceOptionsOperationSchema,\n \"remove-item\": removeItemOperationSchema,\n \"move-item\": moveItemOperationSchema,\n \"reorder-items\": reorderItemsOperationSchema,\n \"update-survey-metadata\": updateSurveyMetadataOperationSchema,\n \"update-survey-pagination\": updateSurveyPaginationOperationSchema,\n \"update-survey-translation\": updateSurveyTranslationOperationSchema,\n \"add-survey-locale\": addSurveyLocaleOperationSchema,\n \"remove-survey-locale\": removeSurveyLocaleOperationSchema,\n \"set-image-asset\": setImageAssetOperationSchema,\n \"update-image-asset-metadata\": updateImageAssetMetadataOperationSchema,\n \"remove-image-asset\": removeImageAssetOperationSchema,\n \"survey-json-patch\": surveyPatchOperationSchema,\n} as const satisfies Record<SurveyOperationKind, z.ZodType>;\n\nconst surveyOperationSchemaOptions = Object.values(surveyOperationSchemasByKind).map((schema) =>\n asDiscriminable(schema as z.ZodType),\n) as [z.ZodObject, z.ZodObject, ...z.ZodObject[]];\n\nexport const surveyOperationSchema: z.ZodType<SurveyOperationShape> = z.discriminatedUnion(\n \"kind\",\n surveyOperationSchemaOptions,\n) as unknown as z.ZodType<SurveyOperationShape>;\n\nexport const surveyValidationIssueSchema: z.ZodType<SurveyValidationIssueShape> = z.object({\n severity: z.enum([\"error\", \"warning\"]),\n code: z.string(),\n message: z.string(),\n operationIndex: z.number().int().nonnegative().optional(),\n operationId: z.string().optional(),\n itemId: z.string().optional(),\n});\n\nexport const surveyValidationResultSchema: z.ZodType<SurveyValidationResultShape> = z.object({\n valid: z.boolean(),\n issues: z.array(surveyValidationIssueSchema),\n warnings: z.array(surveyValidationIssueSchema),\n normalizedOperations: z.array(surveyOperationSchema),\n});\n\nexport type JsonPatchOperation = z.infer<typeof jsonPatchOperationSchema>;\nexport type SurveyOperation = z.infer<typeof surveyOperationSchema>;\n\nexport const SURVEY_OPERATION_KINDS = Object.freeze(\n Object.keys(surveyOperationSchemasByKind),\n) as readonly [SurveyOperationKind, ...SurveyOperationKind[]];\nexport type SurveyValidationIssue = z.infer<typeof surveyValidationIssueSchema>;\nexport type SurveyValidationResult = z.infer<typeof surveyValidationResultSchema>;\n\n// Compatibility names retained while app and survey-ui public APIs migrate.\nexport const surveyJsonPatchOperationSchema = jsonPatchOperationSchema;\nexport const surveyAssistantCreateItemOperationSchema = createItemOperationSchema;\nexport const surveyAssistantUpdateItemKeyOperationSchema = updateItemKeyOperationSchema;\nexport const surveyAssistantUpdateItemLabelOperationSchema = updateItemLabelOperationSchema;\nexport const surveyAssistantUpdateItemColorOperationSchema = updateItemColorOperationSchema;\nexport const surveyAssistantUpdateItemTranslationOperationSchema =\n updateItemTranslationOperationSchema;\nexport const surveyAssistantAddChoiceOptionOperationSchema = addChoiceOptionOperationSchema;\nexport const surveyAssistantUpdateChoiceOptionLabelOperationSchema =\n updateChoiceOptionLabelOperationSchema;\nexport const surveyAssistantRemoveChoiceOptionOperationSchema = removeChoiceOptionOperationSchema;\nexport const surveyAssistantReorderChoiceOptionsOperationSchema =\n reorderChoiceOptionsOperationSchema;\nexport const surveyAssistantRemoveItemOperationSchema = removeItemOperationSchema;\nexport const surveyAssistantSurveyJsonPatchOperationSchema = surveyPatchOperationSchema;\nexport const surveyAssistantOperationSchema = surveyOperationSchema;\nexport const surveyAssistantValidationIssueSchema = surveyValidationIssueSchema;\nexport const surveyAssistantValidationResultSchema = surveyValidationResultSchema;\n\nexport type SurveyAssistantOperation = SurveyOperation;\nexport type SurveyAssistantValidationIssue = SurveyValidationIssue;\nexport type SurveyAssistantValidationResult = SurveyValidationResult;\nexport type SurveyAssistantSurveyJsonPatchOperation = z.infer<typeof surveyPatchOperationSchema>;\n","import { z } from \"zod\";\nimport { SURVEY_OPERATION_KINDS } from \"./operations\";\n\nexport const assistantItemCreateModeSchema = z.enum([\n \"deterministic\",\n \"interactive-only\",\n \"unsupported\",\n]);\n\nexport const assistantContentSurfaceSchema = z.object({\n key: z.string().min(1),\n role: z.enum([\"primary\", \"secondary\", \"option\", \"field\", \"validation\"]),\n format: z.enum([\"plain\", \"rich\"]),\n requiredOnCreate: z.boolean().optional(),\n pattern: z.boolean().optional(),\n aliases: z.array(z.string().min(1)).optional(),\n});\n\nexport const assistantResponseSlotSchema = z.object({\n key: z.string().min(1),\n valueType: z.string().min(1),\n});\n\nexport const assistantItemAuthoringSchema = z.object({\n compactHint: z.string().min(1).max(240).optional(),\n configSummary: z.string().min(1).max(1000).optional(),\n});\n\nexport const assistantCreationPresetSchema = z.object({\n id: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,119}$/),\n});\n\nexport const assistantItemTypeManifestSchema = z.object({\n itemType: z.string().min(1),\n capabilityVersion: z.string().min(1),\n displayName: z.string().min(1),\n description: z.string().optional(),\n defaultItemKeyPrefix: z.string().min(1).optional(),\n create: assistantItemCreateModeSchema,\n supportedOperations: z.array(z.enum(SURVEY_OPERATION_KINDS)),\n contentSurfaces: z.array(assistantContentSurfaceSchema),\n responseSlots: z.array(assistantResponseSlotSchema).optional(),\n creationPresets: z.array(assistantCreationPresetSchema).max(100).optional(),\n referenceTopics: z.array(z.string().min(1)).optional(),\n authoring: assistantItemAuthoringSchema.optional(),\n});\n\nexport const surveyAssistantCapabilityManifestSchema = z.object({\n digest: z.string().min(1),\n itemTypes: z.array(assistantItemTypeManifestSchema),\n});\n\nexport type AssistantItemCreateMode = z.infer<typeof assistantItemCreateModeSchema>;\nexport type AssistantContentSurface = z.infer<typeof assistantContentSurfaceSchema>;\nexport type AssistantResponseSlot = z.infer<typeof assistantResponseSlotSchema>;\nexport type AssistantItemAuthoring = z.infer<typeof assistantItemAuthoringSchema>;\nexport type AssistantCreationPreset = z.infer<typeof assistantCreationPresetSchema>;\nexport type AssistantItemTypeManifest = z.infer<typeof assistantItemTypeManifestSchema>;\nexport type SurveyAssistantCapabilityManifest = z.infer<\n typeof surveyAssistantCapabilityManifestSchema\n>;\n","import type { RawSurvey } from \"@case-framework/survey-core\";\nimport { z } from \"zod\";\nimport { surveyContentSchema } from \"./content\";\nimport {\n surveyAssistantCapabilityManifestSchema,\n type AssistantItemTypeManifest,\n type SurveyAssistantCapabilityManifest,\n} from \"./capabilities\";\n\ninterface SurveyDocumentVersionShape {\n sessionId: string | null;\n revision: number;\n historyIndex: number;\n contentHash: string;\n capabilityDigest: string;\n}\n\ninterface SurveyEditorUIContextShape {\n view: \"item-editor\" | \"preview-mode\" | \"translation-mode\" | \"asset-manager\";\n selectedItemId?: string;\n selectedLocale: string;\n focusItemId?: string;\n recentItemIds?: string[];\n activeSurface?: string;\n openPanels?: string[];\n highlights?: Array<{\n kind: string;\n itemId?: string;\n componentId?: string;\n label?: string;\n details?: string;\n }>;\n history?: {\n currentIndex: number;\n totalEntries: number;\n canUndo: boolean;\n canRedo: boolean;\n recent: Array<{\n index: number;\n kind: \"survey-snapshot\" | \"asset-change\";\n label: string;\n source?: \"user\" | \"system\" | \"assistant\";\n timestamp: number;\n isCurrent: boolean;\n }>;\n };\n}\n\ninterface SurveyDocumentSnapshotShape {\n protocolVersion: 1;\n version: SurveyDocumentVersionShape;\n survey: RawSurvey;\n ui: SurveyEditorUIContextShape;\n capabilities: SurveyAssistantCapabilityManifest;\n createdAt: string;\n}\n\nexport const SURVEY_ASSISTANT_PROTOCOL_VERSION = 1 as const;\nexport const surveyAssistantProtocolVersionSchema = z.literal(SURVEY_ASSISTANT_PROTOCOL_VERSION);\n\nexport const surveyDocumentVersionSchema: z.ZodType<SurveyDocumentVersionShape> = z.object({\n sessionId: z.string().nullable(),\n revision: z.number().int().nonnegative(),\n historyIndex: z.number().int(),\n contentHash: z.string().min(1),\n capabilityDigest: z.string().min(1),\n});\n\nexport const surveyEditorUIContextSchema: z.ZodType<SurveyEditorUIContextShape> = z.object({\n view: z.enum([\"item-editor\", \"preview-mode\", \"translation-mode\", \"asset-manager\"]),\n selectedItemId: z.string().optional(),\n selectedLocale: z.string().min(1),\n focusItemId: z.string().optional(),\n recentItemIds: z.array(z.string()).max(10).optional(),\n activeSurface: z.string().max(120).optional(),\n openPanels: z.array(z.string().max(120)).max(12).optional(),\n highlights: z\n .array(\n z.object({\n kind: z.string().min(1).max(80),\n itemId: z.string().optional(),\n componentId: z.string().optional(),\n label: z.string().max(240).optional(),\n details: z.string().max(1000).optional(),\n }),\n )\n .max(12)\n .optional(),\n history: z\n .object({\n currentIndex: z.number().int(),\n totalEntries: z.number().int().nonnegative(),\n canUndo: z.boolean(),\n canRedo: z.boolean(),\n recent: z\n .array(\n z.object({\n index: z.number().int().nonnegative(),\n kind: z.enum([\"survey-snapshot\", \"asset-change\"]),\n label: z.string(),\n source: z.enum([\"user\", \"system\", \"assistant\"]).optional(),\n timestamp: z.number().nonnegative(),\n isCurrent: z.boolean(),\n }),\n )\n .max(12),\n })\n .optional(),\n});\n\nconst rawSurveyItemSchema = z\n .object({\n id: z.string().min(1),\n key: z.string().min(1),\n itemType: z.string().min(1),\n })\n .passthrough();\n\nconst rawSurveyTranslationsSchema = z.record(\n z.string(),\n z\n .object({\n itemTranslations: z.record(z.string(), z.record(z.string(), surveyContentSchema)).optional(),\n })\n .passthrough(),\n);\n\nexport const rawSurveyDocumentSchema: z.ZodType<RawSurvey> = z\n .object({\n $schema: z.string().min(1),\n surveyItems: z.array(rawSurveyItemSchema).min(1),\n translations: rawSurveyTranslationsSchema.optional(),\n })\n .passthrough() as z.ZodType<RawSurvey>;\n\nexport const surveyDocumentSnapshotSchema: z.ZodType<SurveyDocumentSnapshotShape> = z.object({\n protocolVersion: surveyAssistantProtocolVersionSchema,\n version: surveyDocumentVersionSchema,\n survey: rawSurveyDocumentSchema,\n ui: surveyEditorUIContextSchema,\n capabilities: surveyAssistantCapabilityManifestSchema,\n createdAt: z.string().min(1),\n});\n\nexport const surveyAssistantSnapshotSchema = surveyDocumentSnapshotSchema;\nexport const surveyAssistantSnapshotPayloadSchema = surveyDocumentSnapshotSchema;\n\nexport type SurveyAssistantProtocolVersion = z.infer<typeof surveyAssistantProtocolVersionSchema>;\nexport type SurveyDocumentVersion = z.infer<typeof surveyDocumentVersionSchema>;\nexport type SurveyEditorUIContext = z.infer<typeof surveyEditorUIContextSchema>;\nexport type RawSurveyDocument = z.infer<typeof rawSurveyDocumentSchema>;\nexport type SurveyDocumentSnapshot = z.infer<typeof surveyDocumentSnapshotSchema>;\n\n// Compatibility names for host adapters while the public API converges on\n// SurveyDocumentSnapshot. They are aliases, not alternate wire shapes.\nexport type SurveyAssistantSnapshot = SurveyDocumentSnapshot;\nexport type SurveyAssistantSnapshotPayload = SurveyDocumentSnapshot;\nexport type SurveyAssistantItemCreateStrategy =\n SurveyAssistantCapabilityManifest[\"itemTypes\"][number][\"create\"];\nexport type SurveyAssistantItemTypeManifestEntry = AssistantItemTypeManifest;\nexport type SurveyAssistantItemRegistryManifest = SurveyAssistantCapabilityManifest;\nexport type SurveyAssistantDraftChangePrecondition = SurveyDocumentVersion;\nexport const surveyAssistantDraftChangePreconditionSchema = surveyDocumentVersionSchema;\n","import { z } from \"zod\";\n\nexport const SURVEY_ASSISTANT_ATTACHMENT_PART_TYPE = \"data-survey-assistant-attachment\" as const;\n\nexport interface SurveyAssistantAttachmentReference {\n documentId?: string;\n filename: string;\n mediaType: string;\n bytes: number;\n}\n\nexport const surveyAssistantThreadSchema = z.object({\n id: z.string().min(1).max(240),\n title: z.string().min(1).max(160),\n titleMode: z.enum([\"automatic\", \"manual\"]),\n createdAt: z.string().datetime(),\n updatedAt: z.string().datetime(),\n});\n\nexport const surveyAssistantThreadListSchema = z.object({\n threads: z.array(surveyAssistantThreadSchema),\n});\n\nexport const surveyAssistantThreadTranscriptSchema = z.object({\n thread: surveyAssistantThreadSchema,\n messages: z.array(z.unknown()),\n});\n\nexport const createSurveyAssistantThreadInputSchema = z.object({\n title: z.string().trim().min(1).max(160).optional(),\n});\n\nexport const updateSurveyAssistantThreadInputSchema = z.union([\n z.object({\n mode: z.literal(\"automatic\"),\n title: z.string().trim().min(1).max(160).optional(),\n }),\n z.object({\n mode: z.literal(\"manual\").optional(),\n title: z.string().trim().min(1).max(160),\n }),\n]);\n\nexport type SurveyAssistantThreadTitleMode = \"automatic\" | \"manual\";\nexport type SurveyAssistantThread = z.infer<typeof surveyAssistantThreadSchema>;\nexport type SurveyAssistantThreadList = z.infer<typeof surveyAssistantThreadListSchema>;\nexport type SurveyAssistantThreadTranscript = z.infer<typeof surveyAssistantThreadTranscriptSchema>;\nexport type CreateSurveyAssistantThreadInput = z.infer<\n typeof createSurveyAssistantThreadInputSchema\n>;\nexport type UpdateSurveyAssistantThreadInput = z.infer<\n typeof updateSurveyAssistantThreadInputSchema\n>;\n","import { z } from \"zod\";\n\nexport const surveyAssistantTaskInvocationModeSchema = z.enum([\"user\", \"background\"]);\n\nexport type SurveyAssistantTaskInvocationMode = z.infer<\n typeof surveyAssistantTaskInvocationModeSchema\n>;\n\nexport const surveyAssistantSuggestedTextSchema = z.object({ text: z.string().min(1) });\n\nexport type SurveyAssistantSuggestedText = z.infer<typeof surveyAssistantSuggestedTextSchema>;\n\nexport const surveyAssistantKeySuggestionCategorySchema = z.enum([\n \"survey-pattern\",\n \"compact\",\n \"preferred\",\n \"fair\",\n]);\n\nexport type SurveyAssistantKeySuggestionCategory = z.infer<\n typeof surveyAssistantKeySuggestionCategorySchema\n>;\n\nexport const surveyAssistantKeySuggestionSchema = surveyAssistantSuggestedTextSchema.extend({\n category: surveyAssistantKeySuggestionCategorySchema,\n rationale: z.string().optional(),\n});\n\nexport type SurveyAssistantKeySuggestion = z.infer<typeof surveyAssistantKeySuggestionSchema>;\n\nexport const surveyAssistantSuggestItemKeyInputSchema = z.object({\n itemId: z.string().min(1),\n draftKey: z.string(),\n currentKey: z.string(),\n siblingKeys: z.array(z.string()),\n maxSuggestions: z.number().int().positive().optional(),\n});\n\nexport type SurveyAssistantSuggestItemKeyInput = z.infer<\n typeof surveyAssistantSuggestItemKeyInputSchema\n>;\n\nexport const surveyAssistantSuggestItemKeyResultSchema = z.object({\n suggestions: z.array(surveyAssistantKeySuggestionSchema),\n});\n\nexport type SurveyAssistantSuggestItemKeyResult = z.infer<\n typeof surveyAssistantSuggestItemKeyResultSchema\n>;\n\nexport type SurveyAssistantLabelSuggestion = SurveyAssistantSuggestedText;\n\nexport const surveyAssistantSuggestItemLabelInputSchema = z.object({\n itemId: z.string().min(1),\n draftLabel: z.string(),\n itemType: z.string().min(1),\n locale: z.string().min(1).optional(),\n maxSuggestions: z.number().int().positive().optional(),\n});\n\nexport type SurveyAssistantSuggestItemLabelInput = z.infer<\n typeof surveyAssistantSuggestItemLabelInputSchema\n>;\n\nexport const surveyAssistantSuggestItemLabelResultSchema = z.object({\n suggestions: z.array(surveyAssistantSuggestedTextSchema),\n});\n\nexport type SurveyAssistantSuggestItemLabelResult = z.infer<\n typeof surveyAssistantSuggestItemLabelResultSchema\n>;\n\nexport const surveyAssistantTranslateContentEntrySchema = z.object({\n id: z.string().min(1),\n text: z.string(),\n kind: z.string().min(1),\n});\n\nexport type SurveyAssistantTranslateContentEntry = z.infer<\n typeof surveyAssistantTranslateContentEntrySchema\n>;\n\nexport const surveyAssistantTranslateContentInputSchema = z.object({\n sourceLocale: z.string().min(1),\n targetLocales: z.array(z.string().min(1)).min(1),\n entries: z.array(surveyAssistantTranslateContentEntrySchema).min(1),\n});\n\nexport type SurveyAssistantTranslateContentInput = z.infer<\n typeof surveyAssistantTranslateContentInputSchema\n>;\n\nexport const surveyAssistantTranslateContentResultSchema = z.object({\n translations: z.record(z.string(), z.record(z.string(), z.string())),\n});\n\nexport type SurveyAssistantTranslateContentResult = z.infer<\n typeof surveyAssistantTranslateContentResultSchema\n>;\n\nexport const surveyAssistantTaskItemSummarySchema = z.object({\n id: z.string().min(1),\n key: z.string(),\n fullKey: z.string(),\n itemType: z.string().min(1),\n itemLabel: z.string().optional(),\n visibleText: z.array(\n z.object({\n locale: z.string().min(1),\n contentKey: z.string().min(1),\n text: z.string(),\n }),\n ),\n visibleTextTruncated: z.boolean(),\n});\n\nexport type SurveyAssistantTaskItemSummary = z.infer<typeof surveyAssistantTaskItemSummarySchema>;\n\nconst namingRelationshipSchema = z.enum([\"sibling\", \"same-type\", \"survey\"]);\n\nexport const surveyAssistantTaskContextSchema = z.object({\n document: z.object({\n revision: z.number().int().nonnegative(),\n contentHash: z.string().min(1),\n capabilityDigest: z.string().min(1),\n }),\n survey: z.object({\n key: z.string().optional(),\n locales: z.array(z.string()),\n itemCount: z.number().int().nonnegative(),\n selectedLocale: z.string().min(1),\n }),\n focus: z\n .object({\n item: surveyAssistantTaskItemSummarySchema,\n parent: surveyAssistantTaskItemSummarySchema.optional(),\n ancestorPath: z.array(surveyAssistantTaskItemSummarySchema),\n siblingKeys: z.array(z.string()),\n siblingItems: z.array(surveyAssistantTaskItemSummarySchema),\n siblingItemCount: z.number().int().nonnegative(),\n siblingItemsTruncated: z.boolean(),\n relatedItems: z.array(surveyAssistantTaskItemSummarySchema),\n relatedItemCount: z.number().int().nonnegative(),\n relatedItemsTruncated: z.boolean(),\n })\n .optional(),\n naming: z\n .object({\n keyExamples: z.array(\n z.object({\n itemId: z.string().min(1),\n itemType: z.string().min(1),\n key: z.string(),\n relationship: namingRelationshipSchema,\n }),\n ),\n keyExampleCount: z.number().int().nonnegative(),\n keyExamplesTruncated: z.boolean(),\n labelExamples: z.array(\n z.object({\n itemId: z.string().min(1),\n itemType: z.string().min(1),\n key: z.string(),\n label: z.string(),\n relationship: namingRelationshipSchema,\n }),\n ),\n labelExampleCount: z.number().int().nonnegative(),\n labelExamplesTruncated: z.boolean(),\n })\n .optional(),\n translation: z\n .object({\n examples: z.array(\n z.object({\n itemId: z.string().min(1),\n contentKey: z.string().min(1),\n values: z.record(z.string(), z.string()),\n }),\n ),\n exampleCount: z.number().int().nonnegative(),\n examplesTruncated: z.boolean(),\n })\n .optional(),\n});\n\nexport type SurveyAssistantTaskContext = z.infer<typeof surveyAssistantTaskContextSchema>;\n\nconst taskRequestBase = {\n context: surveyAssistantTaskContextSchema,\n mode: surveyAssistantTaskInvocationModeSchema.optional(),\n modelId: z.string().trim().min(1).max(240).optional(),\n resourceId: z.string().trim().min(1).max(240).optional(),\n surveyId: z.string().trim().min(1).max(240).optional(),\n};\n\nexport const surveyAssistantTaskRequestSchema = z.discriminatedUnion(\"taskId\", [\n z.object({\n ...taskRequestBase,\n taskId: z.literal(\"suggest-item-key\"),\n input: surveyAssistantSuggestItemKeyInputSchema,\n }),\n z.object({\n ...taskRequestBase,\n taskId: z.literal(\"suggest-item-label\"),\n input: surveyAssistantSuggestItemLabelInputSchema,\n }),\n z.object({\n ...taskRequestBase,\n taskId: z.literal(\"translate-content\"),\n input: surveyAssistantTranslateContentInputSchema,\n }),\n]);\n\nexport type SurveyAssistantTaskRequest = z.infer<typeof surveyAssistantTaskRequestSchema>;\n","import { z } from \"zod\";\n\nexport const surveyAssistantModelOptionSchema = z.object({\n id: z.string().trim().min(1).max(240),\n label: z.string().trim().min(1).max(240),\n});\n\nexport const surveyAssistantModelCatalogSchema = z\n .object({\n defaultModelId: z.string().trim().min(1).max(240),\n models: z.array(surveyAssistantModelOptionSchema).min(1),\n })\n .refine(\n ({ defaultModelId, models }) => models.some((model) => model.id === defaultModelId),\n \"The default model must be present in the model catalog.\",\n );\n\nexport type SurveyAssistantModelOption = z.infer<typeof surveyAssistantModelOptionSchema>;\nexport type SurveyAssistantModelCatalog = z.infer<typeof surveyAssistantModelCatalogSchema>;\n","import { z } from \"zod\";\nimport {\n surveyAssistantProtocolVersionSchema,\n surveyDocumentVersionSchema,\n type SurveyDocumentVersion,\n} from \"./document\";\nimport {\n surveyOperationSchema,\n surveyValidationIssueSchema,\n surveyValidationResultSchema,\n type SurveyOperation,\n type SurveyValidationIssue,\n type SurveyValidationResult,\n} from \"./operations\";\n\ninterface SurveyChangeSetShape {\n protocolVersion: 1;\n id: string;\n turnId: string;\n status: \"validated\" | \"rejected\";\n summary: string;\n operations: SurveyOperation[];\n supersedesChangeIds?: string[];\n precondition?: SurveyDocumentVersion;\n postChange?: SurveyAssistantPostChangeProjectionShape;\n verification?: SurveyAssistantChangeVerificationShape;\n validation: SurveyValidationResult;\n createdAt: string;\n}\n\nconst surveyAssistantChangeVerificationReasonValues = [\n \"substantial-change\",\n \"complex-change\",\n \"bounded-preview\",\n \"new-audit-findings\",\n] as const;\n\ninterface SurveyAssistantChangeVerificationShape {\n required: boolean;\n reasons: Array<(typeof surveyAssistantChangeVerificationReasonValues)[number]>;\n newAuditFindingCount: number;\n auditFindings: Array<{\n code: string;\n severity: \"error\" | \"warning\" | \"info\";\n category:\n | \"structure\"\n | \"content\"\n | \"localization\"\n | \"logic\"\n | \"responses\"\n | \"assets\"\n | \"quality\";\n itemId?: string;\n locale?: string;\n contentKey?: string;\n messagePreview: string;\n messageLength: number;\n truncated: boolean;\n }>;\n truncated: boolean;\n}\n\ninterface SurveyAssistantPostChangeProjectionShape {\n version: SurveyDocumentVersion;\n itemCount: number;\n localeCount: number;\n locales: string[];\n targetCount: number;\n touchedTargets: string[];\n touchedItemCount: number;\n availableTouchedItemCount: number;\n touchedItems: Array<{\n itemId: string;\n itemType: string;\n key: string;\n fullKey: string;\n itemLabel?: string;\n translationCount: number;\n translations: Array<{\n locale: string;\n contentKey: string;\n textPreview: string;\n textLength: number;\n truncated: boolean;\n }>;\n responseSlotCount: number;\n responseSlots: string[];\n }>;\n truncated: boolean;\n}\n\nconst surveyAssistantTurnTerminationReasonValues = [\n \"client-abort\",\n \"first-response-timeout\",\n \"idle-timeout\",\n \"max-duration\",\n \"max-steps\",\n \"length-limit\",\n \"content-filter\",\n \"provider-error\",\n \"stream-error\",\n \"incomplete-response\",\n] as const;\n\ninterface SurveyAssistantTurnFinalShape {\n protocolVersion: 1;\n turnId: string;\n status: \"completed\" | \"failed\" | \"aborted\";\n executableChangeSetIds: string[];\n blockedChangeSetIds?: string[];\n startedAt?: string;\n durationMs?: number;\n terminationReason?: (typeof surveyAssistantTurnTerminationReasonValues)[number];\n createdAt: string;\n}\n\ntype SurveyAssistantApplyPolicyShape = \"auto\" | \"review\" | \"deny\";\n\nexport const SURVEY_ASSISTANT_TURN_FINAL_DATA_NAME = \"survey-assistant-turn-final\" as const;\nexport const SURVEY_ASSISTANT_TURN_FINAL_PART_TYPE =\n `data-${SURVEY_ASSISTANT_TURN_FINAL_DATA_NAME}` as const;\n\ntype SurveyApplyStatusShape = \"applied\" | \"rejected\" | \"stale\" | \"failed\";\n\ninterface SurveyApplyResultShape {\n status: SurveyApplyStatusShape;\n changeId: string;\n summary: string;\n message: string;\n appliedOperations: number;\n issues?: SurveyValidationIssue[];\n}\n\ninterface SurveyBatchApplyResultShape {\n results: SurveyApplyResultShape[];\n}\n\ninterface SurveyAssistantApplyOutcomeResultShape {\n status: SurveyApplyStatusShape;\n changeId: string;\n summary: string;\n message: string;\n appliedOperations: number;\n}\n\ninterface SurveyAssistantPreparedChangeShape {\n changeId: string;\n status: \"validated\" | \"rejected\";\n summary: string;\n operationCount: number;\n}\n\nconst surveyAssistantApplyOutcomeStatusValues = [\n \"not-applied\",\n \"apply-failed\",\n \"settle-failed\",\n] as const;\n\ninterface SurveyAssistantApplyOutcomeShape {\n protocolVersion: 1;\n turnId: string;\n status: (typeof surveyAssistantApplyOutcomeStatusValues)[number];\n message: string;\n results?: SurveyAssistantApplyOutcomeResultShape[];\n preparedChanges?: SurveyAssistantPreparedChangeShape[];\n createdAt: string;\n}\n\ninterface ApplyReceiptShape {\n protocolVersion: 1;\n turnId: string;\n changeSetId: string;\n beforeVersion: SurveyDocumentVersion;\n afterVersion?: SurveyDocumentVersion;\n status: SurveyApplyStatusShape;\n operationCount: number;\n commit?: { id?: string; index?: number };\n issues?: SurveyValidationIssue[];\n createdAt: string;\n}\n\nexport const surveyChangeSetSchema: z.ZodType<SurveyChangeSetShape> = z.object({\n protocolVersion: surveyAssistantProtocolVersionSchema.default(1),\n id: z.string().min(1),\n turnId: z.string().min(1),\n status: z.enum([\"validated\", \"rejected\"]),\n summary: z.string().min(1).max(500),\n operations: z.array(surveyOperationSchema),\n supersedesChangeIds: z.array(z.string().min(1)).max(100).optional(),\n precondition: surveyDocumentVersionSchema.optional(),\n postChange: z\n .object({\n version: surveyDocumentVersionSchema,\n itemCount: z.number().int().nonnegative(),\n localeCount: z.number().int().nonnegative(),\n locales: z.array(z.string().min(1)).max(32),\n targetCount: z.number().int().nonnegative(),\n touchedTargets: z.array(z.string().min(1)).max(16),\n touchedItemCount: z.number().int().nonnegative(),\n availableTouchedItemCount: z.number().int().nonnegative(),\n touchedItems: z\n .array(\n z.object({\n itemId: z.string().min(1),\n itemType: z.string().min(1),\n key: z.string().min(1),\n fullKey: z.string().min(1),\n itemLabel: z.string().optional(),\n translationCount: z.number().int().nonnegative(),\n translations: z\n .array(\n z.object({\n locale: z.string().min(1),\n contentKey: z.string().min(1),\n textPreview: z.string(),\n textLength: z.number().int().nonnegative(),\n truncated: z.boolean(),\n }),\n )\n .max(12),\n responseSlotCount: z.number().int().nonnegative(),\n responseSlots: z.array(z.string().min(1)).max(12),\n }),\n )\n .max(6),\n truncated: z.boolean(),\n })\n .optional(),\n verification: z\n .object({\n required: z.boolean(),\n reasons: z\n .array(z.enum(surveyAssistantChangeVerificationReasonValues))\n .min(1)\n .max(surveyAssistantChangeVerificationReasonValues.length),\n newAuditFindingCount: z.number().int().nonnegative(),\n auditFindings: z\n .array(\n z.object({\n code: z.string().min(1),\n severity: z.enum([\"error\", \"warning\", \"info\"]),\n category: z.enum([\n \"structure\",\n \"content\",\n \"localization\",\n \"logic\",\n \"responses\",\n \"assets\",\n \"quality\",\n ]),\n itemId: z.string().min(1).optional(),\n locale: z.string().min(1).optional(),\n contentKey: z.string().min(1).optional(),\n messagePreview: z.string(),\n messageLength: z.number().int().nonnegative(),\n truncated: z.boolean(),\n }),\n )\n .max(8),\n truncated: z.boolean(),\n })\n .optional(),\n validation: surveyValidationResultSchema,\n createdAt: z.string().min(1),\n});\n\nexport const surveyAssistantTurnTerminationReasonSchema = z.enum(\n surveyAssistantTurnTerminationReasonValues,\n);\n\nexport const surveyAssistantTurnFinalSchema: z.ZodType<SurveyAssistantTurnFinalShape> = z\n .object({\n protocolVersion: surveyAssistantProtocolVersionSchema,\n turnId: z.string().min(1),\n status: z.enum([\"completed\", \"failed\", \"aborted\"]),\n executableChangeSetIds: z.array(z.string().min(1)),\n blockedChangeSetIds: z.array(z.string().min(1)).max(100).optional(),\n startedAt: z.string().datetime().optional(),\n durationMs: z.number().int().nonnegative().optional(),\n terminationReason: surveyAssistantTurnTerminationReasonSchema.optional(),\n createdAt: z.string().min(1),\n })\n .superRefine((value, context) => {\n if (value.status !== \"completed\" && value.executableChangeSetIds.length > 0) {\n context.addIssue({\n code: \"custom\",\n message: \"Failed or aborted turns cannot authorize executable change sets.\",\n path: [\"executableChangeSetIds\"],\n });\n }\n\n if (new Set(value.executableChangeSetIds).size !== value.executableChangeSetIds.length) {\n context.addIssue({\n code: \"custom\",\n message: \"Executable change-set ids must be unique.\",\n path: [\"executableChangeSetIds\"],\n });\n }\n\n const blockedChangeSetIds = value.blockedChangeSetIds ?? [];\n if (new Set(blockedChangeSetIds).size !== blockedChangeSetIds.length) {\n context.addIssue({\n code: \"custom\",\n message: \"Blocked change-set ids must be unique.\",\n path: [\"blockedChangeSetIds\"],\n });\n }\n\n if (blockedChangeSetIds.length > 0 && value.executableChangeSetIds.length > 0) {\n context.addIssue({\n code: \"custom\",\n message: \"A blocked turn cannot authorize executable change sets.\",\n path: [\"executableChangeSetIds\"],\n });\n }\n\n if (value.status === \"completed\" && value.terminationReason !== undefined) {\n context.addIssue({\n code: \"custom\",\n message: \"Completed turns cannot have a failure or abort reason.\",\n path: [\"terminationReason\"],\n });\n }\n }) as z.ZodType<SurveyAssistantTurnFinalShape>;\n\nexport const surveyAssistantApplyPolicySchema: z.ZodType<SurveyAssistantApplyPolicyShape> = z.enum([\n \"auto\",\n \"review\",\n \"deny\",\n]);\n\nexport const surveyApplyStatusSchema: z.ZodType<SurveyApplyStatusShape> = z.enum([\n \"applied\",\n \"rejected\",\n \"stale\",\n \"failed\",\n]);\n\nexport const surveyApplyResultSchema: z.ZodType<SurveyApplyResultShape> = z.object({\n status: surveyApplyStatusSchema,\n changeId: z.string(),\n summary: z.string(),\n message: z.string(),\n appliedOperations: z.number().int().nonnegative(),\n issues: z.array(surveyValidationIssueSchema).optional(),\n});\n\nexport const surveyBatchApplyResultSchema: z.ZodType<SurveyBatchApplyResultShape> = z.object({\n results: z.array(surveyApplyResultSchema),\n});\n\nexport const surveyAssistantApplyOutcomeSchema: z.ZodType<SurveyAssistantApplyOutcomeShape> =\n z.object({\n protocolVersion: surveyAssistantProtocolVersionSchema,\n turnId: z.string().min(1),\n status: z.enum(surveyAssistantApplyOutcomeStatusValues),\n message: z.string().min(1).max(2_000),\n results: z\n .array(\n z.object({\n status: surveyApplyStatusSchema,\n changeId: z.string().min(1).max(240),\n summary: z.string().min(1).max(500),\n message: z.string().min(1).max(2_000),\n appliedOperations: z.number().int().nonnegative(),\n }),\n )\n .max(100)\n .optional(),\n preparedChanges: z\n .array(\n z.object({\n changeId: z.string().min(1).max(240),\n status: z.enum([\"validated\", \"rejected\"]),\n summary: z.string().min(1).max(500),\n operationCount: z.number().int().nonnegative(),\n }),\n )\n .max(24)\n .optional(),\n createdAt: z.string().min(1),\n });\n\nexport const applyReceiptSchema: z.ZodType<ApplyReceiptShape> = z.object({\n protocolVersion: surveyAssistantProtocolVersionSchema,\n turnId: z.string().min(1),\n changeSetId: z.string().min(1),\n beforeVersion: surveyDocumentVersionSchema,\n afterVersion: surveyDocumentVersionSchema.optional(),\n status: surveyApplyStatusSchema,\n operationCount: z.number().int().nonnegative(),\n commit: z\n .object({\n id: z.string().min(1).optional(),\n index: z.number().int().optional(),\n })\n .optional(),\n issues: z.array(surveyValidationIssueSchema).optional(),\n createdAt: z.string().min(1),\n});\n\nexport type SurveyChangeSet = z.infer<typeof surveyChangeSetSchema>;\nexport type SurveyAssistantTurnFinal = z.infer<typeof surveyAssistantTurnFinalSchema>;\nexport type SurveyAssistantTurnTerminationReason = z.infer<\n typeof surveyAssistantTurnTerminationReasonSchema\n>;\nexport type SurveyAssistantApplyPolicy = z.infer<typeof surveyAssistantApplyPolicySchema>;\nexport type SurveyApplyStatus = z.infer<typeof surveyApplyStatusSchema>;\nexport type SurveyApplyResult = z.infer<typeof surveyApplyResultSchema>;\nexport type SurveyBatchApplyResult = z.infer<typeof surveyBatchApplyResultSchema>;\nexport type SurveyAssistantApplyOutcome = z.infer<typeof surveyAssistantApplyOutcomeSchema>;\nexport type ApplyReceipt = z.infer<typeof applyReceiptSchema>;\n\n// Compatibility names retained until the UI and host public APIs can make a\n// breaking terminology change.\nexport const surveyAssistantDraftChangeEventSchema = surveyChangeSetSchema;\nexport type SurveyAssistantDraftChangeEvent = SurveyChangeSet;\nexport type SurveyAssistantApplyStatus = SurveyApplyStatus;\nexport type SurveyAssistantApplyResult = SurveyApplyResult;\nexport type SurveyAssistantBatchApplyResult = SurveyBatchApplyResult;\n"],"mappings":";;;AAEA,MAAa,iCAAiC,EAAE,KAAK;CACnD;CACA;CACA;CACA;CACA;CACD,CAAC;AAIF,MAAa,iC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