@agent-native/core 0.40.2 → 0.41.1

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 (148) hide show
  1. package/README.md +11 -1
  2. package/dist/cli/create.d.ts.map +1 -1
  3. package/dist/cli/create.js +57 -0
  4. package/dist/cli/create.js.map +1 -1
  5. package/dist/cli/index.js +16 -0
  6. package/dist/cli/index.js.map +1 -1
  7. package/dist/cli/pr-visual-recap-workflow.d.ts +11 -0
  8. package/dist/cli/pr-visual-recap-workflow.d.ts.map +1 -0
  9. package/dist/cli/pr-visual-recap-workflow.js +11 -0
  10. package/dist/cli/pr-visual-recap-workflow.js.map +1 -0
  11. package/dist/cli/recap.d.ts +52 -0
  12. package/dist/cli/recap.d.ts.map +1 -0
  13. package/dist/cli/recap.js +581 -0
  14. package/dist/cli/recap.js.map +1 -0
  15. package/dist/cli/skills.d.ts +17 -4
  16. package/dist/cli/skills.d.ts.map +1 -1
  17. package/dist/cli/skills.js +60 -16
  18. package/dist/cli/skills.js.map +1 -1
  19. package/dist/cli/templates-meta.js +1 -1
  20. package/dist/cli/templates-meta.js.map +1 -1
  21. package/dist/cli/workspacify.d.ts.map +1 -1
  22. package/dist/cli/workspacify.js +19 -4
  23. package/dist/cli/workspacify.js.map +1 -1
  24. package/dist/client/blocks/index.d.ts +3 -0
  25. package/dist/client/blocks/index.d.ts.map +1 -1
  26. package/dist/client/blocks/index.js +3 -0
  27. package/dist/client/blocks/index.js.map +1 -1
  28. package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts +6 -0
  29. package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts.map +1 -0
  30. package/dist/client/blocks/library/AnnotatedCodeBlock.js +134 -0
  31. package/dist/client/blocks/library/AnnotatedCodeBlock.js.map +1 -0
  32. package/dist/client/blocks/library/HighlightedCode.d.ts +21 -1
  33. package/dist/client/blocks/library/HighlightedCode.d.ts.map +1 -1
  34. package/dist/client/blocks/library/HighlightedCode.js +86 -4
  35. package/dist/client/blocks/library/HighlightedCode.js.map +1 -1
  36. package/dist/client/blocks/library/annotated-code.config.d.ts +58 -0
  37. package/dist/client/blocks/library/annotated-code.config.d.ts.map +1 -0
  38. package/dist/client/blocks/library/annotated-code.config.js +53 -0
  39. package/dist/client/blocks/library/annotated-code.config.js.map +1 -0
  40. package/dist/client/blocks/library/checklist.js +2 -2
  41. package/dist/client/blocks/library/checklist.js.map +1 -1
  42. package/dist/client/blocks/library/code-highlight.d.ts +16 -0
  43. package/dist/client/blocks/library/code-highlight.d.ts.map +1 -0
  44. package/dist/client/blocks/library/code-highlight.js +160 -0
  45. package/dist/client/blocks/library/code-highlight.js.map +1 -0
  46. package/dist/client/blocks/library/code-tabs.config.d.ts +6 -0
  47. package/dist/client/blocks/library/code-tabs.config.d.ts.map +1 -1
  48. package/dist/client/blocks/library/code-tabs.config.js +1 -0
  49. package/dist/client/blocks/library/code-tabs.config.js.map +1 -1
  50. package/dist/client/blocks/library/code-tabs.d.ts.map +1 -1
  51. package/dist/client/blocks/library/code-tabs.js +35 -5
  52. package/dist/client/blocks/library/code-tabs.js.map +1 -1
  53. package/dist/client/blocks/library/code.config.d.ts +43 -0
  54. package/dist/client/blocks/library/code.config.d.ts.map +1 -0
  55. package/dist/client/blocks/library/code.config.js +34 -0
  56. package/dist/client/blocks/library/code.config.js.map +1 -0
  57. package/dist/client/blocks/library/code.d.ts +3 -0
  58. package/dist/client/blocks/library/code.d.ts.map +1 -0
  59. package/dist/client/blocks/library/code.js +95 -0
  60. package/dist/client/blocks/library/code.js.map +1 -0
  61. package/dist/client/blocks/library/dev-doc-ui.d.ts +2 -1
  62. package/dist/client/blocks/library/dev-doc-ui.d.ts.map +1 -1
  63. package/dist/client/blocks/library/dev-doc-ui.js +2 -1
  64. package/dist/client/blocks/library/dev-doc-ui.js.map +1 -1
  65. package/dist/client/blocks/library/server-specs.d.ts.map +1 -1
  66. package/dist/client/blocks/library/server-specs.js +21 -0
  67. package/dist/client/blocks/library/server-specs.js.map +1 -1
  68. package/dist/client/blocks/library/specs.d.ts +1 -1
  69. package/dist/client/blocks/library/specs.d.ts.map +1 -1
  70. package/dist/client/blocks/library/specs.js +30 -2
  71. package/dist/client/blocks/library/specs.js.map +1 -1
  72. package/dist/client/blocks/server.d.ts +1 -0
  73. package/dist/client/blocks/server.d.ts.map +1 -1
  74. package/dist/client/blocks/server.js +1 -0
  75. package/dist/client/blocks/server.js.map +1 -1
  76. package/dist/client/blocks/types.d.ts +1 -1
  77. package/dist/client/blocks/types.js.map +1 -1
  78. package/dist/client/extensions/ExtensionsListPage.d.ts.map +1 -1
  79. package/dist/client/extensions/ExtensionsListPage.js +28 -13
  80. package/dist/client/extensions/ExtensionsListPage.js.map +1 -1
  81. package/dist/client/extensions/ExtensionsSidebarSection.d.ts.map +1 -1
  82. package/dist/client/extensions/ExtensionsSidebarSection.js +31 -9
  83. package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
  84. package/dist/client/rich-markdown-editor/CodeBlockNode.d.ts +49 -0
  85. package/dist/client/rich-markdown-editor/CodeBlockNode.d.ts.map +1 -0
  86. package/dist/client/rich-markdown-editor/CodeBlockNode.js +126 -0
  87. package/dist/client/rich-markdown-editor/CodeBlockNode.js.map +1 -0
  88. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +1 -1
  89. package/dist/client/rich-markdown-editor/RegistryBlockNode.js +26 -3
  90. package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +1 -1
  91. package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts +1 -1
  92. package/dist/client/rich-markdown-editor/extensions.d.ts.map +1 -1
  93. package/dist/client/rich-markdown-editor/extensions.js +8 -8
  94. package/dist/client/rich-markdown-editor/extensions.js.map +1 -1
  95. package/dist/client/rich-markdown-editor/index.d.ts +1 -0
  96. package/dist/client/rich-markdown-editor/index.d.ts.map +1 -1
  97. package/dist/client/rich-markdown-editor/index.js +1 -0
  98. package/dist/client/rich-markdown-editor/index.js.map +1 -1
  99. package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts.map +1 -1
  100. package/dist/client/rich-markdown-editor/registrySlashCommands.js +1 -0
  101. package/dist/client/rich-markdown-editor/registrySlashCommands.js.map +1 -1
  102. package/dist/extensions/actions.d.ts.map +1 -1
  103. package/dist/extensions/actions.js +63 -2
  104. package/dist/extensions/actions.js.map +1 -1
  105. package/dist/extensions/routes.d.ts.map +1 -1
  106. package/dist/extensions/routes.js +24 -3
  107. package/dist/extensions/routes.js.map +1 -1
  108. package/dist/extensions/schema.d.ts +43 -2
  109. package/dist/extensions/schema.d.ts.map +1 -1
  110. package/dist/extensions/schema.js +12 -0
  111. package/dist/extensions/schema.js.map +1 -1
  112. package/dist/extensions/store.d.ts +20 -0
  113. package/dist/extensions/store.d.ts.map +1 -1
  114. package/dist/extensions/store.js +82 -3
  115. package/dist/extensions/store.js.map +1 -1
  116. package/dist/server/auth.d.ts.map +1 -1
  117. package/dist/server/auth.js +13 -0
  118. package/dist/server/auth.js.map +1 -1
  119. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  120. package/dist/server/core-routes-plugin.js +11 -0
  121. package/dist/server/core-routes-plugin.js.map +1 -1
  122. package/dist/server/recap-image-route.d.ts +8 -0
  123. package/dist/server/recap-image-route.d.ts.map +1 -0
  124. package/dist/server/recap-image-route.js +200 -0
  125. package/dist/server/recap-image-route.js.map +1 -0
  126. package/dist/server/recap-image-store.d.ts +41 -0
  127. package/dist/server/recap-image-store.d.ts.map +1 -0
  128. package/dist/server/recap-image-store.js +138 -0
  129. package/dist/server/recap-image-store.js.map +1 -0
  130. package/dist/styles/rich-markdown-editor.css +66 -17
  131. package/dist/templates/default/pnpm-workspace.yaml +7 -0
  132. package/dist/templates/workspace-root/package.json +0 -5
  133. package/dist/templates/workspace-root/pnpm-workspace.yaml +14 -0
  134. package/docs/content/cloneable-saas.md +10 -0
  135. package/docs/content/external-agents.md +4 -7
  136. package/docs/content/faq.md +10 -0
  137. package/docs/content/getting-started.md +11 -0
  138. package/docs/content/pr-visual-recap.md +103 -0
  139. package/docs/content/skills-guide.md +1 -3
  140. package/docs/content/template-assets.md +1 -4
  141. package/docs/content/template-design.md +0 -57
  142. package/docs/content/template-plan.md +22 -18
  143. package/docs/content/visual-plans.md +10 -7
  144. package/docs/content/what-is-agent-native.md +2 -0
  145. package/package.json +5 -1
  146. package/src/templates/default/pnpm-workspace.yaml +7 -0
  147. package/src/templates/workspace-root/package.json +0 -5
  148. package/src/templates/workspace-root/pnpm-workspace.yaml +14 -0
@@ -1 +1 @@
1
- {"version":3,"file":"dev-doc-ui.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/dev-doc-ui.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAQnC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC;;;;;;;;;;;;;;GAcG;AAEH,kFAAkF;AAElF,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAGhC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACxC,gBACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CACX,gYAAgY,EAChY,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AACH,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAElC,kFAAkF;AAElF,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAGhC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,gBACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,4FAA4F,EAC5F,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AACH,QAAQ,CAAC,WAAW,GAAG,UA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AE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,aACvC,iBACE,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,gBACN,SAAS,iCAErB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACtD,SAAS,EAAE,EAAE,CACX,8QAA8Q,CAC/Q,YAEA,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,iBAA2B,KAAK,EAAE,MAAM,CAAC,KAAK,YAC3C,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IADpD,MAAM,CAAC,KAAK,CAEhB,CACV,CAAC,GACK,EACT,KAAC,eAAe,IAAC,SAAS,EAAC,mFAAmF,GAAG,IAC7G,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { forwardRef } from \"react\";\nimport type {\n ComponentProps,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n ReactNode,\n TextareaHTMLAttributes,\n} from \"react\";\nimport { IconChevronDown } from \"@tabler/icons-react\";\nimport { cn } from \"../../utils.js\";\n\n/**\n * Minimal, app-agnostic form primitives for the core \"dev-doc\" block library\n * (mermaid / api-endpoint / data-model / diff / file-tree / json-explorer).\n * These blocks previously imported the plan app's shadcn/ui\n * components (`@/components/ui/*`); core blocks must stay portable, so these are\n * plain styled elements that reproduce the SAME shadcn Tailwind classes byte-for\n * -byte. They resolve against whatever shadcn token theme (`border-input`,\n * `bg-background`, `ring-ring`, …) the host app ships, so the rendered look is\n * unchanged across apps.\n *\n * The Select is intentionally a NATIVE `<select>` styled to match the shadcn\n * trigger rather than a Radix popover: it keeps core dependency-free and behaves\n * identically for the simple enum pickers these editors use (method, change,\n * param location, diff mode).\n */\n\n/* ── Input ─────────────────────────────────────────────────────────────────── */\n\nexport const DevInput = forwardRef<\n HTMLInputElement,\n InputHTMLAttributes<HTMLInputElement>\n>(({ className, type, ...props }, ref) => (\n <input\n ref={ref}\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n className,\n )}\n {...props}\n />\n));\nDevInput.displayName = \"DevInput\";\n\n/* ── Label ─────────────────────────────────────────────────────────────────── */\n\nexport const DevLabel = forwardRef<\n HTMLLabelElement,\n LabelHTMLAttributes<HTMLLabelElement>\n>(({ className, ...props }, ref) => (\n <label\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className,\n )}\n {...props}\n />\n));\nDevLabel.displayName = \"DevLabel\";\n\n/* ── Textarea ──────────────────────────────────────────────────────────────── */\n\nexport const DevTextarea = forwardRef<\n HTMLTextAreaElement,\n TextareaHTMLAttributes<HTMLTextAreaElement>\n>(({ className, ...props }, ref) => (\n <textarea\n ref={ref}\n className={cn(\n \"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n));\nDevTextarea.displayName = \"DevTextarea\";\n\n/* ── Badge ─────────────────────────────────────────────────────────────────── */\n\n/** Only the `outline` badge variant is used by these blocks. */\nexport function DevBadge({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\n \"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/* ── Switch ────────────────────────────────────────────────────────────────── */\n\n/**\n * A native-checkbox toggle styled to read like the shadcn Switch. `onCheckedChange`\n * mirrors the shadcn/Radix API so call sites stay identical.\n */\nexport function DevSwitch({\n checked,\n onCheckedChange,\n disabled,\n className,\n ...props\n}: {\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n disabled?: boolean;\n className?: string;\n} & Omit<\n InputHTMLAttributes<HTMLButtonElement>,\n \"onChange\" | \"checked\" | \"type\"\n>) {\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n disabled={disabled}\n data-plan-interactive\n onClick={() => onCheckedChange(!checked)}\n className={cn(\n \"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50\",\n checked ? \"bg-primary\" : \"bg-input\",\n className,\n )}\n {...(props as Record<string, unknown>)}\n >\n <span\n className={cn(\n \"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform\",\n checked ? \"translate-x-5\" : \"translate-x-0\",\n )}\n />\n </button>\n );\n}\n\n/* ── Select (native, shadcn-trigger styled) ────────────────────────────────── */\n\nexport interface DevSelectOption {\n value: string;\n label: ReactNode;\n}\n\n/**\n * A native `<select>` styled to match the shadcn SelectTrigger. Drop-in for the\n * simple enum pickers the dev-doc editors use. `onValueChange` mirrors the shadcn\n * API. The chevron is positioned over the native control.\n */\nexport function DevSelect({\n value,\n onValueChange,\n options,\n disabled,\n className,\n \"aria-label\": ariaLabel,\n}: {\n value: string;\n onValueChange: (value: string) => void;\n options: DevSelectOption[];\n disabled?: boolean;\n className?: string;\n \"aria-label\"?: string;\n}) {\n return (\n <div className={cn(\"relative\", className)}>\n <select\n value={value}\n disabled={disabled}\n aria-label={ariaLabel}\n data-plan-interactive\n onChange={(event) => onValueChange(event.target.value)}\n className={cn(\n \"flex h-10 w-full appearance-none items-center justify-between rounded-md border border-input bg-background px-3 py-2 pr-8 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n )}\n >\n {options.map((option) => (\n <option key={option.value} value={option.value}>\n {typeof option.label === \"string\" ? option.label : option.value}\n </option>\n ))}\n </select>\n <IconChevronDown className=\"pointer-events-none absolute right-2.5 top-1/2 size-4 -translate-y-1/2 opacity-50\" />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"dev-doc-ui.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/dev-doc-ui.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAQnC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC;;;;;;;;;;;;;;;GAeG;AAEH,kFAAkF;AAElF,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAGhC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACxC,gBACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CACX,gYAAgY,EAChY,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AACH,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAElC,kFAAkF;AAElF,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAGhC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,gBACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,4FAA4F,EAC5F,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AACH,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAElC,kFAAkF;AAElF,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AS,CAAC,aACvC,iBACE,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,gBACN,SAAS,iCAErB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACtD,SAAS,EAAE,EAAE,CACX,8QAA8Q,CAC/Q,YAEA,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,iBAA2B,KAAK,EAAE,MAAM,CAAC,KAAK,YAC3C,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IADpD,MAAM,CAAC,KAAK,CAEhB,CACV,CAAC,GACK,EACT,KAAC,eAAe,IAAC,SAAS,EAAC,mFAAmF,GAAG,IAC7G,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { forwardRef } from \"react\";\nimport type {\n ComponentProps,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n ReactNode,\n TextareaHTMLAttributes,\n} from \"react\";\nimport { IconChevronDown } from \"@tabler/icons-react\";\nimport { cn } from \"../../utils.js\";\n\n/**\n * Minimal, app-agnostic form primitives for the core \"dev-doc\" block library\n * (mermaid / api-endpoint / data-model / diff / file-tree / json-explorer /\n * annotated-code).\n * These blocks previously imported the plan app's shadcn/ui\n * components (`@/components/ui/*`); core blocks must stay portable, so these are\n * plain styled elements that reproduce the SAME shadcn Tailwind classes byte-for\n * -byte. They resolve against whatever shadcn token theme (`border-input`,\n * `bg-background`, `ring-ring`, …) the host app ships, so the rendered look is\n * unchanged across apps.\n *\n * The Select is intentionally a NATIVE `<select>` styled to match the shadcn\n * trigger rather than a Radix popover: it keeps core dependency-free and behaves\n * identically for the simple enum pickers these editors use (method, change,\n * param location, diff mode).\n */\n\n/* ── Input ─────────────────────────────────────────────────────────────────── */\n\nexport const DevInput = forwardRef<\n HTMLInputElement,\n InputHTMLAttributes<HTMLInputElement>\n>(({ className, type, ...props }, ref) => (\n <input\n ref={ref}\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n className,\n )}\n {...props}\n />\n));\nDevInput.displayName = \"DevInput\";\n\n/* ── Label ─────────────────────────────────────────────────────────────────── */\n\nexport const DevLabel = forwardRef<\n HTMLLabelElement,\n LabelHTMLAttributes<HTMLLabelElement>\n>(({ className, ...props }, ref) => (\n <label\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className,\n )}\n {...props}\n />\n));\nDevLabel.displayName = \"DevLabel\";\n\n/* ── Textarea ──────────────────────────────────────────────────────────────── */\n\nexport const DevTextarea = forwardRef<\n HTMLTextAreaElement,\n TextareaHTMLAttributes<HTMLTextAreaElement>\n>(({ className, ...props }, ref) => (\n <textarea\n ref={ref}\n className={cn(\n \"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n));\nDevTextarea.displayName = \"DevTextarea\";\n\n/* ── Badge ─────────────────────────────────────────────────────────────────── */\n\n/** Only the `outline` badge variant is used by these blocks. */\nexport function DevBadge({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\n \"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/* ── Switch ────────────────────────────────────────────────────────────────── */\n\n/**\n * A native-checkbox toggle styled to read like the shadcn Switch. `onCheckedChange`\n * mirrors the shadcn/Radix API so call sites stay identical.\n */\nexport function DevSwitch({\n checked,\n onCheckedChange,\n disabled,\n className,\n ...props\n}: {\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n disabled?: boolean;\n className?: string;\n} & Omit<\n InputHTMLAttributes<HTMLButtonElement>,\n \"onChange\" | \"checked\" | \"type\"\n>) {\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n disabled={disabled}\n data-plan-interactive\n onClick={() => onCheckedChange(!checked)}\n className={cn(\n \"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50\",\n checked ? \"bg-primary\" : \"bg-input\",\n className,\n )}\n {...(props as Record<string, unknown>)}\n >\n <span\n className={cn(\n \"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform\",\n checked ? \"translate-x-5\" : \"translate-x-0\",\n )}\n />\n </button>\n );\n}\n\n/* ── Select (native, shadcn-trigger styled) ────────────────────────────────── */\n\nexport interface DevSelectOption {\n value: string;\n label: ReactNode;\n}\n\n/**\n * A native `<select>` styled to match the shadcn SelectTrigger. Drop-in for the\n * simple enum pickers the dev-doc editors use. `onValueChange` mirrors the shadcn\n * API. The chevron is positioned over the native control.\n */\nexport function DevSelect({\n value,\n onValueChange,\n options,\n disabled,\n className,\n \"aria-label\": ariaLabel,\n}: {\n value: string;\n onValueChange: (value: string) => void;\n options: DevSelectOption[];\n disabled?: boolean;\n className?: string;\n \"aria-label\"?: string;\n}) {\n return (\n <div className={cn(\"relative\", className)}>\n <select\n value={value}\n disabled={disabled}\n aria-label={ariaLabel}\n data-plan-interactive\n onChange={(event) => onValueChange(event.target.value)}\n className={cn(\n \"flex h-10 w-full appearance-none items-center justify-between rounded-md border border-input bg-background px-3 py-2 pr-8 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n )}\n >\n {options.map((option) => (\n <option key={option.value} value={option.value}>\n {typeof option.label === \"string\" ? option.label : option.value}\n </option>\n ))}\n </select>\n <IconChevronDown className=\"pointer-events-none absolute right-2.5 top-1/2 size-4 -translate-y-1/2 opacity-50\" />\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"server-specs.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/server-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AA0DpE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,CAAC,GAAG,CAAC,EAqI/C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAC9C,MAAM,EACN,OAAO,CACL,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,kBAAkB,CAAC,CAC5E,CACF,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,2BAA2B,CAAA;CAAO,GACxD,IAAI,CAON"}
1
+ {"version":3,"file":"server-specs.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/server-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAgEpE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,CAAC,GAAG,CAAC,EA0J/C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAC9C,MAAM,EACN,OAAO,CACL,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,kBAAkB,CAAC,CAC5E,CACF,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,2BAA2B,CAAA;CAAO,GACxD,IAAI,CAON"}
@@ -5,6 +5,7 @@ import { registerBlocks } from "../registry.js";
5
5
  // `spec.schema` / `spec.mdx`, so these configs register with a render-only stub.
6
6
  import { checklistSchema, checklistMdx, } from "./checklist.config.js";
7
7
  import { tableSchema, tableMdx } from "./table.config.js";
8
+ import { codeSchema, codeMdx } from "./code.config.js";
8
9
  import { codeTabsSchema, codeTabsMdx, } from "./code-tabs.config.js";
9
10
  import { htmlSchema, htmlMdx } from "./html.config.js";
10
11
  import { tabsSchema, tabsMdx } from "./tabs.config.js";
@@ -16,6 +17,7 @@ import { dataModelSchema, dataModelMdx, } from "./data-model.config.js";
16
17
  import { diffSchema, diffMdx } from "./diff.config.js";
17
18
  import { fileTreeSchema, fileTreeMdx, } from "./file-tree.config.js";
18
19
  import { jsonExplorerSchema, jsonExplorerMdx, } from "./json-explorer.config.js";
20
+ import { annotatedCodeSchema, annotatedCodeMdx, } from "./annotated-code.config.js";
19
21
  /** Render-only stub for server / agent registries (never invoked off-browser). */
20
22
  const ServerReadStub = () => null;
21
23
  /**
@@ -53,6 +55,16 @@ export const libraryBlockConfigs = [
53
55
  label: "Table",
54
56
  description: "A simple grid with header columns and string rows for comparisons, parameters, or structured lists.",
55
57
  }),
58
+ defineBlock({
59
+ type: "code",
60
+ schema: codeSchema,
61
+ mdx: codeMdx,
62
+ Read: ServerReadStub,
63
+ placement: ["block"],
64
+ notionCompatible: true,
65
+ label: "Code",
66
+ description: "A single syntax-highlighted code snippet (Notion-style: one border, hover language switcher + copy, collapse-to-N lines). Put several in a `tabs` block for a file rail.",
67
+ }),
56
68
  defineBlock({
57
69
  type: "code-tabs",
58
70
  schema: codeTabsSchema,
@@ -152,6 +164,15 @@ export const libraryBlockConfigs = [
152
164
  label: "JSON explorer",
153
165
  description: "A collapsible browser-devtools / Postman-style JSON tree with type-colored values and expand/collapse.",
154
166
  }),
167
+ defineBlock({
168
+ type: "annotated-code",
169
+ schema: annotatedCodeSchema,
170
+ mdx: annotatedCodeMdx,
171
+ Read: ServerReadStub,
172
+ placement: ["block"],
173
+ label: "Annotated code",
174
+ description: "A line-numbered code walkthrough whose line ranges carry anchored explanatory notes.",
175
+ }),
155
176
  ];
156
177
  /**
157
178
  * Register the React-free standard-library config stubs into a server / shared
@@ -1 +1 @@
1
- {"version":3,"file":"server-specs.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/server-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAsB,MAAM,gBAAgB,CAAC;AAEpE,8EAA8E;AAC9E,iFAAiF;AACjF,iFAAiF;AACjF,OAAO,EACL,eAAe,EACf,YAAY,GAEb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAkB,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EACL,cAAc,EACd,WAAW,GAEZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,OAAO,EAAsB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,0BAA0B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E,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { defineBlock, type BlockSpec } from \"../types.js\";\nimport { registerBlocks, type BlockRegistry } from \"../registry.js\";\n\n// React-free schema + MDX config for the standard library. The matching React\n// `Read`/`Edit` live in the full client entry; the server path only ever touches\n// `spec.schema` / `spec.mdx`, so these configs register with a render-only stub.\nimport {\n checklistSchema,\n checklistMdx,\n type ChecklistData,\n} from \"./checklist.config.js\";\nimport { tableSchema, tableMdx, type TableData } from \"./table.config.js\";\nimport {\n codeTabsSchema,\n codeTabsMdx,\n type CodeTabsData,\n} from \"./code-tabs.config.js\";\nimport { htmlSchema, htmlMdx, type HtmlBlockData } from \"./html.config.js\";\nimport { tabsSchema, tabsMdx, type TabsData } from \"./tabs.config.js\";\nimport {\n columnsSchema,\n columnsMdx,\n type ColumnsData,\n} from \"./columns.config.js\";\nimport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./mermaid.config.js\";\nimport {\n apiEndpointSchema,\n apiEndpointMdx,\n type ApiEndpointData,\n} from \"./api-endpoint.config.js\";\nimport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./openapi-spec.config.js\";\nimport {\n dataModelSchema,\n dataModelMdx,\n type DataModelData,\n} from \"./data-model.config.js\";\nimport { diffSchema, diffMdx, type DiffData } from \"./diff.config.js\";\nimport {\n fileTreeSchema,\n fileTreeMdx,\n type FileTreeData,\n} from \"./file-tree.config.js\";\nimport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n type JsonExplorerData,\n} from \"./json-explorer.config.js\";\n\n/** Render-only stub for server / agent registries (never invoked off-browser). */\nconst ServerReadStub = () => null;\n\n/**\n * Canonical React-free specs for the standard library, used by BOTH apps' server\n * / shared registries (`plan-block-registry.ts`, `nfm-registry.ts`). Each carries\n * only the parts the server path touches — `schema` + `mdx` + metadata for the\n * agent schema export — with a render-only `Read` stub. The full client specs\n * (with real React `Read`/`Edit`) live in `./specs.tsx`; both share the identical\n * `schema`/`mdx` config so inline source can never drift from what renders.\n *\n * `table` keeps the core default `type` here; content's server registry renames\n * it to `table-block` via {@link LibraryBlockConfigOverrides}. The descriptions\n * are the neutral agent-schema phrasing; an app that curates a longer\n * description for a block (e.g. plan's hand-drawn Mermaid, plan's detailed file\n * tree) passes an override rather than re-authoring the spec.\n */\nexport const libraryBlockConfigs: BlockSpec<any>[] = [\n defineBlock<ChecklistData>({\n type: \"checklist\",\n schema: checklistSchema,\n mdx: checklistMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n notionCompatible: true,\n label: \"Checklist\",\n description:\n \"A list of toggleable items, each with a label and an optional note.\",\n }),\n defineBlock<TableData>({\n type: \"table\",\n schema: tableSchema,\n mdx: tableMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n notionCompatible: true,\n label: \"Table\",\n description:\n \"A simple grid with header columns and string rows for comparisons, parameters, or structured lists.\",\n }),\n defineBlock<CodeTabsData>({\n type: \"code-tabs\",\n schema: codeTabsSchema,\n mdx: codeTabsMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Code tabs\",\n description:\n \"A vertical file tab rail of syntax-highlighted code snippets, one tab per file with an optional language and caption.\",\n }),\n defineBlock<HtmlBlockData>({\n type: \"custom-html\",\n schema: htmlSchema,\n mdx: htmlMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"HTML / Tailwind\",\n description:\n \"An author-supplied HTML (with optional CSS) fragment rendered in a sandboxed iframe, with inline source editing.\",\n }),\n defineBlock<TabsData>({\n type: \"tabs\",\n schema: tabsSchema,\n mdx: tabsMdx,\n Read: ServerReadStub,\n placement: [\"block\", \"inline\"],\n label: \"Tabs\",\n description:\n \"A top or side tab container; each tab holds its own list of blocks.\",\n }),\n defineBlock<ColumnsData>({\n type: \"columns\",\n schema: columnsSchema,\n mdx: columnsMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Columns\",\n description:\n \"A multi-column side-by-side layout container; each column holds its own list of blocks. Ideal for before/after or current/target comparisons.\",\n }),\n defineBlock<MermaidData>({\n type: \"mermaid\",\n schema: mermaidSchema,\n mdx: mermaidMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Diagram (Mermaid)\",\n description:\n \"A Mermaid diagram (flowchart, sequence, etc.) defined as text and rendered as a diagram.\",\n }),\n defineBlock<ApiEndpointData>({\n type: \"api-endpoint\",\n schema: apiEndpointSchema,\n mdx: apiEndpointMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"API endpoint\",\n description:\n \"A Swagger-style API endpoint reference: a colored method pill + path, collapsed by default, expanding to params, request body, and per-status response examples.\",\n }),\n defineBlock<OpenApiSpecData>({\n type: \"openapi-spec\",\n schema: openApiSpecSchema,\n mdx: openApiSpecMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"OpenAPI spec\",\n description:\n \"A whole-document API specification / Redoc / Swagger-UI-style API reference rendered from a complete OpenAPI 3 / Swagger 2 spec (JSON).\",\n }),\n defineBlock<DataModelData>({\n type: \"data-model\",\n schema: dataModelSchema,\n mdx: dataModelMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Data model\",\n description:\n \"A schema modeling / ERD / dbdiagram-style data model: entity cards with typed fields (PK/FK/nullable flags) and interactive foreign-key relations.\",\n }),\n defineBlock<DiffData>({\n type: \"diff\",\n schema: diffSchema,\n mdx: diffMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Diff\",\n description:\n \"A GitHub-style before/after line diff for a file, with unified or split view and added/removed line highlighting.\",\n }),\n defineBlock<FileTreeData>({\n type: \"file-tree\",\n schema: fileTreeSchema,\n mdx: fileTreeMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"File tree\",\n description:\n \"A VS Code / GitHub-explorer file and change tree with per-file change badges, notes, and code snippets.\",\n }),\n defineBlock<JsonExplorerData>({\n type: \"json-explorer\",\n schema: jsonExplorerSchema,\n mdx: jsonExplorerMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"JSON explorer\",\n description:\n \"A collapsible browser-devtools / Postman-style JSON tree with type-colored values and expand/collapse.\",\n }),\n];\n\n/**\n * Per-block overrides for {@link registerLibraryBlockConfigs}, keyed by canonical\n * `type`. Servers tweak only the agent-facing fields that legitimately differ:\n * content re-types `table` → `table-block`; plan curates a longer Mermaid and\n * file-tree description. The `schema` / `mdx` config always stays shared.\n */\nexport type LibraryBlockConfigOverrides = Record<\n string,\n Partial<\n Pick<BlockSpec<any>, \"type\" | \"label\" | \"description\" | \"notionCompatible\">\n >\n>;\n\n/**\n * Register the React-free standard-library config stubs into a server / shared\n * {@link BlockRegistry}. Both `plan-block-registry.ts` and `nfm-registry.ts` call\n * this, then register only their app-specific block configs (plan adds callout /\n * diagram / wireframe / question-form) on top — so the shared library lives in\n * exactly one place across browser AND server registries.\n */\nexport function registerLibraryBlockConfigs(\n registry: BlockRegistry,\n options: { overrides?: LibraryBlockConfigOverrides } = {},\n): void {\n const overrides = options.overrides ?? {};\n const specs = libraryBlockConfigs.map((spec) => {\n const override = overrides[spec.type];\n return override ? ({ ...spec, ...override } as BlockSpec<any>) : spec;\n });\n registerBlocks(registry, specs);\n}\n"]}
1
+ {"version":3,"file":"server-specs.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/server-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAsB,MAAM,gBAAgB,CAAC;AAEpE,8EAA8E;AAC9E,iFAAiF;AACjF,iFAAiF;AACjF,OAAO,EACL,eAAe,EACf,YAAY,GAEb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAkB,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,cAAc,EACd,WAAW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yG;KAC5G,CAAC;IACF,WAAW,CAAmB;QAC5B,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,kBAAkB;QAC1B,GAAG,EAAE,eAAe;QACpB,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,CAAC,OAAO,CAAC;QACpB,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,wGAAwG;KAC3G,CAAC;IACF,WAAW,CAAoB;QAC7B,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,mBAAmB;QAC3B,GAAG,EAAE,gBAAgB;QACrB,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,CAAC,OAAO,CAAC;QACpB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,sFAAsF;KACzF,CAAC;CACH,CAAC;AAeF;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAuB,EACvB,UAAuD,EAAE;IAEzD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;IAC1C,MAAM,KAAK,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7C,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,QAAQ,CAAC,CAAC,CAAE,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAqB,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { defineBlock, type BlockSpec } from \"../types.js\";\nimport { registerBlocks, type BlockRegistry } from \"../registry.js\";\n\n// React-free schema + MDX config for the standard library. The matching React\n// `Read`/`Edit` live in the full client entry; the server path only ever touches\n// `spec.schema` / `spec.mdx`, so these configs register with a render-only stub.\nimport {\n checklistSchema,\n checklistMdx,\n type ChecklistData,\n} from \"./checklist.config.js\";\nimport { tableSchema, tableMdx, type TableData } from \"./table.config.js\";\nimport { codeSchema, codeMdx, type CodeData } from \"./code.config.js\";\nimport {\n codeTabsSchema,\n codeTabsMdx,\n type CodeTabsData,\n} from \"./code-tabs.config.js\";\nimport { htmlSchema, htmlMdx, type HtmlBlockData } from \"./html.config.js\";\nimport { tabsSchema, tabsMdx, type TabsData } from \"./tabs.config.js\";\nimport {\n columnsSchema,\n columnsMdx,\n type ColumnsData,\n} from \"./columns.config.js\";\nimport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./mermaid.config.js\";\nimport {\n apiEndpointSchema,\n apiEndpointMdx,\n type ApiEndpointData,\n} from \"./api-endpoint.config.js\";\nimport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./openapi-spec.config.js\";\nimport {\n dataModelSchema,\n dataModelMdx,\n type DataModelData,\n} from \"./data-model.config.js\";\nimport { diffSchema, diffMdx, type DiffData } from \"./diff.config.js\";\nimport {\n fileTreeSchema,\n fileTreeMdx,\n type FileTreeData,\n} from \"./file-tree.config.js\";\nimport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n type JsonExplorerData,\n} from \"./json-explorer.config.js\";\nimport {\n annotatedCodeSchema,\n annotatedCodeMdx,\n type AnnotatedCodeData,\n} from \"./annotated-code.config.js\";\n\n/** Render-only stub for server / agent registries (never invoked off-browser). */\nconst ServerReadStub = () => null;\n\n/**\n * Canonical React-free specs for the standard library, used by BOTH apps' server\n * / shared registries (`plan-block-registry.ts`, `nfm-registry.ts`). Each carries\n * only the parts the server path touches — `schema` + `mdx` + metadata for the\n * agent schema export — with a render-only `Read` stub. The full client specs\n * (with real React `Read`/`Edit`) live in `./specs.tsx`; both share the identical\n * `schema`/`mdx` config so inline source can never drift from what renders.\n *\n * `table` keeps the core default `type` here; content's server registry renames\n * it to `table-block` via {@link LibraryBlockConfigOverrides}. The descriptions\n * are the neutral agent-schema phrasing; an app that curates a longer\n * description for a block (e.g. plan's hand-drawn Mermaid, plan's detailed file\n * tree) passes an override rather than re-authoring the spec.\n */\nexport const libraryBlockConfigs: BlockSpec<any>[] = [\n defineBlock<ChecklistData>({\n type: \"checklist\",\n schema: checklistSchema,\n mdx: checklistMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n notionCompatible: true,\n label: \"Checklist\",\n description:\n \"A list of toggleable items, each with a label and an optional note.\",\n }),\n defineBlock<TableData>({\n type: \"table\",\n schema: tableSchema,\n mdx: tableMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n notionCompatible: true,\n label: \"Table\",\n description:\n \"A simple grid with header columns and string rows for comparisons, parameters, or structured lists.\",\n }),\n defineBlock<CodeData>({\n type: \"code\",\n schema: codeSchema,\n mdx: codeMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n notionCompatible: true,\n label: \"Code\",\n description:\n \"A single syntax-highlighted code snippet (Notion-style: one border, hover language switcher + copy, collapse-to-N lines). Put several in a `tabs` block for a file rail.\",\n }),\n defineBlock<CodeTabsData>({\n type: \"code-tabs\",\n schema: codeTabsSchema,\n mdx: codeTabsMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Code tabs\",\n description:\n \"A vertical file tab rail of syntax-highlighted code snippets, one tab per file with an optional language and caption.\",\n }),\n defineBlock<HtmlBlockData>({\n type: \"custom-html\",\n schema: htmlSchema,\n mdx: htmlMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"HTML / Tailwind\",\n description:\n \"An author-supplied HTML (with optional CSS) fragment rendered in a sandboxed iframe, with inline source editing.\",\n }),\n defineBlock<TabsData>({\n type: \"tabs\",\n schema: tabsSchema,\n mdx: tabsMdx,\n Read: ServerReadStub,\n placement: [\"block\", \"inline\"],\n label: \"Tabs\",\n description:\n \"A top or side tab container; each tab holds its own list of blocks.\",\n }),\n defineBlock<ColumnsData>({\n type: \"columns\",\n schema: columnsSchema,\n mdx: columnsMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Columns\",\n description:\n \"A multi-column side-by-side layout container; each column holds its own list of blocks. Ideal for before/after or current/target comparisons.\",\n }),\n defineBlock<MermaidData>({\n type: \"mermaid\",\n schema: mermaidSchema,\n mdx: mermaidMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Diagram (Mermaid)\",\n description:\n \"A Mermaid diagram (flowchart, sequence, etc.) defined as text and rendered as a diagram.\",\n }),\n defineBlock<ApiEndpointData>({\n type: \"api-endpoint\",\n schema: apiEndpointSchema,\n mdx: apiEndpointMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"API endpoint\",\n description:\n \"A Swagger-style API endpoint reference: a colored method pill + path, collapsed by default, expanding to params, request body, and per-status response examples.\",\n }),\n defineBlock<OpenApiSpecData>({\n type: \"openapi-spec\",\n schema: openApiSpecSchema,\n mdx: openApiSpecMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"OpenAPI spec\",\n description:\n \"A whole-document API specification / Redoc / Swagger-UI-style API reference rendered from a complete OpenAPI 3 / Swagger 2 spec (JSON).\",\n }),\n defineBlock<DataModelData>({\n type: \"data-model\",\n schema: dataModelSchema,\n mdx: dataModelMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Data model\",\n description:\n \"A schema modeling / ERD / dbdiagram-style data model: entity cards with typed fields (PK/FK/nullable flags) and interactive foreign-key relations.\",\n }),\n defineBlock<DiffData>({\n type: \"diff\",\n schema: diffSchema,\n mdx: diffMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Diff\",\n description:\n \"A GitHub-style before/after line diff for a file, with unified or split view and added/removed line highlighting.\",\n }),\n defineBlock<FileTreeData>({\n type: \"file-tree\",\n schema: fileTreeSchema,\n mdx: fileTreeMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"File tree\",\n description:\n \"A VS Code / GitHub-explorer file and change tree with per-file change badges, notes, and code snippets.\",\n }),\n defineBlock<JsonExplorerData>({\n type: \"json-explorer\",\n schema: jsonExplorerSchema,\n mdx: jsonExplorerMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"JSON explorer\",\n description:\n \"A collapsible browser-devtools / Postman-style JSON tree with type-colored values and expand/collapse.\",\n }),\n defineBlock<AnnotatedCodeData>({\n type: \"annotated-code\",\n schema: annotatedCodeSchema,\n mdx: annotatedCodeMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Annotated code\",\n description:\n \"A line-numbered code walkthrough whose line ranges carry anchored explanatory notes.\",\n }),\n];\n\n/**\n * Per-block overrides for {@link registerLibraryBlockConfigs}, keyed by canonical\n * `type`. Servers tweak only the agent-facing fields that legitimately differ:\n * content re-types `table` → `table-block`; plan curates a longer Mermaid and\n * file-tree description. The `schema` / `mdx` config always stays shared.\n */\nexport type LibraryBlockConfigOverrides = Record<\n string,\n Partial<\n Pick<BlockSpec<any>, \"type\" | \"label\" | \"description\" | \"notionCompatible\">\n >\n>;\n\n/**\n * Register the React-free standard-library config stubs into a server / shared\n * {@link BlockRegistry}. Both `plan-block-registry.ts` and `nfm-registry.ts` call\n * this, then register only their app-specific block configs (plan adds callout /\n * diagram / wireframe / question-form) on top — so the shared library lives in\n * exactly one place across browser AND server registries.\n */\nexport function registerLibraryBlockConfigs(\n registry: BlockRegistry,\n options: { overrides?: LibraryBlockConfigOverrides } = {},\n): void {\n const overrides = options.overrides ?? {};\n const specs = libraryBlockConfigs.map((spec) => {\n const override = overrides[spec.type];\n return override ? ({ ...spec, ...override } as BlockSpec<any>) : spec;\n });\n registerBlocks(registry, specs);\n}\n"]}
@@ -2,7 +2,7 @@ import { type BlockSpec } from "../types.js";
2
2
  import { type BlockRegistry } from "../registry.js";
3
3
  /**
4
4
  * The full standard library spec set, in registration order: the fully pre-built
5
- * specs (checklist, table, code-tabs, html, tabs, columns) followed by the
5
+ * specs (checklist, table, code-tabs, html, tabs, columns) followed by the eight
6
6
  * dev-doc specs. This is the single list both the plan and content browser
7
7
  * registries register — adding a library block here lands in both apps.
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"specs.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/specs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AA4NpE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,CAAC,GAAG,CAAC,EAQ7C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CACxC,MAAM,EACN,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,OAAO,CAAC,CAAC,CAC1E,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,qBAAqB,CAAA;CAAO,GAClD,IAAI,CAON"}
1
+ {"version":3,"file":"specs.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/specs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AA4PpE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,CAAC,GAAG,CAAC,EAS7C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CACxC,MAAM,EACN,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,OAAO,CAAC,CAAC,CAC1E,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,qBAAqB,CAAA;CAAO,GAClD,IAAI,CAON"}
@@ -3,6 +3,7 @@ import { registerBlocks } from "../registry.js";
3
3
  // Pre-built standard library specs (schema + mdx + React Read/Edit all bundled).
4
4
  import { checklistBlock } from "./checklist.js";
5
5
  import { tableBlock } from "./table.js";
6
+ import { codeBlock } from "./code.js";
6
7
  import { codeTabsBlock } from "./code-tabs.js";
7
8
  import { htmlBlock } from "./html.js";
8
9
  import { tabsBlock } from "./tabs.js";
@@ -23,9 +24,12 @@ import { fileTreeSchema, fileTreeMdx, } from "./file-tree.config.js";
23
24
  import { FileTreeRead, FileTreeEdit } from "./FileTreeBlock.js";
24
25
  import { jsonExplorerSchema, jsonExplorerMdx, JSON_EXPLORER_DEFAULT_COLLAPSED_DEPTH, } from "./json-explorer.config.js";
25
26
  import { JsonExplorerRead, JsonExplorerEdit } from "./JsonExplorerBlock.js";
27
+ import { annotatedCodeSchema, annotatedCodeMdx, } from "./annotated-code.config.js";
28
+ import { AnnotatedCodeRead, AnnotatedCodeEdit } from "./AnnotatedCodeBlock.js";
26
29
  /**
27
30
  * Canonical specs for the standard library's dev-doc blocks (Mermaid, API
28
- * endpoint, OpenAPI spec, data model, diff, file tree, JSON explorer).
31
+ * endpoint, OpenAPI spec, data model, diff, file tree, JSON explorer,
32
+ * annotated code).
29
33
  * Each pairs the shared React-free schema/MDX config
30
34
  * with the shared React `Read`/`Edit` renderers and the canonical
31
35
  * label/description/editSurface/empty metadata. Apps that need a slightly
@@ -173,16 +177,40 @@ const devDocBlockSpecs = [
173
177
  collapsedDepth: JSON_EXPLORER_DEFAULT_COLLAPSED_DEPTH,
174
178
  }),
175
179
  }),
180
+ defineBlock({
181
+ type: "annotated-code",
182
+ schema: annotatedCodeSchema,
183
+ mdx: annotatedCodeMdx,
184
+ Read: AnnotatedCodeRead,
185
+ Edit: AnnotatedCodeEdit,
186
+ placement: ["block"],
187
+ editSurface: "panel",
188
+ label: "Annotated code",
189
+ description: "A line-numbered code walkthrough whose line ranges carry anchored explanatory notes (Stripe-docs / Sourcegraph explain-this-code style).",
190
+ empty: () => ({
191
+ filename: "src/server/auth.ts",
192
+ language: "ts",
193
+ code: "export function resolveAuth(provider: string) {\n const cfg = providers[provider];\n return cfg.token;\n}",
194
+ annotations: [
195
+ {
196
+ lines: "2",
197
+ label: "Lookup",
198
+ note: "Resolves the provider config by key.",
199
+ },
200
+ ],
201
+ }),
202
+ }),
176
203
  ];
177
204
  /**
178
205
  * The full standard library spec set, in registration order: the fully pre-built
179
- * specs (checklist, table, code-tabs, html, tabs, columns) followed by the
206
+ * specs (checklist, table, code-tabs, html, tabs, columns) followed by the eight
180
207
  * dev-doc specs. This is the single list both the plan and content browser
181
208
  * registries register — adding a library block here lands in both apps.
182
209
  */
183
210
  export const libraryBlockSpecs = [
184
211
  checklistBlock,
185
212
  tableBlock,
213
+ codeBlock,
186
214
  codeTabsBlock,
187
215
  htmlBlock,
188
216
  tabsBlock,
@@ -1 +1 @@
1
- {"version":3,"file":"specs.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/specs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAsB,MAAM,gBAAgB,CAAC;AAEpE,iFAAiF;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,8EAA8E;AAC9E,+EAA+E;AAC/E,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,0BA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AAC,CAAC,CAAC;IACH,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { defineBlock, type BlockSpec } from \"../types.js\";\nimport { registerBlocks, type BlockRegistry } from \"../registry.js\";\n\n// Pre-built standard library specs (schema + mdx + React Read/Edit all bundled).\nimport { checklistBlock } from \"./checklist.js\";\nimport { tableBlock } from \"./table.js\";\nimport { codeTabsBlock } from \"./code-tabs.js\";\nimport { htmlBlock } from \"./html.js\";\nimport { tabsBlock } from \"./tabs.js\";\nimport { columnsBlock } from \"./columns.js\";\n\n// Dev-doc blocks: React-free schema + MDX config paired with the shared React\n// Read/Edit renderers. Composed into full specs below with canonical metadata.\nimport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./mermaid.config.js\";\nimport { MermaidRead, MermaidEdit } from \"./MermaidBlock.js\";\nimport {\n apiEndpointSchema,\n apiEndpointMdx,\n type ApiEndpointData,\n} from \"./api-endpoint.config.js\";\nimport { ApiEndpointRead, ApiEndpointEdit } from \"./ApiEndpointBlock.js\";\nimport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./openapi-spec.config.js\";\nimport { OpenApiSpecRead, OpenApiSpecEdit } from \"./OpenApiSpecBlock.js\";\nimport {\n dataModelSchema,\n dataModelMdx,\n type DataModelData,\n} from \"./data-model.config.js\";\nimport { DataModelRead, DataModelEdit } from \"./DataModelBlock.js\";\nimport { diffSchema, diffMdx, type DiffData } from \"./diff.config.js\";\nimport { DiffRead, DiffEdit } from \"./DiffBlock.js\";\nimport {\n fileTreeSchema,\n fileTreeMdx,\n type FileTreeData,\n} from \"./file-tree.config.js\";\nimport { FileTreeRead, FileTreeEdit } from \"./FileTreeBlock.js\";\nimport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n JSON_EXPLORER_DEFAULT_COLLAPSED_DEPTH,\n type JsonExplorerData,\n} from \"./json-explorer.config.js\";\nimport { JsonExplorerRead, JsonExplorerEdit } from \"./JsonExplorerBlock.js\";\n\n/**\n * Canonical specs for the standard library's dev-doc blocks (Mermaid, API\n * endpoint, OpenAPI spec, data model, diff, file tree, JSON explorer).\n * Each pairs the shared React-free schema/MDX config\n * with the shared React `Read`/`Edit` renderers and the canonical\n * label/description/editSurface/empty metadata. Apps that need a slightly\n * different label/description/empty for a block pass an override to\n * {@link registerLibraryBlocks} rather than re-authoring the whole spec.\n *\n * The six fully pre-built standard specs (checklist, table, code-tabs, html,\n * tabs, columns) already bundle their metadata in their own modules, so they are appended\n * by {@link libraryBlockSpecs} rather than re-declared here.\n */\n// Typed `BlockSpec<any>[]` (not `BlockSpec<unknown>[]`) so the per-block generic\n// data types coexist in one array — mirroring `registerBlocks`' own signature,\n// where `childrenField: keyof TData` would otherwise collapse to `never`.\nconst devDocBlockSpecs: BlockSpec<any>[] = [\n defineBlock<MermaidData>({\n type: \"mermaid\",\n schema: mermaidSchema,\n mdx: mermaidMdx,\n Read: MermaidRead,\n Edit: MermaidEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Diagram (Mermaid)\",\n description:\n \"A Mermaid diagram (flowchart, sequence, etc.) defined as text and rendered as a diagram.\",\n empty: () => ({\n source:\n \"flowchart TD\\n A[Start] --> B{Decision}\\n B -->|Yes| C[Do it]\\n B -->|No| D[Skip]\",\n }),\n }),\n defineBlock<ApiEndpointData>({\n type: \"api-endpoint\",\n schema: apiEndpointSchema,\n mdx: apiEndpointMdx,\n Read: ApiEndpointRead,\n Edit: ApiEndpointEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"API endpoint\",\n description:\n \"A Swagger-style API endpoint reference: a colored method pill + path, collapsed by default, expanding to params, request body, and per-status response examples.\",\n empty: () => ({ method: \"GET\", path: \"/api/resource\" }),\n }),\n defineBlock<OpenApiSpecData>({\n type: \"openapi-spec\",\n schema: openApiSpecSchema,\n mdx: openApiSpecMdx,\n Read: OpenApiSpecRead,\n Edit: OpenApiSpecEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"OpenAPI spec\",\n description:\n \"A whole-document API specification / Redoc / Swagger-UI-style API reference rendered from a complete OpenAPI 3 / Swagger 2 spec (JSON): operations grouped by tag, each a collapsible row expanding to params, request body, and per-status responses, with $ref models resolved.\",\n empty: () => ({\n spec: JSON.stringify(\n {\n openapi: \"3.0.0\",\n info: { title: \"Example API\", version: \"1.0.0\" },\n tags: [{ name: \"widgets\", description: \"Manage widgets\" }],\n paths: {\n \"/widgets\": {\n get: {\n tags: [\"widgets\"],\n summary: \"List widgets\",\n responses: { \"200\": { description: \"OK\" } },\n },\n },\n },\n },\n null,\n 2,\n ),\n }),\n }),\n defineBlock<DataModelData>({\n type: \"data-model\",\n schema: dataModelSchema,\n mdx: dataModelMdx,\n Read: DataModelRead,\n Edit: DataModelEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Data model\",\n description:\n \"A schema modeling / ERD / dbdiagram-style data model: entity cards with typed fields (PK/FK/nullable flags) and interactive foreign-key relations.\",\n empty: () => ({\n entities: [\n {\n id: \"e_user\",\n name: \"User\",\n fields: [\n { name: \"id\", type: \"uuid\", pk: true },\n { name: \"email\", type: \"text\" },\n ],\n },\n ],\n }),\n }),\n defineBlock<DiffData>({\n type: \"diff\",\n schema: diffSchema,\n mdx: diffMdx,\n Read: DiffRead,\n Edit: DiffEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Diff\",\n description:\n \"A GitHub-style before/after line diff for a file, with unified or split (side-by-side) view, added/removed line highlighting, and collapsible unchanged runs.\",\n empty: () => ({\n before: \"function add(a, b) {\\n return a + b;\\n}\",\n after: \"function add(a: number, b: number): number {\\n return a + b;\\n}\",\n language: \"ts\",\n }),\n }),\n defineBlock<FileTreeData>({\n type: \"file-tree\",\n schema: fileTreeSchema,\n mdx: fileTreeMdx,\n Read: FileTreeRead,\n Edit: FileTreeEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"File tree\",\n description:\n \"A VS Code / GitHub-explorer file and change tree derived from slash-delimited paths, with per-file change badges (added/modified/removed/renamed), notes, and code snippets.\",\n empty: () => ({\n entries: [\n {\n path: \"src/index.ts\",\n change: \"modified\",\n note: \"Wire the new route here.\",\n },\n { path: \"src/routes/git.ts\", change: \"added\" },\n ],\n }),\n }),\n defineBlock<JsonExplorerData>({\n type: \"json-explorer\",\n schema: jsonExplorerSchema,\n mdx: jsonExplorerMdx,\n Read: JsonExplorerRead,\n Edit: JsonExplorerEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"JSON explorer\",\n description:\n \"A collapsible browser-devtools / Postman-style JSON tree with type-colored values and expand/collapse.\",\n empty: () => ({\n json: JSON.stringify(\n {\n id: \"abc123\",\n active: true,\n tags: [\"alpha\", \"beta\"],\n meta: { count: 2, owner: null },\n },\n null,\n 2,\n ),\n collapsedDepth: JSON_EXPLORER_DEFAULT_COLLAPSED_DEPTH,\n }),\n }),\n];\n\n/**\n * The full standard library spec set, in registration order: the fully pre-built\n * specs (checklist, table, code-tabs, html, tabs, columns) followed by the\n * dev-doc specs. This is the single list both the plan and content browser\n * registries register — adding a library block here lands in both apps.\n */\nexport const libraryBlockSpecs: BlockSpec<any>[] = [\n checklistBlock,\n tableBlock,\n codeTabsBlock,\n htmlBlock,\n tabsBlock,\n columnsBlock,\n ...devDocBlockSpecs,\n];\n\n/**\n * Per-block metadata overrides for {@link registerLibraryBlocks}, keyed by the\n * canonical block `type`. Lets an app tweak the few fields that legitimately\n * differ (a `type` rename, a tweaked `description` or `empty` seed) without\n * re-authoring the spec. Anything omitted keeps the canonical value, so the\n * schema / MDX config and the React `Read`/`Edit` renderers always stay shared.\n */\nexport type LibraryBlockOverrides = Record<\n string,\n Partial<Pick<BlockSpec<any>, \"type\" | \"label\" | \"description\" | \"empty\">>\n>;\n\n/**\n * Register the standard library block specs into a {@link BlockRegistry}. Both\n * the plan and content browser registries call this, then register only their\n * own app-specific blocks on top — so the shared library lives in exactly one\n * place. Pass `overrides` (keyed by canonical `type`) for the small per-app\n * differences (content re-types `table` → `table-block`; each app phrases the\n * Mermaid description and seeds the OpenAPI example a little differently).\n */\nexport function registerLibraryBlocks(\n registry: BlockRegistry,\n options: { overrides?: LibraryBlockOverrides } = {},\n): void {\n const overrides = options.overrides ?? {};\n const specs = libraryBlockSpecs.map((spec) => {\n const override = overrides[spec.type];\n return override ? ({ ...spec, ...override } as BlockSpec<any>) : spec;\n });\n registerBlocks(registry, specs);\n}\n"]}
1
+ {"version":3,"file":"specs.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/specs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAsB,MAAM,gBAAgB,CAAC;AAEpE,iFAAiF;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,8EAA8E;AAC9E,+EAA+E;AAC/E,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACz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IACb,SAAS;IACT,SAAS;IACT,YAAY;IACZ,GAAG,gBAAgB;CACpB,CAAC;AAcF;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAuB,EACvB,UAAiD,EAAE;IAEnD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;IAC1C,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3C,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,QAAQ,CAAC,CAAC,CAAE,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAqB,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { defineBlock, type BlockSpec } from \"../types.js\";\nimport { registerBlocks, type BlockRegistry } from \"../registry.js\";\n\n// Pre-built standard library specs (schema + mdx + React Read/Edit all bundled).\nimport { checklistBlock } from \"./checklist.js\";\nimport { tableBlock } from \"./table.js\";\nimport { codeBlock } from \"./code.js\";\nimport { codeTabsBlock } from \"./code-tabs.js\";\nimport { htmlBlock } from \"./html.js\";\nimport { tabsBlock } from \"./tabs.js\";\nimport { columnsBlock } from \"./columns.js\";\n\n// Dev-doc blocks: React-free schema + MDX config paired with the shared React\n// Read/Edit renderers. Composed into full specs below with canonical metadata.\nimport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./mermaid.config.js\";\nimport { MermaidRead, MermaidEdit } from \"./MermaidBlock.js\";\nimport {\n apiEndpointSchema,\n apiEndpointMdx,\n type ApiEndpointData,\n} from \"./api-endpoint.config.js\";\nimport { ApiEndpointRead, ApiEndpointEdit } from \"./ApiEndpointBlock.js\";\nimport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./openapi-spec.config.js\";\nimport { OpenApiSpecRead, OpenApiSpecEdit } from \"./OpenApiSpecBlock.js\";\nimport {\n dataModelSchema,\n dataModelMdx,\n type DataModelData,\n} from \"./data-model.config.js\";\nimport { DataModelRead, DataModelEdit } from \"./DataModelBlock.js\";\nimport { diffSchema, diffMdx, type DiffData } from \"./diff.config.js\";\nimport { DiffRead, DiffEdit } from \"./DiffBlock.js\";\nimport {\n fileTreeSchema,\n fileTreeMdx,\n type FileTreeData,\n} from \"./file-tree.config.js\";\nimport { FileTreeRead, FileTreeEdit } from \"./FileTreeBlock.js\";\nimport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n JSON_EXPLORER_DEFAULT_COLLAPSED_DEPTH,\n type JsonExplorerData,\n} from \"./json-explorer.config.js\";\nimport { JsonExplorerRead, JsonExplorerEdit } from \"./JsonExplorerBlock.js\";\nimport {\n annotatedCodeSchema,\n annotatedCodeMdx,\n type AnnotatedCodeData,\n} from \"./annotated-code.config.js\";\nimport { AnnotatedCodeRead, AnnotatedCodeEdit } from \"./AnnotatedCodeBlock.js\";\n\n/**\n * Canonical specs for the standard library's dev-doc blocks (Mermaid, API\n * endpoint, OpenAPI spec, data model, diff, file tree, JSON explorer,\n * annotated code).\n * Each pairs the shared React-free schema/MDX config\n * with the shared React `Read`/`Edit` renderers and the canonical\n * label/description/editSurface/empty metadata. Apps that need a slightly\n * different label/description/empty for a block pass an override to\n * {@link registerLibraryBlocks} rather than re-authoring the whole spec.\n *\n * The six fully pre-built standard specs (checklist, table, code-tabs, html,\n * tabs, columns) already bundle their metadata in their own modules, so they are appended\n * by {@link libraryBlockSpecs} rather than re-declared here.\n */\n// Typed `BlockSpec<any>[]` (not `BlockSpec<unknown>[]`) so the per-block generic\n// data types coexist in one array — mirroring `registerBlocks`' own signature,\n// where `childrenField: keyof TData` would otherwise collapse to `never`.\nconst devDocBlockSpecs: BlockSpec<any>[] = [\n defineBlock<MermaidData>({\n type: \"mermaid\",\n schema: mermaidSchema,\n mdx: mermaidMdx,\n Read: MermaidRead,\n Edit: MermaidEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Diagram (Mermaid)\",\n description:\n \"A Mermaid diagram (flowchart, sequence, etc.) defined as text and rendered as a diagram.\",\n empty: () => ({\n source:\n \"flowchart TD\\n A[Start] --> B{Decision}\\n B -->|Yes| C[Do it]\\n B -->|No| D[Skip]\",\n }),\n }),\n defineBlock<ApiEndpointData>({\n type: \"api-endpoint\",\n schema: apiEndpointSchema,\n mdx: apiEndpointMdx,\n Read: ApiEndpointRead,\n Edit: ApiEndpointEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"API endpoint\",\n description:\n \"A Swagger-style API endpoint reference: a colored method pill + path, collapsed by default, expanding to params, request body, and per-status response examples.\",\n empty: () => ({ method: \"GET\", path: \"/api/resource\" }),\n }),\n defineBlock<OpenApiSpecData>({\n type: \"openapi-spec\",\n schema: openApiSpecSchema,\n mdx: openApiSpecMdx,\n Read: OpenApiSpecRead,\n Edit: OpenApiSpecEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"OpenAPI spec\",\n description:\n \"A whole-document API specification / Redoc / Swagger-UI-style API reference rendered from a complete OpenAPI 3 / Swagger 2 spec (JSON): operations grouped by tag, each a collapsible row expanding to params, request body, and per-status responses, with $ref models resolved.\",\n empty: () => ({\n spec: JSON.stringify(\n {\n openapi: \"3.0.0\",\n info: { title: \"Example API\", version: \"1.0.0\" },\n tags: [{ name: \"widgets\", description: \"Manage widgets\" }],\n paths: {\n \"/widgets\": {\n get: {\n tags: [\"widgets\"],\n summary: \"List widgets\",\n responses: { \"200\": { description: \"OK\" } },\n },\n },\n },\n },\n null,\n 2,\n ),\n }),\n }),\n defineBlock<DataModelData>({\n type: \"data-model\",\n schema: dataModelSchema,\n mdx: dataModelMdx,\n Read: DataModelRead,\n Edit: DataModelEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Data model\",\n description:\n \"A schema modeling / ERD / dbdiagram-style data model: entity cards with typed fields (PK/FK/nullable flags) and interactive foreign-key relations.\",\n empty: () => ({\n entities: [\n {\n id: \"e_user\",\n name: \"User\",\n fields: [\n { name: \"id\", type: \"uuid\", pk: true },\n { name: \"email\", type: \"text\" },\n ],\n },\n ],\n }),\n }),\n defineBlock<DiffData>({\n type: \"diff\",\n schema: diffSchema,\n mdx: diffMdx,\n Read: DiffRead,\n Edit: DiffEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Diff\",\n description:\n \"A GitHub-style before/after line diff for a file, with unified or split (side-by-side) view, added/removed line highlighting, and collapsible unchanged runs.\",\n empty: () => ({\n before: \"function add(a, b) {\\n return a + b;\\n}\",\n after: \"function add(a: number, b: number): number {\\n return a + b;\\n}\",\n language: \"ts\",\n }),\n }),\n defineBlock<FileTreeData>({\n type: \"file-tree\",\n schema: fileTreeSchema,\n mdx: fileTreeMdx,\n Read: FileTreeRead,\n Edit: FileTreeEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"File tree\",\n description:\n \"A VS Code / GitHub-explorer file and change tree derived from slash-delimited paths, with per-file change badges (added/modified/removed/renamed), notes, and code snippets.\",\n empty: () => ({\n entries: [\n {\n path: \"src/index.ts\",\n change: \"modified\",\n note: \"Wire the new route here.\",\n },\n { path: \"src/routes/git.ts\", change: \"added\" },\n ],\n }),\n }),\n defineBlock<JsonExplorerData>({\n type: \"json-explorer\",\n schema: jsonExplorerSchema,\n mdx: jsonExplorerMdx,\n Read: JsonExplorerRead,\n Edit: JsonExplorerEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"JSON explorer\",\n description:\n \"A collapsible browser-devtools / Postman-style JSON tree with type-colored values and expand/collapse.\",\n empty: () => ({\n json: JSON.stringify(\n {\n id: \"abc123\",\n active: true,\n tags: [\"alpha\", \"beta\"],\n meta: { count: 2, owner: null },\n },\n null,\n 2,\n ),\n collapsedDepth: JSON_EXPLORER_DEFAULT_COLLAPSED_DEPTH,\n }),\n }),\n defineBlock<AnnotatedCodeData>({\n type: \"annotated-code\",\n schema: annotatedCodeSchema,\n mdx: annotatedCodeMdx,\n Read: AnnotatedCodeRead,\n Edit: AnnotatedCodeEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Annotated code\",\n description:\n \"A line-numbered code walkthrough whose line ranges carry anchored explanatory notes (Stripe-docs / Sourcegraph explain-this-code style).\",\n empty: () => ({\n filename: \"src/server/auth.ts\",\n language: \"ts\",\n code: \"export function resolveAuth(provider: string) {\\n const cfg = providers[provider];\\n return cfg.token;\\n}\",\n annotations: [\n {\n lines: \"2\",\n label: \"Lookup\",\n note: \"Resolves the provider config by key.\",\n },\n ],\n }),\n }),\n];\n\n/**\n * The full standard library spec set, in registration order: the fully pre-built\n * specs (checklist, table, code-tabs, html, tabs, columns) followed by the eight\n * dev-doc specs. This is the single list both the plan and content browser\n * registries register — adding a library block here lands in both apps.\n */\nexport const libraryBlockSpecs: BlockSpec<any>[] = [\n checklistBlock,\n tableBlock,\n codeBlock,\n codeTabsBlock,\n htmlBlock,\n tabsBlock,\n columnsBlock,\n ...devDocBlockSpecs,\n];\n\n/**\n * Per-block metadata overrides for {@link registerLibraryBlocks}, keyed by the\n * canonical block `type`. Lets an app tweak the few fields that legitimately\n * differ (a `type` rename, a tweaked `description` or `empty` seed) without\n * re-authoring the spec. Anything omitted keeps the canonical value, so the\n * schema / MDX config and the React `Read`/`Edit` renderers always stay shared.\n */\nexport type LibraryBlockOverrides = Record<\n string,\n Partial<Pick<BlockSpec<any>, \"type\" | \"label\" | \"description\" | \"empty\">>\n>;\n\n/**\n * Register the standard library block specs into a {@link BlockRegistry}. Both\n * the plan and content browser registries call this, then register only their\n * own app-specific blocks on top — so the shared library lives in exactly one\n * place. Pass `overrides` (keyed by canonical `type`) for the small per-app\n * differences (content re-types `table` → `table-block`; each app phrases the\n * Mermaid description and seeds the OpenAPI example a little differently).\n */\nexport function registerLibraryBlocks(\n registry: BlockRegistry,\n options: { overrides?: LibraryBlockOverrides } = {},\n): void {\n const overrides = options.overrides ?? {};\n const specs = libraryBlockSpecs.map((spec) => {\n const override = overrides[spec.type];\n return override ? ({ ...spec, ...override } as BlockSpec<any>) : spec;\n });\n registerBlocks(registry, specs);\n}\n"]}
@@ -27,5 +27,6 @@ export { dataModelSchema, dataModelMdx, DATA_MODEL_RELATION_KINDS, type DataMode
27
27
  export { diffSchema, diffMdx, type DiffData, type DiffMode, } from "./library/diff.config.js";
28
28
  export { fileTreeSchema, fileTreeMdx, FILE_TREE_CHANGES, type FileTreeData, type FileTreeEntry, type FileTreeChange, } from "./library/file-tree.config.js";
29
29
  export { jsonExplorerSchema, jsonExplorerMdx, type JsonExplorerData, } from "./library/json-explorer.config.js";
30
+ export { annotatedCodeSchema, annotatedCodeMdx, type AnnotatedCodeData, type AnnotatedCodeAnnotation, } from "./library/annotated-code.config.js";
30
31
  export { openApiSpecSchema, openApiSpecMdx, type OpenApiSpecData, } from "./library/openapi-spec.config.js";
31
32
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/client/blocks/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,WAAW,EACX,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,KAAK,SAAS,EACd,KAAK,eAAe,GACrB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,UAAU,CAAC;AAEl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Q,EACb,KAAK,QAAQ,GACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,KAAK,gBAAgB,GACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,KAAK,eAAe,GACrB,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/client/blocks/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,WAAW,EACX,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,KAAK,SAAS,EACd,KAAK,eAAe,GACrB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,sBAAsB,EACtB,8BAA8B,EAC9B,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AAMpB,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,KAAK,2BAA2B,GACjC,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EACL,eAAe,EACf,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,+BAA+B,CAAC;AACvC,OA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,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,GAC7B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,KAAK,eAAe,GACrB,MAAM,kCAAkC,CAAC"}
@@ -37,5 +37,6 @@ export { dataModelSchema, dataModelMdx, DATA_MODEL_RELATION_KINDS, } from "./lib
37
37
  export { diffSchema, diffMdx, } from "./library/diff.config.js";
38
38
  export { fileTreeSchema, fileTreeMdx, FILE_TREE_CHANGES, } from "./library/file-tree.config.js";
39
39
  export { jsonExplorerSchema, jsonExplorerMdx, } from "./library/json-explorer.config.js";
40
+ export { annotatedCodeSchema, annotatedCodeMdx, } from "./library/annotated-code.config.js";
40
41
  export { openApiSpecSchema, openApiSpecMdx, } from "./library/openapi-spec.config.js";
41
42
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/client/blocks/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,WAAW,GAOZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,GAGX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GAKf,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAE/B,MAAM,YAAY,CAAC;AAEpB,8EAA8E;AAC9E,iFAAiF;AACjF,+EAA+E;AAC/E,+EAA+E;AAC/E,OAAO,EACL,mBAAmB,EACnB,2BAA2B,GAE5B,MAAM,2BAA2B,CAAC;AAEnC,0EAA0E;AAC1E,0EAA0E;AAC1E,uDAAuD;AACvD,OAAO,EACL,eAAe,EACf,YAAY,GAGb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,WAAW,EACX,QAAQ,GAET,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,UAAU,EACV,OAAO,GAER,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EACV,OAAO,GAIR,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,aAAa,EACb,UAAU,GAGX,MAAM,6BAA6B,CAAC;AAErC,yEAAyE;AACzE,gFAAgF;AAChF,gEAAgE;AAChE,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,GAOpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,YAAY,EACZ,yBAAyB,GAM1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,UAAU,EACV,OAAO,GAGR,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,cAAc,EACd,WAAW,EACX,iBAAiB,GAIlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,eAAe,GAEhB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,kCAAkC,CAAC","sourcesContent":["/**\n * `@agent-native/core/blocks/server` — the React-free subset of the block\n * registry for server / agent code (MDX serialize/parse, the registry, schema\n * introspection, the `markdown()` helper, agent schema export). Importing this\n * entry never pulls React into the server bundle.\n *\n * A `BlockSpec` carries React (`Read`/`Edit`) and pure (`schema`/`mdx`) parts in\n * the same object; the server path only touches `spec.schema` / `spec.mdx`. The\n * app's registry module is shared by browser and server, but the server only\n * ever calls these React-free functions on it.\n */\n\nexport {\n defineBlock,\n type BlockSpec,\n type BlockPlacement,\n type BlockMdxConfig,\n type BlockAttrReader,\n type MdxAttrValue,\n type NestedBlock,\n} from \"./types.js\";\n\nexport { BlockRegistry, registerBlocks } from \"./registry.js\";\n\nexport {\n markdown,\n richtext,\n introspect,\n type FieldKind,\n type FieldDescriptor,\n} from \"./schema-form/introspect.js\";\n\nexport {\n prop,\n escapeAttr,\n jsonExpression,\n attributeValue,\n createAttrReader,\n serializeSpecBlock,\n parseSpecBlock,\n type MdxJsxNode,\n type MdxAttrNode,\n type SerializableBlock,\n type ParsedBlockBase,\n} from \"./mdx.js\";\n\nexport {\n describeBlocksForAgent,\n renderBlockVocabularyReference,\n type BlockAgentDoc,\n} from \"./agent.js\";\n\n// Standard library registration (React-free). Server / shared registries call\n// `registerLibraryBlockConfigs(registry)` to register the whole standard library\n// as `Read: () => null` config stubs in one place, then add their app-specific\n// block configs on top. `libraryBlockConfigs` is the underlying ordered array.\nexport {\n libraryBlockConfigs,\n registerLibraryBlockConfigs,\n type LibraryBlockConfigOverrides,\n} from \"./library/server-specs.js\";\n\n// Standard block library — React-free schema + MDX config only. The React\n// `Read`/`Edit` live in `./library/checklist.tsx` (imported from the full\n// `@agent-native/core/blocks` entry), never from here.\nexport {\n checklistSchema,\n checklistMdx,\n type ChecklistData,\n type ChecklistItem,\n} from \"./library/checklist.config.js\";\nexport {\n tableSchema,\n tableMdx,\n type TableData,\n} from \"./library/table.config.js\";\nexport {\n codeTabsSchema,\n codeTabsMdx,\n type CodeTabsData,\n type CodeTabsTab,\n} from \"./library/code-tabs.config.js\";\nexport {\n htmlSchema,\n htmlMdx,\n type HtmlBlockData,\n} from \"./library/html.config.js\";\nexport {\n tabsSchema,\n tabsMdx,\n type TabsData,\n type TabsOrientation,\n type TabsTab,\n} from \"./library/tabs.config.js\";\nexport {\n columnsSchema,\n columnsMdx,\n type ColumnsData,\n type ColumnsColumn,\n} from \"./library/columns.config.js\";\n\n// Dev-doc block library — React-free schema + MDX config only. The React\n// `Read`/`Edit` live in the matching `./library/<Name>Block.tsx` (imported from\n// the full `@agent-native/core/blocks` entry), never from here.\nexport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./library/mermaid.config.js\";\nexport {\n apiEndpointSchema,\n apiEndpointMdx,\n API_ENDPOINT_METHODS,\n API_PARAM_LOCATIONS,\n type ApiEndpointData,\n type ApiEndpointMethod,\n type ApiEndpointParam,\n type ApiEndpointRequest,\n type ApiEndpointResponse,\n type ApiParamLocation,\n} from \"./library/api-endpoint.config.js\";\nexport {\n dataModelSchema,\n dataModelMdx,\n DATA_MODEL_RELATION_KINDS,\n type DataModelData,\n type DataModelEntity,\n type DataModelField,\n type DataModelRelation,\n type DataModelRelationKind,\n} from \"./library/data-model.config.js\";\nexport {\n diffSchema,\n diffMdx,\n type DiffData,\n type DiffMode,\n} from \"./library/diff.config.js\";\nexport {\n fileTreeSchema,\n fileTreeMdx,\n FILE_TREE_CHANGES,\n type FileTreeData,\n type FileTreeEntry,\n type FileTreeChange,\n} from \"./library/file-tree.config.js\";\nexport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n type JsonExplorerData,\n} from \"./library/json-explorer.config.js\";\nexport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./library/openapi-spec.config.js\";\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/client/blocks/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,WAAW,GAOZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,GAGX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GAKf,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAE/B,MAAM,YAAY,CAAC;AAEpB,8EAA8E;AAC9E,iFAAiF;AACjF,+EAA+E;AAC/E,+EAA+E;AAC/E,OAAO,EACL,mBAAmB,EACnB,2BAA2B,GAE5B,MAAM,2BAA2B,CAAC;AAEnC,0EAA0E;AAC1E,0EAA0E;AAC1E,uDAAuD;AACvD,OAAO,EACL,eAAe,EACf,YAAY,GAGb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,WAAW,EACX,QAAQ,GAET,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,UAAU,EACV,OAAO,GAER,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EACV,OAAO,GAIR,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,aAAa,EACb,UAAU,GAGX,MAAM,6BAA6B,CAAC;AAErC,yEAAyE;AACzE,gFAAgF;AAChF,gEAAgE;AAChE,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,GAOpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,YAAY,EACZ,yBAAyB,GAM1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,UAAU,EACV,OAAO,GAGR,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,cAAc,EACd,WAAW,EACX,iBAAiB,GAIlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,eAAe,GAEhB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GAGjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,kCAAkC,CAAC","sourcesContent":["/**\n * `@agent-native/core/blocks/server` — the React-free subset of the block\n * registry for server / agent code (MDX serialize/parse, the registry, schema\n * introspection, the `markdown()` helper, agent schema export). Importing this\n * entry never pulls React into the server bundle.\n *\n * A `BlockSpec` carries React (`Read`/`Edit`) and pure (`schema`/`mdx`) parts in\n * the same object; the server path only touches `spec.schema` / `spec.mdx`. The\n * app's registry module is shared by browser and server, but the server only\n * ever calls these React-free functions on it.\n */\n\nexport {\n defineBlock,\n type BlockSpec,\n type BlockPlacement,\n type BlockMdxConfig,\n type BlockAttrReader,\n type MdxAttrValue,\n type NestedBlock,\n} from \"./types.js\";\n\nexport { BlockRegistry, registerBlocks } from \"./registry.js\";\n\nexport {\n markdown,\n richtext,\n introspect,\n type FieldKind,\n type FieldDescriptor,\n} from \"./schema-form/introspect.js\";\n\nexport {\n prop,\n escapeAttr,\n jsonExpression,\n attributeValue,\n createAttrReader,\n serializeSpecBlock,\n parseSpecBlock,\n type MdxJsxNode,\n type MdxAttrNode,\n type SerializableBlock,\n type ParsedBlockBase,\n} from \"./mdx.js\";\n\nexport {\n describeBlocksForAgent,\n renderBlockVocabularyReference,\n type BlockAgentDoc,\n} from \"./agent.js\";\n\n// Standard library registration (React-free). Server / shared registries call\n// `registerLibraryBlockConfigs(registry)` to register the whole standard library\n// as `Read: () => null` config stubs in one place, then add their app-specific\n// block configs on top. `libraryBlockConfigs` is the underlying ordered array.\nexport {\n libraryBlockConfigs,\n registerLibraryBlockConfigs,\n type LibraryBlockConfigOverrides,\n} from \"./library/server-specs.js\";\n\n// Standard block library — React-free schema + MDX config only. The React\n// `Read`/`Edit` live in `./library/checklist.tsx` (imported from the full\n// `@agent-native/core/blocks` entry), never from here.\nexport {\n checklistSchema,\n checklistMdx,\n type ChecklistData,\n type ChecklistItem,\n} from \"./library/checklist.config.js\";\nexport {\n tableSchema,\n tableMdx,\n type TableData,\n} from \"./library/table.config.js\";\nexport {\n codeTabsSchema,\n codeTabsMdx,\n type CodeTabsData,\n type CodeTabsTab,\n} from \"./library/code-tabs.config.js\";\nexport {\n htmlSchema,\n htmlMdx,\n type HtmlBlockData,\n} from \"./library/html.config.js\";\nexport {\n tabsSchema,\n tabsMdx,\n type TabsData,\n type TabsOrientation,\n type TabsTab,\n} from \"./library/tabs.config.js\";\nexport {\n columnsSchema,\n columnsMdx,\n type ColumnsData,\n type ColumnsColumn,\n} from \"./library/columns.config.js\";\n\n// Dev-doc block library — React-free schema + MDX config only. The React\n// `Read`/`Edit` live in the matching `./library/<Name>Block.tsx` (imported from\n// the full `@agent-native/core/blocks` entry), never from here.\nexport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./library/mermaid.config.js\";\nexport {\n apiEndpointSchema,\n apiEndpointMdx,\n API_ENDPOINT_METHODS,\n API_PARAM_LOCATIONS,\n type ApiEndpointData,\n type ApiEndpointMethod,\n type ApiEndpointParam,\n type ApiEndpointRequest,\n type ApiEndpointResponse,\n type ApiParamLocation,\n} from \"./library/api-endpoint.config.js\";\nexport {\n dataModelSchema,\n dataModelMdx,\n DATA_MODEL_RELATION_KINDS,\n type DataModelData,\n type DataModelEntity,\n type DataModelField,\n type DataModelRelation,\n type DataModelRelationKind,\n} from \"./library/data-model.config.js\";\nexport {\n diffSchema,\n diffMdx,\n type DiffData,\n type DiffMode,\n} from \"./library/diff.config.js\";\nexport {\n fileTreeSchema,\n fileTreeMdx,\n FILE_TREE_CHANGES,\n type FileTreeData,\n type FileTreeEntry,\n type FileTreeChange,\n} from \"./library/file-tree.config.js\";\nexport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n type JsonExplorerData,\n} from \"./library/json-explorer.config.js\";\nexport {\n annotatedCodeSchema,\n annotatedCodeMdx,\n type AnnotatedCodeData,\n type AnnotatedCodeAnnotation,\n} from \"./library/annotated-code.config.js\";\nexport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./library/openapi-spec.config.js\";\n"]}
@@ -287,7 +287,7 @@ export interface BlockSpec<TData = unknown> {
287
287
  * per-app sets. Set it on registry-atom blocks with an NFM counterpart
288
288
  * (checklist, table); leave it `false`/undefined on dev-doc blocks
289
289
  * (api-endpoint, openapi-spec, data-model, diff, file-tree, json-explorer,
290
- * mermaid, custom-html, tabs, code-tabs) and visual/plan-only
290
+ * annotated-code, mermaid, custom-html, tabs, code-tabs) and visual/plan-only
291
291
  * blocks (wireframe, diagram). Prose blocks that aren't registry atoms
292
292
  * (rich-text, callout) carry their NFM analog through the prose path, not this
293
293
  * flag.
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/blocks/types.ts"],"names":[],"mappings":"AAmWA,qEAAqE;AACrE,MAAM,UAAU,WAAW,CAAQ,IAAsB;IACvD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { FC } from \"react\";\nimport type { ZodType } from \"zod\";\n\n/**\n * Block-registry contract. A `BlockSpec` describes one document block end to end:\n * its data shape (`schema`), how it round-trips to MDX source (`mdx`), how it\n * renders read-only (`Read`) and how it is edited (`Edit`, or an auto-generated\n * schema-driven editor when omitted), where it can be placed (`placement`), and\n * metadata for menus / agent schema export.\n *\n * The registry runs ALONGSIDE existing per-block code (the plan `PlanBlockView`\n * switch + `serializeBlock`/`parseBlock`). Renderers check the registry first;\n * unregistered block types fall through to the legacy code path unchanged. The\n * MDX `tag` and attribute shape for a converted block MUST match the historical\n * encoding (e.g. `<Callout tone>…body…</Callout>`) so stored `.mdx` files still\n * parse byte-compatibly.\n */\n\n/** Where a block can be placed in a document. */\nexport type BlockPlacement = \"block\" | \"inline\";\n\n/**\n * A serialized MDX/NFM attribute value before the shared `prop()` encoder runs.\n * `prop()` decides string-vs-JSON encoding; this is just the value domain.\n */\nexport type MdxAttrValue =\n | string\n | number\n | boolean\n | unknown[]\n | Record<string, unknown>;\n\n/**\n * Type-narrowed reader over the resolved MDX attributes of a parsed block node.\n * The values are already estree/JSON-resolved by the shared attribute reader\n * (the same engine `plan-mdx.ts` uses), so a spec's `fromAttrs` never touches\n * the AST directly.\n */\nexport interface BlockAttrReader {\n string(name: string): string | undefined;\n number(name: string): number | undefined;\n bool(name: string): boolean | undefined;\n array<T = unknown>(name: string): T[] | undefined;\n object<T = unknown>(name: string): T | undefined;\n raw(name: string): unknown;\n}\n\n/**\n * Maps a block's validated data to/from its MDX component representation.\n * `tag` is the JSX component name in source (e.g. \"Callout\"). It MUST match the\n * historical name in `plan-mdx.ts` `BLOCK_COMPONENTS` / stored `.mdx` files or\n * existing plans break.\n */\nexport interface BlockMdxConfig<TData> {\n /** JSX component name in MDX source. Stable contract — never rename. */\n tag: string;\n /**\n * Encode `data` → a flat attribute bag. The registry serializer runs each\n * value through the shared `prop()` encoder (string-vs-JSON heuristic) and\n * preserves insertion order, so write the keys in the exact historical order.\n * Return `undefined` for a key (or omit it) to drop the attribute. When\n * `childrenField` is set, that field is excluded from the attribute bag.\n */\n toAttrs: (data: TData) => Record<string, MdxAttrValue | undefined>;\n /**\n * Decode resolved attributes (+ optional children markdown) → data. Must\n * tolerate missing/partial attributes for backward-compat (mirror today's\n * `?? []` / `?? \"\"` defaults).\n */\n fromAttrs: (attrs: BlockAttrReader, children: string) => TData;\n /**\n * When set, this data field is a markdown string serialized as MDX *children*\n * between the open/close tags (prose-bearing blocks: rich-text, callout)\n * rather than as a prop — so the body survives as real, inline-editable MDX\n * prose in source.\n */\n childrenField?: keyof TData & string;\n /**\n * Opt-in custom children serializer for blocks whose internals are nested MDX\n * components rather than a single markdown string (e.g. wireframe → Screen/kit\n * primitives). When present it overrides `childrenField`. `serializeChildren`\n * returns the raw inner MDX; `parseChildren` receives the child MDX AST nodes.\n */\n serializeChildren?: (data: TData) => string;\n parseChildren?: (childNodes: unknown[], idContext: string) => Partial<TData>;\n}\n\n/**\n * App-injected capabilities. Core blocks stay app-agnostic by taking these\n * rather than importing app services — mirroring `createImageExtension`'s\n * `onImageUpload` injection. Provided via `BlockRegistryProvider`.\n */\nexport interface BlockRenderContext {\n /** Markdown dialect for the auto-editor's rich-text field. */\n dialect?: \"gfm\" | \"nfm\";\n /** Resolve an asset id → displayable URL. */\n resolveAssetSrc?: (assetId: string) => string | undefined;\n /** Open the shared asset picker (returns the chosen asset). */\n pickAsset?: () => Promise<{ assetId: string; url?: string } | null>;\n /** Upload a local file, returns a hosted URL. */\n uploadFile?: (file: File) => Promise<{ url: string; assetId?: string }>;\n /** Call an app action by name (for blocks that fetch live data). */\n callAction?: (name: string, args: unknown) => Promise<unknown>;\n /** Sanitizer for HTML-bearing blocks. Provided by the app/core. */\n sanitizeHtml?: (html: string, css?: string) => string;\n /**\n * Render a markdown string with the app's read-only markdown renderer. Lets a\n * core block (whose `Read` lives in core) defer prose rendering to the app's\n * markdown reader (e.g. the plan `PlanMarkdownReader`) without importing it.\n */\n renderMarkdown?: (\n markdown: string,\n options?: { className?: string },\n ) => React.ReactNode;\n /**\n * Render an inline, editable rich-markdown field. The auto-editor calls this\n * for a `markdown()`-tagged field so the app owns the editor wiring (collab,\n * autosave debounce, dialect) rather than core hardcoding it.\n */\n renderMarkdownEditor?: (props: {\n value: string;\n onChange: (next: string) => void;\n editable: boolean;\n blockId?: string;\n className?: string;\n ariaLabel?: string;\n }) => React.ReactNode;\n /**\n * Render an app-owned \"Edit with AI\" affordance for a focused/editable block\n * field. Core block editors pass the current field value and nearby companion\n * fields; the host app decides how to collect the prompt and route it to the\n * agent sidebar. This keeps reusable core blocks from importing app-specific\n * popover/composer code while still exposing a generic AI edit hook.\n */\n renderAiFieldAction?: (props: BlockAiFieldActionProps) => React.ReactNode;\n /**\n * Render a nested child block through the app's own block dispatcher. Container\n * blocks whose `Read`/`Edit` live in core (e.g. tabs) call this to render each\n * child so the recursion keeps flowing through the SAME app renderer the\n * top-level document uses — registered children render via their spec, and\n * unregistered (not-yet-converted) children still fall through the app's legacy\n * switch. This is the coexistence seam: a core container never has to know\n * about app-specific child block types. Returns `null`/`undefined` when no\n * dispatcher is wired (read-only/SSR-only contexts can omit it).\n */\n renderBlock?: (props: {\n block: NestedBlock;\n /** Commit a replacement for this child block (edit mode only). */\n onChange?: (next: NestedBlock) => void;\n /** Whether the parent container is being edited. */\n editing?: boolean;\n /** Tighten embedded visuals in dense contexts (e.g. tab panes). */\n compactVisuals?: boolean;\n }) => React.ReactNode;\n /**\n * Render a nested editable block list through the host app's document editor.\n * Container blocks such as columns call this for each editable region so slash\n * commands, nested structured blocks, and ordinary prose behave like the\n * top-level document while the container still persists its normalized runtime\n * data. Source adapters may still expose a human-friendly nested MDX form\n * (for example `<Columns><Column>markdown</Column></Columns>`) and normalize it\n * into these block arrays at runtime.\n */\n renderBlocksEditor?: (props: {\n blocks: NestedBlock[];\n onChange: (blocks: NestedBlock[]) => void;\n editable: boolean;\n containerBlockId: string;\n regionId: string;\n regionLabel?: string;\n /** Tighten embedded visuals in dense regions such as tab panes. */\n compactVisuals?: boolean;\n }) => React.ReactNode;\n /**\n * Wrap a block's edit form in an app-provided \"panel\" surface (e.g. a shadcn\n * Popover anchored to the corner edit button) for `editSurface: \"panel\"`\n * blocks. Core renders the rendered `Read` view plus a corner trigger button\n * and the form, then hands them here so the app owns the overlay primitive\n * (core stays shadcn-free, mirroring `renderMarkdownEditor`). When omitted, a\n * panel-mode block falls back to inline editing. `title` is the block label.\n */\n renderEditSurface?: (props: {\n title: string;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n trigger: React.ReactNode;\n children: React.ReactNode;\n /** Metadata for host-provided contextual controls such as \"Edit with AI\". */\n blockId?: string;\n blockType?: string;\n blockTitle?: string;\n blockSummary?: string;\n blockData?: unknown;\n }) => React.ReactNode;\n}\n\nexport interface BlockAiFieldActionProps {\n blockId: string;\n blockType: string;\n blockTitle?: string;\n blockSummary?: string;\n fieldLabel: string;\n fieldValue: string;\n draftScope: string;\n disabled?: boolean;\n /**\n * Human-readable instructions for the host agent prompt. Mention how to patch\n * the block and which sibling fields should be preserved.\n */\n instructions: string;\n companionFields?: Array<{\n label: string;\n value: string;\n language?: string;\n }>;\n}\n\n/**\n * The minimal shape of a nested child block passed to {@link\n * BlockRenderContext.renderBlock}. It mirrors the app's block union loosely (the\n * app casts it back to its own block type) — a discriminating `type`, a stable\n * `id`, optional heading/summary, and the type-specific `data`.\n */\nexport interface NestedBlock {\n type: string;\n id: string;\n title?: string;\n summary?: string;\n data: unknown;\n [key: string]: unknown;\n}\n\nexport interface BlockContainerRegion {\n id: string;\n label?: string;\n blocks: NestedBlock[];\n}\n\nexport interface BlockContainerSpec<TData> {\n regions: (data: TData) => BlockContainerRegion[];\n updateRegion: (data: TData, regionId: string, blocks: NestedBlock[]) => TData;\n addRegion?: (data: TData, afterRegionId?: string) => TData;\n removeRegion?: (data: TData, regionId: string) => TData;\n reorderRegion?: (\n data: TData,\n fromRegionId: string,\n toRegionId: string,\n ) => TData;\n}\n\nexport type BlockDataChangeMeta = {\n containerRegion?: {\n regionId: string;\n blocks: NestedBlock[];\n };\n};\n\n/** Props passed to a block's read-only renderer. */\nexport interface BlockReadProps<TData> {\n data: TData;\n /** Stable block id (for anchors, comment targeting, source patches). */\n blockId: string;\n /** Block heading, when present. */\n title?: string;\n /** Block trailing summary, when present. */\n summary?: string;\n /** Injected app capabilities. */\n ctx: BlockRenderContext;\n}\n\n/** Props passed to a block's editor (custom or schema-generated). */\nexport interface BlockEditProps<TData> {\n data: TData;\n onChange: (next: TData, meta?: BlockDataChangeMeta) => void;\n editable: boolean;\n blockId: string;\n title?: string;\n summary?: string;\n /** Injected app capabilities. */\n ctx: BlockRenderContext;\n}\n\nexport interface BlockSpec<TData = unknown> {\n /** Discriminator. Equals the runtime block `type`. */\n type: string;\n /** Zod schema for `data`. Drives validation AND the schema-auto-editor. */\n schema: ZodType<TData>;\n /** MDX round-trip config. */\n mdx: BlockMdxConfig<TData>;\n /** Read-only renderer (replaces a `PlanBlockView` switch branch / NodeView). */\n Read: FC<BlockReadProps<TData>>;\n /**\n * Optional editor. When omitted, the registry renders the schema-driven\n * `SchemaBlockEditor` generated from `schema`. Supply for full control\n * (wireframe canvas, diagram editor).\n */\n Edit?: FC<BlockEditProps<TData>>;\n /** Allowed placements: `[\"block\"]`, `[\"inline\"]`, or both. */\n placement: BlockPlacement[];\n /**\n * When `true`, this block's data maps to a Notion-Flavored-Markdown (NFM)\n * analog and therefore round-trips into a Notion page. Apps can derive\n * registry-backed Notion allowlists with\n * {@link BlockRegistry.notionCompatibleTypes} instead of hand-maintaining\n * per-app sets. Set it on registry-atom blocks with an NFM counterpart\n * (checklist, table); leave it `false`/undefined on dev-doc blocks\n * (api-endpoint, openapi-spec, data-model, diff, file-tree, json-explorer,\n * mermaid, custom-html, tabs, code-tabs) and visual/plan-only\n * blocks (wireframe, diagram). Prose blocks that aren't registry atoms\n * (rich-text, callout) carry their NFM analog through the prose path, not this\n * flag.\n */\n notionCompatible?: boolean;\n /**\n * How the block is edited in a `block`-placed document:\n * - `\"inline\"` — the `Edit`/auto-form renders in place for direct\n * manipulation of authored content (prose, checklist text, table cells,\n * code bodies). Schema-ish metadata such as tone/type, tab labels,\n * language, density, or structural settings should still be tucked behind a\n * contextual edit/settings affordance inside the custom `Edit`.\n * - `\"panel\"` — the block shows its rendered `Read` view with a corner edit\n * button that opens the `Edit`/auto-form in an app-provided panel (popover).\n * Best for config-driven blocks whose render differs from their props\n * (custom HTML, charts, any user-registered block).\n * - `\"container\"` — the block renders its `Edit` in place, and that editor\n * may call `ctx.renderBlocksEditor` for nested block regions with normal\n * slash commands and nested structured blocks.\n * Defaults to `\"inline\"` when a custom `Edit` is supplied, else `\"panel\"`\n * (auto-form blocks are property forms, ideal for a panel). The app must wire\n * `ctx.renderEditSurface` for `\"panel\"` to take effect; otherwise it falls\n * back to inline.\n */\n editSurface?: \"inline\" | \"panel\" | \"container\";\n /**\n * Optional generic contract for content-bearing container blocks. Keep this\n * runtime-oriented: it describes editable regions over normalized block arrays;\n * source formats can provide readable nested MDX adapters independently.\n */\n container?: BlockContainerSpec<TData>;\n /** Human label for menus + agent schema export. */\n label: string;\n /** Tabler icon component for UI menus (never emoji/robot/sparkle). */\n icon?: FC<{ size?: number; className?: string }>;\n /** One-line description for the agent schema export. */\n description: string;\n /** Optional default `data` factory for slash-menu insertion (an empty block). */\n empty?: () => TData;\n /**\n * Optional block-specific source-patch handlers, generalizing bespoke ops\n * like `update-custom-html`. Keyed by op name; the registry dispatches a\n * matching patch op here. Generic ops (`update-block` shallow-merge) need none.\n */\n patches?: Record<string, (data: TData, op: Record<string, unknown>) => TData>;\n}\n\n/** Identity helper for authoring a spec with full type inference. */\nexport function defineBlock<TData>(spec: BlockSpec<TData>): BlockSpec<TData> {\n return spec;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/blocks/types.ts"],"names":[],"mappings":"AAmWA,qEAAqE;AACrE,MAAM,UAAU,WAAW,CAAQ,IAAsB;IACvD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { FC } from \"react\";\nimport type { ZodType } from \"zod\";\n\n/**\n * Block-registry contract. A `BlockSpec` describes one document block end to end:\n * its data shape (`schema`), how it round-trips to MDX source (`mdx`), how it\n * renders read-only (`Read`) and how it is edited (`Edit`, or an auto-generated\n * schema-driven editor when omitted), where it can be placed (`placement`), and\n * metadata for menus / agent schema export.\n *\n * The registry runs ALONGSIDE existing per-block code (the plan `PlanBlockView`\n * switch + `serializeBlock`/`parseBlock`). Renderers check the registry first;\n * unregistered block types fall through to the legacy code path unchanged. The\n * MDX `tag` and attribute shape for a converted block MUST match the historical\n * encoding (e.g. `<Callout tone>…body…</Callout>`) so stored `.mdx` files still\n * parse byte-compatibly.\n */\n\n/** Where a block can be placed in a document. */\nexport type BlockPlacement = \"block\" | \"inline\";\n\n/**\n * A serialized MDX/NFM attribute value before the shared `prop()` encoder runs.\n * `prop()` decides string-vs-JSON encoding; this is just the value domain.\n */\nexport type MdxAttrValue =\n | string\n | number\n | boolean\n | unknown[]\n | Record<string, unknown>;\n\n/**\n * Type-narrowed reader over the resolved MDX attributes of a parsed block node.\n * The values are already estree/JSON-resolved by the shared attribute reader\n * (the same engine `plan-mdx.ts` uses), so a spec's `fromAttrs` never touches\n * the AST directly.\n */\nexport interface BlockAttrReader {\n string(name: string): string | undefined;\n number(name: string): number | undefined;\n bool(name: string): boolean | undefined;\n array<T = unknown>(name: string): T[] | undefined;\n object<T = unknown>(name: string): T | undefined;\n raw(name: string): unknown;\n}\n\n/**\n * Maps a block's validated data to/from its MDX component representation.\n * `tag` is the JSX component name in source (e.g. \"Callout\"). It MUST match the\n * historical name in `plan-mdx.ts` `BLOCK_COMPONENTS` / stored `.mdx` files or\n * existing plans break.\n */\nexport interface BlockMdxConfig<TData> {\n /** JSX component name in MDX source. Stable contract — never rename. */\n tag: string;\n /**\n * Encode `data` → a flat attribute bag. The registry serializer runs each\n * value through the shared `prop()` encoder (string-vs-JSON heuristic) and\n * preserves insertion order, so write the keys in the exact historical order.\n * Return `undefined` for a key (or omit it) to drop the attribute. When\n * `childrenField` is set, that field is excluded from the attribute bag.\n */\n toAttrs: (data: TData) => Record<string, MdxAttrValue | undefined>;\n /**\n * Decode resolved attributes (+ optional children markdown) → data. Must\n * tolerate missing/partial attributes for backward-compat (mirror today's\n * `?? []` / `?? \"\"` defaults).\n */\n fromAttrs: (attrs: BlockAttrReader, children: string) => TData;\n /**\n * When set, this data field is a markdown string serialized as MDX *children*\n * between the open/close tags (prose-bearing blocks: rich-text, callout)\n * rather than as a prop — so the body survives as real, inline-editable MDX\n * prose in source.\n */\n childrenField?: keyof TData & string;\n /**\n * Opt-in custom children serializer for blocks whose internals are nested MDX\n * components rather than a single markdown string (e.g. wireframe → Screen/kit\n * primitives). When present it overrides `childrenField`. `serializeChildren`\n * returns the raw inner MDX; `parseChildren` receives the child MDX AST nodes.\n */\n serializeChildren?: (data: TData) => string;\n parseChildren?: (childNodes: unknown[], idContext: string) => Partial<TData>;\n}\n\n/**\n * App-injected capabilities. Core blocks stay app-agnostic by taking these\n * rather than importing app services — mirroring `createImageExtension`'s\n * `onImageUpload` injection. Provided via `BlockRegistryProvider`.\n */\nexport interface BlockRenderContext {\n /** Markdown dialect for the auto-editor's rich-text field. */\n dialect?: \"gfm\" | \"nfm\";\n /** Resolve an asset id → displayable URL. */\n resolveAssetSrc?: (assetId: string) => string | undefined;\n /** Open the shared asset picker (returns the chosen asset). */\n pickAsset?: () => Promise<{ assetId: string; url?: string } | null>;\n /** Upload a local file, returns a hosted URL. */\n uploadFile?: (file: File) => Promise<{ url: string; assetId?: string }>;\n /** Call an app action by name (for blocks that fetch live data). */\n callAction?: (name: string, args: unknown) => Promise<unknown>;\n /** Sanitizer for HTML-bearing blocks. Provided by the app/core. */\n sanitizeHtml?: (html: string, css?: string) => string;\n /**\n * Render a markdown string with the app's read-only markdown renderer. Lets a\n * core block (whose `Read` lives in core) defer prose rendering to the app's\n * markdown reader (e.g. the plan `PlanMarkdownReader`) without importing it.\n */\n renderMarkdown?: (\n markdown: string,\n options?: { className?: string },\n ) => React.ReactNode;\n /**\n * Render an inline, editable rich-markdown field. The auto-editor calls this\n * for a `markdown()`-tagged field so the app owns the editor wiring (collab,\n * autosave debounce, dialect) rather than core hardcoding it.\n */\n renderMarkdownEditor?: (props: {\n value: string;\n onChange: (next: string) => void;\n editable: boolean;\n blockId?: string;\n className?: string;\n ariaLabel?: string;\n }) => React.ReactNode;\n /**\n * Render an app-owned \"Edit with AI\" affordance for a focused/editable block\n * field. Core block editors pass the current field value and nearby companion\n * fields; the host app decides how to collect the prompt and route it to the\n * agent sidebar. This keeps reusable core blocks from importing app-specific\n * popover/composer code while still exposing a generic AI edit hook.\n */\n renderAiFieldAction?: (props: BlockAiFieldActionProps) => React.ReactNode;\n /**\n * Render a nested child block through the app's own block dispatcher. Container\n * blocks whose `Read`/`Edit` live in core (e.g. tabs) call this to render each\n * child so the recursion keeps flowing through the SAME app renderer the\n * top-level document uses — registered children render via their spec, and\n * unregistered (not-yet-converted) children still fall through the app's legacy\n * switch. This is the coexistence seam: a core container never has to know\n * about app-specific child block types. Returns `null`/`undefined` when no\n * dispatcher is wired (read-only/SSR-only contexts can omit it).\n */\n renderBlock?: (props: {\n block: NestedBlock;\n /** Commit a replacement for this child block (edit mode only). */\n onChange?: (next: NestedBlock) => void;\n /** Whether the parent container is being edited. */\n editing?: boolean;\n /** Tighten embedded visuals in dense contexts (e.g. tab panes). */\n compactVisuals?: boolean;\n }) => React.ReactNode;\n /**\n * Render a nested editable block list through the host app's document editor.\n * Container blocks such as columns call this for each editable region so slash\n * commands, nested structured blocks, and ordinary prose behave like the\n * top-level document while the container still persists its normalized runtime\n * data. Source adapters may still expose a human-friendly nested MDX form\n * (for example `<Columns><Column>markdown</Column></Columns>`) and normalize it\n * into these block arrays at runtime.\n */\n renderBlocksEditor?: (props: {\n blocks: NestedBlock[];\n onChange: (blocks: NestedBlock[]) => void;\n editable: boolean;\n containerBlockId: string;\n regionId: string;\n regionLabel?: string;\n /** Tighten embedded visuals in dense regions such as tab panes. */\n compactVisuals?: boolean;\n }) => React.ReactNode;\n /**\n * Wrap a block's edit form in an app-provided \"panel\" surface (e.g. a shadcn\n * Popover anchored to the corner edit button) for `editSurface: \"panel\"`\n * blocks. Core renders the rendered `Read` view plus a corner trigger button\n * and the form, then hands them here so the app owns the overlay primitive\n * (core stays shadcn-free, mirroring `renderMarkdownEditor`). When omitted, a\n * panel-mode block falls back to inline editing. `title` is the block label.\n */\n renderEditSurface?: (props: {\n title: string;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n trigger: React.ReactNode;\n children: React.ReactNode;\n /** Metadata for host-provided contextual controls such as \"Edit with AI\". */\n blockId?: string;\n blockType?: string;\n blockTitle?: string;\n blockSummary?: string;\n blockData?: unknown;\n }) => React.ReactNode;\n}\n\nexport interface BlockAiFieldActionProps {\n blockId: string;\n blockType: string;\n blockTitle?: string;\n blockSummary?: string;\n fieldLabel: string;\n fieldValue: string;\n draftScope: string;\n disabled?: boolean;\n /**\n * Human-readable instructions for the host agent prompt. Mention how to patch\n * the block and which sibling fields should be preserved.\n */\n instructions: string;\n companionFields?: Array<{\n label: string;\n value: string;\n language?: string;\n }>;\n}\n\n/**\n * The minimal shape of a nested child block passed to {@link\n * BlockRenderContext.renderBlock}. It mirrors the app's block union loosely (the\n * app casts it back to its own block type) — a discriminating `type`, a stable\n * `id`, optional heading/summary, and the type-specific `data`.\n */\nexport interface NestedBlock {\n type: string;\n id: string;\n title?: string;\n summary?: string;\n data: unknown;\n [key: string]: unknown;\n}\n\nexport interface BlockContainerRegion {\n id: string;\n label?: string;\n blocks: NestedBlock[];\n}\n\nexport interface BlockContainerSpec<TData> {\n regions: (data: TData) => BlockContainerRegion[];\n updateRegion: (data: TData, regionId: string, blocks: NestedBlock[]) => TData;\n addRegion?: (data: TData, afterRegionId?: string) => TData;\n removeRegion?: (data: TData, regionId: string) => TData;\n reorderRegion?: (\n data: TData,\n fromRegionId: string,\n toRegionId: string,\n ) => TData;\n}\n\nexport type BlockDataChangeMeta = {\n containerRegion?: {\n regionId: string;\n blocks: NestedBlock[];\n };\n};\n\n/** Props passed to a block's read-only renderer. */\nexport interface BlockReadProps<TData> {\n data: TData;\n /** Stable block id (for anchors, comment targeting, source patches). */\n blockId: string;\n /** Block heading, when present. */\n title?: string;\n /** Block trailing summary, when present. */\n summary?: string;\n /** Injected app capabilities. */\n ctx: BlockRenderContext;\n}\n\n/** Props passed to a block's editor (custom or schema-generated). */\nexport interface BlockEditProps<TData> {\n data: TData;\n onChange: (next: TData, meta?: BlockDataChangeMeta) => void;\n editable: boolean;\n blockId: string;\n title?: string;\n summary?: string;\n /** Injected app capabilities. */\n ctx: BlockRenderContext;\n}\n\nexport interface BlockSpec<TData = unknown> {\n /** Discriminator. Equals the runtime block `type`. */\n type: string;\n /** Zod schema for `data`. Drives validation AND the schema-auto-editor. */\n schema: ZodType<TData>;\n /** MDX round-trip config. */\n mdx: BlockMdxConfig<TData>;\n /** Read-only renderer (replaces a `PlanBlockView` switch branch / NodeView). */\n Read: FC<BlockReadProps<TData>>;\n /**\n * Optional editor. When omitted, the registry renders the schema-driven\n * `SchemaBlockEditor` generated from `schema`. Supply for full control\n * (wireframe canvas, diagram editor).\n */\n Edit?: FC<BlockEditProps<TData>>;\n /** Allowed placements: `[\"block\"]`, `[\"inline\"]`, or both. */\n placement: BlockPlacement[];\n /**\n * When `true`, this block's data maps to a Notion-Flavored-Markdown (NFM)\n * analog and therefore round-trips into a Notion page. Apps can derive\n * registry-backed Notion allowlists with\n * {@link BlockRegistry.notionCompatibleTypes} instead of hand-maintaining\n * per-app sets. Set it on registry-atom blocks with an NFM counterpart\n * (checklist, table); leave it `false`/undefined on dev-doc blocks\n * (api-endpoint, openapi-spec, data-model, diff, file-tree, json-explorer,\n * annotated-code, mermaid, custom-html, tabs, code-tabs) and visual/plan-only\n * blocks (wireframe, diagram). Prose blocks that aren't registry atoms\n * (rich-text, callout) carry their NFM analog through the prose path, not this\n * flag.\n */\n notionCompatible?: boolean;\n /**\n * How the block is edited in a `block`-placed document:\n * - `\"inline\"` — the `Edit`/auto-form renders in place for direct\n * manipulation of authored content (prose, checklist text, table cells,\n * code bodies). Schema-ish metadata such as tone/type, tab labels,\n * language, density, or structural settings should still be tucked behind a\n * contextual edit/settings affordance inside the custom `Edit`.\n * - `\"panel\"` — the block shows its rendered `Read` view with a corner edit\n * button that opens the `Edit`/auto-form in an app-provided panel (popover).\n * Best for config-driven blocks whose render differs from their props\n * (custom HTML, charts, any user-registered block).\n * - `\"container\"` — the block renders its `Edit` in place, and that editor\n * may call `ctx.renderBlocksEditor` for nested block regions with normal\n * slash commands and nested structured blocks.\n * Defaults to `\"inline\"` when a custom `Edit` is supplied, else `\"panel\"`\n * (auto-form blocks are property forms, ideal for a panel). The app must wire\n * `ctx.renderEditSurface` for `\"panel\"` to take effect; otherwise it falls\n * back to inline.\n */\n editSurface?: \"inline\" | \"panel\" | \"container\";\n /**\n * Optional generic contract for content-bearing container blocks. Keep this\n * runtime-oriented: it describes editable regions over normalized block arrays;\n * source formats can provide readable nested MDX adapters independently.\n */\n container?: BlockContainerSpec<TData>;\n /** Human label for menus + agent schema export. */\n label: string;\n /** Tabler icon component for UI menus (never emoji/robot/sparkle). */\n icon?: FC<{ size?: number; className?: string }>;\n /** One-line description for the agent schema export. */\n description: string;\n /** Optional default `data` factory for slash-menu insertion (an empty block). */\n empty?: () => TData;\n /**\n * Optional block-specific source-patch handlers, generalizing bespoke ops\n * like `update-custom-html`. Keyed by op name; the registry dispatches a\n * matching patch op here. Generic ops (`update-block` shallow-merge) need none.\n */\n patches?: Record<string, (data: TData, op: Record<string, unknown>) => TData>;\n}\n\n/** Identity helper for authoring a spec with full type inference. */\nexport function defineBlock<TData>(spec: BlockSpec<TData>): BlockSpec<TData> {\n return spec;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ExtensionsListPage.d.ts","sourceRoot":"","sources":["../../../src/client/extensions/ExtensionsListPage.tsx"],"names":[],"mappings":"AA+EA,wBAAgB,kBAAkB,4CAwOjC"}
1
+ {"version":3,"file":"ExtensionsListPage.d.ts","sourceRoot":"","sources":["../../../src/client/extensions/ExtensionsListPage.tsx"],"names":[],"mappings":"AAkFA,wBAAgB,kBAAkB,4CA0SjC"}