@ai-setting/roy-agent-cli 1.3.15 → 1.3.17
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/bin/roy +0 -0
- package/dist/bin/roy.js +4 -3
- package/dist/cli/src/bin/roy.d.ts +6 -0
- package/dist/cli/src/bin/roy.js +10 -0
- package/dist/cli/src/cli.d.ts +5 -0
- package/dist/cli/src/cli.js +96 -0
- package/dist/cli/src/commands/act.d.ts +44 -0
- package/dist/cli/src/commands/act.js +415 -0
- package/dist/cli/src/commands/commands-add.d.ts +17 -0
- package/dist/cli/src/commands/commands-add.js +90 -0
- package/dist/cli/src/commands/commands-dirs.d.ts +12 -0
- package/dist/cli/src/commands/commands-dirs.js +58 -0
- package/dist/cli/src/commands/commands-info.d.ts +12 -0
- package/dist/cli/src/commands/commands-info.js +76 -0
- package/dist/cli/src/commands/commands-list.d.ts +13 -0
- package/dist/cli/src/commands/commands-list.js +132 -0
- package/dist/cli/src/commands/commands-remove.d.ts +14 -0
- package/dist/cli/src/commands/commands-remove.js +136 -0
- package/dist/cli/src/commands/commands.d.ts +27 -0
- package/dist/cli/src/commands/commands.js +39 -0
- package/dist/cli/src/commands/config/config-service.d.ts +70 -0
- package/dist/cli/src/commands/config/config-service.js +233 -0
- package/dist/cli/src/commands/config/deep-merge.d.ts +22 -0
- package/dist/cli/src/commands/config/deep-merge.js +33 -0
- package/dist/cli/src/commands/config/export.d.ts +15 -0
- package/dist/cli/src/commands/config/export.js +83 -0
- package/dist/cli/src/commands/config/import.d.ts +16 -0
- package/dist/cli/src/commands/config/import.js +102 -0
- package/dist/cli/src/commands/config/index.d.ts +13 -0
- package/dist/cli/src/commands/config/index.js +29 -0
- package/dist/cli/src/commands/config/list.d.ts +18 -0
- package/dist/cli/src/commands/config/list.js +233 -0
- package/dist/cli/src/commands/config/types.d.ts +21 -0
- package/dist/cli/src/commands/config/types.js +49 -0
- package/dist/cli/src/commands/debug/index.d.ts +19 -0
- package/dist/cli/src/commands/debug/index.js +34 -0
- package/dist/cli/src/commands/debug/log.d.ts +29 -0
- package/dist/cli/src/commands/debug/log.js +102 -0
- package/dist/cli/src/commands/debug/span.d.ts +24 -0
- package/dist/cli/src/commands/debug/span.js +187 -0
- package/dist/cli/src/commands/debug/trace.d.ts +27 -0
- package/dist/cli/src/commands/debug/trace.js +111 -0
- package/dist/cli/src/commands/eventsource/add.d.ts +19 -0
- package/dist/cli/src/commands/eventsource/add.js +108 -0
- package/dist/cli/src/commands/eventsource/index.d.ts +20 -0
- package/dist/cli/src/commands/eventsource/index.js +35 -0
- package/dist/cli/src/commands/eventsource/list.d.ts +13 -0
- package/dist/cli/src/commands/eventsource/list.js +159 -0
- package/dist/cli/src/commands/eventsource/remove.d.ts +13 -0
- package/dist/cli/src/commands/eventsource/remove.js +74 -0
- package/dist/cli/src/commands/eventsource/start.d.ts +13 -0
- package/dist/cli/src/commands/eventsource/start.js +81 -0
- package/dist/cli/src/commands/eventsource/status.d.ts +13 -0
- package/dist/cli/src/commands/eventsource/status.js +149 -0
- package/dist/cli/src/commands/eventsource/stop.d.ts +13 -0
- package/dist/cli/src/commands/eventsource/stop.js +69 -0
- package/dist/cli/src/commands/index.d.ts +15 -0
- package/dist/cli/src/commands/index.js +14 -0
- package/dist/cli/src/commands/input-handler.d.ts +27 -0
- package/dist/cli/src/commands/input-handler.js +38 -0
- package/dist/cli/src/commands/interactive.d.ts +141 -0
- package/dist/cli/src/commands/interactive.js +854 -0
- package/dist/cli/src/commands/lsp/check.d.ts +9 -0
- package/dist/cli/src/commands/lsp/check.js +79 -0
- package/dist/cli/src/commands/lsp/index.d.ts +12 -0
- package/dist/cli/src/commands/lsp/index.js +26 -0
- package/dist/cli/src/commands/lsp/install.d.ts +9 -0
- package/dist/cli/src/commands/lsp/install.js +114 -0
- package/dist/cli/src/commands/lsp/list.d.ts +9 -0
- package/dist/cli/src/commands/lsp/list.js +53 -0
- package/dist/cli/src/commands/mcp/index.d.ts +11 -0
- package/dist/cli/src/commands/mcp/index.js +23 -0
- package/dist/cli/src/commands/mcp/list.d.ts +14 -0
- package/dist/cli/src/commands/mcp/list.js +100 -0
- package/dist/cli/src/commands/mcp/reload.d.ts +12 -0
- package/dist/cli/src/commands/mcp/reload.js +54 -0
- package/dist/cli/src/commands/mcp/tools.d.ts +15 -0
- package/dist/cli/src/commands/mcp/tools.js +101 -0
- package/dist/cli/src/commands/memory/index.d.ts +11 -0
- package/dist/cli/src/commands/memory/index.js +11 -0
- package/dist/cli/src/commands/memory/memory.d.ts +10 -0
- package/dist/cli/src/commands/memory/memory.js +21 -0
- package/dist/cli/src/commands/memory/organize.d.ts +48 -0
- package/dist/cli/src/commands/memory/organize.js +233 -0
- package/dist/cli/src/commands/memory/recall.d.ts +10 -0
- package/dist/cli/src/commands/memory/recall.js +69 -0
- package/dist/cli/src/commands/memory/record.d.ts +11 -0
- package/dist/cli/src/commands/memory/record.js +268 -0
- package/dist/cli/src/commands/plugin.d.ts +112 -0
- package/dist/cli/src/commands/plugin.js +186 -0
- package/dist/cli/src/commands/sessions/active.d.ts +14 -0
- package/dist/cli/src/commands/sessions/active.js +79 -0
- package/dist/cli/src/commands/sessions/add-message.d.ts +8 -0
- package/dist/cli/src/commands/sessions/add-message.js +78 -0
- package/dist/cli/src/commands/sessions/checkpoints.d.ts +8 -0
- package/dist/cli/src/commands/sessions/checkpoints.js +133 -0
- package/dist/cli/src/commands/sessions/compact.d.ts +16 -0
- package/dist/cli/src/commands/sessions/compact.js +240 -0
- package/dist/cli/src/commands/sessions/delete.d.ts +14 -0
- package/dist/cli/src/commands/sessions/delete.js +214 -0
- package/dist/cli/src/commands/sessions/get.d.ts +8 -0
- package/dist/cli/src/commands/sessions/get.js +129 -0
- package/dist/cli/src/commands/sessions/grep.d.ts +15 -0
- package/dist/cli/src/commands/sessions/grep.js +210 -0
- package/dist/cli/src/commands/sessions/index.d.ts +42 -0
- package/dist/cli/src/commands/sessions/index.js +93 -0
- package/dist/cli/src/commands/sessions/list.d.ts +21 -0
- package/dist/cli/src/commands/sessions/list.js +163 -0
- package/dist/cli/src/commands/sessions/messages.d.ts +8 -0
- package/dist/cli/src/commands/sessions/messages.js +228 -0
- package/dist/cli/src/commands/sessions/mock.d.ts +10 -0
- package/dist/cli/src/commands/sessions/mock.js +172 -0
- package/dist/cli/src/commands/sessions/new.d.ts +16 -0
- package/dist/cli/src/commands/sessions/new.js +66 -0
- package/dist/cli/src/commands/sessions/rename.d.ts +8 -0
- package/dist/cli/src/commands/sessions/rename.js +82 -0
- package/dist/cli/src/commands/shared/event-handler.d.ts +91 -0
- package/dist/cli/src/commands/shared/event-handler.js +167 -0
- package/dist/cli/src/commands/shared/event-message-formatter.d.ts +150 -0
- package/dist/cli/src/commands/shared/event-message-formatter.js +198 -0
- package/dist/cli/src/commands/shared/index.d.ts +10 -0
- package/dist/cli/src/commands/shared/index.js +8 -0
- package/dist/cli/src/commands/shared/query-executor.d.ts +81 -0
- package/dist/cli/src/commands/shared/query-executor.js +254 -0
- package/dist/cli/src/commands/shared/session-manager.d.ts +49 -0
- package/dist/cli/src/commands/shared/session-manager.js +93 -0
- package/dist/cli/src/commands/skills/get.d.ts +14 -0
- package/dist/cli/src/commands/skills/get.js +76 -0
- package/dist/cli/src/commands/skills/index.d.ts +18 -0
- package/dist/cli/src/commands/skills/index.js +36 -0
- package/dist/cli/src/commands/skills/list.d.ts +8 -0
- package/dist/cli/src/commands/skills/list.js +112 -0
- package/dist/cli/src/commands/skills/reload.d.ts +12 -0
- package/dist/cli/src/commands/skills/reload.js +46 -0
- package/dist/cli/src/commands/skills/search.d.ts +15 -0
- package/dist/cli/src/commands/skills/search.js +110 -0
- package/dist/cli/src/commands/skills/show-config.d.ts +12 -0
- package/dist/cli/src/commands/skills/show-config.js +74 -0
- package/dist/cli/src/commands/tasks/complete.d.ts +15 -0
- package/dist/cli/src/commands/tasks/complete.js +72 -0
- package/dist/cli/src/commands/tasks/create.d.ts +19 -0
- package/dist/cli/src/commands/tasks/create.js +93 -0
- package/dist/cli/src/commands/tasks/delete.d.ts +14 -0
- package/dist/cli/src/commands/tasks/delete.js +71 -0
- package/dist/cli/src/commands/tasks/get.d.ts +15 -0
- package/dist/cli/src/commands/tasks/get.js +98 -0
- package/dist/cli/src/commands/tasks/index.d.ts +20 -0
- package/dist/cli/src/commands/tasks/index.js +50 -0
- package/dist/cli/src/commands/tasks/list.d.ts +18 -0
- package/dist/cli/src/commands/tasks/list.js +116 -0
- package/dist/cli/src/commands/tasks/operations.d.ts +8 -0
- package/dist/cli/src/commands/tasks/operations.js +95 -0
- package/dist/cli/src/commands/tasks/update.d.ts +20 -0
- package/dist/cli/src/commands/tasks/update.js +93 -0
- package/dist/cli/src/commands/tools/exec-tool.d.ts +14 -0
- package/dist/cli/src/commands/tools/exec-tool.js +103 -0
- package/dist/cli/src/commands/tools/get.d.ts +14 -0
- package/dist/cli/src/commands/tools/get.js +97 -0
- package/dist/cli/src/commands/tools/index.d.ts +16 -0
- package/dist/cli/src/commands/tools/index.js +30 -0
- package/dist/cli/src/commands/tools/list.d.ts +14 -0
- package/dist/cli/src/commands/tools/list.js +92 -0
- package/dist/cli/src/commands/tools/shared/index.d.ts +7 -0
- package/dist/cli/src/commands/tools/shared/index.js +7 -0
- package/dist/cli/src/commands/tools/shared/schema-helper.d.ts +53 -0
- package/dist/cli/src/commands/tools/shared/schema-helper.js +74 -0
- package/dist/cli/src/commands/workflow/commands/add.d.ts +22 -0
- package/dist/cli/src/commands/workflow/commands/add.js +271 -0
- package/dist/cli/src/commands/workflow/commands/get.d.ts +20 -0
- package/dist/cli/src/commands/workflow/commands/get.js +169 -0
- package/dist/cli/src/commands/workflow/commands/list.d.ts +21 -0
- package/dist/cli/src/commands/workflow/commands/list.js +117 -0
- package/dist/cli/src/commands/workflow/commands/nodes.d.ts +34 -0
- package/dist/cli/src/commands/workflow/commands/nodes.js +465 -0
- package/dist/cli/src/commands/workflow/commands/remove.d.ts +16 -0
- package/dist/cli/src/commands/workflow/commands/remove.js +77 -0
- package/dist/cli/src/commands/workflow/commands/run.d.ts +32 -0
- package/dist/cli/src/commands/workflow/commands/run.js +335 -0
- package/dist/cli/src/commands/workflow/commands/status.d.ts +17 -0
- package/dist/cli/src/commands/workflow/commands/status.js +125 -0
- package/dist/cli/src/commands/workflow/commands/stop.d.ts +15 -0
- package/dist/cli/src/commands/workflow/commands/stop.js +70 -0
- package/dist/cli/src/commands/workflow/commands/update.d.ts +19 -0
- package/dist/cli/src/commands/workflow/commands/update.js +105 -0
- package/dist/cli/src/commands/workflow/commands/validate.d.ts +14 -0
- package/dist/cli/src/commands/workflow/commands/validate.js +118 -0
- package/dist/cli/src/commands/workflow/index.d.ts +28 -0
- package/dist/cli/src/commands/workflow/index.js +44 -0
- package/dist/cli/src/commands/workflow/renderers.d.ts +60 -0
- package/dist/cli/src/commands/workflow/renderers.js +320 -0
- package/dist/cli/src/commands/workflow/validators/index.d.ts +8 -0
- package/dist/cli/src/commands/workflow/validators/index.js +8 -0
- package/dist/cli/src/commands/workflow/validators/node-validator-factory.d.ts +13 -0
- package/dist/cli/src/commands/workflow/validators/node-validator-factory.js +35 -0
- package/dist/cli/src/commands/workflow/validators/node-validator.d.ts +37 -0
- package/dist/cli/src/commands/workflow/validators/node-validator.js +89 -0
- package/dist/cli/src/commands/workflow/validators/nodes/agent-node-validator.d.ts +11 -0
- package/dist/cli/src/commands/workflow/validators/nodes/agent-node-validator.js +50 -0
- package/dist/cli/src/commands/workflow/validators/nodes/condition-node-validator.d.ts +11 -0
- package/dist/cli/src/commands/workflow/validators/nodes/condition-node-validator.js +28 -0
- package/dist/cli/src/commands/workflow/validators/nodes/decorator-node-validator.d.ts +11 -0
- package/dist/cli/src/commands/workflow/validators/nodes/decorator-node-validator.js +38 -0
- package/dist/cli/src/commands/workflow/validators/nodes/merge-node-validator.d.ts +11 -0
- package/dist/cli/src/commands/workflow/validators/nodes/merge-node-validator.js +41 -0
- package/dist/cli/src/commands/workflow/validators/nodes/skill-node-validator.d.ts +11 -0
- package/dist/cli/src/commands/workflow/validators/nodes/skill-node-validator.js +27 -0
- package/dist/cli/src/commands/workflow/validators/nodes/tool-node-validator.d.ts +11 -0
- package/dist/cli/src/commands/workflow/validators/nodes/tool-node-validator.js +45 -0
- package/dist/cli/src/commands/workflow/validators/nodes/workflow-node-validator.d.ts +11 -0
- package/dist/cli/src/commands/workflow/validators/nodes/workflow-node-validator.js +27 -0
- package/dist/cli/src/commands/workflow/validators/types.d.ts +74 -0
- package/dist/cli/src/commands/workflow/validators/types.js +18 -0
- package/dist/cli/src/commands/workflow/validators/workflow-validator.d.ts +37 -0
- package/dist/cli/src/commands/workflow/validators/workflow-validator.js +284 -0
- package/dist/cli/src/index.d.ts +16 -0
- package/dist/cli/src/index.js +18 -0
- package/dist/cli/src/plugin/apply.d.ts +51 -0
- package/dist/cli/src/plugin/apply.js +85 -0
- package/dist/cli/src/plugin/discover.d.ts +29 -0
- package/dist/cli/src/plugin/discover.js +187 -0
- package/dist/cli/src/plugin/index.d.ts +16 -0
- package/dist/cli/src/plugin/index.js +18 -0
- package/dist/cli/src/plugin/registry.d.ts +109 -0
- package/dist/cli/src/plugin/registry.js +226 -0
- package/dist/cli/src/plugin/types.d.ts +145 -0
- package/dist/cli/src/plugin/types.js +7 -0
- package/dist/cli/src/services/context-handler.service.d.ts +72 -0
- package/dist/cli/src/services/context-handler.service.js +312 -0
- package/dist/cli/src/services/environment.service.d.ts +129 -0
- package/dist/cli/src/services/environment.service.js +544 -0
- package/dist/cli/src/services/output.service.d.ts +68 -0
- package/dist/cli/src/services/output.service.js +104 -0
- package/dist/cli/src/services/quiet-mode.service.d.ts +58 -0
- package/dist/cli/src/services/quiet-mode.service.js +74 -0
- package/dist/cli/src/services/stream-output.service.d.ts +116 -0
- package/dist/cli/src/services/stream-output.service.js +242 -0
- package/dist/cli/src/util/which.d.ts +13 -0
- package/dist/cli/src/util/which.js +50 -0
- package/dist/coder-harness/src/index.d.ts +32 -0
- package/dist/coder-harness/src/index.js +36 -0
- package/dist/coder-harness/src/lsp/client.d.ts +104 -0
- package/dist/coder-harness/src/lsp/client.js +490 -0
- package/dist/coder-harness/src/lsp/client.test.d.ts +5 -0
- package/dist/coder-harness/src/lsp/client.test.js +154 -0
- package/dist/coder-harness/src/lsp/language-map.d.ts +42 -0
- package/dist/coder-harness/src/lsp/language-map.js +105 -0
- package/dist/coder-harness/src/lsp/language-map.test.d.ts +5 -0
- package/dist/coder-harness/src/lsp/language-map.test.js +95 -0
- package/dist/coder-harness/src/lsp/manager.d.ts +166 -0
- package/dist/coder-harness/src/lsp/manager.js +457 -0
- package/dist/coder-harness/src/lsp/manager.test.d.ts +11 -0
- package/dist/coder-harness/src/lsp/manager.test.js +121 -0
- package/dist/coder-harness/src/lsp/preload.integration.test.d.ts +5 -0
- package/dist/coder-harness/src/lsp/preload.integration.test.js +125 -0
- package/dist/coder-harness/src/lsp/server.d.ts +72 -0
- package/dist/coder-harness/src/lsp/server.js +271 -0
- package/dist/coder-harness/src/lsp/server.test.d.ts +5 -0
- package/dist/coder-harness/src/lsp/server.test.js +78 -0
- package/dist/coder-harness/src/lsp-deps/config.d.ts +84 -0
- package/dist/coder-harness/src/lsp-deps/config.js +123 -0
- package/dist/coder-harness/src/lsp-deps/index.d.ts +10 -0
- package/dist/coder-harness/src/lsp-deps/index.js +8 -0
- package/dist/coder-harness/src/lsp-deps/installer.d.ts +101 -0
- package/dist/coder-harness/src/lsp-deps/installer.js +207 -0
- package/dist/coder-harness/src/plugins/code-check-manager.d.ts +43 -0
- package/dist/coder-harness/src/plugins/code-check-manager.js +238 -0
- package/dist/coder-harness/src/plugins/code-check-manager.test.d.ts +2 -0
- package/dist/coder-harness/src/plugins/code-check-manager.test.js +45 -0
- package/dist/coder-harness/src/plugins/code-check-plugin.d.ts +79 -0
- package/dist/coder-harness/src/plugins/code-check-plugin.js +181 -0
- package/dist/coder-harness/src/plugins/code-check-plugin.test.d.ts +2 -0
- package/dist/coder-harness/src/plugins/code-check-plugin.test.js +94 -0
- package/dist/coder-harness/src/plugins/lsp-plugin.d.ts +131 -0
- package/dist/coder-harness/src/plugins/lsp-plugin.js +253 -0
- package/dist/coder-harness/src/plugins/lsp-plugin.test.d.ts +9 -0
- package/dist/coder-harness/src/plugins/lsp-plugin.test.js +304 -0
- package/dist/coder-harness/src/plugins/plugin-hook-adapter.d.ts +192 -0
- package/dist/coder-harness/src/plugins/plugin-hook-adapter.js +294 -0
- package/dist/coder-harness/src/plugins/plugin-hook-adapter.test.d.ts +5 -0
- package/dist/coder-harness/src/plugins/plugin-hook-adapter.test.js +312 -0
- package/dist/coder-harness/src/plugins/reminder-plugin.d.ts +69 -0
- package/dist/coder-harness/src/plugins/reminder-plugin.js +92 -0
- package/dist/coder-harness/src/plugins/reminder-plugin.test.d.ts +5 -0
- package/dist/coder-harness/src/plugins/reminder-plugin.test.js +132 -0
- package/dist/coder-harness/src/types/linter.d.ts +263 -0
- package/dist/coder-harness/src/types/linter.js +18 -0
- package/dist/coder-harness/src/util/glob.d.ts +22 -0
- package/dist/coder-harness/src/util/glob.js +31 -0
- package/dist/coder-harness/src/util/glob.test.d.ts +5 -0
- package/dist/coder-harness/src/util/glob.test.js +63 -0
- package/dist/coder-harness/src/util/which.d.ts +13 -0
- package/dist/coder-harness/src/util/which.js +46 -0
- package/dist/core/src/config/config-component.d.ts +323 -0
- package/dist/core/src/config/config-component.js +686 -0
- package/dist/core/src/config/config-component.test.d.ts +2 -0
- package/dist/core/src/config/config-component.test.js +486 -0
- package/dist/core/src/config/config-parser.d.ts +46 -0
- package/dist/core/src/config/config-parser.js +173 -0
- package/dist/core/src/config/config-parser.test.d.ts +2 -0
- package/dist/core/src/config/config-parser.test.js +252 -0
- package/dist/core/src/config/decentralized-config.test.d.ts +2 -0
- package/dist/core/src/config/decentralized-config.test.js +602 -0
- package/dist/core/src/config/env-key.d.ts +93 -0
- package/dist/core/src/config/env-key.js +189 -0
- package/dist/core/src/config/env-source.d.ts +83 -0
- package/dist/core/src/config/env-source.js +240 -0
- package/dist/core/src/config/env-source.test.d.ts +2 -0
- package/dist/core/src/config/env-source.test.js +196 -0
- package/dist/core/src/config/file-source.d.ts +87 -0
- package/dist/core/src/config/file-source.js +349 -0
- package/dist/core/src/config/file-source.test.d.ts +2 -0
- package/dist/core/src/config/file-source.test.js +275 -0
- package/dist/core/src/config/index.d.ts +5 -0
- package/dist/core/src/config/index.js +5 -0
- package/dist/core/src/config/protocol-resolver.d.ts +95 -0
- package/dist/core/src/config/protocol-resolver.js +175 -0
- package/dist/core/src/config/protocol-resolver.test.d.ts +2 -0
- package/dist/core/src/config/protocol-resolver.test.js +167 -0
- package/dist/core/src/env/agent/agent-component.abort.test.d.ts +11 -0
- package/dist/core/src/env/agent/agent-component.abort.test.js +440 -0
- package/dist/core/src/env/agent/agent-component.d.ts +349 -0
- package/dist/core/src/env/agent/agent-component.js +1481 -0
- package/dist/core/src/env/agent/agent-component.record-session.test.d.ts +14 -0
- package/dist/core/src/env/agent/agent-component.record-session.test.js +280 -0
- package/dist/core/src/env/agent/agent-component.test.d.ts +7 -0
- package/dist/core/src/env/agent/agent-component.test.js +1169 -0
- package/dist/core/src/env/agent/agent-component.tool-error.test.d.ts +25 -0
- package/dist/core/src/env/agent/agent-component.tool-error.test.js +272 -0
- package/dist/core/src/env/agent/agent-config-registration.d.ts +19 -0
- package/dist/core/src/env/agent/agent-config-registration.js +41 -0
- package/dist/core/src/env/agent/agent-config-registration.test.d.ts +7 -0
- package/dist/core/src/env/agent/agent-config-registration.test.js +193 -0
- package/dist/core/src/env/agent/agent-reminder-plugin.integration.test.d.ts +7 -0
- package/dist/core/src/env/agent/agent-reminder-plugin.integration.test.js +206 -0
- package/dist/core/src/env/agent/index.d.ts +10 -0
- package/dist/core/src/env/agent/index.js +9 -0
- package/dist/core/src/env/agent/summary-agent.d.ts +101 -0
- package/dist/core/src/env/agent/summary-agent.js +473 -0
- package/dist/core/src/env/agent/summary-agent.parse-hint.test.d.ts +12 -0
- package/dist/core/src/env/agent/summary-agent.parse-hint.test.js +267 -0
- package/dist/core/src/env/agent/types.d.ts +394 -0
- package/dist/core/src/env/agent/types.js +9 -0
- package/dist/core/src/env/commands/commands-component.d.ts +98 -0
- package/dist/core/src/env/commands/commands-component.js +517 -0
- package/dist/core/src/env/commands/commands-component.test.d.ts +2 -0
- package/dist/core/src/env/commands/commands-component.test.js +304 -0
- package/dist/core/src/env/commands/commands-config-registration.d.ts +20 -0
- package/dist/core/src/env/commands/commands-config-registration.js +33 -0
- package/dist/core/src/env/commands/commands-config-registration.test.d.ts +7 -0
- package/dist/core/src/env/commands/commands-config-registration.test.js +164 -0
- package/dist/core/src/env/commands/index.d.ts +8 -0
- package/dist/core/src/env/commands/index.js +8 -0
- package/dist/core/src/env/commands/parser.d.ts +19 -0
- package/dist/core/src/env/commands/parser.js +97 -0
- package/dist/core/src/env/commands/parser.test.d.ts +2 -0
- package/dist/core/src/env/commands/parser.test.js +155 -0
- package/dist/core/src/env/commands/types.d.ts +134 -0
- package/dist/core/src/env/commands/types.js +7 -0
- package/dist/core/src/env/commands-prompt-integration.test.d.ts +2 -0
- package/dist/core/src/env/commands-prompt-integration.test.js +205 -0
- package/dist/core/src/env/component-env.test.d.ts +2 -0
- package/dist/core/src/env/component-env.test.js +101 -0
- package/dist/core/src/env/component.d.ts +187 -0
- package/dist/core/src/env/component.js +160 -0
- package/dist/core/src/env/constants.d.ts +99 -0
- package/dist/core/src/env/constants.js +107 -0
- package/dist/core/src/env/constants.test.d.ts +2 -0
- package/dist/core/src/env/constants.test.js +55 -0
- package/dist/core/src/env/debug/debug-component.d.ts +161 -0
- package/dist/core/src/env/debug/debug-component.js +441 -0
- package/dist/core/src/env/debug/debug-component.test.d.ts +2 -0
- package/dist/core/src/env/debug/debug-component.test.js +89 -0
- package/dist/core/src/env/debug/formatters/index.d.ts +9 -0
- package/dist/core/src/env/debug/formatters/index.js +9 -0
- package/dist/core/src/env/debug/formatters/repl-formatter.d.ts +81 -0
- package/dist/core/src/env/debug/formatters/repl-formatter.js +309 -0
- package/dist/core/src/env/debug/formatters/repl-formatter.test.d.ts +2 -0
- package/dist/core/src/env/debug/formatters/repl-formatter.test.js +119 -0
- package/dist/core/src/env/debug/formatters/trace-formatter.d.ts +44 -0
- package/dist/core/src/env/debug/formatters/trace-formatter.js +157 -0
- package/dist/core/src/env/debug/formatters/trace-formatter.test.d.ts +2 -0
- package/dist/core/src/env/debug/formatters/trace-formatter.test.js +102 -0
- package/dist/core/src/env/debug/formatters/tree-formatter.d.ts +73 -0
- package/dist/core/src/env/debug/formatters/tree-formatter.js +252 -0
- package/dist/core/src/env/debug/formatters/tree-formatter.test.d.ts +2 -0
- package/dist/core/src/env/debug/formatters/tree-formatter.test.js +91 -0
- package/dist/core/src/env/debug/index.d.ts +16 -0
- package/dist/core/src/env/debug/index.js +18 -0
- package/dist/core/src/env/debug/parser/regex-parser.d.ts +50 -0
- package/dist/core/src/env/debug/parser/regex-parser.js +167 -0
- package/dist/core/src/env/debug/parser/regex-parser.test.d.ts +2 -0
- package/dist/core/src/env/debug/parser/regex-parser.test.js +147 -0
- package/dist/core/src/env/debug/parser/span-builder.d.ts +80 -0
- package/dist/core/src/env/debug/parser/span-builder.js +321 -0
- package/dist/core/src/env/debug/parser/span-builder.test.d.ts +2 -0
- package/dist/core/src/env/debug/parser/span-builder.test.js +207 -0
- package/dist/core/src/env/debug/reader/log-reader.d.ts +56 -0
- package/dist/core/src/env/debug/reader/log-reader.js +163 -0
- package/dist/core/src/env/debug/reader/log-reader.test.d.ts +2 -0
- package/dist/core/src/env/debug/reader/log-reader.test.js +132 -0
- package/dist/core/src/env/debug/reader/span-db-reader.d.ts +71 -0
- package/dist/core/src/env/debug/reader/span-db-reader.js +167 -0
- package/dist/core/src/env/debug/reader/span-db-reader.test.d.ts +5 -0
- package/dist/core/src/env/debug/reader/span-db-reader.test.js +96 -0
- package/dist/core/src/env/debug/types.d.ts +146 -0
- package/dist/core/src/env/debug/types.js +7 -0
- package/dist/core/src/env/debug/types.test.d.ts +2 -0
- package/dist/core/src/env/debug/types.test.js +160 -0
- package/dist/core/src/env/environment-init.test.d.ts +2 -0
- package/dist/core/src/env/environment-init.test.js +142 -0
- package/dist/core/src/env/environment-lifecycle.test.d.ts +16 -0
- package/dist/core/src/env/environment-lifecycle.test.js +391 -0
- package/dist/core/src/env/environment-service.test.d.ts +7 -0
- package/dist/core/src/env/environment-service.test.js +265 -0
- package/dist/core/src/env/environment.d.ts +163 -0
- package/dist/core/src/env/environment.handle-query.test.d.ts +5 -0
- package/dist/core/src/env/environment.handle-query.test.js +74 -0
- package/dist/core/src/env/environment.js +607 -0
- package/dist/core/src/env/environment.test.d.ts +5 -0
- package/dist/core/src/env/environment.test.js +188 -0
- package/dist/core/src/env/errors.d.ts +96 -0
- package/dist/core/src/env/errors.js +123 -0
- package/dist/core/src/env/errors.test.d.ts +2 -0
- package/dist/core/src/env/errors.test.js +110 -0
- package/dist/core/src/env/event-source/event-source-agent-handler.d.ts +45 -0
- package/dist/core/src/env/event-source/event-source-agent-handler.js +80 -0
- package/dist/core/src/env/event-source/event-source-agent-handler.test.d.ts +2 -0
- package/dist/core/src/env/event-source/event-source-agent-handler.test.js +165 -0
- package/dist/core/src/env/event-source/event-source-component.d.ts +197 -0
- package/dist/core/src/env/event-source/event-source-component.js +1155 -0
- package/dist/core/src/env/event-source/event-source-component.process-cleanup.test.d.ts +9 -0
- package/dist/core/src/env/event-source/event-source-component.process-cleanup.test.js +207 -0
- package/dist/core/src/env/event-source/event-source-component.stop.test.d.ts +7 -0
- package/dist/core/src/env/event-source/event-source-component.stop.test.js +293 -0
- package/dist/core/src/env/event-source/event-source-component.test.d.ts +2 -0
- package/dist/core/src/env/event-source/event-source-component.test.js +1036 -0
- package/dist/core/src/env/event-source/event-source-config-registration.d.ts +19 -0
- package/dist/core/src/env/event-source/event-source-config-registration.js +32 -0
- package/dist/core/src/env/event-source/event-source-config-registration.test.d.ts +7 -0
- package/dist/core/src/env/event-source/event-source-config-registration.test.js +208 -0
- package/dist/core/src/env/event-source/event-source-integration.test.d.ts +2 -0
- package/dist/core/src/env/event-source/event-source-integration.test.js +275 -0
- package/dist/core/src/env/event-source/event-source-platform.test.d.ts +12 -0
- package/dist/core/src/env/event-source/event-source-platform.test.js +536 -0
- package/dist/core/src/env/event-source/types.d.ts +213 -0
- package/dist/core/src/env/event-source/types.js +57 -0
- package/dist/core/src/env/hook/global-hook-manager.d.ts +74 -0
- package/dist/core/src/env/hook/global-hook-manager.js +126 -0
- package/dist/core/src/env/hook/hook-manager.d.ts +133 -0
- package/dist/core/src/env/hook/hook-manager.js +249 -0
- package/dist/core/src/env/hook/hook-manager.test.d.ts +2 -0
- package/dist/core/src/env/hook/hook-manager.test.js +275 -0
- package/dist/core/src/env/hook/index.d.ts +10 -0
- package/dist/core/src/env/hook/index.js +12 -0
- package/dist/core/src/env/hook/types.d.ts +104 -0
- package/dist/core/src/env/hook/types.js +33 -0
- package/dist/core/src/env/index.d.ts +23 -0
- package/dist/core/src/env/index.js +26 -0
- package/dist/core/src/env/interface.d.ts +156 -0
- package/dist/core/src/env/interface.js +19 -0
- package/dist/core/src/env/llm/hooks.d.ts +151 -0
- package/dist/core/src/env/llm/hooks.js +209 -0
- package/dist/core/src/env/llm/hooks.test.d.ts +2 -0
- package/dist/core/src/env/llm/hooks.test.js +233 -0
- package/dist/core/src/env/llm/index.d.ts +12 -0
- package/dist/core/src/env/llm/index.js +16 -0
- package/dist/core/src/env/llm/invoke-threshold-check.test.d.ts +11 -0
- package/dist/core/src/env/llm/invoke-threshold-check.test.js +76 -0
- package/dist/core/src/env/llm/invoke-timeout.test.d.ts +2 -0
- package/dist/core/src/env/llm/invoke-timeout.test.js +31 -0
- package/dist/core/src/env/llm/invoke.d.ts +118 -0
- package/dist/core/src/env/llm/invoke.js +755 -0
- package/dist/core/src/env/llm/invoke.test.d.ts +2 -0
- package/dist/core/src/env/llm/invoke.test.js +62 -0
- package/dist/core/src/env/llm/llm-config.test.d.ts +2 -0
- package/dist/core/src/env/llm/llm-config.test.js +453 -0
- package/dist/core/src/env/llm/llm.d.ts +164 -0
- package/dist/core/src/env/llm/llm.js +461 -0
- package/dist/core/src/env/llm/llm.test.d.ts +2 -0
- package/dist/core/src/env/llm/llm.test.js +197 -0
- package/dist/core/src/env/llm/provider.d.ts +41 -0
- package/dist/core/src/env/llm/provider.js +90 -0
- package/dist/core/src/env/llm/provider.test.d.ts +2 -0
- package/dist/core/src/env/llm/provider.test.js +152 -0
- package/dist/core/src/env/llm/transform.d.ts +58 -0
- package/dist/core/src/env/llm/transform.js +254 -0
- package/dist/core/src/env/llm/transform.test.d.ts +2 -0
- package/dist/core/src/env/llm/transform.test.js +215 -0
- package/dist/core/src/env/llm/types.d.ts +771 -0
- package/dist/core/src/env/llm/types.js +67 -0
- package/dist/core/src/env/llm/types.test.d.ts +2 -0
- package/dist/core/src/env/llm/types.test.js +520 -0
- package/dist/core/src/env/log-trace/decorator-otel.test.d.ts +7 -0
- package/dist/core/src/env/log-trace/decorator-otel.test.js +204 -0
- package/dist/core/src/env/log-trace/decorator.d.ts +47 -0
- package/dist/core/src/env/log-trace/decorator.js +190 -0
- package/dist/core/src/env/log-trace/index.d.ts +15 -0
- package/dist/core/src/env/log-trace/index.js +20 -0
- package/dist/core/src/env/log-trace/log-trace-component.d.ts +262 -0
- package/dist/core/src/env/log-trace/log-trace-component.js +405 -0
- package/dist/core/src/env/log-trace/log-trace-component.test.d.ts +7 -0
- package/dist/core/src/env/log-trace/log-trace-component.test.js +212 -0
- package/dist/core/src/env/log-trace/log-trace-config-registration.d.ts +20 -0
- package/dist/core/src/env/log-trace/log-trace-config-registration.js +40 -0
- package/dist/core/src/env/log-trace/log-trace-config-registration.test.d.ts +7 -0
- package/dist/core/src/env/log-trace/log-trace-config-registration.test.js +295 -0
- package/dist/core/src/env/log-trace/logger.d.ts +84 -0
- package/dist/core/src/env/log-trace/logger.js +445 -0
- package/dist/core/src/env/log-trace/logger.test.d.ts +2 -0
- package/dist/core/src/env/log-trace/logger.test.js +118 -0
- package/dist/core/src/env/log-trace/opentelemetry/cli-propagation.d.ts +106 -0
- package/dist/core/src/env/log-trace/opentelemetry/cli-propagation.js +149 -0
- package/dist/core/src/env/log-trace/opentelemetry/cli-propagation.test.d.ts +9 -0
- package/dist/core/src/env/log-trace/opentelemetry/cli-propagation.test.js +122 -0
- package/dist/core/src/env/log-trace/opentelemetry/integration.test.d.ts +19 -0
- package/dist/core/src/env/log-trace/opentelemetry/integration.test.js +535 -0
- package/dist/core/src/env/log-trace/opentelemetry/mod.d.ts +25 -0
- package/dist/core/src/env/log-trace/opentelemetry/mod.js +25 -0
- package/dist/core/src/env/log-trace/opentelemetry/propagation-env.d.ts +82 -0
- package/dist/core/src/env/log-trace/opentelemetry/propagation-env.js +109 -0
- package/dist/core/src/env/log-trace/opentelemetry/propagation-env.test.d.ts +9 -0
- package/dist/core/src/env/log-trace/opentelemetry/propagation-env.test.js +143 -0
- package/dist/core/src/env/log-trace/opentelemetry/propagation.d.ts +80 -0
- package/dist/core/src/env/log-trace/opentelemetry/propagation.js +163 -0
- package/dist/core/src/env/log-trace/opentelemetry/propagation.test.d.ts +11 -0
- package/dist/core/src/env/log-trace/opentelemetry/propagation.test.js +197 -0
- package/dist/core/src/env/log-trace/opentelemetry/tracer-provider-context.test.d.ts +8 -0
- package/dist/core/src/env/log-trace/opentelemetry/tracer-provider-context.test.js +127 -0
- package/dist/core/src/env/log-trace/opentelemetry/tracer-provider.d.ts +143 -0
- package/dist/core/src/env/log-trace/opentelemetry/tracer-provider.js +451 -0
- package/dist/core/src/env/log-trace/opentelemetry/tracer-provider.test.d.ts +11 -0
- package/dist/core/src/env/log-trace/opentelemetry/tracer-provider.test.js +291 -0
- package/dist/core/src/env/log-trace/span-storage.d.ts +38 -0
- package/dist/core/src/env/log-trace/span-storage.js +185 -0
- package/dist/core/src/env/log-trace/span-storage.test.d.ts +5 -0
- package/dist/core/src/env/log-trace/span-storage.test.js +121 -0
- package/dist/core/src/env/log-trace/trace-context.d.ts +29 -0
- package/dist/core/src/env/log-trace/trace-context.js +133 -0
- package/dist/core/src/env/log-trace/trace-context.test.d.ts +2 -0
- package/dist/core/src/env/log-trace/trace-context.test.js +149 -0
- package/dist/core/src/env/log-trace/types.d.ts +128 -0
- package/dist/core/src/env/log-trace/types.js +21 -0
- package/dist/core/src/env/log-trace/types.test.d.ts +2 -0
- package/dist/core/src/env/log-trace/types.test.js +53 -0
- package/dist/core/src/env/mcp/__integration__/mcp-component.integration.test.d.ts +2 -0
- package/dist/core/src/env/mcp/__integration__/mcp-component.integration.test.js +322 -0
- package/dist/core/src/env/mcp/config.d.ts +104 -0
- package/dist/core/src/env/mcp/config.js +65 -0
- package/dist/core/src/env/mcp/config.test.d.ts +2 -0
- package/dist/core/src/env/mcp/config.test.js +56 -0
- package/dist/core/src/env/mcp/index.d.ts +12 -0
- package/dist/core/src/env/mcp/index.js +14 -0
- package/dist/core/src/env/mcp/loader.d.ts +67 -0
- package/dist/core/src/env/mcp/loader.js +163 -0
- package/dist/core/src/env/mcp/loader.test.d.ts +2 -0
- package/dist/core/src/env/mcp/loader.test.js +128 -0
- package/dist/core/src/env/mcp/mcp-component.d.ts +55 -0
- package/dist/core/src/env/mcp/mcp-component.js +296 -0
- package/dist/core/src/env/mcp/mcp-component.test.d.ts +2 -0
- package/dist/core/src/env/mcp/mcp-component.test.js +92 -0
- package/dist/core/src/env/mcp/mcp-config-registration.d.ts +20 -0
- package/dist/core/src/env/mcp/mcp-config-registration.js +45 -0
- package/dist/core/src/env/mcp/mcp-config-registration.test.d.ts +7 -0
- package/dist/core/src/env/mcp/mcp-config-registration.test.js +258 -0
- package/dist/core/src/env/mcp/scanner.d.ts +39 -0
- package/dist/core/src/env/mcp/scanner.js +206 -0
- package/dist/core/src/env/mcp/scanner.test.d.ts +2 -0
- package/dist/core/src/env/mcp/scanner.test.js +115 -0
- package/dist/core/src/env/mcp/tool/adapter.d.ts +33 -0
- package/dist/core/src/env/mcp/tool/adapter.js +413 -0
- package/dist/core/src/env/mcp/tool/adapter.test.d.ts +2 -0
- package/dist/core/src/env/mcp/tool/adapter.test.js +436 -0
- package/dist/core/src/env/mcp/tool/index.d.ts +5 -0
- package/dist/core/src/env/mcp/tool/index.js +5 -0
- package/dist/core/src/env/mcp/types.d.ts +122 -0
- package/dist/core/src/env/mcp/types.js +33 -0
- package/dist/core/src/env/mcp/types.test.d.ts +2 -0
- package/dist/core/src/env/mcp/types.test.js +136 -0
- package/dist/core/src/env/memory/built-in/index.d.ts +42 -0
- package/dist/core/src/env/memory/built-in/index.js +24 -0
- package/dist/core/src/env/memory/built-in/recall-memory.d.ts +30 -0
- package/dist/core/src/env/memory/built-in/recall-memory.js +79 -0
- package/dist/core/src/env/memory/built-in/record-memory.d.ts +45 -0
- package/dist/core/src/env/memory/built-in/record-memory.js +111 -0
- package/dist/core/src/env/memory/index.d.ts +11 -0
- package/dist/core/src/env/memory/index.js +16 -0
- package/dist/core/src/env/memory/memory-component.d.ts +115 -0
- package/dist/core/src/env/memory/memory-component.js +406 -0
- package/dist/core/src/env/memory/memory-component.test.d.ts +5 -0
- package/dist/core/src/env/memory/memory-component.test.js +183 -0
- package/dist/core/src/env/memory/memory-config-registration.d.ts +19 -0
- package/dist/core/src/env/memory/memory-config-registration.js +43 -0
- package/dist/core/src/env/memory/memory-config-registration.test.d.ts +5 -0
- package/dist/core/src/env/memory/memory-config-registration.test.js +48 -0
- package/dist/core/src/env/memory/memory-config.d.ts +19 -0
- package/dist/core/src/env/memory/memory-config.js +41 -0
- package/dist/core/src/env/memory/memory-file.test.d.ts +7 -0
- package/dist/core/src/env/memory/memory-file.test.js +222 -0
- package/dist/core/src/env/memory/plugin/index.d.ts +17 -0
- package/dist/core/src/env/memory/plugin/index.js +17 -0
- package/dist/core/src/env/memory/plugin/memory-agent.d.ts +127 -0
- package/dist/core/src/env/memory/plugin/memory-agent.js +250 -0
- package/dist/core/src/env/memory/plugin/memory-agent.test.d.ts +11 -0
- package/dist/core/src/env/memory/plugin/memory-agent.test.js +207 -0
- package/dist/core/src/env/memory/plugin/memory-manager.d.ts +72 -0
- package/dist/core/src/env/memory/plugin/memory-manager.js +166 -0
- package/dist/core/src/env/memory/plugin/memory-plugin-agent.test.d.ts +7 -0
- package/dist/core/src/env/memory/plugin/memory-plugin-agent.test.js +114 -0
- package/dist/core/src/env/memory/plugin/memory-plugin.d.ts +104 -0
- package/dist/core/src/env/memory/plugin/memory-plugin.js +155 -0
- package/dist/core/src/env/memory/plugin/plugin-simplified.test.d.ts +13 -0
- package/dist/core/src/env/memory/plugin/plugin-simplified.test.js +44 -0
- package/dist/core/src/env/memory/plugin/recall-memory.d.ts +17 -0
- package/dist/core/src/env/memory/plugin/recall-memory.js +44 -0
- package/dist/core/src/env/memory/plugin/recall-memory.test.d.ts +7 -0
- package/dist/core/src/env/memory/plugin/recall-memory.test.js +86 -0
- package/dist/core/src/env/memory/plugin/types.d.ts +76 -0
- package/dist/core/src/env/memory/plugin/types.js +16 -0
- package/dist/core/src/env/memory/tools/memory-agent-tools.d.ts +110 -0
- package/dist/core/src/env/memory/tools/memory-agent-tools.js +157 -0
- package/dist/core/src/env/memory/types.d.ts +81 -0
- package/dist/core/src/env/memory/types.js +25 -0
- package/dist/core/src/env/paths.d.ts +47 -0
- package/dist/core/src/env/paths.js +91 -0
- package/dist/core/src/env/prompt/index.d.ts +8 -0
- package/dist/core/src/env/prompt/index.js +7 -0
- package/dist/core/src/env/prompt/memory-prompts.test.d.ts +7 -0
- package/dist/core/src/env/prompt/memory-prompts.test.js +78 -0
- package/dist/core/src/env/prompt/prompt-component.d.ts +163 -0
- package/dist/core/src/env/prompt/prompt-component.js +489 -0
- package/dist/core/src/env/prompt/prompt-component.test.d.ts +7 -0
- package/dist/core/src/env/prompt/prompt-component.test.js +397 -0
- package/dist/core/src/env/prompt/prompt-config-registration.d.ts +19 -0
- package/dist/core/src/env/prompt/prompt-config-registration.js +34 -0
- package/dist/core/src/env/prompt/prompt-config-registration.test.d.ts +7 -0
- package/dist/core/src/env/prompt/prompt-config-registration.test.js +172 -0
- package/dist/core/src/env/prompt/prompts-index.d.ts +27 -0
- package/dist/core/src/env/prompt/prompts-index.js +498 -0
- package/dist/core/src/env/prompt/renderer.d.ts +22 -0
- package/dist/core/src/env/prompt/renderer.js +47 -0
- package/dist/core/src/env/prompt/types.d.ts +159 -0
- package/dist/core/src/env/prompt/types.js +48 -0
- package/dist/core/src/env/session/hooks.d.ts +15 -0
- package/dist/core/src/env/session/hooks.js +5 -0
- package/dist/core/src/env/session/index.d.ts +19 -0
- package/dist/core/src/env/session/index.js +13 -0
- package/dist/core/src/env/session/search-query-parser.d.ts +42 -0
- package/dist/core/src/env/session/search-query-parser.js +141 -0
- package/dist/core/src/env/session/search-query-parser.test.d.ts +14 -0
- package/dist/core/src/env/session/search-query-parser.test.js +332 -0
- package/dist/core/src/env/session/session-checkpoint.test.d.ts +7 -0
- package/dist/core/src/env/session/session-checkpoint.test.js +455 -0
- package/dist/core/src/env/session/session-component.d.ts +290 -0
- package/dist/core/src/env/session/session-component.extract-recent-messages.test.d.ts +7 -0
- package/dist/core/src/env/session/session-component.extract-recent-messages.test.js +166 -0
- package/dist/core/src/env/session/session-component.js +981 -0
- package/dist/core/src/env/session/session-component.test.d.ts +7 -0
- package/dist/core/src/env/session/session-component.test.js +107 -0
- package/dist/core/src/env/session/session-config-registration.d.ts +19 -0
- package/dist/core/src/env/session/session-config-registration.js +47 -0
- package/dist/core/src/env/session/session-config-registration.test.d.ts +5 -0
- package/dist/core/src/env/session/session-config-registration.test.js +115 -0
- package/dist/core/src/env/session/session-message-converter.d.ts +125 -0
- package/dist/core/src/env/session/session-message-converter.js +354 -0
- package/dist/core/src/env/session/session-message-converter.test.d.ts +8 -0
- package/dist/core/src/env/session/session-message-converter.test.js +623 -0
- package/dist/core/src/env/session/session-message-e2e.test.d.ts +8 -0
- package/dist/core/src/env/session/session-message-e2e.test.js +376 -0
- package/dist/core/src/env/session/session-search.test.d.ts +7 -0
- package/dist/core/src/env/session/session-search.test.js +338 -0
- package/dist/core/src/env/session/session-store.d.ts +103 -0
- package/dist/core/src/env/session/session-store.js +5 -0
- package/dist/core/src/env/session/session-store.test.d.ts +2 -0
- package/dist/core/src/env/session/session-store.test.js +291 -0
- package/dist/core/src/env/session/storage/index.d.ts +6 -0
- package/dist/core/src/env/session/storage/index.js +6 -0
- package/dist/core/src/env/session/storage/memory.d.ts +44 -0
- package/dist/core/src/env/session/storage/memory.js +404 -0
- package/dist/core/src/env/session/storage/sqlite.d.ts +64 -0
- package/dist/core/src/env/session/storage/sqlite.js +616 -0
- package/dist/core/src/env/session/types.d.ts +613 -0
- package/dist/core/src/env/session/types.js +32 -0
- package/dist/core/src/env/skill/config.d.ts +14 -0
- package/dist/core/src/env/skill/config.js +36 -0
- package/dist/core/src/env/skill/index.d.ts +7 -0
- package/dist/core/src/env/skill/index.js +7 -0
- package/dist/core/src/env/skill/parser.d.ts +10 -0
- package/dist/core/src/env/skill/parser.js +64 -0
- package/dist/core/src/env/skill/parser.test.d.ts +2 -0
- package/dist/core/src/env/skill/parser.test.js +92 -0
- package/dist/core/src/env/skill/scanner.d.ts +26 -0
- package/dist/core/src/env/skill/scanner.js +98 -0
- package/dist/core/src/env/skill/scanner.test.d.ts +2 -0
- package/dist/core/src/env/skill/scanner.test.js +166 -0
- package/dist/core/src/env/skill/skill-component.d.ts +90 -0
- package/dist/core/src/env/skill/skill-component.js +266 -0
- package/dist/core/src/env/skill/skill-component.test.d.ts +2 -0
- package/dist/core/src/env/skill/skill-component.test.js +187 -0
- package/dist/core/src/env/skill/skill-config-registration.d.ts +19 -0
- package/dist/core/src/env/skill/skill-config-registration.js +38 -0
- package/dist/core/src/env/skill/skill-config-registration.test.d.ts +5 -0
- package/dist/core/src/env/skill/skill-config-registration.test.js +44 -0
- package/dist/core/src/env/skill/tool/index.d.ts +2 -0
- package/dist/core/src/env/skill/tool/index.js +2 -0
- package/dist/core/src/env/skill/tool/skill-tool.d.ts +16 -0
- package/dist/core/src/env/skill/tool/skill-tool.js +64 -0
- package/dist/core/src/env/skill/tool/skill-tool.test.d.ts +2 -0
- package/dist/core/src/env/skill/tool/skill-tool.test.js +77 -0
- package/dist/core/src/env/skill/types.d.ts +62 -0
- package/dist/core/src/env/skill/types.js +8 -0
- package/dist/core/src/env/task/delegate/delegate-tool.d.ts +141 -0
- package/dist/core/src/env/task/delegate/delegate-tool.js +767 -0
- package/dist/core/src/env/task/delegate/delegate-tool.test.d.ts +7 -0
- package/dist/core/src/env/task/delegate/delegate-tool.test.js +386 -0
- package/dist/core/src/env/task/delegate/index.d.ts +9 -0
- package/dist/core/src/env/task/delegate/index.js +8 -0
- package/dist/core/src/env/task/delegate/stop-tool.d.ts +13 -0
- package/dist/core/src/env/task/delegate/stop-tool.js +108 -0
- package/dist/core/src/env/task/delegate/stop-tool.test.d.ts +7 -0
- package/dist/core/src/env/task/delegate/stop-tool.test.js +103 -0
- package/dist/core/src/env/task/delegate/task-events.d.ts +81 -0
- package/dist/core/src/env/task/delegate/task-events.js +67 -0
- package/dist/core/src/env/task/delegate/task-events.test.d.ts +5 -0
- package/dist/core/src/env/task/delegate/task-events.test.js +149 -0
- package/dist/core/src/env/task/hooks/contexts.d.ts +165 -0
- package/dist/core/src/env/task/hooks/contexts.js +5 -0
- package/dist/core/src/env/task/hooks/contexts.test.d.ts +5 -0
- package/dist/core/src/env/task/hooks/contexts.test.js +73 -0
- package/dist/core/src/env/task/hooks/index.d.ts +8 -0
- package/dist/core/src/env/task/hooks/index.js +8 -0
- package/dist/core/src/env/task/hooks/task-hook-points.d.ts +32 -0
- package/dist/core/src/env/task/hooks/task-hook-points.js +37 -0
- package/dist/core/src/env/task/hooks/task-hook-points.test.d.ts +5 -0
- package/dist/core/src/env/task/hooks/task-hook-points.test.js +28 -0
- package/dist/core/src/env/task/index.d.ts +7 -0
- package/dist/core/src/env/task/index.js +7 -0
- package/dist/core/src/env/task/plugins/index.d.ts +7 -0
- package/dist/core/src/env/task/plugins/index.js +7 -0
- package/dist/core/src/env/task/plugins/task-plugin.d.ts +67 -0
- package/dist/core/src/env/task/plugins/task-plugin.js +40 -0
- package/dist/core/src/env/task/plugins/task-plugin.test.d.ts +5 -0
- package/dist/core/src/env/task/plugins/task-plugin.test.js +60 -0
- package/dist/core/src/env/task/plugins/task-tag-plugin.d.ts +79 -0
- package/dist/core/src/env/task/plugins/task-tag-plugin.js +250 -0
- package/dist/core/src/env/task/plugins/task-tag-plugin.test.d.ts +9 -0
- package/dist/core/src/env/task/plugins/task-tag-plugin.test.js +310 -0
- package/dist/core/src/env/task/plugins/task-workflow-extractor.integration.test.d.ts +5 -0
- package/dist/core/src/env/task/plugins/task-workflow-extractor.integration.test.js +198 -0
- package/dist/core/src/env/task/plugins/workflow-extractor-agent.d.ts +36 -0
- package/dist/core/src/env/task/plugins/workflow-extractor-agent.js +197 -0
- package/dist/core/src/env/task/plugins/workflow-extractor-agent.test.d.ts +8 -0
- package/dist/core/src/env/task/plugins/workflow-extractor-agent.test.js +88 -0
- package/dist/core/src/env/task/storage/index.d.ts +6 -0
- package/dist/core/src/env/task/storage/index.js +6 -0
- package/dist/core/src/env/task/storage/sqlite-task-store.d.ts +127 -0
- package/dist/core/src/env/task/storage/sqlite-task-store.js +718 -0
- package/dist/core/src/env/task/storage/sqlite-task-store.test.d.ts +5 -0
- package/dist/core/src/env/task/storage/sqlite-task-store.test.js +235 -0
- package/dist/core/src/env/task/storage/task-search.test.d.ts +5 -0
- package/dist/core/src/env/task/storage/task-search.test.js +236 -0
- package/dist/core/src/env/task/tag-service.d.ts +139 -0
- package/dist/core/src/env/task/tag-service.js +123 -0
- package/dist/core/src/env/task/tag-service.test.d.ts +5 -0
- package/dist/core/src/env/task/tag-service.test.js +157 -0
- package/dist/core/src/env/task/task-component.d.ts +171 -0
- package/dist/core/src/env/task/task-component.js +519 -0
- package/dist/core/src/env/task/task-component.test.d.ts +5 -0
- package/dist/core/src/env/task/task-component.test.js +163 -0
- package/dist/core/src/env/task/task-config-registration.d.ts +20 -0
- package/dist/core/src/env/task/task-config-registration.js +32 -0
- package/dist/core/src/env/task/task-config-registration.test.d.ts +5 -0
- package/dist/core/src/env/task/task-config-registration.test.js +43 -0
- package/dist/core/src/env/task/task-types.test.d.ts +5 -0
- package/dist/core/src/env/task/task-types.test.js +117 -0
- package/dist/core/src/env/task/tools/complete-tool.d.ts +7 -0
- package/dist/core/src/env/task/tools/complete-tool.js +40 -0
- package/dist/core/src/env/task/tools/create-tool.d.ts +7 -0
- package/dist/core/src/env/task/tools/create-tool.js +45 -0
- package/dist/core/src/env/task/tools/delete-tool.d.ts +7 -0
- package/dist/core/src/env/task/tools/delete-tool.js +39 -0
- package/dist/core/src/env/task/tools/get-tool.d.ts +7 -0
- package/dist/core/src/env/task/tools/get-tool.js +57 -0
- package/dist/core/src/env/task/tools/index.d.ts +10 -0
- package/dist/core/src/env/task/tools/index.js +10 -0
- package/dist/core/src/env/task/tools/list-tool.d.ts +7 -0
- package/dist/core/src/env/task/tools/list-tool.js +36 -0
- package/dist/core/src/env/task/tools/operation/create-tool.d.ts +7 -0
- package/dist/core/src/env/task/tools/operation/create-tool.js +44 -0
- package/dist/core/src/env/task/tools/operation/delete-tool.d.ts +7 -0
- package/dist/core/src/env/task/tools/operation/delete-tool.js +39 -0
- package/dist/core/src/env/task/tools/operation/get-tool.d.ts +7 -0
- package/dist/core/src/env/task/tools/operation/get-tool.js +39 -0
- package/dist/core/src/env/task/tools/operation/index.d.ts +9 -0
- package/dist/core/src/env/task/tools/operation/index.js +9 -0
- package/dist/core/src/env/task/tools/operation/list-tool.d.ts +7 -0
- package/dist/core/src/env/task/tools/operation/list-tool.js +36 -0
- package/dist/core/src/env/task/tools/operation/operation-tools.test.d.ts +5 -0
- package/dist/core/src/env/task/tools/operation/operation-tools.test.js +159 -0
- package/dist/core/src/env/task/tools/operation/operation-types.d.ts +92 -0
- package/dist/core/src/env/task/tools/operation/operation-types.js +58 -0
- package/dist/core/src/env/task/tools/operation/update-tool.d.ts +7 -0
- package/dist/core/src/env/task/tools/operation/update-tool.js +42 -0
- package/dist/core/src/env/task/tools/task-tools.test.d.ts +5 -0
- package/dist/core/src/env/task/tools/task-tools.test.js +142 -0
- package/dist/core/src/env/task/tools/task-types.d.ts +114 -0
- package/dist/core/src/env/task/tools/task-types.js +53 -0
- package/dist/core/src/env/task/tools/task-types.test.d.ts +5 -0
- package/dist/core/src/env/task/tools/task-types.test.js +63 -0
- package/dist/core/src/env/task/tools/update-tool.d.ts +7 -0
- package/dist/core/src/env/task/tools/update-tool.js +64 -0
- package/dist/core/src/env/task/types.d.ts +129 -0
- package/dist/core/src/env/task/types.js +39 -0
- package/dist/core/src/env/tool/built-in/bash.d.ts +11 -0
- package/dist/core/src/env/tool/built-in/bash.js +182 -0
- package/dist/core/src/env/tool/built-in/echo.d.ts +8 -0
- package/dist/core/src/env/tool/built-in/echo.js +27 -0
- package/dist/core/src/env/tool/built-in/edit-file.d.ts +7 -0
- package/dist/core/src/env/tool/built-in/edit-file.js +86 -0
- package/dist/core/src/env/tool/built-in/edit-file.test.d.ts +2 -0
- package/dist/core/src/env/tool/built-in/edit-file.test.js +84 -0
- package/dist/core/src/env/tool/built-in/glob.d.ts +7 -0
- package/dist/core/src/env/tool/built-in/glob.js +60 -0
- package/dist/core/src/env/tool/built-in/glob.test.d.ts +2 -0
- package/dist/core/src/env/tool/built-in/glob.test.js +61 -0
- package/dist/core/src/env/tool/built-in/grep.d.ts +7 -0
- package/dist/core/src/env/tool/built-in/grep.js +96 -0
- package/dist/core/src/env/tool/built-in/grep.test.d.ts +2 -0
- package/dist/core/src/env/tool/built-in/grep.test.js +74 -0
- package/dist/core/src/env/tool/built-in/index.d.ts +28 -0
- package/dist/core/src/env/tool/built-in/index.js +41 -0
- package/dist/core/src/env/tool/built-in/read-file.d.ts +6 -0
- package/dist/core/src/env/tool/built-in/read-file.js +73 -0
- package/dist/core/src/env/tool/built-in/read-file.test.d.ts +2 -0
- package/dist/core/src/env/tool/built-in/read-file.test.js +63 -0
- package/dist/core/src/env/tool/built-in/write-file.d.ts +6 -0
- package/dist/core/src/env/tool/built-in/write-file.js +65 -0
- package/dist/core/src/env/tool/built-in/write-file.test.d.ts +2 -0
- package/dist/core/src/env/tool/built-in/write-file.test.js +74 -0
- package/dist/core/src/env/tool/index.d.ts +14 -0
- package/dist/core/src/env/tool/index.js +19 -0
- package/dist/core/src/env/tool/registry.d.ts +62 -0
- package/dist/core/src/env/tool/registry.js +137 -0
- package/dist/core/src/env/tool/registry.test.d.ts +2 -0
- package/dist/core/src/env/tool/registry.test.js +219 -0
- package/dist/core/src/env/tool/tool-component.d.ts +160 -0
- package/dist/core/src/env/tool/tool-component.js +411 -0
- package/dist/core/src/env/tool/tool-component.test.d.ts +2 -0
- package/dist/core/src/env/tool/tool-component.test.js +461 -0
- package/dist/core/src/env/tool/tool-config-registration.d.ts +19 -0
- package/dist/core/src/env/tool/tool-config-registration.js +41 -0
- package/dist/core/src/env/tool/tool-config-registration.test.d.ts +7 -0
- package/dist/core/src/env/tool/tool-config-registration.test.js +202 -0
- package/dist/core/src/env/tool/types.d.ts +226 -0
- package/dist/core/src/env/tool/types.js +2 -0
- package/dist/core/src/env/tool/validator.d.ts +15 -0
- package/dist/core/src/env/tool/validator.js +43 -0
- package/dist/core/src/env/tool/validator.test.d.ts +2 -0
- package/dist/core/src/env/tool/validator.test.js +102 -0
- package/dist/core/src/env/types.d.ts +154 -0
- package/dist/core/src/env/types.js +9 -0
- package/dist/core/src/env/workflow/ask-user-tool-registration.test.d.ts +13 -0
- package/dist/core/src/env/workflow/ask-user-tool-registration.test.js +185 -0
- package/dist/core/src/env/workflow/complex-workflow.integration.test.d.ts +14 -0
- package/dist/core/src/env/workflow/complex-workflow.integration.test.js +1588 -0
- package/dist/core/src/env/workflow/decorators/decorator-node.d.ts +77 -0
- package/dist/core/src/env/workflow/decorators/decorator-node.js +176 -0
- package/dist/core/src/env/workflow/decorators/decorator.test.d.ts +5 -0
- package/dist/core/src/env/workflow/decorators/decorator.test.js +212 -0
- package/dist/core/src/env/workflow/decorators/edge.d.ts +43 -0
- package/dist/core/src/env/workflow/decorators/edge.js +68 -0
- package/dist/core/src/env/workflow/decorators/index.d.ts +14 -0
- package/dist/core/src/env/workflow/decorators/index.js +15 -0
- package/dist/core/src/env/workflow/decorators/node-as.d.ts +41 -0
- package/dist/core/src/env/workflow/decorators/node-as.js +85 -0
- package/dist/core/src/env/workflow/decorators/workflow.d.ts +31 -0
- package/dist/core/src/env/workflow/decorators/workflow.js +49 -0
- package/dist/core/src/env/workflow/engine/dag-manager.d.ts +129 -0
- package/dist/core/src/env/workflow/engine/dag-manager.js +471 -0
- package/dist/core/src/env/workflow/engine/dag-manager.test.d.ts +2 -0
- package/dist/core/src/env/workflow/engine/dag-manager.test.js +488 -0
- package/dist/core/src/env/workflow/engine/engine.d.ts +218 -0
- package/dist/core/src/env/workflow/engine/engine.js +1122 -0
- package/dist/core/src/env/workflow/engine/event-bus.d.ts +55 -0
- package/dist/core/src/env/workflow/engine/event-bus.js +137 -0
- package/dist/core/src/env/workflow/engine/event-bus.test.d.ts +2 -0
- package/dist/core/src/env/workflow/engine/event-bus.test.js +274 -0
- package/dist/core/src/env/workflow/engine/executor-agent-session.test.d.ts +2 -0
- package/dist/core/src/env/workflow/engine/executor-agent-session.test.js +46 -0
- package/dist/core/src/env/workflow/engine/executor.d.ts +106 -0
- package/dist/core/src/env/workflow/engine/executor.js +458 -0
- package/dist/core/src/env/workflow/engine/executor.test.d.ts +11 -0
- package/dist/core/src/env/workflow/engine/executor.test.js +274 -0
- package/dist/core/src/env/workflow/engine/index.d.ts +16 -0
- package/dist/core/src/env/workflow/engine/index.js +10 -0
- package/dist/core/src/env/workflow/engine/node-registry.d.ts +160 -0
- package/dist/core/src/env/workflow/engine/node-registry.js +195 -0
- package/dist/core/src/env/workflow/engine/node-registry.test.d.ts +8 -0
- package/dist/core/src/env/workflow/engine/node-registry.test.js +439 -0
- package/dist/core/src/env/workflow/engine/resume-removed.test.d.ts +2 -0
- package/dist/core/src/env/workflow/engine/resume-removed.test.js +19 -0
- package/dist/core/src/env/workflow/engine/scheduler.d.ts +133 -0
- package/dist/core/src/env/workflow/engine/scheduler.js +253 -0
- package/dist/core/src/env/workflow/engine/scheduler.test.d.ts +2 -0
- package/dist/core/src/env/workflow/engine/scheduler.test.js +575 -0
- package/dist/core/src/env/workflow/engine/workflow-engine.test.d.ts +11 -0
- package/dist/core/src/env/workflow/engine/workflow-engine.test.js +640 -0
- package/dist/core/src/env/workflow/extractor/workflow-converter.d.ts +56 -0
- package/dist/core/src/env/workflow/extractor/workflow-converter.js +252 -0
- package/dist/core/src/env/workflow/fixtures.d.ts +402 -0
- package/dist/core/src/env/workflow/fixtures.js +369 -0
- package/dist/core/src/env/workflow/index.d.ts +31 -0
- package/dist/core/src/env/workflow/index.js +35 -0
- package/dist/core/src/env/workflow/integration/run-resume-unified.test.d.ts +2 -0
- package/dist/core/src/env/workflow/integration/run-resume-unified.test.js +161 -0
- package/dist/core/src/env/workflow/integration/service-integration.test.d.ts +8 -0
- package/dist/core/src/env/workflow/integration/service-integration.test.js +223 -0
- package/dist/core/src/env/workflow/metadata/keys.d.ts +7 -0
- package/dist/core/src/env/workflow/metadata/keys.js +10 -0
- package/dist/core/src/env/workflow/nodes/agent-component-adapter.d.ts +163 -0
- package/dist/core/src/env/workflow/nodes/agent-component-adapter.js +333 -0
- package/dist/core/src/env/workflow/nodes/agent-component-adapter.test.d.ts +2 -0
- package/dist/core/src/env/workflow/nodes/agent-component-adapter.test.js +257 -0
- package/dist/core/src/env/workflow/nodes/agent-node.d.ts +217 -0
- package/dist/core/src/env/workflow/nodes/agent-node.js +419 -0
- package/dist/core/src/env/workflow/nodes/agent-node.test.d.ts +13 -0
- package/dist/core/src/env/workflow/nodes/agent-node.test.js +296 -0
- package/dist/core/src/env/workflow/nodes/ask-user-node.d.ts +69 -0
- package/dist/core/src/env/workflow/nodes/ask-user-node.js +67 -0
- package/dist/core/src/env/workflow/nodes/condition-node.d.ts +48 -0
- package/dist/core/src/env/workflow/nodes/condition-node.js +185 -0
- package/dist/core/src/env/workflow/nodes/index.d.ts +7 -0
- package/dist/core/src/env/workflow/nodes/index.js +5 -0
- package/dist/core/src/env/workflow/nodes/merge-node.d.ts +41 -0
- package/dist/core/src/env/workflow/nodes/merge-node.js +126 -0
- package/dist/core/src/env/workflow/nodes/skill-node.d.ts +118 -0
- package/dist/core/src/env/workflow/nodes/skill-node.js +322 -0
- package/dist/core/src/env/workflow/nodes/skill-node.test.d.ts +2 -0
- package/dist/core/src/env/workflow/nodes/skill-node.test.js +189 -0
- package/dist/core/src/env/workflow/nodes/tool-node.d.ts +121 -0
- package/dist/core/src/env/workflow/nodes/tool-node.js +415 -0
- package/dist/core/src/env/workflow/nodes/tool-node.test.d.ts +2 -0
- package/dist/core/src/env/workflow/nodes/tool-node.test.js +181 -0
- package/dist/core/src/env/workflow/nodes/workflow-llm-history.test.d.ts +7 -0
- package/dist/core/src/env/workflow/nodes/workflow-llm-history.test.js +377 -0
- package/dist/core/src/env/workflow/nodes/workflow-node.d.ts +119 -0
- package/dist/core/src/env/workflow/nodes/workflow-node.js +215 -0
- package/dist/core/src/env/workflow/nodes/workflow-node.test.d.ts +2 -0
- package/dist/core/src/env/workflow/nodes/workflow-node.test.js +255 -0
- package/dist/core/src/env/workflow/service/index.d.ts +10 -0
- package/dist/core/src/env/workflow/service/index.js +8 -0
- package/dist/core/src/env/workflow/service/registry.d.ts +38 -0
- package/dist/core/src/env/workflow/service/registry.js +58 -0
- package/dist/core/src/env/workflow/service/registry.test.d.ts +5 -0
- package/dist/core/src/env/workflow/service/registry.test.js +90 -0
- package/dist/core/src/env/workflow/service/workflow-service.d.ts +162 -0
- package/dist/core/src/env/workflow/service/workflow-service.js +244 -0
- package/dist/core/src/env/workflow/service/workflow-service.test.d.ts +5 -0
- package/dist/core/src/env/workflow/service/workflow-service.test.js +228 -0
- package/dist/core/src/env/workflow/storage/index.d.ts +11 -0
- package/dist/core/src/env/workflow/storage/index.js +13 -0
- package/dist/core/src/env/workflow/storage/mock-repositories.d.ts +89 -0
- package/dist/core/src/env/workflow/storage/mock-repositories.js +286 -0
- package/dist/core/src/env/workflow/storage/sqlite.d.ts +56 -0
- package/dist/core/src/env/workflow/storage/sqlite.js +135 -0
- package/dist/core/src/env/workflow/storage/sqlite.test.d.ts +2 -0
- package/dist/core/src/env/workflow/storage/sqlite.test.js +152 -0
- package/dist/core/src/env/workflow/storage/workflow-repo.d.ts +108 -0
- package/dist/core/src/env/workflow/storage/workflow-repo.js +252 -0
- package/dist/core/src/env/workflow/storage/workflow-repo.test.d.ts +2 -0
- package/dist/core/src/env/workflow/storage/workflow-repo.test.js +447 -0
- package/dist/core/src/env/workflow/tools/ask-user-tool.d.ts +36 -0
- package/dist/core/src/env/workflow/tools/ask-user-tool.js +50 -0
- package/dist/core/src/env/workflow/tools/index.d.ts +8 -0
- package/dist/core/src/env/workflow/tools/index.js +10 -0
- package/dist/core/src/env/workflow/tools/run-workflow.d.ts +61 -0
- package/dist/core/src/env/workflow/tools/run-workflow.js +180 -0
- package/dist/core/src/env/workflow/tools/run-workflow.test.d.ts +5 -0
- package/dist/core/src/env/workflow/tools/run-workflow.test.js +235 -0
- package/dist/core/src/env/workflow/types/context.d.ts +18 -0
- package/dist/core/src/env/workflow/types/context.js +2 -0
- package/dist/core/src/env/workflow/types/decorators-types.d.ts +178 -0
- package/dist/core/src/env/workflow/types/decorators-types.js +9 -0
- package/dist/core/src/env/workflow/types/event.d.ts +864 -0
- package/dist/core/src/env/workflow/types/event.js +154 -0
- package/dist/core/src/env/workflow/types/event.test.d.ts +2 -0
- package/dist/core/src/env/workflow/types/event.test.js +484 -0
- package/dist/core/src/env/workflow/types/index.d.ts +14 -0
- package/dist/core/src/env/workflow/types/index.js +10 -0
- package/dist/core/src/env/workflow/types/run.d.ts +123 -0
- package/dist/core/src/env/workflow/types/run.js +23 -0
- package/dist/core/src/env/workflow/types/run.test.d.ts +2 -0
- package/dist/core/src/env/workflow/types/run.test.js +381 -0
- package/dist/core/src/env/workflow/types/workflow-hil.d.ts +58 -0
- package/dist/core/src/env/workflow/types/workflow-hil.js +76 -0
- package/dist/core/src/env/workflow/types/workflow-message.d.ts +139 -0
- package/dist/core/src/env/workflow/types/workflow-message.js +15 -0
- package/dist/core/src/env/workflow/types/workflow-message.test.d.ts +2 -0
- package/dist/core/src/env/workflow/types/workflow-message.test.js +87 -0
- package/dist/core/src/env/workflow/types/workflow-session.d.ts +18 -0
- package/dist/core/src/env/workflow/types/workflow-session.js +41 -0
- package/dist/core/src/env/workflow/types/workflow-session.test.d.ts +2 -0
- package/dist/core/src/env/workflow/types/workflow-session.test.js +80 -0
- package/dist/core/src/env/workflow/types/workflow.d.ts +387 -0
- package/dist/core/src/env/workflow/types/workflow.js +124 -0
- package/dist/core/src/env/workflow/types/workflow.test.d.ts +2 -0
- package/dist/core/src/env/workflow/types/workflow.test.js +455 -0
- package/dist/core/src/env/workflow/types_compat.d.ts +11 -0
- package/dist/core/src/env/workflow/types_compat.js +8 -0
- package/dist/core/src/env/workflow/utils/create-workflow.d.ts +36 -0
- package/dist/core/src/env/workflow/utils/create-workflow.js +36 -0
- package/dist/core/src/env/workflow/utils/execution-state.d.ts +47 -0
- package/dist/core/src/env/workflow/utils/execution-state.js +228 -0
- package/dist/core/src/env/workflow/utils/index.d.ts +9 -0
- package/dist/core/src/env/workflow/utils/index.js +9 -0
- package/dist/core/src/env/workflow/utils/node-registry-helper.d.ts +37 -0
- package/dist/core/src/env/workflow/utils/node-registry-helper.js +48 -0
- package/dist/core/src/env/workflow/utils/recovery-validator.d.ts +31 -0
- package/dist/core/src/env/workflow/utils/recovery-validator.js +325 -0
- package/dist/core/src/env/workflow/utils/recovery-validator.test.d.ts +2 -0
- package/dist/core/src/env/workflow/utils/recovery-validator.test.js +401 -0
- package/dist/core/src/env/workflow/utils/session-parser.d.ts +22 -0
- package/dist/core/src/env/workflow/utils/session-parser.js +72 -0
- package/dist/core/src/env/workflow/utils/session-parser.test.d.ts +2 -0
- package/dist/core/src/env/workflow/utils/session-parser.test.js +89 -0
- package/dist/core/src/env/workflow/utils/session-recovery.d.ts +62 -0
- package/dist/core/src/env/workflow/utils/session-recovery.js +138 -0
- package/dist/core/src/env/workflow/utils/session-recovery.test.d.ts +2 -0
- package/dist/core/src/env/workflow/utils/session-recovery.test.js +263 -0
- package/dist/core/src/env/workflow/utils/template-resolver.d.ts +161 -0
- package/dist/core/src/env/workflow/utils/template-resolver.js +359 -0
- package/dist/core/src/env/workflow/utils/template-resolver.test.d.ts +2 -0
- package/dist/core/src/env/workflow/utils/template-resolver.test.js +216 -0
- package/dist/core/src/env/workflow/utils/validation-rules.d.ts +104 -0
- package/dist/core/src/env/workflow/utils/validation-rules.js +44 -0
- package/dist/core/src/env/workflow/workflow-component.d.ts +135 -0
- package/dist/core/src/env/workflow/workflow-component.js +376 -0
- package/dist/core/src/index.d.ts +54 -0
- package/dist/core/src/index.js +66 -0
- package/dist/core/src/utils/id.d.ts +12 -0
- package/dist/core/src/utils/id.js +20 -0
- package/dist/roy-agent-darwin-arm64/bin/roy.js +4 -3
- package/dist/roy-agent-darwin-x64/bin/roy.js +4 -3
- package/dist/roy-agent-linux-arm64/bin/roy.js +4 -3
- package/dist/roy-agent-linux-x64/bin/roy.js +4 -3
- package/dist/roy-agent-windows-x64/bin/roy.js +4 -3
- package/package.json +3 -2
|
@@ -0,0 +1,1169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview AgentComponent Tests
|
|
3
|
+
*
|
|
4
|
+
* 使用 TDD 方法测试 AgentComponent
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect, vi, beforeEach, afterEach, test } from "vitest";
|
|
7
|
+
import { AgentComponent } from "./agent-component.js";
|
|
8
|
+
import { ConfigComponent } from "../../config/config-component.js";
|
|
9
|
+
import * as fsSync from "fs";
|
|
10
|
+
import * as path from "path";
|
|
11
|
+
import * as os from "os";
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Mock Environment
|
|
14
|
+
// ============================================================================
|
|
15
|
+
function createMockEnvironment() {
|
|
16
|
+
return {
|
|
17
|
+
name: "test-env",
|
|
18
|
+
version: "1.0.0",
|
|
19
|
+
getConfig: vi.fn(() => ({ name: "test-env", version: "1.0.0", enabled: true })),
|
|
20
|
+
registerComponent: vi.fn(),
|
|
21
|
+
unregisterComponent: vi.fn(),
|
|
22
|
+
getComponent: vi.fn(),
|
|
23
|
+
listComponents: vi.fn(() => []),
|
|
24
|
+
handle_query: vi.fn(),
|
|
25
|
+
handle_action: vi.fn(),
|
|
26
|
+
subscribe: vi.fn(() => () => { }),
|
|
27
|
+
subscribeTo: vi.fn(() => () => { }),
|
|
28
|
+
subscribeAll: vi.fn(() => () => { }),
|
|
29
|
+
pushEnvEvent: vi.fn(),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// Tests
|
|
34
|
+
// ============================================================================
|
|
35
|
+
describe("AgentComponent", () => {
|
|
36
|
+
let agentComponent;
|
|
37
|
+
let mockEnv;
|
|
38
|
+
let configComponent;
|
|
39
|
+
beforeEach(() => {
|
|
40
|
+
vi.clearAllMocks();
|
|
41
|
+
agentComponent = new AgentComponent();
|
|
42
|
+
configComponent = new ConfigComponent();
|
|
43
|
+
// Create mockEnv with configComponent
|
|
44
|
+
mockEnv = {
|
|
45
|
+
name: "test-env",
|
|
46
|
+
version: "1.0.0",
|
|
47
|
+
getConfig: vi.fn(() => ({ name: "test-env", version: "1.0.0", enabled: true })),
|
|
48
|
+
registerComponent: vi.fn(),
|
|
49
|
+
unregisterComponent: vi.fn(),
|
|
50
|
+
getComponent: vi.fn((name) => {
|
|
51
|
+
if (name === "config")
|
|
52
|
+
return configComponent;
|
|
53
|
+
return undefined;
|
|
54
|
+
}),
|
|
55
|
+
hasComponent: vi.fn((name) => name === "config"),
|
|
56
|
+
listComponents: vi.fn(() => []),
|
|
57
|
+
handle_query: vi.fn(),
|
|
58
|
+
handle_action: vi.fn(),
|
|
59
|
+
subscribe: vi.fn(() => () => { }),
|
|
60
|
+
subscribeTo: vi.fn(() => () => { }),
|
|
61
|
+
subscribeAll: vi.fn(() => () => { }),
|
|
62
|
+
pushEnvEvent: vi.fn(),
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
afterEach(() => {
|
|
66
|
+
// Clean up environment variables
|
|
67
|
+
delete process.env.AGENT_AGENT_DEFAULT_AGENT_MAX_ITERATIONS;
|
|
68
|
+
});
|
|
69
|
+
describe("constructor and initialization", () => {
|
|
70
|
+
it("should create AgentComponent instance", () => {
|
|
71
|
+
expect(agentComponent).toBeDefined();
|
|
72
|
+
expect(agentComponent.name).toBe("agent");
|
|
73
|
+
expect(agentComponent.version).toBe("1.0.0");
|
|
74
|
+
});
|
|
75
|
+
it("should initialize with default config", async () => {
|
|
76
|
+
await agentComponent.init({ env: mockEnv, options: { configComponent } });
|
|
77
|
+
expect(agentComponent.getStatus()).toBe("running");
|
|
78
|
+
});
|
|
79
|
+
it("should init with env (env is optional)", async () => {
|
|
80
|
+
// env is optional, but configComponent is required
|
|
81
|
+
const component = new AgentComponent();
|
|
82
|
+
await expect(component.init({ env: mockEnv, options: { configComponent } })).resolves.toBeUndefined();
|
|
83
|
+
expect(component.getStatus()).toBe("running");
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
describe("Agent registration", () => {
|
|
87
|
+
beforeEach(async () => {
|
|
88
|
+
await agentComponent.init({ env: mockEnv, options: { configComponent } });
|
|
89
|
+
});
|
|
90
|
+
it("should register a new agent", () => {
|
|
91
|
+
const agent = agentComponent.registerAgent("test-agent", {
|
|
92
|
+
type: "primary",
|
|
93
|
+
systemPrompt: "You are a helpful assistant.",
|
|
94
|
+
});
|
|
95
|
+
expect(agent).toBeDefined();
|
|
96
|
+
expect(agent.name).toBe("test-agent");
|
|
97
|
+
expect(agent.config.type).toBe("primary");
|
|
98
|
+
});
|
|
99
|
+
it("should get registered agent", () => {
|
|
100
|
+
agentComponent.registerAgent("test-agent", { type: "primary" });
|
|
101
|
+
const agent = agentComponent.getAgent("test-agent");
|
|
102
|
+
expect(agent).toBeDefined();
|
|
103
|
+
expect(agent.name).toBe("test-agent");
|
|
104
|
+
});
|
|
105
|
+
it("should return undefined for non-existent agent", () => {
|
|
106
|
+
const agent = agentComponent.getAgent("non-existent");
|
|
107
|
+
expect(agent).toBeUndefined();
|
|
108
|
+
});
|
|
109
|
+
it("should list all agents", () => {
|
|
110
|
+
agentComponent.registerAgent("agent1", { type: "primary" });
|
|
111
|
+
agentComponent.registerAgent("agent2", { type: "sub" });
|
|
112
|
+
const agents = agentComponent.listAgents();
|
|
113
|
+
expect(agents).toHaveLength(2);
|
|
114
|
+
});
|
|
115
|
+
it("should unregister agent", () => {
|
|
116
|
+
agentComponent.registerAgent("test-agent", { type: "primary" });
|
|
117
|
+
const deleted = agentComponent.unregisterAgent("test-agent");
|
|
118
|
+
expect(deleted).toBe(true);
|
|
119
|
+
expect(agentComponent.getAgent("test-agent")).toBeUndefined();
|
|
120
|
+
});
|
|
121
|
+
it("should return false when unregistering non-existent agent", () => {
|
|
122
|
+
const deleted = agentComponent.unregisterAgent("non-existent");
|
|
123
|
+
expect(deleted).toBe(false);
|
|
124
|
+
});
|
|
125
|
+
it("should use passed config over defaultAgent (PromptComponent priority)", async () => {
|
|
126
|
+
// 模拟 ConfigComponent 中有 systemPrompt 配置
|
|
127
|
+
const configWithPrompt = new ConfigComponent();
|
|
128
|
+
await configWithPrompt.set("agent.defaultAgent.systemPrompt", "From ConfigComponent");
|
|
129
|
+
await configWithPrompt.set("agent.defaultAgent.maxIterations", 50);
|
|
130
|
+
// 通过构造函数传入 config,模拟从配置文件加载的配置
|
|
131
|
+
agentComponent = new AgentComponent({
|
|
132
|
+
config: {
|
|
133
|
+
defaultAgent: {
|
|
134
|
+
systemPrompt: "From ConfigComponent (defaultAgent)",
|
|
135
|
+
maxIterations: 50,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
await agentComponent.init({ env: mockEnv, options: { configComponent: configWithPrompt } });
|
|
140
|
+
// 模拟 environment.ts 从 PromptComponent 获取的 systemPrompt
|
|
141
|
+
const promptFromPromptComponent = "From PromptComponent";
|
|
142
|
+
// 注册 agent,传入 PromptComponent 的 systemPrompt
|
|
143
|
+
const agent = agentComponent.registerAgent("default", {
|
|
144
|
+
type: "primary",
|
|
145
|
+
systemPrompt: promptFromPromptComponent,
|
|
146
|
+
maxIterations: 100, // 传入的 maxIterations 应该覆盖 defaultAgent 的 50
|
|
147
|
+
});
|
|
148
|
+
// 验证:传入的 config (PromptComponent) 优先级最高
|
|
149
|
+
expect(agent.config.systemPrompt).toBe(promptFromPromptComponent);
|
|
150
|
+
expect(agent.config.maxIterations).toBe(100); // 传入的覆盖 defaultAgent 的 50
|
|
151
|
+
});
|
|
152
|
+
it("should fill missing config from defaultAgent", async () => {
|
|
153
|
+
// 当传入的 config 缺失某些字段时,从 defaultAgent 填充
|
|
154
|
+
// 通过构造函数传入默认值
|
|
155
|
+
agentComponent = new AgentComponent({
|
|
156
|
+
config: {
|
|
157
|
+
defaultAgent: {
|
|
158
|
+
systemPrompt: "Default System Prompt",
|
|
159
|
+
maxIterations: 50,
|
|
160
|
+
model: "gpt-4",
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
await agentComponent.init({ env: mockEnv, options: { configComponent } });
|
|
165
|
+
// 只传入 type,其他字段缺失
|
|
166
|
+
const agent = agentComponent.registerAgent("test-agent", {
|
|
167
|
+
type: "primary",
|
|
168
|
+
});
|
|
169
|
+
// 验证:从 defaultAgent 填充缺失的字段
|
|
170
|
+
expect(agent.config.systemPrompt).toBe("Default System Prompt");
|
|
171
|
+
expect(agent.config.maxIterations).toBe(50);
|
|
172
|
+
expect(agent.config.model).toBe("gpt-4");
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
describe("Plugin registration", () => {
|
|
176
|
+
beforeEach(async () => {
|
|
177
|
+
await agentComponent.init({ env: mockEnv, options: { configComponent } });
|
|
178
|
+
});
|
|
179
|
+
it("should register plugin to agent", () => {
|
|
180
|
+
agentComponent.registerAgent("test-agent", { type: "primary" });
|
|
181
|
+
const plugin = {
|
|
182
|
+
name: "test-plugin",
|
|
183
|
+
version: "1.0.0",
|
|
184
|
+
hooks: [{ point: "agent:before.llm" }],
|
|
185
|
+
execute: vi.fn(async () => ({ continue: true })),
|
|
186
|
+
};
|
|
187
|
+
agentComponent.registerPlugin("test-agent", plugin);
|
|
188
|
+
const agent = agentComponent.getAgent("test-agent");
|
|
189
|
+
expect(agent.plugins.has("test-plugin")).toBe(true);
|
|
190
|
+
});
|
|
191
|
+
it("should throw error when registering plugin to non-existent agent", () => {
|
|
192
|
+
const plugin = {
|
|
193
|
+
name: "test-plugin",
|
|
194
|
+
version: "1.0.0",
|
|
195
|
+
hooks: [{ point: "agent:before.llm" }],
|
|
196
|
+
execute: vi.fn(),
|
|
197
|
+
};
|
|
198
|
+
expect(() => agentComponent.registerPlugin("non-existent", plugin)).toThrow();
|
|
199
|
+
});
|
|
200
|
+
it("should unregister plugin", () => {
|
|
201
|
+
agentComponent.registerAgent("test-agent", { type: "primary" });
|
|
202
|
+
const plugin = {
|
|
203
|
+
name: "test-plugin",
|
|
204
|
+
version: "1.0.0",
|
|
205
|
+
hooks: [{ point: "agent:before.llm" }],
|
|
206
|
+
execute: vi.fn(),
|
|
207
|
+
};
|
|
208
|
+
agentComponent.registerPlugin("test-agent", plugin);
|
|
209
|
+
const deleted = agentComponent.unregisterPlugin("test-agent", "test-plugin");
|
|
210
|
+
expect(deleted).toBe(true);
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
describe("abort functionality", () => {
|
|
214
|
+
beforeEach(async () => {
|
|
215
|
+
await agentComponent.init({ env: mockEnv, options: { configComponent } });
|
|
216
|
+
});
|
|
217
|
+
it("should abort running agent", async () => {
|
|
218
|
+
agentComponent.registerAgent("test-agent", { type: "primary" });
|
|
219
|
+
// Start aborting
|
|
220
|
+
agentComponent.abort("test-agent");
|
|
221
|
+
// Check abort was registered
|
|
222
|
+
// This would need integration with actual run
|
|
223
|
+
expect(true).toBe(true);
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
describe("Agent execution (run)", () => {
|
|
227
|
+
beforeEach(async () => {
|
|
228
|
+
await agentComponent.init({ env: mockEnv, options: { configComponent } });
|
|
229
|
+
});
|
|
230
|
+
it("should throw error for non-existent agent", async () => {
|
|
231
|
+
await expect(agentComponent.run("non-existent", "test query")).rejects.toThrow();
|
|
232
|
+
});
|
|
233
|
+
it("should execute agent and return result", async () => {
|
|
234
|
+
agentComponent.registerAgent("test-agent", {
|
|
235
|
+
type: "primary",
|
|
236
|
+
systemPrompt: "You are a helpful assistant.",
|
|
237
|
+
});
|
|
238
|
+
const result = await agentComponent.run("test-agent", "Say hello");
|
|
239
|
+
expect(result).toBeDefined();
|
|
240
|
+
expect(result.iterations).toBe(1);
|
|
241
|
+
expect(result.finalText).toBeDefined();
|
|
242
|
+
});
|
|
243
|
+
it("should respect maxIterations config", async () => {
|
|
244
|
+
agentComponent.registerAgent("test-agent", {
|
|
245
|
+
type: "primary",
|
|
246
|
+
maxIterations: 5,
|
|
247
|
+
});
|
|
248
|
+
// Mock LLM to always return tool calls
|
|
249
|
+
const mockLLMComponent = {
|
|
250
|
+
invoke: vi.fn(() => Promise.resolve({
|
|
251
|
+
output: {
|
|
252
|
+
content: "",
|
|
253
|
+
toolCalls: [{
|
|
254
|
+
id: "call_1",
|
|
255
|
+
function: { name: "test_tool", arguments: "{}" }
|
|
256
|
+
}]
|
|
257
|
+
}
|
|
258
|
+
}))
|
|
259
|
+
};
|
|
260
|
+
mockEnv.getComponent.mockReturnValue(mockLLMComponent);
|
|
261
|
+
const result = await agentComponent.run("test-agent", "Test max iterations");
|
|
262
|
+
expect(result.iterations).toBeLessThanOrEqual(5);
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
describe("Plugin hooks", () => {
|
|
266
|
+
beforeEach(async () => {
|
|
267
|
+
await agentComponent.init({ env: mockEnv, options: { configComponent } });
|
|
268
|
+
agentComponent.registerAgent("test-agent", { type: "primary" });
|
|
269
|
+
});
|
|
270
|
+
it("should execute before.llm hook", async () => {
|
|
271
|
+
const hookCalled = vi.fn();
|
|
272
|
+
const plugin = {
|
|
273
|
+
name: "before-llm-hook",
|
|
274
|
+
version: "1.0.0",
|
|
275
|
+
hooks: [{ point: "agent:before.llm" }],
|
|
276
|
+
execute: hookCalled,
|
|
277
|
+
};
|
|
278
|
+
agentComponent.registerPlugin("test-agent", plugin);
|
|
279
|
+
await agentComponent.run("test-agent", "Test hook");
|
|
280
|
+
expect(hookCalled).toHaveBeenCalled();
|
|
281
|
+
});
|
|
282
|
+
it("should allow hook to stop execution", async () => {
|
|
283
|
+
const plugin = {
|
|
284
|
+
name: "stopper",
|
|
285
|
+
version: "1.0.0",
|
|
286
|
+
hooks: [{ point: "agent:before.llm" }],
|
|
287
|
+
execute: vi.fn(() => Promise.resolve({ continue: false })),
|
|
288
|
+
};
|
|
289
|
+
agentComponent.registerPlugin("test-agent", plugin);
|
|
290
|
+
const result = await agentComponent.run("test-agent", "Test stop");
|
|
291
|
+
expect(result.stopped).toBe(true);
|
|
292
|
+
});
|
|
293
|
+
it("should allow hook to modify messages", async () => {
|
|
294
|
+
let capturedCtx;
|
|
295
|
+
const plugin = {
|
|
296
|
+
name: "message-modifier",
|
|
297
|
+
version: "1.0.0",
|
|
298
|
+
hooks: [{ point: "agent:before.llm" }],
|
|
299
|
+
execute: vi.fn((ctx) => {
|
|
300
|
+
capturedCtx = ctx;
|
|
301
|
+
return { continue: true };
|
|
302
|
+
}),
|
|
303
|
+
};
|
|
304
|
+
agentComponent.registerPlugin("test-agent", plugin);
|
|
305
|
+
await agentComponent.run("test-agent", "Test");
|
|
306
|
+
expect(capturedCtx.messages).toBeDefined();
|
|
307
|
+
expect(capturedCtx.messages.length).toBeGreaterThan(0);
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
describe("Multiple queries in same session", () => {
|
|
311
|
+
beforeEach(async () => {
|
|
312
|
+
await agentComponent.init({ env: mockEnv, options: { configComponent } });
|
|
313
|
+
});
|
|
314
|
+
it("should add user message for every query (not skip when session has history)", async () => {
|
|
315
|
+
// Create a mock session component that returns existing messages
|
|
316
|
+
const sessionMessages = [
|
|
317
|
+
{ role: "user", content: "first query" },
|
|
318
|
+
{ role: "assistant", content: "first response" },
|
|
319
|
+
];
|
|
320
|
+
const mockSessionComponent = {
|
|
321
|
+
addMessage: vi.fn(async () => { }),
|
|
322
|
+
getContext: vi.fn(async () => ({
|
|
323
|
+
messages: sessionMessages,
|
|
324
|
+
checkpoint: undefined,
|
|
325
|
+
})),
|
|
326
|
+
};
|
|
327
|
+
// Update mock env to return session component
|
|
328
|
+
mockEnv.getComponent.mockImplementation((name) => {
|
|
329
|
+
if (name === "session")
|
|
330
|
+
return mockSessionComponent;
|
|
331
|
+
if (name === "config")
|
|
332
|
+
return configComponent;
|
|
333
|
+
return undefined;
|
|
334
|
+
});
|
|
335
|
+
agentComponent.registerAgent("test-agent", {
|
|
336
|
+
type: "primary",
|
|
337
|
+
systemPrompt: "You are a helpful assistant.",
|
|
338
|
+
});
|
|
339
|
+
// First run - session is empty
|
|
340
|
+
const result1 = await agentComponent.run("test-agent", "first query", { sessionId: "session_1" });
|
|
341
|
+
expect(result1).toBeDefined();
|
|
342
|
+
// Verify user message was added to session
|
|
343
|
+
expect(mockSessionComponent.addMessage).toHaveBeenCalled();
|
|
344
|
+
const firstCallArgs = mockSessionComponent.addMessage.mock.calls[0];
|
|
345
|
+
expect(firstCallArgs[1].role).toBe("user");
|
|
346
|
+
expect(firstCallArgs[1].content).toBe("first query");
|
|
347
|
+
// Second run - session has history, but user message SHOULD still be added
|
|
348
|
+
const result2 = await agentComponent.run("test-agent", "second query", { sessionId: "session_1" });
|
|
349
|
+
expect(result2).toBeDefined();
|
|
350
|
+
// Key assertion: user message should be added for the second query
|
|
351
|
+
const allCalls = mockSessionComponent.addMessage.mock.calls;
|
|
352
|
+
const userMessages = allCalls
|
|
353
|
+
.filter((call) => call[1].role === "user")
|
|
354
|
+
.map((call) => call[1].content);
|
|
355
|
+
// This is the critical test - second query's user message MUST be added
|
|
356
|
+
expect(userMessages).toContain("second query");
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
describe("Tool handling", () => {
|
|
360
|
+
// Note: Tool execution is tested via executeTool method directly
|
|
361
|
+
// since mock LLM integration requires more complex setup
|
|
362
|
+
it("should have default tools available", () => {
|
|
363
|
+
const mockTool = {
|
|
364
|
+
name: "test_tool",
|
|
365
|
+
description: "A test tool",
|
|
366
|
+
execute: vi.fn(() => Promise.resolve({ success: true, output: "tool result" })),
|
|
367
|
+
};
|
|
368
|
+
agentComponent.setDefaultTools([mockTool]);
|
|
369
|
+
agentComponent.registerAgent("test-agent", { type: "primary" });
|
|
370
|
+
const agent = agentComponent.getAgent("test-agent");
|
|
371
|
+
const tools = agentComponent.getAvailableTools(agent);
|
|
372
|
+
expect(tools.find(t => t.name === "test_tool")).toBeDefined();
|
|
373
|
+
});
|
|
374
|
+
it("should filter tools by name", () => {
|
|
375
|
+
const mockTool1 = { name: "tool1", execute: vi.fn() };
|
|
376
|
+
const mockTool2 = { name: "tool2", execute: vi.fn() };
|
|
377
|
+
agentComponent.setDefaultTools([mockTool1, mockTool2]);
|
|
378
|
+
agentComponent.registerAgent("test-agent", { type: "primary" });
|
|
379
|
+
const agent = agentComponent.getAgent("test-agent");
|
|
380
|
+
const tools = agentComponent.getAvailableTools(agent);
|
|
381
|
+
expect(tools).toHaveLength(2);
|
|
382
|
+
expect(tools.map(t => t.name)).toContain("tool1");
|
|
383
|
+
expect(tools.map(t => t.name)).toContain("tool2");
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
describe("Default tools", () => {
|
|
387
|
+
beforeEach(async () => {
|
|
388
|
+
await agentComponent.init({ env: mockEnv, options: { configComponent } });
|
|
389
|
+
});
|
|
390
|
+
it("should set and get default tools", () => {
|
|
391
|
+
const tools = [
|
|
392
|
+
{ name: "tool1", execute: vi.fn() },
|
|
393
|
+
{ name: "tool2", execute: vi.fn() },
|
|
394
|
+
];
|
|
395
|
+
agentComponent.setDefaultTools(tools);
|
|
396
|
+
agentComponent.registerAgent("test-agent", { type: "primary" });
|
|
397
|
+
const agent = agentComponent.getAgent("test-agent");
|
|
398
|
+
const availableTools = agentComponent.getAvailableTools(agent);
|
|
399
|
+
expect(availableTools).toHaveLength(2);
|
|
400
|
+
});
|
|
401
|
+
it("should filter tools by allowedTools", () => {
|
|
402
|
+
agentComponent.setDefaultTools([
|
|
403
|
+
{ name: "tool1", execute: vi.fn() },
|
|
404
|
+
{ name: "tool2", execute: vi.fn() },
|
|
405
|
+
{ name: "tool3", execute: vi.fn() },
|
|
406
|
+
]);
|
|
407
|
+
agentComponent.registerAgent("test-agent", {
|
|
408
|
+
type: "primary",
|
|
409
|
+
allowedTools: ["tool1", "tool2"],
|
|
410
|
+
});
|
|
411
|
+
const agent = agentComponent.getAgent("test-agent");
|
|
412
|
+
const availableTools = agentComponent.getAvailableTools(agent);
|
|
413
|
+
expect(availableTools).toHaveLength(2);
|
|
414
|
+
expect(availableTools.every(t => ["tool1", "tool2"].includes(t.name))).toBe(true);
|
|
415
|
+
});
|
|
416
|
+
it("should filter tools by deniedTools", () => {
|
|
417
|
+
agentComponent.setDefaultTools([
|
|
418
|
+
{ name: "tool1", execute: vi.fn() },
|
|
419
|
+
{ name: "tool2", execute: vi.fn() },
|
|
420
|
+
{ name: "tool3", execute: vi.fn() },
|
|
421
|
+
]);
|
|
422
|
+
agentComponent.registerAgent("test-agent", {
|
|
423
|
+
type: "primary",
|
|
424
|
+
deniedTools: ["tool3"],
|
|
425
|
+
});
|
|
426
|
+
const agent = agentComponent.getAgent("test-agent");
|
|
427
|
+
const availableTools = agentComponent.getAvailableTools(agent);
|
|
428
|
+
expect(availableTools).toHaveLength(2);
|
|
429
|
+
expect(availableTools.find(t => t.name === "tool3")).toBeUndefined();
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
// ============================================================================
|
|
434
|
+
// AgentComponent Config Loading Tests (TDD)
|
|
435
|
+
// ============================================================================
|
|
436
|
+
describe("AgentComponent Config Loading", () => {
|
|
437
|
+
let component;
|
|
438
|
+
let configComponent;
|
|
439
|
+
let mockEnv;
|
|
440
|
+
let tempDir;
|
|
441
|
+
beforeEach(() => {
|
|
442
|
+
component = new AgentComponent();
|
|
443
|
+
configComponent = new ConfigComponent();
|
|
444
|
+
// Create temp directory for config files
|
|
445
|
+
tempDir = fsSync.mkdtempSync(path.join(os.tmpdir(), "agent-config-test-"));
|
|
446
|
+
// Set XDG_DATA_HOME to temp directory so ConfigComponent can find config files
|
|
447
|
+
configComponent.setXdgDataHome(tempDir);
|
|
448
|
+
// Mock environment
|
|
449
|
+
mockEnv = {
|
|
450
|
+
name: "test-env",
|
|
451
|
+
version: "1.0.0",
|
|
452
|
+
getComponent: vi.fn((name) => {
|
|
453
|
+
if (name === "config")
|
|
454
|
+
return configComponent;
|
|
455
|
+
return undefined;
|
|
456
|
+
}),
|
|
457
|
+
hasComponent: vi.fn((name) => name === "config"),
|
|
458
|
+
logger: vi.fn(),
|
|
459
|
+
trace: vi.fn(),
|
|
460
|
+
};
|
|
461
|
+
});
|
|
462
|
+
afterEach(() => {
|
|
463
|
+
vi.restoreAllMocks();
|
|
464
|
+
// Clean up environment variables
|
|
465
|
+
delete process.env.AGENT_AGENT_DEFAULT_AGENT_MAX_ITERATIONS;
|
|
466
|
+
// Clean up temp directory
|
|
467
|
+
try {
|
|
468
|
+
fsSync.rmSync(tempDir, { recursive: true });
|
|
469
|
+
}
|
|
470
|
+
catch { }
|
|
471
|
+
});
|
|
472
|
+
describe("AgentComponentOptions", () => {
|
|
473
|
+
test("should accept configComponent only", async () => {
|
|
474
|
+
await component.init({
|
|
475
|
+
name: "agent",
|
|
476
|
+
version: "1.0.0",
|
|
477
|
+
enabled: true,
|
|
478
|
+
env: mockEnv,
|
|
479
|
+
options: { configComponent }
|
|
480
|
+
});
|
|
481
|
+
expect(component.getStatus()).toBe("running");
|
|
482
|
+
});
|
|
483
|
+
test("should accept configPath option", async () => {
|
|
484
|
+
fsSync.writeFileSync(path.join(tempDir, "config.jsonc"), JSON.stringify({
|
|
485
|
+
agent: {
|
|
486
|
+
defaultAgent: {
|
|
487
|
+
maxIterations: 50
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}), "utf-8");
|
|
491
|
+
await component.init({
|
|
492
|
+
name: "agent",
|
|
493
|
+
version: "1.0.0",
|
|
494
|
+
enabled: true,
|
|
495
|
+
env: mockEnv,
|
|
496
|
+
options: { configComponent, configPath: "config.jsonc" }
|
|
497
|
+
});
|
|
498
|
+
expect(component.getStatus()).toBe("running");
|
|
499
|
+
});
|
|
500
|
+
test("should accept envPrefix option", async () => {
|
|
501
|
+
process.env.AGENT_AGENT_DEFAULT_AGENT_MAX_ITERATIONS = "75";
|
|
502
|
+
await component.init({
|
|
503
|
+
name: "agent",
|
|
504
|
+
version: "1.0.0",
|
|
505
|
+
enabled: true,
|
|
506
|
+
env: mockEnv,
|
|
507
|
+
options: { configComponent, envPrefix: "AGENT" }
|
|
508
|
+
});
|
|
509
|
+
expect(component.getStatus()).toBe("running");
|
|
510
|
+
delete process.env.AGENT_AGENT_DEFAULT_AGENT_MAX_ITERATIONS;
|
|
511
|
+
});
|
|
512
|
+
test("should accept config option with direct object", async () => {
|
|
513
|
+
await component.init({
|
|
514
|
+
name: "agent",
|
|
515
|
+
version: "1.0.0",
|
|
516
|
+
enabled: true,
|
|
517
|
+
env: mockEnv,
|
|
518
|
+
options: {
|
|
519
|
+
configComponent,
|
|
520
|
+
config: {
|
|
521
|
+
defaultAgent: {
|
|
522
|
+
maxIterations: 25
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
expect(component.getStatus()).toBe("running");
|
|
528
|
+
});
|
|
529
|
+
});
|
|
530
|
+
describe("config priority: Object > Env > File", () => {
|
|
531
|
+
test("should Object config override Env config", async () => {
|
|
532
|
+
// Set environment variable
|
|
533
|
+
process.env.AGENT_AGENT_DEFAULT_AGENT_MAX_ITERATIONS = "50";
|
|
534
|
+
// Create file config
|
|
535
|
+
fsSync.writeFileSync(path.join(tempDir, "config.jsonc"), JSON.stringify({
|
|
536
|
+
agent: { defaultAgent: { maxIterations: 100 } }
|
|
537
|
+
}), "utf-8");
|
|
538
|
+
await component.init({
|
|
539
|
+
name: "agent",
|
|
540
|
+
version: "1.0.0",
|
|
541
|
+
enabled: true,
|
|
542
|
+
env: mockEnv,
|
|
543
|
+
options: {
|
|
544
|
+
configComponent,
|
|
545
|
+
configPath: "config.jsonc",
|
|
546
|
+
envPrefix: "AGENT",
|
|
547
|
+
config: { defaultAgent: { maxIterations: 25 } } // Object has highest priority
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
// Object config should have highest priority
|
|
551
|
+
expect(configComponent.get("agent.defaultAgent.maxIterations")).toBe(25);
|
|
552
|
+
delete process.env.AGENT_AGENT_DEFAULT_AGENT_MAX_ITERATIONS;
|
|
553
|
+
});
|
|
554
|
+
test("should Env config override File config", async () => {
|
|
555
|
+
// Set environment variable
|
|
556
|
+
process.env.AGENT_AGENT_DEFAULT_AGENT_MAX_ITERATIONS = "50";
|
|
557
|
+
// Create file config
|
|
558
|
+
fsSync.writeFileSync(path.join(tempDir, "config.jsonc"), JSON.stringify({
|
|
559
|
+
agent: { defaultAgent: { maxIterations: 100 } }
|
|
560
|
+
}), "utf-8");
|
|
561
|
+
await component.init({
|
|
562
|
+
name: "agent",
|
|
563
|
+
version: "1.0.0",
|
|
564
|
+
enabled: true,
|
|
565
|
+
env: mockEnv,
|
|
566
|
+
options: {
|
|
567
|
+
configComponent,
|
|
568
|
+
configPath: "config.jsonc",
|
|
569
|
+
envPrefix: "AGENT"
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
// Env should override file
|
|
573
|
+
expect(configComponent.get("agent.defaultAgent.maxIterations")).toBe("50");
|
|
574
|
+
});
|
|
575
|
+
test("should File config be loaded when present", async () => {
|
|
576
|
+
fsSync.writeFileSync(path.join(tempDir, "config.jsonc"), JSON.stringify({
|
|
577
|
+
agent: {
|
|
578
|
+
defaultAgent: {
|
|
579
|
+
maxIterations: 100,
|
|
580
|
+
maxErrorRetries: 5
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}), "utf-8");
|
|
584
|
+
await component.init({
|
|
585
|
+
name: "agent",
|
|
586
|
+
version: "1.0.0",
|
|
587
|
+
enabled: true,
|
|
588
|
+
env: mockEnv,
|
|
589
|
+
options: {
|
|
590
|
+
configComponent,
|
|
591
|
+
configPath: "config.jsonc"
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
expect(configComponent.get("agent.defaultAgent.maxIterations")).toBe(100);
|
|
595
|
+
expect(configComponent.get("agent.defaultAgent.maxErrorRetries")).toBe(5);
|
|
596
|
+
});
|
|
597
|
+
test("should use default values when no config provided", async () => {
|
|
598
|
+
await component.init({
|
|
599
|
+
name: "agent",
|
|
600
|
+
version: "1.0.0",
|
|
601
|
+
enabled: true,
|
|
602
|
+
env: mockEnv,
|
|
603
|
+
options: { configComponent }
|
|
604
|
+
});
|
|
605
|
+
// Default values should be used (配置统一化后应返回默认值)
|
|
606
|
+
// 注意:AGENT_DEFAULTS 中定义的是 200
|
|
607
|
+
expect(configComponent.get("agent.defaultAgent.maxIterations")).toBe(200);
|
|
608
|
+
// maxErrorRetries 没有默认值,所以应该是 undefined
|
|
609
|
+
expect(configComponent.get("agent.defaultAgent.maxErrorRetries")).toBeUndefined();
|
|
610
|
+
});
|
|
611
|
+
});
|
|
612
|
+
describe("config hot reload", () => {
|
|
613
|
+
test("should register config watcher for hot reload", async () => {
|
|
614
|
+
const watcherFn = vi.fn();
|
|
615
|
+
vi.spyOn(configComponent, "watch").mockReturnValue(watcherFn);
|
|
616
|
+
await component.init({
|
|
617
|
+
name: "agent",
|
|
618
|
+
version: "1.0.0",
|
|
619
|
+
enabled: true,
|
|
620
|
+
env: mockEnv,
|
|
621
|
+
options: { configComponent }
|
|
622
|
+
});
|
|
623
|
+
expect(configComponent.watch).toHaveBeenCalledWith("agent.*", expect.any(Function));
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
// ============================================================================
|
|
627
|
+
// TDD: Tool Results Completeness Tests
|
|
628
|
+
//
|
|
629
|
+
// Bug: AI SDK v6 requires 1:1 correspondence between tool-calls and tool-results
|
|
630
|
+
// Error: "Tool results are missing for tool calls call_function_xxx_1, _2, _3"
|
|
631
|
+
//
|
|
632
|
+
// When processing multiple tool calls, if abort/doom-loop/hook-stopped occurs
|
|
633
|
+
// mid-processing, remaining tool calls don't get results, causing AI SDK errors.
|
|
634
|
+
// ============================================================================
|
|
635
|
+
describe("Tool Results Completeness (TDD)", () => {
|
|
636
|
+
let agentComponent;
|
|
637
|
+
let mockEnv;
|
|
638
|
+
let configComponent;
|
|
639
|
+
beforeEach(async () => {
|
|
640
|
+
vi.clearAllMocks();
|
|
641
|
+
agentComponent = new AgentComponent();
|
|
642
|
+
configComponent = new ConfigComponent();
|
|
643
|
+
mockEnv = {
|
|
644
|
+
name: "test-env",
|
|
645
|
+
version: "1.0.0",
|
|
646
|
+
getConfig: vi.fn(() => ({ name: "test-env", version: "1.0.0", enabled: true })),
|
|
647
|
+
registerComponent: vi.fn(),
|
|
648
|
+
unregisterComponent: vi.fn(),
|
|
649
|
+
getComponent: vi.fn((name) => {
|
|
650
|
+
if (name === "config")
|
|
651
|
+
return configComponent;
|
|
652
|
+
return undefined;
|
|
653
|
+
}),
|
|
654
|
+
hasComponent: vi.fn((name) => name === "config"),
|
|
655
|
+
listComponents: vi.fn(() => []),
|
|
656
|
+
handle_query: vi.fn(),
|
|
657
|
+
handle_action: vi.fn(),
|
|
658
|
+
subscribe: vi.fn(() => () => { }),
|
|
659
|
+
subscribeTo: vi.fn(() => () => { }),
|
|
660
|
+
subscribeAll: vi.fn(() => () => { }),
|
|
661
|
+
pushEnvEvent: vi.fn(),
|
|
662
|
+
};
|
|
663
|
+
await agentComponent.init({ env: mockEnv, options: { configComponent } });
|
|
664
|
+
});
|
|
665
|
+
afterEach(() => {
|
|
666
|
+
delete process.env.AGENT_AGENT_DEFAULT_AGENT_MAX_ITERATIONS;
|
|
667
|
+
});
|
|
668
|
+
describe("addRemainingToolResults helper", () => {
|
|
669
|
+
it("should add placeholder results for all remaining tool calls", () => {
|
|
670
|
+
// Register agent
|
|
671
|
+
agentComponent.registerAgent("test-agent", { type: "primary" });
|
|
672
|
+
// Access private method for testing
|
|
673
|
+
const agent = agentComponent.getAgent("test-agent");
|
|
674
|
+
const messages = [];
|
|
675
|
+
const allToolCalls = [
|
|
676
|
+
{ id: "call_1", function: { name: "tool1" } },
|
|
677
|
+
{ id: "call_2", function: { name: "tool2" } },
|
|
678
|
+
{ id: "call_3", function: { name: "tool3" } },
|
|
679
|
+
];
|
|
680
|
+
// Call the helper (we'll test via run() method behavior instead)
|
|
681
|
+
// For now, just verify the structure
|
|
682
|
+
expect(allToolCalls).toHaveLength(3);
|
|
683
|
+
});
|
|
684
|
+
});
|
|
685
|
+
describe("abort during tool call processing", () => {
|
|
686
|
+
it("should add placeholder results for unprocessed tool calls when abort occurs", async () => {
|
|
687
|
+
agentComponent.registerAgent("test-agent", {
|
|
688
|
+
type: "primary",
|
|
689
|
+
maxIterations: 10,
|
|
690
|
+
});
|
|
691
|
+
// Mock LLMComponent that returns 3 tool calls
|
|
692
|
+
const mockLLMComponent = {
|
|
693
|
+
invoke: vi.fn(() => Promise.resolve({
|
|
694
|
+
output: {
|
|
695
|
+
content: "",
|
|
696
|
+
toolCalls: [
|
|
697
|
+
{ id: "call_1", function: { name: "tool1", arguments: "{}" } },
|
|
698
|
+
{ id: "call_2", function: { name: "tool2", arguments: "{}" } },
|
|
699
|
+
{ id: "call_3", function: { name: "tool3", arguments: "{}" } },
|
|
700
|
+
]
|
|
701
|
+
}
|
|
702
|
+
}))
|
|
703
|
+
};
|
|
704
|
+
mockEnv.getComponent.mockReturnValue(mockLLMComponent);
|
|
705
|
+
// Mock tool execution - execute first tool, then abort
|
|
706
|
+
const mockTool = {
|
|
707
|
+
name: "tool1",
|
|
708
|
+
execute: vi.fn(async () => {
|
|
709
|
+
// Simulate abort after first tool
|
|
710
|
+
agentComponent.abort("test-agent");
|
|
711
|
+
return { success: true, output: "result1" };
|
|
712
|
+
}),
|
|
713
|
+
};
|
|
714
|
+
const mockTool2 = { name: "tool2", execute: vi.fn() };
|
|
715
|
+
const mockTool3 = { name: "tool3", execute: vi.fn() };
|
|
716
|
+
agentComponent.setDefaultTools([mockTool, mockTool2, mockTool3]);
|
|
717
|
+
// Run agent
|
|
718
|
+
const result = await agentComponent.run("test-agent", "Execute multiple tools and abort");
|
|
719
|
+
// Verify: result should indicate stopped
|
|
720
|
+
expect(result.stopped).toBe(true);
|
|
721
|
+
// The key test: run() should complete without throwing MissingToolResultsError
|
|
722
|
+
// This is verified by the fact that we reach here without error
|
|
723
|
+
expect(true).toBe(true);
|
|
724
|
+
// The key assertion: there should be no MissingToolResultsError
|
|
725
|
+
// This is verified by the fact that run() completed without throwing
|
|
726
|
+
expect(true).toBe(true); // If we reach here, the bug is fixed
|
|
727
|
+
});
|
|
728
|
+
});
|
|
729
|
+
describe("doom loop detection during tool call processing", () => {
|
|
730
|
+
it("should add placeholder results for unprocessed tool calls when doom loop detected", async () => {
|
|
731
|
+
agentComponent.registerAgent("test-agent", {
|
|
732
|
+
type: "primary",
|
|
733
|
+
maxIterations: 10,
|
|
734
|
+
doomLoopThreshold: 2, // Trigger doom loop quickly
|
|
735
|
+
});
|
|
736
|
+
// Mock LLMComponent that returns same tool call repeatedly
|
|
737
|
+
const mockLLMComponent = {
|
|
738
|
+
invoke: vi.fn(() => Promise.resolve({
|
|
739
|
+
output: {
|
|
740
|
+
content: "",
|
|
741
|
+
toolCalls: [
|
|
742
|
+
{ id: "call_1", function: { name: "repeat_tool", arguments: '{"key":"value"}' } },
|
|
743
|
+
{ id: "call_2", function: { name: "repeat_tool", arguments: '{"key":"value"}' } },
|
|
744
|
+
{ id: "call_3", function: { name: "repeat_tool", arguments: '{"key":"value"}' } },
|
|
745
|
+
]
|
|
746
|
+
}
|
|
747
|
+
}))
|
|
748
|
+
};
|
|
749
|
+
mockEnv.getComponent.mockReturnValue(mockLLMComponent);
|
|
750
|
+
// Mock tool that returns same result (causing doom loop)
|
|
751
|
+
const mockTool = {
|
|
752
|
+
name: "repeat_tool",
|
|
753
|
+
execute: vi.fn(() => Promise.resolve({ success: true, output: "same_result" })),
|
|
754
|
+
};
|
|
755
|
+
agentComponent.setDefaultTools([mockTool]);
|
|
756
|
+
// Run agent - should trigger doom loop detection
|
|
757
|
+
// After doom loop, remaining tool calls should get placeholder results
|
|
758
|
+
// This should not throw MissingToolResultsError
|
|
759
|
+
try {
|
|
760
|
+
const result = await agentComponent.run("test-agent", "Trigger doom loop");
|
|
761
|
+
// If we reach here without error, the fix is working
|
|
762
|
+
expect(result.error).toContain("Doom loop");
|
|
763
|
+
}
|
|
764
|
+
catch (error) {
|
|
765
|
+
// Should NOT contain MissingToolResultsError
|
|
766
|
+
expect(error.message).not.toContain("Tool results are missing");
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
it("should reset doom loop count across iterations (not accumulate across iterations)", async () => {
|
|
770
|
+
agentComponent.registerAgent("test-agent", {
|
|
771
|
+
type: "primary",
|
|
772
|
+
maxIterations: 10,
|
|
773
|
+
doomLoopThreshold: 3, // Need 3+ same calls within one iteration to trigger
|
|
774
|
+
});
|
|
775
|
+
let invokeCount = 0;
|
|
776
|
+
// Mock LLMComponent:
|
|
777
|
+
// - Iteration 1: returns same tool call once (count=1, not enough to trigger)
|
|
778
|
+
// - Iteration 2: returns same tool call once (count should reset to 1, not 2!)
|
|
779
|
+
// - Iteration 3: returns same tool call once (count should reset to 1, not 3!)
|
|
780
|
+
// If doom loop count accumulates across iterations, iteration 3 would trigger doom loop
|
|
781
|
+
// If doom loop count resets per iteration, it should NOT trigger doom loop
|
|
782
|
+
const mockLLMComponent = {
|
|
783
|
+
invoke: vi.fn(() => {
|
|
784
|
+
invokeCount++;
|
|
785
|
+
return Promise.resolve({
|
|
786
|
+
output: {
|
|
787
|
+
content: invokeCount >= 4 ? "done" : "", // Stop after 3 iterations
|
|
788
|
+
toolCalls: [
|
|
789
|
+
{ id: `call_${invokeCount}`, function: { name: "repeat_tool", arguments: '{"key":"value"}' } },
|
|
790
|
+
]
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
})
|
|
794
|
+
};
|
|
795
|
+
mockEnv.getComponent.mockReturnValue(mockLLMComponent);
|
|
796
|
+
// Mock tool that returns same result
|
|
797
|
+
const mockTool = {
|
|
798
|
+
name: "repeat_tool",
|
|
799
|
+
execute: vi.fn(() => Promise.resolve({ success: true, output: "same_result" })),
|
|
800
|
+
};
|
|
801
|
+
agentComponent.setDefaultTools([mockTool]);
|
|
802
|
+
const result = await agentComponent.run("test-agent", "Test doom loop reset across iterations");
|
|
803
|
+
// Should NOT trigger doom loop because count should reset each iteration
|
|
804
|
+
// If this test fails, it means doom loop count accumulated across iterations
|
|
805
|
+
expect(result.error).toBeUndefined();
|
|
806
|
+
// Should complete with max iterations reached or text response
|
|
807
|
+
expect(result.iterations).toBeGreaterThanOrEqual(3);
|
|
808
|
+
});
|
|
809
|
+
});
|
|
810
|
+
describe("hook _stopped during tool call processing", () => {
|
|
811
|
+
it("should add placeholder results when before.tool hook stops execution", async () => {
|
|
812
|
+
agentComponent.registerAgent("test-agent", {
|
|
813
|
+
type: "primary",
|
|
814
|
+
maxIterations: 10,
|
|
815
|
+
});
|
|
816
|
+
// Mock LLMComponent that returns 3 tool calls
|
|
817
|
+
const mockLLMComponent = {
|
|
818
|
+
invoke: vi.fn(() => Promise.resolve({
|
|
819
|
+
output: {
|
|
820
|
+
content: "",
|
|
821
|
+
toolCalls: [
|
|
822
|
+
{ id: "call_1", function: { name: "tool1", arguments: "{}" } },
|
|
823
|
+
{ id: "call_2", function: { name: "tool2", arguments: "{}" } },
|
|
824
|
+
{ id: "call_3", function: { name: "tool3", arguments: "{}" } },
|
|
825
|
+
]
|
|
826
|
+
}
|
|
827
|
+
}))
|
|
828
|
+
};
|
|
829
|
+
mockEnv.getComponent.mockReturnValue(mockLLMComponent);
|
|
830
|
+
// Mock tool
|
|
831
|
+
const mockTool = { name: "tool1", execute: vi.fn() };
|
|
832
|
+
const mockTool2 = { name: "tool2", execute: vi.fn() };
|
|
833
|
+
const mockTool3 = { name: "tool3", execute: vi.fn() };
|
|
834
|
+
agentComponent.setDefaultTools([mockTool, mockTool2, mockTool3]);
|
|
835
|
+
// Register plugin that stops execution after first tool
|
|
836
|
+
const plugin = {
|
|
837
|
+
name: "stop-after-first-tool",
|
|
838
|
+
version: "1.0.0",
|
|
839
|
+
hooks: [{ point: "agent:before.tool" }],
|
|
840
|
+
execute: vi.fn((ctx) => {
|
|
841
|
+
// Stop after processing tool1
|
|
842
|
+
if (ctx.currentToolCall?.name === "tool2") {
|
|
843
|
+
return { continue: false };
|
|
844
|
+
}
|
|
845
|
+
return { continue: true };
|
|
846
|
+
}),
|
|
847
|
+
};
|
|
848
|
+
agentComponent.registerPlugin("test-agent", plugin);
|
|
849
|
+
// Run agent - should not throw MissingToolResultsError
|
|
850
|
+
try {
|
|
851
|
+
const result = await agentComponent.run("test-agent", "Execute with stopping hook");
|
|
852
|
+
// If we reach here without error, the fix is working
|
|
853
|
+
expect(result.stopped).toBe(true);
|
|
854
|
+
}
|
|
855
|
+
catch (error) {
|
|
856
|
+
// Should NOT contain MissingToolResultsError
|
|
857
|
+
expect(error.message).not.toContain("Tool results are missing");
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
});
|
|
861
|
+
describe("_stopped state propagation to next iteration", () => {
|
|
862
|
+
it("should break while loop when _stopped is set by hook in previous iteration", async () => {
|
|
863
|
+
agentComponent.registerAgent("test-agent", {
|
|
864
|
+
type: "primary",
|
|
865
|
+
maxIterations: 10,
|
|
866
|
+
});
|
|
867
|
+
let iteration = 0;
|
|
868
|
+
const mockLLMComponent = {
|
|
869
|
+
invoke: vi.fn(() => {
|
|
870
|
+
iteration++;
|
|
871
|
+
if (iteration === 1) {
|
|
872
|
+
// First iteration: returns tool call and sets _stopped via hook
|
|
873
|
+
return Promise.resolve({
|
|
874
|
+
output: {
|
|
875
|
+
content: "",
|
|
876
|
+
toolCalls: [
|
|
877
|
+
{ id: "call_1", function: { name: "tool1", arguments: "{}" } },
|
|
878
|
+
]
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
// Second iteration should NOT happen
|
|
883
|
+
return Promise.resolve({
|
|
884
|
+
output: {
|
|
885
|
+
content: "should not reach here",
|
|
886
|
+
toolCalls: []
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
})
|
|
890
|
+
};
|
|
891
|
+
mockEnv.getComponent.mockReturnValue(mockLLMComponent);
|
|
892
|
+
const mockTool = {
|
|
893
|
+
name: "tool1",
|
|
894
|
+
execute: vi.fn(() => Promise.resolve({ success: true, output: "result" }))
|
|
895
|
+
};
|
|
896
|
+
agentComponent.setDefaultTools([mockTool]);
|
|
897
|
+
// Register hook that sets _stopped after first iteration's on.iteration
|
|
898
|
+
let firstIterationComplete = false;
|
|
899
|
+
const plugin = {
|
|
900
|
+
name: "stop-after-first-iteration",
|
|
901
|
+
version: "1.0.0",
|
|
902
|
+
hooks: [{ point: "agent:on.iteration" }],
|
|
903
|
+
execute: vi.fn((ctx) => {
|
|
904
|
+
if (!firstIterationComplete) {
|
|
905
|
+
firstIterationComplete = true;
|
|
906
|
+
ctx._stopped = true;
|
|
907
|
+
ctx._stopReason = "stopped by hook";
|
|
908
|
+
}
|
|
909
|
+
return { continue: true };
|
|
910
|
+
}),
|
|
911
|
+
};
|
|
912
|
+
agentComponent.registerPlugin("test-agent", plugin);
|
|
913
|
+
// Run agent
|
|
914
|
+
const result = await agentComponent.run("test-agent", "Test _stopped propagation");
|
|
915
|
+
// Verify: should only run 1 iteration (not 2)
|
|
916
|
+
expect(result.iterations).toBe(1);
|
|
917
|
+
expect(mockLLMComponent.invoke).toHaveBeenCalledTimes(1);
|
|
918
|
+
});
|
|
919
|
+
});
|
|
920
|
+
});
|
|
921
|
+
describe("getConversationHistory", () => {
|
|
922
|
+
let mockSessionComponent;
|
|
923
|
+
let agent;
|
|
924
|
+
beforeEach(async () => {
|
|
925
|
+
agent = new AgentComponent();
|
|
926
|
+
await agent.init({ env: mockEnv, options: { configComponent } });
|
|
927
|
+
// Create mock session component with getContext (new implementation)
|
|
928
|
+
mockSessionComponent = {
|
|
929
|
+
getContext: vi.fn(),
|
|
930
|
+
};
|
|
931
|
+
// Update mockEnv to return our mock session component
|
|
932
|
+
mockEnv.getComponent.mockImplementation((name) => {
|
|
933
|
+
if (name === "session")
|
|
934
|
+
return mockSessionComponent;
|
|
935
|
+
if (name === "config")
|
|
936
|
+
return configComponent;
|
|
937
|
+
return undefined;
|
|
938
|
+
});
|
|
939
|
+
});
|
|
940
|
+
it("应该返回空数组当会话没有消息", async () => {
|
|
941
|
+
mockSessionComponent.getContext.mockResolvedValue({
|
|
942
|
+
messages: []
|
|
943
|
+
});
|
|
944
|
+
const history = await agent.getConversationHistory(mockSessionComponent, "session_123", { minUserMessages: 5 });
|
|
945
|
+
expect(history).toEqual([]);
|
|
946
|
+
});
|
|
947
|
+
it("应该使用 getContext 获取消息并从 user 消息边界截取", async () => {
|
|
948
|
+
const sessionId = "session_123";
|
|
949
|
+
// getContext 已经处理了 minUserMessages 逻辑,直接返回从 user 边界截取后的消息
|
|
950
|
+
const mockMessages = [
|
|
951
|
+
{ id: "msg_3", role: "user", content: "User 2", metadata: {} },
|
|
952
|
+
{ id: "msg_4", role: "assistant", content: "Assistant 2", metadata: {} },
|
|
953
|
+
{ id: "msg_5", role: "user", content: "User 3", metadata: {} },
|
|
954
|
+
{ id: "msg_6", role: "assistant", content: "Assistant 3", metadata: {} },
|
|
955
|
+
];
|
|
956
|
+
mockSessionComponent.getContext.mockResolvedValue({
|
|
957
|
+
messages: mockMessages
|
|
958
|
+
});
|
|
959
|
+
const history = await agent.getConversationHistory(mockSessionComponent, sessionId, { minUserMessages: 2 });
|
|
960
|
+
// Verify: getContext should be called with fullHistory=false and minUserMessages
|
|
961
|
+
expect(mockSessionComponent.getContext).toHaveBeenCalledWith(sessionId, {
|
|
962
|
+
fullHistory: false,
|
|
963
|
+
minUserMessages: 2,
|
|
964
|
+
});
|
|
965
|
+
expect(history).toHaveLength(4);
|
|
966
|
+
expect(history.map((m) => m.content)).toEqual([
|
|
967
|
+
"User 2", "Assistant 2", "User 3", "Assistant 3"
|
|
968
|
+
]);
|
|
969
|
+
});
|
|
970
|
+
it("应该正确处理 filterHistory=true 时过滤 tool 消息", async () => {
|
|
971
|
+
const mockMessages = [
|
|
972
|
+
{ id: "msg_0", role: "user", content: "User 1", metadata: {} },
|
|
973
|
+
{ id: "msg_1", role: "assistant", content: "Assistant 1", metadata: {} },
|
|
974
|
+
{ id: "msg_2", role: "tool", content: "tool result", metadata: { type: "tool_result" } },
|
|
975
|
+
{ id: "msg_3", role: "assistant", content: "Assistant 2", metadata: {} },
|
|
976
|
+
];
|
|
977
|
+
mockSessionComponent.getContext.mockResolvedValue({
|
|
978
|
+
messages: mockMessages
|
|
979
|
+
});
|
|
980
|
+
const history = await agent.getConversationHistory(mockSessionComponent, "session_123", { filterHistory: true });
|
|
981
|
+
// Should filter out tool messages
|
|
982
|
+
expect(history).toHaveLength(3);
|
|
983
|
+
expect(history.map((m) => m.role)).toEqual(["user", "assistant", "assistant"]);
|
|
984
|
+
expect(history.find((m) => m.role === "tool")).toBeUndefined();
|
|
985
|
+
});
|
|
986
|
+
it("应该正确处理 filterHistory=false 时保留所有消息", async () => {
|
|
987
|
+
const mockMessages = [
|
|
988
|
+
{ id: "msg_0", role: "user", content: "User 1", metadata: {} },
|
|
989
|
+
{ id: "msg_1", role: "assistant", content: "Assistant 1", metadata: {} },
|
|
990
|
+
{ id: "msg_2", role: "tool", content: "tool result", metadata: { type: "tool_result" } },
|
|
991
|
+
{ id: "msg_3", role: "assistant", content: "Assistant 2", metadata: {} },
|
|
992
|
+
];
|
|
993
|
+
mockSessionComponent.getContext.mockResolvedValue({
|
|
994
|
+
messages: mockMessages
|
|
995
|
+
});
|
|
996
|
+
const history = await agent.getConversationHistory(mockSessionComponent, "session_123", { filterHistory: false });
|
|
997
|
+
// Should keep all messages including tool
|
|
998
|
+
expect(history).toHaveLength(4);
|
|
999
|
+
expect(history.map((m) => m.role)).toEqual(["user", "assistant", "tool", "assistant"]);
|
|
1000
|
+
});
|
|
1001
|
+
it("默认 filterHistory=false(不指定时)", async () => {
|
|
1002
|
+
const mockMessages = [
|
|
1003
|
+
{ id: "msg_0", role: "user", content: "User 1", metadata: {} },
|
|
1004
|
+
{ id: "msg_1", role: "assistant", content: "Assistant 1", metadata: {} },
|
|
1005
|
+
{ id: "msg_2", role: "tool", content: "tool result", metadata: { type: "tool_result" } },
|
|
1006
|
+
{ id: "msg_3", role: "assistant", content: "Assistant 2", metadata: {} },
|
|
1007
|
+
];
|
|
1008
|
+
mockSessionComponent.getContext.mockResolvedValue({
|
|
1009
|
+
messages: mockMessages
|
|
1010
|
+
});
|
|
1011
|
+
// 不指定 filterHistory 参数
|
|
1012
|
+
const history = await agent.getConversationHistory(mockSessionComponent, "session_123", {});
|
|
1013
|
+
// 默认应该保留所有消息(包括 tool 消息)
|
|
1014
|
+
expect(history).toHaveLength(4);
|
|
1015
|
+
expect(history.map((m) => m.role)).toEqual(["user", "assistant", "tool", "assistant"]);
|
|
1016
|
+
});
|
|
1017
|
+
it("应该正确处理消息少于 minUserMessages 的情况", async () => {
|
|
1018
|
+
const mockMessages = [
|
|
1019
|
+
{ id: "msg_0", role: "user", content: "User 1", metadata: {} },
|
|
1020
|
+
{ id: "msg_1", role: "assistant", content: "Assistant 1", metadata: {} },
|
|
1021
|
+
];
|
|
1022
|
+
mockSessionComponent.getContext.mockResolvedValue({
|
|
1023
|
+
messages: mockMessages
|
|
1024
|
+
});
|
|
1025
|
+
// 当消息少于 minUserMessages 时,getContext 会返回所有消息
|
|
1026
|
+
const history = await agent.getConversationHistory(mockSessionComponent, "session_123", { minUserMessages: 5 });
|
|
1027
|
+
expect(mockSessionComponent.getContext).toHaveBeenCalledWith("session_123", {
|
|
1028
|
+
fullHistory: false,
|
|
1029
|
+
minUserMessages: 5,
|
|
1030
|
+
});
|
|
1031
|
+
expect(history).toHaveLength(2);
|
|
1032
|
+
});
|
|
1033
|
+
});
|
|
1034
|
+
});
|
|
1035
|
+
// ============================================================================
|
|
1036
|
+
// toLLMMessage Tests
|
|
1037
|
+
// ============================================================================
|
|
1038
|
+
describe("toLLMMessage (message conversion)", () => {
|
|
1039
|
+
// Helper function extracted from agent-component.ts for testing
|
|
1040
|
+
function toLLMMessage(msg) {
|
|
1041
|
+
let content;
|
|
1042
|
+
let toolCallId;
|
|
1043
|
+
let toolName;
|
|
1044
|
+
let toolCalls;
|
|
1045
|
+
if (typeof msg.content === "string") {
|
|
1046
|
+
content = msg.content;
|
|
1047
|
+
if (msg.role === "tool") {
|
|
1048
|
+
toolCallId = msg.toolCallId;
|
|
1049
|
+
toolName = msg.toolName;
|
|
1050
|
+
}
|
|
1051
|
+
if (msg.role === "assistant" && msg.toolCalls) {
|
|
1052
|
+
toolCalls = msg.toolCalls;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
else if (Array.isArray(msg.content)) {
|
|
1056
|
+
if (msg.role === "tool") {
|
|
1057
|
+
const toolResult = msg.content.find((part) => part.type === "tool-result");
|
|
1058
|
+
const output = toolResult?.output;
|
|
1059
|
+
if (typeof output === "string") {
|
|
1060
|
+
content = output;
|
|
1061
|
+
}
|
|
1062
|
+
else if (output && typeof output === "object" && "value" in output) {
|
|
1063
|
+
content = output.value?.toString() || "";
|
|
1064
|
+
}
|
|
1065
|
+
else {
|
|
1066
|
+
content = JSON.stringify(output) || "";
|
|
1067
|
+
}
|
|
1068
|
+
toolCallId = toolResult?.toolCallId;
|
|
1069
|
+
toolName = toolResult?.toolName;
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
const textParts = msg.content.filter((part) => part.type === "text");
|
|
1073
|
+
const toolCallParts = msg.content.filter((part) => part.type === "tool-call");
|
|
1074
|
+
content = textParts.map((part) => part.text || "").join("");
|
|
1075
|
+
// Fixed: handle flat tool-call format from toModelMessage
|
|
1076
|
+
if (msg.role === "assistant" && toolCallParts.length > 0) {
|
|
1077
|
+
toolCalls = toolCallParts.map((part) => {
|
|
1078
|
+
const argsString = typeof part.input === "string"
|
|
1079
|
+
? part.input
|
|
1080
|
+
: JSON.stringify(part.input || {});
|
|
1081
|
+
const name = part.toolName || "unknown";
|
|
1082
|
+
return {
|
|
1083
|
+
id: part.toolCallId,
|
|
1084
|
+
name: name,
|
|
1085
|
+
arguments: argsString,
|
|
1086
|
+
function: {
|
|
1087
|
+
name: name,
|
|
1088
|
+
arguments: argsString,
|
|
1089
|
+
},
|
|
1090
|
+
};
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
else {
|
|
1096
|
+
content = "";
|
|
1097
|
+
}
|
|
1098
|
+
return {
|
|
1099
|
+
role: msg.role,
|
|
1100
|
+
content,
|
|
1101
|
+
...(toolCallId ? { toolCallId } : {}),
|
|
1102
|
+
...(toolName ? { name: toolName } : {}),
|
|
1103
|
+
...(toolCalls && toolCalls.length > 0 ? { toolCalls } : {}),
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
it("should convert assistant message with tool-call parts (flat format from toModelMessage)", () => {
|
|
1107
|
+
// Simulate the format generated by SessionMessageConverter.toModelMessage
|
|
1108
|
+
const modelMessage = {
|
|
1109
|
+
role: "assistant",
|
|
1110
|
+
content: [
|
|
1111
|
+
{ type: "text", text: "I'll search for that" },
|
|
1112
|
+
{ type: "tool-call", toolCallId: "call_123", toolName: "search", input: { query: "test" } }
|
|
1113
|
+
]
|
|
1114
|
+
};
|
|
1115
|
+
const result = toLLMMessage(modelMessage);
|
|
1116
|
+
expect(result.role).toBe("assistant");
|
|
1117
|
+
expect(result.content).toBe("I'll search for that");
|
|
1118
|
+
expect(result.toolCalls).toBeDefined();
|
|
1119
|
+
expect(result.toolCalls).toHaveLength(1);
|
|
1120
|
+
expect(result.toolCalls[0]).toEqual({
|
|
1121
|
+
id: "call_123",
|
|
1122
|
+
name: "search",
|
|
1123
|
+
arguments: '{"query":"test"}',
|
|
1124
|
+
function: {
|
|
1125
|
+
name: "search",
|
|
1126
|
+
arguments: '{"query":"test"}',
|
|
1127
|
+
},
|
|
1128
|
+
});
|
|
1129
|
+
});
|
|
1130
|
+
it("should convert tool message with tool-result part", () => {
|
|
1131
|
+
const modelMessage = {
|
|
1132
|
+
role: "tool",
|
|
1133
|
+
content: [
|
|
1134
|
+
{ type: "tool-result", toolCallId: "call_123", toolName: "search", output: "search results" }
|
|
1135
|
+
]
|
|
1136
|
+
};
|
|
1137
|
+
const result = toLLMMessage(modelMessage);
|
|
1138
|
+
expect(result.role).toBe("tool");
|
|
1139
|
+
expect(result.content).toBe("search results");
|
|
1140
|
+
expect(result.toolCallId).toBe("call_123");
|
|
1141
|
+
expect(result.name).toBe("search");
|
|
1142
|
+
});
|
|
1143
|
+
it("should convert tool message with nested output format", () => {
|
|
1144
|
+
const modelMessage = {
|
|
1145
|
+
role: "tool",
|
|
1146
|
+
content: [
|
|
1147
|
+
{ type: "tool-result", toolCallId: "call_456", toolName: "bash", output: { type: "text", value: "command output" } }
|
|
1148
|
+
]
|
|
1149
|
+
};
|
|
1150
|
+
const result = toLLMMessage(modelMessage);
|
|
1151
|
+
expect(result.role).toBe("tool");
|
|
1152
|
+
expect(result.content).toBe("command output");
|
|
1153
|
+
});
|
|
1154
|
+
it("should preserve text content when tool-call parts are present", () => {
|
|
1155
|
+
const modelMessage = {
|
|
1156
|
+
role: "assistant",
|
|
1157
|
+
content: [
|
|
1158
|
+
{ type: "reasoning", text: "I need to run a command" },
|
|
1159
|
+
{ type: "text", text: "Running the command now" },
|
|
1160
|
+
{ type: "tool-call", toolCallId: "call_789", toolName: "bash", input: { command: "ls" } }
|
|
1161
|
+
]
|
|
1162
|
+
};
|
|
1163
|
+
const result = toLLMMessage(modelMessage);
|
|
1164
|
+
expect(result.content).toBe("Running the command now");
|
|
1165
|
+
expect(result.toolCalls).toHaveLength(1);
|
|
1166
|
+
expect(result.toolCalls[0].name).toBe("bash");
|
|
1167
|
+
});
|
|
1168
|
+
});
|
|
1169
|
+
//# sourceMappingURL=agent-component.test.js.map
|