kennel 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -5
- package/dist/cli/dispatch.js +9 -0
- package/dist/cli/src/automations/notifications.d.ts +40 -0
- package/dist/cli/src/automations/notifications.js +220 -0
- package/dist/cli/src/cli/dispatch.d.ts +1 -0
- package/dist/cli/src/cli/dispatch.js +125 -0
- package/dist/cli/src/cli/usage.d.ts +1 -0
- package/dist/cli/src/cli/usage.js +25 -0
- package/dist/cli/src/core/api-client.d.ts +13 -0
- package/dist/cli/src/core/api-client.js +1 -0
- package/dist/cli/src/core/command.d.ts +1 -0
- package/dist/cli/src/core/command.js +69 -0
- package/dist/cli/src/core/core-folders.d.ts +1 -0
- package/dist/cli/src/core/core-folders.js +42 -0
- package/dist/cli/src/core/init.d.ts +1 -0
- package/dist/cli/src/core/init.js +141 -0
- package/dist/cli/src/core/runtime.d.ts +14 -0
- package/dist/cli/src/core/runtime.js +1 -0
- package/dist/cli/src/deploy/cloudflare.d.ts +6 -0
- package/dist/cli/src/deploy/cloudflare.js +100 -0
- package/dist/cli/src/deploy/environment.d.ts +2 -0
- package/dist/cli/src/deploy/environment.js +47 -0
- package/dist/cli/src/deploy/smoke-tests.d.ts +4 -0
- package/dist/cli/src/deploy/smoke-tests.js +92 -0
- package/dist/cli/src/deploy/trigger-dev.d.ts +2 -0
- package/dist/cli/src/deploy/trigger-dev.js +255 -0
- package/dist/cli/src/deploy/vercel.d.ts +3 -0
- package/dist/cli/src/deploy/vercel.js +67 -0
- package/dist/cli/src/main.d.ts +1 -0
- package/dist/cli/src/main.js +9 -0
- package/dist/cli/src/mcp/agent-tools.d.ts +8 -0
- package/dist/cli/src/mcp/agent-tools.js +247 -0
- package/dist/cli/src/mcp/config.d.ts +25 -0
- package/dist/cli/src/mcp/config.js +185 -0
- package/dist/cli/src/mcp/function-source.d.ts +7 -0
- package/dist/cli/src/mcp/function-source.js +42 -0
- package/dist/cli/src/mcp/generate.d.ts +1 -0
- package/dist/cli/src/mcp/generate.js +47 -0
- package/dist/cli/src/mcp/install-page.d.ts +12 -0
- package/dist/cli/src/mcp/install-page.js +5 -0
- package/dist/cli/src/notifications/email-worker.d.ts +8 -0
- package/dist/cli/src/notifications/email-worker.js +137 -0
- package/dist/cli/src/package/mcp-data.d.ts +1 -0
- package/dist/cli/src/package/mcp-data.js +1 -0
- package/dist/cli/src/package/mcp-email-worker.d.ts +1 -0
- package/dist/cli/src/package/mcp-email-worker.js +1 -0
- package/dist/cli/src/package/mcp-http.d.ts +1 -0
- package/dist/cli/src/package/mcp-http.js +1 -0
- package/dist/cli/src/package/mcp-stdio.d.ts +1 -0
- package/dist/cli/src/package/mcp-stdio.js +1 -0
- package/dist/cli/src/package/mcp.d.ts +1 -0
- package/dist/cli/src/package/mcp.js +1 -0
- package/dist/cli/src/package/preview.d.ts +9 -0
- package/dist/cli/src/package/preview.js +1 -0
- package/dist/cli/src/plugins/external.d.ts +36 -0
- package/dist/cli/src/plugins/external.js +503 -0
- package/dist/cli/src/publish/cloudflare-init.d.ts +12 -0
- package/dist/cli/src/publish/cloudflare-init.js +101 -0
- package/dist/cli/src/publish/config.d.ts +28 -0
- package/dist/cli/src/publish/config.js +178 -0
- package/dist/cli/src/publish/options.d.ts +13 -0
- package/dist/cli/src/publish/options.js +78 -0
- package/dist/cli/src/publish/vercel-init.d.ts +9 -0
- package/dist/cli/src/publish/vercel-init.js +52 -0
- package/dist/cli/src/shared/json.d.ts +4 -0
- package/dist/cli/src/shared/json.js +56 -0
- package/dist/cli/src/shared/object.d.ts +2 -0
- package/dist/cli/src/shared/object.js +3 -0
- package/dist/cli/src/shared/package-manager.d.ts +11 -0
- package/dist/cli/src/shared/package-manager.js +39 -0
- package/dist/cli/src/shared/path.d.ts +4 -0
- package/dist/cli/src/shared/path.js +40 -0
- package/dist/cli/src/shared/process.d.ts +7 -0
- package/dist/cli/src/shared/process.js +12 -0
- package/dist/cli/src/shared/project-config.d.ts +2 -0
- package/dist/cli/src/shared/project-config.js +26 -0
- package/dist/cli/src/site/dev.d.ts +10 -0
- package/dist/cli/src/site/dev.js +126 -0
- package/dist/cli/src/site/extension.d.ts +8 -0
- package/dist/cli/src/site/extension.js +113 -0
- package/dist/cli/src/site/folder-icons.d.ts +46 -0
- package/dist/cli/src/site/folder-icons.js +86 -0
- package/dist/cli/src/site/hot-viewer.d.ts +2 -0
- package/dist/cli/src/site/hot-viewer.js +231 -0
- package/dist/cli/src/site/kinds.d.ts +1 -0
- package/dist/cli/src/site/kinds.js +1 -0
- package/dist/cli/src/site/mail.d.ts +1 -0
- package/dist/cli/src/site/mail.js +10 -0
- package/dist/cli/src/site/renderers.d.ts +61 -0
- package/dist/cli/src/site/renderers.js +219 -0
- package/dist/cli/src/site/server-plugins.d.ts +54 -0
- package/dist/cli/src/site/server-plugins.js +1 -0
- package/dist/cli/src/site/viewer.d.ts +36 -0
- package/dist/cli/src/site/viewer.js +352 -0
- package/dist/cli/src/site/vitepress.d.ts +1 -0
- package/dist/cli/src/site/vitepress.js +1 -0
- package/dist/cli/usage.js +1 -0
- package/dist/core/api-client.js +75 -44
- package/dist/core/command.js +6 -3
- package/dist/core/core-folders.js +38280 -33
- package/dist/core/init.js +59 -4
- package/dist/core/runtime.js +57163 -41853
- package/dist/package/preview.js +40589 -17894
- package/dist/plugins/external.d.ts +36 -0
- package/dist/plugins/external.js +503 -0
- package/dist/site/server-plugins.js +394 -59
- package/dist/site/viewer.js +18 -5
- package/kernel/apps/web/.env.example +11 -0
- package/kernel/apps/web/components.json +20 -0
- package/kernel/apps/web/eslint.config.mjs +60 -0
- package/kernel/apps/web/index.html +17 -0
- package/kernel/apps/web/package.json +79 -0
- package/kernel/apps/web/public/favicon.svg +6 -0
- package/kernel/apps/web/public/providers/claude.svg +1 -0
- package/kernel/apps/web/public/providers/codex.svg +1 -0
- package/kernel/apps/web/public/providers/cursor.svg +1 -0
- package/kernel/apps/web/public/providers/opencode.svg +1 -0
- package/kernel/apps/web/public/providers/pi.svg +1 -0
- package/kernel/apps/web/server/acp/index.ts +1 -0
- package/kernel/apps/web/server/acp/live-agent-connection.ts +1 -0
- package/kernel/apps/web/server/acp/process-manager.ts +1 -0
- package/kernel/apps/web/server/acp/registry.ts +1 -0
- package/kernel/apps/web/server/acp/sdk.ts +1 -0
- package/kernel/apps/web/server/acp/transport.ts +1 -0
- package/kernel/apps/web/server/acp/types.ts +1 -0
- package/kernel/apps/web/server/acp-live-plugin.ts +30 -0
- package/kernel/apps/web/server/api/document-edit.ts +1 -0
- package/kernel/apps/web/server/api/open-path.ts +1 -0
- package/kernel/apps/web/server/core-plugin.ts +49 -0
- package/kernel/apps/web/server/folder-favicon.ts +1 -0
- package/kernel/apps/web/server/folder-icons.ts +1 -0
- package/kernel/apps/web/server/folder-metadata-plugin.ts +31 -0
- package/kernel/apps/web/server/plugins.ts +1 -0
- package/kernel/apps/web/server/preview-kinds.ts +1 -0
- package/kernel/apps/web/src/ai-input.tsx +62 -0
- package/kernel/apps/web/src/annotations.tsx +430 -0
- package/kernel/apps/web/src/api/client.ts +3 -0
- package/kernel/apps/web/src/api/errors.ts +1 -0
- package/kernel/apps/web/src/api/events.ts +42 -0
- package/kernel/apps/web/src/app.css +332 -0
- package/kernel/apps/web/src/app.tsx +667 -0
- package/kernel/apps/web/src/ask-draft.ts +164 -0
- package/kernel/apps/web/src/ask-tray.tsx +256 -0
- package/kernel/apps/web/src/comment-editor.tsx +93 -0
- package/kernel/apps/web/src/comment-form.tsx +162 -0
- package/kernel/apps/web/src/copy-path.ts +18 -0
- package/kernel/apps/web/src/deferred-ask-tray.tsx +20 -0
- package/kernel/apps/web/src/document-url.ts +46 -0
- package/kernel/apps/web/src/documents-url.ts +23 -0
- package/kernel/apps/web/src/dropped-folder.ts +64 -0
- package/kernel/apps/web/src/external-plugins.ts +3 -0
- package/kernel/apps/web/src/file-viewer.tsx +171 -0
- package/kernel/apps/web/src/folder-filter-icons.tsx +39 -0
- package/kernel/apps/web/src/folder-metadata.ts +76 -0
- package/kernel/apps/web/src/folder-plugin-view.tsx +87 -0
- package/kernel/apps/web/src/folder-query-cache.ts +66 -0
- package/kernel/apps/web/src/host-adapters.ts +209 -0
- package/kernel/apps/web/src/host-bridge.ts +214 -0
- package/kernel/apps/web/src/lib/entity-folder.ts +2 -0
- package/kernel/apps/web/src/linked-session-header.tsx +43 -0
- package/kernel/apps/web/src/live-session-controls.tsx +326 -0
- package/kernel/apps/web/src/local-source.ts +32 -0
- package/kernel/apps/web/src/main.tsx +24 -0
- package/kernel/apps/web/src/markdown-page.tsx +444 -0
- package/kernel/apps/web/src/notes-page.tsx +103 -0
- package/kernel/apps/web/src/plugins.ts +53 -0
- package/kernel/apps/web/src/project-search-dialog.tsx +257 -0
- package/kernel/apps/web/src/project-search.ts +18 -0
- package/kernel/apps/web/src/query-client.ts +4 -0
- package/kernel/apps/web/src/rehype-source-lines.ts +22 -0
- package/kernel/apps/web/src/routes/document.tsx +1 -0
- package/kernel/apps/web/src/routes/entities.tsx +277 -0
- package/kernel/apps/web/src/routes/search.tsx +60 -0
- package/kernel/apps/web/src/selection-context.ts +68 -0
- package/kernel/apps/web/src/selection-input.tsx +58 -0
- package/kernel/apps/web/src/selection-popup.tsx +155 -0
- package/kernel/apps/web/src/session-transcript-page.tsx +152 -0
- package/kernel/apps/web/src/use-annotations.ts +162 -0
- package/kernel/apps/web/src/use-ask-ai.ts +26 -0
- package/kernel/apps/web/src/use-ask-draft.ts +27 -0
- package/kernel/apps/web/src/use-document.ts +37 -0
- package/kernel/apps/web/src/use-folder-notes.ts +49 -0
- package/kernel/apps/web/src/use-linked-session.ts +33 -0
- package/kernel/apps/web/src/view-context.tsx +69 -0
- package/kernel/apps/web/src/view-header.tsx +66 -0
- package/kernel/apps/web/src/viewer-capabilities.ts +33 -0
- package/kernel/apps/web/src/viewer-route.ts +1 -0
- package/kernel/apps/web/src/viewport-height.ts +33 -0
- package/kernel/apps/web/tsconfig.json +24 -0
- package/kernel/apps/web/vite.config.ts +252 -0
- package/kernel/packages/agents/eslint.config.js +10 -0
- package/kernel/packages/agents/package.json +75 -0
- package/kernel/packages/agents/src/agent-card.tsx +334 -0
- package/kernel/packages/agents/src/client.tsx +13 -0
- package/kernel/packages/agents/src/index.ts +18 -0
- package/kernel/packages/agents/src/manifest.ts +7 -0
- package/kernel/packages/agents/src/node.ts +447 -0
- package/kernel/packages/agents/src/profiles.ts +137 -0
- package/kernel/packages/agents/src/resolve.ts +69 -0
- package/kernel/packages/agents/src/server.ts +60 -0
- package/kernel/packages/agents/src/types.ts +82 -0
- package/kernel/packages/agents/src/viewer.tsx +370 -0
- package/kernel/packages/agents/test/profiles.test.mjs +88 -0
- package/kernel/packages/agents/test/resolve.test.mjs +729 -0
- package/kernel/packages/agents/tsconfig.json +17 -0
- package/kernel/packages/api/README.md +73 -0
- package/kernel/packages/api/openapi.json +3368 -0
- package/kernel/packages/api/package.json +41 -0
- package/kernel/packages/api/src/client/errors.ts +1 -0
- package/kernel/packages/api/src/client/index.ts +2 -0
- package/kernel/packages/api/src/contracts/schemas.ts +277 -0
- package/kernel/packages/api/src/contracts.ts +20 -0
- package/kernel/packages/api/src/index.ts +34 -0
- package/kernel/packages/api/src/server/acp/index.ts +35 -0
- package/kernel/packages/api/src/server/acp/live-agent-connection.ts +44 -0
- package/kernel/packages/api/src/server/acp/process-manager.ts +291 -0
- package/kernel/packages/api/src/server/acp/registry.ts +140 -0
- package/kernel/packages/api/src/server/acp/sdk.ts +15 -0
- package/kernel/packages/api/src/server/acp/transport.ts +115 -0
- package/kernel/packages/api/src/server/acp/types.ts +89 -0
- package/kernel/packages/api/src/server/acp-live-plugin.ts +423 -0
- package/kernel/packages/api/src/server/api/create-agent-file.ts +46 -0
- package/kernel/packages/api/src/server/api/document-edit.ts +125 -0
- package/kernel/packages/api/src/server/api/open-path.ts +40 -0
- package/kernel/packages/api/src/server/contracts.ts +85 -0
- package/kernel/packages/api/src/server/entity-folder.ts +353 -0
- package/kernel/packages/api/src/server/folder-favicon.ts +17 -0
- package/kernel/packages/api/src/server/folder-icons.ts +113 -0
- package/kernel/packages/api/src/server/folder-metadata-plugin.ts +1758 -0
- package/kernel/packages/api/src/server/host.ts +21 -0
- package/kernel/packages/api/src/server/index.ts +197 -0
- package/kernel/packages/api/src/server/linked-folder-discovery.ts +158 -0
- package/kernel/packages/api/src/server/plugins.ts +205 -0
- package/kernel/packages/api/src/server/project-discovery.ts +69 -0
- package/kernel/packages/api/src/server/watcher.ts +46 -0
- package/kernel/packages/api/src/shared/selection.ts +16 -0
- package/kernel/packages/api/src/shared/viewer-route.ts +200 -0
- package/kernel/packages/api/test/agents-loading.test.ts +94 -0
- package/kernel/packages/api/test/core.test.ts +364 -0
- package/kernel/packages/api/test/entity-folder.test.ts +131 -0
- package/kernel/packages/api/test/linked-folder-discovery.test.ts +78 -0
- package/kernel/packages/api/test/media-endpoint.test.ts +83 -0
- package/kernel/packages/api/test/partial-loading.test.ts +43 -0
- package/kernel/packages/api/test/project-discovery.test.ts +44 -0
- package/kernel/packages/api/tsconfig.json +11 -0
- package/kernel/packages/api-client/README.md +72 -0
- package/kernel/packages/api-client/package.json +26 -0
- package/kernel/packages/api-client/scripts/generate.ts +68 -0
- package/kernel/packages/api-client/src/errors.ts +59 -0
- package/kernel/packages/api-client/src/generated.d.ts +1248 -0
- package/kernel/packages/api-client/src/index.ts +206 -0
- package/kernel/packages/api-client/src/responses.ts +19 -0
- package/kernel/packages/api-client/test/client.test.ts +143 -0
- package/kernel/packages/api-client/tsconfig.json +12 -0
- package/kernel/packages/folder-plugin/eslint.config.js +10 -0
- package/kernel/packages/folder-plugin/package.json +50 -0
- package/kernel/packages/folder-plugin/src/client.ts +73 -0
- package/kernel/packages/folder-plugin/src/endpoint.ts +273 -0
- package/kernel/packages/folder-plugin/src/index.ts +15 -0
- package/kernel/packages/folder-plugin/src/server.ts +78 -0
- package/kernel/packages/folder-plugin/src/subpath.ts +34 -0
- package/kernel/packages/folder-plugin/src/types.ts +86 -0
- package/kernel/packages/folder-plugin/src/validation.ts +56 -0
- package/kernel/packages/folder-plugin/test/contract.test.mjs +133 -0
- package/kernel/packages/folder-plugin/tsconfig.json +17 -0
- package/kernel/packages/kinds/package.json +24 -0
- package/kernel/packages/kinds/src/kinds.ts +172 -0
- package/kernel/packages/markdown/README.md +40 -0
- package/kernel/packages/markdown/explorer.css +1 -0
- package/kernel/packages/markdown/package.json +30 -0
- package/kernel/packages/markdown/src/documents.ts +1 -0
- package/kernel/packages/markdown/src/explorer.ts +1 -0
- package/kernel/packages/markdown/src/index.ts +2 -0
- package/kernel/packages/markdown/src/metadata.ts +63 -0
- package/kernel/packages/markdown/src/node.ts +1 -0
- package/kernel/packages/markdown/styles.css +1 -0
- package/kernel/packages/notes/SKILL.md +19 -0
- package/kernel/packages/notes/eslint.config.js +10 -0
- package/kernel/packages/notes/package.json +72 -0
- package/kernel/packages/notes/src/client.tsx +12 -0
- package/kernel/packages/notes/src/data/ai-input.ts +58 -0
- package/kernel/packages/notes/src/data/api.ts +40 -0
- package/kernel/packages/notes/src/data/parse.ts +15 -0
- package/kernel/packages/notes/src/data/routing.ts +33 -0
- package/kernel/packages/notes/src/data/use-folder-notes.ts +49 -0
- package/kernel/packages/notes/src/index.ts +2 -0
- package/kernel/packages/notes/src/manifest.ts +6 -0
- package/kernel/packages/notes/src/pages/notes-page.tsx +79 -0
- package/kernel/packages/notes/src/pages/single-note-page.tsx +57 -0
- package/kernel/packages/notes/src/server.ts +88 -0
- package/kernel/packages/notes/src/ui/ai-composer-controls.tsx +70 -0
- package/kernel/packages/notes/src/ui/folder-notes-list.tsx +140 -0
- package/kernel/packages/notes/tsconfig.json +16 -0
- package/kernel/packages/schemas/ICON-POLICY.md +43 -0
- package/kernel/packages/schemas/SKILL.md +185 -0
- package/kernel/packages/schemas/eslint.config.js +10 -0
- package/kernel/packages/schemas/package.json +81 -0
- package/kernel/packages/schemas/src/client.tsx +137 -0
- package/kernel/packages/schemas/src/data/config-file.ts +37 -0
- package/kernel/packages/schemas/src/data/contract.ts +174 -0
- package/kernel/packages/schemas/src/data/favicon.ts +218 -0
- package/kernel/packages/schemas/src/data/fields.ts +96 -0
- package/kernel/packages/schemas/src/data/icon-image.ts +53 -0
- package/kernel/packages/schemas/src/data/icon.ts +97 -0
- package/kernel/packages/schemas/src/data/load.ts +161 -0
- package/kernel/packages/schemas/src/data/params.ts +103 -0
- package/kernel/packages/schemas/src/data/query.ts +33 -0
- package/kernel/packages/schemas/src/data/sort.ts +50 -0
- package/kernel/packages/schemas/src/data/workspace.ts +101 -0
- package/kernel/packages/schemas/src/index.ts +22 -0
- package/kernel/packages/schemas/src/manifest.ts +4 -0
- package/kernel/packages/schemas/src/node.ts +384 -0
- package/kernel/packages/schemas/src/pages/collection.tsx +252 -0
- package/kernel/packages/schemas/src/server.ts +208 -0
- package/kernel/packages/schemas/src/ui/schema-entity-list.tsx +124 -0
- package/kernel/packages/schemas/src/ui/schema-filters.tsx +186 -0
- package/kernel/packages/schemas/src/ui/schema-search.tsx +35 -0
- package/kernel/packages/schemas/src/ui/use-query-param-filter-setting.tsx +15 -0
- package/kernel/packages/schemas/test/contract.test.mjs +26 -0
- package/kernel/packages/schemas/test/fields.test.mjs +187 -0
- package/kernel/packages/schemas/test/load.test.mjs +12 -0
- package/kernel/packages/schemas/test/node.test.mjs +412 -0
- package/kernel/packages/schemas/test/query.test.mjs +134 -0
- package/kernel/packages/schemas/test/workspace.test.mjs +86 -0
- package/kernel/packages/schemas/tsconfig.json +17 -0
- package/kernel/packages/session-finding/package.json +33 -0
- package/kernel/packages/session-finding/src/index.ts +120 -0
- package/kernel/packages/session-finding/test/list-sessions.test.mjs +139 -0
- package/kernel/packages/session-finding/tsconfig.json +12 -0
- package/kernel/packages/ui/LICENSE +21 -0
- package/kernel/packages/ui/components.json +20 -0
- package/kernel/packages/ui/eslint.config.js +8 -0
- package/kernel/packages/ui/package.json +106 -0
- package/kernel/packages/ui/src/chat/file-link.ts +178 -0
- package/kernel/packages/ui/src/chat/index.ts +18 -0
- package/kernel/packages/ui/src/chat/transcript.tsx +348 -0
- package/kernel/packages/ui/src/chat/turns.ts +76 -0
- package/kernel/packages/ui/src/chat/types.ts +23 -0
- package/kernel/packages/ui/src/chat/use-overflowing.ts +56 -0
- package/kernel/packages/ui/src/components/accordion.tsx +74 -0
- package/kernel/packages/ui/src/components/alert-dialog.tsx +164 -0
- package/kernel/packages/ui/src/components/alert.tsx +68 -0
- package/kernel/packages/ui/src/components/app-breadcrumbs.tsx +170 -0
- package/kernel/packages/ui/src/components/app-header.tsx +125 -0
- package/kernel/packages/ui/src/components/app-options.tsx +87 -0
- package/kernel/packages/ui/src/components/app-view-header.tsx +34 -0
- package/kernel/packages/ui/src/components/aspect-ratio.tsx +11 -0
- package/kernel/packages/ui/src/components/avatar.tsx +53 -0
- package/kernel/packages/ui/src/components/badge.tsx +47 -0
- package/kernel/packages/ui/src/components/base-dialog.tsx +3 -0
- package/kernel/packages/ui/src/components/base-tabs.tsx +63 -0
- package/kernel/packages/ui/src/components/breadcrumb.tsx +110 -0
- package/kernel/packages/ui/src/components/button-group.tsx +86 -0
- package/kernel/packages/ui/src/components/button.tsx +65 -0
- package/kernel/packages/ui/src/components/calendar.tsx +240 -0
- package/kernel/packages/ui/src/components/card.tsx +95 -0
- package/kernel/packages/ui/src/components/carousel.tsx +240 -0
- package/kernel/packages/ui/src/components/chart.tsx +375 -0
- package/kernel/packages/ui/src/components/checkbox.tsx +39 -0
- package/kernel/packages/ui/src/components/collapsible.tsx +33 -0
- package/kernel/packages/ui/src/components/collection-icon.tsx +28 -0
- package/kernel/packages/ui/src/components/command.tsx +205 -0
- package/kernel/packages/ui/src/components/content-issues.tsx +63 -0
- package/kernel/packages/ui/src/components/context-menu.tsx +298 -0
- package/kernel/packages/ui/src/components/copy-context.tsx +134 -0
- package/kernel/packages/ui/src/components/dialog.tsx +157 -0
- package/kernel/packages/ui/src/components/drawer.tsx +162 -0
- package/kernel/packages/ui/src/components/dropdown-menu.tsx +303 -0
- package/kernel/packages/ui/src/components/empty.tsx +108 -0
- package/kernel/packages/ui/src/components/field.tsx +260 -0
- package/kernel/packages/ui/src/components/file-preview.tsx +152 -0
- package/kernel/packages/ui/src/components/file-renderer.tsx +466 -0
- package/kernel/packages/ui/src/components/filter-chip-panel.tsx +157 -0
- package/kernel/packages/ui/src/components/filter-select.tsx +127 -0
- package/kernel/packages/ui/src/components/folder-activity.tsx +646 -0
- package/kernel/packages/ui/src/components/folder-file-list.tsx +58 -0
- package/kernel/packages/ui/src/components/folder-filter-bar.tsx +191 -0
- package/kernel/packages/ui/src/components/folder-image.tsx +18 -0
- package/kernel/packages/ui/src/components/folder-landing.tsx +70 -0
- package/kernel/packages/ui/src/components/folder-list.tsx +140 -0
- package/kernel/packages/ui/src/components/folder-metadata.tsx +107 -0
- package/kernel/packages/ui/src/components/folder-mobile-bar.tsx +60 -0
- package/kernel/packages/ui/src/components/folder-project-list.tsx +133 -0
- package/kernel/packages/ui/src/components/folder-session-list.tsx +113 -0
- package/kernel/packages/ui/src/components/folder-session-page.tsx +126 -0
- package/kernel/packages/ui/src/components/folder-sidebar.tsx +52 -0
- package/kernel/packages/ui/src/components/folder-skill-list.tsx +62 -0
- package/kernel/packages/ui/src/components/folder-tabs.tsx +156 -0
- package/kernel/packages/ui/src/components/form.tsx +167 -0
- package/kernel/packages/ui/src/components/hover-card.tsx +52 -0
- package/kernel/packages/ui/src/components/icons.tsx +34 -0
- package/kernel/packages/ui/src/components/input-group.tsx +184 -0
- package/kernel/packages/ui/src/components/input-otp.tsx +90 -0
- package/kernel/packages/ui/src/components/input.tsx +29 -0
- package/kernel/packages/ui/src/components/item.tsx +195 -0
- package/kernel/packages/ui/src/components/kbd.tsx +32 -0
- package/kernel/packages/ui/src/components/label.tsx +27 -0
- package/kernel/packages/ui/src/components/link.tsx +45 -0
- package/kernel/packages/ui/src/components/live-tool-call.tsx +193 -0
- package/kernel/packages/ui/src/components/menubar.tsx +323 -0
- package/kernel/packages/ui/src/components/navigation-menu.tsx +210 -0
- package/kernel/packages/ui/src/components/note-card.tsx +149 -0
- package/kernel/packages/ui/src/components/pagination.tsx +128 -0
- package/kernel/packages/ui/src/components/popover.tsx +56 -0
- package/kernel/packages/ui/src/components/progress.tsx +31 -0
- package/kernel/packages/ui/src/components/radio-group.tsx +54 -0
- package/kernel/packages/ui/src/components/scroll-area.tsx +61 -0
- package/kernel/packages/ui/src/components/select.tsx +219 -0
- package/kernel/packages/ui/src/components/separator.tsx +30 -0
- package/kernel/packages/ui/src/components/session-icon.tsx +124 -0
- package/kernel/packages/ui/src/components/sheet.tsx +157 -0
- package/kernel/packages/ui/src/components/sidebar.tsx +789 -0
- package/kernel/packages/ui/src/components/skeleton.tsx +13 -0
- package/kernel/packages/ui/src/components/slider.tsx +73 -0
- package/kernel/packages/ui/src/components/sonner.tsx +41 -0
- package/kernel/packages/ui/src/components/spinner.tsx +16 -0
- package/kernel/packages/ui/src/components/switch.tsx +40 -0
- package/kernel/packages/ui/src/components/table.tsx +120 -0
- package/kernel/packages/ui/src/components/tabs.tsx +78 -0
- package/kernel/packages/ui/src/components/textarea.tsx +25 -0
- package/kernel/packages/ui/src/components/toggle-group.tsx +87 -0
- package/kernel/packages/ui/src/components/toggle.tsx +48 -0
- package/kernel/packages/ui/src/components/tooltip.tsx +71 -0
- package/kernel/packages/ui/src/components/viewer-options.tsx +166 -0
- package/kernel/packages/ui/src/hooks/use-folder-filter.ts +103 -0
- package/kernel/packages/ui/src/hooks/use-mobile.ts +19 -0
- package/kernel/packages/ui/src/index.ts +13 -0
- package/kernel/packages/ui/src/lib/document-extensions.ts +83 -0
- package/kernel/packages/ui/src/lib/folder-activity.ts +143 -0
- package/kernel/packages/ui/src/lib/folder-filter.ts +284 -0
- package/kernel/packages/ui/src/lib/live-tool-call.tsx +109 -0
- package/kernel/packages/ui/src/lib/media-urls.ts +176 -0
- package/kernel/packages/ui/src/lib/obsidian-links.ts +120 -0
- package/kernel/packages/ui/src/lib/source-components.tsx +65 -0
- package/kernel/packages/ui/src/lib/utils.tsx +7 -0
- package/kernel/packages/ui/src/pages/entity-detail-page.tsx +82 -0
- package/kernel/packages/ui/src/pages/entity-list-page.tsx +50 -0
- package/kernel/packages/ui/src/pages/entity-page.tsx +69 -0
- package/kernel/packages/ui/src/styles/folder-activity.css +2151 -0
- package/kernel/packages/ui/test/copy-context.test.mjs +48 -0
- package/kernel/packages/ui/test/folder-filter.test.mjs +484 -0
- package/kernel/packages/ui/tsconfig.json +15 -0
- package/kernel/plugins/calendar/SKILL.md +173 -0
- package/kernel/plugins/calendar/eslint.config.js +10 -0
- package/kernel/plugins/calendar/package.json +73 -0
- package/kernel/plugins/calendar/schema.json +137 -0
- package/kernel/plugins/calendar/src/calendar.tsx +328 -0
- package/kernel/plugins/calendar/src/client.tsx +139 -0
- package/kernel/plugins/calendar/src/context.ts +48 -0
- package/kernel/plugins/calendar/src/copy-button.tsx +66 -0
- package/kernel/plugins/calendar/src/event-dialog.tsx +270 -0
- package/kernel/plugins/calendar/src/index.ts +4 -0
- package/kernel/plugins/calendar/src/manifest.ts +7 -0
- package/kernel/plugins/calendar/src/parse.ts +610 -0
- package/kernel/plugins/calendar/src/server.ts +160 -0
- package/kernel/plugins/calendar/src/utils.ts +80 -0
- package/kernel/plugins/calendar/src/views.tsx +418 -0
- package/kernel/plugins/calendar/test/context.test.mjs +60 -0
- package/kernel/plugins/calendar/test/package.test.mjs +43 -0
- package/kernel/plugins/calendar/test/parse.test.mjs +392 -0
- package/kernel/plugins/calendar/test/server.test.mjs +126 -0
- package/kernel/plugins/calendar/tsconfig.json +17 -0
- package/kernel/plugins/mail/SKILL.md +97 -0
- package/kernel/plugins/mail/eslint.config.js +10 -0
- package/kernel/plugins/mail/package.json +79 -0
- package/kernel/plugins/mail/src/api.ts +359 -0
- package/kernel/plugins/mail/src/bun-ffi.d.ts +14 -0
- package/kernel/plugins/mail/src/client.tsx +14 -0
- package/kernel/plugins/mail/src/flock.ts +137 -0
- package/kernel/plugins/mail/src/folders.ts +37 -0
- package/kernel/plugins/mail/src/history.ts +485 -0
- package/kernel/plugins/mail/src/index.ts +3 -0
- package/kernel/plugins/mail/src/mail-card.tsx +123 -0
- package/kernel/plugins/mail/src/mail-conversation.tsx +153 -0
- package/kernel/plugins/mail/src/mail-detail-page.tsx +467 -0
- package/kernel/plugins/mail/src/mail-hooks.ts +252 -0
- package/kernel/plugins/mail/src/mail-page.tsx +109 -0
- package/kernel/plugins/mail/src/mail-request.ts +78 -0
- package/kernel/plugins/mail/src/mail-send-box.tsx +175 -0
- package/kernel/plugins/mail/src/mailos.ts +723 -0
- package/kernel/plugins/mail/src/manifest.ts +7 -0
- package/kernel/plugins/mail/src/node.ts +171 -0
- package/kernel/plugins/mail/src/parse.ts +139 -0
- package/kernel/plugins/mail/src/server.ts +125 -0
- package/kernel/plugins/mail/src/types.ts +10 -0
- package/kernel/plugins/mail/src/viewer.tsx +147 -0
- package/kernel/plugins/mail/test/flock.test.mjs +156 -0
- package/kernel/plugins/mail/test/folders.test.mjs +138 -0
- package/kernel/plugins/mail/test/history.test.mjs +460 -0
- package/kernel/plugins/mail/test/mailos.test.mjs +752 -0
- package/kernel/plugins/mail/test/node.test.mjs +207 -0
- package/kernel/plugins/mail/test/package.test.mjs +54 -0
- package/kernel/plugins/mail/test/parse.test.mjs +32 -0
- package/kernel/plugins/mail/test/server.test.mjs +116 -0
- package/kernel/plugins/mail/test/viewer.test.mjs +192 -0
- package/kernel/plugins/mail/tsconfig.json +17 -0
- package/kernel/plugins/projects/SKILL.md +73 -0
- package/kernel/plugins/projects/eslint.config.js +10 -0
- package/kernel/plugins/projects/package.json +70 -0
- package/kernel/plugins/projects/src/client.tsx +17 -0
- package/kernel/plugins/projects/src/data/model.ts +129 -0
- package/kernel/plugins/projects/src/index.ts +17 -0
- package/kernel/plugins/projects/src/manifest.ts +7 -0
- package/kernel/plugins/projects/src/project-context.ts +41 -0
- package/kernel/plugins/projects/src/server.ts +276 -0
- package/kernel/plugins/projects/src/ui/project-card.tsx +61 -0
- package/kernel/plugins/projects/src/ui/projects-page.tsx +102 -0
- package/kernel/plugins/projects/test/package.test.mjs +51 -0
- package/kernel/plugins/projects/tsconfig.json +17 -0
- package/kernel/plugins/tasks/SKILL.md +341 -0
- package/kernel/plugins/tasks/eslint.config.js +10 -0
- package/kernel/plugins/tasks/package.json +74 -0
- package/kernel/plugins/tasks/schema.json +939 -0
- package/kernel/plugins/tasks/src/api.ts +212 -0
- package/kernel/plugins/tasks/src/client.tsx +23 -0
- package/kernel/plugins/tasks/src/data/parse.ts +544 -0
- package/kernel/plugins/tasks/src/data/task-id.ts +56 -0
- package/kernel/plugins/tasks/src/data/todo-model.ts +795 -0
- package/kernel/plugins/tasks/src/index.ts +34 -0
- package/kernel/plugins/tasks/src/manifest.ts +7 -0
- package/kernel/plugins/tasks/src/pages/task-detail.tsx +48 -0
- package/kernel/plugins/tasks/src/pages/task-list.tsx +88 -0
- package/kernel/plugins/tasks/src/server.ts +447 -0
- package/kernel/plugins/tasks/src/styles.css +9 -0
- package/kernel/plugins/tasks/src/ui/compact-todo-list.tsx +372 -0
- package/kernel/plugins/tasks/src/ui/error-details.tsx +78 -0
- package/kernel/plugins/tasks/src/ui/task-page.tsx +392 -0
- package/kernel/plugins/tasks/src/ui/todo-agent-filter.tsx +36 -0
- package/kernel/plugins/tasks/src/ui/todo-filter-bar.tsx +66 -0
- package/kernel/plugins/tasks/src/ui/todo-item.tsx +494 -0
- package/kernel/plugins/tasks/src/ui/todo-status-filter.tsx +60 -0
- package/kernel/plugins/tasks/src/ui/todo-tag-filter.tsx +48 -0
- package/kernel/plugins/tasks/src/ui/todo-warnings.tsx +106 -0
- package/kernel/plugins/tasks/test/api.test.mjs +99 -0
- package/kernel/plugins/tasks/test/folder-sources.test.mjs +46 -0
- package/kernel/plugins/tasks/test/package.test.mjs +54 -0
- package/kernel/plugins/tasks/test/parse.test.mjs +225 -0
- package/kernel/plugins/tasks/test/server.test.mjs +386 -0
- package/kernel/plugins/tasks/tsconfig.json +17 -0
- package/node_modules/@agentclientprotocol/sdk/LICENSE +191 -0
- package/node_modules/@agentclientprotocol/sdk/README.md +70 -0
- package/node_modules/@agentclientprotocol/sdk/dist/acp.d.ts +1835 -0
- package/node_modules/@agentclientprotocol/sdk/dist/acp.js +1885 -0
- package/node_modules/@agentclientprotocol/sdk/dist/acp.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/acp.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/acp.test.js +5036 -0
- package/node_modules/@agentclientprotocol/sdk/dist/acp.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/connection.d.ts +82 -0
- package/node_modules/@agentclientprotocol/sdk/dist/connection.js +428 -0
- package/node_modules/@agentclientprotocol/sdk/dist/connection.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/connection.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/connection.test.js +470 -0
- package/node_modules/@agentclientprotocol/sdk/dist/connection.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.d.ts +26 -0
- package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.js +96 -0
- package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.js +77 -0
- package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.d.ts +2 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.js +232 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/client.d.ts +2 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/client.js +132 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/client.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.d.ts +9 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js +221 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.d.ts +2 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.js +86 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.d.ts +2 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.js +112 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.d.ts +2 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.js +88 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/http-stream.d.ts +33 -0
- package/node_modules/@agentclientprotocol/sdk/dist/http-stream.js +435 -0
- package/node_modules/@agentclientprotocol/sdk/dist/http-stream.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.js +1380 -0
- package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.d.ts +603 -0
- package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js +1064 -0
- package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.js +851 -0
- package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.d.ts +22 -0
- package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.js +64 -0
- package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.js +45 -0
- package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.d.ts +17 -0
- package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.js +426 -0
- package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.js +499 -0
- package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.d.ts +37 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.js +474 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.js +535 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol.d.ts +11 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol.js +57 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.js +73 -0
- package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.d.ts +199 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js +211 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/index.d.ts +51 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js +52 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.d.ts +6118 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.js +3 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.d.ts +14160 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js +3066 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.d.ts +30 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js +98 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.js +93 -0
- package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.js +261 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.js +490 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-sse.d.ts +2 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-sse.js +104 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-sse.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.js +52 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.js +946 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server.d.ts +81 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server.js +380 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server.test.js +1082 -0
- package/node_modules/@agentclientprotocol/sdk/dist/server.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/sse.d.ts +4 -0
- package/node_modules/@agentclientprotocol/sdk/dist/sse.js +91 -0
- package/node_modules/@agentclientprotocol/sdk/dist/sse.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/sse.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/sse.test.js +126 -0
- package/node_modules/@agentclientprotocol/sdk/dist/sse.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/stream.d.ts +35 -0
- package/node_modules/@agentclientprotocol/sdk/dist/stream.js +106 -0
- package/node_modules/@agentclientprotocol/sdk/dist/stream.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/stream.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/stream.test.js +206 -0
- package/node_modules/@agentclientprotocol/sdk/dist/stream.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.d.ts +8 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.js +51 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.d.ts +24 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.js +163 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.d.ts +9 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.js +74 -0
- package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.d.ts +806 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js +1183 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.js +512 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.d.ts +954 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js +1035 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.d.ts +42 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.js +43 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.d.ts +6146 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.js +3 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.d.ts +30552 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js +3204 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-server.d.ts +14 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-server.js +358 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-server.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.d.ts +54 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.js +246 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.js +833 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.d.ts +13 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.js +78 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.d.ts +1 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.js +42 -0
- package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.js.map +1 -0
- package/node_modules/@agentclientprotocol/sdk/package.json +105 -0
- package/node_modules/@agentclientprotocol/sdk/schema/schema.json +8819 -0
- package/node_modules/@agentclientprotocol/sdk/schema/v2/schema.unstable.json +10098 -0
- package/package.json +52 -6
- package/web/assets/{abnfDiagram-VRR7QNED-Nfq-O04D.js → abnfDiagram-VRR7QNED-Bgfb1nEB.js} +1 -1
- package/web/assets/app-DoGr2Zi7.js +2 -0
- package/web/assets/app-options-D-RJiQ-X.js +25 -0
- package/web/assets/app-view-header-BLvLq02T.js +1 -0
- package/web/assets/arc-Dk_KI36B.js +1 -0
- package/web/assets/{architectureDiagram-ZJ3FMSHR-qhRwPNcQ.js → architectureDiagram-ZJ3FMSHR-NR_KhRCf.js} +1 -1
- package/web/assets/ask-tray-TzeTcO6-.js +14 -0
- package/web/assets/{blockDiagram-677ZJIJ3-C56P3bGu.js → blockDiagram-677ZJIJ3-CkLkwx9C.js} +1 -1
- package/web/assets/button-C6arH7zt.js +1 -0
- package/web/assets/{c4Diagram-LMCZKHZV-Ey1M72zD.js → c4Diagram-LMCZKHZV-CFCUH8e_.js} +1 -1
- package/web/assets/channel-uMEjV8qc.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-a6isk9VU.js → chunk-2Q5K7J3B-B_BPLWsW.js} +1 -1
- package/web/assets/{chunk-32BRIVSS-uy4kdSLL.js → chunk-32BRIVSS-B1VB1hOy.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-oj2sBFd7.js → chunk-5VM5RSS4-KFcYr8Co.js} +1 -1
- package/web/assets/{chunk-EX3LRPZG-Bzl1ukAi.js → chunk-EX3LRPZG-CpBX3kuK.js} +3 -3
- package/web/assets/{chunk-JWPE2WC7-sUph7I_t.js → chunk-JWPE2WC7-BPSl40wG.js} +1 -1
- package/web/assets/{chunk-MOJQB5TN-C0ERSuVK.js → chunk-MOJQB5TN-D2RcYmoU.js} +1 -1
- package/web/assets/{chunk-RYQCIY6F-Dyw1Hfwp.js → chunk-RYQCIY6F-m7Gyn-t3.js} +1 -1
- package/web/assets/{chunk-V7JOEXUC-DnSz22rb.js → chunk-V7JOEXUC-TDvdopxS.js} +1 -1
- package/web/assets/{chunk-VR4S4FIN-Bp2SNel7.js → chunk-VR4S4FIN-DZTsG51a.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-Dqtar746.js → chunk-XXDRQBXY-Dp0--RE2.js} +1 -1
- package/web/assets/classDiagram-OUVF2IWQ-fbZocVor.js +1 -0
- package/web/assets/classDiagram-v2-EOCWNBFH-fbZocVor.js +1 -0
- package/web/assets/client-C6Nxdfif.js +2 -0
- package/web/assets/client-CXYfBko5.js +17 -0
- package/web/assets/client-CoKtOq-X.js +7 -0
- package/web/assets/client-DyRQz5RU.js +53 -0
- package/web/assets/client-OY6HUzuD.js +98 -0
- package/web/assets/client-YOYWZIFi.js +34 -0
- package/web/assets/client-j2kQmxsO.js +22 -0
- package/web/assets/command-BugZBGXE.js +38 -0
- package/web/assets/copy-context-C0Uqsp-3.js +1 -0
- package/web/assets/{cose-bilkent-JH36ORCC-Dx1VqMjj.js → cose-bilkent-JH36ORCC-CPu3PI8h.js} +1 -1
- package/web/assets/{cynefin-VYW2F7L2-SjhCWmIV.js → cynefin-VYW2F7L2-DWxftYAm.js} +1 -1
- package/web/assets/{cynefinDiagram-TSTJHNR4-Dvqz2594.js → cynefinDiagram-TSTJHNR4-DsmN2V-p.js} +1 -1
- package/web/assets/{dagre-VKFMJZFB-Ju2m2qXt.js → dagre-VKFMJZFB-COEbApyY.js} +1 -1
- package/web/assets/{diagram-FQU43EPY-DsHKTt0k.js → diagram-FQU43EPY-0O9WGWKB.js} +1 -1
- package/web/assets/{diagram-G47NLZAW-DWHAcLkJ.js → diagram-G47NLZAW-CutEdMVh.js} +1 -1
- package/web/assets/{diagram-NH7WQ7WH-uUMz46ZD.js → diagram-NH7WQ7WH-C9KZc3B2.js} +1 -1
- package/web/assets/{diagram-OA4YK3LP-BRjVzjdp.js → diagram-OA4YK3LP-D8kkPXbY.js} +1 -1
- package/web/assets/{diagram-WEI45ONY-Cb-FhBpQ.js → diagram-WEI45ONY-_YqiTaGP.js} +1 -1
- package/web/assets/document-Dgt5eZFj.js +19 -0
- package/web/assets/{ebnfDiagram-CCIWWBDH-IhhxX3IB.js → ebnfDiagram-CCIWWBDH-JO-zQh6g.js} +1 -1
- package/web/assets/{entities-DUnx74kH.js → entities-C3wz7FCx.js} +12 -12
- package/web/assets/{erDiagram-Q63AITRT-D1frgeWf.js → erDiagram-Q63AITRT-9UjQwJ4P.js} +1 -1
- package/web/assets/file-viewer-DZJ8nYnl.js +1 -0
- package/web/assets/{flowDiagram-23GEKE2U-BiPPM-FY.js → flowDiagram-23GEKE2U-Ca08tnYM.js} +5 -5
- package/web/assets/folder-image-BfGgxo7i.js +1 -0
- package/web/assets/folder-landing-qUKBCnG-.js +54 -0
- package/web/assets/folder-list-BfFjv7rR.js +1 -0
- package/web/assets/folder-metadata-DCw8xzHk.js +2 -0
- package/web/assets/folder-mobile-bar-Ubz4babf.js +1 -0
- package/web/assets/folder-plugin-view-DsWR1zmQ.js +6 -0
- package/web/assets/{ganttDiagram-NO4QXBWP-CmEOlHD7.js → ganttDiagram-NO4QXBWP-KnHzX5W3.js} +1 -1
- package/web/assets/{gitGraphDiagram-IHSO6WYX-tTjcpZpU.js → gitGraphDiagram-IHSO6WYX-Cm8woNtK.js} +1 -1
- package/web/assets/index-BaRnbYRw.js +1 -0
- package/web/assets/index-BexmLxIP.css +1 -0
- package/web/assets/index-Bp9DidgD.js +1 -0
- package/web/assets/{index-eL1k96k8.js → index-CCXE8zc9.js} +1 -1
- package/web/assets/index-CNyy98F8.js +2 -0
- package/web/assets/{index-DmrKjrlM.js → index-CXhBn-ar.js} +1 -1
- package/web/assets/index-DDirZMgx.js +1 -0
- package/web/assets/{infoDiagram-FWYZ7A6U-Ok2sdbc1.js → infoDiagram-FWYZ7A6U-yyqmUtIb.js} +1 -1
- package/web/assets/{ishikawaDiagram-FXEZZL3T-kPnM5psX.js → ishikawaDiagram-FXEZZL3T-BfvR_Zy4.js} +4 -4
- package/web/assets/{journeyDiagram-5HDEW3XC-BkoT0-45.js → journeyDiagram-5HDEW3XC-BKuw06HM.js} +1 -1
- package/web/assets/{kanban-definition-HUTT4EX6-xnm_eFoU.js → kanban-definition-HUTT4EX6-n0010rmQ.js} +8 -8
- package/web/assets/{linear-CLZpgLH-.js → linear-C0d0lT8O.js} +1 -1
- package/web/assets/linked-session-header-BkEweU0Z.js +3 -0
- package/web/assets/{markdown-njUwQKsR.js → markdown-Bw9RgUGR.js} +9 -9
- package/web/assets/{mermaid.core-Bvxj3RoN.js → mermaid.core-BDVbShyO.js} +6 -6
- package/web/assets/metadata-KV0dpp4G.js +1 -0
- package/web/assets/{mindmap-definition-LN4V7U3C-42Uoox79.js → mindmap-definition-LN4V7U3C--_0ks3GF.js} +1 -1
- package/web/assets/note-card-DBfX6gW1.js +6 -0
- package/web/assets/{pegDiagram-2B236MQR-B-GZCw3w.js → pegDiagram-2B236MQR-CBoNIpKR.js} +1 -1
- package/web/assets/{pieDiagram-ENE6RG2P-DRmmssIB.js → pieDiagram-ENE6RG2P-MA5tkYh5.js} +3 -3
- package/web/assets/popover-DBD7FF-W.js +9 -0
- package/web/assets/{project-search-dialog-B730oZ1S.js → project-search-dialog-DM1IkSZu.js} +6 -6
- package/web/assets/{quadrantDiagram-ABIIQ3AL-BfhVQ7V9.js → quadrantDiagram-ABIIQ3AL-CWT1ryqF.js} +1 -1
- package/web/assets/{railroadDiagram-RFXS5EU6-DxKx7XRp.js → railroadDiagram-RFXS5EU6-ZiLB5FGi.js} +1 -1
- package/web/assets/{react-DZzLHL-l.js → react-B9jn2M18.js} +2 -2
- package/web/assets/{requirementDiagram-TGXJPOKE-NUzj9fw1.js → requirementDiagram-TGXJPOKE-CQq9uneq.js} +1 -1
- package/web/assets/{sankeyDiagram-HTMAVEWB-Cy9OMnl-.js → sankeyDiagram-HTMAVEWB-qDG-0JqI.js} +1 -1
- package/web/assets/search-DNrQA5fF.js +2 -0
- package/web/assets/select-D8cqNgcp.js +30 -0
- package/web/assets/selection-popup-DmtTeRs2.js +7 -0
- package/web/assets/{sequenceDiagram-DBY2YBRQ-CBNE9mzn.js → sequenceDiagram-DBY2YBRQ-CiApurLO.js} +1 -1
- package/web/assets/{sizeCapture-X5ZJPWSS-S4HhfX0n.js → sizeCapture-X5ZJPWSS-DZSR5QXm.js} +1 -1
- package/web/assets/stateDiagram-2N3HPSRC-CjJJR9_z.js +1 -0
- package/web/assets/stateDiagram-v2-6OUMAXLB-BpeGSCu9.js +1 -0
- package/web/assets/{swimlanes-5IMT3BWC-DJ2aLWal.js → swimlanes-5IMT3BWC-CKmo1sg6.js} +2 -2
- package/web/assets/swimlanesDiagram-G3AALYLV-D9RjLKb9.js +8 -0
- package/web/assets/tanstack-YzX_Mi37.js +3 -0
- package/web/assets/{timeline-definition-FHXFAJF6-vFDUVPCX.js → timeline-definition-FHXFAJF6-D-NMwS3y.js} +1 -1
- package/web/assets/{use-folder-filter-BbTUlXgG.js → use-folder-filter-LQyXns5Q.js} +1 -1
- package/web/assets/{utils-CwHGE3BB.js → utils-DCaHk0Gm.js} +1 -1
- package/web/assets/{vennDiagram-L72KCM5P-AsnhK2zW.js → vennDiagram-L72KCM5P-CfL6LBWw.js} +1 -1
- package/web/assets/view-context-gyDl_p2V.js +229 -0
- package/web/assets/viewer-capabilities-Bpp8Uvcg.js +1 -0
- package/web/assets/{wardleyDiagram-EHGQE667-Cj1wFbNV.js → wardleyDiagram-EHGQE667-DgldMxaj.js} +1 -1
- package/web/assets/{xychartDiagram-FW5EYKEG-Bbvnutsm.js → xychartDiagram-FW5EYKEG-CIoAIFX8.js} +1 -1
- package/web/favicon.svg +6 -0
- package/web/index.html +5 -4
- package/web/assets/app-CPSmsokP.js +0 -2
- package/web/assets/app-options-XEWvevsz.js +0 -25
- package/web/assets/app-view-header-BKZ90ToF.js +0 -1
- package/web/assets/arc-DbpbZvCt.js +0 -1
- package/web/assets/arrow-left-CFeHb-Z1.js +0 -1
- package/web/assets/ask-tray-D2YHtbPj.js +0 -14
- package/web/assets/button-BJ7z-ZA7.js +0 -1
- package/web/assets/calendar-days-DWh2XMO2.js +0 -1
- package/web/assets/channel-dSRp_qTo.js +0 -1
- package/web/assets/chevron-down-C5oRtqbX.js +0 -1
- package/web/assets/chevron-right-CsPtvh8C.js +0 -1
- package/web/assets/chevron-up-DjpU6Pyv.js +0 -1
- package/web/assets/classDiagram-OUVF2IWQ-B7B2zLzM.js +0 -1
- package/web/assets/classDiagram-v2-EOCWNBFH-B7B2zLzM.js +0 -1
- package/web/assets/client-CAudjYV9.js +0 -34
- package/web/assets/client-Dn9-_Gm_.js +0 -14
- package/web/assets/client-Dxrf2tyq.js +0 -102
- package/web/assets/client-aFI2M4pE.js +0 -53
- package/web/assets/collection-icon-TbOVyORG.js +0 -1
- package/web/assets/collection-page-Du6FKkuU.js +0 -10
- package/web/assets/command-C_g5E1Wx.js +0 -38
- package/web/assets/copy-Ikmr6Iq2.js +0 -1
- package/web/assets/copy-context-Cl1TE2PJ.js +0 -1
- package/web/assets/document-DcjNSJCk.js +0 -2
- package/web/assets/external-link-BXmSXqqF.js +0 -1
- package/web/assets/file-renderer-BRZTrYx8.js +0 -19
- package/web/assets/file-text-CiiSsCDq.js +0 -1
- package/web/assets/file-viewer-C1wAeVDK.js +0 -1
- package/web/assets/folder-image-AXBrHUcU.js +0 -1
- package/web/assets/folder-landing-BhRg7hwn.js +0 -54
- package/web/assets/folder-list-rIdszVde.js +0 -1
- package/web/assets/folder-metadata-puTC5QqJ.js +0 -2
- package/web/assets/folder-mobile-bar-DjjRQo3T.js +0 -1
- package/web/assets/folder-plugin-view-BU_kzR8j.js +0 -6
- package/web/assets/index-DS2Wmd9I.css +0 -1
- package/web/assets/index-DgqzSeIR.js +0 -1
- package/web/assets/index-DnlTDqaa.js +0 -1
- package/web/assets/index-DztTMDFz.js +0 -2
- package/web/assets/index-kY75qc96.js +0 -1
- package/web/assets/index-p38i_yyY.js +0 -1
- package/web/assets/link-2-BWKA6t--.js +0 -1
- package/web/assets/link-DC_1Z6Yy.js +0 -11
- package/web/assets/linked-session-header-DJYWZ_-q.js +0 -3
- package/web/assets/mail-2rCdIFul.js +0 -1
- package/web/assets/markdown-title-dncAYYiP.js +0 -131
- package/web/assets/notes-page-DIW6rgJp.js +0 -10
- package/web/assets/pencil-8cobiSSq.js +0 -1
- package/web/assets/plus-BHV2wJr7.js +0 -1
- package/web/assets/popover-Cmmgj-MJ.js +0 -9
- package/web/assets/search-CvlYUkN6.js +0 -2
- package/web/assets/select-1SvaKQsS.js +0 -30
- package/web/assets/selection-popup-ntjycEVh.js +0 -7
- package/web/assets/sparkles-CBhGREdc.js +0 -1
- package/web/assets/stateDiagram-2N3HPSRC-BEw1Mheu.js +0 -1
- package/web/assets/stateDiagram-v2-6OUMAXLB-BHtjl1iD.js +0 -1
- package/web/assets/swimlanesDiagram-G3AALYLV-Z362aroZ.js +0 -8
- package/web/assets/tanstack-CD46mJkU.js +0 -1
- package/web/assets/view-context-D-fh9AbH.js +0 -81
- package/web/assets/viewer-capabilities-CROIaoqh.js +0 -1
- package/web/assets/x-BUeE--I4.js +0 -1
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { createHash } from "node:crypto";
|
|
10
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync, } from "node:fs";
|
|
11
|
+
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
12
|
+
import { homedir, tmpdir } from "node:os";
|
|
13
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, } from "node:path";
|
|
14
|
+
import { pathToFileURL, fileURLToPath } from "node:url";
|
|
15
|
+
import { spawnSync } from "node:child_process";
|
|
16
|
+
const CONFIG_FILE = join("kennel", "config.json");
|
|
17
|
+
const VALID_ID = /^[a-z][a-z0-9-]*$/u;
|
|
18
|
+
const CORE_IDS = new Set(["agents", "calendar", "mail", "notes", "projects", "tasks"]);
|
|
19
|
+
const KENNEL_KERNEL_SCHEMA = 2;
|
|
20
|
+
const BUILD_RUNTIME = `node-${process.versions.node}`;
|
|
21
|
+
const BUILD_IDENTITY = "kennel-external-kernel-v2";
|
|
22
|
+
function xdgConfigHome() {
|
|
23
|
+
return process.env.XDG_CONFIG_HOME?.trim() || join(homedir(), ".config");
|
|
24
|
+
}
|
|
25
|
+
function xdgCacheHome() {
|
|
26
|
+
return process.env.XDG_CACHE_HOME?.trim() || join(homedir(), ".cache");
|
|
27
|
+
}
|
|
28
|
+
export function kennelConfigPath() {
|
|
29
|
+
return join(xdgConfigHome(), CONFIG_FILE);
|
|
30
|
+
}
|
|
31
|
+
function cacheRoot() {
|
|
32
|
+
return join(xdgCacheHome(), "kennel");
|
|
33
|
+
}
|
|
34
|
+
function assertUnderCache(path) {
|
|
35
|
+
const root = resolve(cacheRoot());
|
|
36
|
+
const target = resolve(path);
|
|
37
|
+
const rel = relative(root, target);
|
|
38
|
+
if (target !== root && (rel.startsWith("..") || isAbsolute(rel))) {
|
|
39
|
+
throw new Error(`Refusing to touch path outside Kennel cache: ${path}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function hash(value) {
|
|
43
|
+
return createHash("sha256").update(value).digest("hex").slice(0, 32);
|
|
44
|
+
}
|
|
45
|
+
function run(command, args, options = {}) {
|
|
46
|
+
const result = spawnSync(command, args, {
|
|
47
|
+
cwd: options.cwd,
|
|
48
|
+
env: { ...process.env, ...options.env },
|
|
49
|
+
encoding: "utf8",
|
|
50
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
51
|
+
});
|
|
52
|
+
if (result.error)
|
|
53
|
+
throw new Error(`${command} ${args.join(" ")} failed to start: ${result.error.message}`);
|
|
54
|
+
if (result.status !== 0) {
|
|
55
|
+
const detail = [result.stdout.trim(), result.stderr.trim()].filter(Boolean).join("\n");
|
|
56
|
+
throw new Error(`${command} ${args.join(" ")} failed with exit code ${result.status}${detail ? `\n${detail}` : ""}`);
|
|
57
|
+
}
|
|
58
|
+
return result.stdout.trim();
|
|
59
|
+
}
|
|
60
|
+
function readJson(path) {
|
|
61
|
+
if (!existsSync(path))
|
|
62
|
+
return {};
|
|
63
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
64
|
+
}
|
|
65
|
+
function writeJsonAtomic(path, value) {
|
|
66
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
67
|
+
const temp = join(dirname(path), `.${basename(path)}.${process.pid}.tmp`);
|
|
68
|
+
writeFileSync(temp, `${JSON.stringify(value, null, 2)}\n`);
|
|
69
|
+
renameSync(temp, path);
|
|
70
|
+
}
|
|
71
|
+
function splitRepositoryUrl(input) {
|
|
72
|
+
const index = input.indexOf("#");
|
|
73
|
+
const url = index === -1 ? input : input.slice(0, index);
|
|
74
|
+
const requestedRef = index === -1 ? undefined : input.slice(index + 1);
|
|
75
|
+
if (!url.trim())
|
|
76
|
+
throw new Error("Plugin repository URL is empty");
|
|
77
|
+
if (requestedRef !== undefined && !requestedRef.trim())
|
|
78
|
+
throw new Error("Plugin repository ref is empty");
|
|
79
|
+
return { url, requestedRef };
|
|
80
|
+
}
|
|
81
|
+
function resolveCommit(url, requestedRef) {
|
|
82
|
+
if (!requestedRef) {
|
|
83
|
+
const output = run("git", ["ls-remote", url, "HEAD"]);
|
|
84
|
+
const commit = output.split(/\s+/u)[0] ?? "";
|
|
85
|
+
if (!/^[0-9a-f]{40}$/u.test(commit))
|
|
86
|
+
throw new Error(`Could not resolve HEAD for ${url}`);
|
|
87
|
+
return commit;
|
|
88
|
+
}
|
|
89
|
+
const output = run("git", ["ls-remote", url, requestedRef]);
|
|
90
|
+
const first = output.split("\n").find(Boolean) ?? "";
|
|
91
|
+
const commit = first.split(/\s+/u)[0] ?? "";
|
|
92
|
+
if (!/^[0-9a-f]{40}$/u.test(commit))
|
|
93
|
+
throw new Error(`Could not resolve ref ${requestedRef} for ${url}`);
|
|
94
|
+
return commit;
|
|
95
|
+
}
|
|
96
|
+
function sourceCheckout(url, commit) {
|
|
97
|
+
const dir = join(cacheRoot(), "plugins", "sources", hash(url), "repo");
|
|
98
|
+
assertUnderCache(dir);
|
|
99
|
+
mkdirSync(dirname(dir), { recursive: true });
|
|
100
|
+
if (!existsSync(join(dir, ".git")))
|
|
101
|
+
run("git", ["clone", "--no-checkout", url, dir]);
|
|
102
|
+
run("git", ["fetch", "--force", "origin", commit], { cwd: dir });
|
|
103
|
+
run("git", ["checkout", "--force", commit], { cwd: dir });
|
|
104
|
+
return realpathSync(dir);
|
|
105
|
+
}
|
|
106
|
+
function packageExportPath(exportsValue, key) {
|
|
107
|
+
if (!exportsValue || typeof exportsValue !== "object" || Array.isArray(exportsValue))
|
|
108
|
+
return undefined;
|
|
109
|
+
const value = exportsValue[key];
|
|
110
|
+
if (typeof value === "string")
|
|
111
|
+
return value;
|
|
112
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
113
|
+
const record = value;
|
|
114
|
+
if (typeof record.import === "string")
|
|
115
|
+
return record.import;
|
|
116
|
+
if (typeof record.default === "string")
|
|
117
|
+
return record.default;
|
|
118
|
+
}
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
function safeRelativeFile(root, value, label) {
|
|
122
|
+
if (typeof value !== "string" || !value.trim())
|
|
123
|
+
throw new Error(`Missing ${label}`);
|
|
124
|
+
if (isAbsolute(value) || value.includes("\0"))
|
|
125
|
+
throw new Error(`Unsafe ${label}: ${value}`);
|
|
126
|
+
const target = resolve(root, value);
|
|
127
|
+
const rel = relative(root, target);
|
|
128
|
+
if (rel === "" || rel.startsWith("..") || isAbsolute(rel))
|
|
129
|
+
throw new Error(`Unsafe ${label}: ${value}`);
|
|
130
|
+
if (!existsSync(target) || !statSync(target).isFile())
|
|
131
|
+
throw new Error(`Missing ${label}: ${value}`);
|
|
132
|
+
return target;
|
|
133
|
+
}
|
|
134
|
+
function stringField(value, label) {
|
|
135
|
+
if (typeof value !== "string" || !value.trim())
|
|
136
|
+
throw new Error(`Missing ${label}`);
|
|
137
|
+
return value.trim();
|
|
138
|
+
}
|
|
139
|
+
function kernelSourceRoot() {
|
|
140
|
+
const root = cliRoot();
|
|
141
|
+
const workspace = resolve(root, "..");
|
|
142
|
+
if (existsSync(resolve(workspace, "apps/web/vite.config.ts")))
|
|
143
|
+
return workspace;
|
|
144
|
+
const packaged = resolve(root, "kernel");
|
|
145
|
+
if (existsSync(resolve(packaged, "apps/web/vite.config.ts")))
|
|
146
|
+
return packaged;
|
|
147
|
+
throw new Error("Kennel kernel source is missing from this CLI package");
|
|
148
|
+
}
|
|
149
|
+
function internalSourceAliases(root = kernelSourceRoot()) {
|
|
150
|
+
const aliases = {};
|
|
151
|
+
for (const [name, path] of Object.entries({
|
|
152
|
+
"@raggle-ai/agents": "packages/agents/src",
|
|
153
|
+
"@raggle-ai/calendar": "plugins/calendar/src",
|
|
154
|
+
"@raggle-ai/folder-plugin": "packages/folder-plugin/src",
|
|
155
|
+
"@raggle-ai/kennel-api": "packages/api/src",
|
|
156
|
+
"@raggle-ai/mail": "plugins/mail/src",
|
|
157
|
+
"@raggle-ai/markdown": "packages/markdown/src",
|
|
158
|
+
"@raggle-ai/notes": "packages/notes/src",
|
|
159
|
+
"@raggle-ai/projects": "plugins/projects/src",
|
|
160
|
+
"@raggle-ai/schemas": "packages/schemas/src",
|
|
161
|
+
"@raggle-ai/session-finding": "packages/session-finding/src",
|
|
162
|
+
"@raggle-ai/tasks": "plugins/tasks/src",
|
|
163
|
+
"@raggle-ai/ui": "packages/ui/src",
|
|
164
|
+
"kennel-client": "packages/api-client/src",
|
|
165
|
+
})) {
|
|
166
|
+
const target = resolve(root, path);
|
|
167
|
+
if (existsSync(target))
|
|
168
|
+
aliases[name] = target;
|
|
169
|
+
}
|
|
170
|
+
return aliases;
|
|
171
|
+
}
|
|
172
|
+
function resolveAliasPath(target, suffix) {
|
|
173
|
+
if (!suffix)
|
|
174
|
+
return resolve(target, "index.ts");
|
|
175
|
+
const clean = suffix.replace(/^\//u, "");
|
|
176
|
+
for (const candidate of [
|
|
177
|
+
resolve(target, `${clean}.ts`),
|
|
178
|
+
resolve(target, `${clean}.tsx`),
|
|
179
|
+
resolve(target, `${clean}.js`),
|
|
180
|
+
resolve(target, clean, "index.ts"),
|
|
181
|
+
resolve(target, clean, "index.tsx"),
|
|
182
|
+
resolve(target, clean),
|
|
183
|
+
]) {
|
|
184
|
+
if (existsSync(candidate))
|
|
185
|
+
return candidate;
|
|
186
|
+
}
|
|
187
|
+
return resolve(target, clean);
|
|
188
|
+
}
|
|
189
|
+
function esbuildAliasPlugin(root = kernelSourceRoot()) {
|
|
190
|
+
const sourceAliases = internalSourceAliases(root);
|
|
191
|
+
const hostPackages = ["@raggle-ai/barkdown", "@raggle-ai/scout-ui", "@tanstack/react-query", "@tanstack/react-router", "lucide-react", "react", "react-dom", "react/jsx-runtime", "yaml", "lexical"];
|
|
192
|
+
return {
|
|
193
|
+
name: "kennel-host-resolution",
|
|
194
|
+
setup(build) {
|
|
195
|
+
build.onResolve({ filter: /.*/ }, (args) => {
|
|
196
|
+
if (args.path.startsWith("node:"))
|
|
197
|
+
return undefined;
|
|
198
|
+
for (const [name, target] of Object.entries(sourceAliases)) {
|
|
199
|
+
if (args.path === name || args.path.startsWith(`${name}/`)) {
|
|
200
|
+
return { path: resolveAliasPath(target, args.path.slice(name.length)) };
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (hostPackages.some((name) => args.path === name || args.path.startsWith(`${name}/`))) {
|
|
204
|
+
return { path: fileURLToPath(import.meta.resolve(args.path)) };
|
|
205
|
+
}
|
|
206
|
+
return undefined;
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
async function bundleForImport(entry, outfile, platform) {
|
|
212
|
+
const esbuild = await import("esbuild");
|
|
213
|
+
await esbuild.build({
|
|
214
|
+
absWorkingDir: kernelSourceRoot(),
|
|
215
|
+
banner: platform === "node"
|
|
216
|
+
? { js: 'import { createRequire as __kennelCreateRequire } from "node:module"; const require = __kennelCreateRequire(import.meta.url);' }
|
|
217
|
+
: undefined,
|
|
218
|
+
bundle: true,
|
|
219
|
+
entryPoints: [entry],
|
|
220
|
+
external: ["bun:ffi", "koffi"],
|
|
221
|
+
format: "esm",
|
|
222
|
+
jsx: "automatic",
|
|
223
|
+
outfile,
|
|
224
|
+
platform,
|
|
225
|
+
plugins: [esbuildAliasPlugin()],
|
|
226
|
+
sourcemap: false,
|
|
227
|
+
target: platform === "node" ? "node20" : "es2022",
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function assertManifest(value, id, label) {
|
|
231
|
+
if (!value || typeof value !== "object")
|
|
232
|
+
throw new Error(`${label} is not an object`);
|
|
233
|
+
if (value.id !== id)
|
|
234
|
+
throw new Error(`${label} id mismatch`);
|
|
235
|
+
if (typeof value.label !== "string" || !value.label.trim())
|
|
236
|
+
throw new Error(`${label} missing label`);
|
|
237
|
+
}
|
|
238
|
+
async function validateImports(entry) {
|
|
239
|
+
const dir = await mkdtemp(join(tmpdir(), "kennel-plugin-validate-"));
|
|
240
|
+
try {
|
|
241
|
+
const manifestOut = join(dir, "manifest.mjs");
|
|
242
|
+
const serverOut = join(dir, "server.mjs");
|
|
243
|
+
const clientOut = join(dir, "client.mjs");
|
|
244
|
+
await bundleForImport(entry.entries.manifest, manifestOut, "browser");
|
|
245
|
+
await bundleForImport(entry.entries.server, serverOut, "node");
|
|
246
|
+
await bundleForImport(entry.entries.client, clientOut, "node");
|
|
247
|
+
const manifestModule = await import(__rewriteRelativeImportExtension(pathToFileURL(manifestOut).href));
|
|
248
|
+
const serverModule = await import(__rewriteRelativeImportExtension(pathToFileURL(serverOut).href));
|
|
249
|
+
const clientModule = await import(__rewriteRelativeImportExtension(pathToFileURL(clientOut).href));
|
|
250
|
+
const manifest = manifestModule[entry.entries.manifestSymbol];
|
|
251
|
+
const serverExport = serverModule[entry.entries.serverSymbol];
|
|
252
|
+
const server = typeof serverExport === "function" ? serverExport({}) : serverExport;
|
|
253
|
+
const client = clientModule[entry.entries.clientSymbol];
|
|
254
|
+
assertManifest(manifest, entry.id, "manifest export");
|
|
255
|
+
if (!server || typeof server !== "object" || server.id !== entry.id)
|
|
256
|
+
throw new Error("server id mismatch");
|
|
257
|
+
if (typeof server.detect !== "function" || typeof server.handle !== "function")
|
|
258
|
+
throw new Error("server export missing detect/handle");
|
|
259
|
+
if (!client || typeof client !== "object" || client.id !== entry.id)
|
|
260
|
+
throw new Error("client id mismatch");
|
|
261
|
+
if (typeof client.component !== "function")
|
|
262
|
+
throw new Error("client export missing component");
|
|
263
|
+
}
|
|
264
|
+
finally {
|
|
265
|
+
await rm(dir, { force: true, recursive: true });
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
export async function validateExternalPlugin(inputUrl, existing = []) {
|
|
269
|
+
const { url, requestedRef } = splitRepositoryUrl(inputUrl);
|
|
270
|
+
const commit = resolveCommit(url, requestedRef);
|
|
271
|
+
const root = sourceCheckout(url, commit);
|
|
272
|
+
const pkgPath = join(root, "package.json");
|
|
273
|
+
if (!existsSync(pkgPath))
|
|
274
|
+
throw new Error("Plugin repository has no package.json at its root");
|
|
275
|
+
const pkg = JSON.parse(await readFile(pkgPath, "utf8"));
|
|
276
|
+
const packageName = stringField(pkg.name, "package name");
|
|
277
|
+
const metadata = pkg.kennel?.plugin;
|
|
278
|
+
if (!metadata || typeof metadata !== "object")
|
|
279
|
+
throw new Error("package.json must define kennel.plugin metadata");
|
|
280
|
+
if (!metadata.exports || typeof metadata.exports !== "object")
|
|
281
|
+
throw new Error("kennel.plugin.exports is required");
|
|
282
|
+
const id = stringField(metadata.id, "plugin id");
|
|
283
|
+
if (!VALID_ID.test(id))
|
|
284
|
+
throw new Error(`Invalid plugin id: ${id}`);
|
|
285
|
+
if (CORE_IDS.has(id))
|
|
286
|
+
throw new Error(`External plugin id collides with core plugin: ${id}`);
|
|
287
|
+
if (existing.some((plugin) => plugin.id === id))
|
|
288
|
+
throw new Error(`External plugin id is already installed: ${id}`);
|
|
289
|
+
const trigger = stringField(metadata.trigger, "trigger file");
|
|
290
|
+
if (trigger.includes("/") || trigger.includes("\\") || trigger === "." || trigger === "..")
|
|
291
|
+
throw new Error(`Invalid trigger file: ${trigger}`);
|
|
292
|
+
const exportsValue = pkg.exports;
|
|
293
|
+
const client = safeRelativeFile(root, packageExportPath(exportsValue, "./client"), "./client package export");
|
|
294
|
+
const server = safeRelativeFile(root, packageExportPath(exportsValue, "./server"), "./server package export");
|
|
295
|
+
const manifest = safeRelativeFile(root, packageExportPath(exportsValue, "./manifest"), "./manifest package export");
|
|
296
|
+
const cssValue = metadata.exports.css;
|
|
297
|
+
const css = cssValue === undefined ? undefined : safeRelativeFile(root, cssValue, "css export path");
|
|
298
|
+
const entry = {
|
|
299
|
+
url,
|
|
300
|
+
...(requestedRef ? { requestedRef } : {}),
|
|
301
|
+
commit,
|
|
302
|
+
packageName,
|
|
303
|
+
id,
|
|
304
|
+
trigger,
|
|
305
|
+
entries: {
|
|
306
|
+
client,
|
|
307
|
+
clientSymbol: stringField(metadata.exports.clientSymbol, "client export symbol"),
|
|
308
|
+
server,
|
|
309
|
+
serverSymbol: stringField(metadata.exports.serverSymbol, "server export symbol"),
|
|
310
|
+
manifest,
|
|
311
|
+
manifestSymbol: stringField(metadata.exports.manifestSymbol, "manifest export symbol"),
|
|
312
|
+
...(css ? { css } : {}),
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
await validateImports(entry);
|
|
316
|
+
return entry;
|
|
317
|
+
}
|
|
318
|
+
export function readExternalPlugins() {
|
|
319
|
+
const config = readJson(kennelConfigPath());
|
|
320
|
+
return Array.isArray(config.externalPlugins) ? config.externalPlugins : [];
|
|
321
|
+
}
|
|
322
|
+
export async function installExternalPlugin(url) {
|
|
323
|
+
const path = kennelConfigPath();
|
|
324
|
+
const config = readJson(path);
|
|
325
|
+
const externalPlugins = Array.isArray(config.externalPlugins) ? config.externalPlugins : [];
|
|
326
|
+
let entry;
|
|
327
|
+
try {
|
|
328
|
+
entry = await validateExternalPlugin(url, externalPlugins);
|
|
329
|
+
const nextPlugins = [...externalPlugins, entry];
|
|
330
|
+
await ensureKernel(nextPlugins);
|
|
331
|
+
writeJsonAtomic(path, { ...config, externalPlugins: nextPlugins });
|
|
332
|
+
}
|
|
333
|
+
catch (error) {
|
|
334
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
335
|
+
throw new Error(`Failed to install external plugin from ${url}: ${message}`);
|
|
336
|
+
}
|
|
337
|
+
return entry;
|
|
338
|
+
}
|
|
339
|
+
function cliRoot() {
|
|
340
|
+
return resolve(dirname(fileURLToPath(import.meta.url)), "../..");
|
|
341
|
+
}
|
|
342
|
+
export function kernelKey(plugins = readExternalPlugins()) {
|
|
343
|
+
return hash(JSON.stringify({
|
|
344
|
+
buildIdentity: BUILD_IDENTITY,
|
|
345
|
+
schema: KENNEL_KERNEL_SCHEMA,
|
|
346
|
+
runtime: BUILD_RUNTIME,
|
|
347
|
+
plugins: plugins.map((plugin) => ({
|
|
348
|
+
url: plugin.url,
|
|
349
|
+
requestedRef: plugin.requestedRef ?? null,
|
|
350
|
+
packageName: plugin.packageName,
|
|
351
|
+
id: plugin.id,
|
|
352
|
+
commit: plugin.commit,
|
|
353
|
+
trigger: plugin.trigger,
|
|
354
|
+
entries: plugin.entries,
|
|
355
|
+
})),
|
|
356
|
+
}));
|
|
357
|
+
}
|
|
358
|
+
function kernelRoot(key) {
|
|
359
|
+
return join(cacheRoot(), "kernels", key);
|
|
360
|
+
}
|
|
361
|
+
async function readKernelMarker(marker, key) {
|
|
362
|
+
if (!existsSync(marker))
|
|
363
|
+
return undefined;
|
|
364
|
+
try {
|
|
365
|
+
const kernel = JSON.parse(await readFile(marker, "utf8"));
|
|
366
|
+
if (kernel.buildIdentity !== BUILD_IDENTITY ||
|
|
367
|
+
kernel.schema !== KENNEL_KERNEL_SCHEMA ||
|
|
368
|
+
kernel.runtime !== BUILD_RUNTIME ||
|
|
369
|
+
kernel.key !== key ||
|
|
370
|
+
!existsSync(resolve(kernel.webRoot, "index.html")) ||
|
|
371
|
+
!Array.isArray(kernel.serverEntries) ||
|
|
372
|
+
kernel.serverEntries.some((entry) => !entry.id || !entry.module || !entry.symbol || !existsSync(entry.module)))
|
|
373
|
+
return undefined;
|
|
374
|
+
return kernel;
|
|
375
|
+
}
|
|
376
|
+
catch {
|
|
377
|
+
return undefined;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function acquireKernelLock(key) {
|
|
381
|
+
const locks = join(cacheRoot(), "kernels", ".locks");
|
|
382
|
+
mkdirSync(locks, { recursive: true });
|
|
383
|
+
const lock = join(locks, key);
|
|
384
|
+
assertUnderCache(lock);
|
|
385
|
+
for (let attempt = 0; attempt < 200; attempt += 1) {
|
|
386
|
+
try {
|
|
387
|
+
mkdirSync(lock);
|
|
388
|
+
return () => rmSync(lock, { force: true, recursive: true });
|
|
389
|
+
}
|
|
390
|
+
catch (error) {
|
|
391
|
+
if (error?.code !== "EEXIST")
|
|
392
|
+
throw error;
|
|
393
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 100);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
throw new Error(`Timed out waiting for kernel build lock ${key}`);
|
|
397
|
+
}
|
|
398
|
+
function moveIncompleteAside(target) {
|
|
399
|
+
if (!existsSync(target))
|
|
400
|
+
return;
|
|
401
|
+
assertUnderCache(target);
|
|
402
|
+
const broken = `${target}.incomplete-${process.pid}-${Date.now()}`;
|
|
403
|
+
assertUnderCache(broken);
|
|
404
|
+
renameSync(target, broken);
|
|
405
|
+
rmSync(broken, { force: true, recursive: true });
|
|
406
|
+
}
|
|
407
|
+
async function buildKernelTemp(temp, target, key, plugins) {
|
|
408
|
+
const sourceRoot = kernelSourceRoot();
|
|
409
|
+
const clientModule = join(temp, "external-plugins.tsx");
|
|
410
|
+
const serverDir = join(temp, "server");
|
|
411
|
+
mkdirSync(serverDir, { recursive: true });
|
|
412
|
+
const cssImports = plugins.map((plugin) => plugin.entries.css ? `import ${JSON.stringify(plugin.entries.css)};` : "").filter(Boolean).join("\n");
|
|
413
|
+
const clientImports = plugins.map((plugin, index) => `import { ${plugin.entries.manifestSymbol} as manifest${index} } from ${JSON.stringify(plugin.entries.manifest)};`).join("\n");
|
|
414
|
+
const clientItems = plugins.map((plugin, index) => ` { ...manifest${index}, component: lazy(async () => ({ default: (await import(${JSON.stringify(plugin.entries.client)}))[${JSON.stringify(plugin.entries.clientSymbol)}].component })) }`).join(",\n");
|
|
415
|
+
await writeFile(clientModule, `import { lazy } from "react";\nimport type { FolderPluginClient } from "@raggle-ai/folder-plugin/client";\n${cssImports}\n${clientImports}\nexport const externalFolderPlugins: FolderPluginClient[] = [\n${clientItems}\n];\n`);
|
|
416
|
+
const serverEntries = [];
|
|
417
|
+
for (const plugin of plugins) {
|
|
418
|
+
const outfile = join(serverDir, `${plugin.id}.js`);
|
|
419
|
+
await bundleForImport(plugin.entries.server, outfile, "node");
|
|
420
|
+
serverEntries.push({ id: plugin.id, module: join(target, "server", `${plugin.id}.js`), symbol: plugin.entries.serverSymbol, trigger: plugin.trigger });
|
|
421
|
+
}
|
|
422
|
+
const vite = await import("vite");
|
|
423
|
+
const previousClientModule = process.env.KENNEL_EXTERNAL_CLIENT_MODULE;
|
|
424
|
+
const previousSourceRoot = process.env.KENNEL_KERNEL_SOURCE_ROOT;
|
|
425
|
+
process.env.KENNEL_EXTERNAL_CLIENT_MODULE = clientModule;
|
|
426
|
+
process.env.KENNEL_KERNEL_SOURCE_ROOT = sourceRoot;
|
|
427
|
+
try {
|
|
428
|
+
await vite.build({
|
|
429
|
+
configFile: resolve(sourceRoot, "apps/web/vite.config.ts"),
|
|
430
|
+
root: resolve(sourceRoot, "apps/web"),
|
|
431
|
+
build: { outDir: join(temp, "web"), emptyOutDir: true },
|
|
432
|
+
envFile: false,
|
|
433
|
+
mode: "production",
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
finally {
|
|
437
|
+
if (previousClientModule === undefined)
|
|
438
|
+
delete process.env.KENNEL_EXTERNAL_CLIENT_MODULE;
|
|
439
|
+
else
|
|
440
|
+
process.env.KENNEL_EXTERNAL_CLIENT_MODULE = previousClientModule;
|
|
441
|
+
if (previousSourceRoot === undefined)
|
|
442
|
+
delete process.env.KENNEL_KERNEL_SOURCE_ROOT;
|
|
443
|
+
else
|
|
444
|
+
process.env.KENNEL_KERNEL_SOURCE_ROOT = previousSourceRoot;
|
|
445
|
+
}
|
|
446
|
+
const kernel = {
|
|
447
|
+
buildIdentity: BUILD_IDENTITY,
|
|
448
|
+
schema: KENNEL_KERNEL_SCHEMA,
|
|
449
|
+
runtime: BUILD_RUNTIME,
|
|
450
|
+
key,
|
|
451
|
+
webRoot: join(target, "web"),
|
|
452
|
+
serverEntries,
|
|
453
|
+
};
|
|
454
|
+
await writeFile(join(temp, "kernel.json"), JSON.stringify(kernel, null, 2));
|
|
455
|
+
return kernel;
|
|
456
|
+
}
|
|
457
|
+
export async function ensureKernel(plugins = readExternalPlugins()) {
|
|
458
|
+
if (plugins.length === 0) {
|
|
459
|
+
const webRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../../web");
|
|
460
|
+
return { buildIdentity: BUILD_IDENTITY, schema: KENNEL_KERNEL_SCHEMA, runtime: BUILD_RUNTIME, key: "core", webRoot, serverEntries: [] };
|
|
461
|
+
}
|
|
462
|
+
const key = kernelKey(plugins);
|
|
463
|
+
const target = kernelRoot(key);
|
|
464
|
+
assertUnderCache(target);
|
|
465
|
+
const marker = join(target, "kernel.json");
|
|
466
|
+
const cached = await readKernelMarker(marker, key);
|
|
467
|
+
if (cached)
|
|
468
|
+
return cached;
|
|
469
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
470
|
+
const release = acquireKernelLock(key);
|
|
471
|
+
try {
|
|
472
|
+
const afterLock = await readKernelMarker(marker, key);
|
|
473
|
+
if (afterLock)
|
|
474
|
+
return afterLock;
|
|
475
|
+
if (existsSync(target))
|
|
476
|
+
moveIncompleteAside(target);
|
|
477
|
+
const temp = `${target}.tmp-${process.pid}-${Date.now()}`;
|
|
478
|
+
assertUnderCache(temp);
|
|
479
|
+
rmSync(temp, { force: true, recursive: true });
|
|
480
|
+
mkdirSync(temp, { recursive: true });
|
|
481
|
+
try {
|
|
482
|
+
const kernel = await buildKernelTemp(temp, target, key, plugins);
|
|
483
|
+
if (existsSync(target)) {
|
|
484
|
+
const completed = await readKernelMarker(marker, key);
|
|
485
|
+
if (completed) {
|
|
486
|
+
rmSync(temp, { force: true, recursive: true });
|
|
487
|
+
return completed;
|
|
488
|
+
}
|
|
489
|
+
moveIncompleteAside(target);
|
|
490
|
+
}
|
|
491
|
+
renameSync(temp, target);
|
|
492
|
+
return kernel;
|
|
493
|
+
}
|
|
494
|
+
catch (error) {
|
|
495
|
+
rmSync(temp, { force: true, recursive: true });
|
|
496
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
497
|
+
throw new Error(`Failed to build kernel ${key}: ${message}`);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
finally {
|
|
501
|
+
release();
|
|
502
|
+
}
|
|
503
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const CLOUDFLARE_WORKER_MAIN = ".kennel/generated/cloudflare/email-code-worker.js";
|
|
2
|
+
export declare const CLOUDFLARE_WRANGLER_CONFIG = ".kennel/generated/cloudflare/wrangler.jsonc";
|
|
3
|
+
export declare const LEGACY_CLOUDFLARE_WRANGLER_CONFIG = "wrangler.worker.jsonc";
|
|
4
|
+
export type CloudflareSetup = {
|
|
5
|
+
root: string;
|
|
6
|
+
configPath: string;
|
|
7
|
+
config: any;
|
|
8
|
+
wranglerPath: string;
|
|
9
|
+
hostname: string;
|
|
10
|
+
hostnames: string[];
|
|
11
|
+
};
|
|
12
|
+
export declare function publishInitCloudflare(input: string[]): CloudflareSetup;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, relative } from 'node:path';
|
|
3
|
+
import { readJson, readJsonc, writeJson } from '../shared/json.js';
|
|
4
|
+
import { isObject } from '../shared/object.js';
|
|
5
|
+
import { displayPath } from '../shared/path.js';
|
|
6
|
+
import { projectConfigPath } from '../shared/project-config.js';
|
|
7
|
+
import { displayBasePath, rendererDeploymentDescriptor } from '../site/renderers.js';
|
|
8
|
+
import { publishAccountId, publishAuthDefaults, publishAuthWithWranglerFallbacks, publicationAdminMcp, publishHostname, publishHostnames, publishWorkerName, publicationConfig, publicationDomains, } from './config.js';
|
|
9
|
+
import { splitPublishArgs } from './options.js';
|
|
10
|
+
export const CLOUDFLARE_WORKER_MAIN = '.kennel/generated/cloudflare/email-code-worker.js';
|
|
11
|
+
export const CLOUDFLARE_WRANGLER_CONFIG = '.kennel/generated/cloudflare/wrangler.jsonc';
|
|
12
|
+
export const LEGACY_CLOUDFLARE_WRANGLER_CONFIG = 'wrangler.worker.jsonc';
|
|
13
|
+
function workerTemplate() {
|
|
14
|
+
return readFileSync(new URL('../../templates/cloudflare/email-code-worker.js', import.meta.url), 'utf8');
|
|
15
|
+
}
|
|
16
|
+
function readCloudflareWranglerConfig(root) {
|
|
17
|
+
for (const name of [CLOUDFLARE_WRANGLER_CONFIG, LEGACY_CLOUDFLARE_WRANGLER_CONFIG]) {
|
|
18
|
+
const filePath = join(root, name);
|
|
19
|
+
if (existsSync(filePath))
|
|
20
|
+
return readJsonc(filePath);
|
|
21
|
+
}
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
export function publishInitCloudflare(input) {
|
|
25
|
+
const options = splitPublishArgs(input);
|
|
26
|
+
const configPath = projectConfigPath(options.targetPath, options.configFile);
|
|
27
|
+
const root = dirname(configPath);
|
|
28
|
+
const config = readJson(configPath);
|
|
29
|
+
const packagePath = join(root, 'package.json');
|
|
30
|
+
const pkg = existsSync(packagePath) ? readJson(packagePath) : undefined;
|
|
31
|
+
const deployment = rendererDeploymentDescriptor(root, pkg);
|
|
32
|
+
const publication = publicationConfig(config);
|
|
33
|
+
const adminMcp = publicationAdminMcp(config);
|
|
34
|
+
const domains = publicationDomains(config);
|
|
35
|
+
const wranglerPath = join(root, CLOUDFLARE_WRANGLER_CONFIG);
|
|
36
|
+
const wrangler = readCloudflareWranglerConfig(root);
|
|
37
|
+
const vars = isObject(wrangler.vars) ? wrangler.vars : {};
|
|
38
|
+
const auth = publishAuthWithWranglerFallbacks(publishAuthDefaults(config), vars);
|
|
39
|
+
const workerName = publishWorkerName(config, root);
|
|
40
|
+
const hostname = publishHostname(config, options);
|
|
41
|
+
const hostnames = publishHostnames(config, options);
|
|
42
|
+
config.publication = {
|
|
43
|
+
...publication,
|
|
44
|
+
provider: 'cloudflare-workers',
|
|
45
|
+
workerName,
|
|
46
|
+
domains: {
|
|
47
|
+
...domains,
|
|
48
|
+
...(hostname ? { primary: hostname } : {}),
|
|
49
|
+
...(hostnames.length > 1 ? { aliases: hostnames.slice(1) } : {}),
|
|
50
|
+
},
|
|
51
|
+
access: auth,
|
|
52
|
+
};
|
|
53
|
+
delete config.publish;
|
|
54
|
+
writeJson(configPath, config);
|
|
55
|
+
const workerPath = join(root, CLOUDFLARE_WORKER_MAIN);
|
|
56
|
+
mkdirSync(dirname(workerPath), { recursive: true });
|
|
57
|
+
writeFileSync(workerPath, workerTemplate());
|
|
58
|
+
wrangler.name = workerName;
|
|
59
|
+
const accountId = publishAccountId(config);
|
|
60
|
+
if (accountId)
|
|
61
|
+
wrangler.account_id = accountId;
|
|
62
|
+
if (typeof wrangler.account_id !== 'string' && typeof process.env.CLOUDFLARE_ACCOUNT_ID === 'string') {
|
|
63
|
+
wrangler.account_id = process.env.CLOUDFLARE_ACCOUNT_ID;
|
|
64
|
+
}
|
|
65
|
+
wrangler.main = relative(dirname(wranglerPath), workerPath);
|
|
66
|
+
wrangler.compatibility_date = wrangler.compatibility_date ?? new Date().toISOString().slice(0, 10);
|
|
67
|
+
wrangler.assets = {
|
|
68
|
+
binding: 'ASSETS',
|
|
69
|
+
directory: relative(dirname(wranglerPath), join(root, deployment.outputDirectory)),
|
|
70
|
+
run_worker_first: true,
|
|
71
|
+
};
|
|
72
|
+
if (hostnames.length > 0) {
|
|
73
|
+
wrangler.routes = hostnames.map((pattern) => ({ pattern, custom_domain: true }));
|
|
74
|
+
}
|
|
75
|
+
if (auth.mode === 'email-code-worker') {
|
|
76
|
+
wrangler.send_email = [{ name: 'EMAIL', remote: true }];
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
delete wrangler.send_email;
|
|
80
|
+
}
|
|
81
|
+
wrangler.vars = {
|
|
82
|
+
...vars,
|
|
83
|
+
...(auth.allowedDomains.length > 0 ? { KENNEL_AUTH_ALLOWED_DOMAINS: auth.allowedDomains.join(',') } : {}),
|
|
84
|
+
...(auth.allowedEmails.length > 0 ? { KENNEL_AUTH_ALLOWED_EMAILS: auth.allowedEmails.join(',') } : {}),
|
|
85
|
+
...(auth.fromEmail ? { KENNEL_AUTH_FROM_EMAIL: auth.fromEmail } : {}),
|
|
86
|
+
...(auth.emailSubject ? { KENNEL_AUTH_EMAIL_SUBJECT: auth.emailSubject } : {}),
|
|
87
|
+
...(typeof adminMcp.hostname === 'string' && adminMcp.hostname.trim() ? { KENNEL_ADMIN_MCP_HOSTNAMES: adminMcp.hostname.trim() } : {}),
|
|
88
|
+
...(typeof adminMcp.role === 'string' && adminMcp.role.trim() ? { KENNEL_ADMIN_MCP_ROLE: adminMcp.role.trim() } : {}),
|
|
89
|
+
...(typeof adminMcp.upstream === 'string' && adminMcp.upstream.trim() ? { KENNEL_ADMIN_MCP_UPSTREAM: adminMcp.upstream.trim() } : {}),
|
|
90
|
+
...(typeof config.base === 'string' && config.base.trim() ? { KENNEL_SITE_BASE: displayBasePath(config) } : {}),
|
|
91
|
+
};
|
|
92
|
+
mkdirSync(dirname(wranglerPath), { recursive: true });
|
|
93
|
+
writeJson(wranglerPath, wrangler);
|
|
94
|
+
console.log(`ok ${displayPath(configPath)}`);
|
|
95
|
+
console.log(`ok ${displayPath(workerPath)}`);
|
|
96
|
+
console.log(`ok ${displayPath(wranglerPath)}`);
|
|
97
|
+
console.log('required secret: KENNEL_AUTH_SECRET');
|
|
98
|
+
if (!hostname)
|
|
99
|
+
console.log('optional: set publication.domains.primary or pass --hostname to attach a custom domain');
|
|
100
|
+
return { root, configPath, config, wranglerPath, hostname: hostnames[0] ?? hostname, hostnames };
|
|
101
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ChildCommand } from '../shared/process.js';
|
|
2
|
+
import { type PackageJson } from '../site/renderers.js';
|
|
3
|
+
import type { PublishOptions } from './options.js';
|
|
4
|
+
export type DopplerTokenCommand = {
|
|
5
|
+
command: string;
|
|
6
|
+
args: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function publicationConfig(config: any): Record<string, any>;
|
|
9
|
+
export declare function publicationDomains(config: any): Record<string, any>;
|
|
10
|
+
export declare function publicationAccess(config: any): Record<string, any>;
|
|
11
|
+
export declare function publicationAdminMcp(config: any): Record<string, any>;
|
|
12
|
+
export declare function publishAuthDefaults(config: any): any;
|
|
13
|
+
export declare function splitCsv(value: unknown): string[];
|
|
14
|
+
export declare function publishAuthWithWranglerFallbacks(auth: any, vars: Record<string, unknown>): any;
|
|
15
|
+
export declare function publishHostname(config: any, options: Pick<PublishOptions, 'hostname'>): string;
|
|
16
|
+
export declare function publishHostnames(config: any, options: Pick<PublishOptions, 'hostname'>): string[];
|
|
17
|
+
export declare function publishProjectName(config: any, root: string): string;
|
|
18
|
+
export declare function publishWorkerName(config: any, root: string): string;
|
|
19
|
+
export declare function publishCloudflareConfig(config: any): Record<string, any>;
|
|
20
|
+
export declare function publishAccountId(config: any): string;
|
|
21
|
+
export declare function publishDopplerTokenConfig(config: any): Record<string, any>;
|
|
22
|
+
export declare function hasDopplerTokenConfig(config: any): boolean;
|
|
23
|
+
export declare function dopplerTokenCommand(config: any): DopplerTokenCommand | null;
|
|
24
|
+
export declare function publishBuildCommand(root: string, pkg: PackageJson): ChildCommand;
|
|
25
|
+
export declare function publishWranglerCommand(root: string): string;
|
|
26
|
+
export declare function publishWranglerArgs(root: string, args: string[]): string[];
|
|
27
|
+
export declare function publishTestUrl(hostname: string): string;
|
|
28
|
+
export declare function packageJsonPath(root: string): string;
|