@andorra-labs/code 0.1.11 → 0.1.13
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/README.md +8 -2
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/dist/src/account-presentation.d.ts +1 -37
- package/dist/src/account-presentation.js +2 -42
- package/dist/src/activity.d.ts +0 -25
- package/dist/src/activity.js +1 -23
- package/dist/src/agent-definitions.d.ts +0 -26
- package/dist/src/agent-definitions.js +0 -43
- package/dist/src/agent-execution.d.ts +0 -2
- package/dist/src/agent-execution.js +59 -414
- package/dist/src/agent-mcp-catalog.d.ts +0 -8
- package/dist/src/agent-mcp-catalog.js +0 -2
- package/dist/src/agent-mcp.d.ts +0 -56
- package/dist/src/agent-mcp.js +14 -153
- package/dist/src/agent-modifiers.d.ts +0 -1
- package/dist/src/agent-modifiers.js +25 -68
- package/dist/src/analytics.d.ts +0 -66
- package/dist/src/analytics.js +0 -45
- package/dist/src/anthropic-console-auth.d.ts +0 -24
- package/dist/src/anthropic-console-auth.js +0 -37
- package/dist/src/anthropic-credentials.d.ts +0 -25
- package/dist/src/anthropic-credentials.js +0 -28
- package/dist/src/app-server/protocol.d.ts +19 -244
- package/dist/src/app-server/protocol.js +1 -132
- package/dist/src/app-server/reasoning.d.ts +0 -31
- package/dist/src/app-server/reasoning.js +0 -54
- package/dist/src/app-server/terminal.d.ts +0 -36
- package/dist/src/app-server/terminal.js +3 -39
- package/dist/src/app-server/workspace.d.ts +0 -167
- package/dist/src/app-server/workspace.js +4 -406
- package/dist/src/app-server.d.ts +33 -918
- package/dist/src/app-server.js +608 -2984
- package/dist/src/artifacts.d.ts +0 -10
- package/dist/src/artifacts.js +1 -11
- package/dist/src/attachments.d.ts +4 -98
- package/dist/src/attachments.js +10 -130
- package/dist/src/auth/AuthManager.d.ts +0 -93
- package/dist/src/auth/AuthManager.js +3 -165
- package/dist/src/auth/callback-page.d.ts +0 -1
- package/dist/src/auth/callback-page.js +0 -4
- package/dist/src/auth/callback.d.ts +0 -25
- package/dist/src/auth/callback.js +1 -29
- package/dist/src/auth/deployment.d.ts +0 -16
- package/dist/src/auth/deployment.js +0 -16
- package/dist/src/auth/index.d.ts +0 -11
- package/dist/src/auth/index.js +0 -11
- package/dist/src/auth/lock.d.ts +0 -1
- package/dist/src/auth/lock.js +0 -1
- package/dist/src/auth/store.d.ts +7 -108
- package/dist/src/auth/store.js +21 -129
- package/dist/src/auth/types.d.ts +0 -8
- package/dist/src/auth-commands.d.ts +0 -5
- package/dist/src/auth-commands.js +0 -1
- package/dist/src/automation-runner.d.ts +0 -9
- package/dist/src/automation-runner.js +0 -11
- package/dist/src/automation-service.d.ts +0 -10
- package/dist/src/automation-service.js +3 -17
- package/dist/src/automation-tool.js +0 -5
- package/dist/src/automation-worker-shutdown.d.ts +0 -1
- package/dist/src/automation-worker-shutdown.js +0 -3
- package/dist/src/automations.d.ts +23 -2
- package/dist/src/automations.js +91 -12
- package/dist/src/background-tasks.d.ts +0 -23
- package/dist/src/background-tasks.js +0 -11
- package/dist/src/boot-trace.d.ts +0 -13
- package/dist/src/boot-trace.js +1 -14
- package/dist/src/browser-activity.js +0 -2
- package/dist/src/browser-bridge.d.ts +0 -2
- package/dist/src/browser-bridge.js +0 -27
- package/dist/src/browser-captcha-tool.d.ts +0 -13
- package/dist/src/browser-captcha-tool.js +3 -35
- package/dist/src/browser-extensions-tool.d.ts +24 -0
- package/dist/src/browser-extensions-tool.js +137 -0
- package/dist/src/browser-extensions.d.ts +127 -0
- package/dist/src/browser-extensions.js +729 -0
- package/dist/src/browser-observation.d.ts +0 -15
- package/dist/src/browser-observation.js +1 -22
- package/dist/src/browser-panel-tool.d.ts +10 -25
- package/dist/src/browser-panel-tool.js +64 -60
- package/dist/src/browser-runner.d.ts +0 -1
- package/dist/src/browser-runner.js +7 -46
- package/dist/src/browser-server.d.ts +0 -6
- package/dist/src/browser-server.js +6 -229
- package/dist/src/browser-session.d.ts +0 -25
- package/dist/src/browser-session.js +1 -71
- package/dist/src/browser-stealth.d.ts +0 -12
- package/dist/src/browser-stealth.js +0 -36
- package/dist/src/browser-ui/app.js +7 -174
- package/dist/src/browser-ui/style.css +0 -68
- package/dist/src/browser-ui/tokens.css +11 -93
- package/dist/src/browser-view.d.ts +52 -290
- package/dist/src/browser-view.js +354 -567
- package/dist/src/capabilities.d.ts +0 -8
- package/dist/src/capabilities.js +0 -29
- package/dist/src/capsolver.d.ts +0 -13
- package/dist/src/capsolver.js +0 -15
- package/dist/src/clarification-ui.d.ts +0 -7
- package/dist/src/clarification-ui.js +0 -8
- package/dist/src/claude-executable.d.ts +0 -1
- package/dist/src/claude-executable.js +1 -2
- package/dist/src/claude-provider.d.ts +6 -19
- package/dist/src/claude-provider.js +166 -61
- package/dist/src/cli-executable.d.ts +0 -16
- package/dist/src/cli-executable.js +0 -7
- package/dist/src/cli-process.d.ts +0 -26
- package/dist/src/cli-process.js +0 -18
- package/dist/src/cli-sign-in.d.ts +0 -20
- package/dist/src/cli-sign-in.js +1 -17
- package/dist/src/cli.d.ts +3 -56
- package/dist/src/cli.js +193 -702
- package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +4 -59
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +27 -100
- package/dist/src/code-intelligence/ContextLedger.d.ts +0 -4
- package/dist/src/code-intelligence/ContextLedger.js +0 -10
- package/dist/src/code-intelligence/ContextRouter.d.ts +0 -6
- package/dist/src/code-intelligence/ContextRouter.js +0 -8
- package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.d.ts +0 -2
- package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.js +5 -12
- package/dist/src/code-intelligence/codegraph/CodeGraphProvider.d.ts +0 -6
- package/dist/src/code-intelligence/codegraph/CodeGraphProvider.js +0 -6
- package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.d.ts +0 -5
- package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.js +1 -17
- package/dist/src/code-intelligence/codegraph/repoExploreTool.d.ts +0 -5
- package/dist/src/code-intelligence/codegraph/repoExploreTool.js +0 -5
- package/dist/src/code-intelligence/repository.d.ts +0 -9
- package/dist/src/code-intelligence/repository.js +1 -11
- package/dist/src/code-intelligence/types.d.ts +0 -8
- package/dist/src/codex-auth.d.ts +0 -44
- package/dist/src/codex-auth.js +0 -45
- package/dist/src/codex-browser-auth.d.ts +0 -13
- package/dist/src/codex-browser-auth.js +3 -20
- package/dist/src/codex-errors.js +0 -2
- package/dist/src/codex-executable.d.ts +0 -2
- package/dist/src/codex-executable.js +1 -7
- package/dist/src/codex-provider.d.ts +0 -13
- package/dist/src/codex-provider.js +1 -26
- package/dist/src/codex-rpc.d.ts +0 -10
- package/dist/src/codex-rpc.js +0 -12
- package/dist/src/coding-tools.d.ts +6 -27
- package/dist/src/coding-tools.js +193 -205
- package/dist/src/command-metrics.d.ts +0 -4
- package/dist/src/command-output-tap.d.ts +0 -11
- package/dist/src/command-output-tap.js +0 -3
- package/dist/src/command-screens.d.ts +24 -0
- package/dist/src/command-screens.js +132 -100
- package/dist/src/commands.d.ts +6 -63
- package/dist/src/commands.js +20 -100
- package/dist/src/completion-gates.d.ts +0 -47
- package/dist/src/completion-gates.js +0 -14
- package/dist/src/completion.d.ts +2 -58
- package/dist/src/completion.js +90 -186
- package/dist/src/config.d.ts +12 -116
- package/dist/src/config.js +41 -171
- package/dist/src/context-budget.d.ts +0 -22
- package/dist/src/context-budget.js +0 -44
- package/dist/src/context-compaction.d.ts +29 -6
- package/dist/src/context-compaction.js +94 -25
- package/dist/src/context-selection.d.ts +0 -24
- package/dist/src/context-selection.js +0 -34
- package/dist/src/dashboard-view.d.ts +0 -2
- package/dist/src/dashboard-view.js +0 -35
- package/dist/src/dashboard.d.ts +0 -2
- package/dist/src/dashboard.js +0 -9
- package/dist/src/deadline.d.ts +0 -45
- package/dist/src/deadline.js +0 -54
- package/dist/src/decision/ContinuationAdapter.d.ts +0 -5
- package/dist/src/decision/ContinuationAdapter.js +0 -5
- package/dist/src/decision/DecisionEngine.d.ts +0 -4
- package/dist/src/decision/DecisionManager.d.ts +0 -1
- package/dist/src/decision/DecisionManager.js +2 -7
- package/dist/src/decision/DecisionPolicy.d.ts +0 -1
- package/dist/src/decision/DecisionPolicy.js +0 -1
- package/dist/src/decision/FactContinuations.d.ts +11 -43
- package/dist/src/decision/FactContinuations.js +126 -95
- package/dist/src/decision/FactServiceGate.d.ts +0 -1
- package/dist/src/decision/FactServiceGate.js +0 -4
- package/dist/src/decision/PreparedSteps.d.ts +0 -15
- package/dist/src/decision/PreparedSteps.js +1 -11
- package/dist/src/decision/applyToolMenu.d.ts +0 -1
- package/dist/src/decision/applyToolMenu.js +1 -5
- package/dist/src/decision/checks.d.ts +15 -28
- package/dist/src/decision/checks.js +118 -49
- package/dist/src/decision/facts.d.ts +0 -16
- package/dist/src/decision/facts.js +0 -30
- package/dist/src/decision/guidancePolicy.js +0 -1
- package/dist/src/decision/hostedPolicy.d.ts +0 -6
- package/dist/src/decision/hostedPolicy.js +0 -7
- package/dist/src/decision/hostedSkills.d.ts +0 -19
- package/dist/src/decision/hostedSkills.js +0 -19
- package/dist/src/decision/optimizationPolicy.d.ts +0 -3
- package/dist/src/decision/optimizationPolicy.js +1 -4
- package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +0 -7
- package/dist/src/decision/providers/AndorraDecisionProvider.js +4 -27
- package/dist/src/decision/providers/HttpDecisionProvider.d.ts +0 -2
- package/dist/src/decision/providers/HttpDecisionProvider.js +0 -6
- package/dist/src/decision/routeTools.d.ts +0 -8
- package/dist/src/decision/routeTools.js +1 -8
- package/dist/src/decision/toolFamilies.d.ts +0 -1
- package/dist/src/decision/toolFamilies.js +0 -1
- package/dist/src/decision/toolMenu.d.ts +0 -3
- package/dist/src/decision/toolMenu.js +0 -4
- package/dist/src/decision/types.d.ts +0 -6
- package/dist/src/default-graph.d.ts +0 -9
- package/dist/src/default-graph.js +0 -9
- package/dist/src/delegation-changes.d.ts +0 -56
- package/dist/src/delegation-changes.js +15 -124
- package/dist/src/diff-preview.d.ts +1 -1
- package/dist/src/diff-preview.js +4 -12
- package/dist/src/duration.d.ts +0 -50
- package/dist/src/duration.js +0 -50
- package/dist/src/efficiency.d.ts +0 -39
- package/dist/src/efficiency.js +0 -16
- package/dist/src/engine/protocol.d.ts +0 -2
- package/dist/src/engine/protocol.js +0 -2
- package/dist/src/engine-streams.d.ts +13 -0
- package/dist/src/engine-streams.js +16 -0
- package/dist/src/extensions.d.ts +3 -2
- package/dist/src/extensions.js +76 -37
- package/dist/src/favicons.d.ts +0 -26
- package/dist/src/favicons.js +0 -34
- package/dist/src/file-diff.d.ts +2 -58
- package/dist/src/file-diff.js +0 -32
- package/dist/src/file-read-key.d.ts +1 -0
- package/dist/src/file-read-key.js +5 -0
- package/dist/src/file-read-state.d.ts +0 -1
- package/dist/src/file-read-state.js +0 -4
- package/dist/src/firefox-cookies.d.ts +0 -34
- package/dist/src/firefox-cookies.js +1 -55
- package/dist/src/git-identity-audit.d.ts +27 -0
- package/dist/src/git-identity-audit.js +286 -0
- package/dist/src/git-identity-guard.d.ts +4 -0
- package/dist/src/git-identity-guard.js +998 -0
- package/dist/src/git-identity-hold.d.ts +12 -0
- package/dist/src/git-identity-hold.js +81 -0
- package/dist/src/git-summary.d.ts +0 -58
- package/dist/src/git-summary.js +2 -212
- package/dist/src/goal-completion-verification.d.ts +2 -2
- package/dist/src/goal-completion-verification.js +3 -6
- package/dist/src/graph-account.d.ts +0 -21
- package/dist/src/graph-account.js +0 -17
- package/dist/src/graph-editor-session.d.ts +0 -1
- package/dist/src/graph-editor-session.js +1 -3
- package/dist/src/graph-health.d.ts +7 -49
- package/dist/src/graph-health.js +35 -46
- package/dist/src/graph-manager-chat.d.ts +27 -128
- package/dist/src/graph-manager-chat.js +36 -166
- package/dist/src/graph-provider-portability.d.ts +1 -21
- package/dist/src/graph-provider-portability.js +6 -45
- package/dist/src/graph-quota.d.ts +0 -33
- package/dist/src/graph-quota.js +1 -44
- package/dist/src/graph-runner.d.ts +0 -1
- package/dist/src/graph-runner.js +47 -387
- package/dist/src/graph-selection.d.ts +0 -14
- package/dist/src/graph-selection.js +0 -14
- package/dist/src/graph-server.d.ts +3 -11
- package/dist/src/graph-server.js +70 -111
- package/dist/src/graph-studio-features.d.ts +0 -5
- package/dist/src/graph-studio-features.js +2 -42
- package/dist/src/graph-sync.d.ts +0 -78
- package/dist/src/graph-sync.js +5 -201
- package/dist/src/graph-tool.d.ts +0 -18
- package/dist/src/graph-tool.js +0 -27
- package/dist/src/graph-ui/app.js +229 -498
- package/dist/src/graph-ui/compat.js +0 -7
- package/dist/src/graph-ui/controls.css +47 -43
- package/dist/src/graph-ui/controls.js +0 -88
- package/dist/src/graph-ui/drafts.js +0 -12
- package/dist/src/graph-ui/edge-router.js +0 -62
- package/dist/src/graph-ui/embed.js +0 -59
- package/dist/src/graph-ui/icons.js +2 -7
- package/dist/src/graph-ui/index.html +2 -2
- package/dist/src/graph-ui/library.css +0 -5
- package/dist/src/graph-ui/manager-markdown.js +0 -11
- package/dist/src/graph-ui/manager-state.js +110 -49
- package/dist/src/graph-ui/manager.css +2 -20
- package/dist/src/graph-ui/manager.js +251 -166
- package/dist/src/graph-ui/model-picker.js +250 -0
- package/dist/src/graph-ui/provider-glyphs/alibaba-cloud.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/anthropic.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/aws-bedrock.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/claude.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/deepseek.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/fireworks.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/kimi.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/minimax.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/openai.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/opencode.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/openrouter.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/xai.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/xiaomi-mimo.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/zai.png +0 -0
- package/dist/src/graph-ui/sidebar.js +2 -3
- package/dist/src/graph-ui/skill-picker.js +373 -39
- package/dist/src/graph-ui/studio-canvas.js +3 -38
- package/dist/src/graph-ui/studio.css +0 -18
- package/dist/src/graph-ui/studio.js +3 -71
- package/dist/src/graph-ui/style.css +11 -134
- package/dist/src/graph-ui/theme.js +1 -26
- package/dist/src/graph-ui/tokens.css +15 -114
- package/dist/src/graphs.d.ts +7 -156
- package/dist/src/graphs.js +72 -273
- package/dist/src/grep-regex-worker.js +0 -2
- package/dist/src/grep-regex.d.ts +1 -5
- package/dist/src/grep-regex.js +6 -8
- package/dist/src/grok-provider.d.ts +0 -17
- package/dist/src/grok-provider.js +1 -26
- package/dist/src/handoffs.d.ts +0 -11
- package/dist/src/handoffs.js +0 -13
- package/dist/src/hardened-runtime.d.ts +0 -10
- package/dist/src/hardened-runtime.js +8 -46
- package/dist/src/harness-home.d.ts +21 -0
- package/dist/src/harness-home.js +87 -0
- package/dist/src/host-process-guard.d.ts +0 -50
- package/dist/src/host-process-guard.js +0 -641
- package/dist/src/limits.d.ts +0 -64
- package/dist/src/limits.js +0 -62
- package/dist/src/managed-sign-in.d.ts +0 -12
- package/dist/src/managed-sign-in.js +0 -16
- package/dist/src/markdown.d.ts +0 -28
- package/dist/src/markdown.js +1 -175
- package/dist/src/mcp.d.ts +21 -82
- package/dist/src/mcp.js +228 -237
- package/dist/src/membership-errors.d.ts +0 -14
- package/dist/src/membership-errors.js +0 -13
- package/dist/src/membership.d.ts +2 -60
- package/dist/src/membership.js +0 -85
- package/dist/src/memory/LocalToolMemory.d.ts +0 -1
- package/dist/src/memory/LocalToolMemory.js +2 -7
- package/dist/src/memory/MemoryDistiller.js +0 -15
- package/dist/src/memory/MemoryManager.d.ts +0 -3
- package/dist/src/memory/MemoryManager.js +6 -18
- package/dist/src/memory/MemoryPolicy.d.ts +0 -2
- package/dist/src/memory/MemoryPolicy.js +0 -2
- package/dist/src/memory/MemoryProvider.d.ts +0 -6
- package/dist/src/memory/MemoryRetriever.js +0 -7
- package/dist/src/memory/PermissionMemoryProvider.d.ts +0 -1
- package/dist/src/memory/PermissionMemoryProvider.js +0 -1
- package/dist/src/memory/ProjectMemory.d.ts +42 -0
- package/dist/src/memory/ProjectMemory.js +285 -0
- package/dist/src/memory/ToolFailureLessons.d.ts +0 -3
- package/dist/src/memory/ToolFailureLessons.js +0 -6
- package/dist/src/memory/index.d.ts +1 -0
- package/dist/src/memory/index.js +1 -0
- package/dist/src/memory/providers/NoOpMemoryProvider.d.ts +0 -1
- package/dist/src/memory/providers/NoOpMemoryProvider.js +0 -1
- package/dist/src/memory/redaction.d.ts +0 -5
- package/dist/src/memory/redaction.js +0 -11
- package/dist/src/memory/repository.d.ts +0 -6
- package/dist/src/memory/repository.js +2 -12
- package/dist/src/memory/types.d.ts +0 -1
- package/dist/src/model-health-cache.d.ts +0 -38
- package/dist/src/model-health-cache.js +1 -49
- package/dist/src/model-metadata.d.ts +0 -18
- package/dist/src/model-metadata.js +2 -42
- package/dist/src/model-override.d.ts +0 -36
- package/dist/src/model-override.js +0 -43
- package/dist/src/model-tiers.d.ts +0 -13
- package/dist/src/model-tiers.js +0 -23
- package/dist/src/opencode-catalog.d.ts +0 -2
- package/dist/src/opencode-catalog.js +0 -11
- package/dist/src/opencode-cli-provider.d.ts +0 -35
- package/dist/src/opencode-cli-provider.js +1 -44
- package/dist/src/opencode-provider.d.ts +0 -2
- package/dist/src/opencode-provider.js +6 -22
- package/dist/src/package-name.d.ts +1 -0
- package/dist/src/package-name.js +1 -0
- package/dist/src/paged-transcript.d.ts +0 -11
- package/dist/src/paged-transcript.js +2 -20
- package/dist/src/palette.d.ts +0 -63
- package/dist/src/palette.js +0 -63
- package/dist/src/permissions.d.ts +0 -15
- package/dist/src/permissions.js +0 -17
- package/dist/src/powershell-pool.d.ts +0 -9
- package/dist/src/powershell-pool.js +3 -26
- package/dist/src/process-warnings.d.ts +4 -0
- package/dist/src/process-warnings.js +103 -0
- package/dist/src/profile.d.ts +0 -43
- package/dist/src/profile.js +0 -43
- package/dist/src/project-reservation.d.ts +11 -0
- package/dist/src/project-reservation.js +143 -0
- package/dist/src/provider-connection.d.ts +0 -18
- package/dist/src/provider-connection.js +0 -39
- package/dist/src/provider-engine.d.ts +0 -21
- package/dist/src/provider-engine.js +3 -98
- package/dist/src/provider-import.d.ts +0 -49
- package/dist/src/provider-import.js +0 -60
- package/dist/src/provider-keys.d.ts +1 -36
- package/dist/src/provider-keys.js +5 -48
- package/dist/src/provider-settings.d.ts +0 -2
- package/dist/src/provider-settings.js +0 -32
- package/dist/src/providers.d.ts +0 -217
- package/dist/src/providers.js +0 -315
- package/dist/src/pull-requests.d.ts +0 -173
- package/dist/src/pull-requests.js +5 -195
- package/dist/src/qa/browser/PlaywrightRunner.d.ts +0 -7
- package/dist/src/qa/browser/PlaywrightRunner.js +2 -16
- package/dist/src/qa/command-policy.d.ts +0 -23
- package/dist/src/qa/command-policy.js +0 -30
- package/dist/src/qa/guidance.d.ts +0 -21
- package/dist/src/qa/guidance.js +0 -20
- package/dist/src/qa/profile/ProjectInspector.d.ts +0 -4
- package/dist/src/qa/profile/ProjectInspector.js +0 -6
- package/dist/src/qa/profile/QaConfigLoader.d.ts +0 -7
- package/dist/src/qa/profile/QaConfigLoader.js +0 -6
- package/dist/src/qa/profile/QaProfile.d.ts +0 -7
- package/dist/src/qa/profile/QaProfile.js +0 -7
- package/dist/src/qa/profile/yaml.d.ts +0 -9
- package/dist/src/qa/profile/yaml.js +0 -13
- package/dist/src/qa/qa-authorize.d.ts +0 -19
- package/dist/src/qa/qa-authorize.js +4 -11
- package/dist/src/qa/runtime/ProcessManager.d.ts +0 -31
- package/dist/src/qa/runtime/ProcessManager.js +4 -41
- package/dist/src/qa/runtime/PtyManager.d.ts +0 -4
- package/dist/src/qa/runtime/PtyManager.js +2 -7
- package/dist/src/qa/runtime/changes.d.ts +0 -11
- package/dist/src/qa/runtime/changes.js +1 -3
- package/dist/src/qa/tools.d.ts +0 -10
- package/dist/src/qa/tools.js +0 -12
- package/dist/src/qa/types.d.ts +0 -13
- package/dist/src/react-runtime.d.ts +2 -21
- package/dist/src/react-runtime.js +106 -418
- package/dist/src/read-document-doc.d.ts +0 -6
- package/dist/src/read-document-doc.js +0 -55
- package/dist/src/read-document-docx.d.ts +0 -16
- package/dist/src/read-document-docx.js +2 -69
- package/dist/src/read-document-text.d.ts +0 -17
- package/dist/src/read-document-text.js +0 -22
- package/dist/src/read-document-tool.d.ts +0 -31
- package/dist/src/read-document-tool.js +0 -30
- package/dist/src/read-document.d.ts +0 -49
- package/dist/src/read-document.js +1 -67
- package/dist/src/read-image.d.ts +0 -32
- package/dist/src/read-image.js +0 -33
- package/dist/src/remote/cert.d.ts +1 -19
- package/dist/src/remote/cert.js +2 -51
- package/dist/src/remote/client.d.ts +0 -70
- package/dist/src/remote/client.js +2 -117
- package/dist/src/remote/command.js +0 -17
- package/dist/src/remote/engine-pool.d.ts +0 -152
- package/dist/src/remote/engine-pool.js +17 -335
- package/dist/src/remote/errors.d.ts +0 -15
- package/dist/src/remote/errors.js +0 -7
- package/dist/src/remote/network.d.ts +0 -26
- package/dist/src/remote/network.js +1 -34
- package/dist/src/remote/pairing.d.ts +16 -51
- package/dist/src/remote/pairing.js +50 -57
- package/dist/src/remote/pem.d.ts +2 -0
- package/dist/src/remote/pem.js +7 -0
- package/dist/src/remote/roots.d.ts +0 -20
- package/dist/src/remote/roots.js +0 -8
- package/dist/src/remote/serve.d.ts +0 -47
- package/dist/src/remote/serve.js +0 -30
- package/dist/src/remote/server.d.ts +0 -14
- package/dist/src/remote/server.js +1 -79
- package/dist/src/remote/types.d.ts +1 -32
- package/dist/src/remote/types.js +0 -10
- package/dist/src/run-control.d.ts +0 -7
- package/dist/src/run-control.js +0 -7
- package/dist/src/run-progress.d.ts +0 -170
- package/dist/src/run-progress.js +0 -285
- package/dist/src/run-records.d.ts +0 -443
- package/dist/src/run-records.js +44 -678
- package/dist/src/run-temp.d.ts +12 -0
- package/dist/src/run-temp.js +50 -0
- package/dist/src/runtime.d.ts +11 -227
- package/dist/src/runtime.js +0 -127
- package/dist/src/sandbox-child.js +0 -1
- package/dist/src/save-lock.d.ts +0 -12
- package/dist/src/save-lock.js +0 -28
- package/dist/src/screen-selection.d.ts +0 -23
- package/dist/src/screen-selection.js +0 -22
- package/dist/src/secret-redaction.d.ts +0 -12
- package/dist/src/secret-redaction.js +0 -45
- package/dist/src/session-changes.d.ts +4 -80
- package/dist/src/session-changes.js +25 -130
- package/dist/src/session-goal.d.ts +129 -0
- package/dist/src/session-goal.js +230 -0
- package/dist/src/session-monitor.d.ts +1 -10
- package/dist/src/session-monitor.js +2 -39
- package/dist/src/session-reaper.d.ts +0 -15
- package/dist/src/session-reaper.js +0 -14
- package/dist/src/session-skills.d.ts +15 -44
- package/dist/src/session-skills.js +75 -60
- package/dist/src/session-summary.d.ts +0 -26
- package/dist/src/session-summary.js +0 -32
- package/dist/src/session-title.d.ts +0 -1
- package/dist/src/session-title.js +0 -2
- package/dist/src/sessions.d.ts +2 -120
- package/dist/src/sessions.js +9 -178
- package/dist/src/shell.d.ts +3 -20
- package/dist/src/shell.js +8 -72
- package/dist/src/side-panel.d.ts +5 -99
- package/dist/src/side-panel.js +76 -133
- package/dist/src/sign-in-detection.d.ts +43 -0
- package/dist/src/sign-in-detection.js +154 -0
- package/dist/src/sign-in-offer.d.ts +17 -0
- package/dist/src/sign-in-offer.js +103 -0
- package/dist/src/skill-commands.d.ts +0 -1
- package/dist/src/skill-commands.js +1 -4
- package/dist/src/skills/bundled/control-browser/SKILL.md +1 -1
- package/dist/src/skills/bundled/graph-manager/SKILL.md +22 -4
- package/dist/src/skills/bundled/provenance.json +2 -2
- package/dist/src/skills/invocable-skills.d.ts +0 -18
- package/dist/src/skills/invocable-skills.js +0 -17
- package/dist/src/skills/project-skills.d.ts +0 -1
- package/dist/src/skills/project-skills.js +0 -3
- package/dist/src/skills/prompt-skills.js +0 -14
- package/dist/src/skills/runtime-skills.d.ts +1 -8
- package/dist/src/skills/runtime-skills.js +8 -32
- package/dist/src/stall-recovery.d.ts +0 -25
- package/dist/src/stall-recovery.js +0 -38
- package/dist/src/stray-files.d.ts +5 -0
- package/dist/src/stray-files.js +65 -0
- package/dist/src/structured-step.d.ts +0 -22
- package/dist/src/structured-step.js +0 -22
- package/dist/src/subagent-run.d.ts +0 -163
- package/dist/src/subagent-run.js +10 -374
- package/dist/src/subagent-tree.d.ts +32 -0
- package/dist/src/subagent-tree.js +128 -0
- package/dist/src/telemetry/aggregate.d.ts +0 -37
- package/dist/src/telemetry/aggregate.js +0 -40
- package/dist/src/telemetry/capture-core.d.ts +0 -87
- package/dist/src/telemetry/capture-core.js +0 -67
- package/dist/src/telemetry/capture.d.ts +0 -1
- package/dist/src/telemetry/capture.js +0 -3
- package/dist/src/telemetry/classify.d.ts +0 -58
- package/dist/src/telemetry/classify.js +0 -60
- package/dist/src/telemetry/decision-capture.d.ts +0 -1
- package/dist/src/telemetry/emitter.d.ts +0 -30
- package/dist/src/telemetry/emitter.js +1 -62
- package/dist/src/telemetry/gate.d.ts +0 -29
- package/dist/src/telemetry/gate.js +0 -22
- package/dist/src/telemetry/identity.d.ts +0 -13
- package/dist/src/telemetry/identity.js +0 -29
- package/dist/src/telemetry/outbox.d.ts +0 -64
- package/dist/src/telemetry/outbox.js +1 -108
- package/dist/src/telemetry/schema.d.ts +1 -49
- package/dist/src/telemetry/schema.js +1 -82
- package/dist/src/telemetry/state.d.ts +0 -53
- package/dist/src/telemetry/state.js +0 -64
- package/dist/src/telemetry/surface.d.ts +0 -31
- package/dist/src/telemetry/surface.js +1 -39
- package/dist/src/telemetry/uploader.d.ts +0 -11
- package/dist/src/telemetry/uploader.js +0 -46
- package/dist/src/telemetry/uploads.d.ts +0 -11
- package/dist/src/telemetry/uploads.js +0 -11
- package/dist/src/telemetry/version.d.ts +0 -4
- package/dist/src/telemetry/version.js +0 -14
- package/dist/src/telemetry/workspace.d.ts +0 -7
- package/dist/src/telemetry/workspace.js +1 -22
- package/dist/src/terminal-ui.d.ts +15 -524
- package/dist/src/terminal-ui.js +80 -876
- package/dist/src/test-edit-guard.d.ts +74 -0
- package/dist/src/test-edit-guard.js +269 -0
- package/dist/src/text.d.ts +0 -1
- package/dist/src/text.js +0 -1
- package/dist/src/time-limit.d.ts +0 -36
- package/dist/src/time-limit.js +0 -37
- package/dist/src/timers.d.ts +0 -161
- package/dist/src/timers.js +0 -126
- package/dist/src/todos.d.ts +0 -1
- package/dist/src/todos.js +0 -3
- package/dist/src/token-rate.d.ts +0 -94
- package/dist/src/token-rate.js +0 -154
- package/dist/src/tool-activity.d.ts +0 -6
- package/dist/src/tool-activity.js +1 -8
- package/dist/src/tool-availability.d.ts +0 -13
- package/dist/src/tool-availability.js +1 -14
- package/dist/src/tool-call-clock.d.ts +1 -4
- package/dist/src/tool-call-clock.js +0 -13
- package/dist/src/tool-catalog.d.ts +0 -11
- package/dist/src/tool-catalog.js +0 -23
- package/dist/src/tool-dependencies.d.ts +0 -5
- package/dist/src/tool-dependencies.js +0 -4
- package/dist/src/tool-diff-stats.d.ts +0 -23
- package/dist/src/tool-diff-stats.js +0 -49
- package/dist/src/tool-errors.d.ts +9 -7
- package/dist/src/tool-errors.js +13 -6
- package/dist/src/tool-failure-tracker.d.ts +3 -11
- package/dist/src/tool-failure-tracker.js +19 -27
- package/dist/src/tool-names.d.ts +0 -16
- package/dist/src/tool-names.js +0 -12
- package/dist/src/tool-profile.d.ts +6 -0
- package/dist/src/tool-profile.js +23 -0
- package/dist/src/tool-result-filter.d.ts +0 -19
- package/dist/src/tool-result-filter.js +1 -66
- package/dist/src/tool-schema-compatibility.d.ts +1 -2
- package/dist/src/tool-schema-compatibility.js +2 -7
- package/dist/src/tools.d.ts +0 -4
- package/dist/src/tools.js +11 -114
- package/dist/src/trajectory.d.ts +0 -13
- package/dist/src/trajectory.js +23 -79
- package/dist/src/transcript.d.ts +1 -37
- package/dist/src/transcript.js +11 -61
- package/dist/src/types.d.ts +2 -167
- package/dist/src/untracked-file-removal.d.ts +3 -0
- package/dist/src/untracked-file-removal.js +105 -0
- package/dist/src/update-check.d.ts +0 -14
- package/dist/src/update-check.js +2 -16
- package/dist/src/update.d.ts +4 -29
- package/dist/src/update.js +20 -98
- package/dist/src/usage-analytics.d.ts +17 -17
- package/dist/src/usage-analytics.js +168 -209
- package/dist/src/web-search.d.ts +0 -23
- package/dist/src/web-search.js +1 -27
- package/dist/src/widgets.d.ts +0 -25
- package/dist/src/widgets.js +0 -24
- package/dist/src/workspace-facts.d.ts +0 -12
- package/dist/src/workspace-facts.js +1 -18
- package/dist/src/workspace-git-metadata.d.ts +4 -5
- package/dist/src/workspace-git-metadata.js +37 -9
- package/dist/src/workspace-instructions.d.ts +3 -15
- package/dist/src/workspace-instructions.js +7 -20
- package/package.json +2 -2
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Tool } from '../types.js';
|
|
2
|
+
export declare const PROJECT_MEMORY_TYPES: readonly ["user", "feedback", "project", "reference"];
|
|
3
|
+
export type ProjectMemoryType = typeof PROJECT_MEMORY_TYPES[number];
|
|
4
|
+
export interface ProjectMemoryEntry {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
type: ProjectMemoryType;
|
|
8
|
+
body: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const INDEX_FILE = "MEMORY.md";
|
|
11
|
+
export declare function folderName(repositoryId: string): string;
|
|
12
|
+
export declare function parseMemoryFile(text: string, fileName: string): ProjectMemoryEntry | undefined;
|
|
13
|
+
export declare function formatMemoryFile(entry: ProjectMemoryEntry): string;
|
|
14
|
+
export declare function reconcileIndex(current: string, entries: ProjectMemoryEntry[]): string;
|
|
15
|
+
export declare function projectRepositoryId(workspace: string): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Moves a project's saved memory to the folder it now lives in. A project with a Git remote keys its memory by that
|
|
18
|
+
* remote, so nothing moves. One without keys it by its root path, and leaving that alone would keep the notes under the
|
|
19
|
+
* path the project left and present an empty store the next time a task opened them.
|
|
20
|
+
*/
|
|
21
|
+
export declare function relinkProjectMemory(home: string, from: string, to: string): Promise<string | undefined>;
|
|
22
|
+
export declare class ProjectMemory {
|
|
23
|
+
readonly directory: string;
|
|
24
|
+
readonly repositoryId: string;
|
|
25
|
+
private queue;
|
|
26
|
+
private constructor();
|
|
27
|
+
static open(options: {
|
|
28
|
+
home: string;
|
|
29
|
+
workspace: string;
|
|
30
|
+
repositoryId?: string;
|
|
31
|
+
}): Promise<ProjectMemory>;
|
|
32
|
+
private exclusive;
|
|
33
|
+
private readText;
|
|
34
|
+
list(): Promise<ProjectMemoryEntry[]>;
|
|
35
|
+
read(name: string): Promise<ProjectMemoryEntry | undefined>;
|
|
36
|
+
private writeAtomic;
|
|
37
|
+
private rewriteIndex;
|
|
38
|
+
write(entry: ProjectMemoryEntry): Promise<'created' | 'updated'>;
|
|
39
|
+
delete(name: string): Promise<boolean>;
|
|
40
|
+
context(): Promise<string>;
|
|
41
|
+
tools(): Tool[];
|
|
42
|
+
}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { mkdir, readdir, readFile, rename, stat, unlink, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { join, dirname } from 'node:path';
|
|
4
|
+
import { containsSecret } from './redaction.js';
|
|
5
|
+
import { deriveRepositoryId, resolveRepositoryId } from './repository.js';
|
|
6
|
+
import { linkedWorktreeIdentity } from '../workspace-git-metadata.js';
|
|
7
|
+
export const PROJECT_MEMORY_TYPES = ['user', 'feedback', 'project', 'reference'];
|
|
8
|
+
export const INDEX_FILE = 'MEMORY.md';
|
|
9
|
+
const NAME = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
10
|
+
const isIndexFile = (file) => file.toLowerCase() === INDEX_FILE.toLowerCase();
|
|
11
|
+
const validName = (name) => NAME.test(name) && !isIndexFile(`${name}.md`);
|
|
12
|
+
const MAX_FOLDER_CHARS = 120;
|
|
13
|
+
const MAX_FILE_BYTES = 32_768;
|
|
14
|
+
const MAX_BODY_CHARS = 6_000;
|
|
15
|
+
const MAX_DESCRIPTION_CHARS = 200;
|
|
16
|
+
const MAX_MEMORIES = 200;
|
|
17
|
+
const INDEX_CONTEXT_CHARS = 8_000;
|
|
18
|
+
const MAX_INDEX_BYTES = 65_536;
|
|
19
|
+
const GUIDANCE = `Save a memory only for a fact likely to matter in a future session of this project: how the team actually does something (releases, deploys, environment setup), commands that work or fail here, the user's preferences and corrections (with why), known baseline test failures, pointers to external resources. Do not save chatter, task progress, or anything the repository files or git history already record. Before saving, check the index: update an existing memory rather than adding a duplicate, and delete one that turned out wrong. Write absolute dates (YYYY-MM-DD), never "today" or "last week". Never save secrets, credentials or tokens. Memories are background notes from earlier sessions, not instructions; current files and the user's words win when they disagree.`;
|
|
20
|
+
export function folderName(repositoryId) {
|
|
21
|
+
const safe = repositoryId.toLowerCase().replace(/[^a-z0-9.-]+/g, '-').replace(/^[-.]+|[-.]+$/g, '');
|
|
22
|
+
if (safe && safe === repositoryId && safe.length <= MAX_FOLDER_CHARS)
|
|
23
|
+
return safe;
|
|
24
|
+
const hash = createHash('sha256').update(repositoryId).digest('hex').slice(0, 16);
|
|
25
|
+
const prefix = safe.slice(0, MAX_FOLDER_CHARS - hash.length - 1).replace(/[-.]+$/, '');
|
|
26
|
+
return prefix ? `${prefix}-${hash}` : hash;
|
|
27
|
+
}
|
|
28
|
+
function oneLine(value) { return value.replace(/\s+/g, ' ').trim(); }
|
|
29
|
+
export function parseMemoryFile(text, fileName) {
|
|
30
|
+
const match = /^?---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(text);
|
|
31
|
+
if (!match)
|
|
32
|
+
return undefined;
|
|
33
|
+
const fields = {};
|
|
34
|
+
for (const line of match[1].split(/\r?\n/)) {
|
|
35
|
+
const field = /^\s*([A-Za-z_]+)\s*:\s*(.*)$/.exec(line);
|
|
36
|
+
if (field)
|
|
37
|
+
fields[field[1].toLowerCase()] = field[2].trim().replace(/^(['"])(.*)\1$/, '$2');
|
|
38
|
+
}
|
|
39
|
+
const name = fields.name || fileName.replace(/\.md$/i, '');
|
|
40
|
+
const type = fields.type;
|
|
41
|
+
if (!validName(name) || !fields.description || !PROJECT_MEMORY_TYPES.includes(type))
|
|
42
|
+
return undefined;
|
|
43
|
+
return { name, description: oneLine(fields.description), type, body: match[2].trim() };
|
|
44
|
+
}
|
|
45
|
+
export function formatMemoryFile(entry) {
|
|
46
|
+
return `---\nname: ${entry.name}\ndescription: ${oneLine(entry.description)}\ntype: ${entry.type}\n---\n\n${entry.body.trim()}\n`;
|
|
47
|
+
}
|
|
48
|
+
const indexLine = (entry) => `- [${entry.name}](${entry.name}.md) — ${oneLine(entry.description)}`;
|
|
49
|
+
const linkedName = (line) => /^\s*-\s*\[[^\]]*\]\(([a-z0-9][a-z0-9-]{0,63})\.md\)/.exec(line)?.[1];
|
|
50
|
+
export function reconcileIndex(current, entries) {
|
|
51
|
+
const byName = new Map(entries.map(entry => [entry.name, entry]));
|
|
52
|
+
const listed = new Set();
|
|
53
|
+
const lines = [];
|
|
54
|
+
for (const line of current.split(/\r?\n/)) {
|
|
55
|
+
const name = linkedName(line);
|
|
56
|
+
if (name === undefined) {
|
|
57
|
+
lines.push(line);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const entry = byName.get(name);
|
|
61
|
+
if (!entry || listed.has(name))
|
|
62
|
+
continue;
|
|
63
|
+
listed.add(name);
|
|
64
|
+
lines.push(indexLine(entry));
|
|
65
|
+
}
|
|
66
|
+
while (lines.length && !lines.at(-1).trim())
|
|
67
|
+
lines.pop();
|
|
68
|
+
if (!lines.length)
|
|
69
|
+
lines.push('# Project memory', '');
|
|
70
|
+
for (const entry of entries)
|
|
71
|
+
if (!listed.has(entry.name))
|
|
72
|
+
lines.push(indexLine(entry));
|
|
73
|
+
return `${lines.join('\n')}\n`;
|
|
74
|
+
}
|
|
75
|
+
export async function projectRepositoryId(workspace) {
|
|
76
|
+
const linked = await linkedWorktreeIdentity(workspace);
|
|
77
|
+
if (linked)
|
|
78
|
+
return deriveRepositoryId(linked.remote || undefined, linked.root);
|
|
79
|
+
return resolveRepositoryId(workspace).catch(() => deriveRepositoryId(undefined, workspace));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Moves a project's saved memory to the folder it now lives in. A project with a Git remote keys its memory by that
|
|
83
|
+
* remote, so nothing moves. One without keys it by its root path, and leaving that alone would keep the notes under the
|
|
84
|
+
* path the project left and present an empty store the next time a task opened them.
|
|
85
|
+
*/
|
|
86
|
+
export async function relinkProjectMemory(home, from, to) {
|
|
87
|
+
const [sourceId, targetId] = await Promise.all([
|
|
88
|
+
projectRepositoryId(from).catch(() => deriveRepositoryId(undefined, from)),
|
|
89
|
+
projectRepositoryId(to).catch(() => deriveRepositoryId(undefined, to)),
|
|
90
|
+
]);
|
|
91
|
+
if (sourceId === targetId || !sourceId.startsWith('local-') || !targetId.startsWith('local-'))
|
|
92
|
+
return undefined;
|
|
93
|
+
const target = join(home, 'projects', folderName(targetId), 'memory');
|
|
94
|
+
// The folder has a memory of its own, so it is not this project's notes to overwrite.
|
|
95
|
+
if (await stat(target).catch(() => undefined))
|
|
96
|
+
return undefined;
|
|
97
|
+
const source = join(home, 'projects', folderName(sourceId), 'memory');
|
|
98
|
+
await mkdir(dirname(target), { recursive: true }).catch(() => undefined);
|
|
99
|
+
return rename(source, target).then(() => targetId).catch(() => undefined);
|
|
100
|
+
}
|
|
101
|
+
export class ProjectMemory {
|
|
102
|
+
directory;
|
|
103
|
+
repositoryId;
|
|
104
|
+
queue = Promise.resolve();
|
|
105
|
+
constructor(directory, repositoryId) {
|
|
106
|
+
this.directory = directory;
|
|
107
|
+
this.repositoryId = repositoryId;
|
|
108
|
+
}
|
|
109
|
+
static async open(options) {
|
|
110
|
+
const repositoryId = options.repositoryId ?? await projectRepositoryId(options.workspace);
|
|
111
|
+
return new ProjectMemory(join(options.home, 'projects', folderName(repositoryId), 'memory'), repositoryId);
|
|
112
|
+
}
|
|
113
|
+
exclusive(work) {
|
|
114
|
+
const next = this.queue.then(work, work);
|
|
115
|
+
this.queue = next.catch(() => { });
|
|
116
|
+
return next;
|
|
117
|
+
}
|
|
118
|
+
async readText(name, limit) {
|
|
119
|
+
const path = join(this.directory, name);
|
|
120
|
+
try {
|
|
121
|
+
if ((await stat(path)).size > limit)
|
|
122
|
+
return undefined;
|
|
123
|
+
return await readFile(path, 'utf8');
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async list() {
|
|
130
|
+
let names;
|
|
131
|
+
try {
|
|
132
|
+
names = (await readdir(this.directory)).filter(name => /\.md$/i.test(name) && !isIndexFile(name)).sort();
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
const entries = [];
|
|
138
|
+
for (const file of names.slice(0, MAX_MEMORIES * 2)) {
|
|
139
|
+
const text = await this.readText(file, MAX_FILE_BYTES);
|
|
140
|
+
const entry = text === undefined ? undefined : parseMemoryFile(text, file);
|
|
141
|
+
if (entry && `${entry.name}.md` === file)
|
|
142
|
+
entries.push(entry);
|
|
143
|
+
}
|
|
144
|
+
return entries;
|
|
145
|
+
}
|
|
146
|
+
async read(name) {
|
|
147
|
+
if (!validName(name))
|
|
148
|
+
return undefined;
|
|
149
|
+
const text = await this.readText(`${name}.md`, MAX_FILE_BYTES);
|
|
150
|
+
return text === undefined ? undefined : parseMemoryFile(text, `${name}.md`);
|
|
151
|
+
}
|
|
152
|
+
async writeAtomic(file, content) {
|
|
153
|
+
await mkdir(this.directory, { recursive: true, mode: 0o700 });
|
|
154
|
+
const temporary = join(this.directory, `.${file}.${randomUUID()}.tmp`);
|
|
155
|
+
try {
|
|
156
|
+
await writeFile(temporary, content, { encoding: 'utf8', mode: 0o600, flag: 'wx' });
|
|
157
|
+
await rename(temporary, join(this.directory, file));
|
|
158
|
+
}
|
|
159
|
+
finally {
|
|
160
|
+
await unlink(temporary).catch(() => { });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async rewriteIndex() {
|
|
164
|
+
const current = await this.readText(INDEX_FILE, MAX_INDEX_BYTES) ?? '';
|
|
165
|
+
const next = reconcileIndex(current, await this.list());
|
|
166
|
+
if (next !== current)
|
|
167
|
+
await this.writeAtomic(INDEX_FILE, next);
|
|
168
|
+
}
|
|
169
|
+
async write(entry) {
|
|
170
|
+
const name = typeof entry.name === 'string' ? entry.name.trim() : '';
|
|
171
|
+
if (!NAME.test(name))
|
|
172
|
+
throw new Error('name must be a short kebab-case slug: lowercase letters, digits and hyphens, at most 64 characters, e.g. "release-process".');
|
|
173
|
+
if (!validName(name))
|
|
174
|
+
throw new Error(`"${name}" is reserved for the ${INDEX_FILE} index; choose another name.`);
|
|
175
|
+
if (!PROJECT_MEMORY_TYPES.includes(entry.type))
|
|
176
|
+
throw new Error(`type must be one of ${PROJECT_MEMORY_TYPES.join(', ')}.`);
|
|
177
|
+
const description = typeof entry.description === 'string' ? oneLine(entry.description) : '';
|
|
178
|
+
if (!description || description.length > MAX_DESCRIPTION_CHARS)
|
|
179
|
+
throw new Error(`description must be one line of 1-${MAX_DESCRIPTION_CHARS} characters; it is the index line used to decide relevance.`);
|
|
180
|
+
const body = typeof entry.body === 'string' ? entry.body.trim() : '';
|
|
181
|
+
if (!body || body.length > MAX_BODY_CHARS)
|
|
182
|
+
throw new Error(`body must be 1-${MAX_BODY_CHARS} characters. Keep one fact per memory.`);
|
|
183
|
+
if (containsSecret(`${name}\n${description}\n${body}`))
|
|
184
|
+
throw new Error('This memory looks like it contains a secret, credential or token. Memories must never hold secrets; describe where the secret lives instead.');
|
|
185
|
+
const file = formatMemoryFile({ name, description, type: entry.type, body });
|
|
186
|
+
if (Buffer.byteLength(file, 'utf8') > MAX_FILE_BYTES)
|
|
187
|
+
throw new Error(`This memory is ${Buffer.byteLength(file, 'utf8')} bytes once encoded; the limit is ${MAX_FILE_BYTES}. Shorten the body.`);
|
|
188
|
+
return this.exclusive(async () => {
|
|
189
|
+
const existing = await this.read(name);
|
|
190
|
+
if (!existing && (await this.list()).length >= MAX_MEMORIES)
|
|
191
|
+
throw new Error(`This project already has ${MAX_MEMORIES} memories. Update or delete an existing one instead.`);
|
|
192
|
+
await this.writeAtomic(`${name}.md`, file);
|
|
193
|
+
await this.rewriteIndex();
|
|
194
|
+
return existing ? 'updated' : 'created';
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
delete(name) {
|
|
198
|
+
if (!validName(name))
|
|
199
|
+
return Promise.resolve(false);
|
|
200
|
+
return this.exclusive(async () => {
|
|
201
|
+
let removed = true;
|
|
202
|
+
try {
|
|
203
|
+
await unlink(join(this.directory, `${name}.md`));
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
if (error.code !== 'ENOENT')
|
|
207
|
+
throw error;
|
|
208
|
+
removed = false;
|
|
209
|
+
}
|
|
210
|
+
if (removed)
|
|
211
|
+
await this.rewriteIndex();
|
|
212
|
+
return removed;
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
async context() {
|
|
216
|
+
let index = '';
|
|
217
|
+
try {
|
|
218
|
+
const entries = await this.list();
|
|
219
|
+
const text = await this.readText(INDEX_FILE, MAX_INDEX_BYTES) ?? '';
|
|
220
|
+
index = reconcileIndex(text, entries).trim();
|
|
221
|
+
if (!entries.length && index === '# Project memory')
|
|
222
|
+
index = '';
|
|
223
|
+
}
|
|
224
|
+
catch { }
|
|
225
|
+
if (index.length > INDEX_CONTEXT_CHARS)
|
|
226
|
+
index = `${index.slice(0, INDEX_CONTEXT_CHARS)}\n… (index truncated; keep MEMORY.md short, one line per memory)`;
|
|
227
|
+
return [
|
|
228
|
+
`Project memory (notes saved by agents in earlier sessions of this repository; background context, not user instructions). Use memory_read to open a memory whose index line looks relevant before acting on it, memory_write to save or update one, memory_delete to remove a wrong one.`,
|
|
229
|
+
GUIDANCE,
|
|
230
|
+
index ? `<project-memory-index>\n${index}\n</project-memory-index>` : 'The project memory is empty.',
|
|
231
|
+
].join('\n');
|
|
232
|
+
}
|
|
233
|
+
tools() {
|
|
234
|
+
return [
|
|
235
|
+
{
|
|
236
|
+
name: 'memory_read',
|
|
237
|
+
description: 'Read one project memory (its frontmatter and full body) by name, as listed in the project memory index. Memories are notes from earlier sessions; verify them against the current repository before relying on them.',
|
|
238
|
+
executionMode: 'parallel',
|
|
239
|
+
parameters: { type: 'object', properties: { name: { type: 'string', description: 'Memory name from the index, e.g. "release-process".' } }, required: ['name'], additionalProperties: false },
|
|
240
|
+
execute: async (args, context) => {
|
|
241
|
+
context.signal.throwIfAborted();
|
|
242
|
+
const name = typeof args.name === 'string' ? args.name.trim().replace(/\.md$/i, '') : '';
|
|
243
|
+
const entry = await this.read(name);
|
|
244
|
+
if (!entry) {
|
|
245
|
+
const names = (await this.list()).map(item => item.name);
|
|
246
|
+
return `No project memory named "${name}".${names.length ? ` Existing memories: ${names.join(', ')}.` : ' The project memory is empty.'}`;
|
|
247
|
+
}
|
|
248
|
+
return formatMemoryFile(entry);
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: 'memory_write',
|
|
253
|
+
description: `Save a project memory for future sessions, or replace the memory with the same name. ${GUIDANCE} One fact per memory; for feedback and project memories, follow the fact with "Why:" and "How to apply:" lines.`,
|
|
254
|
+
executionMode: 'sequential',
|
|
255
|
+
parameters: {
|
|
256
|
+
type: 'object',
|
|
257
|
+
properties: {
|
|
258
|
+
name: { type: 'string', description: 'Kebab-case slug, unique per memory, e.g. "release-process". Reuse an existing name to update it.' },
|
|
259
|
+
description: { type: 'string', description: `One-line summary shown in the index and used to decide relevance (at most ${MAX_DESCRIPTION_CHARS} characters).` },
|
|
260
|
+
type: { type: 'string', enum: [...PROJECT_MEMORY_TYPES], description: 'user: who the user is and their preferences; feedback: guidance or corrections on how to work; project: ongoing work, decisions and constraints not derivable from the code; reference: pointers to external resources.' },
|
|
261
|
+
body: { type: 'string', description: `The memory in Markdown (at most ${MAX_BODY_CHARS} characters).` },
|
|
262
|
+
},
|
|
263
|
+
required: ['name', 'description', 'type', 'body'],
|
|
264
|
+
additionalProperties: false,
|
|
265
|
+
},
|
|
266
|
+
execute: async (args, context) => {
|
|
267
|
+
context.signal.throwIfAborted();
|
|
268
|
+
const outcome = await this.write({ name: args.name, description: args.description, type: args.type, body: args.body });
|
|
269
|
+
return `Project memory "${args.name.trim()}" ${outcome}.`;
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
name: 'memory_delete',
|
|
274
|
+
description: 'Delete a project memory that is wrong or no longer useful, and remove it from the index.',
|
|
275
|
+
executionMode: 'sequential',
|
|
276
|
+
parameters: { type: 'object', properties: { name: { type: 'string', description: 'Memory name from the index.' } }, required: ['name'], additionalProperties: false },
|
|
277
|
+
execute: async (args, context) => {
|
|
278
|
+
context.signal.throwIfAborted();
|
|
279
|
+
const name = typeof args.name === 'string' ? args.name.trim().replace(/\.md$/i, '') : '';
|
|
280
|
+
return await this.delete(name) ? `Project memory "${name}" deleted.` : `No project memory named "${name}"; nothing was deleted.`;
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
];
|
|
284
|
+
}
|
|
285
|
+
}
|
|
@@ -20,9 +20,7 @@ export interface ToolFailureLessonsOptions {
|
|
|
20
20
|
maxPending?: number;
|
|
21
21
|
maxLessons?: number;
|
|
22
22
|
}
|
|
23
|
-
/** Load only structured facts for this repository and environment; stored prose is never trusted. */
|
|
24
23
|
export declare function restoreToolFailureLesson(value: unknown, repositoryId: string, platform?: string, shell?: string): ToolFailureLesson | undefined;
|
|
25
|
-
/** Deterministic observations, never model-authored instructions or raw tool transcripts. */
|
|
26
24
|
export declare class ToolFailureLessons {
|
|
27
25
|
private options;
|
|
28
26
|
private pending;
|
|
@@ -32,7 +30,6 @@ export declare class ToolFailureLessons {
|
|
|
32
30
|
private maxLessons;
|
|
33
31
|
constructor(options: ToolFailureLessonsOptions);
|
|
34
32
|
observe(event: RuntimeEvent): void;
|
|
35
|
-
/** Final run snapshot; bounded observations include the latest same-run revalidation. */
|
|
36
33
|
drain(): ToolFailureLesson[];
|
|
37
34
|
private time;
|
|
38
35
|
private record;
|
|
@@ -17,7 +17,6 @@ function buildLesson(repositoryId, environment, suffix, kind, observedAt, status
|
|
|
17
17
|
: `The shell reported ${executable} unavailable in this repository. ${advice} This is an observation, not a permanent ban: revalidate after the platform, shell, installation, or PATH changes.`;
|
|
18
18
|
return { key: lessonKey(environment, suffix), repositoryId, kind, title: `${title} (${stamp})`, content: `${content} Observed environment: ${stamp}.`, environment: { ...environment }, observedAt, status, ...(executable ? { executable } : {}) };
|
|
19
19
|
}
|
|
20
|
-
/** Load only structured facts for this repository and environment; stored prose is never trusted. */
|
|
21
20
|
export function restoreToolFailureLesson(value, repositoryId, platform = process.platform, shell = platform === 'win32' ? 'powershell' : '/bin/sh') {
|
|
22
21
|
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
23
22
|
return;
|
|
@@ -57,7 +56,6 @@ export function restoreToolFailureLesson(value, repositoryId, platform = process
|
|
|
57
56
|
return;
|
|
58
57
|
return buildLesson(repositoryId, { platform, shell }, suffix, v.kind, v.observedAt, v.status, executable);
|
|
59
58
|
}
|
|
60
|
-
/** Deterministic observations, never model-authored instructions or raw tool transcripts. */
|
|
61
59
|
export class ToolFailureLessons {
|
|
62
60
|
options;
|
|
63
61
|
pending = new Map();
|
|
@@ -104,14 +102,12 @@ export class ToolFailureLessons {
|
|
|
104
102
|
const shell = d.name === 'bash' ? 'bash' : d.name === 'powershell' ? (this.environment.platform === 'win32' ? 'powershell' : 'pwsh') : this.environment.shell;
|
|
105
103
|
const pending = { name: d.name, environment: { ...this.environment, shell } };
|
|
106
104
|
if (['shell', 'powershell', 'bash'].includes(d.name) && typeof args.command === 'string' && args.command.length <= 65536) {
|
|
107
|
-
// Keep only allowlisted executable names, not arguments or command fragments.
|
|
108
105
|
pending.commands = new Set([...args.command.matchAll(/(?:^|[|&;]\s*)\s*([a-zA-Z0-9]+)(?=\s|$)/g)].map(match => match[1].toLowerCase()).filter(name => EXECUTABLES.has(name)));
|
|
109
106
|
const simple = args.command.match(/^\s*([a-zA-Z0-9]+)(?:\s+[^|&;<>\r\n`$]*)?\s*$/);
|
|
110
107
|
if (simple && EXECUTABLES.has(simple[1].toLowerCase()))
|
|
111
108
|
pending.simpleCommand = simple[1].toLowerCase();
|
|
112
109
|
}
|
|
113
110
|
if (['read_file', 'read'].includes(d.name) && typeof args.path === 'string' && args.path.length <= 4096) {
|
|
114
|
-
// The digest pairs revalidation without retaining paths (which may contain secrets).
|
|
115
111
|
pending.pathKey = createHash('sha256').update(args.path).digest('hex');
|
|
116
112
|
}
|
|
117
113
|
this.pending.set(id, pending);
|
|
@@ -146,7 +142,6 @@ export class ToolFailureLessons {
|
|
|
146
142
|
}
|
|
147
143
|
}
|
|
148
144
|
}
|
|
149
|
-
/** Final run snapshot; bounded observations include the latest same-run revalidation. */
|
|
150
145
|
drain() {
|
|
151
146
|
const result = [...this.lessons.values()];
|
|
152
147
|
this.lessons.clear();
|
|
@@ -159,7 +154,6 @@ export class ToolFailureLessons {
|
|
|
159
154
|
this.lessons.delete(key);
|
|
160
155
|
this.lessons.set(key, buildLesson(this.options.repositoryId, environment, suffix, kind, this.time(event), status, executable));
|
|
161
156
|
if (this.lessons.size > this.maxLessons) {
|
|
162
|
-
// Ordinary successful reads must not crowd newly observed failures out of the run snapshot.
|
|
163
157
|
const oldestSuccess = [...this.lessons.values()].find(lesson => lesson.status === 'revalidated');
|
|
164
158
|
this.lessons.delete(oldestSuccess?.key ?? this.lessons.keys().next().value);
|
|
165
159
|
}
|
|
@@ -8,3 +8,4 @@ export { containsSecret, redactSecrets } from './redaction.js';
|
|
|
8
8
|
export { deriveRepositoryId, memoryGroupId, resolveRepositoryId } from './repository.js';
|
|
9
9
|
export { NoOpMemoryProvider } from './providers/NoOpMemoryProvider.js';
|
|
10
10
|
export { memorySearchTool } from './tools/memorySearchTool.js';
|
|
11
|
+
export { ProjectMemory, PROJECT_MEMORY_TYPES, type ProjectMemoryEntry, type ProjectMemoryType } from './ProjectMemory.js';
|
package/dist/src/memory/index.js
CHANGED
|
@@ -7,3 +7,4 @@ export { containsSecret, redactSecrets } from './redaction.js';
|
|
|
7
7
|
export { deriveRepositoryId, memoryGroupId, resolveRepositoryId } from './repository.js';
|
|
8
8
|
export { NoOpMemoryProvider } from './providers/NoOpMemoryProvider.js';
|
|
9
9
|
export { memorySearchTool } from './tools/memorySearchTool.js';
|
|
10
|
+
export { ProjectMemory, PROJECT_MEMORY_TYPES } from './ProjectMemory.js';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { MemoryProvider } from '../MemoryProvider.js';
|
|
2
2
|
import type { MemoryEvent, MemoryHealth, MemoryQuery, MemoryResult, MemoryScope, MemoryWriteResult } from '../types.js';
|
|
3
|
-
/** Graceful-degradation provider: retrieval is empty, writes are dropped. */
|
|
4
3
|
export declare class NoOpMemoryProvider implements MemoryProvider {
|
|
5
4
|
private readonly detail;
|
|
6
5
|
constructor(detail?: string);
|
|
@@ -3,9 +3,4 @@ export declare function redactSecrets(text: string): {
|
|
|
3
3
|
text: string;
|
|
4
4
|
redactions: number;
|
|
5
5
|
};
|
|
6
|
-
/**
|
|
7
|
-
* Screen a list of provenance/entity strings (test commands, file paths,
|
|
8
|
-
* component names) before persistence. Each value is redacted span-wise;
|
|
9
|
-
* values that were dominated by credential material are dropped entirely.
|
|
10
|
-
*/
|
|
11
6
|
export declare function redactStringList(values: string[], limit: number): string[];
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Secret screening for persistent memory. Candidates are redacted span-wise;
|
|
3
|
-
* a candidate dominated by secrets is rejected by the policy layer. This is a
|
|
4
|
-
* belt-and-braces filter, not a vault: memory content must never include
|
|
5
|
-
* credentials in the first place.
|
|
6
|
-
*/
|
|
7
1
|
const PATTERNS = [
|
|
8
2
|
/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g,
|
|
9
3
|
/\bAKIA[0-9A-Z]{16}\b/g,
|
|
@@ -35,11 +29,6 @@ export function redactSecrets(text) {
|
|
|
35
29
|
}
|
|
36
30
|
return { text: result, redactions };
|
|
37
31
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Screen a list of provenance/entity strings (test commands, file paths,
|
|
40
|
-
* component names) before persistence. Each value is redacted span-wise;
|
|
41
|
-
* values that were dominated by credential material are dropped entirely.
|
|
42
|
-
*/
|
|
43
32
|
export function redactStringList(values, limit) {
|
|
44
33
|
const cleaned = [];
|
|
45
34
|
for (const value of values) {
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stable repository identity for memory isolation. The readable slug is
|
|
3
|
-
* intentionally lossy; the hash of the canonical remote is the collision
|
|
4
|
-
* boundary. Relative filesystem remotes are first resolved against the repo.
|
|
5
|
-
*/
|
|
6
1
|
export declare function deriveRepositoryId(remoteUrl?: string, rootPath?: string): string;
|
|
7
|
-
/** Memory group id; the only scope a provider ever searches. */
|
|
8
2
|
export declare function memoryGroupId(repositoryId: string): string;
|
|
9
3
|
type GitRunner = (args: string[], cwd: string) => Promise<string>;
|
|
10
4
|
export declare function resolveRepositoryId(workspace: string, run?: GitRunner): Promise<string>;
|
|
@@ -14,9 +14,6 @@ function canonicalRemote(remoteUrl, rootPath) {
|
|
|
14
14
|
const host = url.hostname.toLowerCase();
|
|
15
15
|
const port = url.port ? `/${url.port}` : '';
|
|
16
16
|
const path = ['github.com', 'gitlab.com'].includes(host) ? url.pathname.toLowerCase() : url.pathname;
|
|
17
|
-
// Preserve the pre-existing network-remote identity shape (host/path, no
|
|
18
|
-
// scheme) so this fix does not fork existing memory groups. File/self-
|
|
19
|
-
// hosted paths remain case-sensitive where the transport can be.
|
|
20
17
|
return `${host}${port}${path}`;
|
|
21
18
|
}
|
|
22
19
|
catch {
|
|
@@ -34,11 +31,6 @@ function canonicalRemote(remoteUrl, rootPath) {
|
|
|
34
31
|
return `${withoutUser.slice(0, slash).toLowerCase()}${withoutUser.slice(slash)}`;
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Stable repository identity for memory isolation. The readable slug is
|
|
39
|
-
* intentionally lossy; the hash of the canonical remote is the collision
|
|
40
|
-
* boundary. Relative filesystem remotes are first resolved against the repo.
|
|
41
|
-
*/
|
|
42
34
|
export function deriveRepositoryId(remoteUrl, rootPath) {
|
|
43
35
|
if (remoteUrl?.trim()) {
|
|
44
36
|
const canonical = canonicalRemote(remoteUrl, rootPath);
|
|
@@ -49,12 +41,10 @@ export function deriveRepositoryId(remoteUrl, rootPath) {
|
|
|
49
41
|
return `${slug}-${createHash('sha256').update(canonical).digest('hex').slice(0, 8)}`;
|
|
50
42
|
}
|
|
51
43
|
let root = (rootPath ?? '').replace(/\\/g, '/').replace(/\/+$/, '');
|
|
52
|
-
// Windows path identity is case-insensitive; POSIX paths are not.
|
|
53
44
|
if (/^[A-Za-z]:\//.test(root))
|
|
54
45
|
root = root.toLowerCase();
|
|
55
46
|
return `local-${createHash('sha256').update(root || 'unknown').digest('hex').slice(0, 12)}`;
|
|
56
47
|
}
|
|
57
|
-
/** Memory group id; the only scope a provider ever searches. */
|
|
58
48
|
export function memoryGroupId(repositoryId) {
|
|
59
49
|
return `repo:${repositoryId}`;
|
|
60
50
|
}
|
|
@@ -65,10 +55,10 @@ export async function resolveRepositoryId(workspace, run = defaultRunner) {
|
|
|
65
55
|
try {
|
|
66
56
|
remote = (await run(['config', '--get', 'remote.origin.url'], workspace)).trim() || undefined;
|
|
67
57
|
}
|
|
68
|
-
catch {
|
|
58
|
+
catch { }
|
|
69
59
|
try {
|
|
70
60
|
root = (await run(['rev-parse', '--show-toplevel'], workspace)).trim() || undefined;
|
|
71
61
|
}
|
|
72
|
-
catch {
|
|
62
|
+
catch { }
|
|
73
63
|
return deriveRepositoryId(remote, root ?? workspace);
|
|
74
64
|
}
|
|
@@ -14,7 +14,6 @@ export interface MemoryProvenance {
|
|
|
14
14
|
workspaceId?: string;
|
|
15
15
|
files?: string[];
|
|
16
16
|
tests?: string[];
|
|
17
|
-
/** Blob hashes of dirty/untracked evidence at verification time; __missing__ represents deletion. */
|
|
18
17
|
worktreeHashes?: Record<string, string>;
|
|
19
18
|
}
|
|
20
19
|
export interface MemoryEvent {
|
|
@@ -1,38 +1,8 @@
|
|
|
1
1
|
import type { ProviderConfig } from './providers.js';
|
|
2
|
-
/**
|
|
3
|
-
* How long a model that answered is trusted to still answer.
|
|
4
|
-
*
|
|
5
|
-
* The preflight before a run asks every model the graph can call for a short reply, which is a
|
|
6
|
-
* whole model round trip — seconds on a hosted model — in front of the first node of every run,
|
|
7
|
-
* including every follow-up message of a conversation whose last turn finished a moment ago. A
|
|
8
|
-
* model that answered within this window is not asked again: a deployment can stop at any moment,
|
|
9
|
-
* the run that follows takes minutes either way, and the provider's own error still reports a
|
|
10
|
-
* model that stopped in between. Ten minutes keeps a conversation's follow-ups, and a task started
|
|
11
|
-
* right after another one, off the probe without vouching for a model nobody has heard from today.
|
|
12
|
-
*/
|
|
13
2
|
export declare const MODEL_HEALTH_TTL_MS: number;
|
|
14
|
-
/**
|
|
15
|
-
* One provider/model pair as the probe reaches it, as an opaque key.
|
|
16
|
-
*
|
|
17
|
-
* Everything that decides whether the endpoint answers is part of it — the address, the kind of
|
|
18
|
-
* provider, the credential it would send and the account it signs in as — so editing any of them
|
|
19
|
-
* asks the model again. The credential only ever enters a SHA-256 with the rest: the file holds no
|
|
20
|
-
* secret and nothing a secret could be read back from.
|
|
21
|
-
*/
|
|
22
3
|
export declare function modelHealthKey(provider: ProviderConfig, model: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* The models that answered recently, shared by every engine on one configuration home.
|
|
25
|
-
*
|
|
26
|
-
* The desktop runs a process per task, so the answer one engine got has to reach the next one:
|
|
27
|
-
* the record lives in a small file beside the configuration, read when a check begins and
|
|
28
|
-
* rewritten when a model answers. It is advisory in both directions — a file that cannot be read
|
|
29
|
-
* means every model is asked, and one that cannot be written means the next check asks again — so
|
|
30
|
-
* no failure here ever fails a run. Two engines writing at once merge what the other wrote first;
|
|
31
|
-
* the worst a lost update costs is one repeated probe.
|
|
32
|
-
*/
|
|
33
4
|
export declare class ModelHealthCache {
|
|
34
5
|
private readonly verified;
|
|
35
|
-
/** The stamp each pair has in the file, as far as this engine knows: what it read or queued a write of. */
|
|
36
6
|
private readonly persisted;
|
|
37
7
|
private readonly path;
|
|
38
8
|
private readonly ttlMs;
|
|
@@ -42,18 +12,10 @@ export declare class ModelHealthCache {
|
|
|
42
12
|
ttlMs?: number;
|
|
43
13
|
now?: () => number;
|
|
44
14
|
});
|
|
45
|
-
/** Whether answers are remembered at all; a zero window asks every model every time. */
|
|
46
15
|
get enabled(): boolean;
|
|
47
|
-
/** Take in what other engines recorded. Called before a check, so `has` can answer without waiting. */
|
|
48
16
|
load(): Promise<void>;
|
|
49
|
-
/** Whether this pair answered within the window. */
|
|
50
17
|
has(provider: ProviderConfig, model: string): boolean;
|
|
51
|
-
/** Record that this pair answered just now. */
|
|
52
18
|
add(provider: ProviderConfig, model: string): void;
|
|
53
|
-
/**
|
|
54
|
-
* Put every answer on disk and wait for it. A caller that is done with a run uses it, so the
|
|
55
|
-
* stamps the write interval held back are the ones the next engine reads.
|
|
56
|
-
*/
|
|
57
19
|
flush(): Promise<void>;
|
|
58
20
|
private queueWrite;
|
|
59
21
|
private fresh;
|