@office-ai/aioncli-core 0.26.0 → 0.30.1
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/docs/admin/enterprise-controls.md +115 -0
- package/dist/docs/architecture.md +3 -3
- package/dist/docs/assets/monitoring-dashboard-logs.png +0 -0
- package/dist/docs/assets/monitoring-dashboard-metrics.png +0 -0
- package/dist/docs/assets/monitoring-dashboard-overview.png +0 -0
- package/dist/docs/assets/theme-ansi-dark.png +0 -0
- package/dist/docs/assets/theme-atom-one-dark.png +0 -0
- package/dist/docs/assets/theme-ayu-dark.png +0 -0
- package/dist/docs/assets/theme-default-dark.png +0 -0
- package/dist/docs/assets/theme-dracula-dark.png +0 -0
- package/dist/docs/assets/theme-github-dark.png +0 -0
- package/dist/docs/assets/theme-holiday-dark.png +0 -0
- package/dist/docs/assets/theme-shades-of-purple-dark.png +0 -0
- package/dist/docs/assets/theme-solarized-dark.png +0 -0
- package/dist/docs/assets/theme-solarized-light.png +0 -0
- package/dist/docs/bedrock-integration-plan.md +595 -0
- package/dist/docs/changelogs/index.md +187 -0
- package/dist/docs/changelogs/latest.md +299 -209
- package/dist/docs/changelogs/preview.md +353 -115
- package/dist/docs/cli/checkpointing.md +2 -3
- package/dist/docs/cli/cli-reference.md +115 -0
- package/dist/docs/cli/commands.md +360 -247
- package/dist/docs/cli/creating-skills.md +80 -0
- package/dist/docs/cli/custom-commands.md +12 -9
- package/dist/docs/cli/enterprise.md +25 -5
- package/dist/docs/cli/gemini-md.md +20 -12
- package/dist/docs/cli/headless.md +34 -372
- package/dist/docs/cli/index.md +123 -63
- package/dist/docs/cli/keyboard-shortcuts.md +95 -84
- package/dist/docs/cli/model-routing.md +7 -2
- package/dist/docs/cli/model.md +1 -1
- package/dist/docs/cli/notifications.md +58 -0
- package/dist/docs/cli/plan-mode.md +190 -0
- package/dist/docs/cli/rewind.md +51 -0
- package/dist/docs/cli/sandbox.md +4 -3
- package/dist/docs/cli/session-management.md +61 -44
- package/dist/docs/cli/settings.md +95 -61
- package/dist/docs/cli/skills.md +49 -71
- package/dist/docs/cli/system-prompt.md +32 -0
- package/dist/docs/cli/telemetry.md +75 -4
- package/dist/docs/cli/themes.md +85 -53
- package/dist/docs/cli/tutorials/automation.md +187 -0
- package/dist/docs/cli/tutorials/file-management.md +142 -0
- package/dist/docs/cli/tutorials/mcp-setup.md +105 -0
- package/dist/docs/cli/tutorials/memory-management.md +126 -0
- package/dist/docs/cli/tutorials/session-management.md +105 -0
- package/dist/docs/cli/tutorials/shell-commands.md +107 -0
- package/dist/docs/cli/tutorials/skills-getting-started.md +36 -58
- package/dist/docs/cli/tutorials/task-planning.md +93 -0
- package/dist/docs/cli/tutorials/web-tools.md +78 -0
- package/dist/docs/cli/uninstall.md +18 -0
- package/dist/docs/core/concepts.md +137 -0
- package/dist/docs/core/index.md +6 -0
- package/dist/docs/core/memport.md +2 -0
- package/dist/docs/core/policy-engine.md +57 -7
- package/dist/docs/core/remote-agents.md +84 -0
- package/dist/docs/core/subagents.md +191 -0
- package/dist/docs/extensions/best-practices.md +188 -0
- package/dist/docs/extensions/index.md +38 -270
- package/dist/docs/extensions/reference.md +265 -0
- package/dist/docs/extensions/releasing.md +154 -0
- package/dist/docs/extensions/writing-extensions.md +292 -0
- package/dist/docs/get-started/authentication.md +162 -0
- package/dist/docs/get-started/configuration-v1.md +5 -11
- package/dist/docs/get-started/configuration.md +228 -99
- package/dist/docs/get-started/examples.md +39 -119
- package/dist/docs/get-started/gemini-3.md +2 -17
- package/dist/docs/get-started/index.md +6 -4
- package/dist/docs/get-started/installation.md +110 -77
- package/dist/docs/hooks/best-practices.md +219 -398
- package/dist/docs/hooks/index.md +99 -622
- package/dist/docs/hooks/reference.md +269 -115
- package/dist/docs/hooks/writing-hooks.md +203 -779
- package/dist/docs/index.md +146 -147
- package/dist/docs/local-development.md +1 -1
- package/dist/docs/redirects.json +20 -0
- package/dist/docs/reference/commands.md +563 -0
- package/dist/docs/reference/configuration.md +1804 -0
- package/dist/docs/reference/keyboard-shortcuts.md +168 -0
- package/dist/docs/reference/memport.md +246 -0
- package/dist/docs/reference/policy-engine.md +386 -0
- package/dist/docs/reference/tools.md +106 -0
- package/dist/docs/releases.md +3 -3
- package/dist/docs/resources/faq.md +175 -0
- package/dist/docs/resources/quota-and-pricing.md +199 -0
- package/dist/docs/resources/tos-privacy.md +102 -0
- package/dist/docs/resources/troubleshooting.md +176 -0
- package/dist/docs/resources/uninstall.md +56 -0
- package/dist/docs/sidebar.json +105 -217
- package/dist/docs/tools/activate-skill.md +43 -0
- package/dist/docs/tools/ask-user.md +95 -0
- package/dist/docs/tools/file-system.md +48 -139
- package/dist/docs/tools/index.md +92 -85
- package/dist/docs/tools/internal-docs.md +46 -0
- package/dist/docs/tools/mcp-server.md +29 -5
- package/dist/docs/tools/memory.md +21 -40
- package/dist/docs/tools/planning.md +55 -0
- package/dist/docs/tools/shell.md +45 -89
- package/dist/docs/tools/todos.md +22 -44
- package/dist/docs/tools/web-fetch.md +22 -46
- package/dist/docs/tools/web-search.md +19 -29
- package/dist/docs/tos-privacy.md +1 -1
- package/dist/docs/troubleshooting.md +20 -5
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/src/agents/a2a-client-manager.d.ts +4 -5
- package/dist/src/agents/a2a-client-manager.js +9 -131
- package/dist/src/agents/a2a-client-manager.js.map +1 -1
- package/dist/src/agents/a2a-client-manager.test.js +10 -27
- package/dist/src/agents/a2a-client-manager.test.js.map +1 -1
- package/dist/src/agents/a2a-errors.d.ts +65 -0
- package/dist/src/agents/a2a-errors.js +164 -0
- package/dist/src/agents/a2a-errors.js.map +1 -0
- package/dist/src/agents/a2a-errors.test.d.ts +6 -0
- package/dist/src/agents/a2a-errors.test.js +183 -0
- package/dist/src/agents/a2a-errors.test.js.map +1 -0
- package/dist/src/agents/a2aUtils.d.ts +3 -2
- package/dist/src/agents/a2aUtils.js +28 -26
- package/dist/src/agents/a2aUtils.js.map +1 -1
- package/dist/src/agents/a2aUtils.test.js +9 -9
- package/dist/src/agents/a2aUtils.test.js.map +1 -1
- package/dist/src/agents/acknowledgedAgents.d.ts +18 -0
- package/dist/src/agents/acknowledgedAgents.js +58 -0
- package/dist/src/agents/acknowledgedAgents.js.map +1 -0
- package/dist/src/agents/acknowledgedAgents.test.d.ts +6 -0
- package/dist/src/agents/acknowledgedAgents.test.js +70 -0
- package/dist/src/agents/acknowledgedAgents.test.js.map +1 -0
- package/dist/src/agents/agent-scheduler.d.ts +35 -0
- package/dist/src/agents/agent-scheduler.js +30 -0
- package/dist/src/agents/agent-scheduler.js.map +1 -0
- package/dist/src/agents/agent-scheduler.test.d.ts +6 -0
- package/dist/src/agents/agent-scheduler.test.js +56 -0
- package/dist/src/agents/agent-scheduler.test.js.map +1 -0
- package/dist/src/agents/agentLoader.d.ts +88 -0
- package/dist/src/agents/agentLoader.js +394 -0
- package/dist/src/agents/agentLoader.js.map +1 -0
- package/dist/src/agents/agentLoader.test.js +458 -0
- package/dist/src/agents/agentLoader.test.js.map +1 -0
- package/dist/src/agents/auth-provider/api-key-provider.d.ts +30 -0
- package/dist/src/agents/auth-provider/api-key-provider.js +66 -0
- package/dist/src/agents/auth-provider/api-key-provider.js.map +1 -0
- package/dist/src/agents/auth-provider/api-key-provider.test.d.ts +6 -0
- package/dist/src/agents/auth-provider/api-key-provider.test.js +130 -0
- package/dist/src/agents/auth-provider/api-key-provider.test.js.map +1 -0
- package/dist/src/agents/auth-provider/base-provider.d.ts +40 -0
- package/dist/src/agents/auth-provider/base-provider.js +43 -0
- package/dist/src/agents/auth-provider/base-provider.js.map +1 -0
- package/dist/src/agents/auth-provider/base-provider.test.d.ts +6 -0
- package/dist/src/agents/auth-provider/base-provider.test.js +107 -0
- package/dist/src/agents/auth-provider/base-provider.test.js.map +1 -0
- package/dist/src/agents/auth-provider/factory.d.ts +27 -0
- package/dist/src/agents/auth-provider/factory.js +161 -0
- package/dist/src/agents/auth-provider/factory.js.map +1 -0
- package/dist/src/agents/auth-provider/factory.test.d.ts +6 -0
- package/dist/src/agents/auth-provider/factory.test.js +344 -0
- package/dist/src/agents/auth-provider/factory.test.js.map +1 -0
- package/dist/src/agents/auth-provider/http-provider.d.ts +28 -0
- package/dist/src/agents/auth-provider/http-provider.js +73 -0
- package/dist/src/agents/auth-provider/http-provider.js.map +1 -0
- package/dist/src/agents/auth-provider/http-provider.test.d.ts +6 -0
- package/dist/src/agents/auth-provider/http-provider.test.js +112 -0
- package/dist/src/agents/auth-provider/http-provider.test.js.map +1 -0
- package/dist/src/agents/auth-provider/oauth2-provider.d.ts +65 -0
- package/dist/src/agents/auth-provider/oauth2-provider.js +233 -0
- package/dist/src/agents/auth-provider/oauth2-provider.js.map +1 -0
- package/dist/src/agents/auth-provider/oauth2-provider.test.d.ts +6 -0
- package/dist/src/agents/auth-provider/oauth2-provider.test.js +490 -0
- package/dist/src/agents/auth-provider/oauth2-provider.test.js.map +1 -0
- package/dist/src/agents/auth-provider/types.d.ts +74 -0
- package/dist/src/agents/auth-provider/types.js +7 -0
- package/dist/src/agents/auth-provider/types.js.map +1 -0
- package/dist/src/agents/auth-provider/value-resolver.d.ts +29 -0
- package/dist/src/agents/auth-provider/value-resolver.js +85 -0
- package/dist/src/agents/auth-provider/value-resolver.js.map +1 -0
- package/dist/src/agents/auth-provider/value-resolver.test.d.ts +6 -0
- package/dist/src/agents/auth-provider/value-resolver.test.js +100 -0
- package/dist/src/agents/auth-provider/value-resolver.test.js.map +1 -0
- package/dist/src/agents/browser/analyzeScreenshot.d.ts +35 -0
- package/dist/src/agents/browser/analyzeScreenshot.js +183 -0
- package/dist/src/agents/browser/analyzeScreenshot.js.map +1 -0
- package/dist/src/agents/browser/analyzeScreenshot.test.d.ts +6 -0
- package/dist/src/agents/browser/analyzeScreenshot.test.js +161 -0
- package/dist/src/agents/browser/analyzeScreenshot.test.js.map +1 -0
- package/dist/src/agents/browser/automationOverlay.d.ts +26 -0
- package/dist/src/agents/browser/automationOverlay.js +100 -0
- package/dist/src/agents/browser/automationOverlay.js.map +1 -0
- package/dist/src/agents/browser/browserAgentDefinition.d.ts +50 -0
- package/dist/src/agents/browser/browserAgentDefinition.js +141 -0
- package/dist/src/agents/browser/browserAgentDefinition.js.map +1 -0
- package/dist/src/agents/browser/browserAgentFactory.d.ts +42 -0
- package/dist/src/agents/browser/browserAgentFactory.js +116 -0
- package/dist/src/agents/browser/browserAgentFactory.js.map +1 -0
- package/dist/src/agents/browser/browserAgentFactory.test.d.ts +6 -0
- package/dist/src/agents/browser/browserAgentFactory.test.js +240 -0
- package/dist/src/agents/browser/browserAgentFactory.test.js.map +1 -0
- package/dist/src/agents/browser/browserAgentInvocation.d.ts +34 -0
- package/dist/src/agents/browser/browserAgentInvocation.js +386 -0
- package/dist/src/agents/browser/browserAgentInvocation.js.map +1 -0
- package/dist/src/agents/browser/browserAgentInvocation.test.d.ts +6 -0
- package/dist/src/agents/browser/browserAgentInvocation.test.js +382 -0
- package/dist/src/agents/browser/browserAgentInvocation.test.js.map +1 -0
- package/dist/src/agents/browser/browserManager.d.ts +115 -0
- package/dist/src/agents/browser/browserManager.js +370 -0
- package/dist/src/agents/browser/browserManager.js.map +1 -0
- package/dist/src/agents/browser/browserManager.test.d.ts +6 -0
- package/dist/src/agents/browser/browserManager.test.js +382 -0
- package/dist/src/agents/browser/browserManager.test.js.map +1 -0
- package/dist/src/agents/browser/mcpToolWrapper.d.ts +45 -0
- package/dist/src/agents/browser/mcpToolWrapper.js +358 -0
- package/dist/src/agents/browser/mcpToolWrapper.js.map +1 -0
- package/dist/src/agents/browser/mcpToolWrapper.test.d.ts +6 -0
- package/dist/src/agents/browser/mcpToolWrapper.test.js +126 -0
- package/dist/src/agents/browser/mcpToolWrapper.test.js.map +1 -0
- package/dist/src/agents/browser/mcpToolWrapperConfirmation.test.d.ts +6 -0
- package/dist/src/agents/browser/mcpToolWrapperConfirmation.test.js +59 -0
- package/dist/src/agents/browser/mcpToolWrapperConfirmation.test.js.map +1 -0
- package/dist/src/agents/browser/modelAvailability.d.ts +23 -0
- package/dist/src/agents/browser/modelAvailability.js +23 -0
- package/dist/src/agents/browser/modelAvailability.js.map +1 -0
- package/dist/src/agents/cli-help-agent.d.ts +24 -0
- package/dist/src/agents/cli-help-agent.js +80 -0
- package/dist/src/agents/cli-help-agent.js.map +1 -0
- package/dist/src/agents/cli-help-agent.test.js +53 -0
- package/dist/src/agents/cli-help-agent.test.js.map +1 -0
- package/dist/src/agents/codebase-investigator.d.ts +2 -1
- package/dist/src/agents/codebase-investigator.js +68 -39
- package/dist/src/agents/codebase-investigator.js.map +1 -1
- package/dist/src/agents/codebase-investigator.test.js +37 -9
- package/dist/src/agents/codebase-investigator.test.js.map +1 -1
- package/dist/src/agents/generalist-agent.d.ts +21 -0
- package/dist/src/agents/generalist-agent.js +60 -0
- package/dist/src/agents/generalist-agent.js.map +1 -0
- package/dist/src/agents/generalist-agent.test.d.ts +6 -0
- package/dist/src/agents/generalist-agent.test.js +32 -0
- package/dist/src/agents/generalist-agent.test.js.map +1 -0
- package/dist/src/agents/introspection-agent.d.ts +2 -2
- package/dist/src/agents/local-executor.d.ts +2 -0
- package/dist/src/agents/local-executor.js +186 -90
- package/dist/src/agents/local-executor.js.map +1 -1
- package/dist/src/agents/local-executor.test.js +431 -256
- package/dist/src/agents/local-executor.test.js.map +1 -1
- package/dist/src/agents/local-invocation.test.js +15 -5
- package/dist/src/agents/local-invocation.test.js.map +1 -1
- package/dist/src/agents/registry.d.ts +24 -8
- package/dist/src/agents/registry.js +193 -96
- package/dist/src/agents/registry.js.map +1 -1
- package/dist/src/agents/registry.test.js +509 -58
- package/dist/src/agents/registry.test.js.map +1 -1
- package/dist/src/agents/registry_acknowledgement.test.d.ts +6 -0
- package/dist/src/agents/registry_acknowledgement.test.js +130 -0
- package/dist/src/agents/registry_acknowledgement.test.js.map +1 -0
- package/dist/src/agents/remote-invocation.js +12 -14
- package/dist/src/agents/remote-invocation.js.map +1 -1
- package/dist/src/agents/remote-invocation.test.js +16 -4
- package/dist/src/agents/remote-invocation.test.js.map +1 -1
- package/dist/src/agents/subagent-tool-wrapper.js +1 -3
- package/dist/src/agents/subagent-tool-wrapper.js.map +1 -1
- package/dist/src/agents/subagent-tool-wrapper.test.js +18 -27
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -1
- package/dist/src/agents/subagent-tool.d.ts +15 -0
- package/dist/src/agents/subagent-tool.js +57 -0
- package/dist/src/agents/subagent-tool.js.map +1 -0
- package/dist/src/agents/subagent-tool.test.d.ts +6 -0
- package/dist/src/agents/subagent-tool.test.js +97 -0
- package/dist/src/agents/subagent-tool.test.js.map +1 -0
- package/dist/src/agents/types.d.ts +37 -22
- package/dist/src/agents/types.js +12 -0
- package/dist/src/agents/types.js.map +1 -1
- package/dist/src/availability/fallbackIntegration.test.js +57 -0
- package/dist/src/availability/fallbackIntegration.test.js.map +1 -0
- package/dist/src/availability/policyCatalog.d.ts +3 -0
- package/dist/src/availability/policyCatalog.js +29 -5
- package/dist/src/availability/policyCatalog.js.map +1 -1
- package/dist/src/availability/policyCatalog.test.js +20 -1
- package/dist/src/availability/policyCatalog.test.js.map +1 -1
- package/dist/src/availability/policyHelpers.js +40 -11
- package/dist/src/availability/policyHelpers.js.map +1 -1
- package/dist/src/availability/policyHelpers.test.js +72 -2
- package/dist/src/availability/policyHelpers.test.js.map +1 -1
- package/dist/src/availability/testUtils.js +1 -0
- package/dist/src/availability/testUtils.js.map +1 -1
- package/dist/src/billing/billing.d.ts +80 -0
- package/dist/src/billing/billing.js +128 -0
- package/dist/src/billing/billing.js.map +1 -0
- package/dist/src/billing/billing.test.d.ts +6 -0
- package/dist/src/billing/billing.test.js +182 -0
- package/dist/src/billing/billing.test.js.map +1 -0
- package/dist/src/billing/index.d.ts +6 -0
- package/dist/src/billing/index.js +7 -0
- package/dist/src/billing/index.js.map +1 -0
- package/dist/src/code_assist/admin/admin_controls.d.ts +49 -0
- package/dist/src/code_assist/admin/admin_controls.js +197 -0
- package/dist/src/code_assist/admin/admin_controls.js.map +1 -0
- package/dist/src/code_assist/admin/admin_controls.test.js +589 -0
- package/dist/src/code_assist/admin/admin_controls.test.js.map +1 -0
- package/dist/src/code_assist/admin/mcpUtils.d.ts +22 -0
- package/dist/src/code_assist/admin/mcpUtils.js +53 -0
- package/dist/src/code_assist/admin/mcpUtils.js.map +1 -0
- package/dist/src/code_assist/admin/mcpUtils.test.d.ts +6 -0
- package/dist/src/code_assist/admin/mcpUtils.test.js +101 -0
- package/dist/src/code_assist/admin/mcpUtils.test.js.map +1 -0
- package/dist/src/code_assist/codeAssist.js +2 -2
- package/dist/src/code_assist/codeAssist.js.map +1 -1
- package/dist/src/code_assist/codeAssist.test.d.ts +1 -1
- package/dist/src/code_assist/codeAssist.test.js +10 -6
- package/dist/src/code_assist/codeAssist.test.js.map +1 -1
- package/dist/src/code_assist/converter.js +8 -3
- package/dist/src/code_assist/converter.js.map +1 -1
- package/dist/src/code_assist/converter.test.js +8 -0
- package/dist/src/code_assist/converter.test.js.map +1 -1
- package/dist/src/code_assist/experiments/experiments.d.ts +1 -1
- package/dist/src/code_assist/experiments/experiments.js +22 -0
- package/dist/src/code_assist/experiments/experiments.js.map +1 -1
- package/dist/src/code_assist/experiments/experiments.test.js +1 -0
- package/dist/src/code_assist/experiments/experiments.test.js.map +1 -1
- package/dist/src/code_assist/experiments/experiments_local.test.d.ts +6 -0
- package/dist/src/code_assist/experiments/experiments_local.test.js +115 -0
- package/dist/src/code_assist/experiments/experiments_local.test.js.map +1 -0
- package/dist/src/code_assist/experiments/flagNames.d.ts +7 -0
- package/dist/src/code_assist/experiments/flagNames.js +7 -0
- package/dist/src/code_assist/experiments/flagNames.js.map +1 -1
- package/dist/src/code_assist/oauth-credential-storage.js +4 -4
- package/dist/src/code_assist/oauth-credential-storage.js.map +1 -1
- package/dist/src/code_assist/oauth2.d.ts +1 -1
- package/dist/src/code_assist/oauth2.test.js +10 -3
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +7 -4
- package/dist/src/code_assist/server.js +20 -4
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +18 -5
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/setup.d.ts +35 -3
- package/dist/src/code_assist/setup.js +98 -16
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/code_assist/setup.test.js +322 -5
- package/dist/src/code_assist/setup.test.js.map +1 -1
- package/dist/src/code_assist/telemetry.js +2 -1
- package/dist/src/code_assist/telemetry.js.map +1 -1
- package/dist/src/code_assist/telemetry.test.js +2 -1
- package/dist/src/code_assist/telemetry.test.js.map +1 -1
- package/dist/src/code_assist/types.d.ts +255 -24
- package/dist/src/code_assist/types.js +57 -7
- package/dist/src/code_assist/types.js.map +1 -1
- package/dist/src/commands/memory.d.ts +11 -0
- package/dist/src/commands/memory.js +81 -0
- package/dist/src/commands/memory.js.map +1 -0
- package/dist/src/commands/memory.test.d.ts +6 -0
- package/dist/src/commands/memory.test.js +155 -0
- package/dist/src/commands/memory.test.js.map +1 -0
- package/dist/src/commands/restore.js +1 -0
- package/dist/src/commands/restore.js.map +1 -1
- package/dist/src/config/agent-loop-context.d.ts +22 -0
- package/dist/src/config/agent-loop-context.js +7 -0
- package/dist/src/config/agent-loop-context.js.map +1 -0
- package/dist/src/config/config.d.ts +267 -58
- package/dist/src/config/config.js +663 -164
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.d.ts +1 -1
- package/dist/src/config/config.test.js +585 -166
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/constants.d.ts +4 -0
- package/dist/src/config/constants.js +8 -0
- package/dist/src/config/constants.js.map +1 -1
- package/dist/src/config/defaultModelConfigs.js +27 -8
- package/dist/src/config/defaultModelConfigs.js.map +1 -1
- package/dist/src/config/memory.d.ts +14 -0
- package/dist/src/config/memory.js +28 -0
- package/dist/src/config/memory.js.map +1 -0
- package/dist/src/config/memory.test.d.ts +6 -0
- package/dist/src/config/memory.test.js +82 -0
- package/dist/src/config/memory.test.js.map +1 -0
- package/dist/src/config/models.d.ts +77 -6
- package/dist/src/config/models.js +240 -23
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/config/models.test.js +153 -47
- package/dist/src/config/models.test.js.map +1 -1
- package/dist/src/config/projectRegistry.d.ts +36 -0
- package/dist/src/config/projectRegistry.js +262 -0
- package/dist/src/config/projectRegistry.js.map +1 -0
- package/dist/src/config/projectRegistry.test.d.ts +6 -0
- package/dist/src/config/projectRegistry.test.js +219 -0
- package/dist/src/config/projectRegistry.test.js.map +1 -0
- package/dist/src/config/storage.d.ts +23 -1
- package/dist/src/config/storage.js +104 -15
- package/dist/src/config/storage.js.map +1 -1
- package/dist/src/config/storage.test.js +118 -2
- package/dist/src/config/storage.test.js.map +1 -1
- package/dist/src/config/storageMigration.d.ts +16 -0
- package/dist/src/config/storageMigration.js +42 -0
- package/dist/src/config/storageMigration.js.map +1 -0
- package/dist/src/config/storageMigration.test.d.ts +6 -0
- package/dist/src/config/storageMigration.test.js +70 -0
- package/dist/src/config/storageMigration.test.js.map +1 -0
- package/dist/src/config/trackerFeatureFlag.test.d.ts +6 -0
- package/dist/src/config/trackerFeatureFlag.test.js +43 -0
- package/dist/src/config/trackerFeatureFlag.test.js.map +1 -0
- package/dist/src/config/userHintService.d.ts +46 -0
- package/dist/src/config/userHintService.js +81 -0
- package/dist/src/config/userHintService.js.map +1 -0
- package/dist/src/config/userHintService.test.d.ts +6 -0
- package/dist/src/config/userHintService.test.js +62 -0
- package/dist/src/config/userHintService.test.js.map +1 -0
- package/dist/src/confirmation-bus/message-bus.js +3 -33
- package/dist/src/confirmation-bus/message-bus.js.map +1 -1
- package/dist/src/confirmation-bus/types.d.ts +95 -20
- package/dist/src/confirmation-bus/types.js +9 -3
- package/dist/src/confirmation-bus/types.js.map +1 -1
- package/dist/src/core/anthropicContentGenerator.d.ts +3 -2
- package/dist/src/core/anthropicContentGenerator.js +2 -2
- package/dist/src/core/anthropicContentGenerator.js.map +1 -1
- package/dist/src/core/baseLlmClient.d.ts +9 -0
- package/dist/src/core/baseLlmClient.js +9 -8
- package/dist/src/core/baseLlmClient.js.map +1 -1
- package/dist/src/core/baseLlmClient.test.js +17 -7
- package/dist/src/core/baseLlmClient.test.js.map +1 -1
- package/dist/src/core/bedrockContentGenerator.d.ts +73 -0
- package/dist/src/core/bedrockContentGenerator.js +628 -0
- package/dist/src/core/bedrockContentGenerator.js.map +1 -0
- package/dist/src/core/client.d.ts +13 -4
- package/dist/src/core/client.js +132 -41
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +333 -79
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.d.ts +16 -3
- package/dist/src/core/contentGenerator.js +56 -2
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.d.ts +1 -1
- package/dist/src/core/contentGenerator.test.js +127 -24
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolHookTriggers.d.ts +4 -36
- package/dist/src/core/coreToolHookTriggers.js +42 -150
- package/dist/src/core/coreToolHookTriggers.js.map +1 -1
- package/dist/src/core/coreToolHookTriggers.test.js +62 -94
- package/dist/src/core/coreToolHookTriggers.test.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +1 -8
- package/dist/src/core/coreToolScheduler.js +160 -125
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +480 -62
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/fakeContentGenerator.d.ts +4 -2
- package/dist/src/core/fakeContentGenerator.js +9 -2
- package/dist/src/core/fakeContentGenerator.js.map +1 -1
- package/dist/src/core/fakeContentGenerator.test.js +8 -7
- package/dist/src/core/fakeContentGenerator.test.js.map +1 -1
- package/dist/src/core/geminiChat.d.ts +31 -3
- package/dist/src/core/geminiChat.js +144 -34
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +175 -50
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/geminiChat_network_retry.test.js +146 -16
- package/dist/src/core/geminiChat_network_retry.test.js.map +1 -1
- package/dist/src/core/localLiteRtLmClient.d.ts +24 -0
- package/dist/src/core/localLiteRtLmClient.js +77 -0
- package/dist/src/core/localLiteRtLmClient.js.map +1 -0
- package/dist/src/core/localLiteRtLmClient.test.d.ts +6 -0
- package/dist/src/core/localLiteRtLmClient.test.js +87 -0
- package/dist/src/core/localLiteRtLmClient.test.js.map +1 -0
- package/dist/src/core/logger.js +11 -0
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/logger.test.js +2 -4
- package/dist/src/core/logger.test.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.d.ts +7 -3
- package/dist/src/core/loggingContentGenerator.js +40 -21
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.test.d.ts +1 -1
- package/dist/src/core/loggingContentGenerator.test.js +50 -8
- package/dist/src/core/loggingContentGenerator.test.js.map +1 -1
- package/dist/src/core/openaiContentGenerator.d.ts +4 -2
- package/dist/src/core/openaiContentGenerator.js +31 -23
- package/dist/src/core/openaiContentGenerator.js.map +1 -1
- package/dist/src/core/openaiContentGenerator.test.js +57 -4
- package/dist/src/core/openaiContentGenerator.test.js.map +1 -1
- package/dist/src/core/prompts-substitution.test.d.ts +6 -0
- package/dist/src/core/prompts-substitution.test.js +109 -0
- package/dist/src/core/prompts-substitution.test.js.map +1 -0
- package/dist/src/core/prompts.d.ts +11 -9
- package/dist/src/core/prompts.js +14 -405
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +290 -56
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/recordingContentGenerator.d.ts +5 -3
- package/dist/src/core/recordingContentGenerator.js +12 -5
- package/dist/src/core/recordingContentGenerator.js.map +1 -1
- package/dist/src/core/recordingContentGenerator.test.js +5 -4
- package/dist/src/core/recordingContentGenerator.test.js.map +1 -1
- package/dist/src/core/tokenLimits.js +6 -10
- package/dist/src/core/tokenLimits.js.map +1 -1
- package/dist/src/core/tokenLimits.test.js +8 -4
- package/dist/src/core/tokenLimits.test.js.map +1 -1
- package/dist/src/core/turn.d.ts +10 -2
- package/dist/src/core/turn.js +36 -17
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +82 -2
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/fallback/handler.js +1 -1
- package/dist/src/fallback/handler.js.map +1 -1
- package/dist/src/fallback/handler.test.js +10 -12
- package/dist/src/fallback/handler.test.js.map +1 -1
- package/dist/src/fallback/types.d.ts +9 -0
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/hooks/hookAggregator.js +16 -4
- package/dist/src/hooks/hookAggregator.js.map +1 -1
- package/dist/src/hooks/hookEventHandler.d.ts +10 -16
- package/dist/src/hooks/hookEventHandler.js +35 -281
- package/dist/src/hooks/hookEventHandler.js.map +1 -1
- package/dist/src/hooks/hookEventHandler.test.js +189 -4
- package/dist/src/hooks/hookEventHandler.test.js.map +1 -1
- package/dist/src/hooks/hookRegistry.js +8 -3
- package/dist/src/hooks/hookRegistry.js.map +1 -1
- package/dist/src/hooks/hookRegistry.test.js +31 -2
- package/dist/src/hooks/hookRegistry.test.js.map +1 -1
- package/dist/src/hooks/hookRunner.js +21 -18
- package/dist/src/hooks/hookRunner.js.map +1 -1
- package/dist/src/hooks/hookSystem.d.ts +59 -0
- package/dist/src/hooks/hookSystem.js +206 -6
- package/dist/src/hooks/hookSystem.js.map +1 -1
- package/dist/src/hooks/hookSystem.test.js +20 -9
- package/dist/src/hooks/hookSystem.test.js.map +1 -1
- package/dist/src/hooks/hookTranslator.js +13 -6
- package/dist/src/hooks/hookTranslator.js.map +1 -1
- package/dist/src/hooks/index.d.ts +0 -1
- package/dist/src/hooks/index.js +0 -2
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/runtimeHooks.test.d.ts +6 -0
- package/dist/src/hooks/runtimeHooks.test.js +100 -0
- package/dist/src/hooks/runtimeHooks.test.js.map +1 -0
- package/dist/src/hooks/trustedHooks.js +2 -0
- package/dist/src/hooks/trustedHooks.js.map +1 -1
- package/dist/src/hooks/types.d.ts +49 -1
- package/dist/src/hooks/types.js +43 -19
- package/dist/src/hooks/types.js.map +1 -1
- package/dist/src/hooks/types.test.js +13 -29
- package/dist/src/hooks/types.test.js.map +1 -1
- package/dist/src/ide/detect-ide.d.ts +49 -0
- package/dist/src/ide/detect-ide.js +56 -3
- package/dist/src/ide/detect-ide.js.map +1 -1
- package/dist/src/ide/detect-ide.test.js +70 -0
- package/dist/src/ide/detect-ide.test.js.map +1 -1
- package/dist/src/ide/ide-client.d.ts +0 -10
- package/dist/src/ide/ide-client.js +31 -199
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-client.test.js +39 -191
- package/dist/src/ide/ide-client.test.js.map +1 -1
- package/dist/src/ide/ide-connection-utils.d.ts +27 -0
- package/dist/src/ide/ide-connection-utils.js +195 -0
- package/dist/src/ide/ide-connection-utils.js.map +1 -0
- package/dist/src/ide/ide-connection-utils.test.d.ts +6 -0
- package/dist/src/ide/ide-connection-utils.test.js +372 -0
- package/dist/src/ide/ide-connection-utils.test.js.map +1 -0
- package/dist/src/ide/ide-installer.js +76 -5
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/ide-installer.test.js +40 -2
- package/dist/src/ide/ide-installer.test.js.map +1 -1
- package/dist/src/ide/types.d.ts +40 -40
- package/dist/src/index.d.ts +30 -2
- package/dist/src/index.js +31 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/mcp-oauth-provider.d.ts +43 -0
- package/dist/src/mcp/mcp-oauth-provider.js +67 -0
- package/dist/src/mcp/mcp-oauth-provider.js.map +1 -0
- package/dist/src/mcp/mcp-oauth-provider.test.d.ts +6 -0
- package/dist/src/mcp/mcp-oauth-provider.test.js +63 -0
- package/dist/src/mcp/mcp-oauth-provider.test.js.map +1 -0
- package/dist/src/mcp/oauth-provider.d.ts +10 -3
- package/dist/src/mcp/oauth-provider.js +49 -14
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +180 -1
- package/dist/src/mcp/oauth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.js +3 -0
- package/dist/src/mcp/oauth-token-storage.js.map +1 -1
- package/dist/src/mcp/oauth-utils.d.ts +13 -4
- package/dist/src/mcp/oauth-utils.js +25 -19
- package/dist/src/mcp/oauth-utils.js.map +1 -1
- package/dist/src/mcp/oauth-utils.test.js +13 -8
- package/dist/src/mcp/oauth-utils.test.js.map +1 -1
- package/dist/src/mcp/sa-impersonation-provider.js +3 -1
- package/dist/src/mcp/sa-impersonation-provider.js.map +1 -1
- package/dist/src/mcp/token-storage/file-token-storage.js +6 -2
- package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -1
- package/dist/src/mcp/token-storage/hybrid-token-storage.js +4 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.js.map +1 -1
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js +12 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +1 -1
- package/dist/src/mcp/token-storage/keychain-token-storage.js +8 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.js.map +1 -1
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js +10 -5
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +1 -1
- package/dist/src/output/json-formatter.test.js +2 -0
- package/dist/src/output/json-formatter.test.js.map +1 -1
- package/dist/src/output/stream-json-formatter.test.js +4 -0
- package/dist/src/output/stream-json-formatter.test.js.map +1 -1
- package/dist/src/policy/config.d.ts +5 -3
- package/dist/src/policy/config.js +137 -64
- package/dist/src/policy/config.js.map +1 -1
- package/dist/src/policy/config.test.js +218 -12
- package/dist/src/policy/config.test.js.map +1 -1
- package/dist/src/policy/integrity.d.ts +45 -0
- package/dist/src/policy/integrity.js +121 -0
- package/dist/src/policy/integrity.js.map +1 -0
- package/dist/src/policy/integrity.test.d.ts +6 -0
- package/dist/src/policy/integrity.test.js +132 -0
- package/dist/src/policy/integrity.test.js.map +1 -0
- package/dist/src/policy/persistence.test.js +31 -11
- package/dist/src/policy/persistence.test.js.map +1 -1
- package/dist/src/policy/policies/conseca.toml +6 -0
- package/dist/src/policy/policies/plan.toml +56 -0
- package/dist/src/policy/policies/read-only.toml +1 -11
- package/dist/src/policy/policies/yolo.toml +13 -2
- package/dist/src/policy/policy-engine.d.ts +16 -11
- package/dist/src/policy/policy-engine.js +208 -101
- package/dist/src/policy/policy-engine.js.map +1 -1
- package/dist/src/policy/policy-engine.test.js +538 -199
- package/dist/src/policy/policy-engine.test.js.map +1 -1
- package/dist/src/policy/policy-updater.test.js +20 -6
- package/dist/src/policy/policy-updater.test.js.map +1 -1
- package/dist/src/policy/shell-safety.test.js +371 -8
- package/dist/src/policy/shell-safety.test.js.map +1 -1
- package/dist/src/policy/stable-stringify.js +1 -0
- package/dist/src/policy/stable-stringify.js.map +1 -1
- package/dist/src/policy/toml-loader.d.ts +5 -5
- package/dist/src/policy/toml-loader.js +65 -22
- package/dist/src/policy/toml-loader.js.map +1 -1
- package/dist/src/policy/toml-loader.test.js +88 -9
- package/dist/src/policy/toml-loader.test.js.map +1 -1
- package/dist/src/policy/types.d.ts +26 -1
- package/dist/src/policy/types.js +8 -0
- package/dist/src/policy/types.js.map +1 -1
- package/dist/src/policy/utils.d.ts +5 -0
- package/dist/src/policy/utils.js +32 -1
- package/dist/src/policy/utils.js.map +1 -1
- package/dist/src/policy/utils.test.js +67 -7
- package/dist/src/policy/utils.test.js.map +1 -1
- package/dist/src/policy/workspace-policy.test.d.ts +6 -0
- package/dist/src/policy/workspace-policy.test.js +231 -0
- package/dist/src/policy/workspace-policy.test.js.map +1 -0
- package/dist/src/prompts/promptProvider.d.ts +19 -0
- package/dist/src/prompts/promptProvider.js +174 -0
- package/dist/src/prompts/promptProvider.js.map +1 -0
- package/dist/src/prompts/promptProvider.test.d.ts +6 -0
- package/dist/src/prompts/promptProvider.test.js +71 -0
- package/dist/src/prompts/promptProvider.test.js.map +1 -0
- package/dist/src/prompts/snippets.d.ts +86 -0
- package/dist/src/prompts/snippets.js +573 -0
- package/dist/src/prompts/snippets.js.map +1 -0
- package/dist/src/prompts/snippets.legacy.d.ts +91 -0
- package/dist/src/prompts/snippets.legacy.js +573 -0
- package/dist/src/prompts/snippets.legacy.js.map +1 -0
- package/dist/src/prompts/utils.d.ts +23 -0
- package/dist/src/prompts/utils.js +82 -0
- package/dist/src/prompts/utils.js.map +1 -0
- package/dist/src/routing/modelRouterService.js +18 -8
- package/dist/src/routing/modelRouterService.js.map +1 -1
- package/dist/src/routing/modelRouterService.test.js +14 -6
- package/dist/src/routing/modelRouterService.test.js.map +1 -1
- package/dist/src/routing/routingStrategy.d.ts +2 -0
- package/dist/src/routing/strategies/approvalModeStrategy.d.ts +18 -0
- package/dist/src/routing/strategies/approvalModeStrategy.js +59 -0
- package/dist/src/routing/strategies/approvalModeStrategy.js.map +1 -0
- package/dist/src/routing/strategies/approvalModeStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/approvalModeStrategy.test.js +140 -0
- package/dist/src/routing/strategies/approvalModeStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/classifierStrategy.js +14 -9
- package/dist/src/routing/strategies/classifierStrategy.js.map +1 -1
- package/dist/src/routing/strategies/classifierStrategy.test.js +72 -7
- package/dist/src/routing/strategies/classifierStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/compositeStrategy.js +1 -0
- package/dist/src/routing/strategies/compositeStrategy.js.map +1 -1
- package/dist/src/routing/strategies/defaultStrategy.d.ts +1 -1
- package/dist/src/routing/strategies/defaultStrategy.js +5 -4
- package/dist/src/routing/strategies/defaultStrategy.js.map +1 -1
- package/dist/src/routing/strategies/defaultStrategy.test.js +58 -4
- package/dist/src/routing/strategies/defaultStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.d.ts +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.js +3 -3
- package/dist/src/routing/strategies/fallbackStrategy.js.map +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.test.js +13 -1
- package/dist/src/routing/strategies/fallbackStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/gemmaClassifierStrategy.d.ts +14 -0
- package/dist/src/routing/strategies/gemmaClassifierStrategy.js +182 -0
- package/dist/src/routing/strategies/gemmaClassifierStrategy.js.map +1 -0
- package/dist/src/routing/strategies/gemmaClassifierStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/gemmaClassifierStrategy.test.js +218 -0
- package/dist/src/routing/strategies/gemmaClassifierStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/numericalClassifierStrategy.d.ts +13 -0
- package/dist/src/routing/strategies/numericalClassifierStrategy.js +188 -0
- package/dist/src/routing/strategies/numericalClassifierStrategy.js.map +1 -0
- package/dist/src/routing/strategies/numericalClassifierStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/numericalClassifierStrategy.test.js +401 -0
- package/dist/src/routing/strategies/numericalClassifierStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/overrideStrategy.d.ts +1 -1
- package/dist/src/routing/strategies/overrideStrategy.js +6 -6
- package/dist/src/routing/strategies/overrideStrategy.js.map +1 -1
- package/dist/src/routing/strategies/overrideStrategy.test.js +13 -3
- package/dist/src/routing/strategies/overrideStrategy.test.js.map +1 -1
- package/dist/src/safety/built-in.js +1 -0
- package/dist/src/safety/built-in.js.map +1 -1
- package/dist/src/safety/conseca/conseca.d.ts +31 -0
- package/dist/src/safety/conseca/conseca.js +105 -0
- package/dist/src/safety/conseca/conseca.js.map +1 -0
- package/dist/src/safety/conseca/conseca.test.d.ts +6 -0
- package/dist/src/safety/conseca/conseca.test.js +226 -0
- package/dist/src/safety/conseca/conseca.test.js.map +1 -0
- package/dist/src/safety/conseca/integration.test.d.ts +6 -0
- package/dist/src/safety/conseca/integration.test.js +19 -0
- package/dist/src/safety/conseca/integration.test.js.map +1 -0
- package/dist/src/safety/conseca/policy-enforcer.d.ts +13 -0
- package/dist/src/safety/conseca/policy-enforcer.js +135 -0
- package/dist/src/safety/conseca/policy-enforcer.js.map +1 -0
- package/dist/src/safety/conseca/policy-enforcer.test.d.ts +6 -0
- package/dist/src/safety/conseca/policy-enforcer.test.js +141 -0
- package/dist/src/safety/conseca/policy-enforcer.test.js.map +1 -0
- package/dist/src/safety/conseca/policy-generator.d.ts +15 -0
- package/dist/src/safety/conseca/policy-generator.js +144 -0
- package/dist/src/safety/conseca/policy-generator.js.map +1 -0
- package/dist/src/safety/conseca/policy-generator.test.d.ts +6 -0
- package/dist/src/safety/conseca/policy-generator.test.js +84 -0
- package/dist/src/safety/conseca/policy-generator.test.js.map +1 -0
- package/dist/src/safety/conseca/types.d.ts +15 -0
- package/dist/src/safety/conseca/types.js +7 -0
- package/dist/src/safety/conseca/types.js.map +1 -0
- package/dist/src/safety/context-builder.js +3 -1
- package/dist/src/safety/context-builder.js.map +1 -1
- package/dist/src/scheduler/confirmation.d.ts +50 -0
- package/dist/src/scheduler/confirmation.js +204 -0
- package/dist/src/scheduler/confirmation.js.map +1 -0
- package/dist/src/scheduler/confirmation.test.d.ts +6 -0
- package/dist/src/scheduler/confirmation.test.js +310 -0
- package/dist/src/scheduler/confirmation.test.js.map +1 -0
- package/dist/src/scheduler/policy.d.ts +33 -0
- package/dist/src/scheduler/policy.js +119 -0
- package/dist/src/scheduler/policy.js.map +1 -0
- package/dist/src/scheduler/policy.test.d.ts +6 -0
- package/dist/src/scheduler/policy.test.js +419 -0
- package/dist/src/scheduler/policy.test.js.map +1 -0
- package/dist/src/scheduler/scheduler.d.ts +63 -0
- package/dist/src/scheduler/scheduler.js +371 -0
- package/dist/src/scheduler/scheduler.js.map +1 -0
- package/dist/src/scheduler/scheduler.test.d.ts +6 -0
- package/dist/src/scheduler/scheduler.test.js +937 -0
- package/dist/src/scheduler/scheduler.test.js.map +1 -0
- package/dist/src/scheduler/scheduler_parallel.test.d.ts +6 -0
- package/dist/src/scheduler/scheduler_parallel.test.js +401 -0
- package/dist/src/scheduler/scheduler_parallel.test.js.map +1 -0
- package/dist/src/scheduler/scheduler_waiting_callback.test.d.ts +6 -0
- package/dist/src/scheduler/scheduler_waiting_callback.test.js +62 -0
- package/dist/src/scheduler/scheduler_waiting_callback.test.js.map +1 -0
- package/dist/src/scheduler/state-manager.d.ts +74 -0
- package/dist/src/scheduler/state-manager.js +368 -0
- package/dist/src/scheduler/state-manager.js.map +1 -0
- package/dist/src/scheduler/state-manager.test.d.ts +6 -0
- package/dist/src/scheduler/state-manager.test.js +433 -0
- package/dist/src/scheduler/state-manager.test.js.map +1 -0
- package/dist/src/scheduler/tool-executor.js +25 -27
- package/dist/src/scheduler/tool-executor.js.map +1 -1
- package/dist/src/scheduler/tool-executor.test.js +26 -25
- package/dist/src/scheduler/tool-executor.test.js.map +1 -1
- package/dist/src/scheduler/tool-modifier.d.ts +23 -0
- package/dist/src/scheduler/tool-modifier.js +53 -0
- package/dist/src/scheduler/tool-modifier.js.map +1 -0
- package/dist/src/scheduler/tool-modifier.test.d.ts +6 -0
- package/dist/src/scheduler/tool-modifier.test.js +179 -0
- package/dist/src/scheduler/tool-modifier.test.js.map +1 -0
- package/dist/src/scheduler/types.d.ts +51 -8
- package/dist/src/scheduler/types.js +15 -1
- package/dist/src/scheduler/types.js.map +1 -1
- package/dist/src/services/FolderTrustDiscoveryService.d.ts +32 -0
- package/dist/src/services/FolderTrustDiscoveryService.js +169 -0
- package/dist/src/services/FolderTrustDiscoveryService.js.map +1 -0
- package/dist/src/services/FolderTrustDiscoveryService.test.d.ts +6 -0
- package/dist/src/services/FolderTrustDiscoveryService.test.js +118 -0
- package/dist/src/services/FolderTrustDiscoveryService.test.js.map +1 -0
- package/dist/src/services/chatCompressionService.d.ts +5 -1
- package/dist/src/services/chatCompressionService.js +169 -23
- package/dist/src/services/chatCompressionService.js.map +1 -1
- package/dist/src/services/chatCompressionService.test.js +382 -18
- package/dist/src/services/chatCompressionService.test.js.map +1 -1
- package/dist/src/services/chatRecordingService.d.ts +23 -3
- package/dist/src/services/chatRecordingService.js +137 -7
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/chatRecordingService.test.js +450 -186
- package/dist/src/services/chatRecordingService.test.js.map +1 -1
- package/dist/src/services/contextManager.d.ts +7 -4
- package/dist/src/services/contextManager.js +43 -18
- package/dist/src/services/contextManager.js.map +1 -1
- package/dist/src/services/contextManager.test.js +54 -27
- package/dist/src/services/contextManager.test.js.map +1 -1
- package/dist/src/services/environmentSanitization.js +4 -3
- package/dist/src/services/environmentSanitization.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.d.ts +14 -2
- package/dist/src/services/fileDiscoveryService.js +79 -7
- package/dist/src/services/fileDiscoveryService.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.test.js +142 -10
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -1
- package/dist/src/services/fileKeychain.d.ts +24 -0
- package/dist/src/services/fileKeychain.js +123 -0
- package/dist/src/services/fileKeychain.js.map +1 -0
- package/dist/src/services/gitService.d.ts +2 -1
- package/dist/src/services/gitService.js +16 -6
- package/dist/src/services/gitService.js.map +1 -1
- package/dist/src/services/gitService.test.js +26 -10
- package/dist/src/services/gitService.test.js.map +1 -1
- package/dist/src/services/keychainService.d.ts +51 -0
- package/dist/src/services/keychainService.js +133 -0
- package/dist/src/services/keychainService.js.map +1 -0
- package/dist/src/services/keychainService.test.d.ts +6 -0
- package/dist/src/services/keychainService.test.js +150 -0
- package/dist/src/services/keychainService.test.js.map +1 -0
- package/dist/src/services/keychainTypes.d.ts +41 -0
- package/dist/src/services/keychainTypes.js +18 -0
- package/dist/src/services/keychainTypes.js.map +1 -0
- package/dist/src/services/loopDetectionService.js +23 -4
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/loopDetectionService.test.js +24 -0
- package/dist/src/services/loopDetectionService.test.js.map +1 -1
- package/dist/src/services/modelConfig.integration.test.js +2 -2
- package/dist/src/services/modelConfig.integration.test.js.map +1 -1
- package/dist/src/services/modelConfigService.d.ts +39 -4
- package/dist/src/services/modelConfigService.js +153 -76
- package/dist/src/services/modelConfigService.js.map +1 -1
- package/dist/src/services/modelConfigService.test.js +175 -0
- package/dist/src/services/modelConfigService.test.js.map +1 -1
- package/dist/src/services/modelConfigServiceTestUtils.js +3 -1
- package/dist/src/services/modelConfigServiceTestUtils.js.map +1 -1
- package/dist/src/services/sessionSummaryService.js +2 -0
- package/dist/src/services/sessionSummaryService.js.map +1 -1
- package/dist/src/services/sessionSummaryService.test.js +1 -1
- package/dist/src/services/sessionSummaryService.test.js.map +1 -1
- package/dist/src/services/shellExecutionService.d.ts +48 -0
- package/dist/src/services/shellExecutionService.js +339 -97
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +132 -17
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/services/test-data/resolved-aliases-retry.golden.json +26 -8
- package/dist/src/services/test-data/resolved-aliases.golden.json +26 -8
- package/dist/src/services/toolOutputMaskingService.d.ts +43 -0
- package/dist/src/services/toolOutputMaskingService.js +286 -0
- package/dist/src/services/toolOutputMaskingService.js.map +1 -0
- package/dist/src/services/toolOutputMaskingService.test.d.ts +6 -0
- package/dist/src/services/toolOutputMaskingService.test.js +546 -0
- package/dist/src/services/toolOutputMaskingService.test.js.map +1 -0
- package/dist/src/services/trackerService.d.ts +49 -0
- package/dist/src/services/trackerService.js +193 -0
- package/dist/src/services/trackerService.js.map +1 -0
- package/dist/src/services/trackerService.test.d.ts +6 -0
- package/dist/src/services/trackerService.test.js +117 -0
- package/dist/src/services/trackerService.test.js.map +1 -0
- package/dist/src/services/trackerTypes.d.ts +51 -0
- package/dist/src/services/trackerTypes.js +33 -0
- package/dist/src/services/trackerTypes.js.map +1 -0
- package/dist/src/skills/builtin/skill-creator/SKILL.md +382 -0
- package/dist/src/skills/builtin/skill-creator/scripts/init_skill.cjs +239 -0
- package/dist/src/skills/builtin/skill-creator/scripts/package_skill.cjs +106 -0
- package/dist/src/skills/builtin/skill-creator/scripts/validate_skill.cjs +131 -0
- package/dist/src/skills/skillLoader.d.ts +3 -0
- package/dist/src/skills/skillLoader.js +73 -12
- package/dist/src/skills/skillLoader.js.map +1 -1
- package/dist/src/skills/skillLoader.test.d.ts +5 -0
- package/dist/src/skills/skillLoader.test.js +195 -1
- package/dist/src/skills/skillLoader.test.js.map +1 -1
- package/dist/src/skills/skillManager.d.ts +25 -3
- package/dist/src/skills/skillManager.js +76 -11
- package/dist/src/skills/skillManager.js.map +1 -1
- package/dist/src/skills/skillManager.test.js +209 -9
- package/dist/src/skills/skillManager.test.js.map +1 -1
- package/dist/src/skills/skillManagerAlias.test.d.ts +6 -0
- package/dist/src/skills/skillManagerAlias.test.js +140 -0
- package/dist/src/skills/skillManagerAlias.test.js.map +1 -0
- package/dist/src/telemetry/activity-monitor.js +1 -0
- package/dist/src/telemetry/activity-monitor.js.map +1 -1
- package/dist/src/telemetry/billingEvents.d.ts +75 -0
- package/dist/src/telemetry/billingEvents.js +181 -0
- package/dist/src/telemetry/billingEvents.js.map +1 -0
- package/dist/src/telemetry/billingEvents.test.d.ts +6 -0
- package/dist/src/telemetry/billingEvents.test.js +139 -0
- package/dist/src/telemetry/billingEvents.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +25 -4
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +207 -12
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +210 -6
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +23 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +61 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/conseca-logger.d.ts +9 -0
- package/dist/src/telemetry/conseca-logger.js +91 -0
- package/dist/src/telemetry/conseca-logger.js.map +1 -0
- package/dist/src/telemetry/conseca-logger.test.d.ts +6 -0
- package/dist/src/telemetry/conseca-logger.test.js +90 -0
- package/dist/src/telemetry/conseca-logger.test.js.map +1 -0
- package/dist/src/telemetry/file-exporters.js +2 -1
- package/dist/src/telemetry/file-exporters.js.map +1 -1
- package/dist/src/telemetry/file-exporters.test.d.ts +6 -0
- package/dist/src/telemetry/file-exporters.test.js +142 -0
- package/dist/src/telemetry/file-exporters.test.js.map +1 -0
- package/dist/src/telemetry/gcp-exporters.js +1 -0
- package/dist/src/telemetry/gcp-exporters.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +3 -2
- package/dist/src/telemetry/index.js +3 -2
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/integration.test.circular.js +2 -1
- package/dist/src/telemetry/integration.test.circular.js.map +1 -1
- package/dist/src/telemetry/llmRole.d.ts +18 -0
- package/dist/src/telemetry/llmRole.js +20 -0
- package/dist/src/telemetry/llmRole.js.map +1 -0
- package/dist/src/telemetry/loggers.d.ts +8 -1
- package/dist/src/telemetry/loggers.js +113 -10
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.circular.js +5 -2
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +169 -19
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/memory-monitor.test.js +1 -0
- package/dist/src/telemetry/memory-monitor.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +39 -1
- package/dist/src/telemetry/metrics.js +105 -4
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +84 -4
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/sanitize.test.js +2 -0
- package/dist/src/telemetry/sanitize.test.js.map +1 -1
- package/dist/src/telemetry/sdk.js +24 -0
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/sdk.test.js +5 -1
- package/dist/src/telemetry/sdk.test.js.map +1 -1
- package/dist/src/telemetry/semantic.js +92 -0
- package/dist/src/telemetry/semantic.js.map +1 -1
- package/dist/src/telemetry/semantic.truncation.test.d.ts +1 -0
- package/dist/src/telemetry/semantic.truncation.test.js +92 -0
- package/dist/src/telemetry/semantic.truncation.test.js.map +1 -0
- package/dist/src/telemetry/telemetryAttributes.js +5 -0
- package/dist/src/telemetry/telemetryAttributes.js.map +1 -1
- package/dist/src/telemetry/trace.test.d.ts +6 -0
- package/dist/src/telemetry/trace.test.js +116 -0
- package/dist/src/telemetry/trace.test.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +98 -15
- package/dist/src/telemetry/types.js +227 -16
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.d.ts +16 -0
- package/dist/src/telemetry/uiTelemetry.js +39 -0
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +29 -0
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/test-utils/mock-message-bus.d.ts +1 -19
- package/dist/src/test-utils/mock-message-bus.js +5 -65
- package/dist/src/test-utils/mock-message-bus.js.map +1 -1
- package/dist/src/test-utils/mock-tool.d.ts +1 -0
- package/dist/src/test-utils/mock-tool.js +1 -0
- package/dist/src/test-utils/mock-tool.js.map +1 -1
- package/dist/src/test-utils/mockWorkspaceContext.js +1 -0
- package/dist/src/test-utils/mockWorkspaceContext.js.map +1 -1
- package/dist/src/tools/activate-skill.d.ts +1 -0
- package/dist/src/tools/activate-skill.js +28 -25
- package/dist/src/tools/activate-skill.js.map +1 -1
- package/dist/src/tools/activate-skill.test.js +24 -6
- package/dist/src/tools/activate-skill.test.js.map +1 -1
- package/dist/src/tools/ask-user.d.ts +29 -0
- package/dist/src/tools/ask-user.js +141 -0
- package/dist/src/tools/ask-user.js.map +1 -0
- package/dist/src/tools/ask-user.test.d.ts +6 -0
- package/dist/src/tools/ask-user.test.js +446 -0
- package/dist/src/tools/ask-user.test.js.map +1 -0
- package/dist/src/tools/confirmation-policy.test.js +21 -0
- package/dist/src/tools/confirmation-policy.test.js.map +1 -1
- package/dist/src/tools/constants.d.ts +7 -0
- package/dist/src/tools/constants.js +8 -0
- package/dist/src/tools/constants.js.map +1 -0
- package/dist/src/tools/definitions/base-declarations.d.ts +26 -0
- package/dist/src/tools/definitions/base-declarations.js +30 -0
- package/dist/src/tools/definitions/base-declarations.js.map +1 -0
- package/dist/src/tools/definitions/coreTools.d.ts +36 -0
- package/dist/src/tools/definitions/coreTools.js +143 -0
- package/dist/src/tools/definitions/coreTools.js.map +1 -0
- package/dist/src/tools/definitions/coreToolsModelSnapshots.test.d.ts +6 -0
- package/dist/src/tools/definitions/coreToolsModelSnapshots.test.js +82 -0
- package/dist/src/tools/definitions/coreToolsModelSnapshots.test.js.map +1 -0
- package/dist/src/tools/definitions/dynamic-declaration-helpers.d.ts +30 -0
- package/dist/src/tools/definitions/dynamic-declaration-helpers.js +135 -0
- package/dist/src/tools/definitions/dynamic-declaration-helpers.js.map +1 -0
- package/dist/src/tools/definitions/model-family-sets/default-legacy.d.ts +11 -0
- package/dist/src/tools/definitions/model-family-sets/default-legacy.js +575 -0
- package/dist/src/tools/definitions/model-family-sets/default-legacy.js.map +1 -0
- package/dist/src/tools/definitions/model-family-sets/gemini-3.d.ts +14 -0
- package/dist/src/tools/definitions/model-family-sets/gemini-3.js +578 -0
- package/dist/src/tools/definitions/model-family-sets/gemini-3.js.map +1 -0
- package/dist/src/tools/definitions/modelFamilyService.d.ts +14 -0
- package/dist/src/tools/definitions/modelFamilyService.js +29 -0
- package/dist/src/tools/definitions/modelFamilyService.js.map +1 -0
- package/dist/src/tools/definitions/resolver.d.ts +15 -0
- package/dist/src/tools/definitions/resolver.js +27 -0
- package/dist/src/tools/definitions/resolver.js.map +1 -0
- package/dist/src/tools/definitions/resolver.test.d.ts +6 -0
- package/dist/src/tools/definitions/resolver.test.js +58 -0
- package/dist/src/tools/definitions/resolver.test.js.map +1 -0
- package/dist/src/tools/definitions/trackerTools.d.ts +12 -0
- package/dist/src/tools/definitions/trackerTools.js +146 -0
- package/dist/src/tools/definitions/trackerTools.js.map +1 -0
- package/dist/src/tools/definitions/types.d.ts +44 -0
- package/dist/src/tools/definitions/types.js +7 -0
- package/dist/src/tools/definitions/types.js.map +1 -0
- package/dist/src/tools/diff-utils.d.ts +9 -0
- package/dist/src/tools/diff-utils.js +66 -0
- package/dist/src/tools/diff-utils.js.map +1 -0
- package/dist/src/tools/diff-utils.test.d.ts +6 -0
- package/dist/src/tools/diff-utils.test.js +53 -0
- package/dist/src/tools/diff-utils.test.js.map +1 -0
- package/dist/src/tools/diffOptions.d.ts +1 -1
- package/dist/src/tools/diffOptions.js +7 -3
- package/dist/src/tools/diffOptions.js.map +1 -1
- package/dist/src/tools/diffOptions.test.js +17 -0
- package/dist/src/tools/diffOptions.test.js.map +1 -1
- package/dist/src/tools/edit.d.ts +1 -0
- package/dist/src/tools/edit.js +52 -82
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +96 -1
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/enter-plan-mode.d.ts +25 -0
- package/dist/src/tools/enter-plan-mode.js +69 -0
- package/dist/src/tools/enter-plan-mode.js.map +1 -0
- package/dist/src/tools/enter-plan-mode.test.d.ts +6 -0
- package/dist/src/tools/enter-plan-mode.test.js +102 -0
- package/dist/src/tools/enter-plan-mode.test.js.map +1 -0
- package/dist/src/tools/exit-plan-mode.d.ts +33 -0
- package/dist/src/tools/exit-plan-mode.js +173 -0
- package/dist/src/tools/exit-plan-mode.js.map +1 -0
- package/dist/src/tools/exit-plan-mode.test.d.ts +6 -0
- package/dist/src/tools/exit-plan-mode.test.js +311 -0
- package/dist/src/tools/exit-plan-mode.test.js.map +1 -0
- package/dist/src/tools/get-internal-docs.d.ts +1 -0
- package/dist/src/tools/get-internal-docs.js +17 -27
- package/dist/src/tools/get-internal-docs.js.map +1 -1
- package/dist/src/tools/glob.d.ts +1 -0
- package/dist/src/tools/glob.js +15 -36
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/glob.test.js +219 -280
- package/dist/src/tools/glob.test.js.map +1 -1
- package/dist/src/tools/grep-utils.d.ts +49 -0
- package/dist/src/tools/grep-utils.js +147 -0
- package/dist/src/tools/grep-utils.js.map +1 -0
- package/dist/src/tools/grep.d.ts +18 -8
- package/dist/src/tools/grep.js +273 -247
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +165 -16
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/line-endings.test.d.ts +6 -0
- package/dist/src/tools/line-endings.test.js +209 -0
- package/dist/src/tools/line-endings.test.js.map +1 -0
- package/dist/src/tools/ls.d.ts +1 -0
- package/dist/src/tools/ls.js +18 -37
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.js +25 -3
- package/dist/src/tools/ls.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.d.ts +18 -5
- package/dist/src/tools/mcp-client-manager.js +118 -37
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +124 -16
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +18 -7
- package/dist/src/tools/mcp-client.js +137 -42
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +248 -29
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +26 -4
- package/dist/src/tools/mcp-tool.js +17 -5
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +5 -5
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +2 -7
- package/dist/src/tools/memoryTool.js +54 -80
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/memoryTool.test.js +62 -114
- package/dist/src/tools/memoryTool.test.js.map +1 -1
- package/dist/src/tools/modifiable-tool.test.js +3 -3
- package/dist/src/tools/modifiable-tool.test.js.map +1 -1
- package/dist/src/tools/omissionPlaceholderDetector.d.ts +15 -0
- package/dist/src/tools/omissionPlaceholderDetector.js +90 -0
- package/dist/src/tools/omissionPlaceholderDetector.js.map +1 -0
- package/dist/src/tools/omissionPlaceholderDetector.test.d.ts +6 -0
- package/dist/src/tools/omissionPlaceholderDetector.test.js +49 -0
- package/dist/src/tools/omissionPlaceholderDetector.test.js.map +1 -0
- package/dist/src/tools/read-file.d.ts +2 -0
- package/dist/src/tools/read-file.js +26 -30
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-file.test.js +90 -3
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/read-many-files.d.ts +1 -0
- package/dist/src/tools/read-many-files.js +21 -63
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +43 -1
- package/dist/src/tools/read-many-files.test.js.map +1 -1
- package/dist/src/tools/ripGrep.d.ts +20 -3
- package/dist/src/tools/ripGrep.js +217 -189
- package/dist/src/tools/ripGrep.js.map +1 -1
- package/dist/src/tools/ripGrep.test.js +745 -567
- package/dist/src/tools/ripGrep.test.js.map +1 -1
- package/dist/src/tools/shell.d.ts +1 -0
- package/dist/src/tools/shell.js +8 -3
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +248 -11
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/tool-error.d.ts +4 -0
- package/dist/src/tools/tool-error.js +4 -0
- package/dist/src/tools/tool-error.js.map +1 -1
- package/dist/src/tools/tool-names.d.ts +27 -17
- package/dist/src/tools/tool-names.js +59 -20
- package/dist/src/tools/tool-names.js.map +1 -1
- package/dist/src/tools/tool-names.test.js +55 -2
- package/dist/src/tools/tool-names.test.js.map +1 -1
- package/dist/src/tools/tool-registry.d.ts +10 -2
- package/dist/src/tools/tool-registry.js +58 -11
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +113 -1
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +52 -5
- package/dist/src/tools/tools.js +35 -18
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/trackerTools.d.ts +122 -0
- package/dist/src/tools/trackerTools.js +365 -0
- package/dist/src/tools/trackerTools.js.map +1 -0
- package/dist/src/tools/trackerTools.test.d.ts +6 -0
- package/dist/src/tools/trackerTools.test.js +97 -0
- package/dist/src/tools/trackerTools.test.js.map +1 -0
- package/dist/src/tools/web-fetch.d.ts +1 -0
- package/dist/src/tools/web-fetch.js +12 -12
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-search.d.ts +1 -0
- package/dist/src/tools/web-search.js +9 -11
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +1 -4
- package/dist/src/tools/write-file.js +42 -35
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +105 -18
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/tools/write-todos.d.ts +1 -30
- package/dist/src/tools/write-todos.js +5 -123
- package/dist/src/tools/write-todos.js.map +1 -1
- package/dist/src/tools/xcode-mcp-fix-transport.d.ts +30 -0
- package/dist/src/tools/xcode-mcp-fix-transport.js +82 -0
- package/dist/src/tools/xcode-mcp-fix-transport.js.map +1 -0
- package/dist/src/tools/xcode-mcp-fix-transport.test.d.ts +1 -0
- package/dist/src/tools/xcode-mcp-fix-transport.test.js +98 -0
- package/dist/src/tools/xcode-mcp-fix-transport.test.js.map +1 -0
- package/dist/src/utils/apiConversionUtils.d.ts +12 -0
- package/dist/src/utils/apiConversionUtils.js +46 -0
- package/dist/src/utils/apiConversionUtils.js.map +1 -0
- package/dist/src/utils/apiConversionUtils.test.d.ts +6 -0
- package/dist/src/utils/apiConversionUtils.test.js +150 -0
- package/dist/src/utils/apiConversionUtils.test.js.map +1 -0
- package/dist/src/utils/approvalModeUtils.d.ts +14 -0
- package/dist/src/utils/approvalModeUtils.js +35 -0
- package/dist/src/utils/approvalModeUtils.js.map +1 -0
- package/dist/src/utils/approvalModeUtils.test.d.ts +6 -0
- package/dist/src/utils/approvalModeUtils.test.js +36 -0
- package/dist/src/utils/approvalModeUtils.test.js.map +1 -0
- package/dist/src/utils/authConsent.d.ts +10 -0
- package/dist/src/utils/authConsent.js +52 -0
- package/dist/src/utils/authConsent.js.map +1 -0
- package/dist/src/utils/authConsent.test.d.ts +6 -0
- package/dist/src/utils/authConsent.test.js +74 -0
- package/dist/src/utils/authConsent.test.js.map +1 -0
- package/dist/src/utils/bfsFileSearch.js +2 -0
- package/dist/src/utils/bfsFileSearch.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.test.js +6 -1
- package/dist/src/utils/bfsFileSearch.test.js.map +1 -1
- package/dist/src/utils/cache.d.ts +63 -0
- package/dist/src/utils/cache.js +103 -0
- package/dist/src/utils/cache.js.map +1 -0
- package/dist/src/utils/cache.test.d.ts +6 -0
- package/dist/src/utils/cache.test.js +158 -0
- package/dist/src/utils/cache.test.js.map +1 -0
- package/dist/src/utils/checkpointUtils.js +2 -0
- package/dist/src/utils/checkpointUtils.js.map +1 -1
- package/dist/src/utils/checks.d.ts +19 -0
- package/dist/src/utils/checks.js +24 -0
- package/dist/src/utils/checks.js.map +1 -0
- package/dist/src/utils/checks.test.d.ts +6 -0
- package/dist/src/utils/checks.test.js +29 -0
- package/dist/src/utils/checks.test.js.map +1 -0
- package/dist/src/utils/compatibility.d.ts +41 -0
- package/dist/src/utils/compatibility.js +112 -0
- package/dist/src/utils/compatibility.js.map +1 -0
- package/dist/src/utils/compatibility.test.d.ts +6 -0
- package/dist/src/utils/compatibility.test.js +233 -0
- package/dist/src/utils/compatibility.test.js.map +1 -0
- package/dist/src/utils/constants.d.ts +7 -0
- package/dist/src/utils/constants.js +8 -0
- package/dist/src/utils/constants.js.map +1 -0
- package/dist/src/utils/deadlineTimer.d.ts +36 -0
- package/dist/src/utils/deadlineTimer.js +87 -0
- package/dist/src/utils/deadlineTimer.js.map +1 -0
- package/dist/src/utils/deadlineTimer.test.d.ts +6 -0
- package/dist/src/utils/deadlineTimer.test.js +64 -0
- package/dist/src/utils/deadlineTimer.test.js.map +1 -0
- package/dist/src/utils/editCorrector.d.ts +3 -3
- package/dist/src/utils/editCorrector.js +37 -10
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editCorrector.test.js +49 -20
- package/dist/src/utils/editCorrector.test.js.map +1 -1
- package/dist/src/utils/editor.d.ts +17 -3
- package/dist/src/utils/editor.js +84 -15
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/editor.test.js +160 -17
- package/dist/src/utils/editor.test.js.map +1 -1
- package/dist/src/utils/envExpansion.d.ts +18 -0
- package/dist/src/utils/envExpansion.js +46 -0
- package/dist/src/utils/envExpansion.js.map +1 -0
- package/dist/src/utils/envExpansion.test.d.ts +6 -0
- package/dist/src/utils/envExpansion.test.js +110 -0
- package/dist/src/utils/envExpansion.test.js.map +1 -0
- package/dist/src/utils/environmentContext.js +9 -20
- package/dist/src/utils/environmentContext.js.map +1 -1
- package/dist/src/utils/environmentContext.test.js +31 -14
- package/dist/src/utils/environmentContext.test.js.map +1 -1
- package/dist/src/utils/errors.d.ts +3 -0
- package/dist/src/utils/errors.js +13 -3
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/errors.test.js +23 -1
- package/dist/src/utils/errors.test.js.map +1 -1
- package/dist/src/utils/errors_timeout.test.d.ts +6 -0
- package/dist/src/utils/errors_timeout.test.js +40 -0
- package/dist/src/utils/errors_timeout.test.js.map +1 -0
- package/dist/src/utils/events.d.ts +107 -3
- package/dist/src/utils/events.js +65 -1
- package/dist/src/utils/events.js.map +1 -1
- package/dist/src/utils/events.test.js +43 -0
- package/dist/src/utils/events.test.js.map +1 -1
- package/dist/src/utils/extensionLoader.js +2 -0
- package/dist/src/utils/extensionLoader.js.map +1 -1
- package/dist/src/utils/extensionLoader.test.js +21 -0
- package/dist/src/utils/extensionLoader.test.js.map +1 -1
- package/dist/src/utils/fastAckHelper.d.ts +30 -0
- package/dist/src/utils/fastAckHelper.js +142 -0
- package/dist/src/utils/fastAckHelper.js.map +1 -0
- package/dist/src/utils/fastAckHelper.test.d.ts +6 -0
- package/dist/src/utils/fastAckHelper.test.js +115 -0
- package/dist/src/utils/fastAckHelper.test.js.map +1 -0
- package/dist/src/utils/fetch.test.d.ts +6 -0
- package/dist/src/utils/fetch.test.js +206 -0
- package/dist/src/utils/fetch.test.js.map +1 -0
- package/dist/src/utils/fileDiffUtils.d.ts +18 -0
- package/dist/src/utils/fileDiffUtils.js +37 -0
- package/dist/src/utils/fileDiffUtils.js.map +1 -0
- package/dist/src/utils/fileDiffUtils.test.d.ts +6 -0
- package/dist/src/utils/fileDiffUtils.test.js +84 -0
- package/dist/src/utils/fileDiffUtils.test.js.map +1 -0
- package/dist/src/utils/fileUtils.d.ts +27 -3
- package/dist/src/utils/fileUtils.js +104 -60
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/fileUtils.test.js +129 -109
- package/dist/src/utils/fileUtils.test.js.map +1 -1
- package/dist/src/utils/filesearch/crawler.d.ts +1 -0
- package/dist/src/utils/filesearch/crawler.js +18 -1
- package/dist/src/utils/filesearch/crawler.js.map +1 -1
- package/dist/src/utils/filesearch/crawler.test.js +101 -82
- package/dist/src/utils/filesearch/crawler.test.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.d.ts +4 -3
- package/dist/src/utils/filesearch/fileSearch.js +5 -4
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.test.js +172 -84
- package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -1
- package/dist/src/utils/filesearch/ignore.d.ts +2 -7
- package/dist/src/utils/filesearch/ignore.js +7 -14
- package/dist/src/utils/filesearch/ignore.js.map +1 -1
- package/dist/src/utils/filesearch/ignore.test.js +30 -32
- package/dist/src/utils/filesearch/ignore.test.js.map +1 -1
- package/dist/src/utils/formatters.d.ts +1 -1
- package/dist/src/utils/formatters.js +1 -1
- package/dist/src/utils/formatters.js.map +1 -1
- package/dist/src/utils/formatters.test.js +5 -5
- package/dist/src/utils/formatters.test.js.map +1 -1
- package/dist/src/utils/generateContentResponseUtilities.js +3 -0
- package/dist/src/utils/generateContentResponseUtilities.js.map +1 -1
- package/dist/src/utils/getFolderStructure.test.js +5 -2
- package/dist/src/utils/getFolderStructure.test.js.map +1 -1
- package/dist/src/utils/getPty.js +3 -0
- package/dist/src/utils/getPty.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.js +10 -11
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/googleErrors.js +4 -0
- package/dist/src/utils/googleErrors.js.map +1 -1
- package/dist/src/utils/googleQuotaErrors.d.ts +23 -9
- package/dist/src/utils/googleQuotaErrors.js +90 -23
- package/dist/src/utils/googleQuotaErrors.js.map +1 -1
- package/dist/src/utils/googleQuotaErrors.test.js +168 -23
- package/dist/src/utils/googleQuotaErrors.test.js.map +1 -1
- package/dist/src/utils/headless.d.ts +26 -0
- package/dist/src/utils/headless.js +33 -0
- package/dist/src/utils/headless.js.map +1 -0
- package/dist/src/utils/headless.test.d.ts +6 -0
- package/dist/src/utils/headless.test.js +167 -0
- package/dist/src/utils/headless.test.js.map +1 -0
- package/dist/src/utils/httpErrors.js +4 -1
- package/dist/src/utils/httpErrors.js.map +1 -1
- package/dist/src/utils/ignoreFileParser.d.ts +30 -0
- package/dist/src/utils/ignoreFileParser.js +100 -0
- package/dist/src/utils/ignoreFileParser.js.map +1 -0
- package/dist/src/utils/ignoreFileParser.test.d.ts +6 -0
- package/dist/src/utils/ignoreFileParser.test.js +167 -0
- package/dist/src/utils/ignoreFileParser.test.js.map +1 -0
- package/dist/src/utils/installationManager.test.js +11 -3
- package/dist/src/utils/installationManager.test.js.map +1 -1
- package/dist/src/utils/llm-edit-fixer.js +9 -9
- package/dist/src/utils/llm-edit-fixer.js.map +1 -1
- package/dist/src/utils/llm-edit-fixer.test.js +2 -2
- package/dist/src/utils/llm-edit-fixer.test.js.map +1 -1
- package/dist/src/utils/markdownUtils.d.ts +22 -0
- package/dist/src/utils/markdownUtils.js +126 -0
- package/dist/src/utils/markdownUtils.js.map +1 -0
- package/dist/src/utils/markdownUtils.test.d.ts +6 -0
- package/dist/src/utils/markdownUtils.test.js +107 -0
- package/dist/src/utils/markdownUtils.test.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +11 -3
- package/dist/src/utils/memoryDiscovery.js +122 -102
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +163 -109
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.js +7 -24
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/nextSpeakerChecker.js +3 -0
- package/dist/src/utils/nextSpeakerChecker.js.map +1 -1
- package/dist/src/utils/oauth-flow.d.ts +105 -0
- package/dist/src/utils/oauth-flow.js +370 -0
- package/dist/src/utils/oauth-flow.js.map +1 -0
- package/dist/src/utils/oauth-flow.test.d.ts +6 -0
- package/dist/src/utils/oauth-flow.test.js +360 -0
- package/dist/src/utils/oauth-flow.test.js.map +1 -0
- package/dist/src/utils/package.js +10 -3
- package/dist/src/utils/package.js.map +1 -1
- package/dist/src/utils/package.test.d.ts +6 -0
- package/dist/src/utils/package.test.js +57 -0
- package/dist/src/utils/package.test.js.map +1 -0
- package/dist/src/utils/partUtils.js +2 -1
- package/dist/src/utils/partUtils.js.map +1 -1
- package/dist/src/utils/paths.d.ts +33 -9
- package/dist/src/utils/paths.js +88 -29
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/paths.test.js +206 -110
- package/dist/src/utils/paths.test.js.map +1 -1
- package/dist/src/utils/planUtils.d.ts +29 -0
- package/dist/src/utils/planUtils.js +55 -0
- package/dist/src/utils/planUtils.js.map +1 -0
- package/dist/src/utils/planUtils.test.d.ts +6 -0
- package/dist/src/utils/planUtils.test.js +76 -0
- package/dist/src/utils/planUtils.test.js.map +1 -0
- package/dist/src/utils/process-utils.d.ts +32 -0
- package/dist/src/utils/process-utils.js +88 -0
- package/dist/src/utils/process-utils.js.map +1 -0
- package/dist/src/utils/process-utils.test.d.ts +6 -0
- package/dist/src/utils/process-utils.test.js +103 -0
- package/dist/src/utils/process-utils.test.js.map +1 -0
- package/dist/src/utils/promptIdContext.d.ts +6 -0
- package/dist/src/utils/promptIdContext.js +15 -0
- package/dist/src/utils/promptIdContext.js.map +1 -1
- package/dist/src/utils/quotaErrorDetection.js +3 -0
- package/dist/src/utils/quotaErrorDetection.js.map +1 -1
- package/dist/src/utils/retry.d.ts +4 -0
- package/dist/src/utils/retry.js +84 -5
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +70 -3
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/safeJsonStringify.js +1 -0
- package/dist/src/utils/safeJsonStringify.js.map +1 -1
- package/dist/src/utils/schemaValidator.d.ts +8 -1
- package/dist/src/utils/schemaValidator.js +78 -11
- package/dist/src/utils/schemaValidator.js.map +1 -1
- package/dist/src/utils/schemaValidator.test.js +77 -0
- package/dist/src/utils/schemaValidator.test.js.map +1 -1
- package/dist/src/utils/security.d.ts +16 -0
- package/dist/src/utils/security.js +91 -0
- package/dist/src/utils/security.js.map +1 -0
- package/dist/src/utils/security.test.d.ts +1 -0
- package/dist/src/utils/security.test.js +121 -0
- package/dist/src/utils/security.test.js.map +1 -0
- package/dist/src/utils/sessionUtils.d.ts +14 -0
- package/dist/src/utils/sessionUtils.js +122 -0
- package/dist/src/utils/sessionUtils.js.map +1 -0
- package/dist/src/utils/sessionUtils.test.d.ts +1 -0
- package/dist/src/utils/sessionUtils.test.js +171 -0
- package/dist/src/utils/sessionUtils.test.js.map +1 -0
- package/dist/src/utils/shell-utils.d.ts +14 -0
- package/dist/src/utils/shell-utils.integration.test.d.ts +1 -0
- package/dist/src/utils/shell-utils.integration.test.js +58 -0
- package/dist/src/utils/shell-utils.integration.test.js.map +1 -0
- package/dist/src/utils/shell-utils.js +191 -30
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +108 -1
- package/dist/src/utils/shell-utils.test.js.map +1 -1
- package/dist/src/utils/summarizer.js +2 -1
- package/dist/src/utils/summarizer.js.map +1 -1
- package/dist/src/utils/terminal.d.ts +4 -0
- package/dist/src/utils/terminal.js +12 -0
- package/dist/src/utils/terminal.js.map +1 -1
- package/dist/src/utils/terminalSerializer.d.ts +1 -1
- package/dist/src/utils/terminalSerializer.js +25 -13
- package/dist/src/utils/terminalSerializer.js.map +1 -1
- package/dist/src/utils/testUtils.js +1 -0
- package/dist/src/utils/testUtils.js.map +1 -1
- package/dist/src/utils/textUtils.d.ts +14 -0
- package/dist/src/utils/textUtils.js +23 -0
- package/dist/src/utils/textUtils.js.map +1 -1
- package/dist/src/utils/textUtils.test.js +18 -1
- package/dist/src/utils/textUtils.test.js.map +1 -1
- package/dist/src/utils/tokenCalculation.d.ts +2 -2
- package/dist/src/utils/tokenCalculation.js +87 -21
- package/dist/src/utils/tokenCalculation.js.map +1 -1
- package/dist/src/utils/tokenCalculation.test.js +189 -76
- package/dist/src/utils/tokenCalculation.test.js.map +1 -1
- package/dist/src/utils/tool-utils.d.ts +26 -0
- package/dist/src/utils/tool-utils.js +36 -0
- package/dist/src/utils/tool-utils.js.map +1 -1
- package/dist/src/utils/tool-utils.test.js +73 -3
- package/dist/src/utils/tool-utils.test.js.map +1 -1
- package/dist/src/utils/toolCallContext.d.ts +35 -0
- package/dist/src/utils/toolCallContext.js +29 -0
- package/dist/src/utils/toolCallContext.js.map +1 -0
- package/dist/src/utils/toolCallContext.test.d.ts +6 -0
- package/dist/src/utils/toolCallContext.test.js +68 -0
- package/dist/src/utils/toolCallContext.test.js.map +1 -0
- package/dist/src/utils/userAccountManager.js +1 -0
- package/dist/src/utils/userAccountManager.js.map +1 -1
- package/dist/src/utils/userAccountManager.test.js +5 -5
- package/dist/src/utils/userAccountManager.test.js.map +1 -1
- package/dist/src/utils/version.d.ts +2 -0
- package/dist/src/utils/version.js +14 -3
- package/dist/src/utils/version.js.map +1 -1
- package/dist/src/utils/version.test.js +15 -1
- package/dist/src/utils/version.test.js.map +1 -1
- package/dist/src/utils/workspaceContext.d.ts +28 -0
- package/dist/src/utils/workspaceContext.js +74 -9
- package/dist/src/utils/workspaceContext.js.map +1 -1
- package/dist/src/utils/workspaceContext.test.js +56 -1
- package/dist/src/utils/workspaceContext.test.js.map +1 -1
- package/dist/src/voice/responseFormatter.d.ts +38 -0
- package/dist/src/voice/responseFormatter.js +130 -0
- package/dist/src/voice/responseFormatter.js.map +1 -0
- package/dist/src/voice/responseFormatter.test.d.ts +6 -0
- package/dist/src/voice/responseFormatter.test.js +214 -0
- package/dist/src/voice/responseFormatter.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -15
- package/dist/docs/CONTRIBUTING.md +0 -546
- package/dist/src/agents/executor.d.ts +0 -114
- package/dist/src/agents/executor.js +0 -779
- package/dist/src/agents/executor.js.map +0 -1
- package/dist/src/agents/executor.test.js +0 -1362
- package/dist/src/agents/executor.test.js.map +0 -1
- package/dist/src/agents/invocation.d.ts +0 -46
- package/dist/src/agents/invocation.js +0 -102
- package/dist/src/agents/invocation.js.map +0 -1
- package/dist/src/agents/invocation.test.js +0 -215
- package/dist/src/agents/invocation.test.js.map +0 -1
- package/dist/src/core/subagent.d.ts +0 -236
- package/dist/src/core/subagent.js +0 -482
- package/dist/src/core/subagent.js.map +0 -1
- package/dist/src/core/subagent.test.js +0 -530
- package/dist/src/core/subagent.test.js.map +0 -1
- package/dist/src/tools/smart-edit.d.ts +0 -78
- package/dist/src/tools/smart-edit.js +0 -717
- package/dist/src/tools/smart-edit.js.map +0 -1
- package/dist/src/tools/smart-edit.test.js +0 -592
- package/dist/src/tools/smart-edit.test.js.map +0 -1
- /package/dist/src/agents/{executor.test.d.ts → agentLoader.test.d.ts} +0 -0
- /package/dist/src/agents/{invocation.test.d.ts → cli-help-agent.test.d.ts} +0 -0
- /package/dist/src/{core/subagent.test.d.ts → availability/fallbackIntegration.test.d.ts} +0 -0
- /package/dist/src/{tools/smart-edit.test.d.ts → code_assist/admin/admin_controls.test.d.ts} +0 -0
|
@@ -1,1362 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { describe, it, expect, vi, beforeEach, afterEach, } from 'vitest';
|
|
7
|
-
import { debugLogger } from '../utils/debugLogger.js';
|
|
8
|
-
import { AgentExecutor } from './executor.js';
|
|
9
|
-
import { makeFakeConfig } from '../test-utils/config.js';
|
|
10
|
-
import { ToolRegistry } from '../tools/tool-registry.js';
|
|
11
|
-
import { LSTool } from '../tools/ls.js';
|
|
12
|
-
import { LS_TOOL_NAME, READ_FILE_TOOL_NAME } from '../tools/tool-names.js';
|
|
13
|
-
import { GeminiChat, StreamEventType, } from '../core/geminiChat.js';
|
|
14
|
-
import {} from '@google/genai';
|
|
15
|
-
import { MockTool } from '../test-utils/mock-tool.js';
|
|
16
|
-
import { getDirectoryContextString } from '../utils/environmentContext.js';
|
|
17
|
-
import { z } from 'zod';
|
|
18
|
-
import { promptIdContext } from '../utils/promptIdContext.js';
|
|
19
|
-
import { logAgentStart, logAgentFinish, logRecoveryAttempt, } from '../telemetry/loggers.js';
|
|
20
|
-
import { AgentStartEvent, AgentFinishEvent, RecoveryAttemptEvent, } from '../telemetry/types.js';
|
|
21
|
-
import { AgentTerminateMode } from './types.js';
|
|
22
|
-
import { CompressionStatus } from '../core/turn.js';
|
|
23
|
-
import { ChatCompressionService } from '../services/chatCompressionService.js';
|
|
24
|
-
import { getModelConfigAlias } from './registry.js';
|
|
25
|
-
const { mockSendMessageStream, mockExecuteToolCall, mockSetSystemInstruction, mockCompress, mockSetTools, } = vi.hoisted(() => ({
|
|
26
|
-
mockSendMessageStream: vi.fn(),
|
|
27
|
-
mockExecuteToolCall: vi.fn(),
|
|
28
|
-
mockSetSystemInstruction: vi.fn(),
|
|
29
|
-
mockCompress: vi.fn(),
|
|
30
|
-
mockSetTools: vi.fn(),
|
|
31
|
-
}));
|
|
32
|
-
let mockChatHistory = [];
|
|
33
|
-
const mockSetHistory = vi.fn((newHistory) => {
|
|
34
|
-
mockChatHistory = newHistory;
|
|
35
|
-
});
|
|
36
|
-
vi.mock('../services/chatCompressionService.js', () => ({
|
|
37
|
-
ChatCompressionService: vi.fn().mockImplementation(() => ({
|
|
38
|
-
compress: mockCompress,
|
|
39
|
-
})),
|
|
40
|
-
}));
|
|
41
|
-
vi.mock('../core/geminiChat.js', async (importOriginal) => {
|
|
42
|
-
const actual = await importOriginal();
|
|
43
|
-
return {
|
|
44
|
-
...actual,
|
|
45
|
-
GeminiChat: vi.fn().mockImplementation(() => ({
|
|
46
|
-
sendMessageStream: mockSendMessageStream,
|
|
47
|
-
getHistory: vi.fn((_curated) => [...mockChatHistory]),
|
|
48
|
-
setHistory: mockSetHistory,
|
|
49
|
-
setSystemInstruction: mockSetSystemInstruction,
|
|
50
|
-
setTools: mockSetTools,
|
|
51
|
-
})),
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
vi.mock('../core/nonInteractiveToolExecutor.js', () => ({
|
|
55
|
-
executeToolCall: mockExecuteToolCall,
|
|
56
|
-
}));
|
|
57
|
-
vi.mock('../utils/environmentContext.js');
|
|
58
|
-
vi.mock('../telemetry/loggers.js', () => ({
|
|
59
|
-
logAgentStart: vi.fn(),
|
|
60
|
-
logAgentFinish: vi.fn(),
|
|
61
|
-
logRecoveryAttempt: vi.fn(),
|
|
62
|
-
}));
|
|
63
|
-
vi.mock('../utils/promptIdContext.js', async (importOriginal) => {
|
|
64
|
-
const actual = await importOriginal();
|
|
65
|
-
return {
|
|
66
|
-
...actual,
|
|
67
|
-
promptIdContext: {
|
|
68
|
-
...actual.promptIdContext,
|
|
69
|
-
getStore: vi.fn(),
|
|
70
|
-
run: vi.fn((_id, fn) => fn()),
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
});
|
|
74
|
-
const MockedGeminiChat = vi.mocked(GeminiChat);
|
|
75
|
-
const mockedGetDirectoryContextString = vi.mocked(getDirectoryContextString);
|
|
76
|
-
const mockedPromptIdContext = vi.mocked(promptIdContext);
|
|
77
|
-
const mockedLogAgentStart = vi.mocked(logAgentStart);
|
|
78
|
-
const mockedLogAgentFinish = vi.mocked(logAgentFinish);
|
|
79
|
-
const mockedLogRecoveryAttempt = vi.mocked(logRecoveryAttempt);
|
|
80
|
-
// Constants for testing
|
|
81
|
-
const TASK_COMPLETE_TOOL_NAME = 'complete_task';
|
|
82
|
-
const MOCK_TOOL_NOT_ALLOWED = new MockTool({ name: 'write_file_interactive' });
|
|
83
|
-
/**
|
|
84
|
-
* Helper to create a mock API response chunk.
|
|
85
|
-
* Uses conditional spread to handle readonly functionCalls property safely.
|
|
86
|
-
*/
|
|
87
|
-
const createMockResponseChunk = (parts, functionCalls) => ({
|
|
88
|
-
candidates: [{ index: 0, content: { role: 'model', parts } }],
|
|
89
|
-
...(functionCalls && functionCalls.length > 0 ? { functionCalls } : {}),
|
|
90
|
-
});
|
|
91
|
-
/**
|
|
92
|
-
* Helper to mock a single turn of model response in the stream.
|
|
93
|
-
*/
|
|
94
|
-
const mockModelResponse = (functionCalls, thought, text) => {
|
|
95
|
-
const parts = [];
|
|
96
|
-
if (thought) {
|
|
97
|
-
parts.push({
|
|
98
|
-
text: `**${thought}** This is the reasoning part.`,
|
|
99
|
-
thought: true,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
if (text)
|
|
103
|
-
parts.push({ text });
|
|
104
|
-
const responseChunk = createMockResponseChunk(parts, functionCalls);
|
|
105
|
-
mockSendMessageStream.mockImplementationOnce(async () => (async function* () {
|
|
106
|
-
yield {
|
|
107
|
-
type: StreamEventType.CHUNK,
|
|
108
|
-
value: responseChunk,
|
|
109
|
-
};
|
|
110
|
-
})());
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* Helper to extract the message parameters sent to sendMessageStream.
|
|
114
|
-
* Provides type safety for inspecting mock calls.
|
|
115
|
-
*/
|
|
116
|
-
const getMockMessageParams = (callIndex) => {
|
|
117
|
-
const call = mockSendMessageStream.mock.calls[callIndex];
|
|
118
|
-
expect(call).toBeDefined();
|
|
119
|
-
return {
|
|
120
|
-
modelConfigKey: call[0],
|
|
121
|
-
message: call[1],
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
let mockConfig;
|
|
125
|
-
let parentToolRegistry;
|
|
126
|
-
/**
|
|
127
|
-
* Type-safe helper to create agent definitions for tests.
|
|
128
|
-
*/
|
|
129
|
-
const createTestDefinition = (tools = [LS_TOOL_NAME], runConfigOverrides = {}, outputConfigMode = 'default', schema = z.string()) => {
|
|
130
|
-
let outputConfig;
|
|
131
|
-
if (outputConfigMode === 'default') {
|
|
132
|
-
outputConfig = {
|
|
133
|
-
outputName: 'finalResult',
|
|
134
|
-
description: 'The final result.',
|
|
135
|
-
schema,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
return {
|
|
139
|
-
name: 'TestAgent',
|
|
140
|
-
description: 'An agent for testing.',
|
|
141
|
-
inputConfig: {
|
|
142
|
-
inputs: { goal: { type: 'string', required: true, description: 'goal' } },
|
|
143
|
-
},
|
|
144
|
-
modelConfig: { model: 'gemini-test-model', temp: 0, top_p: 1 },
|
|
145
|
-
runConfig: { max_time_minutes: 5, max_turns: 5, ...runConfigOverrides },
|
|
146
|
-
promptConfig: { systemPrompt: 'Achieve the goal: ${goal}.' },
|
|
147
|
-
toolConfig: { tools },
|
|
148
|
-
outputConfig,
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
describe('AgentExecutor', () => {
|
|
152
|
-
let activities;
|
|
153
|
-
let onActivity;
|
|
154
|
-
let abortController;
|
|
155
|
-
let signal;
|
|
156
|
-
beforeEach(async () => {
|
|
157
|
-
vi.resetAllMocks();
|
|
158
|
-
mockCompress.mockClear();
|
|
159
|
-
mockSetHistory.mockClear();
|
|
160
|
-
mockSendMessageStream.mockReset();
|
|
161
|
-
mockSetSystemInstruction.mockReset();
|
|
162
|
-
mockSetTools.mockReset();
|
|
163
|
-
mockExecuteToolCall.mockReset();
|
|
164
|
-
mockedLogAgentStart.mockReset();
|
|
165
|
-
mockedLogAgentFinish.mockReset();
|
|
166
|
-
mockedPromptIdContext.getStore.mockReset();
|
|
167
|
-
mockedPromptIdContext.run.mockImplementation((_id, fn) => fn());
|
|
168
|
-
ChatCompressionService.mockImplementation(() => ({
|
|
169
|
-
compress: mockCompress,
|
|
170
|
-
}));
|
|
171
|
-
mockCompress.mockResolvedValue({
|
|
172
|
-
newHistory: null,
|
|
173
|
-
info: { compressionStatus: CompressionStatus.NOOP },
|
|
174
|
-
});
|
|
175
|
-
MockedGeminiChat.mockImplementation(() => ({
|
|
176
|
-
sendMessageStream: mockSendMessageStream,
|
|
177
|
-
setSystemInstruction: mockSetSystemInstruction,
|
|
178
|
-
setTools: mockSetTools,
|
|
179
|
-
getHistory: vi.fn((_curated) => [...mockChatHistory]),
|
|
180
|
-
getLastPromptTokenCount: vi.fn(() => 100),
|
|
181
|
-
setHistory: mockSetHistory,
|
|
182
|
-
}));
|
|
183
|
-
vi.useFakeTimers();
|
|
184
|
-
mockConfig = makeFakeConfig();
|
|
185
|
-
parentToolRegistry = new ToolRegistry(mockConfig);
|
|
186
|
-
parentToolRegistry.registerTool(new LSTool(mockConfig));
|
|
187
|
-
parentToolRegistry.registerTool(new MockTool({ name: READ_FILE_TOOL_NAME }));
|
|
188
|
-
parentToolRegistry.registerTool(MOCK_TOOL_NOT_ALLOWED);
|
|
189
|
-
vi.spyOn(mockConfig, 'getToolRegistry').mockResolvedValue(parentToolRegistry);
|
|
190
|
-
mockedGetDirectoryContextString.mockResolvedValue('Mocked Environment Context');
|
|
191
|
-
activities = [];
|
|
192
|
-
onActivity = (activity) => activities.push(activity);
|
|
193
|
-
abortController = new AbortController();
|
|
194
|
-
signal = abortController.signal;
|
|
195
|
-
});
|
|
196
|
-
afterEach(() => {
|
|
197
|
-
vi.useRealTimers();
|
|
198
|
-
});
|
|
199
|
-
describe('create (Initialization and Validation)', () => {
|
|
200
|
-
it('should create successfully with allowed tools', async () => {
|
|
201
|
-
const definition = createTestDefinition([LS_TOOL_NAME]);
|
|
202
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
203
|
-
expect(executor).toBeInstanceOf(AgentExecutor);
|
|
204
|
-
});
|
|
205
|
-
it('SECURITY: should throw if a tool is not on the non-interactive allowlist', async () => {
|
|
206
|
-
const definition = createTestDefinition([MOCK_TOOL_NOT_ALLOWED.name]);
|
|
207
|
-
await expect(AgentExecutor.create(definition, mockConfig, onActivity)).rejects.toThrow(/not on the allow-list for non-interactive execution/);
|
|
208
|
-
});
|
|
209
|
-
it('should create an isolated ToolRegistry for the agent', async () => {
|
|
210
|
-
const definition = createTestDefinition([
|
|
211
|
-
LS_TOOL_NAME,
|
|
212
|
-
READ_FILE_TOOL_NAME,
|
|
213
|
-
]);
|
|
214
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
215
|
-
const agentRegistry = executor['toolRegistry'];
|
|
216
|
-
expect(agentRegistry).not.toBe(parentToolRegistry);
|
|
217
|
-
expect(agentRegistry.getAllToolNames()).toEqual(expect.arrayContaining([LS_TOOL_NAME, READ_FILE_TOOL_NAME]));
|
|
218
|
-
expect(agentRegistry.getAllToolNames()).toHaveLength(2);
|
|
219
|
-
expect(agentRegistry.getTool(MOCK_TOOL_NOT_ALLOWED.name)).toBeUndefined();
|
|
220
|
-
});
|
|
221
|
-
it('should use parentPromptId from context to create agentId', async () => {
|
|
222
|
-
const parentId = 'parent-id';
|
|
223
|
-
mockedPromptIdContext.getStore.mockReturnValue(parentId);
|
|
224
|
-
const definition = createTestDefinition();
|
|
225
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
226
|
-
expect(executor['agentId']).toMatch(new RegExp(`^${parentId}-${definition.name}-`));
|
|
227
|
-
});
|
|
228
|
-
it('should correctly apply templates to initialMessages', async () => {
|
|
229
|
-
const definition = createTestDefinition();
|
|
230
|
-
// Override promptConfig to use initialMessages instead of systemPrompt
|
|
231
|
-
definition.promptConfig = {
|
|
232
|
-
initialMessages: [
|
|
233
|
-
{ role: 'user', parts: [{ text: 'Goal: ${goal}' }] },
|
|
234
|
-
{ role: 'model', parts: [{ text: 'OK, starting on ${goal}.' }] },
|
|
235
|
-
],
|
|
236
|
-
};
|
|
237
|
-
const inputs = { goal: 'TestGoal' };
|
|
238
|
-
// Mock a response to prevent the loop from running forever
|
|
239
|
-
mockModelResponse([
|
|
240
|
-
{
|
|
241
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
242
|
-
args: { finalResult: 'done' },
|
|
243
|
-
id: 'call1',
|
|
244
|
-
},
|
|
245
|
-
]);
|
|
246
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
247
|
-
await executor.run(inputs, signal);
|
|
248
|
-
const chatConstructorArgs = MockedGeminiChat.mock.calls[0];
|
|
249
|
-
const startHistory = chatConstructorArgs[3]; // history is the 4th arg
|
|
250
|
-
expect(startHistory).toBeDefined();
|
|
251
|
-
expect(startHistory).toHaveLength(2);
|
|
252
|
-
// Perform checks on defined objects to satisfy TS
|
|
253
|
-
const firstPart = startHistory?.[0]?.parts?.[0];
|
|
254
|
-
expect(firstPart?.text).toBe('Goal: TestGoal');
|
|
255
|
-
const secondPart = startHistory?.[1]?.parts?.[0];
|
|
256
|
-
expect(secondPart?.text).toBe('OK, starting on TestGoal.');
|
|
257
|
-
});
|
|
258
|
-
});
|
|
259
|
-
describe('run (Execution Loop and Logic)', () => {
|
|
260
|
-
it('should log AgentFinish with error if run throws', async () => {
|
|
261
|
-
const definition = createTestDefinition();
|
|
262
|
-
// Make the definition invalid to cause an error during run
|
|
263
|
-
definition.inputConfig.inputs = {
|
|
264
|
-
goal: { type: 'string', required: true, description: 'goal' },
|
|
265
|
-
};
|
|
266
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
267
|
-
// Run without inputs to trigger validation error
|
|
268
|
-
await expect(executor.run({}, signal)).rejects.toThrow(/Missing required input parameters/);
|
|
269
|
-
expect(mockedLogAgentStart).toHaveBeenCalledTimes(1);
|
|
270
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledTimes(1);
|
|
271
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
|
|
272
|
-
terminate_reason: AgentTerminateMode.ERROR,
|
|
273
|
-
}));
|
|
274
|
-
});
|
|
275
|
-
it('should execute successfully when model calls complete_task with output (Happy Path with Output)', async () => {
|
|
276
|
-
const definition = createTestDefinition();
|
|
277
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
278
|
-
const inputs = { goal: 'Find files' };
|
|
279
|
-
// Turn 1: Model calls ls
|
|
280
|
-
mockModelResponse([{ name: LS_TOOL_NAME, args: { path: '.' }, id: 'call1' }], 'T1: Listing');
|
|
281
|
-
mockExecuteToolCall.mockResolvedValueOnce({
|
|
282
|
-
status: 'success',
|
|
283
|
-
request: {
|
|
284
|
-
callId: 'call1',
|
|
285
|
-
name: LS_TOOL_NAME,
|
|
286
|
-
args: { path: '.' },
|
|
287
|
-
isClientInitiated: false,
|
|
288
|
-
prompt_id: 'test-prompt',
|
|
289
|
-
},
|
|
290
|
-
tool: {},
|
|
291
|
-
invocation: {},
|
|
292
|
-
response: {
|
|
293
|
-
callId: 'call1',
|
|
294
|
-
resultDisplay: 'file1.txt',
|
|
295
|
-
responseParts: [
|
|
296
|
-
{
|
|
297
|
-
functionResponse: {
|
|
298
|
-
name: LS_TOOL_NAME,
|
|
299
|
-
response: { result: 'file1.txt' },
|
|
300
|
-
id: 'call1',
|
|
301
|
-
},
|
|
302
|
-
},
|
|
303
|
-
],
|
|
304
|
-
error: undefined,
|
|
305
|
-
errorType: undefined,
|
|
306
|
-
contentLength: undefined,
|
|
307
|
-
},
|
|
308
|
-
});
|
|
309
|
-
// Turn 2: Model calls complete_task with required output
|
|
310
|
-
mockModelResponse([
|
|
311
|
-
{
|
|
312
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
313
|
-
args: { finalResult: 'Found file1.txt' },
|
|
314
|
-
id: 'call2',
|
|
315
|
-
},
|
|
316
|
-
], 'T2: Done');
|
|
317
|
-
const output = await executor.run(inputs, signal);
|
|
318
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
319
|
-
const systemInstruction = MockedGeminiChat.mock.calls[0][1];
|
|
320
|
-
expect(systemInstruction).toContain(`MUST call the \`${TASK_COMPLETE_TOOL_NAME}\` tool`);
|
|
321
|
-
expect(systemInstruction).toContain('Mocked Environment Context');
|
|
322
|
-
expect(systemInstruction).toContain('You are running in a non-interactive mode');
|
|
323
|
-
expect(systemInstruction).toContain('Always use absolute paths');
|
|
324
|
-
const { modelConfigKey } = getMockMessageParams(0);
|
|
325
|
-
expect(modelConfigKey.model).toBe(getModelConfigAlias(definition));
|
|
326
|
-
const call = mockSetTools.mock.calls[0];
|
|
327
|
-
const sentTools = call[0][0].functionDeclarations;
|
|
328
|
-
expect(sentTools).toBeDefined();
|
|
329
|
-
expect(sentTools).toEqual(expect.arrayContaining([
|
|
330
|
-
expect.objectContaining({ name: LS_TOOL_NAME }),
|
|
331
|
-
expect.objectContaining({ name: TASK_COMPLETE_TOOL_NAME }),
|
|
332
|
-
]));
|
|
333
|
-
const completeToolDef = sentTools.find((t) => t.name === TASK_COMPLETE_TOOL_NAME);
|
|
334
|
-
expect(completeToolDef?.parameters?.required).toContain('finalResult');
|
|
335
|
-
expect(output.result).toBe('Found file1.txt');
|
|
336
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
337
|
-
// Telemetry checks
|
|
338
|
-
expect(mockedLogAgentStart).toHaveBeenCalledTimes(1);
|
|
339
|
-
expect(mockedLogAgentStart).toHaveBeenCalledWith(mockConfig, expect.any(AgentStartEvent));
|
|
340
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledTimes(1);
|
|
341
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledWith(mockConfig, expect.any(AgentFinishEvent));
|
|
342
|
-
const finishEvent = mockedLogAgentFinish.mock.calls[0][1];
|
|
343
|
-
expect(finishEvent.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
344
|
-
// Context checks
|
|
345
|
-
expect(mockedPromptIdContext.run).toHaveBeenCalledTimes(2); // Two turns
|
|
346
|
-
const agentId = executor['agentId'];
|
|
347
|
-
expect(mockedPromptIdContext.run).toHaveBeenNthCalledWith(1, `${agentId}#0`, expect.any(Function));
|
|
348
|
-
expect(mockedPromptIdContext.run).toHaveBeenNthCalledWith(2, `${agentId}#1`, expect.any(Function));
|
|
349
|
-
expect(activities).toEqual(expect.arrayContaining([
|
|
350
|
-
expect.objectContaining({
|
|
351
|
-
type: 'THOUGHT_CHUNK',
|
|
352
|
-
data: { text: 'T1: Listing' },
|
|
353
|
-
}),
|
|
354
|
-
expect.objectContaining({
|
|
355
|
-
type: 'TOOL_CALL_END',
|
|
356
|
-
data: { name: LS_TOOL_NAME, output: 'file1.txt' },
|
|
357
|
-
}),
|
|
358
|
-
expect.objectContaining({
|
|
359
|
-
type: 'TOOL_CALL_START',
|
|
360
|
-
data: {
|
|
361
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
362
|
-
args: { finalResult: 'Found file1.txt' },
|
|
363
|
-
},
|
|
364
|
-
}),
|
|
365
|
-
expect.objectContaining({
|
|
366
|
-
type: 'TOOL_CALL_END',
|
|
367
|
-
data: {
|
|
368
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
369
|
-
output: expect.stringContaining('Output submitted'),
|
|
370
|
-
},
|
|
371
|
-
}),
|
|
372
|
-
]));
|
|
373
|
-
});
|
|
374
|
-
it('should execute successfully when model calls complete_task without output (Happy Path No Output)', async () => {
|
|
375
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {}, 'none');
|
|
376
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
377
|
-
mockModelResponse([
|
|
378
|
-
{ name: LS_TOOL_NAME, args: { path: '.' }, id: 'call1' },
|
|
379
|
-
]);
|
|
380
|
-
mockExecuteToolCall.mockResolvedValueOnce({
|
|
381
|
-
status: 'success',
|
|
382
|
-
request: {
|
|
383
|
-
callId: 'call1',
|
|
384
|
-
name: LS_TOOL_NAME,
|
|
385
|
-
args: { path: '.' },
|
|
386
|
-
isClientInitiated: false,
|
|
387
|
-
prompt_id: 'test-prompt',
|
|
388
|
-
},
|
|
389
|
-
tool: {},
|
|
390
|
-
invocation: {},
|
|
391
|
-
response: {
|
|
392
|
-
callId: 'call1',
|
|
393
|
-
resultDisplay: 'ok',
|
|
394
|
-
responseParts: [
|
|
395
|
-
{
|
|
396
|
-
functionResponse: {
|
|
397
|
-
name: LS_TOOL_NAME,
|
|
398
|
-
response: {},
|
|
399
|
-
id: 'call1',
|
|
400
|
-
},
|
|
401
|
-
},
|
|
402
|
-
],
|
|
403
|
-
error: undefined,
|
|
404
|
-
errorType: undefined,
|
|
405
|
-
contentLength: undefined,
|
|
406
|
-
},
|
|
407
|
-
});
|
|
408
|
-
mockModelResponse([{ name: TASK_COMPLETE_TOOL_NAME, args: {}, id: 'call2' }], 'Task finished.');
|
|
409
|
-
const output = await executor.run({ goal: 'Do work' }, signal);
|
|
410
|
-
const { modelConfigKey } = getMockMessageParams(0);
|
|
411
|
-
expect(modelConfigKey.model).toBe(getModelConfigAlias(definition));
|
|
412
|
-
const call = mockSetTools.mock.calls[0];
|
|
413
|
-
const sentTools = call[0][0].functionDeclarations;
|
|
414
|
-
expect(sentTools).toBeDefined();
|
|
415
|
-
const completeToolDef = sentTools.find((t) => t.name === TASK_COMPLETE_TOOL_NAME);
|
|
416
|
-
expect(completeToolDef?.parameters?.required).toEqual([]);
|
|
417
|
-
expect(completeToolDef?.description).toContain('signal that you have completed');
|
|
418
|
-
expect(output.result).toBe('Task completed successfully.');
|
|
419
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
420
|
-
});
|
|
421
|
-
it('should error immediately if the model stops tools without calling complete_task (Protocol Violation)', async () => {
|
|
422
|
-
const definition = createTestDefinition();
|
|
423
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
424
|
-
mockModelResponse([
|
|
425
|
-
{ name: LS_TOOL_NAME, args: { path: '.' }, id: 'call1' },
|
|
426
|
-
]);
|
|
427
|
-
mockExecuteToolCall.mockResolvedValueOnce({
|
|
428
|
-
status: 'success',
|
|
429
|
-
request: {
|
|
430
|
-
callId: 'call1',
|
|
431
|
-
name: LS_TOOL_NAME,
|
|
432
|
-
args: { path: '.' },
|
|
433
|
-
isClientInitiated: false,
|
|
434
|
-
prompt_id: 'test-prompt',
|
|
435
|
-
},
|
|
436
|
-
tool: {},
|
|
437
|
-
invocation: {},
|
|
438
|
-
response: {
|
|
439
|
-
callId: 'call1',
|
|
440
|
-
resultDisplay: 'ok',
|
|
441
|
-
responseParts: [
|
|
442
|
-
{
|
|
443
|
-
functionResponse: {
|
|
444
|
-
name: LS_TOOL_NAME,
|
|
445
|
-
response: {},
|
|
446
|
-
id: 'call1',
|
|
447
|
-
},
|
|
448
|
-
},
|
|
449
|
-
],
|
|
450
|
-
error: undefined,
|
|
451
|
-
errorType: undefined,
|
|
452
|
-
contentLength: undefined,
|
|
453
|
-
},
|
|
454
|
-
});
|
|
455
|
-
// Turn 2 (protocol violation)
|
|
456
|
-
mockModelResponse([], 'I think I am done.');
|
|
457
|
-
// Turn 3 (recovery turn - also fails)
|
|
458
|
-
mockModelResponse([], 'I still give up.');
|
|
459
|
-
const output = await executor.run({ goal: 'Strict test' }, signal);
|
|
460
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(3);
|
|
461
|
-
const expectedError = `Agent stopped calling tools but did not call '${TASK_COMPLETE_TOOL_NAME}'.`;
|
|
462
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.ERROR_NO_COMPLETE_TASK_CALL);
|
|
463
|
-
expect(output.result).toBe(expectedError);
|
|
464
|
-
// Telemetry check for error
|
|
465
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
|
|
466
|
-
terminate_reason: AgentTerminateMode.ERROR_NO_COMPLETE_TASK_CALL,
|
|
467
|
-
}));
|
|
468
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
469
|
-
type: 'ERROR',
|
|
470
|
-
data: expect.objectContaining({
|
|
471
|
-
context: 'protocol_violation',
|
|
472
|
-
error: expectedError,
|
|
473
|
-
}),
|
|
474
|
-
}));
|
|
475
|
-
});
|
|
476
|
-
it('should report an error if complete_task is called with missing required arguments', async () => {
|
|
477
|
-
const definition = createTestDefinition();
|
|
478
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
479
|
-
// Turn 1: Missing arg
|
|
480
|
-
mockModelResponse([
|
|
481
|
-
{
|
|
482
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
483
|
-
args: { wrongArg: 'oops' },
|
|
484
|
-
id: 'call1',
|
|
485
|
-
},
|
|
486
|
-
]);
|
|
487
|
-
// Turn 2: Corrected
|
|
488
|
-
mockModelResponse([
|
|
489
|
-
{
|
|
490
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
491
|
-
args: { finalResult: 'Corrected result' },
|
|
492
|
-
id: 'call2',
|
|
493
|
-
},
|
|
494
|
-
]);
|
|
495
|
-
const output = await executor.run({ goal: 'Error test' }, signal);
|
|
496
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
497
|
-
const expectedError = "Missing required argument 'finalResult' for completion.";
|
|
498
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
499
|
-
type: 'ERROR',
|
|
500
|
-
data: {
|
|
501
|
-
context: 'tool_call',
|
|
502
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
503
|
-
error: expectedError,
|
|
504
|
-
},
|
|
505
|
-
}));
|
|
506
|
-
const turn2Params = getMockMessageParams(1);
|
|
507
|
-
const turn2Parts = turn2Params.message;
|
|
508
|
-
expect(turn2Parts).toBeDefined();
|
|
509
|
-
expect(turn2Parts).toHaveLength(1);
|
|
510
|
-
expect(turn2Parts[0]).toEqual(expect.objectContaining({
|
|
511
|
-
functionResponse: expect.objectContaining({
|
|
512
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
513
|
-
response: { error: expectedError },
|
|
514
|
-
id: 'call1',
|
|
515
|
-
}),
|
|
516
|
-
}));
|
|
517
|
-
expect(output.result).toBe('Corrected result');
|
|
518
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
519
|
-
});
|
|
520
|
-
it('should handle multiple calls to complete_task in the same turn (accept first, block rest)', async () => {
|
|
521
|
-
const definition = createTestDefinition([], {}, 'none');
|
|
522
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
523
|
-
// Turn 1: Duplicate calls
|
|
524
|
-
mockModelResponse([
|
|
525
|
-
{ name: TASK_COMPLETE_TOOL_NAME, args: {}, id: 'call1' },
|
|
526
|
-
{ name: TASK_COMPLETE_TOOL_NAME, args: {}, id: 'call2' },
|
|
527
|
-
]);
|
|
528
|
-
const output = await executor.run({ goal: 'Dup test' }, signal);
|
|
529
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(1);
|
|
530
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
531
|
-
const completions = activities.filter((a) => a.type === 'TOOL_CALL_END' &&
|
|
532
|
-
a.data['name'] === TASK_COMPLETE_TOOL_NAME);
|
|
533
|
-
const errors = activities.filter((a) => a.type === 'ERROR' && a.data['name'] === TASK_COMPLETE_TOOL_NAME);
|
|
534
|
-
expect(completions).toHaveLength(1);
|
|
535
|
-
expect(errors).toHaveLength(1);
|
|
536
|
-
expect(errors[0].data['error']).toContain('Task already marked complete in this turn');
|
|
537
|
-
});
|
|
538
|
-
it('should execute parallel tool calls and then complete', async () => {
|
|
539
|
-
const definition = createTestDefinition([LS_TOOL_NAME]);
|
|
540
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
541
|
-
const call1 = {
|
|
542
|
-
name: LS_TOOL_NAME,
|
|
543
|
-
args: { path: '/a' },
|
|
544
|
-
id: 'c1',
|
|
545
|
-
};
|
|
546
|
-
const call2 = {
|
|
547
|
-
name: LS_TOOL_NAME,
|
|
548
|
-
args: { path: '/b' },
|
|
549
|
-
id: 'c2',
|
|
550
|
-
};
|
|
551
|
-
// Turn 1: Parallel calls
|
|
552
|
-
mockModelResponse([call1, call2]);
|
|
553
|
-
// Concurrency mock
|
|
554
|
-
let callsStarted = 0;
|
|
555
|
-
let resolveCalls;
|
|
556
|
-
const bothStarted = new Promise((r) => {
|
|
557
|
-
resolveCalls = r;
|
|
558
|
-
});
|
|
559
|
-
mockExecuteToolCall.mockImplementation(async (_ctx, reqInfo) => {
|
|
560
|
-
callsStarted++;
|
|
561
|
-
if (callsStarted === 2)
|
|
562
|
-
resolveCalls();
|
|
563
|
-
await vi.advanceTimersByTimeAsync(100);
|
|
564
|
-
return {
|
|
565
|
-
status: 'success',
|
|
566
|
-
request: reqInfo,
|
|
567
|
-
tool: {},
|
|
568
|
-
invocation: {},
|
|
569
|
-
response: {
|
|
570
|
-
callId: reqInfo.callId,
|
|
571
|
-
resultDisplay: 'ok',
|
|
572
|
-
responseParts: [
|
|
573
|
-
{
|
|
574
|
-
functionResponse: {
|
|
575
|
-
name: reqInfo.name,
|
|
576
|
-
response: {},
|
|
577
|
-
id: reqInfo.callId,
|
|
578
|
-
},
|
|
579
|
-
},
|
|
580
|
-
],
|
|
581
|
-
error: undefined,
|
|
582
|
-
errorType: undefined,
|
|
583
|
-
contentLength: undefined,
|
|
584
|
-
},
|
|
585
|
-
};
|
|
586
|
-
});
|
|
587
|
-
// Turn 2: Completion
|
|
588
|
-
mockModelResponse([
|
|
589
|
-
{
|
|
590
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
591
|
-
args: { finalResult: 'done' },
|
|
592
|
-
id: 'c3',
|
|
593
|
-
},
|
|
594
|
-
]);
|
|
595
|
-
const runPromise = executor.run({ goal: 'Parallel' }, signal);
|
|
596
|
-
await vi.advanceTimersByTimeAsync(1);
|
|
597
|
-
await bothStarted;
|
|
598
|
-
await vi.advanceTimersByTimeAsync(150);
|
|
599
|
-
await vi.advanceTimersByTimeAsync(1);
|
|
600
|
-
const output = await runPromise;
|
|
601
|
-
expect(mockExecuteToolCall).toHaveBeenCalledTimes(2);
|
|
602
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
603
|
-
// Safe access to message parts
|
|
604
|
-
const turn2Params = getMockMessageParams(1);
|
|
605
|
-
const parts = turn2Params.message;
|
|
606
|
-
expect(parts).toBeDefined();
|
|
607
|
-
expect(parts).toHaveLength(2);
|
|
608
|
-
expect(parts).toEqual(expect.arrayContaining([
|
|
609
|
-
expect.objectContaining({
|
|
610
|
-
functionResponse: expect.objectContaining({ id: 'c1' }),
|
|
611
|
-
}),
|
|
612
|
-
expect.objectContaining({
|
|
613
|
-
functionResponse: expect.objectContaining({ id: 'c2' }),
|
|
614
|
-
}),
|
|
615
|
-
]));
|
|
616
|
-
});
|
|
617
|
-
it('SECURITY: should block unauthorized tools and provide explicit failure to model', async () => {
|
|
618
|
-
const definition = createTestDefinition([LS_TOOL_NAME]);
|
|
619
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
620
|
-
// Turn 1: Model tries to use a tool not in its config
|
|
621
|
-
const badCallId = 'bad_call_1';
|
|
622
|
-
mockModelResponse([
|
|
623
|
-
{
|
|
624
|
-
name: READ_FILE_TOOL_NAME,
|
|
625
|
-
args: { path: 'secret.txt' },
|
|
626
|
-
id: badCallId,
|
|
627
|
-
},
|
|
628
|
-
]);
|
|
629
|
-
// Turn 2: Model gives up and completes
|
|
630
|
-
mockModelResponse([
|
|
631
|
-
{
|
|
632
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
633
|
-
args: { finalResult: 'Could not read file.' },
|
|
634
|
-
id: 'c2',
|
|
635
|
-
},
|
|
636
|
-
]);
|
|
637
|
-
const consoleWarnSpy = vi
|
|
638
|
-
.spyOn(debugLogger, 'warn')
|
|
639
|
-
.mockImplementation(() => { });
|
|
640
|
-
await executor.run({ goal: 'Sec test' }, signal);
|
|
641
|
-
// Verify external executor was not called (Security held)
|
|
642
|
-
expect(mockExecuteToolCall).not.toHaveBeenCalled();
|
|
643
|
-
// 2. Verify console warning
|
|
644
|
-
expect(consoleWarnSpy).toHaveBeenCalledWith(expect.stringContaining(`[AgentExecutor] Blocked call:`));
|
|
645
|
-
consoleWarnSpy.mockRestore();
|
|
646
|
-
// Verify specific error was sent back to model
|
|
647
|
-
const turn2Params = getMockMessageParams(1);
|
|
648
|
-
const parts = turn2Params.message;
|
|
649
|
-
expect(parts).toBeDefined();
|
|
650
|
-
expect(parts[0]).toEqual(expect.objectContaining({
|
|
651
|
-
functionResponse: expect.objectContaining({
|
|
652
|
-
id: badCallId,
|
|
653
|
-
name: READ_FILE_TOOL_NAME,
|
|
654
|
-
response: {
|
|
655
|
-
error: expect.stringContaining('Unauthorized tool call'),
|
|
656
|
-
},
|
|
657
|
-
}),
|
|
658
|
-
}));
|
|
659
|
-
// Verify Activity Stream reported the error
|
|
660
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
661
|
-
type: 'ERROR',
|
|
662
|
-
data: expect.objectContaining({
|
|
663
|
-
context: 'tool_call_unauthorized',
|
|
664
|
-
name: READ_FILE_TOOL_NAME,
|
|
665
|
-
}),
|
|
666
|
-
}));
|
|
667
|
-
});
|
|
668
|
-
});
|
|
669
|
-
describe('Edge Cases and Error Handling', () => {
|
|
670
|
-
it('should report an error if complete_task output fails schema validation', async () => {
|
|
671
|
-
const definition = createTestDefinition([], {}, 'default', z.string().min(10));
|
|
672
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
673
|
-
// Turn 1: Invalid arg (too short)
|
|
674
|
-
mockModelResponse([
|
|
675
|
-
{
|
|
676
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
677
|
-
args: { finalResult: 'short' },
|
|
678
|
-
id: 'call1',
|
|
679
|
-
},
|
|
680
|
-
]);
|
|
681
|
-
// Turn 2: Corrected
|
|
682
|
-
mockModelResponse([
|
|
683
|
-
{
|
|
684
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
685
|
-
args: { finalResult: 'This is a much longer and valid result' },
|
|
686
|
-
id: 'call2',
|
|
687
|
-
},
|
|
688
|
-
]);
|
|
689
|
-
const output = await executor.run({ goal: 'Validation test' }, signal);
|
|
690
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
691
|
-
const expectedError = 'Output validation failed: {"formErrors":["String must contain at least 10 character(s)"],"fieldErrors":{}}';
|
|
692
|
-
// Check that the error was reported in the activity stream
|
|
693
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
694
|
-
type: 'ERROR',
|
|
695
|
-
data: {
|
|
696
|
-
context: 'tool_call',
|
|
697
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
698
|
-
error: expect.stringContaining('Output validation failed'),
|
|
699
|
-
},
|
|
700
|
-
}));
|
|
701
|
-
// Check that the error was sent back to the model for the next turn
|
|
702
|
-
const turn2Params = getMockMessageParams(1);
|
|
703
|
-
const turn2Parts = turn2Params.message;
|
|
704
|
-
expect(turn2Parts).toEqual([
|
|
705
|
-
expect.objectContaining({
|
|
706
|
-
functionResponse: expect.objectContaining({
|
|
707
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
708
|
-
response: { error: expectedError },
|
|
709
|
-
id: 'call1',
|
|
710
|
-
}),
|
|
711
|
-
}),
|
|
712
|
-
]);
|
|
713
|
-
// Check that the agent eventually succeeded
|
|
714
|
-
expect(output.result).toContain('This is a much longer and valid result');
|
|
715
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
716
|
-
});
|
|
717
|
-
it('should throw and log if GeminiChat creation fails', async () => {
|
|
718
|
-
const definition = createTestDefinition();
|
|
719
|
-
const initError = new Error('Chat creation failed');
|
|
720
|
-
MockedGeminiChat.mockImplementationOnce(() => {
|
|
721
|
-
throw initError;
|
|
722
|
-
});
|
|
723
|
-
// We expect the error to be thrown during the run, not creation
|
|
724
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
725
|
-
await expect(executor.run({ goal: 'test' }, signal)).rejects.toThrow(`Failed to create chat object: ${initError}`);
|
|
726
|
-
// Ensure the error was reported via the activity callback
|
|
727
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
728
|
-
type: 'ERROR',
|
|
729
|
-
data: expect.objectContaining({
|
|
730
|
-
error: `Error: Failed to create chat object: ${initError}`,
|
|
731
|
-
}),
|
|
732
|
-
}));
|
|
733
|
-
// Ensure the agent run was logged as a failure
|
|
734
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
|
|
735
|
-
terminate_reason: AgentTerminateMode.ERROR,
|
|
736
|
-
}));
|
|
737
|
-
});
|
|
738
|
-
it('should handle a failed tool call and feed the error to the model', async () => {
|
|
739
|
-
const definition = createTestDefinition([LS_TOOL_NAME]);
|
|
740
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
741
|
-
const toolErrorMessage = 'Tool failed spectacularly';
|
|
742
|
-
// Turn 1: Model calls a tool that will fail
|
|
743
|
-
mockModelResponse([
|
|
744
|
-
{ name: LS_TOOL_NAME, args: { path: '/fake' }, id: 'call1' },
|
|
745
|
-
]);
|
|
746
|
-
mockExecuteToolCall.mockResolvedValueOnce({
|
|
747
|
-
status: 'error',
|
|
748
|
-
request: {
|
|
749
|
-
callId: 'call1',
|
|
750
|
-
name: LS_TOOL_NAME,
|
|
751
|
-
args: { path: '/fake' },
|
|
752
|
-
isClientInitiated: false,
|
|
753
|
-
prompt_id: 'test-prompt',
|
|
754
|
-
},
|
|
755
|
-
tool: {},
|
|
756
|
-
invocation: {},
|
|
757
|
-
response: {
|
|
758
|
-
callId: 'call1',
|
|
759
|
-
resultDisplay: '',
|
|
760
|
-
responseParts: [
|
|
761
|
-
{
|
|
762
|
-
functionResponse: {
|
|
763
|
-
name: LS_TOOL_NAME,
|
|
764
|
-
response: { error: toolErrorMessage },
|
|
765
|
-
id: 'call1',
|
|
766
|
-
},
|
|
767
|
-
},
|
|
768
|
-
],
|
|
769
|
-
error: {
|
|
770
|
-
type: 'ToolError',
|
|
771
|
-
message: toolErrorMessage,
|
|
772
|
-
},
|
|
773
|
-
errorType: 'ToolError',
|
|
774
|
-
contentLength: 0,
|
|
775
|
-
},
|
|
776
|
-
});
|
|
777
|
-
// Turn 2: Model sees the error and completes
|
|
778
|
-
mockModelResponse([
|
|
779
|
-
{
|
|
780
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
781
|
-
args: { finalResult: 'Aborted due to tool failure.' },
|
|
782
|
-
id: 'call2',
|
|
783
|
-
},
|
|
784
|
-
]);
|
|
785
|
-
const output = await executor.run({ goal: 'Tool failure test' }, signal);
|
|
786
|
-
expect(mockExecuteToolCall).toHaveBeenCalledTimes(1);
|
|
787
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
788
|
-
// Verify the error was reported in the activity stream
|
|
789
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
790
|
-
type: 'ERROR',
|
|
791
|
-
data: {
|
|
792
|
-
context: 'tool_call',
|
|
793
|
-
name: LS_TOOL_NAME,
|
|
794
|
-
error: toolErrorMessage,
|
|
795
|
-
},
|
|
796
|
-
}));
|
|
797
|
-
// Verify the error was sent back to the model
|
|
798
|
-
const turn2Params = getMockMessageParams(1);
|
|
799
|
-
const parts = turn2Params.message;
|
|
800
|
-
expect(parts).toEqual([
|
|
801
|
-
expect.objectContaining({
|
|
802
|
-
functionResponse: expect.objectContaining({
|
|
803
|
-
name: LS_TOOL_NAME,
|
|
804
|
-
id: 'call1',
|
|
805
|
-
response: {
|
|
806
|
-
error: toolErrorMessage,
|
|
807
|
-
},
|
|
808
|
-
}),
|
|
809
|
-
}),
|
|
810
|
-
]);
|
|
811
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
812
|
-
expect(output.result).toBe('Aborted due to tool failure.');
|
|
813
|
-
});
|
|
814
|
-
});
|
|
815
|
-
describe('run (Termination Conditions)', () => {
|
|
816
|
-
const mockWorkResponse = (id) => {
|
|
817
|
-
mockModelResponse([{ name: LS_TOOL_NAME, args: { path: '.' }, id }]);
|
|
818
|
-
mockExecuteToolCall.mockResolvedValueOnce({
|
|
819
|
-
status: 'success',
|
|
820
|
-
request: {
|
|
821
|
-
callId: id,
|
|
822
|
-
name: LS_TOOL_NAME,
|
|
823
|
-
args: { path: '.' },
|
|
824
|
-
isClientInitiated: false,
|
|
825
|
-
prompt_id: 'test-prompt',
|
|
826
|
-
},
|
|
827
|
-
tool: {},
|
|
828
|
-
invocation: {},
|
|
829
|
-
response: {
|
|
830
|
-
callId: id,
|
|
831
|
-
resultDisplay: 'ok',
|
|
832
|
-
responseParts: [
|
|
833
|
-
{ functionResponse: { name: LS_TOOL_NAME, response: {}, id } },
|
|
834
|
-
],
|
|
835
|
-
error: undefined,
|
|
836
|
-
errorType: undefined,
|
|
837
|
-
contentLength: undefined,
|
|
838
|
-
},
|
|
839
|
-
});
|
|
840
|
-
};
|
|
841
|
-
it('should terminate when max_turns is reached', async () => {
|
|
842
|
-
const MAX = 2;
|
|
843
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
844
|
-
max_turns: MAX,
|
|
845
|
-
});
|
|
846
|
-
const executor = await AgentExecutor.create(definition, mockConfig);
|
|
847
|
-
mockWorkResponse('t1');
|
|
848
|
-
mockWorkResponse('t2');
|
|
849
|
-
// Recovery turn
|
|
850
|
-
mockModelResponse([], 'I give up');
|
|
851
|
-
const output = await executor.run({ goal: 'Turns test' }, signal);
|
|
852
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.MAX_TURNS);
|
|
853
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(MAX + 1);
|
|
854
|
-
});
|
|
855
|
-
it('should terminate with TIMEOUT if a model call takes too long', async () => {
|
|
856
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
857
|
-
max_time_minutes: 0.5, // 30 seconds
|
|
858
|
-
});
|
|
859
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
860
|
-
// Mock a model call that is interruptible by an abort signal.
|
|
861
|
-
mockSendMessageStream.mockImplementationOnce(async (_key, _message, _promptId, signal) =>
|
|
862
|
-
// eslint-disable-next-line require-yield
|
|
863
|
-
(async function* () {
|
|
864
|
-
await new Promise((resolve) => {
|
|
865
|
-
// This promise resolves when aborted, ending the generator.
|
|
866
|
-
signal?.addEventListener('abort', () => {
|
|
867
|
-
resolve();
|
|
868
|
-
});
|
|
869
|
-
});
|
|
870
|
-
})());
|
|
871
|
-
// Recovery turn
|
|
872
|
-
mockModelResponse([], 'I give up');
|
|
873
|
-
const runPromise = executor.run({ goal: 'Timeout test' }, signal);
|
|
874
|
-
// Advance time past the timeout to trigger the abort.
|
|
875
|
-
await vi.advanceTimersByTimeAsync(31 * 1000);
|
|
876
|
-
const output = await runPromise;
|
|
877
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.TIMEOUT);
|
|
878
|
-
expect(output.result).toContain('Agent timed out after 0.5 minutes.');
|
|
879
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
880
|
-
// Verify activity stream reported the timeout
|
|
881
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
882
|
-
type: 'ERROR',
|
|
883
|
-
data: expect.objectContaining({
|
|
884
|
-
context: 'timeout',
|
|
885
|
-
error: 'Agent timed out after 0.5 minutes.',
|
|
886
|
-
}),
|
|
887
|
-
}));
|
|
888
|
-
// Verify telemetry
|
|
889
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
|
|
890
|
-
terminate_reason: AgentTerminateMode.TIMEOUT,
|
|
891
|
-
}));
|
|
892
|
-
});
|
|
893
|
-
it('should terminate with TIMEOUT if a tool call takes too long', async () => {
|
|
894
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
895
|
-
max_time_minutes: 1,
|
|
896
|
-
});
|
|
897
|
-
const executor = await AgentExecutor.create(definition, mockConfig);
|
|
898
|
-
mockModelResponse([
|
|
899
|
-
{ name: LS_TOOL_NAME, args: { path: '.' }, id: 't1' },
|
|
900
|
-
]);
|
|
901
|
-
// Long running tool
|
|
902
|
-
mockExecuteToolCall.mockImplementationOnce(async (_ctx, reqInfo) => {
|
|
903
|
-
await vi.advanceTimersByTimeAsync(61 * 1000);
|
|
904
|
-
return {
|
|
905
|
-
status: 'success',
|
|
906
|
-
request: reqInfo,
|
|
907
|
-
tool: {},
|
|
908
|
-
invocation: {},
|
|
909
|
-
response: {
|
|
910
|
-
callId: 't1',
|
|
911
|
-
resultDisplay: 'ok',
|
|
912
|
-
responseParts: [],
|
|
913
|
-
error: undefined,
|
|
914
|
-
errorType: undefined,
|
|
915
|
-
contentLength: undefined,
|
|
916
|
-
},
|
|
917
|
-
};
|
|
918
|
-
});
|
|
919
|
-
// Recovery turn
|
|
920
|
-
mockModelResponse([], 'I give up');
|
|
921
|
-
const output = await executor.run({ goal: 'Timeout test' }, signal);
|
|
922
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.TIMEOUT);
|
|
923
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
924
|
-
});
|
|
925
|
-
it('should terminate when AbortSignal is triggered', async () => {
|
|
926
|
-
const definition = createTestDefinition();
|
|
927
|
-
const executor = await AgentExecutor.create(definition, mockConfig);
|
|
928
|
-
mockSendMessageStream.mockImplementationOnce(async () => (async function* () {
|
|
929
|
-
yield {
|
|
930
|
-
type: StreamEventType.CHUNK,
|
|
931
|
-
value: createMockResponseChunk([
|
|
932
|
-
{ text: 'Thinking...', thought: true },
|
|
933
|
-
]),
|
|
934
|
-
};
|
|
935
|
-
abortController.abort();
|
|
936
|
-
})());
|
|
937
|
-
const output = await executor.run({ goal: 'Abort test' }, signal);
|
|
938
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.ABORTED);
|
|
939
|
-
});
|
|
940
|
-
});
|
|
941
|
-
describe('run (Recovery Turns)', () => {
|
|
942
|
-
const mockWorkResponse = (id) => {
|
|
943
|
-
mockModelResponse([{ name: LS_TOOL_NAME, args: { path: '.' }, id }]);
|
|
944
|
-
mockExecuteToolCall.mockResolvedValueOnce({
|
|
945
|
-
status: 'success',
|
|
946
|
-
request: {
|
|
947
|
-
callId: id,
|
|
948
|
-
name: LS_TOOL_NAME,
|
|
949
|
-
args: { path: '.' },
|
|
950
|
-
isClientInitiated: false,
|
|
951
|
-
prompt_id: 'test-prompt',
|
|
952
|
-
},
|
|
953
|
-
tool: {},
|
|
954
|
-
invocation: {},
|
|
955
|
-
response: {
|
|
956
|
-
callId: id,
|
|
957
|
-
resultDisplay: 'ok',
|
|
958
|
-
responseParts: [
|
|
959
|
-
{ functionResponse: { name: LS_TOOL_NAME, response: {}, id } },
|
|
960
|
-
],
|
|
961
|
-
error: undefined,
|
|
962
|
-
errorType: undefined,
|
|
963
|
-
contentLength: undefined,
|
|
964
|
-
},
|
|
965
|
-
});
|
|
966
|
-
};
|
|
967
|
-
it('should recover successfully if complete_task is called during the grace turn after MAX_TURNS', async () => {
|
|
968
|
-
const MAX = 1;
|
|
969
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
970
|
-
max_turns: MAX,
|
|
971
|
-
});
|
|
972
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
973
|
-
// Turn 1 (hits max_turns)
|
|
974
|
-
mockWorkResponse('t1');
|
|
975
|
-
// Recovery Turn (succeeds)
|
|
976
|
-
mockModelResponse([
|
|
977
|
-
{
|
|
978
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
979
|
-
args: { finalResult: 'Recovered!' },
|
|
980
|
-
id: 't2',
|
|
981
|
-
},
|
|
982
|
-
], 'Recovering from max turns');
|
|
983
|
-
const output = await executor.run({ goal: 'Turns recovery' }, signal);
|
|
984
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
985
|
-
expect(output.result).toBe('Recovered!');
|
|
986
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(MAX + 1); // 1 regular + 1 recovery
|
|
987
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
988
|
-
type: 'THOUGHT_CHUNK',
|
|
989
|
-
data: {
|
|
990
|
-
text: 'Execution limit reached (MAX_TURNS). Attempting one final recovery turn with a grace period.',
|
|
991
|
-
},
|
|
992
|
-
}));
|
|
993
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
994
|
-
type: 'THOUGHT_CHUNK',
|
|
995
|
-
data: { text: 'Graceful recovery succeeded.' },
|
|
996
|
-
}));
|
|
997
|
-
});
|
|
998
|
-
it('should fail if complete_task is NOT called during the grace turn after MAX_TURNS', async () => {
|
|
999
|
-
const MAX = 1;
|
|
1000
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1001
|
-
max_turns: MAX,
|
|
1002
|
-
});
|
|
1003
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
1004
|
-
// Turn 1 (hits max_turns)
|
|
1005
|
-
mockWorkResponse('t1');
|
|
1006
|
-
// Recovery Turn (fails by calling no tools)
|
|
1007
|
-
mockModelResponse([], 'I give up again.');
|
|
1008
|
-
const output = await executor.run({ goal: 'Turns recovery fail' }, signal);
|
|
1009
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.MAX_TURNS);
|
|
1010
|
-
expect(output.result).toContain('Agent reached max turns limit');
|
|
1011
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(MAX + 1);
|
|
1012
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1013
|
-
type: 'ERROR',
|
|
1014
|
-
data: expect.objectContaining({
|
|
1015
|
-
context: 'recovery_turn',
|
|
1016
|
-
error: 'Graceful recovery attempt failed. Reason: stop',
|
|
1017
|
-
}),
|
|
1018
|
-
}));
|
|
1019
|
-
});
|
|
1020
|
-
it('should recover successfully from a protocol violation (no complete_task)', async () => {
|
|
1021
|
-
const definition = createTestDefinition();
|
|
1022
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
1023
|
-
// Turn 1: Normal work
|
|
1024
|
-
mockWorkResponse('t1');
|
|
1025
|
-
// Turn 2: Protocol violation (no tool calls)
|
|
1026
|
-
mockModelResponse([], 'I think I am done, but I forgot the right tool.');
|
|
1027
|
-
// Turn 3: Recovery turn (succeeds)
|
|
1028
|
-
mockModelResponse([
|
|
1029
|
-
{
|
|
1030
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1031
|
-
args: { finalResult: 'Recovered from violation!' },
|
|
1032
|
-
id: 't3',
|
|
1033
|
-
},
|
|
1034
|
-
], 'My mistake, here is the completion.');
|
|
1035
|
-
const output = await executor.run({ goal: 'Violation recovery' }, signal);
|
|
1036
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(3);
|
|
1037
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
1038
|
-
expect(output.result).toBe('Recovered from violation!');
|
|
1039
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1040
|
-
type: 'THOUGHT_CHUNK',
|
|
1041
|
-
data: {
|
|
1042
|
-
text: 'Execution limit reached (ERROR_NO_COMPLETE_TASK_CALL). Attempting one final recovery turn with a grace period.',
|
|
1043
|
-
},
|
|
1044
|
-
}));
|
|
1045
|
-
});
|
|
1046
|
-
it('should fail recovery from a protocol violation if it violates again', async () => {
|
|
1047
|
-
const definition = createTestDefinition();
|
|
1048
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
1049
|
-
// Turn 1: Normal work
|
|
1050
|
-
mockWorkResponse('t1');
|
|
1051
|
-
// Turn 2: Protocol violation (no tool calls)
|
|
1052
|
-
mockModelResponse([], 'I think I am done, but I forgot the right tool.');
|
|
1053
|
-
// Turn 3: Recovery turn (fails again)
|
|
1054
|
-
mockModelResponse([], 'I still dont know what to do.');
|
|
1055
|
-
const output = await executor.run({ goal: 'Violation recovery fail' }, signal);
|
|
1056
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(3);
|
|
1057
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.ERROR_NO_COMPLETE_TASK_CALL);
|
|
1058
|
-
expect(output.result).toContain(`Agent stopped calling tools but did not call '${TASK_COMPLETE_TOOL_NAME}'`);
|
|
1059
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1060
|
-
type: 'ERROR',
|
|
1061
|
-
data: expect.objectContaining({
|
|
1062
|
-
context: 'recovery_turn',
|
|
1063
|
-
error: 'Graceful recovery attempt failed. Reason: stop',
|
|
1064
|
-
}),
|
|
1065
|
-
}));
|
|
1066
|
-
});
|
|
1067
|
-
it('should recover successfully from a TIMEOUT', async () => {
|
|
1068
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1069
|
-
max_time_minutes: 0.5, // 30 seconds
|
|
1070
|
-
});
|
|
1071
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
1072
|
-
// Mock a model call that gets interrupted by the timeout.
|
|
1073
|
-
mockSendMessageStream.mockImplementationOnce(async (_key, _message, _promptId, signal) =>
|
|
1074
|
-
// eslint-disable-next-line require-yield
|
|
1075
|
-
(async function* () {
|
|
1076
|
-
// This promise never resolves, it waits for abort.
|
|
1077
|
-
await new Promise((resolve) => {
|
|
1078
|
-
signal?.addEventListener('abort', () => resolve());
|
|
1079
|
-
});
|
|
1080
|
-
})());
|
|
1081
|
-
// Recovery turn (succeeds)
|
|
1082
|
-
mockModelResponse([
|
|
1083
|
-
{
|
|
1084
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1085
|
-
args: { finalResult: 'Recovered from timeout!' },
|
|
1086
|
-
id: 't2',
|
|
1087
|
-
},
|
|
1088
|
-
], 'Apologies for the delay, finishing up.');
|
|
1089
|
-
const runPromise = executor.run({ goal: 'Timeout recovery' }, signal);
|
|
1090
|
-
// Advance time past the timeout to trigger the abort and recovery.
|
|
1091
|
-
await vi.advanceTimersByTimeAsync(31 * 1000);
|
|
1092
|
-
const output = await runPromise;
|
|
1093
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2); // 1 failed + 1 recovery
|
|
1094
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
1095
|
-
expect(output.result).toBe('Recovered from timeout!');
|
|
1096
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1097
|
-
type: 'THOUGHT_CHUNK',
|
|
1098
|
-
data: {
|
|
1099
|
-
text: 'Execution limit reached (TIMEOUT). Attempting one final recovery turn with a grace period.',
|
|
1100
|
-
},
|
|
1101
|
-
}));
|
|
1102
|
-
});
|
|
1103
|
-
it('should fail recovery from a TIMEOUT if the grace period also times out', async () => {
|
|
1104
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1105
|
-
max_time_minutes: 0.5, // 30 seconds
|
|
1106
|
-
});
|
|
1107
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
1108
|
-
mockSendMessageStream.mockImplementationOnce(async (_key, _message, _promptId, signal) =>
|
|
1109
|
-
// eslint-disable-next-line require-yield
|
|
1110
|
-
(async function* () {
|
|
1111
|
-
await new Promise((resolve) => signal?.addEventListener('abort', () => resolve()));
|
|
1112
|
-
})());
|
|
1113
|
-
// Mock the recovery call to also be long-running
|
|
1114
|
-
mockSendMessageStream.mockImplementationOnce(async (_key, _message, _promptId, signal) =>
|
|
1115
|
-
// eslint-disable-next-line require-yield
|
|
1116
|
-
(async function* () {
|
|
1117
|
-
await new Promise((resolve) => signal?.addEventListener('abort', () => resolve()));
|
|
1118
|
-
})());
|
|
1119
|
-
const runPromise = executor.run({ goal: 'Timeout recovery fail' }, signal);
|
|
1120
|
-
// 1. Trigger the main timeout
|
|
1121
|
-
await vi.advanceTimersByTimeAsync(31 * 1000);
|
|
1122
|
-
// 2. Let microtasks run (start recovery turn)
|
|
1123
|
-
await vi.advanceTimersByTimeAsync(1);
|
|
1124
|
-
// 3. Trigger the grace period timeout (60s)
|
|
1125
|
-
await vi.advanceTimersByTimeAsync(61 * 1000);
|
|
1126
|
-
const output = await runPromise;
|
|
1127
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
1128
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.TIMEOUT);
|
|
1129
|
-
expect(output.result).toContain('Agent timed out after 0.5 minutes.');
|
|
1130
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1131
|
-
type: 'ERROR',
|
|
1132
|
-
data: expect.objectContaining({
|
|
1133
|
-
context: 'recovery_turn',
|
|
1134
|
-
error: 'Graceful recovery attempt failed. Reason: stop',
|
|
1135
|
-
}),
|
|
1136
|
-
}));
|
|
1137
|
-
});
|
|
1138
|
-
});
|
|
1139
|
-
describe('Telemetry and Logging', () => {
|
|
1140
|
-
const mockWorkResponse = (id) => {
|
|
1141
|
-
mockModelResponse([{ name: LS_TOOL_NAME, args: { path: '.' }, id }]);
|
|
1142
|
-
mockExecuteToolCall.mockResolvedValueOnce({
|
|
1143
|
-
status: 'success',
|
|
1144
|
-
request: {
|
|
1145
|
-
callId: id,
|
|
1146
|
-
name: LS_TOOL_NAME,
|
|
1147
|
-
args: { path: '.' },
|
|
1148
|
-
isClientInitiated: false,
|
|
1149
|
-
prompt_id: 'test-prompt',
|
|
1150
|
-
},
|
|
1151
|
-
tool: {},
|
|
1152
|
-
invocation: {},
|
|
1153
|
-
response: {
|
|
1154
|
-
callId: id,
|
|
1155
|
-
resultDisplay: 'ok',
|
|
1156
|
-
responseParts: [
|
|
1157
|
-
{ functionResponse: { name: LS_TOOL_NAME, response: {}, id } },
|
|
1158
|
-
],
|
|
1159
|
-
error: undefined,
|
|
1160
|
-
errorType: undefined,
|
|
1161
|
-
contentLength: undefined,
|
|
1162
|
-
},
|
|
1163
|
-
});
|
|
1164
|
-
};
|
|
1165
|
-
beforeEach(() => {
|
|
1166
|
-
mockedLogRecoveryAttempt.mockClear();
|
|
1167
|
-
});
|
|
1168
|
-
it('should log a RecoveryAttemptEvent when a recoverable error occurs and recovery fails', async () => {
|
|
1169
|
-
const MAX = 1;
|
|
1170
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1171
|
-
max_turns: MAX,
|
|
1172
|
-
});
|
|
1173
|
-
const executor = await AgentExecutor.create(definition, mockConfig);
|
|
1174
|
-
// Turn 1 (hits max_turns)
|
|
1175
|
-
mockWorkResponse('t1');
|
|
1176
|
-
// Recovery Turn (fails by calling no tools)
|
|
1177
|
-
mockModelResponse([], 'I give up again.');
|
|
1178
|
-
await executor.run({ goal: 'Turns recovery fail' }, signal);
|
|
1179
|
-
expect(mockedLogRecoveryAttempt).toHaveBeenCalledTimes(1);
|
|
1180
|
-
const recoveryEvent = mockedLogRecoveryAttempt.mock.calls[0][1];
|
|
1181
|
-
expect(recoveryEvent).toBeInstanceOf(RecoveryAttemptEvent);
|
|
1182
|
-
expect(recoveryEvent.agent_name).toBe(definition.name);
|
|
1183
|
-
expect(recoveryEvent.reason).toBe(AgentTerminateMode.MAX_TURNS);
|
|
1184
|
-
expect(recoveryEvent.success).toBe(false);
|
|
1185
|
-
expect(recoveryEvent.turn_count).toBe(1);
|
|
1186
|
-
expect(recoveryEvent.duration_ms).toBeGreaterThanOrEqual(0);
|
|
1187
|
-
});
|
|
1188
|
-
it('should log a successful RecoveryAttemptEvent when recovery succeeds', async () => {
|
|
1189
|
-
const MAX = 1;
|
|
1190
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1191
|
-
max_turns: MAX,
|
|
1192
|
-
});
|
|
1193
|
-
const executor = await AgentExecutor.create(definition, mockConfig);
|
|
1194
|
-
// Turn 1 (hits max_turns)
|
|
1195
|
-
mockWorkResponse('t1');
|
|
1196
|
-
// Recovery Turn (succeeds)
|
|
1197
|
-
mockModelResponse([
|
|
1198
|
-
{
|
|
1199
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1200
|
-
args: { finalResult: 'Recovered!' },
|
|
1201
|
-
id: 't2',
|
|
1202
|
-
},
|
|
1203
|
-
], 'Recovering from max turns');
|
|
1204
|
-
await executor.run({ goal: 'Turns recovery success' }, signal);
|
|
1205
|
-
expect(mockedLogRecoveryAttempt).toHaveBeenCalledTimes(1);
|
|
1206
|
-
const recoveryEvent = mockedLogRecoveryAttempt.mock.calls[0][1];
|
|
1207
|
-
expect(recoveryEvent).toBeInstanceOf(RecoveryAttemptEvent);
|
|
1208
|
-
expect(recoveryEvent.success).toBe(true);
|
|
1209
|
-
expect(recoveryEvent.reason).toBe(AgentTerminateMode.MAX_TURNS);
|
|
1210
|
-
});
|
|
1211
|
-
});
|
|
1212
|
-
describe('Chat Compression', () => {
|
|
1213
|
-
const mockWorkResponse = (id) => {
|
|
1214
|
-
mockModelResponse([{ name: LS_TOOL_NAME, args: { path: '.' }, id }]);
|
|
1215
|
-
mockExecuteToolCall.mockResolvedValueOnce({
|
|
1216
|
-
status: 'success',
|
|
1217
|
-
request: {
|
|
1218
|
-
callId: id,
|
|
1219
|
-
name: LS_TOOL_NAME,
|
|
1220
|
-
args: { path: '.' },
|
|
1221
|
-
isClientInitiated: false,
|
|
1222
|
-
prompt_id: 'test-prompt',
|
|
1223
|
-
},
|
|
1224
|
-
tool: {},
|
|
1225
|
-
invocation: {},
|
|
1226
|
-
response: {
|
|
1227
|
-
callId: id,
|
|
1228
|
-
resultDisplay: 'ok',
|
|
1229
|
-
responseParts: [
|
|
1230
|
-
{ functionResponse: { name: LS_TOOL_NAME, response: {}, id } },
|
|
1231
|
-
],
|
|
1232
|
-
error: undefined,
|
|
1233
|
-
errorType: undefined,
|
|
1234
|
-
contentLength: undefined,
|
|
1235
|
-
},
|
|
1236
|
-
});
|
|
1237
|
-
};
|
|
1238
|
-
it('should attempt to compress chat history on each turn', async () => {
|
|
1239
|
-
const definition = createTestDefinition();
|
|
1240
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
1241
|
-
// Mock compression to do nothing
|
|
1242
|
-
mockCompress.mockResolvedValue({
|
|
1243
|
-
newHistory: null,
|
|
1244
|
-
info: { compressionStatus: CompressionStatus.NOOP },
|
|
1245
|
-
});
|
|
1246
|
-
// Turn 1
|
|
1247
|
-
mockWorkResponse('t1');
|
|
1248
|
-
// Turn 2: Complete
|
|
1249
|
-
mockModelResponse([
|
|
1250
|
-
{
|
|
1251
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1252
|
-
args: { finalResult: 'Done' },
|
|
1253
|
-
id: 'call2',
|
|
1254
|
-
},
|
|
1255
|
-
], 'T2');
|
|
1256
|
-
await executor.run({ goal: 'Compress test' }, signal);
|
|
1257
|
-
expect(mockCompress).toHaveBeenCalledTimes(2);
|
|
1258
|
-
});
|
|
1259
|
-
it('should update chat history when compression is successful', async () => {
|
|
1260
|
-
const definition = createTestDefinition();
|
|
1261
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
1262
|
-
const compressedHistory = [
|
|
1263
|
-
{ role: 'user', parts: [{ text: 'compressed' }] },
|
|
1264
|
-
];
|
|
1265
|
-
mockCompress.mockResolvedValue({
|
|
1266
|
-
newHistory: compressedHistory,
|
|
1267
|
-
info: { compressionStatus: CompressionStatus.COMPRESSED },
|
|
1268
|
-
});
|
|
1269
|
-
// Turn 1: Complete
|
|
1270
|
-
mockModelResponse([
|
|
1271
|
-
{
|
|
1272
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1273
|
-
args: { finalResult: 'Done' },
|
|
1274
|
-
id: 'call1',
|
|
1275
|
-
},
|
|
1276
|
-
], 'T1');
|
|
1277
|
-
await executor.run({ goal: 'Compress success' }, signal);
|
|
1278
|
-
expect(mockCompress).toHaveBeenCalledTimes(1);
|
|
1279
|
-
expect(mockSetHistory).toHaveBeenCalledTimes(1);
|
|
1280
|
-
expect(mockSetHistory).toHaveBeenCalledWith(compressedHistory);
|
|
1281
|
-
});
|
|
1282
|
-
it('should pass hasFailedCompressionAttempt=true to compression after a failure', async () => {
|
|
1283
|
-
const definition = createTestDefinition();
|
|
1284
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
1285
|
-
// First call fails
|
|
1286
|
-
mockCompress.mockResolvedValueOnce({
|
|
1287
|
-
newHistory: null,
|
|
1288
|
-
info: {
|
|
1289
|
-
compressionStatus: CompressionStatus.COMPRESSION_FAILED_INFLATED_TOKEN_COUNT,
|
|
1290
|
-
},
|
|
1291
|
-
});
|
|
1292
|
-
// Second call is neutral
|
|
1293
|
-
mockCompress.mockResolvedValueOnce({
|
|
1294
|
-
newHistory: null,
|
|
1295
|
-
info: { compressionStatus: CompressionStatus.NOOP },
|
|
1296
|
-
});
|
|
1297
|
-
// Turn 1
|
|
1298
|
-
mockWorkResponse('t1');
|
|
1299
|
-
// Turn 2: Complete
|
|
1300
|
-
mockModelResponse([
|
|
1301
|
-
{
|
|
1302
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1303
|
-
args: { finalResult: 'Done' },
|
|
1304
|
-
id: 't2',
|
|
1305
|
-
},
|
|
1306
|
-
], 'T2');
|
|
1307
|
-
await executor.run({ goal: 'Compress fail' }, signal);
|
|
1308
|
-
expect(mockCompress).toHaveBeenCalledTimes(2);
|
|
1309
|
-
// First call, hasFailedCompressionAttempt is false
|
|
1310
|
-
expect(mockCompress.mock.calls[0][5]).toBe(false);
|
|
1311
|
-
// Second call, hasFailedCompressionAttempt is true
|
|
1312
|
-
expect(mockCompress.mock.calls[1][5]).toBe(true);
|
|
1313
|
-
});
|
|
1314
|
-
it('should reset hasFailedCompressionAttempt flag after a successful compression', async () => {
|
|
1315
|
-
const definition = createTestDefinition();
|
|
1316
|
-
const executor = await AgentExecutor.create(definition, mockConfig, onActivity);
|
|
1317
|
-
const compressedHistory = [
|
|
1318
|
-
{ role: 'user', parts: [{ text: 'compressed' }] },
|
|
1319
|
-
];
|
|
1320
|
-
// Turn 1: Fails
|
|
1321
|
-
mockCompress.mockResolvedValueOnce({
|
|
1322
|
-
newHistory: null,
|
|
1323
|
-
info: {
|
|
1324
|
-
compressionStatus: CompressionStatus.COMPRESSION_FAILED_INFLATED_TOKEN_COUNT,
|
|
1325
|
-
},
|
|
1326
|
-
});
|
|
1327
|
-
// Turn 2: Succeeds
|
|
1328
|
-
mockCompress.mockResolvedValueOnce({
|
|
1329
|
-
newHistory: compressedHistory,
|
|
1330
|
-
info: { compressionStatus: CompressionStatus.COMPRESSED },
|
|
1331
|
-
});
|
|
1332
|
-
// Turn 3: Neutral
|
|
1333
|
-
mockCompress.mockResolvedValueOnce({
|
|
1334
|
-
newHistory: null,
|
|
1335
|
-
info: { compressionStatus: CompressionStatus.NOOP },
|
|
1336
|
-
});
|
|
1337
|
-
// Turn 1
|
|
1338
|
-
mockWorkResponse('t1');
|
|
1339
|
-
// Turn 2
|
|
1340
|
-
mockWorkResponse('t2');
|
|
1341
|
-
// Turn 3: Complete
|
|
1342
|
-
mockModelResponse([
|
|
1343
|
-
{
|
|
1344
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1345
|
-
args: { finalResult: 'Done' },
|
|
1346
|
-
id: 't3',
|
|
1347
|
-
},
|
|
1348
|
-
], 'T3');
|
|
1349
|
-
await executor.run({ goal: 'Compress reset' }, signal);
|
|
1350
|
-
expect(mockCompress).toHaveBeenCalledTimes(3);
|
|
1351
|
-
// Call 1: hasFailed... is false
|
|
1352
|
-
expect(mockCompress.mock.calls[0][5]).toBe(false);
|
|
1353
|
-
// Call 2: hasFailed... is true
|
|
1354
|
-
expect(mockCompress.mock.calls[1][5]).toBe(true);
|
|
1355
|
-
// Call 3: hasFailed... is false again
|
|
1356
|
-
expect(mockCompress.mock.calls[2][5]).toBe(false);
|
|
1357
|
-
expect(mockSetHistory).toHaveBeenCalledTimes(1);
|
|
1358
|
-
expect(mockSetHistory).toHaveBeenCalledWith(compressedHistory);
|
|
1359
|
-
});
|
|
1360
|
-
});
|
|
1361
|
-
});
|
|
1362
|
-
//# sourceMappingURL=executor.test.js.map
|