@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
|
@@ -7,8 +7,10 @@ import * as fs from 'node:fs/promises';
|
|
|
7
7
|
import * as path from 'node:path';
|
|
8
8
|
import { constants as fsConstants } from 'node:fs';
|
|
9
9
|
import { randomUUID } from 'node:crypto';
|
|
10
|
-
import
|
|
10
|
+
import * as Diff from 'diff';
|
|
11
|
+
import { SESSION_FILE_PREFIX, loadConversationRecord, } from './chatRecordingService.js';
|
|
11
12
|
import { debugLogger } from '../utils/debugLogger.js';
|
|
13
|
+
import { coreEvents } from '../utils/events.js';
|
|
12
14
|
import { isNodeError } from '../utils/errors.js';
|
|
13
15
|
import { FRONTMATTER_REGEX, parseFrontmatter } from '../skills/skillLoader.js';
|
|
14
16
|
import { LocalAgentExecutor } from '../agents/local-executor.js';
|
|
@@ -21,19 +23,30 @@ import { PolicyEngine } from '../policy/policy-engine.js';
|
|
|
21
23
|
import { PolicyDecision } from '../policy/types.js';
|
|
22
24
|
import { MessageBus } from '../confirmation-bus/message-bus.js';
|
|
23
25
|
import { Storage } from '../config/storage.js';
|
|
26
|
+
import { READ_FILE_TOOL_NAME } from '../tools/tool-names.js';
|
|
27
|
+
import { applyParsedSkillPatches, hasParsedPatchHunks, } from './memoryPatchUtils.js';
|
|
24
28
|
const LOCK_FILENAME = '.extraction.lock';
|
|
25
29
|
const STATE_FILENAME = '.extraction-state.json';
|
|
26
30
|
const LOCK_STALE_MS = 35 * 60 * 1000; // 35 minutes (exceeds agent's 30-min time limit)
|
|
27
31
|
const MIN_USER_MESSAGES = 10;
|
|
28
32
|
const MIN_IDLE_MS = 3 * 60 * 60 * 1000; // 3 hours
|
|
29
33
|
const MAX_SESSION_INDEX_SIZE = 50;
|
|
34
|
+
const MAX_NEW_SESSION_BATCH_SIZE = 10;
|
|
35
|
+
function hasProperty(obj, prop) {
|
|
36
|
+
return obj !== null && typeof obj === 'object' && prop in obj;
|
|
37
|
+
}
|
|
38
|
+
function isStringProperty(obj, prop) {
|
|
39
|
+
return hasProperty(obj, prop) && typeof obj[prop] === 'string';
|
|
40
|
+
}
|
|
30
41
|
/**
|
|
31
42
|
* Returns all session IDs that have been processed across all runs.
|
|
32
43
|
*/
|
|
33
44
|
export function getProcessedSessionIds(state) {
|
|
34
45
|
const ids = new Set();
|
|
35
46
|
for (const run of state.runs) {
|
|
36
|
-
|
|
47
|
+
const processedSessionIds = run.processedSessions?.map((session) => session.sessionId) ??
|
|
48
|
+
run.sessionIds;
|
|
49
|
+
for (const id of processedSessionIds) {
|
|
37
50
|
ids.add(id);
|
|
38
51
|
}
|
|
39
52
|
}
|
|
@@ -47,26 +60,35 @@ function isLockInfo(value) {
|
|
|
47
60
|
'startedAt' in value &&
|
|
48
61
|
typeof value.startedAt === 'string');
|
|
49
62
|
}
|
|
50
|
-
function
|
|
63
|
+
function isSessionVersion(value) {
|
|
51
64
|
return (typeof value === 'object' &&
|
|
52
65
|
value !== null &&
|
|
53
66
|
'sessionId' in value &&
|
|
54
67
|
typeof value.sessionId === 'string' &&
|
|
55
|
-
'
|
|
56
|
-
|
|
57
|
-
'projectHash' in value &&
|
|
58
|
-
'startTime' in value &&
|
|
59
|
-
'lastUpdated' in value);
|
|
68
|
+
'lastUpdated' in value &&
|
|
69
|
+
typeof value.lastUpdated === 'string');
|
|
60
70
|
}
|
|
61
|
-
function
|
|
71
|
+
function normalizeSessionVersions(value) {
|
|
72
|
+
if (!Array.isArray(value)) {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
return value.filter(isSessionVersion).map((session) => ({
|
|
76
|
+
sessionId: session.sessionId,
|
|
77
|
+
lastUpdated: session.lastUpdated,
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
function normalizeStringArray(value) {
|
|
81
|
+
if (!Array.isArray(value)) {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
return value.filter((item) => typeof item === 'string');
|
|
85
|
+
}
|
|
86
|
+
function isExtractionRunLike(value) {
|
|
62
87
|
return (typeof value === 'object' &&
|
|
63
88
|
value !== null &&
|
|
64
89
|
'runAt' in value &&
|
|
65
90
|
typeof value.runAt === 'string' &&
|
|
66
|
-
'
|
|
67
|
-
Array.isArray(value.sessionIds) &&
|
|
68
|
-
'skillsCreated' in value &&
|
|
69
|
-
Array.isArray(value.skillsCreated));
|
|
91
|
+
'skillsCreated' in value);
|
|
70
92
|
}
|
|
71
93
|
function isExtractionState(value) {
|
|
72
94
|
return (typeof value === 'object' &&
|
|
@@ -74,6 +96,123 @@ function isExtractionState(value) {
|
|
|
74
96
|
'runs' in value &&
|
|
75
97
|
Array.isArray(value.runs));
|
|
76
98
|
}
|
|
99
|
+
function buildExtractionRun(value) {
|
|
100
|
+
if (!isExtractionRunLike(value)) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
const candidateSessions = normalizeSessionVersions(value.candidateSessions);
|
|
104
|
+
const processedSessions = normalizeSessionVersions(value.processedSessions);
|
|
105
|
+
const sessionIds = normalizeStringArray(value.sessionIds);
|
|
106
|
+
return {
|
|
107
|
+
runAt: value.runAt,
|
|
108
|
+
sessionIds: sessionIds.length > 0
|
|
109
|
+
? sessionIds
|
|
110
|
+
: processedSessions.map((session) => session.sessionId),
|
|
111
|
+
candidateSessions: candidateSessions.length > 0 ? candidateSessions : undefined,
|
|
112
|
+
processedSessions: processedSessions.length > 0 ? processedSessions : undefined,
|
|
113
|
+
skillsCreated: normalizeStringArray(value.skillsCreated),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function getTimestampMs(timestamp) {
|
|
117
|
+
const parsed = Date.parse(timestamp);
|
|
118
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
119
|
+
}
|
|
120
|
+
function getSessionVersionKey(session) {
|
|
121
|
+
return `${session.sessionId}\u0000${session.lastUpdated}`;
|
|
122
|
+
}
|
|
123
|
+
function hasLegacyRunProcessedSession(run, session) {
|
|
124
|
+
return (run.sessionIds.includes(session.sessionId) &&
|
|
125
|
+
getTimestampMs(run.runAt) >= getTimestampMs(session.lastUpdated));
|
|
126
|
+
}
|
|
127
|
+
function isSessionVersionProcessed(state, session) {
|
|
128
|
+
const sessionKey = getSessionVersionKey(session);
|
|
129
|
+
for (const run of state.runs) {
|
|
130
|
+
if (run.processedSessions?.some((processed) => getSessionVersionKey(processed) === sessionKey)) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
if (!run.processedSessions && hasLegacyRunProcessedSession(run, session)) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
function getSessionAttemptCount(state, session) {
|
|
140
|
+
const sessionKey = getSessionVersionKey(session);
|
|
141
|
+
let attempts = 0;
|
|
142
|
+
for (const run of state.runs) {
|
|
143
|
+
if (run.candidateSessions) {
|
|
144
|
+
if (run.candidateSessions.some((candidate) => getSessionVersionKey(candidate) === sessionKey)) {
|
|
145
|
+
attempts++;
|
|
146
|
+
}
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (hasLegacyRunProcessedSession(run, session)) {
|
|
150
|
+
attempts++;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return attempts;
|
|
154
|
+
}
|
|
155
|
+
function compareIndexedSessions(a, b) {
|
|
156
|
+
const timestampDelta = getTimestampMs(b.lastUpdated) - getTimestampMs(a.lastUpdated);
|
|
157
|
+
if (timestampDelta !== 0) {
|
|
158
|
+
return timestampDelta;
|
|
159
|
+
}
|
|
160
|
+
if (a.filePath.endsWith('.jsonl') !== b.filePath.endsWith('.jsonl')) {
|
|
161
|
+
return a.filePath.endsWith('.jsonl') ? -1 : 1;
|
|
162
|
+
}
|
|
163
|
+
return b.filePath.localeCompare(a.filePath);
|
|
164
|
+
}
|
|
165
|
+
function shouldReplaceIndexedSession(existing, candidate) {
|
|
166
|
+
return compareIndexedSessions(candidate, existing) < 0;
|
|
167
|
+
}
|
|
168
|
+
function isReadFileStartActivity(activity) {
|
|
169
|
+
return (activity.type === 'TOOL_CALL_START' &&
|
|
170
|
+
activity.data['name'] === READ_FILE_TOOL_NAME);
|
|
171
|
+
}
|
|
172
|
+
function getResolvedReadFilePath(config, activity) {
|
|
173
|
+
if (!isReadFileStartActivity(activity)) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
const args = activity.data.args;
|
|
177
|
+
if (typeof args !== 'object' ||
|
|
178
|
+
args === null ||
|
|
179
|
+
!('file_path' in args) ||
|
|
180
|
+
typeof args.file_path !== 'string') {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
return path.resolve(config.getTargetDir(), args.file_path);
|
|
184
|
+
}
|
|
185
|
+
function getReadFileStartCallId(activity) {
|
|
186
|
+
if (!isReadFileStartActivity(activity) ||
|
|
187
|
+
!isStringProperty(activity.data, 'callId')) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
return activity.data.callId;
|
|
191
|
+
}
|
|
192
|
+
function getCompletedReadFileCallId(activity) {
|
|
193
|
+
if (activity.type !== 'TOOL_CALL_END' ||
|
|
194
|
+
activity.data['name'] !== READ_FILE_TOOL_NAME ||
|
|
195
|
+
!isStringProperty(activity.data, 'id')) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
return activity.data['id'];
|
|
199
|
+
}
|
|
200
|
+
function getFailedReadFileCallId(activity) {
|
|
201
|
+
if (activity.type !== 'ERROR' ||
|
|
202
|
+
activity.data['name'] !== READ_FILE_TOOL_NAME ||
|
|
203
|
+
!isStringProperty(activity.data, 'callId')) {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
return activity.data['callId'];
|
|
207
|
+
}
|
|
208
|
+
function getUserMessageCount(conversation) {
|
|
209
|
+
return (conversation.userMessageCount ??
|
|
210
|
+
conversation.messages.filter((message) => message.type === 'user').length);
|
|
211
|
+
}
|
|
212
|
+
function isSupportedSessionFile(fileName) {
|
|
213
|
+
return (fileName.startsWith(SESSION_FILE_PREFIX) &&
|
|
214
|
+
(fileName.endsWith('.json') || fileName.endsWith('.jsonl')));
|
|
215
|
+
}
|
|
77
216
|
/**
|
|
78
217
|
* Attempts to acquire an exclusive lock file using O_CREAT | O_EXCL.
|
|
79
218
|
* Returns true if the lock was acquired, false if another instance owns it.
|
|
@@ -165,13 +304,10 @@ export async function readExtractionState(statePath) {
|
|
|
165
304
|
}
|
|
166
305
|
const runs = [];
|
|
167
306
|
for (const run of parsed.runs) {
|
|
168
|
-
|
|
307
|
+
const normalizedRun = buildExtractionRun(run);
|
|
308
|
+
if (!normalizedRun)
|
|
169
309
|
continue;
|
|
170
|
-
runs.push(
|
|
171
|
-
runAt: run.runAt,
|
|
172
|
-
sessionIds: run.sessionIds.filter((sid) => typeof sid === 'string'),
|
|
173
|
-
skillsCreated: run.skillsCreated.filter((sk) => typeof sk === 'string'),
|
|
174
|
-
});
|
|
310
|
+
runs.push(normalizedRun);
|
|
175
311
|
}
|
|
176
312
|
return { runs };
|
|
177
313
|
}
|
|
@@ -198,18 +334,20 @@ function shouldProcessConversation(parsed) {
|
|
|
198
334
|
if (parsed.kind === 'subagent')
|
|
199
335
|
return false;
|
|
200
336
|
// Skip sessions that are still active (not idle for 3+ hours)
|
|
201
|
-
const lastUpdated =
|
|
337
|
+
const lastUpdated = getTimestampMs(parsed.lastUpdated);
|
|
202
338
|
if (Date.now() - lastUpdated < MIN_IDLE_MS)
|
|
203
339
|
return false;
|
|
204
340
|
// Skip sessions with too few user messages
|
|
205
|
-
|
|
206
|
-
if (userMessageCount < MIN_USER_MESSAGES)
|
|
341
|
+
if (getUserMessageCount(parsed) < MIN_USER_MESSAGES)
|
|
207
342
|
return false;
|
|
208
343
|
return true;
|
|
209
344
|
}
|
|
210
345
|
/**
|
|
211
|
-
* Scans the chats directory for eligible session files
|
|
212
|
-
*
|
|
346
|
+
* Scans the chats directory for eligible session files, loading metadata from
|
|
347
|
+
* both JSONL and legacy JSON sessions, deduplicating migrated sessions by
|
|
348
|
+
* session ID, and sorting by actual lastUpdated. We scan the full directory
|
|
349
|
+
* here so already-processed recent sessions cannot permanently block older
|
|
350
|
+
* backlog sessions from surfacing as new candidates.
|
|
213
351
|
*/
|
|
214
352
|
async function scanEligibleSessions(chatsDir) {
|
|
215
353
|
let allFiles;
|
|
@@ -219,55 +357,94 @@ async function scanEligibleSessions(chatsDir) {
|
|
|
219
357
|
catch {
|
|
220
358
|
return [];
|
|
221
359
|
}
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
for (const file of sessionFiles) {
|
|
227
|
-
if (results.length >= MAX_SESSION_INDEX_SIZE)
|
|
228
|
-
break;
|
|
360
|
+
const candidates = [];
|
|
361
|
+
for (const file of allFiles) {
|
|
362
|
+
if (!isSupportedSessionFile(file))
|
|
363
|
+
continue;
|
|
229
364
|
const filePath = path.join(chatsDir, file);
|
|
230
365
|
try {
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
if (!isConversationRecord(parsed))
|
|
366
|
+
const stat = await fs.stat(filePath);
|
|
367
|
+
if (!stat.isFile())
|
|
234
368
|
continue;
|
|
235
|
-
|
|
369
|
+
candidates.push({ filePath, mtimeMs: stat.mtimeMs });
|
|
370
|
+
}
|
|
371
|
+
catch {
|
|
372
|
+
// Skip files that disappeared between readdir and stat.
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
candidates.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
376
|
+
const latestBySessionId = new Map();
|
|
377
|
+
for (const { filePath } of candidates) {
|
|
378
|
+
try {
|
|
379
|
+
const conversation = await loadConversationRecord(filePath, {
|
|
380
|
+
metadataOnly: true,
|
|
381
|
+
});
|
|
382
|
+
if (!conversation || !shouldProcessConversation(conversation))
|
|
236
383
|
continue;
|
|
237
|
-
|
|
384
|
+
const indexedSession = {
|
|
385
|
+
sessionId: conversation.sessionId,
|
|
386
|
+
lastUpdated: conversation.lastUpdated,
|
|
387
|
+
filePath,
|
|
388
|
+
summary: conversation.summary,
|
|
389
|
+
userMessageCount: getUserMessageCount(conversation),
|
|
390
|
+
};
|
|
391
|
+
const existing = latestBySessionId.get(indexedSession.sessionId);
|
|
392
|
+
if (!existing || shouldReplaceIndexedSession(existing, indexedSession)) {
|
|
393
|
+
latestBySessionId.set(indexedSession.sessionId, indexedSession);
|
|
394
|
+
}
|
|
238
395
|
}
|
|
239
396
|
catch {
|
|
240
397
|
// Skip unreadable files
|
|
241
398
|
}
|
|
242
399
|
}
|
|
243
|
-
return
|
|
400
|
+
return Array.from(latestBySessionId.values()).sort(compareIndexedSessions);
|
|
244
401
|
}
|
|
245
402
|
/**
|
|
246
403
|
* Builds a session index for the extraction agent: a compact listing of all
|
|
247
404
|
* eligible sessions with their summary, file path, and new/previously-processed status.
|
|
248
405
|
* The agent can use read_file on paths to inspect sessions that look promising.
|
|
249
406
|
*
|
|
250
|
-
* Returns the index text
|
|
407
|
+
* Returns the index text, the list of selected new (unprocessed) session IDs,
|
|
408
|
+
* and the surfaced candidate sessions for this run.
|
|
251
409
|
*/
|
|
252
410
|
export async function buildSessionIndex(chatsDir, state) {
|
|
253
|
-
const processedSet = getProcessedSessionIds(state);
|
|
254
411
|
const eligible = await scanEligibleSessions(chatsDir);
|
|
255
412
|
if (eligible.length === 0) {
|
|
256
|
-
return { sessionIndex: '', newSessionIds: [] };
|
|
413
|
+
return { sessionIndex: '', newSessionIds: [], candidateSessions: [] };
|
|
257
414
|
}
|
|
258
|
-
const
|
|
259
|
-
const
|
|
260
|
-
for (const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
415
|
+
const newSessions = [];
|
|
416
|
+
const oldSessions = [];
|
|
417
|
+
for (const session of eligible) {
|
|
418
|
+
if (isSessionVersionProcessed(state, session)) {
|
|
419
|
+
oldSessions.push(session);
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
newSessions.push(session);
|
|
265
423
|
}
|
|
266
|
-
const status = isNew ? '[NEW]' : '[old]';
|
|
267
|
-
const summary = conversation.summary ?? '(no summary)';
|
|
268
|
-
lines.push(`${status} ${summary} (${userMessageCount} user msgs) — ${filePath}`);
|
|
269
424
|
}
|
|
270
|
-
|
|
425
|
+
newSessions.sort((a, b) => {
|
|
426
|
+
const attemptDelta = getSessionAttemptCount(state, a) - getSessionAttemptCount(state, b);
|
|
427
|
+
if (attemptDelta !== 0) {
|
|
428
|
+
return attemptDelta;
|
|
429
|
+
}
|
|
430
|
+
return compareIndexedSessions(a, b);
|
|
431
|
+
});
|
|
432
|
+
const candidateSessions = newSessions.slice(0, MAX_NEW_SESSION_BATCH_SIZE);
|
|
433
|
+
const remainingSlots = Math.max(0, MAX_SESSION_INDEX_SIZE - candidateSessions.length);
|
|
434
|
+
const displayedOldSessions = oldSessions.slice(0, remainingSlots);
|
|
435
|
+
const candidateSessionIds = new Set(candidateSessions.map((session) => getSessionVersionKey(session)));
|
|
436
|
+
const lines = [...candidateSessions, ...displayedOldSessions].map((session) => {
|
|
437
|
+
const status = candidateSessionIds.has(getSessionVersionKey(session))
|
|
438
|
+
? '[NEW]'
|
|
439
|
+
: '[old]';
|
|
440
|
+
const summary = session.summary ?? '(no summary)';
|
|
441
|
+
return `${status} ${summary} (${session.userMessageCount} user msgs) — ${session.filePath}`;
|
|
442
|
+
});
|
|
443
|
+
return {
|
|
444
|
+
sessionIndex: lines.join('\n'),
|
|
445
|
+
newSessionIds: candidateSessions.map((session) => session.sessionId),
|
|
446
|
+
candidateSessions,
|
|
447
|
+
};
|
|
271
448
|
}
|
|
272
449
|
/**
|
|
273
450
|
* Builds a summary of all existing skills — both memory-extracted skills
|
|
@@ -318,20 +495,19 @@ async function buildExistingSkillsSummary(skillsDir, config) {
|
|
|
318
495
|
const extensionSkills = [];
|
|
319
496
|
const builtinSkills = [];
|
|
320
497
|
for (const s of discoveredSkills) {
|
|
321
|
-
const entry = `- **${s.name}**: ${s.description}`;
|
|
322
498
|
const loc = s.location;
|
|
323
499
|
if (loc.includes('/bundle/') || loc.includes('\\bundle\\')) {
|
|
324
|
-
builtinSkills.push(
|
|
500
|
+
builtinSkills.push(`- **${s.name}**: ${s.description}`);
|
|
325
501
|
}
|
|
326
502
|
else if (loc.startsWith(userSkillsDir)) {
|
|
327
|
-
globalSkills.push(
|
|
503
|
+
globalSkills.push(`- **${s.name}**: ${s.description} (${loc})`);
|
|
328
504
|
}
|
|
329
505
|
else if (loc.includes('/extensions/') ||
|
|
330
506
|
loc.includes('\\extensions\\')) {
|
|
331
|
-
extensionSkills.push(
|
|
507
|
+
extensionSkills.push(`- **${s.name}**: ${s.description}`);
|
|
332
508
|
}
|
|
333
509
|
else {
|
|
334
|
-
workspaceSkills.push(
|
|
510
|
+
workspaceSkills.push(`- **${s.name}**: ${s.description} (${loc})`);
|
|
335
511
|
}
|
|
336
512
|
}
|
|
337
513
|
if (globalSkills.length > 0) {
|
|
@@ -380,6 +556,82 @@ function buildAgentLoopContext(config) {
|
|
|
380
556
|
sandboxManager: config.sandboxManager,
|
|
381
557
|
};
|
|
382
558
|
}
|
|
559
|
+
/**
|
|
560
|
+
* Validates all .patch files in the skills directory using the `diff` library.
|
|
561
|
+
* Parses each patch, reads the target file(s), and attempts a dry-run apply.
|
|
562
|
+
* Removes patches that fail validation. Returns the filenames of valid patches.
|
|
563
|
+
*/
|
|
564
|
+
export async function validatePatches(skillsDir, config) {
|
|
565
|
+
let entries;
|
|
566
|
+
try {
|
|
567
|
+
entries = await fs.readdir(skillsDir);
|
|
568
|
+
}
|
|
569
|
+
catch {
|
|
570
|
+
return [];
|
|
571
|
+
}
|
|
572
|
+
const patchFiles = entries.filter((e) => e.endsWith('.patch'));
|
|
573
|
+
const validPatches = [];
|
|
574
|
+
for (const patchFile of patchFiles) {
|
|
575
|
+
const patchPath = path.join(skillsDir, patchFile);
|
|
576
|
+
let valid = true;
|
|
577
|
+
let reason = '';
|
|
578
|
+
try {
|
|
579
|
+
const patchContent = await fs.readFile(patchPath, 'utf-8');
|
|
580
|
+
const parsedPatches = Diff.parsePatch(patchContent);
|
|
581
|
+
if (!hasParsedPatchHunks(parsedPatches)) {
|
|
582
|
+
valid = false;
|
|
583
|
+
reason = 'no hunks found in patch';
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
const applied = await applyParsedSkillPatches(parsedPatches, config);
|
|
587
|
+
if (!applied.success) {
|
|
588
|
+
valid = false;
|
|
589
|
+
switch (applied.reason) {
|
|
590
|
+
case 'missingTargetPath':
|
|
591
|
+
reason = 'missing target file path in patch header';
|
|
592
|
+
break;
|
|
593
|
+
case 'invalidPatchHeaders':
|
|
594
|
+
reason = 'invalid diff headers';
|
|
595
|
+
break;
|
|
596
|
+
case 'outsideAllowedRoots':
|
|
597
|
+
reason = `target file is outside skill roots: ${applied.targetPath}`;
|
|
598
|
+
break;
|
|
599
|
+
case 'newFileAlreadyExists':
|
|
600
|
+
reason = `new file target already exists: ${applied.targetPath}`;
|
|
601
|
+
break;
|
|
602
|
+
case 'targetNotFound':
|
|
603
|
+
reason = `target file not found: ${applied.targetPath}`;
|
|
604
|
+
break;
|
|
605
|
+
case 'doesNotApply':
|
|
606
|
+
reason = `patch does not apply cleanly to ${applied.targetPath}`;
|
|
607
|
+
break;
|
|
608
|
+
default:
|
|
609
|
+
reason = 'unknown patch validation failure';
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
catch (err) {
|
|
616
|
+
valid = false;
|
|
617
|
+
reason = `failed to read or parse patch: ${err}`;
|
|
618
|
+
}
|
|
619
|
+
if (valid) {
|
|
620
|
+
validPatches.push(patchFile);
|
|
621
|
+
debugLogger.log(`[MemoryService] Patch validated: ${patchFile}`);
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
debugLogger.warn(`[MemoryService] Removing invalid patch ${patchFile}: ${reason}`);
|
|
625
|
+
try {
|
|
626
|
+
await fs.unlink(patchPath);
|
|
627
|
+
}
|
|
628
|
+
catch {
|
|
629
|
+
// Best-effort cleanup
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
return validPatches;
|
|
634
|
+
}
|
|
383
635
|
/**
|
|
384
636
|
* Main entry point for the skill extraction background task.
|
|
385
637
|
* Designed to be called fire-and-forget on session startup.
|
|
@@ -420,18 +672,28 @@ export async function startMemoryService(config) {
|
|
|
420
672
|
debugLogger.log(`[MemoryService] State loaded: ${previousRuns} previous run(s), ${previouslyProcessed} session(s) already processed`);
|
|
421
673
|
// Build session index: all eligible sessions with summaries + file paths.
|
|
422
674
|
// The agent decides which to read in full via read_file.
|
|
423
|
-
const { sessionIndex, newSessionIds } = await buildSessionIndex(chatsDir, state);
|
|
675
|
+
const { sessionIndex, newSessionIds, candidateSessions } = await buildSessionIndex(chatsDir, state);
|
|
424
676
|
const totalInIndex = sessionIndex ? sessionIndex.split('\n').length : 0;
|
|
425
|
-
debugLogger.log(`[MemoryService] Session scan: ${totalInIndex}
|
|
677
|
+
debugLogger.log(`[MemoryService] Session scan: ${totalInIndex} indexed session(s), ${candidateSessions.length} surfaced as new candidates`);
|
|
426
678
|
if (newSessionIds.length === 0) {
|
|
427
679
|
debugLogger.log('[MemoryService] Skipped: no new sessions to process');
|
|
428
680
|
return;
|
|
429
681
|
}
|
|
430
682
|
// Snapshot existing skill directories before extraction
|
|
431
683
|
const skillsBefore = new Set();
|
|
684
|
+
const patchContentsBefore = new Map();
|
|
432
685
|
try {
|
|
433
686
|
const entries = await fs.readdir(skillsDir);
|
|
434
687
|
for (const e of entries) {
|
|
688
|
+
if (e.endsWith('.patch')) {
|
|
689
|
+
try {
|
|
690
|
+
patchContentsBefore.set(e, await fs.readFile(path.join(skillsDir, e), 'utf-8'));
|
|
691
|
+
}
|
|
692
|
+
catch {
|
|
693
|
+
// Ignore unreadable existing patches.
|
|
694
|
+
}
|
|
695
|
+
continue;
|
|
696
|
+
}
|
|
435
697
|
skillsBefore.add(e);
|
|
436
698
|
}
|
|
437
699
|
}
|
|
@@ -453,8 +715,42 @@ export async function startMemoryService(config) {
|
|
|
453
715
|
modelConfig: agentDefinition.modelConfig,
|
|
454
716
|
});
|
|
455
717
|
debugLogger.log(`[MemoryService] Starting extraction agent (model: ${agentDefinition.modelConfig.model}, maxTurns: 30, maxTime: 30min)`);
|
|
718
|
+
const candidateSessionsByPath = new Map(candidateSessions.map((session) => [
|
|
719
|
+
path.resolve(session.filePath),
|
|
720
|
+
session,
|
|
721
|
+
]));
|
|
722
|
+
const processedSessionKeys = new Set();
|
|
723
|
+
const pendingReadFileSessions = new Map();
|
|
456
724
|
// Create and run the extraction agent
|
|
457
|
-
const executor = await LocalAgentExecutor.create(agentDefinition, context)
|
|
725
|
+
const executor = await LocalAgentExecutor.create(agentDefinition, context, (activity) => {
|
|
726
|
+
const readFileCallId = getReadFileStartCallId(activity);
|
|
727
|
+
if (readFileCallId) {
|
|
728
|
+
const resolvedPath = getResolvedReadFilePath(config, activity);
|
|
729
|
+
if (!resolvedPath) {
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
const session = candidateSessionsByPath.get(resolvedPath);
|
|
733
|
+
if (!session) {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
pendingReadFileSessions.set(readFileCallId, getSessionVersionKey(session));
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
const completedReadFileCallId = getCompletedReadFileCallId(activity);
|
|
740
|
+
if (completedReadFileCallId) {
|
|
741
|
+
const sessionKey = pendingReadFileSessions.get(completedReadFileCallId);
|
|
742
|
+
if (!sessionKey) {
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
processedSessionKeys.add(sessionKey);
|
|
746
|
+
pendingReadFileSessions.delete(completedReadFileCallId);
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
const failedReadFileCallId = getFailedReadFileCallId(activity);
|
|
750
|
+
if (failedReadFileCallId) {
|
|
751
|
+
pendingReadFileSessions.delete(failedReadFileCallId);
|
|
752
|
+
}
|
|
753
|
+
});
|
|
458
754
|
await executor.run({ request: 'Extract skills from the provided sessions.' }, abortController.signal);
|
|
459
755
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
460
756
|
// Diff skills directory to find newly created skills
|
|
@@ -462,7 +758,7 @@ export async function startMemoryService(config) {
|
|
|
462
758
|
try {
|
|
463
759
|
const entriesAfter = await fs.readdir(skillsDir);
|
|
464
760
|
for (const e of entriesAfter) {
|
|
465
|
-
if (!skillsBefore.has(e)) {
|
|
761
|
+
if (!skillsBefore.has(e) && !e.endsWith('.patch')) {
|
|
466
762
|
skillsCreated.push(e);
|
|
467
763
|
}
|
|
468
764
|
}
|
|
@@ -470,21 +766,66 @@ export async function startMemoryService(config) {
|
|
|
470
766
|
catch {
|
|
471
767
|
// Skills dir read failed
|
|
472
768
|
}
|
|
769
|
+
// Validate any .patch files the agent generated
|
|
770
|
+
const validPatches = await validatePatches(skillsDir, config);
|
|
771
|
+
const patchesCreatedThisRun = [];
|
|
772
|
+
for (const patchFile of validPatches) {
|
|
773
|
+
const patchPath = path.join(skillsDir, patchFile);
|
|
774
|
+
let currentContent;
|
|
775
|
+
try {
|
|
776
|
+
currentContent = await fs.readFile(patchPath, 'utf-8');
|
|
777
|
+
}
|
|
778
|
+
catch {
|
|
779
|
+
continue;
|
|
780
|
+
}
|
|
781
|
+
if (patchContentsBefore.get(patchFile) !== currentContent) {
|
|
782
|
+
patchesCreatedThisRun.push(patchFile);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
if (validPatches.length > 0) {
|
|
786
|
+
debugLogger.log(`[MemoryService] ${validPatches.length} valid patch(es) currently in inbox; ${patchesCreatedThisRun.length} created or updated this run`);
|
|
787
|
+
}
|
|
788
|
+
const processedSessions = candidateSessions
|
|
789
|
+
.filter((session) => processedSessionKeys.has(getSessionVersionKey(session)))
|
|
790
|
+
.map((session) => ({
|
|
791
|
+
sessionId: session.sessionId,
|
|
792
|
+
lastUpdated: session.lastUpdated,
|
|
793
|
+
}));
|
|
473
794
|
// Record the run with full metadata
|
|
474
795
|
const run = {
|
|
475
796
|
runAt: new Date().toISOString(),
|
|
476
|
-
sessionIds:
|
|
797
|
+
sessionIds: processedSessions.map((session) => session.sessionId),
|
|
798
|
+
candidateSessions: candidateSessions.map((session) => ({
|
|
799
|
+
sessionId: session.sessionId,
|
|
800
|
+
lastUpdated: session.lastUpdated,
|
|
801
|
+
})),
|
|
802
|
+
processedSessions,
|
|
477
803
|
skillsCreated,
|
|
478
804
|
};
|
|
479
805
|
const updatedState = {
|
|
480
806
|
runs: [...state.runs, run],
|
|
481
807
|
};
|
|
482
808
|
await writeExtractionState(statePath, updatedState);
|
|
483
|
-
if (skillsCreated.length > 0) {
|
|
484
|
-
|
|
809
|
+
if (skillsCreated.length > 0 || patchesCreatedThisRun.length > 0) {
|
|
810
|
+
const completionParts = [];
|
|
811
|
+
if (skillsCreated.length > 0) {
|
|
812
|
+
completionParts.push(`created ${skillsCreated.length} skill(s): ${skillsCreated.join(', ')}`);
|
|
813
|
+
}
|
|
814
|
+
if (patchesCreatedThisRun.length > 0) {
|
|
815
|
+
completionParts.push(`prepared ${patchesCreatedThisRun.length} patch(es): ${patchesCreatedThisRun.join(', ')}`);
|
|
816
|
+
}
|
|
817
|
+
debugLogger.log(`[MemoryService] Completed in ${elapsed}s. ${completionParts.join('; ')} (read ${processedSessions.length}/${candidateSessions.length} surfaced session(s))`);
|
|
818
|
+
const feedbackParts = [];
|
|
819
|
+
if (skillsCreated.length > 0) {
|
|
820
|
+
feedbackParts.push(`${skillsCreated.length} new skill${skillsCreated.length > 1 ? 's' : ''} extracted from past sessions: ${skillsCreated.join(', ')}`);
|
|
821
|
+
}
|
|
822
|
+
if (patchesCreatedThisRun.length > 0) {
|
|
823
|
+
feedbackParts.push(`${patchesCreatedThisRun.length} skill update${patchesCreatedThisRun.length > 1 ? 's' : ''} extracted from past sessions`);
|
|
824
|
+
}
|
|
825
|
+
coreEvents.emitFeedback('info', `${feedbackParts.join('. ')}. Use /memory inbox to review.`);
|
|
485
826
|
}
|
|
486
827
|
else {
|
|
487
|
-
debugLogger.log(`[MemoryService] Completed in ${elapsed}s. No new skills created (
|
|
828
|
+
debugLogger.log(`[MemoryService] Completed in ${elapsed}s. No new skills or patches created (read ${processedSessions.length}/${candidateSessions.length} surfaced session(s))`);
|
|
488
829
|
}
|
|
489
830
|
}
|
|
490
831
|
catch (error) {
|