@xopcai/xopc 0.0.276 → 0.0.278
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/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
- package/dist/extensions/feishu/src/outbound/media-load.js +2 -2
- package/dist/extensions/telegram/src/inbound-processor.js +2 -2
- package/dist/extensions/telegram/src/outbound-sender.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +2 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +2 -2
- package/dist/extensions/weixin/src/auth/accounts.js +12 -12
- package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
- package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-sj_1IC5H.js → agent-avatar-dicebear-lRVOwbrK.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DAqn5DdL.js +1 -0
- package/dist/gateway/static/root/assets/{agents-CIzev0Qj.js → agents-DNQNTDkU.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-oHTY5PDs.js +1 -0
- package/dist/gateway/static/root/assets/{appearance-settings-BeXvF-dZ.js → appearance-settings-B0YnZ3ig.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Bh0etSmL.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BSgaIIGE.js → archive-plugin-D4x142le.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CGNt02hP.js → attachment-load-zibD2Hod.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DoafJiVA.js → automations-page-Dkp7gp_S.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-w4McwueN.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BsAL26Aq.js → binary-plugins-CfUzu1Hc.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BxB7m8aI.js → block-editor-r5nCBBan.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-DGCqIPXT.js → browser-automation-inputs-DcVLoIzc.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BNsO-Ip2.js → browser-automations-page-BnL4JnTM.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-DxX-t0EJ.js +8 -0
- package/dist/gateway/static/root/assets/{button-B11EPpor.js → button-BA45yciM.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CvacBQAI.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-CJzSNo-L.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-ZCFwco1W.js → chat-terminal-dock-CWVnJtBp.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-DNBhBT0b.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-C26e13YU.js → cron-expression-CjrWuy2m.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-CpxFfgpg.js → date-picker-XjPSlgq_.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-eCIGAfHa.js → dependency-picker-CkyfEP88.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-_MSZvIDO.js → desktop-pet-BAE_NVx5.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-feBnJWkV.js → desktop-pet-settings-BUw6V2R9.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DsR5NQEC.js +1 -0
- package/dist/gateway/static/root/assets/{dist-CpzYSoz7.js → dist-BGTk37IG.js} +1 -1
- package/dist/gateway/static/root/assets/{dist-DBS3OB8K.js → dist-CI_fqRk-.js} +1 -1
- package/dist/gateway/static/root/assets/{dist-DLmwHyAh.js → dist-Che_jiQF.js} +1 -1
- package/dist/gateway/static/root/assets/es2015-DBLcMg5B.js +41 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-CotBlxJ-.js → extension-debug-page-giBeIVUT.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CFBmQ7U3.js → extension-page-Bqo9bNtx.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Cd1lfh8z.js → extension-settings-page-BX-6AA3k.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-Dil7vuyU.js +1 -0
- package/dist/gateway/static/root/assets/{heartbeat-settings-DRG0u1ON.js → heartbeat-settings-DWFAopk_.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-Dpeuvazg.js +1 -0
- package/dist/gateway/static/root/assets/index-B03HGpzt.js +74 -0
- package/dist/gateway/static/root/assets/index-CXF9-BpI.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BLHsdFIQ.js → keyboard-shortcuts-settings-BKGPpBnV.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CBtemxFc.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BjAj1xhq.js → local-apps-page-B06ToOxB.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DibI1GsP.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-CPHxDaOw.js → management-settings-DJ6yMZCd.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-B2IR4E2r.js → markdown-view-DF3aJP_5.js} +4 -4
- package/dist/gateway/static/root/assets/{media-plugins-BUOzcXCL.js → media-plugins-CdrLNAks.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-GOxomxOK.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-CQBgk3_x.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-BgEYFhqS.js → page-tabs-B7LA4z-x.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-DGmMQt4t.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-C-pQIx6W.js → preview-open-alternatives-DTQRN7WR.js} +1 -1
- package/dist/gateway/static/root/assets/proactive-card-BF3741px.js +1 -0
- package/dist/gateway/static/root/assets/proactive-page-1EM217v0.js +1 -0
- package/dist/gateway/static/root/assets/product-open-page-BazdmFYo.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-B1Pm-fQd.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DUrxyNR9.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-C6VzHUwx.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DkAjFJ-9.js → runtime-tools-settings-panel-D-DZf4I1.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BpDcuSsl.js → schema-form-B-Yj9DVW.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DtemHfkv.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-ByEVQe0c.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-RElRijJw.js → settings-form-section-BxPUqwY6.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CaixunoA.js → settings-page-zLn8lIrs.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BwIrk3Jx.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CC-bFOTf.js → share-preview-page-DAc_FkVc.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Dwdv6QyS.js +1 -0
- package/dist/gateway/static/root/assets/{skill-reload-api-CcOtxf53.js → skill-reload-api-CDzQWN60.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DmRvRxtY.js → skills-page-CO5XVkbY.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page.utils-BR5bk2vT.js +1 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DRIJ5mXq.js → system-settings-panel-C0ptJutB.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DOjcKOzQ.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-BABuQvGD.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-Cq4--C1i.js → use-autosave-Dc5aN2px.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-UhsSP_pC.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CbJ6tKGI.js → voice-api-key-field-CY0DpJui.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-Brg9yJBr.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-vw1229Fh.js → workflow-run-setup-panel-D3fq7boB.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-S7XXNBWa.js +6 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/tasks.js +6 -1
- package/dist/src/agent/agent-manager.js +17 -17
- package/dist/src/agent/agent-scope.js +2 -2
- package/dist/src/agent/background-review/run-background-review.js +4 -4
- package/dist/src/agent/commands/command-isolation.d.ts +1 -0
- package/dist/src/agent/commands/command-isolation.js +17 -1
- package/dist/src/agent/commands/commandMounts.d.ts +2 -0
- package/dist/src/agent/commands/commandMounts.js +32 -0
- package/dist/src/agent/context/coordinator.js +3 -3
- package/dist/src/agent/context/execution-context.js +4 -4
- package/dist/src/agent/context/execution-scope.js +2 -2
- package/dist/src/agent/context/project-context.js +4 -4
- package/dist/src/agent/embedded/index.js +2 -2
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +5 -5
- package/dist/src/agent/embedded/run-turn.js +2 -2
- package/dist/src/agent/embedded/session-tool-result-guard.js +3 -3
- package/dist/src/agent/external-tools/composio-provider.js +1 -1
- package/dist/src/agent/external-tools/gateway-tools.js +1 -1
- package/dist/src/agent/external-tools/mcp-provider.js +2 -2
- package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
- package/dist/src/agent/image/generation/providers/dashscope.js +1 -1
- package/dist/src/agent/image/generation/providers/fal.js +1 -1
- package/dist/src/agent/image/generation/providers/google.js +1 -1
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/index.js +1 -1
- package/dist/src/agent/image/load-image-media.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/inbound/inbound-loop.js +2 -2
- package/dist/src/agent/index.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-gateway.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
- package/dist/src/agent/mcp/index.js +2 -2
- package/dist/src/agent/mcp/mcp-transport.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/memory/index.js +2 -2
- package/dist/src/agent/messaging/outbound-coordinator.js +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +5 -5
- package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
- package/dist/src/agent/sandbox/command-validator.js +0 -20
- package/dist/src/agent/sandbox/exec-policy.d.ts +1 -0
- package/dist/src/agent/sandbox/exec-policy.js +3 -3
- package/dist/src/agent/sandbox/fileAccess.d.ts +7 -0
- package/dist/src/agent/sandbox/fileAccess.js +100 -0
- package/dist/src/agent/sandbox/path-policy.d.ts +2 -0
- package/dist/src/agent/sandbox/path-policy.js +54 -17
- package/dist/src/agent/sandbox/sanitize-env-vars.js +10 -9
- package/dist/src/agent/service/direct-turn-helpers.js +6 -6
- package/dist/src/agent/service/process-direct-one-shot.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +5 -5
- package/dist/src/agent/service/webchat-tts.js +2 -2
- package/dist/src/agent/service.js +19 -19
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/filesystem-watcher.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +3 -3
- package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +5 -5
- package/dist/src/agent/tools/apply-patch.js +25 -38
- package/dist/src/agent/tools/create-share-tool.js +13 -5
- package/dist/src/agent/tools/delegate-tool.js +3 -3
- package/dist/src/agent/tools/exec-command.js +2 -1
- package/dist/src/agent/tools/executor.js +1 -1
- package/dist/src/agent/tools/factory.js +13 -13
- package/dist/src/agent/tools/find.js +5 -3
- package/dist/src/agent/tools/grep.js +21 -4
- package/dist/src/agent/tools/image-generate-tool.js +5 -6
- package/dist/src/agent/tools/index.js +5 -5
- package/dist/src/agent/tools/list-dir.js +2 -1
- package/dist/src/agent/tools/managed-job-tool.js +1 -0
- package/dist/src/agent/tools/publish-artifacts.js +4 -3
- package/dist/src/agent/tools/read.js +9 -6
- package/dist/src/agent/tools/repository-search.d.ts +2 -0
- package/dist/src/agent/tools/repository-search.js +51 -7
- package/dist/src/agent/tools/review-workspace.js +76 -10
- package/dist/src/agent/tools/send-media.js +5 -4
- package/dist/src/agent/tools/skills-tools.js +1 -1
- package/dist/src/agent/tools/tool-paths.js +3 -1
- package/dist/src/agent/tools/tts-tool.js +1 -1
- package/dist/src/agent/tools/user-context-tool.js +1 -1
- package/dist/src/agent/tools/write.js +6 -19
- package/dist/src/agent/tools/xopc-use-tool.js +6 -6
- package/dist/src/agent/workflow/subagent-runner.js +1 -1
- package/dist/src/agent-config/schema.d.ts +24 -0
- package/dist/src/agent-config/schema.js +2 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/capabilities/store-connector.js +1 -1
- package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
- package/dist/src/channels/index.js +2 -2
- package/dist/src/channels/outbound-sender.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +9 -9
- package/dist/src/channels/pairing/pairing-store.js +6 -6
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/builtins/session.js +1 -1
- package/dist/src/chat-commands/builtins/thinking.js +1 -1
- package/dist/src/chat-commands/builtins/tts.js +1 -1
- package/dist/src/chat-commands/builtins/understanding.js +1 -1
- package/dist/src/chat-commands/builtins/workflow.js +2 -2
- package/dist/src/chat-commands/context.js +2 -2
- package/dist/src/chat-commands/index.js +3 -3
- package/dist/src/cli/commands/agent.js +6 -6
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +21 -20
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +2 -2
- package/dist/src/cli/commands/extension.js +1 -1
- package/dist/src/cli/commands/gateway/shared.js +1 -1
- package/dist/src/cli/commands/gateway/token.js +1 -1
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard.js +2 -2
- package/dist/src/cli/commands/project.js +2 -2
- package/dist/src/cli/commands/runtime.js +1 -1
- package/dist/src/cli/commands/skills.js +2 -2
- package/dist/src/cli/commands/tui.js +1 -1
- package/dist/src/cli/commands/tunnel.js +3 -3
- package/dist/src/cli/extension-cli-register.js +4 -4
- package/dist/src/cli/utils/gateway-client.js +1 -1
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +16 -0
- package/dist/src/connectors/connected-source-understanding.js +2 -2
- package/dist/src/connectors/connection-recovery-service.js +3 -3
- package/dist/src/discussions/live-worker.js +1 -1
- package/dist/src/discussions/sealer.js +1 -1
- package/dist/src/extensions/api.js +3 -3
- package/dist/src/extensions/bundled-extension-activation.js +1 -1
- package/dist/src/extensions/index.js +1 -1
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agents-admin.js +4 -4
- package/dist/src/gateway/device-routes.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +2 -2
- package/dist/src/gateway/hono/app.js +3 -3
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -0
- package/dist/src/gateway/hono/lib/config-payload.js +3 -3
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +2 -2
- package/dist/src/gateway/hono/routes/browser.js +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +3 -3
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +2 -2
- package/dist/src/gateway/hono/routes/media.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +5 -5
- package/dist/src/gateway/hono/routes/notes.js +1 -1
- package/dist/src/gateway/hono/routes/proactive-control.js +4 -4
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/sessions.js +1 -1
- package/dist/src/gateway/hono/routes/shares.js +25 -4
- package/dist/src/gateway/hono/routes/site-shares.js +1 -1
- package/dist/src/gateway/hono/routes/status.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +10 -3
- package/dist/src/gateway/hono/routes/user-model.js +4 -4
- package/dist/src/gateway/hono/routes/voice.js +3 -3
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/lock.js +10 -10
- package/dist/src/gateway/media-access.js +2 -2
- package/dist/src/gateway/ports.js +6 -6
- package/dist/src/gateway/server.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +4 -4
- package/dist/src/gateway/service/marketplace-service.js +3 -3
- package/dist/src/gateway/service/run-gateway-agent.js +3 -3
- package/dist/src/gateway/service.js +31 -31
- package/dist/src/gateway/session-context-summary.js +2 -2
- package/dist/src/gateway/workspace-editor-path.js +2 -2
- package/dist/src/infra/gateway-processes.js +2 -2
- package/dist/src/infra/path-env.js +3 -3
- package/dist/src/infra/update-global.js +10 -10
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/media-shared/http/ssrf-guard.js +1 -1
- package/dist/src/notes/agent-context.js +3 -3
- package/dist/src/notes/service.js +3 -2
- package/dist/src/proactive/actions/service.js +1 -1
- package/dist/src/proactive/execution/agent-executor.js +1 -1
- package/dist/src/proactive/execution/context.js +1 -1
- package/dist/src/proactive/execution/worker.js +1 -1
- package/dist/src/proactive/experience.js +7 -2
- package/dist/src/proactive/follow-ups.js +1 -1
- package/dist/src/proactive/inbox/cards.js +2 -2
- package/dist/src/proactive/inbox/delivery.js +2 -2
- package/dist/src/proactive/inbox/digest.js +2 -2
- package/dist/src/proactive/inbox/notification-policy.js +1 -1
- package/dist/src/proactive/inbox/repository.js +1 -1
- package/dist/src/proactive/inbox/service.js +1 -1
- package/dist/src/proactive/index.js +1 -1
- package/dist/src/proactive/temporal/worker.js +1 -1
- package/dist/src/projects/project-skill-service.js +2 -2
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-reference-auditor.js +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/remote-access/exposure-manager.js +1 -1
- package/dist/src/session/index.js +2 -2
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/store.js +3 -3
- package/dist/src/session/thinking-resolve.js +1 -1
- package/dist/src/share/share-store.js +6 -2
- package/dist/src/share/share-thumbnail.js +1 -1
- package/dist/src/share/site-share-store.js +1 -1
- package/dist/src/storage/sqlite/connection.js +9 -9
- package/dist/src/tasks/execution-context.js +1 -1
- package/dist/src/tasks/home-query-service.js +4 -3
- package/dist/src/tasks/index.js +3 -3
- package/dist/src/tasks/project-operating-view-service.js +7 -4
- package/dist/src/tasks/task-application-service.js +109 -5
- package/dist/src/tasks/task-context-assembler.js +8 -4
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-read-model-projector.js +7 -5
- package/dist/src/tasks/task-run-coordinator.js +3 -1
- package/dist/src/tasks/task-run-repository.js +4 -1
- package/dist/src/tui/backends/embedded-backend.js +9 -9
- package/dist/src/tui/backends/gateway-realtime-backend.js +2 -2
- package/dist/src/tui/extension-host/load-extensions.js +1 -1
- package/dist/src/tui/tui-command-formatters.js +1 -1
- package/dist/src/tui/tui-commands.js +5 -5
- package/dist/src/tui/tui-picker-overlay.js +1 -1
- package/dist/src/tui/tui-skills-autocomplete.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +5 -5
- package/dist/src/tui/tui.js +3 -3
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/voice/local/runtime-worker.js +1 -1
- package/dist/src/voice/realtime/memory-context.js +3 -3
- package/dist/src/voice/stt/index.js +2 -2
- package/dist/src/voice/stt/preflight.js +1 -1
- package/dist/src/voice/stt/providers/local-transcription.js +1 -1
- package/dist/src/voice/stt/transcribe-core.js +1 -1
- package/dist/src/voice/tts/index.js +3 -3
- package/dist/src/voice/tts/merge-config.js +1 -1
- package/dist/src/voice/tts/payload.js +1 -1
- package/dist/src/voice/tts/speak-core.js +1 -1
- package/dist/src/work-discovery/service.js +3 -3
- package/dist/src/workflows/context/workflow-context.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +6 -6
- package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-B5MRLEy8.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-DY3Vwxjq.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Ch_9Ffgk.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-MACr99IO.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Nvdoi0B1.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BluLJq5I.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-DYxxhcjb.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Bpcp8UyE.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-D_fB0fml.js +0 -1
- package/dist/gateway/static/root/assets/es2015-BvLh9GaE.js +0 -41
- package/dist/gateway/static/root/assets/gateway-settings-BH35C8RI.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BlZk-aD4.js +0 -1
- package/dist/gateway/static/root/assets/index-CfQor-TM.js +0 -74
- package/dist/gateway/static/root/assets/index-DKy1Qn1_.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-DJd71FlC.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-5MWeZ6Ae.js +0 -2
- package/dist/gateway/static/root/assets/note-detail-panel-Bch98ut3.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-CWO5dQKN.js +0 -8
- package/dist/gateway/static/root/assets/popover-select-Dz_Qis2R.js +0 -1
- package/dist/gateway/static/root/assets/proactive-card-DfjMVJUW.js +0 -1
- package/dist/gateway/static/root/assets/proactive-page-BGVcVsbd.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-DsQcgZkI.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DZFVirjV.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B2g6inq-.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CbkUOkQY.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page--7-w-0WS.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BvZrH_sp.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Ul06Y5YX.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DwV2Wh7S.js +0 -1
- package/dist/gateway/static/root/assets/skills-page.utils-CT0-daZD.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BQjLHqSk.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-IvWcgZdD.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-hwc5-nqV.js +0 -2
- package/dist/gateway/static/root/assets/work-discovery-overlay-BG2pmXL3.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DZWpJHDr.js +0 -6
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolvePathUnderWorkspace } from "./tool-paths.js";
|
|
3
|
-
import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
|
|
1
|
+
import { checkedFilePath, deleteWorkspaceFile, readWorkspaceFile, writeWorkspaceFile } from "../sandbox/fileAccess.js";
|
|
4
2
|
import { detectLineEnding, generateDiffString, normalizeToLF, restoreLineEndings } from "./edit-diff.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { relative } from "node:path";
|
|
4
|
+
import { stat } from "node:fs/promises";
|
|
7
5
|
import { Type } from "@sinclair/typebox";
|
|
8
6
|
//#region src/agent/tools/apply-patch.ts
|
|
9
7
|
const ApplyPatchSchema = Type.Object({ patch: Type.String({ description: [
|
|
@@ -128,19 +126,11 @@ function applyHunks(original, hunks, path) {
|
|
|
128
126
|
}
|
|
129
127
|
return content;
|
|
130
128
|
}
|
|
131
|
-
async function readExisting(path) {
|
|
132
|
-
return
|
|
129
|
+
async function readExisting(workspace, path) {
|
|
130
|
+
return readWorkspaceFile(workspace, path).toString("utf8");
|
|
133
131
|
}
|
|
134
132
|
async function assertWritable(workspace, path) {
|
|
135
|
-
|
|
136
|
-
if (!quick.allowed) throw new Error(quick.message ?? `Cannot write ${path}`);
|
|
137
|
-
const policy = evaluateFilePolicy({
|
|
138
|
-
operation: "write",
|
|
139
|
-
path,
|
|
140
|
-
workspaceRoot: workspace
|
|
141
|
-
});
|
|
142
|
-
if (!policy.allowed) throw new Error(`Sandbox: ${policy.reason}`);
|
|
143
|
-
return resolvePathUnderWorkspace(path, workspace);
|
|
133
|
+
return checkedFilePath(workspace, path, "write");
|
|
144
134
|
}
|
|
145
135
|
async function pathExists(path) {
|
|
146
136
|
try {
|
|
@@ -178,7 +168,7 @@ async function buildPatchPlan(workspace, parsed) {
|
|
|
178
168
|
if (op.kind === "delete") {
|
|
179
169
|
const target = await assertWritable(workspace, op.path);
|
|
180
170
|
rememberTarget(target);
|
|
181
|
-
const oldContent = await readExisting(target);
|
|
171
|
+
const oldContent = await readExisting(workspace, target);
|
|
182
172
|
const diff = generateDiffString(oldContent, "", op.path);
|
|
183
173
|
const counts = countDiff(diff);
|
|
184
174
|
changes.push({
|
|
@@ -193,7 +183,7 @@ async function buildPatchPlan(workspace, parsed) {
|
|
|
193
183
|
}
|
|
194
184
|
const target = await assertWritable(workspace, op.path);
|
|
195
185
|
rememberTarget(target);
|
|
196
|
-
const oldContent = await readExisting(target);
|
|
186
|
+
const oldContent = await readExisting(workspace, target);
|
|
197
187
|
const lineEnding = detectLineEnding(oldContent);
|
|
198
188
|
const newContent = restoreLineEndings(applyHunks(normalizeToLF(oldContent), op.hunks, op.path), lineEnding);
|
|
199
189
|
const destination = op.moveTo ? await assertWritable(workspace, op.moveTo) : target;
|
|
@@ -217,33 +207,28 @@ async function buildPatchPlan(workspace, parsed) {
|
|
|
217
207
|
}
|
|
218
208
|
return changes;
|
|
219
209
|
}
|
|
220
|
-
async function commitPatchPlan(changes) {
|
|
210
|
+
async function commitPatchPlan(workspace, changes) {
|
|
221
211
|
const committed = [];
|
|
222
212
|
try {
|
|
223
213
|
for (const change of changes) {
|
|
224
214
|
committed.push(change);
|
|
225
|
-
if (change.kind === "add")
|
|
226
|
-
|
|
227
|
-
await writeFile(change.absolutePath, change.newContent ?? "", "utf-8");
|
|
228
|
-
} else if (change.kind === "delete") await rm(change.absolutePath);
|
|
215
|
+
if (change.kind === "add") writeWorkspaceFile(workspace, change.absolutePath, change.newContent ?? "");
|
|
216
|
+
else if (change.kind === "delete") deleteWorkspaceFile(workspace, change.absolutePath);
|
|
229
217
|
else {
|
|
230
218
|
const destination = change.absoluteMoveTo ?? change.absolutePath;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (destination !== change.absolutePath) await rm(change.absolutePath);
|
|
219
|
+
writeWorkspaceFile(workspace, destination, change.newContent ?? "");
|
|
220
|
+
if (destination !== change.absolutePath) deleteWorkspaceFile(workspace, change.absolutePath);
|
|
234
221
|
}
|
|
235
222
|
}
|
|
236
223
|
} catch (error) {
|
|
237
224
|
for (const change of committed.reverse()) try {
|
|
238
|
-
if (change.kind === "add")
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
await writeFile(change.absolutePath, change.oldContent ?? "", "utf-8");
|
|
246
|
-
} else await writeFile(change.absolutePath, change.oldContent ?? "", "utf-8");
|
|
225
|
+
if (change.kind === "add") {
|
|
226
|
+
if (await pathExists(change.absolutePath)) deleteWorkspaceFile(workspace, change.absolutePath);
|
|
227
|
+
} else if (change.kind === "delete") writeWorkspaceFile(workspace, change.absolutePath, change.oldContent ?? "");
|
|
228
|
+
else if (change.absoluteMoveTo) {
|
|
229
|
+
if (await pathExists(change.absoluteMoveTo)) deleteWorkspaceFile(workspace, change.absoluteMoveTo);
|
|
230
|
+
writeWorkspaceFile(workspace, change.absolutePath, change.oldContent ?? "");
|
|
231
|
+
} else writeWorkspaceFile(workspace, change.absolutePath, change.oldContent ?? "");
|
|
247
232
|
} catch {}
|
|
248
233
|
throw error;
|
|
249
234
|
}
|
|
@@ -262,12 +247,14 @@ function createApplyPatchTool(workspace) {
|
|
|
262
247
|
finalGuardRelevant: true,
|
|
263
248
|
async execute(_toolCallId, params) {
|
|
264
249
|
try {
|
|
265
|
-
const
|
|
266
|
-
|
|
250
|
+
const parsed = parsePatch(params.patch ?? "");
|
|
251
|
+
const canonicalWorkspace = checkedFilePath(workspace, workspace, "write");
|
|
252
|
+
const changes = await buildPatchPlan(canonicalWorkspace, parsed);
|
|
253
|
+
await commitPatchPlan(canonicalWorkspace, changes);
|
|
267
254
|
const diff = changes.map((change) => change.diff).join("\n");
|
|
268
255
|
const added = changes.reduce((sum, change) => sum + change.added, 0);
|
|
269
256
|
const removed = changes.reduce((sum, change) => sum + change.removed, 0);
|
|
270
|
-
const files = changes.map((change) => relative(
|
|
257
|
+
const files = changes.map((change) => relative(canonicalWorkspace, change.absoluteMoveTo ?? change.absolutePath));
|
|
271
258
|
const summary = changes.map((change) => {
|
|
272
259
|
const display = change.moveTo ? `${change.path} -> ${change.moveTo}` : change.path;
|
|
273
260
|
return `${change.kind}: ${display} (+${change.added}/-${change.removed})`;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { turnOutcomeKindFromFileName } from "../../../packages/gateway-contract/src/turn-outcome.js";
|
|
2
|
-
import { resolvePathUnderWorkspace } from "./tool-paths.js";
|
|
3
2
|
import { resolveGatewayEffectiveHost } from "../../config/gateway-bind.js";
|
|
3
|
+
import { resolveReverseProxyPublicUrl } from "../../gateway/public-url.js";
|
|
4
|
+
import { resolvePathUnderWorkspace } from "./tool-paths.js";
|
|
5
|
+
import { assertWorkspaceTreeReadable, checkedFilePath } from "../sandbox/fileAccess.js";
|
|
4
6
|
import { resolveShareConfig } from "../../share/share-config.js";
|
|
5
7
|
import { mergeWithDefaults } from "../../share/site-share-config.js";
|
|
6
8
|
import { getShareStore } from "../../share/share-store.js";
|
|
7
9
|
import { getSiteShareStore } from "../../share/site-share-store.js";
|
|
8
10
|
import { resolveShareUrl, resolveSiteShareUrl } from "../../share/share-url.js";
|
|
9
11
|
import { publishHostedStaticSite } from "../../share/hosted-static-site-publish.js";
|
|
10
|
-
import { resolveReverseProxyPublicUrl } from "../../gateway/public-url.js";
|
|
11
12
|
import { audienceDefaults, decideShareKind, makeDescription, makeTitle, probeShareTarget, rememberStagedSite, stageSingleHtmlAsSite } from "../../share/share-auto.js";
|
|
12
13
|
import { scheduleThumbnail } from "../../share/share-thumbnail.js";
|
|
13
14
|
import { resolveToolLocale, shareToolErrorLine, shareToolSuccessLines } from "../../i18n/share-tool-bundle.js";
|
|
15
|
+
import { relative } from "node:path";
|
|
14
16
|
import { createHash } from "node:crypto";
|
|
15
17
|
import { Type } from "@sinclair/typebox";
|
|
16
18
|
//#region src/agent/tools/create-share-tool.ts
|
|
@@ -87,9 +89,15 @@ function createCreateShareTool(deps) {
|
|
|
87
89
|
reverseProxyPublicUrl: resolveReverseProxyPublicUrl(cfg)
|
|
88
90
|
};
|
|
89
91
|
const tokenHash = hashCreator(deps.getAgentId?.() ?? "agent-tool");
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
let relPath;
|
|
93
|
+
try {
|
|
94
|
+
const root = checkedFilePath(workspace, workspace, "read");
|
|
95
|
+
const absolutePath = checkedFilePath(workspace, resolvePathUnderWorkspace(p.filePath, workspace), "read");
|
|
96
|
+
relPath = relative(root, absolutePath).replace(/\\/g, "/");
|
|
97
|
+
if (relPath) assertWorkspaceTreeReadable(workspace, absolutePath);
|
|
98
|
+
} catch (err) {
|
|
99
|
+
return errorResult(locale, `Cannot read target: ${err instanceof Error ? err.message : String(err)}`);
|
|
100
|
+
}
|
|
93
101
|
if (!relPath) return errorResult(locale, "Cannot share the workspace root itself.");
|
|
94
102
|
let probe;
|
|
95
103
|
try {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { runGit } from "../../execution-environments/git.js";
|
|
2
|
+
import { LocalWorktreeManager } from "../../execution-environments/local-worktree-manager.js";
|
|
3
|
+
import { SessionEnvironmentService } from "../../execution-environments/session-environment-service.js";
|
|
1
4
|
import { readWorkspaceRevision } from "../coding/workspace-revision.js";
|
|
2
5
|
import { EXTERNAL_TOOL_NAMES } from "../external-tools/gateway-tools.js";
|
|
3
6
|
import "../external-tools/index.js";
|
|
4
7
|
import { createDelegateChildHandle } from "../child-agent-factory.js";
|
|
5
|
-
import { runGit } from "../../execution-environments/git.js";
|
|
6
|
-
import { LocalWorktreeManager } from "../../execution-environments/local-worktree-manager.js";
|
|
7
|
-
import { SessionEnvironmentService } from "../../execution-environments/session-environment-service.js";
|
|
8
8
|
import { Type } from "@sinclair/typebox";
|
|
9
9
|
//#region src/agent/tools/delegate-tool.ts
|
|
10
10
|
const DEFAULT_DELEGATE_TOOLS = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { commandRegistry, commandTimeout } from "../commands/command-registry.js";
|
|
2
|
-
import { formatSize, truncateTail } from "./truncate.js";
|
|
3
2
|
import { evaluateExecPolicy } from "../sandbox/exec-policy.js";
|
|
3
|
+
import { formatSize, truncateTail } from "./truncate.js";
|
|
4
4
|
import { publishArtifactPaths } from "./publish-artifacts.js";
|
|
5
5
|
import { resolve } from "node:path";
|
|
6
6
|
import { Type } from "@sinclair/typebox";
|
|
@@ -93,6 +93,7 @@ function createExecCommandTool(workspaceCwd, options) {
|
|
|
93
93
|
const policy = evaluateExecPolicy({
|
|
94
94
|
command,
|
|
95
95
|
cwd: requestedCwd,
|
|
96
|
+
workspaceRoot: workspaceCwd,
|
|
96
97
|
allowedEnvVars: options?.getSkillPassthroughEnvVarNames?.() ?? []
|
|
97
98
|
});
|
|
98
99
|
if (!policy.allowed) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { withRetry } from "../../infra/retry.js";
|
|
3
4
|
import { commandTimeout } from "../commands/command-registry.js";
|
|
4
5
|
import { DEFAULT_TOOL_EXECUTION_TIMEOUT_MS, TimeoutError, executeWithTimeout } from "../lifecycle/timeout-wrapper.js";
|
|
5
|
-
import { withRetry } from "../../infra/retry.js";
|
|
6
6
|
import { ToolConcurrencyController, resolveToolLockMode } from "./concurrency.js";
|
|
7
7
|
//#region src/agent/tools/executor.ts
|
|
8
8
|
init_logger();
|
|
@@ -7,15 +7,24 @@ import { getSessionMetadata } from "../../storage/sqlite/session-repository.js";
|
|
|
7
7
|
import { getSessionTaskPlan, setSessionTaskPlan } from "../../storage/sqlite/session-task-plan-repository.js";
|
|
8
8
|
import "../../storage/sqlite/index.js";
|
|
9
9
|
import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
|
|
10
|
-
import {
|
|
10
|
+
import { BrowserRuntime } from "../../browser/runtime/browser-runtime.js";
|
|
11
11
|
import "../../../packages/browser-control-contract/src/index.js";
|
|
12
|
-
import {
|
|
12
|
+
import { createBrowserDriver } from "../../browser/drivers/create-driver.js";
|
|
13
|
+
import { checkBrowserReadiness } from "../../browser/readiness.js";
|
|
14
|
+
import "../../browser/index.js";
|
|
15
|
+
import { mergeTtsConfigFromAppConfig } from "../../voice/tts/merge-config.js";
|
|
16
|
+
import { resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
|
|
17
|
+
import { createWorkflowCatalog } from "../workflow/catalog.js";
|
|
18
|
+
import { buildRuntimeEnvironment } from "../../runtime-tools/environment.js";
|
|
19
|
+
import { skillEnvironmentId } from "../skills/installer.js";
|
|
13
20
|
import { wrapToolsWithProtection } from "./executor.js";
|
|
14
21
|
import { EXTERNAL_TOOL_NAMES } from "../external-tools/gateway-tools.js";
|
|
15
|
-
import { buildRuntimeEnvironment } from "../../runtime-tools/environment.js";
|
|
16
22
|
import { createDefaultExternalToolGatewayTools } from "../external-tools/index.js";
|
|
23
|
+
import { resolveUserContextSessionAccess } from "../../user-context/access-policy.js";
|
|
24
|
+
import { getPendingTranscriptUserText } from "../inbound/attachment-pipeline.js";
|
|
25
|
+
import { getEmbeddedExecutionRunId, getEmbeddedExecutionSession } from "../embedded/execution-context.js";
|
|
26
|
+
import { createDelegateTool } from "./delegate-tool.js";
|
|
17
27
|
import { createReadFileTool } from "./read.js";
|
|
18
|
-
import { skillEnvironmentId } from "../skills/installer.js";
|
|
19
28
|
import { createWriteFileTool } from "./write.js";
|
|
20
29
|
import { createListDirTool } from "./list-dir.js";
|
|
21
30
|
import { createPublishArtifactsTool } from "./publish-artifacts.js";
|
|
@@ -38,12 +47,6 @@ import { createUpdatePlanTool } from "./update-plan-tool.js";
|
|
|
38
47
|
import { createSessionStatusTool } from "./session-status-tool.js";
|
|
39
48
|
import { createMemoryMaintenanceTool } from "./memory-maintenance-tool.js";
|
|
40
49
|
import { createClarifyTool } from "./clarify-tool.js";
|
|
41
|
-
import { BrowserRuntime } from "../../browser/runtime/browser-runtime.js";
|
|
42
|
-
import { createBrowserDriver } from "../../browser/drivers/create-driver.js";
|
|
43
|
-
import { checkBrowserReadiness } from "../../browser/readiness.js";
|
|
44
|
-
import "../../browser/index.js";
|
|
45
|
-
import { getPendingTranscriptUserText } from "../inbound/attachment-pipeline.js";
|
|
46
|
-
import { createDelegateTool } from "./delegate-tool.js";
|
|
47
50
|
import { createWorkflowTool } from "./workflow-tool.js";
|
|
48
51
|
import { createAutomationTool } from "./automation-tool.js";
|
|
49
52
|
import { createBrowserAutomationTool } from "./browser-automation-tool.js";
|
|
@@ -58,12 +61,9 @@ import { createManagedJobTool } from "./managed-job-tool.js";
|
|
|
58
61
|
import { createImageTool } from "./image-tool.js";
|
|
59
62
|
import { createImageGenerateTool } from "./image-generate-tool.js";
|
|
60
63
|
import "./index.js";
|
|
61
|
-
import { resolveUserContextSessionAccess } from "../../user-context/access-policy.js";
|
|
62
64
|
import { createBrowserUseTool } from "./browser/tool/browser-use-tool.js";
|
|
63
65
|
import { createReviewWorkspaceTool } from "./review-workspace.js";
|
|
64
66
|
import { createLanguageDiagnosticsTool } from "./language-diagnostics.js";
|
|
65
|
-
import { createWorkflowCatalog } from "../workflow/catalog.js";
|
|
66
|
-
import { mergeTtsConfigFromAppConfig } from "../../voice/tts/merge-config.js";
|
|
67
67
|
import { createTextToSpeechTool } from "./tts-tool.js";
|
|
68
68
|
import { getAgentCapabilityToolNames } from "../capabilities/registry.js";
|
|
69
69
|
import "../capabilities/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
|
|
2
2
|
import { resolveToCwd } from "../../utils/helpers.js";
|
|
3
|
-
import { repositorySearch } from "./repository-search.js";
|
|
3
|
+
import { isSearchFileAllowed, repositorySearch } from "./repository-search.js";
|
|
4
4
|
import { Type } from "@sinclair/typebox";
|
|
5
5
|
//#region src/agent/tools/find.ts
|
|
6
6
|
const findSchema = Type.Object({
|
|
@@ -20,20 +20,22 @@ function createFindTool(cwd) {
|
|
|
20
20
|
supportsParallel: true,
|
|
21
21
|
idempotent: true,
|
|
22
22
|
async execute(_id, params, signal) {
|
|
23
|
-
|
|
23
|
+
let path = resolveToCwd(params.path || ".", cwd);
|
|
24
24
|
const policy = evaluateFilePolicy({
|
|
25
25
|
operation: "read",
|
|
26
26
|
path,
|
|
27
27
|
workspaceRoot: cwd
|
|
28
28
|
});
|
|
29
29
|
if (!policy.allowed) throw new Error(policy.reason);
|
|
30
|
+
path = policy.canonicalPath;
|
|
30
31
|
const result = await repositorySearch(path, [
|
|
31
32
|
"--files",
|
|
33
|
+
"--null",
|
|
32
34
|
"--glob",
|
|
33
35
|
params.pattern
|
|
34
36
|
], signal);
|
|
35
37
|
const limit = Math.min(1e4, Math.max(1, params.limit ?? 1e3));
|
|
36
|
-
const lines = result.output.
|
|
38
|
+
const lines = result.output.split("\0").slice(0, -1).filter((file) => file && isSearchFileAllowed(cwd, resolveToCwd(file, path))).sort();
|
|
37
39
|
const truncated = result.truncated || lines.length > limit;
|
|
38
40
|
return {
|
|
39
41
|
content: [{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
|
|
2
2
|
import { resolveToCwd } from "../../utils/helpers.js";
|
|
3
|
-
import { repositorySearch } from "./repository-search.js";
|
|
3
|
+
import { isSearchFileAllowed, repositorySearch } from "./repository-search.js";
|
|
4
4
|
import { Type } from "@sinclair/typebox";
|
|
5
5
|
//#region src/agent/tools/grep.ts
|
|
6
6
|
const grepSchema = Type.Object({
|
|
@@ -27,15 +27,17 @@ function createGrepTool(cwd) {
|
|
|
27
27
|
supportsParallel: true,
|
|
28
28
|
idempotent: true,
|
|
29
29
|
async execute(_id, params, signal) {
|
|
30
|
-
|
|
30
|
+
let path = resolveToCwd(params.path || ".", cwd);
|
|
31
31
|
const policy = evaluateFilePolicy({
|
|
32
32
|
operation: "read",
|
|
33
33
|
path,
|
|
34
34
|
workspaceRoot: cwd
|
|
35
35
|
});
|
|
36
36
|
if (!policy.allowed) throw new Error(policy.reason);
|
|
37
|
+
path = policy.canonicalPath;
|
|
37
38
|
const limit = Math.min(1e3, Math.max(1, params.limit ?? 100));
|
|
38
39
|
const result = await repositorySearch(cwd, [
|
|
40
|
+
"--json",
|
|
39
41
|
"--line-number",
|
|
40
42
|
"--with-filename",
|
|
41
43
|
"--color",
|
|
@@ -55,13 +57,28 @@ function createGrepTool(cwd) {
|
|
|
55
57
|
"--",
|
|
56
58
|
path
|
|
57
59
|
], signal);
|
|
58
|
-
const lines =
|
|
60
|
+
const lines = [];
|
|
61
|
+
for (const row of result.output.split("\n")) {
|
|
62
|
+
if (!row) continue;
|
|
63
|
+
let event;
|
|
64
|
+
try {
|
|
65
|
+
event = JSON.parse(row);
|
|
66
|
+
} catch {
|
|
67
|
+
if (result.truncated) continue;
|
|
68
|
+
throw new Error("Invalid search output");
|
|
69
|
+
}
|
|
70
|
+
if (event.type !== "match" && event.type !== "context") continue;
|
|
71
|
+
const data = event.data;
|
|
72
|
+
if (!data?.path?.text || !data.lines?.text || !isSearchFileAllowed(cwd, data.path.text)) continue;
|
|
73
|
+
const separator = event.type === "match" ? ":" : "-";
|
|
74
|
+
lines.push(`${data.path.text}${separator}${data.line_number}${separator}${data.lines.text.replace(/\r?\n$/, "")}`);
|
|
75
|
+
}
|
|
59
76
|
const outputLimit = limit * (1 + 2 * (params.context ?? 0));
|
|
60
77
|
const truncated = result.truncated || lines.length > outputLimit;
|
|
61
78
|
return {
|
|
62
79
|
content: [{
|
|
63
80
|
type: "text",
|
|
64
|
-
text: (
|
|
81
|
+
text: (lines.length ? lines.slice(0, outputLimit).join("\n") : "No matches found") + (truncated ? "\n[Results truncated; narrow the path or pattern.]" : "")
|
|
65
82
|
}],
|
|
66
83
|
details: { truncated }
|
|
67
84
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { getAgentDefaultImageGenerationModelConfig, init_schema } from "../../config/schema.js";
|
|
2
2
|
import { imageAssetFromDataUrl, imageFileExtensionForMimeType, mimeTypeFromFileName, parseImageDataUrl, sniffImageMimeType } from "../image/generation/image-assets.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getImageGenerationProvider } from "../image/generation/provider-registry.js";
|
|
4
4
|
import { buildCapabilityPlansForConfig } from "../../capabilities/readiness/from-config.js";
|
|
5
5
|
import "../../capabilities/readiness/index.js";
|
|
6
6
|
import { applyImageGenerationModelConfigDefaults } from "../image/image-helpers.js";
|
|
7
|
+
import { readWorkspaceFile, writeWorkspaceFile } from "../sandbox/fileAccess.js";
|
|
8
|
+
import { persistToolMedia } from "./tool-media.js";
|
|
7
9
|
import { isFailoverError } from "../failover-error.js";
|
|
8
|
-
import { getImageGenerationProvider } from "../image/generation/provider-registry.js";
|
|
9
10
|
import { generateImage, listImageGenerationProvidersSummary } from "../image/generation/runtime.js";
|
|
10
11
|
import path from "node:path";
|
|
11
12
|
import { randomBytes } from "node:crypto";
|
|
12
|
-
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
13
13
|
import { Type } from "@sinclair/typebox";
|
|
14
14
|
//#region src/agent/tools/image-generate-tool.ts
|
|
15
15
|
init_schema();
|
|
@@ -114,7 +114,7 @@ async function loadInputImages(params) {
|
|
|
114
114
|
if (resolved !== workspaceAbs && !resolved.startsWith(workspaceAbs + path.sep)) throw new ToolInputError("inputImages[].source escapes workspace.");
|
|
115
115
|
let buffer;
|
|
116
116
|
try {
|
|
117
|
-
buffer =
|
|
117
|
+
buffer = readWorkspaceFile(params.workspace, resolved);
|
|
118
118
|
} catch (e) {
|
|
119
119
|
throw new ToolInputError(`inputImages[].source not readable: ${e instanceof Error ? e.message : String(e)}`);
|
|
120
120
|
}
|
|
@@ -173,7 +173,6 @@ function resolveImageGenerationModelConfigForTool(params) {
|
|
|
173
173
|
}
|
|
174
174
|
async function saveGeneratedImages(params) {
|
|
175
175
|
const dir = path.join(params.workspace, "media", "generated");
|
|
176
|
-
await mkdir(dir, { recursive: true });
|
|
177
176
|
const out = [];
|
|
178
177
|
const random = randomBytes(4).toString("hex");
|
|
179
178
|
let i = 0;
|
|
@@ -182,7 +181,7 @@ async function saveGeneratedImages(params) {
|
|
|
182
181
|
const ext = imageFileExtensionForMimeType(img.mimeType);
|
|
183
182
|
const name = `${(params.filenameHint?.replace(/[^\w.-]/g, "") || "image") + `-${random}`}-${i}.${ext}`;
|
|
184
183
|
const full = path.join(dir, name);
|
|
185
|
-
|
|
184
|
+
writeWorkspaceFile(params.workspace, full, img.buffer);
|
|
186
185
|
out.push(full);
|
|
187
186
|
}
|
|
188
187
|
return out;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { assertBrowserUrlAllowed } from "../../browser/url-policy.js";
|
|
2
|
+
import { BrowserRuntime } from "../../browser/runtime/browser-runtime.js";
|
|
3
|
+
import "../../browser/index.js";
|
|
1
4
|
import { DEFAULT_TOOL_METADATA, getToolMetadata } from "./metadata.js";
|
|
2
5
|
import { ToolConcurrencyController, resolveToolLockMode } from "./concurrency.js";
|
|
6
|
+
import { resolveImageModelConfigForTool } from "../image/tool-model-config.js";
|
|
7
|
+
import { DEFAULT_DELEGATE_TOOLS, DELEGATE_BLOCKED_TOOLS, createDelegateTool } from "./delegate-tool.js";
|
|
3
8
|
import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, GREP_MAX_LINE_LENGTH, formatSize, truncateHead, truncateLine, truncateTail } from "./truncate.js";
|
|
4
9
|
import { createReadFileTool } from "./read.js";
|
|
5
10
|
import { createWriteFileTool, writeFileTool } from "./write.js";
|
|
@@ -25,11 +30,6 @@ import { createUpdatePlanTool } from "./update-plan-tool.js";
|
|
|
25
30
|
import { createSessionStatusTool } from "./session-status-tool.js";
|
|
26
31
|
import { createMemoryMaintenanceTool } from "./memory-maintenance-tool.js";
|
|
27
32
|
import { createClarifyTool } from "./clarify-tool.js";
|
|
28
|
-
import { assertBrowserUrlAllowed } from "../../browser/url-policy.js";
|
|
29
|
-
import { BrowserRuntime } from "../../browser/runtime/browser-runtime.js";
|
|
30
|
-
import "../../browser/index.js";
|
|
31
|
-
import { resolveImageModelConfigForTool } from "../image/tool-model-config.js";
|
|
32
|
-
import { DEFAULT_DELEGATE_TOOLS, DELEGATE_BLOCKED_TOOLS, createDelegateTool } from "./delegate-tool.js";
|
|
33
33
|
import { createWorkflowTool } from "./workflow-tool.js";
|
|
34
34
|
import { createAutomationTool } from "./automation-tool.js";
|
|
35
35
|
import { createBrowserAutomationTool } from "./browser-automation-tool.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolvePathUnderWorkspace } from "./tool-paths.js";
|
|
2
|
+
import { checkedFilePath } from "../sandbox/fileAccess.js";
|
|
2
3
|
import { readdir } from "fs/promises";
|
|
3
4
|
import { Type } from "@sinclair/typebox";
|
|
4
5
|
//#region src/agent/tools/list-dir.ts
|
|
@@ -16,7 +17,7 @@ function createListDirTool(workspace) {
|
|
|
16
17
|
return {
|
|
17
18
|
content: [{
|
|
18
19
|
type: "text",
|
|
19
|
-
text: (await readdir(resolvePathUnderWorkspace(params.path, workspace), { withFileTypes: true })).map((e) => {
|
|
20
|
+
text: (await readdir(checkedFilePath(workspace, resolvePathUnderWorkspace(params.path, workspace), "read"), { withFileTypes: true })).map((e) => {
|
|
20
21
|
return `${e.isDirectory() ? "d" : e.isFile() ? "f" : "?"} ${e.name}`;
|
|
21
22
|
}).join("\n") || "(empty)"
|
|
22
23
|
}],
|
|
@@ -71,6 +71,7 @@ function createManagedJobTool(workspace, getSessionKey, getSkillPassthroughEnvVa
|
|
|
71
71
|
error: "command is required"
|
|
72
72
|
});
|
|
73
73
|
const policy = evaluateExecPolicy({
|
|
74
|
+
workspaceRoot: workspace,
|
|
74
75
|
command,
|
|
75
76
|
cwd: resolve(workspace, input.cwd?.trim() || "."),
|
|
76
77
|
allowedEnvVars: getSkillPassthroughEnvVarNames?.() ?? []
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { turnOutcomeKindFromFileName, turnOutcomeMimeTypeFromFileName } from "../../../packages/gateway-contract/src/turn-outcome.js";
|
|
2
|
-
import { resolvePathUnderWorkspace } from "./tool-paths.js";
|
|
3
2
|
import { fileResourceId, fileSpaceId } from "../../files/file-service.js";
|
|
3
|
+
import { resolvePathUnderWorkspace } from "./tool-paths.js";
|
|
4
4
|
import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
|
|
5
|
+
import { readWorkspaceFile } from "../sandbox/fileAccess.js";
|
|
5
6
|
import { persistToolMedia } from "./tool-media.js";
|
|
6
7
|
import { basename, isAbsolute, relative, sep } from "node:path";
|
|
7
|
-
import {
|
|
8
|
+
import { realpath } from "node:fs/promises";
|
|
8
9
|
import { Type } from "@sinclair/typebox";
|
|
9
10
|
//#region src/agent/tools/publish-artifacts.ts
|
|
10
11
|
const PublishArtifactsSchema = Type.Object({ paths: Type.Array(Type.String({ minLength: 1 }), {
|
|
@@ -35,7 +36,7 @@ async function publishArtifactPaths(params) {
|
|
|
35
36
|
if (sourcePath !== ".." && !sourcePath.startsWith(`..${sep}`) && !isAbsolute(sourcePath)) sourceFileId = fileResourceId(fileSpaceId(root), sourcePath.split(sep).join("/"));
|
|
36
37
|
}
|
|
37
38
|
const media = await persistToolMedia({
|
|
38
|
-
buffer:
|
|
39
|
+
buffer: readWorkspaceFile(params.workspaceRoot, source),
|
|
39
40
|
filePath: resolved
|
|
40
41
|
});
|
|
41
42
|
const kind = turnOutcomeKindFromFileName(media.name);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { isBareProfileMarkdownFileName, resolvePathUnderWorkspace, resolveProfileMarkdownPathIfBareName } from "./tool-paths.js";
|
|
2
|
+
import { checkedFilePath, readWorkspaceFile } from "../sandbox/fileAccess.js";
|
|
1
3
|
import { checkFileSafety } from "../prompt/safety.js";
|
|
2
4
|
import { DEFAULT_MAX_BYTES, formatSize, truncateHead } from "./truncate.js";
|
|
3
|
-
import {
|
|
4
|
-
import { readFile, stat } from "fs/promises";
|
|
5
|
+
import { stat } from "fs/promises";
|
|
5
6
|
import { Type } from "@sinclair/typebox";
|
|
6
7
|
//#region src/agent/tools/read.ts
|
|
7
8
|
const MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
@@ -41,7 +42,8 @@ async function executeReadFile(workspace, profileMarkdownRoot, params) {
|
|
|
41
42
|
}],
|
|
42
43
|
details: { status: "failed" }
|
|
43
44
|
};
|
|
44
|
-
let
|
|
45
|
+
let activeRoot = workspace;
|
|
46
|
+
let normalized = checkedFilePath(activeRoot, resolvePathUnderWorkspace(params.path, workspace), "read");
|
|
45
47
|
let stats;
|
|
46
48
|
try {
|
|
47
49
|
stats = await stat(normalized);
|
|
@@ -49,8 +51,9 @@ async function executeReadFile(workspace, profileMarkdownRoot, params) {
|
|
|
49
51
|
if (e?.code === "ENOENT" && profileMarkdownRoot && isBareProfileMarkdownFileName(params.path)) {
|
|
50
52
|
const alt = resolveProfileMarkdownPathIfBareName(params.path, profileMarkdownRoot);
|
|
51
53
|
try {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
normalized = checkedFilePath(profileMarkdownRoot, alt, "read");
|
|
55
|
+
stats = await stat(normalized);
|
|
56
|
+
activeRoot = profileMarkdownRoot;
|
|
54
57
|
} catch {
|
|
55
58
|
throw e;
|
|
56
59
|
}
|
|
@@ -63,7 +66,7 @@ async function executeReadFile(workspace, profileMarkdownRoot, params) {
|
|
|
63
66
|
}],
|
|
64
67
|
details: { status: "failed" }
|
|
65
68
|
};
|
|
66
|
-
const content =
|
|
69
|
+
const content = readWorkspaceFile(activeRoot, normalized, MAX_FILE_SIZE).toString("utf8");
|
|
67
70
|
const offset = Math.max(1, params.offset ?? 1);
|
|
68
71
|
const lines = content.split("\n");
|
|
69
72
|
if (offset > lines.length) throw new Error(`Offset ${offset} exceeds ${lines.length} lines`);
|
|
@@ -3,3 +3,5 @@ export declare function repositorySearch(cwd: string, args: string[], signal?: A
|
|
|
3
3
|
output: string;
|
|
4
4
|
truncated: boolean;
|
|
5
5
|
}>;
|
|
6
|
+
/** Search results must satisfy the same policy as direct file reads. */
|
|
7
|
+
export declare function isSearchFileAllowed(workspace: string, path: string): boolean;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { prepareSafeToolEnv } from "../sandbox/sanitize-env-vars.js";
|
|
2
|
+
import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
|
|
1
3
|
import { resolveRipgrepBinary } from "../../infra/ripgrep.js";
|
|
4
|
+
import { lstatSync } from "node:fs";
|
|
2
5
|
import { spawn } from "node:child_process";
|
|
3
6
|
//#region src/agent/tools/repository-search.ts
|
|
4
7
|
/** Bounded native search; unavailable tools and invalid regexes are explicit failures. */
|
|
@@ -6,15 +9,41 @@ async function repositorySearch(cwd, args, signal) {
|
|
|
6
9
|
signal?.throwIfAborted();
|
|
7
10
|
const binary = await resolveRipgrepBinary();
|
|
8
11
|
return new Promise((resolve, reject) => {
|
|
12
|
+
const separator = args.indexOf("--");
|
|
13
|
+
const options = separator < 0 ? args : args.slice(0, separator);
|
|
14
|
+
const targets = separator < 0 ? [] : args.slice(separator);
|
|
15
|
+
const excluded = [
|
|
16
|
+
".git",
|
|
17
|
+
"node_modules",
|
|
18
|
+
".env",
|
|
19
|
+
".env.*",
|
|
20
|
+
".ssh",
|
|
21
|
+
".aws",
|
|
22
|
+
".gnupg",
|
|
23
|
+
".docker",
|
|
24
|
+
".config",
|
|
25
|
+
".netrc",
|
|
26
|
+
".npmrc",
|
|
27
|
+
".cargo/credentials",
|
|
28
|
+
".kube",
|
|
29
|
+
".xopc"
|
|
30
|
+
];
|
|
9
31
|
const child = spawn(binary, [
|
|
10
32
|
"--no-config",
|
|
11
33
|
"--hidden",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
34
|
+
...options,
|
|
35
|
+
...excluded.flatMap((path) => [
|
|
36
|
+
"--glob",
|
|
37
|
+
`!**/${path}`,
|
|
38
|
+
"--glob",
|
|
39
|
+
`!**/${path}/**`
|
|
40
|
+
]),
|
|
41
|
+
"--no-follow",
|
|
42
|
+
...targets
|
|
43
|
+
], {
|
|
44
|
+
cwd,
|
|
45
|
+
env: prepareSafeToolEnv(process.env)
|
|
46
|
+
});
|
|
18
47
|
const chunks = [];
|
|
19
48
|
let bytes = 0, truncated = false, stderr = "";
|
|
20
49
|
const timer = setTimeout(() => child.kill("SIGKILL"), 1e4);
|
|
@@ -52,5 +81,20 @@ async function repositorySearch(cwd, args, signal) {
|
|
|
52
81
|
if (signal?.aborted) abort();
|
|
53
82
|
});
|
|
54
83
|
}
|
|
84
|
+
/** Search results must satisfy the same policy as direct file reads. */
|
|
85
|
+
function isSearchFileAllowed(workspace, path) {
|
|
86
|
+
const policy = evaluateFilePolicy({
|
|
87
|
+
operation: "read",
|
|
88
|
+
workspaceRoot: workspace,
|
|
89
|
+
path
|
|
90
|
+
});
|
|
91
|
+
if (!policy.allowed || !policy.canonicalPath) return false;
|
|
92
|
+
try {
|
|
93
|
+
const stat = lstatSync(policy.canonicalPath);
|
|
94
|
+
return stat.isFile() && stat.nlink === 1;
|
|
95
|
+
} catch {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
55
99
|
//#endregion
|
|
56
|
-
export { repositorySearch };
|
|
100
|
+
export { isSearchFileAllowed, repositorySearch };
|