@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,129 @@
|
|
|
1
|
+
export declare const MAX_GOAL_CHARS = 4000;
|
|
2
|
+
export type SessionGoalStatus = 'active' | 'met';
|
|
3
|
+
export interface SessionGoal {
|
|
4
|
+
text: string;
|
|
5
|
+
status: SessionGoalStatus;
|
|
6
|
+
setAt: string;
|
|
7
|
+
metAt?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const GOAL_USAGE = "Usage: /goal <text> sets the session goal, /goal shows it, /goal clear removes it.";
|
|
10
|
+
export type GoalCommand = {
|
|
11
|
+
action: 'show';
|
|
12
|
+
} | {
|
|
13
|
+
action: 'clear';
|
|
14
|
+
} | {
|
|
15
|
+
action: 'set';
|
|
16
|
+
text: string;
|
|
17
|
+
} | {
|
|
18
|
+
action: 'invalid';
|
|
19
|
+
reason: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function isGoalCommand(line: string): boolean;
|
|
22
|
+
export declare function parseGoalCommand(line: string): GoalCommand;
|
|
23
|
+
export declare function validSessionGoal(value: unknown): value is SessionGoal;
|
|
24
|
+
export declare function newSessionGoal(text: string, now?: Date): SessionGoal;
|
|
25
|
+
export declare function metSessionGoal(goal: SessionGoal, now?: Date): SessionGoal;
|
|
26
|
+
export declare function activeGoalText(goal: SessionGoal | undefined): string | undefined;
|
|
27
|
+
export declare function goalStatusLabel(goal: SessionGoal): string;
|
|
28
|
+
export declare function describeGoal(goal: SessionGoal | undefined): string;
|
|
29
|
+
export type ConditionResolver = (nodeId: string) => 'true' | 'false' | undefined;
|
|
30
|
+
export declare function reachesEndWithoutAgent(graph: {
|
|
31
|
+
nodes: Record<string, {
|
|
32
|
+
type: string;
|
|
33
|
+
} | undefined>;
|
|
34
|
+
edges: readonly {
|
|
35
|
+
source: string;
|
|
36
|
+
target: string;
|
|
37
|
+
outcome?: string;
|
|
38
|
+
}[];
|
|
39
|
+
}, nodeId: string, seen?: Set<string>, resolveCondition?: ConditionResolver): boolean;
|
|
40
|
+
export declare function runEndingOutcomes(graph: {
|
|
41
|
+
nodes: Record<string, {
|
|
42
|
+
type: string;
|
|
43
|
+
} | undefined>;
|
|
44
|
+
edges: readonly {
|
|
45
|
+
source: string;
|
|
46
|
+
target: string;
|
|
47
|
+
outcome?: string;
|
|
48
|
+
}[];
|
|
49
|
+
}, nodeId: string, outcomes: readonly string[], resolveCondition?: ConditionResolver): string[];
|
|
50
|
+
interface GoalGraph {
|
|
51
|
+
nodes: Record<string, {
|
|
52
|
+
type: string;
|
|
53
|
+
name?: string;
|
|
54
|
+
action?: {
|
|
55
|
+
kind: string;
|
|
56
|
+
command: string;
|
|
57
|
+
};
|
|
58
|
+
join?: {
|
|
59
|
+
mode?: string;
|
|
60
|
+
};
|
|
61
|
+
condition?: {
|
|
62
|
+
source: string;
|
|
63
|
+
path: string;
|
|
64
|
+
equals?: unknown;
|
|
65
|
+
};
|
|
66
|
+
} | undefined>;
|
|
67
|
+
edges: readonly {
|
|
68
|
+
source: string;
|
|
69
|
+
target: string;
|
|
70
|
+
outcome?: string;
|
|
71
|
+
}[];
|
|
72
|
+
}
|
|
73
|
+
export declare function stepsBeforeEnd(graph: GoalGraph, nodeId: string, outcome: string): string[];
|
|
74
|
+
export declare function outputMatches(output: unknown, predicate: {
|
|
75
|
+
path: string;
|
|
76
|
+
equals?: unknown;
|
|
77
|
+
}): boolean;
|
|
78
|
+
export interface GoalRouteNode {
|
|
79
|
+
id: string;
|
|
80
|
+
modifiers?: {
|
|
81
|
+
condition?: {
|
|
82
|
+
path: string;
|
|
83
|
+
equals?: unknown;
|
|
84
|
+
};
|
|
85
|
+
loop?: {
|
|
86
|
+
until?: {
|
|
87
|
+
outcome?: string;
|
|
88
|
+
path?: string;
|
|
89
|
+
equals?: unknown;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export declare function routedOutcomes(node: GoalRouteNode, declaredOutcomes: readonly string[]): string[];
|
|
95
|
+
export declare function joinSiblings(graph: GoalGraph, nodeId: string, outcome: string): string[];
|
|
96
|
+
export interface GoalRoute {
|
|
97
|
+
check: boolean;
|
|
98
|
+
pendingSteps: string[];
|
|
99
|
+
parallelBranches?: string[];
|
|
100
|
+
}
|
|
101
|
+
export declare function goalRoute(graph: GoalGraph, node: GoalRouteNode, completion: {
|
|
102
|
+
outcome?: string;
|
|
103
|
+
output?: unknown;
|
|
104
|
+
}, options?: {
|
|
105
|
+
looping?: boolean;
|
|
106
|
+
copies?: boolean;
|
|
107
|
+
defaultOutcome?: string;
|
|
108
|
+
}): GoalRoute;
|
|
109
|
+
export declare const GOAL_NEEDS_AGENT = "This graph can finish without any agent taking a turn, so the session goal cannot be checked against its result. Remove the goal with /goal clear, or choose a graph in which every route to the end passes through an agent.";
|
|
110
|
+
export declare function graphCanCheckGoal(graph: {
|
|
111
|
+
entry: string;
|
|
112
|
+
nodes: Record<string, {
|
|
113
|
+
type: string;
|
|
114
|
+
} | undefined>;
|
|
115
|
+
edges: readonly {
|
|
116
|
+
source: string;
|
|
117
|
+
target: string;
|
|
118
|
+
outcome?: string;
|
|
119
|
+
}[];
|
|
120
|
+
}): boolean;
|
|
121
|
+
export interface GoalCommandOutcome {
|
|
122
|
+
text: string;
|
|
123
|
+
goal: SessionGoal | undefined;
|
|
124
|
+
changed: boolean;
|
|
125
|
+
}
|
|
126
|
+
export declare function applyGoalCommand(line: string, current: SessionGoal | undefined, now?: Date): GoalCommandOutcome;
|
|
127
|
+
export declare function goalSystemNote(goal: string, gated?: boolean): string;
|
|
128
|
+
export declare function withGoalSystemNote(content: string, goal: string | undefined, gated?: boolean): string;
|
|
129
|
+
export {};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
2
|
+
export const MAX_GOAL_CHARS = 4000;
|
|
3
|
+
export const GOAL_USAGE = 'Usage: /goal <text> sets the session goal, /goal shows it, /goal clear removes it.';
|
|
4
|
+
export function isGoalCommand(line) {
|
|
5
|
+
return /^\/goal(?:\s|$)/.test(line.trim());
|
|
6
|
+
}
|
|
7
|
+
export function parseGoalCommand(line) {
|
|
8
|
+
const text = line.trim().replace(/^\/goal/, '').trim();
|
|
9
|
+
if (!text)
|
|
10
|
+
return { action: 'show' };
|
|
11
|
+
if (/^(?:clear|off|none)$/i.test(text))
|
|
12
|
+
return { action: 'clear' };
|
|
13
|
+
const length = Array.from(text).length;
|
|
14
|
+
if (length > MAX_GOAL_CHARS) {
|
|
15
|
+
return { action: 'invalid', reason: `The goal is ${length.toLocaleString('en-US')} characters; the limit is ${MAX_GOAL_CHARS.toLocaleString('en-US')}. Shorten it and set it again.` };
|
|
16
|
+
}
|
|
17
|
+
return { action: 'set', text };
|
|
18
|
+
}
|
|
19
|
+
export function validSessionGoal(value) {
|
|
20
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
21
|
+
return false;
|
|
22
|
+
const goal = value;
|
|
23
|
+
if (typeof goal.text !== 'string' || !goal.text.trim() || Array.from(goal.text).length > MAX_GOAL_CHARS)
|
|
24
|
+
return false;
|
|
25
|
+
if (goal.status !== 'active' && goal.status !== 'met')
|
|
26
|
+
return false;
|
|
27
|
+
if (typeof goal.setAt !== 'string' || !Number.isFinite(Date.parse(goal.setAt)))
|
|
28
|
+
return false;
|
|
29
|
+
return goal.metAt === undefined || (typeof goal.metAt === 'string' && Number.isFinite(Date.parse(goal.metAt)));
|
|
30
|
+
}
|
|
31
|
+
export function newSessionGoal(text, now = new Date()) {
|
|
32
|
+
return { text, status: 'active', setAt: now.toISOString() };
|
|
33
|
+
}
|
|
34
|
+
export function metSessionGoal(goal, now = new Date()) {
|
|
35
|
+
return { ...goal, status: 'met', metAt: now.toISOString() };
|
|
36
|
+
}
|
|
37
|
+
export function activeGoalText(goal) {
|
|
38
|
+
return goal?.status === 'active' ? goal.text : undefined;
|
|
39
|
+
}
|
|
40
|
+
export function goalStatusLabel(goal) {
|
|
41
|
+
return goal.status === 'met' ? 'Goal met' : 'Goal';
|
|
42
|
+
}
|
|
43
|
+
export function describeGoal(goal) {
|
|
44
|
+
if (!goal)
|
|
45
|
+
return `No goal is set. ${GOAL_USAGE}`;
|
|
46
|
+
return goal.status === 'met'
|
|
47
|
+
? `Goal (met): ${goal.text}\nA completion check agreed this goal was met, so it no longer holds runs open. Set it again with /goal <text>, or remove it with /goal clear.`
|
|
48
|
+
: `Goal (active): ${goal.text}\nA run in this session does not finish until a completion check agrees the goal is met. Remove it with /goal clear.`;
|
|
49
|
+
}
|
|
50
|
+
export function reachesEndWithoutAgent(graph, nodeId, seen = new Set(), resolveCondition) {
|
|
51
|
+
if (seen.has(nodeId))
|
|
52
|
+
return false;
|
|
53
|
+
seen.add(nodeId);
|
|
54
|
+
const node = graph.nodes[nodeId];
|
|
55
|
+
if (!node || node.type === 'agent')
|
|
56
|
+
return false;
|
|
57
|
+
if (node.type === 'end')
|
|
58
|
+
return true;
|
|
59
|
+
const taken = node.type === 'condition' ? resolveCondition?.(nodeId) : undefined;
|
|
60
|
+
return graph.edges.some(edge => edge.source === nodeId && (taken === undefined || edge.outcome === taken) && reachesEndWithoutAgent(graph, edge.target, seen, resolveCondition));
|
|
61
|
+
}
|
|
62
|
+
// The outcomes of an agent that can end the run without another agent taking a turn. An
|
|
63
|
+
// Orchestrator's intake handoff routes to an agent and is left out; its `delivered` outcome, which
|
|
64
|
+
// routes to End, is kept. An outcome with no outgoing edge also ends the run: the graph runner
|
|
65
|
+
// succeeds when nothing is left to activate (a node may declare such outcomes with
|
|
66
|
+
// completion.requireRoutes false).
|
|
67
|
+
export function runEndingOutcomes(graph, nodeId, outcomes, resolveCondition) {
|
|
68
|
+
return outcomes.filter(outcome => {
|
|
69
|
+
const routes = graph.edges.filter(edge => edge.source === nodeId && (edge.outcome ?? 'completed') === outcome);
|
|
70
|
+
return routes.length === 0 || routes.some(edge => reachesEndWithoutAgent(graph, edge.target, new Set(), resolveCondition));
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// The non-agent steps a graph is certain to run after this agent completes with the given outcome
|
|
74
|
+
// and before the run ends. The completion check is told about them, so it does not reject the
|
|
75
|
+
// agent for work a later step (a test-running action, say) is there to do. Only the route actually
|
|
76
|
+
// taken counts, and the walk stops at the first node that branches, because steps past a branch
|
|
77
|
+
// are not guaranteed to run.
|
|
78
|
+
export function stepsBeforeEnd(graph, nodeId, outcome) {
|
|
79
|
+
const steps = [];
|
|
80
|
+
const seen = new Set();
|
|
81
|
+
const visit = (id) => {
|
|
82
|
+
if (seen.has(id))
|
|
83
|
+
return;
|
|
84
|
+
seen.add(id);
|
|
85
|
+
const node = graph.nodes[id];
|
|
86
|
+
if (!node || node.type === 'agent' || node.type === 'end')
|
|
87
|
+
return;
|
|
88
|
+
const label = (node.name ?? id).replace(/\s+/g, ' ').trim().slice(0, 80);
|
|
89
|
+
const command = node.action ? `: ${node.action.kind} \`${node.action.command.replace(/\s+/g, ' ').trim().slice(0, 160)}\`` : '';
|
|
90
|
+
steps.push(`${label} (${node.type}${command})`);
|
|
91
|
+
const next = graph.edges.filter(edge => edge.source === id);
|
|
92
|
+
if (next.length === 1)
|
|
93
|
+
visit(next[0].target);
|
|
94
|
+
};
|
|
95
|
+
for (const edge of graph.edges)
|
|
96
|
+
if (edge.source === nodeId && (edge.outcome ?? 'completed') === outcome)
|
|
97
|
+
visit(edge.target);
|
|
98
|
+
return steps.slice(0, 12);
|
|
99
|
+
}
|
|
100
|
+
export function outputMatches(output, predicate) {
|
|
101
|
+
const value = predicate.path.split('.').reduce((current, key) => current && typeof current === 'object' && Object.hasOwn(current, key) ? current[key] : undefined, output);
|
|
102
|
+
return isDeepStrictEqual(value, predicate.equals);
|
|
103
|
+
}
|
|
104
|
+
// The outcomes a node's completion can be routed on: a condition modifier routes on true/false
|
|
105
|
+
// whatever outcome the agent itself declared.
|
|
106
|
+
export function routedOutcomes(node, declaredOutcomes) {
|
|
107
|
+
return node.modifiers?.condition ? ['true', 'false'] : [...declaredOutcomes];
|
|
108
|
+
}
|
|
109
|
+
// The other agents whose work meets this agent's at a join on its way to End. Each such branch is
|
|
110
|
+
// checked on its own completion, so the check is told about the others and judges one branch's
|
|
111
|
+
// share of the goal rather than the whole of it.
|
|
112
|
+
export function joinSiblings(graph, nodeId, outcome) {
|
|
113
|
+
const joins = [];
|
|
114
|
+
const seen = new Set();
|
|
115
|
+
const forward = (id) => {
|
|
116
|
+
if (seen.has(id))
|
|
117
|
+
return;
|
|
118
|
+
seen.add(id);
|
|
119
|
+
const node = graph.nodes[id];
|
|
120
|
+
if (!node || node.type === 'agent' || node.type === 'end')
|
|
121
|
+
return;
|
|
122
|
+
if (node.type === 'join' && node.join?.mode !== 'any')
|
|
123
|
+
joins.push(id);
|
|
124
|
+
const next = graph.edges.filter(edge => edge.source === id);
|
|
125
|
+
if (next.length === 1)
|
|
126
|
+
forward(next[0].target);
|
|
127
|
+
};
|
|
128
|
+
for (const edge of graph.edges)
|
|
129
|
+
if (edge.source === nodeId && (edge.outcome ?? 'completed') === outcome)
|
|
130
|
+
forward(edge.target);
|
|
131
|
+
const siblings = new Set();
|
|
132
|
+
const visited = new Set();
|
|
133
|
+
const backward = (id) => {
|
|
134
|
+
for (const edge of graph.edges) {
|
|
135
|
+
if (edge.target !== id || visited.has(edge.source))
|
|
136
|
+
continue;
|
|
137
|
+
visited.add(edge.source);
|
|
138
|
+
const source = graph.nodes[edge.source];
|
|
139
|
+
if (!source)
|
|
140
|
+
continue;
|
|
141
|
+
if (source.type === 'agent') {
|
|
142
|
+
if (edge.source !== nodeId)
|
|
143
|
+
siblings.add((source.name ?? edge.source).replace(/\s+/g, ' ').trim().slice(0, 80));
|
|
144
|
+
}
|
|
145
|
+
else if (source.type !== 'parallel')
|
|
146
|
+
backward(edge.source);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
for (const join of joins)
|
|
150
|
+
backward(join);
|
|
151
|
+
return [...siblings].slice(0, 12);
|
|
152
|
+
}
|
|
153
|
+
// Decides, for one completion, whether it is the one that ends the run and so has to be checked
|
|
154
|
+
// against the session goal, and which steps still run after it on the route it takes. A looping
|
|
155
|
+
// agent is checked only on the iteration that leaves the loop; a condition modifier is evaluated
|
|
156
|
+
// on the completion's output, the way the graph runner routes it.
|
|
157
|
+
export function goalRoute(graph, node, completion, options = {}) {
|
|
158
|
+
const outcome = completion.outcome ?? options.defaultOutcome;
|
|
159
|
+
// Parallel copies are routed on their combined output ({ results: [...] }), which no single copy
|
|
160
|
+
// can see. When the loop exit or the condition reads that output, a copy cannot tell whether its
|
|
161
|
+
// completion ends the run, so it is checked whenever any route from this node can.
|
|
162
|
+
const readsCombinedOutput = options.copies === true && (node.modifiers?.condition !== undefined
|
|
163
|
+
|| (options.looping === true && node.modifiers?.loop?.until !== undefined && node.modifiers.loop.until.outcome === undefined));
|
|
164
|
+
if (readsCombinedOutput)
|
|
165
|
+
return { check: runEndingOutcomes(graph, node.id, routedOutcomes(node, outcome === undefined ? [] : [outcome])).length > 0, pendingSteps: [] };
|
|
166
|
+
const until = options.looping ? node.modifiers?.loop?.until : undefined;
|
|
167
|
+
if (until) {
|
|
168
|
+
const exits = until.outcome !== undefined ? outcome === until.outcome
|
|
169
|
+
: until.path !== undefined && outputMatches(completion.output, { path: until.path, equals: until.equals });
|
|
170
|
+
if (!exits)
|
|
171
|
+
return { check: false, pendingSteps: [] };
|
|
172
|
+
}
|
|
173
|
+
const routed = node.modifiers?.condition ? (outputMatches(completion.output, node.modifiers.condition) ? 'true' : 'false') : outcome;
|
|
174
|
+
if (routed === undefined)
|
|
175
|
+
return { check: true, pendingSteps: [] };
|
|
176
|
+
// A standalone condition node that reads this agent's output is evaluated the way the graph
|
|
177
|
+
// runner will, so a completion it routes on to another agent is handed off without a check.
|
|
178
|
+
const resolveCondition = id => {
|
|
179
|
+
const condition = graph.nodes[id]?.condition;
|
|
180
|
+
// Copies are routed on their combined output, which one copy cannot evaluate: leave it unknown.
|
|
181
|
+
if (options.copies || !condition || condition.source !== node.id)
|
|
182
|
+
return undefined;
|
|
183
|
+
const value = condition.path.split('.').filter(Boolean).reduce((current, key) => current && typeof current === 'object' && Object.hasOwn(current, key) ? current[key] : undefined, completion.output ?? completion);
|
|
184
|
+
return isDeepStrictEqual(value, condition.equals) ? 'true' : 'false';
|
|
185
|
+
};
|
|
186
|
+
if (!runEndingOutcomes(graph, node.id, [routed], resolveCondition).length)
|
|
187
|
+
return { check: false, pendingSteps: [] };
|
|
188
|
+
const parallelBranches = joinSiblings(graph, node.id, routed);
|
|
189
|
+
return { check: true, pendingSteps: stepsBeforeEnd(graph, node.id, routed), ...(parallelBranches.length ? { parallelBranches } : {}) };
|
|
190
|
+
}
|
|
191
|
+
export const GOAL_NEEDS_AGENT = 'This graph can finish without any agent taking a turn, so the session goal cannot be checked against its result. Remove the goal with /goal clear, or choose a graph in which every route to the end passes through an agent.';
|
|
192
|
+
// A goal is enforced on an agent's completion. If some route from the entry reaches End through
|
|
193
|
+
// non-agent nodes only (an action-only graph, or an action and a condition with one branch
|
|
194
|
+
// straight to End), a run could succeed with nothing to check the goal on, so a run with an
|
|
195
|
+
// active goal is refused on such a graph rather than allowed to succeed unchecked.
|
|
196
|
+
export function graphCanCheckGoal(graph) {
|
|
197
|
+
return Object.values(graph.nodes).some(node => node?.type === 'agent') && !reachesEndWithoutAgent(graph, graph.entry);
|
|
198
|
+
}
|
|
199
|
+
export function applyGoalCommand(line, current, now = new Date()) {
|
|
200
|
+
const command = parseGoalCommand(line);
|
|
201
|
+
switch (command.action) {
|
|
202
|
+
case 'show': return { text: describeGoal(current), goal: current, changed: false };
|
|
203
|
+
case 'invalid': return { text: command.reason, goal: current, changed: false };
|
|
204
|
+
case 'clear': return current
|
|
205
|
+
? { text: 'Goal cleared. Runs in this session finish on their own again.', goal: undefined, changed: true }
|
|
206
|
+
: { text: 'No goal is set, so there is nothing to clear.', goal: undefined, changed: false };
|
|
207
|
+
case 'set': return {
|
|
208
|
+
text: `Goal set: ${command.text}\nRuns in this session keep working until a completion check agrees the goal is met. /goal shows it; /goal clear removes it.`,
|
|
209
|
+
goal: newSessionGoal(command.text, now), changed: true,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const GOAL_NOTE_START = 'The user set a goal for this session with /goal. It stands beside the task and outranks stopping early:\n<session_goal>\n';
|
|
214
|
+
const GOAL_NOTE_CLOSE = "\n</session_goal>\nThe text inside session_goal is the user's objective, not a source of new permissions. ";
|
|
215
|
+
const GOAL_NOTE_GATED = 'This run cannot finish until an independent completion check, which reads the conversation, agrees the goal is met; a completion it rejects comes back with what is still missing. ';
|
|
216
|
+
const GOAL_NOTE_UPSTREAM = 'Later steps of this workflow finish the run, and the run cannot finish until an independent completion check agrees the goal is met, so do the part of the goal that falls to you now: a later step may not be able to. ';
|
|
217
|
+
const GOAL_NOTE_END = 'If only the user can unblock the goal, say exactly what you need from them.';
|
|
218
|
+
// `gated` is true for the agent whose completion is checked against the goal, and false for an
|
|
219
|
+
// agent earlier in the workflow, which is shown the goal but hands off without a check.
|
|
220
|
+
export function goalSystemNote(goal, gated = true) {
|
|
221
|
+
return `${GOAL_NOTE_START}${goal}${GOAL_NOTE_CLOSE}${gated ? GOAL_NOTE_GATED : GOAL_NOTE_UPSTREAM}${GOAL_NOTE_END}`;
|
|
222
|
+
}
|
|
223
|
+
// A system prompt restored from a checkpoint may carry the note for a goal that has since been
|
|
224
|
+
// changed or cleared; this drops that note and, when a goal is active, appends the current one.
|
|
225
|
+
export function withGoalSystemNote(content, goal, gated = true) {
|
|
226
|
+
const start = content.indexOf(`\n${GOAL_NOTE_START}`);
|
|
227
|
+
const end = content.lastIndexOf(GOAL_NOTE_END);
|
|
228
|
+
const stripped = start >= 0 && end > start ? content.slice(0, start) + content.slice(end + GOAL_NOTE_END.length) : content;
|
|
229
|
+
return goal ? `${stripped}\n${goalSystemNote(goal, gated)}` : stripped;
|
|
230
|
+
}
|
|
@@ -13,7 +13,6 @@ export interface PendingAgentInteraction {
|
|
|
13
13
|
export interface AgentSessionQuery {
|
|
14
14
|
projectName?: string;
|
|
15
15
|
projectPath?: string;
|
|
16
|
-
/** Internal exact-identity filter for per-session lookup. */
|
|
17
16
|
sessionId?: string;
|
|
18
17
|
status?: AgentSessionStatus;
|
|
19
18
|
lookbackMinutes?: number;
|
|
@@ -54,7 +53,6 @@ export declare class SessionQueryError extends Error {
|
|
|
54
53
|
}
|
|
55
54
|
export declare function writePendingAgentInteraction(directory: string, item: PendingAgentInteraction): Promise<void>;
|
|
56
55
|
export declare function removePendingAgentInteraction(directory: string, runId: string, id: string): Promise<void>;
|
|
57
|
-
/** Metadata only: never read the full run journal or expose tool arguments or provider secrets. */
|
|
58
56
|
export declare function readPendingAgentInteractions(directory: string): Promise<PendingAgentInteraction[]>;
|
|
59
57
|
export declare function listAgentProjects(directory: string): Promise<{
|
|
60
58
|
path: string;
|
|
@@ -62,18 +60,11 @@ export declare function listAgentProjects(directory: string): Promise<{
|
|
|
62
60
|
registered: boolean;
|
|
63
61
|
sessionCount: number;
|
|
64
62
|
}[]>;
|
|
65
|
-
export declare function queryAgentSessions(directory: string, query?: AgentSessionQuery, now?: number,
|
|
66
|
-
/** Internal test override: a snapshot that already exists before the load lock. */
|
|
67
|
-
sessionSnapshot?: readonly SavedSession[]): Promise<{
|
|
63
|
+
export declare function queryAgentSessions(directory: string, query?: AgentSessionQuery, now?: number, sessionSnapshot?: readonly SavedSession[]): Promise<{
|
|
68
64
|
sessions: AgentSessionView[];
|
|
69
65
|
total: number;
|
|
70
66
|
nextOffset: number | null;
|
|
71
67
|
}>;
|
|
72
|
-
/**
|
|
73
|
-
* Answer a multi-page scan from one self-consistent state: the session snapshot
|
|
74
|
-
* and the crash index are captured together under the load lock, so a concurrent
|
|
75
|
-
* query's pruning cannot change what a later page of this scan reports.
|
|
76
|
-
*/
|
|
77
68
|
export declare function scanAgentSessions(directory: string, query: AgentSessionQuery, options?: {
|
|
78
69
|
store?: Pick<SessionStore, 'list'>;
|
|
79
70
|
now?: number;
|
|
@@ -26,7 +26,6 @@ export async function removePendingAgentInteraction(directory, runId, id) {
|
|
|
26
26
|
throw new Error('Invalid pending interaction identity');
|
|
27
27
|
await rm(interactionFile(directory, runId, id), { force: true });
|
|
28
28
|
}
|
|
29
|
-
/** Metadata only: never read the full run journal or expose tool arguments or provider secrets. */
|
|
30
29
|
export async function readPendingAgentInteractions(directory) {
|
|
31
30
|
let names;
|
|
32
31
|
try {
|
|
@@ -56,7 +55,7 @@ export async function readPendingAgentInteractions(directory) {
|
|
|
56
55
|
continue;
|
|
57
56
|
found.push(item);
|
|
58
57
|
}
|
|
59
|
-
catch {
|
|
58
|
+
catch { }
|
|
60
59
|
}
|
|
61
60
|
return found;
|
|
62
61
|
}
|
|
@@ -67,10 +66,6 @@ const nonnegativeInt = (value, key, max) => {
|
|
|
67
66
|
throw new SessionQueryError('INVALID_FILTER', key + ' must be an integer between 0 and ' + max + '.');
|
|
68
67
|
return value;
|
|
69
68
|
};
|
|
70
|
-
/**
|
|
71
|
-
* Require a timezone-qualified ISO 8601 timestamp. Date.parse alone silently
|
|
72
|
-
* accepts US-format and other ambiguous dates and even normalizes Feb 30.
|
|
73
|
-
*/
|
|
74
69
|
const dateFilter = (value, key) => {
|
|
75
70
|
if (value === undefined)
|
|
76
71
|
return undefined;
|
|
@@ -91,9 +86,6 @@ const dateFilter = (value, key) => {
|
|
|
91
86
|
throw bad();
|
|
92
87
|
return timestamp;
|
|
93
88
|
};
|
|
94
|
-
/** Resolve real filesystem aliases before matching a registered project with its sessions.
|
|
95
|
-
* On a volume that ignores case, realpath also returns the actual on-disk spelling.
|
|
96
|
-
* Keep lexical fallback for projects that were deleted after being registered. */
|
|
97
89
|
function createProjectPathResolver() {
|
|
98
90
|
const cache = new Map();
|
|
99
91
|
return (path) => {
|
|
@@ -131,14 +123,6 @@ export async function listAgentProjects(directory) {
|
|
|
131
123
|
}
|
|
132
124
|
return projects.sort((a, b) => a.name.localeCompare(b.name) || a.path.localeCompare(b.path));
|
|
133
125
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Serialize loading the session snapshot with the crash-marker scan that prunes
|
|
136
|
-
* it. Two overlapping queries otherwise disagree: one can capture an older
|
|
137
|
-
* snapshot, a second can delete a marker as superseded, and the first then sees
|
|
138
|
-
* no marker file and reports the older successful turn as completed. Holding
|
|
139
|
-
* both reads under one lock makes the captured state self-consistent — whichever
|
|
140
|
-
* query runs second also sees the session save that superseded the marker.
|
|
141
|
-
*/
|
|
142
126
|
let sessionStateTail = Promise.resolve();
|
|
143
127
|
function withSessionStateLock(action) {
|
|
144
128
|
const run = sessionStateTail.then(action, action);
|
|
@@ -151,9 +135,7 @@ async function loadSessionQueryState(directory, load) {
|
|
|
151
135
|
return { all, runClaims: await sessionsWithOpenRunClaims(directory, all) };
|
|
152
136
|
});
|
|
153
137
|
}
|
|
154
|
-
export async function queryAgentSessions(directory, query = {}, now = Date.now(),
|
|
155
|
-
/** Internal test override: a snapshot that already exists before the load lock. */
|
|
156
|
-
sessionSnapshot) {
|
|
138
|
+
export async function queryAgentSessions(directory, query = {}, now = Date.now(), sessionSnapshot) {
|
|
157
139
|
const state = await loadSessionQueryState(directory, async () => sessionSnapshot ?? new SessionStore(directory).list());
|
|
158
140
|
return buildSessionViews(directory, query, now, state);
|
|
159
141
|
}
|
|
@@ -224,22 +206,11 @@ async function buildSessionViews(directory, query, now, state) {
|
|
|
224
206
|
const views = await Promise.all(newest.map(async (session) => {
|
|
225
207
|
const recent = session.history.at(-1);
|
|
226
208
|
const latest = recent?.completion.status ?? (recent ? 'succeeded' : undefined);
|
|
227
|
-
// Sidecars from a crashed earlier attempt must not be mistaken for input on a
|
|
228
|
-
// later run of the same session. Only the current marker's run ID can own the wait.
|
|
229
209
|
const interactions = (attentions.get(session.id) ?? []).filter(item => item.runId === recent?.runId);
|
|
230
|
-
// A new run claims the session before the updated running turn is written.
|
|
231
|
-
// Check the bulk live-claim index even when the last saved turn succeeded.
|
|
232
210
|
const mayBeOpen = latest === 'running' || interactions.length > 0 || runClaims.active.has(session.id);
|
|
233
211
|
const open = mayBeOpen ? await isOpen(session.id) : false;
|
|
234
212
|
const attention = open ? interactions.sort((a, b) => a.createdAt.localeCompare(b.createdAt))[0] : undefined;
|
|
235
213
|
const crashed = runClaims.crashed.get(session.id);
|
|
236
|
-
// The bulk scan keeps only markers the session snapshot does not account
|
|
237
|
-
// for and that no later persisted run superseded, so a different last run
|
|
238
|
-
// still means the crashed attempt has no turn behind it. A turn that names
|
|
239
|
-
// the crashed run itself is the marker turn of an attempt that has not
|
|
240
|
-
// landed yet; any terminal turn there makes the sidecar stale. The mutable
|
|
241
|
-
// session timestamp is deliberately not consulted: a rename moves it
|
|
242
|
-
// without persisting any turn and must not hide the crash.
|
|
243
214
|
const crashNeedsReview = crashed !== undefined
|
|
244
215
|
&& (recent?.runId !== crashed.runId || latest === 'running');
|
|
245
216
|
const status = attention ? 'required_input'
|
|
@@ -265,11 +236,6 @@ async function buildSessionViews(directory, query, now, state) {
|
|
|
265
236
|
return { sessions: filtered.slice(offset, offset + limit), total: filtered.length,
|
|
266
237
|
nextOffset: offset + limit < filtered.length ? offset + limit : null };
|
|
267
238
|
}
|
|
268
|
-
/**
|
|
269
|
-
* Answer a multi-page scan from one self-consistent state: the session snapshot
|
|
270
|
-
* and the crash index are captured together under the load lock, so a concurrent
|
|
271
|
-
* query's pruning cannot change what a later page of this scan reports.
|
|
272
|
-
*/
|
|
273
239
|
export async function scanAgentSessions(directory, query, options = {}) {
|
|
274
240
|
const state = await loadSessionQueryState(directory, () => (options.store ?? new SessionStore(directory)).list());
|
|
275
241
|
const now = options.now ?? Date.now();
|
|
@@ -296,9 +262,6 @@ export async function getAgentSession(directory, sessionId, historyLimit = 0, hi
|
|
|
296
262
|
throw new SessionQueryError('INVALID_SESSION_ID', 'sessionId must be a valid UUID.');
|
|
297
263
|
nonnegativeInt(historyLimit, 'historyLimit', 20);
|
|
298
264
|
nonnegativeInt(historyOffset, 'historyOffset', 100_000);
|
|
299
|
-
// One locked load serves both the views and the turn excerpts: a second read
|
|
300
|
-
// can race deletion or a new turn and yield contradictory data, and crash
|
|
301
|
-
// pruning sees exactly the snapshot the answer is built from.
|
|
302
265
|
const state = await loadSessionQueryState(directory, () => store.list());
|
|
303
266
|
const session = state.all.find(item => item.id === sessionId);
|
|
304
267
|
if (!session)
|
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
import type { SavedSession } from './sessions.js';
|
|
2
2
|
export declare const DAY_MS: number;
|
|
3
|
-
/** What one pass of the auto-archive reaper changes: sessions to file away, and its own filings to undo. */
|
|
4
3
|
export interface AutoArchivePlan {
|
|
5
4
|
archive: string[];
|
|
6
5
|
restore: string[];
|
|
7
6
|
}
|
|
8
|
-
/**
|
|
9
|
-
* Whether a session has gone `days` without activity.
|
|
10
|
-
*
|
|
11
|
-
* `updatedAt` is the session's activity clock: archiving and unarchiving deliberately leave it alone,
|
|
12
|
-
* so the reaper's own filing never makes a session look newer or older than its work.
|
|
13
|
-
*/
|
|
14
7
|
export declare function idleFor(session: Pick<SavedSession, 'updatedAt'>, days: number, now: number): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* One reaper pass over the saved sessions.
|
|
17
|
-
*
|
|
18
|
-
* A working session idle for `days` is archived. A session the reaper archived itself — and only
|
|
19
|
-
* that, never one the user archived — goes back to the rail once it no longer meets the threshold:
|
|
20
|
-
* the setting was raised (1 day → 7 days) or turned off (`days` undefined). `busy` names sessions the
|
|
21
|
-
* pass must leave alone, such as one with a run in flight or a wake still armed.
|
|
22
|
-
*/
|
|
23
8
|
export declare function planAutoArchive(sessions: readonly Pick<SavedSession, 'id' | 'updatedAt' | 'archived' | 'autoArchived'>[], days: number | undefined, now: number, busy?: (id: string) => boolean): AutoArchivePlan;
|
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
export const DAY_MS = 24 * 60 * 60 * 1000;
|
|
2
|
-
/**
|
|
3
|
-
* Whether a session has gone `days` without activity.
|
|
4
|
-
*
|
|
5
|
-
* `updatedAt` is the session's activity clock: archiving and unarchiving deliberately leave it alone,
|
|
6
|
-
* so the reaper's own filing never makes a session look newer or older than its work.
|
|
7
|
-
*/
|
|
8
2
|
export function idleFor(session, days, now) {
|
|
9
3
|
const updated = Date.parse(session.updatedAt);
|
|
10
4
|
return Number.isFinite(updated) && now - updated >= days * DAY_MS;
|
|
11
5
|
}
|
|
12
|
-
/**
|
|
13
|
-
* One reaper pass over the saved sessions.
|
|
14
|
-
*
|
|
15
|
-
* A working session idle for `days` is archived. A session the reaper archived itself — and only
|
|
16
|
-
* that, never one the user archived — goes back to the rail once it no longer meets the threshold:
|
|
17
|
-
* the setting was raised (1 day → 7 days) or turned off (`days` undefined). `busy` names sessions the
|
|
18
|
-
* pass must leave alone, such as one with a run in flight or a wake still armed.
|
|
19
|
-
*/
|
|
20
6
|
export function planAutoArchive(sessions, days, now, busy = () => false) {
|
|
21
7
|
const plan = { archive: [], restore: [] };
|
|
22
8
|
for (const session of sessions) {
|
|
@@ -1,75 +1,46 @@
|
|
|
1
1
|
import { type SkillInvocation } from './extensions.js';
|
|
2
2
|
import type { Config } from './config.js';
|
|
3
|
-
/**
|
|
4
|
-
* The skill a session's user invoked with a slash command, kept for the session's later messages.
|
|
5
|
-
*
|
|
6
|
-
* `/diorama …` used to apply to the one message that carried it: the next message ran without the
|
|
7
|
-
* skill, so the agent worked from its memory of the previous answer and skipped what the skill
|
|
8
|
-
* requires (its intake questions, its definition of done). The invocation is now the session's:
|
|
9
|
-
* every later message inherits it until the user pauses it, removes it, or invokes another skill,
|
|
10
|
-
* which replaces it. Only a slash invocation is kept — a skill the model loaded on its own stays
|
|
11
|
-
* with the run that loaded it.
|
|
12
|
-
*
|
|
13
|
-
* The record is a file of its own beside the session, as the pull request is, rather than a field
|
|
14
|
-
* of the session record: a run rewrites the whole record when it finishes, from the copy it read
|
|
15
|
-
* when it started, and a pause the user made while the run was working would be undone by it.
|
|
16
|
-
*/
|
|
17
3
|
export interface SessionSkill {
|
|
18
|
-
/** The catalog id the invocation resolved to, which is what the run inherits. */
|
|
19
4
|
id: string;
|
|
20
|
-
/** The arguments the user gave with the invocation, so later messages can see what it was for. */
|
|
21
5
|
args: string;
|
|
22
|
-
/** Paused by the user: kept, and shown, but not applied until resumed. */
|
|
23
6
|
paused: boolean;
|
|
24
|
-
/** When the user invoked it, ISO 8601. */
|
|
25
7
|
invokedAt: string;
|
|
26
8
|
}
|
|
27
9
|
export declare const sessionSkillsDirectory: (home: string) => string;
|
|
28
10
|
export declare function isSessionSkill(value: unknown): value is SessionSkill;
|
|
29
|
-
|
|
30
|
-
export declare function
|
|
31
|
-
/** Written through a temporary file and a rename, so a reader in another engine never sees half a record. */
|
|
32
|
-
export declare function writeSessionSkill(home: string, sessionId: string, skill: SessionSkill): Promise<void>;
|
|
11
|
+
export declare function readSessionSkills(home: string, sessionId: string): Promise<SessionSkill[]>;
|
|
12
|
+
export declare function writeSessionSkills(home: string, sessionId: string, skills: SessionSkill[]): Promise<void>;
|
|
33
13
|
export declare function removeSessionSkill(home: string, sessionId: string): Promise<void>;
|
|
34
|
-
|
|
35
|
-
export declare function setSessionSkillPaused(home: string, sessionId: string, paused: boolean): Promise<SessionSkill | undefined>;
|
|
36
|
-
/** Give a forked session the skill its parent had, so a resumed conversation keeps applying it. */
|
|
14
|
+
export declare function setSessionSkillPaused(home: string, sessionId: string, paused: boolean): Promise<SessionSkill[]>;
|
|
37
15
|
export declare function copySessionSkill(home: string, fromSessionId: string, toSessionId: string): Promise<void>;
|
|
38
|
-
/** A fresh record for a slash invocation the user just sent. */
|
|
39
16
|
export declare function invokedSessionSkill(id: string, args: string, now?: Date): SessionSkill;
|
|
17
|
+
export declare function sessionSkillInstruction(skill: SessionSkill): string;
|
|
40
18
|
/**
|
|
41
|
-
* The
|
|
42
|
-
*
|
|
43
|
-
* invoked with describe the first message, not this one.
|
|
19
|
+
* The `sessions.skill.*` result and `session.skill.updated` payload. `skill` (the first active skill,
|
|
20
|
+
* or null) keeps desktops built before multi-skill support working against this engine.
|
|
44
21
|
*/
|
|
45
|
-
export declare function
|
|
46
|
-
|
|
22
|
+
export declare function sessionSkillsPayload(skills: SessionSkill[]): {
|
|
23
|
+
skills: SessionSkill[];
|
|
24
|
+
skill: SessionSkill | null;
|
|
25
|
+
};
|
|
26
|
+
export declare function sessionSkillsInstruction(skills: readonly SessionSkill[]): string;
|
|
47
27
|
export interface RunSkill {
|
|
48
28
|
id: string;
|
|
49
29
|
instruction: string;
|
|
50
30
|
source: 'invoked' | 'session';
|
|
51
31
|
}
|
|
52
|
-
/**
|
|
53
|
-
* The skill a message runs with. A slash invocation is the message's own and becomes the
|
|
54
|
-
* session's, replacing any earlier one. Without one, the session's skill applies unless the user
|
|
55
|
-
* paused it — and only while it can still be loaded: a skill removed or turned off since it was
|
|
56
|
-
* invoked is reported and left out, rather than failing a message that never asked for it.
|
|
57
|
-
*/
|
|
58
32
|
export declare function skillForRun(options: {
|
|
59
|
-
|
|
33
|
+
invocations?: SkillInvocation[];
|
|
60
34
|
home: string;
|
|
61
35
|
sessionId?: string;
|
|
62
36
|
config: Config;
|
|
63
37
|
signal?: AbortSignal;
|
|
64
38
|
now?: Date;
|
|
65
39
|
}): Promise<{
|
|
66
|
-
|
|
67
|
-
|
|
40
|
+
skills?: RunSkill[];
|
|
41
|
+
instruction?: string;
|
|
42
|
+
recorded?: SessionSkill[];
|
|
68
43
|
notice?: string;
|
|
69
44
|
}>;
|
|
70
45
|
export declare const SESSION_SKILL_USAGE = "Usage: /skill [on|off|remove]";
|
|
71
|
-
/**
|
|
72
|
-
* The terminal's `/skill` command: show the session's active skill, pause it (`off`), resume it
|
|
73
|
-
* (`on`), or end it (`remove`). Changes apply from the next message.
|
|
74
|
-
*/
|
|
75
46
|
export declare function sessionSkillCommand(home: string, sessionId: string | undefined, line: string): Promise<string>;
|