@tianshu-ai/tianshu 0.3.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/LICENSE +200 -0
- package/README.md +284 -0
- package/README.zh-CN.md +136 -0
- package/bin/tianshu.mjs +32 -0
- package/package.json +60 -0
- package/packages/plugin-sdk/dist/agent-loop.d.ts +96 -0
- package/packages/plugin-sdk/dist/agent-loop.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/agent-loop.js +11 -0
- package/packages/plugin-sdk/dist/agent-loop.js.map +1 -0
- package/packages/plugin-sdk/dist/capabilities.d.ts +48 -0
- package/packages/plugin-sdk/dist/capabilities.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/capabilities.js +61 -0
- package/packages/plugin-sdk/dist/capabilities.js.map +1 -0
- package/packages/plugin-sdk/dist/catalog.d.ts +60 -0
- package/packages/plugin-sdk/dist/catalog.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/catalog.js +11 -0
- package/packages/plugin-sdk/dist/catalog.js.map +1 -0
- package/packages/plugin-sdk/dist/client.d.ts +171 -0
- package/packages/plugin-sdk/dist/client.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/client.js +96 -0
- package/packages/plugin-sdk/dist/client.js.map +1 -0
- package/packages/plugin-sdk/dist/index.d.ts +9 -0
- package/packages/plugin-sdk/dist/index.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/index.js +19 -0
- package/packages/plugin-sdk/dist/index.js.map +1 -0
- package/packages/plugin-sdk/dist/lsp.d.ts +32 -0
- package/packages/plugin-sdk/dist/lsp.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/lsp.js +19 -0
- package/packages/plugin-sdk/dist/lsp.js.map +1 -0
- package/packages/plugin-sdk/dist/manifest.d.ts +423 -0
- package/packages/plugin-sdk/dist/manifest.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/manifest.js +7 -0
- package/packages/plugin-sdk/dist/manifest.js.map +1 -0
- package/packages/plugin-sdk/dist/mcp-client.d.ts +74 -0
- package/packages/plugin-sdk/dist/mcp-client.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/mcp-client.js +226 -0
- package/packages/plugin-sdk/dist/mcp-client.js.map +1 -0
- package/packages/plugin-sdk/dist/mcp-fetch.d.ts +10 -0
- package/packages/plugin-sdk/dist/mcp-fetch.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/mcp-fetch.js +130 -0
- package/packages/plugin-sdk/dist/mcp-fetch.js.map +1 -0
- package/packages/plugin-sdk/dist/mcp-toolset.d.ts +128 -0
- package/packages/plugin-sdk/dist/mcp-toolset.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/mcp-toolset.js +246 -0
- package/packages/plugin-sdk/dist/mcp-toolset.js.map +1 -0
- package/packages/plugin-sdk/dist/server.d.ts +486 -0
- package/packages/plugin-sdk/dist/server.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/server.js +10 -0
- package/packages/plugin-sdk/dist/server.js.map +1 -0
- package/packages/plugin-sdk/dist/session-inbox.d.ts +56 -0
- package/packages/plugin-sdk/dist/session-inbox.d.ts.map +1 -0
- package/packages/plugin-sdk/dist/session-inbox.js +12 -0
- package/packages/plugin-sdk/dist/session-inbox.js.map +1 -0
- package/packages/plugin-sdk/package.json +36 -0
- package/packages/server/builtinConfig/plugins/README.md +1 -0
- package/packages/server/builtinConfig/plugins/files/manifest.json +100 -0
- package/packages/server/builtinConfig/plugins/files/skills/files-workspace-layout.md +29 -0
- package/packages/server/builtinConfig/plugins/microsandbox/manifest.json +177 -0
- package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-browser-howto.md +155 -0
- package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-build-use.md +201 -0
- package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-config.md +38 -0
- package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-exec-howto.md +144 -0
- package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-libreoffice.md +159 -0
- package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-main-orchestration.md +75 -0
- package/packages/server/builtinConfig/plugins/microsandbox/templates/README.md +26 -0
- package/packages/server/builtinConfig/plugins/microsandbox/templates/browser.yaml +105 -0
- package/packages/server/builtinConfig/plugins/microsandbox/templates/task-runner-with-browser.yaml +80 -0
- package/packages/server/builtinConfig/plugins/microsandbox/templates/task-runner.yaml +80 -0
- package/packages/server/builtinConfig/plugins/web-search/manifest.json +65 -0
- package/packages/server/builtinConfig/plugins/web-search/skills/web-search-howto.md +69 -0
- package/packages/server/builtinConfig/plugins/workboard/agent-seeds/echo-demo/agent.json +7 -0
- package/packages/server/builtinConfig/plugins/workboard/agent-seeds/llm-default/SOUL.md +53 -0
- package/packages/server/builtinConfig/plugins/workboard/agent-seeds/llm-default/agent.json +7 -0
- package/packages/server/builtinConfig/plugins/workboard/manifest.json +180 -0
- package/packages/server/builtinConfig/plugins/workboard/skills/large-input-large-output.md +185 -0
- package/packages/server/builtinConfig/plugins/workboard/skills/workboard-howto.md +166 -0
- package/packages/server/builtinConfig/plugins/workboard/skills/worker-creator.md +267 -0
- package/packages/server/builtinConfig/plugins/workboard/skills/worker-fleet.md +431 -0
- package/packages/server/dist/catalog.d.ts +52 -0
- package/packages/server/dist/catalog.d.ts.map +1 -0
- package/packages/server/dist/catalog.js +189 -0
- package/packages/server/dist/catalog.js.map +1 -0
- package/packages/server/dist/chat/active-harnesses.d.ts +34 -0
- package/packages/server/dist/chat/active-harnesses.d.ts.map +1 -0
- package/packages/server/dist/chat/active-harnesses.js +118 -0
- package/packages/server/dist/chat/active-harnesses.js.map +1 -0
- package/packages/server/dist/chat/agent-loop.d.ts +64 -0
- package/packages/server/dist/chat/agent-loop.d.ts.map +1 -0
- package/packages/server/dist/chat/agent-loop.js +597 -0
- package/packages/server/dist/chat/agent-loop.js.map +1 -0
- package/packages/server/dist/chat/agent-tool-adapter.d.ts +33 -0
- package/packages/server/dist/chat/agent-tool-adapter.d.ts.map +1 -0
- package/packages/server/dist/chat/agent-tool-adapter.js +260 -0
- package/packages/server/dist/chat/agent-tool-adapter.js.map +1 -0
- package/packages/server/dist/chat/compact.d.ts +52 -0
- package/packages/server/dist/chat/compact.d.ts.map +1 -0
- package/packages/server/dist/chat/compact.js +248 -0
- package/packages/server/dist/chat/compact.js.map +1 -0
- package/packages/server/dist/chat/dump-system-prompt.d.ts +17 -0
- package/packages/server/dist/chat/dump-system-prompt.d.ts.map +1 -0
- package/packages/server/dist/chat/dump-system-prompt.js +58 -0
- package/packages/server/dist/chat/dump-system-prompt.js.map +1 -0
- package/packages/server/dist/chat/handler.d.ts +186 -0
- package/packages/server/dist/chat/handler.d.ts.map +1 -0
- package/packages/server/dist/chat/handler.js +1248 -0
- package/packages/server/dist/chat/handler.js.map +1 -0
- package/packages/server/dist/chat/image-fit.d.ts +34 -0
- package/packages/server/dist/chat/image-fit.d.ts.map +1 -0
- package/packages/server/dist/chat/image-fit.js +157 -0
- package/packages/server/dist/chat/image-fit.js.map +1 -0
- package/packages/server/dist/chat/messages.d.ts +118 -0
- package/packages/server/dist/chat/messages.d.ts.map +1 -0
- package/packages/server/dist/chat/messages.js +341 -0
- package/packages/server/dist/chat/messages.js.map +1 -0
- package/packages/server/dist/chat/session-inbox.d.ts +114 -0
- package/packages/server/dist/chat/session-inbox.d.ts.map +1 -0
- package/packages/server/dist/chat/session-inbox.js +418 -0
- package/packages/server/dist/chat/session-inbox.js.map +1 -0
- package/packages/server/dist/chat/sqlite-session-repo.d.ts +26 -0
- package/packages/server/dist/chat/sqlite-session-repo.d.ts.map +1 -0
- package/packages/server/dist/chat/sqlite-session-repo.js +132 -0
- package/packages/server/dist/chat/sqlite-session-repo.js.map +1 -0
- package/packages/server/dist/chat/sqlite-session-storage.d.ts +83 -0
- package/packages/server/dist/chat/sqlite-session-storage.d.ts.map +1 -0
- package/packages/server/dist/chat/sqlite-session-storage.js +418 -0
- package/packages/server/dist/chat/sqlite-session-storage.js.map +1 -0
- package/packages/server/dist/chat/stub-execution-env.d.ts +3 -0
- package/packages/server/dist/chat/stub-execution-env.d.ts.map +1 -0
- package/packages/server/dist/chat/stub-execution-env.js +87 -0
- package/packages/server/dist/chat/stub-execution-env.js.map +1 -0
- package/packages/server/dist/chat/token-estimate.d.ts +11 -0
- package/packages/server/dist/chat/token-estimate.d.ts.map +1 -0
- package/packages/server/dist/chat/token-estimate.js +67 -0
- package/packages/server/dist/chat/token-estimate.js.map +1 -0
- package/packages/server/dist/chat/ws-protocol.d.ts +244 -0
- package/packages/server/dist/chat/ws-protocol.d.ts.map +1 -0
- package/packages/server/dist/chat/ws-protocol.js +193 -0
- package/packages/server/dist/chat/ws-protocol.js.map +1 -0
- package/packages/server/dist/cli.d.ts +9 -0
- package/packages/server/dist/cli.d.ts.map +1 -0
- package/packages/server/dist/cli.js +329 -0
- package/packages/server/dist/cli.js.map +1 -0
- package/packages/server/dist/core/agent-seeds.d.ts +25 -0
- package/packages/server/dist/core/agent-seeds.d.ts.map +1 -0
- package/packages/server/dist/core/agent-seeds.js +69 -0
- package/packages/server/dist/core/agent-seeds.js.map +1 -0
- package/packages/server/dist/core/config.d.ts +172 -0
- package/packages/server/dist/core/config.d.ts.map +1 -0
- package/packages/server/dist/core/config.js +155 -0
- package/packages/server/dist/core/config.js.map +1 -0
- package/packages/server/dist/core/db-pool.d.ts +32 -0
- package/packages/server/dist/core/db-pool.d.ts.map +1 -0
- package/packages/server/dist/core/db-pool.js +108 -0
- package/packages/server/dist/core/db-pool.js.map +1 -0
- package/packages/server/dist/core/dev-mode.d.ts +13 -0
- package/packages/server/dist/core/dev-mode.d.ts.map +1 -0
- package/packages/server/dist/core/dev-mode.js +51 -0
- package/packages/server/dist/core/dev-mode.js.map +1 -0
- package/packages/server/dist/core/global-ops.d.ts +54 -0
- package/packages/server/dist/core/global-ops.d.ts.map +1 -0
- package/packages/server/dist/core/global-ops.js +143 -0
- package/packages/server/dist/core/global-ops.js.map +1 -0
- package/packages/server/dist/core/identity-resolvers.d.ts +102 -0
- package/packages/server/dist/core/identity-resolvers.d.ts.map +1 -0
- package/packages/server/dist/core/identity-resolvers.js +176 -0
- package/packages/server/dist/core/identity-resolvers.js.map +1 -0
- package/packages/server/dist/core/index.d.ts +13 -0
- package/packages/server/dist/core/index.d.ts.map +1 -0
- package/packages/server/dist/core/index.js +18 -0
- package/packages/server/dist/core/index.js.map +1 -0
- package/packages/server/dist/core/llm.d.ts +45 -0
- package/packages/server/dist/core/llm.d.ts.map +1 -0
- package/packages/server/dist/core/llm.js +140 -0
- package/packages/server/dist/core/llm.js.map +1 -0
- package/packages/server/dist/core/mcp-manager.d.ts +47 -0
- package/packages/server/dist/core/mcp-manager.d.ts.map +1 -0
- package/packages/server/dist/core/mcp-manager.js +129 -0
- package/packages/server/dist/core/mcp-manager.js.map +1 -0
- package/packages/server/dist/core/middleware.d.ts +31 -0
- package/packages/server/dist/core/middleware.d.ts.map +1 -0
- package/packages/server/dist/core/middleware.js +102 -0
- package/packages/server/dist/core/middleware.js.map +1 -0
- package/packages/server/dist/core/migrations/001-initial.d.ts +4 -0
- package/packages/server/dist/core/migrations/001-initial.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/001-initial.js +66 -0
- package/packages/server/dist/core/migrations/001-initial.js.map +1 -0
- package/packages/server/dist/core/migrations/002-task-dependencies.d.ts +4 -0
- package/packages/server/dist/core/migrations/002-task-dependencies.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/002-task-dependencies.js +20 -0
- package/packages/server/dist/core/migrations/002-task-dependencies.js.map +1 -0
- package/packages/server/dist/core/migrations/003-session-tree.d.ts +4 -0
- package/packages/server/dist/core/migrations/003-session-tree.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/003-session-tree.js +96 -0
- package/packages/server/dist/core/migrations/003-session-tree.js.map +1 -0
- package/packages/server/dist/core/migrations/003-worker-agents.d.ts +4 -0
- package/packages/server/dist/core/migrations/003-worker-agents.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/003-worker-agents.js +65 -0
- package/packages/server/dist/core/migrations/003-worker-agents.js.map +1 -0
- package/packages/server/dist/core/migrations/004-rebuild-message-chain.d.ts +4 -0
- package/packages/server/dist/core/migrations/004-rebuild-message-chain.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/004-rebuild-message-chain.js +52 -0
- package/packages/server/dist/core/migrations/004-rebuild-message-chain.js.map +1 -0
- package/packages/server/dist/core/migrations/005-task-status-rename.d.ts +4 -0
- package/packages/server/dist/core/migrations/005-task-status-rename.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/005-task-status-rename.js +64 -0
- package/packages/server/dist/core/migrations/005-task-status-rename.js.map +1 -0
- package/packages/server/dist/core/migrations/006-task-labels.d.ts +4 -0
- package/packages/server/dist/core/migrations/006-task-labels.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/006-task-labels.js +43 -0
- package/packages/server/dist/core/migrations/006-task-labels.js.map +1 -0
- package/packages/server/dist/core/migrations/007-session-inbox.d.ts +4 -0
- package/packages/server/dist/core/migrations/007-session-inbox.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/007-session-inbox.js +67 -0
- package/packages/server/dist/core/migrations/007-session-inbox.js.map +1 -0
- package/packages/server/dist/core/migrations/008-task-intervention.d.ts +4 -0
- package/packages/server/dist/core/migrations/008-task-intervention.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/008-task-intervention.js +60 -0
- package/packages/server/dist/core/migrations/008-task-intervention.js.map +1 -0
- package/packages/server/dist/core/migrations/index.d.ts +12 -0
- package/packages/server/dist/core/migrations/index.d.ts.map +1 -0
- package/packages/server/dist/core/migrations/index.js +58 -0
- package/packages/server/dist/core/migrations/index.js.map +1 -0
- package/packages/server/dist/core/paths.d.ts +53 -0
- package/packages/server/dist/core/paths.d.ts.map +1 -0
- package/packages/server/dist/core/paths.js +125 -0
- package/packages/server/dist/core/paths.js.map +1 -0
- package/packages/server/dist/core/plugins/builtin-loader.d.ts +56 -0
- package/packages/server/dist/core/plugins/builtin-loader.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/builtin-loader.js +153 -0
- package/packages/server/dist/core/plugins/builtin-loader.js.map +1 -0
- package/packages/server/dist/core/plugins/discovery.d.ts +28 -0
- package/packages/server/dist/core/plugins/discovery.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/discovery.js +97 -0
- package/packages/server/dist/core/plugins/discovery.js.map +1 -0
- package/packages/server/dist/core/plugins/index.d.ts +6 -0
- package/packages/server/dist/core/plugins/index.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/index.js +6 -0
- package/packages/server/dist/core/plugins/index.js.map +1 -0
- package/packages/server/dist/core/plugins/manifest.d.ts +9 -0
- package/packages/server/dist/core/plugins/manifest.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/manifest.js +584 -0
- package/packages/server/dist/core/plugins/manifest.js.map +1 -0
- package/packages/server/dist/core/plugins/registry.d.ts +269 -0
- package/packages/server/dist/core/plugins/registry.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/registry.js +1003 -0
- package/packages/server/dist/core/plugins/registry.js.map +1 -0
- package/packages/server/dist/core/plugins/secrets.d.ts +46 -0
- package/packages/server/dist/core/plugins/secrets.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/secrets.js +174 -0
- package/packages/server/dist/core/plugins/secrets.js.map +1 -0
- package/packages/server/dist/core/plugins/skills.d.ts +131 -0
- package/packages/server/dist/core/plugins/skills.d.ts.map +1 -0
- package/packages/server/dist/core/plugins/skills.js +389 -0
- package/packages/server/dist/core/plugins/skills.js.map +1 -0
- package/packages/server/dist/core/templates.d.ts +28 -0
- package/packages/server/dist/core/templates.d.ts.map +1 -0
- package/packages/server/dist/core/templates.js +103 -0
- package/packages/server/dist/core/templates.js.map +1 -0
- package/packages/server/dist/core/tenant-context.d.ts +18 -0
- package/packages/server/dist/core/tenant-context.d.ts.map +1 -0
- package/packages/server/dist/core/tenant-context.js +42 -0
- package/packages/server/dist/core/tenant-context.js.map +1 -0
- package/packages/server/dist/core/tenant-id.d.ts +8 -0
- package/packages/server/dist/core/tenant-id.d.ts.map +1 -0
- package/packages/server/dist/core/tenant-id.js +53 -0
- package/packages/server/dist/core/tenant-id.js.map +1 -0
- package/packages/server/dist/core/tenant-skills.d.ts +29 -0
- package/packages/server/dist/core/tenant-skills.d.ts.map +1 -0
- package/packages/server/dist/core/tenant-skills.js +77 -0
- package/packages/server/dist/core/tenant-skills.js.map +1 -0
- package/packages/server/dist/core/worker-agents-fs.d.ts +44 -0
- package/packages/server/dist/core/worker-agents-fs.d.ts.map +1 -0
- package/packages/server/dist/core/worker-agents-fs.js +86 -0
- package/packages/server/dist/core/worker-agents-fs.js.map +1 -0
- package/packages/server/dist/core/worker-agents.d.ts +77 -0
- package/packages/server/dist/core/worker-agents.d.ts.map +1 -0
- package/packages/server/dist/core/worker-agents.js +191 -0
- package/packages/server/dist/core/worker-agents.js.map +1 -0
- package/packages/server/dist/index.d.ts +2 -0
- package/packages/server/dist/index.d.ts.map +1 -0
- package/packages/server/dist/index.js +623 -0
- package/packages/server/dist/index.js.map +1 -0
- package/packages/server/dist/lsp/client.d.ts +53 -0
- package/packages/server/dist/lsp/client.d.ts.map +1 -0
- package/packages/server/dist/lsp/client.js +258 -0
- package/packages/server/dist/lsp/client.js.map +1 -0
- package/packages/server/dist/lsp/format.d.ts +13 -0
- package/packages/server/dist/lsp/format.d.ts.map +1 -0
- package/packages/server/dist/lsp/format.js +55 -0
- package/packages/server/dist/lsp/format.js.map +1 -0
- package/packages/server/dist/lsp/index.d.ts +20 -0
- package/packages/server/dist/lsp/index.d.ts.map +1 -0
- package/packages/server/dist/lsp/index.js +32 -0
- package/packages/server/dist/lsp/index.js.map +1 -0
- package/packages/server/dist/lsp/language-registry.d.ts +29 -0
- package/packages/server/dist/lsp/language-registry.d.ts.map +1 -0
- package/packages/server/dist/lsp/language-registry.js +62 -0
- package/packages/server/dist/lsp/language-registry.js.map +1 -0
- package/packages/server/dist/lsp/manager.d.ts +77 -0
- package/packages/server/dist/lsp/manager.d.ts.map +1 -0
- package/packages/server/dist/lsp/manager.js +300 -0
- package/packages/server/dist/lsp/manager.js.map +1 -0
- package/packages/server/dist/plugins-routes.d.ts +96 -0
- package/packages/server/dist/plugins-routes.d.ts.map +1 -0
- package/packages/server/dist/plugins-routes.js +627 -0
- package/packages/server/dist/plugins-routes.js.map +1 -0
- package/packages/server/dist/setup/checks/config.d.ts +9 -0
- package/packages/server/dist/setup/checks/config.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/config.js +66 -0
- package/packages/server/dist/setup/checks/config.js.map +1 -0
- package/packages/server/dist/setup/checks/db.d.ts +6 -0
- package/packages/server/dist/setup/checks/db.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/db.js +79 -0
- package/packages/server/dist/setup/checks/db.js.map +1 -0
- package/packages/server/dist/setup/checks/known-models.d.ts +18 -0
- package/packages/server/dist/setup/checks/known-models.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/known-models.js +119 -0
- package/packages/server/dist/setup/checks/known-models.js.map +1 -0
- package/packages/server/dist/setup/checks/network.d.ts +11 -0
- package/packages/server/dist/setup/checks/network.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/network.js +176 -0
- package/packages/server/dist/setup/checks/network.js.map +1 -0
- package/packages/server/dist/setup/checks/plugins.d.ts +9 -0
- package/packages/server/dist/setup/checks/plugins.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/plugins.js +194 -0
- package/packages/server/dist/setup/checks/plugins.js.map +1 -0
- package/packages/server/dist/setup/checks/providers.d.ts +12 -0
- package/packages/server/dist/setup/checks/providers.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/providers.js +368 -0
- package/packages/server/dist/setup/checks/providers.js.map +1 -0
- package/packages/server/dist/setup/checks/runtime.d.ts +3 -0
- package/packages/server/dist/setup/checks/runtime.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/runtime.js +44 -0
- package/packages/server/dist/setup/checks/runtime.js.map +1 -0
- package/packages/server/dist/setup/checks/sandbox.d.ts +9 -0
- package/packages/server/dist/setup/checks/sandbox.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/sandbox.js +110 -0
- package/packages/server/dist/setup/checks/sandbox.js.map +1 -0
- package/packages/server/dist/setup/checks/tenants.d.ts +9 -0
- package/packages/server/dist/setup/checks/tenants.d.ts.map +1 -0
- package/packages/server/dist/setup/checks/tenants.js +509 -0
- package/packages/server/dist/setup/checks/tenants.js.map +1 -0
- package/packages/server/dist/setup/cli-agent.d.ts +39 -0
- package/packages/server/dist/setup/cli-agent.d.ts.map +1 -0
- package/packages/server/dist/setup/cli-agent.js +1353 -0
- package/packages/server/dist/setup/cli-agent.js.map +1 -0
- package/packages/server/dist/setup/doctor.d.ts +32 -0
- package/packages/server/dist/setup/doctor.d.ts.map +1 -0
- package/packages/server/dist/setup/doctor.js +80 -0
- package/packages/server/dist/setup/doctor.js.map +1 -0
- package/packages/server/dist/setup/launchd.d.ts +107 -0
- package/packages/server/dist/setup/launchd.d.ts.map +1 -0
- package/packages/server/dist/setup/launchd.js +309 -0
- package/packages/server/dist/setup/launchd.js.map +1 -0
- package/packages/server/dist/setup/load-env.d.ts +21 -0
- package/packages/server/dist/setup/load-env.d.ts.map +1 -0
- package/packages/server/dist/setup/load-env.js +88 -0
- package/packages/server/dist/setup/load-env.js.map +1 -0
- package/packages/server/dist/setup/probe-default-model.d.ts +28 -0
- package/packages/server/dist/setup/probe-default-model.d.ts.map +1 -0
- package/packages/server/dist/setup/probe-default-model.js +133 -0
- package/packages/server/dist/setup/probe-default-model.js.map +1 -0
- package/packages/server/dist/setup/render.d.ts +28 -0
- package/packages/server/dist/setup/render.d.ts.map +1 -0
- package/packages/server/dist/setup/render.js +60 -0
- package/packages/server/dist/setup/render.js.map +1 -0
- package/packages/server/dist/setup/repo-root.d.ts +3 -0
- package/packages/server/dist/setup/repo-root.d.ts.map +1 -0
- package/packages/server/dist/setup/repo-root.js +43 -0
- package/packages/server/dist/setup/repo-root.js.map +1 -0
- package/packages/server/dist/setup/service.d.ts +60 -0
- package/packages/server/dist/setup/service.d.ts.map +1 -0
- package/packages/server/dist/setup/service.js +345 -0
- package/packages/server/dist/setup/service.js.map +1 -0
- package/packages/server/dist/setup/start-server.d.ts +23 -0
- package/packages/server/dist/setup/start-server.d.ts.map +1 -0
- package/packages/server/dist/setup/start-server.js +465 -0
- package/packages/server/dist/setup/start-server.js.map +1 -0
- package/packages/server/dist/setup/wizard.d.ts +59 -0
- package/packages/server/dist/setup/wizard.d.ts.map +1 -0
- package/packages/server/dist/setup/wizard.js +556 -0
- package/packages/server/dist/setup/wizard.js.map +1 -0
- package/packages/server/dist/tools/edit-file.d.ts +13 -0
- package/packages/server/dist/tools/edit-file.d.ts.map +1 -0
- package/packages/server/dist/tools/edit-file.js +90 -0
- package/packages/server/dist/tools/edit-file.js.map +1 -0
- package/packages/server/dist/tools/glob.d.ts +12 -0
- package/packages/server/dist/tools/glob.d.ts.map +1 -0
- package/packages/server/dist/tools/glob.js +82 -0
- package/packages/server/dist/tools/glob.js.map +1 -0
- package/packages/server/dist/tools/index.d.ts +82 -0
- package/packages/server/dist/tools/index.d.ts.map +1 -0
- package/packages/server/dist/tools/index.js +72 -0
- package/packages/server/dist/tools/index.js.map +1 -0
- package/packages/server/dist/tools/list-dir.d.ts +24 -0
- package/packages/server/dist/tools/list-dir.d.ts.map +1 -0
- package/packages/server/dist/tools/list-dir.js +99 -0
- package/packages/server/dist/tools/list-dir.js.map +1 -0
- package/packages/server/dist/tools/path-helper.d.ts +15 -0
- package/packages/server/dist/tools/path-helper.d.ts.map +1 -0
- package/packages/server/dist/tools/path-helper.js +72 -0
- package/packages/server/dist/tools/path-helper.js.map +1 -0
- package/packages/server/dist/tools/read-file.d.ts +17 -0
- package/packages/server/dist/tools/read-file.d.ts.map +1 -0
- package/packages/server/dist/tools/read-file.js +94 -0
- package/packages/server/dist/tools/read-file.js.map +1 -0
- package/packages/server/dist/tools/sandbox.d.ts +57 -0
- package/packages/server/dist/tools/sandbox.d.ts.map +1 -0
- package/packages/server/dist/tools/sandbox.js +291 -0
- package/packages/server/dist/tools/sandbox.js.map +1 -0
- package/packages/server/dist/tools/write-file.d.ts +12 -0
- package/packages/server/dist/tools/write-file.d.ts.map +1 -0
- package/packages/server/dist/tools/write-file.js +67 -0
- package/packages/server/dist/tools/write-file.js.map +1 -0
- package/packages/server/dist/worker-agents-routes.d.ts +11 -0
- package/packages/server/dist/worker-agents-routes.d.ts.map +1 -0
- package/packages/server/dist/worker-agents-routes.js +253 -0
- package/packages/server/dist/worker-agents-routes.js.map +1 -0
- package/packages/server/package.json +41 -0
- package/packages/web/dist/assets/index-DH-gJ09_.js +60 -0
- package/packages/web/dist/assets/index-xU4lYYqY.css +2 -0
- package/packages/web/dist/index.html +14 -0
- package/packages/web/package.json +36 -0
- package/plugins/README.md +64 -0
- package/plugins/files/dist/client.d.ts +5 -0
- package/plugins/files/dist/client.d.ts.map +1 -0
- package/plugins/files/dist/client.js +354 -0
- package/plugins/files/dist/client.js.map +1 -0
- package/plugins/files/dist/server.d.ts +32 -0
- package/plugins/files/dist/server.d.ts.map +1 -0
- package/plugins/files/dist/server.js +514 -0
- package/plugins/files/dist/server.js.map +1 -0
- package/plugins/files/dist/tools/edit-file.d.ts +29 -0
- package/plugins/files/dist/tools/edit-file.d.ts.map +1 -0
- package/plugins/files/dist/tools/edit-file.js +230 -0
- package/plugins/files/dist/tools/edit-file.js.map +1 -0
- package/plugins/files/dist/tools/edit-file.prompt.md +36 -0
- package/plugins/files/dist/tools/glob.d.ts +12 -0
- package/plugins/files/dist/tools/glob.d.ts.map +1 -0
- package/plugins/files/dist/tools/glob.js +84 -0
- package/plugins/files/dist/tools/glob.js.map +1 -0
- package/plugins/files/dist/tools/index.d.ts +13 -0
- package/plugins/files/dist/tools/index.d.ts.map +1 -0
- package/plugins/files/dist/tools/index.js +158 -0
- package/plugins/files/dist/tools/index.js.map +1 -0
- package/plugins/files/dist/tools/list-dir.d.ts +24 -0
- package/plugins/files/dist/tools/list-dir.d.ts.map +1 -0
- package/plugins/files/dist/tools/list-dir.js +104 -0
- package/plugins/files/dist/tools/list-dir.js.map +1 -0
- package/plugins/files/dist/tools/load-prompt.d.ts +5 -0
- package/plugins/files/dist/tools/load-prompt.d.ts.map +1 -0
- package/plugins/files/dist/tools/load-prompt.js +39 -0
- package/plugins/files/dist/tools/load-prompt.js.map +1 -0
- package/plugins/files/dist/tools/path-helper.d.ts +32 -0
- package/plugins/files/dist/tools/path-helper.d.ts.map +1 -0
- package/plugins/files/dist/tools/path-helper.js +113 -0
- package/plugins/files/dist/tools/path-helper.js.map +1 -0
- package/plugins/files/dist/tools/read-file.d.ts +17 -0
- package/plugins/files/dist/tools/read-file.d.ts.map +1 -0
- package/plugins/files/dist/tools/read-file.js +109 -0
- package/plugins/files/dist/tools/read-file.js.map +1 -0
- package/plugins/files/dist/tools/read-tracker.d.ts +28 -0
- package/plugins/files/dist/tools/read-tracker.d.ts.map +1 -0
- package/plugins/files/dist/tools/read-tracker.js +135 -0
- package/plugins/files/dist/tools/read-tracker.js.map +1 -0
- package/plugins/files/dist/tools/replacers.d.ts +27 -0
- package/plugins/files/dist/tools/replacers.d.ts.map +1 -0
- package/plugins/files/dist/tools/replacers.js +221 -0
- package/plugins/files/dist/tools/replacers.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-delete.d.ts +12 -0
- package/plugins/files/dist/tools/tenant-config-delete.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-delete.js +70 -0
- package/plugins/files/dist/tools/tenant-config-delete.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-edit.d.ts +25 -0
- package/plugins/files/dist/tools/tenant-config-edit.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-edit.js +142 -0
- package/plugins/files/dist/tools/tenant-config-edit.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-glob.d.ts +12 -0
- package/plugins/files/dist/tools/tenant-config-glob.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-glob.js +64 -0
- package/plugins/files/dist/tools/tenant-config-glob.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-helper.d.ts +64 -0
- package/plugins/files/dist/tools/tenant-config-helper.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-helper.js +162 -0
- package/plugins/files/dist/tools/tenant-config-helper.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-list.d.ts +20 -0
- package/plugins/files/dist/tools/tenant-config-list.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-list.js +95 -0
- package/plugins/files/dist/tools/tenant-config-list.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-read.d.ts +17 -0
- package/plugins/files/dist/tools/tenant-config-read.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-read.js +87 -0
- package/plugins/files/dist/tools/tenant-config-read.js.map +1 -0
- package/plugins/files/dist/tools/tenant-config-write.d.ts +14 -0
- package/plugins/files/dist/tools/tenant-config-write.d.ts.map +1 -0
- package/plugins/files/dist/tools/tenant-config-write.js +78 -0
- package/plugins/files/dist/tools/tenant-config-write.js.map +1 -0
- package/plugins/files/dist/tools/text-shape.d.ts +20 -0
- package/plugins/files/dist/tools/text-shape.d.ts.map +1 -0
- package/plugins/files/dist/tools/text-shape.js +57 -0
- package/plugins/files/dist/tools/text-shape.js.map +1 -0
- package/plugins/files/dist/tools/write-file.d.ts +12 -0
- package/plugins/files/dist/tools/write-file.d.ts.map +1 -0
- package/plugins/files/dist/tools/write-file.js +89 -0
- package/plugins/files/dist/tools/write-file.js.map +1 -0
- package/plugins/files/dist/tools/write-file.prompt.md +14 -0
- package/plugins/files/manifest.json +100 -0
- package/plugins/files/package.json +39 -0
- package/plugins/files/skills/files-workspace-layout.md +29 -0
- package/plugins/microsandbox/dist/admin/browser-routes.d.ts +41 -0
- package/plugins/microsandbox/dist/admin/browser-routes.d.ts.map +1 -0
- package/plugins/microsandbox/dist/admin/browser-routes.js +208 -0
- package/plugins/microsandbox/dist/admin/browser-routes.js.map +1 -0
- package/plugins/microsandbox/dist/admin/preview-exec.d.ts +38 -0
- package/plugins/microsandbox/dist/admin/preview-exec.d.ts.map +1 -0
- package/plugins/microsandbox/dist/admin/preview-exec.js +185 -0
- package/plugins/microsandbox/dist/admin/preview-exec.js.map +1 -0
- package/plugins/microsandbox/dist/admin/routes.d.ts +35 -0
- package/plugins/microsandbox/dist/admin/routes.d.ts.map +1 -0
- package/plugins/microsandbox/dist/admin/routes.js +728 -0
- package/plugins/microsandbox/dist/admin/routes.js.map +1 -0
- package/plugins/microsandbox/dist/admin/sandboxfile-io.d.ts +11 -0
- package/plugins/microsandbox/dist/admin/sandboxfile-io.d.ts.map +1 -0
- package/plugins/microsandbox/dist/admin/sandboxfile-io.js +72 -0
- package/plugins/microsandbox/dist/admin/sandboxfile-io.js.map +1 -0
- package/plugins/microsandbox/dist/admin/templates.d.ts +16 -0
- package/plugins/microsandbox/dist/admin/templates.d.ts.map +1 -0
- package/plugins/microsandbox/dist/admin/templates.js +66 -0
- package/plugins/microsandbox/dist/admin/templates.js.map +1 -0
- package/plugins/microsandbox/dist/admin.d.ts +5 -0
- package/plugins/microsandbox/dist/admin.d.ts.map +1 -0
- package/plugins/microsandbox/dist/admin.js +256 -0
- package/plugins/microsandbox/dist/admin.js.map +1 -0
- package/plugins/microsandbox/dist/build/builder.d.ts +69 -0
- package/plugins/microsandbox/dist/build/builder.d.ts.map +1 -0
- package/plugins/microsandbox/dist/build/builder.js +257 -0
- package/plugins/microsandbox/dist/build/builder.js.map +1 -0
- package/plugins/microsandbox/dist/build/metadata.d.ts +27 -0
- package/plugins/microsandbox/dist/build/metadata.d.ts.map +1 -0
- package/plugins/microsandbox/dist/build/metadata.js +55 -0
- package/plugins/microsandbox/dist/build/metadata.js.map +1 -0
- package/plugins/microsandbox/dist/build/pointer.d.ts +51 -0
- package/plugins/microsandbox/dist/build/pointer.d.ts.map +1 -0
- package/plugins/microsandbox/dist/build/pointer.js +130 -0
- package/plugins/microsandbox/dist/build/pointer.js.map +1 -0
- package/plugins/microsandbox/dist/build/sandboxfile.d.ts +15 -0
- package/plugins/microsandbox/dist/build/sandboxfile.d.ts.map +1 -0
- package/plugins/microsandbox/dist/build/sandboxfile.js +176 -0
- package/plugins/microsandbox/dist/build/sandboxfile.js.map +1 -0
- package/plugins/microsandbox/dist/client.d.ts +5 -0
- package/plugins/microsandbox/dist/client.d.ts.map +1 -0
- package/plugins/microsandbox/dist/client.js +941 -0
- package/plugins/microsandbox/dist/client.js.map +1 -0
- package/plugins/microsandbox/dist/runner/browser.d.ts +50 -0
- package/plugins/microsandbox/dist/runner/browser.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/browser.js +142 -0
- package/plugins/microsandbox/dist/runner/browser.js.map +1 -0
- package/plugins/microsandbox/dist/runner/free-port.d.ts +6 -0
- package/plugins/microsandbox/dist/runner/free-port.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/free-port.js +53 -0
- package/plugins/microsandbox/dist/runner/free-port.js.map +1 -0
- package/plugins/microsandbox/dist/runner/index.d.ts +28 -0
- package/plugins/microsandbox/dist/runner/index.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/index.js +72 -0
- package/plugins/microsandbox/dist/runner/index.js.map +1 -0
- package/plugins/microsandbox/dist/runner/microsandbox.d.ts +64 -0
- package/plugins/microsandbox/dist/runner/microsandbox.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/microsandbox.js +668 -0
- package/plugins/microsandbox/dist/runner/microsandbox.js.map +1 -0
- package/plugins/microsandbox/dist/runner/nullable.d.ts +36 -0
- package/plugins/microsandbox/dist/runner/nullable.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/nullable.js +82 -0
- package/plugins/microsandbox/dist/runner/nullable.js.map +1 -0
- package/plugins/microsandbox/dist/runner/pool.d.ts +97 -0
- package/plugins/microsandbox/dist/runner/pool.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/pool.js +494 -0
- package/plugins/microsandbox/dist/runner/pool.js.map +1 -0
- package/plugins/microsandbox/dist/runner/types.d.ts +33 -0
- package/plugins/microsandbox/dist/runner/types.d.ts.map +1 -0
- package/plugins/microsandbox/dist/runner/types.js +79 -0
- package/plugins/microsandbox/dist/runner/types.js.map +1 -0
- package/plugins/microsandbox/dist/server.d.ts +7 -0
- package/plugins/microsandbox/dist/server.d.ts.map +1 -0
- package/plugins/microsandbox/dist/server.js +276 -0
- package/plugins/microsandbox/dist/server.js.map +1 -0
- package/plugins/microsandbox/dist/tools/browser.d.ts +25 -0
- package/plugins/microsandbox/dist/tools/browser.d.ts.map +1 -0
- package/plugins/microsandbox/dist/tools/browser.js +78 -0
- package/plugins/microsandbox/dist/tools/browser.js.map +1 -0
- package/plugins/microsandbox/dist/tools/build.d.ts +5 -0
- package/plugins/microsandbox/dist/tools/build.d.ts.map +1 -0
- package/plugins/microsandbox/dist/tools/build.js +243 -0
- package/plugins/microsandbox/dist/tools/build.js.map +1 -0
- package/plugins/microsandbox/dist/tools/index.d.ts +9 -0
- package/plugins/microsandbox/dist/tools/index.d.ts.map +1 -0
- package/plugins/microsandbox/dist/tools/index.js +430 -0
- package/plugins/microsandbox/dist/tools/index.js.map +1 -0
- package/plugins/microsandbox/dist/tools/mcp-client.d.ts +63 -0
- package/plugins/microsandbox/dist/tools/mcp-client.d.ts.map +1 -0
- package/plugins/microsandbox/dist/tools/mcp-client.js +226 -0
- package/plugins/microsandbox/dist/tools/mcp-client.js.map +1 -0
- package/plugins/microsandbox/manifest.json +177 -0
- package/plugins/microsandbox/package.json +38 -0
- package/plugins/microsandbox/skills/microsandbox-browser-howto.md +155 -0
- package/plugins/microsandbox/skills/microsandbox-build-use.md +201 -0
- package/plugins/microsandbox/skills/microsandbox-config.md +38 -0
- package/plugins/microsandbox/skills/microsandbox-exec-howto.md +144 -0
- package/plugins/microsandbox/skills/microsandbox-libreoffice.md +159 -0
- package/plugins/microsandbox/templates/README.md +26 -0
- package/plugins/web-search/dist/server.d.ts +4 -0
- package/plugins/web-search/dist/server.d.ts.map +1 -0
- package/plugins/web-search/dist/server.js +73 -0
- package/plugins/web-search/dist/server.js.map +1 -0
- package/plugins/web-search/dist/tools/health.d.ts +31 -0
- package/plugins/web-search/dist/tools/health.d.ts.map +1 -0
- package/plugins/web-search/dist/tools/health.js +59 -0
- package/plugins/web-search/dist/tools/health.js.map +1 -0
- package/plugins/web-search/dist/tools/index.d.ts +3 -0
- package/plugins/web-search/dist/tools/index.d.ts.map +1 -0
- package/plugins/web-search/dist/tools/index.js +2 -0
- package/plugins/web-search/dist/tools/index.js.map +1 -0
- package/plugins/web-search/dist/tools/providers.d.ts +43 -0
- package/plugins/web-search/dist/tools/providers.d.ts.map +1 -0
- package/plugins/web-search/dist/tools/providers.js +140 -0
- package/plugins/web-search/dist/tools/providers.js.map +1 -0
- package/plugins/web-search/dist/tools/web-search.d.ts +15 -0
- package/plugins/web-search/dist/tools/web-search.d.ts.map +1 -0
- package/plugins/web-search/dist/tools/web-search.js +244 -0
- package/plugins/web-search/dist/tools/web-search.js.map +1 -0
- package/plugins/web-search/manifest.json +65 -0
- package/plugins/web-search/node_modules/@esbuild/darwin-arm64/README.md +3 -0
- package/plugins/web-search/node_modules/@esbuild/darwin-arm64/package.json +20 -0
- package/plugins/web-search/node_modules/@vitest/expect/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/expect/README.md +21 -0
- package/plugins/web-search/node_modules/@vitest/expect/dist/index.d.ts +808 -0
- package/plugins/web-search/node_modules/@vitest/expect/dist/index.js +1799 -0
- package/plugins/web-search/node_modules/@vitest/expect/package.json +46 -0
- package/plugins/web-search/node_modules/@vitest/mocker/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/mocker/README.md +5 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/auto-register.d.ts +2 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/auto-register.js +9 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/browser.d.ts +53 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/browser.js +91 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-interceptor-native.js +15 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-mocker.js +1602 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-pathe.M-eThtNZ.js +174 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-registry.js +182 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-utils.js +16 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/index.d.ts +21 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/index.js +174 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/mocker.d-Ce9_ySj5.d.ts +83 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/node.d.ts +821 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/node.js +1306 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/redirect.d.ts +3 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/redirect.js +75 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/register.d.ts +9 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/register.js +41 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/registry.d-D765pazg.d.ts +87 -0
- package/plugins/web-search/node_modules/@vitest/mocker/dist/types.d-D_aRZRdy.d.ts +8 -0
- package/plugins/web-search/node_modules/@vitest/mocker/package.json +82 -0
- package/plugins/web-search/node_modules/@vitest/pretty-format/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/pretty-format/dist/index.d.ts +119 -0
- package/plugins/web-search/node_modules/@vitest/pretty-format/dist/index.js +1387 -0
- package/plugins/web-search/node_modules/@vitest/pretty-format/package.json +44 -0
- package/plugins/web-search/node_modules/@vitest/runner/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/runner/README.md +5 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/chunk-hooks.js +2254 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/index.d.ts +261 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/index.js +6 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/tasks.d-CkscK4of.d.ts +558 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/types.d.ts +163 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/types.js +1 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/utils.d.ts +47 -0
- package/plugins/web-search/node_modules/@vitest/runner/dist/utils.js +6 -0
- package/plugins/web-search/node_modules/@vitest/runner/package.json +49 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/README.md +84 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/environment.d-DHdQ1Csl.d.ts +22 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/environment.d.ts +16 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/environment.js +40 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/index.d.ts +137 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/index.js +2305 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/manager.d.ts +18 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/manager.js +73 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/dist/rawSnapshot.d-lFsMJFUd.d.ts +61 -0
- package/plugins/web-search/node_modules/@vitest/snapshot/package.json +54 -0
- package/plugins/web-search/node_modules/@vitest/spy/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/spy/README.md +3 -0
- package/plugins/web-search/node_modules/@vitest/spy/dist/index.d.ts +356 -0
- package/plugins/web-search/node_modules/@vitest/spy/dist/index.js +191 -0
- package/plugins/web-search/node_modules/@vitest/spy/package.json +38 -0
- package/plugins/web-search/node_modules/@vitest/utils/LICENSE +21 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +158 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/diff.d.ts +104 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/diff.js +2185 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/error.d.ts +9 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/error.js +162 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/helpers.d.ts +56 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/helpers.js +251 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/index.d.ts +57 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/index.js +633 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/source-map.d.ts +139 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/source-map.js +996 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/types.d-BCElaP-c.d.ts +53 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/types.d.ts +53 -0
- package/plugins/web-search/node_modules/@vitest/utils/dist/types.js +1 -0
- package/plugins/web-search/node_modules/@vitest/utils/package.json +77 -0
- package/plugins/web-search/node_modules/chai/LICENSE +21 -0
- package/plugins/web-search/node_modules/chai/README.md +162 -0
- package/plugins/web-search/node_modules/chai/package.json +74 -0
- package/plugins/web-search/node_modules/esbuild/README.md +3 -0
- package/plugins/web-search/node_modules/esbuild/package.json +49 -0
- package/plugins/web-search/node_modules/std-env/README.md +118 -0
- package/plugins/web-search/node_modules/std-env/dist/index.cjs +1 -0
- package/plugins/web-search/node_modules/std-env/dist/index.d.cts +92 -0
- package/plugins/web-search/node_modules/std-env/dist/index.d.mts +92 -0
- package/plugins/web-search/node_modules/std-env/dist/index.d.ts +92 -0
- package/plugins/web-search/node_modules/std-env/dist/index.mjs +1 -0
- package/plugins/web-search/node_modules/std-env/package.json +46 -0
- package/plugins/web-search/node_modules/tinyexec/LICENSE +21 -0
- package/plugins/web-search/node_modules/tinyexec/README.md +256 -0
- package/plugins/web-search/node_modules/tinyexec/dist/main.cjs +575 -0
- package/plugins/web-search/node_modules/tinyexec/dist/main.d.cts +70 -0
- package/plugins/web-search/node_modules/tinyexec/dist/main.d.ts +70 -0
- package/plugins/web-search/node_modules/tinyexec/dist/main.js +578 -0
- package/plugins/web-search/node_modules/tinyexec/package.json +66 -0
- package/plugins/web-search/node_modules/tinyrainbow/README.md +28 -0
- package/plugins/web-search/node_modules/tinyrainbow/dist/browser.d.ts +8 -0
- package/plugins/web-search/node_modules/tinyrainbow/dist/browser.js +20 -0
- package/plugins/web-search/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +90 -0
- package/plugins/web-search/node_modules/tinyrainbow/dist/index-8b61d5bc.d.ts +59 -0
- package/plugins/web-search/node_modules/tinyrainbow/dist/node.d.ts +8 -0
- package/plugins/web-search/node_modules/tinyrainbow/dist/node.js +22 -0
- package/plugins/web-search/node_modules/tinyrainbow/package.json +37 -0
- package/plugins/web-search/node_modules/typescript/README.md +50 -0
- package/plugins/web-search/node_modules/typescript/package.json +120 -0
- package/plugins/web-search/node_modules/vite/README.md +20 -0
- package/plugins/web-search/node_modules/vite/dist/client/client.mjs +1106 -0
- package/plugins/web-search/node_modules/vite/dist/client/env.mjs +19 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/build.js +4 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/build2.js +5538 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/chunk.js +48 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/config.js +36065 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/config2.js +4 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/dist.js +6758 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/lib.js +377 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/logger.js +329 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts +96 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/optimizer.js +4 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/postcss-import.js +479 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/preview.js +4 -0
- package/plugins/web-search/node_modules/vite/dist/node/chunks/server.js +4 -0
- package/plugins/web-search/node_modules/vite/dist/node/cli.js +698 -0
- package/plugins/web-search/node_modules/vite/dist/node/index.d.ts +3717 -0
- package/plugins/web-search/node_modules/vite/dist/node/index.js +30 -0
- package/plugins/web-search/node_modules/vite/dist/node/module-runner.d.ts +311 -0
- package/plugins/web-search/node_modules/vite/dist/node/module-runner.js +1160 -0
- package/plugins/web-search/node_modules/vite/package.json +199 -0
- package/plugins/web-search/node_modules/vite/types/package.json +4 -0
- package/plugins/web-search/node_modules/vitest/README.md +7 -0
- package/plugins/web-search/node_modules/vitest/dist/browser.d.ts +34 -0
- package/plugins/web-search/node_modules/vitest/dist/browser.js +8 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +7 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/base.DfmxU-tU.js +38 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/benchmark.CYdenmiT.js +37 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/benchmark.d.BwvBVTda.d.ts +24 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/cac.0BJqEUeA.js +1469 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/cli-api.DWGBtMmz.js +10660 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/config.d.BKdhh7Zx.d.ts +224 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/console.CtFJOzRO.js +153 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/constants.DnKduX2e.js +44 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/coverage.DVF1vEu8.js +25 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/coverage.DfSpMS-b.js +4350 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/coverage.d.S9RMNXIe.d.ts +35 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/creator.GK6I-cL4.js +640 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +73 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/defaults.B7q_naMc.js +115 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/env.D4Lgay0q.js +8 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/environment.d.cL3nLXbE.d.ts +119 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/execute.B7h3T_Hc.js +708 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/git.BVQ8w_Sw.js +72 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/global.d.MAmajcmJ.d.ts +136 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/globals.DEHgCU4V.js +26 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.B521nVV-.js +157 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.BCWujgDG.js +231 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.CdQS2e2Q.js +37 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.CmSc2RE5.js +587 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.CwejwG0H.js +105 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.D3XRDfWc.js +213 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.VByaPkjc.js +2183 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/index.X0nbfr6-.js +6584 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/inspector.C914Efll.js +57 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/mocker.d.BE_2ls6u.d.ts +17 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/node.fjCdwEIl.js +15 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/reporters.d.BuRON0I0.d.ts +3168 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/rpc.-pEldfrD.js +83 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/runBaseTests.9Ij9_de-.js +129 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/setup-common.Dd054P77.js +60 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/suite.d.FvehnV49.d.ts +10 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/typechecker.DRKU1-1g.js +874 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/utils.CAioKnHs.js +61 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +65 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +4015 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/vite.d.BnOPPc46.d.ts +25 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/vm.BThCzidc.js +756 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/worker.d.CUgIPz9V.d.ts +176 -0
- package/plugins/web-search/node_modules/vitest/dist/chunks/worker.d.uzWsCv9X.d.ts +8 -0
- package/plugins/web-search/node_modules/vitest/dist/cli.js +27 -0
- package/plugins/web-search/node_modules/vitest/dist/config.cjs +148 -0
- package/plugins/web-search/node_modules/vitest/dist/config.d.ts +100 -0
- package/plugins/web-search/node_modules/vitest/dist/config.js +21 -0
- package/plugins/web-search/node_modules/vitest/dist/coverage.d.ts +108 -0
- package/plugins/web-search/node_modules/vitest/dist/coverage.js +34 -0
- package/plugins/web-search/node_modules/vitest/dist/environments.d.ts +26 -0
- package/plugins/web-search/node_modules/vitest/dist/environments.js +2 -0
- package/plugins/web-search/node_modules/vitest/dist/execute.d.ts +150 -0
- package/plugins/web-search/node_modules/vitest/dist/execute.js +13 -0
- package/plugins/web-search/node_modules/vitest/dist/index.d.ts +651 -0
- package/plugins/web-search/node_modules/vitest/dist/index.js +18 -0
- package/plugins/web-search/node_modules/vitest/dist/mocker.d.ts +1 -0
- package/plugins/web-search/node_modules/vitest/dist/mocker.js +1 -0
- package/plugins/web-search/node_modules/vitest/dist/node.d.ts +158 -0
- package/plugins/web-search/node_modules/vitest/dist/node.js +105 -0
- package/plugins/web-search/node_modules/vitest/dist/path.js +7 -0
- package/plugins/web-search/node_modules/vitest/dist/reporters.d.ts +25 -0
- package/plugins/web-search/node_modules/vitest/dist/reporters.js +23 -0
- package/plugins/web-search/node_modules/vitest/dist/runners.d.ts +46 -0
- package/plugins/web-search/node_modules/vitest/dist/runners.js +235 -0
- package/plugins/web-search/node_modules/vitest/dist/snapshot.d.ts +9 -0
- package/plugins/web-search/node_modules/vitest/dist/snapshot.js +4 -0
- package/plugins/web-search/node_modules/vitest/dist/spy.js +1 -0
- package/plugins/web-search/node_modules/vitest/dist/suite.d.ts +5 -0
- package/plugins/web-search/node_modules/vitest/dist/suite.js +5 -0
- package/plugins/web-search/node_modules/vitest/dist/worker.js +124 -0
- package/plugins/web-search/node_modules/vitest/dist/workers/forks.js +43 -0
- package/plugins/web-search/node_modules/vitest/dist/workers/runVmTests.js +90 -0
- package/plugins/web-search/node_modules/vitest/dist/workers/threads.js +31 -0
- package/plugins/web-search/node_modules/vitest/dist/workers/vmForks.js +47 -0
- package/plugins/web-search/node_modules/vitest/dist/workers/vmThreads.js +37 -0
- package/plugins/web-search/node_modules/vitest/dist/workers.d.ts +40 -0
- package/plugins/web-search/node_modules/vitest/dist/workers.js +30 -0
- package/plugins/web-search/node_modules/vitest/package.json +207 -0
- package/plugins/web-search/package.json +30 -0
- package/plugins/web-search/skills/web-search-howto.md +69 -0
- package/plugins/workboard/agent-seeds/echo-demo/agent.json +7 -0
- package/plugins/workboard/agent-seeds/llm-default/SOUL.md +53 -0
- package/plugins/workboard/agent-seeds/llm-default/agent.json +7 -0
- package/plugins/workboard/dist/client.d.ts +5 -0
- package/plugins/workboard/dist/client.d.ts.map +1 -0
- package/plugins/workboard/dist/client.js +895 -0
- package/plugins/workboard/dist/client.js.map +1 -0
- package/plugins/workboard/dist/db/agents.d.ts +100 -0
- package/plugins/workboard/dist/db/agents.d.ts.map +1 -0
- package/plugins/workboard/dist/db/agents.js +280 -0
- package/plugins/workboard/dist/db/agents.js.map +1 -0
- package/plugins/workboard/dist/db/schema.d.ts +3 -0
- package/plugins/workboard/dist/db/schema.d.ts.map +1 -0
- package/plugins/workboard/dist/db/schema.js +31 -0
- package/plugins/workboard/dist/db/schema.js.map +1 -0
- package/plugins/workboard/dist/db/session-history.d.ts +28 -0
- package/plugins/workboard/dist/db/session-history.d.ts.map +1 -0
- package/plugins/workboard/dist/db/session-history.js +224 -0
- package/plugins/workboard/dist/db/session-history.js.map +1 -0
- package/plugins/workboard/dist/db/tasks.d.ts +260 -0
- package/plugins/workboard/dist/db/tasks.d.ts.map +1 -0
- package/plugins/workboard/dist/db/tasks.js +451 -0
- package/plugins/workboard/dist/db/tasks.js.map +1 -0
- package/plugins/workboard/dist/db/worker-agents.d.ts +16 -0
- package/plugins/workboard/dist/db/worker-agents.d.ts.map +1 -0
- package/plugins/workboard/dist/db/worker-agents.js +62 -0
- package/plugins/workboard/dist/db/worker-agents.js.map +1 -0
- package/plugins/workboard/dist/effective-skills.d.ts +13 -0
- package/plugins/workboard/dist/effective-skills.d.ts.map +1 -0
- package/plugins/workboard/dist/effective-skills.js +126 -0
- package/plugins/workboard/dist/effective-skills.js.map +1 -0
- package/plugins/workboard/dist/fs-worker-agents.d.ts +35 -0
- package/plugins/workboard/dist/fs-worker-agents.d.ts.map +1 -0
- package/plugins/workboard/dist/fs-worker-agents.js +199 -0
- package/plugins/workboard/dist/fs-worker-agents.js.map +1 -0
- package/plugins/workboard/dist/migrate-worker-agents.d.ts +11 -0
- package/plugins/workboard/dist/migrate-worker-agents.d.ts.map +1 -0
- package/plugins/workboard/dist/migrate-worker-agents.js +89 -0
- package/plugins/workboard/dist/migrate-worker-agents.js.map +1 -0
- package/plugins/workboard/dist/routes/handlers.d.ts +106 -0
- package/plugins/workboard/dist/routes/handlers.d.ts.map +1 -0
- package/plugins/workboard/dist/routes/handlers.js +668 -0
- package/plugins/workboard/dist/routes/handlers.js.map +1 -0
- package/plugins/workboard/dist/server.d.ts +6 -0
- package/plugins/workboard/dist/server.d.ts.map +1 -0
- package/plugins/workboard/dist/server.js +368 -0
- package/plugins/workboard/dist/server.js.map +1 -0
- package/plugins/workboard/dist/tools/index.d.ts +70 -0
- package/plugins/workboard/dist/tools/index.d.ts.map +1 -0
- package/plugins/workboard/dist/tools/index.js +963 -0
- package/plugins/workboard/dist/tools/index.js.map +1 -0
- package/plugins/workboard/dist/types.d.ts +27 -0
- package/plugins/workboard/dist/types.d.ts.map +1 -0
- package/plugins/workboard/dist/types.js +16 -0
- package/plugins/workboard/dist/types.js.map +1 -0
- package/plugins/workboard/dist/worker/pool.d.ts +220 -0
- package/plugins/workboard/dist/worker/pool.d.ts.map +1 -0
- package/plugins/workboard/dist/worker/pool.js +866 -0
- package/plugins/workboard/dist/worker/pool.js.map +1 -0
- package/plugins/workboard/dist/worker/tool-policy.d.ts +27 -0
- package/plugins/workboard/dist/worker/tool-policy.d.ts.map +1 -0
- package/plugins/workboard/dist/worker/tool-policy.js +76 -0
- package/plugins/workboard/dist/worker/tool-policy.js.map +1 -0
- package/plugins/workboard/dist/worker-agents-page.d.ts +4 -0
- package/plugins/workboard/dist/worker-agents-page.d.ts.map +1 -0
- package/plugins/workboard/dist/worker-agents-page.js +193 -0
- package/plugins/workboard/dist/worker-agents-page.js.map +1 -0
- package/plugins/workboard/manifest.json +180 -0
- package/plugins/workboard/package.json +37 -0
- package/plugins/workboard/skills/large-input-large-output.md +185 -0
- package/plugins/workboard/skills/workboard-howto.md +166 -0
- package/plugins/workboard/skills/worker-creator.md +267 -0
- package/plugins/workboard/skills/worker-fleet.md +431 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { SessionMetadata, SessionStorage, SessionTreeEntry } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import type { TenantContext } from "../core/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* How `getPathToRoot` should hydrate stored `{type:"image"}` parts
|
|
5
|
+
* before handing the path back to pi's LLM call site.
|
|
6
|
+
*
|
|
7
|
+
* `userHome` is the per-user root the wire-side `path` field is
|
|
8
|
+
* relative to (e.g. `/tenant/users/<userId>`). `imageMaxBytes` is
|
|
9
|
+
* the model's encoded-base64 budget; `supportsImages` is the
|
|
10
|
+
* vision flag from `ResolvedModelInfo`.
|
|
11
|
+
*
|
|
12
|
+
* Caller leaves this unset on storages that don't drive an LLM
|
|
13
|
+
* call (manual compact, repo-level fork, tests). In that case
|
|
14
|
+
* `getPathToRoot` returns image parts with their stored shape
|
|
15
|
+
* untouched. */
|
|
16
|
+
export interface ImageInflateOptions {
|
|
17
|
+
userHome: string;
|
|
18
|
+
imageMaxBytes: number;
|
|
19
|
+
supportsImages: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface SqliteSessionMetadata extends SessionMetadata {
|
|
22
|
+
/** Tenant id. Same value for the lifetime of a session. */
|
|
23
|
+
tenantId: string;
|
|
24
|
+
/** Owner user id. */
|
|
25
|
+
userId: string;
|
|
26
|
+
/** Worker / chat / system kind, mirrors `sessions.kind`. */
|
|
27
|
+
kind: "user" | "worker" | "system";
|
|
28
|
+
/** Optional worker role tag (e.g. "llm"). */
|
|
29
|
+
workerRole: string | null;
|
|
30
|
+
/** Parent session id (for forks). */
|
|
31
|
+
parentSessionId: string | null;
|
|
32
|
+
/** Session display title. */
|
|
33
|
+
title: string | null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Sidecar slot the chat handler uses to attach `attachments[]`
|
|
37
|
+
* to the next user message the harness creates. Workboard /
|
|
38
|
+
* worker callers don't need this; chat callers set it just before
|
|
39
|
+
* `harness.prompt()` and clear it inside the consumer.
|
|
40
|
+
*
|
|
41
|
+
* Why it's a per-storage field rather than a parameter: the
|
|
42
|
+
* harness owns user-message creation, so we have no callsite to
|
|
43
|
+
* pass attachments through. The closure-style sidecar lets the
|
|
44
|
+
* storage stamp them onto the JSON for the *first* user-role
|
|
45
|
+
* message it sees, then forget.
|
|
46
|
+
*/
|
|
47
|
+
export interface PendingUserAttachments {
|
|
48
|
+
/** Cleared after the first user message lands. Subsequent
|
|
49
|
+
* user messages in the same turn (e.g. follow-up after a
|
|
50
|
+
* tool result) won't pick this up. */
|
|
51
|
+
attachments: unknown[];
|
|
52
|
+
}
|
|
53
|
+
export declare class SqliteSessionStorage implements SessionStorage<SqliteSessionMetadata> {
|
|
54
|
+
private readonly ctx;
|
|
55
|
+
private readonly sessionId;
|
|
56
|
+
/** Optional: when set, the next user-role message persisted
|
|
57
|
+
* through `appendEntry` gets the `attachments` array spliced
|
|
58
|
+
* into its JSON content as a sibling field. Cleared after one
|
|
59
|
+
* use. */
|
|
60
|
+
pendingUserAttachments: PendingUserAttachments | null;
|
|
61
|
+
/** Optional: when set, `getPathToRoot` reads the bytes for every
|
|
62
|
+
* `{type:"image"}` part it finds in a user message, runs them
|
|
63
|
+
* through `fitToLimit`, and emits a fresh ImageContent with
|
|
64
|
+
* inline base64. Failed reads degrade to a short text note —
|
|
65
|
+
* same shape the chat handler used to write before N+6.4. */
|
|
66
|
+
imageInflate: ImageInflateOptions | null;
|
|
67
|
+
constructor(ctx: TenantContext, sessionId: string, options?: {
|
|
68
|
+
imageInflate?: ImageInflateOptions;
|
|
69
|
+
});
|
|
70
|
+
getMetadata(): Promise<SqliteSessionMetadata>;
|
|
71
|
+
getLeafId(): Promise<string | null>;
|
|
72
|
+
setLeafId(leafId: string | null): Promise<void>;
|
|
73
|
+
createEntryId(): Promise<string>;
|
|
74
|
+
appendEntry(entry: SessionTreeEntry): Promise<void>;
|
|
75
|
+
getEntry(id: string): Promise<SessionTreeEntry | undefined>;
|
|
76
|
+
findEntries<TType extends SessionTreeEntry["type"]>(type: TType): Promise<Array<Extract<SessionTreeEntry, {
|
|
77
|
+
type: TType;
|
|
78
|
+
}>>>;
|
|
79
|
+
getLabel(id: string): Promise<string | undefined>;
|
|
80
|
+
getPathToRoot(leafId: string | null): Promise<SessionTreeEntry[]>;
|
|
81
|
+
getEntries(): Promise<SessionTreeEntry[]>;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=sqlite-session-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-session-storage.d.ts","sourceRoot":"","sources":["../../src/chat/sqlite-session-storage.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAEV,eAAe,EACf,cAAc,EACd,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQtD;;;;;;;;;;;;gBAYgB;AAChB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;CACzB;AAyBD,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACnC,6CAA6C;IAC7C,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,qCAAqC;IACrC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,6BAA6B;IAC7B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,sBAAsB;IACrC;;2CAEuC;IACvC,WAAW,EAAE,OAAO,EAAE,CAAC;CACxB;AAED,qBAAa,oBACX,YAAW,cAAc,CAAC,qBAAqB,CAAC;IAgB9C,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAf5B;;;eAGW;IACX,sBAAsB,EAAE,sBAAsB,GAAG,IAAI,CAAQ;IAE7D;;;;kEAI8D;IAC9D,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAAQ;gBAG7B,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,MAAM,EAClC,OAAO,GAAE;QAAE,YAAY,CAAC,EAAE,mBAAmB,CAAA;KAAO;IAKhD,WAAW,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAoB7C,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IASnC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ/C,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAIhC,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IA0DnD,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAU3D,WAAW,CAAC,KAAK,SAAS,gBAAgB,CAAC,MAAM,CAAC,EACtD,IAAI,EAAE,KAAK,GACV,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC,CAAC;IAWvD,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAoBjD,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IA2CjE,UAAU,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAUhD"}
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
// SQLite-backed implementation of pi-agent-core's
|
|
2
|
+
// `SessionStorage<TMetadata>` interface.
|
|
3
|
+
//
|
|
4
|
+
// Why this exists: pi's harness reads/writes a session as a tree
|
|
5
|
+
// of typed entries (message, compaction, label, model_change, ...).
|
|
6
|
+
// Tianshu has its own `messages` SQLite table (extended in
|
|
7
|
+
// migration 003 with entry_type / entry_details / parent_id) and
|
|
8
|
+
// wants to keep using it — so we expose pi's interface as a thin
|
|
9
|
+
// adapter on top of the SQL.
|
|
10
|
+
//
|
|
11
|
+
// Mapping cheat sheet:
|
|
12
|
+
// pi entry | tianshu messages row
|
|
13
|
+
// ---------------------|----------------------------------------------
|
|
14
|
+
// { type: "message" } | role ∈ {user,assistant,tool},
|
|
15
|
+
// content = JSON.stringify(AgentMessage),
|
|
16
|
+
// entry_type = "message",
|
|
17
|
+
// entry_details = NULL
|
|
18
|
+
// any other type | role = "system",
|
|
19
|
+
// content = "" (unused),
|
|
20
|
+
// entry_type = entry.type,
|
|
21
|
+
// entry_details = JSON.stringify(rest of entry)
|
|
22
|
+
//
|
|
23
|
+
// `parent_id` always points at the entry that came immediately
|
|
24
|
+
// before this one in the active branch (NULL for the first entry).
|
|
25
|
+
// `sessions.leaf_id` records the most-recently-appended entry in
|
|
26
|
+
// the active branch.
|
|
27
|
+
//
|
|
28
|
+
// `findEntries(type)` reverses: pulls rows by entry_type, then
|
|
29
|
+
// reconstructs the typed entry from `entry_details` (plus core
|
|
30
|
+
// fields).
|
|
31
|
+
import { randomUUID } from "node:crypto";
|
|
32
|
+
import fs from "node:fs";
|
|
33
|
+
import path from "node:path";
|
|
34
|
+
import { cacheGet, cachePut, fitToLimit, imageFitCacheKey, } from "./image-fit.js";
|
|
35
|
+
export class SqliteSessionStorage {
|
|
36
|
+
ctx;
|
|
37
|
+
sessionId;
|
|
38
|
+
/** Optional: when set, the next user-role message persisted
|
|
39
|
+
* through `appendEntry` gets the `attachments` array spliced
|
|
40
|
+
* into its JSON content as a sibling field. Cleared after one
|
|
41
|
+
* use. */
|
|
42
|
+
pendingUserAttachments = null;
|
|
43
|
+
/** Optional: when set, `getPathToRoot` reads the bytes for every
|
|
44
|
+
* `{type:"image"}` part it finds in a user message, runs them
|
|
45
|
+
* through `fitToLimit`, and emits a fresh ImageContent with
|
|
46
|
+
* inline base64. Failed reads degrade to a short text note —
|
|
47
|
+
* same shape the chat handler used to write before N+6.4. */
|
|
48
|
+
imageInflate = null;
|
|
49
|
+
constructor(ctx, sessionId, options = {}) {
|
|
50
|
+
this.ctx = ctx;
|
|
51
|
+
this.sessionId = sessionId;
|
|
52
|
+
this.imageInflate = options.imageInflate ?? null;
|
|
53
|
+
}
|
|
54
|
+
async getMetadata() {
|
|
55
|
+
const row = this.ctx.db
|
|
56
|
+
.prepare(`SELECT id, user_id, parent_id, status, kind, worker_role, title, leaf_id, created_at
|
|
57
|
+
FROM sessions WHERE id = ?`)
|
|
58
|
+
.get(this.sessionId);
|
|
59
|
+
if (!row)
|
|
60
|
+
throw new Error(`session not found: ${this.sessionId}`);
|
|
61
|
+
return {
|
|
62
|
+
id: row.id,
|
|
63
|
+
createdAt: new Date(row.created_at).toISOString(),
|
|
64
|
+
tenantId: this.ctx.tenantId,
|
|
65
|
+
userId: row.user_id,
|
|
66
|
+
kind: row.kind,
|
|
67
|
+
workerRole: row.worker_role,
|
|
68
|
+
parentSessionId: row.parent_id,
|
|
69
|
+
title: row.title,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async getLeafId() {
|
|
73
|
+
const row = this.ctx.db
|
|
74
|
+
.prepare(`SELECT leaf_id FROM sessions WHERE id = ?`)
|
|
75
|
+
.get(this.sessionId);
|
|
76
|
+
return row?.leaf_id ?? null;
|
|
77
|
+
}
|
|
78
|
+
async setLeafId(leafId) {
|
|
79
|
+
this.ctx.db
|
|
80
|
+
.prepare(`UPDATE sessions SET leaf_id = ? WHERE id = ?`)
|
|
81
|
+
.run(leafId, this.sessionId);
|
|
82
|
+
}
|
|
83
|
+
async createEntryId() {
|
|
84
|
+
return `msg_${randomUUID()}`;
|
|
85
|
+
}
|
|
86
|
+
async appendEntry(entry) {
|
|
87
|
+
// If the chat handler stashed attachments for this turn,
|
|
88
|
+
// splice them onto the first user message we persist.
|
|
89
|
+
let mutated = entry;
|
|
90
|
+
if (this.pendingUserAttachments &&
|
|
91
|
+
entry.type === "message" &&
|
|
92
|
+
entry.message.role === "user") {
|
|
93
|
+
const m = entry.message;
|
|
94
|
+
const merged = {
|
|
95
|
+
...m,
|
|
96
|
+
attachments: this.pendingUserAttachments.attachments,
|
|
97
|
+
};
|
|
98
|
+
mutated = {
|
|
99
|
+
...entry,
|
|
100
|
+
message: merged,
|
|
101
|
+
};
|
|
102
|
+
this.pendingUserAttachments = null;
|
|
103
|
+
}
|
|
104
|
+
const row = entryToRow(this.sessionId, mutated);
|
|
105
|
+
this.ctx.db
|
|
106
|
+
.prepare(`INSERT INTO messages
|
|
107
|
+
(id, session_id, role, content, parent_id, entry_type, entry_details, created_at)
|
|
108
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
109
|
+
.run(row.id, row.session_id, row.role, row.content, row.parent_id, row.entry_type, row.entry_details, row.created_at);
|
|
110
|
+
// Advance the leaf so the next appendMessage call picks this
|
|
111
|
+
// row as its parent. Pi's Session class reads the leafId at
|
|
112
|
+
// turn-start time but never writes it back — the storage owns
|
|
113
|
+
// that responsibility. Without this, every entry in a turn
|
|
114
|
+
// gets the SAME parent (the leaf at turn-start), which makes
|
|
115
|
+
// path-to-root walk only return one entry.
|
|
116
|
+
await this.setLeafId(mutated.id);
|
|
117
|
+
}
|
|
118
|
+
async getEntry(id) {
|
|
119
|
+
const row = this.ctx.db
|
|
120
|
+
.prepare(`SELECT id, session_id, role, content, parent_id, entry_type, entry_details, created_at
|
|
121
|
+
FROM messages WHERE session_id = ? AND id = ?`)
|
|
122
|
+
.get(this.sessionId, id);
|
|
123
|
+
return row ? rowToEntry(row) : undefined;
|
|
124
|
+
}
|
|
125
|
+
async findEntries(type) {
|
|
126
|
+
const rows = this.ctx.db
|
|
127
|
+
.prepare(`SELECT id, session_id, role, content, parent_id, entry_type, entry_details, created_at
|
|
128
|
+
FROM messages WHERE session_id = ? AND entry_type = ?
|
|
129
|
+
ORDER BY created_at ASC, rowid ASC`)
|
|
130
|
+
.all(this.sessionId, type);
|
|
131
|
+
return rows.map((r) => rowToEntry(r));
|
|
132
|
+
}
|
|
133
|
+
async getLabel(id) {
|
|
134
|
+
// Labels are stored as their own entries (`entry_type='label'`)
|
|
135
|
+
// and reference the labelled entry via `targetId`. The most
|
|
136
|
+
// recent label wins.
|
|
137
|
+
const rows = this.ctx.db
|
|
138
|
+
.prepare(`SELECT id, session_id, role, content, parent_id, entry_type, entry_details, created_at
|
|
139
|
+
FROM messages WHERE session_id = ? AND entry_type = 'label'
|
|
140
|
+
ORDER BY created_at DESC, rowid DESC`)
|
|
141
|
+
.all(this.sessionId);
|
|
142
|
+
for (const r of rows) {
|
|
143
|
+
const entry = rowToEntry(r);
|
|
144
|
+
if (entry.type === "label" && entry.targetId === id) {
|
|
145
|
+
return entry.label ?? undefined;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
async getPathToRoot(leafId) {
|
|
151
|
+
if (!leafId)
|
|
152
|
+
return [];
|
|
153
|
+
const rows = this.ctx.db
|
|
154
|
+
.prepare(`SELECT id, session_id, role, content, parent_id, entry_type, entry_details, created_at
|
|
155
|
+
FROM messages WHERE session_id = ?
|
|
156
|
+
ORDER BY created_at ASC, rowid ASC`)
|
|
157
|
+
.all(this.sessionId);
|
|
158
|
+
const byId = new Map(rows.map((r) => [r.id, r]));
|
|
159
|
+
let path = [];
|
|
160
|
+
let cursor = leafId;
|
|
161
|
+
const guard = new Set();
|
|
162
|
+
while (cursor) {
|
|
163
|
+
if (guard.has(cursor))
|
|
164
|
+
break;
|
|
165
|
+
guard.add(cursor);
|
|
166
|
+
const r = byId.get(cursor);
|
|
167
|
+
if (!r)
|
|
168
|
+
break;
|
|
169
|
+
path.unshift(rowToEntry(r));
|
|
170
|
+
cursor = r.parent_id;
|
|
171
|
+
}
|
|
172
|
+
// Migration 004 guarantees every session's parent_id forms a
|
|
173
|
+
// strict chronological chain rooted at NULL, so the walk above
|
|
174
|
+
// covers every row when leafId is current. We deliberately
|
|
175
|
+
// don't paper over a short walk here — if it happens we want
|
|
176
|
+
// to see it (storage corruption / out-of-date leaf_id) rather
|
|
177
|
+
// than silently splice rows in.
|
|
178
|
+
if (this.imageInflate) {
|
|
179
|
+
const inflate = this.imageInflate;
|
|
180
|
+
path = await Promise.all(path.map(async (entry) => entry.type === "message" && entry.message.role === "user"
|
|
181
|
+
? {
|
|
182
|
+
...entry,
|
|
183
|
+
message: await inflateUserImages(entry.message, inflate),
|
|
184
|
+
}
|
|
185
|
+
: entry));
|
|
186
|
+
}
|
|
187
|
+
return path;
|
|
188
|
+
}
|
|
189
|
+
async getEntries() {
|
|
190
|
+
const rows = this.ctx.db
|
|
191
|
+
.prepare(`SELECT id, session_id, role, content, parent_id, entry_type, entry_details, created_at
|
|
192
|
+
FROM messages WHERE session_id = ?
|
|
193
|
+
ORDER BY created_at ASC, rowid ASC`)
|
|
194
|
+
.all(this.sessionId);
|
|
195
|
+
return rows.map(rowToEntry);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// ─── row ↔ entry conversion ─────────────────────────────────────
|
|
199
|
+
function entryToRow(sessionId, entry) {
|
|
200
|
+
const created_at = Date.parse(entry.timestamp) || Date.now();
|
|
201
|
+
if (entry.type === "message") {
|
|
202
|
+
const m = entry.message;
|
|
203
|
+
const role = m.role === "toolResult" ? "tool" : m.role;
|
|
204
|
+
return {
|
|
205
|
+
id: entry.id,
|
|
206
|
+
session_id: sessionId,
|
|
207
|
+
role,
|
|
208
|
+
content: JSON.stringify(m),
|
|
209
|
+
parent_id: entry.parentId,
|
|
210
|
+
entry_type: "message",
|
|
211
|
+
entry_details: null,
|
|
212
|
+
created_at,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
// Non-message entries are stamped with role='system'; the actual
|
|
216
|
+
// payload lives in `entry_details`. We strip the four base
|
|
217
|
+
// fields the writer already encodes elsewhere (id / parentId /
|
|
218
|
+
// timestamp / type) and stash the remaining typed fields under
|
|
219
|
+
// entry_details. The cast through Record satisfies the
|
|
220
|
+
// type-checker; entry-shape correctness is the caller's concern.
|
|
221
|
+
const erased = entry;
|
|
222
|
+
const rest = { ...erased };
|
|
223
|
+
delete rest.id;
|
|
224
|
+
delete rest.parentId;
|
|
225
|
+
delete rest.timestamp;
|
|
226
|
+
delete rest.type;
|
|
227
|
+
return {
|
|
228
|
+
id: entry.id,
|
|
229
|
+
session_id: sessionId,
|
|
230
|
+
role: "system",
|
|
231
|
+
content: "",
|
|
232
|
+
parent_id: entry.parentId,
|
|
233
|
+
entry_type: entry.type,
|
|
234
|
+
entry_details: JSON.stringify(rest),
|
|
235
|
+
created_at,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function rowToEntry(row) {
|
|
239
|
+
const base = {
|
|
240
|
+
id: row.id,
|
|
241
|
+
parentId: row.parent_id,
|
|
242
|
+
timestamp: new Date(row.created_at).toISOString(),
|
|
243
|
+
};
|
|
244
|
+
if (row.entry_type === "message") {
|
|
245
|
+
const message = parseMessage(row.content, row.role);
|
|
246
|
+
return { type: "message", ...base, message };
|
|
247
|
+
}
|
|
248
|
+
const parsed = row.entry_details ? safeParse(row.entry_details) : null;
|
|
249
|
+
const details = parsed && typeof parsed === "object" && !Array.isArray(parsed)
|
|
250
|
+
? parsed
|
|
251
|
+
: {};
|
|
252
|
+
// Cast through unknown — the `details` JSON keys have to line up
|
|
253
|
+
// with the typed entry's fields (we control the writer).
|
|
254
|
+
return { type: row.entry_type, ...base, ...details };
|
|
255
|
+
}
|
|
256
|
+
function parseMessage(content, role) {
|
|
257
|
+
const parsed = safeParse(content);
|
|
258
|
+
if (parsed &&
|
|
259
|
+
typeof parsed === "object" &&
|
|
260
|
+
typeof parsed.role === "string") {
|
|
261
|
+
return parsed;
|
|
262
|
+
}
|
|
263
|
+
// Legacy plain-text rows: best-effort upgrade.
|
|
264
|
+
if (role === "user") {
|
|
265
|
+
return {
|
|
266
|
+
role: "user",
|
|
267
|
+
content: [{ type: "text", text: content }],
|
|
268
|
+
timestamp: Date.now(),
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
if (role === "assistant") {
|
|
272
|
+
return {
|
|
273
|
+
role: "assistant",
|
|
274
|
+
content: [{ type: "text", text: content }],
|
|
275
|
+
stopReason: "stop",
|
|
276
|
+
usage: {
|
|
277
|
+
input: 0,
|
|
278
|
+
output: 0,
|
|
279
|
+
cacheRead: 0,
|
|
280
|
+
cacheWrite: 0,
|
|
281
|
+
totalTokens: 0,
|
|
282
|
+
cost: 0,
|
|
283
|
+
},
|
|
284
|
+
api: "anthropic",
|
|
285
|
+
provider: "unknown",
|
|
286
|
+
model: "unknown",
|
|
287
|
+
timestamp: Date.now(),
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
if (role === "tool") {
|
|
291
|
+
return {
|
|
292
|
+
role: "toolResult",
|
|
293
|
+
toolCallId: "",
|
|
294
|
+
toolName: "",
|
|
295
|
+
content: [{ type: "text", text: content }],
|
|
296
|
+
isError: false,
|
|
297
|
+
timestamp: Date.now(),
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
// 'system' entries shouldn't reach this path (we route non-message
|
|
301
|
+
// entries through entry_details). Fallback to a synthetic user
|
|
302
|
+
// message to keep types happy.
|
|
303
|
+
return {
|
|
304
|
+
role: "user",
|
|
305
|
+
content: [{ type: "text", text: content }],
|
|
306
|
+
timestamp: Date.now(),
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Hydrate a user message's `{type:"image"}` parts before the LLM
|
|
311
|
+
* call.
|
|
312
|
+
*
|
|
313
|
+
* Stored shape: `{ type:"image", path, mimeType, name?, size?,
|
|
314
|
+
* data:"" }`. The chat handler writes this when the user uploads
|
|
315
|
+
* a file (size + path are stable, base64 isn't — stuffing it on
|
|
316
|
+
* disk would bloat every read). At LLM-call time we resolve the
|
|
317
|
+
* path under `userHome`, run the bytes through `fitToLimit` (which
|
|
318
|
+
* caches by path|mtime|maxBytes) and emit a fresh ImageContent
|
|
319
|
+
* with inline base64.
|
|
320
|
+
*
|
|
321
|
+
* Three failure shapes degrade to a short text note instead of
|
|
322
|
+
* poisoning the request:
|
|
323
|
+
* - vision-incapable model → `[Attached image (no vision support):
|
|
324
|
+
* <name>]`
|
|
325
|
+
* - file vanished or read errored → `[Attached image: <name> —
|
|
326
|
+
* read failed: <reason>]`
|
|
327
|
+
* - already-inlined image (no `path`) → pass through verbatim
|
|
328
|
+
*/
|
|
329
|
+
async function inflateUserImages(msg, options) {
|
|
330
|
+
if (msg.role !== "user" || !Array.isArray(msg.content))
|
|
331
|
+
return msg;
|
|
332
|
+
const parts = msg.content;
|
|
333
|
+
let mutated = false;
|
|
334
|
+
const out = [];
|
|
335
|
+
for (const part of parts) {
|
|
336
|
+
if (part.type !== "image") {
|
|
337
|
+
out.push(part);
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
const data = typeof part.data === "string" ? part.data : "";
|
|
341
|
+
const filePath = typeof part.path === "string" && part.path.length > 0
|
|
342
|
+
? part.path
|
|
343
|
+
: "";
|
|
344
|
+
const name = typeof part.name === "string"
|
|
345
|
+
? part.name
|
|
346
|
+
: filePath
|
|
347
|
+
? path.basename(filePath)
|
|
348
|
+
: "image";
|
|
349
|
+
if (data.length > 0) {
|
|
350
|
+
// Already inlined (e.g. a turn we just persisted) — keep it.
|
|
351
|
+
out.push(part);
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
if (!options.supportsImages) {
|
|
355
|
+
out.push({
|
|
356
|
+
type: "text",
|
|
357
|
+
text: `[Attached image (current model has no vision support): ${name}]`,
|
|
358
|
+
});
|
|
359
|
+
mutated = true;
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (!filePath) {
|
|
363
|
+
// Nothing to read — strip and degrade.
|
|
364
|
+
out.push({
|
|
365
|
+
type: "text",
|
|
366
|
+
text: `[Attached image: ${name} — read failed (empty payload)]`,
|
|
367
|
+
});
|
|
368
|
+
mutated = true;
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
const abs = path.join(options.userHome, filePath.startsWith("/") ? filePath.slice(1) : filePath);
|
|
372
|
+
try {
|
|
373
|
+
const stat = fs.statSync(abs);
|
|
374
|
+
const cacheKey = imageFitCacheKey(abs, stat.mtimeMs, options.imageMaxBytes);
|
|
375
|
+
const cached = cacheGet(cacheKey);
|
|
376
|
+
let buf;
|
|
377
|
+
let mimeType;
|
|
378
|
+
if (cached) {
|
|
379
|
+
buf = cached.buf;
|
|
380
|
+
mimeType = cached.mimeType;
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
const raw = fs.readFileSync(abs);
|
|
384
|
+
const mt = typeof part.mimeType === "string" ? part.mimeType : "";
|
|
385
|
+
const fitted = await fitToLimit(raw, mt, options.imageMaxBytes);
|
|
386
|
+
buf = fitted.buf;
|
|
387
|
+
mimeType = fitted.mimeType;
|
|
388
|
+
cachePut(cacheKey, buf, mimeType);
|
|
389
|
+
}
|
|
390
|
+
out.push({
|
|
391
|
+
type: "image",
|
|
392
|
+
data: buf.toString("base64"),
|
|
393
|
+
mimeType,
|
|
394
|
+
});
|
|
395
|
+
mutated = true;
|
|
396
|
+
}
|
|
397
|
+
catch (err) {
|
|
398
|
+
const reason = err?.message ?? "read failed";
|
|
399
|
+
out.push({
|
|
400
|
+
type: "text",
|
|
401
|
+
text: `[Attached image: ${name} — read failed: ${reason}]`,
|
|
402
|
+
});
|
|
403
|
+
mutated = true;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (!mutated)
|
|
407
|
+
return msg;
|
|
408
|
+
return { ...msg, content: out };
|
|
409
|
+
}
|
|
410
|
+
function safeParse(s) {
|
|
411
|
+
try {
|
|
412
|
+
return JSON.parse(s);
|
|
413
|
+
}
|
|
414
|
+
catch {
|
|
415
|
+
return null;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
//# sourceMappingURL=sqlite-session-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-session-storage.js","sourceRoot":"","sources":["../../src/chat/sqlite-session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AAQ,CAAC;gBAC5B,QAAQ;aACT,CAAC,CAAC;YACH,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,MAAM,GACT,GAAmC,EAAE,OAAO,IAAI,aAAa,CAAC;YACjE,GAAG,CAAC,IAAI,CAAC;gBACP,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,oBAAoB,IAAI,mBAAmB,MAAM,GAAG;aAC3D,CAAC,CAAC;YACH,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;IACH,CAAC;IACD,IAAI,CAAC,OAAO;QAAE,OAAO,GAAG,CAAC;IACzB,OAAO,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,GAAG,EAA6B,CAAC;AAC7D,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub-execution-env.d.ts","sourceRoot":"","sources":["../../src/chat/stub-execution-env.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,+BAA+B,CAAC;AAkBvC,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAuD9D"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Stub `ExecutionEnv` for pi-agent-core's harness.
|
|
2
|
+
//
|
|
3
|
+
// The harness's filesystem + shell capabilities are meant for
|
|
4
|
+
// agent-driven file/exec ops. In tianshu, those flows go through
|
|
5
|
+
// plugin tools (the `files` plugin reads/writes via tool calls,
|
|
6
|
+
// `microsandbox` runs commands via tool calls). The harness itself
|
|
7
|
+
// does NOT need filesystem/shell access — its only references to
|
|
8
|
+
// `env` are inside system-prompt callbacks and a few hooks that we
|
|
9
|
+
// don't use.
|
|
10
|
+
//
|
|
11
|
+
// So we hand it a stub that:
|
|
12
|
+
// * fails every fs/shell call with `not_supported`
|
|
13
|
+
// * exposes `cwd` so any callback that reads it gets a sane path
|
|
14
|
+
//
|
|
15
|
+
// If a future feature actually needs filesystem ops at the
|
|
16
|
+
// harness level, we'll route them through the `files` plugin's
|
|
17
|
+
// capability instead of growing this stub.
|
|
18
|
+
import { FileError as FileErrorClass, ExecutionError as ExecutionErrorClass } from "@earendil-works/pi-agent-core";
|
|
19
|
+
function fileErr(message) {
|
|
20
|
+
return {
|
|
21
|
+
ok: false,
|
|
22
|
+
error: new FileErrorClass("not_supported", message),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function execErr(message) {
|
|
26
|
+
return {
|
|
27
|
+
ok: false,
|
|
28
|
+
error: new ExecutionErrorClass("shell_unavailable", message),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function makeStubExecutionEnv(cwd) {
|
|
32
|
+
return {
|
|
33
|
+
cwd,
|
|
34
|
+
async absolutePath() {
|
|
35
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
36
|
+
},
|
|
37
|
+
async joinPath() {
|
|
38
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
39
|
+
},
|
|
40
|
+
async readTextFile() {
|
|
41
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
42
|
+
},
|
|
43
|
+
async readTextLines() {
|
|
44
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
45
|
+
},
|
|
46
|
+
async readBinaryFile() {
|
|
47
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
48
|
+
},
|
|
49
|
+
async writeFile() {
|
|
50
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
51
|
+
},
|
|
52
|
+
async appendFile() {
|
|
53
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
54
|
+
},
|
|
55
|
+
async fileInfo() {
|
|
56
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
57
|
+
},
|
|
58
|
+
async listDir() {
|
|
59
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
60
|
+
},
|
|
61
|
+
async canonicalPath() {
|
|
62
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
63
|
+
},
|
|
64
|
+
async exists() {
|
|
65
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
66
|
+
},
|
|
67
|
+
async createDir() {
|
|
68
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
69
|
+
},
|
|
70
|
+
async remove() {
|
|
71
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
72
|
+
},
|
|
73
|
+
async createTempDir() {
|
|
74
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
75
|
+
},
|
|
76
|
+
async createTempFile() {
|
|
77
|
+
return fileErr("filesystem ops not supported in this harness");
|
|
78
|
+
},
|
|
79
|
+
async exec() {
|
|
80
|
+
return execErr("shell exec not supported in this harness");
|
|
81
|
+
},
|
|
82
|
+
async cleanup() {
|
|
83
|
+
// best-effort; nothing to release
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=stub-execution-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub-execution-env.js","sourceRoot":"","sources":["../../src/chat/stub-execution-env.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,8DAA8D;AAC9D,iEAAiE;AACjE,gEAAgE;AAChE,mEAAmE;AACnE,iEAAiE;AACjE,mEAAmE;AACnE,aAAa;AACb,EAAE;AACF,6BAA6B;AAC7B,qDAAqD;AACrD,mEAAmE;AACnE,EAAE;AACF,2DAA2D;AAC3D,+DAA+D;AAC/D,2CAA2C;AAO3C,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,cAAc,IAAI,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGnH,SAAS,OAAO,CAAC,OAAe;IAC9B,OAAO;QACL,EAAE,EAAE,KAAK;QACT,KAAK,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AAC;QACD,KAAK,CAAC,MAAM;YACV,OAAO,OAAO,CAAC,8CAA8C,CAAC,CAAC;QACjE,CAAC;QACD,KAAK,CAAC,aAAa;YACjB,OAAO,OAAO,CAAC,8CAA8C,CAAC,CAAC;QACjE,CAAC;QACD,KAAK,CAAC,cAAc;YAClB,OAAO,OAAO,CAAC,8CAA8C,CAAC,CAAC;QACjE,CAAC;QACD,KAAK,CAAC,IAAI;YACR,OAAO,OAAO,CAAC,0CAA0C,CAAC,CAAC;QAC7D,CAAC;QACD,KAAK,CAAC,OAAO;YACX,kCAAkC;QACpC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Message, Tool } from "@earendil-works/pi-ai";
|
|
2
|
+
/**
|
|
3
|
+
* Estimate the number of tokens needed to send the given context to
|
|
4
|
+
* an LLM. Returns whole tokens. Always rounds up.
|
|
5
|
+
*/
|
|
6
|
+
export declare function estimateTokens(args: {
|
|
7
|
+
systemPrompt?: string;
|
|
8
|
+
messages: Message[];
|
|
9
|
+
tools?: Tool[];
|
|
10
|
+
}): number;
|
|
11
|
+
//# sourceMappingURL=token-estimate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-estimate.d.ts","sourceRoot":"","sources":["../../src/chat/token-estimate.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAI3D;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;CAChB,GAAG,MAAM,CAqCT"}
|