@agent-native/core 0.84.35 → 0.84.37

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 (205) hide show
  1. package/README.md +15 -51
  2. package/corpus/core/CHANGELOG.md +18 -0
  3. package/corpus/core/docs/content/actions.mdx +17 -24
  4. package/corpus/core/docs/content/agent-surfaces.mdx +59 -56
  5. package/corpus/core/docs/content/cloneable-saas.mdx +3 -3
  6. package/corpus/core/docs/content/faq.mdx +4 -4
  7. package/corpus/core/docs/content/getting-started.mdx +246 -204
  8. package/corpus/core/docs/content/key-concepts.mdx +9 -9
  9. package/corpus/core/docs/content/locales/ar-SA/cloneable-saas.mdx +3 -3
  10. package/corpus/core/docs/content/locales/ar-SA/faq.mdx +4 -4
  11. package/corpus/core/docs/content/locales/ar-SA/getting-started.mdx +148 -214
  12. package/corpus/core/docs/content/locales/ar-SA/pure-agent-apps.mdx +4 -9
  13. package/corpus/core/docs/content/locales/ar-SA/template-chat.mdx +2 -2
  14. package/corpus/core/docs/content/locales/ar-SA/using-your-agent.mdx +2 -2
  15. package/corpus/core/docs/content/locales/de-DE/cloneable-saas.mdx +3 -3
  16. package/corpus/core/docs/content/locales/de-DE/faq.mdx +4 -4
  17. package/corpus/core/docs/content/locales/de-DE/getting-started.mdx +145 -211
  18. package/corpus/core/docs/content/locales/de-DE/pure-agent-apps.mdx +4 -9
  19. package/corpus/core/docs/content/locales/de-DE/template-chat.mdx +2 -2
  20. package/corpus/core/docs/content/locales/de-DE/using-your-agent.mdx +2 -2
  21. package/corpus/core/docs/content/locales/es-ES/cloneable-saas.mdx +3 -3
  22. package/corpus/core/docs/content/locales/es-ES/faq.mdx +4 -4
  23. package/corpus/core/docs/content/locales/es-ES/getting-started.mdx +148 -214
  24. package/corpus/core/docs/content/locales/es-ES/pure-agent-apps.mdx +4 -9
  25. package/corpus/core/docs/content/locales/es-ES/template-chat.mdx +2 -2
  26. package/corpus/core/docs/content/locales/es-ES/using-your-agent.mdx +2 -2
  27. package/corpus/core/docs/content/locales/fr-FR/cloneable-saas.mdx +2 -2
  28. package/corpus/core/docs/content/locales/fr-FR/faq.mdx +4 -4
  29. package/corpus/core/docs/content/locales/fr-FR/getting-started.mdx +146 -212
  30. package/corpus/core/docs/content/locales/fr-FR/pure-agent-apps.mdx +4 -9
  31. package/corpus/core/docs/content/locales/fr-FR/template-chat.mdx +2 -2
  32. package/corpus/core/docs/content/locales/fr-FR/using-your-agent.mdx +2 -2
  33. package/corpus/core/docs/content/locales/hi-IN/cloneable-saas.mdx +3 -3
  34. package/corpus/core/docs/content/locales/hi-IN/faq.mdx +4 -4
  35. package/corpus/core/docs/content/locales/hi-IN/getting-started.mdx +149 -215
  36. package/corpus/core/docs/content/locales/hi-IN/pure-agent-apps.mdx +8 -13
  37. package/corpus/core/docs/content/locales/hi-IN/template-chat.mdx +2 -2
  38. package/corpus/core/docs/content/locales/hi-IN/using-your-agent.mdx +2 -2
  39. package/corpus/core/docs/content/locales/ja-JP/cloneable-saas.mdx +2 -2
  40. package/corpus/core/docs/content/locales/ja-JP/faq.mdx +4 -4
  41. package/corpus/core/docs/content/locales/ja-JP/getting-started.mdx +144 -210
  42. package/corpus/core/docs/content/locales/ja-JP/pure-agent-apps.mdx +8 -13
  43. package/corpus/core/docs/content/locales/ja-JP/template-chat.mdx +2 -2
  44. package/corpus/core/docs/content/locales/ja-JP/using-your-agent.mdx +2 -2
  45. package/corpus/core/docs/content/locales/ko-KR/cloneable-saas.mdx +3 -3
  46. package/corpus/core/docs/content/locales/ko-KR/faq.mdx +4 -4
  47. package/corpus/core/docs/content/locales/ko-KR/getting-started.mdx +146 -212
  48. package/corpus/core/docs/content/locales/ko-KR/pure-agent-apps.mdx +8 -13
  49. package/corpus/core/docs/content/locales/ko-KR/template-chat.mdx +2 -2
  50. package/corpus/core/docs/content/locales/ko-KR/using-your-agent.mdx +2 -2
  51. package/corpus/core/docs/content/locales/pt-BR/cloneable-saas.mdx +3 -3
  52. package/corpus/core/docs/content/locales/pt-BR/faq.mdx +4 -4
  53. package/corpus/core/docs/content/locales/pt-BR/getting-started.mdx +145 -211
  54. package/corpus/core/docs/content/locales/pt-BR/pure-agent-apps.mdx +4 -9
  55. package/corpus/core/docs/content/locales/pt-BR/template-chat.mdx +2 -2
  56. package/corpus/core/docs/content/locales/pt-BR/using-your-agent.mdx +2 -2
  57. package/corpus/core/docs/content/locales/zh-CN/cloneable-saas.mdx +3 -3
  58. package/corpus/core/docs/content/locales/zh-CN/faq.mdx +4 -4
  59. package/corpus/core/docs/content/locales/zh-CN/getting-started.mdx +158 -209
  60. package/corpus/core/docs/content/locales/zh-CN/pure-agent-apps.mdx +4 -9
  61. package/corpus/core/docs/content/locales/zh-CN/template-chat.mdx +2 -2
  62. package/corpus/core/docs/content/locales/zh-CN/using-your-agent.mdx +2 -2
  63. package/corpus/core/docs/content/locales/zh-TW/cloneable-saas.mdx +3 -3
  64. package/corpus/core/docs/content/locales/zh-TW/faq.mdx +4 -4
  65. package/corpus/core/docs/content/locales/zh-TW/getting-started.mdx +158 -212
  66. package/corpus/core/docs/content/locales/zh-TW/pure-agent-apps.mdx +4 -9
  67. package/corpus/core/docs/content/locales/zh-TW/template-chat.mdx +2 -2
  68. package/corpus/core/docs/content/locales/zh-TW/using-your-agent.mdx +2 -2
  69. package/corpus/core/docs/content/native-chat-ui.mdx +17 -32
  70. package/corpus/core/docs/content/pure-agent-apps.mdx +46 -26
  71. package/corpus/core/docs/content/template-chat.mdx +8 -8
  72. package/corpus/core/docs/content/using-your-agent.mdx +2 -2
  73. package/corpus/core/docs/content/what-is-agent-native.mdx +6 -6
  74. package/corpus/core/package.json +1 -1
  75. package/corpus/core/src/cli/skills.ts +7 -9
  76. package/corpus/core/src/client/AssistantChat.tsx +27 -13
  77. package/corpus/core/src/client/MultiTabAssistantChat.tsx +2 -0
  78. package/corpus/core/src/client/RunStuckBanner.tsx +195 -21
  79. package/corpus/core/src/client/blocks/library/wireframe-kit.tsx +57 -9
  80. package/corpus/core/src/client/blocks/library/wireframe.tsx +3 -18
  81. package/corpus/core/src/client/chat/widgets/builtin-tool-renderers.tsx +28 -32
  82. package/corpus/core/src/client/use-run-stuck-detection.ts +14 -1
  83. package/corpus/core/src/db/schema.ts +5 -0
  84. package/corpus/core/src/server/agent-chat-plugin.ts +5 -2
  85. package/corpus/core/src/styles/blocks.css +27 -6
  86. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +1 -4
  87. package/corpus/templates/content/actions/list-trashed-content-databases.ts +1 -1
  88. package/corpus/templates/plan/.agents/skills/visual-plan/references/wireframe.md +7 -9
  89. package/corpus/templates/plan/.agents/skills/visual-recap/references/wireframe.md +7 -9
  90. package/dist/cli/skills.d.ts +1 -1
  91. package/dist/cli/skills.d.ts.map +1 -1
  92. package/dist/cli/skills.js +7 -9
  93. package/dist/cli/skills.js.map +1 -1
  94. package/dist/client/AssistantChat.d.ts +6 -0
  95. package/dist/client/AssistantChat.d.ts.map +1 -1
  96. package/dist/client/AssistantChat.js +19 -13
  97. package/dist/client/AssistantChat.js.map +1 -1
  98. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  99. package/dist/client/MultiTabAssistantChat.js +1 -1
  100. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  101. package/dist/client/RunStuckBanner.d.ts +13 -1
  102. package/dist/client/RunStuckBanner.d.ts.map +1 -1
  103. package/dist/client/RunStuckBanner.js +138 -16
  104. package/dist/client/RunStuckBanner.js.map +1 -1
  105. package/dist/client/blocks/library/wireframe-kit.d.ts +6 -6
  106. package/dist/client/blocks/library/wireframe-kit.d.ts.map +1 -1
  107. package/dist/client/blocks/library/wireframe-kit.js +52 -5
  108. package/dist/client/blocks/library/wireframe-kit.js.map +1 -1
  109. package/dist/client/blocks/library/wireframe.d.ts.map +1 -1
  110. package/dist/client/blocks/library/wireframe.js +1 -11
  111. package/dist/client/blocks/library/wireframe.js.map +1 -1
  112. package/dist/client/chat/widgets/builtin-tool-renderers.d.ts.map +1 -1
  113. package/dist/client/chat/widgets/builtin-tool-renderers.js +27 -31
  114. package/dist/client/chat/widgets/builtin-tool-renderers.js.map +1 -1
  115. package/dist/client/use-run-stuck-detection.d.ts +4 -0
  116. package/dist/client/use-run-stuck-detection.d.ts.map +1 -1
  117. package/dist/client/use-run-stuck-detection.js +7 -1
  118. package/dist/client/use-run-stuck-detection.js.map +1 -1
  119. package/dist/collab/awareness.d.ts +2 -2
  120. package/dist/collab/awareness.d.ts.map +1 -1
  121. package/dist/collab/routes.d.ts +1 -1
  122. package/dist/db/schema.d.ts +2 -1
  123. package/dist/db/schema.d.ts.map +1 -1
  124. package/dist/db/schema.js +3 -2
  125. package/dist/db/schema.js.map +1 -1
  126. package/dist/notifications/routes.d.ts +3 -3
  127. package/dist/progress/routes.d.ts +1 -1
  128. package/dist/resources/handlers.d.ts +3 -3
  129. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  130. package/dist/server/agent-chat-plugin.js +3 -2
  131. package/dist/server/agent-chat-plugin.js.map +1 -1
  132. package/dist/server/transcribe-voice.d.ts +1 -1
  133. package/dist/styles/blocks.css +27 -6
  134. package/docs/content/actions.mdx +17 -24
  135. package/docs/content/agent-surfaces.mdx +59 -56
  136. package/docs/content/cloneable-saas.mdx +3 -3
  137. package/docs/content/faq.mdx +4 -4
  138. package/docs/content/getting-started.mdx +246 -204
  139. package/docs/content/key-concepts.mdx +9 -9
  140. package/docs/content/locales/ar-SA/cloneable-saas.mdx +3 -3
  141. package/docs/content/locales/ar-SA/faq.mdx +4 -4
  142. package/docs/content/locales/ar-SA/getting-started.mdx +148 -214
  143. package/docs/content/locales/ar-SA/pure-agent-apps.mdx +4 -9
  144. package/docs/content/locales/ar-SA/template-chat.mdx +2 -2
  145. package/docs/content/locales/ar-SA/using-your-agent.mdx +2 -2
  146. package/docs/content/locales/de-DE/cloneable-saas.mdx +3 -3
  147. package/docs/content/locales/de-DE/faq.mdx +4 -4
  148. package/docs/content/locales/de-DE/getting-started.mdx +145 -211
  149. package/docs/content/locales/de-DE/pure-agent-apps.mdx +4 -9
  150. package/docs/content/locales/de-DE/template-chat.mdx +2 -2
  151. package/docs/content/locales/de-DE/using-your-agent.mdx +2 -2
  152. package/docs/content/locales/es-ES/cloneable-saas.mdx +3 -3
  153. package/docs/content/locales/es-ES/faq.mdx +4 -4
  154. package/docs/content/locales/es-ES/getting-started.mdx +148 -214
  155. package/docs/content/locales/es-ES/pure-agent-apps.mdx +4 -9
  156. package/docs/content/locales/es-ES/template-chat.mdx +2 -2
  157. package/docs/content/locales/es-ES/using-your-agent.mdx +2 -2
  158. package/docs/content/locales/fr-FR/cloneable-saas.mdx +2 -2
  159. package/docs/content/locales/fr-FR/faq.mdx +4 -4
  160. package/docs/content/locales/fr-FR/getting-started.mdx +146 -212
  161. package/docs/content/locales/fr-FR/pure-agent-apps.mdx +4 -9
  162. package/docs/content/locales/fr-FR/template-chat.mdx +2 -2
  163. package/docs/content/locales/fr-FR/using-your-agent.mdx +2 -2
  164. package/docs/content/locales/hi-IN/cloneable-saas.mdx +3 -3
  165. package/docs/content/locales/hi-IN/faq.mdx +4 -4
  166. package/docs/content/locales/hi-IN/getting-started.mdx +149 -215
  167. package/docs/content/locales/hi-IN/pure-agent-apps.mdx +8 -13
  168. package/docs/content/locales/hi-IN/template-chat.mdx +2 -2
  169. package/docs/content/locales/hi-IN/using-your-agent.mdx +2 -2
  170. package/docs/content/locales/ja-JP/cloneable-saas.mdx +2 -2
  171. package/docs/content/locales/ja-JP/faq.mdx +4 -4
  172. package/docs/content/locales/ja-JP/getting-started.mdx +144 -210
  173. package/docs/content/locales/ja-JP/pure-agent-apps.mdx +8 -13
  174. package/docs/content/locales/ja-JP/template-chat.mdx +2 -2
  175. package/docs/content/locales/ja-JP/using-your-agent.mdx +2 -2
  176. package/docs/content/locales/ko-KR/cloneable-saas.mdx +3 -3
  177. package/docs/content/locales/ko-KR/faq.mdx +4 -4
  178. package/docs/content/locales/ko-KR/getting-started.mdx +146 -212
  179. package/docs/content/locales/ko-KR/pure-agent-apps.mdx +8 -13
  180. package/docs/content/locales/ko-KR/template-chat.mdx +2 -2
  181. package/docs/content/locales/ko-KR/using-your-agent.mdx +2 -2
  182. package/docs/content/locales/pt-BR/cloneable-saas.mdx +3 -3
  183. package/docs/content/locales/pt-BR/faq.mdx +4 -4
  184. package/docs/content/locales/pt-BR/getting-started.mdx +145 -211
  185. package/docs/content/locales/pt-BR/pure-agent-apps.mdx +4 -9
  186. package/docs/content/locales/pt-BR/template-chat.mdx +2 -2
  187. package/docs/content/locales/pt-BR/using-your-agent.mdx +2 -2
  188. package/docs/content/locales/zh-CN/cloneable-saas.mdx +3 -3
  189. package/docs/content/locales/zh-CN/faq.mdx +4 -4
  190. package/docs/content/locales/zh-CN/getting-started.mdx +158 -209
  191. package/docs/content/locales/zh-CN/pure-agent-apps.mdx +4 -9
  192. package/docs/content/locales/zh-CN/template-chat.mdx +2 -2
  193. package/docs/content/locales/zh-CN/using-your-agent.mdx +2 -2
  194. package/docs/content/locales/zh-TW/cloneable-saas.mdx +3 -3
  195. package/docs/content/locales/zh-TW/faq.mdx +4 -4
  196. package/docs/content/locales/zh-TW/getting-started.mdx +158 -212
  197. package/docs/content/locales/zh-TW/pure-agent-apps.mdx +4 -9
  198. package/docs/content/locales/zh-TW/template-chat.mdx +2 -2
  199. package/docs/content/locales/zh-TW/using-your-agent.mdx +2 -2
  200. package/docs/content/native-chat-ui.mdx +17 -32
  201. package/docs/content/pure-agent-apps.mdx +46 -26
  202. package/docs/content/template-chat.mdx +8 -8
  203. package/docs/content/using-your-agent.mdx +2 -2
  204. package/docs/content/what-is-agent-native.mdx +6 -6
  205. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"wireframe.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/wireframe.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACL,SAAS,EACT,KAAK,EACL,OAAO,EACP,MA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["import { IconPencil } from \"@tabler/icons-react\";\nimport {\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\n\nimport { ltrCodeBlockProps } from \"../code-block-direction.js\";\nimport { defineBlock } from \"../types.js\";\nimport type {\n BlockReadProps,\n BlockEditProps,\n BlockRenderContext,\n} from \"../types.js\";\nimport { useBlockCopy } from \"./block-copy.js\";\nimport {\n sanitizeWireframeCss,\n sanitizeWireframeHtml,\n scopeDesignCss,\n} from \"./sanitize-html.js\";\nimport { renderWireframeIconHtml } from \"./wireframe-icons.js\";\nimport {\n HTML_ROUGH_SELECTOR,\n KitConfigContext,\n RoughOverlay,\n Screen,\n renderNodes,\n toggleWireframeStyle,\n useIsDark,\n useWireframeStyle,\n} from \"./wireframe-kit.js\";\nimport {\n wireframeSchema,\n wireframeMdx,\n type WireframeData,\n type WireframeSurface,\n} from \"./wireframe.config.js\";\n\n/**\n * Shared `wireframe` block — a hand-drawn low-fi mockup of one screen, rendered\n * from either a declarative kit tree (`data.screen`) or a self-contained HTML\n * mockup (`data.html`), inside a surface-locked frame (desktop/mobile/popover/\n * panel/browser) with a rough.js sketch overlay. Lives in core so any app can\n * register it (it originated in the plan template).\n *\n * DECOUPLING from the plan original:\n * - Theme: `useIsDark()` reads `document.documentElement.classList` instead of\n * `next-themes` (the MermaidBlock precedent), so core stays dependency-light.\n * - HTML sanitize: the HTML path runs `data.html`/`data.css` through the\n * app-injected `ctx.sanitizeHtml`. If no sanitizer is wired the HTML path is\n * skipped (kit tree or an empty frame renders) — core never injects unsanitized\n * author HTML.\n * - The plan-only prototype runtime, design-element selection, and legacy region\n * fallback are intentionally NOT ported; those are plan-canvas features, not\n * part of the document-block render. The kit element vocabulary, the `--wf-*`\n * token contract, and the `.plan-wf` / `[data-rough]` classes the overlay\n * measures are preserved exactly.\n *\n * The section carries the app-neutral `an-block` class plus the legacy\n * `plan-block` class so plan renders byte-identically while any other app gets\n * the theme-token treatment from core's `blocks.css`.\n *\n * The wireframe is canvas / agent-patch edited (node-addressable content patches\n * applied server-side), NOT schema-form edited in the browser — so `Edit` reuses\n * the same static render as `Read`, mirroring the plan `WireframeEditor`.\n */\n\ntype SurfacePreset = {\n width: number;\n /**\n * Floor height for the surface. The frame is AUTO-HEIGHT (content-driven): it\n * grows past this when content is tall and shrinks toward its content height\n * when content is short, but never collapses below this floor — so an empty or\n * near-empty frame still reads as that surface instead of a thin sliver. This\n * is a `min-height`, not a fixed `height`: it is the lower bound the old fixed\n * preset height used to also be the UPPER bound, which is what left a big empty\n * vertical band below short content (e.g. a header + one dropdown padded to a\n * tall fixed aspect).\n */\n minHeight: number;\n radius: number;\n};\n\nconst SURFACE_PRESETS: Record<WireframeSurface, SurfacePreset> = {\n // mobile keeps a tall floor: a phone frame reads as a phone even when short.\n mobile: { width: 300, minHeight: 360, radius: 30 },\n desktop: { width: 840, minHeight: 200, radius: 14 },\n browser: { width: 900, minHeight: 200, radius: 14 },\n popover: { width: 360, minHeight: 120, radius: 16 },\n panel: { width: 420, minHeight: 200, radius: 16 },\n};\n\nfunction isHtmlData(data: WireframeData): boolean {\n return typeof data.html === \"string\" && data.html.trim().length > 0;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Shared frame shell: surface-locked WIDTH + auto (content-driven) height + */\n/* theme + rough overlay. The frame keeps each surface's footprint and chrome */\n/* but fits its content height instead of padding to a fixed aspect, so short */\n/* content yields a short frame and tall content grows. Pass `canvasSize` to */\n/* opt a fixed-aspect canvas artboard back into a hard pixel height. */\n/* -------------------------------------------------------------------------- */\n\nfunction ArtboardFrame({\n surface,\n compact,\n canvasSize,\n canvasWidth,\n skeleton,\n renderMode,\n roughOverlay = true,\n selector,\n caption,\n render,\n}: {\n surface: WireframeSurface;\n compact?: boolean;\n /**\n * Force a FIXED pixel height instead of the auto-height (content-driven)\n * default. Reserved for fixed-aspect canvas artboards (pan/zoom). Document-flow\n * wireframes — what recaps render — leave this unset so the frame fits content.\n */\n canvasSize?: number;\n canvasWidth?: number;\n skeleton?: boolean;\n renderMode?: \"wireframe\" | \"design\";\n roughOverlay?: boolean;\n selector: string;\n caption?: string;\n render: (ctx: {\n theme: \"light\" | \"dark\";\n style: \"sketchy\" | \"clean\";\n }) => ReactNode;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const fitRef = useRef<HTMLDivElement>(null);\n const isDark = useIsDark();\n const theme: \"light\" | \"dark\" = isDark ? \"dark\" : \"light\";\n const style = useWireframeStyle();\n const preset = SURFACE_PRESETS[surface] ?? SURFACE_PRESETS.desktop;\n const width = canvasWidth ?? preset.width;\n // AUTO-HEIGHT: with no explicit `canvasSize` the artboard height is driven by\n // its content (`height: auto`), floored at the surface's `minHeight` so a short\n // screen produces a short frame and a tall screen grows — instead of every\n // surface being padded to a fixed preset height that left a big empty band\n // below short content. A `canvasSize` (fixed-aspect canvas artboard) overrides\n // this with a hard pixel height.\n const fixedHeight = canvasSize;\n const minHeight = fixedHeight ?? preset.minHeight;\n const baseScale = compact ? Math.min(1, 320 / preset.width) : 1;\n const maxFrameWidth = compact ? preset.width * baseScale : width;\n const [fitScale, setFitScale] = useState(baseScale);\n // The scaled artboard is `transform: scale()`-ed, which does not change its\n // layout box, so the wrapper that reserves vertical space must track the\n // artboard's ACTUAL rendered height. With a fixed height that's known up front;\n // with auto-height we measure it.\n const [measuredHeight, setMeasuredHeight] = useState<number | null>(\n fixedHeight ?? null,\n );\n const designMode = renderMode === \"design\";\n const sketchy = !designMode && style === \"sketchy\" && !skeleton;\n const roughEnabled = sketchy && roughOverlay;\n const paper = designMode\n ? \"hsl(var(--background))\"\n : \"var(--plan-document, hsl(var(--background)))\";\n const frameBorder = skeleton\n ? \"var(--plan-placeholder-line, var(--plan-line, hsl(var(--border))))\"\n : \"var(--plan-line, hsl(var(--border)))\";\n\n useEffect(() => {\n const element = fitRef.current;\n if (!element) return;\n const measure = () => {\n const availableWidth = element.clientWidth;\n const nextScale =\n availableWidth > 0\n ? Math.min(baseScale, availableWidth / width)\n : baseScale;\n setFitScale((current) =>\n Math.abs(current - nextScale) < 0.001 ? current : nextScale,\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, [baseScale, width]);\n\n // Track the auto-height artboard's rendered height so the (un-transformed)\n // wrapper reserves exactly the scaled space the frame occupies. Skipped when a\n // fixed height is supplied — there's nothing to measure.\n useEffect(() => {\n if (fixedHeight != null) return;\n const element = ref.current;\n if (!element) return;\n const measure = () => {\n const next = element.offsetHeight;\n setMeasuredHeight((current) =>\n current != null && Math.abs(current - next) < 0.5 ? current : next,\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, [fixedHeight]);\n\n // Height the wrapper reserves: the measured (or fixed) artboard height scaled\n // by the fit factor. Falls back to the surface floor before the first measure\n // so SSR / first paint reserves a sensible box rather than collapsing.\n const reservedHeight = (measuredHeight ?? minHeight) * fitScale;\n const reserveScaledHeight = fixedHeight != null || fitScale !== 1;\n\n return (\n <div\n ref={fitRef}\n className=\"plan-kit-wireframe\"\n style={{\n width: \"100%\",\n maxWidth: maxFrameWidth,\n }}\n >\n <div\n className=\"group/wireframe-artboard relative\"\n style={{\n width: \"100%\",\n maxWidth: maxFrameWidth,\n ...(reserveScaledHeight ? { height: reservedHeight } : {}),\n marginInline: \"auto\",\n }}\n >\n <div\n ref={ref}\n className=\"plan-kit-artboard relative\"\n data-rough-scope=\"wireframe\"\n style={{\n width,\n // Auto-height by default (content-driven, floored at `minHeight`);\n // a fixed `canvasSize` locks the height for canvas artboards.\n ...(fixedHeight != null ? { height: fixedHeight } : { minHeight }),\n borderRadius: preset.radius,\n background: paper,\n ...(fitScale !== 1\n ? {\n transform: `scale(${fitScale})`,\n transformOrigin: \"top left\",\n }\n : {}),\n }}\n >\n {/* Content drives the artboard height in flow when auto-height; for a\n fixed height it's pinned to the box. Rounded corners clip overflow\n either way. */}\n <div\n className=\"overflow-hidden\"\n style={{\n borderRadius: preset.radius,\n ...(fixedHeight != null\n ? { position: \"absolute\", inset: 0 }\n : { minHeight }),\n }}\n >\n {render({ theme, style })}\n </div>\n {!roughEnabled && (\n <div\n className=\"pointer-events-none absolute inset-0\"\n style={{\n borderRadius: preset.radius,\n border: `1.5px solid ${frameBorder}`,\n }}\n />\n )}\n <RoughOverlay\n scopeRef={ref}\n enabled={roughEnabled}\n frameRadius={preset.radius}\n selector={selector}\n />\n </div>\n {!designMode && !skeleton && <WireframeStyleToggleButton />}\n </div>\n {caption && (\n <p className=\"mt-2 text-center text-xs text-plan-muted\">{caption}</p>\n )}\n </div>\n );\n}\n\nfunction WireframeStyleToggleButton() {\n const style = useWireframeStyle();\n const copy = useBlockCopy();\n const nextStyle = style === \"sketchy\" ? \"clean\" : \"sketchy\";\n const label = nextStyle === \"clean\" ? copy.clean : copy.sketchy;\n const description = copy.switchVisualStyle.replace(\n \"{{style}}\",\n label.toLocaleLowerCase(),\n );\n\n return (\n <button\n type=\"button\"\n data-plan-interactive\n data-rough=\"none\"\n data-wireframe-style-toggle\n aria-label={description}\n title={description}\n onClick={(event) => {\n event.stopPropagation();\n toggleWireframeStyle();\n }}\n className=\"absolute right-2 top-2 z-30 inline-flex h-7 items-center gap-1 rounded-md border border-border/60 bg-background px-2 text-xs font-medium text-muted-foreground opacity-0 shadow-sm transition-[color,opacity] hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring group-hover/wireframe-artboard:opacity-100\"\n >\n <IconPencil className=\"size-3.5\" aria-hidden=\"true\" />\n <span>{label}</span>\n </button>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* HTML artboard — author HTML, themed + roughened by the renderer. */\n/* -------------------------------------------------------------------------- */\n\nfunction HtmlArtboard({\n data,\n ctx: _ctx,\n compact,\n}: {\n data: WireframeData;\n ctx: BlockRenderContext;\n compact?: boolean;\n}) {\n const renderMode = data.renderMode ?? \"wireframe\";\n const designMode = renderMode === \"design\";\n // Sanitize author HTML/CSS at the render point (defense-in-depth against stored\n // XSS). Self-contained in core via the shared block sanitizer (DOM-based in the\n // browser, regex fallback on the server) so the HTML mockup path renders in any\n // app without the host wiring a sanitizer hook.\n const safeHtml = useMemo(\n () =>\n renderWireframeIconHtml(\n sanitizeWireframeHtml(data.html, {\n preserveThemeClasses: designMode,\n }),\n ),\n [data.html, designMode],\n );\n const scopeId = useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n const scopedCss = useMemo(() => {\n const safeCss = sanitizeWireframeCss(data.css);\n // Scope every author selector under this instance's artboard so global\n // selectors (body, *, .app-shell, :root) can't restyle/hide the host app.\n return safeCss\n ? scopeDesignCss(safeCss, `[data-plan-design-scope=\"${scopeId}\"]`)\n : \"\";\n }, [data.css, scopeId]);\n\n return (\n <ArtboardFrame\n surface={data.surface}\n compact={compact}\n skeleton={data.skeleton}\n renderMode={renderMode}\n selector={HTML_ROUGH_SELECTOR}\n caption={data.caption}\n render={({ theme, style }) => (\n <div\n className=\"plan-html-frame\"\n data-theme={theme}\n data-style={style}\n data-render-mode={renderMode}\n data-plan-design-scope={scopeId}\n data-skeleton={data.skeleton ? \"true\" : undefined}\n >\n {scopedCss && <style>{scopedCss}</style>}\n <div\n className=\"plan-html-frame-content\"\n dangerouslySetInnerHTML={{ __html: safeHtml }}\n />\n </div>\n )}\n />\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Kit artboard — declarative kit tree. */\n/* -------------------------------------------------------------------------- */\n\nfunction KitArtboard({\n data,\n compact,\n}: {\n data: WireframeData;\n compact?: boolean;\n}) {\n return (\n <ArtboardFrame\n surface={data.surface}\n compact={compact}\n skeleton={data.skeleton}\n selector=\"[data-rough]\"\n caption={data.caption}\n render={({ theme, style }) => (\n <KitConfigContext.Provider\n value={{ skeleton: data.skeleton, theme, style }}\n >\n {renderKitScreen(data.screen ?? [])}\n </KitConfigContext.Provider>\n )}\n />\n );\n}\n\nfunction renderKitScreen(\n nodes: NonNullable<WireframeData[\"screen\"]>,\n): ReactNode {\n if (nodes.length === 1 && nodes[0]?.el === \"screen\") {\n return renderNodes(nodes);\n }\n // `minHeight` (not `height`) so the screen fills the auto-height artboard floor\n // but grows past it when content is tall, instead of locking to a fixed box.\n return (\n <Screen pad=\"calc(var(--pad) * 1.35)\" style={{ minHeight: \"100%\" }}>\n {renderNodes(nodes)}\n </Screen>\n );\n}\n\n/**\n * The bare wireframe surface (no block section / title). Routes to the HTML\n * mockup when `data.html` is present and a sanitizer is wired; otherwise renders\n * the kit tree.\n */\nfunction WireframeSurfaceView({\n data,\n ctx,\n compact,\n}: {\n data: WireframeData;\n ctx: BlockRenderContext;\n compact?: boolean;\n}) {\n if (isHtmlData(data)) {\n return <HtmlArtboard data={data} ctx={ctx} compact={compact} />;\n }\n return <KitArtboard data={data} compact={compact} />;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Block Read / Edit */\n/* -------------------------------------------------------------------------- */\n\n/** Read-only renderer for a `wireframe` block. */\nexport function WireframeBlock({\n data,\n blockId,\n title,\n summary,\n ctx,\n compactVisuals,\n}: BlockReadProps<WireframeData>) {\n return (\n <section\n {...ltrCodeBlockProps}\n className=\"an-block plan-block an-wireframe\"\n data-block-id={blockId}\n >\n {title && <div className=\"an-block-label plan-block-label\">{title}</div>}\n <WireframeSurfaceView data={data} ctx={ctx} compact={compactVisuals} />\n {summary && <p className=\"mt-5 text-plan-muted\">{summary}</p>}\n </section>\n );\n}\n\n/**\n * Editor for the `wireframe` block. The wireframe is canvas / agent-patch edited\n * (it never calls `onChange`), so edit mode reuses the read surface — mirroring\n * the plan `WireframeEditor`. The host document editor already wraps the registry\n * edit path in a titled section, so this renders only the surface to avoid\n * double-nesting.\n */\nexport function WireframeEditor({ data, ctx }: BlockEditProps<WireframeData>) {\n return <WireframeSurfaceView data={data} ctx={ctx} />;\n}\n\n/** Full client spec for the shared `wireframe` block (schema + MDX + Read/Edit). */\nexport const wireframeBlock = defineBlock<WireframeData>({\n type: \"wireframe\",\n schema: wireframeSchema,\n mdx: wireframeMdx,\n Read: WireframeBlock,\n Edit: WireframeEditor,\n placement: [\"block\"],\n editSurface: \"inline\",\n label: \"Wireframe\",\n description:\n \"A sketch wireframe of one screen built from kit primitives (or an HTML mockup), rendered in a chosen surface frame (desktop/mobile/popover/panel/browser).\",\n // `surface` is the only required field; `screen` defaults to []. Start on the\n // desktop surface with an empty screen so the canvas/agent can fill it in.\n empty: () => ({ surface: \"desktop\", screen: [] }),\n});\n"]}
1
+ {"version":3,"file":"wireframe.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/wireframe.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACL,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,MAAM,EACN,WAAW,EACX,oBAAoB,EACpB,SAAS,EACT,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,eAAe,EACf,YAAY,GAGb,MAAM,uBAAuB,CAAC;AA+C/B,MAAM,eAAe,GAA4C;IAC/D,6EAA6E;IAC7E,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;IAClD,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;IACnD,OAAO,EA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,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;CAClD,CAAC,CAAC","sourcesContent":["import { IconPencil } from \"@tabler/icons-react\";\nimport {\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\n\nimport { ltrCodeBlockProps } from \"../code-block-direction.js\";\nimport { defineBlock } from \"../types.js\";\nimport type {\n BlockReadProps,\n BlockEditProps,\n BlockRenderContext,\n} from \"../types.js\";\nimport { useBlockCopy } from \"./block-copy.js\";\nimport {\n sanitizeWireframeCss,\n sanitizeWireframeHtml,\n scopeDesignCss,\n} from \"./sanitize-html.js\";\nimport { renderWireframeIconHtml } from \"./wireframe-icons.js\";\nimport {\n HTML_ROUGH_SELECTOR,\n KitConfigContext,\n RoughOverlay,\n Screen,\n renderNodes,\n toggleWireframeStyle,\n useIsDark,\n useWireframeStyle,\n} from \"./wireframe-kit.js\";\nimport {\n wireframeSchema,\n wireframeMdx,\n type WireframeData,\n type WireframeSurface,\n} from \"./wireframe.config.js\";\n\n/**\n * Shared `wireframe` block — a hand-drawn low-fi mockup of one screen, rendered\n * from either a declarative kit tree (`data.screen`) or a self-contained HTML\n * mockup (`data.html`), inside a surface-locked frame (desktop/mobile/popover/\n * panel/browser) with a rough.js sketch overlay. Lives in core so any app can\n * register it (it originated in the plan template).\n *\n * DECOUPLING from the plan original:\n * - Theme: `useIsDark()` reads `document.documentElement.classList` instead of\n * `next-themes` (the MermaidBlock precedent), so core stays dependency-light.\n * - HTML sanitize: the HTML path runs `data.html`/`data.css` through the\n * app-injected `ctx.sanitizeHtml`. If no sanitizer is wired the HTML path is\n * skipped (kit tree or an empty frame renders) — core never injects unsanitized\n * author HTML.\n * - The plan-only prototype runtime, design-element selection, and legacy region\n * fallback are intentionally NOT ported; those are plan-canvas features, not\n * part of the document-block render. The kit element vocabulary, the `--wf-*`\n * token contract, and the `.plan-wf` / `.wf-*` / `[data-rough]` classes the\n * overlay measures are preserved exactly.\n *\n * The section carries the app-neutral `an-block` class plus the legacy\n * `plan-block` class so plan renders byte-identically while any other app gets\n * the theme-token treatment from core's `blocks.css`.\n *\n * The wireframe is canvas / agent-patch edited (node-addressable content patches\n * applied server-side), NOT schema-form edited in the browser — so `Edit` reuses\n * the same static render as `Read`, mirroring the plan `WireframeEditor`.\n */\n\ntype SurfacePreset = {\n width: number;\n /**\n * Floor height for the surface. The frame is AUTO-HEIGHT (content-driven): it\n * grows past this when content is tall and shrinks toward its content height\n * when content is short, but never collapses below this floor — so an empty or\n * near-empty frame still reads as that surface instead of a thin sliver. This\n * is a `min-height`, not a fixed `height`: it is the lower bound the old fixed\n * preset height used to also be the UPPER bound, which is what left a big empty\n * vertical band below short content (e.g. a header + one dropdown padded to a\n * tall fixed aspect).\n */\n minHeight: number;\n radius: number;\n};\n\nconst SURFACE_PRESETS: Record<WireframeSurface, SurfacePreset> = {\n // mobile keeps a tall floor: a phone frame reads as a phone even when short.\n mobile: { width: 300, minHeight: 360, radius: 30 },\n desktop: { width: 840, minHeight: 200, radius: 14 },\n browser: { width: 900, minHeight: 200, radius: 14 },\n popover: { width: 360, minHeight: 120, radius: 16 },\n panel: { width: 420, minHeight: 200, radius: 16 },\n};\n\nfunction isHtmlData(data: WireframeData): boolean {\n return typeof data.html === \"string\" && data.html.trim().length > 0;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Shared frame shell: surface-locked WIDTH + auto (content-driven) height + */\n/* theme + rough overlay. The frame keeps each surface's footprint and chrome */\n/* but fits its content height instead of padding to a fixed aspect, so short */\n/* content yields a short frame and tall content grows. Pass `canvasSize` to */\n/* opt a fixed-aspect canvas artboard back into a hard pixel height. */\n/* -------------------------------------------------------------------------- */\n\nfunction ArtboardFrame({\n surface,\n compact,\n canvasSize,\n canvasWidth,\n skeleton,\n renderMode,\n roughOverlay = true,\n selector,\n caption,\n render,\n}: {\n surface: WireframeSurface;\n compact?: boolean;\n /**\n * Force a FIXED pixel height instead of the auto-height (content-driven)\n * default. Reserved for fixed-aspect canvas artboards (pan/zoom). Document-flow\n * wireframes — what recaps render — leave this unset so the frame fits content.\n */\n canvasSize?: number;\n canvasWidth?: number;\n skeleton?: boolean;\n renderMode?: \"wireframe\" | \"design\";\n roughOverlay?: boolean;\n selector: string;\n caption?: string;\n render: (ctx: {\n theme: \"light\" | \"dark\";\n style: \"sketchy\" | \"clean\";\n }) => ReactNode;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const fitRef = useRef<HTMLDivElement>(null);\n const isDark = useIsDark();\n const theme: \"light\" | \"dark\" = isDark ? \"dark\" : \"light\";\n const style = useWireframeStyle();\n const preset = SURFACE_PRESETS[surface] ?? SURFACE_PRESETS.desktop;\n const width = canvasWidth ?? preset.width;\n // AUTO-HEIGHT: with no explicit `canvasSize` the artboard height is driven by\n // its content (`height: auto`), floored at the surface's `minHeight` so a short\n // screen produces a short frame and a tall screen grows — instead of every\n // surface being padded to a fixed preset height that left a big empty band\n // below short content. A `canvasSize` (fixed-aspect canvas artboard) overrides\n // this with a hard pixel height.\n const fixedHeight = canvasSize;\n const minHeight = fixedHeight ?? preset.minHeight;\n const baseScale = compact ? Math.min(1, 320 / preset.width) : 1;\n const maxFrameWidth = compact ? preset.width * baseScale : width;\n const [fitScale, setFitScale] = useState(baseScale);\n // The scaled artboard is `transform: scale()`-ed, which does not change its\n // layout box, so the wrapper that reserves vertical space must track the\n // artboard's ACTUAL rendered height. With a fixed height that's known up front;\n // with auto-height we measure it.\n const [measuredHeight, setMeasuredHeight] = useState<number | null>(\n fixedHeight ?? null,\n );\n const designMode = renderMode === \"design\";\n const sketchy = !designMode && style === \"sketchy\" && !skeleton;\n const roughEnabled = sketchy && roughOverlay;\n\n useEffect(() => {\n const element = fitRef.current;\n if (!element) return;\n const measure = () => {\n const availableWidth = element.clientWidth;\n const nextScale =\n availableWidth > 0\n ? Math.min(baseScale, availableWidth / width)\n : baseScale;\n setFitScale((current) =>\n Math.abs(current - nextScale) < 0.001 ? current : nextScale,\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, [baseScale, width]);\n\n // Track the auto-height artboard's rendered height so the (un-transformed)\n // wrapper reserves exactly the scaled space the frame occupies. Skipped when a\n // fixed height is supplied — there's nothing to measure.\n useEffect(() => {\n if (fixedHeight != null) return;\n const element = ref.current;\n if (!element) return;\n const measure = () => {\n const next = element.offsetHeight;\n setMeasuredHeight((current) =>\n current != null && Math.abs(current - next) < 0.5 ? current : next,\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, [fixedHeight]);\n\n // Height the wrapper reserves: the measured (or fixed) artboard height scaled\n // by the fit factor. Falls back to the surface floor before the first measure\n // so SSR / first paint reserves a sensible box rather than collapsing.\n const reservedHeight = (measuredHeight ?? minHeight) * fitScale;\n const reserveScaledHeight = fixedHeight != null || fitScale !== 1;\n\n return (\n <div\n ref={fitRef}\n className=\"plan-kit-wireframe\"\n style={{\n width: \"100%\",\n maxWidth: maxFrameWidth,\n }}\n >\n <div\n className=\"group/wireframe-artboard relative\"\n style={{\n width: \"100%\",\n maxWidth: maxFrameWidth,\n ...(reserveScaledHeight ? { height: reservedHeight } : {}),\n marginInline: \"auto\",\n }}\n >\n <div\n ref={ref}\n className=\"plan-kit-artboard relative\"\n data-rough-scope=\"wireframe\"\n style={{\n width,\n // Auto-height by default (content-driven, floored at `minHeight`);\n // a fixed `canvasSize` locks the height for canvas artboards.\n ...(fixedHeight != null ? { height: fixedHeight } : { minHeight }),\n borderRadius: preset.radius,\n ...(fitScale !== 1\n ? {\n transform: `scale(${fitScale})`,\n transformOrigin: \"top left\",\n }\n : {}),\n }}\n >\n {/* Content drives the artboard height in flow when auto-height; for a\n fixed height it's pinned to the box. Rounded corners clip overflow\n either way. */}\n <div\n className=\"overflow-hidden\"\n style={{\n borderRadius: preset.radius,\n ...(fixedHeight != null\n ? { position: \"absolute\", inset: 0 }\n : { minHeight }),\n }}\n >\n {render({ theme, style })}\n </div>\n <RoughOverlay\n scopeRef={ref}\n enabled={roughEnabled}\n drawFrame={false}\n frameRadius={preset.radius}\n selector={selector}\n />\n </div>\n {!designMode && !skeleton && <WireframeStyleToggleButton />}\n </div>\n {caption && (\n <p className=\"mt-2 text-center text-xs text-plan-muted\">{caption}</p>\n )}\n </div>\n );\n}\n\nfunction WireframeStyleToggleButton() {\n const style = useWireframeStyle();\n const copy = useBlockCopy();\n const nextStyle = style === \"sketchy\" ? \"clean\" : \"sketchy\";\n const label = nextStyle === \"clean\" ? copy.clean : copy.sketchy;\n const description = copy.switchVisualStyle.replace(\n \"{{style}}\",\n label.toLocaleLowerCase(),\n );\n\n return (\n <button\n type=\"button\"\n data-plan-interactive\n data-rough=\"none\"\n data-wireframe-style-toggle\n aria-label={description}\n title={description}\n onClick={(event) => {\n event.stopPropagation();\n toggleWireframeStyle();\n }}\n className=\"absolute right-2 top-2 z-30 inline-flex h-7 items-center gap-1 rounded-md border border-border/60 bg-background px-2 text-xs font-medium text-muted-foreground opacity-0 shadow-sm transition-[color,opacity] hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring group-hover/wireframe-artboard:opacity-100\"\n >\n <IconPencil className=\"size-3.5\" aria-hidden=\"true\" />\n <span>{label}</span>\n </button>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* HTML artboard — author HTML, themed + roughened by the renderer. */\n/* -------------------------------------------------------------------------- */\n\nfunction HtmlArtboard({\n data,\n ctx: _ctx,\n compact,\n}: {\n data: WireframeData;\n ctx: BlockRenderContext;\n compact?: boolean;\n}) {\n const renderMode = data.renderMode ?? \"wireframe\";\n const designMode = renderMode === \"design\";\n // Sanitize author HTML/CSS at the render point (defense-in-depth against stored\n // XSS). Self-contained in core via the shared block sanitizer (DOM-based in the\n // browser, regex fallback on the server) so the HTML mockup path renders in any\n // app without the host wiring a sanitizer hook.\n const safeHtml = useMemo(\n () =>\n renderWireframeIconHtml(\n sanitizeWireframeHtml(data.html, {\n preserveThemeClasses: designMode,\n }),\n ),\n [data.html, designMode],\n );\n const scopeId = useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n const scopedCss = useMemo(() => {\n const safeCss = sanitizeWireframeCss(data.css);\n // Scope every author selector under this instance's artboard so global\n // selectors (body, *, .app-shell, :root) can't restyle/hide the host app.\n return safeCss\n ? scopeDesignCss(safeCss, `[data-plan-design-scope=\"${scopeId}\"]`)\n : \"\";\n }, [data.css, scopeId]);\n\n return (\n <ArtboardFrame\n surface={data.surface}\n compact={compact}\n skeleton={data.skeleton}\n renderMode={renderMode}\n selector={HTML_ROUGH_SELECTOR}\n caption={data.caption}\n render={({ theme, style }) => (\n <div\n className=\"plan-html-frame\"\n data-theme={theme}\n data-style={style}\n data-render-mode={renderMode}\n data-plan-design-scope={scopeId}\n data-skeleton={data.skeleton ? \"true\" : undefined}\n >\n {scopedCss && <style>{scopedCss}</style>}\n <div\n className=\"plan-html-frame-content\"\n dangerouslySetInnerHTML={{ __html: safeHtml }}\n />\n </div>\n )}\n />\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Kit artboard — declarative kit tree. */\n/* -------------------------------------------------------------------------- */\n\nfunction KitArtboard({\n data,\n compact,\n}: {\n data: WireframeData;\n compact?: boolean;\n}) {\n return (\n <ArtboardFrame\n surface={data.surface}\n compact={compact}\n skeleton={data.skeleton}\n selector=\"[data-rough]\"\n caption={data.caption}\n render={({ theme, style }) => (\n <KitConfigContext.Provider\n value={{ skeleton: data.skeleton, theme, style }}\n >\n {renderKitScreen(data.screen ?? [])}\n </KitConfigContext.Provider>\n )}\n />\n );\n}\n\nfunction renderKitScreen(\n nodes: NonNullable<WireframeData[\"screen\"]>,\n): ReactNode {\n if (nodes.length === 1 && nodes[0]?.el === \"screen\") {\n return renderNodes(nodes);\n }\n // `minHeight` (not `height`) so the screen fills the auto-height artboard floor\n // but grows past it when content is tall, instead of locking to a fixed box.\n return (\n <Screen pad=\"calc(var(--pad) * 1.35)\" style={{ minHeight: \"100%\" }}>\n {renderNodes(nodes)}\n </Screen>\n );\n}\n\n/**\n * The bare wireframe surface (no block section / title). Routes to the HTML\n * mockup when `data.html` is present and a sanitizer is wired; otherwise renders\n * the kit tree.\n */\nfunction WireframeSurfaceView({\n data,\n ctx,\n compact,\n}: {\n data: WireframeData;\n ctx: BlockRenderContext;\n compact?: boolean;\n}) {\n if (isHtmlData(data)) {\n return <HtmlArtboard data={data} ctx={ctx} compact={compact} />;\n }\n return <KitArtboard data={data} compact={compact} />;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Block Read / Edit */\n/* -------------------------------------------------------------------------- */\n\n/** Read-only renderer for a `wireframe` block. */\nexport function WireframeBlock({\n data,\n blockId,\n title,\n summary,\n ctx,\n compactVisuals,\n}: BlockReadProps<WireframeData>) {\n return (\n <section\n {...ltrCodeBlockProps}\n className=\"an-block plan-block an-wireframe\"\n data-block-id={blockId}\n >\n {title && <div className=\"an-block-label plan-block-label\">{title}</div>}\n <WireframeSurfaceView data={data} ctx={ctx} compact={compactVisuals} />\n {summary && <p className=\"mt-5 text-plan-muted\">{summary}</p>}\n </section>\n );\n}\n\n/**\n * Editor for the `wireframe` block. The wireframe is canvas / agent-patch edited\n * (it never calls `onChange`), so edit mode reuses the read surface — mirroring\n * the plan `WireframeEditor`. The host document editor already wraps the registry\n * edit path in a titled section, so this renders only the surface to avoid\n * double-nesting.\n */\nexport function WireframeEditor({ data, ctx }: BlockEditProps<WireframeData>) {\n return <WireframeSurfaceView data={data} ctx={ctx} />;\n}\n\n/** Full client spec for the shared `wireframe` block (schema + MDX + Read/Edit). */\nexport const wireframeBlock = defineBlock<WireframeData>({\n type: \"wireframe\",\n schema: wireframeSchema,\n mdx: wireframeMdx,\n Read: WireframeBlock,\n Edit: WireframeEditor,\n placement: [\"block\"],\n editSurface: \"inline\",\n label: \"Wireframe\",\n description:\n \"A sketch wireframe of one screen built from kit primitives (or an HTML mockup), rendered in a chosen surface frame (desktop/mobile/popover/panel/browser).\",\n // `surface` is the only required field; `screen` defaults to []. Start on the\n // desktop surface with an empty screen so the canvas/agent can fill it in.\n empty: () => ({ surface: \"desktop\", screen: [] }),\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"builtin-tool-renderers.d.ts","sourceRoot":"","sources":["../../../../src/client/chat/widgets/builtin-tool-renderers.tsx"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC3B,MAAM,4BAA4B,CAAC;AAqGpC,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAQT;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,mBAAmB,GAC3B,qBAAqB,GAAG,IAAI,CAc9B;AAED,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,mBAAmB,GAC3B,qBAAqB,GAAG,IAAI,CAU9B"}
1
+ {"version":3,"file":"builtin-tool-renderers.d.ts","sourceRoot":"","sources":["../../../../src/client/chat/widgets/builtin-tool-renderers.tsx"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC3B,MAAM,4BAA4B,CAAC;AAiGpC,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAQT;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,mBAAmB,GAC3B,qBAAqB,GAAG,IAAI,CAc9B;AAED,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,mBAAmB,GAC3B,qBAAqB,GAAG,IAAI,CAU9B"}
@@ -10,46 +10,42 @@ function isRecord(value) {
10
10
  return !!value && typeof value === "object" && !Array.isArray(value);
11
11
  }
12
12
  function normalizeActionDataWidgetResult(context) {
13
+ const renderer = context.chatUI?.renderer;
14
+ if (isRecord(context.resultJson)) {
15
+ if (renderer === ACTION_CHAT_UI_DATA_TABLE_RENDERER) {
16
+ return normalizeDataWidgetResult({
17
+ ...context.resultJson,
18
+ widget: DATA_TABLE_WIDGET,
19
+ table: isRecord(context.resultJson.table)
20
+ ? context.resultJson.table
21
+ : context.resultJson,
22
+ });
23
+ }
24
+ if (renderer === ACTION_CHAT_UI_DATA_CHART_RENDERER) {
25
+ return normalizeDataWidgetResult({
26
+ ...context.resultJson,
27
+ widget: DATA_CHART_WIDGET,
28
+ chartSeries: isRecord(context.resultJson.chartSeries)
29
+ ? context.resultJson.chartSeries
30
+ : context.resultJson,
31
+ });
32
+ }
33
+ if (renderer === ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER) {
34
+ return normalizeDataWidgetResult({
35
+ ...context.resultJson,
36
+ widget: DATA_INSIGHTS_WIDGET,
37
+ });
38
+ }
39
+ }
13
40
  const result = normalizeDataWidgetResult(context.resultJson);
14
41
  if (result)
15
42
  return result;
16
- const renderer = context.chatUI?.renderer;
17
43
  if (renderer === ACTION_CHAT_UI_DATA_WIDGET_RENDERER ||
18
44
  context.toolName === "render-data-widget") {
19
45
  const argsResult = normalizeDataWidgetResult(context.args);
20
46
  if (argsResult)
21
47
  return argsResult;
22
48
  }
23
- if (!isRecord(context.resultJson))
24
- return null;
25
- if (renderer === ACTION_CHAT_UI_DATA_TABLE_RENDERER) {
26
- return normalizeDataWidgetResult({
27
- widget: DATA_TABLE_WIDGET,
28
- table: isRecord(context.resultJson.table)
29
- ? context.resultJson.table
30
- : context.resultJson,
31
- display: isRecord(context.resultJson.display)
32
- ? context.resultJson.display
33
- : undefined,
34
- });
35
- }
36
- if (renderer === ACTION_CHAT_UI_DATA_CHART_RENDERER) {
37
- return normalizeDataWidgetResult({
38
- widget: DATA_CHART_WIDGET,
39
- chartSeries: isRecord(context.resultJson.chartSeries)
40
- ? context.resultJson.chartSeries
41
- : context.resultJson,
42
- display: isRecord(context.resultJson.display)
43
- ? context.resultJson.display
44
- : undefined,
45
- });
46
- }
47
- if (renderer === ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER) {
48
- return normalizeDataWidgetResult({
49
- ...context.resultJson,
50
- widget: DATA_INSIGHTS_WIDGET,
51
- });
52
- }
53
49
  return null;
54
50
  }
55
51
  function renderDataWidget(context) {
@@ -1 +1 @@
1
- {"version":3,"file":"builtin-tool-renderers.js","sourceRoot":"","sources":["../../../../src/client/chat/widgets/builtin-tool-renderers.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,EAClC,mCAAmC,EACnC,wCAAwC,GACzC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,kCAAkC,EAClC,oCAAoC,GAGrC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,GAE1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,qBAAqB,EACrB,kCAAkC,GACnC,MAAM,4BAA4B,CAAC;AAEpC,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,+BAA+B,CACtC,OAA4B;IAE5B,MAAM,MAAM,GAAG,yBAAyB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7D,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1C,IACE,QAAQ,KAAK,mCAAmC;QAChD,OAAO,CAAC,QAAQ,KAAK,oBAAoB,EACzC,CAAC;QACD,MAAM,UAAU,GAAG,yBAAyB,CAAC,OAAO,CAAC,IAAI,CAAC,C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AC,KAAK,IAAI;IACrE,SAAS,EAAE,yBAAyB;CACrC,CAAC,CAAC","sourcesContent":["import {\n ACTION_CHAT_UI_DATA_CHART_RENDERER,\n ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER,\n ACTION_CHAT_UI_DATA_TABLE_RENDERER,\n ACTION_CHAT_UI_DATA_WIDGET_RENDERER,\n ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER,\n} from \"../../../action-ui.js\";\nimport {\n registerReservedActionChatRenderer,\n registerReservedFallbackToolRenderer,\n type ToolRendererContext,\n type ToolRendererComponent,\n} from \"../tool-render-registry.js\";\nimport {\n DATA_CHART_WIDGET,\n DATA_INSIGHTS_WIDGET,\n DATA_TABLE_WIDGET,\n normalizeDataWidgetKind,\n normalizeDataWidgetResult,\n type DataWidgetResult,\n} from \"./data-widget-types.js\";\nimport { DataChartWidget } from \"./DataChartWidget.js\";\nimport { DataInsightsWidget } from \"./DataInsightsWidget.js\";\nimport { DataTableWidget } from \"./DataTableWidget.js\";\nimport {\n InlineExtensionWidget,\n normalizeInlineExtensionToolResult,\n} from \"./InlineExtensionWidget.js\";\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction normalizeActionDataWidgetResult(\n context: ToolRendererContext,\n): DataWidgetResult | null {\n const result = normalizeDataWidgetResult(context.resultJson);\n if (result) return result;\n\n const renderer = context.chatUI?.renderer;\n if (\n renderer === ACTION_CHAT_UI_DATA_WIDGET_RENDERER ||\n context.toolName === \"render-data-widget\"\n ) {\n const argsResult = normalizeDataWidgetResult(context.args);\n if (argsResult) return argsResult;\n }\n\n if (!isRecord(context.resultJson)) return null;\n\n if (renderer === ACTION_CHAT_UI_DATA_TABLE_RENDERER) {\n return normalizeDataWidgetResult({\n widget: DATA_TABLE_WIDGET,\n table: isRecord(context.resultJson.table)\n ? context.resultJson.table\n : context.resultJson,\n display: isRecord(context.resultJson.display)\n ? context.resultJson.display\n : undefined,\n });\n }\n if (renderer === ACTION_CHAT_UI_DATA_CHART_RENDERER) {\n return normalizeDataWidgetResult({\n widget: DATA_CHART_WIDGET,\n chartSeries: isRecord(context.resultJson.chartSeries)\n ? context.resultJson.chartSeries\n : context.resultJson,\n display: isRecord(context.resultJson.display)\n ? context.resultJson.display\n : undefined,\n });\n }\n if (renderer === ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER) {\n return normalizeDataWidgetResult({\n ...context.resultJson,\n widget: DATA_INSIGHTS_WIDGET,\n });\n }\n\n return null;\n}\n\nfunction renderDataWidget(context: ToolRendererContext) {\n const result =\n normalizeActionDataWidgetResult(context) ??\n normalizeDataWidgetResult(context.resultJson);\n if (!result) return null;\n const widget = normalizeDataWidgetKind(result.widget);\n if (widget === DATA_TABLE_WIDGET && result.table) {\n return (\n <DataTableWidget\n table={result.table}\n action={result.display?.primaryAction}\n />\n );\n }\n if (widget === DATA_CHART_WIDGET && result.chartSeries) {\n return <DataChartWidget chart={result.chartSeries} />;\n }\n if (widget === DATA_INSIGHTS_WIDGET) {\n return <DataInsightsWidget result={result} />;\n }\n return null;\n}\n\nconst BuiltinDataWidgetRenderer: ToolRendererComponent = ({ context }) =>\n renderDataWidget(context);\n\nconst BuiltinInlineExtensionRenderer: ToolRendererComponent = ({ context }) =>\n normalizeInlineExtensionToolResult(context) ? (\n <InlineExtensionWidget context={context} />\n ) : null;\n\nexport function isBuiltinDataWidgetActionRenderer(\n context: ToolRendererContext,\n): boolean {\n const renderer = context.chatUI?.renderer;\n return (\n renderer === ACTION_CHAT_UI_DATA_TABLE_RENDERER ||\n renderer === ACTION_CHAT_UI_DATA_CHART_RENDERER ||\n renderer === ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER ||\n renderer === ACTION_CHAT_UI_DATA_WIDGET_RENDERER\n );\n}\n\nexport function resolveBuiltinActionChatRenderer(\n context: ToolRendererContext,\n): ToolRendererComponent | null {\n if (\n context.chatUI?.renderer === ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER &&\n normalizeInlineExtensionToolResult(context)\n ) {\n return BuiltinInlineExtensionRenderer;\n }\n if (\n isBuiltinDataWidgetActionRenderer(context) &&\n normalizeActionDataWidgetResult(context)\n ) {\n return BuiltinDataWidgetRenderer;\n }\n return null;\n}\n\nexport function resolveBuiltinFallbackToolRenderer(\n context: ToolRendererContext,\n): ToolRendererComponent | null {\n if (\n context.chatUI?.renderer === ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER &&\n normalizeInlineExtensionToolResult(context)\n ) {\n return BuiltinInlineExtensionRenderer;\n }\n return normalizeActionDataWidgetResult(context) !== null\n ? BuiltinDataWidgetRenderer\n : null;\n}\n\nfor (const [id, renderer] of [\n [\"core.data-table\", ACTION_CHAT_UI_DATA_TABLE_RENDERER],\n [\"core.data-chart\", ACTION_CHAT_UI_DATA_CHART_RENDERER],\n [\"core.data-insights\", ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER],\n [\"core.data-widget\", ACTION_CHAT_UI_DATA_WIDGET_RENDERER],\n [\"core.inline-extension\", ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER],\n] as const) {\n registerReservedActionChatRenderer({\n id,\n renderer,\n Component:\n renderer === ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER\n ? BuiltinInlineExtensionRenderer\n : BuiltinDataWidgetRenderer,\n });\n}\n\nregisterReservedFallbackToolRenderer({\n id: \"core.data-widgets\",\n match: (context) => normalizeActionDataWidgetResult(context) !== null,\n Component: BuiltinDataWidgetRenderer,\n});\n"]}
1
+ {"version":3,"file":"builtin-tool-renderers.js","sourceRoot":"","sources":["../../../../src/client/chat/widgets/builtin-tool-renderers.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,EAClC,mCAAmC,EACnC,wCAAwC,GACzC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,kCAAkC,EAClC,oCAAoC,GAGrC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAC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,yBAAyB;QAC3B,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,KAAK,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI;IAC3B,CAAC,iBAAiB,EAAE,kCAAkC,CAAC;IACvD,CAAC,iBAAiB,EAAE,kCAAkC,CAAC;IACvD,CAAC,oBAAoB,EAAE,qCAAqC,CAAC;IAC7D,CAAC,kBAAkB,EAAE,mCAAmC,CAAC;IACzD,CAAC,uBAAuB,EAAE,wCAAwC,CAAC;CAC3D,EAAE,CAAC;IACX,kCAAkC,CAAC;QACjC,EAAE;QACF,QAAQ;QACR,SAAS,EACP,QAAQ,KAAK,wCAAwC;YACnD,CAAC,CAAC,8BAA8B;YAChC,CAAC,CAAC,yBAAyB;KAChC,CAAC,CAAC;AACL,CAAC;AAED,oCAAoC,CAAC;IACnC,EAAE,EAAE,mBAAmB;IACvB,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,+BAA+B,CAAC,OAAO,CAAC,KAAK,IAAI;IACrE,SAAS,EAAE,yBAAyB;CACrC,CAAC,CAAC","sourcesContent":["import {\n ACTION_CHAT_UI_DATA_CHART_RENDERER,\n ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER,\n ACTION_CHAT_UI_DATA_TABLE_RENDERER,\n ACTION_CHAT_UI_DATA_WIDGET_RENDERER,\n ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER,\n} from \"../../../action-ui.js\";\nimport {\n registerReservedActionChatRenderer,\n registerReservedFallbackToolRenderer,\n type ToolRendererContext,\n type ToolRendererComponent,\n} from \"../tool-render-registry.js\";\nimport {\n DATA_CHART_WIDGET,\n DATA_INSIGHTS_WIDGET,\n DATA_TABLE_WIDGET,\n normalizeDataWidgetKind,\n normalizeDataWidgetResult,\n type DataWidgetResult,\n} from \"./data-widget-types.js\";\nimport { DataChartWidget } from \"./DataChartWidget.js\";\nimport { DataInsightsWidget } from \"./DataInsightsWidget.js\";\nimport { DataTableWidget } from \"./DataTableWidget.js\";\nimport {\n InlineExtensionWidget,\n normalizeInlineExtensionToolResult,\n} from \"./InlineExtensionWidget.js\";\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction normalizeActionDataWidgetResult(\n context: ToolRendererContext,\n): DataWidgetResult | null {\n const renderer = context.chatUI?.renderer;\n if (isRecord(context.resultJson)) {\n if (renderer === ACTION_CHAT_UI_DATA_TABLE_RENDERER) {\n return normalizeDataWidgetResult({\n ...context.resultJson,\n widget: DATA_TABLE_WIDGET,\n table: isRecord(context.resultJson.table)\n ? context.resultJson.table\n : context.resultJson,\n });\n }\n if (renderer === ACTION_CHAT_UI_DATA_CHART_RENDERER) {\n return normalizeDataWidgetResult({\n ...context.resultJson,\n widget: DATA_CHART_WIDGET,\n chartSeries: isRecord(context.resultJson.chartSeries)\n ? context.resultJson.chartSeries\n : context.resultJson,\n });\n }\n if (renderer === ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER) {\n return normalizeDataWidgetResult({\n ...context.resultJson,\n widget: DATA_INSIGHTS_WIDGET,\n });\n }\n }\n\n const result = normalizeDataWidgetResult(context.resultJson);\n if (result) return result;\n\n if (\n renderer === ACTION_CHAT_UI_DATA_WIDGET_RENDERER ||\n context.toolName === \"render-data-widget\"\n ) {\n const argsResult = normalizeDataWidgetResult(context.args);\n if (argsResult) return argsResult;\n }\n\n return null;\n}\n\nfunction renderDataWidget(context: ToolRendererContext) {\n const result =\n normalizeActionDataWidgetResult(context) ??\n normalizeDataWidgetResult(context.resultJson);\n if (!result) return null;\n const widget = normalizeDataWidgetKind(result.widget);\n if (widget === DATA_TABLE_WIDGET && result.table) {\n return (\n <DataTableWidget\n table={result.table}\n action={result.display?.primaryAction}\n />\n );\n }\n if (widget === DATA_CHART_WIDGET && result.chartSeries) {\n return <DataChartWidget chart={result.chartSeries} />;\n }\n if (widget === DATA_INSIGHTS_WIDGET) {\n return <DataInsightsWidget result={result} />;\n }\n return null;\n}\n\nconst BuiltinDataWidgetRenderer: ToolRendererComponent = ({ context }) =>\n renderDataWidget(context);\n\nconst BuiltinInlineExtensionRenderer: ToolRendererComponent = ({ context }) =>\n normalizeInlineExtensionToolResult(context) ? (\n <InlineExtensionWidget context={context} />\n ) : null;\n\nexport function isBuiltinDataWidgetActionRenderer(\n context: ToolRendererContext,\n): boolean {\n const renderer = context.chatUI?.renderer;\n return (\n renderer === ACTION_CHAT_UI_DATA_TABLE_RENDERER ||\n renderer === ACTION_CHAT_UI_DATA_CHART_RENDERER ||\n renderer === ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER ||\n renderer === ACTION_CHAT_UI_DATA_WIDGET_RENDERER\n );\n}\n\nexport function resolveBuiltinActionChatRenderer(\n context: ToolRendererContext,\n): ToolRendererComponent | null {\n if (\n context.chatUI?.renderer === ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER &&\n normalizeInlineExtensionToolResult(context)\n ) {\n return BuiltinInlineExtensionRenderer;\n }\n if (\n isBuiltinDataWidgetActionRenderer(context) &&\n normalizeActionDataWidgetResult(context)\n ) {\n return BuiltinDataWidgetRenderer;\n }\n return null;\n}\n\nexport function resolveBuiltinFallbackToolRenderer(\n context: ToolRendererContext,\n): ToolRendererComponent | null {\n if (\n context.chatUI?.renderer === ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER &&\n normalizeInlineExtensionToolResult(context)\n ) {\n return BuiltinInlineExtensionRenderer;\n }\n return normalizeActionDataWidgetResult(context) !== null\n ? BuiltinDataWidgetRenderer\n : null;\n}\n\nfor (const [id, renderer] of [\n [\"core.data-table\", ACTION_CHAT_UI_DATA_TABLE_RENDERER],\n [\"core.data-chart\", ACTION_CHAT_UI_DATA_CHART_RENDERER],\n [\"core.data-insights\", ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER],\n [\"core.data-widget\", ACTION_CHAT_UI_DATA_WIDGET_RENDERER],\n [\"core.inline-extension\", ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER],\n] as const) {\n registerReservedActionChatRenderer({\n id,\n renderer,\n Component:\n renderer === ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER\n ? BuiltinInlineExtensionRenderer\n : BuiltinDataWidgetRenderer,\n });\n}\n\nregisterReservedFallbackToolRenderer({\n id: \"core.data-widgets\",\n match: (context) => normalizeActionDataWidgetResult(context) !== null,\n Component: BuiltinDataWidgetRenderer,\n});\n"]}
@@ -20,6 +20,10 @@ export interface RunStuckState {
20
20
  stuckSinceMs: number | null;
21
21
  /** Server timestamp (ms) of the last process-alive heartbeat. */
22
22
  heartbeatAt: number | null;
23
+ /** Milliseconds since `heartbeatAt`, computed against the server clock. */
24
+ heartbeatSinceMs: number | null;
25
+ /** How the run was dispatched, e.g. foreground or background-processing. */
26
+ dispatchMode: string | null;
23
27
  }
24
28
  export interface UseRunStuckDetectionOptions {
25
29
  /** The thread to monitor. Pass null/undefined to disable polling. */
@@ -1 +1 @@
1
- {"version":3,"file":"use-run-stuck-detection.d.ts","sourceRoot":"","sources":["../../src/client/use-run-stuck-detection.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,8EAA8E;IAC9E,OAAO,EAAE,OAAO,CAAC;IACjB,+DAA+D;IAC/D,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,2EAA2E;IAC3E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,4EAA4E;IAC5E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,oDAAoD;IACpD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iEAAiE;IACjE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,2BAA2B;IAC1C,qEAAqE;IACrE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sCAAsC;IACtC,cAAc,C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EACnC,QAAQ,EACR,gBAA6C,EAC7C,cAAyC,EACzC,MAAM,GACP,EAAE,2BAA2B,GAAG,aAAa,CAgF7C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,WAEzB,MAAM,WAAU,MAAM,KAAY,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoBzE"}
@@ -10,6 +10,8 @@ const EMPTY_STATE = {
10
10
  lastProgressAt: null,
11
11
  stuckSinceMs: null,
12
12
  heartbeatAt: null,
13
+ heartbeatSinceMs: null,
14
+ dispatchMode: null,
13
15
  };
14
16
  export function useRunStuckDetection({ threadId, stuckThresholdMs = DEFAULT_STUCK_THRESHOLD_MS, pollIntervalMs = DEFAULT_POLL_INTERVAL_MS, apiUrl, }) {
15
17
  const [state, setState] = useState(EMPTY_STATE);
@@ -40,6 +42,8 @@ export function useRunStuckDetection({ threadId, stuckThresholdMs = DEFAULT_STUC
40
42
  // the client clock for older bundles that don't send serverNow.
41
43
  const nowMs = data.serverNow ?? Date.now();
42
44
  const stuckSinceMs = lastProgressAt != null ? nowMs - lastProgressAt : null;
45
+ const heartbeatAt = data.heartbeatAt ?? null;
46
+ const heartbeatSinceMs = heartbeatAt != null ? nowMs - heartbeatAt : null;
43
47
  const isStuck = Boolean(data.active &&
44
48
  data.status === "running" &&
45
49
  stuckSinceMs != null &&
@@ -50,7 +54,9 @@ export function useRunStuckDetection({ threadId, stuckThresholdMs = DEFAULT_STUC
50
54
  status: data.status ?? null,
51
55
  lastProgressAt,
52
56
  stuckSinceMs,
53
- heartbeatAt: data.heartbeatAt ?? null,
57
+ heartbeatAt,
58
+ heartbeatSinceMs,
59
+ dispatchMode: typeof data.dispatchMode === "string" ? data.dispatchMode : null,
54
60
  });
55
61
  // Back off polling when nothing is in flight — there's no point
56
62
  // hammering the endpoint while the chat is idle. We still poll
@@ -1 +1 @@
1
- {"version":3,"file":"use-run-stuck-detection.js","sourceRoot":"","sources":["../../src/client/use-run-st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nE,uBAAuB;QACvB,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAEhC,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;YACjB,IAAI,KAAK;gBAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;IAEzD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,MAAe;IACzC,OAAO,WAAW,CAChB,KAAK,EAAE,KAAa,EAAE,MAAM,GAAW,MAAM,EAA0B,EAAE;QACvE,MAAM,IAAI,GAAG,MAAM,IAAI,eAAe,CAAC,2BAA2B,CAAC,CAAC;QACpE,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,KAAK,CACrB,GAAG,IAAI,SAAS,kBAAkB,CAAC,KAAK,CAAC,QAAQ,EACjD;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;gBAC/C,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;aACjC,CACF,CAAC;YACF,IAAI,CAAC,GAAG,CAAC,EAAE;gBAAE,OAAO,IAAI,CAAC;YACzB,OAAO,KAAK,CAAC;QACf,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useState, useCallback } from \"react\";\n\nimport { agentNativePath } from \"./api-path.js\";\n\n/**\n * Per-thread chat run health, derived from the durable `last_progress_at`\n * timestamp on the server. Drives the user-visible \"this chat looks stuck\"\n * affordance — distinct from the silent reconnect logic in\n * `agent-chat-adapter.ts`, which keeps trying in the background. When\n * automatic recovery isn't making progress (for whatever reason), this\n * hook surfaces a Retry / Cancel button to the user instead of leaving\n * them staring at a frozen spinner.\n */\nexport interface RunStuckState {\n /** True when an active run hasn't emitted an event for `stuckThresholdMs`. */\n isStuck: boolean;\n /** ID of the active run, or null when nothing is in flight. */\n runId: string | null;\n /** Server-side run status (\"running\" / \"completed\" / \"errored\" / etc.). */\n status: string | null;\n /** Server timestamp (ms) of the last emitted event, or null if none yet. */\n lastProgressAt: number | null;\n /** Milliseconds since `lastProgressAt`, or null. */\n stuckSinceMs: number | null;\n /** Server timestamp (ms) of the last process-alive heartbeat. */\n heartbeatAt: number | null;\n}\n\nexport interface UseRunStuckDetectionOptions {\n /** The thread to monitor. Pass null/undefined to disable polling. */\n threadId: string | null | undefined;\n /**\n * Threshold above which an in-flight run is considered stuck. The default\n * sits comfortably above the adapter's 75s no-progress reconnect — by then\n * automatic recovery has already had its chance.\n */\n stuckThresholdMs?: number;\n /** Poll interval. Default 5_000ms. */\n pollIntervalMs?: number;\n /** API base path. Default `/_agent-native/agent-chat`. */\n apiUrl?: string;\n}\n\nconst DEFAULT_STUCK_THRESHOLD_MS = 90_000;\nconst DEFAULT_POLL_INTERVAL_MS = 5_000;\nconst IDLE_BACKOFF_INTERVAL_MS = 15_000;\n\ninterface ActiveRunResponse {\n active: boolean;\n runId?: string;\n status?: string;\n heartbeatAt: number | null;\n lastProgressAt?: number | null;\n /** Server clock at response time, used to compute elapsed server-relative. */\n serverNow?: number;\n}\n\nconst EMPTY_STATE: RunStuckState = {\n isStuck: false,\n runId: null,\n status: null,\n lastProgressAt: null,\n stuckSinceMs: null,\n heartbeatAt: null,\n};\n\nexport function useRunStuckDetection({\n threadId,\n stuckThresholdMs = DEFAULT_STUCK_THRESHOLD_MS,\n pollIntervalMs = DEFAULT_POLL_INTERVAL_MS,\n apiUrl,\n}: UseRunStuckDetectionOptions): RunStuckState {\n const [state, setState] = useState<RunStuckState>(EMPTY_STATE);\n\n useEffect(() => {\n // Reset on every thread change so the previous thread's stuck banner\n // doesn't bleed onto the new one before the first poll completes.\n setState(EMPTY_STATE);\n if (!threadId) return;\n\n const base = apiUrl ?? agentNativePath(\"/_agent-native/agent-chat\");\n let cancelled = false;\n let timer: ReturnType<typeof setTimeout> | null = null;\n\n const poll = async () => {\n if (cancelled) return;\n let nextDelay = pollIntervalMs;\n try {\n const res = await fetch(\n `${base}/runs/active?threadId=${encodeURIComponent(threadId)}`,\n { credentials: \"same-origin\" },\n );\n if (cancelled) return;\n if (res.ok) {\n const data = (await res.json()) as ActiveRunResponse;\n const lastProgressAt = data.lastProgressAt ?? null;\n // Measure elapsed against the SERVER clock (serverNow) rather than the\n // client's Date.now(). lastProgressAt is a server timestamp, so client\n // clock skew of more than stuckThresholdMs would otherwise mark every\n // run stuck (clock ahead) or never stuck (clock behind). Fall back to\n // the client clock for older bundles that don't send serverNow.\n const nowMs = data.serverNow ?? Date.now();\n const stuckSinceMs =\n lastProgressAt != null ? nowMs - lastProgressAt : null;\n const isStuck = Boolean(\n data.active &&\n data.status === \"running\" &&\n stuckSinceMs != null &&\n stuckSinceMs > stuckThresholdMs,\n );\n setState({\n isStuck,\n runId: data.runId ?? null,\n status: data.status ?? null,\n lastProgressAt,\n stuckSinceMs,\n heartbeatAt: data.heartbeatAt ?? null,\n });\n // Back off polling when nothing is in flight — there's no point\n // hammering the endpoint while the chat is idle. We still poll\n // occasionally so a fresh run started in another tab is picked up.\n if (!data.active || data.status !== \"running\") {\n nextDelay = IDLE_BACKOFF_INTERVAL_MS;\n }\n }\n } catch {\n // Network blip — leave previous state. Next tick will retry.\n }\n if (!cancelled) {\n timer = setTimeout(poll, nextDelay);\n }\n };\n\n // Stagger the first poll so a freshly-started run isn't immediately\n // classified as stuck before the server has had a chance to record\n // any progress events.\n timer = setTimeout(poll, 2_000);\n\n return () => {\n cancelled = true;\n if (timer) clearTimeout(timer);\n };\n }, [threadId, stuckThresholdMs, pollIntervalMs, apiUrl]);\n\n return state;\n}\n\n/**\n * POST `/runs/:id/abort` so the server flips the run to \"aborted\" and the\n * adapter's reconnect loop exits cleanly. Returns the run id that was\n * aborted (or null on failure) so callers can correlate observability\n * events. Best-effort — failures are swallowed, since the user's intent\n * is already captured locally.\n */\nexport function useAbortRun(apiUrl?: string) {\n return useCallback(\n async (runId: string, reason: string = \"user\"): Promise<string | null> => {\n const base = apiUrl ?? agentNativePath(\"/_agent-native/agent-chat\");\n try {\n const res = await fetch(\n `${base}/runs/${encodeURIComponent(runId)}/abort`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"same-origin\",\n body: JSON.stringify({ reason }),\n },\n );\n if (!res.ok) return null;\n return runId;\n } catch {\n return null;\n }\n },\n [apiUrl],\n );\n}\n"]}
1
+ {"version":3,"file":"use-run-stuck-detection.js","sourceRoot":"","sources":["../../src/client/use-run-stuck-detection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA6ChD,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAC1C,MAAM,wBAAwB,GAAG,KAAK,CAAC;AACvC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAaxC,MAAM,WAAW,GAAkB;IACjC,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;IACjB,gBAAgB,EAAE,IAAI;IACtB,YAAY,EAAE,IAAI;CACnB,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,EACnC,QAAQ,EACR,gBAAgB,GAAG,0BAA0B,EAC7C,cAAc,GAAG,wBAAwB,EACzC,MAAM,GACsB;IAC5B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,WAAW,CAAC,CAAC;IAE/D,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WAAW,CAChB,KAAK,EAAE,KAAa,EAAE,MAAM,GAAW,MAAM,EAA0B,EAAE;QACvE,MAAM,IAAI,GAAG,MAAM,IAAI,eAAe,CAAC,2BAA2B,CAAC,CAAC;QACpE,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,KAAK,CACrB,GAAG,IAAI,SAAS,kBAAkB,CAAC,KAAK,CAAC,QAAQ,EACjD;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;gBAC/C,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;aACjC,CACF,CAAC;YACF,IAAI,CAAC,GAAG,CAAC,EAAE;gBAAE,OAAO,IAAI,CAAC;YACzB,OAAO,KAAK,CAAC;QACf,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useState, useCallback } from \"react\";\n\nimport { agentNativePath } from \"./api-path.js\";\n\n/**\n * Per-thread chat run health, derived from the durable `last_progress_at`\n * timestamp on the server. Drives the user-visible \"this chat looks stuck\"\n * affordance — distinct from the silent reconnect logic in\n * `agent-chat-adapter.ts`, which keeps trying in the background. When\n * automatic recovery isn't making progress (for whatever reason), this\n * hook surfaces a Retry / Cancel button to the user instead of leaving\n * them staring at a frozen spinner.\n */\nexport interface RunStuckState {\n /** True when an active run hasn't emitted an event for `stuckThresholdMs`. */\n isStuck: boolean;\n /** ID of the active run, or null when nothing is in flight. */\n runId: string | null;\n /** Server-side run status (\"running\" / \"completed\" / \"errored\" / etc.). */\n status: string | null;\n /** Server timestamp (ms) of the last emitted event, or null if none yet. */\n lastProgressAt: number | null;\n /** Milliseconds since `lastProgressAt`, or null. */\n stuckSinceMs: number | null;\n /** Server timestamp (ms) of the last process-alive heartbeat. */\n heartbeatAt: number | null;\n /** Milliseconds since `heartbeatAt`, computed against the server clock. */\n heartbeatSinceMs: number | null;\n /** How the run was dispatched, e.g. foreground or background-processing. */\n dispatchMode: string | null;\n}\n\nexport interface UseRunStuckDetectionOptions {\n /** The thread to monitor. Pass null/undefined to disable polling. */\n threadId: string | null | undefined;\n /**\n * Threshold above which an in-flight run is considered stuck. The default\n * sits comfortably above the adapter's 75s no-progress reconnect — by then\n * automatic recovery has already had its chance.\n */\n stuckThresholdMs?: number;\n /** Poll interval. Default 5_000ms. */\n pollIntervalMs?: number;\n /** API base path. Default `/_agent-native/agent-chat`. */\n apiUrl?: string;\n}\n\nconst DEFAULT_STUCK_THRESHOLD_MS = 90_000;\nconst DEFAULT_POLL_INTERVAL_MS = 5_000;\nconst IDLE_BACKOFF_INTERVAL_MS = 15_000;\n\ninterface ActiveRunResponse {\n active: boolean;\n runId?: string;\n status?: string;\n heartbeatAt: number | null;\n lastProgressAt?: number | null;\n dispatchMode?: string | null;\n /** Server clock at response time, used to compute elapsed server-relative. */\n serverNow?: number;\n}\n\nconst EMPTY_STATE: RunStuckState = {\n isStuck: false,\n runId: null,\n status: null,\n lastProgressAt: null,\n stuckSinceMs: null,\n heartbeatAt: null,\n heartbeatSinceMs: null,\n dispatchMode: null,\n};\n\nexport function useRunStuckDetection({\n threadId,\n stuckThresholdMs = DEFAULT_STUCK_THRESHOLD_MS,\n pollIntervalMs = DEFAULT_POLL_INTERVAL_MS,\n apiUrl,\n}: UseRunStuckDetectionOptions): RunStuckState {\n const [state, setState] = useState<RunStuckState>(EMPTY_STATE);\n\n useEffect(() => {\n // Reset on every thread change so the previous thread's stuck banner\n // doesn't bleed onto the new one before the first poll completes.\n setState(EMPTY_STATE);\n if (!threadId) return;\n\n const base = apiUrl ?? agentNativePath(\"/_agent-native/agent-chat\");\n let cancelled = false;\n let timer: ReturnType<typeof setTimeout> | null = null;\n\n const poll = async () => {\n if (cancelled) return;\n let nextDelay = pollIntervalMs;\n try {\n const res = await fetch(\n `${base}/runs/active?threadId=${encodeURIComponent(threadId)}`,\n { credentials: \"same-origin\" },\n );\n if (cancelled) return;\n if (res.ok) {\n const data = (await res.json()) as ActiveRunResponse;\n const lastProgressAt = data.lastProgressAt ?? null;\n // Measure elapsed against the SERVER clock (serverNow) rather than the\n // client's Date.now(). lastProgressAt is a server timestamp, so client\n // clock skew of more than stuckThresholdMs would otherwise mark every\n // run stuck (clock ahead) or never stuck (clock behind). Fall back to\n // the client clock for older bundles that don't send serverNow.\n const nowMs = data.serverNow ?? Date.now();\n const stuckSinceMs =\n lastProgressAt != null ? nowMs - lastProgressAt : null;\n const heartbeatAt = data.heartbeatAt ?? null;\n const heartbeatSinceMs =\n heartbeatAt != null ? nowMs - heartbeatAt : null;\n const isStuck = Boolean(\n data.active &&\n data.status === \"running\" &&\n stuckSinceMs != null &&\n stuckSinceMs > stuckThresholdMs,\n );\n setState({\n isStuck,\n runId: data.runId ?? null,\n status: data.status ?? null,\n lastProgressAt,\n stuckSinceMs,\n heartbeatAt,\n heartbeatSinceMs,\n dispatchMode:\n typeof data.dispatchMode === \"string\" ? data.dispatchMode : null,\n });\n // Back off polling when nothing is in flight — there's no point\n // hammering the endpoint while the chat is idle. We still poll\n // occasionally so a fresh run started in another tab is picked up.\n if (!data.active || data.status !== \"running\") {\n nextDelay = IDLE_BACKOFF_INTERVAL_MS;\n }\n }\n } catch {\n // Network blip — leave previous state. Next tick will retry.\n }\n if (!cancelled) {\n timer = setTimeout(poll, nextDelay);\n }\n };\n\n // Stagger the first poll so a freshly-started run isn't immediately\n // classified as stuck before the server has had a chance to record\n // any progress events.\n timer = setTimeout(poll, 2_000);\n\n return () => {\n cancelled = true;\n if (timer) clearTimeout(timer);\n };\n }, [threadId, stuckThresholdMs, pollIntervalMs, apiUrl]);\n\n return state;\n}\n\n/**\n * POST `/runs/:id/abort` so the server flips the run to \"aborted\" and the\n * adapter's reconnect loop exits cleanly. Returns the run id that was\n * aborted (or null on failure) so callers can correlate observability\n * events. Best-effort — failures are swallowed, since the user's intent\n * is already captured locally.\n */\nexport function useAbortRun(apiUrl?: string) {\n return useCallback(\n async (runId: string, reason: string = \"user\"): Promise<string | null> => {\n const base = apiUrl ?? agentNativePath(\"/_agent-native/agent-chat\");\n try {\n const res = await fetch(\n `${base}/runs/${encodeURIComponent(runId)}/abort`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"same-origin\",\n body: JSON.stringify({ reason }),\n },\n );\n if (!res.ok) return null;\n return runId;\n } catch {\n return null;\n }\n },\n [apiUrl],\n );\n}\n"]}
@@ -49,11 +49,11 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
49
49
  error: string;
50
50
  states?: undefined;
51
51
  } | {
52
+ error?: undefined;
52
53
  states: {
53
54
  clientId: number;
54
55
  state: string;
55
56
  }[];
56
- error?: undefined;
57
57
  }>>;
58
58
  /**
59
59
  * GET /_agent-native/collab/:docId/users
@@ -64,10 +64,10 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
64
64
  error: string;
65
65
  users?: undefined;
66
66
  } | {
67
+ error?: undefined;
67
68
  users: {
68
69
  clientId: number;
69
70
  lastSeen: number;
70
71
  }[];
71
- error?: undefined;
72
72
  }>>;
73
73
  //# sourceMappingURL=awareness.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"awareness.d.ts","sourceRoot":"","sources":["../../src/collab/awareness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAS3C,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAOD,eAAO,MAAM,sBAAsB,EAAG,kBAA2B,CAAC;AAElE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,E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AE,WAAW,CAAC;IACpB,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,MAAM,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAKD,wBAAgB,mBAAmB,IAAI,YAAY,CAElD;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EAClD,KAAK,CAAC,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,GACb,IAAI,CAUN;AAKD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAO1E;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,IAAI,CAOnE;AAUD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;;;;kBAuCa,MAAM;eAAS,MAAM;;GAa1D,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;kBAWM,MAAM;kBAAY,MAAM;;GAMvD,CAAC"}
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
26
26
  * Body: { update: string (base64), requestSource?: string }
27
27
  */
28
28
  export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
29
- error: string;
30
29
  ok?: undefined;
30
+ error: string;
31
31
  } | {
32
32
  error?: undefined;
33
33
  ok: boolean;
@@ -15,11 +15,12 @@
15
15
  * createdAt: text("created_at").notNull().default(now()),
16
16
  * });
17
17
  */
18
- import { sqliteTable, index as sqliteIndex, text as sqliteText, integer as sqliteInteger, real as sqliteReal, uniqueIndex as sqliteUniqueIndex } from "drizzle-orm/sqlite-core";
18
+ import { sqliteTable, alias as sqliteAlias, index as sqliteIndex, text as sqliteText, integer as sqliteInteger, real as sqliteReal, uniqueIndex as sqliteUniqueIndex } from "drizzle-orm/sqlite-core";
19
19
  /**
20
20
  * Define a table. Delegates to `pgTable` or `sqliteTable` based on dialect.
21
21
  */
22
22
  export declare const table: typeof sqliteTable;
23
+ export declare const alias: typeof sqliteAlias;
23
24
  export declare const index: typeof sqliteIndex;
24
25
  export declare const uniqueIndex: typeof sqliteUniqueIndex;
25
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAYH,OAAO,EACL,WAAW,EACX,KAAK,IAAI,WAAW,EACpB,IAAI,IAAI,UAAU,EAClB,OAAO,IAAI,aAAa,EACxB,IAAI,IAAI,UAAU,EAClB,WAAW,IAAI,iBAAiB,EACjC,MAAM,yBAAyB,CAAC;AAWjC;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,OAAO,WAC+C,CAAC;AAE3E,eAAO,MAAM,KAAK,EAAE,OAAO,WAC+C,CAAC;AAE3E,eAAO,MAAM,WAAW,EAAE,OAAO,iBAGgB,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,OAAO,UAC8C,CAAC;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,OAAO,aAKpB,CAAC;AAEV;;;;;GAKG;AACH,eAAO,MAAM,IAAI,EAAE,OAAO,UAIjB,CAAC;AAEV;;;;;;GAMG;AACH,wBAAgB,GAAG,uCAElB;AAED,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAKtE,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAaH,OAAO,EACL,WAAW,EACX,KAAK,IAAI,WAAW,EACpB,KAAK,IAAI,WAAW,EACpB,IAAI,IAAI,UAAU,EAClB,OAAO,IAAI,aAAa,EACxB,IAAI,IAAI,UAAU,EAClB,WAAW,IAAI,iBAAiB,EACjC,MAAM,yBAAyB,CAAC;AAWjC;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,OAAO,WAC+C,CAAC;AAE3E,eAAO,MAAM,KAAK,EAAE,OAAO,WAC+C,CAAC;AAE3E,eAAO,MAAM,KAAK,EAAE,OAAO,WAC+C,CAAC;AAE3E,eAAO,MAAM,WAAW,EAAE,OAAO,iBAGgB,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,OAAO,UAC8C,CAAC;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,OAAO,aAKpB,CAAC;AAEV;;;;;GAKG;AACH,eAAO,MAAM,IAAI,EAAE,OAAO,UAIjB,CAAC;AAEV;;;;;;GAMG;AACH,wBAAgB,GAAG,uCAElB;AAED,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAKtE,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAC"}
package/dist/db/schema.js CHANGED
@@ -16,8 +16,8 @@
16
16
  * });
17
17
  */
18
18
  import { sql } from "drizzle-orm";
19
- import { pgTable, index as pgIndex, text as pgText, integer as pgInteger, boolean as pgBoolean, doublePrecision as pgDoublePrecision, uniqueIndex as pgUniqueIndex, } from "drizzle-orm/pg-core";
20
- import { sqliteTable, index as sqliteIndex, text as sqliteText, integer as sqliteInteger, real as sqliteReal, uniqueIndex as sqliteUniqueIndex, } from "drizzle-orm/sqlite-core";
19
+ import { pgTable, alias as pgAlias, index as pgIndex, text as pgText, integer as pgInteger, boolean as pgBoolean, doublePrecision as pgDoublePrecision, uniqueIndex as pgUniqueIndex, } from "drizzle-orm/pg-core";
20
+ import { sqliteTable, alias as sqliteAlias, index as sqliteIndex, text as sqliteText, integer as sqliteInteger, real as sqliteReal, uniqueIndex as sqliteUniqueIndex, } from "drizzle-orm/sqlite-core";
21
21
  import { getDialect } from "./client.js";
22
22
  // No caching — getDialect() handles its own caching once env is available.
23
23
  // On CF Workers, this runs at import time before env bindings are set, so
@@ -29,6 +29,7 @@ function pg() {
29
29
  * Define a table. Delegates to `pgTable` or `sqliteTable` based on dialect.
30
30
  */
31
31
  export const table = ((...args) => pg() ? pgTable(...args) : sqliteTable(...args));
32
+ export const alias = ((...args) => pg() ? pgAlias(...args) : sqliteAlias(...args));
32
33
  export const index = ((...args) => pg() ? pgIndex(...args) : sqliteIndex(...args));
33
34
  export const uniqueIndex = ((...args) => pg()
34
35
  ? pgUniqueIndex(...args)
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EACL,OAAO,EACP,KAAK,IAAI,OAAO,EAChB,IAAI,IAAI,MAAM,EACd,OAAO,IAAI,SAAS,EACpB,OAAO,IAAI,SAAS,EACpB,eAAe,IAAI,iBAAiB,EACpC,WAAW,IAAI,aAAa,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EACX,KAAK,IAAI,WAAW,EACpB,IAA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EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,SAAS,EAAE,CAAC;QACxC,OAAQ,SAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,EAAE,EAAE,CAAC,CAAC,CAAE,SAAiB,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAE,aAAqB,CAAC,GAAG,IAAI,CAAC,CAAC;AAC9E,CAAC,CAAQ,CAAC;AAEV;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAsB,CAAC,CAAC,GAAG,IAAW,EAAE,EAAE;IACzD,OAAO,EAAE,EAAE;QACT,CAAC,CAAE,iBAAyB,CAAC,GAAG,IAAI,CAAC;QACrC,CAAC,CAAE,UAAkB,CAAC,GAAG,IAAI,CAAC,CAAC;AACnC,CAAC,CAAQ,CAAC;AAEV;;;;;;GAMG;AACH,MAAM,UAAU,GAAG;IACjB,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA,OAAO,CAAC,CAAC,CAAC,GAAG,CAAA,mBAAmB,CAAC;AACpD,CAAC;AAED,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEtE,+EAA+E;AAC/E,6EAA6E;AAC7E,iEAAiE;AACjE,OAAO,EACL,cAAc,EACd,iBAAiB,GAIlB,MAAM,sBAAsB,CAAC","sourcesContent":["/**\n * Dialect-agnostic Drizzle schema helpers.\n *\n * Templates import `table`, `text`, `integer`, and `now` from here instead of\n * importing directly from `drizzle-orm/sqlite-core` or `drizzle-orm/pg-core`.\n * The correct dialect is chosen at runtime based on `DATABASE_URL`.\n *\n * Usage:\n * import { table, text, integer, now } from \"@agent-native/core/db/schema\";\n *\n * export const users = table(\"users\", {\n * id: text(\"id\").primaryKey(),\n * name: text(\"name\").notNull(),\n * active: integer(\"active\", { mode: \"boolean\" }).notNull().default(true),\n * createdAt: text(\"created_at\").notNull().default(now()),\n * });\n */\n\nimport { sql } from \"drizzle-orm\";\nimport {\n pgTable,\n index as pgIndex,\n text as pgText,\n integer as pgInteger,\n boolean as pgBoolean,\n doublePrecision as pgDoublePrecision,\n uniqueIndex as pgUniqueIndex,\n} from \"drizzle-orm/pg-core\";\nimport {\n sqliteTable,\n index as sqliteIndex,\n text as sqliteText,\n integer as sqliteInteger,\n real as sqliteReal,\n uniqueIndex as sqliteUniqueIndex,\n} from \"drizzle-orm/sqlite-core\";\n\nimport { getDialect } from \"./client.js\";\n\n// No caching — getDialect() handles its own caching once env is available.\n// On CF Workers, this runs at import time before env bindings are set, so\n// caching here would lock in the wrong dialect.\nfunction pg(): boolean {\n return getDialect() === \"postgres\";\n}\n\n/**\n * Define a table. Delegates to `pgTable` or `sqliteTable` based on dialect.\n */\nexport const table: typeof sqliteTable = ((...args: any[]) =>\n pg() ? (pgTable as any)(...args) : (sqliteTable as any)(...args)) as any;\n\nexport const index: typeof sqliteIndex = ((...args: any[]) =>\n pg() ? (pgIndex as any)(...args) : (sqliteIndex as any)(...args)) as any;\n\nexport const uniqueIndex: typeof sqliteUniqueIndex = ((...args: any[]) =>\n pg()\n ? (pgUniqueIndex as any)(...args)\n : (sqliteUniqueIndex as any)(...args)) as any;\n\n/**\n * Text column. Works identically in both dialects.\n * Supports `{ enum: [...] }` config in both.\n */\nexport const text: typeof sqliteText = ((...args: any[]) =>\n pg() ? (pgText as any)(...args) : (sqliteText as any)(...args)) as any;\n\n/**\n * Integer column.\n *\n * Handles `{ mode: \"boolean\" }` transparently — maps to Postgres `boolean`\n * type when running against Postgres, and SQLite `integer` with boolean\n * coercion when running against SQLite.\n */\nexport const integer: typeof sqliteInteger = ((...args: any[]) => {\n if (pg() && args[1]?.mode === \"boolean\") {\n return (pgBoolean as any)(args[0]);\n }\n return pg() ? (pgInteger as any)(...args) : (sqliteInteger as any)(...args);\n}) as any;\n\n/**\n * Real/float column.\n *\n * Maps to `real` on SQLite and `double precision` on Postgres.\n * Use for decimal values like weight, macros, etc.\n */\nexport const real: typeof sqliteReal = ((...args: any[]) => {\n return pg()\n ? (pgDoublePrecision as any)(...args)\n : (sqliteReal as any)(...args);\n}) as any;\n\n/**\n * Dialect-agnostic \"current timestamp\" SQL expression.\n * Use with `.default(now())` on text columns storing timestamps.\n *\n * - Postgres: `now()`\n * - SQLite: `(datetime('now'))`\n */\nexport function now() {\n return pg() ? sql`now()` : sql`(datetime('now'))`;\n}\n\nexport { and, desc, eq, inArray, isNull, or, sql } from \"drizzle-orm\";\n\n// Ownership / sharing primitives — templates opt a resource into the framework\n// sharing system by spreading ownableColumns() into the table and pairing it\n// with createSharesTable(). See .agents/skills/sharing/SKILL.md.\nexport {\n ownableColumns,\n createSharesTable,\n type Visibility,\n type ShareRole,\n type PrincipalType,\n} from \"../sharing/schema.js\";\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EACL,OAAO,EACP,KAAK,IAAI,OAAO,EAChB,KAAK,IAAI,OAAO,EAChB,IAAI,IAAI,MAAM,EACd,OAAO,IAAI,SAAS,EACpB,OAAO,IAAI,SAAS,EACpB,eAAe,IAAI,iBAAiB,EACpC,WAAW,IAAI,aAAa,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EACX,KAAK,IAAI,WAAW,EACpB,KAAK,IAAI,WAAW,EACpB,IAAI,IAAI,UAAU,EAClB,OAAO,IAAI,aAAa,EACxB,IAAI,IAAI,UAAU,EAClB,WAAW,IAAI,iBAAiB,GACjC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,2EAA2E;AAC3E,0EAA0E;AAC1E,gDAAgD;AAChD,SAAS,EAAE;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AAC,CAAC,EAAE,IAAI,KAAK,SAAS,EAAE,CAAC;QACxC,OAAQ,SAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,EAAE,EAAE,CAAC,CAAC,CAAE,SAAiB,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAE,aAAqB,CAAC,GAAG,IAAI,CAAC,CAAC;AAC9E,CAAC,CAAQ,CAAC;AAEV;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAsB,CAAC,CAAC,GAAG,IAAW,EAAE,EAAE;IACzD,OAAO,EAAE,EAAE;QACT,CAAC,CAAE,iBAAyB,CAAC,GAAG,IAAI,CAAC;QACrC,CAAC,CAAE,UAAkB,CAAC,GAAG,IAAI,CAAC,CAAC;AACnC,CAAC,CAAQ,CAAC;AAEV;;;;;;GAMG;AACH,MAAM,UAAU,GAAG;IACjB,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA,OAAO,CAAC,CAAC,CAAC,GAAG,CAAA,mBAAmB,CAAC;AACpD,CAAC;AAED,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEtE,+EAA+E;AAC/E,6EAA6E;AAC7E,iEAAiE;AACjE,OAAO,EACL,cAAc,EACd,iBAAiB,GAIlB,MAAM,sBAAsB,CAAC","sourcesContent":["/**\n * Dialect-agnostic Drizzle schema helpers.\n *\n * Templates import `table`, `text`, `integer`, and `now` from here instead of\n * importing directly from `drizzle-orm/sqlite-core` or `drizzle-orm/pg-core`.\n * The correct dialect is chosen at runtime based on `DATABASE_URL`.\n *\n * Usage:\n * import { table, text, integer, now } from \"@agent-native/core/db/schema\";\n *\n * export const users = table(\"users\", {\n * id: text(\"id\").primaryKey(),\n * name: text(\"name\").notNull(),\n * active: integer(\"active\", { mode: \"boolean\" }).notNull().default(true),\n * createdAt: text(\"created_at\").notNull().default(now()),\n * });\n */\n\nimport { sql } from \"drizzle-orm\";\nimport {\n pgTable,\n alias as pgAlias,\n index as pgIndex,\n text as pgText,\n integer as pgInteger,\n boolean as pgBoolean,\n doublePrecision as pgDoublePrecision,\n uniqueIndex as pgUniqueIndex,\n} from \"drizzle-orm/pg-core\";\nimport {\n sqliteTable,\n alias as sqliteAlias,\n index as sqliteIndex,\n text as sqliteText,\n integer as sqliteInteger,\n real as sqliteReal,\n uniqueIndex as sqliteUniqueIndex,\n} from \"drizzle-orm/sqlite-core\";\n\nimport { getDialect } from \"./client.js\";\n\n// No caching — getDialect() handles its own caching once env is available.\n// On CF Workers, this runs at import time before env bindings are set, so\n// caching here would lock in the wrong dialect.\nfunction pg(): boolean {\n return getDialect() === \"postgres\";\n}\n\n/**\n * Define a table. Delegates to `pgTable` or `sqliteTable` based on dialect.\n */\nexport const table: typeof sqliteTable = ((...args: any[]) =>\n pg() ? (pgTable as any)(...args) : (sqliteTable as any)(...args)) as any;\n\nexport const alias: typeof sqliteAlias = ((...args: any[]) =>\n pg() ? (pgAlias as any)(...args) : (sqliteAlias as any)(...args)) as any;\n\nexport const index: typeof sqliteIndex = ((...args: any[]) =>\n pg() ? (pgIndex as any)(...args) : (sqliteIndex as any)(...args)) as any;\n\nexport const uniqueIndex: typeof sqliteUniqueIndex = ((...args: any[]) =>\n pg()\n ? (pgUniqueIndex as any)(...args)\n : (sqliteUniqueIndex as any)(...args)) as any;\n\n/**\n * Text column. Works identically in both dialects.\n * Supports `{ enum: [...] }` config in both.\n */\nexport const text: typeof sqliteText = ((...args: any[]) =>\n pg() ? (pgText as any)(...args) : (sqliteText as any)(...args)) as any;\n\n/**\n * Integer column.\n *\n * Handles `{ mode: \"boolean\" }` transparently — maps to Postgres `boolean`\n * type when running against Postgres, and SQLite `integer` with boolean\n * coercion when running against SQLite.\n */\nexport const integer: typeof sqliteInteger = ((...args: any[]) => {\n if (pg() && args[1]?.mode === \"boolean\") {\n return (pgBoolean as any)(args[0]);\n }\n return pg() ? (pgInteger as any)(...args) : (sqliteInteger as any)(...args);\n}) as any;\n\n/**\n * Real/float column.\n *\n * Maps to `real` on SQLite and `double precision` on Postgres.\n * Use for decimal values like weight, macros, etc.\n */\nexport const real: typeof sqliteReal = ((...args: any[]) => {\n return pg()\n ? (pgDoublePrecision as any)(...args)\n : (sqliteReal as any)(...args);\n}) as any;\n\n/**\n * Dialect-agnostic \"current timestamp\" SQL expression.\n * Use with `.default(now())` on text columns storing timestamps.\n *\n * - Postgres: `now()`\n * - SQLite: `(datetime('now'))`\n */\nexport function now() {\n return pg() ? sql`now()` : sql`(datetime('now'))`;\n}\n\nexport { and, desc, eq, inArray, isNull, or, sql } from \"drizzle-orm\";\n\n// Ownership / sharing primitives — templates opt a resource into the framework\n// sharing system by spreading ownableColumns() into the table and pairing it\n// with createSharesTable(). See .agents/skills/sharing/SKILL.md.\nexport {\n ownableColumns,\n createSharesTable,\n type Visibility,\n type ShareRole,\n type PrincipalType,\n} from \"../sharing/schema.js\";\n"]}
@@ -11,14 +11,14 @@
11
11
  * DELETE /_agent-native/notifications/:id — delete
12
12
  */
13
13
  export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
14
+ error?: undefined;
14
15
  count: number;
15
16
  updated?: undefined;
16
- error?: undefined;
17
17
  ok?: undefined;
18
18
  } | {
19
+ error?: undefined;
19
20
  count?: undefined;
20
21
  updated: number;
21
- error?: undefined;
22
22
  ok?: undefined;
23
23
  } | {
24
24
  count?: undefined;
@@ -26,9 +26,9 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
26
26
  error: string;
27
27
  ok?: undefined;
28
28
  } | {
29
+ error?: undefined;
29
30
  count?: undefined;
30
31
  updated?: undefined;
31
32
  ok: boolean;
32
- error?: undefined;
33
33
  }>>;
34
34
  //# sourceMappingURL=routes.d.ts.map
@@ -15,7 +15,7 @@ export declare function createProgressHandler(): import("h3").EventHandlerWithFe
15
15
  error: string;
16
16
  ok?: undefined;
17
17
  } | {
18
- ok: boolean;
19
18
  error?: undefined;
19
+ ok: boolean;
20
20
  }>>;
21
21
  //# sourceMappingURL=routes.d.ts.map
@@ -49,11 +49,11 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
49
49
  }>;
50
50
  /** DELETE /_agent-native/resources/:id — delete a resource */
51
51
  export declare function handleDeleteResource(event: any): Promise<{
52
- error: string;
53
52
  ok?: undefined;
53
+ error: string;
54
54
  } | {
55
- ok: boolean;
56
55
  error?: undefined;
56
+ ok: boolean;
57
57
  }>;
58
58
  /** POST /_agent-native/resources/upload — upload a file as a resource */
59
59
  export declare function handleUploadResource(event: any): Promise<import("./store.js").Resource | {
@@ -73,9 +73,9 @@ export declare function handleUploadResource(event: any): Promise<import("./stor
73
73
  runId: string | null;
74
74
  expiresAt: number | null;
75
75
  metadata: string | null;
76
+ error?: undefined;
76
77
  url: string;
77
78
  provider: string;
78
- error?: undefined;
79
79
  }>;
80
80
  export {};
81
81
  //# sourceMappingURL=handlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-chat-plugin.d.ts","sourceRoot":"","sources":["../../src/server/agent-chat-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAQL,KAAK,OAAO,EACb,MAAM,IAAI,CAAC;AAEZ,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AAuCrC,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAEL,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EAEnB,WAAW,EACX,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAY/B,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAElB,eAAe,EAChB,MAAM,mBAA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