@ai-setting/roy-agent-cli 1.3.15 → 1.3.16
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,981 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Session Component
|
|
3
|
+
*
|
|
4
|
+
* Component for managing session lifecycle
|
|
5
|
+
*/
|
|
6
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
13
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
14
|
+
};
|
|
15
|
+
import { BaseComponent } from "../component.js";
|
|
16
|
+
import { MemorySessionStore, SQLiteSessionStore } from "./storage/index.js";
|
|
17
|
+
import { createLogger } from "../log-trace/logger.js";
|
|
18
|
+
import { envKeyToConfigKey } from "../../config/env-key.js";
|
|
19
|
+
import { TracedAs } from "../log-trace/decorator.js";
|
|
20
|
+
import { SummaryAgent } from "../agent/summary-agent.js"; // (new)
|
|
21
|
+
import { SESSION_CONFIG_REGISTRATION, SESSION_DEFAULTS } from "./session-config-registration.js";
|
|
22
|
+
import { parseSearchQuery, matchesQuery } from "./search-query-parser.js";
|
|
23
|
+
import path from "path";
|
|
24
|
+
// Create logger for session component
|
|
25
|
+
const logger = createLogger("session");
|
|
26
|
+
/**
|
|
27
|
+
* SessionComponent
|
|
28
|
+
*
|
|
29
|
+
* Manages session lifecycle including:
|
|
30
|
+
* - Session CRUD operations
|
|
31
|
+
* - Message management
|
|
32
|
+
* - Active session tracking
|
|
33
|
+
*/
|
|
34
|
+
export class SessionComponent extends BaseComponent {
|
|
35
|
+
name = "session";
|
|
36
|
+
version = "1.1.0"; // (new)
|
|
37
|
+
config;
|
|
38
|
+
store;
|
|
39
|
+
activeSessionId;
|
|
40
|
+
hooksConfig = {};
|
|
41
|
+
/** ConfigComponent 用于配置管理 */
|
|
42
|
+
configComponent;
|
|
43
|
+
/** 配置变更 watcher 清理函数 */
|
|
44
|
+
configWatcher;
|
|
45
|
+
/** Summary Agent for checkpoint generation [new] */
|
|
46
|
+
summaryAgent;
|
|
47
|
+
/** PromptComponent reference for SummaryAgent */
|
|
48
|
+
promptComponent;
|
|
49
|
+
/** LLMComponent reference for SummaryAgent */
|
|
50
|
+
llmComponent;
|
|
51
|
+
constructor() {
|
|
52
|
+
super();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Initialize the component
|
|
56
|
+
*
|
|
57
|
+
* 配置加载优先级(从高到低):
|
|
58
|
+
* 1. Object - 直接传入的 config 对象
|
|
59
|
+
* 2. Env - 环境变量(通过 envPrefix 配置前缀)
|
|
60
|
+
* 3. File - 配置文件(通过 configPath 指定)
|
|
61
|
+
*/
|
|
62
|
+
async init(config) {
|
|
63
|
+
// 调用基类 init,注入 env
|
|
64
|
+
await super.init(config);
|
|
65
|
+
// 从 options 获取 ConfigComponent
|
|
66
|
+
const options = config?.options;
|
|
67
|
+
if (!options?.configComponent) {
|
|
68
|
+
throw new Error("ConfigComponent is required for SessionComponent initialization");
|
|
69
|
+
}
|
|
70
|
+
this.configComponent = options.configComponent;
|
|
71
|
+
await this.registerConfig(options);
|
|
72
|
+
// Initialize store based on config
|
|
73
|
+
const storageConfig = this.config?.storage;
|
|
74
|
+
if (storageConfig?.type === "sqlite") {
|
|
75
|
+
this.store = new SQLiteSessionStore(storageConfig.dbPath);
|
|
76
|
+
logger.info(`[SessionComponent] Using SQLite storage: ${storageConfig.dbPath || "default path"}`);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.store = new MemorySessionStore();
|
|
80
|
+
logger.info("[SessionComponent] Using memory storage");
|
|
81
|
+
}
|
|
82
|
+
this.setStatus("running");
|
|
83
|
+
logger.info("[SessionComponent] Initialized");
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 获取默认 session 数据库路径
|
|
87
|
+
*/
|
|
88
|
+
getDefaultSessionDbPath() {
|
|
89
|
+
const home = process.env.HOME || process.env.USERPROFILE || "/tmp";
|
|
90
|
+
return path.join(home, ".local", "share", "roy-agent", "sessions.db");
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 注册配置到 ConfigComponent
|
|
94
|
+
*
|
|
95
|
+
* 配置加载顺序(优先级从低到高):
|
|
96
|
+
* 1. Defaults - 默认值(最低)
|
|
97
|
+
* 2. FileSource - 从配置文件加载
|
|
98
|
+
* 3. EnvSource - 从环境变量加载
|
|
99
|
+
* 4. config 对象 - 直接传入的配置(最高)
|
|
100
|
+
*/
|
|
101
|
+
async registerConfig(options) {
|
|
102
|
+
const configComponent = options.configComponent;
|
|
103
|
+
if (!configComponent)
|
|
104
|
+
return;
|
|
105
|
+
const { configPath, envPrefix, config } = options;
|
|
106
|
+
const prefix = envPrefix !== undefined ? envPrefix : "SESSION";
|
|
107
|
+
// 1. 使用 registerComponent 注册配置结构(keys 和 sources,不含 defaults)
|
|
108
|
+
configComponent.registerComponent(SESSION_CONFIG_REGISTRATION);
|
|
109
|
+
// 2. 注册 FileSource(如果提供了 configPath)
|
|
110
|
+
if (configPath) {
|
|
111
|
+
configComponent.registerSource({
|
|
112
|
+
type: "file",
|
|
113
|
+
relativePath: configPath,
|
|
114
|
+
optional: true,
|
|
115
|
+
watch: false
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
// 3. 注册 EnvSource
|
|
119
|
+
configComponent.registerSource({
|
|
120
|
+
type: "env",
|
|
121
|
+
envPrefix: prefix,
|
|
122
|
+
priority: 20,
|
|
123
|
+
watch: false
|
|
124
|
+
});
|
|
125
|
+
// 4. 从 sources 加载配置(FileSource 和 EnvSource)
|
|
126
|
+
await configComponent.load("session");
|
|
127
|
+
// 5. 后备方案:直接读取环境变量(确保所有环境变量都被处理)
|
|
128
|
+
for (const envKey of Object.keys(process.env)) {
|
|
129
|
+
const configKey = envKeyToConfigKey(envKey, prefix, "session");
|
|
130
|
+
if (!configKey)
|
|
131
|
+
continue;
|
|
132
|
+
const value = process.env[envKey];
|
|
133
|
+
if (value !== undefined) {
|
|
134
|
+
await configComponent.set(configKey, value);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// 6. 设置默认值(只有当配置不存在时)
|
|
138
|
+
for (const [key, value] of Object.entries(SESSION_DEFAULTS)) {
|
|
139
|
+
if (configComponent.get(key) === undefined) {
|
|
140
|
+
await configComponent.set(key, value);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// 7. 特殊处理 dbPath 动态默认值(优先级高于 SESSION_DEFAULTS)
|
|
144
|
+
if (configComponent.get("session.storage.dbPath") === undefined) {
|
|
145
|
+
await configComponent.set("session.storage.dbPath", this.getDefaultSessionDbPath());
|
|
146
|
+
}
|
|
147
|
+
// 8. 直接配置对象(最高优先级)
|
|
148
|
+
if (config) {
|
|
149
|
+
const flatConfig = this.flattenConfig(config);
|
|
150
|
+
for (const [key, value] of Object.entries(flatConfig)) {
|
|
151
|
+
await configComponent.set(key, value);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// 9. 注册配置热更新监听
|
|
155
|
+
this.registerConfigWatcher(configComponent);
|
|
156
|
+
// 10. 解析最终配置
|
|
157
|
+
this.config = this.buildConfig(configComponent);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* 构建最终配置对象
|
|
161
|
+
*/
|
|
162
|
+
buildConfig(configComponent) {
|
|
163
|
+
return {
|
|
164
|
+
defaultDirectory: configComponent.get("session.defaultDirectory"),
|
|
165
|
+
defaultTitleTemplate: configComponent.get("session.defaultTitleTemplate"),
|
|
166
|
+
maxMessages: configComponent.get("session.maxMessages"),
|
|
167
|
+
compactionThreshold: configComponent.get("session.compactionThreshold"),
|
|
168
|
+
autoCompact: configComponent.get("session.autoCompact"),
|
|
169
|
+
storage: {
|
|
170
|
+
type: configComponent.get("session.storage.type"),
|
|
171
|
+
dbPath: configComponent.get("session.storage.dbPath"),
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* 将配置对象展平为点号路径
|
|
177
|
+
*/
|
|
178
|
+
flattenConfig(obj, prefix = "session") {
|
|
179
|
+
const result = {};
|
|
180
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
181
|
+
const fullKey = `${prefix}.${key}`;
|
|
182
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
183
|
+
Object.assign(result, this.flattenConfig(value, fullKey));
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
result[fullKey] = value;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* 注册配置热更新监听
|
|
193
|
+
*/
|
|
194
|
+
registerConfigWatcher(configComponent) {
|
|
195
|
+
if (typeof configComponent.watch !== "function") {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
this.configWatcher = configComponent.watch("session.*", (event) => {
|
|
199
|
+
this.onConfigChange(event);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* 处理配置变更
|
|
204
|
+
*/
|
|
205
|
+
onConfigChange(event) {
|
|
206
|
+
logger.info(`Session config changed: ${event.key}`, {
|
|
207
|
+
oldValue: event.oldValue,
|
|
208
|
+
newValue: event.newValue
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Start the component
|
|
213
|
+
*/
|
|
214
|
+
async onStart() {
|
|
215
|
+
logger.info("[SessionComponent] Started");
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Stop the component
|
|
219
|
+
*/
|
|
220
|
+
async onStop() {
|
|
221
|
+
// 清理配置 watcher
|
|
222
|
+
this.configWatcher?.();
|
|
223
|
+
this.configWatcher = undefined;
|
|
224
|
+
// 清理资源
|
|
225
|
+
await this.store?.close();
|
|
226
|
+
this.store = undefined;
|
|
227
|
+
this.setStatus("stopped");
|
|
228
|
+
logger.info("[SessionComponent] Stopped");
|
|
229
|
+
}
|
|
230
|
+
// ============ Session CRUD ============
|
|
231
|
+
/**
|
|
232
|
+
* Create a new session
|
|
233
|
+
*/
|
|
234
|
+
async create(options = {}) {
|
|
235
|
+
// Execute before hooks
|
|
236
|
+
await this.executeBeforeHooks("create", { options });
|
|
237
|
+
// Generate title if not provided
|
|
238
|
+
const title = options.title ?? this.generateTitle();
|
|
239
|
+
// Create session
|
|
240
|
+
const session = await this.store.create({
|
|
241
|
+
...options,
|
|
242
|
+
title,
|
|
243
|
+
});
|
|
244
|
+
logger.info(`[SessionComponent] Created session: ${session.id}`, { title });
|
|
245
|
+
// Execute after hooks
|
|
246
|
+
await this.executeAfterHooks("create", { session, options });
|
|
247
|
+
return session;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Get a session by ID
|
|
251
|
+
*/
|
|
252
|
+
async get(id) {
|
|
253
|
+
await this.executeBeforeHooks("session.get", { id });
|
|
254
|
+
const session = await this.store?.get(id);
|
|
255
|
+
await this.executeAfterHooks("session.get", { session });
|
|
256
|
+
return session;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Get a session with full context (for Memory Agent)
|
|
260
|
+
*/
|
|
261
|
+
async getSession(id) {
|
|
262
|
+
const session = await this.get(id);
|
|
263
|
+
if (!session) {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
const messages = await this.getMessages(id);
|
|
267
|
+
return {
|
|
268
|
+
sessionId: session.id,
|
|
269
|
+
title: session.title || "Untitled",
|
|
270
|
+
messages: messages.map(m => ({
|
|
271
|
+
role: m.role,
|
|
272
|
+
content: m.content,
|
|
273
|
+
timestamp: m.timestamp,
|
|
274
|
+
})),
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Search sessions by query (for Memory Agent)
|
|
279
|
+
*
|
|
280
|
+
* Simple implementation: list all sessions and return them for the agent to filter
|
|
281
|
+
*/
|
|
282
|
+
async searchSessions(query, options) {
|
|
283
|
+
const limit = options?.limit ?? 20;
|
|
284
|
+
// 如果指定了 session_id,只返回该会话
|
|
285
|
+
if (options?.session_id) {
|
|
286
|
+
const session = await this.get(options.session_id);
|
|
287
|
+
if (session) {
|
|
288
|
+
const messages = await this.getMessages(options.session_id);
|
|
289
|
+
const lastMessage = messages[messages.length - 1];
|
|
290
|
+
return [{
|
|
291
|
+
sessionId: session.id,
|
|
292
|
+
title: session.title || "Untitled",
|
|
293
|
+
preview: lastMessage?.content?.substring(0, 200) || "",
|
|
294
|
+
timestamp: session.updatedAt || session.createdAt,
|
|
295
|
+
}];
|
|
296
|
+
}
|
|
297
|
+
return [];
|
|
298
|
+
}
|
|
299
|
+
// 否则列出所有会话
|
|
300
|
+
const sessions = await this.list({ limit });
|
|
301
|
+
// 对每个会话获取预览
|
|
302
|
+
const results = [];
|
|
303
|
+
for (const session of sessions) {
|
|
304
|
+
if (results.length >= limit)
|
|
305
|
+
break;
|
|
306
|
+
const messages = await this.getMessages(session.id);
|
|
307
|
+
const lastMessage = messages[messages.length - 1];
|
|
308
|
+
const preview = lastMessage?.content?.substring(0, 200) || "";
|
|
309
|
+
// 简单过滤:如果 query 不为空,检查标题或预览是否包含 query
|
|
310
|
+
if (query) {
|
|
311
|
+
const lowerQuery = query.toLowerCase();
|
|
312
|
+
const titleMatch = (session.title || "").toLowerCase().includes(lowerQuery);
|
|
313
|
+
const previewMatch = preview.toLowerCase().includes(lowerQuery);
|
|
314
|
+
if (!titleMatch && !previewMatch) {
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
results.push({
|
|
319
|
+
sessionId: session.id,
|
|
320
|
+
title: session.title || "Untitled",
|
|
321
|
+
preview,
|
|
322
|
+
timestamp: session.updatedAt || session.createdAt,
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
return results;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* List all sessions
|
|
329
|
+
*/
|
|
330
|
+
async list(options) {
|
|
331
|
+
await this.executeBeforeHooks("session.list", { options });
|
|
332
|
+
const sessions = (await this.store?.list(options)) ?? [];
|
|
333
|
+
await this.executeAfterHooks("session.list", { sessions });
|
|
334
|
+
return sessions;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Get total session count
|
|
338
|
+
*/
|
|
339
|
+
async getCount() {
|
|
340
|
+
return (await this.store?.getCount()) ?? 0;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Update a session
|
|
344
|
+
*/
|
|
345
|
+
async update(id, updates) {
|
|
346
|
+
await this.executeBeforeHooks("session.update", { id, updates });
|
|
347
|
+
const success = await this.store?.update(id, updates);
|
|
348
|
+
if (success) {
|
|
349
|
+
logger.info(`[SessionComponent] Updated session: ${id}`, { updates });
|
|
350
|
+
await this.executeAfterHooks("session.update", { id, updates });
|
|
351
|
+
}
|
|
352
|
+
return success ?? false;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Delete a session
|
|
356
|
+
*/
|
|
357
|
+
async delete(id) {
|
|
358
|
+
await this.executeBeforeHooks("session.delete", { id });
|
|
359
|
+
const success = await this.store?.delete(id);
|
|
360
|
+
if (success) {
|
|
361
|
+
if (this.activeSessionId === id) {
|
|
362
|
+
this.activeSessionId = undefined;
|
|
363
|
+
}
|
|
364
|
+
logger.info(`[SessionComponent] Deleted session: ${id}`);
|
|
365
|
+
await this.executeAfterHooks("session.delete", { id });
|
|
366
|
+
}
|
|
367
|
+
return success ?? false;
|
|
368
|
+
}
|
|
369
|
+
// ============ Active Session ============
|
|
370
|
+
/**
|
|
371
|
+
* Get the current active session
|
|
372
|
+
*/
|
|
373
|
+
getActiveSession() {
|
|
374
|
+
if (!this.activeSessionId)
|
|
375
|
+
return undefined;
|
|
376
|
+
// Synchronous getter, so we need to handle this carefully
|
|
377
|
+
// In a real implementation, we'd cache the active session
|
|
378
|
+
return undefined; // Will be populated by callers who need it
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Get the active session ID
|
|
382
|
+
*/
|
|
383
|
+
getActiveSessionId() {
|
|
384
|
+
return this.activeSessionId;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Set the active session
|
|
388
|
+
*/
|
|
389
|
+
async setActiveSession(id) {
|
|
390
|
+
const session = await this.store?.get(id);
|
|
391
|
+
if (!session)
|
|
392
|
+
return false;
|
|
393
|
+
this.activeSessionId = id;
|
|
394
|
+
logger.info(`[SessionComponent] Active session set: ${id}`);
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
// ============ Messages ============
|
|
398
|
+
/**
|
|
399
|
+
* Add a message to a session
|
|
400
|
+
*/
|
|
401
|
+
async addMessage(sessionId, message) {
|
|
402
|
+
// DEBUG: 记录添加消息的调用栈
|
|
403
|
+
const contentPreview = typeof message.content === "string"
|
|
404
|
+
? message.content.substring(0, 100)
|
|
405
|
+
: JSON.stringify(message.content).substring(0, 100);
|
|
406
|
+
logger.info(`[SessionComponent.addMessage] sessionId=${sessionId}, role=${message.role}, content="${contentPreview}"`);
|
|
407
|
+
try {
|
|
408
|
+
const messageId = await this.store?.addMessage(sessionId, message);
|
|
409
|
+
logger.info(`[SessionComponent.addMessage] Success: messageId=${messageId}`);
|
|
410
|
+
return messageId;
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
logger.error(`[SessionComponent] Failed to add message: ${error}`);
|
|
414
|
+
return undefined;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Get messages from a session
|
|
419
|
+
*/
|
|
420
|
+
async getMessages(sessionId, options) {
|
|
421
|
+
const messages = await this.store?.getMessages(sessionId, options?.offset, options?.limit);
|
|
422
|
+
return messages ?? [];
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Get message count for a session
|
|
426
|
+
*/
|
|
427
|
+
async getMessageCount(sessionId, includeArchived) {
|
|
428
|
+
return this.store?.getMessageCount(sessionId, includeArchived) ?? 0;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Get indexes of all messages with the specified role
|
|
432
|
+
* @param sessionId - Session ID
|
|
433
|
+
* @param role - Role to filter by (e.g., "user", "assistant")
|
|
434
|
+
* @returns Array of message indexes (0-indexed, in chronological order)
|
|
435
|
+
*/
|
|
436
|
+
async getMessageIndexes(sessionId, role) {
|
|
437
|
+
return this.store?.getMessageIndexes(sessionId, role) ?? [];
|
|
438
|
+
}
|
|
439
|
+
// ============ Hooks ============
|
|
440
|
+
async executeBeforeHooks(operation, context) {
|
|
441
|
+
// operation is like "create", so key should be "before.session.create"
|
|
442
|
+
const hookKey = `before.session.${operation}`;
|
|
443
|
+
const hooks = this.hooksConfig[hookKey] ?? [];
|
|
444
|
+
const hookContext = context;
|
|
445
|
+
// Execute registered hooks first
|
|
446
|
+
for (const hook of hooks) {
|
|
447
|
+
if (hook.before) {
|
|
448
|
+
await hook.before(hookContext);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
// Also execute from hooks config if passed in options
|
|
452
|
+
const options = context.options;
|
|
453
|
+
if (options?.hooks) {
|
|
454
|
+
// options.hooks has keys like "before.session.create"
|
|
455
|
+
const hookArray = options.hooks[hookKey] ?? [];
|
|
456
|
+
for (const hook of hookArray) {
|
|
457
|
+
if (hook.before) {
|
|
458
|
+
await hook.before(hookContext);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
async executeAfterHooks(operation, context) {
|
|
464
|
+
const hookKey = `after.session.${operation}`;
|
|
465
|
+
const hooks = this.hooksConfig[hookKey] ?? [];
|
|
466
|
+
const hookContext = context;
|
|
467
|
+
// Execute registered hooks first
|
|
468
|
+
for (const hook of hooks) {
|
|
469
|
+
if (hook.after) {
|
|
470
|
+
await hook.after(hookContext);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
// Also execute from hooks config if passed in options
|
|
474
|
+
const options = context.options;
|
|
475
|
+
if (options?.hooks) {
|
|
476
|
+
// options.hooks has keys like "after.session.create"
|
|
477
|
+
const hookArray = options.hooks[hookKey] ?? [];
|
|
478
|
+
for (const hook of hookArray) {
|
|
479
|
+
if (hook.after) {
|
|
480
|
+
await hook.after(hookContext);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
// ============ Helper Methods ============
|
|
486
|
+
generateTitle() {
|
|
487
|
+
const template = this.config?.defaultTitleTemplate ?? "Session - {date}";
|
|
488
|
+
const date = new Date().toISOString().replace("T", " ").substring(0, 19);
|
|
489
|
+
return template.replace("{date}", date);
|
|
490
|
+
}
|
|
491
|
+
// ============ Checkpoint Management [new] ============
|
|
492
|
+
/**
|
|
493
|
+
* Set components for SummaryAgent
|
|
494
|
+
*
|
|
495
|
+
* Call this after initialization if you need compact functionality
|
|
496
|
+
*/
|
|
497
|
+
setSummaryComponents(promptComponent, llmComponent) {
|
|
498
|
+
this.promptComponent = promptComponent;
|
|
499
|
+
this.llmComponent = llmComponent;
|
|
500
|
+
this.summaryAgent = new SummaryAgent(promptComponent, llmComponent);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* 初始化 SummaryAgent(如未初始化)
|
|
504
|
+
*/
|
|
505
|
+
ensureSummaryAgent() {
|
|
506
|
+
if (!this.summaryAgent) {
|
|
507
|
+
if (!this.promptComponent || !this.llmComponent) {
|
|
508
|
+
throw new Error("SummaryAgent components not initialized. Call setSummaryComponents() first.");
|
|
509
|
+
}
|
|
510
|
+
this.summaryAgent = new SummaryAgent(this.promptComponent, this.llmComponent);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* 生成场景化压缩提示 (Compact Hint)
|
|
515
|
+
*
|
|
516
|
+
* 两阶段自动压缩的第一阶段:
|
|
517
|
+
* 根据会话历史生成场景化的压缩提示
|
|
518
|
+
*
|
|
519
|
+
* @param sessionId 会话 ID
|
|
520
|
+
* @returns 生成的场景化提示
|
|
521
|
+
*/
|
|
522
|
+
async generateCompactHint(sessionId) {
|
|
523
|
+
const session = await this.get(sessionId);
|
|
524
|
+
if (!session) {
|
|
525
|
+
throw new Error(`Session not found: ${sessionId}`);
|
|
526
|
+
}
|
|
527
|
+
// 获取最新 checkpoint 之后的所有消息
|
|
528
|
+
const latestCheckpoint = this.getLatestCheckpoint(session);
|
|
529
|
+
const startIndex = latestCheckpoint?.messageIndex ?? 0;
|
|
530
|
+
const MAX_SAFE_MESSAGES = Number.MAX_SAFE_INTEGER;
|
|
531
|
+
const messages = await this.store.getMessages(sessionId, startIndex, MAX_SAFE_MESSAGES, { includeArchived: false });
|
|
532
|
+
if (messages.length < 3) {
|
|
533
|
+
logger.warn("[SessionComponent] Not enough messages for hint generation");
|
|
534
|
+
return "";
|
|
535
|
+
}
|
|
536
|
+
// 确保 SummaryAgent 已初始化
|
|
537
|
+
this.ensureSummaryAgent();
|
|
538
|
+
// 生成提示
|
|
539
|
+
const result = await this.summaryAgent.generateCompactHint({
|
|
540
|
+
messages: messages.map((m) => ({ role: m.role, content: m.content })),
|
|
541
|
+
sessionContext: {
|
|
542
|
+
// 可以扩展更多上下文信息
|
|
543
|
+
},
|
|
544
|
+
});
|
|
545
|
+
logger.info("[SessionComponent] Compact hint generated", {
|
|
546
|
+
sessionId,
|
|
547
|
+
hintLength: result.hint.length,
|
|
548
|
+
});
|
|
549
|
+
return result.hint;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Compact a session
|
|
553
|
+
*
|
|
554
|
+
* 1. Get messages from latest checkpoint to current
|
|
555
|
+
* 2. Call Summary Agent to generate checkpoint
|
|
556
|
+
* 3. Save checkpoint and archive messages
|
|
557
|
+
*
|
|
558
|
+
* 支持 scenarioHint 参数,用于指导不同场景下的压缩重点提取
|
|
559
|
+
*/
|
|
560
|
+
async compact(sessionId, options) {
|
|
561
|
+
const session = await this.get(sessionId);
|
|
562
|
+
if (!session) {
|
|
563
|
+
throw new Error(`Session not found: ${sessionId}`);
|
|
564
|
+
}
|
|
565
|
+
// 1. Determine start position
|
|
566
|
+
const latestCheckpoint = this.getLatestCheckpoint(session);
|
|
567
|
+
const startIndex = latestCheckpoint?.messageIndex ?? 0;
|
|
568
|
+
// 2. Get messages to compact
|
|
569
|
+
// Use MAX_SAFE_INTEGER to ensure we get ALL messages (default limit=50 can cause issues)
|
|
570
|
+
const MAX_SAFE_MESSAGES = Number.MAX_SAFE_INTEGER;
|
|
571
|
+
const messages = await this.store.getMessages(sessionId, startIndex, MAX_SAFE_MESSAGES, { includeArchived: false });
|
|
572
|
+
if (messages.length < 3) {
|
|
573
|
+
throw new Error("Not enough messages to compact (minimum 3 required)");
|
|
574
|
+
}
|
|
575
|
+
// 3. Extract recent messages for checkpoint context
|
|
576
|
+
// We need the last 2 turns of user query + assistant text response (no tool calls/results)
|
|
577
|
+
const recentMessages = this.extractRecentMessages(messages, 2);
|
|
578
|
+
// 4. Ensure Summary Agent is initialized
|
|
579
|
+
this.ensureSummaryAgent();
|
|
580
|
+
// 5. Execute before hooks
|
|
581
|
+
await this.executeBeforeHooks("compact", { session, options });
|
|
582
|
+
// 6. Call Summary Agent (with scenarioHint if provided)
|
|
583
|
+
const summaryResult = await this.summaryAgent.run({
|
|
584
|
+
messages: messages.map((m) => ({ role: m.role, content: m.content })),
|
|
585
|
+
userContext: options?.summary,
|
|
586
|
+
outputFormat: "json",
|
|
587
|
+
scenarioHint: options?.scenarioHint, // Pass scenario hint to SummaryAgent
|
|
588
|
+
});
|
|
589
|
+
// 7. Generate checkpoint ID
|
|
590
|
+
const checkpointId = `cp_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 8)}`;
|
|
591
|
+
// 8. Create checkpoint object (include recentMessages for fresh history context)
|
|
592
|
+
const checkpoint = {
|
|
593
|
+
id: checkpointId,
|
|
594
|
+
messageIndex: startIndex,
|
|
595
|
+
title: summaryResult.title,
|
|
596
|
+
summary: [
|
|
597
|
+
`Process: ${summaryResult.processKeyPoints.join("; ")}`,
|
|
598
|
+
`State: ${summaryResult.currentState}`,
|
|
599
|
+
].join("\n"),
|
|
600
|
+
processKeyPoints: summaryResult.processKeyPoints,
|
|
601
|
+
currentState: summaryResult.currentState,
|
|
602
|
+
nextSteps: summaryResult.nextSteps,
|
|
603
|
+
userIntents: summaryResult.userIntents,
|
|
604
|
+
messageCountBefore: messages.length,
|
|
605
|
+
createdAt: Date.now(),
|
|
606
|
+
type: "compact",
|
|
607
|
+
recentMessages, // Preserve recent messages for context
|
|
608
|
+
};
|
|
609
|
+
// 9. Save checkpoint
|
|
610
|
+
await this.store.saveCheckpoint(sessionId, checkpoint);
|
|
611
|
+
// 10. Archive messages
|
|
612
|
+
await this.store.archiveMessages(sessionId, checkpointId, messages.length);
|
|
613
|
+
// 11. Create and add checkpoint message (user role)
|
|
614
|
+
const checkpointMessage = this.createCheckpointMessage(checkpoint);
|
|
615
|
+
await this.store.addMessage(sessionId, checkpointMessage);
|
|
616
|
+
// 12. Update session
|
|
617
|
+
const updatedSession = await this.get(sessionId);
|
|
618
|
+
const remainingMessageCount = updatedSession?.messageCount ?? 0;
|
|
619
|
+
const checkpointCount = updatedSession?.metadata?.checkpoints?.checkpoints?.length ?? 0;
|
|
620
|
+
logger.info(`[SessionComponent] Compacted session: ${sessionId}`, {
|
|
621
|
+
checkpointId,
|
|
622
|
+
archivedCount: messages.length,
|
|
623
|
+
remainingCount: remainingMessageCount,
|
|
624
|
+
hasScenarioHint: !!options?.scenarioHint,
|
|
625
|
+
recentMessagesCount: recentMessages.length,
|
|
626
|
+
});
|
|
627
|
+
// 13. Execute after hooks
|
|
628
|
+
await this.executeAfterHooks("compact", { session, checkpoint, options });
|
|
629
|
+
return {
|
|
630
|
+
checkpoint,
|
|
631
|
+
deletedMessageCount: messages.length,
|
|
632
|
+
remainingMessageCount,
|
|
633
|
+
checkpointCount,
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Extract recent messages from the conversation for checkpoint context
|
|
638
|
+
*
|
|
639
|
+
* Extracts the last N turns of user query + assistant text response,
|
|
640
|
+
* excluding tool calls and tool results.
|
|
641
|
+
*
|
|
642
|
+
* @param messages - All messages in the conversation
|
|
643
|
+
* @param turnCount - Number of turns to extract (default: 2)
|
|
644
|
+
* @returns Array of recent messages formatted as { role, content }
|
|
645
|
+
*/
|
|
646
|
+
extractRecentMessages(messages, turnCount = 2) {
|
|
647
|
+
const recentMessages = [];
|
|
648
|
+
let turnsExtracted = 0;
|
|
649
|
+
// Iterate from the most recent messages backwards
|
|
650
|
+
// We need to find user + assistant pairs
|
|
651
|
+
let i = messages.length - 1;
|
|
652
|
+
while (i >= 0 && turnsExtracted < turnCount) {
|
|
653
|
+
const msg = messages[i];
|
|
654
|
+
// Skip checkpoint messages
|
|
655
|
+
if (msg.metadata?.isCheckpoint) {
|
|
656
|
+
i--;
|
|
657
|
+
continue;
|
|
658
|
+
}
|
|
659
|
+
// Check if this is a text response (no tool calls/results)
|
|
660
|
+
const hasToolParts = msg.parts?.some(p => p.type === 'tool-call' || p.type === 'tool-result');
|
|
661
|
+
if (msg.role === 'assistant' && !hasToolParts && msg.content.trim()) {
|
|
662
|
+
// Found an assistant text response
|
|
663
|
+
recentMessages.unshift({
|
|
664
|
+
role: 'assistant',
|
|
665
|
+
content: msg.content,
|
|
666
|
+
});
|
|
667
|
+
// Look for the preceding user message
|
|
668
|
+
let j = i - 1;
|
|
669
|
+
while (j >= 0) {
|
|
670
|
+
const prevMsg = messages[j];
|
|
671
|
+
if (prevMsg.metadata?.isCheckpoint) {
|
|
672
|
+
j--;
|
|
673
|
+
continue;
|
|
674
|
+
}
|
|
675
|
+
if (prevMsg.role === 'user') {
|
|
676
|
+
recentMessages.unshift({
|
|
677
|
+
role: 'user',
|
|
678
|
+
content: prevMsg.content,
|
|
679
|
+
});
|
|
680
|
+
turnsExtracted++;
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
683
|
+
j--;
|
|
684
|
+
}
|
|
685
|
+
i = j;
|
|
686
|
+
}
|
|
687
|
+
else {
|
|
688
|
+
i--;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
logger.debug("[SessionComponent] Extracted recent messages", {
|
|
692
|
+
turnCount,
|
|
693
|
+
messagesExtracted: recentMessages.length,
|
|
694
|
+
});
|
|
695
|
+
return recentMessages;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Preview compact operation
|
|
699
|
+
*/
|
|
700
|
+
async previewCompact(sessionId) {
|
|
701
|
+
const session = await this.get(sessionId);
|
|
702
|
+
if (!session) {
|
|
703
|
+
throw new Error(`Session not found: ${sessionId}`);
|
|
704
|
+
}
|
|
705
|
+
const latestCheckpoint = this.getLatestCheckpoint(session);
|
|
706
|
+
const startIndex = latestCheckpoint?.messageIndex ?? 0;
|
|
707
|
+
// Use MAX_SAFE_INTEGER to ensure we get ALL messages (default limit=50 can cause issues)
|
|
708
|
+
const MAX_SAFE_MESSAGES = Number.MAX_SAFE_INTEGER;
|
|
709
|
+
const messages = await this.store.getMessages(sessionId, startIndex, MAX_SAFE_MESSAGES, { includeArchived: false });
|
|
710
|
+
// Rough estimate: ~4 tokens per character
|
|
711
|
+
const estimatedTokens = messages.reduce((sum, m) => sum + m.content.length * 0.25, 0);
|
|
712
|
+
return {
|
|
713
|
+
messageCountToCompact: messages.length,
|
|
714
|
+
estimatedCheckpointTokens: Math.round(estimatedTokens * 0.1), // Checkpoint is ~10% of original
|
|
715
|
+
wouldTrigger: messages.length >= (this.config?.maxMessages ?? 50),
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Get all checkpoints for a session
|
|
720
|
+
*/
|
|
721
|
+
async getCheckpoints(sessionId) {
|
|
722
|
+
return await this.store.getCheckpoints(sessionId);
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Get a specific checkpoint
|
|
726
|
+
*/
|
|
727
|
+
async getCheckpoint(sessionId, checkpointId) {
|
|
728
|
+
return await this.store.getCheckpoint(sessionId, checkpointId);
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Delete a checkpoint and restore archived messages
|
|
732
|
+
*/
|
|
733
|
+
async deleteCheckpoint(sessionId, checkpointId) {
|
|
734
|
+
await this.executeBeforeHooks("deleteCheckpoint", { sessionId, checkpointId });
|
|
735
|
+
const success = await this.store.deleteCheckpoint(sessionId, checkpointId);
|
|
736
|
+
if (success) {
|
|
737
|
+
logger.info(`[SessionComponent] Deleted checkpoint: ${checkpointId}`);
|
|
738
|
+
await this.executeAfterHooks("deleteCheckpoint", { sessionId, checkpointId });
|
|
739
|
+
}
|
|
740
|
+
return success;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Get session context
|
|
744
|
+
*
|
|
745
|
+
* Returns messages starting from the latest checkpoint by default
|
|
746
|
+
*/
|
|
747
|
+
async getContext(sessionId, options) {
|
|
748
|
+
const session = await this.get(sessionId);
|
|
749
|
+
if (!session) {
|
|
750
|
+
throw new Error(`Session not found`);
|
|
751
|
+
}
|
|
752
|
+
let contextMessages = [];
|
|
753
|
+
let startCheckpoint;
|
|
754
|
+
if (options?.fullHistory) {
|
|
755
|
+
// Get ALL messages including archived ones (for full history view)
|
|
756
|
+
const MAX_SAFE_MESSAGES = Number.MAX_SAFE_INTEGER;
|
|
757
|
+
contextMessages = await this.store.getMessages(sessionId, 0, MAX_SAFE_MESSAGES, {
|
|
758
|
+
includeArchived: true,
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
else {
|
|
762
|
+
// Optimization: Start from latest checkpoint instead of reading all messages
|
|
763
|
+
// This avoids reading archived messages that have been compacted
|
|
764
|
+
const latestCheckpointId = session.metadata?.checkpoints?.latestCheckpointId;
|
|
765
|
+
if (latestCheckpointId) {
|
|
766
|
+
// Get checkpoint details to find messageIndex
|
|
767
|
+
startCheckpoint = await this.store.getCheckpoint(sessionId, latestCheckpointId);
|
|
768
|
+
if (startCheckpoint) {
|
|
769
|
+
// Read messages from checkpoint position onwards
|
|
770
|
+
const MAX_SAFE_MESSAGES = Number.MAX_SAFE_INTEGER;
|
|
771
|
+
contextMessages = await this.store.getMessages(sessionId, startCheckpoint.messageIndex, MAX_SAFE_MESSAGES, { includeArchived: false });
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
// If no checkpoint found, read from beginning (first session)
|
|
775
|
+
if (contextMessages.length === 0) {
|
|
776
|
+
const MAX_SAFE_MESSAGES = Number.MAX_SAFE_INTEGER;
|
|
777
|
+
contextMessages = await this.store.getMessages(sessionId, 0, MAX_SAFE_MESSAGES, {
|
|
778
|
+
includeArchived: false,
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
// Ensure starting from user message boundary (avoids tool_call/tool_result mismatch)
|
|
783
|
+
if (options?.minUserMessages && options.minUserMessages > 0) {
|
|
784
|
+
const userIndexes = [];
|
|
785
|
+
for (let i = 0; i < contextMessages.length; i++) {
|
|
786
|
+
if (contextMessages[i].role === "user") {
|
|
787
|
+
userIndexes.push(i);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
if (userIndexes.length > options.minUserMessages) {
|
|
791
|
+
const targetIndex = userIndexes[userIndexes.length - options.minUserMessages];
|
|
792
|
+
contextMessages = contextMessages.slice(targetIndex);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
// Apply message limit (after minUserMessages processing)
|
|
796
|
+
if (options?.messageLimit) {
|
|
797
|
+
contextMessages = contextMessages.slice(-options.messageLimit);
|
|
798
|
+
}
|
|
799
|
+
// Extract checkpoint info
|
|
800
|
+
const checkpoints = contextMessages
|
|
801
|
+
.filter((m) => m.metadata?.isCheckpoint)
|
|
802
|
+
.map((m) => m.metadata.checkpointMeta);
|
|
803
|
+
// Estimate tokens
|
|
804
|
+
const estimatedTokens = contextMessages.reduce((sum, m) => sum + m.content.length * 0.25, 0);
|
|
805
|
+
return {
|
|
806
|
+
session,
|
|
807
|
+
checkpoints,
|
|
808
|
+
startCheckpoint: startCheckpoint ?? checkpoints[checkpoints.length - 1],
|
|
809
|
+
messages: contextMessages,
|
|
810
|
+
totalMessageCount: contextMessages.length,
|
|
811
|
+
activeMessageCount: contextMessages.filter((m) => !m.isArchived).length,
|
|
812
|
+
archivedMessageCount: contextMessages.filter((m) => m.isArchived).length,
|
|
813
|
+
estimatedTokens: Math.round(estimatedTokens),
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Check if session needs compaction
|
|
818
|
+
*/
|
|
819
|
+
async shouldCompact(sessionId) {
|
|
820
|
+
const session = await this.get(sessionId);
|
|
821
|
+
if (!session)
|
|
822
|
+
return false;
|
|
823
|
+
const preview = await this.previewCompact(sessionId);
|
|
824
|
+
return preview.wouldTrigger;
|
|
825
|
+
}
|
|
826
|
+
// ============ Search [new] ============
|
|
827
|
+
/**
|
|
828
|
+
* Search messages across sessions
|
|
829
|
+
*
|
|
830
|
+
* Searches all messages matching the query, aggregated by session.
|
|
831
|
+
* Supports SQLite FTS5 for fast full-text search.
|
|
832
|
+
*/
|
|
833
|
+
async searchMessages(options) {
|
|
834
|
+
const { query, sessionId, limit = 10, maxResults = 100, beforeTime, afterTime, includeArchived = false, includeContext = false, contextLines = 2, } = options;
|
|
835
|
+
// Delegate to store for actual search
|
|
836
|
+
if (!this.store) {
|
|
837
|
+
return [];
|
|
838
|
+
}
|
|
839
|
+
// Get all sessions or specific session
|
|
840
|
+
let sessions;
|
|
841
|
+
if (sessionId) {
|
|
842
|
+
const session = await this.get(sessionId);
|
|
843
|
+
sessions = session ? [session] : [];
|
|
844
|
+
}
|
|
845
|
+
else {
|
|
846
|
+
sessions = await this.list({ limit: 1000 }); // Get all sessions
|
|
847
|
+
}
|
|
848
|
+
const results = [];
|
|
849
|
+
let totalMatches = 0;
|
|
850
|
+
for (const session of sessions) {
|
|
851
|
+
// Check time constraints
|
|
852
|
+
if (beforeTime && session.updatedAt > beforeTime)
|
|
853
|
+
continue;
|
|
854
|
+
if (afterTime && session.updatedAt < afterTime)
|
|
855
|
+
continue;
|
|
856
|
+
// Search messages in this session
|
|
857
|
+
const messages = await this.store.getMessages(session.id, 0, 1000, { includeArchived });
|
|
858
|
+
// Simple text search (case-insensitive, supports AND/OR/NOT)
|
|
859
|
+
const queryTerms = parseSearchQuery(query);
|
|
860
|
+
const matches = [];
|
|
861
|
+
for (const msg of messages) {
|
|
862
|
+
// Time constraints
|
|
863
|
+
if (beforeTime && msg.timestamp > beforeTime)
|
|
864
|
+
continue;
|
|
865
|
+
if (afterTime && msg.timestamp < afterTime)
|
|
866
|
+
continue;
|
|
867
|
+
// Check if message matches query
|
|
868
|
+
if (matchesQuery(msg.content, queryTerms)) {
|
|
869
|
+
const match = {
|
|
870
|
+
messageId: msg.id,
|
|
871
|
+
sessionId: session.id,
|
|
872
|
+
role: msg.role,
|
|
873
|
+
content: msg.content,
|
|
874
|
+
timestamp: msg.timestamp,
|
|
875
|
+
};
|
|
876
|
+
// Add context if requested
|
|
877
|
+
if (includeContext) {
|
|
878
|
+
const msgIndex = messages.indexOf(msg);
|
|
879
|
+
const beforeMsgs = messages.slice(Math.max(0, msgIndex - contextLines), msgIndex);
|
|
880
|
+
const afterMsgs = messages.slice(msgIndex + 1, msgIndex + 1 + contextLines);
|
|
881
|
+
match.contextBefore = beforeMsgs.map(m => m.content).join("\n");
|
|
882
|
+
match.contextAfter = afterMsgs.map(m => m.content).join("\n");
|
|
883
|
+
}
|
|
884
|
+
matches.push(match);
|
|
885
|
+
if (matches.length >= limit)
|
|
886
|
+
break;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
if (matches.length > 0) {
|
|
890
|
+
results.push({
|
|
891
|
+
sessionId: session.id,
|
|
892
|
+
sessionTitle: session.title,
|
|
893
|
+
sessionDirectory: session.directory,
|
|
894
|
+
updatedAt: session.updatedAt,
|
|
895
|
+
messageCount: session.messageCount,
|
|
896
|
+
matches,
|
|
897
|
+
});
|
|
898
|
+
totalMatches += matches.length;
|
|
899
|
+
if (totalMatches >= maxResults)
|
|
900
|
+
break;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
return results;
|
|
904
|
+
}
|
|
905
|
+
// ============ Private Helper Methods [new] ============
|
|
906
|
+
/**
|
|
907
|
+
* Get latest checkpoint from session
|
|
908
|
+
*/
|
|
909
|
+
getLatestCheckpoint(session) {
|
|
910
|
+
const latestId = session.metadata?.checkpoints?.latestCheckpointId;
|
|
911
|
+
if (!latestId)
|
|
912
|
+
return undefined;
|
|
913
|
+
return session.metadata?.checkpointDetails?.[latestId];
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Create checkpoint message (user role)
|
|
917
|
+
*
|
|
918
|
+
* Generates a markdown-formatted checkpoint summary as a user message,
|
|
919
|
+
* allowing it to appear in the message list and provide context for
|
|
920
|
+
* subsequent LLM calls.
|
|
921
|
+
*/
|
|
922
|
+
createCheckpointMessage(checkpoint) {
|
|
923
|
+
const lines = [
|
|
924
|
+
`# Checkpoint: ${checkpoint.title}`,
|
|
925
|
+
"",
|
|
926
|
+
"## Process Key Points",
|
|
927
|
+
...checkpoint.processKeyPoints.map((p, i) => `${i + 1}. ${p}`),
|
|
928
|
+
"",
|
|
929
|
+
"## Current State",
|
|
930
|
+
checkpoint.currentState,
|
|
931
|
+
"",
|
|
932
|
+
];
|
|
933
|
+
if (checkpoint.nextSteps?.length) {
|
|
934
|
+
lines.push("## Next Steps");
|
|
935
|
+
checkpoint.nextSteps.forEach((s, i) => lines.push(`${i + 1}. ${s}`));
|
|
936
|
+
lines.push("");
|
|
937
|
+
}
|
|
938
|
+
lines.push("## Messages Compacted");
|
|
939
|
+
lines.push(`${checkpoint.messageCountBefore} messages compacted at ${new Date(checkpoint.createdAt).toISOString()}`);
|
|
940
|
+
const content = lines.join("\n");
|
|
941
|
+
return {
|
|
942
|
+
role: "user",
|
|
943
|
+
content,
|
|
944
|
+
parts: [{
|
|
945
|
+
type: "checkpoint",
|
|
946
|
+
checkpointId: checkpoint.id,
|
|
947
|
+
content,
|
|
948
|
+
title: checkpoint.title,
|
|
949
|
+
processKeyPoints: checkpoint.processKeyPoints,
|
|
950
|
+
currentState: checkpoint.currentState,
|
|
951
|
+
nextSteps: checkpoint.nextSteps,
|
|
952
|
+
messageCountBefore: checkpoint.messageCountBefore,
|
|
953
|
+
createdAt: checkpoint.createdAt,
|
|
954
|
+
}],
|
|
955
|
+
metadata: {
|
|
956
|
+
isCheckpoint: true,
|
|
957
|
+
checkpointId: checkpoint.id,
|
|
958
|
+
checkpointMeta: checkpoint,
|
|
959
|
+
},
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
__decorate([
|
|
964
|
+
TracedAs("session.generateCompactHint"),
|
|
965
|
+
__metadata("design:type", Function),
|
|
966
|
+
__metadata("design:paramtypes", [String]),
|
|
967
|
+
__metadata("design:returntype", Promise)
|
|
968
|
+
], SessionComponent.prototype, "generateCompactHint", null);
|
|
969
|
+
__decorate([
|
|
970
|
+
TracedAs("session.compact", { recordParams: true, recordResult: true }),
|
|
971
|
+
__metadata("design:type", Function),
|
|
972
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
973
|
+
__metadata("design:returntype", Promise)
|
|
974
|
+
], SessionComponent.prototype, "compact", null);
|
|
975
|
+
__decorate([
|
|
976
|
+
TracedAs("session.extractRecentMessages"),
|
|
977
|
+
__metadata("design:type", Function),
|
|
978
|
+
__metadata("design:paramtypes", [Array, Number]),
|
|
979
|
+
__metadata("design:returntype", Array)
|
|
980
|
+
], SessionComponent.prototype, "extractRecentMessages", null);
|
|
981
|
+
//# sourceMappingURL=session-component.js.map
|