@xopcai/xopc 0.0.244 → 0.0.245
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/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CAah-_8h.js → activity-store-BlxqErph.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BhXGsupm.js → agent-avatar-dicebear-DRQnogaU.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-Blzn2H6t.js → agent-defaults-settings-panel-CpOxGbMD.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-Cmp-z8Y_.js → agents-flnXZLaT.js} +1 -1
- package/dist/gateway/static/root/assets/{api-B2tKxbcz.js → api-BbXzyQMj.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CezjAP1K.js → app-management-settings-panel-CZl6n2xi.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C-CfS05x.js → appearance-settings-Bglp-pn6.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-7Y13_bqZ.js → apps-page-CmsWarVB.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BmSx7wzY.js → archive-plugin-DD2SweEH.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DI4CoIga.js → attachment-load-G0HenUmG.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-D04Xceck.js → automations-page-B78bFjH2.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-wEO1OWk0.js → automations-workspace-BMQGmn50.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-BJQe8TRu.js → binary-plugins-BbSQmXqn.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BSzGjJC6.js → block-editor-DutTIH81.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-DjAZ_LF2.js → browser-settings-page-CALiFKm4.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-CRnkgZHI.js → browser-workflow-inputs-BAAc151l.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CwbxA3B7.js → browser-workflows-page-DE5HPrHZ.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-jt9bqUMK.js → capabilities-settings-panel-Dts7XtP3.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-Cz_TWY3a.js → channels-settings-CWEd3wzh.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-status-swr-DuY4MGxe.js → channels-status-swr-CCBCtLDg.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D3gj2D3U.js → chat-terminal-dock-Bp1fXQm1.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-Shs5vbzx.js → connectors-page-CQ6wVNLm.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-DgWHw0jX.js → cron-expression-B8HA5IRb.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-CKg-RPbs.js → date-picker-DD8b7oad.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CVYkw-NN.js → dependency-picker-BC9zwIyH.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Bf46oXTY.js → desktop-pet-DsrsPZTW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BJO_klc7.js → desktop-pet-settings-D7gp_HNA.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-T2PmFFOW.js → extension-debug-page-BoKbOX7x.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-2wAE2RCe.js → extension-page-BegL4FW8.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Y9ZiCJ21.js → extension-settings-page-CjPqq57s.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DaYY1Gkn.js → gateway-config-api-DaG57o4X.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BC3pgb_P.js → gateway-config-swr-826dipyU.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-eO3IzW_J.js → gateway-settings-DkJGpgm6.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-uMcSfLru.js → gateway-startup-retry-DyvcAIMm.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-BAgrkyHc.js → heartbeat-settings-BLZ48kSU.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-GTjKH7LK.js → home-page-Dtw7Ipt1.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-D1qlQA-A.js → image-generation-api-D7cyfks6.js} +1 -1
- package/dist/gateway/static/root/assets/{index-DUz0O54y.js → index-DG5CfYat.js} +10 -10
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CWGqL6o5.js → keyboard-shortcuts-settings-D2Has7-N.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DKJ-rks0.js → local-app-workbench-page-BWidWY93.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-Bfidv29d.js → local-apps-page-Bkekjoxf.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CMZljTJx.js → locale-store-CBoCuIMx.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DwAHrPbF.js → logs-page-C5zSSgvA.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-BG7j1I9f.js → management-settings-B8c62vRS.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-AnmmpLs6.js → markdown-split-3kxTTGO7.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-PPCLt7fu.js → markdown-view-BXsHghJd.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CGS-05cE.js → media-plugins-BW8J1nCG.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BbdwoxVo.js +3 -0
- package/dist/gateway/static/root/assets/{mobile-pairing-wizard-DoKK5GfV.js → mobile-pairing-wizard-nwQ8iUcd.js} +1 -1
- package/dist/gateway/static/root/assets/models-hub-cache-88f4fzYS.js +1 -0
- package/dist/gateway/static/root/assets/{notes-page-Lr8rsFAR.js → notes-page-DdybD0QM.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-ISWnKLxO.js → notes-workbench-IYfpy2Jx.js} +2 -2
- package/dist/gateway/static/root/assets/{oauth-api-4VeMbkTJ.js → oauth-api-BjSUDIgq.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BU0HiZtv.js → product-open-page-CAJeUXeU.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-BZqr4yam.js → project-detail-page-4wjw-b7h.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-Dau8733A.js → projects-page-CCMj9PeL.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-CWOtPFrE.js → registry-api-BhGKnvLP.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DdChlvGP.js → remote-access-hub-DsBJqWIk.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CmZTNv1W.js → runtime-tools-settings-panel-B4IDcqx0.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-XlVPyiVQ.js → schema-form-DiGUUjO6.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-C3kADsd4.js → sessions-page-BwGj0t-2.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BJCfUghk.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-DblUeM3V.js → settings-page-CVQUsAhd.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-bDfRfSnq.js → setup-status-panel-CQACRh1i.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DBMWFMN-.js → share-preview-page-DTP1dtuS.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-Bu6lIStj.js → shares-settings-D_YPh6Rw.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B43xlJlX.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CSOseeQe.js → skills-page-Czpn7Y28.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CniRGhkJ.js → skills-page.utils-d39rm3hb.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-D0GqNpKy.js → system-settings-panel-CXXySCSp.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BRCq-nR7.js → task-detail-page-DHiOqQMx.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-uxUwr10D.js → theme-store-hybK3oC9.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-BtjS2nrM.js → tunnel-api-BiBGK7O2.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-TwuAycG8.js → use-autosave-DjpzpeIm.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-CbqPu8xZ.js → user-context-page-1XBRV5gX.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-CzwG5plu.js → voice-api-key-field-CUIPNmOc.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-MqyI6cgq.js → voice-config-api-CBbiF1T3.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DS15FzQA.js → work-discovery-overlay-DVNxhb1x.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C_boCemi.js → workflow-run-setup-panel-HxxFQFY7.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-CaI2ruyy.js → workflows-page-BCgL7PRm.js} +1 -1
- package/dist/gateway/static/root/index.html +11 -11
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/turn-outcome.js +3 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +3 -1
- package/dist/src/agent/agent-manager.d.ts +2 -4
- package/dist/src/agent/agent-manager.js +28 -32
- package/dist/src/agent/background-review/coordinator.js +1 -1
- package/dist/src/agent/background-review/run-background-review.js +2 -2
- package/dist/src/agent/child-agent-factory.d.ts +10 -7
- package/dist/src/agent/child-agent-factory.js +112 -158
- package/dist/src/agent/coding/index.d.ts +1 -1
- package/dist/src/agent/coding/index.js +2 -2
- package/dist/src/agent/coding/repository-instructions.d.ts +12 -0
- package/dist/src/agent/coding/repository-instructions.js +76 -0
- package/dist/src/agent/coding/run-verification.d.ts +34 -0
- package/dist/src/agent/coding/run-verification.js +134 -0
- package/dist/src/agent/coding/verification-command.d.ts +3 -0
- package/dist/src/agent/coding/verification-command.js +50 -0
- package/dist/src/agent/coding/workspace-revision.d.ts +2 -0
- package/dist/src/agent/coding/workspace-revision.js +77 -0
- package/dist/src/agent/commands/command-isolation.d.ts +21 -0
- package/dist/src/agent/commands/command-isolation.js +71 -0
- package/dist/src/agent/commands/command-registry.d.ts +56 -0
- package/dist/src/agent/commands/command-registry.js +259 -0
- package/dist/src/agent/embedded/index.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +3 -2
- package/dist/src/agent/embedded/run-turn.js +88 -25
- package/dist/src/agent/embedded/session-tool-result-guard.js +2 -2
- package/dist/src/agent/embedded/subscribe-session.d.ts +2 -1
- package/dist/src/agent/embedded/subscribe-session.js +2 -1
- package/dist/src/agent/embedded/types.d.ts +3 -1
- package/dist/src/agent/embedded/xopc-tools-bridge.js +4 -1
- package/dist/src/agent/image/index.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/index.js +3 -3
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/memory/user-context-coordinator.js +1 -1
- package/dist/src/agent/middleware/index.d.ts +0 -5
- package/dist/src/agent/middleware/index.js +1 -2
- package/dist/src/agent/orchestration/agent-event-handler.d.ts +0 -5
- package/dist/src/agent/orchestration/agent-event-handler.js +1 -96
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
- package/dist/src/agent/orchestration/agent-turn-policy.js +5 -5
- package/dist/src/agent/orchestration/index.d.ts +1 -1
- package/dist/src/agent/orchestration/index.js +2 -2
- package/dist/src/agent/orchestration/loop-guard.d.ts +4 -31
- package/dist/src/agent/orchestration/loop-guard.js +14 -99
- package/dist/src/agent/prompt/sections/tooling.js +2 -4
- package/dist/src/agent/sandbox/types.d.ts +2 -2
- package/dist/src/agent/sandbox/types.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/service.d.ts +0 -2
- package/dist/src/agent/service.js +8 -25
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.d.ts +7 -0
- package/dist/src/agent/tasks/task-judge-service.js +27 -5
- package/dist/src/agent/tools/delegate-tool.d.ts +2 -1
- package/dist/src/agent/tools/delegate-tool.js +102 -124
- package/dist/src/agent/tools/exec-command.d.ts +8 -1
- package/dist/src/agent/tools/exec-command.js +77 -169
- package/dist/src/agent/tools/executor.js +9 -2
- package/dist/src/agent/tools/factory.js +50 -5
- package/dist/src/agent/tools/find.d.ts +10 -13
- package/dist/src/agent/tools/find.js +33 -80
- package/dist/src/agent/tools/grep.d.ts +14 -18
- package/dist/src/agent/tools/grep.js +56 -144
- package/dist/src/agent/tools/index.d.ts +0 -1
- package/dist/src/agent/tools/index.js +2 -3
- package/dist/src/agent/tools/language-diagnostics.d.ts +11 -0
- package/dist/src/agent/tools/language-diagnostics.js +62 -0
- package/dist/src/agent/tools/managed-job-tool.d.ts +2 -1
- package/dist/src/agent/tools/managed-job-tool.js +58 -118
- package/dist/src/agent/tools/read.js +24 -7
- package/dist/src/agent/tools/repository-search.d.ts +5 -0
- package/dist/src/agent/tools/repository-search.js +56 -0
- package/dist/src/agent/tools/review-workspace.d.ts +2 -0
- package/dist/src/agent/tools/review-workspace.js +103 -0
- package/dist/src/agent/tools/write.js +4 -4
- package/dist/src/agent/transcript/index.js +2 -2
- package/dist/src/agent/transcript/transcript-hygiene.js +2 -2
- package/dist/src/agent/workflow/subagent-runner.d.ts +0 -2
- package/dist/src/agent/workflow/subagent-runner.js +12 -31
- package/dist/src/agent-config/schema.d.ts +42 -0
- package/dist/src/agent-config/schema.js +5 -0
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- 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/cli/commands/agent.js +2 -2
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/profile.js +1 -1
- package/dist/src/cli/commands/tunnel.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +28 -0
- package/dist/src/execution-environments/local-worktree-manager.d.ts +3 -1
- package/dist/src/execution-environments/local-worktree-manager.js +8 -3
- package/dist/src/execution-environments/session-environment-service.js +5 -3
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +7 -0
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +1 -1
- package/dist/src/gateway/media-access.js +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +4 -1
- package/dist/src/gateway/service.js +7 -7
- package/dist/src/gateway/session-reset-service.js +1 -1
- package/dist/src/gateway/workspace-ripgrep.d.ts +0 -6
- package/dist/src/gateway/workspace-ripgrep.js +2 -40
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/ripgrep.d.ts +13 -0
- package/dist/src/infra/ripgrep.js +46 -0
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/proactive/execution/agent-executor.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/session/store.js +1 -1
- package/dist/src/session/turn-outcome-projector.js +26 -6
- package/dist/src/share/hosted-session-share.js +1 -1
- package/dist/src/tasks/task-run-coordinator.d.ts +2 -2
- package/dist/src/tasks/task-run-coordinator.js +14 -12
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/messages-CTSgFlE4.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-ZrbGRiGY.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CSYy6SUa.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BNMc4l04.js +0 -1
- package/dist/src/agent/coding/turn-diff-tracker.d.ts +0 -67
- package/dist/src/agent/coding/turn-diff-tracker.js +0 -231
- package/dist/src/agent/middleware/self-verify.d.ts +0 -136
- package/dist/src/agent/middleware/self-verify.js +0 -380
- package/dist/src/agent/tools/execute-code-tool.d.ts +0 -11
- package/dist/src/agent/tools/execute-code-tool.js +0 -208
|
@@ -5,7 +5,9 @@ import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
|
|
|
5
5
|
import { getSessionTaskPlan, setSessionTaskPlan } from "../../storage/sqlite/session-task-plan-repository.js";
|
|
6
6
|
import "../../storage/sqlite/index.js";
|
|
7
7
|
import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
|
|
8
|
+
import { resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
|
|
8
9
|
import { wrapToolsWithProtection } from "./executor.js";
|
|
10
|
+
import { EXTERNAL_TOOL_NAMES } from "../external-tools/gateway-tools.js";
|
|
9
11
|
import { buildRuntimeEnvironment } from "../../runtime-tools/environment.js";
|
|
10
12
|
import { createDefaultExternalToolGatewayTools } from "../external-tools/index.js";
|
|
11
13
|
import { createReadFileTool } from "./read.js";
|
|
@@ -36,9 +38,8 @@ import { resolveBrowserBackendFromConfig } from "../../browser/backend-from-conf
|
|
|
36
38
|
import { checkBrowserReadiness } from "../../browser/readiness.js";
|
|
37
39
|
import { CdpSupervisor } from "../../browser/cdp-supervisor.js";
|
|
38
40
|
import "../../browser/index.js";
|
|
39
|
-
import "./delegate-tool.js";
|
|
41
|
+
import { createDelegateTool } from "./delegate-tool.js";
|
|
40
42
|
import { createWorkflowTool } from "./workflow-tool.js";
|
|
41
|
-
import "./execute-code-tool.js";
|
|
42
43
|
import { createAutomationTool } from "./automation-tool.js";
|
|
43
44
|
import { createBrowserRecipeTool } from "./browser-recipe-tool.js";
|
|
44
45
|
import { createXopcUseTool } from "./xopc-use-tool.js";
|
|
@@ -53,6 +54,8 @@ import { createImageTool } from "./image-tool.js";
|
|
|
53
54
|
import { createImageGenerateTool } from "./image-generate-tool.js";
|
|
54
55
|
import "./index.js";
|
|
55
56
|
import { createBrowserUseTool } from "./browser/tool/browser-use-tool.js";
|
|
57
|
+
import { createReviewWorkspaceTool } from "./review-workspace.js";
|
|
58
|
+
import { createLanguageDiagnosticsTool } from "./language-diagnostics.js";
|
|
56
59
|
import { createWorkflowCatalog } from "../workflow/catalog.js";
|
|
57
60
|
import { mergeTtsConfigFromAppConfig } from "../../voice/tts/merge-config.js";
|
|
58
61
|
import { createTextToSpeechTool } from "./tts-tool.js";
|
|
@@ -70,7 +73,7 @@ const CLARIFY_SUPPORTED_CHANNELS = new Set([
|
|
|
70
73
|
"telegram",
|
|
71
74
|
"cli"
|
|
72
75
|
]);
|
|
73
|
-
var AgentToolsFactory = class {
|
|
76
|
+
var AgentToolsFactory = class AgentToolsFactory {
|
|
74
77
|
browserManager = null;
|
|
75
78
|
/** One dialog/console supervisor per chat session (browser tab). */
|
|
76
79
|
browserTaskSupervisors = /* @__PURE__ */ new Map();
|
|
@@ -193,6 +196,10 @@ var AgentToolsFactory = class {
|
|
|
193
196
|
agentId: options?.agentId ?? (cfg ? resolveDefaultAgentId(cfg) : "main")
|
|
194
197
|
});
|
|
195
198
|
const agentId = options?.agentId;
|
|
199
|
+
const getCommandIsolation = () => {
|
|
200
|
+
const config = this.deps.getConfig?.();
|
|
201
|
+
return config ? resolveEffectiveAgentConfigForSession(config, this.deps.getCurrentContext()?.sessionKey ?? `agent:${agentId ?? "main"}:internal`).config.runtime.commandIsolation : void 0;
|
|
202
|
+
};
|
|
196
203
|
const externalTools = createDefaultExternalToolGatewayTools({
|
|
197
204
|
workspace,
|
|
198
205
|
getConfig: () => this.deps.getConfig?.(),
|
|
@@ -271,10 +278,18 @@ var AgentToolsFactory = class {
|
|
|
271
278
|
grep,
|
|
272
279
|
find,
|
|
273
280
|
createExecCommandTool(workspace, {
|
|
281
|
+
getCommandIsolation,
|
|
282
|
+
getSessionKey: () => this.deps.getCurrentContext()?.sessionKey,
|
|
274
283
|
getSkillPassthroughEnvVarNames: this.deps.getSkillPassthroughEnvVarNames,
|
|
275
284
|
prepareEnv: this.prepareRuntimeEnv
|
|
276
285
|
}),
|
|
277
|
-
|
|
286
|
+
createReviewWorkspaceTool(workspace),
|
|
287
|
+
createLanguageDiagnosticsTool(workspace, {
|
|
288
|
+
getCommandIsolation,
|
|
289
|
+
getSessionKey: () => this.deps.getCurrentContext()?.sessionKey,
|
|
290
|
+
prepareEnv: this.prepareRuntimeEnv
|
|
291
|
+
}),
|
|
292
|
+
createManagedJobTool(workspace, () => this.deps.getCurrentContext()?.sessionKey, this.deps.getSkillPassthroughEnvVarNames, this.prepareRuntimeEnv, getCommandIsolation),
|
|
278
293
|
createWebSearchTool(() => this.deps.getConfig?.()),
|
|
279
294
|
createWebFetchTool(() => this.deps.getConfig?.()),
|
|
280
295
|
createWebExtractTool({ getConfig: () => this.deps.getConfig?.() }),
|
|
@@ -345,7 +360,37 @@ var AgentToolsFactory = class {
|
|
|
345
360
|
getConfig: () => this.deps.getConfig?.(),
|
|
346
361
|
startWorkflowRun: this.deps.getWorkflowRunService ? (params) => this.deps.getWorkflowRunService().startWorkflowRun(params) : void 0
|
|
347
362
|
})] : [],
|
|
348
|
-
...[
|
|
363
|
+
...primary ? [createDelegateTool({
|
|
364
|
+
workspace,
|
|
365
|
+
getSubagentModel: () => {
|
|
366
|
+
const m = (options?.getPrimaryModel ?? this.deps.getPrimaryModel)?.();
|
|
367
|
+
if (!m) throw new Error("No primary model configured for delegate_task");
|
|
368
|
+
return m;
|
|
369
|
+
},
|
|
370
|
+
bus: this.deps.bus,
|
|
371
|
+
getConfig: () => this.deps.getConfig?.(),
|
|
372
|
+
getCurrentContext: () => this.deps.getCurrentContext?.() ?? null,
|
|
373
|
+
toolExecutorConfig: this.deps.toolExecutorConfig,
|
|
374
|
+
buildChildTools: (childOpts) => {
|
|
375
|
+
return new AgentToolsFactory({
|
|
376
|
+
workspace: childOpts.workspace,
|
|
377
|
+
bus: childOpts.bus,
|
|
378
|
+
getCurrentContext: () => null,
|
|
379
|
+
getConfig: childOpts.getConfig,
|
|
380
|
+
getPrimaryModel: () => childOpts.model,
|
|
381
|
+
toolExecutorConfig: childOpts.toolExecutorConfig
|
|
382
|
+
}).createAllTools({
|
|
383
|
+
workspace: childOpts.workspace,
|
|
384
|
+
getPrimaryModel: () => childOpts.model,
|
|
385
|
+
agentId: options?.agentId ?? childOpts.agentId,
|
|
386
|
+
disabledTools: new Set([
|
|
387
|
+
EXTERNAL_TOOL_NAMES.search,
|
|
388
|
+
EXTERNAL_TOOL_NAMES.describe,
|
|
389
|
+
EXTERNAL_TOOL_NAMES.execute
|
|
390
|
+
])
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
})] : [],
|
|
349
394
|
...optionalTools
|
|
350
395
|
], disabled);
|
|
351
396
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
+
import { type Static } from '@sinclair/typebox';
|
|
1
2
|
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
3
|
+
declare const findSchema: import("@sinclair/typebox").TObject<{
|
|
4
|
+
pattern: import("@sinclair/typebox").TString;
|
|
5
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
6
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
7
|
+
}>;
|
|
8
8
|
export interface FindToolDetails {
|
|
9
|
-
|
|
10
|
-
resultLimitReached?: number;
|
|
9
|
+
truncated: boolean;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
* Find tool - Search for files by glob pattern
|
|
14
|
-
*/
|
|
11
|
+
export type FindToolInput = Static<typeof findSchema>;
|
|
15
12
|
export declare function createFindTool(cwd: string): AgentTool;
|
|
16
|
-
|
|
17
|
-
export
|
|
13
|
+
export declare const findTool: AgentTool<import("typebox").TSchema, any>;
|
|
14
|
+
export {};
|
|
@@ -1,97 +1,50 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
|
|
2
2
|
import { resolveToCwd } from "../../utils/helpers.js";
|
|
3
|
-
import
|
|
4
|
-
import { existsSync } from "fs";
|
|
3
|
+
import { repositorySearch } from "./repository-search.js";
|
|
5
4
|
import { Type } from "@sinclair/typebox";
|
|
6
|
-
import { globSync } from "glob";
|
|
7
5
|
//#region src/agent/tools/find.ts
|
|
8
6
|
const findSchema = Type.Object({
|
|
9
|
-
pattern: Type.String({ description: "Glob pattern
|
|
10
|
-
path: Type.Optional(Type.String(
|
|
11
|
-
limit: Type.Optional(Type.
|
|
7
|
+
pattern: Type.String({ description: "Glob pattern, e.g. *.ts or src/**/*.json" }),
|
|
8
|
+
path: Type.Optional(Type.String()),
|
|
9
|
+
limit: Type.Optional(Type.Integer({
|
|
10
|
+
minimum: 1,
|
|
11
|
+
maximum: 1e4
|
|
12
|
+
}))
|
|
12
13
|
});
|
|
13
|
-
const DEFAULT_LIMIT = 1e3;
|
|
14
|
-
/**
|
|
15
|
-
* Find tool - Search for files by glob pattern
|
|
16
|
-
*/
|
|
17
14
|
function createFindTool(cwd) {
|
|
18
15
|
return {
|
|
19
16
|
name: "find",
|
|
20
|
-
label: "
|
|
21
|
-
description: "Find files by glob pattern (e.g., *.ts, **/*.json).",
|
|
17
|
+
label: "Find files",
|
|
22
18
|
parameters: findSchema,
|
|
19
|
+
description: "Find files by glob with ripgrep; respects .gitignore and skips .git and node_modules. Results are relative to the search directory.",
|
|
23
20
|
supportsParallel: true,
|
|
24
21
|
idempotent: true,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
if (filePaths.length === 0) return {
|
|
50
|
-
content: [{
|
|
51
|
-
type: "text",
|
|
52
|
-
text: "No files found matching pattern"
|
|
53
|
-
}],
|
|
54
|
-
details: {}
|
|
55
|
-
};
|
|
56
|
-
const relativized = filePaths.map((p) => {
|
|
57
|
-
if (p.startsWith(searchPath)) return p.slice(searchPath.length + 1);
|
|
58
|
-
return path.relative(searchPath, p);
|
|
59
|
-
});
|
|
60
|
-
relativized.sort();
|
|
61
|
-
const resultLimitReached = relativized.length >= effectiveLimit;
|
|
62
|
-
const truncation = truncateHead((resultLimitReached ? relativized.slice(0, effectiveLimit) : relativized).join("\n"), { maxLines: Number.MAX_SAFE_INTEGER });
|
|
63
|
-
let resultOutput = truncation.content;
|
|
64
|
-
const details = {};
|
|
65
|
-
const notices = [];
|
|
66
|
-
if (resultLimitReached) {
|
|
67
|
-
notices.push(`${effectiveLimit} results limit reached`);
|
|
68
|
-
details.resultLimitReached = effectiveLimit;
|
|
69
|
-
}
|
|
70
|
-
if (truncation.truncated) {
|
|
71
|
-
notices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);
|
|
72
|
-
details.truncation = truncation;
|
|
73
|
-
}
|
|
74
|
-
if (notices.length > 0) resultOutput += `\n\n[${notices.join(". ")}]`;
|
|
75
|
-
return {
|
|
76
|
-
content: [{
|
|
77
|
-
type: "text",
|
|
78
|
-
text: resultOutput
|
|
79
|
-
}],
|
|
80
|
-
details: Object.keys(details).length > 0 ? details : void 0
|
|
81
|
-
};
|
|
82
|
-
} catch (error) {
|
|
83
|
-
return {
|
|
84
|
-
content: [{
|
|
85
|
-
type: "text",
|
|
86
|
-
text: `Error during find: ${error instanceof Error ? error.message : String(error)}`
|
|
87
|
-
}],
|
|
88
|
-
details: {}
|
|
89
|
-
};
|
|
90
|
-
}
|
|
22
|
+
async execute(_id, params, signal) {
|
|
23
|
+
const path = resolveToCwd(params.path || ".", cwd);
|
|
24
|
+
const policy = evaluateFilePolicy({
|
|
25
|
+
operation: "read",
|
|
26
|
+
path,
|
|
27
|
+
workspaceRoot: cwd
|
|
28
|
+
});
|
|
29
|
+
if (!policy.allowed) throw new Error(policy.reason);
|
|
30
|
+
const result = await repositorySearch(path, [
|
|
31
|
+
"--files",
|
|
32
|
+
"--glob",
|
|
33
|
+
params.pattern
|
|
34
|
+
], signal);
|
|
35
|
+
const limit = Math.min(1e4, Math.max(1, params.limit ?? 1e3));
|
|
36
|
+
const lines = result.output.trimEnd().split("\n").filter(Boolean).sort();
|
|
37
|
+
const truncated = result.truncated || lines.length > limit;
|
|
38
|
+
return {
|
|
39
|
+
content: [{
|
|
40
|
+
type: "text",
|
|
41
|
+
text: (lines.slice(0, limit).join("\n") || "No files found matching pattern") + (truncated ? "\n[Results truncated; narrow the glob.]" : "")
|
|
42
|
+
}],
|
|
43
|
+
details: { truncated }
|
|
44
|
+
};
|
|
91
45
|
}
|
|
92
46
|
};
|
|
93
47
|
}
|
|
94
|
-
/** Default find tool using process.cwd() */
|
|
95
48
|
const findTool = createFindTool(process.cwd());
|
|
96
49
|
//#endregion
|
|
97
50
|
export { createFindTool, findTool };
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
+
import { type Static } from '@sinclair/typebox';
|
|
1
2
|
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
3
|
+
declare const grepSchema: import("@sinclair/typebox").TObject<{
|
|
4
|
+
pattern: import("@sinclair/typebox").TString;
|
|
5
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
6
|
+
glob: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
7
|
+
ignoreCase: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
8
|
+
literal: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
9
|
+
context: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
10
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
11
|
+
}>;
|
|
12
12
|
export interface GrepToolDetails {
|
|
13
|
-
|
|
14
|
-
matchLimitReached?: number;
|
|
15
|
-
linesTruncated?: boolean;
|
|
13
|
+
truncated: boolean;
|
|
16
14
|
}
|
|
17
|
-
|
|
18
|
-
* Grep tool - Search file contents for a pattern
|
|
19
|
-
*/
|
|
15
|
+
export type GrepToolInput = Static<typeof grepSchema>;
|
|
20
16
|
export declare function createGrepTool(cwd: string): AgentTool;
|
|
21
|
-
|
|
22
|
-
export
|
|
17
|
+
export declare const grepTool: AgentTool<import("typebox").TSchema, any>;
|
|
18
|
+
export {};
|
|
@@ -1,161 +1,73 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
|
|
2
2
|
import { resolveToCwd } from "../../utils/helpers.js";
|
|
3
|
-
import
|
|
4
|
-
import { existsSync, readFileSync, statSync } from "fs";
|
|
3
|
+
import { repositorySearch } from "./repository-search.js";
|
|
5
4
|
import { Type } from "@sinclair/typebox";
|
|
6
|
-
import { globSync } from "glob";
|
|
7
5
|
//#region src/agent/tools/grep.ts
|
|
8
6
|
const grepSchema = Type.Object({
|
|
9
|
-
pattern: Type.String({ description: "
|
|
10
|
-
path: Type.Optional(Type.String(
|
|
11
|
-
glob: Type.Optional(Type.String(
|
|
12
|
-
ignoreCase: Type.Optional(Type.Boolean(
|
|
13
|
-
literal: Type.Optional(Type.Boolean(
|
|
14
|
-
context: Type.Optional(Type.
|
|
15
|
-
|
|
7
|
+
pattern: Type.String({ description: "Ripgrep regex, or literal text when literal=true" }),
|
|
8
|
+
path: Type.Optional(Type.String()),
|
|
9
|
+
glob: Type.Optional(Type.String()),
|
|
10
|
+
ignoreCase: Type.Optional(Type.Boolean()),
|
|
11
|
+
literal: Type.Optional(Type.Boolean()),
|
|
12
|
+
context: Type.Optional(Type.Integer({
|
|
13
|
+
minimum: 0,
|
|
14
|
+
maximum: 20
|
|
15
|
+
})),
|
|
16
|
+
limit: Type.Optional(Type.Integer({
|
|
17
|
+
minimum: 1,
|
|
18
|
+
maximum: 1e3
|
|
19
|
+
}))
|
|
16
20
|
});
|
|
17
|
-
const DEFAULT_LIMIT = 100;
|
|
18
|
-
/**
|
|
19
|
-
* Simple grep implementation using Node.js regex
|
|
20
|
-
*/
|
|
21
|
-
function simpleGrep(content, pattern, options) {
|
|
22
|
-
const matches = [];
|
|
23
|
-
const lines = content.split("\n");
|
|
24
|
-
const regexPattern = options.literal ? pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") : pattern;
|
|
25
|
-
const flags = options.ignoreCase ? "i" : "";
|
|
26
|
-
const regex = new RegExp(regexPattern, flags);
|
|
27
|
-
for (let i = 0; i < lines.length; i++) if (regex.test(lines[i])) matches.push({
|
|
28
|
-
lineNumber: i + 1,
|
|
29
|
-
line: lines[i]
|
|
30
|
-
});
|
|
31
|
-
return matches;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Grep tool - Search file contents for a pattern
|
|
35
|
-
*/
|
|
36
21
|
function createGrepTool(cwd) {
|
|
37
22
|
return {
|
|
38
23
|
name: "grep",
|
|
39
|
-
label: "
|
|
40
|
-
description: "Search file contents for a pattern (regex or literal).",
|
|
24
|
+
label: "Search",
|
|
41
25
|
parameters: grepSchema,
|
|
26
|
+
description: "Search with ripgrep, respecting .gitignore and skipping binary files. Returns path:line content. Use a narrow path or glob; output is bounded.",
|
|
42
27
|
supportsParallel: true,
|
|
43
28
|
idempotent: true,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
});
|
|
84
|
-
for (const match of fileMatches) {
|
|
85
|
-
if (matchCount >= effectiveLimit) break;
|
|
86
|
-
matches.push({
|
|
87
|
-
file: filePath,
|
|
88
|
-
...match
|
|
89
|
-
});
|
|
90
|
-
matchCount++;
|
|
91
|
-
}
|
|
92
|
-
} catch {}
|
|
93
|
-
if (matchCount >= effectiveLimit) break;
|
|
94
|
-
}
|
|
95
|
-
if (matches.length === 0) return {
|
|
96
|
-
content: [{
|
|
97
|
-
type: "text",
|
|
98
|
-
text: "No matches found"
|
|
99
|
-
}],
|
|
100
|
-
details: {}
|
|
101
|
-
};
|
|
102
|
-
const outputLines = [];
|
|
103
|
-
const basePath = isDirectory ? searchPath : path.dirname(searchPath);
|
|
104
|
-
for (const match of matches) {
|
|
105
|
-
const relativePath = path.relative(basePath, match.file);
|
|
106
|
-
const { text: truncatedLine, wasTruncated } = truncateLine(match.line);
|
|
107
|
-
if (wasTruncated) linesTruncated = true;
|
|
108
|
-
if (context > 0) try {
|
|
109
|
-
const allLines = readFileSync(match.file, "utf-8").split("\n");
|
|
110
|
-
const start = Math.max(1, match.lineNumber - context);
|
|
111
|
-
const end = Math.min(allLines.length, match.lineNumber + context);
|
|
112
|
-
for (let i = start; i <= end; i++) {
|
|
113
|
-
const { text: truncatedContextLine } = truncateLine(allLines[i - 1] || "");
|
|
114
|
-
if (i === match.lineNumber) outputLines.push(`${relativePath}:${i}: ${truncatedContextLine}`);
|
|
115
|
-
else outputLines.push(`${relativePath}-${i}- ${truncatedContextLine}`);
|
|
116
|
-
}
|
|
117
|
-
} catch {
|
|
118
|
-
outputLines.push(`${relativePath}:${match.lineNumber}: ${truncatedLine}`);
|
|
119
|
-
}
|
|
120
|
-
else outputLines.push(`${relativePath}:${match.lineNumber}: ${truncatedLine}`);
|
|
121
|
-
}
|
|
122
|
-
const truncation = truncateHead(outputLines.join("\n"), { maxLines: Number.MAX_SAFE_INTEGER });
|
|
123
|
-
let output = truncation.content;
|
|
124
|
-
const details = {};
|
|
125
|
-
const notices = [];
|
|
126
|
-
if (matches.length >= effectiveLimit) {
|
|
127
|
-
notices.push(`${effectiveLimit} matches limit reached`);
|
|
128
|
-
details.matchLimitReached = effectiveLimit;
|
|
129
|
-
}
|
|
130
|
-
if (truncation.truncated) {
|
|
131
|
-
notices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);
|
|
132
|
-
details.truncation = truncation;
|
|
133
|
-
}
|
|
134
|
-
if (linesTruncated) {
|
|
135
|
-
notices.push(`Some lines truncated to 500 chars`);
|
|
136
|
-
details.linesTruncated = true;
|
|
137
|
-
}
|
|
138
|
-
if (notices.length > 0) output += `\n\n[${notices.join(". ")}]`;
|
|
139
|
-
return {
|
|
140
|
-
content: [{
|
|
141
|
-
type: "text",
|
|
142
|
-
text: output
|
|
143
|
-
}],
|
|
144
|
-
details: Object.keys(details).length > 0 ? details : void 0
|
|
145
|
-
};
|
|
146
|
-
} catch (error) {
|
|
147
|
-
return {
|
|
148
|
-
content: [{
|
|
149
|
-
type: "text",
|
|
150
|
-
text: `Error during grep: ${error instanceof Error ? error.message : String(error)}`
|
|
151
|
-
}],
|
|
152
|
-
details: {}
|
|
153
|
-
};
|
|
154
|
-
}
|
|
29
|
+
async execute(_id, params, signal) {
|
|
30
|
+
const path = resolveToCwd(params.path || ".", cwd);
|
|
31
|
+
const policy = evaluateFilePolicy({
|
|
32
|
+
operation: "read",
|
|
33
|
+
path,
|
|
34
|
+
workspaceRoot: cwd
|
|
35
|
+
});
|
|
36
|
+
if (!policy.allowed) throw new Error(policy.reason);
|
|
37
|
+
const limit = Math.min(1e3, Math.max(1, params.limit ?? 100));
|
|
38
|
+
const result = await repositorySearch(cwd, [
|
|
39
|
+
"--line-number",
|
|
40
|
+
"--with-filename",
|
|
41
|
+
"--color",
|
|
42
|
+
"never",
|
|
43
|
+
"--max-columns",
|
|
44
|
+
"300",
|
|
45
|
+
"--max-columns-preview",
|
|
46
|
+
"--max-count",
|
|
47
|
+
String(limit),
|
|
48
|
+
"--context",
|
|
49
|
+
String(params.context ?? 0),
|
|
50
|
+
...params.ignoreCase ? ["--ignore-case"] : [],
|
|
51
|
+
...params.literal ? ["--fixed-strings"] : [],
|
|
52
|
+
...params.glob ? ["--glob", params.glob] : [],
|
|
53
|
+
"-e",
|
|
54
|
+
params.pattern,
|
|
55
|
+
"--",
|
|
56
|
+
path
|
|
57
|
+
], signal);
|
|
58
|
+
const lines = result.output.trimEnd().split("\n");
|
|
59
|
+
const outputLimit = limit * (1 + 2 * (params.context ?? 0));
|
|
60
|
+
const truncated = result.truncated || lines.length > outputLimit;
|
|
61
|
+
return {
|
|
62
|
+
content: [{
|
|
63
|
+
type: "text",
|
|
64
|
+
text: (result.output ? lines.slice(0, outputLimit).join("\n") : "No matches found") + (truncated ? "\n[Results truncated; narrow the path or pattern.]" : "")
|
|
65
|
+
}],
|
|
66
|
+
details: { truncated }
|
|
67
|
+
};
|
|
155
68
|
}
|
|
156
69
|
};
|
|
157
70
|
}
|
|
158
|
-
/** Default grep tool using process.cwd() */
|
|
159
71
|
const grepTool = createGrepTool(process.cwd());
|
|
160
72
|
//#endregion
|
|
161
73
|
export { createGrepTool, grepTool };
|
|
@@ -25,7 +25,6 @@ export { createClarifyTool, type ClarifyRequestPayload, type GatewayClarifyReque
|
|
|
25
25
|
export { BrowserManager, assertBrowserUrlAllowed } from '../../browser/index.js';
|
|
26
26
|
export { createDelegateTool, DEFAULT_DELEGATE_TOOLS, DELEGATE_BLOCKED_TOOLS, } from './delegate-tool.js';
|
|
27
27
|
export { createWorkflowTool, type WorkflowToolDeps, type WorkflowToolInput } from './workflow-tool.js';
|
|
28
|
-
export { createExecuteCodeTool, buildSandboxToolMap, SANDBOX_ALLOWED_TOOLS, } from './execute-code-tool.js';
|
|
29
28
|
export { createAutomationTool, type AutomationToolDeps } from './automation-tool.js';
|
|
30
29
|
export { createBrowserRecipeTool } from './browser-recipe-tool.js';
|
|
31
30
|
export { createXopcUseTool, type XopcUseToolDeps, type XopcUseToolInput } from './xopc-use-tool.js';
|
|
@@ -27,9 +27,9 @@ import { createClarifyTool } from "./clarify-tool.js";
|
|
|
27
27
|
import { BrowserManager } from "../../browser/manager.js";
|
|
28
28
|
import { assertBrowserUrlAllowed } from "../../browser/url-policy.js";
|
|
29
29
|
import "../../browser/index.js";
|
|
30
|
+
import { resolveImageModelConfigForTool } from "../image/tool-model-config.js";
|
|
30
31
|
import { DEFAULT_DELEGATE_TOOLS, DELEGATE_BLOCKED_TOOLS, createDelegateTool } from "./delegate-tool.js";
|
|
31
32
|
import { createWorkflowTool } from "./workflow-tool.js";
|
|
32
|
-
import { SANDBOX_ALLOWED_TOOLS, buildSandboxToolMap, createExecuteCodeTool } from "./execute-code-tool.js";
|
|
33
33
|
import { createAutomationTool } from "./automation-tool.js";
|
|
34
34
|
import { createBrowserRecipeTool } from "./browser-recipe-tool.js";
|
|
35
35
|
import { createXopcUseTool } from "./xopc-use-tool.js";
|
|
@@ -40,7 +40,6 @@ import { createSkillInstallTool } from "./skill-install-tool.js";
|
|
|
40
40
|
import { createToolManualTool } from "./tool-manual-tool.js";
|
|
41
41
|
import { createDesktopPetTool } from "./desktop-pet-tool.js";
|
|
42
42
|
import { createManagedJobTool } from "./managed-job-tool.js";
|
|
43
|
-
import { resolveImageModelConfigForTool } from "../image/tool-model-config.js";
|
|
44
43
|
import { createImageTool } from "./image-tool.js";
|
|
45
44
|
import { createImageGenerateTool, resolveImageGenerationModelConfigForTool } from "./image-generate-tool.js";
|
|
46
|
-
export { BrowserManager, DEFAULT_DELEGATE_TOOLS, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, DEFAULT_TOOL_METADATA, DEFAULT_WEB_EXTRACT_MAX_LENGTH, DELEGATE_BLOCKED_TOOLS, GREP_MAX_LINE_LENGTH, MAX_RAW_HTML_CHARS_FOR_WEB_EXTRACT,
|
|
45
|
+
export { BrowserManager, DEFAULT_DELEGATE_TOOLS, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, DEFAULT_TOOL_METADATA, DEFAULT_WEB_EXTRACT_MAX_LENGTH, DELEGATE_BLOCKED_TOOLS, GREP_MAX_LINE_LENGTH, MAX_RAW_HTML_CHARS_FOR_WEB_EXTRACT, TodoStore, ToolConcurrencyController, assertBrowserUrlAllowed, createApplyPatchTool, createAutomationTool, createBrowserRecipeTool, createClarifyTool, createCreateShareTool, createDelegateTool, createDesktopPetTool, createDreamingTool, createExecCommandTool, createFindTool, createGrepTool, createImageGenerateTool, createImageTool, createListDirTool, createManagedJobTool, createMemoryGetTool, createMemorySearchTool, createMessageTool, createPublishArtifactsTool, createReadFileTool, createReadMediaTool, createSendMediaTool, createSessionRecallTool, createSessionSearchTool, createSessionStatusTool, createSkillInstallTool, createSkillManageTool, createSkillViewTool, createSkillsListTool, createSkillsMarketplaceSearchTool, createTodoTool, createToolManualTool, createUpdatePlanTool, createWebExtractTool, createWebFetchTool, createWebSearchTool, createWorkflowTool, createWriteFileTool, createXopcUseTool, findTool, formatSize, fuzzyFindText, generateDiffString, getToolMetadata, grepTool, isShareToolAvailable, listDirTool, normalizeForFuzzyMatch, normalizeToLF, resolveImageGenerationModelConfigForTool, resolveImageModelConfigForTool, resolveToolLockMode, restoreLineEndings, stripBom, stripHtmlBoilerplate, truncateHead, truncateLine, truncateTail, writeFileTool };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
|
+
import { type CreateExecCommandToolOptions } from './exec-command.js';
|
|
3
|
+
export interface LanguageDiagnostic {
|
|
4
|
+
file: string;
|
|
5
|
+
line: number;
|
|
6
|
+
column: number;
|
|
7
|
+
code: string;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function parseTypeScriptDiagnostics(output: string): LanguageDiagnostic[];
|
|
11
|
+
export declare function createLanguageDiagnosticsTool(workspace: string, options?: CreateExecCommandToolOptions): AgentTool;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createExecCommandTool } from "./exec-command.js";
|
|
2
|
+
import { relative, resolve, sep } from "node:path";
|
|
3
|
+
import { access } from "node:fs/promises";
|
|
4
|
+
import { Type } from "@sinclair/typebox";
|
|
5
|
+
//#region src/agent/tools/language-diagnostics.ts
|
|
6
|
+
function parseTypeScriptDiagnostics(output) {
|
|
7
|
+
return [...output.matchAll(/^(.+)\((\d+),(\d+)\): error (TS\d+): (.+)$/gm)].slice(0, 200).map((match) => ({
|
|
8
|
+
file: match[1],
|
|
9
|
+
line: Number(match[2]),
|
|
10
|
+
column: Number(match[3]),
|
|
11
|
+
code: match[4],
|
|
12
|
+
message: match[5]
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
function quote(value) {
|
|
16
|
+
if (process.platform === "win32") {
|
|
17
|
+
if (/[%!"\r\n]/.test(value)) throw new Error("Unsupported character in diagnostic path");
|
|
18
|
+
return `"${value}"`;
|
|
19
|
+
}
|
|
20
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
21
|
+
}
|
|
22
|
+
function createLanguageDiagnosticsTool(workspace, options) {
|
|
23
|
+
const exec = createExecCommandTool(workspace, options);
|
|
24
|
+
return {
|
|
25
|
+
name: "language_diagnostics",
|
|
26
|
+
label: "TypeScript diagnostics",
|
|
27
|
+
description: "Run the repository-installed TypeScript compiler without emitting code. Returns compiler exit status, bounded file/line diagnostics, and a durable command log. Supports tsconfig projects; other languages use their normal check command.",
|
|
28
|
+
parameters: Type.Object({ project: Type.Optional(Type.String({ description: "tsconfig path relative to the workspace; defaults to tsconfig.json" })) }),
|
|
29
|
+
supportsParallel: false,
|
|
30
|
+
idempotent: false,
|
|
31
|
+
async execute(id, input, signal, onUpdate) {
|
|
32
|
+
const project = resolve(workspace, input.project ?? "tsconfig.json");
|
|
33
|
+
const projectRelative = relative(workspace, project);
|
|
34
|
+
if (projectRelative === ".." || projectRelative.startsWith(`..${sep}`)) throw new Error("Project must be inside the workspace");
|
|
35
|
+
await access(project);
|
|
36
|
+
let compiler;
|
|
37
|
+
try {
|
|
38
|
+
compiler = resolve(workspace, "node_modules/typescript/lib/tsc.js");
|
|
39
|
+
await access(compiler);
|
|
40
|
+
} catch {
|
|
41
|
+
throw new Error("This workspace has no installed TypeScript compiler. Install its declared dependencies first.");
|
|
42
|
+
}
|
|
43
|
+
const isolated = options?.getCommandIsolation?.()?.mode === "docker";
|
|
44
|
+
const compilerPath = isolated ? relative(workspace, compiler).split(sep).join("/") : compiler;
|
|
45
|
+
if (isolated && compilerPath.startsWith("../")) throw new Error("Container diagnostics require TypeScript installed inside the workspace.");
|
|
46
|
+
const result = await exec.execute(id, {
|
|
47
|
+
cmd: `${quote(isolated ? "node" : process.execPath)} ${quote(compilerPath)} --project ${quote(projectRelative)} --noEmit --pretty false`,
|
|
48
|
+
timeoutMs: 12e4
|
|
49
|
+
}, signal, onUpdate);
|
|
50
|
+
return {
|
|
51
|
+
...result,
|
|
52
|
+
details: {
|
|
53
|
+
...result.details,
|
|
54
|
+
diagnosticEngine: "typescript",
|
|
55
|
+
diagnostics: parseTypeScriptDiagnostics(String(result.details.aggregatedOutput ?? ""))
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { createLanguageDiagnosticsTool, parseTypeScriptDiagnostics };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
|
-
|
|
2
|
+
import type { CommandIsolation } from '../commands/command-isolation.js';
|
|
3
|
+
export declare function createManagedJobTool(workspace: string, getSessionKey: () => string | undefined, getSkillPassthroughEnvVarNames?: () => string[], prepareEnv?: (baseEnv: Record<string, string>, cwd: string) => Promise<Record<string, string>>, getCommandIsolation?: () => CommandIsolation | undefined): AgentTool;
|