@machina.ai/cell-cli-core 1.38.1-rc2 → 1.40.1-rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/AFTER_MERGE_PROMPT.md +1 -1
- package/dist/docs/admin/enterprise-controls.md +1 -1
- package/dist/docs/changelogs/index.md +42 -0
- package/dist/docs/changelogs/latest.md +254 -361
- package/dist/docs/changelogs/preview.md +237 -406
- package/dist/docs/cli/acp-mode.md +6 -6
- package/dist/docs/cli/auto-memory.md +143 -0
- package/dist/docs/cli/checkpointing.md +5 -5
- package/dist/docs/cli/cli-reference.md +12 -11
- package/dist/docs/cli/creating-skills.md +2 -2
- package/dist/docs/cli/custom-commands.md +15 -14
- package/dist/docs/cli/enterprise.md +17 -14
- package/dist/docs/cli/gemini-ignore.md +2 -2
- package/dist/docs/cli/generation-settings.md +21 -20
- package/dist/docs/cli/model-routing.md +2 -2
- package/dist/docs/cli/model-steering.md +1 -1
- package/dist/docs/cli/plan-mode.md +11 -6
- package/dist/docs/cli/sandbox.md +7 -5
- package/dist/docs/cli/settings.md +32 -28
- package/dist/docs/cli/system-prompt.md +8 -8
- package/dist/docs/cli/telemetry.md +18 -11
- package/dist/docs/cli/themes.md +2 -2
- package/dist/docs/cli/trusted-folders.md +41 -13
- package/dist/docs/cli/tutorials/mcp-setup.md +1 -1
- package/dist/docs/cli/tutorials/memory-management.md +3 -1
- package/dist/docs/cli/tutorials/plan-mode-steering.md +2 -2
- package/dist/docs/cli/tutorials/session-management.md +1 -1
- package/dist/docs/cli/tutorials/shell-commands.md +1 -1
- package/dist/docs/cli/tutorials/task-planning.md +3 -3
- package/dist/docs/core/index.md +5 -6
- package/dist/docs/core/local-model-routing.md +1 -1
- package/dist/docs/core/remote-agents.md +1 -1
- package/dist/docs/core/subagents.md +38 -8
- package/dist/docs/extensions/best-practices.md +5 -4
- package/dist/docs/extensions/reference.md +6 -5
- package/dist/docs/extensions/releasing.md +6 -5
- package/dist/docs/extensions/writing-extensions.md +11 -11
- package/dist/docs/get-started/{authentication.md → authentication.mdx} +139 -93
- package/dist/docs/get-started/gemini-3.md +1 -1
- package/dist/docs/get-started/index.md +4 -4
- package/dist/docs/get-started/installation.mdx +201 -0
- package/dist/docs/hooks/best-practices.md +18 -17
- package/dist/docs/hooks/index.md +10 -8
- package/dist/docs/hooks/reference.md +10 -10
- package/dist/docs/ide-integration/ide-companion-spec.md +14 -14
- package/dist/docs/ide-integration/index.md +4 -4
- package/dist/docs/index.md +2 -2
- package/dist/docs/integration-tests.md +84 -2
- package/dist/docs/issue-and-pr-automation.md +8 -7
- package/dist/docs/npm.md +2 -2
- package/dist/docs/reference/commands.md +11 -11
- package/dist/docs/reference/configuration.md +150 -47
- package/dist/docs/reference/keyboard-shortcuts.md +79 -2
- package/dist/docs/reference/memport.md +2 -3
- package/dist/docs/reference/policy-engine.md +60 -26
- package/dist/docs/reference/tools.md +38 -4
- package/dist/docs/release-confidence.md +1 -1
- package/dist/docs/releases.md +19 -19
- package/dist/docs/resources/faq.md +5 -5
- package/dist/docs/resources/tos-privacy.md +10 -9
- package/dist/docs/resources/troubleshooting.md +17 -16
- package/dist/docs/resources/uninstall.md +5 -4
- package/dist/docs/sidebar.json +13 -1
- package/dist/docs/tools/ask-user.md +3 -3
- package/dist/docs/tools/file-system.md +7 -7
- package/dist/docs/tools/mcp-resources.md +44 -0
- package/dist/docs/tools/mcp-server.md +42 -39
- package/dist/docs/tools/shell.md +5 -5
- package/dist/docs/tools/tracker.md +61 -0
- package/dist/package.json +5 -4
- package/dist/src/agent/content-utils.d.ts +0 -6
- package/dist/src/agent/content-utils.js +0 -14
- package/dist/src/agent/content-utils.js.map +1 -1
- package/dist/src/agent/content-utils.test.js +1 -18
- package/dist/src/agent/content-utils.test.js.map +1 -1
- package/dist/src/agent/event-translator.js +8 -3
- package/dist/src/agent/event-translator.js.map +1 -1
- package/dist/src/agent/event-translator.test.js +14 -9
- package/dist/src/agent/event-translator.test.js.map +1 -1
- package/dist/src/agent/legacy-agent-session.js +9 -3
- package/dist/src/agent/legacy-agent-session.js.map +1 -1
- package/dist/src/agent/legacy-agent-session.test.js +4 -3
- package/dist/src/agent/legacy-agent-session.test.js.map +1 -1
- package/dist/src/agent/tool-display-utils.d.ts +30 -0
- package/dist/src/agent/tool-display-utils.js +69 -0
- package/dist/src/agent/tool-display-utils.js.map +1 -0
- package/dist/src/agent/tool-display-utils.test.js +101 -0
- package/dist/src/agent/tool-display-utils.test.js.map +1 -0
- package/dist/src/agent/types.d.ts +25 -5
- package/dist/src/agents/a2aUtils.js +28 -15
- package/dist/src/agents/a2aUtils.js.map +1 -1
- package/dist/src/agents/a2aUtils.test.js +43 -0
- package/dist/src/agents/a2aUtils.test.js.map +1 -1
- package/dist/src/agents/agent-tool.d.ts +31 -0
- package/dist/src/agents/agent-tool.js +155 -0
- package/dist/src/agents/agent-tool.js.map +1 -0
- package/dist/src/agents/agent-tool.test.js +110 -0
- package/dist/src/agents/agent-tool.test.js.map +1 -0
- package/dist/src/agents/agentLoader.d.ts +79 -4
- package/dist/src/agents/agentLoader.js +40 -2
- package/dist/src/agents/agentLoader.js.map +1 -1
- package/dist/src/agents/agentLoader.test.js +32 -0
- package/dist/src/agents/agentLoader.test.js.map +1 -1
- package/dist/src/agents/browser/analyzeScreenshot.js +1 -1
- package/dist/src/agents/browser/analyzeScreenshot.js.map +1 -1
- package/dist/src/agents/browser/analyzeScreenshot.test.js +19 -7
- package/dist/src/agents/browser/analyzeScreenshot.test.js.map +1 -1
- package/dist/src/agents/browser/browserAgentInvocation.d.ts +2 -2
- package/dist/src/agents/browser/browserAgentInvocation.js +2 -1
- package/dist/src/agents/browser/browserAgentInvocation.js.map +1 -1
- package/dist/src/agents/browser/browserAgentInvocation.test.js +61 -17
- package/dist/src/agents/browser/browserAgentInvocation.test.js.map +1 -1
- package/dist/src/agents/browser/mcpToolWrapper.js +1 -1
- package/dist/src/agents/browser/mcpToolWrapper.js.map +1 -1
- package/dist/src/agents/browser/mcpToolWrapper.test.js +22 -10
- package/dist/src/agents/browser/mcpToolWrapper.test.js.map +1 -1
- package/dist/src/agents/codebase-investigator.js +2 -2
- package/dist/src/agents/codebase-investigator.js.map +1 -1
- package/dist/src/agents/generalist-agent.js +3 -2
- package/dist/src/agents/generalist-agent.js.map +1 -1
- package/dist/src/agents/generalist-agent.test.js +1 -0
- package/dist/src/agents/generalist-agent.test.js.map +1 -1
- package/dist/src/agents/local-executor.d.ts +1 -1
- package/dist/src/agents/local-executor.js +10 -7
- package/dist/src/agents/local-executor.js.map +1 -1
- package/dist/src/agents/local-executor.test.js +5 -3
- package/dist/src/agents/local-executor.test.js.map +1 -1
- package/dist/src/agents/local-invocation.d.ts +2 -2
- package/dist/src/agents/local-invocation.js +8 -2
- package/dist/src/agents/local-invocation.js.map +1 -1
- package/dist/src/agents/local-invocation.test.js +29 -13
- package/dist/src/agents/local-invocation.test.js.map +1 -1
- package/dist/src/agents/registry.d.ts +2 -0
- package/dist/src/agents/registry.js +20 -19
- package/dist/src/agents/registry.js.map +1 -1
- package/dist/src/agents/registry.test.js +19 -30
- package/dist/src/agents/registry.test.js.map +1 -1
- package/dist/src/agents/remote-invocation.d.ts +3 -4
- package/dist/src/agents/remote-invocation.js +2 -1
- package/dist/src/agents/remote-invocation.js.map +1 -1
- package/dist/src/agents/remote-invocation.test.js +45 -18
- package/dist/src/agents/remote-invocation.test.js.map +1 -1
- package/dist/src/agents/skill-extraction-agent.d.ts +3 -2
- package/dist/src/agents/skill-extraction-agent.js +99 -56
- package/dist/src/agents/skill-extraction-agent.js.map +1 -1
- package/dist/src/agents/skill-extraction-agent.test.js +54 -0
- package/dist/src/agents/skill-extraction-agent.test.js.map +1 -0
- package/dist/src/availability/policyCatalog.js +1 -1
- package/dist/src/availability/policyCatalog.js.map +1 -1
- package/dist/src/availability/policyCatalog.test.js +1 -1
- package/dist/src/availability/policyCatalog.test.js.map +1 -1
- package/dist/src/code_assist/oauth2.js +14 -4
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/commands/memory.d.ts +77 -0
- package/dist/src/commands/memory.js +494 -0
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/memory.test.js +720 -1
- package/dist/src/commands/memory.test.js.map +1 -1
- package/dist/src/config/config-agents-reload.test.js +26 -31
- package/dist/src/config/config-agents-reload.test.js.map +1 -1
- package/dist/src/config/config.d.ts +24 -10
- package/dist/src/config/config.js +148 -82
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +373 -10
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/constants.d.ts +1 -0
- package/dist/src/config/constants.js +2 -0
- package/dist/src/config/constants.js.map +1 -1
- package/dist/src/config/defaultModelConfigs.js +7 -7
- package/dist/src/config/defaultModelConfigs.js.map +1 -1
- package/dist/src/config/memory.js +1 -1
- package/dist/src/config/memory.js.map +1 -1
- package/dist/src/config/path-validation.test.js +15 -6
- package/dist/src/config/path-validation.test.js.map +1 -1
- package/dist/src/config/projectRegistry.js +113 -32
- package/dist/src/config/projectRegistry.js.map +1 -1
- package/dist/src/config/projectRegistry.test.js +51 -0
- package/dist/src/config/projectRegistry.test.js.map +1 -1
- package/dist/src/config/storage.d.ts +5 -1
- package/dist/src/config/storage.js +14 -1
- package/dist/src/config/storage.js.map +1 -1
- package/dist/src/config/storage.test.js +12 -0
- package/dist/src/config/storage.test.js.map +1 -1
- package/dist/src/confirmation-bus/message-bus.d.ts +4 -1
- package/dist/src/confirmation-bus/message-bus.js +39 -1
- package/dist/src/confirmation-bus/message-bus.js.map +1 -1
- package/dist/src/confirmation-bus/message-bus.test.js +43 -0
- package/dist/src/confirmation-bus/message-bus.test.js.map +1 -1
- package/dist/src/context/config/configLoader.d.ts +13 -0
- package/dist/src/context/config/configLoader.js +65 -0
- package/dist/src/context/config/configLoader.js.map +1 -0
- package/dist/src/context/config/configLoader.test.d.ts +6 -0
- package/dist/src/context/config/configLoader.test.js +79 -0
- package/dist/src/context/config/configLoader.test.js.map +1 -0
- package/dist/src/context/config/profiles.d.ts +17 -0
- package/dist/src/context/config/profiles.js +93 -0
- package/dist/src/context/config/profiles.js.map +1 -0
- package/dist/src/context/config/registry.d.ts +21 -0
- package/dist/src/context/config/registry.js +32 -0
- package/dist/src/context/config/registry.js.map +1 -0
- package/dist/src/context/config/schema.d.ts +45 -0
- package/dist/src/context/config/schema.js +47 -0
- package/dist/src/context/config/schema.js.map +1 -0
- package/dist/src/context/config/types.d.ts +39 -0
- package/dist/src/context/config/types.js +7 -0
- package/dist/src/context/config/types.js.map +1 -0
- package/dist/src/context/contextManager.barrier.test.d.ts +6 -0
- package/dist/src/context/contextManager.barrier.test.js +56 -0
- package/dist/src/context/contextManager.barrier.test.js.map +1 -0
- package/dist/src/context/contextManager.d.ts +49 -0
- package/dist/src/context/contextManager.js +120 -0
- package/dist/src/context/contextManager.js.map +1 -0
- package/dist/src/context/eventBus.d.ts +28 -0
- package/dist/src/context/eventBus.js +27 -0
- package/dist/src/context/eventBus.js.map +1 -0
- package/dist/src/context/graph/behaviorRegistry.d.ts +28 -0
- package/dist/src/context/graph/behaviorRegistry.js +14 -0
- package/dist/src/context/graph/behaviorRegistry.js.map +1 -0
- package/dist/src/context/graph/builtinBehaviors.d.ts +11 -0
- package/dist/src/context/graph/builtinBehaviors.js +145 -0
- package/dist/src/context/graph/builtinBehaviors.js.map +1 -0
- package/dist/src/context/graph/fromGraph.d.ts +9 -0
- package/dist/src/context/graph/fromGraph.js +34 -0
- package/dist/src/context/graph/fromGraph.js.map +1 -0
- package/dist/src/context/graph/mapper.d.ts +16 -0
- package/dist/src/context/graph/mapper.js +16 -0
- package/dist/src/context/graph/mapper.js.map +1 -0
- package/dist/src/context/graph/render.d.ts +15 -0
- package/dist/src/context/graph/render.js +72 -0
- package/dist/src/context/graph/render.js.map +1 -0
- package/dist/src/context/graph/toGraph.d.ts +10 -0
- package/dist/src/context/graph/toGraph.js +172 -0
- package/dist/src/context/graph/toGraph.js.map +1 -0
- package/dist/src/context/graph/types.d.ts +139 -0
- package/dist/src/context/graph/types.js +36 -0
- package/dist/src/context/graph/types.js.map +1 -0
- package/dist/src/context/historyObserver.d.ts +27 -0
- package/dist/src/context/historyObserver.js +64 -0
- package/dist/src/context/historyObserver.js.map +1 -0
- package/dist/src/context/pipeline/contextWorkingBuffer.d.ts +33 -0
- package/dist/src/context/pipeline/contextWorkingBuffer.js +197 -0
- package/dist/src/context/pipeline/contextWorkingBuffer.js.map +1 -0
- package/dist/src/context/pipeline/contextWorkingBuffer.test.d.ts +6 -0
- package/dist/src/context/pipeline/contextWorkingBuffer.test.js +89 -0
- package/dist/src/context/pipeline/contextWorkingBuffer.test.js.map +1 -0
- package/dist/src/context/pipeline/environment.d.ts +27 -0
- package/dist/src/context/pipeline/environment.js +2 -0
- package/dist/src/context/pipeline/environment.js.map +1 -0
- package/dist/src/context/pipeline/environmentImpl.d.ts +28 -0
- package/dist/src/context/pipeline/environmentImpl.js +40 -0
- package/dist/src/context/pipeline/environmentImpl.js.map +1 -0
- package/dist/src/context/pipeline/environmentImpl.test.d.ts +1 -0
- package/dist/src/context/pipeline/environmentImpl.test.js +32 -0
- package/dist/src/context/pipeline/environmentImpl.test.js.map +1 -0
- package/dist/src/context/pipeline/inbox.d.ts +15 -0
- package/dist/src/context/pipeline/inbox.js +52 -0
- package/dist/src/context/pipeline/inbox.js.map +1 -0
- package/dist/src/context/pipeline/inbox.test.d.ts +1 -0
- package/dist/src/context/pipeline/inbox.test.js +36 -0
- package/dist/src/context/pipeline/inbox.test.js.map +1 -0
- package/dist/src/context/pipeline/orchestrator.d.ts +22 -0
- package/dist/src/context/pipeline/orchestrator.js +126 -0
- package/dist/src/context/pipeline/orchestrator.js.map +1 -0
- package/dist/src/context/pipeline/orchestrator.test.d.ts +6 -0
- package/dist/src/context/pipeline/orchestrator.test.js +154 -0
- package/dist/src/context/pipeline/orchestrator.test.js.map +1 -0
- package/dist/src/context/pipeline.d.ts +52 -0
- package/dist/src/context/pipeline.js +7 -0
- package/dist/src/context/pipeline.js.map +1 -0
- package/dist/src/context/processors/blobDegradationProcessor.d.ts +6 -0
- package/dist/src/context/processors/blobDegradationProcessor.js +127 -0
- package/dist/src/context/processors/blobDegradationProcessor.js.map +1 -0
- package/dist/src/context/processors/blobDegradationProcessor.test.d.ts +6 -0
- package/dist/src/context/processors/blobDegradationProcessor.test.js +72 -0
- package/dist/src/context/processors/blobDegradationProcessor.test.js.map +1 -0
- package/dist/src/context/processors/historyTruncationProcessor.d.ts +11 -0
- package/dist/src/context/processors/historyTruncationProcessor.js +61 -0
- package/dist/src/context/processors/historyTruncationProcessor.js.map +1 -0
- package/dist/src/context/processors/nodeDistillationProcessor.d.ts +8 -0
- package/dist/src/context/processors/nodeDistillationProcessor.js +167 -0
- package/dist/src/context/processors/nodeDistillationProcessor.js.map +1 -0
- package/dist/src/context/processors/nodeDistillationProcessor.test.d.ts +6 -0
- package/dist/src/context/processors/nodeDistillationProcessor.test.js +77 -0
- package/dist/src/context/processors/nodeDistillationProcessor.test.js.map +1 -0
- package/dist/src/context/processors/nodeTruncationProcessor.d.ts +8 -0
- package/dist/src/context/processors/nodeTruncationProcessor.js +109 -0
- package/dist/src/context/processors/nodeTruncationProcessor.js.map +1 -0
- package/dist/src/context/processors/nodeTruncationProcessor.test.d.ts +6 -0
- package/dist/src/context/processors/nodeTruncationProcessor.test.js +71 -0
- package/dist/src/context/processors/nodeTruncationProcessor.test.js.map +1 -0
- package/dist/src/context/processors/rollingSummaryProcessor.d.ts +8 -0
- package/dist/src/context/processors/rollingSummaryProcessor.js +129 -0
- package/dist/src/context/processors/rollingSummaryProcessor.js.map +1 -0
- package/dist/src/context/processors/rollingSummaryProcessor.test.d.ts +1 -0
- package/dist/src/context/processors/rollingSummaryProcessor.test.js +60 -0
- package/dist/src/context/processors/rollingSummaryProcessor.test.js.map +1 -0
- package/dist/src/context/processors/stateSnapshotAsyncProcessor.d.ts +9 -0
- package/dist/src/context/processors/stateSnapshotAsyncProcessor.js +75 -0
- package/dist/src/context/processors/stateSnapshotAsyncProcessor.js.map +1 -0
- package/dist/src/context/processors/stateSnapshotAsyncProcessor.test.d.ts +1 -0
- package/dist/src/context/processors/stateSnapshotAsyncProcessor.test.js +80 -0
- package/dist/src/context/processors/stateSnapshotAsyncProcessor.test.js.map +1 -0
- package/dist/src/context/processors/stateSnapshotProcessor.d.ts +9 -0
- package/dist/src/context/processors/stateSnapshotProcessor.js +130 -0
- package/dist/src/context/processors/stateSnapshotProcessor.js.map +1 -0
- package/dist/src/context/processors/stateSnapshotProcessor.test.d.ts +1 -0
- package/dist/src/context/processors/stateSnapshotProcessor.test.js +91 -0
- package/dist/src/context/processors/stateSnapshotProcessor.test.js.map +1 -0
- package/dist/src/context/processors/toolMaskingProcessor.d.ts +8 -0
- package/dist/src/context/processors/toolMaskingProcessor.js +194 -0
- package/dist/src/context/processors/toolMaskingProcessor.js.map +1 -0
- package/dist/src/context/processors/toolMaskingProcessor.test.d.ts +1 -0
- package/dist/src/context/processors/toolMaskingProcessor.test.js +50 -0
- package/dist/src/context/processors/toolMaskingProcessor.test.js.map +1 -0
- package/dist/src/context/system-tests/lifecycle.golden.test.d.ts +6 -0
- package/dist/src/context/system-tests/lifecycle.golden.test.js +195 -0
- package/dist/src/context/system-tests/lifecycle.golden.test.js.map +1 -0
- package/dist/src/context/system-tests/simulationHarness.d.ts +41 -0
- package/dist/src/context/system-tests/simulationHarness.js +88 -0
- package/dist/src/context/system-tests/simulationHarness.js.map +1 -0
- package/dist/src/context/testing/contextTestUtils.d.ts +44 -0
- package/dist/src/context/testing/contextTestUtils.js +176 -0
- package/dist/src/context/testing/contextTestUtils.js.map +1 -0
- package/dist/src/context/testing/testProfile.d.ts +7 -0
- package/dist/src/context/testing/testProfile.js +20 -0
- package/dist/src/context/testing/testProfile.js.map +1 -0
- package/dist/src/context/tracer.d.ts +19 -0
- package/dist/src/context/tracer.js +79 -0
- package/dist/src/context/tracer.js.map +1 -0
- package/dist/src/context/tracer.test.d.ts +6 -0
- package/dist/src/context/tracer.test.js +71 -0
- package/dist/src/context/tracer.test.js.map +1 -0
- package/dist/src/context/utils/contextTokenCalculator.d.ts +53 -0
- package/dist/src/context/utils/contextTokenCalculator.js +97 -0
- package/dist/src/context/utils/contextTokenCalculator.js.map +1 -0
- package/dist/src/context/utils/snapshotGenerator.d.ts +12 -0
- package/dist/src/context/utils/snapshotGenerator.js +43 -0
- package/dist/src/context/utils/snapshotGenerator.js.map +1 -0
- package/dist/src/core/agentChatHistory.d.ts +26 -0
- package/dist/src/core/agentChatHistory.js +50 -0
- package/dist/src/core/agentChatHistory.js.map +1 -0
- package/dist/src/core/client.js +3 -1
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +4 -0
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.d.ts +8 -1
- package/dist/src/core/contentGenerator.js +46 -4
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +174 -8
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolHookTriggers.d.ts +1 -1
- package/dist/src/core/coreToolHookTriggers.js +5 -1
- package/dist/src/core/coreToolHookTriggers.js.map +1 -1
- package/dist/src/core/coreToolHookTriggers.test.js +1 -1
- package/dist/src/core/coreToolHookTriggers.test.js.map +1 -1
- package/dist/src/core/geminiChat.d.ts +2 -1
- package/dist/src/core/geminiChat.js +7 -2
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +19 -6
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/geminiChat_network_retry.test.js +42 -0
- package/dist/src/core/geminiChat_network_retry.test.js.map +1 -1
- package/dist/src/core/localLiteRtLmClient.js +2 -0
- package/dist/src/core/localLiteRtLmClient.js.map +1 -1
- package/dist/src/core/localLiteRtLmClient.test.js +7 -0
- package/dist/src/core/localLiteRtLmClient.test.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.js +19 -6
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.test.js +55 -0
- package/dist/src/core/loggingContentGenerator.test.js.map +1 -1
- package/dist/src/core/prompts-substitution.test.js +1 -0
- package/dist/src/core/prompts-substitution.test.js.map +1 -1
- package/dist/src/core/prompts.d.ts +1 -1
- package/dist/src/core/prompts.js +2 -2
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +39 -8
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/hooks/hookRunner.js +8 -0
- package/dist/src/hooks/hookRunner.js.map +1 -1
- package/dist/src/hooks/hookRunner.test.js +23 -0
- package/dist/src/hooks/hookRunner.test.js.map +1 -1
- package/dist/src/ide/ide-client.js +3 -4
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/index.d.ts +7 -3
- package/dist/src/index.js +7 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/mcpLauncher.js +1 -1
- package/dist/src/mcp/mcpLauncher.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +24 -17
- package/dist/src/mcp/oauth-provider.test.js.map +1 -1
- package/dist/src/policy/config.d.ts +2 -0
- package/dist/src/policy/config.js +67 -12
- package/dist/src/policy/config.js.map +1 -1
- package/dist/src/policy/core-tools-mapping.test.d.ts +6 -0
- package/dist/src/policy/core-tools-mapping.test.js +44 -0
- package/dist/src/policy/core-tools-mapping.test.js.map +1 -0
- package/dist/src/policy/policies/agents.toml +10 -0
- package/dist/src/policy/policies/plan.toml +17 -43
- package/dist/src/policy/policies/read-only.toml +24 -38
- package/dist/src/policy/policy-engine.d.ts +1 -1
- package/dist/src/policy/policy-engine.js +72 -67
- package/dist/src/policy/policy-engine.js.map +1 -1
- package/dist/src/policy/policy-engine.test.js +71 -4
- package/dist/src/policy/policy-engine.test.js.map +1 -1
- package/dist/src/policy/sandboxPolicyManager.js +4 -4
- package/dist/src/policy/sandboxPolicyManager.js.map +1 -1
- package/dist/src/policy/shell-safety-regression.test.d.ts +6 -0
- package/dist/src/policy/shell-safety-regression.test.js +86 -0
- package/dist/src/policy/shell-safety-regression.test.js.map +1 -0
- package/dist/src/policy/shell-safety.test.js +24 -0
- package/dist/src/policy/shell-safety.test.js.map +1 -1
- package/dist/src/policy/shell-substitution.test.d.ts +6 -0
- package/dist/src/policy/shell-substitution.test.js +75 -0
- package/dist/src/policy/shell-substitution.test.js.map +1 -0
- package/dist/src/policy/toml-loader.test.js +25 -11
- package/dist/src/policy/toml-loader.test.js.map +1 -1
- package/dist/src/policy/types.d.ts +6 -2
- package/dist/src/policy/types.js +4 -2
- package/dist/src/policy/types.js.map +1 -1
- package/dist/src/prompts/promptProvider.d.ts +1 -1
- package/dist/src/prompts/promptProvider.js +41 -24
- package/dist/src/prompts/promptProvider.js.map +1 -1
- package/dist/src/prompts/promptProvider.test.js +36 -2
- package/dist/src/prompts/promptProvider.test.js.map +1 -1
- package/dist/src/prompts/snippets-memory-v2.test.d.ts +6 -0
- package/dist/src/prompts/snippets-memory-v2.test.js +94 -0
- package/dist/src/prompts/snippets-memory-v2.test.js.map +1 -0
- package/dist/src/prompts/snippets.d.ts +19 -1
- package/dist/src/prompts/snippets.js +33 -6
- package/dist/src/prompts/snippets.js.map +1 -1
- package/dist/src/prompts/snippets.legacy.d.ts +6 -1
- package/dist/src/prompts/snippets.legacy.js +14 -7
- package/dist/src/prompts/snippets.legacy.js.map +1 -1
- package/dist/src/prompts/utils.test.js +1 -0
- package/dist/src/prompts/utils.test.js.map +1 -1
- package/dist/src/routing/modelRouterService.js +1 -1
- package/dist/src/routing/modelRouterService.js.map +1 -1
- package/dist/src/sandbox/linux/LinuxSandboxManager.d.ts +2 -0
- package/dist/src/sandbox/linux/LinuxSandboxManager.js +43 -19
- package/dist/src/sandbox/linux/LinuxSandboxManager.js.map +1 -1
- package/dist/src/sandbox/linux/LinuxSandboxManager.test.js +16 -0
- package/dist/src/sandbox/linux/LinuxSandboxManager.test.js.map +1 -1
- package/dist/src/sandbox/linux/bwrapArgsBuilder.d.ts +3 -7
- package/dist/src/sandbox/linux/bwrapArgsBuilder.js +96 -105
- package/dist/src/sandbox/linux/bwrapArgsBuilder.js.map +1 -1
- package/dist/src/sandbox/linux/bwrapArgsBuilder.test.js +144 -41
- package/dist/src/sandbox/linux/bwrapArgsBuilder.test.js.map +1 -1
- package/dist/src/sandbox/macos/MacOsSandboxManager.js +19 -10
- package/dist/src/sandbox/macos/MacOsSandboxManager.js.map +1 -1
- package/dist/src/sandbox/macos/MacOsSandboxManager.test.js +24 -37
- package/dist/src/sandbox/macos/MacOsSandboxManager.test.js.map +1 -1
- package/dist/src/sandbox/macos/seatbeltArgsBuilder.d.ts +3 -9
- package/dist/src/sandbox/macos/seatbeltArgsBuilder.js +129 -96
- package/dist/src/sandbox/macos/seatbeltArgsBuilder.js.map +1 -1
- package/dist/src/sandbox/macos/seatbeltArgsBuilder.test.js +78 -77
- package/dist/src/sandbox/macos/seatbeltArgsBuilder.test.js.map +1 -1
- package/dist/src/sandbox/utils/fsUtils.d.ts +2 -3
- package/dist/src/sandbox/utils/fsUtils.js +12 -27
- package/dist/src/sandbox/utils/fsUtils.js.map +1 -1
- package/dist/src/sandbox/utils/fsUtils.test.js +87 -29
- package/dist/src/sandbox/utils/fsUtils.test.js.map +1 -1
- package/dist/src/sandbox/windows/GeminiSandbox.cs +186 -77
- package/dist/src/sandbox/windows/WindowsSandboxManager.d.ts +4 -16
- package/dist/src/sandbox/windows/WindowsSandboxManager.js +138 -204
- package/dist/src/sandbox/windows/WindowsSandboxManager.js.map +1 -1
- package/dist/src/sandbox/windows/WindowsSandboxManager.test.js +105 -122
- package/dist/src/sandbox/windows/WindowsSandboxManager.test.js.map +1 -1
- package/dist/src/scheduler/policy.js +1 -2
- package/dist/src/scheduler/policy.js.map +1 -1
- package/dist/src/scheduler/policy.test.js +58 -2
- package/dist/src/scheduler/policy.test.js.map +1 -1
- package/dist/src/scheduler/scheduler.d.ts +2 -1
- package/dist/src/scheduler/scheduler.js +13 -14
- package/dist/src/scheduler/scheduler.js.map +1 -1
- package/dist/src/scheduler/scheduler.test.js +66 -0
- package/dist/src/scheduler/scheduler.test.js.map +1 -1
- package/dist/src/scheduler/scheduler_hooks.test.js +1 -0
- package/dist/src/scheduler/scheduler_hooks.test.js.map +1 -1
- package/dist/src/scheduler/scheduler_parallel.test.js +2 -0
- package/dist/src/scheduler/scheduler_parallel.test.js.map +1 -1
- package/dist/src/scheduler/tool-executor.js +2 -0
- package/dist/src/scheduler/tool-executor.js.map +1 -1
- package/dist/src/services/chatRecordingService.d.ts +12 -153
- package/dist/src/services/chatRecordingService.js +444 -350
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/chatRecordingService.test.js +174 -128
- package/dist/src/services/chatRecordingService.test.js.map +1 -1
- package/dist/src/services/chatRecordingTypes.d.ts +111 -0
- package/dist/src/services/chatRecordingTypes.js +10 -0
- package/dist/src/services/chatRecordingTypes.js.map +1 -0
- package/dist/src/services/gitService.d.ts +2 -0
- package/dist/src/services/gitService.js +10 -1
- package/dist/src/services/gitService.js.map +1 -1
- package/dist/src/services/gitService.test.js +6 -2
- package/dist/src/services/gitService.test.js.map +1 -1
- package/dist/src/services/keychainService.d.ts +2 -2
- package/dist/src/services/keychainService.js +9 -9
- package/dist/src/services/keychainService.js.map +1 -1
- package/dist/src/services/keychainService.test.js +7 -7
- package/dist/src/services/keychainService.test.js.map +1 -1
- package/dist/src/services/keychainTypes.d.ts +1 -1
- package/dist/src/services/memoryPatchUtils.d.ts +42 -0
- package/dist/src/services/memoryPatchUtils.js +216 -0
- package/dist/src/services/memoryPatchUtils.js.map +1 -0
- package/dist/src/services/memoryService.d.ts +21 -1
- package/dist/src/services/memoryService.js +405 -64
- package/dist/src/services/memoryService.js.map +1 -1
- package/dist/src/services/memoryService.test.js +686 -2
- package/dist/src/services/memoryService.test.js.map +1 -1
- package/dist/src/services/sandboxManager.d.ts +33 -19
- package/dist/src/services/sandboxManager.integration.test.js +728 -266
- package/dist/src/services/sandboxManager.integration.test.js.map +1 -1
- package/dist/src/services/sandboxManager.js +65 -62
- package/dist/src/services/sandboxManager.js.map +1 -1
- package/dist/src/services/sandboxManager.test.js +17 -114
- package/dist/src/services/sandboxManager.test.js.map +1 -1
- package/dist/src/services/sandboxedFileSystemService.js +72 -62
- package/dist/src/services/sandboxedFileSystemService.js.map +1 -1
- package/dist/src/services/sessionSummaryUtils.d.ts +1 -1
- package/dist/src/services/sessionSummaryUtils.js +111 -38
- package/dist/src/services/sessionSummaryUtils.js.map +1 -1
- package/dist/src/services/sessionSummaryUtils.test.js +204 -51
- package/dist/src/services/sessionSummaryUtils.test.js.map +1 -1
- package/dist/src/services/shellExecutionService.d.ts +19 -0
- package/dist/src/services/shellExecutionService.js +88 -34
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +38 -4
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/telemetry/activity-monitor.js +1 -0
- package/dist/src/telemetry/activity-monitor.js.map +1 -1
- package/dist/src/telemetry/config.js +3 -0
- package/dist/src/telemetry/config.js.map +1 -1
- package/dist/src/telemetry/conseca-logger.js +18 -20
- package/dist/src/telemetry/conseca-logger.js.map +1 -1
- package/dist/src/telemetry/conseca-logger.test.js +100 -0
- package/dist/src/telemetry/conseca-logger.test.js.map +1 -1
- package/dist/src/telemetry/event-loop-monitor.d.ts +17 -0
- package/dist/src/telemetry/event-loop-monitor.js +76 -0
- package/dist/src/telemetry/event-loop-monitor.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +2 -1
- package/dist/src/telemetry/index.js +2 -1
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/llmRole.d.ts +2 -1
- package/dist/src/telemetry/llmRole.js +1 -0
- package/dist/src/telemetry/llmRole.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +184 -8
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/memory-monitor.d.ts +1 -0
- package/dist/src/telemetry/memory-monitor.js +8 -1
- package/dist/src/telemetry/memory-monitor.js.map +1 -1
- package/dist/src/telemetry/memory-monitor.test.js +6 -1
- package/dist/src/telemetry/memory-monitor.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +12 -0
- package/dist/src/telemetry/metrics.js +19 -0
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/sdk.js +20 -1
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/trace.d.ts +23 -6
- package/dist/src/telemetry/trace.js +71 -22
- package/dist/src/telemetry/trace.js.map +1 -1
- package/dist/src/telemetry/trace.test.js +79 -15
- package/dist/src/telemetry/trace.test.js.map +1 -1
- package/dist/src/telemetry/types.js +61 -15
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/test-utils/mock-tool.d.ts +3 -2
- package/dist/src/test-utils/mock-tool.js +4 -3
- package/dist/src/test-utils/mock-tool.js.map +1 -1
- package/dist/src/tools/activate-skill.js +1 -1
- package/dist/src/tools/activate-skill.js.map +1 -1
- package/dist/src/tools/activate-skill.test.js +6 -2
- package/dist/src/tools/activate-skill.test.js.map +1 -1
- package/dist/src/tools/ask-user.d.ts +2 -2
- package/dist/src/tools/ask-user.js +1 -1
- package/dist/src/tools/ask-user.js.map +1 -1
- package/dist/src/tools/ask-user.test.js +9 -3
- package/dist/src/tools/ask-user.test.js.map +1 -1
- package/dist/src/tools/complete-task.d.ts +2 -2
- package/dist/src/tools/complete-task.js +1 -1
- package/dist/src/tools/complete-task.js.map +1 -1
- package/dist/src/tools/complete-task.test.js +9 -3
- package/dist/src/tools/complete-task.test.js.map +1 -1
- package/dist/src/tools/definitions/base-declarations.d.ts +2 -0
- package/dist/src/tools/definitions/base-declarations.js +3 -0
- package/dist/src/tools/definitions/base-declarations.js.map +1 -1
- package/dist/src/tools/definitions/coreTools.d.ts +3 -1
- package/dist/src/tools/definitions/coreTools.js +13 -1
- package/dist/src/tools/definitions/coreTools.js.map +1 -1
- package/dist/src/tools/definitions/model-family-sets/default-legacy.js +29 -1
- package/dist/src/tools/definitions/model-family-sets/default-legacy.js.map +1 -1
- package/dist/src/tools/definitions/model-family-sets/gemini-3.js +29 -1
- package/dist/src/tools/definitions/model-family-sets/gemini-3.js.map +1 -1
- package/dist/src/tools/definitions/types.d.ts +2 -0
- package/dist/src/tools/edit.js +20 -4
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +41 -18
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/enter-plan-mode.d.ts +2 -2
- package/dist/src/tools/enter-plan-mode.js +1 -1
- package/dist/src/tools/enter-plan-mode.js.map +1 -1
- package/dist/src/tools/enter-plan-mode.test.js +10 -4
- package/dist/src/tools/enter-plan-mode.test.js.map +1 -1
- package/dist/src/tools/exit-plan-mode.d.ts +2 -2
- package/dist/src/tools/exit-plan-mode.js +9 -12
- package/dist/src/tools/exit-plan-mode.js.map +1 -1
- package/dist/src/tools/exit-plan-mode.test.js +44 -17
- package/dist/src/tools/exit-plan-mode.test.js.map +1 -1
- package/dist/src/tools/get-internal-docs.js +6 -3
- package/dist/src/tools/get-internal-docs.js.map +1 -1
- package/dist/src/tools/get-internal-docs.test.js +4 -4
- package/dist/src/tools/get-internal-docs.test.js.map +1 -1
- package/dist/src/tools/glob.js +1 -1
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/glob.test.js +16 -16
- package/dist/src/tools/glob.test.js.map +1 -1
- package/dist/src/tools/grep.js +21 -12
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +18 -18
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/line-endings.test.js +3 -3
- package/dist/src/tools/line-endings.test.js.map +1 -1
- package/dist/src/tools/list-mcp-resources.d.ts +24 -0
- package/dist/src/tools/list-mcp-resources.js +74 -0
- package/dist/src/tools/list-mcp-resources.js.map +1 -0
- package/dist/src/tools/list-mcp-resources.test.d.ts +6 -0
- package/dist/src/tools/list-mcp-resources.test.js +79 -0
- package/dist/src/tools/list-mcp-resources.test.js.map +1 -0
- package/dist/src/tools/ls.js +2 -2
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.js +21 -21
- package/dist/src/tools/ls.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.d.ts +3 -1
- package/dist/src/tools/mcp-client-manager.js +24 -1
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +43 -0
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.js +10 -12
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +14 -2
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +2 -2
- package/dist/src/tools/mcp-tool.js +1 -1
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +51 -21
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +4 -3
- package/dist/src/tools/memoryTool.js +43 -14
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/memoryTool.test.js +29 -9
- package/dist/src/tools/memoryTool.test.js.map +1 -1
- package/dist/src/tools/read-file.js +1 -1
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-file.test.js +17 -17
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/read-many-files.js +4 -4
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +70 -24
- package/dist/src/tools/read-many-files.test.js.map +1 -1
- package/dist/src/tools/read-mcp-resource.d.ts +25 -0
- package/dist/src/tools/read-mcp-resource.js +120 -0
- package/dist/src/tools/read-mcp-resource.js.map +1 -0
- package/dist/src/tools/read-mcp-resource.test.d.ts +6 -0
- package/dist/src/tools/read-mcp-resource.test.js +110 -0
- package/dist/src/tools/read-mcp-resource.test.js.map +1 -0
- package/dist/src/tools/ripGrep.d.ts +3 -2
- package/dist/src/tools/ripGrep.js +26 -55
- package/dist/src/tools/ripGrep.js.map +1 -1
- package/dist/src/tools/ripGrep.test.js +113 -167
- package/dist/src/tools/ripGrep.test.js.map +1 -1
- package/dist/src/tools/shell.d.ts +2 -2
- package/dist/src/tools/shell.js +51 -21
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +479 -76
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/shellBackgroundTools.d.ts +3 -3
- package/dist/src/tools/shellBackgroundTools.integration.test.js +6 -2
- package/dist/src/tools/shellBackgroundTools.integration.test.js.map +1 -1
- package/dist/src/tools/shellBackgroundTools.js +2 -2
- package/dist/src/tools/shellBackgroundTools.js.map +1 -1
- package/dist/src/tools/shellBackgroundTools.test.js +30 -10
- package/dist/src/tools/shellBackgroundTools.test.js.map +1 -1
- package/dist/src/tools/tool-error.d.ts +1 -0
- package/dist/src/tools/tool-error.js +1 -0
- package/dist/src/tools/tool-error.js.map +1 -1
- package/dist/src/tools/tool-names.d.ts +5 -4
- package/dist/src/tools/tool-names.js +8 -2
- package/dist/src/tools/tool-names.js.map +1 -1
- package/dist/src/tools/tool-registry.js +137 -114
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +3 -1
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +6 -6
- package/dist/src/tools/tools.js +6 -2
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/topicTool.d.ts +2 -2
- package/dist/src/tools/topicTool.js +1 -1
- package/dist/src/tools/topicTool.js.map +1 -1
- package/dist/src/tools/topicTool.test.js +6 -2
- package/dist/src/tools/topicTool.test.js.map +1 -1
- package/dist/src/tools/trackerTools.d.ts +7 -7
- package/dist/src/tools/trackerTools.js +6 -6
- package/dist/src/tools/trackerTools.js.map +1 -1
- package/dist/src/tools/web-fetch.js +1 -1
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +59 -23
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/web-search.js +1 -1
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/web-search.test.js +5 -5
- package/dist/src/tools/web-search.test.js.map +1 -1
- package/dist/src/tools/write-file.js +22 -4
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +29 -11
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/tools/write-todos.js +1 -1
- package/dist/src/tools/write-todos.js.map +1 -1
- package/dist/src/utils/compatibility.js +6 -1
- package/dist/src/utils/compatibility.js.map +1 -1
- package/dist/src/utils/compatibility.test.js +23 -0
- package/dist/src/utils/compatibility.test.js.map +1 -1
- package/dist/src/utils/errors.d.ts +3 -0
- package/dist/src/utils/errors.js +6 -0
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/fileUtils.d.ts +1 -2
- package/dist/src/utils/fileUtils.js +80 -40
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/fileUtils.test.js +61 -0
- package/dist/src/utils/fileUtils.test.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.d.ts +2 -0
- package/dist/src/utils/filesearch/fileSearch.js +97 -6
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.test.js +54 -0
- package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -1
- package/dist/src/utils/filesearch/fileWatcher.d.ts +25 -0
- package/dist/src/utils/filesearch/fileWatcher.js +86 -0
- package/dist/src/utils/filesearch/fileWatcher.js.map +1 -0
- package/dist/src/utils/filesearch/fileWatcher.test.js +142 -0
- package/dist/src/utils/filesearch/fileWatcher.test.js.map +1 -0
- package/dist/src/utils/getFolderStructure.js +4 -2
- package/dist/src/utils/getFolderStructure.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.js +1 -1
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/googleQuotaErrors.d.ts +2 -1
- package/dist/src/utils/googleQuotaErrors.js +30 -35
- package/dist/src/utils/googleQuotaErrors.js.map +1 -1
- package/dist/src/utils/googleQuotaErrors.test.js +24 -0
- package/dist/src/utils/googleQuotaErrors.test.js.map +1 -1
- package/dist/src/utils/ignoreFileParser.js +1 -1
- package/dist/src/utils/ignoreFileParser.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.js +15 -5
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/oauth-flow.js +17 -5
- package/dist/src/utils/oauth-flow.js.map +1 -1
- package/dist/src/utils/oauth-flow.test.js +20 -0
- package/dist/src/utils/oauth-flow.test.js.map +1 -1
- package/dist/src/utils/paths.d.ts +9 -0
- package/dist/src/utils/paths.js +37 -0
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/paths.test.js +45 -1
- package/dist/src/utils/paths.test.js.map +1 -1
- package/dist/src/utils/planUtils.d.ts +11 -2
- package/dist/src/utils/planUtils.js +43 -11
- package/dist/src/utils/planUtils.js.map +1 -1
- package/dist/src/utils/planUtils.test.js +10 -9
- package/dist/src/utils/planUtils.test.js.map +1 -1
- package/dist/src/utils/process-utils.d.ts +2 -1
- package/dist/src/utils/process-utils.js +64 -33
- package/dist/src/utils/process-utils.js.map +1 -1
- package/dist/src/utils/process-utils.test.js +9 -0
- package/dist/src/utils/process-utils.test.js.map +1 -1
- package/dist/src/utils/retry.js +18 -6
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +30 -0
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/sessionOperations.js +3 -2
- package/dist/src/utils/sessionOperations.js.map +1 -1
- package/dist/src/utils/shell-utils.d.ts +2 -0
- package/dist/src/utils/shell-utils.js +237 -107
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/tool-utils.d.ts +1 -29
- package/dist/src/utils/tool-utils.js +0 -39
- package/dist/src/utils/tool-utils.js.map +1 -1
- package/dist/src/utils/tool-utils.test.js +2 -76
- package/dist/src/utils/tool-utils.test.js.map +1 -1
- package/dist/src/utils/tool-visibility.d.ts +40 -0
- package/dist/src/utils/tool-visibility.js +111 -0
- package/dist/src/utils/tool-visibility.js.map +1 -0
- package/dist/src/utils/tool-visibility.test.d.ts +6 -0
- package/dist/src/utils/tool-visibility.test.js +96 -0
- package/dist/src/utils/tool-visibility.test.js.map +1 -0
- package/dist/src/utils/trust.d.ts +64 -0
- package/dist/src/utils/trust.js +276 -0
- package/dist/src/utils/trust.js.map +1 -0
- package/dist/src/utils/trust.test.d.ts +6 -0
- package/dist/src/utils/trust.test.js +159 -0
- package/dist/src/utils/trust.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/dist/docs/get-started/installation.md +0 -181
- package/dist/src/agents/memory-manager-agent.d.ts +0 -25
- package/dist/src/agents/memory-manager-agent.js +0 -138
- package/dist/src/agents/memory-manager-agent.js.map +0 -1
- package/dist/src/agents/memory-manager-agent.test.js +0 -123
- package/dist/src/agents/memory-manager-agent.test.js.map +0 -1
- package/dist/src/agents/subagent-tool-wrapper.d.ts +0 -38
- package/dist/src/agents/subagent-tool-wrapper.js +0 -58
- package/dist/src/agents/subagent-tool-wrapper.js.map +0 -1
- package/dist/src/agents/subagent-tool-wrapper.test.js +0 -123
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +0 -1
- package/dist/src/agents/subagent-tool.d.ts +0 -18
- package/dist/src/agents/subagent-tool.js +0 -134
- package/dist/src/agents/subagent-tool.js.map +0 -1
- package/dist/src/agents/subagent-tool.test.js +0 -287
- package/dist/src/agents/subagent-tool.test.js.map +0 -1
- package/dist/src/policy/policies/tracker.toml +0 -34
- package/dist/src/prompts/snippets-memory-manager.test.js +0 -31
- package/dist/src/prompts/snippets-memory-manager.test.js.map +0 -1
- /package/dist/src/{agents/memory-manager-agent.test.d.ts → agent/tool-display-utils.test.d.ts} +0 -0
- /package/dist/src/agents/{subagent-tool.test.d.ts → agent-tool.test.d.ts} +0 -0
- /package/dist/src/{prompts/snippets-memory-manager.test.d.ts → agents/skill-extraction-agent.test.d.ts} +0 -0
- /package/dist/src/{agents/subagent-tool-wrapper.test.d.ts → utils/filesearch/fileWatcher.test.d.ts} +0 -0
|
@@ -8,6 +8,8 @@ import * as fs from 'node:fs/promises';
|
|
|
8
8
|
import * as path from 'node:path';
|
|
9
9
|
import * as os from 'node:os';
|
|
10
10
|
import { SESSION_FILE_PREFIX, } from './chatRecordingService.js';
|
|
11
|
+
import { coreEvents } from '../utils/events.js';
|
|
12
|
+
import { Storage } from '../config/storage.js';
|
|
11
13
|
// Mock external modules used by startMemoryService
|
|
12
14
|
vi.mock('../agents/local-executor.js', () => ({
|
|
13
15
|
LocalAgentExecutor: {
|
|
@@ -22,6 +24,7 @@ vi.mock('../agents/skill-extraction-agent.js', () => ({
|
|
|
22
24
|
promptConfig: { systemPrompt: 'test' },
|
|
23
25
|
tools: [],
|
|
24
26
|
outputSchema: {},
|
|
27
|
+
modelConfig: { model: 'test-model' },
|
|
25
28
|
}),
|
|
26
29
|
}));
|
|
27
30
|
vi.mock('./executionLifecycleService.js', () => ({
|
|
@@ -39,6 +42,27 @@ vi.mock('../prompts/prompt-registry.js', () => ({
|
|
|
39
42
|
vi.mock('../resources/resource-registry.js', () => ({
|
|
40
43
|
ResourceRegistry: vi.fn(),
|
|
41
44
|
}));
|
|
45
|
+
vi.mock('../policy/policy-engine.js', () => ({
|
|
46
|
+
PolicyEngine: vi.fn(),
|
|
47
|
+
}));
|
|
48
|
+
vi.mock('../policy/types.js', () => ({
|
|
49
|
+
PolicyDecision: { ALLOW: 'ALLOW' },
|
|
50
|
+
}));
|
|
51
|
+
vi.mock('../confirmation-bus/message-bus.js', () => ({
|
|
52
|
+
MessageBus: vi.fn(),
|
|
53
|
+
}));
|
|
54
|
+
vi.mock('../agents/registry.js', () => ({
|
|
55
|
+
getModelConfigAlias: vi.fn().mockReturnValue('skill-extraction-config'),
|
|
56
|
+
}));
|
|
57
|
+
vi.mock('../config/storage.js', () => ({
|
|
58
|
+
Storage: {
|
|
59
|
+
getUserSkillsDir: vi.fn().mockReturnValue('/tmp/fake-user-skills'),
|
|
60
|
+
},
|
|
61
|
+
}));
|
|
62
|
+
vi.mock('../skills/skillLoader.js', () => ({
|
|
63
|
+
FRONTMATTER_REGEX: /^---\n([\s\S]*?)\n---/,
|
|
64
|
+
parseFrontmatter: vi.fn().mockReturnValue(null),
|
|
65
|
+
}));
|
|
42
66
|
vi.mock('../utils/debugLogger.js', () => ({
|
|
43
67
|
debugLogger: {
|
|
44
68
|
debug: vi.fn(),
|
|
@@ -46,6 +70,11 @@ vi.mock('../utils/debugLogger.js', () => ({
|
|
|
46
70
|
warn: vi.fn(),
|
|
47
71
|
},
|
|
48
72
|
}));
|
|
73
|
+
vi.mock('../utils/events.js', () => ({
|
|
74
|
+
coreEvents: {
|
|
75
|
+
emitFeedback: vi.fn(),
|
|
76
|
+
},
|
|
77
|
+
}));
|
|
49
78
|
// Helper to create a minimal ConversationRecord
|
|
50
79
|
function createConversation(overrides = {}) {
|
|
51
80
|
const { messageCount = 4, ...rest } = overrides;
|
|
@@ -64,6 +93,23 @@ function createConversation(overrides = {}) {
|
|
|
64
93
|
...rest,
|
|
65
94
|
};
|
|
66
95
|
}
|
|
96
|
+
async function writeConversationJsonl(filePath, conversation) {
|
|
97
|
+
const metadata = {
|
|
98
|
+
sessionId: conversation.sessionId,
|
|
99
|
+
projectHash: conversation.projectHash,
|
|
100
|
+
startTime: conversation.startTime,
|
|
101
|
+
lastUpdated: conversation.lastUpdated,
|
|
102
|
+
summary: conversation.summary,
|
|
103
|
+
directories: conversation.directories,
|
|
104
|
+
kind: conversation.kind,
|
|
105
|
+
};
|
|
106
|
+
const records = [metadata, ...conversation.messages];
|
|
107
|
+
await fs.writeFile(filePath, records.map((record) => JSON.stringify(record)).join('\n') + '\n');
|
|
108
|
+
}
|
|
109
|
+
async function setSessionMtime(filePath, timestamp) {
|
|
110
|
+
const date = new Date(timestamp);
|
|
111
|
+
await fs.utimes(filePath, date, date);
|
|
112
|
+
}
|
|
67
113
|
describe('memoryService', () => {
|
|
68
114
|
let tmpDir;
|
|
69
115
|
beforeEach(async () => {
|
|
@@ -321,6 +367,175 @@ describe('memoryService', () => {
|
|
|
321
367
|
error: expect.any(Error),
|
|
322
368
|
}));
|
|
323
369
|
});
|
|
370
|
+
it('emits feedback when new skills are created during extraction', async () => {
|
|
371
|
+
const { startMemoryService } = await import('./memoryService.js');
|
|
372
|
+
const { LocalAgentExecutor } = await import('../agents/local-executor.js');
|
|
373
|
+
// Reset mocks that may carry state from prior tests
|
|
374
|
+
vi.mocked(coreEvents.emitFeedback).mockClear();
|
|
375
|
+
vi.mocked(LocalAgentExecutor.create).mockReset();
|
|
376
|
+
const memoryDir = path.join(tmpDir, 'memory4');
|
|
377
|
+
const skillsDir = path.join(tmpDir, 'skills4');
|
|
378
|
+
const projectTempDir = path.join(tmpDir, 'temp4');
|
|
379
|
+
const chatsDir = path.join(projectTempDir, 'chats');
|
|
380
|
+
await fs.mkdir(memoryDir, { recursive: true });
|
|
381
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
382
|
+
await fs.mkdir(chatsDir, { recursive: true });
|
|
383
|
+
// Write a valid session with enough messages to pass the filter
|
|
384
|
+
const conversation = createConversation({
|
|
385
|
+
sessionId: 'skill-session',
|
|
386
|
+
messageCount: 20,
|
|
387
|
+
});
|
|
388
|
+
await fs.writeFile(path.join(chatsDir, 'session-2025-01-01T00-00-skill001.json'), JSON.stringify(conversation));
|
|
389
|
+
// Override LocalAgentExecutor.create to return an executor whose run
|
|
390
|
+
// creates a new skill directory with a SKILL.md in the skillsDir
|
|
391
|
+
vi.mocked(LocalAgentExecutor.create).mockResolvedValueOnce({
|
|
392
|
+
run: vi.fn().mockImplementation(async () => {
|
|
393
|
+
const newSkillDir = path.join(skillsDir, 'my-new-skill');
|
|
394
|
+
await fs.mkdir(newSkillDir, { recursive: true });
|
|
395
|
+
await fs.writeFile(path.join(newSkillDir, 'SKILL.md'), '# My New Skill');
|
|
396
|
+
return undefined;
|
|
397
|
+
}),
|
|
398
|
+
});
|
|
399
|
+
const mockConfig = {
|
|
400
|
+
storage: {
|
|
401
|
+
getProjectMemoryDir: vi.fn().mockReturnValue(memoryDir),
|
|
402
|
+
getProjectMemoryTempDir: vi.fn().mockReturnValue(memoryDir),
|
|
403
|
+
getProjectSkillsMemoryDir: vi.fn().mockReturnValue(skillsDir),
|
|
404
|
+
getProjectTempDir: vi.fn().mockReturnValue(projectTempDir),
|
|
405
|
+
},
|
|
406
|
+
getToolRegistry: vi.fn(),
|
|
407
|
+
getMessageBus: vi.fn(),
|
|
408
|
+
getGeminiClient: vi.fn(),
|
|
409
|
+
getSkillManager: vi.fn().mockReturnValue({ getSkills: () => [] }),
|
|
410
|
+
modelConfigService: {
|
|
411
|
+
registerRuntimeModelConfig: vi.fn(),
|
|
412
|
+
},
|
|
413
|
+
sandboxManager: undefined,
|
|
414
|
+
};
|
|
415
|
+
await startMemoryService(mockConfig);
|
|
416
|
+
expect(coreEvents.emitFeedback).toHaveBeenCalledWith('info', expect.stringContaining('my-new-skill'));
|
|
417
|
+
expect(coreEvents.emitFeedback).toHaveBeenCalledWith('info', expect.stringContaining('/memory inbox'));
|
|
418
|
+
});
|
|
419
|
+
it('records only sessions whose read_file calls succeed as processed', async () => {
|
|
420
|
+
const { startMemoryService, readExtractionState } = await import('./memoryService.js');
|
|
421
|
+
const { LocalAgentExecutor } = await import('../agents/local-executor.js');
|
|
422
|
+
vi.mocked(LocalAgentExecutor.create).mockReset();
|
|
423
|
+
const memoryDir = path.join(tmpDir, 'memory-read-tracking');
|
|
424
|
+
const skillsDir = path.join(tmpDir, 'skills-read-tracking');
|
|
425
|
+
const projectTempDir = path.join(tmpDir, 'temp-read-tracking');
|
|
426
|
+
const chatsDir = path.join(projectTempDir, 'chats');
|
|
427
|
+
await fs.mkdir(memoryDir, { recursive: true });
|
|
428
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
429
|
+
await fs.mkdir(chatsDir, { recursive: true });
|
|
430
|
+
const openedConversation = createConversation({
|
|
431
|
+
sessionId: 'opened-session',
|
|
432
|
+
summary: 'Read this one',
|
|
433
|
+
messageCount: 20,
|
|
434
|
+
lastUpdated: '2025-01-02T01:00:00Z',
|
|
435
|
+
});
|
|
436
|
+
const skippedConversation = createConversation({
|
|
437
|
+
sessionId: 'skipped-session',
|
|
438
|
+
summary: 'Do not read this one',
|
|
439
|
+
messageCount: 20,
|
|
440
|
+
lastUpdated: '2025-01-01T01:00:00Z',
|
|
441
|
+
});
|
|
442
|
+
const openedPath = path.join(chatsDir, `${SESSION_FILE_PREFIX}2025-01-02T00-00-opened.jsonl`);
|
|
443
|
+
const skippedPath = path.join(chatsDir, `${SESSION_FILE_PREFIX}2025-01-01T00-00-skipped.jsonl`);
|
|
444
|
+
await writeConversationJsonl(openedPath, openedConversation);
|
|
445
|
+
await writeConversationJsonl(skippedPath, skippedConversation);
|
|
446
|
+
vi.mocked(LocalAgentExecutor.create).mockImplementationOnce(async (_definition, _context, onActivity) => ({
|
|
447
|
+
run: vi.fn().mockImplementation(async () => {
|
|
448
|
+
onActivity?.({
|
|
449
|
+
isSubagentActivityEvent: true,
|
|
450
|
+
agentName: 'Skill Extractor',
|
|
451
|
+
type: 'TOOL_CALL_START',
|
|
452
|
+
data: {
|
|
453
|
+
name: 'read_file',
|
|
454
|
+
args: { file_path: openedPath },
|
|
455
|
+
callId: 'call-opened',
|
|
456
|
+
},
|
|
457
|
+
});
|
|
458
|
+
onActivity?.({
|
|
459
|
+
isSubagentActivityEvent: true,
|
|
460
|
+
agentName: 'Skill Extractor',
|
|
461
|
+
type: 'TOOL_CALL_START',
|
|
462
|
+
data: {
|
|
463
|
+
name: 'read_file',
|
|
464
|
+
args: { file_path: skippedPath },
|
|
465
|
+
callId: 'call-skipped',
|
|
466
|
+
},
|
|
467
|
+
});
|
|
468
|
+
onActivity?.({
|
|
469
|
+
isSubagentActivityEvent: true,
|
|
470
|
+
agentName: 'Skill Extractor',
|
|
471
|
+
type: 'ERROR',
|
|
472
|
+
data: {
|
|
473
|
+
name: 'read_file',
|
|
474
|
+
callId: 'call-skipped',
|
|
475
|
+
error: 'access denied',
|
|
476
|
+
},
|
|
477
|
+
});
|
|
478
|
+
onActivity?.({
|
|
479
|
+
isSubagentActivityEvent: true,
|
|
480
|
+
agentName: 'Skill Extractor',
|
|
481
|
+
type: 'TOOL_CALL_END',
|
|
482
|
+
data: {
|
|
483
|
+
name: 'read_file',
|
|
484
|
+
id: 'call-opened',
|
|
485
|
+
data: { content: 'Read this one' },
|
|
486
|
+
},
|
|
487
|
+
});
|
|
488
|
+
onActivity?.({
|
|
489
|
+
isSubagentActivityEvent: true,
|
|
490
|
+
agentName: 'Skill Extractor',
|
|
491
|
+
type: 'TOOL_CALL_START',
|
|
492
|
+
data: {
|
|
493
|
+
name: 'read_file',
|
|
494
|
+
args: { file_path: path.join(chatsDir, 'unrelated.jsonl') },
|
|
495
|
+
callId: 'call-unrelated',
|
|
496
|
+
},
|
|
497
|
+
});
|
|
498
|
+
return undefined;
|
|
499
|
+
}),
|
|
500
|
+
}));
|
|
501
|
+
const mockConfig = {
|
|
502
|
+
storage: {
|
|
503
|
+
getProjectMemoryDir: vi.fn().mockReturnValue(memoryDir),
|
|
504
|
+
getProjectMemoryTempDir: vi.fn().mockReturnValue(memoryDir),
|
|
505
|
+
getProjectSkillsMemoryDir: vi.fn().mockReturnValue(skillsDir),
|
|
506
|
+
getProjectTempDir: vi.fn().mockReturnValue(projectTempDir),
|
|
507
|
+
},
|
|
508
|
+
getToolRegistry: vi.fn(),
|
|
509
|
+
getMessageBus: vi.fn(),
|
|
510
|
+
getGeminiClient: vi.fn(),
|
|
511
|
+
getSkillManager: vi.fn().mockReturnValue({ getSkills: () => [] }),
|
|
512
|
+
modelConfigService: {
|
|
513
|
+
registerRuntimeModelConfig: vi.fn(),
|
|
514
|
+
},
|
|
515
|
+
getTargetDir: vi.fn().mockReturnValue(tmpDir),
|
|
516
|
+
sandboxManager: undefined,
|
|
517
|
+
};
|
|
518
|
+
await startMemoryService(mockConfig);
|
|
519
|
+
const state = await readExtractionState(path.join(memoryDir, '.extraction-state.json'));
|
|
520
|
+
expect(state.runs).toHaveLength(1);
|
|
521
|
+
expect(state.runs[0].candidateSessions).toEqual([
|
|
522
|
+
{
|
|
523
|
+
sessionId: 'opened-session',
|
|
524
|
+
lastUpdated: '2025-01-02T01:00:00Z',
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
sessionId: 'skipped-session',
|
|
528
|
+
lastUpdated: '2025-01-01T01:00:00Z',
|
|
529
|
+
},
|
|
530
|
+
]);
|
|
531
|
+
expect(state.runs[0].processedSessions).toEqual([
|
|
532
|
+
{
|
|
533
|
+
sessionId: 'opened-session',
|
|
534
|
+
lastUpdated: '2025-01-02T01:00:00Z',
|
|
535
|
+
},
|
|
536
|
+
]);
|
|
537
|
+
expect(state.runs[0].sessionIds).toEqual(['opened-session']);
|
|
538
|
+
});
|
|
324
539
|
});
|
|
325
540
|
describe('getProcessedSessionIds', () => {
|
|
326
541
|
it('returns empty set for empty state', async () => {
|
|
@@ -411,7 +626,7 @@ describe('memoryService', () => {
|
|
|
411
626
|
const state = {
|
|
412
627
|
runs: [
|
|
413
628
|
{
|
|
414
|
-
runAt: '2025-01-
|
|
629
|
+
runAt: '2025-01-01T02:00:00Z',
|
|
415
630
|
sessionIds: ['old-session'],
|
|
416
631
|
skillsCreated: [],
|
|
417
632
|
},
|
|
@@ -421,6 +636,28 @@ describe('memoryService', () => {
|
|
|
421
636
|
expect(result.sessionIndex).toContain('[old]');
|
|
422
637
|
expect(result.sessionIndex).not.toContain('[NEW]');
|
|
423
638
|
});
|
|
639
|
+
it('treats resumed legacy sessions as [NEW] when lastUpdated moved past the old run', async () => {
|
|
640
|
+
const { buildSessionIndex } = await import('./memoryService.js');
|
|
641
|
+
const conversation = createConversation({
|
|
642
|
+
sessionId: 'resumed-session',
|
|
643
|
+
summary: 'Resumed after extraction',
|
|
644
|
+
messageCount: 20,
|
|
645
|
+
lastUpdated: '2025-01-01T03:00:00Z',
|
|
646
|
+
});
|
|
647
|
+
await fs.writeFile(path.join(chatsDir, `${SESSION_FILE_PREFIX}2025-01-01T00-00-resumed01.json`), JSON.stringify(conversation));
|
|
648
|
+
const state = {
|
|
649
|
+
runs: [
|
|
650
|
+
{
|
|
651
|
+
runAt: '2025-01-01T02:00:00Z',
|
|
652
|
+
sessionIds: ['resumed-session'],
|
|
653
|
+
skillsCreated: [],
|
|
654
|
+
},
|
|
655
|
+
],
|
|
656
|
+
};
|
|
657
|
+
const result = await buildSessionIndex(chatsDir, state);
|
|
658
|
+
expect(result.sessionIndex).toContain('[NEW]');
|
|
659
|
+
expect(result.newSessionIds).toEqual(['resumed-session']);
|
|
660
|
+
});
|
|
424
661
|
it('includes file path and summary in each line', async () => {
|
|
425
662
|
const { buildSessionIndex } = await import('./memoryService.js');
|
|
426
663
|
const conversation = createConversation({
|
|
@@ -493,7 +730,7 @@ describe('memoryService', () => {
|
|
|
493
730
|
const state = {
|
|
494
731
|
runs: [
|
|
495
732
|
{
|
|
496
|
-
runAt: '2025-01-
|
|
733
|
+
runAt: '2025-01-01T02:00:00Z',
|
|
497
734
|
sessionIds: ['processed-one'],
|
|
498
735
|
skillsCreated: [],
|
|
499
736
|
},
|
|
@@ -506,6 +743,97 @@ describe('memoryService', () => {
|
|
|
506
743
|
expect(result.sessionIndex).toContain('[NEW]');
|
|
507
744
|
expect(result.sessionIndex).toContain('[old]');
|
|
508
745
|
});
|
|
746
|
+
it('reads JSONL sessions and sorts by actual lastUpdated instead of filename', async () => {
|
|
747
|
+
const { buildSessionIndex } = await import('./memoryService.js');
|
|
748
|
+
const olderByName = createConversation({
|
|
749
|
+
sessionId: 'older-by-name',
|
|
750
|
+
summary: 'Filename looks newer',
|
|
751
|
+
messageCount: 20,
|
|
752
|
+
lastUpdated: '2025-01-01T01:00:00Z',
|
|
753
|
+
});
|
|
754
|
+
const newerByActivity = createConversation({
|
|
755
|
+
sessionId: 'newer-by-activity',
|
|
756
|
+
summary: 'Actually most recent',
|
|
757
|
+
messageCount: 20,
|
|
758
|
+
lastUpdated: '2025-02-01T01:00:00Z',
|
|
759
|
+
});
|
|
760
|
+
await writeConversationJsonl(path.join(chatsDir, `${SESSION_FILE_PREFIX}2025-02-01T00-00-oldername.jsonl`), olderByName);
|
|
761
|
+
await writeConversationJsonl(path.join(chatsDir, `${SESSION_FILE_PREFIX}2025-01-01T00-00-neweractv.jsonl`), newerByActivity);
|
|
762
|
+
const result = await buildSessionIndex(chatsDir, { runs: [] });
|
|
763
|
+
const firstLine = result.sessionIndex.split('\n')[0];
|
|
764
|
+
expect(firstLine).toContain('Actually most recent');
|
|
765
|
+
expect(firstLine).not.toContain('Filename looks newer');
|
|
766
|
+
});
|
|
767
|
+
it('rotates in older unprocessed sessions instead of starving them behind retried recent ones', async () => {
|
|
768
|
+
const { buildSessionIndex } = await import('./memoryService.js');
|
|
769
|
+
for (let i = 0; i < 11; i++) {
|
|
770
|
+
const day = String(11 - i).padStart(2, '0');
|
|
771
|
+
const conversation = createConversation({
|
|
772
|
+
sessionId: `backlog-${i}`,
|
|
773
|
+
summary: `Backlog ${i}`,
|
|
774
|
+
messageCount: 20,
|
|
775
|
+
lastUpdated: `2025-01-${day}T01:00:00Z`,
|
|
776
|
+
});
|
|
777
|
+
await fs.writeFile(path.join(chatsDir, `${SESSION_FILE_PREFIX}2025-01-${day}T00-00-backlog${i}.json`), JSON.stringify(conversation));
|
|
778
|
+
}
|
|
779
|
+
const state = {
|
|
780
|
+
runs: [
|
|
781
|
+
{
|
|
782
|
+
runAt: '2025-02-01T00:00:00Z',
|
|
783
|
+
sessionIds: [],
|
|
784
|
+
candidateSessions: Array.from({ length: 10 }, (_, i) => ({
|
|
785
|
+
sessionId: `backlog-${i}`,
|
|
786
|
+
lastUpdated: `2025-01-${String(11 - i).padStart(2, '0')}T01:00:00Z`,
|
|
787
|
+
})),
|
|
788
|
+
skillsCreated: [],
|
|
789
|
+
},
|
|
790
|
+
],
|
|
791
|
+
};
|
|
792
|
+
const result = await buildSessionIndex(chatsDir, state);
|
|
793
|
+
expect(result.newSessionIds).toContain('backlog-10');
|
|
794
|
+
expect(result.newSessionIds).not.toContain('backlog-9');
|
|
795
|
+
});
|
|
796
|
+
it('surfaces older unprocessed sessions even when the newest 100 files were already processed', async () => {
|
|
797
|
+
const { buildSessionIndex } = await import('./memoryService.js');
|
|
798
|
+
const processedSessions = [];
|
|
799
|
+
for (let i = 0; i < 105; i++) {
|
|
800
|
+
const timestamp = new Date(Date.UTC(2025, 0, 1, 0, 0, 105 - i)).toISOString();
|
|
801
|
+
const conversation = createConversation({
|
|
802
|
+
sessionId: `backlog-${i}`,
|
|
803
|
+
summary: `Backlog ${i}`,
|
|
804
|
+
messageCount: 20,
|
|
805
|
+
lastUpdated: timestamp,
|
|
806
|
+
});
|
|
807
|
+
const filePath = path.join(chatsDir, `${SESSION_FILE_PREFIX}2025-01-01T00-00-backlog${String(i).padStart(3, '0')}.json`);
|
|
808
|
+
await fs.writeFile(filePath, JSON.stringify(conversation));
|
|
809
|
+
await setSessionMtime(filePath, timestamp);
|
|
810
|
+
if (i < 100) {
|
|
811
|
+
processedSessions.push({
|
|
812
|
+
sessionId: conversation.sessionId,
|
|
813
|
+
lastUpdated: conversation.lastUpdated,
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
const result = await buildSessionIndex(chatsDir, {
|
|
818
|
+
runs: [
|
|
819
|
+
{
|
|
820
|
+
runAt: '2025-02-01T00:00:00Z',
|
|
821
|
+
sessionIds: processedSessions.map((session) => session.sessionId),
|
|
822
|
+
processedSessions,
|
|
823
|
+
skillsCreated: [],
|
|
824
|
+
},
|
|
825
|
+
],
|
|
826
|
+
});
|
|
827
|
+
expect(result.newSessionIds).toEqual([
|
|
828
|
+
'backlog-100',
|
|
829
|
+
'backlog-101',
|
|
830
|
+
'backlog-102',
|
|
831
|
+
'backlog-103',
|
|
832
|
+
'backlog-104',
|
|
833
|
+
]);
|
|
834
|
+
expect(result.sessionIndex).toContain('Backlog 100');
|
|
835
|
+
expect(result.sessionIndex).toContain('Backlog 104');
|
|
836
|
+
});
|
|
509
837
|
});
|
|
510
838
|
describe('ExtractionState runs tracking', () => {
|
|
511
839
|
it('readExtractionState parses runs array with skillsCreated', async () => {
|
|
@@ -516,6 +844,18 @@ describe('memoryService', () => {
|
|
|
516
844
|
{
|
|
517
845
|
runAt: '2025-06-01T00:00:00Z',
|
|
518
846
|
sessionIds: ['s1'],
|
|
847
|
+
candidateSessions: [
|
|
848
|
+
{
|
|
849
|
+
sessionId: 's1',
|
|
850
|
+
lastUpdated: '2025-05-31T12:00:00Z',
|
|
851
|
+
},
|
|
852
|
+
],
|
|
853
|
+
processedSessions: [
|
|
854
|
+
{
|
|
855
|
+
sessionId: 's1',
|
|
856
|
+
lastUpdated: '2025-05-31T12:00:00Z',
|
|
857
|
+
},
|
|
858
|
+
],
|
|
519
859
|
skillsCreated: ['debug-helper', 'test-gen'],
|
|
520
860
|
},
|
|
521
861
|
],
|
|
@@ -527,6 +867,18 @@ describe('memoryService', () => {
|
|
|
527
867
|
'debug-helper',
|
|
528
868
|
'test-gen',
|
|
529
869
|
]);
|
|
870
|
+
expect(result.runs[0].candidateSessions).toEqual([
|
|
871
|
+
{
|
|
872
|
+
sessionId: 's1',
|
|
873
|
+
lastUpdated: '2025-05-31T12:00:00Z',
|
|
874
|
+
},
|
|
875
|
+
]);
|
|
876
|
+
expect(result.runs[0].processedSessions).toEqual([
|
|
877
|
+
{
|
|
878
|
+
sessionId: 's1',
|
|
879
|
+
lastUpdated: '2025-05-31T12:00:00Z',
|
|
880
|
+
},
|
|
881
|
+
]);
|
|
530
882
|
expect(result.runs[0].sessionIds).toEqual(['s1']);
|
|
531
883
|
expect(result.runs[0].runAt).toBe('2025-06-01T00:00:00Z');
|
|
532
884
|
});
|
|
@@ -537,6 +889,26 @@ describe('memoryService', () => {
|
|
|
537
889
|
{
|
|
538
890
|
runAt: '2025-01-01T00:00:00Z',
|
|
539
891
|
sessionIds: ['a', 'b'],
|
|
892
|
+
candidateSessions: [
|
|
893
|
+
{
|
|
894
|
+
sessionId: 'a',
|
|
895
|
+
lastUpdated: '2024-12-31T23:00:00Z',
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
sessionId: 'b',
|
|
899
|
+
lastUpdated: '2024-12-31T22:00:00Z',
|
|
900
|
+
},
|
|
901
|
+
],
|
|
902
|
+
processedSessions: [
|
|
903
|
+
{
|
|
904
|
+
sessionId: 'a',
|
|
905
|
+
lastUpdated: '2024-12-31T23:00:00Z',
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
sessionId: 'b',
|
|
909
|
+
lastUpdated: '2024-12-31T22:00:00Z',
|
|
910
|
+
},
|
|
911
|
+
],
|
|
540
912
|
skillsCreated: ['skill-x'],
|
|
541
913
|
},
|
|
542
914
|
{
|
|
@@ -559,5 +931,317 @@ describe('memoryService', () => {
|
|
|
559
931
|
expect(result).toEqual({ runs: [] });
|
|
560
932
|
});
|
|
561
933
|
});
|
|
934
|
+
describe('validatePatches', () => {
|
|
935
|
+
let skillsDir;
|
|
936
|
+
let globalSkillsDir;
|
|
937
|
+
let projectSkillsDir;
|
|
938
|
+
let validateConfig;
|
|
939
|
+
beforeEach(() => {
|
|
940
|
+
skillsDir = path.join(tmpDir, 'skills');
|
|
941
|
+
globalSkillsDir = path.join(tmpDir, 'global-skills');
|
|
942
|
+
projectSkillsDir = path.join(tmpDir, 'project-skills');
|
|
943
|
+
vi.mocked(Storage.getUserSkillsDir).mockReturnValue(globalSkillsDir);
|
|
944
|
+
validateConfig = {
|
|
945
|
+
storage: {
|
|
946
|
+
getProjectSkillsDir: () => projectSkillsDir,
|
|
947
|
+
},
|
|
948
|
+
};
|
|
949
|
+
});
|
|
950
|
+
it('returns empty array when no patch files exist', async () => {
|
|
951
|
+
const { validatePatches } = await import('./memoryService.js');
|
|
952
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
953
|
+
// Add a non-patch file to ensure it's ignored
|
|
954
|
+
await fs.writeFile(path.join(skillsDir, 'some-file.txt'), 'hello');
|
|
955
|
+
const result = await validatePatches(skillsDir, validateConfig);
|
|
956
|
+
expect(result).toEqual([]);
|
|
957
|
+
});
|
|
958
|
+
it('returns empty array when directory does not exist', async () => {
|
|
959
|
+
const { validatePatches } = await import('./memoryService.js');
|
|
960
|
+
const result = await validatePatches(path.join(tmpDir, 'nonexistent-dir'), validateConfig);
|
|
961
|
+
expect(result).toEqual([]);
|
|
962
|
+
});
|
|
963
|
+
it('removes invalid patch files', async () => {
|
|
964
|
+
const { validatePatches } = await import('./memoryService.js');
|
|
965
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
966
|
+
// Write a malformed patch
|
|
967
|
+
const patchPath = path.join(skillsDir, 'bad-skill.patch');
|
|
968
|
+
await fs.writeFile(patchPath, 'this is not a valid patch');
|
|
969
|
+
const result = await validatePatches(skillsDir, validateConfig);
|
|
970
|
+
expect(result).toEqual([]);
|
|
971
|
+
// Verify the invalid patch was deleted
|
|
972
|
+
await expect(fs.access(patchPath)).rejects.toThrow();
|
|
973
|
+
});
|
|
974
|
+
it('keeps valid patch files', async () => {
|
|
975
|
+
const { validatePatches } = await import('./memoryService.js');
|
|
976
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
977
|
+
await fs.mkdir(projectSkillsDir, { recursive: true });
|
|
978
|
+
// Create a real target file to patch
|
|
979
|
+
const targetFile = path.join(projectSkillsDir, 'target.md');
|
|
980
|
+
await fs.writeFile(targetFile, 'line1\nline2\nline3\n');
|
|
981
|
+
// Write a valid unified diff patch with absolute paths
|
|
982
|
+
const patchContent = [
|
|
983
|
+
`--- ${targetFile}`,
|
|
984
|
+
`+++ ${targetFile}`,
|
|
985
|
+
'@@ -1,3 +1,4 @@',
|
|
986
|
+
' line1',
|
|
987
|
+
' line2',
|
|
988
|
+
'+line2.5',
|
|
989
|
+
' line3',
|
|
990
|
+
'',
|
|
991
|
+
].join('\n');
|
|
992
|
+
const patchPath = path.join(skillsDir, 'good-skill.patch');
|
|
993
|
+
await fs.writeFile(patchPath, patchContent);
|
|
994
|
+
const result = await validatePatches(skillsDir, validateConfig);
|
|
995
|
+
expect(result).toEqual(['good-skill.patch']);
|
|
996
|
+
// Verify the valid patch still exists
|
|
997
|
+
await expect(fs.access(patchPath)).resolves.toBeUndefined();
|
|
998
|
+
});
|
|
999
|
+
it('keeps patches with repeated sections for the same file when hunks apply cumulatively', async () => {
|
|
1000
|
+
const { validatePatches } = await import('./memoryService.js');
|
|
1001
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
1002
|
+
await fs.mkdir(projectSkillsDir, { recursive: true });
|
|
1003
|
+
const targetFile = path.join(projectSkillsDir, 'target.md');
|
|
1004
|
+
await fs.writeFile(targetFile, 'alpha\nbeta\ngamma\ndelta\n');
|
|
1005
|
+
const patchPath = path.join(skillsDir, 'multi-section.patch');
|
|
1006
|
+
await fs.writeFile(patchPath, [
|
|
1007
|
+
`--- ${targetFile}`,
|
|
1008
|
+
`+++ ${targetFile}`,
|
|
1009
|
+
'@@ -1,4 +1,5 @@',
|
|
1010
|
+
' alpha',
|
|
1011
|
+
' beta',
|
|
1012
|
+
'+beta2',
|
|
1013
|
+
' gamma',
|
|
1014
|
+
' delta',
|
|
1015
|
+
`--- ${targetFile}`,
|
|
1016
|
+
`+++ ${targetFile}`,
|
|
1017
|
+
'@@ -2,4 +2,5 @@',
|
|
1018
|
+
' beta',
|
|
1019
|
+
' beta2',
|
|
1020
|
+
' gamma',
|
|
1021
|
+
'+gamma2',
|
|
1022
|
+
' delta',
|
|
1023
|
+
'',
|
|
1024
|
+
].join('\n'));
|
|
1025
|
+
const result = await validatePatches(skillsDir, validateConfig);
|
|
1026
|
+
expect(result).toEqual(['multi-section.patch']);
|
|
1027
|
+
await expect(fs.access(patchPath)).resolves.toBeUndefined();
|
|
1028
|
+
});
|
|
1029
|
+
it('removes /dev/null patches that target an existing skill file', async () => {
|
|
1030
|
+
const { validatePatches } = await import('./memoryService.js');
|
|
1031
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
1032
|
+
await fs.mkdir(projectSkillsDir, { recursive: true });
|
|
1033
|
+
const targetFile = path.join(projectSkillsDir, 'existing-skill.md');
|
|
1034
|
+
await fs.writeFile(targetFile, 'original content\n');
|
|
1035
|
+
const patchPath = path.join(skillsDir, 'bad-new-file.patch');
|
|
1036
|
+
await fs.writeFile(patchPath, [
|
|
1037
|
+
'--- /dev/null',
|
|
1038
|
+
`+++ ${targetFile}`,
|
|
1039
|
+
'@@ -0,0 +1 @@',
|
|
1040
|
+
'+replacement content',
|
|
1041
|
+
'',
|
|
1042
|
+
].join('\n'));
|
|
1043
|
+
const result = await validatePatches(skillsDir, validateConfig);
|
|
1044
|
+
expect(result).toEqual([]);
|
|
1045
|
+
await expect(fs.access(patchPath)).rejects.toThrow();
|
|
1046
|
+
expect(await fs.readFile(targetFile, 'utf-8')).toBe('original content\n');
|
|
1047
|
+
});
|
|
1048
|
+
it('removes patches with malformed diff headers', async () => {
|
|
1049
|
+
const { validatePatches } = await import('./memoryService.js');
|
|
1050
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
1051
|
+
await fs.mkdir(projectSkillsDir, { recursive: true });
|
|
1052
|
+
const targetFile = path.join(projectSkillsDir, 'target.md');
|
|
1053
|
+
await fs.writeFile(targetFile, 'line1\nline2\nline3\n');
|
|
1054
|
+
const patchPath = path.join(skillsDir, 'bad-headers.patch');
|
|
1055
|
+
await fs.writeFile(patchPath, [
|
|
1056
|
+
`--- ${targetFile}`,
|
|
1057
|
+
'+++ .cell-cli/skills/foo/SKILL.md',
|
|
1058
|
+
'@@ -1,3 +1,4 @@',
|
|
1059
|
+
' line1',
|
|
1060
|
+
' line2',
|
|
1061
|
+
'+line2.5',
|
|
1062
|
+
' line3',
|
|
1063
|
+
'',
|
|
1064
|
+
].join('\n'));
|
|
1065
|
+
const result = await validatePatches(skillsDir, validateConfig);
|
|
1066
|
+
expect(result).toEqual([]);
|
|
1067
|
+
await expect(fs.access(patchPath)).rejects.toThrow();
|
|
1068
|
+
expect(await fs.readFile(targetFile, 'utf-8')).toBe('line1\nline2\nline3\n');
|
|
1069
|
+
});
|
|
1070
|
+
it('removes patches that contain no hunks', async () => {
|
|
1071
|
+
const { validatePatches } = await import('./memoryService.js');
|
|
1072
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
1073
|
+
const patchPath = path.join(skillsDir, 'empty.patch');
|
|
1074
|
+
await fs.writeFile(patchPath, [
|
|
1075
|
+
`--- ${path.join(projectSkillsDir, 'target.md')}`,
|
|
1076
|
+
`+++ ${path.join(projectSkillsDir, 'target.md')}`,
|
|
1077
|
+
'',
|
|
1078
|
+
].join('\n'));
|
|
1079
|
+
const result = await validatePatches(skillsDir, validateConfig);
|
|
1080
|
+
expect(result).toEqual([]);
|
|
1081
|
+
await expect(fs.access(patchPath)).rejects.toThrow();
|
|
1082
|
+
});
|
|
1083
|
+
it('removes patches that target files outside the allowed skill roots', async () => {
|
|
1084
|
+
const { validatePatches } = await import('./memoryService.js');
|
|
1085
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
1086
|
+
const outsideFile = path.join(tmpDir, 'outside.md');
|
|
1087
|
+
await fs.writeFile(outsideFile, 'line1\nline2\nline3\n');
|
|
1088
|
+
const patchPath = path.join(skillsDir, 'outside.patch');
|
|
1089
|
+
await fs.writeFile(patchPath, [
|
|
1090
|
+
`--- ${outsideFile}`,
|
|
1091
|
+
`+++ ${outsideFile}`,
|
|
1092
|
+
'@@ -1,3 +1,4 @@',
|
|
1093
|
+
' line1',
|
|
1094
|
+
' line2',
|
|
1095
|
+
'+line2.5',
|
|
1096
|
+
' line3',
|
|
1097
|
+
'',
|
|
1098
|
+
].join('\n'));
|
|
1099
|
+
const result = await validatePatches(skillsDir, validateConfig);
|
|
1100
|
+
expect(result).toEqual([]);
|
|
1101
|
+
await expect(fs.access(patchPath)).rejects.toThrow();
|
|
1102
|
+
});
|
|
1103
|
+
it('removes patches that escape the allowed roots through a symlinked parent', async () => {
|
|
1104
|
+
const { validatePatches } = await import('./memoryService.js');
|
|
1105
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
1106
|
+
await fs.mkdir(projectSkillsDir, { recursive: true });
|
|
1107
|
+
const outsideDir = path.join(tmpDir, 'outside-dir');
|
|
1108
|
+
const linkedDir = path.join(projectSkillsDir, 'linked');
|
|
1109
|
+
await fs.mkdir(outsideDir, { recursive: true });
|
|
1110
|
+
await fs.symlink(outsideDir, linkedDir, process.platform === 'win32' ? 'junction' : 'dir');
|
|
1111
|
+
const outsideFile = path.join(outsideDir, 'escaped.md');
|
|
1112
|
+
await fs.writeFile(outsideFile, 'line1\nline2\nline3\n');
|
|
1113
|
+
const patchPath = path.join(skillsDir, 'symlink.patch');
|
|
1114
|
+
await fs.writeFile(patchPath, [
|
|
1115
|
+
`--- ${path.join(linkedDir, 'escaped.md')}`,
|
|
1116
|
+
`+++ ${path.join(linkedDir, 'escaped.md')}`,
|
|
1117
|
+
'@@ -1,3 +1,4 @@',
|
|
1118
|
+
' line1',
|
|
1119
|
+
' line2',
|
|
1120
|
+
'+line2.5',
|
|
1121
|
+
' line3',
|
|
1122
|
+
'',
|
|
1123
|
+
].join('\n'));
|
|
1124
|
+
const result = await validatePatches(skillsDir, validateConfig);
|
|
1125
|
+
expect(result).toEqual([]);
|
|
1126
|
+
await expect(fs.access(patchPath)).rejects.toThrow();
|
|
1127
|
+
expect(await fs.readFile(outsideFile, 'utf-8')).not.toContain('line2.5');
|
|
1128
|
+
});
|
|
1129
|
+
});
|
|
1130
|
+
describe('startMemoryService feedback for patch-only runs', () => {
|
|
1131
|
+
it('emits feedback when extraction produces only patch suggestions', async () => {
|
|
1132
|
+
const { startMemoryService } = await import('./memoryService.js');
|
|
1133
|
+
const { LocalAgentExecutor } = await import('../agents/local-executor.js');
|
|
1134
|
+
vi.mocked(coreEvents.emitFeedback).mockClear();
|
|
1135
|
+
vi.mocked(LocalAgentExecutor.create).mockReset();
|
|
1136
|
+
const memoryDir = path.join(tmpDir, 'memory-patch-only');
|
|
1137
|
+
const skillsDir = path.join(tmpDir, 'skills-patch-only');
|
|
1138
|
+
const projectTempDir = path.join(tmpDir, 'temp-patch-only');
|
|
1139
|
+
const chatsDir = path.join(projectTempDir, 'chats');
|
|
1140
|
+
const projectSkillsDir = path.join(tmpDir, 'workspace-skills');
|
|
1141
|
+
await fs.mkdir(memoryDir, { recursive: true });
|
|
1142
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
1143
|
+
await fs.mkdir(chatsDir, { recursive: true });
|
|
1144
|
+
await fs.mkdir(projectSkillsDir, { recursive: true });
|
|
1145
|
+
const existingSkill = path.join(projectSkillsDir, 'existing-skill.md');
|
|
1146
|
+
await fs.writeFile(existingSkill, 'line1\nline2\nline3\n');
|
|
1147
|
+
const conversation = createConversation({
|
|
1148
|
+
sessionId: 'patch-only-session',
|
|
1149
|
+
messageCount: 20,
|
|
1150
|
+
});
|
|
1151
|
+
await fs.writeFile(path.join(chatsDir, 'session-2025-01-01T00-00-patchonly.json'), JSON.stringify(conversation));
|
|
1152
|
+
vi.mocked(Storage.getUserSkillsDir).mockReturnValue(path.join(tmpDir, 'global-skills'));
|
|
1153
|
+
vi.mocked(LocalAgentExecutor.create).mockResolvedValueOnce({
|
|
1154
|
+
run: vi.fn().mockImplementation(async () => {
|
|
1155
|
+
const patchPath = path.join(skillsDir, 'existing-skill.patch');
|
|
1156
|
+
await fs.writeFile(patchPath, [
|
|
1157
|
+
`--- ${existingSkill}`,
|
|
1158
|
+
`+++ ${existingSkill}`,
|
|
1159
|
+
'@@ -1,3 +1,4 @@',
|
|
1160
|
+
' line1',
|
|
1161
|
+
' line2',
|
|
1162
|
+
'+line2.5',
|
|
1163
|
+
' line3',
|
|
1164
|
+
'',
|
|
1165
|
+
].join('\n'));
|
|
1166
|
+
return undefined;
|
|
1167
|
+
}),
|
|
1168
|
+
});
|
|
1169
|
+
const mockConfig = {
|
|
1170
|
+
storage: {
|
|
1171
|
+
getProjectMemoryDir: vi.fn().mockReturnValue(memoryDir),
|
|
1172
|
+
getProjectMemoryTempDir: vi.fn().mockReturnValue(memoryDir),
|
|
1173
|
+
getProjectSkillsMemoryDir: vi.fn().mockReturnValue(skillsDir),
|
|
1174
|
+
getProjectSkillsDir: vi.fn().mockReturnValue(projectSkillsDir),
|
|
1175
|
+
getProjectTempDir: vi.fn().mockReturnValue(projectTempDir),
|
|
1176
|
+
},
|
|
1177
|
+
getToolRegistry: vi.fn(),
|
|
1178
|
+
getMessageBus: vi.fn(),
|
|
1179
|
+
getGeminiClient: vi.fn(),
|
|
1180
|
+
getSkillManager: vi.fn().mockReturnValue({ getSkills: () => [] }),
|
|
1181
|
+
modelConfigService: {
|
|
1182
|
+
registerRuntimeModelConfig: vi.fn(),
|
|
1183
|
+
},
|
|
1184
|
+
sandboxManager: undefined,
|
|
1185
|
+
};
|
|
1186
|
+
await startMemoryService(mockConfig);
|
|
1187
|
+
expect(coreEvents.emitFeedback).toHaveBeenCalledWith('info', expect.stringContaining('skill update'));
|
|
1188
|
+
expect(coreEvents.emitFeedback).toHaveBeenCalledWith('info', expect.stringContaining('/memory inbox'));
|
|
1189
|
+
});
|
|
1190
|
+
it('does not emit feedback for old inbox patches when this run creates none', async () => {
|
|
1191
|
+
const { startMemoryService } = await import('./memoryService.js');
|
|
1192
|
+
const { LocalAgentExecutor } = await import('../agents/local-executor.js');
|
|
1193
|
+
vi.mocked(coreEvents.emitFeedback).mockClear();
|
|
1194
|
+
vi.mocked(LocalAgentExecutor.create).mockReset();
|
|
1195
|
+
const memoryDir = path.join(tmpDir, 'memory-old-patch');
|
|
1196
|
+
const skillsDir = path.join(tmpDir, 'skills-old-patch');
|
|
1197
|
+
const projectTempDir = path.join(tmpDir, 'temp-old-patch');
|
|
1198
|
+
const chatsDir = path.join(projectTempDir, 'chats');
|
|
1199
|
+
const projectSkillsDir = path.join(tmpDir, 'workspace-old-patch');
|
|
1200
|
+
await fs.mkdir(memoryDir, { recursive: true });
|
|
1201
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
1202
|
+
await fs.mkdir(chatsDir, { recursive: true });
|
|
1203
|
+
await fs.mkdir(projectSkillsDir, { recursive: true });
|
|
1204
|
+
const existingSkill = path.join(projectSkillsDir, 'existing-skill.md');
|
|
1205
|
+
await fs.writeFile(existingSkill, 'line1\nline2\nline3\n');
|
|
1206
|
+
await fs.writeFile(path.join(skillsDir, 'existing-skill.patch'), [
|
|
1207
|
+
`--- ${existingSkill}`,
|
|
1208
|
+
`+++ ${existingSkill}`,
|
|
1209
|
+
'@@ -1,3 +1,4 @@',
|
|
1210
|
+
' line1',
|
|
1211
|
+
' line2',
|
|
1212
|
+
'+line2.5',
|
|
1213
|
+
' line3',
|
|
1214
|
+
'',
|
|
1215
|
+
].join('\n'));
|
|
1216
|
+
const conversation = createConversation({
|
|
1217
|
+
sessionId: 'old-patch-session',
|
|
1218
|
+
messageCount: 20,
|
|
1219
|
+
});
|
|
1220
|
+
await fs.writeFile(path.join(chatsDir, 'session-2025-01-01T00-00-oldpatch.json'), JSON.stringify(conversation));
|
|
1221
|
+
vi.mocked(Storage.getUserSkillsDir).mockReturnValue(path.join(tmpDir, 'global-skills'));
|
|
1222
|
+
vi.mocked(LocalAgentExecutor.create).mockResolvedValueOnce({
|
|
1223
|
+
run: vi.fn().mockResolvedValue(undefined),
|
|
1224
|
+
});
|
|
1225
|
+
const mockConfig = {
|
|
1226
|
+
storage: {
|
|
1227
|
+
getProjectMemoryDir: vi.fn().mockReturnValue(memoryDir),
|
|
1228
|
+
getProjectMemoryTempDir: vi.fn().mockReturnValue(memoryDir),
|
|
1229
|
+
getProjectSkillsMemoryDir: vi.fn().mockReturnValue(skillsDir),
|
|
1230
|
+
getProjectSkillsDir: vi.fn().mockReturnValue(projectSkillsDir),
|
|
1231
|
+
getProjectTempDir: vi.fn().mockReturnValue(projectTempDir),
|
|
1232
|
+
},
|
|
1233
|
+
getToolRegistry: vi.fn(),
|
|
1234
|
+
getMessageBus: vi.fn(),
|
|
1235
|
+
getGeminiClient: vi.fn(),
|
|
1236
|
+
getSkillManager: vi.fn().mockReturnValue({ getSkills: () => [] }),
|
|
1237
|
+
modelConfigService: {
|
|
1238
|
+
registerRuntimeModelConfig: vi.fn(),
|
|
1239
|
+
},
|
|
1240
|
+
sandboxManager: undefined,
|
|
1241
|
+
};
|
|
1242
|
+
await startMemoryService(mockConfig);
|
|
1243
|
+
expect(coreEvents.emitFeedback).not.toHaveBeenCalled();
|
|
1244
|
+
});
|
|
1245
|
+
});
|
|
562
1246
|
});
|
|
563
1247
|
//# sourceMappingURL=memoryService.test.js.map
|