@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,260 @@
|
|
|
1
|
+
// Adapter: tianshu plugin `AgentTool` (sdk shape) → pi-agent-core `AgentTool`.
|
|
2
|
+
//
|
|
3
|
+
// Why this exists:
|
|
4
|
+
// * Plugin authors keep using the simpler tianshu shape:
|
|
5
|
+
// execute(args, ctx) → { ok, text, ... }
|
|
6
|
+
// which we don't want to break or re-architect across every
|
|
7
|
+
// plugin in this repo (files, microsandbox, workboard).
|
|
8
|
+
// * The agent loop uses pi-agent-core, whose tool contract is
|
|
9
|
+
// richer:
|
|
10
|
+
// execute(toolCallId, params, signal, onUpdate) → AgentToolResult
|
|
11
|
+
// * The adapter wraps each plugin tool into the pi shape: it
|
|
12
|
+
// forwards args, normalises return shapes via the same
|
|
13
|
+
// `normaliseToolResult` the chat handler already uses, and
|
|
14
|
+
// translates `ok=false` returns into AgentToolResult `isError`.
|
|
15
|
+
//
|
|
16
|
+
// One subtlety worth flagging: pi's contract says `execute()` should
|
|
17
|
+
// THROW on failure rather than encode errors in the content array.
|
|
18
|
+
// Our plugin tools, by long-standing convention, return
|
|
19
|
+
// `{ ok: false, text: "..." }` instead of throwing. The adapter
|
|
20
|
+
// converts that pattern into an AgentToolResult with the same text
|
|
21
|
+
// content but does NOT throw — pi's `runAgentLoop` already supports
|
|
22
|
+
// "soft failures" via the ToolResultMessage's `isError` flag, but
|
|
23
|
+
// tianshu plugins want them to be visible to the LLM verbatim.
|
|
24
|
+
// Tracked in workers.md §7.2.
|
|
25
|
+
/**
|
|
26
|
+
* Normalise an executor's structured return value to `{ ok, text }`.
|
|
27
|
+
* Two shapes are accepted:
|
|
28
|
+
*
|
|
29
|
+
* 1. Fs-style: `{ ok: boolean, text: string, ...extras }` — used
|
|
30
|
+
* as-is.
|
|
31
|
+
* 2. Anything else: JSON-encoded into `text`. `ok` is derived
|
|
32
|
+
* from common hints (`ok`, `exit_code`, `state`) and defaults
|
|
33
|
+
* to true when there's no clear signal.
|
|
34
|
+
*
|
|
35
|
+
* Lives in the adapter file because it's the only consumer now
|
|
36
|
+
* that the host's chat handler runs through pi-agent-core.
|
|
37
|
+
*/
|
|
38
|
+
export function normaliseToolResult(out) {
|
|
39
|
+
if (out &&
|
|
40
|
+
typeof out === "object" &&
|
|
41
|
+
typeof out.text === "string" &&
|
|
42
|
+
typeof out.ok === "boolean") {
|
|
43
|
+
const r = out;
|
|
44
|
+
return { ok: r.ok, text: r.text };
|
|
45
|
+
}
|
|
46
|
+
if (out && typeof out === "object") {
|
|
47
|
+
const r = out;
|
|
48
|
+
let ok = true;
|
|
49
|
+
if (typeof r.ok === "boolean")
|
|
50
|
+
ok = r.ok;
|
|
51
|
+
else if (typeof r.exit_code === "number")
|
|
52
|
+
ok = r.exit_code === 0;
|
|
53
|
+
else if (typeof r.state === "string")
|
|
54
|
+
ok = r.state !== "error" && r.state !== "failed";
|
|
55
|
+
return { ok, text: JSON.stringify(out) };
|
|
56
|
+
}
|
|
57
|
+
return { ok: true, text: String(out ?? "") };
|
|
58
|
+
}
|
|
59
|
+
export function adaptToolset(toolset) {
|
|
60
|
+
// Per-toolset truncation counter. The toolset is freshly built
|
|
61
|
+
// per agent loop run (chat handler / worker pool), so this map
|
|
62
|
+
// covers "this agent's lifetime" — the natural granularity
|
|
63
|
+
// for an escalation rule. Resetting between turns would let a
|
|
64
|
+
// model thrash forever: hit truncation once per turn, get the
|
|
65
|
+
// permissive message, repeat. Persisting across turns lets us
|
|
66
|
+
// catch "second time the same tool ate truncation" reliably.
|
|
67
|
+
const truncationCount = new Map();
|
|
68
|
+
const tools = toolset.schemas.map((schema) => {
|
|
69
|
+
const exec = toolset.executors[schema.name];
|
|
70
|
+
const piTool = {
|
|
71
|
+
...schema,
|
|
72
|
+
// pi-agent-core requires a `label` (UI display); fall back to
|
|
73
|
+
// the schema name. Plugin-side schema doesn't carry one yet.
|
|
74
|
+
label: schema.name,
|
|
75
|
+
// Default execution mode "sequential" matches the legacy
|
|
76
|
+
// tianshu chat handler behaviour (one tool at a time). We can
|
|
77
|
+
// flip individual plugin tools to "parallel" later when their
|
|
78
|
+
// contract documents thread-safety.
|
|
79
|
+
executionMode: "sequential",
|
|
80
|
+
// pi-agent-core calls `prepareArguments` BEFORE schema
|
|
81
|
+
// validation. We use it to detect Anthropic stream
|
|
82
|
+
// truncation — a frequent failure mode where the
|
|
83
|
+
// assistant emits a tool_use block whose input_json never
|
|
84
|
+
// finishes streaming, so the framework receives `{}` (or a
|
|
85
|
+
// partial dict missing required fields). The default error
|
|
86
|
+
// message ("must have required property X") looks like a
|
|
87
|
+
// model mistake, so the model dutifully retries the tool
|
|
88
|
+
// call AND HITS THE SAME TRUNCATION. By throwing a more
|
|
89
|
+
// diagnostic error here — in pi-agent-core's prepare phase,
|
|
90
|
+
// which still gets converted into an immediate error tool
|
|
91
|
+
// result — we tell the model what actually happened so it
|
|
92
|
+
// changes strategy on the retry (often: re-issue the call
|
|
93
|
+
// earlier in the turn before context bloats).
|
|
94
|
+
prepareArguments: (raw) => {
|
|
95
|
+
const truncated = detectStreamTruncation(schema, raw);
|
|
96
|
+
if (truncated) {
|
|
97
|
+
// Escalate on repeat. After the first truncation the
|
|
98
|
+
// model already saw the standard hint ("re-issue first,
|
|
99
|
+
// keep fields concise, use skeleton-then-fill"). If it
|
|
100
|
+
// hits truncation a second time on the same tool inside
|
|
101
|
+
// the same agent run, hinting harder rarely helps — the
|
|
102
|
+
// model is stuck. Switch to a fatal-flavored message
|
|
103
|
+
// that explicitly forbids the bad pattern and tells it
|
|
104
|
+
// exactly which alternative tools to call.
|
|
105
|
+
const prior = truncationCount.get(schema.name) ?? 0;
|
|
106
|
+
truncationCount.set(schema.name, prior + 1);
|
|
107
|
+
if (prior >= 1) {
|
|
108
|
+
throw new Error(formatRepeatTruncationError(schema.name, prior + 1));
|
|
109
|
+
}
|
|
110
|
+
throw new Error(truncated);
|
|
111
|
+
}
|
|
112
|
+
return raw;
|
|
113
|
+
},
|
|
114
|
+
execute: async (_toolCallId, params, _signal) => {
|
|
115
|
+
const args = params && typeof params === "object"
|
|
116
|
+
? params
|
|
117
|
+
: {};
|
|
118
|
+
if (!exec) {
|
|
119
|
+
// Should be unreachable — schema came from the same map.
|
|
120
|
+
return {
|
|
121
|
+
content: [
|
|
122
|
+
{ type: "text", text: `unknown tool: ${schema.name}` },
|
|
123
|
+
],
|
|
124
|
+
details: undefined,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
// Plugin tools are sync OR async; both are fine.
|
|
128
|
+
const raw = await Promise.resolve(exec(args));
|
|
129
|
+
const norm = normaliseToolResult(raw);
|
|
130
|
+
const result = {
|
|
131
|
+
content: [{ type: "text", text: norm.text }],
|
|
132
|
+
// Stash the raw tool result on `details` so future UI
|
|
133
|
+
// bits (chat panel rendering) can introspect it without
|
|
134
|
+
// re-parsing the text.
|
|
135
|
+
details: raw,
|
|
136
|
+
};
|
|
137
|
+
if (!norm.ok) {
|
|
138
|
+
// pi-agent-core has no boolean on AgentToolResult itself
|
|
139
|
+
// — it routes "isError" via the afterToolCall hook or
|
|
140
|
+
// via promise rejection. We piggyback on the surrounding
|
|
141
|
+
// run's afterToolCall to flip isError when this happens
|
|
142
|
+
// (caller wires that up).
|
|
143
|
+
result.__ok = false;
|
|
144
|
+
}
|
|
145
|
+
return result;
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
return piTool;
|
|
149
|
+
});
|
|
150
|
+
return { tools, executors: toolset.executors };
|
|
151
|
+
}
|
|
152
|
+
/** Helper for the surrounding agent run: detect whether a finished
|
|
153
|
+
* AgentToolResult came from a `{ ok:false }` plugin return, so
|
|
154
|
+
* pi-agent's `afterToolCall` can mark it as an error to the LLM. */
|
|
155
|
+
export function isAdapterError(result) {
|
|
156
|
+
return Boolean(result?.__ok === false);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Heuristic: did Anthropic / Bedrock truncate the tool_use input
|
|
160
|
+
* stream before the assistant finished serialising arguments?
|
|
161
|
+
*
|
|
162
|
+
* Returns a diagnostic message when truncation is the most likely
|
|
163
|
+
* explanation; the caller (prepareArguments hook) throws it so
|
|
164
|
+
* the model sees a clear "stream cut, retry differently" prompt
|
|
165
|
+
* instead of pi-ai's default schema error.
|
|
166
|
+
*
|
|
167
|
+
* Two signal cases — both confined to "the framework received
|
|
168
|
+
* suspiciously little JSON, AND the schema clearly expected more":
|
|
169
|
+
*
|
|
170
|
+
* 1. params is null / not an object → received nothing at all.
|
|
171
|
+
* 2. params is an object missing one or more required fields.
|
|
172
|
+
* We list the missing ones; the model can usually tell from
|
|
173
|
+
* the names which call it tried to make.
|
|
174
|
+
*
|
|
175
|
+
* If the model legitimately omitted a required field on its own
|
|
176
|
+
* (rare but possible — bad system prompt, distracted run), the
|
|
177
|
+
* message still helps it: "you didn't pass X" is true either
|
|
178
|
+
* way, only the "stream may have been truncated" hint is
|
|
179
|
+
* speculative. We word it accordingly.
|
|
180
|
+
*/
|
|
181
|
+
function detectStreamTruncation(schema, rawArgs) {
|
|
182
|
+
const required = extractRequiredKeys(schema);
|
|
183
|
+
if (required.length === 0)
|
|
184
|
+
return null;
|
|
185
|
+
if (rawArgs == null || typeof rawArgs !== "object") {
|
|
186
|
+
return formatTruncationError(schema.name, required, required);
|
|
187
|
+
}
|
|
188
|
+
const args = rawArgs;
|
|
189
|
+
const missing = required.filter((k) => !(k in args));
|
|
190
|
+
if (missing.length === 0)
|
|
191
|
+
return null;
|
|
192
|
+
// If MOST of the required fields are missing AND args has zero
|
|
193
|
+
// present keys, treat it as full truncation (the most common
|
|
194
|
+
// shape we've actually observed). Otherwise it's just a
|
|
195
|
+
// partial — still worth flagging, but with a slightly softer
|
|
196
|
+
// hint.
|
|
197
|
+
return formatTruncationError(schema.name, required, missing);
|
|
198
|
+
}
|
|
199
|
+
function extractRequiredKeys(schema) {
|
|
200
|
+
// pi-ai uses TypeBox JSON-schema-ish objects. The `required`
|
|
201
|
+
// field is a top-level array of strings. Defensive: the schema
|
|
202
|
+
// may not carry it (Type.Object infers required from non-Optional
|
|
203
|
+
// members at compile time and stamps the array onto the JSON
|
|
204
|
+
// schema, but plugin authors could in principle hand-craft a
|
|
205
|
+
// schema without one).
|
|
206
|
+
const params = schema.parameters;
|
|
207
|
+
const req = params?.required;
|
|
208
|
+
if (!Array.isArray(req))
|
|
209
|
+
return [];
|
|
210
|
+
return req.filter((k) => typeof k === "string");
|
|
211
|
+
}
|
|
212
|
+
function formatTruncationError(toolName, required, missing) {
|
|
213
|
+
const reqList = required.map((k) => `\`${k}\``).join(", ");
|
|
214
|
+
const missList = missing.map((k) => `\`${k}\``).join(", ");
|
|
215
|
+
const suspectsTruncation = missing.length === required.length;
|
|
216
|
+
const head = suspectsTruncation
|
|
217
|
+
? `Tool call to \`${toolName}\` arrived with empty arguments — the model's tool_use input stream may have been truncated by the provider before parameters finished serialising.`
|
|
218
|
+
: `Tool call to \`${toolName}\` is missing required field${missing.length === 1 ? "" : "s"} ${missList}. This often means the provider truncated the tool_use input stream mid-write.`;
|
|
219
|
+
const requiredHint = `Required: ${reqList}.`;
|
|
220
|
+
const retryAdvice = "To retry: re-issue the tool call as the FIRST action in your next assistant turn (no preamble text), and keep `description` / `content` / similar long fields concise. If you keep hitting the same truncation, switch tactics — use the skeleton-then-fill pattern (write a short scaffold first, then fill sections via batch `edit_file`) instead of one giant call.";
|
|
221
|
+
return `${head} ${requiredHint} ${retryAdvice}`;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Second-time truncation on the same tool in the same agent run.
|
|
225
|
+
* The model has already seen the permissive hint and ignored it,
|
|
226
|
+
* so we make the failure mode explicit and prescribe one specific
|
|
227
|
+
* alternative — "don't call this tool again, use these instead".
|
|
228
|
+
*
|
|
229
|
+
* Tool-specific advice covers the two we actually see thrash:
|
|
230
|
+
* - write_file / tenant_config_write → skeleton + edit_file
|
|
231
|
+
* - everything else → generic "split the call into smaller chunks"
|
|
232
|
+
*
|
|
233
|
+
* The wording is intentionally direct ("STOP calling") because the
|
|
234
|
+
* permissive version above already failed; subtle is for first-
|
|
235
|
+
* time messages, not for the loop-breaker.
|
|
236
|
+
*/
|
|
237
|
+
function formatRepeatTruncationError(toolName, attempts) {
|
|
238
|
+
const head = `Tool call to \`${toolName}\` truncated again (attempt ${attempts}). ` +
|
|
239
|
+
"The first hint did not change the outcome, so the call shape " +
|
|
240
|
+
"itself is the problem.";
|
|
241
|
+
const isWriter = toolName === "write_file" || toolName === "tenant_config_write";
|
|
242
|
+
const prescription = isWriter
|
|
243
|
+
? `STOP calling \`${toolName}\` with a large \`content\` payload. Instead:\n` +
|
|
244
|
+
` 1. Call \`${toolName}\` ONCE with a small skeleton (title, ` +
|
|
245
|
+
`headings, and \`<!-- TODO: section X -->\` placeholders only).\n` +
|
|
246
|
+
" 2. Use `edit_file` (or `tenant_config_edit`) with `edits[]` to " +
|
|
247
|
+
"replace each placeholder with its real content. The batch form " +
|
|
248
|
+
"of edit_file accepts multiple disjoint replacements in one call " +
|
|
249
|
+
"— plan two or three sections per edit_file call rather than one " +
|
|
250
|
+
"giant write.\n\n" +
|
|
251
|
+
"Read the `large-input-large-output` skill for the worked example. " +
|
|
252
|
+
"Do not attempt another `write_file` with the same content shape; " +
|
|
253
|
+
"the next attempt will fail the same way."
|
|
254
|
+
: `STOP retrying \`${toolName}\` with the same shape. Split the request ` +
|
|
255
|
+
"into smaller calls (fewer items, shorter strings) before calling it " +
|
|
256
|
+
"again. The provider's tool-use input stream cannot accept the size " +
|
|
257
|
+
"of payload you keep submitting.";
|
|
258
|
+
return `${head}\n\n${prescription}`;
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=agent-tool-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-tool-adapter.js","sourceRoot":"","sources":["../../src/chat/agent-tool-adapter.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,EAAE;AACF,mBAAmB;AACnB,2DAA2D;AAC3D,+CAA+C;AAC/C,gEAAgE;AAChE,4DAA4D;AAC5D,gEAAgE;AAChE,cAAc;AACd,wEAAwE;AACxE,+DAA+D;AAC/D,2DAA2D;AAC3D,+DAA+D;AAC/D,oEAAoE;AACpE,EAAE;AACF,qEAAqE;AACrE,mEAAmE;AACnE,wDAAwD;AACxD,gEAAgE;AAChE,mEAAmE;AACnE,oEAAoE;AACpE,kEAAkE;AAClE,+DAA+D;AAC/D,8BAA8B;A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C/D,kEAAkE;YAClE,mEAAmE;YACnE,iEAAiE;YACjE,kEAAkE;YAClE,kEAAkE;YAClE,kBAAkB;YAClB,oEAAoE;YACpE,mEAAmE;YACnE,0CAA0C;QAC5C,CAAC,CAAC,mBAAmB,QAAQ,4CAA4C;YACvE,sEAAsE;YACtE,qEAAqE;YACrE,iCAAiC,CAAC;IACtC,OAAO,GAAG,IAAI,OAAO,YAAY,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Message } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { TenantContext } from "../core/index.js";
|
|
3
|
+
import { type ResolvedModelInfo } from "../core/index.js";
|
|
4
|
+
import type { ChatMessage, ChatSession } from "./messages.js";
|
|
5
|
+
/** Trigger threshold: compact when estimated input ≥ this fraction
|
|
6
|
+
* of the active model's context window. Per Yu's call (2026-06-05). */
|
|
7
|
+
export declare const COMPACT_THRESHOLD = 0.5;
|
|
8
|
+
export interface CompactPlan {
|
|
9
|
+
toSummarise: Message[];
|
|
10
|
+
keep: Message[];
|
|
11
|
+
/** Original ChatMessage rows for the kept tail (so we re-persist
|
|
12
|
+
* the exact JSON when forking; round-tripping through pi-ai
|
|
13
|
+
* shapes loses metadata like sibling `attachments`). */
|
|
14
|
+
keepRows: ChatMessage[];
|
|
15
|
+
}
|
|
16
|
+
/** Decide how many tail turns to keep verbatim and split the message
|
|
17
|
+
* log accordingly. */
|
|
18
|
+
export declare function planCompact(pi: Message[], rows: ChatMessage[]): CompactPlan;
|
|
19
|
+
export interface CompactResult {
|
|
20
|
+
summary: string;
|
|
21
|
+
newSession: ChatSession;
|
|
22
|
+
oldSessionId: string;
|
|
23
|
+
summarisedCount: number;
|
|
24
|
+
keptCount: number;
|
|
25
|
+
durationMs: number;
|
|
26
|
+
}
|
|
27
|
+
export declare class CompactSkippedError extends Error {
|
|
28
|
+
readonly code: "COMPACT_SKIPPED";
|
|
29
|
+
constructor(reason: string);
|
|
30
|
+
}
|
|
31
|
+
/** Run a summarisation LLM call. Returns the plain text summary. */
|
|
32
|
+
export declare function summarise(toSummarise: Message[], modelInfo: ResolvedModelInfo, signal?: AbortSignal): Promise<{
|
|
33
|
+
summary: string;
|
|
34
|
+
durationMs: number;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* End-to-end compact: summarise → mark old → fork new → seed new.
|
|
38
|
+
*/
|
|
39
|
+
export declare function compactSession(args: {
|
|
40
|
+
ctx: TenantContext;
|
|
41
|
+
userId: string;
|
|
42
|
+
oldSession: ChatSession;
|
|
43
|
+
pi: Message[];
|
|
44
|
+
rows: ChatMessage[];
|
|
45
|
+
modelInfo: ResolvedModelInfo;
|
|
46
|
+
signal?: AbortSignal;
|
|
47
|
+
}): Promise<CompactResult>;
|
|
48
|
+
/** Build a plain-text transcript from pi-ai messages. Drops base64
|
|
49
|
+
* image bytes (replaced with a marker) and clamps long tool-result
|
|
50
|
+
* bodies so the summariser doesn't burn its own context on them. */
|
|
51
|
+
export declare function buildTranscript(messages: Message[]): string;
|
|
52
|
+
//# sourceMappingURL=compact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../src/chat/compact.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAGV,OAAO,EAKR,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE9D;wEACwE;AACxE,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAuBrC,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,OAAO,EAAE,CAAC;IACvB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB;;6DAEyD;IACzD,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB;AAED;uBACuB;AACvB,wBAAgB,WAAW,CACzB,EAAE,EAAE,OAAO,EAAE,EACb,IAAI,EAAE,WAAW,EAAE,GAClB,WAAW,CA2Bb;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAG,iBAAiB,CAAU;gBAC/B,MAAM,EAAE,MAAM;CAI3B;AAED,oEAAoE;AACpE,wBAAsB,SAAS,CAC7B,WAAW,EAAE,OAAO,EAAE,EACtB,SAAS,EAAE,iBAAiB,EAC5B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAmClD;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,GAAG,EAAE,aAAa,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,WAAW,CAAC;IACxB,EAAE,EAAE,OAAO,EAAE,CAAC;IACd,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,aAAa,CAAC,CA+DzB;AAiCD;;qEAEqE;AACrE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAkC3D"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// Conversation compaction.
|
|
2
|
+
//
|
|
3
|
+
// Two paths share the same LLM-summarisation core:
|
|
4
|
+
//
|
|
5
|
+
// 1. Auto-compact: kicked off before each turn when the projected
|
|
6
|
+
// input tokens exceed `contextWindow * COMPACT_THRESHOLD` of the
|
|
7
|
+
// active model.
|
|
8
|
+
// 2. Manual `/compact` slash command from the user.
|
|
9
|
+
//
|
|
10
|
+
// In both cases we:
|
|
11
|
+
// 1. Pick a tail of recent turns to keep verbatim.
|
|
12
|
+
// 2. Hand everything older to the active LLM with the SUMMARY_PROMPT
|
|
13
|
+
// and let it produce one structured note.
|
|
14
|
+
// 3. Mark the OLD session `status='compacted'`, stash the summary on
|
|
15
|
+
// `compacted_summary`.
|
|
16
|
+
// 4. Fork a new session under the same user, `parent_id` pointing
|
|
17
|
+
// at the old one (per ADR-0001 §5: the chain is queryable, no
|
|
18
|
+
// messages get deleted).
|
|
19
|
+
// 5. Seed the new session with a [history summary] user message and
|
|
20
|
+
// an "understood" assistant ack, then re-add the kept tail.
|
|
21
|
+
//
|
|
22
|
+
// The old session's messages stay on disk untouched. The chat hot
|
|
23
|
+
// path uses `ensureActiveSession` which only returns the newly-forked
|
|
24
|
+
// active session, so future LLM calls see only the shorter history.
|
|
25
|
+
import { completeSimple } from "@earendil-works/pi-ai";
|
|
26
|
+
import { randomUUID } from "node:crypto";
|
|
27
|
+
import { buildModel, resolveApiKey, } from "../core/index.js";
|
|
28
|
+
import { appendMessage } from "./messages.js";
|
|
29
|
+
/** Trigger threshold: compact when estimated input ≥ this fraction
|
|
30
|
+
* of the active model's context window. Per Yu's call (2026-06-05). */
|
|
31
|
+
export const COMPACT_THRESHOLD = 0.5;
|
|
32
|
+
/** Minimum number of messages to keep verbatim at the tail. */
|
|
33
|
+
const KEEP_TAIL_MIN = 2;
|
|
34
|
+
const SUMMARY_PROMPT = `You are a conversation-compaction assistant. Below is a chat history between a user and an AI agent (including tool calls). Produce a structured summary so a fresh agent can pick up seamlessly.
|
|
35
|
+
|
|
36
|
+
Requirements:
|
|
37
|
+
1. Address the next agent in the second person ("you previously …").
|
|
38
|
+
2. **MUST preserve**:
|
|
39
|
+
- The user's core goals, constraints, preferences
|
|
40
|
+
- Decisions already made (technology choices, plans, parameters)
|
|
41
|
+
- Files and paths visited / created / modified (give exact paths)
|
|
42
|
+
- Key commands run and their salient results (do not paste full output)
|
|
43
|
+
- Open / in-progress tasks, todos
|
|
44
|
+
- Errors and pitfalls (so they aren't repeated)
|
|
45
|
+
- The most recent turn's specifics (what the user just said; what you were about to do)
|
|
46
|
+
3. **You may drop**: greetings, repetition, verbose tool-mid-output, long file dumps, UI chrome
|
|
47
|
+
4. Use Markdown headings, e.g. ## Goal / ## Decisions / ## Files / ## Progress / ## Caveats / ## Current State
|
|
48
|
+
5. Output ONLY the summary itself (no preamble, no sign-off)
|
|
49
|
+
6. Match the original conversation's language (Chinese conversation → Chinese summary, otherwise English)
|
|
50
|
+
7. Aim for 600–1500 words. Shorter is better when the conversation is short.`;
|
|
51
|
+
/** Decide how many tail turns to keep verbatim and split the message
|
|
52
|
+
* log accordingly. */
|
|
53
|
+
export function planCompact(pi, rows) {
|
|
54
|
+
if (pi.length !== rows.length) {
|
|
55
|
+
const n = Math.min(pi.length, rows.length);
|
|
56
|
+
pi = pi.slice(0, n);
|
|
57
|
+
rows = rows.slice(0, n);
|
|
58
|
+
}
|
|
59
|
+
if (pi.length <= KEEP_TAIL_MIN) {
|
|
60
|
+
return { toSummarise: [], keep: pi, keepRows: rows };
|
|
61
|
+
}
|
|
62
|
+
// Find the last user message; keep from there to the end. Falls
|
|
63
|
+
// back to KEEP_TAIL_MIN tail when no user message is in range.
|
|
64
|
+
let lastUser = -1;
|
|
65
|
+
for (let i = pi.length - 1; i >= 0; i--) {
|
|
66
|
+
if (pi[i].role === "user") {
|
|
67
|
+
lastUser = i;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const fromIdx = lastUser >= 0
|
|
72
|
+
? Math.min(lastUser, pi.length - KEEP_TAIL_MIN)
|
|
73
|
+
: pi.length - KEEP_TAIL_MIN;
|
|
74
|
+
return {
|
|
75
|
+
toSummarise: pi.slice(0, fromIdx),
|
|
76
|
+
keep: pi.slice(fromIdx),
|
|
77
|
+
keepRows: rows.slice(fromIdx),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export class CompactSkippedError extends Error {
|
|
81
|
+
code = "COMPACT_SKIPPED";
|
|
82
|
+
constructor(reason) {
|
|
83
|
+
super(reason);
|
|
84
|
+
this.name = "CompactSkippedError";
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** Run a summarisation LLM call. Returns the plain text summary. */
|
|
88
|
+
export async function summarise(toSummarise, modelInfo, signal) {
|
|
89
|
+
const transcript = buildTranscript(toSummarise);
|
|
90
|
+
if (!transcript.trim()) {
|
|
91
|
+
return { summary: "(empty conversation)", durationMs: 0 };
|
|
92
|
+
}
|
|
93
|
+
const model = buildModel(modelInfo);
|
|
94
|
+
const apiKey = resolveApiKey(modelInfo);
|
|
95
|
+
const ctx = {
|
|
96
|
+
systemPrompt: SUMMARY_PROMPT,
|
|
97
|
+
messages: [
|
|
98
|
+
{
|
|
99
|
+
role: "user",
|
|
100
|
+
content: [
|
|
101
|
+
{
|
|
102
|
+
type: "text",
|
|
103
|
+
text: `Please compact this conversation:\n\n${transcript}`,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
timestamp: Date.now(),
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
};
|
|
110
|
+
const t0 = Date.now();
|
|
111
|
+
const result = (await completeSimple(model, ctx, {
|
|
112
|
+
signal,
|
|
113
|
+
apiKey,
|
|
114
|
+
}));
|
|
115
|
+
const durationMs = Date.now() - t0;
|
|
116
|
+
const text = result.content
|
|
117
|
+
.filter((c) => c.type === "text")
|
|
118
|
+
.map((c) => c.text)
|
|
119
|
+
.join("\n")
|
|
120
|
+
.trim();
|
|
121
|
+
if (!text)
|
|
122
|
+
throw new Error("compaction summariser returned empty content");
|
|
123
|
+
return { summary: text, durationMs };
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* End-to-end compact: summarise → mark old → fork new → seed new.
|
|
127
|
+
*/
|
|
128
|
+
export async function compactSession(args) {
|
|
129
|
+
const { ctx, userId, oldSession, pi, rows, modelInfo, signal } = args;
|
|
130
|
+
const plan = planCompact(pi, rows);
|
|
131
|
+
if (plan.toSummarise.length === 0) {
|
|
132
|
+
throw new CompactSkippedError("nothing to summarise (≤ KEEP_TAIL_MIN messages)");
|
|
133
|
+
}
|
|
134
|
+
const { summary, durationMs } = await summarise(plan.toSummarise, modelInfo, signal);
|
|
135
|
+
// Mark the old session compacted + stash the summary for audit.
|
|
136
|
+
ctx.db
|
|
137
|
+
.prepare(`UPDATE sessions
|
|
138
|
+
SET status='compacted', compacted_summary=?, ended_at=?
|
|
139
|
+
WHERE id=?`)
|
|
140
|
+
.run(summary, Date.now(), oldSession.id);
|
|
141
|
+
// Fork a new active session under the same user, parent pointing
|
|
142
|
+
// at the old one.
|
|
143
|
+
const newSession = forkSession(ctx, userId, oldSession);
|
|
144
|
+
// Seed: history-summary user msg + ack assistant msg.
|
|
145
|
+
const seedTime = Date.now();
|
|
146
|
+
appendMessage(ctx, newSession, {
|
|
147
|
+
role: "user",
|
|
148
|
+
content: `[Conversation summary — generated at ${new Date(seedTime).toISOString()}]\n\n${summary}`,
|
|
149
|
+
});
|
|
150
|
+
appendMessage(ctx, newSession, {
|
|
151
|
+
role: "assistant",
|
|
152
|
+
content: "Understood — I have the prior context and will continue from where we left off.",
|
|
153
|
+
});
|
|
154
|
+
// Re-persist the kept tail rows. Copy the original `content` JSON
|
|
155
|
+
// verbatim so attachments / structured tool turns survive.
|
|
156
|
+
for (const r of plan.keepRows) {
|
|
157
|
+
const id = `msg_${randomUUID()}`;
|
|
158
|
+
ctx.db
|
|
159
|
+
.prepare(`INSERT INTO messages (id, session_id, role, content, created_at)
|
|
160
|
+
VALUES (?, ?, ?, ?, ?)`)
|
|
161
|
+
.run(id, newSession.id, r.role, r.content, Date.now());
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
summary,
|
|
165
|
+
newSession,
|
|
166
|
+
oldSessionId: oldSession.id,
|
|
167
|
+
summarisedCount: plan.toSummarise.length,
|
|
168
|
+
keptCount: plan.keep.length,
|
|
169
|
+
durationMs,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function forkSession(ctx, userId, parent) {
|
|
173
|
+
const id = `session_${randomUUID()}`;
|
|
174
|
+
const now = Date.now();
|
|
175
|
+
ctx.db
|
|
176
|
+
.prepare(`INSERT INTO sessions (id, user_id, parent_id, status, kind, created_at)
|
|
177
|
+
VALUES (?, ?, ?, ?, ?, ?)`)
|
|
178
|
+
.run(id, userId, parent.id, "active", "user", now);
|
|
179
|
+
return {
|
|
180
|
+
id,
|
|
181
|
+
userId,
|
|
182
|
+
parentId: parent.id,
|
|
183
|
+
status: "active",
|
|
184
|
+
kind: "user",
|
|
185
|
+
title: null,
|
|
186
|
+
createdAt: now,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
// ─── transcript helpers ───────────────────────────────────────────
|
|
190
|
+
const MAX_TOOL_RESULT_CHARS = 600;
|
|
191
|
+
/** Build a plain-text transcript from pi-ai messages. Drops base64
|
|
192
|
+
* image bytes (replaced with a marker) and clamps long tool-result
|
|
193
|
+
* bodies so the summariser doesn't burn its own context on them. */
|
|
194
|
+
export function buildTranscript(messages) {
|
|
195
|
+
const lines = [];
|
|
196
|
+
for (const m of messages) {
|
|
197
|
+
if (m.role === "user") {
|
|
198
|
+
lines.push(`### USER\n${userMessageToText(m)}`);
|
|
199
|
+
}
|
|
200
|
+
else if (m.role === "assistant") {
|
|
201
|
+
const a = m;
|
|
202
|
+
const parts = [];
|
|
203
|
+
for (const c of a.content) {
|
|
204
|
+
if (c.type === "text" && c.text)
|
|
205
|
+
parts.push(c.text);
|
|
206
|
+
else if (c.type === "toolCall") {
|
|
207
|
+
const tc = c;
|
|
208
|
+
const args = JSON.stringify(tc.arguments ?? {}).slice(0, 400);
|
|
209
|
+
parts.push(`[tool:${tc.name} args=${args}]`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (parts.length > 0)
|
|
213
|
+
lines.push(`### ASSISTANT\n${parts.join("\n")}`);
|
|
214
|
+
}
|
|
215
|
+
else if (m.role === "toolResult") {
|
|
216
|
+
const tr = m;
|
|
217
|
+
const text = tr.content
|
|
218
|
+
.filter((c) => c.type === "text")
|
|
219
|
+
.map((c) => c.text)
|
|
220
|
+
.join("\n");
|
|
221
|
+
if (text) {
|
|
222
|
+
const trimmed = text.length > MAX_TOOL_RESULT_CHARS
|
|
223
|
+
? text.slice(0, MAX_TOOL_RESULT_CHARS) +
|
|
224
|
+
`\n...(+${text.length - MAX_TOOL_RESULT_CHARS} chars)`
|
|
225
|
+
: text;
|
|
226
|
+
lines.push(`### TOOL_RESULT (${tr.toolName})\n${trimmed}`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return lines.join("\n\n");
|
|
231
|
+
}
|
|
232
|
+
function userMessageToText(u) {
|
|
233
|
+
if (typeof u.content === "string")
|
|
234
|
+
return u.content;
|
|
235
|
+
if (!Array.isArray(u.content))
|
|
236
|
+
return "";
|
|
237
|
+
const parts = [];
|
|
238
|
+
for (const c of u.content) {
|
|
239
|
+
const p = c;
|
|
240
|
+
if (p.type === "text" && p.text)
|
|
241
|
+
parts.push(p.text);
|
|
242
|
+
else if (p.type === "image") {
|
|
243
|
+
parts.push(`[image: ${p.name ?? p.path ?? "(no name)"}]`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return parts.join("\n");
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=compact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compact.js","sourceRoot":"","sources":["../../src/chat/compact.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,EAAE;AACF,mDAAmD;AACnD,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,qBAAqB;AACrB,sDAAsD;AACtD,EA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CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAc;IACvC,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC,OAAO,CAAC;IACpD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC;IACzC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,CAAmE,CAAC;QAC9E,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aAC/C,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,WAAW,GAAG,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TenantContext } from "../core/index.js";
|
|
2
|
+
export interface DumpSystemPromptArgs {
|
|
3
|
+
ctx: TenantContext;
|
|
4
|
+
/** "main" for the chat handler, or "worker:<slug>" for a worker
|
|
5
|
+
* agent. Used in the filename so concurrent agents don't
|
|
6
|
+
* trample each other. */
|
|
7
|
+
role: string;
|
|
8
|
+
userId: string;
|
|
9
|
+
systemPrompt: string;
|
|
10
|
+
}
|
|
11
|
+
/** Returns true iff the dump is enabled in this tenant's resolved
|
|
12
|
+
* config. Cheap to call per-turn. */
|
|
13
|
+
export declare function dumpSystemPromptEnabled(ctx: TenantContext): boolean;
|
|
14
|
+
/** Overwrite the dump file for this (tenant, role, user). Best
|
|
15
|
+
* effort — never throws. */
|
|
16
|
+
export declare function dumpSystemPrompt(args: DumpSystemPromptArgs): void;
|
|
17
|
+
//# sourceMappingURL=dump-system-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dump-system-prompt.d.ts","sourceRoot":"","sources":["../../src/chat/dump-system-prompt.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,aAAa,CAAC;IACnB;;8BAE0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;sCACsC;AACtC,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAEnE;AAED;6BAC6B;AAC7B,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CA6BjE"}
|