@xopcai/xopc 0.0.277 → 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 +1 -1
- 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-Cavbls0E.js → agent-avatar-dicebear-lRVOwbrK.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DyCyuJpi.js → agent-defaults-settings-panel-DAqn5DdL.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-DlDTItrB.js → agents-DNQNTDkU.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-5gS0_LWl.js → app-management-settings-panel-oHTY5PDs.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DHzZCJon.js → appearance-settings-B0YnZ3ig.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-__yzruGu.js → apps-page-Bh0etSmL.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Ia98yZe3.js → archive-plugin-D4x142le.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DiWW88c8.js → attachment-load-zibD2Hod.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BuhTeGRJ.js → automations-page-Dkp7gp_S.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-DaisbmEh.js → automations-workspace-w4McwueN.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DDD48cJv.js → binary-plugins-CfUzu1Hc.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-0AWVCD3F.js → block-editor-r5nCBBan.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BKOYX5xV.js → browser-automations-page-BnL4JnTM.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-C7zjxscU.js → browser-settings-page-DxX-t0EJ.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-7kZMT1r6.js → capabilities-settings-panel-CvacBQAI.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-BKUh6hzO.js → channels-settings-CJzSNo-L.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CW9Byi8V.js → chat-terminal-dock-CWVnJtBp.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-m8J-F3u8.js → connectors-page-DNBhBT0b.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-gdYmKC8W.js → date-picker-XjPSlgq_.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-40BYmiMc.js → dependency-picker-CkyfEP88.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-By1z6tKE.js → desktop-pet-BAE_NVx5.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-ByjJqx9H.js → desktop-pet-settings-BUw6V2R9.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-CfWQfz7a.js → device-pairing-wizard-DsR5NQEC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DQO65KbM.js → extension-debug-page-giBeIVUT.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Db32jip6.js → extension-page-Bqo9bNtx.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CL8Wx8lf.js → extension-settings-page-BX-6AA3k.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-wLly-Kc1.js → gateway-settings-Dil7vuyU.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CRXWu2q6.js → heartbeat-settings-DWFAopk_.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-FqgSwpmy.js → home-page-Dpeuvazg.js} +1 -1
- package/dist/gateway/static/root/assets/{index-5UchbidQ.js → index-B03HGpzt.js} +9 -9
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CjehhHPz.js → keyboard-shortcuts-settings-BKGPpBnV.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DtYZa4GK.js → local-app-workbench-page-CBtemxFc.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-CrIdaTrK.js → local-apps-page-B06ToOxB.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-FfSwV_VH.js → logs-page-DibI1GsP.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-BakV5aOw.js → management-settings-DJ6yMZCd.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Blv9U6Jp.js → media-plugins-CdrLNAks.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-JbvyGdEX.js → note-detail-panel-GOxomxOK.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-Dm7mE2FK.js → notes-page-CQBgk3_x.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-BQfVtLLC.js → page-tabs-B7LA4z-x.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-kjHFiO81.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/{project-detail-page-h00lfcVI.js → project-detail-page-B1Pm-fQd.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-C2Bo1FAL.js → projects-page-DUrxyNR9.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-_bZYAl49.js → remote-access-hub-C6VzHUwx.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BhJlopSW.js → runtime-tools-settings-panel-D-DZf4I1.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-cxoO_5I1.js → schema-form-B-Yj9DVW.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-F7CHsvPa.js → sessions-page-DtemHfkv.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-ByEVQe0c.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BiRTWiBi.js → settings-form-section-BxPUqwY6.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-D-Cb71pq.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-DciHfTay.js → share-preview-page-DAc_FkVc.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BS2pnWO0.js → shares-settings-Dwdv6QyS.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-DX344nVV.js → skill-reload-api-CDzQWN60.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-BhfKUsv7.js → skills-page-CO5XVkbY.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CU7PALQB.js → skills-page.utils-BR5bk2vT.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-GpjNbqvM.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-Bhi_x_h4.js → tunnel-api-BABuQvGD.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-LvCiBidm.js → use-autosave-Dc5aN2px.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-BydARq2C.js → user-model-page-UhsSP_pC.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BlGysZxj.js → voice-api-key-field-CY0DpJui.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DvIQOR5x.js → work-discovery-overlay-Brg9yJBr.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-JIp60bXT.js → workflow-run-setup-panel-D3fq7boB.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-B972t6zx.js → workflows-page-S7XXNBWa.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -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/config.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.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 +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- 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/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/heartbeat/service.js +1 -1
- 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 +1 -1
- 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 +4 -4
- 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 +36 -36
- package/dist/src/gateway/session-context-summary.js +2 -2
- package/dist/src/gateway/workspace-editor-path.js +2 -2
- package/dist/src/heartbeat/index.js +1 -1
- 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/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/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 +3 -3
- package/dist/src/tasks/index.js +3 -3
- package/dist/src/tasks/task-application-service.js +78 -4
- package/dist/src/tasks/task-context-assembler.js +2 -1
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-run-coordinator.js +1 -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/proactive-card-Ap_wfos3.js +0 -1
- package/dist/gateway/static/root/assets/proactive-page-D1lEuanT.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DtZSUX4H.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-VPfBsNVv.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CElcQ9Sh.js +0 -1
|
@@ -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 };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { prepareSafeToolEnv } from "../sandbox/sanitize-env-vars.js";
|
|
1
2
|
import { readWorkspaceRevision } from "../coding/workspace-revision.js";
|
|
3
|
+
import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
|
|
4
|
+
import { checkedFilePath, readWorkspaceFile } from "../sandbox/fileAccess.js";
|
|
2
5
|
import { resolve } from "node:path";
|
|
3
6
|
import { execFile } from "node:child_process";
|
|
4
|
-
import { lstat,
|
|
7
|
+
import { lstat, readlink, realpath } from "node:fs/promises";
|
|
5
8
|
import { promisify } from "node:util";
|
|
6
9
|
import { Type } from "@sinclair/typebox";
|
|
7
10
|
//#region src/agent/tools/review-workspace.ts
|
|
@@ -15,62 +18,125 @@ function createReviewWorkspaceTool(workspace) {
|
|
|
15
18
|
supportsParallel: true,
|
|
16
19
|
idempotent: true,
|
|
17
20
|
async execute(_id, _args, signal) {
|
|
18
|
-
let cwd = workspace;
|
|
21
|
+
let cwd = checkedFilePath(workspace, workspace, "read");
|
|
19
22
|
const git = async (args) => (await exec("git", [
|
|
20
23
|
"-c",
|
|
21
24
|
"core.fsmonitor=false",
|
|
22
25
|
...args
|
|
23
26
|
], {
|
|
24
27
|
cwd,
|
|
28
|
+
env: prepareSafeToolEnv(process.env),
|
|
25
29
|
signal,
|
|
26
30
|
timeout: 1e4,
|
|
27
31
|
maxBuffer: 8 * 1024 * 1024
|
|
28
32
|
})).stdout;
|
|
29
|
-
cwd = await realpath((await git(["rev-parse", "--show-toplevel"])).trim());
|
|
33
|
+
cwd = checkedFilePath(workspace, await realpath((await git(["rev-parse", "--show-toplevel"])).trim()), "read");
|
|
30
34
|
const startRevision = await readWorkspaceRevision(cwd);
|
|
31
35
|
const head = await git([
|
|
32
36
|
"rev-parse",
|
|
33
37
|
"--verify",
|
|
34
38
|
"HEAD"
|
|
35
39
|
]).catch(() => "");
|
|
36
|
-
const
|
|
40
|
+
const changedNames = head ? await git([
|
|
37
41
|
"diff",
|
|
42
|
+
"--no-renames",
|
|
43
|
+
"--name-only",
|
|
44
|
+
"-z",
|
|
45
|
+
"HEAD",
|
|
46
|
+
"--"
|
|
47
|
+
]) : (await Promise.all([git([
|
|
48
|
+
"diff",
|
|
49
|
+
"--name-only",
|
|
50
|
+
"-z",
|
|
51
|
+
"--cached",
|
|
52
|
+
"--"
|
|
53
|
+
]), git([
|
|
54
|
+
"diff",
|
|
55
|
+
"--name-only",
|
|
56
|
+
"-z",
|
|
57
|
+
"--"
|
|
58
|
+
])])).join("");
|
|
59
|
+
const safePaths = [];
|
|
60
|
+
let complete = true;
|
|
61
|
+
for (const path of new Set(changedNames.split("\0").filter(Boolean))) {
|
|
62
|
+
const file = resolve(cwd, path);
|
|
63
|
+
if (!evaluateFilePolicy({
|
|
64
|
+
workspaceRoot: workspace,
|
|
65
|
+
path: file,
|
|
66
|
+
operation: "read"
|
|
67
|
+
}).allowed) {
|
|
68
|
+
complete = false;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const info = await lstat(file).catch((error) => {
|
|
72
|
+
if (error.code === "ENOENT") return null;
|
|
73
|
+
throw error;
|
|
74
|
+
});
|
|
75
|
+
if (info && (!info.isFile() || info.nlink !== 1)) {
|
|
76
|
+
complete = false;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
safePaths.push(`:(literal)${path}`);
|
|
80
|
+
}
|
|
81
|
+
if (safePaths.length > 1e3) throw new Error("Too many changed files for a bounded workspace review");
|
|
82
|
+
const [diff, names] = await Promise.all([safePaths.length === 0 ? Promise.resolve("") : head ? git([
|
|
83
|
+
"diff",
|
|
84
|
+
"--no-renames",
|
|
38
85
|
"--no-ext-diff",
|
|
39
86
|
"--no-textconv",
|
|
40
87
|
"--binary",
|
|
41
88
|
"HEAD",
|
|
42
|
-
"--"
|
|
89
|
+
"--",
|
|
90
|
+
...safePaths
|
|
43
91
|
]) : Promise.all([git([
|
|
44
92
|
"diff",
|
|
93
|
+
"--no-renames",
|
|
45
94
|
"--no-ext-diff",
|
|
46
95
|
"--no-textconv",
|
|
47
96
|
"--binary",
|
|
48
97
|
"--cached",
|
|
49
|
-
"--"
|
|
98
|
+
"--",
|
|
99
|
+
...safePaths
|
|
50
100
|
]), git([
|
|
51
101
|
"diff",
|
|
102
|
+
"--no-renames",
|
|
52
103
|
"--no-ext-diff",
|
|
53
104
|
"--no-textconv",
|
|
54
105
|
"--binary",
|
|
55
|
-
"--"
|
|
106
|
+
"--",
|
|
107
|
+
...safePaths
|
|
56
108
|
])]).then((parts) => parts.join("\n")), git([
|
|
57
109
|
"ls-files",
|
|
58
110
|
"--others",
|
|
59
111
|
"--exclude-standard",
|
|
60
112
|
"-z"
|
|
61
113
|
])]);
|
|
62
|
-
let text = diff.slice(0, 2e5)
|
|
114
|
+
let text = diff.slice(0, 2e5);
|
|
115
|
+
complete &&= diff.length <= 2e5;
|
|
63
116
|
for (const path of names.split("\0").filter(Boolean)) {
|
|
64
117
|
signal?.throwIfAborted();
|
|
65
118
|
if (text.length >= 2e5) {
|
|
66
119
|
complete = false;
|
|
67
120
|
break;
|
|
68
121
|
}
|
|
69
|
-
const file = resolve(cwd, path)
|
|
122
|
+
const file = resolve(cwd, path);
|
|
123
|
+
if (!evaluateFilePolicy({
|
|
124
|
+
workspaceRoot: workspace,
|
|
125
|
+
path: file,
|
|
126
|
+
operation: "read"
|
|
127
|
+
}).allowed) {
|
|
128
|
+
complete = false;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const info = await lstat(file);
|
|
132
|
+
if (info.isFile() && info.nlink !== 1) {
|
|
133
|
+
complete = false;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
70
136
|
text += `\nUntracked file: ${path}\n`;
|
|
71
137
|
if (info.isSymbolicLink()) text += `Symlink to ${await readlink(file)}\n`;
|
|
72
138
|
else if (info.isFile() && info.size <= 5e4) {
|
|
73
|
-
const content =
|
|
139
|
+
const content = readWorkspaceFile(workspace, file, 5e4);
|
|
74
140
|
if (content.includes(0)) {
|
|
75
141
|
text += "(binary file; inspect separately)\n";
|
|
76
142
|
complete = false;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { turnOutcomeKindFromFileName } from "../../../packages/gateway-contract/src/turn-outcome.js";
|
|
2
|
-
import { checkFileSafety } from "../prompt/safety.js";
|
|
3
2
|
import { resolvePathUnderWorkspace } from "./tool-paths.js";
|
|
3
|
+
import { MEDIA_MAX_BYTES } from "../../media/store.js";
|
|
4
|
+
import { readWorkspaceFile } from "../sandbox/fileAccess.js";
|
|
5
|
+
import { checkFileSafety } from "../prompt/safety.js";
|
|
4
6
|
import { persistToolMedia } from "./tool-media.js";
|
|
5
7
|
import { basename } from "node:path";
|
|
6
|
-
import { readFile } from "fs/promises";
|
|
7
8
|
import { Type } from "@sinclair/typebox";
|
|
8
9
|
//#region src/agent/tools/send-media.ts
|
|
9
10
|
const SendMediaSchema = Type.Object({
|
|
10
|
-
filePath: Type.String({ description: "File to send. Relative paths are under the current agent workspace; absolute paths
|
|
11
|
+
filePath: Type.String({ description: "File to send. Relative paths are under the current agent workspace; absolute paths must remain inside the workspace." }),
|
|
11
12
|
mediaType: Type.Optional(Type.Enum({
|
|
12
13
|
photo: "photo",
|
|
13
14
|
video: "video",
|
|
@@ -42,7 +43,7 @@ function createSendMediaTool(workspace, bus, getContext) {
|
|
|
42
43
|
details: {}
|
|
43
44
|
};
|
|
44
45
|
try {
|
|
45
|
-
const fileBuffer =
|
|
46
|
+
const fileBuffer = readWorkspaceFile(workspace, resolved, MEDIA_MAX_BYTES);
|
|
46
47
|
const media = await persistToolMedia({
|
|
47
48
|
buffer: fileBuffer,
|
|
48
49
|
filePath: resolved,
|