@patodo/localapp 0.1.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/.localapp-artifact.json +2731 -0
- package/LICENSE +21 -0
- package/README.md +288 -0
- package/bin/localapp.mjs +34182 -0
- package/package.json +21 -0
- package/runtime/bootstrap/localapp-daemon-bootstrap.mjs +150 -0
- package/runtime/native/adapter-manifest.json +85 -0
- package/runtime/native/darwin-arm64/LocalAppBridge.app/Contents/Info.plist +21 -0
- package/runtime/native/darwin-arm64/LocalAppBridge.app/Contents/MacOS/LocalAppBridge +0 -0
- package/runtime/native/darwin-arm64/LocalAppBridge.app/Contents/Resources/localapp-native-ipc-client.mjs +940 -0
- package/runtime/native/darwin-arm64/LocalAppBridge.app/Contents/_CodeSignature/CodeResources +128 -0
- package/runtime/native/darwin-x64/LocalAppBridge.app/Contents/Info.plist +21 -0
- package/runtime/native/darwin-x64/LocalAppBridge.app/Contents/MacOS/LocalAppBridge +0 -0
- package/runtime/native/darwin-x64/LocalAppBridge.app/Contents/Resources/localapp-native-ipc-client.mjs +940 -0
- package/runtime/native/darwin-x64/LocalAppBridge.app/Contents/_CodeSignature/CodeResources +128 -0
- package/runtime/native/linux-x64/localapp-native-ipc-client.mjs +940 -0
- package/runtime/native/linux-x64/localapp-notifications +0 -0
- package/runtime/native/win32-x64/localapp-native-ipc-client.mjs +940 -0
- package/runtime/native/win32-x64/localapp-native.exe +0 -0
- package/runtime/server/.localapp-server-runtime.json +133 -0
- package/runtime/server/bin/server-cli.cjs +8343 -0
- package/runtime/server/bin/server.mjs +8 -0
- package/runtime/server/bin/worker.cjs +144339 -0
- package/runtime/server/node_modules/sql.js/dist/sql-wasm.js +185 -0
- package/runtime/server/node_modules/sql.js/dist/sql-wasm.wasm +0 -0
- package/runtime/server/node_modules/sql.js/package.json +58 -0
- package/runtime/server/package.json +11 -0
- package/runtime/server/runner/localapp-runner.mjs +324 -0
- package/runtime/server/web/404.html +1 -0
- package/runtime/server/web/_next/static/CqtRUQyhpQ2FmEc3vaVz3/_buildManifest.js +1 -0
- package/runtime/server/web/_next/static/CqtRUQyhpQ2FmEc3vaVz3/_ssgManifest.js +1 -0
- package/runtime/server/web/_next/static/chunks/184-184da63eba05808f.js +1 -0
- package/runtime/server/web/_next/static/chunks/265-a58973dbf631dc41.js +1 -0
- package/runtime/server/web/_next/static/chunks/308-d74213c6f5179bf0.js +1 -0
- package/runtime/server/web/_next/static/chunks/416-53d48ad9442eb7b2.js +1 -0
- package/runtime/server/web/_next/static/chunks/448-280e06e915001cb5.js +1 -0
- package/runtime/server/web/_next/static/chunks/66-6f6658280a10fbca.js +1 -0
- package/runtime/server/web/_next/static/chunks/740d80ee-6c0a9504f1fd46f8.js +1 -0
- package/runtime/server/web/_next/static/chunks/86-7105ac54171494a1.js +1 -0
- package/runtime/server/web/_next/static/chunks/900-743e38de13217291.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/inbox/page-32b885c019043e48.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/layout-4b3a212263712a5c.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/analytics/page-6af9adc14ccfa925.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/apps/[name]/settings/page-8b6f809eeccdbd22.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/apps/page-7f1ddf07889da248.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/dashboard/page-a25eb621fb18491d.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/device-actions/page-e6045823829567f7.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/device-notifications/page-377ed49cf55da81d.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/favorites/page-82f292daebf98a2f.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/groups/page-fe4ed80c7b11920f.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/info/page-d5d5075eec069ce3.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/keys/page-35ed01bf39a163b6.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/layout-5481d53aae3a0ce1.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/orgs/page-44c606ff2233f1a8.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/page-f2331bbbe09541aa.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/pages/page-6bf4e160a99411ce.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/peers/page-27041dd149601002.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/recent/page-f321688d374a8ff3.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/settings/page-64e724318dc3a584.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/studio/page-a2c0c34538ac62b3.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/subscriptions/page-57cdaafe12347e32.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/system/page-96d2e1f8c2fb22b0.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/tasks/page-bf16b78ed6749d78.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/my/users/page-c47d4524d2a156b8.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/page-f4641be7b88818a2.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/_not-found/page-f4902e6b69eebd4c.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/layout-5557bc90d966fded.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/platform-shell/[userId]/[name]/page-da0d5e71857f33d1.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/platform-shell-preview/page-52fa7e8c8b480934.js +1 -0
- package/runtime/server/web/_next/static/chunks/app/setup/page-9e29d6f66825a8f8.js +1 -0
- package/runtime/server/web/_next/static/chunks/framework-1c02a2e60068b586.js +1 -0
- package/runtime/server/web/_next/static/chunks/main-21ea4d4d10f4a256.js +1 -0
- package/runtime/server/web/_next/static/chunks/main-app-5b3c67453d8c5b99.js +1 -0
- package/runtime/server/web/_next/static/chunks/pages/_app-649f81c9fedecf29.js +1 -0
- package/runtime/server/web/_next/static/chunks/pages/_error-64e3bd84e2ecae08.js +1 -0
- package/runtime/server/web/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/runtime/server/web/_next/static/chunks/webpack-0bed2fdf6baa566e.js +1 -0
- package/runtime/server/web/_next/static/css/afdc0938fca59693.css +3 -0
- package/runtime/server/web/_next/static/media/013b72fa676f92e0-s.woff2 +0 -0
- package/runtime/server/web/_next/static/media/22a5144ee8d83bca-s.p.woff2 +0 -0
- package/runtime/server/web/_next/static/media/2b5b02fc7e511755-s.woff2 +0 -0
- package/runtime/server/web/_next/static/media/65f03d54ccadf4a8-s.woff2 +0 -0
- package/runtime/server/web/_next/static/media/7d4881bb7e1bf84d-s.p.woff2 +0 -0
- package/runtime/server/web/_next/static/media/9766a7e9e2e0ad5a-s.woff2 +0 -0
- package/runtime/server/web/_next/static/media/aa016aab0e6d1295-s.woff2 +0 -0
- package/runtime/server/web/_next/static/media/b66cf8e69499582a-s.woff2 +0 -0
- package/runtime/server/web/_next/static/media/b9408752a0c24fb9-s.woff2 +0 -0
- package/runtime/server/web/_next/static/media/e038a29029a234f2-s.woff2 +0 -0
- package/runtime/server/web/_next/static/media/f639721981034f88-s.woff2 +0 -0
- package/runtime/server/web/home/redline-launch-hero.png +0 -0
- package/runtime/server/web/inbox.html +1 -0
- package/runtime/server/web/inbox.txt +27 -0
- package/runtime/server/web/index.html +1 -0
- package/runtime/server/web/index.txt +27 -0
- package/runtime/server/web/my/analytics.html +1 -0
- package/runtime/server/web/my/analytics.txt +27 -0
- package/runtime/server/web/my/apps/placeholder/settings.html +1 -0
- package/runtime/server/web/my/apps/placeholder/settings.txt +24 -0
- package/runtime/server/web/my/apps.html +1 -0
- package/runtime/server/web/my/apps.txt +27 -0
- package/runtime/server/web/my/dashboard.html +1 -0
- package/runtime/server/web/my/dashboard.txt +27 -0
- package/runtime/server/web/my/device-actions.html +1 -0
- package/runtime/server/web/my/device-actions.txt +24 -0
- package/runtime/server/web/my/device-notifications.html +1 -0
- package/runtime/server/web/my/device-notifications.txt +24 -0
- package/runtime/server/web/my/favorites.html +1 -0
- package/runtime/server/web/my/favorites.txt +27 -0
- package/runtime/server/web/my/groups.html +1 -0
- package/runtime/server/web/my/groups.txt +27 -0
- package/runtime/server/web/my/info.html +1 -0
- package/runtime/server/web/my/info.txt +27 -0
- package/runtime/server/web/my/keys.html +1 -0
- package/runtime/server/web/my/keys.txt +27 -0
- package/runtime/server/web/my/orgs.html +1 -0
- package/runtime/server/web/my/orgs.txt +27 -0
- package/runtime/server/web/my/pages.html +1 -0
- package/runtime/server/web/my/pages.txt +27 -0
- package/runtime/server/web/my/peers.html +1 -0
- package/runtime/server/web/my/peers.txt +24 -0
- package/runtime/server/web/my/recent.html +1 -0
- package/runtime/server/web/my/recent.txt +27 -0
- package/runtime/server/web/my/settings.html +1 -0
- package/runtime/server/web/my/settings.txt +27 -0
- package/runtime/server/web/my/studio.html +1 -0
- package/runtime/server/web/my/studio.txt +24 -0
- package/runtime/server/web/my/subscriptions.html +1 -0
- package/runtime/server/web/my/subscriptions.txt +27 -0
- package/runtime/server/web/my/system.html +1 -0
- package/runtime/server/web/my/system.txt +24 -0
- package/runtime/server/web/my/tasks.html +1 -0
- package/runtime/server/web/my/tasks.txt +24 -0
- package/runtime/server/web/my/users.html +1 -0
- package/runtime/server/web/my/users.txt +27 -0
- package/runtime/server/web/my.html +1 -0
- package/runtime/server/web/my.txt +27 -0
- package/runtime/server/web/platform-shell/placeholder/placeholder.html +1 -0
- package/runtime/server/web/platform-shell/placeholder/placeholder.txt +23 -0
- package/runtime/server/web/platform-shell-preview.html +1 -0
- package/runtime/server/web/platform-shell-preview.txt +23 -0
- package/runtime/server/web/setup.html +1 -0
- package/runtime/server/web/setup.txt +23 -0
- package/template/.claude/skills/agent-tool-patterns/SKILL.md +195 -0
- package/template/.claude/skills/localapp/SKILL.md +80 -0
- package/template/.claude/skills/localapp-auth/SKILL.md +299 -0
- package/template/.claude/skills/localapp-business/SKILL.md +325 -0
- package/template/.claude/skills/localapp-data/SKILL.md +381 -0
- package/template/.claude/skills/localapp-device-actions/SKILL.md +60 -0
- package/template/.claude/skills/localapp-notify/SKILL.md +118 -0
- package/template/.claude/skills/localapp-transitions/SKILL.md +238 -0
- package/template/.claude/skills/localapp-ui/SKILL.md +67 -0
- package/template/.claude/skills/localapp-upload/SKILL.md +172 -0
- package/template/AGENTS.md +33 -0
- package/template/CLAUDE.md +117 -0
- package/template/ISSUES.md +32 -0
- package/template/backend/resources/work_items/mutations.json +83 -0
- package/template/backend/resources/work_items/queries.json +83 -0
- package/template/backend/resources/work_items/schema.json +31 -0
- package/template/backend/schemas/mutations.schema.json +15 -0
- package/template/backend/schemas/queries.schema.json +36 -0
- package/template/backend/schemas/resource-schema.schema.json +25 -0
- package/template/components.json +25 -0
- package/template/index.html +12 -0
- package/template/migrations/001_work_items.sql +6 -0
- package/template/package.json +70 -0
- package/template/postcss.config.js +5 -0
- package/template/runtime/dev-shell.tsx +6398 -0
- package/template/runtime/hooks/use-mobile.ts +19 -0
- package/template/runtime/issue-reference.ts +44 -0
- package/template/runtime/lib/utils.ts +6 -0
- package/template/runtime/package.json +14 -0
- package/template/runtime/platform-capabilities.json +109 -0
- package/template/runtime/sdk/agent/package.json +51 -0
- package/template/runtime/sdk/agent/src/agent-chat.tsx +188 -0
- package/template/runtime/sdk/agent/src/assistant-ui-adapter.ts +87 -0
- package/template/runtime/sdk/agent/src/context.ts +56 -0
- package/template/runtime/sdk/agent/src/dev-bridge.ts +21 -0
- package/template/runtime/sdk/agent/src/index.ts +19 -0
- package/template/runtime/sdk/agent/src/llm-adapter.ts +263 -0
- package/template/runtime/sdk/agent/src/native-registry.ts +61 -0
- package/template/runtime/sdk/agent/src/platform-runtime.ts +164 -0
- package/template/runtime/sdk/agent/src/postmessage-bridge.ts +60 -0
- package/template/runtime/sdk/agent/src/postmessage-types.ts +150 -0
- package/template/runtime/sdk/agent/src/tools.ts +70 -0
- package/template/runtime/sdk/agent/src/types.ts +27 -0
- package/template/runtime/sdk/agent/src/use-agent.ts +139 -0
- package/template/runtime/sdk/agent/src/use-register-edit-session.ts +54 -0
- package/template/runtime/sdk/agent/src/use-register-tools.ts +92 -0
- package/template/runtime/sdk/agent/tests/platform-runtime.test.ts +154 -0
- package/template/runtime/sdk/agent/tests/postmessage-bridge.test.ts +119 -0
- package/template/runtime/sdk/agent/tests/shell-integration.test.ts +71 -0
- package/template/runtime/sdk/agent/tests/use-register-edit-session.test.tsx +125 -0
- package/template/runtime/sdk/agent/tests/use-register-tools.test.ts +208 -0
- package/template/runtime/sdk/agent/tsconfig.json +18 -0
- package/template/runtime/sdk/agent/vitest.config.ts +8 -0
- package/template/runtime/sdk/backend/package.json +15 -0
- package/template/runtime/sdk/backend/src/index.ts +92 -0
- package/template/runtime/sdk/backend/tsconfig.json +8 -0
- package/template/runtime/sdk/core/package.json +15 -0
- package/template/runtime/sdk/core/src/client.ts +317 -0
- package/template/runtime/sdk/core/src/collaboration.ts +66 -0
- package/template/runtime/sdk/core/src/desktop.ts +469 -0
- package/template/runtime/sdk/core/src/device.ts +112 -0
- package/template/runtime/sdk/core/src/index.ts +6 -0
- package/template/runtime/sdk/core/src/invalidate.ts +40 -0
- package/template/runtime/sdk/core/src/types.ts +108 -0
- package/template/runtime/sdk/core/tests/capabilities.test.ts +64 -0
- package/template/runtime/sdk/core/tests/client.test.ts +424 -0
- package/template/runtime/sdk/core/tests/collaboration.test.ts +92 -0
- package/template/runtime/sdk/core/tests/desktop.test.ts +310 -0
- package/template/runtime/sdk/core/tests/device.test.ts +69 -0
- package/template/runtime/sdk/core/tsconfig.json +17 -0
- package/template/runtime/sdk/react/package.json +34 -0
- package/template/runtime/sdk/react/src/client.ts +7 -0
- package/template/runtime/sdk/react/src/components/can.tsx +24 -0
- package/template/runtime/sdk/react/src/hooks/use-action.ts +34 -0
- package/template/runtime/sdk/react/src/hooks/use-capabilities.ts +35 -0
- package/template/runtime/sdk/react/src/hooks/use-count.ts +37 -0
- package/template/runtime/sdk/react/src/hooks/use-create.ts +37 -0
- package/template/runtime/sdk/react/src/hooks/use-delete.ts +36 -0
- package/template/runtime/sdk/react/src/hooks/use-desktop-action.ts +94 -0
- package/template/runtime/sdk/react/src/hooks/use-device-action.ts +62 -0
- package/template/runtime/sdk/react/src/hooks/use-get.ts +37 -0
- package/template/runtime/sdk/react/src/hooks/use-group-members.ts +31 -0
- package/template/runtime/sdk/react/src/hooks/use-groups.ts +31 -0
- package/template/runtime/sdk/react/src/hooks/use-list.ts +53 -0
- package/template/runtime/sdk/react/src/hooks/use-me.ts +35 -0
- package/template/runtime/sdk/react/src/hooks/use-mutation.ts +30 -0
- package/template/runtime/sdk/react/src/hooks/use-permissions.ts +37 -0
- package/template/runtime/sdk/react/src/hooks/use-platform-data.ts +94 -0
- package/template/runtime/sdk/react/src/hooks/use-query.ts +30 -0
- package/template/runtime/sdk/react/src/hooks/use-time.ts +36 -0
- package/template/runtime/sdk/react/src/hooks/use-transaction.ts +30 -0
- package/template/runtime/sdk/react/src/hooks/use-transitions.ts +82 -0
- package/template/runtime/sdk/react/src/hooks/use-update.ts +37 -0
- package/template/runtime/sdk/react/src/hooks/use-upload.ts +30 -0
- package/template/runtime/sdk/react/src/hooks/use-users.ts +31 -0
- package/template/runtime/sdk/react/src/index.ts +40 -0
- package/template/runtime/sdk/react/src/permissions.ts +94 -0
- package/template/runtime/sdk/react/tests/permissions.test.ts +176 -0
- package/template/runtime/sdk/react/tests/use-action.test.tsx +64 -0
- package/template/runtime/sdk/react/tests/use-capabilities.test.tsx +48 -0
- package/template/runtime/sdk/react/tests/use-desktop-action.test.tsx +144 -0
- package/template/runtime/sdk/react/tests/use-permissions.test.tsx +162 -0
- package/template/runtime/sdk/react/tests/use-platform-data.test.tsx +89 -0
- package/template/runtime/sdk/react/tests/use-transaction.test.tsx +65 -0
- package/template/runtime/sdk/react/tests/use-transitions.test.ts +149 -0
- package/template/runtime/sdk/react/tsconfig.json +18 -0
- package/template/runtime/sdk/react/vitest.config.ts +9 -0
- package/template/runtime/sdk/react/vitest.setup.ts +6 -0
- package/template/runtime/server-core/dist/generated/platform-capabilities.d.ts +84 -0
- package/template/runtime/server-core/dist/generated/platform-capabilities.d.ts.map +1 -0
- package/template/runtime/server-core/dist/generated/platform-capabilities.js +115 -0
- package/template/runtime/server-core/dist/generated/platform-capabilities.js.map +1 -0
- package/template/runtime/server-core/dist/index.d.ts +19 -0
- package/template/runtime/server-core/dist/index.d.ts.map +1 -0
- package/template/runtime/server-core/dist/index.js +35 -0
- package/template/runtime/server-core/dist/index.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/action-runtime-hardening.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/action-runtime-hardening.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/action-runtime-hardening.test.js +475 -0
- package/template/runtime/server-core/dist/lib/__tests__/action-runtime-hardening.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/app-api-contract.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/app-api-contract.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/app-api-contract.test.js +65 -0
- package/template/runtime/server-core/dist/lib/__tests__/app-api-contract.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/app-runtime.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/app-runtime.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/app-runtime.test.js +103 -0
- package/template/runtime/server-core/dist/lib/__tests__/app-runtime.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/backend-actions.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/backend-actions.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/backend-actions.test.js +358 -0
- package/template/runtime/server-core/dist/lib/__tests__/backend-actions.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/backend-contract.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/backend-contract.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/backend-contract.test.js +786 -0
- package/template/runtime/server-core/dist/lib/__tests__/backend-contract.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/content-capabilities.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/content-capabilities.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/content-capabilities.test.js +82 -0
- package/template/runtime/server-core/dist/lib/__tests__/content-capabilities.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/database-write-guard.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/database-write-guard.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/database-write-guard.test.js +42 -0
- package/template/runtime/server-core/dist/lib/__tests__/database-write-guard.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-collaboration.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-collaboration.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-collaboration.test.js +144 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-collaboration.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-comment-minimization.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-comment-minimization.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-comment-minimization.test.js +75 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-comment-minimization.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-comment-pins.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-comment-pins.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-comment-pins.test.js +85 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-comment-pins.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-cross-references.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-cross-references.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-cross-references.test.js +75 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-cross-references.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-dependencies.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-dependencies.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-dependencies.test.js +78 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-dependencies.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-duplicates.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-duplicates.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-duplicates.test.js +66 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-duplicates.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-list.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-list.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-list.test.js +322 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-list.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-potential-duplicates.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-potential-duplicates.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-potential-duplicates.test.js +49 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-potential-duplicates.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-reactions.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-reactions.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-reactions.test.js +67 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-reactions.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-revisions.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-revisions.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-revisions.test.js +91 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-revisions.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-saved-views.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-saved-views.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-saved-views.test.js +69 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-saved-views.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-sub-issues.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-sub-issues.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-sub-issues.test.js +159 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-sub-issues.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-task-conversion.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-task-conversion.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-task-conversion.test.js +102 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-task-conversion.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-templates.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-templates.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-templates.test.js +65 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-templates.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-timeline.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-timeline.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-timeline.test.js +226 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-timeline.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-types.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-types.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-types.test.js +64 -0
- package/template/runtime/server-core/dist/lib/__tests__/issue-types.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/migrations.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/migrations.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/migrations.test.js +101 -0
- package/template/runtime/server-core/dist/lib/__tests__/migrations.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/platform-capabilities.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/platform-capabilities.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/platform-capabilities.test.js +69 -0
- package/template/runtime/server-core/dist/lib/__tests__/platform-capabilities.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/transitions.test.d.ts +2 -0
- package/template/runtime/server-core/dist/lib/__tests__/transitions.test.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/__tests__/transitions.test.js +32 -0
- package/template/runtime/server-core/dist/lib/__tests__/transitions.test.js.map +1 -0
- package/template/runtime/server-core/dist/lib/access-control.d.ts +34 -0
- package/template/runtime/server-core/dist/lib/access-control.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/access-control.js +138 -0
- package/template/runtime/server-core/dist/lib/access-control.js.map +1 -0
- package/template/runtime/server-core/dist/lib/app-api-contract.d.ts +69 -0
- package/template/runtime/server-core/dist/lib/app-api-contract.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/app-api-contract.js +57 -0
- package/template/runtime/server-core/dist/lib/app-api-contract.js.map +1 -0
- package/template/runtime/server-core/dist/lib/app-db.d.ts +486 -0
- package/template/runtime/server-core/dist/lib/app-db.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/app-db.js +2581 -0
- package/template/runtime/server-core/dist/lib/app-db.js.map +1 -0
- package/template/runtime/server-core/dist/lib/app-runtime.d.ts +28 -0
- package/template/runtime/server-core/dist/lib/app-runtime.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/app-runtime.js +56 -0
- package/template/runtime/server-core/dist/lib/app-runtime.js.map +1 -0
- package/template/runtime/server-core/dist/lib/backend-actions.d.ts +149 -0
- package/template/runtime/server-core/dist/lib/backend-actions.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/backend-actions.js +926 -0
- package/template/runtime/server-core/dist/lib/backend-actions.js.map +1 -0
- package/template/runtime/server-core/dist/lib/backend-contract.d.ts +399 -0
- package/template/runtime/server-core/dist/lib/backend-contract.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/backend-contract.js +1148 -0
- package/template/runtime/server-core/dist/lib/backend-contract.js.map +1 -0
- package/template/runtime/server-core/dist/lib/content-capabilities.d.ts +30 -0
- package/template/runtime/server-core/dist/lib/content-capabilities.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/content-capabilities.js +133 -0
- package/template/runtime/server-core/dist/lib/content-capabilities.js.map +1 -0
- package/template/runtime/server-core/dist/lib/issue-saved-replies.d.ts +7 -0
- package/template/runtime/server-core/dist/lib/issue-saved-replies.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/issue-saved-replies.js +22 -0
- package/template/runtime/server-core/dist/lib/issue-saved-replies.js.map +1 -0
- package/template/runtime/server-core/dist/lib/issue-saved-views.d.ts +43 -0
- package/template/runtime/server-core/dist/lib/issue-saved-views.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/issue-saved-views.js +201 -0
- package/template/runtime/server-core/dist/lib/issue-saved-views.js.map +1 -0
- package/template/runtime/server-core/dist/lib/issue-task-conversion.d.ts +11 -0
- package/template/runtime/server-core/dist/lib/issue-task-conversion.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/issue-task-conversion.js +66 -0
- package/template/runtime/server-core/dist/lib/issue-task-conversion.js.map +1 -0
- package/template/runtime/server-core/dist/lib/issue-templates.d.ts +16 -0
- package/template/runtime/server-core/dist/lib/issue-templates.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/issue-templates.js +89 -0
- package/template/runtime/server-core/dist/lib/issue-templates.js.map +1 -0
- package/template/runtime/server-core/dist/lib/migrations.d.ts +31 -0
- package/template/runtime/server-core/dist/lib/migrations.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/migrations.js +180 -0
- package/template/runtime/server-core/dist/lib/migrations.js.map +1 -0
- package/template/runtime/server-core/dist/lib/notify-permission-sql.d.ts +21 -0
- package/template/runtime/server-core/dist/lib/notify-permission-sql.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/notify-permission-sql.js +71 -0
- package/template/runtime/server-core/dist/lib/notify-permission-sql.js.map +1 -0
- package/template/runtime/server-core/dist/lib/record-access.d.ts +34 -0
- package/template/runtime/server-core/dist/lib/record-access.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/record-access.js +81 -0
- package/template/runtime/server-core/dist/lib/record-access.js.map +1 -0
- package/template/runtime/server-core/dist/lib/runtime-errors.d.ts +28 -0
- package/template/runtime/server-core/dist/lib/runtime-errors.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/runtime-errors.js +67 -0
- package/template/runtime/server-core/dist/lib/runtime-errors.js.map +1 -0
- package/template/runtime/server-core/dist/lib/transitions.d.ts +55 -0
- package/template/runtime/server-core/dist/lib/transitions.d.ts.map +1 -0
- package/template/runtime/server-core/dist/lib/transitions.js +142 -0
- package/template/runtime/server-core/dist/lib/transitions.js.map +1 -0
- package/template/runtime/server-core/dist/types/models.d.ts +163 -0
- package/template/runtime/server-core/dist/types/models.d.ts.map +1 -0
- package/template/runtime/server-core/dist/types/models.js +3 -0
- package/template/runtime/server-core/dist/types/models.js.map +1 -0
- package/template/runtime/server-core/package.json +24 -0
- package/template/runtime/styles/preset.css +282 -0
- package/template/runtime/sync-template-command.cjs +19 -0
- package/template/runtime/sync-template.cjs +71 -0
- package/template/runtime/tsconfig.base.json +20 -0
- package/template/runtime/version.json +3 -0
- package/template/runtime/vite-plugin.mjs +309 -0
- package/template/src/App.tsx +273 -0
- package/template/src/components/ui/accordion.tsx +79 -0
- package/template/src/components/ui/alert-dialog.tsx +197 -0
- package/template/src/components/ui/alert.tsx +76 -0
- package/template/src/components/ui/aspect-ratio.tsx +11 -0
- package/template/src/components/ui/avatar.tsx +110 -0
- package/template/src/components/ui/badge.tsx +49 -0
- package/template/src/components/ui/breadcrumb.tsx +122 -0
- package/template/src/components/ui/button-group.tsx +83 -0
- package/template/src/components/ui/button.tsx +67 -0
- package/template/src/components/ui/calendar.tsx +221 -0
- package/template/src/components/ui/card.tsx +103 -0
- package/template/src/components/ui/carousel.tsx +240 -0
- package/template/src/components/ui/chart.tsx +373 -0
- package/template/src/components/ui/checkbox.tsx +31 -0
- package/template/src/components/ui/collapsible.tsx +33 -0
- package/template/src/components/ui/combobox.tsx +299 -0
- package/template/src/components/ui/command.tsx +193 -0
- package/template/src/components/ui/context-menu.tsx +261 -0
- package/template/src/components/ui/dialog.tsx +168 -0
- package/template/src/components/ui/direction.tsx +22 -0
- package/template/src/components/ui/drawer.tsx +132 -0
- package/template/src/components/ui/dropdown-menu.tsx +269 -0
- package/template/src/components/ui/empty.tsx +104 -0
- package/template/src/components/ui/field.tsx +238 -0
- package/template/src/components/ui/hover-card.tsx +42 -0
- package/template/src/components/ui/input-group.tsx +154 -0
- package/template/src/components/ui/input-otp.tsx +87 -0
- package/template/src/components/ui/input.tsx +19 -0
- package/template/src/components/ui/item.tsx +196 -0
- package/template/src/components/ui/kbd.tsx +26 -0
- package/template/src/components/ui/label.tsx +22 -0
- package/template/src/components/ui/menubar.tsx +280 -0
- package/template/src/components/ui/native-select.tsx +61 -0
- package/template/src/components/ui/navigation-menu.tsx +164 -0
- package/template/src/components/ui/pagination.tsx +129 -0
- package/template/src/components/ui/popover.tsx +87 -0
- package/template/src/components/ui/progress.tsx +31 -0
- package/template/src/components/ui/radio-group.tsx +42 -0
- package/template/src/components/ui/resizable.tsx +50 -0
- package/template/src/components/ui/scroll-area.tsx +53 -0
- package/template/src/components/ui/select.tsx +192 -0
- package/template/src/components/ui/separator.tsx +26 -0
- package/template/src/components/ui/sheet.tsx +145 -0
- package/template/src/components/ui/sidebar.tsx +700 -0
- package/template/src/components/ui/skeleton.tsx +13 -0
- package/template/src/components/ui/slider.tsx +59 -0
- package/template/src/components/ui/sonner.tsx +47 -0
- package/template/src/components/ui/spinner.tsx +10 -0
- package/template/src/components/ui/switch.tsx +33 -0
- package/template/src/components/ui/table.tsx +114 -0
- package/template/src/components/ui/tabs.tsx +90 -0
- package/template/src/components/ui/textarea.tsx +18 -0
- package/template/src/components/ui/toggle-group.tsx +89 -0
- package/template/src/components/ui/toggle.tsx +45 -0
- package/template/src/components/ui/tooltip.tsx +57 -0
- package/template/src/hooks/use-mobile.ts +3 -0
- package/template/src/index.css +4 -0
- package/template/src/lib/utils.ts +3 -0
- package/template/src/main.tsx +10 -0
- package/template/src/vite-env.d.ts +1 -0
- package/template/template.gitignore +10 -0
- package/template/template.npmrc +1 -0
- package/template/tests/agent-context.test.ts +69 -0
- package/template/tests/agent-guidance-template.test.ts +49 -0
- package/template/tests/agent-runtime.test.ts +198 -0
- package/template/tests/agent-tools.test.ts +150 -0
- package/template/tests/agent-use-agent.test.ts +86 -0
- package/template/tests/assistant-ui-adapter.test.ts +211 -0
- package/template/tests/business-modeling-template.test.ts +71 -0
- package/template/tests/client.test.ts +382 -0
- package/template/tests/dev-issue-search-suggestions.test.ts +36 -0
- package/template/tests/dev-shell-context.test.tsx +40 -0
- package/template/tests/dev-shell-template.test.ts +2593 -0
- package/template/tests/invalidation.test.ts +126 -0
- package/template/tests/main-tsx.test.ts +28 -0
- package/template/tests/media-preview-template.test.ts +21 -0
- package/template/tests/mutations.test.ts +224 -0
- package/template/tests/react.test.ts +302 -0
- package/template/tests/redirect.test.ts +51 -0
- package/template/tests/skill-docs.test.ts +76 -0
- package/template/tests/state-transitions-template.test.ts +61 -0
- package/template/tests/template-ui.test.ts +145 -0
- package/template/tests/upload.test.ts +143 -0
- package/template/tests/vite-plugin.test.ts +426 -0
- package/template/tests/vite-proxy-security.test.ts +153 -0
- package/template/tsconfig.json +11 -0
- package/template/vite.config.ts +7 -0
- package/template/vitest.config.ts +16 -0
- package/template/vitest.setup.ts +1 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
const MOBILE_BREAKPOINT = 768
|
|
4
|
+
|
|
5
|
+
export function useIsMobile() {
|
|
6
|
+
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
|
|
7
|
+
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
|
|
10
|
+
const onChange = () => {
|
|
11
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
12
|
+
}
|
|
13
|
+
mql.addEventListener("change", onChange)
|
|
14
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
15
|
+
return () => mql.removeEventListener("change", onChange)
|
|
16
|
+
}, [])
|
|
17
|
+
|
|
18
|
+
return !!isMobile
|
|
19
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const DEV_ISSUE_REFERENCE_PREFIX = "#localapp-issue-";
|
|
2
|
+
|
|
3
|
+
interface DevMarkdownNode { type: string; value?: string; url?: string; children?: DevMarkdownNode[]; position?: { start?: { offset?: number }; end?: { offset?: number } }; }
|
|
4
|
+
const DEV_ISSUE_REFERENCE = /(^|[^\\\w])#([1-9]\d*)\b/g;
|
|
5
|
+
|
|
6
|
+
function transformDevIssueReferenceText(node: DevMarkdownNode, source: string): DevMarkdownNode[] {
|
|
7
|
+
const value = node.value ?? "";
|
|
8
|
+
const result: DevMarkdownNode[] = [];
|
|
9
|
+
let offset = 0;
|
|
10
|
+
for (const match of value.matchAll(DEV_ISSUE_REFERENCE)) {
|
|
11
|
+
const prefix = match[1];
|
|
12
|
+
const issueNumber = match[2];
|
|
13
|
+
const hashOffset = (match.index ?? 0) + prefix.length;
|
|
14
|
+
const sourceStart = node.position?.start?.offset;
|
|
15
|
+
const sourceEnd = node.position?.end?.offset;
|
|
16
|
+
if (typeof sourceStart === "number" && typeof sourceEnd === "number") {
|
|
17
|
+
const raw = source.slice(sourceStart, sourceEnd);
|
|
18
|
+
const rawHashOffset = raw.indexOf(`#${issueNumber}`);
|
|
19
|
+
if (rawHashOffset > 0 && raw[rawHashOffset - 1] === "\\") continue;
|
|
20
|
+
}
|
|
21
|
+
if (hashOffset > offset) result.push({ type: "text", value: value.slice(offset, hashOffset) });
|
|
22
|
+
result.push({ type: "link", url: `${DEV_ISSUE_REFERENCE_PREFIX}${issueNumber}`, children: [{ type: "text", value: `#${issueNumber}` }] });
|
|
23
|
+
offset = hashOffset + issueNumber.length + 1;
|
|
24
|
+
}
|
|
25
|
+
if (offset === 0) return [node];
|
|
26
|
+
if (offset < value.length) result.push({ type: "text", value: value.slice(offset) });
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function transformDevIssueReferenceChildren(node: DevMarkdownNode, source: string): void {
|
|
31
|
+
if (!node.children || ["link", "linkReference", "code", "inlineCode", "html"].includes(node.type)) return;
|
|
32
|
+
node.children = node.children.flatMap((child) => {
|
|
33
|
+
if (child.type === "text") return transformDevIssueReferenceText(child, source);
|
|
34
|
+
transformDevIssueReferenceChildren(child, source);
|
|
35
|
+
return [child];
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function remarkDevIssueReferences() { return (tree: DevMarkdownNode, file: { value?: unknown }) => transformDevIssueReferenceChildren(tree, String(file.value ?? "")); }
|
|
40
|
+
export function readDevIssueReference(href?: string): number | null {
|
|
41
|
+
if (!href?.startsWith(DEV_ISSUE_REFERENCE_PREFIX)) return null;
|
|
42
|
+
const value = Number(href.slice(DEV_ISSUE_REFERENCE_PREFIX.length));
|
|
43
|
+
return Number.isSafeInteger(value) && value > 0 ? value : null;
|
|
44
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@localapp/app-kit",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./vite": "./vite-plugin.mjs",
|
|
8
|
+
"./dev-shell": "./dev-shell.tsx",
|
|
9
|
+
"./lib/utils": "./lib/utils.ts",
|
|
10
|
+
"./hooks/use-mobile": "./hooks/use-mobile.ts",
|
|
11
|
+
"./styles/preset.css": "./styles/preset.css",
|
|
12
|
+
"./tsconfig.base": "./tsconfig.base.json"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./capabilities.schema.json",
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"platformVersion": "1.2.0",
|
|
5
|
+
"content": {
|
|
6
|
+
"upload": {
|
|
7
|
+
"enabled": true,
|
|
8
|
+
"maxBytes": 10485760,
|
|
9
|
+
"validatesFileSignature": true
|
|
10
|
+
},
|
|
11
|
+
"read": {
|
|
12
|
+
"enabled": true,
|
|
13
|
+
"rangeRequests": true,
|
|
14
|
+
"delete": false
|
|
15
|
+
},
|
|
16
|
+
"types": [
|
|
17
|
+
{
|
|
18
|
+
"extension": "png",
|
|
19
|
+
"mimeType": "image/png",
|
|
20
|
+
"inlinePreview": true
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"extension": "jpg",
|
|
24
|
+
"mimeType": "image/jpeg",
|
|
25
|
+
"inlinePreview": true
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"extension": "jpeg",
|
|
29
|
+
"mimeType": "image/jpeg",
|
|
30
|
+
"inlinePreview": true
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"extension": "gif",
|
|
34
|
+
"mimeType": "image/gif",
|
|
35
|
+
"inlinePreview": true
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"extension": "webp",
|
|
39
|
+
"mimeType": "image/webp",
|
|
40
|
+
"inlinePreview": true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"extension": "svg",
|
|
44
|
+
"mimeType": "image/svg+xml",
|
|
45
|
+
"inlinePreview": true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"extension": "pdf",
|
|
49
|
+
"mimeType": "application/pdf",
|
|
50
|
+
"inlinePreview": true
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"backend": {
|
|
55
|
+
"stableMode": "named-sql",
|
|
56
|
+
"namedSql": {
|
|
57
|
+
"enabled": true,
|
|
58
|
+
"transactions": true,
|
|
59
|
+
"maxRows": 1000,
|
|
60
|
+
"maxBytes": 1048576,
|
|
61
|
+
"systemParams": [
|
|
62
|
+
"currentUserId",
|
|
63
|
+
"ownerId",
|
|
64
|
+
"now"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"hostedActions": {
|
|
68
|
+
"enabled": false,
|
|
69
|
+
"stable": false
|
|
70
|
+
},
|
|
71
|
+
"securityContracts": {
|
|
72
|
+
"enabled": true,
|
|
73
|
+
"contractVersion": 1,
|
|
74
|
+
"requiredFromPlatformVersion": "1.1.0",
|
|
75
|
+
"generatedTemplates": [
|
|
76
|
+
"public-v1",
|
|
77
|
+
"authenticated-v1",
|
|
78
|
+
"owner-read-v1",
|
|
79
|
+
"owner-create-v1",
|
|
80
|
+
"owner-update-v1",
|
|
81
|
+
"owner-delete-v1",
|
|
82
|
+
"member-read-v1",
|
|
83
|
+
"member-create-v1",
|
|
84
|
+
"member-update-v1",
|
|
85
|
+
"member-delete-v1",
|
|
86
|
+
"parent-owner-v1",
|
|
87
|
+
"transition-v1"
|
|
88
|
+
],
|
|
89
|
+
"customScenarios": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"identity": {
|
|
93
|
+
"currentUser": true,
|
|
94
|
+
"pageOwner": true,
|
|
95
|
+
"groups": true
|
|
96
|
+
},
|
|
97
|
+
"verification": {
|
|
98
|
+
"enabled": true,
|
|
99
|
+
"isolatedDatabase": true,
|
|
100
|
+
"identities": [
|
|
101
|
+
"owner",
|
|
102
|
+
"member"
|
|
103
|
+
],
|
|
104
|
+
"defaultTtlSeconds": 900,
|
|
105
|
+
"maxTtlSeconds": 1800,
|
|
106
|
+
"maxConcurrentSessions": 8,
|
|
107
|
+
"maxDatabaseBytes": 67108864
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@localapp/sdk-agent",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "LocalApp Agent SDK — AI agent integration for LocalApp apps",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.ts",
|
|
7
|
+
"types": "./src/index.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.ts",
|
|
10
|
+
"./dev-bridge": "./src/dev-bridge.ts",
|
|
11
|
+
"./native-registry": "./src/native-registry.ts",
|
|
12
|
+
"./platform-runtime": "./src/platform-runtime.ts",
|
|
13
|
+
"./postmessage-types": "./src/postmessage-types.ts",
|
|
14
|
+
"./use-register-edit-session": "./src/use-register-edit-session.ts"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"src"
|
|
18
|
+
],
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@earendil-works/pi-agent-core": "^0.75.5",
|
|
22
|
+
"@earendil-works/pi-ai": "^0.75.5",
|
|
23
|
+
"@sinclair/typebox": "^0.34.49"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@assistant-ui/react": "^0.14.7",
|
|
27
|
+
"@localapp/sdk": "file:../core",
|
|
28
|
+
"@localapp/sdk-react": "file:../react",
|
|
29
|
+
"react": "^18.3.0",
|
|
30
|
+
"react-dom": "^18.3.0",
|
|
31
|
+
"react-markdown": "^10.1.0",
|
|
32
|
+
"remark-gfm": "^4.0.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@assistant-ui/react": "^0.14.7",
|
|
36
|
+
"@localapp/sdk": "file:../core",
|
|
37
|
+
"@localapp/sdk-react": "file:../react",
|
|
38
|
+
"@types/react": "^18.3.0",
|
|
39
|
+
"@types/react-dom": "^18.3.0",
|
|
40
|
+
"react": "^18.3.0",
|
|
41
|
+
"react-dom": "^18.3.0",
|
|
42
|
+
"react-markdown": "^10.1.0",
|
|
43
|
+
"remark-gfm": "^4.0.1",
|
|
44
|
+
"vitest": "^3.2.1",
|
|
45
|
+
"jsdom": "^26.1.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:watch": "vitest"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
useExternalStoreRuntime,
|
|
4
|
+
AssistantRuntimeProvider,
|
|
5
|
+
ThreadPrimitive,
|
|
6
|
+
ComposerPrimitive,
|
|
7
|
+
MessagePrimitive,
|
|
8
|
+
} from "@assistant-ui/react";
|
|
9
|
+
import type { ThreadMessageLike } from "@assistant-ui/react";
|
|
10
|
+
import ReactMarkdown from "react-markdown";
|
|
11
|
+
import remarkGfm from "remark-gfm";
|
|
12
|
+
import type { UseAgentReturn } from "./types.js";
|
|
13
|
+
import { convertMessages } from "./assistant-ui-adapter.js";
|
|
14
|
+
|
|
15
|
+
interface AgentChatProps {
|
|
16
|
+
agent: UseAgentReturn;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function AgentChat({ agent }: AgentChatProps) {
|
|
20
|
+
const { send, messages, isRunning, error } = agent;
|
|
21
|
+
const threadMessages = useMemo(() => {
|
|
22
|
+
const converted = convertMessages(messages);
|
|
23
|
+
if (isRunning && converted.length > 0 && converted[converted.length - 1].role === "assistant") {
|
|
24
|
+
const last = converted[converted.length - 1];
|
|
25
|
+
converted[converted.length - 1] = { ...last, status: { type: "running" } };
|
|
26
|
+
}
|
|
27
|
+
return converted;
|
|
28
|
+
}, [messages, isRunning]);
|
|
29
|
+
|
|
30
|
+
const runtime = useExternalStoreRuntime<ThreadMessageLike>({
|
|
31
|
+
messages: threadMessages,
|
|
32
|
+
isRunning,
|
|
33
|
+
onNew: async (msg) => {
|
|
34
|
+
const text = msg.content
|
|
35
|
+
.filter((p: any) => p.type === "text")
|
|
36
|
+
.map((p: any) => p.text)
|
|
37
|
+
.join("");
|
|
38
|
+
if (text) send(text);
|
|
39
|
+
},
|
|
40
|
+
convertMessage: (msg) => msg,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<AssistantRuntimeProvider runtime={runtime}>
|
|
45
|
+
<div style={{ display: "flex", flexDirection: "column", height: "100%", fontSize: 14 }}>
|
|
46
|
+
{error && (
|
|
47
|
+
<div style={{ padding: "8px 12px", background: "#fff3e0", color: "#d84315", borderBottom: "1px solid #ffe0b2", fontSize: 13 }}>
|
|
48
|
+
{error}
|
|
49
|
+
</div>
|
|
50
|
+
)}
|
|
51
|
+
<ThreadPrimitive.Root style={{ flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }}>
|
|
52
|
+
<ThreadPrimitive.Viewport style={{ flex: 1, overflowY: "auto", padding: 12 }}>
|
|
53
|
+
<ThreadPrimitive.Messages>
|
|
54
|
+
{({ message }) => {
|
|
55
|
+
if (message.role === "user") return <UserMessage />;
|
|
56
|
+
return <AssistantMessage isRunning={isRunning} />;
|
|
57
|
+
}}
|
|
58
|
+
</ThreadPrimitive.Messages>
|
|
59
|
+
</ThreadPrimitive.Viewport>
|
|
60
|
+
<ThreadPrimitive.ViewportFooter>
|
|
61
|
+
<Composer />
|
|
62
|
+
</ThreadPrimitive.ViewportFooter>
|
|
63
|
+
</ThreadPrimitive.Root>
|
|
64
|
+
</div>
|
|
65
|
+
</AssistantRuntimeProvider>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function UserMessage() {
|
|
70
|
+
return (
|
|
71
|
+
<div style={{ display: "flex", justifyContent: "flex-end", marginBottom: 8 }}>
|
|
72
|
+
<div style={{ maxWidth: "70%", padding: "8px 12px", background: "#1976d2", color: "white", borderRadius: "12px 12px 2px 12px", whiteSpace: "pre-wrap" }}>
|
|
73
|
+
<MessagePrimitive.Root>
|
|
74
|
+
<MessagePrimitive.Parts>
|
|
75
|
+
{({ part }) => {
|
|
76
|
+
if (part.type === "text" && part.text) return <>{part.text}</>;
|
|
77
|
+
return null;
|
|
78
|
+
}}
|
|
79
|
+
</MessagePrimitive.Parts>
|
|
80
|
+
</MessagePrimitive.Root>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function AssistantMessage({ isRunning }: { isRunning: boolean }) {
|
|
87
|
+
return (
|
|
88
|
+
<div style={{ display: "flex", justifyContent: "flex-start", marginBottom: 8 }}>
|
|
89
|
+
<div style={{ maxWidth: "70%", display: "flex", flexDirection: "column", gap: 4 }}>
|
|
90
|
+
<MessagePrimitive.Root>
|
|
91
|
+
<MessagePrimitive.Parts>
|
|
92
|
+
{({ part }) => {
|
|
93
|
+
if (part.type === "text") {
|
|
94
|
+
return (
|
|
95
|
+
<div style={{ padding: "8px 12px", background: "#f5f5f5", borderRadius: "12px 12px 12px 2px", lineHeight: 1.6 }}>
|
|
96
|
+
<div className="markdown-body">
|
|
97
|
+
<ReactMarkdown remarkPlugins={[remarkGfm]}>{part.text}</ReactMarkdown>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
if (part.type === "tool-call") {
|
|
103
|
+
return <ToolCallDisplay toolName={part.toolName} args={part.args} result={part.result} isRunning={isRunning} />;
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}}
|
|
107
|
+
</MessagePrimitive.Parts>
|
|
108
|
+
</MessagePrimitive.Root>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function ToolCallDisplay({ toolName, args, result, isRunning }: { toolName: string; args?: any; result?: any; isRunning?: boolean }) {
|
|
115
|
+
const hasResult = result !== undefined;
|
|
116
|
+
const hasArgs = args && Object.keys(args).length > 0;
|
|
117
|
+
const [expanded, setExpanded] = useState(!hasResult);
|
|
118
|
+
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (hasResult && !isRunning) setExpanded(false);
|
|
121
|
+
}, [hasResult, isRunning]);
|
|
122
|
+
|
|
123
|
+
const fullResult = hasResult
|
|
124
|
+
? (typeof result === "string" ? result : JSON.stringify(result))
|
|
125
|
+
: "";
|
|
126
|
+
const summary = fullResult.slice(0, 60);
|
|
127
|
+
|
|
128
|
+
const toggle = () => setExpanded((prev) => !prev);
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<div
|
|
132
|
+
onClick={hasResult ? toggle : undefined}
|
|
133
|
+
style={{
|
|
134
|
+
padding: "6px 10px",
|
|
135
|
+
background: "#e3f2fd",
|
|
136
|
+
borderRadius: 6,
|
|
137
|
+
fontSize: 12,
|
|
138
|
+
cursor: hasResult ? "pointer" : "default",
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
<div style={{ display: "flex", alignItems: "center", gap: 6, color: "#1565c0", fontWeight: 500 }}>
|
|
142
|
+
<span>{hasResult ? "✓" : "⏳"}</span>
|
|
143
|
+
<span>{toolName}</span>
|
|
144
|
+
{!expanded && summary && (
|
|
145
|
+
<span style={{ fontWeight: 400, color: "#666", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 }}>
|
|
146
|
+
{summary}{fullResult.length > 60 ? "…" : ""}
|
|
147
|
+
</span>
|
|
148
|
+
)}
|
|
149
|
+
{hasResult && (
|
|
150
|
+
<span style={{ marginLeft: "auto", fontSize: 11, fontWeight: 400, color: "#1976d2", flexShrink: 0 }}>
|
|
151
|
+
{expanded ? "▲ 折叠" : "▼ 展开"}
|
|
152
|
+
</span>
|
|
153
|
+
)}
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
{expanded && (
|
|
157
|
+
<>
|
|
158
|
+
{hasArgs && (
|
|
159
|
+
<pre style={{ margin: "4px 0 0", fontSize: 11, color: "#666", whiteSpace: "pre-wrap" }}>
|
|
160
|
+
{JSON.stringify(args, null, 2)}
|
|
161
|
+
</pre>
|
|
162
|
+
)}
|
|
163
|
+
{hasResult && (
|
|
164
|
+
<pre style={{ margin: "4px 0 0", fontSize: 11, color: "#2e7d32", whiteSpace: "pre-wrap" }}>
|
|
165
|
+
{typeof result === "string" ? result : JSON.stringify(result, null, 2)}
|
|
166
|
+
</pre>
|
|
167
|
+
)}
|
|
168
|
+
</>
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function Composer() {
|
|
175
|
+
return (
|
|
176
|
+
<ComposerPrimitive.Root style={{ display: "flex", borderTop: "1px solid #e0e0e0", padding: 8, gap: 8, background: "#fafafa" }}>
|
|
177
|
+
<ComposerPrimitive.Input
|
|
178
|
+
placeholder="输入消息..."
|
|
179
|
+
style={{ flex: 1, padding: "8px 12px", border: "1px solid #ddd", borderRadius: 6, outline: "none", fontSize: 14 }}
|
|
180
|
+
/>
|
|
181
|
+
<ComposerPrimitive.Send
|
|
182
|
+
style={{ padding: "8px 16px", background: "#1976d2", color: "white", border: "none", borderRadius: 6, cursor: "pointer", fontSize: 14 }}
|
|
183
|
+
>
|
|
184
|
+
发送
|
|
185
|
+
</ComposerPrimitive.Send>
|
|
186
|
+
</ComposerPrimitive.Root>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import type { ThreadMessageLike } from "@assistant-ui/react";
|
|
3
|
+
|
|
4
|
+
function extractText(content: unknown): string {
|
|
5
|
+
if (typeof content === "string") return content;
|
|
6
|
+
if (Array.isArray(content)) {
|
|
7
|
+
return content
|
|
8
|
+
.filter((c: any) => c.type === "text")
|
|
9
|
+
.map((c: any) => c.text)
|
|
10
|
+
.join("");
|
|
11
|
+
}
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function convertMessages(msgs: AgentMessage[]): ThreadMessageLike[] {
|
|
16
|
+
const toolResults = new Map<string, { result: string; isError: boolean }>();
|
|
17
|
+
|
|
18
|
+
for (const msg of msgs) {
|
|
19
|
+
if (msg.role === "toolResult") {
|
|
20
|
+
toolResults.set(msg.toolCallId, {
|
|
21
|
+
result: extractText(msg.content),
|
|
22
|
+
isError: msg.isError,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const result: ThreadMessageLike[] = [];
|
|
28
|
+
|
|
29
|
+
for (let i = 0; i < msgs.length; i++) {
|
|
30
|
+
const msg = msgs[i];
|
|
31
|
+
|
|
32
|
+
if (msg.role === "user") {
|
|
33
|
+
result.push({
|
|
34
|
+
role: "user",
|
|
35
|
+
content: extractText(msg.content),
|
|
36
|
+
id: `msg-${i}`,
|
|
37
|
+
});
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (msg.role === "assistant") {
|
|
42
|
+
const parts: ThreadMessageLike["content"] extends string
|
|
43
|
+
? never
|
|
44
|
+
: Array<
|
|
45
|
+
| { type: "text"; text: string }
|
|
46
|
+
| {
|
|
47
|
+
type: "tool-call";
|
|
48
|
+
toolCallId: string;
|
|
49
|
+
toolName: string;
|
|
50
|
+
args: any;
|
|
51
|
+
argsText: string;
|
|
52
|
+
result?: any;
|
|
53
|
+
isError?: boolean;
|
|
54
|
+
}
|
|
55
|
+
> = [];
|
|
56
|
+
|
|
57
|
+
for (const block of msg.content as any[]) {
|
|
58
|
+
if (block.type === "text") {
|
|
59
|
+
parts.push({ type: "text", text: block.text });
|
|
60
|
+
}
|
|
61
|
+
if (block.type === "toolCall") {
|
|
62
|
+
const tr = toolResults.get(block.id);
|
|
63
|
+
parts.push({
|
|
64
|
+
type: "tool-call",
|
|
65
|
+
toolCallId: block.id,
|
|
66
|
+
toolName: block.name,
|
|
67
|
+
args: block.arguments,
|
|
68
|
+
argsText: JSON.stringify(block.arguments),
|
|
69
|
+
...(tr ? { result: tr.result, isError: tr.isError } : {}),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
result.push({
|
|
75
|
+
role: "assistant",
|
|
76
|
+
content: parts,
|
|
77
|
+
id: `msg-${i}`,
|
|
78
|
+
status: { type: "complete", reason: "stop" },
|
|
79
|
+
});
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// toolResult messages are merged into assistant messages, skip
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { detectBasePath } from "@localapp/sdk";
|
|
2
|
+
|
|
3
|
+
export async function fetchSchemaContext(): Promise<string> {
|
|
4
|
+
try {
|
|
5
|
+
const basePath = detectBasePath();
|
|
6
|
+
const res = await fetch(`${basePath}/_schemas`, { credentials: "include" });
|
|
7
|
+
const body = await res.json();
|
|
8
|
+
if (!body.success || !body.data || body.data.length === 0) return "";
|
|
9
|
+
const schemas = body.data as Array<{
|
|
10
|
+
name: string;
|
|
11
|
+
fields: Record<string, { type: string; constraints?: Record<string, unknown> }>;
|
|
12
|
+
}>;
|
|
13
|
+
const lines = ["## 数据结构定义\n"];
|
|
14
|
+
for (const schema of schemas) {
|
|
15
|
+
lines.push(`### ${schema.name}`);
|
|
16
|
+
for (const [field, def] of Object.entries(schema.fields)) {
|
|
17
|
+
const constraints = def.constraints
|
|
18
|
+
? ` (${Object.entries(def.constraints).map(([k, v]) => `${k}: ${v}`).join(", ")})`
|
|
19
|
+
: "";
|
|
20
|
+
lines.push(`- ${field}: ${def.type}${constraints}`);
|
|
21
|
+
}
|
|
22
|
+
lines.push("");
|
|
23
|
+
}
|
|
24
|
+
return lines.join("\n");
|
|
25
|
+
} catch {
|
|
26
|
+
return "";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function buildSystemContext(user: { name: string } | null, appName: string | null): string {
|
|
31
|
+
const parts: string[] = [
|
|
32
|
+
"你是一个运行在 LocalApp 应用中的 AI 助手。",
|
|
33
|
+
];
|
|
34
|
+
if (appName) {
|
|
35
|
+
parts.push(`当前应用: ${appName}`);
|
|
36
|
+
}
|
|
37
|
+
parts.push(`当前用户: ${user?.name ?? "未登录"}`);
|
|
38
|
+
parts.push("");
|
|
39
|
+
parts.push("## 工具使用规则");
|
|
40
|
+
parts.push("当用户的需求可以映射到工具操作时,必须调用工具执行,不要仅给文字建议。");
|
|
41
|
+
parts.push("信息不完整时,先询问缺失的必填参数,收集完整后立即调用工具。");
|
|
42
|
+
parts.push("");
|
|
43
|
+
parts.push("请用中文回复用户。");
|
|
44
|
+
return parts.join("\n");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function buildSystemPrompt(systemContext: string, schemaContext: string, hint?: string): string {
|
|
48
|
+
const parts: string[] = [systemContext];
|
|
49
|
+
if (schemaContext) {
|
|
50
|
+
parts.push(schemaContext);
|
|
51
|
+
}
|
|
52
|
+
if (hint) {
|
|
53
|
+
parts.push(hint);
|
|
54
|
+
}
|
|
55
|
+
return parts.join("\n\n");
|
|
56
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ToolSchema } from "./postmessage-types.js";
|
|
2
|
+
|
|
3
|
+
type ExecuteFn = (args: Record<string, unknown>) => Promise<unknown>;
|
|
4
|
+
|
|
5
|
+
export interface DevShellRegistry {
|
|
6
|
+
registerTools: (tools: ToolSchema[], executeFns: Record<string, ExecuteFn>, systemHint?: string) => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const GLOBAL_KEY = "__LOCALAPP_DEV_SHELL__";
|
|
10
|
+
|
|
11
|
+
export function getDevRegistry(): DevShellRegistry | undefined {
|
|
12
|
+
return (globalThis as Record<string, unknown>)[GLOBAL_KEY] as DevShellRegistry | undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function setDevRegistry(registry: DevShellRegistry): void {
|
|
16
|
+
(globalThis as Record<string, unknown>)[GLOBAL_KEY] = registry;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function isDevMode(): boolean {
|
|
20
|
+
return getDevRegistry() !== undefined;
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { useAgent, parseAppName, fetchUser } from "./use-agent.js";
|
|
2
|
+
export { AgentChat } from "./agent-chat.js";
|
|
3
|
+
export { useRegisterTools, registerToolsForShell } from "./use-register-tools.js";
|
|
4
|
+
export { useRegisterEditSession, registerEditSessionForShell } from "./use-register-edit-session.js";
|
|
5
|
+
export { buildSystemContext, buildSystemPrompt, fetchSchemaContext } from "./context.js";
|
|
6
|
+
export { convertMessages } from "./assistant-ui-adapter.js";
|
|
7
|
+
export { createStreamFn } from "./llm-adapter.js";
|
|
8
|
+
export { createSystemTools, convertUserTool } from "./tools.js";
|
|
9
|
+
export { createPlatformRuntime, platform, isPlatformResponseMessage } from "./platform-runtime.js";
|
|
10
|
+
export type { UseAgentOptions, UseAgentReturn, UserToolDef } from "./types.js";
|
|
11
|
+
export type { PlatformRuntime, PlatformUser, DownloadFileOptions, OpenRouteOptions, ConfirmOptions } from "./platform-runtime.js";
|
|
12
|
+
export type { UseRegisterToolsOptions } from "./use-register-tools.js";
|
|
13
|
+
export type { PlatformEditSession, PlatformEditSessionRegistry, PlatformToolRegistry, NativeToolExecute } from "./native-registry.js";
|
|
14
|
+
export type { PlatformEditSessionInput } from "./use-register-edit-session.js";
|
|
15
|
+
export { getPlatformToolRegistry, setPlatformToolRegistry, isPlatformToolRegistryAvailable, getPlatformEditSessionRegistry, setPlatformEditSessionRegistry, isPlatformEditSessionRegistryAvailable } from "./native-registry.js";
|
|
16
|
+
export type { ToolSchema, RegisterToolsMessage, ToolCallMessage, ToolResultMessage, AiCustomModeMessage, ToggleChatMessage, HideShellMessage, PlatformCapability, PlatformRequestMessage, PlatformResponseMessage } from "./postmessage-types.js";
|
|
17
|
+
export { getDevRegistry, setDevRegistry, isDevMode } from "./dev-bridge.js";
|
|
18
|
+
export { isRegisterToolsMessage, isAiCustomModeMessage, isToolResultMessage, isToolCallMessage, isToggleChatMessage, isHideShellMessage, isPlatformRequestMessage, postToParent, postToIframe, hideShell } from "./postmessage-types.js";
|
|
19
|
+
export type { DevShellRegistry } from "./dev-bridge.js";
|