@nxuss/lemma 1.16.1 ā 1.18.0
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/bin/init.js +101 -11
- package/dist/cjs/cli/lemma-proxy.d.ts.map +1 -1
- package/dist/cjs/cli/lemma-proxy.js +19 -11
- package/dist/cjs/cli/lemma-proxy.js.map +1 -1
- package/dist/cjs/cloud/TenantCache.d.ts.map +1 -1
- package/dist/cjs/cloud/TenantCache.js +0 -4
- package/dist/cjs/cloud/TenantCache.js.map +1 -1
- package/dist/cjs/cloud/identity/ApiKey.d.ts +32 -0
- package/dist/cjs/cloud/identity/ApiKey.d.ts.map +1 -0
- package/dist/cjs/cloud/identity/ApiKey.js +59 -0
- package/dist/cjs/cloud/identity/ApiKey.js.map +1 -0
- package/dist/cjs/cloud/identity/PlanPolicy.d.ts +79 -0
- package/dist/cjs/cloud/identity/PlanPolicy.d.ts.map +1 -0
- package/dist/cjs/cloud/identity/PlanPolicy.js +135 -0
- package/dist/cjs/cloud/identity/PlanPolicy.js.map +1 -0
- package/dist/cjs/cloud/identity/RateLimiter.d.ts +49 -0
- package/dist/cjs/cloud/identity/RateLimiter.d.ts.map +1 -0
- package/dist/cjs/cloud/identity/RateLimiter.js +75 -0
- package/dist/cjs/cloud/identity/RateLimiter.js.map +1 -0
- package/dist/cjs/cloud/identity/TenantResolver.d.ts +19 -0
- package/dist/cjs/cloud/identity/TenantResolver.d.ts.map +1 -0
- package/dist/cjs/cloud/identity/TenantResolver.js +40 -0
- package/dist/cjs/cloud/identity/TenantResolver.js.map +1 -0
- package/dist/cjs/cloud/identity/authenticateV2.d.ts +48 -0
- package/dist/cjs/cloud/identity/authenticateV2.d.ts.map +1 -0
- package/dist/cjs/cloud/identity/authenticateV2.js +66 -0
- package/dist/cjs/cloud/identity/authenticateV2.js.map +1 -0
- package/dist/cjs/cloud/identity/identityStore.d.ts +56 -0
- package/dist/cjs/cloud/identity/identityStore.d.ts.map +1 -0
- package/dist/cjs/cloud/identity/identityStore.js +99 -0
- package/dist/cjs/cloud/identity/identityStore.js.map +1 -0
- package/dist/cjs/cloud/identity/index.d.ts +14 -0
- package/dist/cjs/cloud/identity/index.d.ts.map +1 -0
- package/dist/cjs/cloud/identity/index.js +30 -0
- package/dist/cjs/cloud/identity/index.js.map +1 -0
- package/dist/cjs/cloud/metering/TokenCounter.d.ts +26 -0
- package/dist/cjs/cloud/metering/TokenCounter.d.ts.map +1 -0
- package/dist/cjs/cloud/metering/TokenCounter.js +80 -0
- package/dist/cjs/cloud/metering/TokenCounter.js.map +1 -0
- package/dist/cjs/cloud/metering/UsageLedger.d.ts +68 -0
- package/dist/cjs/cloud/metering/UsageLedger.d.ts.map +1 -0
- package/dist/cjs/cloud/metering/UsageLedger.js +106 -0
- package/dist/cjs/cloud/metering/UsageLedger.js.map +1 -0
- package/dist/cjs/cloud/metering/index.d.ts +12 -0
- package/dist/cjs/cloud/metering/index.d.ts.map +1 -0
- package/dist/cjs/cloud/metering/index.js +28 -0
- package/dist/cjs/cloud/metering/index.js.map +1 -0
- package/dist/cjs/cloud/scrub/StatelessScrubber.d.ts +53 -0
- package/dist/cjs/cloud/scrub/StatelessScrubber.d.ts.map +1 -0
- package/dist/cjs/cloud/scrub/StatelessScrubber.js +203 -0
- package/dist/cjs/cloud/scrub/StatelessScrubber.js.map +1 -0
- package/dist/cjs/cloud/scrub/index.d.ts +5 -0
- package/dist/cjs/cloud/scrub/index.d.ts.map +1 -0
- package/dist/cjs/cloud/scrub/index.js +21 -0
- package/dist/cjs/cloud/scrub/index.js.map +1 -0
- package/dist/cjs/cloud/store/FileBrainStore.d.ts +26 -0
- package/dist/cjs/cloud/store/FileBrainStore.d.ts.map +1 -0
- package/dist/cjs/cloud/store/FileBrainStore.js +219 -0
- package/dist/cjs/cloud/store/FileBrainStore.js.map +1 -0
- package/dist/cjs/cloud/store/PostgresBrainStore.d.ts +50 -0
- package/dist/cjs/cloud/store/PostgresBrainStore.d.ts.map +1 -0
- package/dist/cjs/cloud/store/PostgresBrainStore.js +181 -0
- package/dist/cjs/cloud/store/PostgresBrainStore.js.map +1 -0
- package/dist/cjs/cloud/store/index.d.ts +6 -0
- package/dist/cjs/cloud/store/index.d.ts.map +1 -0
- package/dist/cjs/cloud/store/index.js +22 -0
- package/dist/cjs/cloud/store/index.js.map +1 -0
- package/dist/cjs/cloud/types.d.ts +0 -4
- package/dist/cjs/cloud/types.d.ts.map +1 -1
- package/dist/cjs/cloud/types.js +1 -3
- package/dist/cjs/cloud/types.js.map +1 -1
- package/dist/cjs/cloud/v2/app.d.ts +15 -0
- package/dist/cjs/cloud/v2/app.d.ts.map +1 -0
- package/dist/cjs/cloud/v2/app.js +63 -0
- package/dist/cjs/cloud/v2/app.js.map +1 -0
- package/dist/cjs/cloud/v2/routes/index.d.ts +24 -0
- package/dist/cjs/cloud/v2/routes/index.d.ts.map +1 -0
- package/dist/cjs/cloud/v2/routes/index.js +35 -0
- package/dist/cjs/cloud/v2/routes/index.js.map +1 -0
- package/dist/cjs/cloud/v2/routes/memories.d.ts +83 -0
- package/dist/cjs/cloud/v2/routes/memories.d.ts.map +1 -0
- package/dist/cjs/cloud/v2/routes/memories.js +249 -0
- package/dist/cjs/cloud/v2/routes/memories.js.map +1 -0
- package/dist/cjs/cloud/v2/routes/recall.d.ts +33 -0
- package/dist/cjs/cloud/v2/routes/recall.d.ts.map +1 -0
- package/dist/cjs/cloud/v2/routes/recall.js +51 -0
- package/dist/cjs/cloud/v2/routes/recall.js.map +1 -0
- package/dist/cjs/cloud/v2/routes/scrub.d.ts +13 -0
- package/dist/cjs/cloud/v2/routes/scrub.d.ts.map +1 -0
- package/dist/cjs/cloud/v2/routes/scrub.js +82 -0
- package/dist/cjs/cloud/v2/routes/scrub.js.map +1 -0
- package/dist/cjs/cloud/v2/routes/usage.d.ts +18 -0
- package/dist/cjs/cloud/v2/routes/usage.d.ts.map +1 -0
- package/dist/cjs/cloud/v2/routes/usage.js +18 -0
- package/dist/cjs/cloud/v2/routes/usage.js.map +1 -0
- package/dist/cjs/cloud/v2/routes/verify.d.ts +35 -0
- package/dist/cjs/cloud/v2/routes/verify.d.ts.map +1 -0
- package/dist/cjs/cloud/v2/routes/verify.js +43 -0
- package/dist/cjs/cloud/v2/routes/verify.js.map +1 -0
- package/dist/cjs/cloud/v2/server.d.ts +27 -0
- package/dist/cjs/cloud/v2/server.d.ts.map +1 -0
- package/dist/cjs/cloud/v2/server.js +47 -0
- package/dist/cjs/cloud/v2/server.js.map +1 -0
- package/dist/cjs/contracts/api-v2.types.d.ts +103 -0
- package/dist/cjs/contracts/api-v2.types.d.ts.map +1 -0
- package/dist/cjs/contracts/api-v2.types.js +3 -0
- package/dist/cjs/contracts/api-v2.types.js.map +1 -0
- package/dist/cjs/contracts/errors.d.ts +40 -0
- package/dist/cjs/contracts/errors.d.ts.map +1 -0
- package/dist/cjs/contracts/errors.js +50 -0
- package/dist/cjs/contracts/errors.js.map +1 -0
- package/dist/cjs/contracts/evidence.d.ts +49 -0
- package/dist/cjs/contracts/evidence.d.ts.map +1 -0
- package/dist/cjs/contracts/evidence.js +12 -0
- package/dist/cjs/contracts/evidence.js.map +1 -0
- package/dist/cjs/contracts/index.d.ts +10 -0
- package/dist/cjs/contracts/index.d.ts.map +1 -0
- package/dist/cjs/contracts/index.js +26 -0
- package/dist/cjs/contracts/index.js.map +1 -0
- package/dist/cjs/contracts/store.d.ts +30 -0
- package/dist/cjs/contracts/store.d.ts.map +1 -0
- package/dist/cjs/contracts/store.js +3 -0
- package/dist/cjs/contracts/store.js.map +1 -0
- package/dist/cjs/mcp/tool-profiles.d.ts.map +1 -1
- package/dist/cjs/mcp/tool-profiles.js +46 -1
- package/dist/cjs/mcp/tool-profiles.js.map +1 -1
- package/dist/cjs/mcp/tools.d.ts +2 -0
- package/dist/cjs/mcp/tools.d.ts.map +1 -1
- package/dist/cjs/mcp/tools.js +319 -30
- package/dist/cjs/mcp/tools.js.map +1 -1
- package/dist/cjs/pr-review/bridge/BrainBridge.js +1 -1
- package/dist/cjs/pr-review/bridge/BrainBridge.js.map +1 -1
- package/dist/cjs/subconscious/BrainEmbeddings.d.ts +59 -0
- package/dist/cjs/subconscious/BrainEmbeddings.d.ts.map +1 -0
- package/dist/cjs/subconscious/BrainEmbeddings.js +222 -0
- package/dist/cjs/subconscious/BrainEmbeddings.js.map +1 -0
- package/dist/cjs/subconscious/GitIngest.js +2 -2
- package/dist/cjs/subconscious/GitIngest.js.map +1 -1
- package/dist/cjs/subconscious/TheBrainV2.d.ts +327 -9
- package/dist/cjs/subconscious/TheBrainV2.d.ts.map +1 -1
- package/dist/cjs/subconscious/TheBrainV2.js +952 -98
- package/dist/cjs/subconscious/TheBrainV2.js.map +1 -1
- package/dist/cjs/subconscious/freshness/LocalFsResolver.d.ts +16 -0
- package/dist/cjs/subconscious/freshness/LocalFsResolver.d.ts.map +1 -0
- package/dist/cjs/subconscious/freshness/LocalFsResolver.js +74 -0
- package/dist/cjs/subconscious/freshness/LocalFsResolver.js.map +1 -0
- package/dist/cjs/subconscious/freshness/SuppliedEvidenceResolver.d.ts +23 -0
- package/dist/cjs/subconscious/freshness/SuppliedEvidenceResolver.d.ts.map +1 -0
- package/dist/cjs/subconscious/freshness/SuppliedEvidenceResolver.js +24 -0
- package/dist/cjs/subconscious/freshness/SuppliedEvidenceResolver.js.map +1 -0
- package/dist/cjs/subconscious/freshness/index.d.ts +10 -0
- package/dist/cjs/subconscious/freshness/index.d.ts.map +1 -0
- package/dist/cjs/subconscious/freshness/index.js +26 -0
- package/dist/cjs/subconscious/freshness/index.js.map +1 -0
- package/dist/cjs/utils/ConversationCheckpoint.js +1 -1
- package/dist/cjs/utils/ConversationCheckpoint.js.map +1 -1
- package/dist/cjs/utils/ProjectIdentity.d.ts +12 -0
- package/dist/cjs/utils/ProjectIdentity.d.ts.map +1 -0
- package/dist/cjs/utils/ProjectIdentity.js +44 -0
- package/dist/cjs/utils/ProjectIdentity.js.map +1 -0
- package/dist/cjs/utils/PromptPatternCache.d.ts.map +1 -1
- package/dist/cjs/utils/PromptPatternCache.js +12 -2
- package/dist/cjs/utils/PromptPatternCache.js.map +1 -1
- package/dist/cjs/utils/RepeatGuard.d.ts.map +1 -1
- package/dist/cjs/utils/RepeatGuard.js +10 -2
- package/dist/cjs/utils/RepeatGuard.js.map +1 -1
- package/dist/cjs/utils/StateHashCache.d.ts +5 -0
- package/dist/cjs/utils/StateHashCache.d.ts.map +1 -1
- package/dist/cjs/utils/StateHashCache.js +40 -16
- package/dist/cjs/utils/StateHashCache.js.map +1 -1
- package/dist/esm/api/dashboardRoutes.d.ts +3 -3
- package/dist/esm/api/dashboardRoutes.js +1 -1
- package/dist/esm/api/server.d.ts +4 -4
- package/dist/esm/api/server.js +3 -3
- package/dist/esm/autopilot/AutopilotWatcher.js +3 -3
- package/dist/esm/autopilot/Notifier.d.ts +1 -1
- package/dist/esm/cli/lemma-proxy.d.ts.map +1 -1
- package/dist/esm/cli/lemma-proxy.js +33 -25
- package/dist/esm/cli/lemma-proxy.js.map +1 -1
- package/dist/esm/cli/stack.d.ts +4 -4
- package/dist/esm/cli/stack.js +5 -5
- package/dist/esm/cloud/KeyManager.d.ts +1 -1
- package/dist/esm/cloud/KeyManager.js +1 -1
- package/dist/esm/cloud/TenantCache.d.ts +1 -1
- package/dist/esm/cloud/TenantCache.d.ts.map +1 -1
- package/dist/esm/cloud/TenantCache.js +0 -4
- package/dist/esm/cloud/TenantCache.js.map +1 -1
- package/dist/esm/cloud/identity/ApiKey.d.ts +32 -0
- package/dist/esm/cloud/identity/ApiKey.d.ts.map +1 -0
- package/dist/esm/cloud/identity/ApiKey.js +49 -0
- package/dist/esm/cloud/identity/ApiKey.js.map +1 -0
- package/dist/esm/cloud/identity/PlanPolicy.d.ts +79 -0
- package/dist/esm/cloud/identity/PlanPolicy.d.ts.map +1 -0
- package/dist/esm/cloud/identity/PlanPolicy.js +129 -0
- package/dist/esm/cloud/identity/PlanPolicy.js.map +1 -0
- package/dist/esm/cloud/identity/RateLimiter.d.ts +49 -0
- package/dist/esm/cloud/identity/RateLimiter.d.ts.map +1 -0
- package/dist/esm/cloud/identity/RateLimiter.js +69 -0
- package/dist/esm/cloud/identity/RateLimiter.js.map +1 -0
- package/dist/esm/cloud/identity/TenantResolver.d.ts +19 -0
- package/dist/esm/cloud/identity/TenantResolver.d.ts.map +1 -0
- package/dist/esm/cloud/identity/TenantResolver.js +36 -0
- package/dist/esm/cloud/identity/TenantResolver.js.map +1 -0
- package/dist/esm/cloud/identity/authenticateV2.d.ts +48 -0
- package/dist/esm/cloud/identity/authenticateV2.d.ts.map +1 -0
- package/dist/esm/cloud/identity/authenticateV2.js +62 -0
- package/dist/esm/cloud/identity/authenticateV2.js.map +1 -0
- package/dist/esm/cloud/identity/identityStore.d.ts +56 -0
- package/dist/esm/cloud/identity/identityStore.d.ts.map +1 -0
- package/dist/esm/cloud/identity/identityStore.js +94 -0
- package/dist/esm/cloud/identity/identityStore.js.map +1 -0
- package/dist/esm/cloud/identity/index.d.ts +14 -0
- package/dist/esm/cloud/identity/index.d.ts.map +1 -0
- package/dist/esm/cloud/identity/index.js +14 -0
- package/dist/esm/cloud/identity/index.js.map +1 -0
- package/dist/esm/cloud/index.d.ts +3 -3
- package/dist/esm/cloud/index.js +3 -3
- package/dist/esm/cloud/metering/TokenCounter.d.ts +26 -0
- package/dist/esm/cloud/metering/TokenCounter.d.ts.map +1 -0
- package/dist/esm/cloud/metering/TokenCounter.js +76 -0
- package/dist/esm/cloud/metering/TokenCounter.js.map +1 -0
- package/dist/esm/cloud/metering/UsageLedger.d.ts +68 -0
- package/dist/esm/cloud/metering/UsageLedger.d.ts.map +1 -0
- package/dist/esm/cloud/metering/UsageLedger.js +98 -0
- package/dist/esm/cloud/metering/UsageLedger.js.map +1 -0
- package/dist/esm/cloud/metering/index.d.ts +12 -0
- package/dist/esm/cloud/metering/index.d.ts.map +1 -0
- package/dist/esm/cloud/metering/index.js +12 -0
- package/dist/esm/cloud/metering/index.js.map +1 -0
- package/dist/esm/cloud/scrub/StatelessScrubber.d.ts +53 -0
- package/dist/esm/cloud/scrub/StatelessScrubber.d.ts.map +1 -0
- package/dist/esm/cloud/scrub/StatelessScrubber.js +199 -0
- package/dist/esm/cloud/scrub/StatelessScrubber.js.map +1 -0
- package/dist/esm/cloud/scrub/index.d.ts +5 -0
- package/dist/esm/cloud/scrub/index.d.ts.map +1 -0
- package/dist/esm/cloud/scrub/index.js +5 -0
- package/dist/esm/cloud/scrub/index.js.map +1 -0
- package/dist/esm/cloud/server.d.ts +3 -3
- package/dist/esm/cloud/server.js +5 -5
- package/dist/esm/cloud/store/FileBrainStore.d.ts +26 -0
- package/dist/esm/cloud/store/FileBrainStore.d.ts.map +1 -0
- package/dist/esm/cloud/store/FileBrainStore.js +212 -0
- package/dist/esm/cloud/store/FileBrainStore.js.map +1 -0
- package/dist/esm/cloud/store/PostgresBrainStore.d.ts +50 -0
- package/dist/esm/cloud/store/PostgresBrainStore.d.ts.map +1 -0
- package/dist/esm/cloud/store/PostgresBrainStore.js +176 -0
- package/dist/esm/cloud/store/PostgresBrainStore.js.map +1 -0
- package/dist/esm/cloud/store/index.d.ts +6 -0
- package/dist/esm/cloud/store/index.d.ts.map +1 -0
- package/dist/esm/cloud/store/index.js +6 -0
- package/dist/esm/cloud/store/index.js.map +1 -0
- package/dist/esm/cloud/types.d.ts +0 -4
- package/dist/esm/cloud/types.d.ts.map +1 -1
- package/dist/esm/cloud/types.js +0 -2
- package/dist/esm/cloud/types.js.map +1 -1
- package/dist/esm/cloud/v2/app.d.ts +15 -0
- package/dist/esm/cloud/v2/app.d.ts.map +1 -0
- package/dist/esm/cloud/v2/app.js +57 -0
- package/dist/esm/cloud/v2/app.js.map +1 -0
- package/dist/esm/cloud/v2/routes/index.d.ts +24 -0
- package/dist/esm/cloud/v2/routes/index.d.ts.map +1 -0
- package/dist/esm/cloud/v2/routes/index.js +32 -0
- package/dist/esm/cloud/v2/routes/index.js.map +1 -0
- package/dist/esm/cloud/v2/routes/memories.d.ts +83 -0
- package/dist/esm/cloud/v2/routes/memories.d.ts.map +1 -0
- package/dist/esm/cloud/v2/routes/memories.js +238 -0
- package/dist/esm/cloud/v2/routes/memories.js.map +1 -0
- package/dist/esm/cloud/v2/routes/recall.d.ts +33 -0
- package/dist/esm/cloud/v2/routes/recall.d.ts.map +1 -0
- package/dist/esm/cloud/v2/routes/recall.js +47 -0
- package/dist/esm/cloud/v2/routes/recall.js.map +1 -0
- package/dist/esm/cloud/v2/routes/scrub.d.ts +13 -0
- package/dist/esm/cloud/v2/routes/scrub.d.ts.map +1 -0
- package/dist/esm/cloud/v2/routes/scrub.js +79 -0
- package/dist/esm/cloud/v2/routes/scrub.js.map +1 -0
- package/dist/esm/cloud/v2/routes/usage.d.ts +18 -0
- package/dist/esm/cloud/v2/routes/usage.d.ts.map +1 -0
- package/dist/esm/cloud/v2/routes/usage.js +15 -0
- package/dist/esm/cloud/v2/routes/usage.js.map +1 -0
- package/dist/esm/cloud/v2/routes/verify.d.ts +35 -0
- package/dist/esm/cloud/v2/routes/verify.d.ts.map +1 -0
- package/dist/esm/cloud/v2/routes/verify.js +39 -0
- package/dist/esm/cloud/v2/routes/verify.js.map +1 -0
- package/dist/esm/cloud/v2/server.d.ts +27 -0
- package/dist/esm/cloud/v2/server.d.ts.map +1 -0
- package/dist/esm/cloud/v2/server.js +44 -0
- package/dist/esm/cloud/v2/server.js.map +1 -0
- package/dist/esm/config/index.d.ts +1 -1
- package/dist/esm/config/index.js +1 -1
- package/dist/esm/consensus/index.d.ts +2 -2
- package/dist/esm/consensus/index.js +2 -2
- package/dist/esm/contracts/api-v2.types.d.ts +103 -0
- package/dist/esm/contracts/api-v2.types.d.ts.map +1 -0
- package/dist/esm/contracts/api-v2.types.js +2 -0
- package/dist/esm/contracts/api-v2.types.js.map +1 -0
- package/dist/esm/contracts/errors.d.ts +40 -0
- package/dist/esm/contracts/errors.d.ts.map +1 -0
- package/dist/esm/contracts/errors.js +45 -0
- package/dist/esm/contracts/errors.js.map +1 -0
- package/dist/esm/contracts/evidence.d.ts +49 -0
- package/dist/esm/contracts/evidence.d.ts.map +1 -0
- package/dist/esm/contracts/evidence.js +11 -0
- package/dist/esm/contracts/evidence.js.map +1 -0
- package/dist/esm/contracts/index.d.ts +10 -0
- package/dist/esm/contracts/index.d.ts.map +1 -0
- package/dist/esm/contracts/index.js +10 -0
- package/dist/esm/contracts/index.js.map +1 -0
- package/dist/esm/contracts/store.d.ts +30 -0
- package/dist/esm/contracts/store.d.ts.map +1 -0
- package/dist/esm/contracts/store.js +2 -0
- package/dist/esm/contracts/store.js.map +1 -0
- package/dist/esm/core/AgentRegistry.d.ts +1 -1
- package/dist/esm/core/AgentRegistry.js +1 -1
- package/dist/esm/core/DashboardBroadcaster.d.ts +3 -3
- package/dist/esm/core/DashboardBroadcaster.js +2 -2
- package/dist/esm/core/DashboardWebSocketServer.d.ts +1 -1
- package/dist/esm/core/DashboardWebSocketServer.js +1 -1
- package/dist/esm/core/GhostAlchemist.js +1 -1
- package/dist/esm/core/GhostListener.js +2 -2
- package/dist/esm/core/OrchestrationEngine.d.ts +3 -3
- package/dist/esm/core/OrchestrationEngine.js +2 -2
- package/dist/esm/core/SubconsciousEngine.d.ts +1 -1
- package/dist/esm/core/SubconsciousEngine.js +2 -2
- package/dist/esm/core/WebSocketServer.d.ts +2 -2
- package/dist/esm/core/WebSocketServer.js +1 -1
- package/dist/esm/core/index.d.ts +6 -6
- package/dist/esm/core/index.js +6 -6
- package/dist/esm/core/router.d.ts +3 -3
- package/dist/esm/core/router.js +1 -1
- package/dist/esm/db/database.js +1 -1
- package/dist/esm/embed.d.ts +2 -2
- package/dist/esm/embed.js +2 -2
- package/dist/esm/examples/basic-usage.js +1 -1
- package/dist/esm/index.d.ts +14 -14
- package/dist/esm/index.js +14 -14
- package/dist/esm/infra/analyzers/DriftDetector.d.ts +1 -1
- package/dist/esm/infra/analyzers/InfraAnalyzer.d.ts +1 -1
- package/dist/esm/infra/analyzers/MonolithAnalyzer.d.ts +1 -1
- package/dist/esm/infra/analyzers/index.d.ts +3 -3
- package/dist/esm/infra/analyzers/index.js +3 -3
- package/dist/esm/infra/cli.js +2 -2
- package/dist/esm/infra/config.d.ts +1 -1
- package/dist/esm/infra/index.d.ts +5 -5
- package/dist/esm/infra/index.js +5 -5
- package/dist/esm/infra/mcp-tools.js +5 -5
- package/dist/esm/infra/providers/InfraProvider.d.ts +1 -1
- package/dist/esm/infra/providers/JenkinsProvider.d.ts +2 -2
- package/dist/esm/infra/providers/OKDProvider.d.ts +2 -2
- package/dist/esm/infra/providers/TerraformProvider.d.ts +2 -2
- package/dist/esm/infra/providers/index.d.ts +5 -5
- package/dist/esm/infra/providers/index.js +3 -3
- package/dist/esm/mcp/index.js +5 -5
- package/dist/esm/mcp/prompts.js +1 -1
- package/dist/esm/mcp/resources.js +2 -2
- package/dist/esm/mcp/tasks.js +1 -1
- package/dist/esm/mcp/tool-profiles.d.ts.map +1 -1
- package/dist/esm/mcp/tool-profiles.js +47 -2
- package/dist/esm/mcp/tool-profiles.js.map +1 -1
- package/dist/esm/mcp/tools.d.ts +2 -0
- package/dist/esm/mcp/tools.d.ts.map +1 -1
- package/dist/esm/mcp/tools.js +366 -78
- package/dist/esm/mcp/tools.js.map +1 -1
- package/dist/esm/observability/IdeContextSync.d.ts +1 -1
- package/dist/esm/observability/IdeContextSync.js +5 -5
- package/dist/esm/pr-review/PRReviewEngine.d.ts +1 -1
- package/dist/esm/pr-review/PRReviewEngine.js +4 -4
- package/dist/esm/pr-review/ReviewStore.d.ts +1 -1
- package/dist/esm/pr-review/adapters/AzureDevOpsAdapter.d.ts +2 -2
- package/dist/esm/pr-review/adapters/AzureDevOpsAdapter.js +1 -1
- package/dist/esm/pr-review/adapters/GitHubAdapter.d.ts +2 -2
- package/dist/esm/pr-review/adapters/GitHubAdapter.js +1 -1
- package/dist/esm/pr-review/adapters/GitLabAdapter.d.ts +2 -2
- package/dist/esm/pr-review/adapters/GitLabAdapter.js +1 -1
- package/dist/esm/pr-review/adapters/GitPlatformAdapter.d.ts +1 -1
- package/dist/esm/pr-review/adapters/index.d.ts +4 -4
- package/dist/esm/pr-review/adapters/index.js +3 -3
- package/dist/esm/pr-review/analyzers/QualityGrader.d.ts +1 -1
- package/dist/esm/pr-review/analyzers/RegressionDetector.d.ts +1 -1
- package/dist/esm/pr-review/analyzers/SecurityScanner.d.ts +1 -1
- package/dist/esm/pr-review/analyzers/StaticAnalyzer.d.ts +1 -1
- package/dist/esm/pr-review/analyzers/index.d.ts +8 -8
- package/dist/esm/pr-review/analyzers/index.js +4 -4
- package/dist/esm/pr-review/bridge/BrainBridge.d.ts +1 -1
- package/dist/esm/pr-review/bridge/BrainBridge.js +2 -2
- package/dist/esm/pr-review/bridge/BrainBridge.js.map +1 -1
- package/dist/esm/pr-review/bridge/index.d.ts +1 -1
- package/dist/esm/pr-review/bridge/index.js +1 -1
- package/dist/esm/pr-review/index.d.ts +4 -4
- package/dist/esm/pr-review/index.js +2 -2
- package/dist/esm/pr-review/reviewRunner.d.ts +2 -2
- package/dist/esm/pr-review/reviewRunner.js +6 -6
- package/dist/esm/pr-review/webhook/WebhookServer.js +1 -1
- package/dist/esm/pr-review/webhook/index.d.ts +1 -1
- package/dist/esm/pr-review/webhook/index.js +1 -1
- package/dist/esm/protocol/flows.d.ts +1 -1
- package/dist/esm/protocol/flows.js +1 -1
- package/dist/esm/protocol/index.d.ts +4 -4
- package/dist/esm/protocol/index.js +4 -4
- package/dist/esm/protocol/utils.d.ts +1 -1
- package/dist/esm/protocol/utils.js +2 -2
- package/dist/esm/protocol/validators.d.ts +1 -1
- package/dist/esm/protocol/validators.js +1 -1
- package/dist/esm/proxy/ContextInjector.d.ts +1 -1
- package/dist/esm/proxy/Gatekeeper.d.ts +1 -1
- package/dist/esm/security/SecurityMiddleware.d.ts +1 -1
- package/dist/esm/security/SecurityMiddleware.js +3 -3
- package/dist/esm/security/index.d.ts +4 -4
- package/dist/esm/security/index.js +4 -4
- package/dist/esm/speculative/SpeculativeCache.d.ts +2 -2
- package/dist/esm/speculative/SpeculativeEngine.d.ts +2 -2
- package/dist/esm/speculative/SpeculativeEngine.js +3 -3
- package/dist/esm/speculative/WorkerPool.d.ts +1 -1
- package/dist/esm/speculative/index.d.ts +4 -4
- package/dist/esm/speculative/index.js +4 -4
- package/dist/esm/subconscious/BrainEmbeddings.d.ts +59 -0
- package/dist/esm/subconscious/BrainEmbeddings.d.ts.map +1 -0
- package/dist/esm/subconscious/BrainEmbeddings.js +211 -0
- package/dist/esm/subconscious/BrainEmbeddings.js.map +1 -0
- package/dist/esm/subconscious/GitIngest.d.ts +1 -1
- package/dist/esm/subconscious/GitIngest.js +3 -3
- package/dist/esm/subconscious/GitIngest.js.map +1 -1
- package/dist/esm/subconscious/SemanticCache.d.ts +2 -2
- package/dist/esm/subconscious/SemanticCache.js +2 -2
- package/dist/esm/subconscious/SubconsciousEngine.d.ts +1 -1
- package/dist/esm/subconscious/SubconsciousEngine.js +3 -3
- package/dist/esm/subconscious/TheBrainV2.d.ts +327 -9
- package/dist/esm/subconscious/TheBrainV2.d.ts.map +1 -1
- package/dist/esm/subconscious/TheBrainV2.js +947 -98
- package/dist/esm/subconscious/TheBrainV2.js.map +1 -1
- package/dist/esm/subconscious/freshness/LocalFsResolver.d.ts +16 -0
- package/dist/esm/subconscious/freshness/LocalFsResolver.d.ts.map +1 -0
- package/dist/esm/subconscious/freshness/LocalFsResolver.js +67 -0
- package/dist/esm/subconscious/freshness/LocalFsResolver.js.map +1 -0
- package/dist/esm/subconscious/freshness/SuppliedEvidenceResolver.d.ts +23 -0
- package/dist/esm/subconscious/freshness/SuppliedEvidenceResolver.d.ts.map +1 -0
- package/dist/esm/subconscious/freshness/SuppliedEvidenceResolver.js +20 -0
- package/dist/esm/subconscious/freshness/SuppliedEvidenceResolver.js.map +1 -0
- package/dist/esm/subconscious/freshness/index.d.ts +10 -0
- package/dist/esm/subconscious/freshness/index.d.ts.map +1 -0
- package/dist/esm/subconscious/freshness/index.js +10 -0
- package/dist/esm/subconscious/freshness/index.js.map +1 -0
- package/dist/esm/subconscious/index.d.ts +4 -4
- package/dist/esm/subconscious/index.js +4 -4
- package/dist/esm/utils/AffectedTests.js +1 -1
- package/dist/esm/utils/AutoContextBundle.d.ts +1 -1
- package/dist/esm/utils/AutoContextBundle.js +4 -4
- package/dist/esm/utils/BulkFileDigest.js +2 -2
- package/dist/esm/utils/ClipboardWatcher.js +2 -2
- package/dist/esm/utils/ContextCollapser.js +1 -1
- package/dist/esm/utils/ConversationCheckpoint.js +2 -2
- package/dist/esm/utils/ConversationCheckpoint.js.map +1 -1
- package/dist/esm/utils/ExecutiveReport.js +1 -1
- package/dist/esm/utils/OutputLedger.js +2 -2
- package/dist/esm/utils/ProjectIdentity.d.ts +12 -0
- package/dist/esm/utils/ProjectIdentity.d.ts.map +1 -0
- package/dist/esm/utils/ProjectIdentity.js +37 -0
- package/dist/esm/utils/ProjectIdentity.js.map +1 -0
- package/dist/esm/utils/PromptPatternCache.d.ts.map +1 -1
- package/dist/esm/utils/PromptPatternCache.js +12 -2
- package/dist/esm/utils/PromptPatternCache.js.map +1 -1
- package/dist/esm/utils/ReadWorkspaceCache.js +1 -1
- package/dist/esm/utils/RepeatGuard.d.ts.map +1 -1
- package/dist/esm/utils/RepeatGuard.js +10 -2
- package/dist/esm/utils/RepeatGuard.js.map +1 -1
- package/dist/esm/utils/SpeculativeWarmer.d.ts +1 -1
- package/dist/esm/utils/SpeculativeWarmer.js +2 -2
- package/dist/esm/utils/StateHashCache.d.ts +5 -0
- package/dist/esm/utils/StateHashCache.d.ts.map +1 -1
- package/dist/esm/utils/StateHashCache.js +40 -16
- package/dist/esm/utils/StateHashCache.js.map +1 -1
- package/dist/esm/utils/StructuralSearch.d.ts +1 -1
- package/dist/esm/utils/SurgicalASTInsert.js +1 -1
- package/dist/esm/utils/SymbolSurgicalContext.js +1 -1
- package/dist/esm/utils/TestAutofixInterceptor.js +1 -1
- package/dist/esm/utils/WorkspaceSearch.js +0 -0
- package/dist/esm/utils/logger.js +1 -1
- package/dist/esm/utils/reportSavings.js +1 -1
- package/package.json +1 -1
- package/sdks/crewai/README.md +25 -0
- package/dist/cjs/package.json +0 -3
- package/dist/esm/package.json +0 -3
- package/sdks/crewai/dist/index.d.ts +0 -130
- package/sdks/crewai/dist/index.js +0 -308
package/dist/cjs/mcp/tools.js
CHANGED
|
@@ -36,6 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.detectExpectedProjectName = void 0;
|
|
39
40
|
exports.getToolSchemaChars = getToolSchemaChars;
|
|
40
41
|
exports.getRegisteredToolNames = getRegisteredToolNames;
|
|
41
42
|
exports.getAdvertisedToolNames = getAdvertisedToolNames;
|
|
@@ -54,6 +55,7 @@ const ContextSqueezer_1 = require("../utils/ContextSqueezer");
|
|
|
54
55
|
const reportSavings_1 = require("../utils/reportSavings");
|
|
55
56
|
const utils_1 = require("./utils");
|
|
56
57
|
const FileFingerprint_1 = require("../utils/FileFingerprint");
|
|
58
|
+
const ProjectIdentity_1 = require("../utils/ProjectIdentity");
|
|
57
59
|
const GitBlameHeat_1 = require("../utils/GitBlameHeat");
|
|
58
60
|
const TypeCoverage_1 = require("../utils/TypeCoverage");
|
|
59
61
|
const ImportTreeContext_1 = require("../utils/ImportTreeContext");
|
|
@@ -112,6 +114,10 @@ function isProUser() {
|
|
|
112
114
|
const FREE_TOOLS = new Set([
|
|
113
115
|
// Cache & Memory ā the hook that shows instant value
|
|
114
116
|
"smarter_cache", "state_hash_cache", "token_receipt", "search_memory", "store_memory", "downvote_memory", "verify_memory", "get_project_history",
|
|
117
|
+
// Memory upkeep. Deleting your own memories, re-verifying them, and getting them back out
|
|
118
|
+
// of the tool must never be behind a paywall ā a user who cannot export or forget what a
|
|
119
|
+
// free tier collected does not really own it.
|
|
120
|
+
"forget_memory", "refresh_memory", "brain_stats", "brain_export", "brain_import",
|
|
115
121
|
// Token optimization ā shows what they're saving
|
|
116
122
|
"token_budget", "squeeze_prompt", "turbosqueeze",
|
|
117
123
|
// Utility ā just enough to function
|
|
@@ -350,6 +356,81 @@ const toolDefinitions = [
|
|
|
350
356
|
required: ["id"],
|
|
351
357
|
},
|
|
352
358
|
},
|
|
359
|
+
{
|
|
360
|
+
name: "forget_memory",
|
|
361
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
362
|
+
description: "Permanently delete one memory from the Brain by id. Use when a memory is flat wrong, was captured by mistake, or should never have been stored ā not when it is merely a poor match for one query (that is downvote_memory, which keeps it around for a different question later). Deletion is irreversible and the id will not come back from another session's copy.",
|
|
363
|
+
inputSchema: {
|
|
364
|
+
type: "object",
|
|
365
|
+
properties: {
|
|
366
|
+
id: { type: "string", description: "The memory's id, from a search_memory or store_memory result." },
|
|
367
|
+
},
|
|
368
|
+
required: ["id"],
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
name: "refresh_memory",
|
|
373
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
374
|
+
description: "Re-anchor a STALE memory to the code as it stands now, keeping its id, hit count and derivedFrom links (storing a near-duplicate instead loses all three, and dedup often refuses it anyway). Call with just the id after you have verified the memory is still correct; pass filePaths/symbols instead when the code moved and it should track something new. Only call this once you have actually checked ā it records your assertion that the memory is true today, it cannot verify that itself.",
|
|
375
|
+
inputSchema: {
|
|
376
|
+
type: "object",
|
|
377
|
+
properties: {
|
|
378
|
+
id: { type: "string", description: "The memory's id, from a search_memory or verify_memory result." },
|
|
379
|
+
filePaths: { type: "array", items: { type: "string" }, description: "New files to track instead of the current ones. Omit to re-hash whatever it already tracks." },
|
|
380
|
+
symbols: {
|
|
381
|
+
type: "array",
|
|
382
|
+
items: {
|
|
383
|
+
type: "object",
|
|
384
|
+
properties: {
|
|
385
|
+
filePath: { type: "string" },
|
|
386
|
+
symbolName: { type: "string" },
|
|
387
|
+
},
|
|
388
|
+
required: ["filePath", "symbolName"],
|
|
389
|
+
},
|
|
390
|
+
description: "New symbols to track instead of the current ones (e.g. the function was renamed or moved).",
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
required: ["id"],
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
name: "brain_stats",
|
|
398
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
399
|
+
description: "Health report for the Brain itself: entry count, how many memories no search has ever reused, how many were downvoted, what wrote them (manual vs. each auto-capture path), projects covered, and corpus size. Pass deep:true to also re-hash every tracked file and report the stale ratio ā accurate but thousands of file reads on a large Brain.",
|
|
400
|
+
inputSchema: {
|
|
401
|
+
type: "object",
|
|
402
|
+
properties: {
|
|
403
|
+
deep: { type: "boolean", description: "Also compute the stale ratio by re-hashing all tracked evidence. Slow.", default: false },
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
name: "brain_export",
|
|
409
|
+
annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: false },
|
|
410
|
+
description: "Write memories to a portable NDJSON bundle for backup, moving to another machine, or sharing with a teammate. Defaults to this project's memories only, and to fresh ones only (a stale memory exported and imported elsewhere is just a wrong answer with a passport).",
|
|
411
|
+
inputSchema: {
|
|
412
|
+
type: "object",
|
|
413
|
+
properties: {
|
|
414
|
+
outPath: { type: "string", description: "Where to write the bundle (relative to the workspace root)." },
|
|
415
|
+
allProjects: { type: "boolean", description: "Export every project's memories, not just this one.", default: false },
|
|
416
|
+
domain: { type: "string", description: "Only export memories tagged with this domain." },
|
|
417
|
+
includeStale: { type: "boolean", description: "Include memories whose tracked evidence no longer matches.", default: false },
|
|
418
|
+
},
|
|
419
|
+
required: ["outPath"],
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
name: "brain_import",
|
|
424
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
425
|
+
description: "Merge a bundle written by brain_export into this Brain. Additive and non-destructive: an id already present keeps the newer version, and anything previously deleted with forget_memory stays deleted. Imported memories track the paths of the machine they came from, so most will read as stale here until refresh_memory re-anchors them.",
|
|
426
|
+
inputSchema: {
|
|
427
|
+
type: "object",
|
|
428
|
+
properties: {
|
|
429
|
+
path: { type: "string", description: "Path to the bundle file (relative to the workspace root)." },
|
|
430
|
+
},
|
|
431
|
+
required: ["path"],
|
|
432
|
+
},
|
|
433
|
+
},
|
|
353
434
|
{
|
|
354
435
|
name: "get_routing_advice",
|
|
355
436
|
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
@@ -1480,6 +1561,11 @@ const toolHandlers = {
|
|
|
1480
1561
|
store_memory: handleStoreMemory,
|
|
1481
1562
|
downvote_memory: handleDownvoteMemory,
|
|
1482
1563
|
verify_memory: handleVerifyMemory,
|
|
1564
|
+
forget_memory: handleForgetMemory,
|
|
1565
|
+
refresh_memory: handleRefreshMemory,
|
|
1566
|
+
brain_stats: handleBrainStats,
|
|
1567
|
+
brain_export: handleBrainExport,
|
|
1568
|
+
brain_import: handleBrainImport,
|
|
1483
1569
|
get_routing_advice: handleGetRoutingAdvice,
|
|
1484
1570
|
auto_heal: handleAutoHeal,
|
|
1485
1571
|
read_workspace_file: handleReadWorkspaceFile,
|
|
@@ -1758,7 +1844,9 @@ async function handleSearchMemory(args) {
|
|
|
1758
1844
|
throw new Error("Query is required");
|
|
1759
1845
|
try {
|
|
1760
1846
|
const brain = (0, TheBrainV2_1.getBrain)();
|
|
1761
|
-
|
|
1847
|
+
// searchHybrid is search() plus one boolean check unless LEMMA_BRAIN_EMBEDDINGS is set,
|
|
1848
|
+
// so this costs nothing by default and picks up the semantic re-rank when it is enabled.
|
|
1849
|
+
const results = await brain.searchHybrid(query, limit, minSimilarity, { projectId: (0, TheBrainV2_1.deriveProjectId)(), domain, semanticDiff });
|
|
1762
1850
|
if (results.length === 0) {
|
|
1763
1851
|
(0, TokenReceipt_1.recordReceiptEvent)("reasoning", query.substring(0, 100), {
|
|
1764
1852
|
tool: "search_memory",
|
|
@@ -1809,7 +1897,15 @@ async function handleSearchMemory(args) {
|
|
|
1809
1897
|
}
|
|
1810
1898
|
if (stale.length > 0) {
|
|
1811
1899
|
const staleText = stale
|
|
1812
|
-
.map((r, i) =>
|
|
1900
|
+
.map((r, i) => {
|
|
1901
|
+
// "You are on a different branch" and "someone rewrote this function" are the same
|
|
1902
|
+
// hash mismatch and completely different situations for the reader: the first is
|
|
1903
|
+
// usually not a reason to distrust the memory at all.
|
|
1904
|
+
const cause = r.staleCause === "branch-changed"
|
|
1905
|
+
? `\nNOTE: stored on branch \`${r.storedOnBranch}\`, you are on \`${(0, TheBrainV2_1.currentGitContext)().branch || "an unknown branch"}\`. The difference may be the branch switch rather than an edit ā check before discarding this.`
|
|
1906
|
+
: "";
|
|
1907
|
+
return `${formatResult(r, i)}\nSTALE ā changed since stored: ${r.staleFiles.join(", ")}${cause}`;
|
|
1908
|
+
})
|
|
1813
1909
|
.join("\n\n---\n\n");
|
|
1814
1910
|
parts.push(`${stale.length} more ${stale.length === 1 ? "memory is" : "memories are"} similar but STALE (underlying file(s) changed) ā do not reuse verbatim, re-verify against current file state:\n\n${staleText}`);
|
|
1815
1911
|
}
|
|
@@ -1843,7 +1939,7 @@ async function handleStoreMemory(args) {
|
|
|
1843
1939
|
throw new Error("Query and response are required");
|
|
1844
1940
|
try {
|
|
1845
1941
|
const brain = (0, TheBrainV2_1.getBrain)();
|
|
1846
|
-
const storeRes = brain.store(query, responseText, provider, 0.92, filePaths, undefined, outcome, symbols, claims, domain, derivedFrom);
|
|
1942
|
+
const storeRes = brain.store(query, responseText, provider, 0.92, filePaths, undefined, outcome, symbols, claims, domain, derivedFrom, { source: "manual" });
|
|
1847
1943
|
// Storing a memory saves nothing ā it only creates the chance of a saving later.
|
|
1848
1944
|
// Crediting tokens here inflated the ledger on write and then credited the same
|
|
1849
1945
|
// answer again on every read. The saving is booked by search_memory on a fresh hit.
|
|
@@ -1866,7 +1962,11 @@ async function handleStoreMemory(args) {
|
|
|
1866
1962
|
? `\n\nā ļø ${storeRes.conflicts.length} existing ${storeRes.conflicts.length === 1 ? "memory shares" : "memories share"} a symbol with this one but disagree on outcome ā review before trusting either:\n` +
|
|
1867
1963
|
storeRes.conflicts.map((c) => ` - [${c.outcome}] ${c.id}: ${c.query.substring(0, 120)}`).join("\n")
|
|
1868
1964
|
: "";
|
|
1869
|
-
|
|
1965
|
+
// The id is the handle for every follow-up action on this memory ā derivedFrom on a
|
|
1966
|
+
// later store, verify_memory, refresh_memory, forget_memory. Without it the caller had
|
|
1967
|
+
// to search for the memory it had just written to do anything with it.
|
|
1968
|
+
const idNote = storeRes.id ? ` (id: ${storeRes.id})` : "";
|
|
1969
|
+
return { content: [{ type: "text", text: `Success: Memory stored${idNote}. ${storeRes.reason}${trackingNote}${symbolNote}${outcomeNote}${claimsNote}${domainNote}${derivedFromNote}${conflictsNote}` }] };
|
|
1870
1970
|
}
|
|
1871
1971
|
catch (e) {
|
|
1872
1972
|
(0, utils_1.logError)("store_memory", e);
|
|
@@ -1886,6 +1986,138 @@ async function handleDownvoteMemory(args) {
|
|
|
1886
1986
|
return { content: [{ type: "text", text: `Failed to downvote memory: ${e.message}` }] };
|
|
1887
1987
|
}
|
|
1888
1988
|
}
|
|
1989
|
+
/**
|
|
1990
|
+
* Deleting a memory is the one Brain operation with no undo, so it asks the client to
|
|
1991
|
+
* confirm where the client supports it, and echoes back what was destroyed where it doesn't
|
|
1992
|
+
* ā an irreversible action must at minimum leave a record of what it removed.
|
|
1993
|
+
*/
|
|
1994
|
+
async function handleForgetMemory(args) {
|
|
1995
|
+
const id = args?.id;
|
|
1996
|
+
if (!id)
|
|
1997
|
+
throw new Error("id is required");
|
|
1998
|
+
try {
|
|
1999
|
+
const brain = (0, TheBrainV2_1.getBrain)();
|
|
2000
|
+
const preview = brain.verifyByIds([id])[0];
|
|
2001
|
+
if (preview?.status === "unknown") {
|
|
2002
|
+
return { content: [{ type: "text", text: `No memory with id "${id}" in the Brain ā nothing to delete.` }] };
|
|
2003
|
+
}
|
|
2004
|
+
const elicited = await tryElicitConfirmation(`Permanently delete Brain memory "${id}"? This cannot be undone.`);
|
|
2005
|
+
if (elicited.supported && !elicited.confirmed) {
|
|
2006
|
+
return { content: [{ type: "text", text: `Memory "${id}" was not deleted: declined during confirmation.` }] };
|
|
2007
|
+
}
|
|
2008
|
+
const result = brain.forget(id);
|
|
2009
|
+
if (!result.ok || !result.forgotten) {
|
|
2010
|
+
return { content: [{ type: "text", text: result.message }] };
|
|
2011
|
+
}
|
|
2012
|
+
return {
|
|
2013
|
+
content: [{
|
|
2014
|
+
type: "text",
|
|
2015
|
+
text: `${result.message}\n\nDeleted content, for the record (nothing else can recover it):\n stored: ${result.forgotten.timestamp}\n reused: ${result.forgotten.hits} time(s)\n query: ${result.forgotten.query.substring(0, 300)}`,
|
|
2016
|
+
}],
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
catch (e) {
|
|
2020
|
+
(0, utils_1.logError)("forget_memory", e);
|
|
2021
|
+
return { content: [{ type: "text", text: `Failed to delete memory: ${e.message}` }] };
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
async function handleRefreshMemory(args) {
|
|
2025
|
+
const id = args?.id;
|
|
2026
|
+
if (!id)
|
|
2027
|
+
throw new Error("id is required");
|
|
2028
|
+
const filePaths = Array.isArray(args?.filePaths) ? args.filePaths.filter((p) => typeof p === "string" && p) : undefined;
|
|
2029
|
+
const symbols = Array.isArray(args?.symbols)
|
|
2030
|
+
? args.symbols.filter((sym) => sym?.filePath && sym?.symbolName)
|
|
2031
|
+
: undefined;
|
|
2032
|
+
try {
|
|
2033
|
+
const result = (0, TheBrainV2_1.getBrain)().refresh(id, { filePaths, symbols });
|
|
2034
|
+
if (!result.ok)
|
|
2035
|
+
return { content: [{ type: "text", text: result.message }] };
|
|
2036
|
+
const retrackedNote = result.retracked && result.retracked.length > 0
|
|
2037
|
+
? `\nNow tracking: ${result.retracked.join(", ")}`
|
|
2038
|
+
: "\nThis memory tracks no files or symbols, so there was nothing to re-anchor ā its age clock was reset.";
|
|
2039
|
+
return { content: [{ type: "text", text: `${result.message}${retrackedNote}` }] };
|
|
2040
|
+
}
|
|
2041
|
+
catch (e) {
|
|
2042
|
+
(0, utils_1.logError)("refresh_memory", e);
|
|
2043
|
+
return { content: [{ type: "text", text: `Failed to refresh memory: ${e.message}` }] };
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
async function handleBrainStats(args) {
|
|
2047
|
+
try {
|
|
2048
|
+
const stats = (0, TheBrainV2_1.getBrain)().getStats({ deep: args?.deep === true });
|
|
2049
|
+
const lines = [];
|
|
2050
|
+
lines.push(`# Brain health`);
|
|
2051
|
+
lines.push(`Entries: ${stats.totalEntries} (${stats.totalTerms} indexed terms, ${((stats.corpusBytes || 0) / 1024).toFixed(0)} KB on disk)`);
|
|
2052
|
+
lines.push(`This session: ${stats.cacheHits} hit(s), ${stats.cacheMisses} miss(es)`);
|
|
2053
|
+
if (stats.totalEntries > 0) {
|
|
2054
|
+
const neverHitPct = ((stats.neverHit || 0) / stats.totalEntries) * 100;
|
|
2055
|
+
lines.push(`Never reused: ${stats.neverHit} (${neverHitPct.toFixed(0)}% ā these are evicted first)`);
|
|
2056
|
+
lines.push(`Downvoted: ${stats.downvoted}`);
|
|
2057
|
+
lines.push(`Projects: ${stats.projects}${stats.unscopedEntries ? ` (+${stats.unscopedEntries} entries predating project scoping)` : ""}`);
|
|
2058
|
+
if (stats.oldestEntry)
|
|
2059
|
+
lines.push(`Oldest entry: ${stats.oldestEntry}`);
|
|
2060
|
+
if (stats.tombstones)
|
|
2061
|
+
lines.push(`Deleted ids still suppressed: ${stats.tombstones}`);
|
|
2062
|
+
const sources = Object.entries(stats.bySource || {}).sort((a, b) => b[1] - a[1]);
|
|
2063
|
+
if (sources.length > 0) {
|
|
2064
|
+
lines.push(`Written by: ${sources.map(([k, v]) => `${k}=${v}`).join(", ")}`);
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
if (stats.staleEntries !== undefined) {
|
|
2068
|
+
lines.push(`Stale: ${stats.staleEntries} of the entries that track evidence (${((stats.staleRatio || 0) * 100).toFixed(0)}%) ā refresh_memory re-anchors one, forget_memory drops it.`);
|
|
2069
|
+
}
|
|
2070
|
+
else {
|
|
2071
|
+
lines.push(`(stale ratio not computed ā pass deep:true)`);
|
|
2072
|
+
}
|
|
2073
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
2074
|
+
}
|
|
2075
|
+
catch (e) {
|
|
2076
|
+
(0, utils_1.logError)("brain_stats", e);
|
|
2077
|
+
return { content: [{ type: "text", text: `Failed to read Brain stats: ${e.message}` }] };
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
async function handleBrainExport(args) {
|
|
2081
|
+
const outPath = args?.outPath;
|
|
2082
|
+
if (!outPath)
|
|
2083
|
+
throw new Error("outPath is required");
|
|
2084
|
+
try {
|
|
2085
|
+
const bundle = (0, TheBrainV2_1.getBrain)().exportBundle({
|
|
2086
|
+
// Scoped to this project unless asked otherwise: exporting every project's memories
|
|
2087
|
+
// by default is how a bundle meant for one teammate ends up carrying another client's
|
|
2088
|
+
// codebase notes with it.
|
|
2089
|
+
projectId: args?.allProjects === true ? undefined : (0, TheBrainV2_1.deriveProjectId)(),
|
|
2090
|
+
domain: typeof args?.domain === "string" && args.domain.trim() ? args.domain.trim() : undefined,
|
|
2091
|
+
includeStale: args?.includeStale === true,
|
|
2092
|
+
});
|
|
2093
|
+
const { resolved } = (0, utils_1.safeResolvePath)(process.cwd(), outPath);
|
|
2094
|
+
fs_1.default.mkdirSync(path_1.default.dirname(resolved), { recursive: true });
|
|
2095
|
+
fs_1.default.writeFileSync(resolved, bundle.text, "utf8");
|
|
2096
|
+
const staleNote = bundle.skippedStale > 0
|
|
2097
|
+
? ` Skipped ${bundle.skippedStale} stale memor${bundle.skippedStale === 1 ? "y" : "ies"} (pass includeStale:true to export those too).`
|
|
2098
|
+
: "";
|
|
2099
|
+
return { content: [{ type: "text", text: `Exported ${bundle.count} memor${bundle.count === 1 ? "y" : "ies"} to ${outPath}.${staleNote}` }] };
|
|
2100
|
+
}
|
|
2101
|
+
catch (e) {
|
|
2102
|
+
(0, utils_1.logError)("brain_export", e);
|
|
2103
|
+
return { content: [{ type: "text", text: `Failed to export Brain: ${e.message}` }] };
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
async function handleBrainImport(args) {
|
|
2107
|
+
const bundlePath = args?.path;
|
|
2108
|
+
if (!bundlePath)
|
|
2109
|
+
throw new Error("path is required");
|
|
2110
|
+
try {
|
|
2111
|
+
const { resolved } = (0, utils_1.safeResolvePath)(process.cwd(), bundlePath);
|
|
2112
|
+
const text = fs_1.default.readFileSync(resolved, "utf8");
|
|
2113
|
+
const result = (0, TheBrainV2_1.getBrain)().importBundle(text);
|
|
2114
|
+
return { content: [{ type: "text", text: result.message }] };
|
|
2115
|
+
}
|
|
2116
|
+
catch (e) {
|
|
2117
|
+
(0, utils_1.logError)("brain_import", e);
|
|
2118
|
+
return { content: [{ type: "text", text: `Failed to import Brain bundle: ${e.message}` }] };
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
1889
2121
|
async function handleVerifyMemory(args) {
|
|
1890
2122
|
const ids = Array.isArray(args?.ids) ? args.ids.filter((id) => typeof id === "string" && id) : [];
|
|
1891
2123
|
const semanticDiff = args?.semanticDiff === true;
|
|
@@ -2073,7 +2305,7 @@ async function handleReadWorkspaceFile(args) {
|
|
|
2073
2305
|
`If you no longer hold that copy, re-fetch with force:true.`,
|
|
2074
2306
|
``,
|
|
2075
2307
|
delta.body,
|
|
2076
|
-
].join("\n"),
|
|
2308
|
+
].join("\n") + formatRecallNote(filePath),
|
|
2077
2309
|
},
|
|
2078
2310
|
],
|
|
2079
2311
|
};
|
|
@@ -2082,7 +2314,7 @@ async function handleReadWorkspaceFile(args) {
|
|
|
2082
2314
|
}
|
|
2083
2315
|
(0, ReadWorkspaceCache_1.recordSent)(resolved, view, dedup.hash, content);
|
|
2084
2316
|
(0, SpeculativeWarmer_1.warmNeighbors)(workspaceRoot, resolved);
|
|
2085
|
-
return { content: [{ type: "text", text: rangeHeader + content }] };
|
|
2317
|
+
return { content: [{ type: "text", text: rangeHeader + content + formatRecallNote(filePath) }] };
|
|
2086
2318
|
}
|
|
2087
2319
|
catch (err) {
|
|
2088
2320
|
(0, utils_1.logError)("read_workspace_file", err);
|
|
@@ -2172,6 +2404,46 @@ function formatBlastRadiusNote(result) {
|
|
|
2172
2404
|
const failedIds = result.failedHits.map((h) => h.id).join(", ");
|
|
2173
2405
|
return `${base}\nā ļø ${result.failedHits.length} of those document a PRIOR ATTEMPT THAT FAILED on related code: ${failedIds}. Review before continuing down this path.`;
|
|
2174
2406
|
}
|
|
2407
|
+
/**
|
|
2408
|
+
* The read-side counterpart to formatBlastRadiusNote.
|
|
2409
|
+
*
|
|
2410
|
+
* Fase E made the write path proactive: a tool that stales memories says so on the spot.
|
|
2411
|
+
* The read path stayed entirely opt-in ā the Brain only spoke when the agent remembered to
|
|
2412
|
+
* call search_memory, which is exactly the moment an agent that doesn't know a memory exists
|
|
2413
|
+
* has no reason to. This closes that asymmetry: reading code the Brain already has notes on
|
|
2414
|
+
* surfaces them, including any documented dead end, before the investigation restarts from
|
|
2415
|
+
* scratch.
|
|
2416
|
+
*
|
|
2417
|
+
* Same rules as the write-side note: advisory only, never blocks, never mutates, and adds no
|
|
2418
|
+
* tool schema (it enriches an existing response), so it costs nothing per turn. It reports
|
|
2419
|
+
* ids rather than content ā pulling whole memories into every file read would spend far more
|
|
2420
|
+
* context than it saves; search_memory or verify_memory fetches the ones that matter.
|
|
2421
|
+
*/
|
|
2422
|
+
const _recallNoted = new Set();
|
|
2423
|
+
function formatRecallNote(filePath, symbolName) {
|
|
2424
|
+
try {
|
|
2425
|
+
const result = (0, TheBrainV2_1.getBrain)().findBlastRadius(filePath, symbolName);
|
|
2426
|
+
if (result.hits.length === 0)
|
|
2427
|
+
return "";
|
|
2428
|
+
// Repeating the identical note on every read of the same file is nagging, not signal.
|
|
2429
|
+
// Keyed by the memory set, so a note reappears when the set genuinely changes.
|
|
2430
|
+
const ids = result.hits.map((h) => h.id).sort();
|
|
2431
|
+
const key = `${path_1.default.resolve(filePath)}::${symbolName || ""}::${ids.join(",")}`;
|
|
2432
|
+
if (_recallNoted.has(key))
|
|
2433
|
+
return "";
|
|
2434
|
+
_recallNoted.add(key);
|
|
2435
|
+
const subject = symbolName ? `\`${symbolName}\`` : "this file";
|
|
2436
|
+
const base = `\n\nš§ The Brain already has ${result.hits.length} memor${result.hits.length === 1 ? "y" : "ies"} about ${subject}: ${ids.join(", ")}. Call verify_memory on them before investigating from scratch.`;
|
|
2437
|
+
if (result.failedHits.length === 0)
|
|
2438
|
+
return base;
|
|
2439
|
+
const failedIds = result.failedHits.map((h) => h.id).join(", ");
|
|
2440
|
+
return `${base}\nā ļø ${result.failedHits.length} of those document an approach that was tried here and FAILED: ${failedIds}. Read those first so you don't repeat it.`;
|
|
2441
|
+
}
|
|
2442
|
+
catch {
|
|
2443
|
+
// A recall note must never be the reason a file read fails.
|
|
2444
|
+
return "";
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2175
2447
|
async function applyMatch(match, filePath, resolved, originalContent, searchContent, replaceContent) {
|
|
2176
2448
|
let updatedContent;
|
|
2177
2449
|
if (match.strategy === "exact" && match.charStart !== undefined && match.charEnd !== undefined) {
|
|
@@ -2737,11 +3009,27 @@ function buildLocalOnboarding(cwd) {
|
|
|
2737
3009
|
catch { /* brain unavailable */ }
|
|
2738
3010
|
return lines.join("\n");
|
|
2739
3011
|
}
|
|
3012
|
+
// Re-exported for callers/tests that already import detectExpectedProjectName from here ā
|
|
3013
|
+
// the actual implementation lives in ../utils/ProjectIdentity, shared with the proxy daemon
|
|
3014
|
+
// (src/cli/lemma-proxy.ts) so both sides compute "project name" exactly one way.
|
|
3015
|
+
exports.detectExpectedProjectName = ProjectIdentity_1.detectProjectName;
|
|
2740
3016
|
async function handleGetProjectOnboarding(_args) {
|
|
2741
3017
|
const cwd = process.cwd();
|
|
2742
3018
|
try {
|
|
2743
3019
|
const port = (0, utils_1.getProxyPort)();
|
|
2744
|
-
|
|
3020
|
+
// The proxy daemon is one global process per machine, tracked by a single shared
|
|
3021
|
+
// ~/.lemma-cache/proxy.port file ā every MCP client on the box points at whichever
|
|
3022
|
+
// daemon happens to be listening there, regardless of which project it's actually
|
|
3023
|
+
// running in. Its project identity is fixed to whatever cwd IT was started from, not
|
|
3024
|
+
// ours. Without expectedProject, a daemon started for a different project answers with
|
|
3025
|
+
// THAT project's stack/files/memories ā a real cross-project data leak, not a cosmetic
|
|
3026
|
+
// bug. The route only returns `markdown` when this matches; otherwise we fall through
|
|
3027
|
+
// to the local (always correctly-scoped) generator below.
|
|
3028
|
+
const expectedProject = (0, exports.detectExpectedProjectName)(cwd);
|
|
3029
|
+
const response = await axios_1.default.get(`http://localhost:${port}/api/project/onboarding`, {
|
|
3030
|
+
timeout: 2000,
|
|
3031
|
+
params: { expectedProject },
|
|
3032
|
+
});
|
|
2745
3033
|
if (response.data?.markdown) {
|
|
2746
3034
|
return { content: [{ type: "text", text: response.data.markdown }] };
|
|
2747
3035
|
}
|
|
@@ -3266,30 +3554,31 @@ async function handleBatchToolCalls(args) {
|
|
|
3266
3554
|
// āā TurboSqueeze āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
3267
3555
|
async function handleTurboSqueeze(args) {
|
|
3268
3556
|
const text = args?.text;
|
|
3269
|
-
const
|
|
3270
|
-
const
|
|
3557
|
+
const wantStripComments = args?.stripComments !== false;
|
|
3558
|
+
const wantStripImports = args?.stripImports !== false;
|
|
3271
3559
|
const compactJson = args?.compactJson !== false;
|
|
3272
3560
|
if (!text)
|
|
3273
3561
|
throw new Error("text is required");
|
|
3562
|
+
// Delegates to the same stripComments/stripImports/compactWhitespace primitives
|
|
3563
|
+
// squeeze_prompt and the proxy's own cache-miss path use ā this used to be a second,
|
|
3564
|
+
// independent regex implementation of the same job that had drifted out of sync: its
|
|
3565
|
+
// naive `//.*$` comment strip mangled any line containing a URL (http://, https://),
|
|
3566
|
+
// a case the shared stripComments already guards against. One implementation now.
|
|
3274
3567
|
let squeezed = text;
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
squeezed =
|
|
3279
|
-
|
|
3280
|
-
//
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
//
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
squeezed = squeezed.replace(/^require\(['"][\w@\/\.-]+['"]\);?\s*$/gm, '');
|
|
3290
|
-
}
|
|
3291
|
-
// Compact JSON
|
|
3292
|
-
if (compactJson) {
|
|
3568
|
+
if (wantStripComments)
|
|
3569
|
+
squeezed = (0, ContextSqueezer_1.stripComments)(squeezed);
|
|
3570
|
+
if (wantStripImports)
|
|
3571
|
+
squeezed = (0, ContextSqueezer_1.stripImports)(squeezed);
|
|
3572
|
+
squeezed = (0, ContextSqueezer_1.compactWhitespace)(squeezed);
|
|
3573
|
+
// Compact JSON ā the one genuinely turbosqueeze-specific step, kept as-is, but only when
|
|
3574
|
+
// the input actually looks like JSON. Pre-existing bug found while consolidating this
|
|
3575
|
+
// function: these regexes ran unconditionally whenever compactJson wasn't explicitly
|
|
3576
|
+
// false, so ordinary code went through them too ā `{ foo }` in an import statement came
|
|
3577
|
+
// out as `{foo}`, and the same regexes would just as happily squash braces in real
|
|
3578
|
+
// control-flow code. Gate on the input's own shape instead of trusting the caller only
|
|
3579
|
+
// ever sets compactJson for genuine JSON.
|
|
3580
|
+
const looksLikeJson = /^\s*[[{]/.test(squeezed);
|
|
3581
|
+
if (compactJson && looksLikeJson) {
|
|
3293
3582
|
squeezed = squeezed.replace(/"\s*:\s*/g, '":');
|
|
3294
3583
|
squeezed = squeezed.replace(/,\s*"/g, ',"');
|
|
3295
3584
|
squeezed = squeezed.replace(/\[\s+/g, '[');
|
|
@@ -5090,7 +5379,7 @@ async function handleGetSymbolSurgicalContext(args) {
|
|
|
5090
5379
|
filePath
|
|
5091
5380
|
});
|
|
5092
5381
|
return {
|
|
5093
|
-
content: [{ type: "text", text: output }]
|
|
5382
|
+
content: [{ type: "text", text: output + formatRecallNote(filePath, symbolName) }]
|
|
5094
5383
|
};
|
|
5095
5384
|
}
|
|
5096
5385
|
catch (err) {
|
|
@@ -5271,7 +5560,7 @@ async function handleSmartFileSlice(args) {
|
|
|
5271
5560
|
resultText += `${i + 1}: ${lines[i]}\n`;
|
|
5272
5561
|
}
|
|
5273
5562
|
});
|
|
5274
|
-
return { content: [{ type: "text", text: resultText }] };
|
|
5563
|
+
return { content: [{ type: "text", text: resultText + formatRecallNote(filePath) }] };
|
|
5275
5564
|
}
|
|
5276
5565
|
catch (e) {
|
|
5277
5566
|
return { content: [{ type: "text", text: `Error slicing file: ${e.message}` }] };
|
|
@@ -5299,7 +5588,7 @@ function autoStoreGreenTests(command, workspaceRoot) {
|
|
|
5299
5588
|
const domain = deriveDomainForFile(changed[0]);
|
|
5300
5589
|
const query = `tests passing after changes to ${changed.slice(0, 5).join(", ")}${changed.length > 5 ? ` and ${changed.length - 5} more file(s)` : ""}`;
|
|
5301
5590
|
const response = `\`${command}\` passed with these files changed (uncommitted at capture time):\n${changed.join("\n")}`;
|
|
5302
|
-
const storeRes = (0, TheBrainV2_1.getBrain)().store(query, response, "test_oracle_auto", 0.92, changed, undefined, "confirmed", undefined, undefined, domain);
|
|
5591
|
+
const storeRes = (0, TheBrainV2_1.getBrain)().store(query, response, "test_oracle_auto", 0.92, changed, undefined, "confirmed", undefined, undefined, domain, undefined, { source: "auto-test" });
|
|
5303
5592
|
if (!storeRes.stored)
|
|
5304
5593
|
return "";
|
|
5305
5594
|
return `\n\n[Lemma] Auto-captured this green state in Brain (${changed.length} file(s), tagged confirmed) ā search_memory will surface it, and will flag it stale the moment any of these files change again.`;
|