@fses/workbench-app 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (803) hide show
  1. package/WORKBENCH-CLOSURE.json +80 -0
  2. package/dist/Workspace-fYH2XNdb.js +22699 -0
  3. package/dist/fses-workbench-app.js +2 -2
  4. package/dist/{index-DbH6tMQy.js → index-CbIJlts1.js} +8 -8
  5. package/dist/internal/personal-workbench/components/workbench/WorkbenchStudio.vue.d.ts +2 -2
  6. package/dist/internal/personal-workbench/lib/deepAgentApi.d.ts +41 -2
  7. package/dist/internal/personal-workbench/lib/deepAgentQueueState.d.ts +111 -0
  8. package/dist/internal/personal-workbench/lib/vueRuntimeAdapters.d.ts +72 -0
  9. package/dist/internal/personal-workbench/lib/workbenchSocketClient.d.ts +1 -1
  10. package/dist/internal/personal-workbench/lib/workbenchStorage.d.ts +2 -0
  11. package/dist/runtime/index.js +1 -1
  12. package/dist/style.css +1 -1
  13. package/dist/{useWorkbenchRuntime-XpOzwm56.js → useWorkbenchRuntime-Ch8lqkjO.js} +6707 -6315
  14. package/node_modules/@byteluck/agentic-protocol/LICENSE +9 -0
  15. package/node_modules/@byteluck/agentic-protocol/README.md +74 -0
  16. package/node_modules/@byteluck/agentic-protocol/dist/index.d.ts +1623 -0
  17. package/node_modules/@byteluck/agentic-protocol/dist/index.mjs +3380 -0
  18. package/node_modules/@byteluck/agentic-protocol/package.json +37 -0
  19. package/node_modules/@byteluck/workbench-skill-contracts/LICENSE +9 -0
  20. package/node_modules/@byteluck/workbench-skill-contracts/dist/index.d.ts +234 -0
  21. package/node_modules/@byteluck/workbench-skill-contracts/dist/index.mjs +394 -0
  22. package/node_modules/@byteluck/workbench-skill-contracts/package.json +37 -0
  23. package/node_modules/@fses/ai-chat/LICENSE +9 -0
  24. package/node_modules/@fses/ai-chat/README.md +320 -0
  25. package/node_modules/@fses/ai-chat/dist/chart-card/data.d.ts +12 -0
  26. package/node_modules/@fses/ai-chat/dist/chart-card/from-markdown.d.ts +11 -0
  27. package/node_modules/@fses/ai-chat/dist/chart-card/from-tool.d.ts +8 -0
  28. package/node_modules/@fses/ai-chat/dist/chart-card/options.d.ts +4 -0
  29. package/node_modules/@fses/ai-chat/dist/chart-card/trace.d.ts +19 -0
  30. package/node_modules/@fses/ai-chat/dist/chart-card/types.d.ts +133 -0
  31. package/node_modules/@fses/ai-chat/dist/components/CardRecommendationDeferredDraft.vue.d.ts +13 -0
  32. package/node_modules/@fses/ai-chat/dist/components/CardRecommendationDraft.vue.d.ts +18 -0
  33. package/node_modules/@fses/ai-chat/dist/components/ChartCardRenderer.vue.d.ts +11 -0
  34. package/node_modules/@fses/ai-chat/dist/components/ChatMessageItem.vue.d.ts +76 -0
  35. package/node_modules/@fses/ai-chat/dist/components/ChatMessageList.vue.d.ts +79 -0
  36. package/node_modules/@fses/ai-chat/dist/components/ChatSender.vue.d.ts +98 -0
  37. package/node_modules/@fses/ai-chat/dist/components/CollapsedToolActivity.vue.d.ts +9 -0
  38. package/node_modules/@fses/ai-chat/dist/components/ContextUsageRing.vue.d.ts +12 -0
  39. package/node_modules/@fses/ai-chat/dist/components/EChartsView.vue.d.ts +6 -0
  40. package/node_modules/@fses/ai-chat/dist/components/FsesAiChat.vue.d.ts +306 -0
  41. package/node_modules/@fses/ai-chat/dist/components/PlanDraftCard.vue.d.ts +19 -0
  42. package/node_modules/@fses/ai-chat/dist/components/ShellExecPanel.vue.d.ts +6 -0
  43. package/node_modules/@fses/ai-chat/dist/components/TaskTodoPlanBar.vue.d.ts +6 -0
  44. package/node_modules/@fses/ai-chat/dist/components/ThinkingShimmer.vue.d.ts +6 -0
  45. package/node_modules/@fses/ai-chat/dist/composables/context-usage.d.ts +11 -0
  46. package/node_modules/@fses/ai-chat/dist/composables/types.d.ts +465 -0
  47. package/node_modules/@fses/ai-chat/dist/composables/useChat.d.ts +2 -0
  48. package/node_modules/@fses/ai-chat/dist/composables/useSystemEChartsIcon.d.ts +11 -0
  49. package/node_modules/@fses/ai-chat/dist/fses-ai-chat.js +11408 -0
  50. package/node_modules/@fses/ai-chat/dist/fses-ai-chat.umd.cjs +25 -0
  51. package/node_modules/@fses/ai-chat/dist/index.d.ts +17 -0
  52. package/node_modules/@fses/ai-chat/dist/plugin.d.ts +8 -0
  53. package/node_modules/@fses/ai-chat/dist/style.css +1 -0
  54. package/node_modules/@fses/ai-chat/dist/utils/assistant-markdown.d.ts +11 -0
  55. package/node_modules/@fses/ai-chat/dist/utils/attachment-upload.d.ts +22 -0
  56. package/node_modules/@fses/ai-chat/dist/utils/card-recommendation-config-summary.d.ts +86 -0
  57. package/node_modules/@fses/ai-chat/dist/utils/card-recommendation-field-label.d.ts +24 -0
  58. package/node_modules/@fses/ai-chat/dist/utils/card-recommendation-source.d.ts +18 -0
  59. package/node_modules/@fses/ai-chat/dist/utils/card-recommendation-title-source.d.ts +12 -0
  60. package/node_modules/@fses/ai-chat/dist/utils/chart-card-visibility.d.ts +24 -0
  61. package/node_modules/@fses/ai-chat/dist/utils/derived-process-labels.d.ts +13 -0
  62. package/node_modules/@fses/ai-chat/dist/utils/echarts-recommendation-icon.d.ts +36 -0
  63. package/node_modules/@fses/ai-chat/dist/utils/group-messages.d.ts +30 -0
  64. package/node_modules/@fses/ai-chat/dist/utils/status-activity.d.ts +48 -0
  65. package/node_modules/@fses/ai-chat/dist/utils/system-echarts-template-icons.generated.d.ts +305 -0
  66. package/node_modules/@fses/ai-chat/dist/utils/system-echarts-template.d.ts +20 -0
  67. package/node_modules/@fses/ai-chat/dist/utils/task-todo-plan.d.ts +40 -0
  68. package/node_modules/@fses/ai-chat/dist/utils/workbench-echarts-theme.d.ts +35 -0
  69. package/node_modules/@fses/ai-chat/package.json +81 -0
  70. package/node_modules/@fses/workbench-card/LICENSE +9 -0
  71. package/node_modules/@fses/workbench-card/README.md +81 -0
  72. package/node_modules/@fses/workbench-card/dist/chart/index.d.ts +8 -0
  73. package/node_modules/@fses/workbench-card/dist/fses-workbench-card-echarts-protocol.js +2230 -0
  74. package/node_modules/@fses/workbench-card/dist/fses-workbench-card-renderers.js +33742 -0
  75. package/node_modules/@fses/workbench-card/dist/fses-workbench-card.js +21238 -0
  76. package/node_modules/@fses/workbench-card/dist/fses-workbench-card.umd.cjs +1 -0
  77. package/node_modules/@fses/workbench-card/dist/index.d.ts +11 -0
  78. package/node_modules/@fses/workbench-card/dist/registry/cardRegistry.d.ts +50 -0
  79. package/node_modules/@fses/workbench-card/dist/registry/compositeCardPatterns.d.ts +39 -0
  80. package/node_modules/@fses/workbench-card/dist/registry/echartsTemplateCategories.d.ts +20 -0
  81. package/node_modules/@fses/workbench-card/dist/registry/echartsTemplateRegistry.d.ts +1158 -0
  82. package/node_modules/@fses/workbench-card/dist/registry/echartsTemplateRegistry.generated.d.ts +1141 -0
  83. package/node_modules/@fses/workbench-card/dist/registry/echartsTemplateTypes.d.ts +76 -0
  84. package/node_modules/@fses/workbench-card/dist/registry/index.d.ts +10 -0
  85. package/node_modules/@fses/workbench-card/dist/renderers/WorkbenchBlockRenderer.vue.d.ts +55 -0
  86. package/node_modules/@fses/workbench-card/dist/renderers/chart/ChartRegistry.vue.d.ts +22 -0
  87. package/node_modules/@fses/workbench-card/dist/renderers/chart/EChartsProtocolRenderer.vue.d.ts +34 -0
  88. package/node_modules/@fses/workbench-card/dist/renderers/chart/chartRendererRegistry.d.ts +219 -0
  89. package/node_modules/@fses/workbench-card/dist/renderers/chart/chartResponsiveLayout.d.ts +47 -0
  90. package/node_modules/@fses/workbench-card/dist/renderers/chart/dynamicEchartOption.d.ts +30 -0
  91. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/adapter.d.ts +73 -0
  92. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/composite.converter.d.ts +11 -0
  93. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/configOnly.converter.d.ts +11 -0
  94. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/geo.converter.d.ts +10 -0
  95. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/graphic.converter.d.ts +10 -0
  96. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/layout.converter.d.ts +11 -0
  97. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/network.converter.d.ts +10 -0
  98. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/scene3D.converter.d.ts +11 -0
  99. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/series.converter.d.ts +10 -0
  100. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/table.converter.d.ts +10 -0
  101. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/timeline.converter.d.ts +11 -0
  102. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/transition.converter.d.ts +11 -0
  103. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/tree.converter.d.ts +10 -0
  104. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/tuple.converter.d.ts +10 -0
  105. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/index.d.ts +9 -0
  106. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/merger.d.ts +16 -0
  107. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/types.d.ts +447 -0
  108. package/node_modules/@fses/workbench-card/dist/renderers/chart/echartsRuntimeInteractions.d.ts +30 -0
  109. package/node_modules/@fses/workbench-card/dist/renderers/chart/echartsTitle.d.ts +13 -0
  110. package/node_modules/@fses/workbench-card/dist/renderers/chart/echartsTooltipPortal.d.ts +12 -0
  111. package/node_modules/@fses/workbench-card/dist/renderers/chart/types.d.ts +47 -0
  112. package/node_modules/@fses/workbench-card/dist/renderers/chart/useEchart.d.ts +29 -0
  113. package/node_modules/@fses/workbench-card/dist/renderers/chart/workbenchChartTheme.d.ts +36 -0
  114. package/node_modules/@fses/workbench-card/dist/renderers/custom-canvas/canvasLayoutBindings.d.ts +86 -0
  115. package/node_modules/@fses/workbench-card/dist/renderers/hostBridge.d.ts +61 -0
  116. package/node_modules/@fses/workbench-card/dist/renderers/index.d.ts +17 -0
  117. package/node_modules/@fses/workbench-card/dist/renderers/native/nativeBindings.d.ts +145 -0
  118. package/node_modules/@fses/workbench-card/dist/renderers/nested/nestedBlockBindings.d.ts +107 -0
  119. package/node_modules/@fses/workbench-card/dist/renderers/quickLinkDisplay.d.ts +24 -0
  120. package/node_modules/@fses/workbench-card/dist/renderers/reference-composite/referenceCompositeBindings.d.ts +171 -0
  121. package/node_modules/@fses/workbench-card/dist/renderers/reference-composite/referenceRiskAndStrategyBindings.d.ts +91 -0
  122. package/node_modules/@fses/workbench-card/dist/renderers/resizableTable.d.ts +51 -0
  123. package/node_modules/@fses/workbench-card/dist/renderers/style.css +1 -0
  124. package/node_modules/@fses/workbench-card/dist/renderers/tableDisplay.d.ts +25 -0
  125. package/node_modules/@fses/workbench-card/dist/renderers/useWorkbenchBlockRendererBindings.d.ts +580 -0
  126. package/node_modules/@fses/workbench-card/dist/shell/workbenchVisualShell.d.ts +48 -0
  127. package/node_modules/@fses/workbench-card/dist/style.css +1 -0
  128. package/node_modules/@fses/workbench-card/dist/types/block.d.ts +2011 -0
  129. package/node_modules/@fses/workbench-card/dist/types/canvas.d.ts +25 -0
  130. package/node_modules/@fses/workbench-card/dist/types/echartsProtocol.d.ts +445 -0
  131. package/node_modules/@fses/workbench-card/dist/types/index.d.ts +10 -0
  132. package/node_modules/@fses/workbench-card/dist/types/registry.d.ts +7 -0
  133. package/node_modules/@fses/workbench-card/dist/types/runtime.d.ts +34 -0
  134. package/node_modules/@fses/workbench-card/package.json +83 -0
  135. package/node_modules/@fses/workbench-card/src/chart/index.ts +8 -0
  136. package/node_modules/@fses/workbench-card/src/index.ts +13 -0
  137. package/node_modules/@fses/workbench-card/src/registry/cardRegistry.ts +476 -0
  138. package/node_modules/@fses/workbench-card/src/registry/compositeCardPatterns.ts +206 -0
  139. package/node_modules/@fses/workbench-card/src/registry/echartsTemplateCategories.ts +74 -0
  140. package/node_modules/@fses/workbench-card/src/registry/echartsTemplateRegistry.generated.js +19950 -0
  141. package/node_modules/@fses/workbench-card/src/registry/echartsTemplateRegistry.generated.ts +19951 -0
  142. package/node_modules/@fses/workbench-card/src/registry/echartsTemplateRegistry.ts +32 -0
  143. package/node_modules/@fses/workbench-card/src/registry/echartsTemplateTypes.ts +83 -0
  144. package/node_modules/@fses/workbench-card/src/registry/index.ts +10 -0
  145. package/node_modules/@fses/workbench-card/src/renderers/WorkbenchBlockRenderer.vue +2728 -0
  146. package/node_modules/@fses/workbench-card/src/renderers/chart/ChartRegistry.vue +221 -0
  147. package/node_modules/@fses/workbench-card/src/renderers/chart/EChartsProtocolRenderer.vue +304 -0
  148. package/node_modules/@fses/workbench-card/src/renderers/chart/chartRendererRegistry.ts +311 -0
  149. package/node_modules/@fses/workbench-card/src/renderers/chart/chartResponsiveLayout.ts +172 -0
  150. package/node_modules/@fses/workbench-card/src/renderers/chart/dynamicEchartOption.ts +127 -0
  151. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/adapter.ts +1349 -0
  152. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/composite.converter.ts +71 -0
  153. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/configOnly.converter.ts +45 -0
  154. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/geo.converter.ts +97 -0
  155. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/graphic.converter.ts +59 -0
  156. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/layout.converter.ts +53 -0
  157. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/network.converter.ts +82 -0
  158. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/scene3D.converter.ts +73 -0
  159. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/series.converter.ts +795 -0
  160. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/table.converter.ts +195 -0
  161. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/timeline.converter.ts +62 -0
  162. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/transition.converter.ts +58 -0
  163. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/tree.converter.ts +75 -0
  164. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/tuple.converter.ts +112 -0
  165. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/index.ts +10 -0
  166. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/merger.ts +109 -0
  167. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/types.ts +515 -0
  168. package/node_modules/@fses/workbench-card/src/renderers/chart/echartsRuntimeInteractions.ts +450 -0
  169. package/node_modules/@fses/workbench-card/src/renderers/chart/echartsTitle.ts +94 -0
  170. package/node_modules/@fses/workbench-card/src/renderers/chart/echartsTooltipPortal.ts +140 -0
  171. package/node_modules/@fses/workbench-card/src/renderers/chart/types.ts +53 -0
  172. package/node_modules/@fses/workbench-card/src/renderers/chart/useEchart.ts +1820 -0
  173. package/node_modules/@fses/workbench-card/src/renderers/chart/workbenchChartTheme.ts +240 -0
  174. package/node_modules/@fses/workbench-card/src/renderers/custom-canvas/canvasLayoutBindings.ts +660 -0
  175. package/node_modules/@fses/workbench-card/src/renderers/hostBridge.ts +74 -0
  176. package/node_modules/@fses/workbench-card/src/renderers/index.ts +25 -0
  177. package/node_modules/@fses/workbench-card/src/renderers/native/nativeBindings.ts +1096 -0
  178. package/node_modules/@fses/workbench-card/src/renderers/nested/nestedBlockBindings.ts +1349 -0
  179. package/node_modules/@fses/workbench-card/src/renderers/quickLinkDisplay.ts +53 -0
  180. package/node_modules/@fses/workbench-card/src/renderers/reference-composite/referenceCompositeBindings.ts +3209 -0
  181. package/node_modules/@fses/workbench-card/src/renderers/reference-composite/referenceRiskAndStrategyBindings.ts +1004 -0
  182. package/node_modules/@fses/workbench-card/src/renderers/resizableTable.ts +136 -0
  183. package/node_modules/@fses/workbench-card/src/renderers/tableDisplay.ts +140 -0
  184. package/node_modules/@fses/workbench-card/src/renderers/useWorkbenchBlockRendererBindings.ts +3192 -0
  185. package/node_modules/@fses/workbench-card/src/shell/workbenchVisualShell.ts +228 -0
  186. package/node_modules/@fses/workbench-card/src/styles/workbench-card.css +343 -0
  187. package/node_modules/@fses/workbench-card/src/types/block.ts +2496 -0
  188. package/node_modules/@fses/workbench-card/src/types/canvas.ts +30 -0
  189. package/node_modules/@fses/workbench-card/src/types/echartsProtocol.ts +513 -0
  190. package/node_modules/@fses/workbench-card/src/types/index.ts +10 -0
  191. package/node_modules/@fses/workbench-card/src/types/registry.ts +17 -0
  192. package/node_modules/@fses/workbench-card/src/types/runtime.ts +31 -0
  193. package/node_modules/dompurify/LICENSE +568 -0
  194. package/node_modules/dompurify/README.md +523 -0
  195. package/node_modules/dompurify/dist/purify.cjs.d.ts +451 -0
  196. package/node_modules/dompurify/dist/purify.cjs.js +1472 -0
  197. package/node_modules/dompurify/dist/purify.cjs.js.map +1 -0
  198. package/node_modules/dompurify/dist/purify.es.d.mts +448 -0
  199. package/node_modules/dompurify/dist/purify.es.mjs +1470 -0
  200. package/node_modules/dompurify/dist/purify.es.mjs.map +1 -0
  201. package/node_modules/dompurify/dist/purify.js +1478 -0
  202. package/node_modules/dompurify/dist/purify.js.map +1 -0
  203. package/node_modules/dompurify/dist/purify.min.js +3 -0
  204. package/node_modules/dompurify/dist/purify.min.js.map +1 -0
  205. package/node_modules/dompurify/package.json +168 -0
  206. package/node_modules/zod/LICENSE +21 -0
  207. package/node_modules/zod/README.md +208 -0
  208. package/node_modules/zod/index.cjs +33 -0
  209. package/node_modules/zod/index.d.cts +4 -0
  210. package/node_modules/zod/index.d.ts +4 -0
  211. package/node_modules/zod/index.js +4 -0
  212. package/node_modules/zod/package.json +118 -0
  213. package/node_modules/zod/src/index.ts +4 -0
  214. package/node_modules/zod/src/v3/ZodError.ts +330 -0
  215. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  216. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  217. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  218. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  219. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  220. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  221. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  222. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  223. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  224. package/node_modules/zod/src/v3/errors.ts +13 -0
  225. package/node_modules/zod/src/v3/external.ts +6 -0
  226. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  227. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  228. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  229. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  230. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  231. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  232. package/node_modules/zod/src/v3/index.ts +4 -0
  233. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  234. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  235. package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
  236. package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
  237. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
  238. package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
  239. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
  240. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
  241. package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
  242. package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
  243. package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
  244. package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
  245. package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
  246. package/node_modules/zod/src/v3/tests/complex.test.ts +56 -0
  247. package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
  248. package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
  249. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
  250. package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
  251. package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
  252. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  253. package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
  254. package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
  255. package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
  256. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  257. package/node_modules/zod/src/v3/tests/function.test.ts +257 -0
  258. package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
  259. package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
  260. package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
  261. package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
  262. package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
  263. package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
  264. package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
  265. package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
  266. package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
  267. package/node_modules/zod/src/v3/tests/nan.test.ts +21 -0
  268. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  269. package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
  270. package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
  271. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  272. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  273. package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
  274. package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
  275. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
  276. package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
  277. package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
  278. package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
  279. package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
  280. package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
  281. package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
  282. package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
  283. package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
  284. package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
  285. package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
  286. package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
  287. package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
  288. package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
  289. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
  290. package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
  291. package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
  292. package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
  293. package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
  294. package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
  295. package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
  296. package/node_modules/zod/src/v3/types.ts +5136 -0
  297. package/node_modules/zod/src/v4/classic/checks.ts +30 -0
  298. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  299. package/node_modules/zod/src/v4/classic/compat.ts +66 -0
  300. package/node_modules/zod/src/v4/classic/errors.ts +75 -0
  301. package/node_modules/zod/src/v4/classic/external.ts +50 -0
  302. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  303. package/node_modules/zod/src/v4/classic/iso.ts +90 -0
  304. package/node_modules/zod/src/v4/classic/parse.ts +33 -0
  305. package/node_modules/zod/src/v4/classic/schemas.ts +2054 -0
  306. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  307. package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
  308. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +210 -0
  309. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  310. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  311. package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
  312. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
  313. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +63 -0
  314. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +252 -0
  315. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  316. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  317. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +352 -0
  318. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
  319. package/node_modules/zod/src/v4/classic/tests/date.test.ts +31 -0
  320. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +296 -0
  321. package/node_modules/zod/src/v4/classic/tests/default.test.ts +313 -0
  322. package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
  323. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +619 -0
  324. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
  325. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +527 -0
  326. package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
  327. package/node_modules/zod/src/v4/classic/tests/file.test.ts +91 -0
  328. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +175 -0
  329. package/node_modules/zod/src/v4/classic/tests/function.test.ts +268 -0
  330. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
  331. package/node_modules/zod/src/v4/classic/tests/index.test.ts +829 -0
  332. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +34 -0
  333. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +171 -0
  334. package/node_modules/zod/src/v4/classic/tests/json.test.ts +108 -0
  335. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
  336. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +92 -0
  337. package/node_modules/zod/src/v4/classic/tests/map.test.ts +196 -0
  338. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
  339. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  340. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +86 -0
  341. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  342. package/node_modules/zod/src/v4/classic/tests/number.test.ts +247 -0
  343. package/node_modules/zod/src/v4/classic/tests/object.test.ts +563 -0
  344. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +123 -0
  345. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +147 -0
  346. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +127 -0
  347. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +81 -0
  348. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +37 -0
  349. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +298 -0
  350. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  351. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
  352. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  353. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
  354. package/node_modules/zod/src/v4/classic/tests/record.test.ts +342 -0
  355. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +356 -0
  356. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +532 -0
  357. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +204 -0
  358. package/node_modules/zod/src/v4/classic/tests/set.test.ts +179 -0
  359. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +57 -0
  360. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +109 -0
  361. package/node_modules/zod/src/v4/classic/tests/string.test.ts +881 -0
  362. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +66 -0
  363. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +758 -0
  364. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +2314 -0
  365. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +250 -0
  366. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +163 -0
  367. package/node_modules/zod/src/v4/classic/tests/union.test.ts +94 -0
  368. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
  369. package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
  370. package/node_modules/zod/src/v4/core/api.ts +1594 -0
  371. package/node_modules/zod/src/v4/core/checks.ts +1283 -0
  372. package/node_modules/zod/src/v4/core/config.ts +15 -0
  373. package/node_modules/zod/src/v4/core/core.ts +134 -0
  374. package/node_modules/zod/src/v4/core/doc.ts +44 -0
  375. package/node_modules/zod/src/v4/core/errors.ts +424 -0
  376. package/node_modules/zod/src/v4/core/function.ts +176 -0
  377. package/node_modules/zod/src/v4/core/index.ts +15 -0
  378. package/node_modules/zod/src/v4/core/json-schema.ts +143 -0
  379. package/node_modules/zod/src/v4/core/parse.ts +94 -0
  380. package/node_modules/zod/src/v4/core/regexes.ts +135 -0
  381. package/node_modules/zod/src/v4/core/registries.ts +96 -0
  382. package/node_modules/zod/src/v4/core/schemas.ts +3842 -0
  383. package/node_modules/zod/src/v4/core/standard-schema.ts +64 -0
  384. package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
  385. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  386. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  387. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  388. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  389. package/node_modules/zod/src/v4/core/to-json-schema.ts +977 -0
  390. package/node_modules/zod/src/v4/core/util.ts +775 -0
  391. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  392. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  393. package/node_modules/zod/src/v4/index.ts +4 -0
  394. package/node_modules/zod/src/v4/locales/ar.ts +125 -0
  395. package/node_modules/zod/src/v4/locales/az.ts +121 -0
  396. package/node_modules/zod/src/v4/locales/be.ts +184 -0
  397. package/node_modules/zod/src/v4/locales/ca.ts +127 -0
  398. package/node_modules/zod/src/v4/locales/cs.ts +142 -0
  399. package/node_modules/zod/src/v4/locales/de.ts +124 -0
  400. package/node_modules/zod/src/v4/locales/en.ts +127 -0
  401. package/node_modules/zod/src/v4/locales/eo.ts +125 -0
  402. package/node_modules/zod/src/v4/locales/es.ts +125 -0
  403. package/node_modules/zod/src/v4/locales/fa.ts +134 -0
  404. package/node_modules/zod/src/v4/locales/fi.ts +131 -0
  405. package/node_modules/zod/src/v4/locales/fr-CA.ts +126 -0
  406. package/node_modules/zod/src/v4/locales/fr.ts +124 -0
  407. package/node_modules/zod/src/v4/locales/he.ts +125 -0
  408. package/node_modules/zod/src/v4/locales/hu.ts +126 -0
  409. package/node_modules/zod/src/v4/locales/id.ts +125 -0
  410. package/node_modules/zod/src/v4/locales/index.ts +39 -0
  411. package/node_modules/zod/src/v4/locales/it.ts +125 -0
  412. package/node_modules/zod/src/v4/locales/ja.ts +122 -0
  413. package/node_modules/zod/src/v4/locales/kh.ts +126 -0
  414. package/node_modules/zod/src/v4/locales/ko.ts +131 -0
  415. package/node_modules/zod/src/v4/locales/mk.ts +127 -0
  416. package/node_modules/zod/src/v4/locales/ms.ts +124 -0
  417. package/node_modules/zod/src/v4/locales/nl.ts +126 -0
  418. package/node_modules/zod/src/v4/locales/no.ts +124 -0
  419. package/node_modules/zod/src/v4/locales/ota.ts +125 -0
  420. package/node_modules/zod/src/v4/locales/pl.ts +126 -0
  421. package/node_modules/zod/src/v4/locales/ps.ts +133 -0
  422. package/node_modules/zod/src/v4/locales/pt.ts +123 -0
  423. package/node_modules/zod/src/v4/locales/ru.ts +184 -0
  424. package/node_modules/zod/src/v4/locales/sl.ts +126 -0
  425. package/node_modules/zod/src/v4/locales/sv.ts +127 -0
  426. package/node_modules/zod/src/v4/locales/ta.ts +125 -0
  427. package/node_modules/zod/src/v4/locales/th.ts +126 -0
  428. package/node_modules/zod/src/v4/locales/tr.ts +121 -0
  429. package/node_modules/zod/src/v4/locales/ua.ts +126 -0
  430. package/node_modules/zod/src/v4/locales/ur.ts +126 -0
  431. package/node_modules/zod/src/v4/locales/vi.ts +125 -0
  432. package/node_modules/zod/src/v4/locales/zh-CN.ts +123 -0
  433. package/node_modules/zod/src/v4/locales/zh-TW.ts +125 -0
  434. package/node_modules/zod/src/v4/mini/checks.ts +32 -0
  435. package/node_modules/zod/src/v4/mini/coerce.ts +22 -0
  436. package/node_modules/zod/src/v4/mini/external.ts +40 -0
  437. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  438. package/node_modules/zod/src/v4/mini/iso.ts +62 -0
  439. package/node_modules/zod/src/v4/mini/parse.ts +1 -0
  440. package/node_modules/zod/src/v4/mini/schemas.ts +1579 -0
  441. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
  442. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +51 -0
  443. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
  444. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
  445. package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
  446. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +43 -0
  447. package/node_modules/zod/src/v4/mini/tests/index.test.ts +871 -0
  448. package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
  449. package/node_modules/zod/src/v4/mini/tests/object.test.ts +185 -0
  450. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  451. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
  452. package/node_modules/zod/src/v4/mini/tests/string.test.ts +299 -0
  453. package/node_modules/zod/src/v4-mini/index.ts +1 -0
  454. package/node_modules/zod/v3/ZodError.cjs +138 -0
  455. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  456. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  457. package/node_modules/zod/v3/ZodError.js +133 -0
  458. package/node_modules/zod/v3/errors.cjs +17 -0
  459. package/node_modules/zod/v3/errors.d.cts +5 -0
  460. package/node_modules/zod/v3/errors.d.ts +5 -0
  461. package/node_modules/zod/v3/errors.js +9 -0
  462. package/node_modules/zod/v3/external.cjs +22 -0
  463. package/node_modules/zod/v3/external.d.cts +6 -0
  464. package/node_modules/zod/v3/external.d.ts +6 -0
  465. package/node_modules/zod/v3/external.js +6 -0
  466. package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
  467. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  468. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  469. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  470. package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
  471. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  472. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  473. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  474. package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
  475. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  476. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  477. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  478. package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
  479. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  480. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  481. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  482. package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
  483. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  484. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  485. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  486. package/node_modules/zod/v3/helpers/util.cjs +137 -0
  487. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  488. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  489. package/node_modules/zod/v3/helpers/util.js +133 -0
  490. package/node_modules/zod/v3/index.cjs +33 -0
  491. package/node_modules/zod/v3/index.d.cts +4 -0
  492. package/node_modules/zod/v3/index.d.ts +4 -0
  493. package/node_modules/zod/v3/index.js +4 -0
  494. package/node_modules/zod/v3/locales/en.cjs +111 -0
  495. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  496. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  497. package/node_modules/zod/v3/locales/en.js +109 -0
  498. package/node_modules/zod/v3/standard-schema.cjs +2 -0
  499. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  500. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  501. package/node_modules/zod/v3/standard-schema.js +1 -0
  502. package/node_modules/zod/v3/types.cjs +3775 -0
  503. package/node_modules/zod/v3/types.d.cts +1031 -0
  504. package/node_modules/zod/v3/types.d.ts +1031 -0
  505. package/node_modules/zod/v3/types.js +3693 -0
  506. package/node_modules/zod/v4/classic/checks.cjs +32 -0
  507. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  508. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  509. package/node_modules/zod/v4/classic/checks.js +1 -0
  510. package/node_modules/zod/v4/classic/coerce.cjs +47 -0
  511. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  512. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  513. package/node_modules/zod/v4/classic/coerce.js +17 -0
  514. package/node_modules/zod/v4/classic/compat.cjs +57 -0
  515. package/node_modules/zod/v4/classic/compat.d.cts +46 -0
  516. package/node_modules/zod/v4/classic/compat.d.ts +46 -0
  517. package/node_modules/zod/v4/classic/compat.js +27 -0
  518. package/node_modules/zod/v4/classic/errors.cjs +67 -0
  519. package/node_modules/zod/v4/classic/errors.d.cts +30 -0
  520. package/node_modules/zod/v4/classic/errors.d.ts +30 -0
  521. package/node_modules/zod/v4/classic/errors.js +41 -0
  522. package/node_modules/zod/v4/classic/external.cjs +70 -0
  523. package/node_modules/zod/v4/classic/external.d.cts +13 -0
  524. package/node_modules/zod/v4/classic/external.d.ts +13 -0
  525. package/node_modules/zod/v4/classic/external.js +18 -0
  526. package/node_modules/zod/v4/classic/index.cjs +33 -0
  527. package/node_modules/zod/v4/classic/index.d.cts +4 -0
  528. package/node_modules/zod/v4/classic/index.d.ts +4 -0
  529. package/node_modules/zod/v4/classic/index.js +4 -0
  530. package/node_modules/zod/v4/classic/iso.cjs +60 -0
  531. package/node_modules/zod/v4/classic/iso.d.cts +22 -0
  532. package/node_modules/zod/v4/classic/iso.d.ts +22 -0
  533. package/node_modules/zod/v4/classic/iso.js +30 -0
  534. package/node_modules/zod/v4/classic/parse.cjs +32 -0
  535. package/node_modules/zod/v4/classic/parse.d.cts +23 -0
  536. package/node_modules/zod/v4/classic/parse.d.ts +23 -0
  537. package/node_modules/zod/v4/classic/parse.js +6 -0
  538. package/node_modules/zod/v4/classic/schemas.cjs +1109 -0
  539. package/node_modules/zod/v4/classic/schemas.d.cts +630 -0
  540. package/node_modules/zod/v4/classic/schemas.d.ts +630 -0
  541. package/node_modules/zod/v4/classic/schemas.js +1006 -0
  542. package/node_modules/zod/v4/core/api.cjs +1039 -0
  543. package/node_modules/zod/v4/core/api.d.cts +284 -0
  544. package/node_modules/zod/v4/core/api.d.ts +284 -0
  545. package/node_modules/zod/v4/core/api.js +906 -0
  546. package/node_modules/zod/v4/core/checks.cjs +591 -0
  547. package/node_modules/zod/v4/core/checks.d.cts +278 -0
  548. package/node_modules/zod/v4/core/checks.d.ts +278 -0
  549. package/node_modules/zod/v4/core/checks.js +565 -0
  550. package/node_modules/zod/v4/core/core.cjs +67 -0
  551. package/node_modules/zod/v4/core/core.d.cts +49 -0
  552. package/node_modules/zod/v4/core/core.d.ts +49 -0
  553. package/node_modules/zod/v4/core/core.js +61 -0
  554. package/node_modules/zod/v4/core/doc.cjs +39 -0
  555. package/node_modules/zod/v4/core/doc.d.cts +14 -0
  556. package/node_modules/zod/v4/core/doc.d.ts +14 -0
  557. package/node_modules/zod/v4/core/doc.js +35 -0
  558. package/node_modules/zod/v4/core/errors.cjs +226 -0
  559. package/node_modules/zod/v4/core/errors.d.cts +208 -0
  560. package/node_modules/zod/v4/core/errors.d.ts +208 -0
  561. package/node_modules/zod/v4/core/errors.js +195 -0
  562. package/node_modules/zod/v4/core/function.cjs +102 -0
  563. package/node_modules/zod/v4/core/function.d.cts +52 -0
  564. package/node_modules/zod/v4/core/function.d.ts +52 -0
  565. package/node_modules/zod/v4/core/function.js +75 -0
  566. package/node_modules/zod/v4/core/index.cjs +44 -0
  567. package/node_modules/zod/v4/core/index.d.cts +15 -0
  568. package/node_modules/zod/v4/core/index.d.ts +15 -0
  569. package/node_modules/zod/v4/core/index.js +15 -0
  570. package/node_modules/zod/v4/core/json-schema.cjs +2 -0
  571. package/node_modules/zod/v4/core/json-schema.d.cts +87 -0
  572. package/node_modules/zod/v4/core/json-schema.d.ts +87 -0
  573. package/node_modules/zod/v4/core/json-schema.js +1 -0
  574. package/node_modules/zod/v4/core/parse.cjs +87 -0
  575. package/node_modules/zod/v4/core/parse.d.cts +25 -0
  576. package/node_modules/zod/v4/core/parse.d.ts +25 -0
  577. package/node_modules/zod/v4/core/parse.js +57 -0
  578. package/node_modules/zod/v4/core/regexes.cjs +103 -0
  579. package/node_modules/zod/v4/core/regexes.d.cts +62 -0
  580. package/node_modules/zod/v4/core/regexes.d.ts +62 -0
  581. package/node_modules/zod/v4/core/regexes.js +95 -0
  582. package/node_modules/zod/v4/core/registries.cjs +56 -0
  583. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  584. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  585. package/node_modules/zod/v4/core/registries.js +51 -0
  586. package/node_modules/zod/v4/core/schemas.cjs +1748 -0
  587. package/node_modules/zod/v4/core/schemas.d.cts +1041 -0
  588. package/node_modules/zod/v4/core/schemas.d.ts +1041 -0
  589. package/node_modules/zod/v4/core/schemas.js +1717 -0
  590. package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
  591. package/node_modules/zod/v4/core/standard-schema.d.cts +55 -0
  592. package/node_modules/zod/v4/core/standard-schema.d.ts +55 -0
  593. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  594. package/node_modules/zod/v4/core/to-json-schema.cjs +854 -0
  595. package/node_modules/zod/v4/core/to-json-schema.d.cts +88 -0
  596. package/node_modules/zod/v4/core/to-json-schema.d.ts +88 -0
  597. package/node_modules/zod/v4/core/to-json-schema.js +849 -0
  598. package/node_modules/zod/v4/core/util.cjs +539 -0
  599. package/node_modules/zod/v4/core/util.d.cts +183 -0
  600. package/node_modules/zod/v4/core/util.d.ts +183 -0
  601. package/node_modules/zod/v4/core/util.js +493 -0
  602. package/node_modules/zod/v4/core/versions.cjs +8 -0
  603. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  604. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  605. package/node_modules/zod/v4/core/versions.js +5 -0
  606. package/node_modules/zod/v4/index.cjs +22 -0
  607. package/node_modules/zod/v4/index.d.cts +3 -0
  608. package/node_modules/zod/v4/index.d.ts +3 -0
  609. package/node_modules/zod/v4/index.js +3 -0
  610. package/node_modules/zod/v4/locales/ar.cjs +142 -0
  611. package/node_modules/zod/v4/locales/ar.d.cts +4 -0
  612. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  613. package/node_modules/zod/v4/locales/ar.js +116 -0
  614. package/node_modules/zod/v4/locales/az.cjs +141 -0
  615. package/node_modules/zod/v4/locales/az.d.cts +4 -0
  616. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  617. package/node_modules/zod/v4/locales/az.js +115 -0
  618. package/node_modules/zod/v4/locales/be.cjs +190 -0
  619. package/node_modules/zod/v4/locales/be.d.cts +4 -0
  620. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  621. package/node_modules/zod/v4/locales/be.js +164 -0
  622. package/node_modules/zod/v4/locales/ca.cjs +144 -0
  623. package/node_modules/zod/v4/locales/ca.d.cts +4 -0
  624. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  625. package/node_modules/zod/v4/locales/ca.js +118 -0
  626. package/node_modules/zod/v4/locales/cs.cjs +161 -0
  627. package/node_modules/zod/v4/locales/cs.d.cts +4 -0
  628. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  629. package/node_modules/zod/v4/locales/cs.js +135 -0
  630. package/node_modules/zod/v4/locales/de.cjs +142 -0
  631. package/node_modules/zod/v4/locales/de.d.cts +4 -0
  632. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  633. package/node_modules/zod/v4/locales/de.js +116 -0
  634. package/node_modules/zod/v4/locales/en.cjs +145 -0
  635. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  636. package/node_modules/zod/v4/locales/en.d.ts +5 -0
  637. package/node_modules/zod/v4/locales/en.js +117 -0
  638. package/node_modules/zod/v4/locales/eo.cjs +144 -0
  639. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  640. package/node_modules/zod/v4/locales/eo.d.ts +5 -0
  641. package/node_modules/zod/v4/locales/eo.js +116 -0
  642. package/node_modules/zod/v4/locales/es.cjs +143 -0
  643. package/node_modules/zod/v4/locales/es.d.cts +4 -0
  644. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  645. package/node_modules/zod/v4/locales/es.js +117 -0
  646. package/node_modules/zod/v4/locales/fa.cjs +148 -0
  647. package/node_modules/zod/v4/locales/fa.d.cts +4 -0
  648. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  649. package/node_modules/zod/v4/locales/fa.js +122 -0
  650. package/node_modules/zod/v4/locales/fi.cjs +148 -0
  651. package/node_modules/zod/v4/locales/fi.d.cts +4 -0
  652. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  653. package/node_modules/zod/v4/locales/fi.js +122 -0
  654. package/node_modules/zod/v4/locales/fr-CA.cjs +143 -0
  655. package/node_modules/zod/v4/locales/fr-CA.d.cts +4 -0
  656. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  657. package/node_modules/zod/v4/locales/fr-CA.js +117 -0
  658. package/node_modules/zod/v4/locales/fr.cjs +142 -0
  659. package/node_modules/zod/v4/locales/fr.d.cts +4 -0
  660. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  661. package/node_modules/zod/v4/locales/fr.js +116 -0
  662. package/node_modules/zod/v4/locales/he.cjs +143 -0
  663. package/node_modules/zod/v4/locales/he.d.cts +4 -0
  664. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  665. package/node_modules/zod/v4/locales/he.js +117 -0
  666. package/node_modules/zod/v4/locales/hu.cjs +143 -0
  667. package/node_modules/zod/v4/locales/hu.d.cts +4 -0
  668. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  669. package/node_modules/zod/v4/locales/hu.js +117 -0
  670. package/node_modules/zod/v4/locales/id.cjs +142 -0
  671. package/node_modules/zod/v4/locales/id.d.cts +4 -0
  672. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  673. package/node_modules/zod/v4/locales/id.js +116 -0
  674. package/node_modules/zod/v4/locales/index.cjs +84 -0
  675. package/node_modules/zod/v4/locales/index.d.cts +39 -0
  676. package/node_modules/zod/v4/locales/index.d.ts +39 -0
  677. package/node_modules/zod/v4/locales/index.js +39 -0
  678. package/node_modules/zod/v4/locales/it.cjs +143 -0
  679. package/node_modules/zod/v4/locales/it.d.cts +4 -0
  680. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  681. package/node_modules/zod/v4/locales/it.js +117 -0
  682. package/node_modules/zod/v4/locales/ja.cjs +141 -0
  683. package/node_modules/zod/v4/locales/ja.d.cts +4 -0
  684. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  685. package/node_modules/zod/v4/locales/ja.js +115 -0
  686. package/node_modules/zod/v4/locales/kh.cjs +143 -0
  687. package/node_modules/zod/v4/locales/kh.d.cts +4 -0
  688. package/node_modules/zod/v4/locales/kh.d.ts +4 -0
  689. package/node_modules/zod/v4/locales/kh.js +117 -0
  690. package/node_modules/zod/v4/locales/ko.cjs +147 -0
  691. package/node_modules/zod/v4/locales/ko.d.cts +4 -0
  692. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  693. package/node_modules/zod/v4/locales/ko.js +121 -0
  694. package/node_modules/zod/v4/locales/mk.cjs +144 -0
  695. package/node_modules/zod/v4/locales/mk.d.cts +4 -0
  696. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  697. package/node_modules/zod/v4/locales/mk.js +118 -0
  698. package/node_modules/zod/v4/locales/ms.cjs +142 -0
  699. package/node_modules/zod/v4/locales/ms.d.cts +4 -0
  700. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  701. package/node_modules/zod/v4/locales/ms.js +116 -0
  702. package/node_modules/zod/v4/locales/nl.cjs +143 -0
  703. package/node_modules/zod/v4/locales/nl.d.cts +4 -0
  704. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  705. package/node_modules/zod/v4/locales/nl.js +117 -0
  706. package/node_modules/zod/v4/locales/no.cjs +142 -0
  707. package/node_modules/zod/v4/locales/no.d.cts +4 -0
  708. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  709. package/node_modules/zod/v4/locales/no.js +116 -0
  710. package/node_modules/zod/v4/locales/ota.cjs +143 -0
  711. package/node_modules/zod/v4/locales/ota.d.cts +4 -0
  712. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  713. package/node_modules/zod/v4/locales/ota.js +117 -0
  714. package/node_modules/zod/v4/locales/pl.cjs +143 -0
  715. package/node_modules/zod/v4/locales/pl.d.cts +4 -0
  716. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  717. package/node_modules/zod/v4/locales/pl.js +117 -0
  718. package/node_modules/zod/v4/locales/ps.cjs +148 -0
  719. package/node_modules/zod/v4/locales/ps.d.cts +4 -0
  720. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  721. package/node_modules/zod/v4/locales/ps.js +122 -0
  722. package/node_modules/zod/v4/locales/pt.cjs +142 -0
  723. package/node_modules/zod/v4/locales/pt.d.cts +4 -0
  724. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  725. package/node_modules/zod/v4/locales/pt.js +116 -0
  726. package/node_modules/zod/v4/locales/ru.cjs +190 -0
  727. package/node_modules/zod/v4/locales/ru.d.cts +4 -0
  728. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  729. package/node_modules/zod/v4/locales/ru.js +164 -0
  730. package/node_modules/zod/v4/locales/sl.cjs +143 -0
  731. package/node_modules/zod/v4/locales/sl.d.cts +4 -0
  732. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  733. package/node_modules/zod/v4/locales/sl.js +117 -0
  734. package/node_modules/zod/v4/locales/sv.cjs +144 -0
  735. package/node_modules/zod/v4/locales/sv.d.cts +4 -0
  736. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  737. package/node_modules/zod/v4/locales/sv.js +118 -0
  738. package/node_modules/zod/v4/locales/ta.cjs +143 -0
  739. package/node_modules/zod/v4/locales/ta.d.cts +4 -0
  740. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  741. package/node_modules/zod/v4/locales/ta.js +117 -0
  742. package/node_modules/zod/v4/locales/th.cjs +143 -0
  743. package/node_modules/zod/v4/locales/th.d.cts +4 -0
  744. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  745. package/node_modules/zod/v4/locales/th.js +117 -0
  746. package/node_modules/zod/v4/locales/tr.cjs +143 -0
  747. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  748. package/node_modules/zod/v4/locales/tr.d.ts +5 -0
  749. package/node_modules/zod/v4/locales/tr.js +115 -0
  750. package/node_modules/zod/v4/locales/ua.cjs +143 -0
  751. package/node_modules/zod/v4/locales/ua.d.cts +4 -0
  752. package/node_modules/zod/v4/locales/ua.d.ts +4 -0
  753. package/node_modules/zod/v4/locales/ua.js +117 -0
  754. package/node_modules/zod/v4/locales/ur.cjs +143 -0
  755. package/node_modules/zod/v4/locales/ur.d.cts +4 -0
  756. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  757. package/node_modules/zod/v4/locales/ur.js +117 -0
  758. package/node_modules/zod/v4/locales/vi.cjs +142 -0
  759. package/node_modules/zod/v4/locales/vi.d.cts +4 -0
  760. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  761. package/node_modules/zod/v4/locales/vi.js +116 -0
  762. package/node_modules/zod/v4/locales/zh-CN.cjs +142 -0
  763. package/node_modules/zod/v4/locales/zh-CN.d.cts +4 -0
  764. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  765. package/node_modules/zod/v4/locales/zh-CN.js +116 -0
  766. package/node_modules/zod/v4/locales/zh-TW.cjs +143 -0
  767. package/node_modules/zod/v4/locales/zh-TW.d.cts +4 -0
  768. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  769. package/node_modules/zod/v4/locales/zh-TW.js +117 -0
  770. package/node_modules/zod/v4/mini/checks.cjs +34 -0
  771. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  772. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  773. package/node_modules/zod/v4/mini/checks.js +1 -0
  774. package/node_modules/zod/v4/mini/coerce.cjs +47 -0
  775. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  776. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  777. package/node_modules/zod/v4/mini/coerce.js +17 -0
  778. package/node_modules/zod/v4/mini/external.cjs +62 -0
  779. package/node_modules/zod/v4/mini/external.d.cts +11 -0
  780. package/node_modules/zod/v4/mini/external.d.ts +11 -0
  781. package/node_modules/zod/v4/mini/external.js +13 -0
  782. package/node_modules/zod/v4/mini/index.cjs +32 -0
  783. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  784. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  785. package/node_modules/zod/v4/mini/index.js +3 -0
  786. package/node_modules/zod/v4/mini/iso.cjs +60 -0
  787. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  788. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  789. package/node_modules/zod/v4/mini/iso.js +30 -0
  790. package/node_modules/zod/v4/mini/parse.cjs +8 -0
  791. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  792. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  793. package/node_modules/zod/v4/mini/parse.js +1 -0
  794. package/node_modules/zod/v4/mini/schemas.cjs +839 -0
  795. package/node_modules/zod/v4/mini/schemas.d.cts +356 -0
  796. package/node_modules/zod/v4/mini/schemas.d.ts +356 -0
  797. package/node_modules/zod/v4/mini/schemas.js +732 -0
  798. package/node_modules/zod/v4-mini/index.cjs +17 -0
  799. package/node_modules/zod/v4-mini/index.d.cts +1 -0
  800. package/node_modules/zod/v4-mini/index.d.ts +1 -0
  801. package/node_modules/zod/v4-mini/index.js +1 -0
  802. package/package.json +99 -104
  803. package/dist/Workspace-DMye5DU8.js +0 -43113
@@ -0,0 +1,3380 @@
1
+ //#region src/thread-item-notification-contract.ts
2
+ const FDE_TYPED_TURN_V2_PROTOCOL_VERSION = "fde_typed_turn_v2";
3
+ const FDE_TURN_STATUSES = [
4
+ "inProgress",
5
+ "completed",
6
+ "failed",
7
+ "interrupted"
8
+ ];
9
+ const FDE_TURN_ITEMS_VIEWS = [
10
+ "notLoaded",
11
+ "summary",
12
+ "full"
13
+ ];
14
+ const FDE_PUBLIC_ITEM_LIFECYCLES = [
15
+ "started",
16
+ "updated",
17
+ "completed"
18
+ ];
19
+ const FDE_AGENT_MESSAGE_PHASES = ["final_answer", "commentary"];
20
+ const FDE_EXECUTION_STATUSES = [
21
+ "pending",
22
+ "running",
23
+ "succeeded",
24
+ "failed",
25
+ "declined"
26
+ ];
27
+ const FDE_EVENT_APPENDED_NOTIFICATION_METHODS = [
28
+ "item/started",
29
+ "item/updated",
30
+ "item/completed",
31
+ "serverRequest/resolved",
32
+ "fde-core/event.watermark",
33
+ "fde-core/turn.started",
34
+ "fde-core/turn.completed",
35
+ "fde-core/turn.failed",
36
+ "fde-core/turn.cancelled",
37
+ "fde/archiveResource/saved"
38
+ ];
39
+ const FDE_DELTA_NOTIFICATION_METHODS = [
40
+ "item/commandExecution/outputDelta",
41
+ "item/fileChange/patchUpdated",
42
+ "item/agentMessage/delta",
43
+ "item/plan/delta",
44
+ "item/reasoning/summaryTextDelta",
45
+ "item/mcpToolCall/progress"
46
+ ];
47
+ const FDE_PROJECTION_BACKED_LIVE_NOTIFICATION_METHODS = ["runtime.state.updated"];
48
+ const FDE_ADAPTER_LIVE_NOTIFICATION_METHODS = [
49
+ "fde-core/turn.started",
50
+ "fde-core/turn.completed",
51
+ "fde-core/turn.failed",
52
+ "fde-core/turn.cancelled",
53
+ "fde/archiveResource/saved"
54
+ ];
55
+ const FDE_SUBSCRIPTION_NOTIFICATION_METHODS = [
56
+ ...FDE_EVENT_APPENDED_NOTIFICATION_METHODS,
57
+ ...FDE_DELTA_NOTIFICATION_METHODS,
58
+ ...FDE_PROJECTION_BACKED_LIVE_NOTIFICATION_METHODS
59
+ ];
60
+ //#endregion
61
+ //#region src/fde-core/identity.ts
62
+ function fdeCoreServerRequestIdentityKey(identity) {
63
+ const normalized = normalizeFdeCoreServerRequestIdentity(identity);
64
+ return JSON.stringify([
65
+ normalized.threadId,
66
+ normalized.turnId,
67
+ normalized.requestId,
68
+ normalized.requestRevision,
69
+ normalized.stateRevision
70
+ ]);
71
+ }
72
+ function normalizeFdeCoreServerRequestIdentity(value) {
73
+ const identity = asRecord$2(value, "serverRequestIdentity");
74
+ return {
75
+ requestId: requiredString$2(identity.requestId, "requestId"),
76
+ requestRevision: requiredNumber$2(identity.requestRevision, "requestRevision"),
77
+ stateRevision: requiredNumber$2(identity.stateRevision, "stateRevision"),
78
+ threadId: requiredString$2(identity.threadId, "threadId"),
79
+ turnId: requiredString$2(identity.turnId, "turnId")
80
+ };
81
+ }
82
+ function isFdeCoreServerRequestIdentityWire(value) {
83
+ try {
84
+ normalizeFdeCoreServerRequestIdentity(value);
85
+ return true;
86
+ } catch {
87
+ return false;
88
+ }
89
+ }
90
+ function normalizeFdeCoreResponseToRequestWire(value, fieldName = "responseToRequest") {
91
+ if (value === void 0) return void 0;
92
+ const record = asRecord$2(value, fieldName);
93
+ return {
94
+ ownerTurnId: requiredString$2(record.ownerTurnId, `${fieldName}.ownerTurnId`),
95
+ requestId: requiredString$2(record.requestId, `${fieldName}.requestId`),
96
+ requestRevision: requiredPositiveSafeInteger$1(record.requestRevision, `${fieldName}.requestRevision`),
97
+ requestStateRevision: requiredPositiveSafeInteger$1(record.requestStateRevision, `${fieldName}.requestStateRevision`)
98
+ };
99
+ }
100
+ function normalizeFdeCoreResponseToRequestWireFromRecord(value, fieldName = "turn") {
101
+ const record = asRecord$2(value, fieldName);
102
+ if (Object.prototype.hasOwnProperty.call(record, "response_to_request")) throw new Error(`${fieldName}.response_to_request is not a protocol field; map it in fde-agent before normalization.`);
103
+ if (!Object.prototype.hasOwnProperty.call(record, "responseToRequest")) return;
104
+ return normalizeFdeCoreResponseToRequestWire(record.responseToRequest, `${fieldName}.responseToRequest`);
105
+ }
106
+ function fdeCoreServerRequestIdentityFromResponseToRequest(input) {
107
+ const responseToRequest = normalizeFdeCoreResponseToRequestWire(input.responseToRequest);
108
+ if (!responseToRequest) throw new Error("responseToRequest is required.");
109
+ return {
110
+ requestId: responseToRequest.requestId,
111
+ requestRevision: responseToRequest.requestRevision,
112
+ stateRevision: responseToRequest.requestStateRevision,
113
+ threadId: requiredString$2(input.threadId, "threadId"),
114
+ turnId: responseToRequest.ownerTurnId
115
+ };
116
+ }
117
+ function asRecord$2(value, field) {
118
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`${field} must be an object.`);
119
+ return value;
120
+ }
121
+ function requiredString$2(value, field) {
122
+ if (typeof value !== "string" || !value.trim()) throw new Error(`${field} is required.`);
123
+ return value.trim();
124
+ }
125
+ function requiredNumber$2(value, field) {
126
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new Error(`${field} is required.`);
127
+ return value;
128
+ }
129
+ function requiredPositiveSafeInteger$1(value, field) {
130
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) throw new Error(`${field} must be a positive safe integer.`);
131
+ return value;
132
+ }
133
+ //#endregion
134
+ //#region src/fde-core/index.ts
135
+ /**
136
+ * app/UI wire 常量:用于让 fde-agent adapter 和前端识别“formal save approval”
137
+ * 这个 approval surface。它不是 core runtime 的能力声明,也不表示协议包知道
138
+ * formal-save materialization 的目标、private context、provider receipt 或
139
+ * 平台 side-effect scope。新增 formal-save 细节时应留在 app adapter 的私有
140
+ * payload/执行层,protocol 只承载可公开展示和可提交的 decision。
141
+ */
142
+ const SYSTEM_ANALYSIS_FORMAL_SAVE_APPROVE_REQUEST_TYPE = "system_analysis.formal_save.approve";
143
+ const BUILD_FORMAL_SAVE_APPROVE_REQUEST_TYPE = "build.formal_save.approve";
144
+ const BUILD_RETIRED_SAVE_APPROVAL_REQUEST_TYPES = [
145
+ "build.overwrite.approve",
146
+ "build.platform_sync.approve",
147
+ "build.publish.approve"
148
+ ];
149
+ const BUILD_RETIRED_NON_SAVE_REQUEST_TYPES = [
150
+ "build.clarification",
151
+ "build.semantic_target.clarification",
152
+ "build.module.select",
153
+ "build.requirement.clarification",
154
+ "build.requirement.clarify",
155
+ "build.structured_model_edit.clarification",
156
+ "build.target.resolve",
157
+ "build.model_blueprint.confirm",
158
+ "build.model_blueprint.clarify",
159
+ "build.model_blueprint.generation_failed",
160
+ "build.model_edit_safety.resolve",
161
+ "build.review.decide",
162
+ "build.dependency_request",
163
+ "build.source_dependency.select",
164
+ "build_source_dependency_required",
165
+ "build_module_required"
166
+ ];
167
+ const BUILD_RETIRED_NON_SAVE_PUBLIC_PAYLOAD_TYPES = [
168
+ "build_model_blueprint_confirmation",
169
+ "build_goal_plan_required",
170
+ "build_output_target_required",
171
+ "build_skill_dependency_required",
172
+ "build_source_dependency_required",
173
+ "build_module_required",
174
+ "build.semantic_clarification"
175
+ ];
176
+ const BUILD_RETIRED_NON_SAVE_SURFACE_KINDS = [
177
+ "build_source_dependency",
178
+ "build_module_selection",
179
+ "model_blueprint_confirmation"
180
+ ];
181
+ const BUILD_RETIRED_NON_SAVE_SURFACE_KIND_TO_PUBLIC_PAYLOAD_TYPE = {
182
+ build_module_selection: "build_module_required",
183
+ build_source_dependency: "build_source_dependency_required",
184
+ model_blueprint_confirmation: "build_model_blueprint_confirmation"
185
+ };
186
+ const FDE_PROTOCOL_BUILD = {
187
+ contractRevision: "fde-core-surface-v2-formal-save-required-operation",
188
+ packageName: "@byteluck/agentic-protocol",
189
+ schemaHash: "fde-core-surface-v2-formal-save-required-operation",
190
+ version: "1.0.5"
191
+ };
192
+ const clientMethods = new Set([
193
+ "thread/read",
194
+ "thread/resume",
195
+ "thread/start",
196
+ "thread/turns/list",
197
+ "turn/continue",
198
+ "turn/interrupt",
199
+ "turn/read",
200
+ "turn/start",
201
+ "turn/steer"
202
+ ]);
203
+ function normalizeFdeCoreClientRequest(value) {
204
+ const request = asRecord$1(value, "request");
205
+ const id = requiredString$1(request.id, "id");
206
+ const method = requiredClientMethod(request.method);
207
+ const params = asRecord$1(request.params, "params");
208
+ switch (method) {
209
+ case "thread/read": return {
210
+ id,
211
+ method,
212
+ params: {
213
+ includeTurns: optionalBoolean(params.includeTurns, "includeTurns"),
214
+ threadId: requiredString$1(params.threadId, "threadId")
215
+ }
216
+ };
217
+ case "thread/resume":
218
+ if ("connectionId" in params) throw new Error("connectionId is not supported for thread/resume. Use afterOffset.");
219
+ return {
220
+ id,
221
+ method,
222
+ params: {
223
+ afterOffset: optionalNumber$1(params.afterOffset, "afterOffset"),
224
+ includeRecentTurns: optionalNumber$1(params.includeRecentTurns, "includeRecentTurns"),
225
+ threadId: requiredString$1(params.threadId, "threadId")
226
+ }
227
+ };
228
+ case "thread/start": return {
229
+ id,
230
+ method,
231
+ params: {
232
+ appId: requiredString$1(params.appId, "appId"),
233
+ clientRequestId: requiredString$1(params.clientRequestId, "clientRequestId"),
234
+ initialTitle: optionalString$1(params.initialTitle, "initialTitle")
235
+ }
236
+ };
237
+ case "thread/turns/list": return {
238
+ id,
239
+ method,
240
+ params: {
241
+ cursor: optionalString$1(params.cursor, "cursor"),
242
+ limit: optionalNumber$1(params.limit, "limit"),
243
+ threadId: requiredString$1(params.threadId, "threadId")
244
+ }
245
+ };
246
+ case "turn/continue": {
247
+ const clientUserMessageId = optionalNonEmptyString(params.clientUserMessageId, "clientUserMessageId");
248
+ return {
249
+ id,
250
+ method,
251
+ params: {
252
+ baseTurnId: requiredString$1(params.baseTurnId, "baseTurnId"),
253
+ clientRequestId: requiredString$1(params.clientRequestId, "clientRequestId"),
254
+ ...clientUserMessageId === void 0 ? {} : { clientUserMessageId },
255
+ expectedTaskSessionRevision: requiredNonNegativeSafeInteger(params.expectedTaskSessionRevision, "expectedTaskSessionRevision"),
256
+ input: requiredInputArray(params.input, "input"),
257
+ taskSessionId: requiredString$1(params.taskSessionId, "taskSessionId"),
258
+ threadId: requiredString$1(params.threadId, "threadId")
259
+ }
260
+ };
261
+ }
262
+ case "turn/interrupt": return {
263
+ id,
264
+ method,
265
+ params: {
266
+ clientRequestId: requiredString$1(params.clientRequestId, "clientRequestId"),
267
+ reason: optionalString$1(params.reason, "reason"),
268
+ threadId: requiredString$1(params.threadId, "threadId"),
269
+ turnId: requiredString$1(params.turnId, "turnId")
270
+ }
271
+ };
272
+ case "turn/read": return {
273
+ id,
274
+ method,
275
+ params: {
276
+ threadId: requiredString$1(params.threadId, "threadId"),
277
+ turnId: requiredString$1(params.turnId, "turnId")
278
+ }
279
+ };
280
+ case "turn/start": {
281
+ const clientUserMessageId = optionalNonEmptyString(params.clientUserMessageId, "clientUserMessageId");
282
+ if ("skillId" in params) throw new Error("skillId is not supported for turn/start. Use capabilityId.");
283
+ return {
284
+ id,
285
+ method,
286
+ params: {
287
+ capabilityId: optionalNonEmptyString(params.capabilityId, "capabilityId"),
288
+ threadId: requiredString$1(params.threadId, "threadId"),
289
+ input: requiredInputArray(params.input, "input"),
290
+ clientRequestId: requiredString$1(params.clientRequestId, "clientRequestId"),
291
+ ...clientUserMessageId === void 0 ? {} : { clientUserMessageId }
292
+ }
293
+ };
294
+ }
295
+ case "turn/steer": {
296
+ const clientUserMessageId = optionalNonEmptyString(params.clientUserMessageId, "clientUserMessageId");
297
+ if ("turnId" in params) throw new Error("turnId is not supported for turn/steer. Use expectedTurnId.");
298
+ return {
299
+ id,
300
+ method,
301
+ params: {
302
+ threadId: requiredString$1(params.threadId, "threadId"),
303
+ expectedTurnId: requiredString$1(params.expectedTurnId, "expectedTurnId"),
304
+ input: requiredInputArray(params.input, "input"),
305
+ clientRequestId: requiredString$1(params.clientRequestId, "clientRequestId"),
306
+ ...clientUserMessageId === void 0 ? {} : { clientUserMessageId }
307
+ }
308
+ };
309
+ }
310
+ }
311
+ }
312
+ function toFdeCoreSuccessResponse(id, result) {
313
+ return {
314
+ id,
315
+ result
316
+ };
317
+ }
318
+ function normalizeFdeCoreThreadResumeResult(value) {
319
+ const result = asRecord$1(value, "thread/resume.result");
320
+ if ("projection" in result) throw new Error("thread/resume.result.projection is not supported. Use bootstrapFrames.");
321
+ if ("thread" in result) throw new Error("thread/resume.result.thread is not supported. Use bootstrapFrames.");
322
+ if ("initialReplayFrames" in result) throw new Error("thread/resume.result.initialReplayFrames is not supported. Use bootstrapFrames.");
323
+ const threadId = requiredString$1(result.threadId, "thread/resume.result.threadId");
324
+ const latestOffset = requiredNonNegativeSafeInteger(result.latestOffset, "thread/resume.result.latestOffset");
325
+ const bootstrapFrames = requiredArray(result.bootstrapFrames, "thread/resume.result.bootstrapFrames").map((frame, index) => {
326
+ const normalized = normalizeFdeCoreSubscriptionFrame(frame);
327
+ if (normalized.kind !== "event_appended" && normalized.kind !== "projection_snapshot") throw new Error(`thread/resume.result.bootstrapFrames[${index}] must be event_appended or projection_snapshot.`);
328
+ if (normalized.threadId !== threadId) throw new Error(`thread/resume.result.bootstrapFrames[${index}].threadId must match result.threadId.`);
329
+ return normalized;
330
+ });
331
+ if (bootstrapFrames.filter((frame) => frame.kind === "projection_snapshot").length !== 1) throw new Error("thread/resume.result.bootstrapFrames must contain exactly one projection_snapshot.");
332
+ const finalFrame = bootstrapFrames[bootstrapFrames.length - 1];
333
+ if (!finalFrame || finalFrame.kind !== "projection_snapshot") throw new Error("thread/resume.result.bootstrapFrames must end with projection_snapshot.");
334
+ if (finalFrame.offset !== latestOffset) throw new Error("thread/resume.result.latestOffset must equal final projection_snapshot.offset.");
335
+ if (finalFrame.projection.metadata.lastEventCursor !== latestOffset) throw new Error("thread/resume final projection metadata cursor must equal latestOffset.");
336
+ return {
337
+ bootstrapFrames,
338
+ latestOffset,
339
+ threadId
340
+ };
341
+ }
342
+ function toFdeCoreThreadResumeSuccessResponse(id, result) {
343
+ return toFdeCoreSuccessResponse(id, normalizeFdeCoreThreadResumeResult(result));
344
+ }
345
+ function toFdeCoreErrorResponse(id, code, message, data) {
346
+ return {
347
+ id,
348
+ error: {
349
+ code,
350
+ ...data === void 0 ? {} : { data },
351
+ message
352
+ }
353
+ };
354
+ }
355
+ function createFdeCoreUserInputServerRequest(input) {
356
+ const fields = normalizeRequestFields(input.fields, "fields");
357
+ assertUserInputRequestSurface(input.kind, fields);
358
+ const publicPayload = sanitizePublicPayload(input.publicPayload);
359
+ const surface = normalizeRequiredActionSurfaceWire(input.surface, "surface");
360
+ const itemBoundIdentity = normalizeItemBoundIdentity(input);
361
+ return {
362
+ id: fdeCoreServerRequestIdentityKey(input),
363
+ method: "fde/serverRequest/userInput",
364
+ params: {
365
+ actionId: input.actionId,
366
+ ...input.domain === void 0 ? {} : { domain: input.domain },
367
+ ...fields === void 0 ? {} : { fields },
368
+ ...itemBoundIdentity,
369
+ itemId: input.itemId,
370
+ kind: input.kind,
371
+ prompt: input.prompt,
372
+ ...publicPayload === void 0 ? {} : { publicPayload },
373
+ requestId: input.requestId,
374
+ requestRevision: input.requestRevision,
375
+ ...input.requestType === void 0 ? {} : { requestType: input.requestType },
376
+ stateRevision: input.stateRevision,
377
+ ...surface === void 0 ? {} : { surface },
378
+ threadId: input.threadId,
379
+ turnId: input.turnId
380
+ }
381
+ };
382
+ }
383
+ function createFdeCoreApprovalServerRequest(input) {
384
+ const publicPayload = sanitizePublicPayload(input.publicPayload);
385
+ const surface = normalizeRequiredActionSurfaceWire(input.surface, "surface");
386
+ const itemBoundIdentity = normalizeItemBoundIdentity(input);
387
+ return {
388
+ id: fdeCoreServerRequestIdentityKey(input),
389
+ method: "fde/serverRequest/approval",
390
+ params: {
391
+ actionId: input.actionId,
392
+ decisions: normalizeApprovalDecisionOptions(input.decisions, "decisions"),
393
+ ...input.domain === void 0 ? {} : { domain: input.domain },
394
+ ...itemBoundIdentity,
395
+ itemId: input.itemId,
396
+ kind: "approval",
397
+ prompt: input.prompt,
398
+ ...publicPayload === void 0 ? {} : { publicPayload },
399
+ requestId: input.requestId,
400
+ requestRevision: input.requestRevision,
401
+ ...input.requestType === void 0 ? {} : { requestType: input.requestType },
402
+ stateRevision: input.stateRevision,
403
+ ...surface === void 0 ? {} : { surface },
404
+ threadId: input.threadId,
405
+ turnId: input.turnId
406
+ }
407
+ };
408
+ }
409
+ function normalizeFdeCoreServerRequest(value) {
410
+ const request = asRecord$1(value, "serverRequest");
411
+ const method = requiredServerRequestMethod(request.method);
412
+ const params = asRecord$1(request.params, "params");
413
+ if (method === "fde/serverRequest/userInput") {
414
+ if ("options" in params) throw new TypeError("params.options is not supported for FDE Core user-input requests.");
415
+ const requestId = requiredString$1(params.requestId, "requestId");
416
+ const envelope = createFdeCoreUserInputServerRequest({
417
+ actionId: requiredString$1(params.actionId, "actionId"),
418
+ domain: optionalString$1(params.domain, "domain"),
419
+ fields: normalizeRequestFields(params.fields, "params.fields"),
420
+ ...normalizeItemBoundIdentity(params),
421
+ itemId: requiredString$1(params.itemId, "itemId"),
422
+ kind: requiredUserInputKind(params.kind),
423
+ prompt: requiredString$1(params.prompt, "prompt"),
424
+ publicPayload: optionalPublicPayload(params),
425
+ requestId,
426
+ requestRevision: requiredNumber$1(params.requestRevision, "requestRevision"),
427
+ requestType: optionalString$1(params.requestType, "requestType"),
428
+ stateRevision: requiredNumber$1(params.stateRevision, "stateRevision"),
429
+ surface: normalizeRequiredActionSurfaceWire(params.surface, "params.surface"),
430
+ threadId: requiredString$1(params.threadId, "threadId"),
431
+ turnId: requiredString$1(params.turnId, "turnId")
432
+ });
433
+ ensureMatchingId(request.id, fdeCoreServerRequestIdentityKey(envelope.params));
434
+ return envelope;
435
+ }
436
+ const requestId = requiredString$1(params.requestId, "requestId");
437
+ const envelope = createFdeCoreApprovalServerRequest({
438
+ actionId: requiredString$1(params.actionId, "actionId"),
439
+ decisions: normalizeApprovalDecisionOptions(params.decisions, "params.decisions"),
440
+ domain: optionalString$1(params.domain, "domain"),
441
+ ...normalizeItemBoundIdentity(params),
442
+ itemId: requiredString$1(params.itemId, "itemId"),
443
+ prompt: requiredString$1(params.prompt, "prompt"),
444
+ publicPayload: optionalPublicPayload(params),
445
+ requestId,
446
+ requestRevision: requiredNumber$1(params.requestRevision, "requestRevision"),
447
+ requestType: optionalString$1(params.requestType, "requestType"),
448
+ stateRevision: requiredNumber$1(params.stateRevision, "stateRevision"),
449
+ surface: normalizeRequiredActionSurfaceWire(params.surface, "params.surface"),
450
+ threadId: requiredString$1(params.threadId, "threadId"),
451
+ turnId: requiredString$1(params.turnId, "turnId")
452
+ });
453
+ ensureMatchingId(request.id, fdeCoreServerRequestIdentityKey(envelope.params));
454
+ if (params.kind !== "approval") throw new TypeError("params.kind must be approval for FDE Core approval requests.");
455
+ return envelope;
456
+ }
457
+ function normalizeFdeCoreServerResponse(value) {
458
+ const response = asRecord$1(value, "serverResponse");
459
+ const id = requiredString$1(response.id, "id");
460
+ const method = requiredServerRequestMethod(response.method);
461
+ const params = asRecord$1(response.params, "params");
462
+ const requestId = requiredString$1(params.requestId, "requestId");
463
+ const identity = {
464
+ requestId,
465
+ requestRevision: requiredNumber$1(params.expectedRequestRevision, "expectedRequestRevision"),
466
+ stateRevision: requiredNumber$1(params.expectedStateRevision, "expectedStateRevision"),
467
+ threadId: requiredString$1(params.threadId, "threadId"),
468
+ turnId: requiredString$1(params.turnId, "turnId")
469
+ };
470
+ ensureMatchingId(id, fdeCoreServerRequestIdentityKey(identity));
471
+ const baseParams = {
472
+ expectedRequestRevision: identity.requestRevision,
473
+ expectedStateRevision: identity.stateRevision,
474
+ requestId,
475
+ threadId: identity.threadId,
476
+ turnId: identity.turnId
477
+ };
478
+ const responseBody = asRecord$1(response.response, "response");
479
+ if (method === "fde/serverRequest/userInput") {
480
+ const decision = responseBody.decision;
481
+ if (decision !== "answer" && decision !== "cancel") throw new Error("decision must be answer or cancel.");
482
+ return {
483
+ id,
484
+ method,
485
+ params: baseParams,
486
+ response: {
487
+ answers: normalizeUserInputAnswers(responseBody.answers),
488
+ decision
489
+ }
490
+ };
491
+ }
492
+ const decision = responseBody.decision;
493
+ if (decision !== "approve" && decision !== "reject" && decision !== "cancel") throw new Error("decision must be approve, reject or cancel.");
494
+ return {
495
+ id,
496
+ method,
497
+ params: baseParams,
498
+ response: {
499
+ decision,
500
+ reason: optionalString$1(responseBody.reason, "reason")
501
+ }
502
+ };
503
+ }
504
+ function getFdeCoreRequestSerialization(request) {
505
+ switch (request.method) {
506
+ case "thread/read":
507
+ case "thread/resume":
508
+ case "turn/continue":
509
+ case "turn/interrupt":
510
+ case "turn/read":
511
+ case "turn/start":
512
+ case "turn/steer": return {
513
+ mode: "thread",
514
+ key: readThreadId(request.params)
515
+ };
516
+ case "thread/start":
517
+ case "thread/turns/list": return { mode: "none" };
518
+ }
519
+ }
520
+ function createFdeCoreLiveNotification(method, params) {
521
+ if (method === "serverRequest/resolved") throw new Error("Use createFdeCoreServerRequestResolvedNotification for serverRequest/resolved");
522
+ const sanitizedParams = params === void 0 ? void 0 : sanitizePublicPayload(params);
523
+ return sanitizedParams === void 0 ? { method } : {
524
+ method,
525
+ params: sanitizedParams
526
+ };
527
+ }
528
+ function createFdeCoreServerRequestResolvedNotification(identity) {
529
+ return {
530
+ method: "serverRequest/resolved",
531
+ params: normalizeFdeCoreServerRequestIdentity(identity)
532
+ };
533
+ }
534
+ function isFdeCoreServerRequestResolvedNotification(notification) {
535
+ return notification.method === "serverRequest/resolved" && isFdeCoreServerRequestIdentityWire(notification.params);
536
+ }
537
+ function normalizeFdeCoreLiveNotification(value) {
538
+ const notification = asRecord$1(value, "notification");
539
+ const method = requiredString$1(notification.method, "method");
540
+ if (method === "serverRequest/resolved") return createFdeCoreServerRequestResolvedNotification(normalizeFdeCoreServerRequestIdentity(notification.params));
541
+ if (method === "fde-core/turn.started") return normalizeFdeCoreTurnStartedNotification(notification);
542
+ if (method === "fde-core/turn.completed" || method === "fde-core/turn.failed" || method === "fde-core/turn.cancelled") return normalizeFdeCoreTurnTerminalNotification(notification, method);
543
+ if (isFdeEventAppendedNotificationMethod(method)) return normalizeFdeEventAppendedNotification(notification);
544
+ return createFdeCoreLiveNotification(method, notification.params === void 0 ? void 0 : asRecord$1(notification.params, "notification.params"));
545
+ }
546
+ function normalizeFdeCoreLiveDeltaNotification(value) {
547
+ const notification = asRecord$1(value, "notification");
548
+ const method = requiredString$1(notification.method, "method");
549
+ if (!isFdeDeltaNotificationMethod(method)) throw new Error(`live_notification method is not delta: ${method}`);
550
+ return normalizeFdeDeltaNotification(notification);
551
+ }
552
+ function normalizeFdeLiveNotification(value) {
553
+ const notification = asRecord$1(value, "notification");
554
+ const method = requiredString$1(notification.method, "method");
555
+ if (isFdeDeltaNotificationMethod(method)) return normalizeFdeDeltaNotification(notification);
556
+ if (isFdeProjectionBackedLiveNotificationMethod(method)) return normalizeFdeProjectionBackedLiveNotification(notification, method);
557
+ throw new Error(`Unsupported FDE live_notification method: ${method}`);
558
+ }
559
+ function normalizeFdeCoreSubscriptionFrame(value) {
560
+ const frame = asRecord$1(value, "frame");
561
+ const kind = requiredString$1(frame.kind, "kind");
562
+ if (kind === "projection_snapshot") {
563
+ if ("notifications" in frame) throw new Error("projection_snapshot.notifications is not supported.");
564
+ if ("serverRequests" in frame) throw new Error("projection_snapshot.serverRequests is not supported.");
565
+ if ("runtime_state" in frame) throw new Error("projection_snapshot.runtime_state is not supported.");
566
+ if ("runtimeState" in frame) throw new Error("projection_snapshot.runtimeState is not supported.");
567
+ return {
568
+ kind,
569
+ offset: requiredNumber$1(frame.offset, "offset"),
570
+ projection: normalizeFdeCoreProjection(frame.projection),
571
+ resumeHighWater: optionalNumber$1(frame.resumeHighWater, "resumeHighWater"),
572
+ threadId: requiredString$1(frame.threadId, "threadId")
573
+ };
574
+ }
575
+ if (kind === "event_appended") {
576
+ if ("event" in frame) throw new Error("event_appended.event is not supported.");
577
+ return {
578
+ kind,
579
+ notifications: requiredArray(frame.notifications, "notifications").map((notification) => normalizeFdeEventAppendedNotification(notification)),
580
+ offset: requiredNumber$1(frame.offset, "offset"),
581
+ serverRequests: requiredArray(frame.serverRequests, "serverRequests").map((request) => normalizeFdeCoreServerRequest(request)),
582
+ threadId: requiredString$1(frame.threadId, "threadId")
583
+ };
584
+ }
585
+ if (kind === "stream_ready") {
586
+ rejectFrameFields(frame, kind, [
587
+ "offset",
588
+ "notifications",
589
+ "serverRequests",
590
+ "projection",
591
+ "liveSeq",
592
+ "error"
593
+ ]);
594
+ return {
595
+ connectionId: requiredString$1(frame.connectionId, "connectionId"),
596
+ kind,
597
+ threadId: requiredString$1(frame.threadId, "threadId")
598
+ };
599
+ }
600
+ if (kind === "stream_error") {
601
+ rejectFrameFields(frame, kind, [
602
+ "offset",
603
+ "notifications",
604
+ "serverRequests",
605
+ "projection",
606
+ "liveSeq"
607
+ ]);
608
+ const error = asRecord$1(frame.error, "stream_error.error");
609
+ return {
610
+ connectionId: requiredString$1(frame.connectionId, "connectionId"),
611
+ error: withoutUndefinedFields$1({
612
+ code: optionalString$1(error.code, "stream_error.error.code"),
613
+ detail: optionalString$1(error.detail, "stream_error.error.detail"),
614
+ message: requiredString$1(error.message, "stream_error.error.message")
615
+ }),
616
+ kind,
617
+ threadId: requiredString$1(frame.threadId, "threadId")
618
+ };
619
+ }
620
+ if (kind === "live_notification") {
621
+ rejectFrameFields(frame, kind, [
622
+ "offset",
623
+ "serverRequests",
624
+ "projection",
625
+ "connectionId",
626
+ "error"
627
+ ]);
628
+ return {
629
+ kind,
630
+ liveSeq: optionalNumber$1(frame.liveSeq, "liveSeq"),
631
+ notifications: requiredArray(frame.notifications, "notifications").map((notification) => normalizeFdeLiveNotification(notification)),
632
+ threadId: requiredString$1(frame.threadId, "threadId")
633
+ };
634
+ }
635
+ throw new Error(`Unsupported FDE Core subscription frame kind: ${kind}`);
636
+ }
637
+ function requiredClientMethod(value) {
638
+ if (typeof value !== "string" || !clientMethods.has(value)) throw new Error("method is invalid.");
639
+ return value;
640
+ }
641
+ function normalizeFdeCoreProjection(value) {
642
+ const projection = asRecord$1(value, "projection");
643
+ const metadata = asRecord$1(projection.metadata, "projection.metadata");
644
+ const artifactPanel = asRecord$1(projection.artifactPanel, "projection.artifactPanel");
645
+ return withoutUndefinedFields$1({
646
+ activeRequiredAction: projection.activeRequiredAction === void 0 ? void 0 : normalizeRequiredAction(projection.activeRequiredAction),
647
+ activeTurnControl: projection.activeTurnControl === void 0 ? void 0 : normalizeActiveTurnControl(projection.activeTurnControl),
648
+ artifactPanel: { items: requiredArray(artifactPanel.items, "projection.artifactPanel.items").map((item, index) => normalizeArtifactPanelItemWire(item, `projection.artifactPanel.items[${index}]`)) },
649
+ continuableTaskSession: projection.continuableTaskSession === void 0 ? void 0 : normalizeContinuableTaskSession(projection.continuableTaskSession),
650
+ metadata: { lastEventCursor: requiredNumber$1(metadata.lastEventCursor, "projection.metadata.lastEventCursor") },
651
+ runtimeState: projection.runtimeState === void 0 ? void 0 : normalizeFdeRuntimeStateSnapshotWire(projection.runtimeState, "projection.runtimeState"),
652
+ threadId: requiredString$1(projection.threadId, "projection.threadId"),
653
+ turns: requiredArray(projection.turns, "projection.turns").map((turn, index) => normalizeTurnWire(turn, `projection.turns[${index}]`))
654
+ });
655
+ }
656
+ function normalizeTurnWire(value, fieldName) {
657
+ const turn = asRecord$1(value, fieldName);
658
+ const metadata = asRecord$1(turn.metadata, `${fieldName}.metadata`);
659
+ rejectFrameFields(turn, fieldName, [
660
+ `assistantMessage`,
661
+ `finalAnswer`,
662
+ "notifications",
663
+ `requiredAction`,
664
+ `transcriptItems`,
665
+ `userMessage`
666
+ ]);
667
+ const itemsView = requiredTypedTurnItemsView(turn.itemsView, `${fieldName}.itemsView`);
668
+ const rawItems = requiredArray(turn.items, `${fieldName}.items`);
669
+ const base = withoutUndefinedFields$1({
670
+ artifacts: requiredArray(turn.artifacts, `${fieldName}.artifacts`).map((item, index) => normalizeArtifactRefWire(item, `${fieldName}.artifacts[${index}]`)),
671
+ baseTurnId: optionalString$1(turn.baseTurnId, `${fieldName}.baseTurnId`),
672
+ capability: turn.capability === void 0 ? void 0 : normalizeCapabilitySummaryWire(turn.capability, `${fieldName}.capability`),
673
+ clientRequestId: optionalString$1(turn.clientRequestId, `${fieldName}.clientRequestId`),
674
+ durationMs: optionalNumber$1(turn.durationMs, `${fieldName}.durationMs`),
675
+ endedAt: optionalString$1(turn.endedAt, `${fieldName}.endedAt`),
676
+ error: turn.error === void 0 ? void 0 : normalizePublicErrorWire(turn.error, `${fieldName}.error`),
677
+ diff: turn.diff === void 0 ? void 0 : normalizeTurnDiffSnapshot(turn.diff, `${fieldName}.diff`),
678
+ facts: requiredArray(turn.facts, `${fieldName}.facts`).map((item, index) => asRecord$1(item, `${fieldName}.facts[${index}]`)),
679
+ memoryContext: turn.memoryContext === void 0 ? void 0 : normalizeMemoryContextProjection(turn.memoryContext, `${fieldName}.memoryContext`),
680
+ metadata: { lastEventCursor: requiredNumber$1(metadata.lastEventCursor, `${fieldName}.metadata.lastEventCursor`) },
681
+ plan: turn.plan === void 0 ? void 0 : normalizeTurnPlanSnapshot(turn.plan, `${fieldName}.plan`),
682
+ responseToRequest: normalizeFdeCoreResponseToRequestWireFromRecord(turn, fieldName),
683
+ runtimeStates: turn.runtimeStates === void 0 ? void 0 : requiredArray(turn.runtimeStates, `${fieldName}.runtimeStates`).map((item, index) => normalizeFdeRuntimeStateSnapshotWire(item, `${fieldName}.runtimeStates[${index}]`)),
684
+ saveCompletions: turn.saveCompletions === void 0 ? void 0 : requiredArray(turn.saveCompletions, `${fieldName}.saveCompletions`).map((item, index) => normalizeSaveCompletionWire(item, `${fieldName}.saveCompletions[${index}]`)),
685
+ startedAt: optionalString$1(turn.startedAt, `${fieldName}.startedAt`),
686
+ status: requiredTurnStatus(turn.status, `${fieldName}.status`),
687
+ threadId: requiredString$1(turn.threadId, `${fieldName}.threadId`),
688
+ turnId: requiredString$1(turn.turnId, `${fieldName}.turnId`)
689
+ });
690
+ if (itemsView === "notLoaded") {
691
+ if (rawItems.length !== 0) throw new Error(`${fieldName}.items must be empty when itemsView is notLoaded.`);
692
+ return {
693
+ ...base,
694
+ items: [],
695
+ itemsView
696
+ };
697
+ }
698
+ if (itemsView === "summary") return withoutUndefinedFields$1({
699
+ ...base,
700
+ items: rawItems.map((item, index) => normalizeFdeThreadItemPreview(item, `${fieldName}.items[${index}]`)),
701
+ itemsView,
702
+ previewHighWater: optionalPositiveSafeInteger(turn.previewHighWater, `${fieldName}.previewHighWater`)
703
+ });
704
+ return {
705
+ ...base,
706
+ items: rawItems.map((item, index) => normalizeFdeFullThreadItem(item, `${fieldName}.items[${index}]`)),
707
+ itemsView,
708
+ projectionHighWater: requiredPositiveSafeInteger(turn.projectionHighWater, `${fieldName}.projectionHighWater`)
709
+ };
710
+ }
711
+ function normalizeFdeDeltaNotification(value) {
712
+ const notification = asRecord$1(value, "notification");
713
+ const method = requiredString$1(notification.method, "method");
714
+ const params = asRecord$1(notification.params, "notification.params");
715
+ switch (method) {
716
+ case "item/agentMessage/delta":
717
+ assertExactKeys(params, "notification.params", [
718
+ "delta",
719
+ "itemId",
720
+ "threadId",
721
+ "turnId"
722
+ ]);
723
+ return {
724
+ method,
725
+ params: {
726
+ delta: requiredString$1(params.delta, "notification.params.delta"),
727
+ itemId: requiredString$1(params.itemId, "notification.params.itemId"),
728
+ threadId: requiredString$1(params.threadId, "notification.params.threadId"),
729
+ turnId: requiredString$1(params.turnId, "notification.params.turnId")
730
+ }
731
+ };
732
+ case "item/commandExecution/outputDelta":
733
+ assertExactKeys(params, "notification.params", [
734
+ "delta",
735
+ "itemId",
736
+ "threadId",
737
+ "turnId"
738
+ ]);
739
+ return {
740
+ method,
741
+ params: {
742
+ delta: requiredPlainString(params.delta, "notification.params.delta"),
743
+ itemId: requiredString$1(params.itemId, "notification.params.itemId"),
744
+ threadId: requiredString$1(params.threadId, "notification.params.threadId"),
745
+ turnId: requiredString$1(params.turnId, "notification.params.turnId")
746
+ }
747
+ };
748
+ case "item/fileChange/patchUpdated":
749
+ assertExactKeys(params, "notification.params", [
750
+ "changes",
751
+ "itemId",
752
+ "threadId",
753
+ "turnId"
754
+ ]);
755
+ return {
756
+ method,
757
+ params: {
758
+ changes: normalizeFileChangeEntries(params.changes, "notification.params.changes"),
759
+ itemId: requiredString$1(params.itemId, "notification.params.itemId"),
760
+ threadId: requiredString$1(params.threadId, "notification.params.threadId"),
761
+ turnId: requiredString$1(params.turnId, "notification.params.turnId")
762
+ }
763
+ };
764
+ case "item/plan/delta":
765
+ assertExactKeys(params, "notification.params", [
766
+ "delta",
767
+ "itemId",
768
+ "threadId",
769
+ "turnId"
770
+ ]);
771
+ return {
772
+ method,
773
+ params: {
774
+ delta: requiredString$1(params.delta, "notification.params.delta"),
775
+ itemId: requiredString$1(params.itemId, "notification.params.itemId"),
776
+ threadId: requiredString$1(params.threadId, "notification.params.threadId"),
777
+ turnId: requiredString$1(params.turnId, "notification.params.turnId")
778
+ }
779
+ };
780
+ case "item/reasoning/summaryTextDelta":
781
+ assertExactKeys(params, "notification.params", [
782
+ "delta",
783
+ "itemId",
784
+ "summaryIndex",
785
+ "threadId",
786
+ "turnId"
787
+ ]);
788
+ return {
789
+ method,
790
+ params: {
791
+ delta: requiredString$1(params.delta, "notification.params.delta"),
792
+ itemId: requiredString$1(params.itemId, "notification.params.itemId"),
793
+ summaryIndex: requiredNumber$1(params.summaryIndex, "notification.params.summaryIndex"),
794
+ threadId: requiredString$1(params.threadId, "notification.params.threadId"),
795
+ turnId: requiredString$1(params.turnId, "notification.params.turnId")
796
+ }
797
+ };
798
+ case "item/mcpToolCall/progress":
799
+ assertExactKeys(params, "notification.params", [
800
+ "itemId",
801
+ "message",
802
+ "threadId",
803
+ "turnId"
804
+ ]);
805
+ return {
806
+ method,
807
+ params: {
808
+ itemId: requiredString$1(params.itemId, "notification.params.itemId"),
809
+ message: requiredPlainString(params.message, "notification.params.message"),
810
+ threadId: requiredString$1(params.threadId, "notification.params.threadId"),
811
+ turnId: requiredString$1(params.turnId, "notification.params.turnId")
812
+ }
813
+ };
814
+ default: throw new Error(`Unsupported FDE delta notification method: ${method}`);
815
+ }
816
+ }
817
+ function normalizeFdeProjectionBackedLiveNotification(notification, method) {
818
+ switch (method) {
819
+ case "runtime.state.updated": return {
820
+ method,
821
+ params: normalizeFdeRuntimeStateSnapshotWire(notification.params, "runtime_state")
822
+ };
823
+ }
824
+ }
825
+ function normalizeFdeRuntimeStateSnapshotWire(value, fieldName) {
826
+ const state = asRecord$1(value, fieldName);
827
+ rejectFrameFields(state, fieldName, [
828
+ "current_phase",
829
+ "last_agent",
830
+ "mode",
831
+ "pending_action",
832
+ "pending_fields",
833
+ "target_artifact",
834
+ "updated_at"
835
+ ]);
836
+ assertAllowedKeys(state, fieldName, [
837
+ "activities",
838
+ "clock",
839
+ "content_policy",
840
+ "gates",
841
+ "outputs",
842
+ "right_panel",
843
+ "run",
844
+ "sources",
845
+ "summary",
846
+ "version"
847
+ ]);
848
+ if (requiredNumber$1(state.version, `${fieldName}.version`) !== 1) throw new Error(`${fieldName}.version is unsupported.`);
849
+ const run = asRecord$1(state.run, `${fieldName}.run`);
850
+ rejectFrameFields(run, `${fieldName}.run`, [
851
+ "assistant_message_id",
852
+ "conversation_id",
853
+ "conversationId",
854
+ "user_message_id"
855
+ ]);
856
+ assertAllowedKeys(run, `${fieldName}.run`, [
857
+ "elapsed_ms",
858
+ "ended_at",
859
+ "message_id",
860
+ "phase",
861
+ "run_id",
862
+ "started_at",
863
+ "status",
864
+ "thread_id",
865
+ "turn_id",
866
+ "updated_at"
867
+ ]);
868
+ const clock = asRecord$1(state.clock, `${fieldName}.clock`);
869
+ assertAllowedKeys(clock, `${fieldName}.clock`, [
870
+ "revision",
871
+ "source_offset",
872
+ "updated_at"
873
+ ]);
874
+ const summary = asRecord$1(state.summary, `${fieldName}.summary`);
875
+ assertAllowedKeys(summary, `${fieldName}.summary`, [
876
+ "current",
877
+ "done",
878
+ "next",
879
+ "outputs"
880
+ ]);
881
+ const contentPolicy = asRecord$1(state.content_policy, `${fieldName}.content_policy`);
882
+ assertAllowedKeys(contentPolicy, `${fieldName}.content_policy`, [
883
+ "contains_internal_reasoning",
884
+ "contains_raw_tool_payload",
885
+ "visible_reply_contract"
886
+ ]);
887
+ const containsInternalReasoning = requiredBoolean(contentPolicy.contains_internal_reasoning, `${fieldName}.content_policy.contains_internal_reasoning`);
888
+ const containsRawToolPayload = requiredBoolean(contentPolicy.contains_raw_tool_payload, `${fieldName}.content_policy.contains_raw_tool_payload`);
889
+ if (containsInternalReasoning || containsRawToolPayload) throw new Error(`${fieldName}.content_policy contains private content.`);
890
+ const visibleReplyContract = optionalString$1(contentPolicy.visible_reply_contract, `${fieldName}.content_policy.visible_reply_contract`);
891
+ if (visibleReplyContract !== void 0 && visibleReplyContract !== "terminal_summary") throw new Error(`${fieldName}.content_policy.visible_reply_contract is invalid.`);
892
+ return withoutUndefinedFields$1({
893
+ activities: requiredArray(state.activities, `${fieldName}.activities`).map((item, index) => normalizeFdeRuntimeActivityWire(item, `${fieldName}.activities[${index}]`)),
894
+ clock: withoutUndefinedFields$1({
895
+ revision: requiredNonNegativeSafeInteger(clock.revision, `${fieldName}.clock.revision`),
896
+ source_offset: optionalNonNegativeSafeInteger(clock.source_offset, `${fieldName}.clock.source_offset`),
897
+ updated_at: requiredString$1(clock.updated_at, `${fieldName}.clock.updated_at`)
898
+ }),
899
+ content_policy: withoutUndefinedFields$1({
900
+ contains_internal_reasoning: containsInternalReasoning,
901
+ contains_raw_tool_payload: containsRawToolPayload,
902
+ visible_reply_contract: visibleReplyContract
903
+ }),
904
+ gates: requiredArray(state.gates, `${fieldName}.gates`).map((item, index) => normalizeFdeRuntimeGateWire(item, `${fieldName}.gates[${index}]`)),
905
+ outputs: requiredArray(state.outputs, `${fieldName}.outputs`).map((item, index) => normalizeFdeRuntimeOutputRefWire(item, `${fieldName}.outputs[${index}]`)),
906
+ right_panel: state.right_panel === void 0 ? void 0 : normalizeFdeRuntimeRightPanelWire(state.right_panel, `${fieldName}.right_panel`),
907
+ run: withoutUndefinedFields$1({
908
+ elapsed_ms: optionalNumber$1(run.elapsed_ms, `${fieldName}.run.elapsed_ms`),
909
+ ended_at: optionalString$1(run.ended_at, `${fieldName}.run.ended_at`),
910
+ message_id: optionalString$1(run.message_id, `${fieldName}.run.message_id`),
911
+ phase: requiredRuntimeRunPhase(run.phase, `${fieldName}.run.phase`),
912
+ run_id: requiredString$1(run.run_id, `${fieldName}.run.run_id`),
913
+ started_at: optionalString$1(run.started_at, `${fieldName}.run.started_at`),
914
+ status: requiredRuntimeRunStatus(run.status, `${fieldName}.run.status`),
915
+ thread_id: requiredString$1(run.thread_id, `${fieldName}.run.thread_id`),
916
+ turn_id: requiredString$1(run.turn_id, `${fieldName}.run.turn_id`),
917
+ updated_at: requiredString$1(run.updated_at, `${fieldName}.run.updated_at`)
918
+ }),
919
+ sources: requiredArray(state.sources, `${fieldName}.sources`).map((item, index) => normalizeFdeRuntimeSourceRefWire(item, `${fieldName}.sources[${index}]`)),
920
+ summary: withoutUndefinedFields$1({
921
+ current: optionalString$1(summary.current, `${fieldName}.summary.current`),
922
+ done: requiredStringArray$1(summary.done, `${fieldName}.summary.done`),
923
+ next: requiredStringArray$1(summary.next, `${fieldName}.summary.next`),
924
+ outputs: requiredArray(summary.outputs, `${fieldName}.summary.outputs`).map((item, index) => normalizeFdeRuntimeOutputRefWire(item, `${fieldName}.summary.outputs[${index}]`))
925
+ }),
926
+ version: 1
927
+ });
928
+ }
929
+ function normalizeFdeRuntimeActivityWire(value, fieldName) {
930
+ const activity = asRecord$1(value, fieldName);
931
+ assertAllowedKeys(activity, fieldName, [
932
+ "detail",
933
+ "ended_at",
934
+ "id",
935
+ "label",
936
+ "started_at",
937
+ "status",
938
+ "updated_at"
939
+ ]);
940
+ return withoutUndefinedFields$1({
941
+ detail: optionalString$1(activity.detail, `${fieldName}.detail`),
942
+ ended_at: optionalString$1(activity.ended_at, `${fieldName}.ended_at`),
943
+ id: requiredString$1(activity.id, `${fieldName}.id`),
944
+ label: requiredString$1(activity.label, `${fieldName}.label`),
945
+ started_at: optionalString$1(activity.started_at, `${fieldName}.started_at`),
946
+ status: requiredRuntimeActivityStatus(activity.status, `${fieldName}.status`),
947
+ updated_at: optionalString$1(activity.updated_at, `${fieldName}.updated_at`)
948
+ });
949
+ }
950
+ function normalizeFdeRuntimeGateWire(value, fieldName) {
951
+ const gate = asRecord$1(value, fieldName);
952
+ assertAllowedKeys(gate, fieldName, [
953
+ "id",
954
+ "kind",
955
+ "message",
956
+ "request_id",
957
+ "request_revision",
958
+ "request_state_revision",
959
+ "required_action_id",
960
+ "status",
961
+ "title",
962
+ "turn_id"
963
+ ]);
964
+ return withoutUndefinedFields$1({
965
+ id: requiredString$1(gate.id, `${fieldName}.id`),
966
+ kind: requiredRuntimeGateKind(gate.kind, `${fieldName}.kind`),
967
+ message: optionalString$1(gate.message, `${fieldName}.message`),
968
+ request_id: optionalString$1(gate.request_id, `${fieldName}.request_id`),
969
+ request_revision: optionalNonNegativeSafeInteger(gate.request_revision, `${fieldName}.request_revision`),
970
+ request_state_revision: optionalNonNegativeSafeInteger(gate.request_state_revision, `${fieldName}.request_state_revision`),
971
+ required_action_id: optionalString$1(gate.required_action_id, `${fieldName}.required_action_id`),
972
+ status: requiredRuntimeGateStatus(gate.status, `${fieldName}.status`),
973
+ title: requiredString$1(gate.title, `${fieldName}.title`),
974
+ turn_id: optionalString$1(gate.turn_id, `${fieldName}.turn_id`)
975
+ });
976
+ }
977
+ function normalizeFdeRuntimeOutputRefWire(value, fieldName) {
978
+ const output = asRecord$1(value, fieldName);
979
+ assertAllowedKeys(output, fieldName, [
980
+ "document_uid",
981
+ "id",
982
+ "kind",
983
+ "mime_type",
984
+ "rel_path",
985
+ "title",
986
+ "uri"
987
+ ]);
988
+ return withoutUndefinedFields$1({
989
+ document_uid: optionalString$1(output.document_uid, `${fieldName}.document_uid`),
990
+ id: requiredString$1(output.id, `${fieldName}.id`),
991
+ kind: requiredRuntimeOutputKind(output.kind, `${fieldName}.kind`),
992
+ mime_type: optionalString$1(output.mime_type, `${fieldName}.mime_type`),
993
+ rel_path: optionalString$1(output.rel_path, `${fieldName}.rel_path`),
994
+ title: requiredString$1(output.title, `${fieldName}.title`),
995
+ uri: optionalRuntimeUri(output.uri, `${fieldName}.uri`)
996
+ });
997
+ }
998
+ function normalizeFdeRuntimeSourceRefWire(value, fieldName) {
999
+ const source = asRecord$1(value, fieldName);
1000
+ assertAllowedKeys(source, fieldName, [
1001
+ "document_uid",
1002
+ "id",
1003
+ "kind",
1004
+ "rel_path",
1005
+ "title",
1006
+ "uri"
1007
+ ]);
1008
+ return withoutUndefinedFields$1({
1009
+ document_uid: optionalString$1(source.document_uid, `${fieldName}.document_uid`),
1010
+ id: requiredString$1(source.id, `${fieldName}.id`),
1011
+ kind: requiredRuntimeSourceKind(source.kind, `${fieldName}.kind`),
1012
+ rel_path: optionalString$1(source.rel_path, `${fieldName}.rel_path`),
1013
+ title: requiredString$1(source.title, `${fieldName}.title`),
1014
+ uri: optionalRuntimeUri(source.uri, `${fieldName}.uri`)
1015
+ });
1016
+ }
1017
+ function normalizeFdeRuntimeRightPanelWire(value, fieldName) {
1018
+ const panel = asRecord$1(value, fieldName);
1019
+ assertAllowedKeys(panel, fieldName, [
1020
+ "document_uid",
1021
+ "kind",
1022
+ "ref_id",
1023
+ "title"
1024
+ ]);
1025
+ return withoutUndefinedFields$1({
1026
+ document_uid: optionalString$1(panel.document_uid, `${fieldName}.document_uid`),
1027
+ kind: requiredRuntimeRightPanelKind(panel.kind, `${fieldName}.kind`),
1028
+ ref_id: optionalString$1(panel.ref_id, `${fieldName}.ref_id`),
1029
+ title: requiredString$1(panel.title, `${fieldName}.title`)
1030
+ });
1031
+ }
1032
+ function normalizeFdeEventAppendedNotification(value) {
1033
+ const notification = asRecord$1(value, "notification");
1034
+ const method = requiredString$1(notification.method, "method");
1035
+ const params = asRecord$1(notification.params, "notification.params");
1036
+ switch (method) {
1037
+ case "item/started":
1038
+ assertExactKeys(params, "notification.params", [
1039
+ "item",
1040
+ "startedAtMs",
1041
+ "threadId",
1042
+ "turnId"
1043
+ ]);
1044
+ return {
1045
+ method,
1046
+ params: {
1047
+ item: normalizeFdeFullThreadItem(params.item, "notification.params.item"),
1048
+ startedAtMs: requiredNumber$1(params.startedAtMs, "notification.params.startedAtMs"),
1049
+ threadId: requiredString$1(params.threadId, "notification.params.threadId"),
1050
+ turnId: requiredString$1(params.turnId, "notification.params.turnId")
1051
+ }
1052
+ };
1053
+ case "item/updated":
1054
+ assertExactKeys(params, "notification.params", [
1055
+ "item",
1056
+ "threadId",
1057
+ "turnId",
1058
+ "updatedAtMs"
1059
+ ]);
1060
+ return {
1061
+ method,
1062
+ params: {
1063
+ item: normalizeFdeFullThreadItem(params.item, "notification.params.item"),
1064
+ threadId: requiredString$1(params.threadId, "notification.params.threadId"),
1065
+ turnId: requiredString$1(params.turnId, "notification.params.turnId"),
1066
+ updatedAtMs: requiredNumber$1(params.updatedAtMs, "notification.params.updatedAtMs")
1067
+ }
1068
+ };
1069
+ case "item/completed":
1070
+ assertExactKeys(params, "notification.params", [
1071
+ "completedAtMs",
1072
+ "item",
1073
+ "threadId",
1074
+ "turnId"
1075
+ ]);
1076
+ return {
1077
+ method,
1078
+ params: {
1079
+ completedAtMs: requiredNumber$1(params.completedAtMs, "notification.params.completedAtMs"),
1080
+ item: normalizeFdeFullThreadItem(params.item, "notification.params.item"),
1081
+ threadId: requiredString$1(params.threadId, "notification.params.threadId"),
1082
+ turnId: requiredString$1(params.turnId, "notification.params.turnId")
1083
+ }
1084
+ };
1085
+ case "serverRequest/resolved": return createFdeCoreServerRequestResolvedNotification(normalizeFdeCoreServerRequestIdentity(params));
1086
+ case "fde-core/turn.started": return normalizeFdeCoreTurnStartedNotification(notification);
1087
+ case "fde-core/turn.completed":
1088
+ case "fde-core/turn.failed":
1089
+ case "fde-core/turn.cancelled": return normalizeFdeCoreTurnTerminalNotification(notification, method);
1090
+ case "fde-core/event.watermark":
1091
+ case "fde/archiveResource/saved": {
1092
+ const sanitizedParams = sanitizePublicPayload(params);
1093
+ return sanitizedParams === void 0 ? { method } : {
1094
+ method,
1095
+ params: sanitizedParams
1096
+ };
1097
+ }
1098
+ default: throw new Error(`Unsupported FDE event_appended notification method: ${method}`);
1099
+ }
1100
+ }
1101
+ function normalizeFdeFullThreadItem(value, fieldName) {
1102
+ const item = asRecord$1(value, fieldName);
1103
+ const type = requiredString$1(item.type, `${fieldName}.type`);
1104
+ const base = withoutUndefinedFields$1({
1105
+ createdAtMs: optionalNumber$1(item.createdAtMs, `${fieldName}.createdAtMs`),
1106
+ id: requiredString$1(item.id, `${fieldName}.id`),
1107
+ sourceSeq: requiredPositiveSafeInteger(item.sourceSeq, `${fieldName}.sourceSeq`),
1108
+ type,
1109
+ updatedAtMs: optionalNumber$1(item.updatedAtMs, `${fieldName}.updatedAtMs`)
1110
+ });
1111
+ switch (type) {
1112
+ case "userMessage": return withoutUndefinedFields$1({
1113
+ ...base,
1114
+ clientId: optionalString$1(item.clientId, `${fieldName}.clientId`),
1115
+ clientRequestId: optionalString$1(item.clientRequestId, `${fieldName}.clientRequestId`),
1116
+ content: requiredInputArray(item.content, `${fieldName}.content`),
1117
+ text: optionalString$1(item.text, `${fieldName}.text`),
1118
+ type
1119
+ });
1120
+ case "agentMessage": return {
1121
+ ...base,
1122
+ phase: requiredAgentMessagePhase(item.phase, `${fieldName}.phase`),
1123
+ text: requiredPlainString(item.text, `${fieldName}.text`),
1124
+ type
1125
+ };
1126
+ case "artifact": return {
1127
+ ...base,
1128
+ artifactRefs: requiredArray(item.artifactRefs, `${fieldName}.artifactRefs`).map((ref, index) => normalizeFdeArtifactRef(ref, `${fieldName}.artifactRefs[${index}]`)),
1129
+ title: requiredString$1(item.title, `${fieldName}.title`),
1130
+ type
1131
+ };
1132
+ case "clarification":
1133
+ case "confirmation": return withoutUndefinedFields$1({
1134
+ ...base,
1135
+ displaySnapshot: normalizeRequestDisplaySnapshot(item.displaySnapshot, `${fieldName}.displaySnapshot`),
1136
+ requestIdentity: normalizeRequestDisplayIdentity(item.requestIdentity, `${fieldName}.requestIdentity`),
1137
+ requestType: optionalString$1(item.requestType, `${fieldName}.requestType`),
1138
+ response: item.response === void 0 ? void 0 : sanitizePublicPayload(asRecord$1(item.response, `${fieldName}.response`)),
1139
+ state: requiredRequestDisplayState(item.state, `${fieldName}.state`),
1140
+ type
1141
+ });
1142
+ case "collabAgentToolCall": return withoutUndefinedFields$1({
1143
+ ...base,
1144
+ prompt: optionalString$1(item.prompt, `${fieldName}.prompt`),
1145
+ receiverThreadIds: requiredStringArray$1(item.receiverThreadIds, `${fieldName}.receiverThreadIds`),
1146
+ status: requiredExecutionStatus(item.status, `${fieldName}.status`),
1147
+ tool: requiredString$1(item.tool, `${fieldName}.tool`),
1148
+ toolKind: optionalToolKind(item.toolKind, `${fieldName}.toolKind`),
1149
+ type
1150
+ });
1151
+ case "commandExecution": return withoutUndefinedFields$1({
1152
+ ...base,
1153
+ aggregatedOutput: optionalString$1(item.aggregatedOutput, `${fieldName}.aggregatedOutput`),
1154
+ approvalRequestId: optionalString$1(item.approvalRequestId, `${fieldName}.approvalRequestId`),
1155
+ command: requiredString$1(item.command, `${fieldName}.command`),
1156
+ cwd: optionalString$1(item.cwd, `${fieldName}.cwd`),
1157
+ durationMs: optionalNullableNumber(item.durationMs, `${fieldName}.durationMs`),
1158
+ exitCode: optionalNullableNumber(item.exitCode, `${fieldName}.exitCode`),
1159
+ status: requiredExecutionStatus(item.status, `${fieldName}.status`),
1160
+ type
1161
+ });
1162
+ case "diagnostic": return withoutUndefinedFields$1({
1163
+ ...base,
1164
+ debugId: optionalString$1(item.debugId, `${fieldName}.debugId`),
1165
+ detail: optionalString$1(item.detail, `${fieldName}.detail`),
1166
+ publicPayload: item.publicPayload === void 0 ? void 0 : sanitizePublicPayload(asRecord$1(item.publicPayload, `${fieldName}.publicPayload`)),
1167
+ severity: optionalDiagnosticSeverity(item.severity, `${fieldName}.severity`),
1168
+ title: requiredString$1(item.title, `${fieldName}.title`),
1169
+ type
1170
+ });
1171
+ case "dynamicToolCall":
1172
+ case "mcpToolCall": return withoutUndefinedFields$1({
1173
+ ...base,
1174
+ durationMs: optionalNullableNumber(item.durationMs, `${fieldName}.durationMs`),
1175
+ error: item.error === void 0 || item.error === null ? item.error : normalizeFdeTurnError(item.error, `${fieldName}.error`),
1176
+ namespace: type === "dynamicToolCall" ? optionalString$1(item.namespace, `${fieldName}.namespace`) : void 0,
1177
+ server: type === "mcpToolCall" ? optionalString$1(item.server, `${fieldName}.server`) : void 0,
1178
+ status: requiredExecutionStatus(item.status, `${fieldName}.status`),
1179
+ tool: requiredString$1(item.tool, `${fieldName}.tool`),
1180
+ toolKind: optionalToolKind(item.toolKind, `${fieldName}.toolKind`),
1181
+ type,
1182
+ ...item.arguments === void 0 ? {} : { arguments: sanitizePublicPayloadValue(item.arguments) },
1183
+ ...item.result === void 0 ? {} : { result: sanitizePublicPayloadValue(item.result) }
1184
+ });
1185
+ case "error": return withoutUndefinedFields$1({
1186
+ ...base,
1187
+ code: optionalString$1(item.code, `${fieldName}.code`),
1188
+ detail: optionalString$1(item.detail, `${fieldName}.detail`),
1189
+ message: requiredString$1(item.message, `${fieldName}.message`),
1190
+ type
1191
+ });
1192
+ case "fileChange": return withoutUndefinedFields$1({
1193
+ ...base,
1194
+ approvalRequestId: optionalString$1(item.approvalRequestId, `${fieldName}.approvalRequestId`),
1195
+ artifactRefs: item.artifactRefs === void 0 ? void 0 : requiredArray(item.artifactRefs, `${fieldName}.artifactRefs`).map((ref, index) => normalizeFdeArtifactRef(ref, `${fieldName}.artifactRefs[${index}]`)),
1196
+ changes: item.changes === void 0 ? [] : normalizeFileChangeEntries(item.changes, `${fieldName}.changes`),
1197
+ diff: optionalString$1(item.diff, `${fieldName}.diff`),
1198
+ path: optionalString$1(item.path, `${fieldName}.path`),
1199
+ status: requiredExecutionStatus(item.status, `${fieldName}.status`),
1200
+ type
1201
+ });
1202
+ case "imageGeneration": return withoutUndefinedFields$1({
1203
+ ...base,
1204
+ artifactRefs: item.artifactRefs === void 0 ? void 0 : requiredArray(item.artifactRefs, `${fieldName}.artifactRefs`).map((ref, index) => normalizeFdeArtifactRef(ref, `${fieldName}.artifactRefs[${index}]`)),
1205
+ prompt: requiredString$1(item.prompt, `${fieldName}.prompt`),
1206
+ status: item.status === void 0 ? void 0 : requiredExecutionStatus(item.status, `${fieldName}.status`),
1207
+ type
1208
+ });
1209
+ case "webSearch": return withoutUndefinedFields$1({
1210
+ ...base,
1211
+ query: requiredString$1(item.query, `${fieldName}.query`),
1212
+ results: item.results === void 0 ? void 0 : requiredArray(item.results, `${fieldName}.results`),
1213
+ status: item.status === void 0 ? void 0 : requiredExecutionStatus(item.status, `${fieldName}.status`),
1214
+ type
1215
+ });
1216
+ case "plan":
1217
+ if ("steps" in item) throw new Error(`${fieldName}.steps is not supported.`);
1218
+ if ("explanation" in item) throw new Error(`${fieldName}.explanation is not supported.`);
1219
+ return {
1220
+ ...base,
1221
+ text: requiredString$1(item.text, `${fieldName}.text`),
1222
+ type
1223
+ };
1224
+ case "reasoning": return {
1225
+ ...base,
1226
+ summary: requiredStringArray$1(item.summary, `${fieldName}.summary`),
1227
+ type
1228
+ };
1229
+ case "skillCall": return withoutUndefinedFields$1({
1230
+ ...base,
1231
+ artifactRefs: item.artifactRefs === void 0 ? void 0 : requiredArray(item.artifactRefs, `${fieldName}.artifactRefs`).map((ref, index) => normalizeFdeArtifactRef(ref, `${fieldName}.artifactRefs[${index}]`)),
1232
+ result: item.result === void 0 ? void 0 : sanitizePublicPayloadValue(item.result),
1233
+ skillId: optionalString$1(item.skillId, `${fieldName}.skillId`),
1234
+ status: requiredExecutionStatus(item.status, `${fieldName}.status`),
1235
+ title: optionalString$1(item.title, `${fieldName}.title`) ?? optionalString$1(item.toolName, `${fieldName}.toolName`) ?? optionalString$1(item.skillId, `${fieldName}.skillId`) ?? requiredString$1(item.title, `${fieldName}.title`),
1236
+ toolKind: optionalToolKind(item.toolKind, `${fieldName}.toolKind`),
1237
+ toolCallId: optionalString$1(item.toolCallId, `${fieldName}.toolCallId`),
1238
+ toolName: optionalString$1(item.toolName, `${fieldName}.toolName`),
1239
+ type
1240
+ });
1241
+ default: throw new Error(`${fieldName}.type is invalid.`);
1242
+ }
1243
+ }
1244
+ function normalizeFdeThreadItemPreview(value, fieldName) {
1245
+ const item = asRecord$1(value, fieldName);
1246
+ if ("sourceSeq" in item) throw new Error(`${fieldName}.sourceSeq is not supported for previews.`);
1247
+ const type = requiredString$1(item.type, `${fieldName}.type`);
1248
+ const base = withoutUndefinedFields$1({
1249
+ createdAtMs: optionalNumber$1(item.createdAtMs, `${fieldName}.createdAtMs`),
1250
+ id: requiredString$1(item.id, `${fieldName}.id`),
1251
+ type,
1252
+ updatedAtMs: optionalNumber$1(item.updatedAtMs, `${fieldName}.updatedAtMs`)
1253
+ });
1254
+ switch (type) {
1255
+ case "agentMessage":
1256
+ case "plan":
1257
+ case "userMessage": return withoutUndefinedFields$1({
1258
+ ...base,
1259
+ text: optionalString$1(item.text, `${fieldName}.text`),
1260
+ type
1261
+ });
1262
+ case "clarification":
1263
+ case "confirmation": return withoutUndefinedFields$1({
1264
+ ...base,
1265
+ state: optionalRequestDisplayState(item.state, `${fieldName}.state`),
1266
+ title: optionalString$1(item.title, `${fieldName}.title`),
1267
+ type
1268
+ });
1269
+ case "diagnostic":
1270
+ case "error": return withoutUndefinedFields$1({
1271
+ ...base,
1272
+ message: optionalString$1(item.message, `${fieldName}.message`),
1273
+ title: optionalString$1(item.title, `${fieldName}.title`),
1274
+ type
1275
+ });
1276
+ case "artifact":
1277
+ case "collabAgentToolCall":
1278
+ case "commandExecution":
1279
+ case "dynamicToolCall":
1280
+ case "fileChange":
1281
+ case "imageGeneration":
1282
+ case "mcpToolCall":
1283
+ case "skillCall":
1284
+ case "webSearch": return withoutUndefinedFields$1({
1285
+ ...base,
1286
+ title: optionalString$1(item.title, `${fieldName}.title`),
1287
+ type
1288
+ });
1289
+ default: throw new Error(`${fieldName}.type is invalid.`);
1290
+ }
1291
+ }
1292
+ function normalizeFdeArtifactRef(value, fieldName) {
1293
+ const item = asRecord$1(value, fieldName);
1294
+ return withoutUndefinedFields$1({
1295
+ artifactId: optionalString$1(item.artifactId, `${fieldName}.artifactId`),
1296
+ fileKey: optionalString$1(item.fileKey, `${fieldName}.fileKey`),
1297
+ id: optionalString$1(item.id, `${fieldName}.id`),
1298
+ logicalPath: optionalString$1(item.logicalPath, `${fieldName}.logicalPath`),
1299
+ path: optionalString$1(item.path, `${fieldName}.path`),
1300
+ resourceId: optionalString$1(item.resourceId, `${fieldName}.resourceId`),
1301
+ sourceCollection: requiredString$1(item.sourceCollection, `${fieldName}.sourceCollection`),
1302
+ title: optionalString$1(item.title, `${fieldName}.title`)
1303
+ });
1304
+ }
1305
+ function normalizeRequestDisplayIdentity(value, fieldName) {
1306
+ const identity = asRecord$1(value, fieldName);
1307
+ return {
1308
+ ownerTurnId: requiredString$1(identity.ownerTurnId, `${fieldName}.ownerTurnId`),
1309
+ requestId: requiredString$1(identity.requestId, `${fieldName}.requestId`),
1310
+ requestRevision: requiredNumber$1(identity.requestRevision, `${fieldName}.requestRevision`),
1311
+ stateRevision: requiredNumber$1(identity.stateRevision, `${fieldName}.stateRevision`),
1312
+ threadId: requiredString$1(identity.threadId, `${fieldName}.threadId`)
1313
+ };
1314
+ }
1315
+ function normalizeRequestDisplaySnapshot(value, fieldName) {
1316
+ const snapshot = asRecord$1(value, fieldName);
1317
+ return withoutUndefinedFields$1({
1318
+ prompt: requiredString$1(snapshot.prompt, `${fieldName}.prompt`),
1319
+ publicPayload: snapshot.publicPayload === void 0 ? void 0 : sanitizePublicPayload(asRecord$1(snapshot.publicPayload, `${fieldName}.publicPayload`)),
1320
+ title: optionalString$1(snapshot.title, `${fieldName}.title`)
1321
+ });
1322
+ }
1323
+ function normalizeFileChangeEntries(value, fieldName) {
1324
+ return requiredArray(value, fieldName).map((entry, index) => normalizeFileChangeEntry(entry, `${fieldName}[${index}]`));
1325
+ }
1326
+ function normalizeFileChangeEntry(value, fieldName) {
1327
+ const entry = asRecord$1(value, fieldName);
1328
+ assertExactKeys(entry, fieldName, [
1329
+ "diff",
1330
+ "kind",
1331
+ "path"
1332
+ ]);
1333
+ return {
1334
+ diff: requiredPlainString(entry.diff, `${fieldName}.diff`),
1335
+ kind: normalizePatchChangeKind(entry.kind, `${fieldName}.kind`),
1336
+ path: requiredString$1(entry.path, `${fieldName}.path`)
1337
+ };
1338
+ }
1339
+ function normalizePatchChangeKind(value, fieldName) {
1340
+ const kind = asRecord$1(value, fieldName);
1341
+ const type = requiredString$1(kind.type, `${fieldName}.type`);
1342
+ if (type === "add" || type === "delete") {
1343
+ assertExactKeys(kind, fieldName, ["type"]);
1344
+ return { type };
1345
+ }
1346
+ if (type === "update") {
1347
+ assertExactKeys(kind, fieldName, ["movePath", "type"]);
1348
+ return withoutUndefinedFields$1({
1349
+ movePath: optionalString$1(kind.movePath, `${fieldName}.movePath`),
1350
+ type
1351
+ });
1352
+ }
1353
+ throw new Error(`${fieldName}.type is invalid.`);
1354
+ }
1355
+ function normalizeTurnDiffSnapshot(value, fieldName) {
1356
+ const diff = asRecord$1(value, fieldName);
1357
+ return withoutUndefinedFields$1({
1358
+ fileCount: requiredNumber$1(diff.fileCount, `${fieldName}.fileCount`),
1359
+ sourceSeq: optionalNumber$1(diff.sourceSeq, `${fieldName}.sourceSeq`),
1360
+ unifiedDiff: requiredPlainString(diff.unifiedDiff, `${fieldName}.unifiedDiff`),
1361
+ updatedAt: optionalString$1(diff.updatedAt, `${fieldName}.updatedAt`)
1362
+ });
1363
+ }
1364
+ function normalizeTurnPlanSnapshot(value, fieldName) {
1365
+ const plan = asRecord$1(value, fieldName);
1366
+ return withoutUndefinedFields$1({
1367
+ explanation: optionalString$1(plan.explanation, `${fieldName}.explanation`),
1368
+ itemId: optionalString$1(plan.itemId, `${fieldName}.itemId`),
1369
+ sourceSeq: optionalNumber$1(plan.sourceSeq, `${fieldName}.sourceSeq`),
1370
+ steps: requiredArray(plan.steps, `${fieldName}.steps`).map((step, index) => normalizePlanStep(step, `${fieldName}.steps[${index}]`)),
1371
+ text: optionalString$1(plan.text, `${fieldName}.text`),
1372
+ updatedAt: optionalString$1(plan.updatedAt, `${fieldName}.updatedAt`)
1373
+ });
1374
+ }
1375
+ function normalizePlanStep(value, fieldName) {
1376
+ const step = asRecord$1(value, fieldName);
1377
+ return withoutUndefinedFields$1({
1378
+ id: optionalString$1(step.id, `${fieldName}.id`),
1379
+ status: requiredPlanStepStatus(step.status, `${fieldName}.status`),
1380
+ step: requiredString$1(step.step, `${fieldName}.step`)
1381
+ });
1382
+ }
1383
+ function normalizeFdeTurnError(value, fieldName) {
1384
+ const error = asRecord$1(value, fieldName);
1385
+ return withoutUndefinedFields$1({
1386
+ code: optionalString$1(error.code, `${fieldName}.code`),
1387
+ detail: optionalString$1(error.detail, `${fieldName}.detail`),
1388
+ message: requiredString$1(error.message, `${fieldName}.message`)
1389
+ });
1390
+ }
1391
+ function normalizeCapabilitySummaryWire(value, fieldName) {
1392
+ const capability = asRecord$1(value, fieldName);
1393
+ return withoutUndefinedFields$1({
1394
+ capabilityId: requiredString$1(capability.capabilityId, `${fieldName}.capabilityId`),
1395
+ displayName: optionalString$1(capability.displayName, `${fieldName}.displayName`),
1396
+ mode: requiredString$1(capability.mode, `${fieldName}.mode`),
1397
+ reasonCode: optionalString$1(capability.reasonCode, `${fieldName}.reasonCode`)
1398
+ });
1399
+ }
1400
+ function normalizePublicErrorWire(value, fieldName) {
1401
+ const error = asRecord$1(value, fieldName);
1402
+ return withoutUndefinedFields$1({
1403
+ code: optionalString$1(error.code, `${fieldName}.code`),
1404
+ detail: optionalString$1(error.detail, `${fieldName}.detail`),
1405
+ message: requiredString$1(error.message, `${fieldName}.message`),
1406
+ nextAction: optionalString$1(error.nextAction, `${fieldName}.nextAction`),
1407
+ targetPath: optionalString$1(error.targetPath, `${fieldName}.targetPath`),
1408
+ title: optionalString$1(error.title, `${fieldName}.title`)
1409
+ });
1410
+ }
1411
+ function normalizeSaveCompletionWire(value, fieldName) {
1412
+ const completion = asRecord$1(value, fieldName);
1413
+ return {
1414
+ completionId: requiredString$1(completion.completionId, `${fieldName}.completionId`),
1415
+ operation: requiredSaveCompletionOperation(completion.operation, `${fieldName}.operation`),
1416
+ requestId: requiredString$1(completion.requestId, `${fieldName}.requestId`),
1417
+ requestRevision: requiredNonNegativeSafeInteger(completion.requestRevision, `${fieldName}.requestRevision`),
1418
+ requestStateRevision: requiredNonNegativeSafeInteger(completion.requestStateRevision, `${fieldName}.requestStateRevision`),
1419
+ status: requiredSaveCompletionStatus(completion.status, `${fieldName}.status`),
1420
+ summary: requiredString$1(completion.summary, `${fieldName}.summary`),
1421
+ targetPaths: requiredArray(completion.targetPaths, `${fieldName}.targetPaths`).map((path, index) => requiredString$1(path, `${fieldName}.targetPaths[${index}]`))
1422
+ };
1423
+ }
1424
+ function normalizeArtifactRefWire(value, fieldName) {
1425
+ const item = asRecord$1(value, fieldName);
1426
+ return withoutUndefinedFields$1({
1427
+ artifactId: requiredString$1(item.artifactId, `${fieldName}.artifactId`),
1428
+ artifact_kind: optionalString$1(item.artifact_kind, `${fieldName}.artifact_kind`),
1429
+ locator: item.locator === void 0 ? void 0 : asRecord$1(item.locator, `${fieldName}.locator`),
1430
+ operationSource: requiredOptionalOperationSource(item.operationSource, `${fieldName}.operationSource`),
1431
+ path: requiredString$1(item.path, `${fieldName}.path`),
1432
+ platformSyncStatus: requiredOptionalPlatformSyncStatus(item.platformSyncStatus, `${fieldName}.platformSyncStatus`),
1433
+ resourceOperation: requiredOptionalResourceOperation(item.resourceOperation, `${fieldName}.resourceOperation`),
1434
+ title: optionalString$1(item.title, `${fieldName}.title`)
1435
+ });
1436
+ }
1437
+ function normalizeArtifactPanelItemWire(value, fieldName) {
1438
+ const record = asRecord$1(value, fieldName);
1439
+ return {
1440
+ ...normalizeArtifactRefWire(value, fieldName),
1441
+ turnId: requiredString$1(record.turnId, `${fieldName}.turnId`)
1442
+ };
1443
+ }
1444
+ function normalizeRequiredAction(value) {
1445
+ const action = asRecord$1(value, "activeRequiredAction");
1446
+ const kind = requiredString$1(action.kind, "activeRequiredAction.kind");
1447
+ if (kind === "status") {
1448
+ if ("surface" in action) throw new TypeError("activeRequiredAction.surface is not supported for status required actions.");
1449
+ return {
1450
+ actionId: requiredString$1(action.actionId, "activeRequiredAction.actionId"),
1451
+ kind,
1452
+ prompt: requiredString$1(action.prompt, "activeRequiredAction.prompt"),
1453
+ stateRevision: requiredNumber$1(action.stateRevision, "activeRequiredAction.stateRevision"),
1454
+ turnId: requiredString$1(action.turnId, "activeRequiredAction.turnId")
1455
+ };
1456
+ }
1457
+ if (kind !== "text" && kind !== "choice" && kind !== "form" && kind !== "approval") throw new Error("activeRequiredAction.kind is invalid.");
1458
+ const identity = normalizeFdeCoreServerRequestIdentity(action);
1459
+ const submitKind = kind;
1460
+ return withoutUndefinedFields$1({
1461
+ ...identity,
1462
+ actionId: requiredString$1(action.actionId, "activeRequiredAction.actionId"),
1463
+ decisions: optionalArray(action.decisions),
1464
+ domain: optionalString$1(action.domain, "activeRequiredAction.domain"),
1465
+ fields: optionalArray(action.fields),
1466
+ kind: submitKind,
1467
+ prompt: requiredString$1(action.prompt, "activeRequiredAction.prompt"),
1468
+ publicPayload: optionalPublicPayload(action),
1469
+ requestType: optionalString$1(action.requestType, "activeRequiredAction.requestType"),
1470
+ surface: normalizeRequiredActionSurfaceWire(action.surface, "activeRequiredAction.surface")
1471
+ });
1472
+ }
1473
+ function normalizeRequiredActionSurfaceWire(value, fieldName) {
1474
+ if (value === void 0) return void 0;
1475
+ const surface = asRecord$1(value, fieldName);
1476
+ const kind = requiredString$1(surface.kind, `${fieldName}.kind`);
1477
+ const version = requiredNumber$1(surface.version, `${fieldName}.version`);
1478
+ if (version !== 1) throw new TypeError(`${fieldName}.version is unsupported.`);
1479
+ switch (kind) {
1480
+ case "build_module_selection": return {
1481
+ diagnostics: normalizePublicDiagnostics(surface.diagnostics, `${fieldName}.diagnostics`),
1482
+ goalId: optionalString$1(surface.goalId, `${fieldName}.goalId`),
1483
+ kind,
1484
+ modules: requiredArray(surface.modules, `${fieldName}.modules`).map((module, index) => normalizeBuildModuleSelectionSurfaceModule(module, `${fieldName}.modules[${index}]`)),
1485
+ version
1486
+ };
1487
+ case "build_source_dependency": return {
1488
+ dependencies: requiredArray(surface.dependencies, `${fieldName}.dependencies`).map((dependency, index) => normalizeBuildSourceDependencySurfaceDependency(dependency, `${fieldName}.dependencies[${index}]`)),
1489
+ diagnostics: normalizePublicDiagnostics(surface.diagnostics, `${fieldName}.diagnostics`),
1490
+ goalId: optionalString$1(surface.goalId, `${fieldName}.goalId`),
1491
+ kind,
1492
+ mode: requiredBuildSourceDependencyMode(surface.mode, `${fieldName}.mode`),
1493
+ version
1494
+ };
1495
+ case "formal_save_approval": return {
1496
+ diagnostics: normalizePublicDiagnostics(surface.diagnostics, `${fieldName}.diagnostics`),
1497
+ kind,
1498
+ targetSummary: requiredArray(surface.targetSummary, `${fieldName}.targetSummary`).map((target, index) => normalizeFormalSaveApprovalSurfaceTarget(target, `${fieldName}.targetSummary[${index}]`)),
1499
+ title: requiredString$1(surface.title, `${fieldName}.title`),
1500
+ version
1501
+ };
1502
+ case "model_blueprint_confirmation": return {
1503
+ blueprint: normalizeModelBlueprintSummaryWire(surface.blueprint, `${fieldName}.blueprint`),
1504
+ decisionMode: requiredDecisionMode(surface.decisionMode, `${fieldName}.decisionMode`),
1505
+ diagnostics: normalizePublicDiagnostics(surface.diagnostics, `${fieldName}.diagnostics`),
1506
+ goalId: requiredString$1(surface.goalId, `${fieldName}.goalId`),
1507
+ kind,
1508
+ missingSlots: requiredArray(surface.missingSlots, `${fieldName}.missingSlots`).map((slot, index) => normalizeModelBlueprintMissingSlotWire(slot, `${fieldName}.missingSlots[${index}]`)),
1509
+ nextAction: requiredModelBlueprintNextAction(surface.nextAction, `${fieldName}.nextAction`),
1510
+ version
1511
+ };
1512
+ default: throw new TypeError(`${fieldName}.kind is unsupported.`);
1513
+ }
1514
+ }
1515
+ function normalizePublicDiagnostics(value, fieldName) {
1516
+ return requiredArray(value ?? [], fieldName).map((item, index) => {
1517
+ const diagnostic = asRecord$1(item, `${fieldName}[${index}]`);
1518
+ return withoutUndefinedFields$1({
1519
+ code: requiredString$1(diagnostic.code, `${fieldName}[${index}].code`),
1520
+ message: requiredString$1(diagnostic.message, `${fieldName}[${index}].message`),
1521
+ severity: requiredPublicDiagnosticSeverity(diagnostic.severity, `${fieldName}[${index}].severity`),
1522
+ targetPath: optionalString$1(diagnostic.targetPath, `${fieldName}[${index}].targetPath`)
1523
+ });
1524
+ });
1525
+ }
1526
+ function normalizeModelBlueprintSummaryWire(value, fieldName) {
1527
+ const blueprint = asRecord$1(value, fieldName);
1528
+ return withoutUndefinedFields$1({
1529
+ blueprintId: requiredString$1(blueprint.blueprintId, `${fieldName}.blueprintId`),
1530
+ confidence: optionalNumber$1(blueprint.confidence, `${fieldName}.confidence`),
1531
+ dictionaries: requiredArray(blueprint.dictionaries, `${fieldName}.dictionaries`).map((dictionary, index) => normalizeModelBlueprintDictionaryWire(dictionary, `${fieldName}.dictionaries[${index}]`)),
1532
+ entities: requiredArray(blueprint.entities, `${fieldName}.entities`).map((entity, index) => normalizeModelBlueprintEntityWire(entity, `${fieldName}.entities[${index}]`))
1533
+ });
1534
+ }
1535
+ function normalizeModelBlueprintEntityWire(value, fieldName) {
1536
+ const entity = asRecord$1(value, fieldName);
1537
+ return {
1538
+ code: requiredString$1(entity.code, `${fieldName}.code`),
1539
+ fieldCount: requiredNumber$1(entity.fieldCount, `${fieldName}.fieldCount`),
1540
+ fields: requiredArray(entity.fields, `${fieldName}.fields`).map((field, index) => normalizeModelBlueprintFieldWire(field, `${fieldName}.fields[${index}]`)),
1541
+ title: requiredString$1(entity.title, `${fieldName}.title`)
1542
+ };
1543
+ }
1544
+ function normalizeModelBlueprintFieldWire(value, fieldName) {
1545
+ const field = asRecord$1(value, fieldName);
1546
+ return withoutUndefinedFields$1({
1547
+ code: requiredString$1(field.code, `${fieldName}.code`),
1548
+ dictionaryCode: optionalString$1(field.dictionaryCode, `${fieldName}.dictionaryCode`),
1549
+ name: requiredString$1(field.name, `${fieldName}.name`),
1550
+ relationHint: optionalString$1(field.relationHint, `${fieldName}.relationHint`),
1551
+ relationTargetCode: optionalString$1(field.relationTargetCode, `${fieldName}.relationTargetCode`),
1552
+ required: optionalBoolean(field.required, `${fieldName}.required`),
1553
+ typeHint: optionalString$1(field.typeHint, `${fieldName}.typeHint`),
1554
+ valueSource: optionalString$1(field.valueSource, `${fieldName}.valueSource`)
1555
+ });
1556
+ }
1557
+ function normalizeModelBlueprintDictionaryWire(value, fieldName) {
1558
+ const dictionary = asRecord$1(value, fieldName);
1559
+ return withoutUndefinedFields$1({
1560
+ code: requiredString$1(dictionary.code, `${fieldName}.code`),
1561
+ title: requiredString$1(dictionary.title, `${fieldName}.title`),
1562
+ valueCount: optionalNumber$1(dictionary.valueCount, `${fieldName}.valueCount`),
1563
+ valuesPreview: requiredArray(dictionary.valuesPreview, `${fieldName}.valuesPreview`).map((item, index) => {
1564
+ const valueRecord = asRecord$1(item, `${fieldName}.valuesPreview[${index}]`);
1565
+ return {
1566
+ label: requiredString$1(valueRecord.label, `${fieldName}.valuesPreview[${index}].label`),
1567
+ value: requiredString$1(valueRecord.value, `${fieldName}.valuesPreview[${index}].value`)
1568
+ };
1569
+ })
1570
+ });
1571
+ }
1572
+ function normalizeModelBlueprintMissingSlotWire(value, fieldName) {
1573
+ const slot = asRecord$1(value, fieldName);
1574
+ return {
1575
+ blocking: requiredBoolean(slot.blocking, `${fieldName}.blocking`),
1576
+ candidates: requiredArray(slot.candidates, `${fieldName}.candidates`).map((candidate, index) => {
1577
+ const record = asRecord$1(candidate, `${fieldName}.candidates[${index}]`);
1578
+ return withoutUndefinedFields$1({
1579
+ description: optionalString$1(record.description, `${fieldName}.candidates[${index}].description`),
1580
+ id: requiredString$1(record.id, `${fieldName}.candidates[${index}].id`),
1581
+ label: requiredString$1(record.label, `${fieldName}.candidates[${index}].label`)
1582
+ });
1583
+ }),
1584
+ field: requiredString$1(slot.field, `${fieldName}.field`),
1585
+ owner: requiredString$1(slot.owner, `${fieldName}.owner`),
1586
+ ownerId: requiredString$1(slot.ownerId, `${fieldName}.ownerId`),
1587
+ reason: requiredString$1(slot.reason, `${fieldName}.reason`),
1588
+ slotId: requiredString$1(slot.slotId, `${fieldName}.slotId`)
1589
+ };
1590
+ }
1591
+ function normalizeBuildSourceDependencySurfaceDependency(value, fieldName) {
1592
+ const dependency = asRecord$1(value, fieldName);
1593
+ return withoutUndefinedFields$1({
1594
+ blocking: requiredBoolean(dependency.blocking, `${fieldName}.blocking`),
1595
+ candidates: requiredArray(dependency.candidates, `${fieldName}.candidates`).map((candidate, index) => {
1596
+ const record = asRecord$1(candidate, `${fieldName}.candidates[${index}]`);
1597
+ return withoutUndefinedFields$1({
1598
+ description: optionalString$1(record.description, `${fieldName}.candidates[${index}].description`),
1599
+ id: requiredString$1(record.id, `${fieldName}.candidates[${index}].id`),
1600
+ label: requiredString$1(record.label, `${fieldName}.candidates[${index}].label`),
1601
+ resourceType: optionalString$1(record.resourceType, `${fieldName}.candidates[${index}].resourceType`)
1602
+ });
1603
+ }),
1604
+ dependencyId: requiredString$1(dependency.dependencyId, `${fieldName}.dependencyId`),
1605
+ reason: requiredBuildSourceDependencyReason(dependency.reason, `${fieldName}.reason`),
1606
+ resourceName: optionalString$1(dependency.resourceName, `${fieldName}.resourceName`),
1607
+ resourceType: requiredBuildResourceType(dependency.resourceType, `${fieldName}.resourceType`)
1608
+ });
1609
+ }
1610
+ function normalizeBuildModuleSelectionSurfaceModule(value, fieldName) {
1611
+ const module = asRecord$1(value, fieldName);
1612
+ return withoutUndefinedFields$1({
1613
+ description: optionalString$1(module.description, `${fieldName}.description`),
1614
+ id: requiredString$1(module.id, `${fieldName}.id`),
1615
+ label: requiredString$1(module.label, `${fieldName}.label`),
1616
+ selected: optionalBoolean(module.selected, `${fieldName}.selected`)
1617
+ });
1618
+ }
1619
+ function normalizeFormalSaveApprovalSurfaceTarget(value, fieldName) {
1620
+ const target = asRecord$1(value, fieldName);
1621
+ return withoutUndefinedFields$1({
1622
+ changeType: requiredOptionalChangeType(target.changeType, `${fieldName}.changeType`),
1623
+ id: requiredString$1(target.id, `${fieldName}.id`),
1624
+ label: requiredString$1(target.label, `${fieldName}.label`),
1625
+ operationSource: requiredOperationSource(target.operationSource, `${fieldName}.operationSource`),
1626
+ platformSyncStatus: requiredPlatformSyncStatus(target.platformSyncStatus, `${fieldName}.platformSyncStatus`),
1627
+ resourceOperation: requiredResourceOperation(target.resourceOperation, `${fieldName}.resourceOperation`),
1628
+ resourceType: optionalString$1(target.resourceType, `${fieldName}.resourceType`)
1629
+ });
1630
+ }
1631
+ function normalizeActiveTurnControl(value) {
1632
+ const active = asRecord$1(value, "activeTurnControl");
1633
+ const status = optionalString$1(active.status, "activeTurnControl.status");
1634
+ if (status !== void 0 && status !== "running" && status !== "interrupting") throw new Error("activeTurnControl.status is invalid.");
1635
+ return {
1636
+ clientRequestId: optionalString$1(active.clientRequestId, "activeTurnControl.clientRequestId"),
1637
+ stateRevision: requiredNumber$1(active.stateRevision, "activeTurnControl.stateRevision"),
1638
+ status,
1639
+ turnId: requiredString$1(active.turnId, "activeTurnControl.turnId")
1640
+ };
1641
+ }
1642
+ function normalizeContinuableTaskSession(value) {
1643
+ const session = asRecord$1(value, "continuableTaskSession");
1644
+ const status = requiredString$1(session.status, "continuableTaskSession.status");
1645
+ if (status !== "continuable") throw new Error("continuableTaskSession.status is invalid.");
1646
+ const continuableStatus = status;
1647
+ return withoutUndefinedFields$1({
1648
+ baseTurnId: requiredString$1(session.baseTurnId, "continuableTaskSession.baseTurnId"),
1649
+ status: continuableStatus,
1650
+ taskSessionId: requiredString$1(session.taskSessionId, "continuableTaskSession.taskSessionId"),
1651
+ taskSessionRevision: requiredNonNegativeSafeInteger(session.taskSessionRevision, "continuableTaskSession.taskSessionRevision")
1652
+ });
1653
+ }
1654
+ function normalizeMemoryContextProjection(value, fieldName) {
1655
+ const context = asRecord$1(value, fieldName);
1656
+ rejectFrameFields(context, fieldName, [
1657
+ "tenant_id",
1658
+ "conversation_id",
1659
+ "turn_id",
1660
+ "created_at",
1661
+ "source_status",
1662
+ "suppressed_refs",
1663
+ "budget_breakdown"
1664
+ ]);
1665
+ const budget = asRecord$1(context.budget, `${fieldName}.budget`);
1666
+ return {
1667
+ snapshot_id: requiredString$1(context.snapshot_id, `${fieldName}.snapshot_id`),
1668
+ selected_count: requiredNumber$1(context.selected_count, `${fieldName}.selected_count`),
1669
+ suppressed_count: requiredNumber$1(context.suppressed_count, `${fieldName}.suppressed_count`),
1670
+ suppressed_reason_counts: normalizeSuppressedReasonCounts(context.suppressed_reason_counts, `${fieldName}.suppressed_reason_counts`),
1671
+ budget: {
1672
+ max_tokens: requiredNumber$1(budget.max_tokens, `${fieldName}.budget.max_tokens`),
1673
+ estimated_tokens: requiredNumber$1(budget.estimated_tokens, `${fieldName}.budget.estimated_tokens`)
1674
+ },
1675
+ summary_available: requiredBoolean(context.summary_available, `${fieldName}.summary_available`),
1676
+ snapshot_detail_status: requiredMemorySnapshotDetailStatus(context.snapshot_detail_status, `${fieldName}.snapshot_detail_status`),
1677
+ fallback_level: requiredMemoryFallbackLevel(context.fallback_level, `${fieldName}.fallback_level`),
1678
+ selected_refs: requiredArray(context.selected_refs, `${fieldName}.selected_refs`).map((ref, index) => normalizePublicMemoryContextRef(ref, `${fieldName}.selected_refs[${index}]`))
1679
+ };
1680
+ }
1681
+ function normalizeSuppressedReasonCounts(value, fieldName) {
1682
+ const record = asRecord$1(value, fieldName);
1683
+ const out = {};
1684
+ for (const [key, count] of Object.entries(record)) out[key] = requiredNumber$1(count, `${fieldName}.${key}`);
1685
+ return out;
1686
+ }
1687
+ function normalizePublicMemoryContextRef(value, fieldName) {
1688
+ const ref = asRecord$1(value, fieldName);
1689
+ const type = requiredString$1(ref.type, `${fieldName}.type`);
1690
+ if (type === "memory_record") return withoutUndefinedFields$1({
1691
+ type,
1692
+ memory_id: requiredString$1(ref.memory_id, `${fieldName}.memory_id`),
1693
+ scope: requiredMemoryScope(ref.scope, `${fieldName}.scope`),
1694
+ category: ref.category === void 0 ? void 0 : requiredMemoryRecordCategory(ref.category, `${fieldName}.category`),
1695
+ trust_level: ref.trust_level === void 0 ? void 0 : requiredMemoryTrustLevel(ref.trust_level, `${fieldName}.trust_level`),
1696
+ title: optionalString$1(ref.title, `${fieldName}.title`),
1697
+ summary: requiredString$1(ref.summary, `${fieldName}.summary`),
1698
+ reason: requiredMemoryRecordContextReason(ref.reason, `${fieldName}.reason`),
1699
+ rank: requiredNumber$1(ref.rank, `${fieldName}.rank`),
1700
+ token_estimate: requiredNumber$1(ref.token_estimate, `${fieldName}.token_estimate`)
1701
+ });
1702
+ if (type === "conversation_summary") return {
1703
+ type,
1704
+ summary_id: requiredString$1(ref.summary_id, `${fieldName}.summary_id`),
1705
+ conversation_id: requiredString$1(ref.conversation_id, `${fieldName}.conversation_id`),
1706
+ summary: requiredString$1(ref.summary, `${fieldName}.summary`),
1707
+ reason: requiredConversationSummaryContextReason(ref.reason, `${fieldName}.reason`),
1708
+ rank: requiredNumber$1(ref.rank, `${fieldName}.rank`),
1709
+ token_estimate: requiredNumber$1(ref.token_estimate, `${fieldName}.token_estimate`)
1710
+ };
1711
+ if (type === "recent_message_range") return withoutUndefinedFields$1({
1712
+ type,
1713
+ conversation_id: requiredString$1(ref.conversation_id, `${fieldName}.conversation_id`),
1714
+ from_message_seq: optionalNumber$1(ref.from_message_seq, `${fieldName}.from_message_seq`),
1715
+ to_message_seq: optionalNumber$1(ref.to_message_seq, `${fieldName}.to_message_seq`),
1716
+ reason: requiredRecentMessageContextReason(ref.reason, `${fieldName}.reason`),
1717
+ rank: requiredNumber$1(ref.rank, `${fieldName}.rank`),
1718
+ token_estimate: requiredNumber$1(ref.token_estimate, `${fieldName}.token_estimate`)
1719
+ });
1720
+ throw new Error(`${fieldName}.type is invalid.`);
1721
+ }
1722
+ function requiredServerRequestMethod(value) {
1723
+ if (value === "fde/serverRequest/userInput" || value === "fde/serverRequest/approval") return value;
1724
+ throw new Error("method is invalid.");
1725
+ }
1726
+ function requiredTurnStatus(value, fieldName) {
1727
+ if (value === "running" || value === "awaiting_input" || value === "completed" || value === "failed" || value === "cancelled") return value;
1728
+ throw new Error(`${fieldName} is invalid.`);
1729
+ }
1730
+ function requiredRuntimeRunStatus(value, fieldName) {
1731
+ if (value === "running" || value === "waiting_user" || value === "completed" || value === "failed" || value === "cancelled") return value;
1732
+ throw new Error(`${fieldName} is invalid.`);
1733
+ }
1734
+ function requiredRuntimeRunPhase(value, fieldName) {
1735
+ if (value === "prework" || value === "planning" || value === "executing" || value === "answering" || value === "saving" || value === "done") return value;
1736
+ throw new Error(`${fieldName} is invalid.`);
1737
+ }
1738
+ function requiredRuntimeActivityStatus(value, fieldName) {
1739
+ if (value === "pending" || value === "running" || value === "completed" || value === "failed" || value === "skipped") return value;
1740
+ throw new Error(`${fieldName} is invalid.`);
1741
+ }
1742
+ function requiredRuntimeGateKind(value, fieldName) {
1743
+ if (value === "user_input" || value === "approval" || value === "server_request") return value;
1744
+ throw new Error(`${fieldName} is invalid.`);
1745
+ }
1746
+ function requiredRuntimeGateStatus(value, fieldName) {
1747
+ if (value === "pending" || value === "resolved" || value === "cancelled") return value;
1748
+ throw new Error(`${fieldName} is invalid.`);
1749
+ }
1750
+ function requiredRuntimeOutputKind(value, fieldName) {
1751
+ if (value === "artifact" || value === "file" || value === "message" || value === "panel") return value;
1752
+ throw new Error(`${fieldName} is invalid.`);
1753
+ }
1754
+ function requiredRuntimeSourceKind(value, fieldName) {
1755
+ if (value === "file" || value === "artifact" || value === "tool" || value === "knowledge") return value;
1756
+ throw new Error(`${fieldName} is invalid.`);
1757
+ }
1758
+ function requiredRuntimeRightPanelKind(value, fieldName) {
1759
+ if (value === "produce" || value === "artifact" || value === "diff" || value === "approval") return value;
1760
+ throw new Error(`${fieldName} is invalid.`);
1761
+ }
1762
+ function requiredMemoryScope(value, fieldName) {
1763
+ if (value === "platform" || value === "tenant" || value === "app" || value === "resource" || value === "user" || value === "conversation") return value;
1764
+ throw new Error(`${fieldName} is invalid.`);
1765
+ }
1766
+ function requiredMemoryRecordCategory(value, fieldName) {
1767
+ if (value === "profile" || value === "preference" || value === "business_term" || value === "design_decision" || value === "constraint" || value === "open_question" || value === "workflow_pattern") return value;
1768
+ throw new Error(`${fieldName} is invalid.`);
1769
+ }
1770
+ function requiredMemoryTrustLevel(value, fieldName) {
1771
+ if (value === "admin_confirmed" || value === "owner_confirmed" || value === "user_confirmed" || value === "imported") return value;
1772
+ throw new Error(`${fieldName} is invalid.`);
1773
+ }
1774
+ function requiredMemorySnapshotDetailStatus(value, fieldName) {
1775
+ if (value === "available" || value === "pending" || value === "unavailable") return value;
1776
+ throw new Error(`${fieldName} is invalid.`);
1777
+ }
1778
+ function requiredMemoryFallbackLevel(value, fieldName) {
1779
+ if (value === "memory_summary_recent" || value === "summary_recent" || value === "recent_only") return value;
1780
+ throw new Error(`${fieldName} is invalid.`);
1781
+ }
1782
+ function requiredMemoryRecordContextReason(value, fieldName) {
1783
+ if (value === "retrieved" || value === "recent_write" || value === "pinned") return value;
1784
+ throw new Error(`${fieldName} is invalid.`);
1785
+ }
1786
+ function requiredConversationSummaryContextReason(value, fieldName) {
1787
+ if (value === "recent_summary") return value;
1788
+ throw new Error(`${fieldName} is invalid.`);
1789
+ }
1790
+ function requiredRecentMessageContextReason(value, fieldName) {
1791
+ if (value === "recent_messages") return value;
1792
+ throw new Error(`${fieldName} is invalid.`);
1793
+ }
1794
+ function requiredDecisionMode(value, fieldName) {
1795
+ if (value === "clarify" || value === "confirm") return value;
1796
+ throw new Error(`${fieldName} is invalid.`);
1797
+ }
1798
+ function requiredModelBlueprintNextAction(value, fieldName) {
1799
+ if (value === "clarify_model_blueprint" || value === "confirm_model_blueprint") return value;
1800
+ throw new Error(`${fieldName} is invalid.`);
1801
+ }
1802
+ function requiredPublicDiagnosticSeverity(value, fieldName) {
1803
+ if (value === "blocking" || value === "info" || value === "warning") return value;
1804
+ throw new Error(`${fieldName} is invalid.`);
1805
+ }
1806
+ function requiredBuildSourceDependencyMode(value, fieldName) {
1807
+ if (value === "ambiguous" || value === "missing") return value;
1808
+ throw new Error(`${fieldName} is invalid.`);
1809
+ }
1810
+ function requiredBuildSourceDependencyReason(value, fieldName) {
1811
+ if (value === "ambiguous" || value === "missing" || value === "not_found") return value;
1812
+ throw new Error(`${fieldName} is invalid.`);
1813
+ }
1814
+ function requiredBuildResourceType(value, fieldName) {
1815
+ if (value === "document" || value === "form_page" || value === "list_page" || value === "model" || value === "script" || value === "workflow") return value;
1816
+ throw new Error(`${fieldName} is invalid.`);
1817
+ }
1818
+ function requiredOptionalChangeType(value, fieldName) {
1819
+ if (value === void 0) return void 0;
1820
+ if (value === "create" || value === "delete" || value === "edit") return value;
1821
+ throw new Error(`${fieldName} is invalid.`);
1822
+ }
1823
+ function requiredOptionalResourceOperation(value, fieldName) {
1824
+ if (value === void 0) return void 0;
1825
+ if (value === "create" || value === "edit") return value;
1826
+ throw new Error(`${fieldName} is invalid.`);
1827
+ }
1828
+ function requiredResourceOperation(value, fieldName) {
1829
+ const result = requiredOptionalResourceOperation(value, fieldName);
1830
+ if (result === void 0) throw new Error(`${fieldName} is required.`);
1831
+ return result;
1832
+ }
1833
+ function requiredOptionalOperationSource(value, fieldName) {
1834
+ if (value === void 0) return void 0;
1835
+ if (value === "semantic_planner" || value === "typed_user_decision" || value === "runtime_resolution") return value;
1836
+ throw new Error(`${fieldName} is invalid.`);
1837
+ }
1838
+ function requiredOperationSource(value, fieldName) {
1839
+ const result = requiredOptionalOperationSource(value, fieldName);
1840
+ if (result === void 0) throw new Error(`${fieldName} is required.`);
1841
+ return result;
1842
+ }
1843
+ function requiredSaveCompletionOperation(value, fieldName) {
1844
+ if (value === "formal_save" || value === "platform_sync") return value;
1845
+ throw new Error(`${fieldName} is invalid.`);
1846
+ }
1847
+ function requiredSaveCompletionStatus(value, fieldName) {
1848
+ if (value === "succeeded") return value;
1849
+ throw new Error(`${fieldName} is invalid.`);
1850
+ }
1851
+ function requiredOptionalPlatformSyncStatus(value, fieldName) {
1852
+ if (value === void 0) return void 0;
1853
+ if (value === "not_required" || value === "pending_user_confirm" || value === "succeeded" || value === "failed" || value === "failed_retryable" || value === "failed_terminal" || value === "partial_write" || value === "waived") return value;
1854
+ throw new Error(`${fieldName} is invalid.`);
1855
+ }
1856
+ function requiredPlatformSyncStatus(value, fieldName) {
1857
+ const result = requiredOptionalPlatformSyncStatus(value, fieldName);
1858
+ if (result === void 0) throw new Error(`${fieldName} is required.`);
1859
+ return result;
1860
+ }
1861
+ function ensureMatchingId(id, requestId) {
1862
+ if (id !== requestId) throw new Error(`stale_or_invalid server response id mismatch for requestId ${requestId}.`);
1863
+ }
1864
+ function requiredArray(value, fieldName) {
1865
+ if (!Array.isArray(value)) throw new TypeError(`${fieldName} must be an array.`);
1866
+ return value;
1867
+ }
1868
+ function optionalArray(value) {
1869
+ return value === void 0 ? void 0 : requiredArray(value, "array");
1870
+ }
1871
+ function optionalPublicPayload(record) {
1872
+ if ("public_payload" in record) throw new TypeError("public_payload is not supported for app/UI server request wire.");
1873
+ const value = record.publicPayload;
1874
+ if (value === void 0) return void 0;
1875
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("publicPayload must be an object.");
1876
+ return sanitizePublicPayload(value);
1877
+ }
1878
+ function optionalBoundItemType(value, fieldName) {
1879
+ if (value === void 0) return void 0;
1880
+ if (value === "commandExecution" || value === "fileChange") return value;
1881
+ throw new TypeError(`${fieldName} is invalid.`);
1882
+ }
1883
+ function normalizeItemBoundIdentity(params) {
1884
+ const approvalRequestId = optionalNonEmptyString(params.approvalRequestId, "approvalRequestId");
1885
+ const boundItemId = optionalNonEmptyString(params.boundItemId, "boundItemId");
1886
+ const boundItemType = optionalBoundItemType(params.boundItemType, "boundItemType");
1887
+ if (boundItemId && !boundItemType || !boundItemId && boundItemType) throw new TypeError("boundItemId and boundItemType must be provided together.");
1888
+ return withoutUndefinedFields$1({
1889
+ approvalRequestId,
1890
+ boundItemId,
1891
+ boundItemType
1892
+ });
1893
+ }
1894
+ const FDE_PUBLIC_PAYLOAD_MAX_DEPTH = 8;
1895
+ const FDE_PUBLIC_PAYLOAD_MAX_OBJECT_KEYS = 64;
1896
+ const FDE_PUBLIC_PAYLOAD_MAX_ARRAY_ITEMS = 100;
1897
+ const FDE_PUBLIC_PAYLOAD_MAX_STRING_LENGTH = 2e4;
1898
+ const PRIVATE_PUBLIC_PAYLOAD_KEYS = new Set([
1899
+ ["projection", "Requirements"].join(""),
1900
+ ["projection", "requirements"].join("_"),
1901
+ "attachment_id",
1902
+ "attachmentId",
1903
+ "base64",
1904
+ "binary",
1905
+ "candidate_catalog_hash",
1906
+ "candidate_set_hash",
1907
+ "candidateCatalogHash",
1908
+ "candidateSetHash",
1909
+ "canonical_path",
1910
+ "canonical_turn_id",
1911
+ "canonicalPath",
1912
+ "canonicalTurnId",
1913
+ "commit_idempotency_key",
1914
+ "commitIdempotencyKey",
1915
+ "content_hash",
1916
+ "contentHash",
1917
+ "conversation_id",
1918
+ "conversationId",
1919
+ "document_uid",
1920
+ "documentUid",
1921
+ "draft_id",
1922
+ "draftId",
1923
+ "edit_intents",
1924
+ "editIntents",
1925
+ "field_list",
1926
+ "fieldList",
1927
+ "debug_log",
1928
+ "debug_logs",
1929
+ "debugLog",
1930
+ "debugLogs",
1931
+ "file_key",
1932
+ "fileKey",
1933
+ "formal_abs_path",
1934
+ "formal_save",
1935
+ "formalAbsPath",
1936
+ "formalSave",
1937
+ "full_path",
1938
+ "fullPath",
1939
+ "idempotency_key",
1940
+ "idempotencyKey",
1941
+ "internalReasoning",
1942
+ "internal_trace",
1943
+ "internalTrace",
1944
+ "lock_fencing_token",
1945
+ "lock_id",
1946
+ "lockFencingToken",
1947
+ "lockId",
1948
+ "migration_policies",
1949
+ "migrationPolicies",
1950
+ "model_edit_intent_bundle",
1951
+ "modelEditIntentBundle",
1952
+ "logical_path",
1953
+ "logicalPath",
1954
+ "materialization_idempotency_key",
1955
+ "materializationIdempotencyKey",
1956
+ "message_id",
1957
+ "messageId",
1958
+ "operation_id",
1959
+ "operationId",
1960
+ "package",
1961
+ "package_contract",
1962
+ "package_draft_id",
1963
+ "package_formal_evidence_hash",
1964
+ "package_formal_evidence_id",
1965
+ "package_hash",
1966
+ "package_path",
1967
+ "package_required",
1968
+ "package_review",
1969
+ "package_sha256",
1970
+ "packageContract",
1971
+ "packageDraftId",
1972
+ "packageFormalEvidenceHash",
1973
+ "packageFormalEvidenceId",
1974
+ "packageHash",
1975
+ "packagePath",
1976
+ "packageRequired",
1977
+ "packageReview",
1978
+ "packageSha256",
1979
+ "owner_session_id",
1980
+ "ownerSessionId",
1981
+ "platform_document_message_id",
1982
+ "platform_message_id",
1983
+ "platform_resource_identity",
1984
+ "platform_side_effect_scope",
1985
+ "platform_sync",
1986
+ "snapshot_path",
1987
+ "snapshotPath",
1988
+ "platform_version",
1989
+ "platformDocumentMessageId",
1990
+ "platformMessageId",
1991
+ "platformResourceIdentity",
1992
+ "platformSideEffectScope",
1993
+ "platformSync",
1994
+ "platformVersion",
1995
+ "policy_invocation_idempotency_key",
1996
+ "policyInvocationIdempotencyKey",
1997
+ "private_ref",
1998
+ "private_refs",
1999
+ "private_result",
2000
+ "private_state",
2001
+ "private_state_hash",
2002
+ "privateRef",
2003
+ "privateRefs",
2004
+ "privateResult",
2005
+ "privateState",
2006
+ "privateStateHash",
2007
+ "promote",
2008
+ "pull_policy",
2009
+ "pulled_at",
2010
+ "pulled_turn_id",
2011
+ "pullPolicy",
2012
+ "pulledAt",
2013
+ "pulledTurnId",
2014
+ "raw_input",
2015
+ "raw_json",
2016
+ "raw_model_output",
2017
+ "raw_output",
2018
+ "raw_plan",
2019
+ "raw_reasoning",
2020
+ "raw_result",
2021
+ "raw_skill_input",
2022
+ "raw_skill_output",
2023
+ "raw_tool_result",
2024
+ "rawInput",
2025
+ "rawJson",
2026
+ "rawModelOutput",
2027
+ "rawOutput",
2028
+ "rawPlan",
2029
+ "rawReasoning",
2030
+ "rawResult",
2031
+ "rawSkillInput",
2032
+ "rawSkillOutput",
2033
+ "rawToolResult",
2034
+ "receipt_identity",
2035
+ "receiptIdentity",
2036
+ "request_id",
2037
+ "request_identity",
2038
+ "request_identity_hash",
2039
+ "review_task_id",
2040
+ "requestId",
2041
+ "requestIdentity",
2042
+ "requestIdentityHash",
2043
+ "reviewTaskId",
2044
+ "resolved_ref",
2045
+ "resolvedRef",
2046
+ "resource_key",
2047
+ "resource_ref",
2048
+ "resource_refs",
2049
+ "resourceKey",
2050
+ "resourceRef",
2051
+ "resourceRefs",
2052
+ "rp_id",
2053
+ "rpId",
2054
+ "runtime_identity",
2055
+ "runtimeIdentity",
2056
+ "save_to_platform",
2057
+ "saveToPlatform",
2058
+ "server_response_id",
2059
+ "serverResponseId",
2060
+ "side_effect_scope",
2061
+ "sideEffectScope",
2062
+ "skillOutput",
2063
+ "source_dependency_fingerprint",
2064
+ "source_hash",
2065
+ "sourceDependencyFingerprint",
2066
+ "sourceHash",
2067
+ "stack",
2068
+ "stderr",
2069
+ "stdout",
2070
+ "store_key",
2071
+ "storeKey",
2072
+ "sync_to_platform",
2073
+ "syncToPlatform",
2074
+ "target_id",
2075
+ "target_plan_id",
2076
+ "task_id",
2077
+ "targetId",
2078
+ "targetPlanId",
2079
+ "taskId",
2080
+ "validation_main",
2081
+ "validationMain",
2082
+ "validator_main",
2083
+ "validator_main_doc",
2084
+ "validatorMain",
2085
+ "validatorMainDoc",
2086
+ "tool_args",
2087
+ "toolArgs",
2088
+ "update_time",
2089
+ "updateTime",
2090
+ "user_id",
2091
+ "userId",
2092
+ "userid",
2093
+ "workflow_run_id",
2094
+ "workflowRunId",
2095
+ "workspace_abs_path",
2096
+ "workspace_path",
2097
+ "workspace_resolution",
2098
+ "workspaceAbsPath",
2099
+ "workspacePath",
2100
+ "workspaceResolution"
2101
+ ]);
2102
+ function normalizePublicPayloadKey(key) {
2103
+ return key.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
2104
+ }
2105
+ function isPrivatePublicPayloadKey(key, denylist) {
2106
+ if (denylist.has(key)) return true;
2107
+ const normalized = normalizePublicPayloadKey(key);
2108
+ for (const denied of denylist) if (normalizePublicPayloadKey(denied) === normalized) return true;
2109
+ return false;
2110
+ }
2111
+ function sanitizePublicPayload(value) {
2112
+ if (!value) return void 0;
2113
+ const sanitized = isBuildPublicPayload(value) ? sanitizeBuildPublicPayload(value) : isSkillRuntimePublicPayload(value) ? sanitizeSkillRuntimePublicPayload(value) : sanitizePublicPayloadRecord(value, 0);
2114
+ return Object.keys(sanitized).length === 0 ? void 0 : sanitized;
2115
+ }
2116
+ const BUILD_PUBLIC_PAYLOAD_TYPES = new Set([
2117
+ "build_model_blueprint_confirmation",
2118
+ "build_module_required",
2119
+ "build_output_target_required",
2120
+ "build_source_dependency_required"
2121
+ ]);
2122
+ const BUILD_PUBLIC_PAYLOAD_KEYS = new Set([
2123
+ "allow_create",
2124
+ "blueprint_summary",
2125
+ "candidate_modules",
2126
+ "candidate_summary",
2127
+ "decision_mode",
2128
+ "diagnostics",
2129
+ "display_mode",
2130
+ "expected_patch_slots",
2131
+ "goal_id",
2132
+ "missing_slots",
2133
+ "next_action",
2134
+ "proposed_module_name",
2135
+ "reason",
2136
+ "type"
2137
+ ]);
2138
+ const SKILL_PUBLIC_PAYLOAD_TYPES = new Set(["skill_dependency_required"]);
2139
+ function isBuildPublicPayload(value) {
2140
+ return typeof value.type === "string" && BUILD_PUBLIC_PAYLOAD_TYPES.has(value.type);
2141
+ }
2142
+ function sanitizeBuildPublicPayload(record) {
2143
+ const out = {};
2144
+ for (const [key, value] of Object.entries(record)) {
2145
+ if (!BUILD_PUBLIC_PAYLOAD_KEYS.has(key)) continue;
2146
+ const sanitized = key === "candidate_summary" ? sanitizeBuildCandidateSummary(value) : sanitizePublicPayloadValue(value, 0);
2147
+ if (sanitized !== void 0) out[key] = sanitized;
2148
+ }
2149
+ return out;
2150
+ }
2151
+ function sanitizeBuildCandidateSummary(value) {
2152
+ if (!Array.isArray(value)) return sanitizePublicPayloadValue(value, 0);
2153
+ const sanitized = value.map((item) => sanitizeBuildSourceDependencyCandidateSummary(item)).filter((item) => item !== void 0);
2154
+ return sanitized.length === 0 ? void 0 : sanitized;
2155
+ }
2156
+ function sanitizeBuildSourceDependencyCandidateSummary(value) {
2157
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
2158
+ const record = value;
2159
+ if (typeof record.resource_type !== "string" || record.resource_type.trim() === "") return void 0;
2160
+ const sanitized = sanitizePublicPayloadRecord({
2161
+ dependency_id: record.dependency_id,
2162
+ description: record.description,
2163
+ label: record.label,
2164
+ match_evidence: sanitizeBuildMatchEvidenceDisplay(record.match_evidence),
2165
+ option_id: record.option_id,
2166
+ resource_identity: sanitizeBuildResourceIdentityDisplay(record.resource_identity),
2167
+ resource_type: record.resource_type,
2168
+ status: record.status
2169
+ }, 0);
2170
+ return Object.keys(sanitized).length === 0 ? void 0 : sanitized;
2171
+ }
2172
+ function sanitizeBuildResourceIdentityDisplay(value) {
2173
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
2174
+ const record = value;
2175
+ const sanitized = stringRecordWithoutUndefinedFields({
2176
+ code: stringFromUnknown(record.code),
2177
+ form_key: stringFromUnknown(record.form_key) ?? stringFromUnknown(record.formKey),
2178
+ list_key: stringFromUnknown(record.list_key) ?? stringFromUnknown(record.listKey),
2179
+ node_key: stringFromUnknown(record.node_key) ?? stringFromUnknown(record.nodeKey),
2180
+ resource_key: stringFromUnknown(record.resource_key) ?? stringFromUnknown(record.resourceKey),
2181
+ rp_id: stringFromUnknown(record.rp_id) ?? stringFromUnknown(record.rpId)
2182
+ });
2183
+ return Object.keys(sanitized).length === 0 ? void 0 : sanitized;
2184
+ }
2185
+ function sanitizeBuildMatchEvidenceDisplay(value) {
2186
+ const sanitized = arrayFromUnknown(value).map((item) => {
2187
+ const record = recordFromUnknown(item);
2188
+ if (!record) return void 0;
2189
+ const evidence = stringRecordWithoutUndefinedFields({
2190
+ field: stringFromUnknown(record.field),
2191
+ reason: stringFromUnknown(record.reason),
2192
+ score: stringFromUnknown(record.score),
2193
+ source: stringFromUnknown(record.source),
2194
+ value: stringFromUnknown(record.value)
2195
+ });
2196
+ return Object.keys(evidence).length === 0 ? void 0 : evidence;
2197
+ }).filter((item) => item !== void 0);
2198
+ return sanitized.length === 0 ? void 0 : sanitized;
2199
+ }
2200
+ function sanitizePublicPayloadRecord(record, depth) {
2201
+ if (depth > 8) return {};
2202
+ const out = {};
2203
+ for (const [key, value] of Object.entries(record).slice(0, 64)) {
2204
+ if (isPrivatePublicPayloadKey(key, PRIVATE_PUBLIC_PAYLOAD_KEYS)) continue;
2205
+ const sanitized = key === "skill_runtime" || key === "skillRuntime" ? sanitizeSkillRuntimePublicPayloadOrUndefined(value) : sanitizePublicPayloadValue(value, depth + 1);
2206
+ if (sanitized !== void 0) out[key] = sanitized;
2207
+ }
2208
+ return out;
2209
+ }
2210
+ function sanitizePublicPayloadValue(value, depth = 0) {
2211
+ if (value === void 0) return void 0;
2212
+ if (depth > 8) return void 0;
2213
+ if (typeof value === "string") return value.length > 2e4 ? `${value.slice(0, FDE_PUBLIC_PAYLOAD_MAX_STRING_LENGTH)}...[truncated]` : value;
2214
+ if (Array.isArray(value)) return value.slice(0, 100).map((item) => sanitizePublicPayloadValue(item, depth + 1)).filter((item) => item !== void 0);
2215
+ if (value && typeof value === "object") {
2216
+ const record = value;
2217
+ const sanitized = isSkillRuntimePublicPayload(record) ? sanitizeSkillRuntimePublicPayload(record) : sanitizePublicPayloadRecord(record, depth + 1);
2218
+ return Object.keys(sanitized).length === 0 ? void 0 : sanitized;
2219
+ }
2220
+ return value;
2221
+ }
2222
+ function isSkillRuntimePublicPayload(value) {
2223
+ return isSkillDependencyPublicPayload(value) || isSkillPublicSummaryPayload(value);
2224
+ }
2225
+ function isSkillDependencyPublicPayload(value) {
2226
+ return typeof value.type === "string" && SKILL_PUBLIC_PAYLOAD_TYPES.has(value.type);
2227
+ }
2228
+ function isSkillPublicSummaryPayload(value) {
2229
+ if (stringFromUnknown(value.skill_id ?? value.skillId) === void 0) return false;
2230
+ return stringFromUnknown(value.runtime_kind ?? value.runtimeKind) !== void 0 || stringFromUnknown(value.result_kind ?? value.resultKind) !== void 0 || value.artifact_count !== void 0 || value.artifactCount !== void 0 || value.artifact_refs !== void 0 || value.artifactRefs !== void 0 || value.diagnostic_count !== void 0 || value.diagnosticCount !== void 0 || value.fact_count !== void 0 || value.factCount !== void 0 || value.fact_refs !== void 0 || value.factRefs !== void 0 || value.missing_dependencies !== void 0 || value.missingDependencies !== void 0;
2231
+ }
2232
+ function sanitizeSkillRuntimePublicPayload(record) {
2233
+ return withoutUndefinedFields$1({
2234
+ artifact_count: numberFromUnknown(record.artifact_count),
2235
+ artifact_refs: sanitizeSkillArtifactRefs(record.artifact_refs),
2236
+ artifactCount: numberFromUnknown(record.artifactCount),
2237
+ artifactRefs: sanitizeSkillArtifactRefs(record.artifactRefs),
2238
+ candidate_count: numberFromUnknown(record.candidate_count),
2239
+ candidateCount: numberFromUnknown(record.candidateCount),
2240
+ candidates: sanitizeSkillDependencyCandidates(record.candidates),
2241
+ diagnostic_count: numberFromUnknown(record.diagnostic_count),
2242
+ diagnosticCount: numberFromUnknown(record.diagnosticCount),
2243
+ fact_count: numberFromUnknown(record.fact_count),
2244
+ fact_refs: sanitizeSkillFactRefs(record.fact_refs),
2245
+ factCount: numberFromUnknown(record.factCount),
2246
+ factRefs: sanitizeSkillFactRefs(record.factRefs),
2247
+ kind: stringFromUnknown(record.kind),
2248
+ message: stringFromUnknown(record.message),
2249
+ missing_dependencies: sanitizeSkillMissingDependencies(record.missing_dependencies),
2250
+ missingDependencies: sanitizeSkillMissingDependencies(record.missingDependencies),
2251
+ public_ref: stringFromUnknown(record.public_ref),
2252
+ publicRef: stringFromUnknown(record.publicRef),
2253
+ required: booleanFromUnknown(record.required),
2254
+ result_kind: stringFromUnknown(record.result_kind),
2255
+ resultKind: stringFromUnknown(record.resultKind),
2256
+ runtime_kind: stringFromUnknown(record.runtime_kind),
2257
+ runtimeKind: stringFromUnknown(record.runtimeKind),
2258
+ skill_id: stringFromUnknown(record.skill_id),
2259
+ skill_runtime: sanitizeSkillRuntimePublicPayloadOrUndefined(record.skill_runtime),
2260
+ skillId: stringFromUnknown(record.skillId),
2261
+ skillRuntime: sanitizeSkillRuntimePublicPayloadOrUndefined(record.skillRuntime),
2262
+ slot: stringFromUnknown(record.slot),
2263
+ status: stringFromUnknown(record.status),
2264
+ summary: stringFromUnknown(record.summary),
2265
+ type: stringFromUnknown(record.type)
2266
+ });
2267
+ }
2268
+ function sanitizeSkillRuntimePublicPayloadOrUndefined(value) {
2269
+ const record = recordFromUnknown(value);
2270
+ if (!record) return void 0;
2271
+ const sanitized = sanitizeSkillRuntimePublicPayload(record);
2272
+ return Object.keys(sanitized).length === 0 ? void 0 : sanitized;
2273
+ }
2274
+ function sanitizeSkillArtifactRefs(value) {
2275
+ const sanitized = arrayFromUnknown(value).map((item) => sanitizeSkillArtifactRef(recordFromUnknown(item))).filter((item) => Boolean(item));
2276
+ return sanitized.length === 0 ? void 0 : sanitized;
2277
+ }
2278
+ function sanitizeSkillArtifactRef(record) {
2279
+ if (!record) return void 0;
2280
+ const sanitized = withoutUndefinedFields$1({
2281
+ artifact_kind: stringFromUnknown(record.artifact_kind),
2282
+ artifactKind: stringFromUnknown(record.artifactKind),
2283
+ logical_key: stringFromUnknown(record.logical_key),
2284
+ logicalKey: stringFromUnknown(record.logicalKey),
2285
+ title: stringFromUnknown(record.title)
2286
+ });
2287
+ return Object.keys(sanitized).length === 0 ? void 0 : sanitized;
2288
+ }
2289
+ function sanitizeSkillFactRefs(value) {
2290
+ const sanitized = arrayFromUnknown(value).map((item) => sanitizeSkillFactRef(recordFromUnknown(item))).filter((item) => Boolean(item));
2291
+ return sanitized.length === 0 ? void 0 : sanitized;
2292
+ }
2293
+ function sanitizeSkillFactRef(record) {
2294
+ if (!record) return void 0;
2295
+ const sanitized = withoutUndefinedFields$1({
2296
+ fact_id: stringFromUnknown(record.fact_id),
2297
+ factId: stringFromUnknown(record.factId),
2298
+ title: stringFromUnknown(record.title)
2299
+ });
2300
+ return Object.keys(sanitized).length === 0 ? void 0 : sanitized;
2301
+ }
2302
+ function sanitizeSkillMissingDependencies(value) {
2303
+ const sanitized = arrayFromUnknown(value).map((item) => sanitizeSkillMissingDependency(recordFromUnknown(item))).filter((item) => Boolean(item));
2304
+ return sanitized.length === 0 ? void 0 : sanitized;
2305
+ }
2306
+ function sanitizeSkillMissingDependency(record) {
2307
+ if (!record) return void 0;
2308
+ const sanitized = withoutUndefinedFields$1({
2309
+ candidate_count: numberFromUnknown(record.candidate_count),
2310
+ candidateCount: numberFromUnknown(record.candidateCount),
2311
+ kind: stringFromUnknown(record.kind),
2312
+ required: booleanFromUnknown(record.required),
2313
+ slot: stringFromUnknown(record.slot)
2314
+ });
2315
+ return Object.keys(sanitized).length === 0 ? void 0 : sanitized;
2316
+ }
2317
+ function sanitizeSkillDependencyCandidates(value) {
2318
+ const sanitized = arrayFromUnknown(value).map((item) => sanitizeSkillDependencyCandidate(recordFromUnknown(item))).filter((item) => Boolean(item));
2319
+ return sanitized.length === 0 ? void 0 : sanitized;
2320
+ }
2321
+ function sanitizeSkillDependencyCandidate(record) {
2322
+ if (!record) return void 0;
2323
+ const sanitized = withoutUndefinedFields$1({
2324
+ description: stringFromUnknown(record.description),
2325
+ label: stringFromUnknown(record.label),
2326
+ option_id: stringFromUnknown(record.option_id),
2327
+ optionId: stringFromUnknown(record.optionId),
2328
+ public_ref: stringFromUnknown(record.public_ref),
2329
+ publicRef: stringFromUnknown(record.publicRef)
2330
+ });
2331
+ return Object.keys(sanitized).length === 0 ? void 0 : sanitized;
2332
+ }
2333
+ function recordFromUnknown(value) {
2334
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
2335
+ }
2336
+ function arrayFromUnknown(value) {
2337
+ return Array.isArray(value) ? value : [];
2338
+ }
2339
+ function stringFromUnknown(value) {
2340
+ if (typeof value === "string") return value.trim() || void 0;
2341
+ if (typeof value === "number" && Number.isFinite(value)) return String(value);
2342
+ }
2343
+ function numberFromUnknown(value) {
2344
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
2345
+ }
2346
+ function booleanFromUnknown(value) {
2347
+ return typeof value === "boolean" ? value : void 0;
2348
+ }
2349
+ function requiredUserInputKind(value) {
2350
+ if (value === "choice" || value === "form" || value === "text") return value;
2351
+ throw new Error("kind is invalid.");
2352
+ }
2353
+ function requiredApprovalDecision(value, fieldName) {
2354
+ if (value === "approve" || value === "reject" || value === "cancel") return value;
2355
+ throw new Error(`${fieldName} is invalid.`);
2356
+ }
2357
+ function normalizeApprovalDecisionOptions(value, fieldName) {
2358
+ if (!Array.isArray(value) || value.length === 0) throw new TypeError(`${fieldName} must be a non-empty array.`);
2359
+ const seen = /* @__PURE__ */ new Set();
2360
+ return value.map((item, index) => {
2361
+ const option = asRecord$1(item, `${fieldName}[${index}]`);
2362
+ const decision = requiredApprovalDecision(option.decision, `${fieldName}[${index}].decision`);
2363
+ if (seen.has(decision)) throw new TypeError(`duplicate approval decision: ${decision}.`);
2364
+ seen.add(decision);
2365
+ const style = option.style;
2366
+ if (style !== void 0 && style !== "primary" && style !== "secondary" && style !== "danger") throw new TypeError(`${fieldName}[${index}].style is invalid.`);
2367
+ return {
2368
+ decision,
2369
+ label: requiredString$1(option.label, `${fieldName}[${index}].label`),
2370
+ ...style === void 0 ? {} : { style }
2371
+ };
2372
+ });
2373
+ }
2374
+ function normalizeRequestFields(value, fieldName) {
2375
+ if (value === void 0) return void 0;
2376
+ if (!Array.isArray(value)) throw new TypeError(`${fieldName} must be an array.`);
2377
+ return value.map((field, index) => normalizeRequestField(field, `${fieldName}[${index}]`));
2378
+ }
2379
+ function normalizeUserInputAnswers(value) {
2380
+ if (value === void 0) return void 0;
2381
+ const answers = asRecord$1(value, "answers");
2382
+ const normalized = {};
2383
+ for (const [fieldId, answerValue] of Object.entries(answers)) {
2384
+ if (!fieldId) throw new TypeError("answer field id must be a non-empty string.");
2385
+ if (!answerValue || typeof answerValue !== "object" || Array.isArray(answerValue)) throw new TypeError("answer value must be an object.");
2386
+ const answer = asRecord$1(answerValue, `answers.${fieldId}`);
2387
+ const type = answer.type;
2388
+ if (type !== "attachment_ids" && type !== "option_ids" && type !== "text") throw new TypeError("answer type must be attachment_ids, option_ids or text.");
2389
+ if (!Array.isArray(answer.answers)) throw new TypeError("answers must be an array.");
2390
+ normalized[fieldId] = {
2391
+ answers: answer.answers.map((item, index) => requiredString$1(item, `answers.${fieldId}.answers[${index}]`)),
2392
+ type
2393
+ };
2394
+ }
2395
+ return normalized;
2396
+ }
2397
+ function normalizeRequestField(value, fieldName) {
2398
+ const field = asRecord$1(value, fieldName);
2399
+ const type = requiredString$1(field.type, `${fieldName}.type`);
2400
+ const base = {
2401
+ id: requiredString$1(field.id, `${fieldName}.id`),
2402
+ label: requiredString$1(field.label, `${fieldName}.label`),
2403
+ required: optionalBoolean(field.required, `${fieldName}.required`)
2404
+ };
2405
+ if (type === "text" || type === "textarea") return {
2406
+ ...base,
2407
+ type
2408
+ };
2409
+ if (type === "single_select" || type === "multi_select") return {
2410
+ ...base,
2411
+ options: requiredRequestOptions(field.options, `${fieldName}.options`),
2412
+ type
2413
+ };
2414
+ throw new Error(`${fieldName}.type is invalid.`);
2415
+ }
2416
+ function requiredRequestOptions(value, fieldName) {
2417
+ if (!Array.isArray(value) || value.length === 0) throw new TypeError(`${fieldName} must be a non-empty array.`);
2418
+ return value.map((option, index) => normalizeRequestOption(option, `${fieldName}[${index}]`));
2419
+ }
2420
+ function normalizeRequestOption(value, fieldName) {
2421
+ const option = asRecord$1(value, fieldName);
2422
+ return {
2423
+ description: optionalString$1(option.description, `${fieldName}.description`),
2424
+ id: requiredString$1(option.id, `${fieldName}.id`),
2425
+ label: requiredString$1(option.label, `${fieldName}.label`)
2426
+ };
2427
+ }
2428
+ function assertUserInputRequestSurface(kind, fields) {
2429
+ assertUniqueFieldIds(fields);
2430
+ assertUniqueSelectableOptionIds(fields);
2431
+ if (kind === "choice") {
2432
+ if (!fields || fields.length !== 1 || fields[0]?.type !== "single_select") throw new TypeError("choice requests must contain exactly one single_select field.");
2433
+ return;
2434
+ }
2435
+ if (kind === "form") {
2436
+ if (!fields || fields.length === 0) throw new TypeError("form requests must contain at least one field.");
2437
+ return;
2438
+ }
2439
+ if (fields && fields.length > 1) throw new TypeError("text requests may contain at most one text field.");
2440
+ const [field] = fields ?? [];
2441
+ if (field && field.type !== "text" && field.type !== "textarea") throw new TypeError("text requests may not contain select fields.");
2442
+ }
2443
+ function assertUniqueFieldIds(fields) {
2444
+ const seen = /* @__PURE__ */ new Set();
2445
+ for (const field of fields ?? []) {
2446
+ if (seen.has(field.id)) throw new TypeError(`duplicate request field id: ${field.id}.`);
2447
+ seen.add(field.id);
2448
+ }
2449
+ }
2450
+ function assertUniqueSelectableOptionIds(fields) {
2451
+ for (const field of fields ?? []) {
2452
+ if (field.type !== "single_select" && field.type !== "multi_select") continue;
2453
+ const seen = /* @__PURE__ */ new Set();
2454
+ for (const option of field.options) {
2455
+ if (seen.has(option.id)) throw new TypeError(`duplicate request option id for field ${field.id}: ${option.id}.`);
2456
+ seen.add(option.id);
2457
+ }
2458
+ }
2459
+ }
2460
+ function asRecord$1(value, field) {
2461
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`${field} must be an object.`);
2462
+ return value;
2463
+ }
2464
+ function rejectFrameFields(frame, kind, fields) {
2465
+ for (const field of fields) if (field in frame) throw new Error(`${kind}.${field} is not supported.`);
2466
+ }
2467
+ function assertExactKeys(record, fieldName, allowedKeys) {
2468
+ const allowed = new Set(allowedKeys);
2469
+ for (const key of Object.keys(record)) if (!allowed.has(key)) throw new Error(`${fieldName}.${key} is not supported.`);
2470
+ for (const key of allowedKeys) {
2471
+ if (key === "explanation" || key === "movePath") continue;
2472
+ if (!(key in record)) throw new Error(`${fieldName}.${key} is required.`);
2473
+ }
2474
+ }
2475
+ function assertAllowedKeys(record, fieldName, allowedKeys) {
2476
+ const allowed = new Set(allowedKeys);
2477
+ for (const key of Object.keys(record)) if (!allowed.has(key)) throw new Error(`${fieldName}.${key} is not supported.`);
2478
+ }
2479
+ function isFdeEventAppendedNotificationMethod(method) {
2480
+ return FDE_EVENT_APPENDED_NOTIFICATION_METHODS.includes(method);
2481
+ }
2482
+ function isFdeDeltaNotificationMethod(method) {
2483
+ return FDE_DELTA_NOTIFICATION_METHODS.includes(method);
2484
+ }
2485
+ function isFdeProjectionBackedLiveNotificationMethod(method) {
2486
+ return FDE_PROJECTION_BACKED_LIVE_NOTIFICATION_METHODS.includes(method);
2487
+ }
2488
+ function normalizeFdeCoreTurnStartedNotification(notification) {
2489
+ const params = asRecord$1(notification.params, "notification.params");
2490
+ return {
2491
+ method: "fde-core/turn.started",
2492
+ params: withoutUndefinedFields$1({
2493
+ ...sanitizePublicPayload(omitKeys(params, [
2494
+ "baseTurnId",
2495
+ "offset",
2496
+ "responseToRequest",
2497
+ "startedAt",
2498
+ "startedAtMs",
2499
+ "threadId",
2500
+ "turnId"
2501
+ ])) ?? {},
2502
+ baseTurnId: optionalString$1(params.baseTurnId, "notification.params.baseTurnId"),
2503
+ offset: optionalNumber$1(params.offset, "notification.params.offset"),
2504
+ responseToRequest: normalizeFdeCoreResponseToRequestWireFromRecord(params, "notification.params"),
2505
+ startedAt: optionalString$1(params.startedAt, "notification.params.startedAt"),
2506
+ startedAtMs: optionalNumber$1(params.startedAtMs, "notification.params.startedAtMs"),
2507
+ threadId: requiredString$1(params.threadId, "notification.params.threadId"),
2508
+ turnId: requiredString$1(params.turnId, "notification.params.turnId")
2509
+ })
2510
+ };
2511
+ }
2512
+ function normalizeFdeCoreTurnTerminalNotification(notification, method) {
2513
+ const params = asRecord$1(notification.params, "notification.params");
2514
+ return {
2515
+ method,
2516
+ params: withoutUndefinedFields$1({
2517
+ ...sanitizePublicPayload(omitKeys(params, [
2518
+ "clientRequestId",
2519
+ "completedAt",
2520
+ "completedAtMs",
2521
+ "offset",
2522
+ "responseToRequest",
2523
+ "threadId",
2524
+ "turnId"
2525
+ ])) ?? {},
2526
+ clientRequestId: optionalString$1(params.clientRequestId, "notification.params.clientRequestId"),
2527
+ completedAt: optionalString$1(params.completedAt, "notification.params.completedAt"),
2528
+ completedAtMs: optionalNumber$1(params.completedAtMs, "notification.params.completedAtMs"),
2529
+ offset: optionalNumber$1(params.offset, "notification.params.offset"),
2530
+ responseToRequest: normalizeFdeCoreResponseToRequestWireFromRecord(params, "notification.params"),
2531
+ threadId: requiredString$1(params.threadId, "notification.params.threadId"),
2532
+ turnId: requiredString$1(params.turnId, "notification.params.turnId")
2533
+ })
2534
+ };
2535
+ }
2536
+ function withoutUndefinedFields$1(value) {
2537
+ return Object.fromEntries(Object.entries(value).filter(([, fieldValue]) => fieldValue !== void 0));
2538
+ }
2539
+ function stringRecordWithoutUndefinedFields(value) {
2540
+ return Object.fromEntries(Object.entries(value).filter((entry) => entry[1] !== void 0));
2541
+ }
2542
+ function omitKeys(value, keys) {
2543
+ const omitted = new Set(keys);
2544
+ return Object.fromEntries(Object.entries(value).filter(([key]) => !omitted.has(key)));
2545
+ }
2546
+ function requiredString$1(value, field) {
2547
+ if (typeof value !== "string" || value.length === 0) throw new Error(`${field} must be a non-empty string.`);
2548
+ return value;
2549
+ }
2550
+ function requiredPlainString(value, field) {
2551
+ if (typeof value !== "string") throw new TypeError(`${field} must be a string.`);
2552
+ return value;
2553
+ }
2554
+ function optionalString$1(value, field) {
2555
+ if (value === void 0) return void 0;
2556
+ if (typeof value !== "string") throw new TypeError(`${field} must be a string.`);
2557
+ return value;
2558
+ }
2559
+ function optionalNonEmptyString(value, field) {
2560
+ const result = optionalString$1(value, field);
2561
+ if (result !== void 0 && result.trim().length === 0) throw new Error(`${field} must be a non-empty string.`);
2562
+ return result;
2563
+ }
2564
+ function optionalNumber$1(value, field) {
2565
+ if (value === void 0) return void 0;
2566
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new TypeError(`${field} must be a finite number.`);
2567
+ return value;
2568
+ }
2569
+ function optionalNonNegativeSafeInteger(value, field) {
2570
+ if (value === void 0) return void 0;
2571
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw new TypeError(`${field} must be a non-negative safe integer.`);
2572
+ return value;
2573
+ }
2574
+ function optionalPositiveSafeInteger(value, field) {
2575
+ if (value === void 0) return void 0;
2576
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) throw new TypeError(`${field} must be a positive safe integer.`);
2577
+ return value;
2578
+ }
2579
+ function requiredPositiveSafeInteger(value, field) {
2580
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) throw new TypeError(`${field} must be a positive safe integer.`);
2581
+ return value;
2582
+ }
2583
+ function requiredNonNegativeSafeInteger(value, field) {
2584
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw new TypeError(`${field} must be a non-negative safe integer.`);
2585
+ return value;
2586
+ }
2587
+ function optionalNullableNumber(value, field) {
2588
+ if (value === void 0) return void 0;
2589
+ if (value === null) return null;
2590
+ return requiredNumber$1(value, field);
2591
+ }
2592
+ function optionalBoolean(value, field) {
2593
+ if (value === void 0) return void 0;
2594
+ if (typeof value !== "boolean") throw new TypeError(`${field} must be a boolean.`);
2595
+ return value;
2596
+ }
2597
+ function requiredBoolean(value, field) {
2598
+ if (typeof value !== "boolean") throw new TypeError(`${field} must be a boolean.`);
2599
+ return value;
2600
+ }
2601
+ function requiredNumber$1(value, field) {
2602
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new TypeError(`${field} must be a finite number.`);
2603
+ return value;
2604
+ }
2605
+ function requiredStringArray$1(value, field) {
2606
+ if (!Array.isArray(value)) throw new TypeError(`${field} must be an array.`);
2607
+ return value.map((item, index) => requiredString$1(item, `${field}[${index}]`));
2608
+ }
2609
+ function optionalRuntimeUri(value, field) {
2610
+ const uri = optionalString$1(value, field);
2611
+ if (uri === void 0) return void 0;
2612
+ if (uri.startsWith("/") || uri.startsWith("file://") || uri.startsWith("http://") || uri.startsWith("https://")) throw new Error(`${field} must be a public protocol uri.`);
2613
+ return uri;
2614
+ }
2615
+ function requiredAgentMessagePhase(value, field) {
2616
+ if (typeof value === "string" && FDE_AGENT_MESSAGE_PHASES.includes(value)) return value;
2617
+ throw new Error(`${field} is invalid.`);
2618
+ }
2619
+ function requiredExecutionStatus(value, field) {
2620
+ if (typeof value === "string" && FDE_EXECUTION_STATUSES.includes(value)) return value;
2621
+ throw new Error(`${field} is invalid.`);
2622
+ }
2623
+ function optionalToolKind(value, field) {
2624
+ if (value === void 0) return void 0;
2625
+ if (value === "mcp" || value === "dynamic" || value === "skill" || value === "unknown") return value;
2626
+ throw new Error(`${field} is invalid.`);
2627
+ }
2628
+ function requiredRequestDisplayState(value, field) {
2629
+ if (value === "pending" || value === "answered" || value === "cancelled") return value;
2630
+ throw new Error(`${field} is invalid.`);
2631
+ }
2632
+ function optionalRequestDisplayState(value, field) {
2633
+ if (value === void 0) return void 0;
2634
+ return requiredRequestDisplayState(value, field);
2635
+ }
2636
+ function optionalDiagnosticSeverity(value, field) {
2637
+ if (value === void 0) return void 0;
2638
+ if (value === "debug" || value === "error" || value === "info" || value === "warning") return value;
2639
+ throw new Error(`${field} is invalid.`);
2640
+ }
2641
+ function requiredPlanStepStatus(value, field) {
2642
+ if (value === "pending" || value === "inProgress" || value === "completed") return value;
2643
+ throw new Error(`${field} is invalid.`);
2644
+ }
2645
+ function requiredTypedTurnItemsView(value, field) {
2646
+ if (typeof value === "string" && FDE_TURN_ITEMS_VIEWS.includes(value)) return value;
2647
+ throw new Error(`${field} is invalid.`);
2648
+ }
2649
+ function requiredInputArray(value, field) {
2650
+ if (!Array.isArray(value)) throw new TypeError(`${field} must be an array.`);
2651
+ return value.map((item, index) => normalizeWireUserInput(item, `${field}[${index}]`));
2652
+ }
2653
+ function normalizeWireUserInput(value, field) {
2654
+ const item = asRecord$1(value, field);
2655
+ const type = requiredString$1(item.type, `${field}.type`);
2656
+ switch (type) {
2657
+ case "text": return {
2658
+ text: requiredString$1(item.text, `${field}.text`),
2659
+ type
2660
+ };
2661
+ case "attachment":
2662
+ case "screenshot": return withoutUndefinedFields$1({
2663
+ attachment_id: requiredString$1(item.attachment_id, `${field}.attachment_id`),
2664
+ mime_type: optionalString$1(item.mime_type, `${field}.mime_type`),
2665
+ name: optionalString$1(item.name, `${field}.name`),
2666
+ parse_status: optionalAttachmentParseStatus(item.parse_status, `${field}.parse_status`),
2667
+ parsed_content_item_id: optionalString$1(item.parsed_content_item_id, `${field}.parsed_content_item_id`),
2668
+ parsed_text_ref: optionalString$1(item.parsed_text_ref, `${field}.parsed_text_ref`),
2669
+ size_bytes: requiredNumber$1(item.size_bytes, `${field}.size_bytes`),
2670
+ type
2671
+ });
2672
+ case "resource_ref": return withoutUndefinedFields$1({
2673
+ data: optionalResourceRefData(item.data, `${field}.data`),
2674
+ resource_id: requiredString$1(item.resource_id, `${field}.resource_id`),
2675
+ resource_type: optionalString$1(item.resource_type, `${field}.resource_type`),
2676
+ title: optionalString$1(item.title, `${field}.title`),
2677
+ type
2678
+ });
2679
+ default: throw new Error(`${field}.type is invalid.`);
2680
+ }
2681
+ }
2682
+ function optionalAttachmentParseStatus(value, field) {
2683
+ if (value === void 0) return void 0;
2684
+ if (value === "failed" || value === "not_parsed" || value === "parsed") return value;
2685
+ throw new Error(`${field} is invalid.`);
2686
+ }
2687
+ function optionalResourceRefData(value, field) {
2688
+ if (value === void 0) return void 0;
2689
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError(`${field} must be an object.`);
2690
+ return sanitizePublicPayload(value);
2691
+ }
2692
+ function readThreadId(params) {
2693
+ if (!params || typeof params !== "object" || typeof params.threadId !== "string") throw new Error("threadId is required for serialized fde-core requests.");
2694
+ return params.threadId;
2695
+ }
2696
+ //#endregion
2697
+ //#region src/memory/wire.ts
2698
+ const FDE_MEMORY_ADMIN_RECORD_CATEGORIES = [
2699
+ "business_term",
2700
+ "design_decision",
2701
+ "constraint",
2702
+ "open_question",
2703
+ "workflow_pattern"
2704
+ ];
2705
+ const MEMORY_SCOPES = new Set([
2706
+ "platform",
2707
+ "tenant",
2708
+ "app",
2709
+ "resource",
2710
+ "user",
2711
+ "conversation"
2712
+ ]);
2713
+ const MEMORY_CATEGORIES = new Set([
2714
+ "profile",
2715
+ "preference",
2716
+ "business_term",
2717
+ "design_decision",
2718
+ "constraint",
2719
+ "open_question",
2720
+ "workflow_pattern"
2721
+ ]);
2722
+ const MEMORY_SENSITIVITIES = new Set([
2723
+ "public",
2724
+ "internal",
2725
+ "sensitive"
2726
+ ]);
2727
+ const MEMORY_TRUST_LEVELS = new Set([
2728
+ "admin_confirmed",
2729
+ "owner_confirmed",
2730
+ "user_confirmed",
2731
+ "imported"
2732
+ ]);
2733
+ const RECORD_STATUSES = new Set([
2734
+ "active",
2735
+ "archived",
2736
+ "deleted"
2737
+ ]);
2738
+ const RECORD_VISIBILITIES = new Set([
2739
+ "model_readable",
2740
+ "ui_only",
2741
+ "disabled"
2742
+ ]);
2743
+ const CANDIDATE_STATUSES = new Set([
2744
+ "pending_review",
2745
+ "accepted",
2746
+ "edited_accepted",
2747
+ "ignored",
2748
+ "rejected_scope",
2749
+ "expired"
2750
+ ]);
2751
+ const REVIEW_POLICIES = new Set([
2752
+ "auto_low_risk",
2753
+ "manual_user",
2754
+ "manual_owner",
2755
+ "manual_admin",
2756
+ "scope_denied"
2757
+ ]);
2758
+ const RISK_LEVELS = new Set([
2759
+ "low",
2760
+ "medium",
2761
+ "high"
2762
+ ]);
2763
+ const ADMIN_RECORD_CATEGORIES = new Set(FDE_MEMORY_ADMIN_RECORD_CATEGORIES);
2764
+ const LEGACY_SCOPE_FIELD = ["scope", "key"].join("_");
2765
+ const LEGACY_PROPOSED_SCOPE_FIELD = [
2766
+ "proposed",
2767
+ "scope",
2768
+ "key"
2769
+ ].join("_");
2770
+ const CLIENT_TRUSTED_SAVE_INTENT_FIELDS = [
2771
+ "actor_user_id",
2772
+ "tenant_id",
2773
+ LEGACY_PROPOSED_SCOPE_FIELD,
2774
+ "capture_trigger",
2775
+ "capture_reason",
2776
+ "source_ref",
2777
+ "idempotency_key"
2778
+ ];
2779
+ const CLIENT_TRUSTED_ADMIN_CREATE_FIELDS = [
2780
+ "scope",
2781
+ "scope_ref",
2782
+ "scope_context",
2783
+ LEGACY_SCOPE_FIELD,
2784
+ "tenant_id",
2785
+ "actor_user_id",
2786
+ "trust_level",
2787
+ "origin",
2788
+ "activation",
2789
+ "capture_trigger",
2790
+ "source_ref",
2791
+ "conflict_key",
2792
+ "memory_id",
2793
+ "record_id",
2794
+ "status",
2795
+ "visibility",
2796
+ "confidence",
2797
+ "usage_count",
2798
+ "version",
2799
+ "created_at",
2800
+ "updated_at",
2801
+ "last_used_at"
2802
+ ];
2803
+ function normalizeFdeMemorySaveIntentRequest(input) {
2804
+ const value = asRecord(input, "save_intent");
2805
+ rejectFields(value, "save_intent", CLIENT_TRUSTED_SAVE_INTENT_FIELDS);
2806
+ rejectUnknownFields(value, "save_intent", [
2807
+ "proposed_scope",
2808
+ "scope_ref",
2809
+ "scope_context",
2810
+ "category",
2811
+ "title",
2812
+ "summary",
2813
+ "tags",
2814
+ "sensitivity",
2815
+ "client_source"
2816
+ ]);
2817
+ return withoutUndefinedFields({
2818
+ proposed_scope: requiredEnum(value.proposed_scope, "proposed_scope", MEMORY_SCOPES),
2819
+ scope_ref: normalizeScopeRef(value.scope_ref, "scope_ref"),
2820
+ scope_context: normalizeScopeContext(value.scope_context, "scope_context"),
2821
+ category: requiredEnum(value.category, "category", MEMORY_CATEGORIES),
2822
+ title: requiredString(value.title, "title"),
2823
+ summary: requiredString(value.summary, "summary"),
2824
+ tags: value.tags === void 0 ? void 0 : requiredStringArray(value.tags, "tags"),
2825
+ sensitivity: value.sensitivity === void 0 ? void 0 : requiredEnum(value.sensitivity, "sensitivity", MEMORY_SENSITIVITIES),
2826
+ client_source: value.client_source === void 0 ? void 0 : normalizeClientSource(value.client_source)
2827
+ });
2828
+ }
2829
+ function normalizeFdeMemoryCandidateDecisionRequest(input) {
2830
+ const value = asRecord(input, "decision");
2831
+ const action = requiredString(value.action, "action");
2832
+ const base = {
2833
+ expected_status: requiredEnum(value.expected_status, "expected_status", CANDIDATE_STATUSES),
2834
+ expected_updated_at: requiredString(value.expected_updated_at, "expected_updated_at"),
2835
+ reason: optionalString(value.reason, "reason")
2836
+ };
2837
+ if (action === "accept") {
2838
+ assertStatus(base.expected_status, ["pending_review"], "expected_status");
2839
+ return withoutUndefinedFields({
2840
+ action,
2841
+ ...base
2842
+ });
2843
+ }
2844
+ if (action === "edit_and_accept") {
2845
+ assertStatus(base.expected_status, ["pending_review"], "expected_status");
2846
+ return withoutUndefinedFields({
2847
+ action,
2848
+ ...base,
2849
+ patch: normalizeDecisionPatch(value.patch)
2850
+ });
2851
+ }
2852
+ if (action === "ignore") {
2853
+ assertStatus(base.expected_status, ["pending_review", "rejected_scope"], "expected_status");
2854
+ return withoutUndefinedFields({
2855
+ action,
2856
+ ...base
2857
+ });
2858
+ }
2859
+ if (action === "change_scope") {
2860
+ assertStatus(base.expected_status, ["pending_review", "rejected_scope"], "expected_status");
2861
+ return withoutUndefinedFields({
2862
+ action,
2863
+ ...base,
2864
+ target_scope: requiredEnum(value.target_scope, "target_scope", MEMORY_SCOPES),
2865
+ target_scope_ref: normalizeScopeRef(value.target_scope_ref, "target_scope_ref"),
2866
+ target_scope_context: normalizeScopeContext(value.target_scope_context, "target_scope_context")
2867
+ });
2868
+ }
2869
+ if (action === "select_fallback_scope") {
2870
+ assertStatus(base.expected_status, ["rejected_scope"], "expected_status");
2871
+ return withoutUndefinedFields({
2872
+ action,
2873
+ ...base,
2874
+ fallback_scope: requiredEnum(value.fallback_scope, "fallback_scope", MEMORY_SCOPES),
2875
+ fallback_scope_ref: normalizeScopeRef(value.fallback_scope_ref, "fallback_scope_ref"),
2876
+ fallback_scope_context: normalizeScopeContext(value.fallback_scope_context, "fallback_scope_context")
2877
+ });
2878
+ }
2879
+ throw new Error("action is invalid.");
2880
+ }
2881
+ function normalizeFdeMemoryRecordPatchRequest(input) {
2882
+ const value = asRecord(input, "record_patch");
2883
+ rejectFields(value, "record_patch", [
2884
+ "scope",
2885
+ LEGACY_SCOPE_FIELD,
2886
+ "proposed_scope",
2887
+ LEGACY_PROPOSED_SCOPE_FIELD,
2888
+ "status",
2889
+ "visibility"
2890
+ ]);
2891
+ rejectUnknownFields(value, "record_patch", [
2892
+ "expected_version",
2893
+ "title",
2894
+ "summary",
2895
+ "tags",
2896
+ "sensitivity",
2897
+ "valid_from",
2898
+ "valid_until",
2899
+ "conflict_key",
2900
+ "reason"
2901
+ ]);
2902
+ return withoutUndefinedFields({
2903
+ expected_version: requiredNumber(value.expected_version, "expected_version"),
2904
+ title: optionalString(value.title, "title"),
2905
+ summary: optionalString(value.summary, "summary"),
2906
+ tags: value.tags === void 0 ? void 0 : requiredStringArray(value.tags, "tags"),
2907
+ sensitivity: value.sensitivity === void 0 ? void 0 : requiredEnum(value.sensitivity, "sensitivity", MEMORY_SENSITIVITIES),
2908
+ valid_from: optionalString(value.valid_from, "valid_from"),
2909
+ valid_until: optionalString(value.valid_until, "valid_until"),
2910
+ conflict_key: optionalString(value.conflict_key, "conflict_key"),
2911
+ reason: optionalString(value.reason, "reason")
2912
+ });
2913
+ }
2914
+ function normalizeFdeMemoryRecordLifecycleRequest(input) {
2915
+ const value = asRecord(input, "record_lifecycle");
2916
+ rejectUnknownFields(value, "record_lifecycle", ["expected_version", "reason"]);
2917
+ return withoutUndefinedFields({
2918
+ expected_version: requiredNumber(value.expected_version, "expected_version"),
2919
+ reason: optionalString(value.reason, "reason")
2920
+ });
2921
+ }
2922
+ function normalizeFdeMemoryAdminRecordListQuery(input) {
2923
+ const value = asRecord(input, "admin_record_query");
2924
+ rejectUnknownFields(value, "admin_record_query", [
2925
+ "category",
2926
+ "status",
2927
+ "visibility",
2928
+ "q",
2929
+ "cursor",
2930
+ "limit"
2931
+ ]);
2932
+ return withoutUndefinedFields({
2933
+ category: optionalEnum(value.category, "category", ADMIN_RECORD_CATEGORIES),
2934
+ status: optionalEnum(value.status, "status", RECORD_STATUSES),
2935
+ visibility: optionalEnum(value.visibility, "visibility", RECORD_VISIBILITIES),
2936
+ q: optionalString(value.q, "q"),
2937
+ cursor: optionalString(value.cursor, "cursor"),
2938
+ limit: optionalBoundedLimit(value.limit, "limit", 1, 100)
2939
+ });
2940
+ }
2941
+ function normalizeFdeMemoryAdminCreateRecordRequest(input) {
2942
+ const value = asRecord(input, "admin_create_record");
2943
+ rejectFields(value, "admin_create_record", CLIENT_TRUSTED_ADMIN_CREATE_FIELDS);
2944
+ rejectUnknownFields(value, "admin_create_record", [
2945
+ "category",
2946
+ "title",
2947
+ "summary",
2948
+ "tags",
2949
+ "sensitivity",
2950
+ "valid_from",
2951
+ "valid_until",
2952
+ "reason",
2953
+ "client_request_id"
2954
+ ]);
2955
+ return withoutUndefinedFields({
2956
+ category: requiredEnum(value.category, "category", ADMIN_RECORD_CATEGORIES),
2957
+ title: requiredString(value.title, "title"),
2958
+ summary: requiredString(value.summary, "summary"),
2959
+ tags: value.tags === void 0 ? void 0 : requiredStringArray(value.tags, "tags"),
2960
+ sensitivity: value.sensitivity === void 0 ? void 0 : requiredEnum(value.sensitivity, "sensitivity", MEMORY_SENSITIVITIES),
2961
+ valid_from: optionalString(value.valid_from, "valid_from"),
2962
+ valid_until: optionalString(value.valid_until, "valid_until"),
2963
+ reason: optionalString(value.reason, "reason"),
2964
+ client_request_id: optionalString(value.client_request_id, "client_request_id")
2965
+ });
2966
+ }
2967
+ function normalizeFdeMemoryAdminRecordLifecycleRequest(input) {
2968
+ return normalizeFdeMemoryRecordLifecycleRequest(input);
2969
+ }
2970
+ function normalizeFdeMemoryRecordListQuery(input) {
2971
+ const value = asRecord(input, "record_query");
2972
+ rejectUnknownFields(value, "record_query", [
2973
+ "scope",
2974
+ "category",
2975
+ "trust_level",
2976
+ "status",
2977
+ "visibility",
2978
+ "source_conversation_id",
2979
+ "q",
2980
+ "cursor",
2981
+ "limit"
2982
+ ]);
2983
+ return withoutUndefinedFields({
2984
+ scope: optionalEnum(value.scope, "scope", MEMORY_SCOPES),
2985
+ category: optionalEnum(value.category, "category", MEMORY_CATEGORIES),
2986
+ trust_level: optionalEnum(value.trust_level, "trust_level", MEMORY_TRUST_LEVELS),
2987
+ status: optionalEnum(value.status, "status", RECORD_STATUSES),
2988
+ visibility: optionalEnum(value.visibility, "visibility", RECORD_VISIBILITIES),
2989
+ source_conversation_id: optionalString(value.source_conversation_id, "source_conversation_id"),
2990
+ q: optionalString(value.q, "q"),
2991
+ cursor: optionalString(value.cursor, "cursor"),
2992
+ limit: optionalNumber(value.limit, "limit")
2993
+ });
2994
+ }
2995
+ function normalizeFdeMemoryCandidateListQuery(input) {
2996
+ const value = asRecord(input, "candidate_query");
2997
+ rejectUnknownFields(value, "candidate_query", [
2998
+ "scope",
2999
+ "category",
3000
+ "status",
3001
+ "review_policy",
3002
+ "risk_level",
3003
+ "source_conversation_id",
3004
+ "q",
3005
+ "cursor",
3006
+ "limit"
3007
+ ]);
3008
+ return withoutUndefinedFields({
3009
+ scope: optionalEnum(value.scope, "scope", MEMORY_SCOPES),
3010
+ category: optionalEnum(value.category, "category", MEMORY_CATEGORIES),
3011
+ status: optionalEnum(value.status, "status", CANDIDATE_STATUSES),
3012
+ review_policy: optionalEnum(value.review_policy, "review_policy", REVIEW_POLICIES),
3013
+ risk_level: optionalEnum(value.risk_level, "risk_level", RISK_LEVELS),
3014
+ source_conversation_id: optionalString(value.source_conversation_id, "source_conversation_id"),
3015
+ q: optionalString(value.q, "q"),
3016
+ cursor: optionalString(value.cursor, "cursor"),
3017
+ limit: optionalNumber(value.limit, "limit")
3018
+ });
3019
+ }
3020
+ function normalizeFdeMemoryScopesQuery(input) {
3021
+ const value = asRecord(input, "scopes_query");
3022
+ rejectUnknownFields(value, "scopes_query", [
3023
+ "app_id",
3024
+ "conversation_id",
3025
+ "resource_type",
3026
+ "resource_id"
3027
+ ]);
3028
+ return normalizeScopeContext(value, "scopes_query");
3029
+ }
3030
+ function normalizeScopeRef(value, fieldName) {
3031
+ const ref = asRecord(value, fieldName);
3032
+ const token = requiredString(ref.ref, `${fieldName}.ref`);
3033
+ if (/^(platform|tenant|app|resource|user|conversation):/.test(token)) throw new Error(`${fieldName}.ref must be an opaque signed token.`);
3034
+ const refType = requiredString(ref.ref_type, `${fieldName}.ref_type`);
3035
+ if (refType !== "signed_scope_token") throw new Error(`${fieldName}.ref_type is invalid.`);
3036
+ return {
3037
+ scope: requiredEnum(ref.scope, `${fieldName}.scope`, MEMORY_SCOPES),
3038
+ ref_type: refType,
3039
+ ref: token
3040
+ };
3041
+ }
3042
+ function normalizeScopeContext(value, fieldName) {
3043
+ const context = asRecord(value, fieldName);
3044
+ rejectUnknownFields(context, fieldName, [
3045
+ "app_id",
3046
+ "conversation_id",
3047
+ "resource_type",
3048
+ "resource_id"
3049
+ ]);
3050
+ return withoutUndefinedFields({
3051
+ app_id: optionalString(context.app_id, `${fieldName}.app_id`),
3052
+ conversation_id: optionalString(context.conversation_id, `${fieldName}.conversation_id`),
3053
+ resource_type: optionalString(context.resource_type, `${fieldName}.resource_type`),
3054
+ resource_id: optionalString(context.resource_id, `${fieldName}.resource_id`)
3055
+ });
3056
+ }
3057
+ function normalizeClientSource(value) {
3058
+ const source = asRecord(value, "client_source");
3059
+ rejectUnknownFields(source, "client_source", [
3060
+ "conversation_id",
3061
+ "turn_id",
3062
+ "message_ids",
3063
+ "artifact_id",
3064
+ "fact_id",
3065
+ "selected_text_hash"
3066
+ ]);
3067
+ return withoutUndefinedFields({
3068
+ conversation_id: optionalString(source.conversation_id, "client_source.conversation_id"),
3069
+ turn_id: optionalString(source.turn_id, "client_source.turn_id"),
3070
+ message_ids: source.message_ids === void 0 ? void 0 : requiredStringArray(source.message_ids, "client_source.message_ids"),
3071
+ artifact_id: optionalString(source.artifact_id, "client_source.artifact_id"),
3072
+ fact_id: optionalString(source.fact_id, "client_source.fact_id"),
3073
+ selected_text_hash: optionalString(source.selected_text_hash, "client_source.selected_text_hash")
3074
+ });
3075
+ }
3076
+ function normalizeDecisionPatch(value) {
3077
+ const patch = asRecord(value, "patch");
3078
+ rejectUnknownFields(patch, "patch", [
3079
+ "title",
3080
+ "summary",
3081
+ "tags",
3082
+ "category",
3083
+ "conflict_key"
3084
+ ]);
3085
+ return withoutUndefinedFields({
3086
+ title: optionalString(patch.title, "patch.title"),
3087
+ summary: optionalString(patch.summary, "patch.summary"),
3088
+ tags: patch.tags === void 0 ? void 0 : requiredStringArray(patch.tags, "patch.tags"),
3089
+ category: patch.category === void 0 ? void 0 : requiredEnum(patch.category, "patch.category", MEMORY_CATEGORIES),
3090
+ conflict_key: optionalString(patch.conflict_key, "patch.conflict_key")
3091
+ });
3092
+ }
3093
+ function asRecord(value, fieldName) {
3094
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError(`${fieldName} must be an object.`);
3095
+ return value;
3096
+ }
3097
+ function requiredString(value, fieldName) {
3098
+ if (typeof value !== "string" || value.length === 0) throw new TypeError(`${fieldName} must be a non-empty string.`);
3099
+ return value;
3100
+ }
3101
+ function optionalString(value, fieldName) {
3102
+ if (value === void 0) return void 0;
3103
+ return requiredString(value, fieldName);
3104
+ }
3105
+ function requiredNumber(value, fieldName) {
3106
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new TypeError(`${fieldName} must be a finite number.`);
3107
+ return value;
3108
+ }
3109
+ function optionalNumber(value, fieldName) {
3110
+ if (value === void 0) return void 0;
3111
+ return requiredNumber(value, fieldName);
3112
+ }
3113
+ function optionalBoundedLimit(value, fieldName, min, max) {
3114
+ const numberValue = optionalNumber(value, fieldName);
3115
+ if (numberValue === void 0) return void 0;
3116
+ return Math.max(min, Math.min(max, Math.trunc(numberValue)));
3117
+ }
3118
+ function requiredStringArray(value, fieldName) {
3119
+ if (!Array.isArray(value)) throw new TypeError(`${fieldName} must be an array.`);
3120
+ return value.map((item, index) => requiredString(item, `${fieldName}[${index}]`));
3121
+ }
3122
+ function requiredEnum(value, fieldName, allowed) {
3123
+ if (typeof value !== "string" || value.includes(",") || !allowed.has(value)) throw new Error(`${fieldName} is invalid.`);
3124
+ return value;
3125
+ }
3126
+ function optionalEnum(value, fieldName, allowed) {
3127
+ if (value === void 0) return void 0;
3128
+ return requiredEnum(value, fieldName, allowed);
3129
+ }
3130
+ function assertStatus(value, allowed, fieldName) {
3131
+ if (!allowed.includes(value)) throw new Error(`${fieldName} is invalid for action.`);
3132
+ }
3133
+ function rejectFields(record, fieldName, fields) {
3134
+ for (const field of fields) if (field in record) throw new Error(`${fieldName}.${field} is not supported.`);
3135
+ }
3136
+ function rejectUnknownFields(record, fieldName, allowed) {
3137
+ const allowedSet = new Set(allowed);
3138
+ for (const key of Object.keys(record)) if (!allowedSet.has(key)) throw new Error(`${fieldName}.${key} is not supported.`);
3139
+ }
3140
+ function withoutUndefinedFields(value) {
3141
+ for (const key of Object.keys(value)) if (value[key] === void 0) delete value[key];
3142
+ return value;
3143
+ }
3144
+ //#endregion
3145
+ //#region src/memory/index.ts
3146
+ const FDE_MEMORY_RECORD_CATEGORIES = [
3147
+ "profile",
3148
+ "preference",
3149
+ "business_term",
3150
+ "design_decision",
3151
+ "constraint",
3152
+ "open_question",
3153
+ "workflow_pattern"
3154
+ ];
3155
+ const FDE_MEMORY_SCOPES = [
3156
+ "platform",
3157
+ "tenant",
3158
+ "app",
3159
+ "resource",
3160
+ "user",
3161
+ "conversation"
3162
+ ];
3163
+ const FDE_MEMORY_TRUST_LEVELS = [
3164
+ "admin_confirmed",
3165
+ "owner_confirmed",
3166
+ "user_confirmed",
3167
+ "imported"
3168
+ ];
3169
+ //#endregion
3170
+ //#region src/canonical-fixtures.ts
3171
+ const threadId = "thread-canonical-1";
3172
+ const turnId = "turn-canonical-1";
3173
+ const requestId = "request-canonical-1";
3174
+ const requestRevision = 2;
3175
+ const stateRevision = 7;
3176
+ const eventOffset = 11;
3177
+ const now = "2026-06-21T00:00:00.000Z";
3178
+ const turnStartRequest = normalizeFdeCoreClientRequest({
3179
+ id: "rpc-canonical-turn-start-1",
3180
+ method: "turn/start",
3181
+ params: {
3182
+ capabilityId: "system_analysis",
3183
+ clientRequestId: "client-request-canonical-1",
3184
+ clientUserMessageId: "user-message-canonical-1",
3185
+ input: [{
3186
+ text: "请梳理订单履约流程,并标记需要确认的业务术语。",
3187
+ type: "text"
3188
+ }],
3189
+ threadId
3190
+ }
3191
+ });
3192
+ const serverRequest = createFdeCoreUserInputServerRequest({
3193
+ actionId: "required-action-canonical-1",
3194
+ domain: "system_analysis",
3195
+ fields: [{
3196
+ id: "term_scope",
3197
+ label: "术语作用域",
3198
+ options: [{
3199
+ id: "tenant",
3200
+ label: "租户级"
3201
+ }, {
3202
+ id: "app",
3203
+ label: "应用级"
3204
+ }],
3205
+ required: true,
3206
+ type: "single_select"
3207
+ }, {
3208
+ id: "term_note",
3209
+ label: "补充说明",
3210
+ required: false,
3211
+ type: "textarea"
3212
+ }],
3213
+ itemId: "item-confirmation-canonical-1",
3214
+ kind: "form",
3215
+ prompt: "请选择“履约状态”的业务术语作用域。",
3216
+ publicPayload: {
3217
+ candidate_term: "履约状态",
3218
+ source: "canonical_fixture"
3219
+ },
3220
+ requestId,
3221
+ requestRevision,
3222
+ requestType: "system_analysis.term_scope.confirm",
3223
+ stateRevision,
3224
+ threadId,
3225
+ turnId
3226
+ });
3227
+ const serverResponse = normalizeFdeCoreServerResponse({
3228
+ id: fdeCoreServerRequestIdentityKey(serverRequest.params),
3229
+ method: "fde/serverRequest/userInput",
3230
+ params: {
3231
+ expectedRequestRevision: requestRevision,
3232
+ expectedStateRevision: stateRevision,
3233
+ requestId,
3234
+ threadId,
3235
+ turnId
3236
+ },
3237
+ response: {
3238
+ answers: {
3239
+ term_note: {
3240
+ answers: ["履约状态只在当前应用内生效。"],
3241
+ type: "text"
3242
+ },
3243
+ term_scope: {
3244
+ answers: ["app"],
3245
+ type: "option_ids"
3246
+ }
3247
+ },
3248
+ decision: "answer"
3249
+ }
3250
+ });
3251
+ const eventAppendedFrame = normalizeFdeCoreSubscriptionFrame({
3252
+ kind: "event_appended",
3253
+ notifications: [{
3254
+ method: "item/started",
3255
+ params: {
3256
+ item: {
3257
+ content: turnStartRequest.params.input,
3258
+ createdAtMs: 1782e9,
3259
+ id: "item-user-canonical-1",
3260
+ sourceSeq: 1,
3261
+ text: "请梳理订单履约流程,并标记需要确认的业务术语。",
3262
+ type: "userMessage"
3263
+ },
3264
+ startedAtMs: 1782e9,
3265
+ threadId,
3266
+ turnId
3267
+ }
3268
+ }],
3269
+ offset: eventOffset,
3270
+ serverRequests: [serverRequest],
3271
+ threadId
3272
+ });
3273
+ const projectionSnapshotFrame = normalizeFdeCoreSubscriptionFrame({
3274
+ kind: "projection_snapshot",
3275
+ offset: eventOffset,
3276
+ projection: {
3277
+ activeRequiredAction: { ...serverRequest.params },
3278
+ artifactPanel: { items: [] },
3279
+ metadata: { lastEventCursor: eventOffset },
3280
+ threadId,
3281
+ turns: [{
3282
+ artifacts: [],
3283
+ clientRequestId: turnStartRequest.params.clientRequestId,
3284
+ facts: [],
3285
+ items: [{
3286
+ content: turnStartRequest.params.input,
3287
+ createdAtMs: 1782e9,
3288
+ id: "item-user-canonical-1",
3289
+ sourceSeq: 1,
3290
+ text: "请梳理订单履约流程,并标记需要确认的业务术语。",
3291
+ type: "userMessage"
3292
+ }, {
3293
+ displaySnapshot: {
3294
+ prompt: serverRequest.params.prompt,
3295
+ publicPayload: serverRequest.params.publicPayload,
3296
+ title: "业务术语确认"
3297
+ },
3298
+ id: "item-confirmation-canonical-1",
3299
+ requestIdentity: {
3300
+ ownerTurnId: turnId,
3301
+ requestId,
3302
+ requestRevision,
3303
+ stateRevision,
3304
+ threadId
3305
+ },
3306
+ requestType: serverRequest.params.requestType,
3307
+ sourceSeq: 2,
3308
+ state: "pending",
3309
+ type: "clarification"
3310
+ }],
3311
+ itemsView: "full",
3312
+ memoryContext: {
3313
+ budget: {
3314
+ estimated_tokens: 32,
3315
+ max_tokens: 512
3316
+ },
3317
+ fallback_level: "memory_summary_recent",
3318
+ selected_count: 1,
3319
+ selected_refs: [{
3320
+ category: "business_term",
3321
+ memory_id: "memory-canonical-1",
3322
+ rank: 1,
3323
+ reason: "retrieved",
3324
+ scope: "app",
3325
+ summary: "履约状态用于表达订单从待发货到已完成的业务阶段。",
3326
+ title: "履约状态术语",
3327
+ token_estimate: 32,
3328
+ trust_level: "owner_confirmed",
3329
+ type: "memory_record"
3330
+ }],
3331
+ snapshot_detail_status: "available",
3332
+ snapshot_id: "memory-snapshot-canonical-1",
3333
+ summary_available: true,
3334
+ suppressed_count: 0,
3335
+ suppressed_reason_counts: {}
3336
+ },
3337
+ metadata: { lastEventCursor: eventOffset },
3338
+ projectionHighWater: eventOffset,
3339
+ startedAt: now,
3340
+ status: "awaiting_input",
3341
+ threadId,
3342
+ turnId
3343
+ }]
3344
+ },
3345
+ resumeHighWater: eventOffset,
3346
+ threadId
3347
+ });
3348
+ const memorySaveIntent = normalizeFdeMemorySaveIntentRequest({
3349
+ category: "business_term",
3350
+ client_source: {
3351
+ conversation_id: threadId,
3352
+ turn_id: turnId
3353
+ },
3354
+ proposed_scope: "app",
3355
+ scope_context: {
3356
+ app_id: "app-canonical-1",
3357
+ conversation_id: threadId,
3358
+ resource_id: "order",
3359
+ resource_type: "domain_model"
3360
+ },
3361
+ scope_ref: {
3362
+ ref: "signed-scope-token-canonical-1",
3363
+ ref_type: "signed_scope_token",
3364
+ scope: "app"
3365
+ },
3366
+ sensitivity: "internal",
3367
+ summary: "履约状态用于表达订单从待发货到已完成的业务阶段。",
3368
+ tags: ["order", "fulfillment"],
3369
+ title: "履约状态术语"
3370
+ });
3371
+ const AGENTIC_CANONICAL_PROTOCOL_FIXTURES = Object.freeze({
3372
+ eventAppendedFrame,
3373
+ memorySaveIntent,
3374
+ projectionSnapshotFrame,
3375
+ serverRequest,
3376
+ serverResponse,
3377
+ turnStartRequest
3378
+ });
3379
+ //#endregion
3380
+ export { AGENTIC_CANONICAL_PROTOCOL_FIXTURES, BUILD_FORMAL_SAVE_APPROVE_REQUEST_TYPE, BUILD_RETIRED_NON_SAVE_PUBLIC_PAYLOAD_TYPES, BUILD_RETIRED_NON_SAVE_REQUEST_TYPES, BUILD_RETIRED_NON_SAVE_SURFACE_KINDS, BUILD_RETIRED_NON_SAVE_SURFACE_KIND_TO_PUBLIC_PAYLOAD_TYPE, BUILD_RETIRED_SAVE_APPROVAL_REQUEST_TYPES, FDE_ADAPTER_LIVE_NOTIFICATION_METHODS, FDE_AGENT_MESSAGE_PHASES, FDE_DELTA_NOTIFICATION_METHODS, FDE_EVENT_APPENDED_NOTIFICATION_METHODS, FDE_EXECUTION_STATUSES, FDE_MEMORY_ADMIN_RECORD_CATEGORIES, FDE_MEMORY_RECORD_CATEGORIES, FDE_MEMORY_SCOPES, FDE_MEMORY_TRUST_LEVELS, FDE_PROJECTION_BACKED_LIVE_NOTIFICATION_METHODS, FDE_PROTOCOL_BUILD, FDE_PUBLIC_ITEM_LIFECYCLES, FDE_PUBLIC_PAYLOAD_MAX_ARRAY_ITEMS, FDE_PUBLIC_PAYLOAD_MAX_DEPTH, FDE_PUBLIC_PAYLOAD_MAX_OBJECT_KEYS, FDE_PUBLIC_PAYLOAD_MAX_STRING_LENGTH, FDE_SUBSCRIPTION_NOTIFICATION_METHODS, FDE_TURN_ITEMS_VIEWS, FDE_TURN_STATUSES, FDE_TYPED_TURN_V2_PROTOCOL_VERSION, SYSTEM_ANALYSIS_FORMAL_SAVE_APPROVE_REQUEST_TYPE, createFdeCoreApprovalServerRequest, createFdeCoreLiveNotification, createFdeCoreServerRequestResolvedNotification, createFdeCoreUserInputServerRequest, fdeCoreServerRequestIdentityFromResponseToRequest, fdeCoreServerRequestIdentityKey, getFdeCoreRequestSerialization, isFdeCoreServerRequestIdentityWire, isFdeCoreServerRequestResolvedNotification, normalizeFdeCoreClientRequest, normalizeFdeCoreLiveDeltaNotification, normalizeFdeCoreLiveNotification, normalizeFdeCoreResponseToRequestWire, normalizeFdeCoreResponseToRequestWireFromRecord, normalizeFdeCoreServerRequest, normalizeFdeCoreServerRequestIdentity, normalizeFdeCoreServerResponse, normalizeFdeCoreSubscriptionFrame, normalizeFdeCoreThreadResumeResult, normalizeFdeLiveNotification, normalizeFdeMemoryAdminCreateRecordRequest, normalizeFdeMemoryAdminRecordLifecycleRequest, normalizeFdeMemoryAdminRecordListQuery, normalizeFdeMemoryCandidateDecisionRequest, normalizeFdeMemoryCandidateListQuery, normalizeFdeMemoryRecordLifecycleRequest, normalizeFdeMemoryRecordListQuery, normalizeFdeMemoryRecordPatchRequest, normalizeFdeMemorySaveIntentRequest, normalizeFdeMemoryScopesQuery, toFdeCoreErrorResponse, toFdeCoreSuccessResponse, toFdeCoreThreadResumeSuccessResponse };