@agent-native/core 0.37.2 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -6
- package/dist/action.d.ts +60 -2
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +6 -2
- package/dist/action.js.map +1 -1
- package/dist/agent/production-agent.d.ts +12 -6
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +161 -11
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/types.d.ts +2 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/catalog.json +2 -2
- package/dist/cli/connect.d.ts.map +1 -1
- package/dist/cli/connect.js +15 -0
- package/dist/cli/connect.js.map +1 -1
- package/dist/cli/index.js +10 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/plan-publish-store.d.ts +52 -0
- package/dist/cli/plan-publish-store.d.ts.map +1 -0
- package/dist/cli/plan-publish-store.js +103 -0
- package/dist/cli/plan-publish-store.js.map +1 -0
- package/dist/cli/skills.d.ts +29 -0
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +1349 -544
- package/dist/cli/skills.js.map +1 -1
- package/dist/cli/templates-meta.js +12 -12
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +3 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +65 -15
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +20 -2
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +12 -0
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/agent-engine-key.d.ts +24 -0
- package/dist/client/agent-engine-key.d.ts.map +1 -0
- package/dist/client/agent-engine-key.js +49 -0
- package/dist/client/agent-engine-key.js.map +1 -0
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +34 -0
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/blocks/BlockView.d.ts +26 -0
- package/dist/client/blocks/BlockView.d.ts.map +1 -0
- package/dist/client/blocks/BlockView.js +24 -0
- package/dist/client/blocks/BlockView.js.map +1 -0
- package/dist/client/blocks/SchemaBlockEditor.d.ts +25 -0
- package/dist/client/blocks/SchemaBlockEditor.d.ts.map +1 -0
- package/dist/client/blocks/SchemaBlockEditor.js +72 -0
- package/dist/client/blocks/SchemaBlockEditor.js.map +1 -0
- package/dist/client/blocks/agent.d.ts +30 -0
- package/dist/client/blocks/agent.d.ts.map +1 -0
- package/dist/client/blocks/agent.js +61 -0
- package/dist/client/blocks/agent.js.map +1 -0
- package/dist/client/blocks/index.d.ts +34 -0
- package/dist/client/blocks/index.d.ts.map +1 -0
- package/dist/client/blocks/index.js +42 -0
- package/dist/client/blocks/index.js.map +1 -0
- package/dist/client/blocks/library/checklist.config.d.ts +36 -0
- package/dist/client/blocks/library/checklist.config.d.ts.map +1 -0
- package/dist/client/blocks/library/checklist.config.js +25 -0
- package/dist/client/blocks/library/checklist.config.js.map +1 -0
- package/dist/client/blocks/library/checklist.d.ts +26 -0
- package/dist/client/blocks/library/checklist.d.ts.map +1 -0
- package/dist/client/blocks/library/checklist.js +76 -0
- package/dist/client/blocks/library/checklist.js.map +1 -0
- package/dist/client/blocks/library/code-tabs.config.d.ts +36 -0
- package/dist/client/blocks/library/code-tabs.config.d.ts.map +1 -0
- package/dist/client/blocks/library/code-tabs.config.js +30 -0
- package/dist/client/blocks/library/code-tabs.config.js.map +1 -0
- package/dist/client/blocks/library/code-tabs.d.ts +3 -0
- package/dist/client/blocks/library/code-tabs.d.ts.map +1 -0
- package/dist/client/blocks/library/code-tabs.js +165 -0
- package/dist/client/blocks/library/code-tabs.js.map +1 -0
- package/dist/client/blocks/library/html.config.d.ts +37 -0
- package/dist/client/blocks/library/html.config.d.ts.map +1 -0
- package/dist/client/blocks/library/html.config.js +46 -0
- package/dist/client/blocks/library/html.config.js.map +1 -0
- package/dist/client/blocks/library/html.d.ts +21 -0
- package/dist/client/blocks/library/html.d.ts.map +1 -0
- package/dist/client/blocks/library/html.js +69 -0
- package/dist/client/blocks/library/html.js.map +1 -0
- package/dist/client/blocks/library/table.config.d.ts +30 -0
- package/dist/client/blocks/library/table.config.d.ts.map +1 -0
- package/dist/client/blocks/library/table.config.js +22 -0
- package/dist/client/blocks/library/table.config.js.map +1 -0
- package/dist/client/blocks/library/table.d.ts +8 -0
- package/dist/client/blocks/library/table.d.ts.map +1 -0
- package/dist/client/blocks/library/table.js +107 -0
- package/dist/client/blocks/library/table.js.map +1 -0
- package/dist/client/blocks/library/tabs.config.d.ts +56 -0
- package/dist/client/blocks/library/tabs.config.d.ts.map +1 -0
- package/dist/client/blocks/library/tabs.config.js +36 -0
- package/dist/client/blocks/library/tabs.config.js.map +1 -0
- package/dist/client/blocks/library/tabs.d.ts +20 -0
- package/dist/client/blocks/library/tabs.d.ts.map +1 -0
- package/dist/client/blocks/library/tabs.js +123 -0
- package/dist/client/blocks/library/tabs.js.map +1 -0
- package/dist/client/blocks/mdx.d.ts +74 -0
- package/dist/client/blocks/mdx.d.ts.map +1 -0
- package/dist/client/blocks/mdx.js +205 -0
- package/dist/client/blocks/mdx.js.map +1 -0
- package/dist/client/blocks/provider.d.ts +25 -0
- package/dist/client/blocks/provider.d.ts.map +1 -0
- package/dist/client/blocks/provider.js +19 -0
- package/dist/client/blocks/provider.js.map +1 -0
- package/dist/client/blocks/registry.d.ts +24 -0
- package/dist/client/blocks/registry.d.ts.map +1 -0
- package/dist/client/blocks/registry.js +50 -0
- package/dist/client/blocks/registry.js.map +1 -0
- package/dist/client/blocks/schema-form/introspect.d.ts +31 -0
- package/dist/client/blocks/schema-form/introspect.d.ts.map +1 -0
- package/dist/client/blocks/schema-form/introspect.js +164 -0
- package/dist/client/blocks/schema-form/introspect.js.map +1 -0
- package/dist/client/blocks/server.d.ts +22 -0
- package/dist/client/blocks/server.d.ts.map +1 -0
- package/dist/client/blocks/server.js +25 -0
- package/dist/client/blocks/server.js.map +1 -0
- package/dist/client/blocks/types.d.ts +212 -0
- package/dist/client/blocks/types.d.ts.map +1 -0
- package/dist/client/blocks/types.js +5 -0
- package/dist/client/blocks/types.js.map +1 -0
- package/dist/client/composer/ComposerPlusMenu.js +10 -1
- package/dist/client/composer/ComposerPlusMenu.js.map +1 -1
- package/dist/client/guided-questions.d.ts +68 -0
- package/dist/client/guided-questions.d.ts.map +1 -1
- package/dist/client/guided-questions.js +158 -3
- package/dist/client/guided-questions.js.map +1 -1
- package/dist/client/index.d.ts +5 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +15 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts +37 -0
- package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/BubbleToolbar.js +161 -0
- package/dist/client/rich-markdown-editor/BubbleToolbar.js.map +1 -0
- package/dist/client/rich-markdown-editor/ImageExtension.d.ts +63 -0
- package/dist/client/rich-markdown-editor/ImageExtension.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/ImageExtension.js +242 -0
- package/dist/client/rich-markdown-editor/ImageExtension.js.map +1 -0
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts +51 -0
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.js +37 -0
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.js.map +1 -0
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +61 -0
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/SharedRichEditor.js +121 -0
- package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -0
- package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts +36 -0
- package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/SlashCommandMenu.js +193 -0
- package/dist/client/rich-markdown-editor/SlashCommandMenu.js.map +1 -0
- package/dist/client/rich-markdown-editor/extensions.d.ts +166 -0
- package/dist/client/rich-markdown-editor/extensions.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/extensions.js +222 -0
- package/dist/client/rich-markdown-editor/extensions.js.map +1 -0
- package/dist/client/rich-markdown-editor/index.d.ts +9 -0
- package/dist/client/rich-markdown-editor/index.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/index.js +9 -0
- package/dist/client/rich-markdown-editor/index.js.map +1 -0
- package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts +18 -0
- package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/uploadEditorImage.js +57 -0
- package/dist/client/rich-markdown-editor/uploadEditorImage.js.map +1 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts +91 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.js +342 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -0
- package/dist/client/track.d.ts +25 -0
- package/dist/client/track.d.ts.map +1 -0
- package/dist/client/track.js +53 -0
- package/dist/client/track.js.map +1 -0
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +6 -0
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/use-session.d.ts +3 -2
- package/dist/client/use-session.d.ts.map +1 -1
- package/dist/client/use-session.js +3 -2
- package/dist/client/use-session.js.map +1 -1
- package/dist/deploy/build.d.ts +5 -0
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +67 -1
- package/dist/deploy/build.js.map +1 -1
- package/dist/extensions/schema.d.ts +1 -1
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +9 -2
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +35 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/provider-api/index.d.ts +1 -1
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/scripts/docs/search.d.ts.map +1 -1
- package/dist/scripts/docs/search.js +5 -2
- package/dist/scripts/docs/search.js.map +1 -1
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +16 -3
- package/dist/scripts/runner.js.map +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +2 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +30 -4
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +65 -19
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +8 -1
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/agents-bundle.d.ts +27 -1
- package/dist/server/agents-bundle.d.ts.map +1 -1
- package/dist/server/agents-bundle.js +41 -3
- package/dist/server/agents-bundle.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +76 -3
- package/dist/server/auth.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +60 -0
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +160 -22
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/sentry.d.ts.map +1 -1
- package/dist/server/sentry.js +6 -0
- package/dist/server/sentry.js.map +1 -1
- package/dist/server/social-og-image.d.ts +2 -1
- package/dist/server/social-og-image.d.ts.map +1 -1
- package/dist/server/social-og-image.js +24 -4
- package/dist/server/social-og-image.js.map +1 -1
- package/dist/sharing/schema.d.ts +1 -1
- package/dist/styles/agent-native.css +1 -0
- package/dist/styles/rich-markdown-editor.css +439 -0
- package/dist/templates/default/.agents/skills/actions/SKILL.md +4 -1
- package/dist/templates/default/.agents/skills/security/SKILL.md +13 -4
- package/dist/templates/default/.agents/skills/storing-data/SKILL.md +15 -3
- package/dist/templates/default/AGENTS.md +1 -0
- package/dist/templates/default/DEVELOPING.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +10 -3
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +98 -10
- package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +45 -3
- package/dist/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +37 -4
- package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +9 -4
- package/dist/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/client-methods/SKILL.md +106 -0
- package/dist/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +53 -0
- package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +62 -61
- package/dist/templates/workspace-core/.agents/skills/context-xray/SKILL.md +47 -0
- package/dist/templates/workspace-core/.agents/skills/create-skill/SKILL.md +28 -0
- package/dist/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +52 -1
- package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +95 -433
- package/dist/templates/workspace-core/.agents/skills/extensions/references/api.md +285 -0
- package/dist/templates/workspace-core/.agents/skills/extensions/references/examples.md +259 -0
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +398 -0
- package/dist/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +157 -0
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +17 -0
- package/dist/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +13 -2
- package/dist/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +51 -0
- package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +14 -4
- package/dist/templates/workspace-core/.agents/skills/onboarding/SKILL.md +13 -1
- package/dist/templates/workspace-core/.agents/skills/portability/SKILL.md +27 -5
- package/dist/templates/workspace-core/.agents/skills/qa/SKILL.md +24 -8
- package/dist/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +53 -7
- package/dist/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +43 -10
- package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +43 -14
- package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +50 -1
- package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +4 -2
- package/dist/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +11 -1
- package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +15 -0
- package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +5 -1
- package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +48 -19
- package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +7 -3
- package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +13 -6
- package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +236 -0
- package/dist/templates/workspace-core/AGENTS.md +5 -1
- package/dist/templates/workspace-root/AGENTS.md +5 -2
- package/dist/tracking/route.d.ts +43 -0
- package/dist/tracking/route.d.ts.map +1 -0
- package/dist/tracking/route.js +85 -0
- package/dist/tracking/route.js.map +1 -0
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +15 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/a2a-protocol.md +18 -4
- package/docs/content/actions.md +87 -0
- package/docs/content/agent-mentions.md +2 -1
- package/docs/content/authentication.md +2 -1
- package/docs/content/client.md +64 -13
- package/docs/content/cloneable-saas.md +1 -1
- package/docs/content/code-agents-ui.md +17 -11
- package/docs/content/context-awareness.md +23 -28
- package/docs/content/creating-templates.md +1 -1
- package/docs/content/drop-in-agent.md +2 -0
- package/docs/content/getting-started.md +2 -2
- package/docs/content/key-concepts.md +2 -2
- package/docs/content/messaging.md +57 -15
- package/docs/content/migration-workbench.md +1 -1
- package/docs/content/multi-app-workspace.md +1 -1
- package/docs/content/multi-tenancy.md +17 -15
- package/docs/content/real-time-collaboration.md +1 -1
- package/docs/content/recurring-jobs.md +1 -1
- package/docs/content/security.md +2 -2
- package/docs/content/server.md +4 -4
- package/docs/content/skills-guide.md +30 -0
- package/docs/content/template-analytics.md +2 -2
- package/docs/content/template-assets.md +17 -1
- package/docs/content/template-brain.md +2 -2
- package/docs/content/template-calendar.md +1 -1
- package/docs/content/template-clips.md +3 -3
- package/docs/content/template-content.md +2 -2
- package/docs/content/template-design.md +2 -2
- package/docs/content/template-dispatch.md +3 -3
- package/docs/content/template-forms.md +14 -2
- package/docs/content/template-mail.md +1 -3
- package/docs/content/template-plan.md +118 -0
- package/docs/content/template-slides.md +5 -4
- package/docs/content/template-starter.md +4 -4
- package/docs/content/template-videos.md +6 -11
- package/docs/content/tracking.md +21 -1
- package/docs/content/visual-plans.md +72 -0
- package/docs/content/workspace.md +9 -9
- package/package.json +26 -11
- package/src/templates/default/.agents/skills/actions/SKILL.md +4 -1
- package/src/templates/default/.agents/skills/security/SKILL.md +13 -4
- package/src/templates/default/.agents/skills/storing-data/SKILL.md +15 -3
- package/src/templates/default/AGENTS.md +1 -0
- package/src/templates/default/DEVELOPING.md +2 -0
- package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +10 -3
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +98 -10
- package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +45 -3
- package/src/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +37 -4
- package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +9 -4
- package/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/client-methods/SKILL.md +106 -0
- package/src/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +53 -0
- package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +62 -61
- package/src/templates/workspace-core/.agents/skills/context-xray/SKILL.md +47 -0
- package/src/templates/workspace-core/.agents/skills/create-skill/SKILL.md +28 -0
- package/src/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +52 -1
- package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +95 -433
- package/src/templates/workspace-core/.agents/skills/extensions/references/api.md +285 -0
- package/src/templates/workspace-core/.agents/skills/extensions/references/examples.md +259 -0
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +398 -0
- package/src/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +157 -0
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +17 -0
- package/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +13 -2
- package/src/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +51 -0
- package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +14 -4
- package/src/templates/workspace-core/.agents/skills/onboarding/SKILL.md +13 -1
- package/src/templates/workspace-core/.agents/skills/portability/SKILL.md +27 -5
- package/src/templates/workspace-core/.agents/skills/qa/SKILL.md +24 -8
- package/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +53 -7
- package/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +43 -10
- package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +43 -14
- package/src/templates/workspace-core/.agents/skills/security/SKILL.md +50 -1
- package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +4 -2
- package/src/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +11 -1
- package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +15 -0
- package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +5 -1
- package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +48 -19
- package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +7 -3
- package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +13 -6
- package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +236 -0
- package/src/templates/workspace-core/AGENTS.md +5 -1
- package/src/templates/workspace-root/AGENTS.md +5 -2
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Describe every registered block for the agent (sorted by type for stability). */
|
|
3
|
+
export function describeBlocksForAgent(registry) {
|
|
4
|
+
return registry
|
|
5
|
+
.list()
|
|
6
|
+
.map((spec) => ({
|
|
7
|
+
type: spec.type,
|
|
8
|
+
label: spec.label,
|
|
9
|
+
description: spec.description,
|
|
10
|
+
placement: spec.placement,
|
|
11
|
+
mdxTag: spec.mdx.tag,
|
|
12
|
+
dataSchema: safeJsonSchema(spec.schema),
|
|
13
|
+
example: spec.empty?.(),
|
|
14
|
+
}))
|
|
15
|
+
.sort((a, b) => a.type.localeCompare(b.type));
|
|
16
|
+
}
|
|
17
|
+
function safeJsonSchema(schema) {
|
|
18
|
+
try {
|
|
19
|
+
return z.toJSONSchema(schema, { io: "input" });
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Some schemas (recursive lazy, custom refinements) can't convert; the
|
|
23
|
+
// agent still gets the type/label/description, which is the essential part.
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Render the registry into a compact markdown block-vocabulary reference for the
|
|
29
|
+
* agent (skill / action surface). Lists each block's runtime `type`, MDX tag,
|
|
30
|
+
* placement, the key data fields (pulled from the converted JSON schema), and the
|
|
31
|
+
* one-line description — generated from the live registry so the agent's
|
|
32
|
+
* vocabulary can never drift from what the app actually renders and serializes.
|
|
33
|
+
*/
|
|
34
|
+
export function renderBlockVocabularyReference(registry, options = {}) {
|
|
35
|
+
const docs = describeBlocksForAgent(registry);
|
|
36
|
+
const lines = [];
|
|
37
|
+
if (options.heading)
|
|
38
|
+
lines.push(options.heading, "");
|
|
39
|
+
lines.push("| type | mdx tag | placement | key data fields | description |", "| --- | --- | --- | --- | --- |");
|
|
40
|
+
for (const doc of docs) {
|
|
41
|
+
lines.push(`| \`${doc.type}\` | \`<${doc.mdxTag}>\` | ${doc.placement.join("+")} | ${summarizeFields(doc.dataSchema) || "—"} | ${escapeCell(doc.description)} |`);
|
|
42
|
+
}
|
|
43
|
+
return lines.join("\n");
|
|
44
|
+
}
|
|
45
|
+
/** Pull a short `field`/`field?` list out of a converted JSON schema object. */
|
|
46
|
+
function summarizeFields(jsonSchema) {
|
|
47
|
+
if (!jsonSchema || typeof jsonSchema !== "object")
|
|
48
|
+
return "";
|
|
49
|
+
const obj = jsonSchema;
|
|
50
|
+
if (!obj.properties)
|
|
51
|
+
return "";
|
|
52
|
+
const required = new Set(obj.required ?? []);
|
|
53
|
+
return Object.keys(obj.properties)
|
|
54
|
+
.map((key) => `\`${key}${required.has(key) ? "" : "?"}\``)
|
|
55
|
+
.join(", ");
|
|
56
|
+
}
|
|
57
|
+
/** Escape pipe/newline so a description never breaks the markdown table. */
|
|
58
|
+
function escapeCell(text) {
|
|
59
|
+
return text.replace(/\|/g, "\\|").replace(/\r?\n/g, " ").trim();
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../src/client/blocks/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB,oFAAoF;AACpF,MAAM,UAAU,sBAAsB,CACpC,QAAuB;IAEvB,OAAO,QAAQ;SACZ,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACd,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG;QACpB,UAAU,EAAE,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC;QACvC,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE;KACxB,CAAC,CAAC;SACF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,cAAc,CAAC,MAA0B;IAChD,IAAI,CAAC;QACH,OAAO,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,uEAAuE;QACvE,4EAA4E;QAC5E,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAC5C,QAAuB,EACvB,UAAgC,EAAE;IAElC,MAAM,IAAI,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAC9C,MA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AAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAClE,CAAC","sourcesContent":["import { z } from \"zod\";\nimport type { BlockRegistry } from \"./registry.js\";\nimport type { BlockPlacement } from \"./types.js\";\n\n/**\n * Agent-facing description of one registered block. Generated from the registry\n * so the agent's block vocabulary always matches what the app can render and\n * serialize — no hand-maintained second list. React-free so an action / the\n * agent schema export can import it.\n */\nexport interface BlockAgentDoc {\n type: string;\n label: string;\n description: string;\n placement: BlockPlacement[];\n mdxTag: string;\n dataSchema: unknown;\n example?: unknown;\n}\n\n/** Describe every registered block for the agent (sorted by type for stability). */\nexport function describeBlocksForAgent(\n registry: BlockRegistry,\n): BlockAgentDoc[] {\n return registry\n .list()\n .map((spec) => ({\n type: spec.type,\n label: spec.label,\n description: spec.description,\n placement: spec.placement,\n mdxTag: spec.mdx.tag,\n dataSchema: safeJsonSchema(spec.schema),\n example: spec.empty?.(),\n }))\n .sort((a, b) => a.type.localeCompare(b.type));\n}\n\nfunction safeJsonSchema(schema: z.ZodType<unknown>): unknown {\n try {\n return z.toJSONSchema(schema, { io: \"input\" });\n } catch {\n // Some schemas (recursive lazy, custom refinements) can't convert; the\n // agent still gets the type/label/description, which is the essential part.\n return undefined;\n }\n}\n\n/**\n * Render the registry into a compact markdown block-vocabulary reference for the\n * agent (skill / action surface). Lists each block's runtime `type`, MDX tag,\n * placement, the key data fields (pulled from the converted JSON schema), and the\n * one-line description — generated from the live registry so the agent's\n * vocabulary can never drift from what the app actually renders and serializes.\n */\nexport function renderBlockVocabularyReference(\n registry: BlockRegistry,\n options: { heading?: string } = {},\n): string {\n const docs = describeBlocksForAgent(registry);\n const lines: string[] = [];\n if (options.heading) lines.push(options.heading, \"\");\n lines.push(\n \"| type | mdx tag | placement | key data fields | description |\",\n \"| --- | --- | --- | --- | --- |\",\n );\n for (const doc of docs) {\n lines.push(\n `| \\`${doc.type}\\` | \\`<${doc.mdxTag}>\\` | ${doc.placement.join(\"+\")} | ${\n summarizeFields(doc.dataSchema) || \"—\"\n } | ${escapeCell(doc.description)} |`,\n );\n }\n return lines.join(\"\\n\");\n}\n\n/** Pull a short `field`/`field?` list out of a converted JSON schema object. */\nfunction summarizeFields(jsonSchema: unknown): string {\n if (!jsonSchema || typeof jsonSchema !== \"object\") return \"\";\n const obj = jsonSchema as {\n properties?: Record<string, unknown>;\n required?: string[];\n };\n if (!obj.properties) return \"\";\n const required = new Set(obj.required ?? []);\n return Object.keys(obj.properties)\n .map((key) => `\\`${key}${required.has(key) ? \"\" : \"?\"}\\``)\n .join(\", \");\n}\n\n/** Escape pipe/newline so a description never breaks the markdown table. */\nfunction escapeCell(text: string): string {\n return text.replace(/\\|/g, \"\\\\|\").replace(/\\r?\\n/g, \" \").trim();\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@agent-native/core/blocks` — the first-party block registry.
|
|
3
|
+
*
|
|
4
|
+
* A block registry unifies structured document blocks under one `defineBlock`
|
|
5
|
+
* contract: a zod `schema` for the data, an `mdx` config for byte-stable MDX
|
|
6
|
+
* round-trip, a `Read` renderer, an optional `Edit` (auto-generated from the
|
|
7
|
+
* schema when omitted), and `placement` (top-level and/or inline). Apps create a
|
|
8
|
+
* `BlockRegistry`, register the core standard library plus their own specs, and
|
|
9
|
+
* render through `BlockView` inside a `BlockRegistryProvider`. The renderer
|
|
10
|
+
* checks the registry first and falls back to legacy code for unregistered
|
|
11
|
+
* types, so existing documents keep working unchanged.
|
|
12
|
+
*
|
|
13
|
+
* This entry includes the React surface. For server/agent code that must stay
|
|
14
|
+
* React-free, import from `@agent-native/core/blocks/server`.
|
|
15
|
+
*/
|
|
16
|
+
export { defineBlock, type BlockSpec, type BlockPlacement, type BlockMdxConfig, type BlockAttrReader, type BlockRenderContext, type BlockReadProps, type BlockEditProps, type MdxAttrValue, type NestedBlock, } from "./types.js";
|
|
17
|
+
export { BlockRegistry, registerBlocks } from "./registry.js";
|
|
18
|
+
export { BlockRegistryProvider, useBlockRegistry, useOptionalBlockRegistry, } from "./provider.js";
|
|
19
|
+
export { BlockView } from "./BlockView.js";
|
|
20
|
+
export { SchemaBlockEditor } from "./SchemaBlockEditor.js";
|
|
21
|
+
export { markdown, richtext, introspect, type FieldKind, type FieldDescriptor, } from "./schema-form/introspect.js";
|
|
22
|
+
export { prop, escapeAttr, jsonExpression, attributeValue, createAttrReader, serializeSpecBlock, parseSpecBlock, type MdxJsxNode, type MdxAttrNode, type SerializableBlock, type ParsedBlockBase, } from "./mdx.js";
|
|
23
|
+
export { describeBlocksForAgent, renderBlockVocabularyReference, type BlockAgentDoc, } from "./agent.js";
|
|
24
|
+
export { checklistBlock, ChecklistBlock, ChecklistEditor, } from "./library/checklist.js";
|
|
25
|
+
export { checklistSchema, checklistMdx, type ChecklistData, type ChecklistItem, } from "./library/checklist.config.js";
|
|
26
|
+
export { tableBlock } from "./library/table.js";
|
|
27
|
+
export { tableSchema, tableMdx, type TableData, } from "./library/table.config.js";
|
|
28
|
+
export { codeTabsBlock } from "./library/code-tabs.js";
|
|
29
|
+
export { codeTabsSchema, codeTabsMdx, type CodeTabsData, type CodeTabsTab, } from "./library/code-tabs.config.js";
|
|
30
|
+
export { htmlBlock, HtmlReadBlock, HtmlEditBlock } from "./library/html.js";
|
|
31
|
+
export { htmlSchema, htmlMdx, type HtmlBlockData, } from "./library/html.config.js";
|
|
32
|
+
export { tabsBlock, TabsBlockReader, TabsBlockEditor } from "./library/tabs.js";
|
|
33
|
+
export { tabsSchema, tabsMdx, type TabsData, type TabsTab, } from "./library/tabs.config.js";
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/blocks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,WAAW,EACX,KAAK,SAAS,EACd,KA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AAC;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,UAAU,EACV,OAAO,EACP,KAAK,aAAa,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EACL,UAAU,EACV,OAAO,EACP,KAAK,QAAQ,EACb,KAAK,OAAO,GACb,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@agent-native/core/blocks` — the first-party block registry.
|
|
3
|
+
*
|
|
4
|
+
* A block registry unifies structured document blocks under one `defineBlock`
|
|
5
|
+
* contract: a zod `schema` for the data, an `mdx` config for byte-stable MDX
|
|
6
|
+
* round-trip, a `Read` renderer, an optional `Edit` (auto-generated from the
|
|
7
|
+
* schema when omitted), and `placement` (top-level and/or inline). Apps create a
|
|
8
|
+
* `BlockRegistry`, register the core standard library plus their own specs, and
|
|
9
|
+
* render through `BlockView` inside a `BlockRegistryProvider`. The renderer
|
|
10
|
+
* checks the registry first and falls back to legacy code for unregistered
|
|
11
|
+
* types, so existing documents keep working unchanged.
|
|
12
|
+
*
|
|
13
|
+
* This entry includes the React surface. For server/agent code that must stay
|
|
14
|
+
* React-free, import from `@agent-native/core/blocks/server`.
|
|
15
|
+
*/
|
|
16
|
+
// Types + authoring
|
|
17
|
+
export { defineBlock, } from "./types.js";
|
|
18
|
+
// Registry + provisioning
|
|
19
|
+
export { BlockRegistry, registerBlocks } from "./registry.js";
|
|
20
|
+
export { BlockRegistryProvider, useBlockRegistry, useOptionalBlockRegistry, } from "./provider.js";
|
|
21
|
+
// Rendering
|
|
22
|
+
export { BlockView } from "./BlockView.js";
|
|
23
|
+
export { SchemaBlockEditor } from "./SchemaBlockEditor.js";
|
|
24
|
+
// Schema-form helpers
|
|
25
|
+
export { markdown, richtext, introspect, } from "./schema-form/introspect.js";
|
|
26
|
+
// MDX round-trip (registry-driven serialize/parse + shared encoder primitives)
|
|
27
|
+
export { prop, escapeAttr, jsonExpression, attributeValue, createAttrReader, serializeSpecBlock, parseSpecBlock, } from "./mdx.js";
|
|
28
|
+
// Agent schema export
|
|
29
|
+
export { describeBlocksForAgent, renderBlockVocabularyReference, } from "./agent.js";
|
|
30
|
+
// Standard block library (React specs). Apps register these in their browser
|
|
31
|
+
// registry alongside their own app-specific blocks.
|
|
32
|
+
export { checklistBlock, ChecklistBlock, ChecklistEditor, } from "./library/checklist.js";
|
|
33
|
+
export { checklistSchema, checklistMdx, } from "./library/checklist.config.js";
|
|
34
|
+
export { tableBlock } from "./library/table.js";
|
|
35
|
+
export { tableSchema, tableMdx, } from "./library/table.config.js";
|
|
36
|
+
export { codeTabsBlock } from "./library/code-tabs.js";
|
|
37
|
+
export { codeTabsSchema, codeTabsMdx, } from "./library/code-tabs.config.js";
|
|
38
|
+
export { htmlBlock, HtmlReadBlock, HtmlEditBlock } from "./library/html.js";
|
|
39
|
+
export { htmlSchema, htmlMdx, } from "./library/html.config.js";
|
|
40
|
+
export { tabsBlock, TabsBlockReader, TabsBlockEditor } from "./library/tabs.js";
|
|
41
|
+
export { tabsSchema, tabsMdx, } from "./library/tabs.config.js";
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/blocks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,oBAAoB;AACpB,OAAO,EACL,WAAW,GAUZ,MAAM,YAAY,CAAC;AAEpB,0BAA0B;AAC1B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AAEvB,YAAY;AACZ,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,sBAAsB;AACtB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,GAGX,MAAM,6BAA6B,CAAC;AAErC,+EAA+E;AAC/E,OAAO,EACL,IAAI,EACJ,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GAKf,MAAM,UAAU,CAAC;AAElB,sBAAsB;AACtB,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAE/B,MAAM,YAAY,CAAC;AAEpB,6EAA6E;AAC7E,oDAAoD;AACpD,OAAO,EACL,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,eAAe,EACf,YAAY,GAGb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,WAAW,EACX,QAAQ,GAET,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,UAAU,EACV,OAAO,GAER,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EACL,UAAU,EACV,OAAO,GAGR,MAAM,0BAA0B,CAAC","sourcesContent":["/**\n * `@agent-native/core/blocks` — the first-party block registry.\n *\n * A block registry unifies structured document blocks under one `defineBlock`\n * contract: a zod `schema` for the data, an `mdx` config for byte-stable MDX\n * round-trip, a `Read` renderer, an optional `Edit` (auto-generated from the\n * schema when omitted), and `placement` (top-level and/or inline). Apps create a\n * `BlockRegistry`, register the core standard library plus their own specs, and\n * render through `BlockView` inside a `BlockRegistryProvider`. The renderer\n * checks the registry first and falls back to legacy code for unregistered\n * types, so existing documents keep working unchanged.\n *\n * This entry includes the React surface. For server/agent code that must stay\n * React-free, import from `@agent-native/core/blocks/server`.\n */\n\n// Types + authoring\nexport {\n defineBlock,\n type BlockSpec,\n type BlockPlacement,\n type BlockMdxConfig,\n type BlockAttrReader,\n type BlockRenderContext,\n type BlockReadProps,\n type BlockEditProps,\n type MdxAttrValue,\n type NestedBlock,\n} from \"./types.js\";\n\n// Registry + provisioning\nexport { BlockRegistry, registerBlocks } from \"./registry.js\";\nexport {\n BlockRegistryProvider,\n useBlockRegistry,\n useOptionalBlockRegistry,\n} from \"./provider.js\";\n\n// Rendering\nexport { BlockView } from \"./BlockView.js\";\nexport { SchemaBlockEditor } from \"./SchemaBlockEditor.js\";\n\n// Schema-form helpers\nexport {\n markdown,\n richtext,\n introspect,\n type FieldKind,\n type FieldDescriptor,\n} from \"./schema-form/introspect.js\";\n\n// MDX round-trip (registry-driven serialize/parse + shared encoder primitives)\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\n// Agent schema export\nexport {\n describeBlocksForAgent,\n renderBlockVocabularyReference,\n type BlockAgentDoc,\n} from \"./agent.js\";\n\n// Standard block library (React specs). Apps register these in their browser\n// registry alongside their own app-specific blocks.\nexport {\n checklistBlock,\n ChecklistBlock,\n ChecklistEditor,\n} from \"./library/checklist.js\";\nexport {\n checklistSchema,\n checklistMdx,\n type ChecklistData,\n type ChecklistItem,\n} from \"./library/checklist.config.js\";\nexport { tableBlock } from \"./library/table.js\";\nexport {\n tableSchema,\n tableMdx,\n type TableData,\n} from \"./library/table.config.js\";\nexport { codeTabsBlock } from \"./library/code-tabs.js\";\nexport {\n codeTabsSchema,\n codeTabsMdx,\n type CodeTabsData,\n type CodeTabsTab,\n} from \"./library/code-tabs.config.js\";\nexport { htmlBlock, HtmlReadBlock, HtmlEditBlock } from \"./library/html.js\";\nexport {\n htmlSchema,\n htmlMdx,\n type HtmlBlockData,\n} from \"./library/html.config.js\";\nexport { tabsBlock, TabsBlockReader, TabsBlockEditor } from \"./library/tabs.js\";\nexport {\n tabsSchema,\n tabsMdx,\n type TabsData,\n type TabsTab,\n} from \"./library/tabs.config.js\";\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { BlockMdxConfig } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Pure (React-free) part of the standard `checklist` block: its data schema and
|
|
5
|
+
* MDX round-trip config. Lives in core because checklist is a STANDARD block
|
|
6
|
+
* shared across apps (plan today, content later). The React renderer/editor live
|
|
7
|
+
* in `./checklist.tsx`; this file is safe to import from server / agent code
|
|
8
|
+
* (the plan server MDX adapter registers it) without pulling React into the
|
|
9
|
+
* bundle.
|
|
10
|
+
*
|
|
11
|
+
* The schema MUST stay data-compatible with the `checklist` branch of the plan
|
|
12
|
+
* `planBlockSchema` (`items[]` of `{ id, label, checked?, note? }`), and the MDX
|
|
13
|
+
* `tag` + attribute shape MUST match the legacy
|
|
14
|
+
* `<Checklist id title summary editable items />` encoding
|
|
15
|
+
* (`plan-mdx.ts` `serializeBlock` L322 / `parseBlock` L626) so stored `.mdx`
|
|
16
|
+
* round-trips byte-compatibly.
|
|
17
|
+
*/
|
|
18
|
+
export interface ChecklistItem {
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
checked?: boolean;
|
|
22
|
+
note?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ChecklistData {
|
|
25
|
+
items: ChecklistItem[];
|
|
26
|
+
}
|
|
27
|
+
export declare const checklistSchema: z.ZodType<ChecklistData>;
|
|
28
|
+
/**
|
|
29
|
+
* MDX config: a self-closing `<Checklist … items />` element. `items` is the
|
|
30
|
+
* only data attribute (always a JSON expression via the shared `prop()` encoder,
|
|
31
|
+
* matching the legacy `prop("items", block.data.items)` output). `fromAttrs`
|
|
32
|
+
* reads `items` and defaults to `[]` for backward-compat, mirroring the legacy
|
|
33
|
+
* `arrayAttr(node, "items") ?? []`.
|
|
34
|
+
*/
|
|
35
|
+
export declare const checklistMdx: BlockMdxConfig<ChecklistData>;
|
|
36
|
+
//# sourceMappingURL=checklist.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checklist.config.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/checklist.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AASD,eAAO,MAAM,eAAe,EAEX,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,aAAa,CAMtD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const checklistItemSchema = z.object({
|
|
3
|
+
id: z.string().trim().min(1).max(120),
|
|
4
|
+
label: z.string().trim().min(1).max(400),
|
|
5
|
+
checked: z.boolean().optional(),
|
|
6
|
+
note: z.string().trim().max(800).optional(),
|
|
7
|
+
});
|
|
8
|
+
export const checklistSchema = z.object({
|
|
9
|
+
items: z.array(checklistItemSchema).max(200),
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* MDX config: a self-closing `<Checklist … items />` element. `items` is the
|
|
13
|
+
* only data attribute (always a JSON expression via the shared `prop()` encoder,
|
|
14
|
+
* matching the legacy `prop("items", block.data.items)` output). `fromAttrs`
|
|
15
|
+
* reads `items` and defaults to `[]` for backward-compat, mirroring the legacy
|
|
16
|
+
* `arrayAttr(node, "items") ?? []`.
|
|
17
|
+
*/
|
|
18
|
+
export const checklistMdx = {
|
|
19
|
+
tag: "Checklist",
|
|
20
|
+
toAttrs: (data) => ({ items: data.items }),
|
|
21
|
+
fromAttrs: (attrs) => ({
|
|
22
|
+
items: (attrs.array("items") ?? []),
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=checklist.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checklist.config.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/checklist.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC/B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CAC7C,CAAwC,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkC;IACzD,GAAG,EAAE,WAAW;IAChB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IAC1C,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrB,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,CAAgB,OAAO,CAAC,IAAI,EAAE,CAAoB;KACtE,CAAC;CACH,CAAC","sourcesContent":["import { z } from \"zod\";\nimport type { BlockMdxConfig } from \"../types.js\";\n\n/**\n * Pure (React-free) part of the standard `checklist` block: its data schema and\n * MDX round-trip config. Lives in core because checklist is a STANDARD block\n * shared across apps (plan today, content later). The React renderer/editor live\n * in `./checklist.tsx`; this file is safe to import from server / agent code\n * (the plan server MDX adapter registers it) without pulling React into the\n * bundle.\n *\n * The schema MUST stay data-compatible with the `checklist` branch of the plan\n * `planBlockSchema` (`items[]` of `{ id, label, checked?, note? }`), and the MDX\n * `tag` + attribute shape MUST match the legacy\n * `<Checklist id title summary editable items />` encoding\n * (`plan-mdx.ts` `serializeBlock` L322 / `parseBlock` L626) so stored `.mdx`\n * round-trips byte-compatibly.\n */\n\nexport interface ChecklistItem {\n id: string;\n label: string;\n checked?: boolean;\n note?: string;\n}\n\nexport interface ChecklistData {\n items: ChecklistItem[];\n}\n\nconst checklistItemSchema = z.object({\n id: z.string().trim().min(1).max(120),\n label: z.string().trim().min(1).max(400),\n checked: z.boolean().optional(),\n note: z.string().trim().max(800).optional(),\n});\n\nexport const checklistSchema = z.object({\n items: z.array(checklistItemSchema).max(200),\n}) as unknown as z.ZodType<ChecklistData>;\n\n/**\n * MDX config: a self-closing `<Checklist … items />` element. `items` is the\n * only data attribute (always a JSON expression via the shared `prop()` encoder,\n * matching the legacy `prop(\"items\", block.data.items)` output). `fromAttrs`\n * reads `items` and defaults to `[]` for backward-compat, mirroring the legacy\n * `arrayAttr(node, \"items\") ?? []`.\n */\nexport const checklistMdx: BlockMdxConfig<ChecklistData> = {\n tag: \"Checklist\",\n toAttrs: (data) => ({ items: data.items }),\n fromAttrs: (attrs) => ({\n items: (attrs.array<ChecklistItem>(\"items\") ?? []) as ChecklistItem[],\n }),\n};\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BlockReadProps, BlockEditProps } from "../types.js";
|
|
2
|
+
import { type ChecklistData } from "./checklist.config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Read renderer. Note `onToggle` is supplied by the block dispatcher for the
|
|
5
|
+
* historical click-to-toggle behavior; in pure read contexts it is omitted and
|
|
6
|
+
* the markers render statically.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ChecklistBlock({ data, blockId, title, onToggle, }: BlockReadProps<ChecklistData> & {
|
|
9
|
+
onToggle?: (itemId: string) => void;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
/** Custom editor: toggle, relabel, add, and remove items. */
|
|
12
|
+
export declare function ChecklistEditor({ data, onChange, editable, }: BlockEditProps<ChecklistData>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* The standard checklist block spec (with React `Read`/`Edit`). Apps register
|
|
15
|
+
* this in their browser registry. The schema + MDX config come from
|
|
16
|
+
* `./checklist.config.ts`, the exact same object server / agent code registers,
|
|
17
|
+
* so rendering and source round-trip never drift.
|
|
18
|
+
*
|
|
19
|
+
* `Read` is typed against `BlockReadProps<ChecklistData>`; the optional
|
|
20
|
+
* `onToggle` the dispatcher injects for the legacy click-to-toggle behavior is
|
|
21
|
+
* an extra prop the registry's `BlockView` passes through harmlessly when
|
|
22
|
+
* present (it lives outside `BlockReadProps`, so it's wired by the app's block
|
|
23
|
+
* dispatch rather than the generic `BlockView`).
|
|
24
|
+
*/
|
|
25
|
+
export declare const checklistBlock: import("../types.js").BlockSpec<ChecklistData>;
|
|
26
|
+
//# sourceMappingURL=checklist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checklist.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/checklist.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAGL,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;AAsB/B;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,OAAO,EACP,KAAK,EACL,QAAQ,GACT,EAAE,cAAc,CAAC,aAAa,CAAC,GAAG;IACjC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,2CA8BA;AA0BD,6DAA6D;AAC7D,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,QAAQ,EACR,QAAQ,GACT,EAAE,cAAc,CAAC,aAAa,CAAC,2CAuE/B;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,gDAYzB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconCheck, IconPlus, IconX } from "@tabler/icons-react";
|
|
3
|
+
import { cn } from "../../utils.js";
|
|
4
|
+
import { defineBlock } from "../types.js";
|
|
5
|
+
import { checklistSchema, checklistMdx, } from "./checklist.config.js";
|
|
6
|
+
/**
|
|
7
|
+
* Standard `checklist` block. A list of toggleable items, each with a label and
|
|
8
|
+
* an optional note. Lives in core so any app can register it.
|
|
9
|
+
*
|
|
10
|
+
* `Read` mirrors the legacy plan `PlanBlockView` checklist branch byte-for-byte
|
|
11
|
+
* (same `plan-block` section, toggle buttons, `IconCheck` marker, and the
|
|
12
|
+
* existing toggle-via-`onChange` behavior) so converting the block to the
|
|
13
|
+
* registry does not change rendered output. The plan CSS classes
|
|
14
|
+
* (`plan-block`, `text-plan-*`, `border-plan-line`) resolve against the plan
|
|
15
|
+
* app's stylesheet at render time, exactly as before.
|
|
16
|
+
*
|
|
17
|
+
* `Edit` is a custom editor (the schema auto-editor can't edit an array of
|
|
18
|
+
* objects): it lets you add, remove, toggle, and relabel items inline.
|
|
19
|
+
*/
|
|
20
|
+
/** Mint a reasonably-unique item id without pulling a dep into core. */
|
|
21
|
+
function newItemId() {
|
|
22
|
+
return `item-${Math.random().toString(36).slice(2, 10)}`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Read renderer. Note `onToggle` is supplied by the block dispatcher for the
|
|
26
|
+
* historical click-to-toggle behavior; in pure read contexts it is omitted and
|
|
27
|
+
* the markers render statically.
|
|
28
|
+
*/
|
|
29
|
+
export function ChecklistBlock({ data, blockId, title, onToggle, }) {
|
|
30
|
+
return (_jsxs("section", { className: "plan-block", "data-block-id": blockId, children: [title && _jsx("h2", { children: title }), _jsx("div", { className: "grid gap-3", children: data.items.map((item) => onToggle ? (_jsxs("button", { type: "button", "data-plan-interactive": true, className: "flex items-start gap-3 text-left text-plan-muted", onClick: () => onToggle(item.id), children: [_jsx(ChecklistMarker, { checked: item.checked }), _jsx(ChecklistItemBody, { item: item })] }, item.id)) : (_jsxs("div", { className: "flex items-start gap-3 text-left text-plan-muted", children: [_jsx(ChecklistMarker, { checked: item.checked }), _jsx(ChecklistItemBody, { item: item })] }, item.id))) })] }));
|
|
31
|
+
}
|
|
32
|
+
function ChecklistMarker({ checked }) {
|
|
33
|
+
return (_jsx("span", { className: cn("mt-1 flex size-5 items-center justify-center rounded border", checked
|
|
34
|
+
? "border-primary bg-primary text-primary-foreground"
|
|
35
|
+
: "border-plan-line"), children: checked && _jsx(IconCheck, { className: "size-3.5" }) }));
|
|
36
|
+
}
|
|
37
|
+
function ChecklistItemBody({ item }) {
|
|
38
|
+
return (_jsxs("span", { children: [_jsx("span", { className: "block text-plan-text", children: item.label }), item.note && _jsx("span", { className: "block text-sm", children: item.note })] }));
|
|
39
|
+
}
|
|
40
|
+
/** Custom editor: toggle, relabel, add, and remove items. */
|
|
41
|
+
export function ChecklistEditor({ data, onChange, editable, }) {
|
|
42
|
+
const items = data.items;
|
|
43
|
+
const update = (next) => onChange({ items: next });
|
|
44
|
+
const toggle = (id) => update(items.map((item) => item.id === id ? { ...item, checked: !item.checked } : item));
|
|
45
|
+
const setLabel = (id, label) => update(items.map((item) => (item.id === id ? { ...item, label } : item)));
|
|
46
|
+
const remove = (id) => update(items.filter((item) => item.id !== id));
|
|
47
|
+
const add = () => update([...items, { id: newItemId(), label: "", checked: false }]);
|
|
48
|
+
return (_jsxs("div", { className: "grid gap-2", children: [items.map((item) => (_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("button", { type: "button", "data-plan-interactive": true, "aria-label": item.checked ? "Mark incomplete" : "Mark complete", className: cn("mt-1 flex size-5 shrink-0 items-center justify-center rounded border", item.checked
|
|
49
|
+
? "border-primary bg-primary text-primary-foreground"
|
|
50
|
+
: "border-plan-line"), onClick: () => toggle(item.id), children: item.checked && _jsx(IconCheck, { className: "size-3.5" }) }), _jsx("input", { type: "text", "data-plan-interactive": true, className: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", placeholder: "Checklist item", value: item.label, disabled: !editable, onChange: (event) => setLabel(item.id, event.target.value) }), _jsx("button", { type: "button", "data-plan-interactive": true, "aria-label": "Remove item", className: "mt-1 flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50", disabled: !editable, onClick: () => remove(item.id), children: _jsx(IconX, { className: "size-4" }) })] }, item.id))), _jsxs("button", { type: "button", "data-plan-interactive": true, className: "flex items-center gap-1.5 self-start rounded-md px-2 py-1 text-sm text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50", disabled: !editable, onClick: add, children: [_jsx(IconPlus, { className: "size-4" }), "Add item"] })] }));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The standard checklist block spec (with React `Read`/`Edit`). Apps register
|
|
54
|
+
* this in their browser registry. The schema + MDX config come from
|
|
55
|
+
* `./checklist.config.ts`, the exact same object server / agent code registers,
|
|
56
|
+
* so rendering and source round-trip never drift.
|
|
57
|
+
*
|
|
58
|
+
* `Read` is typed against `BlockReadProps<ChecklistData>`; the optional
|
|
59
|
+
* `onToggle` the dispatcher injects for the legacy click-to-toggle behavior is
|
|
60
|
+
* an extra prop the registry's `BlockView` passes through harmlessly when
|
|
61
|
+
* present (it lives outside `BlockReadProps`, so it's wired by the app's block
|
|
62
|
+
* dispatch rather than the generic `BlockView`).
|
|
63
|
+
*/
|
|
64
|
+
export const checklistBlock = defineBlock({
|
|
65
|
+
type: "checklist",
|
|
66
|
+
schema: checklistSchema,
|
|
67
|
+
mdx: checklistMdx,
|
|
68
|
+
Read: ChecklistBlock,
|
|
69
|
+
Edit: ChecklistEditor,
|
|
70
|
+
placement: ["block"],
|
|
71
|
+
label: "Checklist",
|
|
72
|
+
icon: IconCheck,
|
|
73
|
+
description: "A list of toggleable items, each with a label and an optional note.",
|
|
74
|
+
empty: () => ({ items: [] }),
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=checklist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checklist.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/checklist.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EACL,eAAe,EACf,YAAY,GAGb,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;;;;GAaG;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AjCD,IAAI,CAAC,EAAE,CAkCX,CACP,CAAC,EACF,kBACE,IAAI,EAAC,QAAQ,iCAEb,SAAS,EAAC,kJAAkJ,EAC5J,QAAQ,EAAE,CAAC,QAAQ,EACnB,OAAO,EAAE,GAAG,aAEZ,KAAC,QAAQ,IAAC,SAAS,EAAC,QAAQ,GAAG,gBAExB,IACL,CACP,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAgB;IACvD,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,eAAe;IACvB,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,cAAuB;IAC7B,IAAI,EAAE,eAAe;IACrB,SAAS,EAAE,CAAC,OAAO,CAAC;IACpB,KAAK,EAAE,WAAW;IAClB,IAAI,EAAE,SAAS;IACf,WAAW,EACT,qEAAqE;IACvE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;CAC7B,CAAC,CAAC","sourcesContent":["import { IconCheck, IconPlus, IconX } from \"@tabler/icons-react\";\nimport { cn } from \"../../utils.js\";\nimport { defineBlock } from \"../types.js\";\nimport type { BlockReadProps, BlockEditProps } from \"../types.js\";\nimport {\n checklistSchema,\n checklistMdx,\n type ChecklistData,\n type ChecklistItem,\n} from \"./checklist.config.js\";\n\n/**\n * Standard `checklist` block. A list of toggleable items, each with a label and\n * an optional note. Lives in core so any app can register it.\n *\n * `Read` mirrors the legacy plan `PlanBlockView` checklist branch byte-for-byte\n * (same `plan-block` section, toggle buttons, `IconCheck` marker, and the\n * existing toggle-via-`onChange` behavior) so converting the block to the\n * registry does not change rendered output. The plan CSS classes\n * (`plan-block`, `text-plan-*`, `border-plan-line`) resolve against the plan\n * app's stylesheet at render time, exactly as before.\n *\n * `Edit` is a custom editor (the schema auto-editor can't edit an array of\n * objects): it lets you add, remove, toggle, and relabel items inline.\n */\n\n/** Mint a reasonably-unique item id without pulling a dep into core. */\nfunction newItemId(): string {\n return `item-${Math.random().toString(36).slice(2, 10)}`;\n}\n\n/**\n * Read renderer. Note `onToggle` is supplied by the block dispatcher for the\n * historical click-to-toggle behavior; in pure read contexts it is omitted and\n * the markers render statically.\n */\nexport function ChecklistBlock({\n data,\n blockId,\n title,\n onToggle,\n}: BlockReadProps<ChecklistData> & {\n onToggle?: (itemId: string) => void;\n}) {\n return (\n <section className=\"plan-block\" data-block-id={blockId}>\n {title && <h2>{title}</h2>}\n <div className=\"grid gap-3\">\n {data.items.map((item) =>\n onToggle ? (\n <button\n key={item.id}\n type=\"button\"\n data-plan-interactive\n className=\"flex items-start gap-3 text-left text-plan-muted\"\n onClick={() => onToggle(item.id)}\n >\n <ChecklistMarker checked={item.checked} />\n <ChecklistItemBody item={item} />\n </button>\n ) : (\n <div\n key={item.id}\n className=\"flex items-start gap-3 text-left text-plan-muted\"\n >\n <ChecklistMarker checked={item.checked} />\n <ChecklistItemBody item={item} />\n </div>\n ),\n )}\n </div>\n </section>\n );\n}\n\nfunction ChecklistMarker({ checked }: { checked?: boolean }) {\n return (\n <span\n className={cn(\n \"mt-1 flex size-5 items-center justify-center rounded border\",\n checked\n ? \"border-primary bg-primary text-primary-foreground\"\n : \"border-plan-line\",\n )}\n >\n {checked && <IconCheck className=\"size-3.5\" />}\n </span>\n );\n}\n\nfunction ChecklistItemBody({ item }: { item: ChecklistItem }) {\n return (\n <span>\n <span className=\"block text-plan-text\">{item.label}</span>\n {item.note && <span className=\"block text-sm\">{item.note}</span>}\n </span>\n );\n}\n\n/** Custom editor: toggle, relabel, add, and remove items. */\nexport function ChecklistEditor({\n data,\n onChange,\n editable,\n}: BlockEditProps<ChecklistData>) {\n const items = data.items;\n\n const update = (next: ChecklistItem[]) => onChange({ items: next });\n\n const toggle = (id: string) =>\n update(\n items.map((item) =>\n item.id === id ? { ...item, checked: !item.checked } : item,\n ),\n );\n\n const setLabel = (id: string, label: string) =>\n update(items.map((item) => (item.id === id ? { ...item, label } : item)));\n\n const remove = (id: string) => update(items.filter((item) => item.id !== id));\n\n const add = () =>\n update([...items, { id: newItemId(), label: \"\", checked: false }]);\n\n return (\n <div className=\"grid gap-2\">\n {items.map((item) => (\n <div key={item.id} className=\"flex items-start gap-2\">\n <button\n type=\"button\"\n data-plan-interactive\n aria-label={item.checked ? \"Mark incomplete\" : \"Mark complete\"}\n className={cn(\n \"mt-1 flex size-5 shrink-0 items-center justify-center rounded border\",\n item.checked\n ? \"border-primary bg-primary text-primary-foreground\"\n : \"border-plan-line\",\n )}\n onClick={() => toggle(item.id)}\n >\n {item.checked && <IconCheck className=\"size-3.5\" />}\n </button>\n <input\n type=\"text\"\n data-plan-interactive\n className=\"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\"\n placeholder=\"Checklist item\"\n value={item.label}\n disabled={!editable}\n onChange={(event) => setLabel(item.id, event.target.value)}\n />\n <button\n type=\"button\"\n data-plan-interactive\n aria-label=\"Remove item\"\n className=\"mt-1 flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50\"\n disabled={!editable}\n onClick={() => remove(item.id)}\n >\n <IconX className=\"size-4\" />\n </button>\n </div>\n ))}\n <button\n type=\"button\"\n data-plan-interactive\n className=\"flex items-center gap-1.5 self-start rounded-md px-2 py-1 text-sm text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50\"\n disabled={!editable}\n onClick={add}\n >\n <IconPlus className=\"size-4\" />\n Add item\n </button>\n </div>\n );\n}\n\n/**\n * The standard checklist block spec (with React `Read`/`Edit`). Apps register\n * this in their browser registry. The schema + MDX config come from\n * `./checklist.config.ts`, the exact same object server / agent code registers,\n * so rendering and source round-trip never drift.\n *\n * `Read` is typed against `BlockReadProps<ChecklistData>`; the optional\n * `onToggle` the dispatcher injects for the legacy click-to-toggle behavior is\n * an extra prop the registry's `BlockView` passes through harmlessly when\n * present (it lives outside `BlockReadProps`, so it's wired by the app's block\n * dispatch rather than the generic `BlockView`).\n */\nexport const checklistBlock = defineBlock<ChecklistData>({\n type: \"checklist\",\n schema: checklistSchema,\n mdx: checklistMdx,\n Read: ChecklistBlock as never,\n Edit: ChecklistEditor,\n placement: [\"block\"],\n label: \"Checklist\",\n icon: IconCheck,\n description:\n \"A list of toggleable items, each with a label and an optional note.\",\n empty: () => ({ items: [] }),\n});\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { BlockMdxConfig } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Pure (React-free) part of the standard `code-tabs` block: its data schema and
|
|
5
|
+
* MDX round-trip config. Shared by the server MDX adapter (a plan/content app
|
|
6
|
+
* registers it via `@agent-native/core/blocks/server`) and the full client spec
|
|
7
|
+
* (`code-tabs.tsx`). Keeping this React-free means importing it into a server
|
|
8
|
+
* module never pulls React into the Nitro/SSR bundle.
|
|
9
|
+
*
|
|
10
|
+
* `code-tabs` is a STANDARD library block (a vertical file tab rail of Shiki-
|
|
11
|
+
* highlighted code), shareable by any app. Its schema MUST stay data-compatible
|
|
12
|
+
* with the legacy plan `code-tabs` branch of `planBlockSchema`, and the MDX
|
|
13
|
+
* `tag` + attribute shape MUST match the legacy
|
|
14
|
+
* `<CodeTabs … tabs={[…]} />` encoding (`plan-mdx.ts` `serializeBlock`/
|
|
15
|
+
* `parseBlock`) so stored `.mdx` round-trips byte-compatibly.
|
|
16
|
+
*/
|
|
17
|
+
export interface CodeTabsTab {
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
language?: string;
|
|
21
|
+
code: string;
|
|
22
|
+
caption?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CodeTabsData {
|
|
25
|
+
tabs: CodeTabsTab[];
|
|
26
|
+
}
|
|
27
|
+
export declare const codeTabsSchema: z.ZodType<CodeTabsData>;
|
|
28
|
+
/**
|
|
29
|
+
* MDX config: `tabs` is a single JSON-encoded attribute and the block is
|
|
30
|
+
* self-closing — exactly the legacy `<CodeTabs id … tabs={[…]} />` form.
|
|
31
|
+
* `toAttrs` returns only `tabs`; `fromAttrs` reads the `tabs` array (defaulting
|
|
32
|
+
* to `[]` for backward-compat with malformed/empty stored blocks, mirroring the
|
|
33
|
+
* legacy `arrayAttr(node, "tabs") ?? []`).
|
|
34
|
+
*/
|
|
35
|
+
export declare const codeTabsMdx: BlockMdxConfig<CodeTabsData>;
|
|
36
|
+
//# sourceMappingURL=code-tabs.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tabs.config.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/code-tabs.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,EAAE,CAAC;CACrB;AAKD,eAAO,MAAM,cAAc,EAaV,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,cAAc,CAAC,YAAY,CAMpD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Matches the plan `idSchema` (`z.string().trim().min(1).max(120)`). */
|
|
3
|
+
const tabIdSchema = z.string().trim().min(1).max(120);
|
|
4
|
+
export const codeTabsSchema = z.object({
|
|
5
|
+
tabs: z
|
|
6
|
+
.array(z.object({
|
|
7
|
+
id: tabIdSchema,
|
|
8
|
+
label: z.string().trim().min(1).max(120),
|
|
9
|
+
language: z.string().trim().max(40).optional(),
|
|
10
|
+
code: z.string().max(100_000),
|
|
11
|
+
caption: z.string().trim().max(400).optional(),
|
|
12
|
+
}))
|
|
13
|
+
.min(1)
|
|
14
|
+
.max(12),
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* MDX config: `tabs` is a single JSON-encoded attribute and the block is
|
|
18
|
+
* self-closing — exactly the legacy `<CodeTabs id … tabs={[…]} />` form.
|
|
19
|
+
* `toAttrs` returns only `tabs`; `fromAttrs` reads the `tabs` array (defaulting
|
|
20
|
+
* to `[]` for backward-compat with malformed/empty stored blocks, mirroring the
|
|
21
|
+
* legacy `arrayAttr(node, "tabs") ?? []`).
|
|
22
|
+
*/
|
|
23
|
+
export const codeTabsMdx = {
|
|
24
|
+
tag: "CodeTabs",
|
|
25
|
+
toAttrs: (data) => ({ tabs: data.tabs }),
|
|
26
|
+
fromAttrs: (attrs) => ({
|
|
27
|
+
tabs: attrs.array("tabs") ?? [],
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=code-tabs.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tabs.config.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/code-tabs.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,yEAAyE;AACzE,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,CAAC;SACJ,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;QACxC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;QAC9C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC;QAC7B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;KAC/C,CAAC,CACH;SACA,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;CACX,CAAuC,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAiC;IACvD,GAAG,EAAE,UAAU;IACf,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IACxC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrB,IAAI,EAAE,KAAK,CAAC,KAAK,CAAc,MAAM,CAAC,IAAI,EAAE;KAC7C,CAAC;CACH,CAAC","sourcesContent":["import { z } from \"zod\";\nimport type { BlockMdxConfig } from \"../types.js\";\n\n/**\n * Pure (React-free) part of the standard `code-tabs` block: its data schema and\n * MDX round-trip config. Shared by the server MDX adapter (a plan/content app\n * registers it via `@agent-native/core/blocks/server`) and the full client spec\n * (`code-tabs.tsx`). Keeping this React-free means importing it into a server\n * module never pulls React into the Nitro/SSR bundle.\n *\n * `code-tabs` is a STANDARD library block (a vertical file tab rail of Shiki-\n * highlighted code), shareable by any app. Its schema MUST stay data-compatible\n * with the legacy plan `code-tabs` branch of `planBlockSchema`, and the MDX\n * `tag` + attribute shape MUST match the legacy\n * `<CodeTabs … tabs={[…]} />` encoding (`plan-mdx.ts` `serializeBlock`/\n * `parseBlock`) so stored `.mdx` round-trips byte-compatibly.\n */\n\nexport interface CodeTabsTab {\n id: string;\n label: string;\n language?: string;\n code: string;\n caption?: string;\n}\n\nexport interface CodeTabsData {\n tabs: CodeTabsTab[];\n}\n\n/** Matches the plan `idSchema` (`z.string().trim().min(1).max(120)`). */\nconst tabIdSchema = z.string().trim().min(1).max(120);\n\nexport const codeTabsSchema = z.object({\n tabs: z\n .array(\n z.object({\n id: tabIdSchema,\n label: z.string().trim().min(1).max(120),\n language: z.string().trim().max(40).optional(),\n code: z.string().max(100_000),\n caption: z.string().trim().max(400).optional(),\n }),\n )\n .min(1)\n .max(12),\n}) as unknown as z.ZodType<CodeTabsData>;\n\n/**\n * MDX config: `tabs` is a single JSON-encoded attribute and the block is\n * self-closing — exactly the legacy `<CodeTabs id … tabs={[…]} />` form.\n * `toAttrs` returns only `tabs`; `fromAttrs` reads the `tabs` array (defaulting\n * to `[]` for backward-compat with malformed/empty stored blocks, mirroring the\n * legacy `arrayAttr(node, \"tabs\") ?? []`).\n */\nexport const codeTabsMdx: BlockMdxConfig<CodeTabsData> = {\n tag: \"CodeTabs\",\n toAttrs: (data) => ({ tabs: data.tabs }),\n fromAttrs: (attrs) => ({\n tabs: attrs.array<CodeTabsTab>(\"tabs\") ?? [],\n }),\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tabs.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/code-tabs.tsx"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,YAAY,EAElB,MAAM,uBAAuB,CAAC;AA2X/B,eAAO,MAAM,aAAa,+CAWxB,CAAC"}
|