@andorra-labs/code 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/account-presentation.d.ts +1 -37
- package/dist/src/account-presentation.js +6 -43
- 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 +347 -554
- 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 +11 -155
- 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/andorra/endpoint.d.ts +7 -0
- package/dist/src/andorra/endpoint.js +46 -0
- package/dist/src/andorra/entry.d.ts +21 -0
- package/dist/src/andorra/entry.js +100 -0
- package/dist/src/andorra/errors.d.ts +2 -0
- package/dist/src/andorra/errors.js +39 -0
- package/dist/src/andorra/hosted.d.ts +52 -0
- package/dist/src/andorra/hosted.js +126 -0
- package/dist/src/andorra/monitor.d.ts +151 -0
- package/dist/src/andorra/monitor.js +393 -0
- package/dist/src/andorra/notices.d.ts +7 -0
- package/dist/src/andorra/notices.js +15 -0
- package/dist/src/andorra/opt-in.d.ts +58 -0
- package/dist/src/andorra/opt-in.js +112 -0
- package/dist/src/andorra/request-watch.d.ts +6 -0
- package/dist/src/andorra/request-watch.js +10 -0
- package/dist/src/andorra/state.d.ts +86 -0
- package/dist/src/andorra/state.js +238 -0
- package/dist/src/andorra/terminal.d.ts +68 -0
- package/dist/src/andorra/terminal.js +125 -0
- package/dist/src/andorra/usage-format.d.ts +9 -0
- package/dist/src/andorra/usage-format.js +19 -0
- 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 +9 -29
- package/dist/src/app-server/protocol.d.ts +18 -246
- 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 +52 -925
- package/dist/src/app-server.js +828 -3076
- 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 +9 -93
- package/dist/src/auth/AuthManager.js +164 -186
- 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 +1 -16
- package/dist/src/auth/deployment.js +1 -16
- package/dist/src/auth/index.d.ts +1 -12
- package/dist/src/auth/index.js +1 -12
- package/dist/src/auth/lock.d.ts +0 -1
- package/dist/src/auth/lock.js +0 -1
- package/dist/src/auth/store.d.ts +33 -108
- package/dist/src/auth/store.js +55 -130
- 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 +1 -37
- package/dist/src/browser-panel-tool.js +3 -73
- package/dist/src/browser-runner.d.ts +0 -1
- package/dist/src/browser-runner.js +5 -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 +19 -13
- package/dist/src/browser-stealth.js +22 -38
- 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 +15 -97
- package/dist/src/browser-view.d.ts +106 -295
- package/dist/src/browser-view.js +551 -587
- 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 +155 -63
- 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 +1 -55
- package/dist/src/cli.js +118 -742
- package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +4 -59
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +26 -99
- 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 +0 -28
- package/dist/src/codex-rpc.d.ts +0 -10
- package/dist/src/codex-rpc.js +0 -12
- package/dist/src/coding-tools.d.ts +4 -26
- package/dist/src/coding-tools.js +161 -181
- 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 +41 -1
- package/dist/src/command-screens.js +316 -113
- package/dist/src/commands.d.ts +12 -63
- package/dist/src/commands.js +98 -127
- package/dist/src/completion-gates.d.ts +0 -47
- package/dist/src/completion-gates.js +0 -14
- package/dist/src/completion.d.ts +0 -98
- package/dist/src/completion.js +2 -239
- package/dist/src/config.d.ts +15 -115
- package/dist/src/config.js +123 -172
- 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 +2 -2
- package/dist/src/dashboard-view.js +11 -37
- 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 +2 -6
- 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 +1 -2
- package/dist/src/decision/toolMenu.d.ts +0 -3
- package/dist/src/decision/toolMenu.js +0 -4
- package/dist/src/decision/types.d.ts +1 -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 +4 -130
- package/dist/src/diff-preview.d.ts +0 -1
- package/dist/src/diff-preview.js +0 -17
- 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 +0 -9
- package/dist/src/extensions.d.ts +3 -2
- package/dist/src/extensions.js +63 -35
- 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 +0 -7
- package/dist/src/file-read-key.js +0 -7
- 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 +0 -3
- package/dist/src/graph-health.d.ts +9 -61
- package/dist/src/graph-health.js +34 -59
- package/dist/src/graph-manager-chat.d.ts +36 -153
- package/dist/src/graph-manager-chat.js +161 -182
- 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 +58 -391
- package/dist/src/graph-selection.d.ts +0 -14
- package/dist/src/graph-selection.js +2 -15
- package/dist/src/graph-server.d.ts +2 -10
- package/dist/src/graph-server.js +39 -101
- 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 +176 -492
- package/dist/src/graph-ui/compat.js +0 -7
- package/dist/src/graph-ui/controls.css +0 -48
- 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 +0 -8
- 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 +1 -78
- package/dist/src/graph-ui/manager.css +0 -18
- package/dist/src/graph-ui/manager.js +43 -185
- package/dist/src/graph-ui/model-picker.js +0 -29
- 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 +16 -136
- package/dist/src/graph-ui/theme.js +1 -26
- package/dist/src/graph-ui/tokens.css +19 -118
- package/dist/src/graphs.d.ts +6 -157
- package/dist/src/graphs.js +66 -269
- 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 +9 -47
- 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 +0 -99
- package/dist/src/mcp.js +4 -170
- package/dist/src/membership-errors.d.ts +0 -14
- package/dist/src/membership-errors.js +1 -14
- package/dist/src/membership.d.ts +9 -59
- package/dist/src/membership.js +20 -91
- 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 +5 -40
- package/dist/src/memory/ProjectMemory.js +22 -47
- package/dist/src/memory/ToolFailureLessons.d.ts +0 -3
- package/dist/src/memory/ToolFailureLessons.js +0 -6
- 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-context-windows.d.ts +2 -0
- package/dist/src/model-context-windows.js +24 -0
- package/dist/src/model-health-cache.d.ts +0 -38
- package/dist/src/model-health-cache.js +2 -50
- package/dist/src/model-metadata.d.ts +1 -18
- package/dist/src/model-metadata.js +42 -45
- 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 +1 -16
- package/dist/src/package-name.d.ts +0 -2
- package/dist/src/package-name.js +0 -2
- package/dist/src/paged-transcript.d.ts +0 -11
- package/dist/src/paged-transcript.js +2 -20
- package/dist/src/palette.d.ts +1 -63
- package/dist/src/palette.js +1 -64
- package/dist/src/permissions.d.ts +0 -15
- package/dist/src/permissions.js +17 -21
- 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 +15 -39
- package/dist/src/provider-engine.d.ts +0 -21
- package/dist/src/provider-engine.js +1 -96
- 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 +16 -3
- package/dist/src/provider-settings.js +36 -52
- package/dist/src/providers.d.ts +14 -219
- package/dist/src/providers.js +69 -326
- 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 +1 -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 +107 -422
- 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 +0 -18
- package/dist/src/remote/cert.js +0 -44
- package/dist/src/remote/client.d.ts +0 -70
- package/dist/src/remote/client.js +1 -116
- 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 +22 -339
- 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 +0 -4
- package/dist/src/remote/pem.js +0 -4
- 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 +2 -9
- package/dist/src/run-control.js +9 -13
- 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 +14 -687
- package/dist/src/run-temp.d.ts +12 -0
- package/dist/src/run-temp.js +50 -0
- package/dist/src/runtime.d.ts +12 -228
- package/dist/src/runtime.js +2 -128
- 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 +3 -122
- 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 +0 -39
- package/dist/src/sign-in-detection.js +0 -43
- package/dist/src/sign-in-offer.d.ts +1 -19
- package/dist/src/sign-in-offer.js +0 -13
- 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/errors.md +1 -1
- package/dist/src/skills/bundled/provenance.json +738 -738
- 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 +0 -13
- package/dist/src/skills/runtime-skills.js +0 -37
- package/dist/src/stall-recovery.d.ts +0 -25
- package/dist/src/stall-recovery.js +0 -38
- package/dist/src/stray-files.d.ts +0 -9
- package/dist/src/stray-files.js +0 -16
- package/dist/src/structured-step.d.ts +0 -22
- package/dist/src/structured-step.js +0 -22
- package/dist/src/subagent-run.d.ts +2 -163
- package/dist/src/subagent-run.js +18 -376
- 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 +3 -84
- 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 +33 -521
- package/dist/src/terminal-ui.js +145 -884
- 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 +0 -7
- 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 +0 -6
- package/dist/src/tool-schema-compatibility.js +0 -9
- 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 +0 -41
- package/dist/src/transcript.js +5 -60
- package/dist/src/types.d.ts +4 -168
- package/dist/src/untracked-file-removal.js +0 -20
- package/dist/src/update-check.d.ts +0 -14
- package/dist/src/update-check.js +1 -15
- package/dist/src/update.d.ts +0 -35
- package/dist/src/update.js +0 -100
- 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 +0 -16
- package/dist/src/workspace-git-metadata.js +0 -21
- package/dist/src/workspace-instructions.d.ts +3 -15
- package/dist/src/workspace-instructions.js +6 -19
- package/package.json +13 -2
package/dist/src/side-panel.js
CHANGED
|
@@ -2,52 +2,14 @@ import stringWidth from 'string-width';
|
|
|
2
2
|
import { stripVTControlCharacters } from 'node:util';
|
|
3
3
|
import { ATTENTION, FAINT, GRAY, STATUS, SUBTLE, WHITE, accentSgr } from './palette.js';
|
|
4
4
|
import { formatHms } from './duration.js';
|
|
5
|
-
|
|
5
|
+
import { subagentChangeWord, subagentRunning, subagentStatusWord } from './subagent-tree.js';
|
|
6
6
|
export const panelRowText = (row) => row.segments.map(segment => segment.text).join('');
|
|
7
|
-
/**
|
|
8
|
-
* Visible columns the terminal needs before the panel is worth drawing.
|
|
9
|
-
*
|
|
10
|
-
* The panel claims roughly a third of the width, so below this the chat column would drop
|
|
11
|
-
* under about 77 columns: narrow enough that the transcript's own wrapping and the command
|
|
12
|
-
* popup degrade, which is a worse trade than losing the panel.
|
|
13
|
-
*/
|
|
14
7
|
export const PANEL_MIN_COLUMNS = 110;
|
|
15
|
-
/**
|
|
16
|
-
* Rows the panel needs before it is drawn.
|
|
17
|
-
*
|
|
18
|
-
* The floor is the tallest fixed stack the panel can reach - the Git section's four rows,
|
|
19
|
-
* the Node section's four, and the progress summary's three, plus the rules between them -
|
|
20
|
-
* so a terminal that shows the panel always has room for every section that cannot shrink.
|
|
21
|
-
*/
|
|
22
8
|
export const PANEL_MIN_ROWS = 14;
|
|
23
|
-
/**
|
|
24
|
-
* Total columns the panel occupies at a given terminal width, divider included.
|
|
25
|
-
*
|
|
26
|
-
* A fixed share keeps the panel's measurements stable as the terminal grows while the clamps
|
|
27
|
-
* stop it from becoming a second chat column on very wide terminals or a sliver on the
|
|
28
|
-
* narrowest ones that still show it.
|
|
29
|
-
*/
|
|
30
9
|
export const panelWidth = (columns) => Math.min(44, Math.max(28, Math.floor(columns * 0.3)));
|
|
31
|
-
/**
|
|
32
|
-
* Whether the selected graph is a custom one.
|
|
33
|
-
*
|
|
34
|
-
* The built-in Andorra Agent harness is stored under `'default'` (and answers to its own
|
|
35
|
-
* id when a graph file was never written), so both spell the default; anything else is a
|
|
36
|
-
* user-authored graph, which is what the zoom section exists for.
|
|
37
|
-
*/
|
|
38
10
|
export const isCustomGraph = (selection, graph) => (selection ?? (graph?.id === 'software-engineer' ? 'default' : graph?.id)) !== 'default';
|
|
39
11
|
const compact = Intl.NumberFormat('en', { notation: 'compact', maximumFractionDigits: 1 });
|
|
40
12
|
const count = (value) => compact.format(Math.max(0, Math.round(value)));
|
|
41
|
-
/**
|
|
42
|
-
* Flatten one value to a single paintable line.
|
|
43
|
-
*
|
|
44
|
-
* Panel values come from outside the render pass: a `qa.terminal` command, a graph node name,
|
|
45
|
-
* a plan item, a branch. A newline or an escape sequence in any of them would otherwise be
|
|
46
|
-
* written into the full-screen frame as itself - breaking the row arithmetic at best, driving
|
|
47
|
-
* the terminal at worst - so every value is stripped of control characters and flattened
|
|
48
|
-
* before it is measured, clipped or painted. Spacing is preserved: the panel's own alignment
|
|
49
|
-
* is made of it.
|
|
50
|
-
*/
|
|
51
13
|
const flat = (text) => stripVTControlCharacters(String(text))
|
|
52
14
|
.replace(/[\x00-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/g, ' ');
|
|
53
15
|
function clip(text, width) {
|
|
@@ -69,14 +31,6 @@ function clip(text, width) {
|
|
|
69
31
|
const row = (...segments) => ({
|
|
70
32
|
segments: segments.map(segment => typeof segment === 'string' ? { text: flat(segment) } : { text: flat(segment.text), ...(segment.color === undefined ? {} : { color: segment.color }) }),
|
|
71
33
|
});
|
|
72
|
-
/**
|
|
73
|
-
* A row with a label on the left and a value or values right-aligned against the panel edge.
|
|
74
|
-
*
|
|
75
|
-
* The value keeps its own segments, so a row can pair a green `+120` with a red `-8`. When
|
|
76
|
-
* the two cannot both fit, the row degrades to one clipped line rather than letting the value
|
|
77
|
-
* run under the panel's edge: the panel is a fixed width, so a row that cannot fit is a row
|
|
78
|
-
* that must lose something.
|
|
79
|
-
*/
|
|
80
34
|
function pair(label, values, width) {
|
|
81
35
|
const valueWidth = values.reduce((total, segment) => total + stringWidth(flat(segment.text)), 0);
|
|
82
36
|
const gap = width - stringWidth(flat(label.text)) - valueWidth;
|
|
@@ -84,9 +38,7 @@ function pair(label, values, width) {
|
|
|
84
38
|
return row({ text: clip([label.text, ...values.map(value => value.text)].join(' '), width), color: label.color });
|
|
85
39
|
return values.length ? row(label, { text: ' '.repeat(gap) }, ...values) : row(label);
|
|
86
40
|
}
|
|
87
|
-
/** A section heading with an optional right-aligned value, e.g. `Plan 6/14`. */
|
|
88
41
|
const heading = (title, width, right = []) => pair({ text: title, color: SUBTLE }, right, width);
|
|
89
|
-
/** The faint rule that separates one section from the one above it. */
|
|
90
42
|
const rule = (width) => row({ text: '─'.repeat(Math.max(1, width)), color: FAINT });
|
|
91
43
|
const plural = (value, word) => `${value} ${word}${value === 1 ? '' : 's'}`;
|
|
92
44
|
function gitSection(data, width) {
|
|
@@ -97,8 +49,6 @@ function gitSection(data, width) {
|
|
|
97
49
|
body.push(row({ text: 'Reading working tree…', color: FAINT }));
|
|
98
50
|
else if (!changes.isGit)
|
|
99
51
|
body.push(row({ text: 'Not a Git repository', color: FAINT }));
|
|
100
|
-
// A withheld reading comes first: its counts are zero because nothing was measured, and the
|
|
101
|
-
// clean-tree branch below would turn that into the one thing it is not.
|
|
102
52
|
else if (changes.skipped || changes.unavailable)
|
|
103
53
|
body.push(pair(label, [{ text: 'no counts', color: FAINT }], width));
|
|
104
54
|
else if (!changes.files && !changes.untracked && !changes.insertions && !changes.deletions)
|
|
@@ -110,8 +60,6 @@ function gitSection(data, width) {
|
|
|
110
60
|
{ text: `-${count(changes.deletions)}`, color: changes.deletions ? STATUS.error : GRAY },
|
|
111
61
|
], width));
|
|
112
62
|
if (changes?.isGit) {
|
|
113
|
-
// The summary's own read names the branch, so the row and the counts always describe the
|
|
114
|
-
// same repository; a read that could not name one falls back to the session's reader.
|
|
115
63
|
const branch = changes.branch ?? data.branch;
|
|
116
64
|
body.push(row({ text: '⎇ ', color: SUBTLE }, { text: clip(branch ?? 'detached', width - 2), color: GRAY }));
|
|
117
65
|
if (changes.skipped)
|
|
@@ -138,9 +86,6 @@ function nodeSection(data, width) {
|
|
|
138
86
|
body.push(row({ text: clip(` ${focus.detail}`, width), color: GRAY }));
|
|
139
87
|
if (focus.model)
|
|
140
88
|
body.push(row({ text: clip(` ${focus.model}`, width), color: FAINT }));
|
|
141
|
-
// A parallel run can have several nodes working at once, but the section keeps a fixed
|
|
142
|
-
// height so the packing above it can promise the panel never outgrows the terminal: the
|
|
143
|
-
// follower nodes are worth one line together, not one line each.
|
|
144
89
|
if (rest.length)
|
|
145
90
|
body.push(row({ text: clip(` +${rest.length} more running: ${rest.map(node => node.name).join(', ')}`, width), color: FAINT }));
|
|
146
91
|
return [heading('Step', width), ...body];
|
|
@@ -153,32 +98,15 @@ function progressSection(data, width) {
|
|
|
153
98
|
const active = data.todos.filter(todo => todo.status === 'in_progress').length;
|
|
154
99
|
const waiting = total - done - active;
|
|
155
100
|
const share = done / total;
|
|
156
|
-
// The bar is sized from the row it shares with the percentage, so the pair always fits one
|
|
157
|
-
// row; a single filled cell still shows at least one percent of movement.
|
|
158
101
|
const label = `${Math.round(share * 100)}%`;
|
|
159
102
|
const barWidth = Math.max(3, width - stringWidth(label) - 1);
|
|
160
|
-
// A nonzero share fills at least one cell: `floor` rounds a small plan's first step (1 of 100) to
|
|
161
|
-
// nothing, which drew an empty bar beside a percentage that says otherwise.
|
|
162
103
|
const filled = share >= 1 ? barWidth : share > 0 ? Math.max(1, Math.min(barWidth, Math.floor(share * barWidth))) : 0;
|
|
163
104
|
return [
|
|
164
105
|
heading('Progress', width),
|
|
165
|
-
// Progress is neutral, as the window draws it: the accent fill on a faint track. Green is a
|
|
166
|
-
// passed check, and a plan two-thirds done has passed nothing yet.
|
|
167
106
|
row({ text: '█'.repeat(filled), color: accentSgr() }, { text: '░'.repeat(barWidth - filled), color: FAINT }, { text: ' ' }, { text: label, color: GRAY }),
|
|
168
107
|
row({ text: clip(`${done} done · ${active} active · ${waiting} waiting`, width), color: GRAY }),
|
|
169
108
|
];
|
|
170
109
|
}
|
|
171
|
-
/**
|
|
172
|
-
* The current plan: its completed count, the items in progress, what comes next, and a count
|
|
173
|
-
* of whatever did not fit.
|
|
174
|
-
*
|
|
175
|
-
* The list is the elastic section - it absorbs whatever the fixed sections leave - so the
|
|
176
|
-
* rows are ordered by importance rather than by position in the plan: the item being worked
|
|
177
|
-
* on is what the reader checks, while the completed and waiting lines are context. Items fill
|
|
178
|
-
* every row the budget allows; only a plan longer than that is cut, and the cut is named on
|
|
179
|
-
* its own line. `rows` is the whole section's budget, heading included; below two rows
|
|
180
|
-
* nothing is worth drawing.
|
|
181
|
-
*/
|
|
182
110
|
function planSection(data, width, rows) {
|
|
183
111
|
if (rows < 2 || !data.todos.length)
|
|
184
112
|
return [];
|
|
@@ -188,13 +116,8 @@ function planSection(data, width, rows) {
|
|
|
188
116
|
const pending = data.todos.filter(todo => todo.status === 'pending');
|
|
189
117
|
const budget = rows - 1;
|
|
190
118
|
const doneRow = done ? 1 : 0;
|
|
191
|
-
// A plan that fits is listed whole. One that does not gives a row to the line naming the cut,
|
|
192
|
-
// unless that row is the only one there is: a single item says more than a count does.
|
|
193
119
|
const fits = active.length + doneRow + pending.length <= budget;
|
|
194
120
|
const room = fits ? budget : Math.max(1, budget - 1);
|
|
195
|
-
// The completed count shares the items' room, so it is taken out before any item is placed:
|
|
196
|
-
// appended afterwards it would land on the row the cut line needs. A cut list keeps it only
|
|
197
|
-
// beside at least one item - the heading already carries the same count.
|
|
198
121
|
const doneShown = fits || room >= 2 ? doneRow : 0;
|
|
199
122
|
const shownActive = active.slice(0, Math.max(0, room - doneShown));
|
|
200
123
|
for (const todo of shownActive)
|
|
@@ -204,37 +127,25 @@ function planSection(data, width, rows) {
|
|
|
204
127
|
const shownPending = pending.slice(0, Math.max(0, room - shownActive.length - doneShown));
|
|
205
128
|
for (const todo of shownPending)
|
|
206
129
|
body.push(row({ text: '○ ', color: SUBTLE }, { text: clip(todo.text, width - 2), color: GRAY }));
|
|
207
|
-
// Every item the budget left out is named, active ones included: the Progress row above counts all of
|
|
208
|
-
// them, so a list that showed two of three active items and said only "1 waiting" would hide the
|
|
209
|
-
// third entirely.
|
|
210
130
|
const omitted = [
|
|
211
131
|
active.length > shownActive.length ? `${active.length - shownActive.length} more active` : '',
|
|
212
132
|
pending.length > shownPending.length ? `${pending.length - shownPending.length} waiting` : '',
|
|
213
133
|
].filter(Boolean);
|
|
214
|
-
// Clipped like every other row: the line can now name two omissions, and a narrow panel must not
|
|
215
|
-
// overflow on it.
|
|
216
134
|
if (omitted.length)
|
|
217
135
|
body.push(row({ text: clip(`… ${omitted.join(' · ')}`, width), color: FAINT }));
|
|
218
136
|
if (!body.length)
|
|
219
137
|
body.push(row({ text: `${done}/${data.todos.length} done`, color: GRAY }));
|
|
220
138
|
return [heading('Plan', width, [{ text: `${done}/${data.todos.length}`, color: GRAY }]), ...body.slice(0, budget)];
|
|
221
139
|
}
|
|
222
|
-
/** `12s`, `5m 20s`, `1h 4m 9s` - the age a background terminal has been running. */
|
|
223
140
|
export function panelDuration(milliseconds) {
|
|
224
141
|
return formatHms(milliseconds / 1000);
|
|
225
142
|
}
|
|
226
143
|
function terminalSection(data, width) {
|
|
227
144
|
if (!data.terminals.length)
|
|
228
145
|
return [];
|
|
229
|
-
// Running sessions come first: the manager keeps a naturally exited session until it is
|
|
230
|
-
// stopped explicitly, so insertion order would let three finished sessions hide the one
|
|
231
|
-
// process that is still alive - the row a reader actually needs - behind `+N more`.
|
|
232
146
|
const ordered = [...data.terminals].sort((left, right) => Number(right.running) - Number(left.running));
|
|
233
147
|
const body = ordered.slice(0, 3).map(session => {
|
|
234
148
|
const age = session.running && session.startedAt !== undefined ? ` · ${panelDuration(data.now - session.startedAt)}` : '';
|
|
235
|
-
// The age is what the row exists for, so it is reserved before the command is clipped: a
|
|
236
|
-
// long test-runner invocation must lose its own tail, not the elapsed time a reader is
|
|
237
|
-
// watching while the row keeps repainting for it.
|
|
238
149
|
const life = clip(`${session.id} · ${session.command}`, Math.max(1, width - 2 - stringWidth(age)));
|
|
239
150
|
return row({ text: session.running ? '● ' : '○ ', color: session.running ? accentSgr() : FAINT }, { text: life, color: session.running ? GRAY : FAINT }, { text: age, color: session.running ? GRAY : FAINT });
|
|
240
151
|
});
|
|
@@ -242,15 +153,69 @@ function terminalSection(data, width) {
|
|
|
242
153
|
body.push(row({ text: ` +${ordered.length - body.length} more`, color: FAINT }));
|
|
243
154
|
return [heading('Terminals', width), ...body];
|
|
244
155
|
}
|
|
156
|
+
function agentMark(entry) {
|
|
157
|
+
if (subagentRunning(entry))
|
|
158
|
+
return { text: '● ', color: accentSgr() };
|
|
159
|
+
if (entry.status === 'succeeded')
|
|
160
|
+
return { text: '✓ ', color: SUBTLE };
|
|
161
|
+
if (entry.status === 'stopped' || entry.status === 'cancelled')
|
|
162
|
+
return { text: '■ ', color: FAINT };
|
|
163
|
+
return { text: '✗ ', color: STATUS.error };
|
|
164
|
+
}
|
|
165
|
+
export const AGENT_SECTION_MAX_ROWS = 10;
|
|
166
|
+
export const agentTreeNaturalRows = (groups) => groups?.length ? 1 + groups.length + groups.reduce((sum, group) => sum + group.agents.length, 0) : 0;
|
|
167
|
+
export function subagentTreeRows(groups, width, rows, now) {
|
|
168
|
+
const all = groups.flatMap(group => group.agents);
|
|
169
|
+
if (!all.length || rows < 2)
|
|
170
|
+
return [];
|
|
171
|
+
const settled = all.filter(entry => !subagentRunning(entry)).length;
|
|
172
|
+
const head = heading('Agents', width, [{ text: `${settled}/${all.length}`, color: GRAY }]);
|
|
173
|
+
const hidden = new Set();
|
|
174
|
+
const visibleGroups = () => groups.filter(group => group.agents.some(entry => !hidden.has(entry)));
|
|
175
|
+
const natural = () => 1 + visibleGroups().length + all.length - hidden.size;
|
|
176
|
+
if (natural() > rows) {
|
|
177
|
+
const budget = rows - 1;
|
|
178
|
+
const finished = all.filter(entry => !subagentRunning(entry));
|
|
179
|
+
const working = all.filter(subagentRunning).reverse();
|
|
180
|
+
for (const entry of [...finished, ...working]) {
|
|
181
|
+
if (natural() <= budget)
|
|
182
|
+
break;
|
|
183
|
+
hidden.add(entry);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const body = [];
|
|
187
|
+
for (const group of visibleGroups()) {
|
|
188
|
+
const shown = group.agents.filter(entry => !hidden.has(entry));
|
|
189
|
+
const working = group.agents.some(subagentRunning);
|
|
190
|
+
body.push(row({ text: working ? '● ' : '✓ ', color: working ? accentSgr() : SUBTLE }, { text: clip(group.name, width - 2), color: working ? WHITE : GRAY }));
|
|
191
|
+
shown.forEach((entry, index) => {
|
|
192
|
+
const connector = `${index === shown.length - 1 ? '└─' : '├─'}${' '.repeat(Math.max(0, entry.depth - 1))}`;
|
|
193
|
+
const mark = agentMark(entry);
|
|
194
|
+
const elapsed = formatHms(((subagentRunning(entry) ? now : entry.endedAt ?? now) - entry.startedAt) / 1000);
|
|
195
|
+
const word = subagentStatusWord(entry);
|
|
196
|
+
const change = subagentChangeWord(entry.change);
|
|
197
|
+
const lead = stringWidth(connector) + stringWidth(mark.text);
|
|
198
|
+
const tails = [
|
|
199
|
+
[elapsed, word, change].filter(Boolean).join(' '),
|
|
200
|
+
[elapsed, change].filter(Boolean).join(' '),
|
|
201
|
+
elapsed,
|
|
202
|
+
'',
|
|
203
|
+
];
|
|
204
|
+
const nameFloor = Math.min(6, stringWidth(entry.label));
|
|
205
|
+
const tail = tails.find(text => !text || lead + nameFloor + 1 + stringWidth(text) <= width) ?? '';
|
|
206
|
+
const nameRoom = Math.max(1, width - lead - (tail ? stringWidth(tail) + 1 : 0));
|
|
207
|
+
const name = clip(entry.label, nameRoom);
|
|
208
|
+
const gap = Math.max(tail ? 1 : 0, width - lead - stringWidth(name) - stringWidth(tail));
|
|
209
|
+
body.push(row({ text: connector, color: FAINT }, mark, { text: name, color: subagentRunning(entry) ? WHITE : GRAY }, ...(tail ? [{ text: ' '.repeat(gap) }, { text: tail, color: subagentRunning(entry) ? GRAY : FAINT }] : [])));
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
if (hidden.size) {
|
|
213
|
+
const running = [...hidden].filter(subagentRunning).length;
|
|
214
|
+
body.push(row({ text: clip(`… +${hidden.size} more${running ? ` · ${running} running` : ''}`, width), color: FAINT }));
|
|
215
|
+
}
|
|
216
|
+
return [head, ...body].slice(0, rows);
|
|
217
|
+
}
|
|
245
218
|
const MARK = (visited, active, id) => active.has(id) ? { glyph: '●', color: accentSgr() } : visited.has(id) ? { glyph: '✓', color: SUBTLE } : { glyph: '○', color: FAINT };
|
|
246
|
-
/**
|
|
247
|
-
* The zoomed view of the graph section the run is in: what leads into the current node and
|
|
248
|
-
* what it hands off to, with every node marked as visited, current, or not yet reached.
|
|
249
|
-
*
|
|
250
|
-
* Only a custom graph gets this: the built-in harness is a single agent node, and a zoom of
|
|
251
|
-
* it would say nothing a `Step` row does not already say. Neighbours are capped so a hub node
|
|
252
|
-
* cannot push the panel's other sections off the screen.
|
|
253
|
-
*/
|
|
254
219
|
function graphSection(data, width) {
|
|
255
220
|
const graph = data.graph;
|
|
256
221
|
if (!data.customGraph || !graph)
|
|
@@ -260,39 +225,24 @@ function graphSection(data, width) {
|
|
|
260
225
|
const focusOf = (id) => graph.nodes[id]?.name ?? id;
|
|
261
226
|
const focus = data.nodes[0]?.id ?? data.stoppedNode ?? [...data.visited].at(-1) ?? graph.entry;
|
|
262
227
|
const incoming = [...new Set(graph.edges.filter(edge => edge.target === focus && edge.source !== focus).map(edge => edge.source))];
|
|
263
|
-
// Self-targeting edges are hand-offs too: a bounded retry (a node with `maxNodeVisits` routing
|
|
264
|
-
// back to itself) is an outcome of this node, and dropping it would present the node as having
|
|
265
|
-
// no such route at all.
|
|
266
228
|
const outgoing = graph.edges.filter(edge => edge.source === focus);
|
|
267
229
|
const body = [];
|
|
268
|
-
// A join node can have more inputs than the cap shows; the hidden remainder is reported
|
|
269
|
-
// before the rows it was cut from, so a five-input join does not read as a two-input one.
|
|
270
230
|
if (incoming.length > 2)
|
|
271
231
|
body.push(row({ text: ` +${incoming.length - 2} more upstream`, color: FAINT }));
|
|
272
232
|
for (const id of incoming.slice(-2)) {
|
|
273
233
|
const mark = MARK(visited, active, id);
|
|
274
234
|
body.push(row({ text: '▲ ', color: FAINT }, { text: `${mark.glyph} `, color: mark.color }, { text: clip(focusOf(id), width - 4), color: GRAY }));
|
|
275
235
|
}
|
|
276
|
-
// The focus row is the marker the whole zoom is read against: `●` while a node is running,
|
|
277
|
-
// where a run ended (completed or stopped mid-node), and the same `○` an unreached node
|
|
278
|
-
// carries while the panel is idle and the focus is only the graph's entry - the row must not
|
|
279
|
-
// claim a position nothing has reached yet.
|
|
280
236
|
const stopped = data.stoppedNode === focus;
|
|
281
237
|
const focusGlyph = active.has(focus) || visited.has(focus) || stopped ? '●' : '○';
|
|
282
|
-
// A run that stopped on a node it had visited earlier is a stopped position, not a completed
|
|
283
|
-
// one: the bold stopped marker outranks the historical visit.
|
|
284
238
|
const focusColor = active.has(focus) ? accentSgr() : stopped ? ATTENTION : visited.has(focus) ? SUBTLE : FAINT;
|
|
285
239
|
body.push(row({ text: `${focusGlyph} `, color: focusColor }, { text: clip(focusOf(focus), width - 2), color: active.has(focus) ? WHITE : GRAY }));
|
|
286
|
-
// Distinct routes are distinct rows even when they lead to the same node: a QA node can hand off
|
|
287
|
-
// to one End through `pass` and through `fail`, and collapsing them by target would hide one.
|
|
288
240
|
const routes = [...new Map(outgoing.map(edge => [`${edge.target}\u0000${edge.outcome ?? ''}`, edge])).values()];
|
|
289
241
|
const unique = routes.slice(0, 3);
|
|
290
242
|
unique.forEach((edge, index) => {
|
|
291
243
|
const mark = MARK(visited, active, edge.target);
|
|
292
244
|
const loop = edge.target === focus;
|
|
293
245
|
const label = edge.outcome ? `${focusOf(edge.target)} · ${edge.outcome}` : focusOf(edge.target);
|
|
294
|
-
// A loop is drawn with its own arrow so a retry back to this node is not mistaken for a
|
|
295
|
-
// hand-off to a neighbour that happens to share its name.
|
|
296
246
|
body.push(row({ text: `${index === unique.length - 1 ? '└─' : '├─'}${loop ? '↻' : '▶'} `, color: FAINT }, { text: `${mark.glyph} `, color: mark.color }, { text: clip(label, width - 6), color: GRAY }));
|
|
297
247
|
});
|
|
298
248
|
const hidden = routes.length - unique.length;
|
|
@@ -300,18 +250,6 @@ function graphSection(data, width) {
|
|
|
300
250
|
body.push(row({ text: ` +${hidden} more`, color: FAINT }));
|
|
301
251
|
return [heading('Graph', width, [{ text: `${visited.size}/${Object.keys(graph.nodes).length}`, color: GRAY }]), ...body];
|
|
302
252
|
}
|
|
303
|
-
/**
|
|
304
|
-
* The panel's rows, top to bottom, for a terminal of `columns` x `height`.
|
|
305
|
-
*
|
|
306
|
-
* Sections are anchored: Git tools, Step, Progress and the plan read from the top, while the
|
|
307
|
-
* terminal list and the graph zoom are held against the bottom - the reader asked for the graph
|
|
308
|
-
* section to be at the bottom of the panel - with whatever rows the top sections leave as blank
|
|
309
|
-
* space between them, so a tall terminal does not park the zoom in the middle of the screen.
|
|
310
|
-
* The panel never outgrows the terminal: the plan list is elastic and takes only what the fixed
|
|
311
|
-
* sections leave, and when even those overflow, whole sections are given up from the bottom
|
|
312
|
-
* upward - the zoom first, then the terminal list - because the sections above them are read on
|
|
313
|
-
* every run while those two describe states that come and go.
|
|
314
|
-
*/
|
|
315
253
|
export function sidePanelRows(data, columns, height) {
|
|
316
254
|
const width = Math.max(8, Math.floor(columns));
|
|
317
255
|
if (height < PANEL_MIN_ROWS || width < 8)
|
|
@@ -321,14 +259,14 @@ export function sidePanelRows(data, columns, height) {
|
|
|
321
259
|
const progress = progressSection(data, width);
|
|
322
260
|
let terminals = terminalSection(data, width);
|
|
323
261
|
let graph = graphSection(data, width);
|
|
262
|
+
let agentBudget = Math.min(AGENT_SECTION_MAX_ROWS, agentTreeNaturalRows(data.agents));
|
|
263
|
+
let agents = data.agents?.length ? subagentTreeRows(data.agents, width, agentBudget, data.now) : [];
|
|
324
264
|
let plan = [];
|
|
325
|
-
// Total rows a set of sections occupies once the rules between them are counted.
|
|
326
265
|
const total = (sections) => sections.reduce((sum, rows) => sum + rows.length, 0)
|
|
327
266
|
+ Math.max(0, sections.length - 1);
|
|
328
|
-
// The plan's own rule and heading, before it can show a single item.
|
|
329
267
|
const PLAN_OVERHEAD = 2;
|
|
330
268
|
for (;;) {
|
|
331
|
-
const anchored = [git, node, progress, terminals, graph].filter(rows => rows.length);
|
|
269
|
+
const anchored = [git, node, progress, agents, terminals, graph].filter(rows => rows.length);
|
|
332
270
|
const room = height - total(anchored) - (data.todos.length ? PLAN_OVERHEAD : 0);
|
|
333
271
|
if (room >= 0) {
|
|
334
272
|
plan = data.todos.length && room >= 1 ? planSection(data, width, room + 1) : [];
|
|
@@ -342,12 +280,19 @@ export function sidePanelRows(data, columns, height) {
|
|
|
342
280
|
terminals = [];
|
|
343
281
|
continue;
|
|
344
282
|
}
|
|
345
|
-
|
|
346
|
-
|
|
283
|
+
if (agents.length > 2) {
|
|
284
|
+
agentBudget = Math.max(2, agents.length + room);
|
|
285
|
+
agents = subagentTreeRows(data.agents ?? [], width, agentBudget, data.now);
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
if (agents.length) {
|
|
289
|
+
agents = [];
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
347
292
|
plan = [];
|
|
348
293
|
break;
|
|
349
294
|
}
|
|
350
|
-
const top = [git, node, progress, plan].filter(rows => rows.length);
|
|
295
|
+
const top = [git, node, progress, agents, plan].filter(rows => rows.length);
|
|
351
296
|
const bottom = [terminals, graph].filter(rows => rows.length);
|
|
352
297
|
const assemble = (groups) => groups.filter(rows => rows.length)
|
|
353
298
|
.flatMap((rows, index) => index === 0 ? rows : [rule(width), ...rows]);
|
|
@@ -355,8 +300,6 @@ export function sidePanelRows(data, columns, height) {
|
|
|
355
300
|
const bottomRows = bottom.length ? [rule(width), ...assemble(bottom)] : [];
|
|
356
301
|
if (!bottomRows.length)
|
|
357
302
|
return topRows;
|
|
358
|
-
// The rows nobody claimed sit between the two groups; without them the bottom sections would
|
|
359
|
-
// simply follow the plan, which is where they already were before they were anchored.
|
|
360
303
|
const gap = Array.from({ length: Math.max(0, height - topRows.length - bottomRows.length) }, () => ({ segments: [] }));
|
|
361
304
|
return [...topRows, ...gap, ...bottomRows];
|
|
362
305
|
}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import type { Config } from './config.js';
|
|
2
2
|
import type { ProviderConfig } from './providers.js';
|
|
3
|
-
/**
|
|
4
|
-
* Finding the vendor CLIs a person is already signed in to, and turning the ones they pick into
|
|
5
|
-
* provider entries.
|
|
6
|
-
*
|
|
7
|
-
* These four provider types run through the CLI's own login, so nothing here reads, copies or stores
|
|
8
|
-
* a credential: detection asks each CLI what it would tell its own user, and an import writes a
|
|
9
|
-
* configuration entry that names the type. Only display text and model ids leave this module.
|
|
10
|
-
*/
|
|
11
3
|
export declare const DETECTABLE_SIGN_IN_TYPES: readonly ["claude", "codex", "grok", "opencode"];
|
|
12
4
|
export type DetectableSignInType = typeof DETECTABLE_SIGN_IN_TYPES[number];
|
|
13
5
|
export declare function isDetectableSignInType(value: unknown): value is DetectableSignInType;
|
|
14
|
-
/** One signed-in CLI with no provider yet. `model` is the preselection; OpenCode never has one. */
|
|
15
6
|
export interface DetectedSignIn {
|
|
16
7
|
type: DetectableSignInType;
|
|
17
8
|
email?: string;
|
|
@@ -20,7 +11,6 @@ export interface DetectedSignIn {
|
|
|
20
11
|
models: string[];
|
|
21
12
|
model?: string;
|
|
22
13
|
}
|
|
23
|
-
/** What one CLI says about itself, before any of it is trusted for display. */
|
|
24
14
|
export interface SignInProbe {
|
|
25
15
|
signedIn: boolean;
|
|
26
16
|
email?: string;
|
|
@@ -31,51 +21,22 @@ export interface SignInProbe {
|
|
|
31
21
|
}
|
|
32
22
|
export type SignInProbes = Record<DetectableSignInType, (signal: AbortSignal) => Promise<SignInProbe>>;
|
|
33
23
|
export interface DetectOptions {
|
|
34
|
-
/** Types to leave alone: no process is started for them. Unknown names are ignored. */
|
|
35
24
|
skip?: readonly string[];
|
|
36
25
|
probes?: Partial<SignInProbes>;
|
|
37
|
-
/** The bound on each probe; the slowest reader bounds itself at 45 seconds. */
|
|
38
26
|
timeoutMs?: number;
|
|
39
27
|
}
|
|
40
28
|
export interface DetectionResult {
|
|
41
29
|
signIns: DetectedSignIn[];
|
|
42
30
|
timedOut: DetectableSignInType[];
|
|
43
31
|
}
|
|
44
|
-
/**
|
|
45
|
-
* The readers the product already uses, each behind a look for its executable.
|
|
46
|
-
*
|
|
47
|
-
* The resolvers only inspect the machine — none installs or downloads — so a CLI that is absent
|
|
48
|
-
* answers signed-out without a process being started for it.
|
|
49
|
-
*/
|
|
50
32
|
export declare function defaultSignInProbes(): SignInProbes;
|
|
51
|
-
/**
|
|
52
|
-
* Ask every CLI that has no provider yet whether it is signed in.
|
|
53
|
-
*
|
|
54
|
-
* Each probe stands alone: one that fails, is absent or outlives the bound contributes nothing and
|
|
55
|
-
* never fails the call. A type that already has a provider is not asked — for Codex that is any
|
|
56
|
-
* Codex provider, since a second one is always given a fresh, signed-out account slot.
|
|
57
|
-
*/
|
|
58
33
|
export declare function detectSignIns(config: Pick<Config, 'providers'>, signal: AbortSignal, options?: DetectOptions): Promise<DetectionResult>;
|
|
59
34
|
export interface SignInImport {
|
|
60
35
|
type: DetectableSignInType;
|
|
61
36
|
model: string;
|
|
62
37
|
}
|
|
63
|
-
/** The provider entry for one detected sign-in with the model the person chose from its catalog. */
|
|
64
38
|
export declare function importedProvider(detected: DetectedSignIn, model: string, taken: (id: string) => boolean): ProviderConfig;
|
|
65
|
-
/**
|
|
66
|
-
* Whether the active provider could start a task as configured. Only two things say it could not:
|
|
67
|
-
* there is no active provider, or it names a key variable that is unset and holds no saved key. A
|
|
68
|
-
* provider that asks for no key at all (a local server, a private gateway) is someone's deliberate
|
|
69
|
-
* choice and is never displaced by an import.
|
|
70
|
-
*/
|
|
71
39
|
export declare function providerCanRun(config: Pick<Config, 'provider' | 'providers'>, env?: NodeJS.ProcessEnv): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* The configuration after importing the chosen sign-ins.
|
|
74
|
-
*
|
|
75
|
-
* A type that gained a provider since detection is skipped rather than duplicated: the file is
|
|
76
|
-
* shared with other windows and the CLI. The first entry added becomes the active provider only
|
|
77
|
-
* when the current one could not start a task.
|
|
78
|
-
*/
|
|
79
40
|
export declare function applySignInImports(config: Config, detected: readonly DetectedSignIn[], imports: readonly SignInImport[], env?: NodeJS.ProcessEnv): {
|
|
80
41
|
config: Config;
|
|
81
42
|
added: string[];
|
|
@@ -7,31 +7,16 @@ import { connectCodex } from './codex-rpc.js';
|
|
|
7
7
|
import { GROK_BASE_URL, GROK_EXECUTABLE, readGrokCatalog } from './grok-provider.js';
|
|
8
8
|
import { OPENCODE_BASE_URL, OPENCODE_EXECUTABLE, readOpenCodeCatalog, sharedOpenCodeServer } from './opencode-cli-provider.js';
|
|
9
9
|
import { uniqueProviderId } from './provider-import.js';
|
|
10
|
-
/**
|
|
11
|
-
* Finding the vendor CLIs a person is already signed in to, and turning the ones they pick into
|
|
12
|
-
* provider entries.
|
|
13
|
-
*
|
|
14
|
-
* These four provider types run through the CLI's own login, so nothing here reads, copies or stores
|
|
15
|
-
* a credential: detection asks each CLI what it would tell its own user, and an import writes a
|
|
16
|
-
* configuration entry that names the type. Only display text and model ids leave this module.
|
|
17
|
-
*/
|
|
18
10
|
export const DETECTABLE_SIGN_IN_TYPES = ['claude', 'codex', 'grok', 'opencode'];
|
|
19
11
|
export function isDetectableSignInType(value) {
|
|
20
12
|
return DETECTABLE_SIGN_IN_TYPES.includes(value);
|
|
21
13
|
}
|
|
22
14
|
const SIGNED_OUT = { signedIn: false, models: [] };
|
|
23
15
|
const MAX_MODELS = 5000;
|
|
24
|
-
/** OpenCode lists every model of every upstream provider it has connected; no entry stores all of them. */
|
|
25
16
|
const FIXED_BASE_URL = {
|
|
26
17
|
claude: 'https://api.anthropic.com', codex: 'https://chatgpt.com/backend-api/codex', grok: GROK_BASE_URL, opencode: OPENCODE_BASE_URL,
|
|
27
18
|
};
|
|
28
19
|
const DISPLAY_NAME = { claude: 'Claude', codex: 'ChatGPT', grok: 'Grok', opencode: 'OpenCode' };
|
|
29
|
-
/**
|
|
30
|
-
* The readers the product already uses, each behind a look for its executable.
|
|
31
|
-
*
|
|
32
|
-
* The resolvers only inspect the machine — none installs or downloads — so a CLI that is absent
|
|
33
|
-
* answers signed-out without a process being started for it.
|
|
34
|
-
*/
|
|
35
20
|
export function defaultSignInProbes() {
|
|
36
21
|
const present = async (resolve) => { try {
|
|
37
22
|
await resolve();
|
|
@@ -44,8 +29,6 @@ export function defaultSignInProbes() {
|
|
|
44
29
|
claude: async (signal) => {
|
|
45
30
|
if (!await present(() => resolveClaudeExecutable()))
|
|
46
31
|
return SIGNED_OUT;
|
|
47
|
-
// Side by side rather than one after the other: each is its own CLI start, and the TUI's whole
|
|
48
|
-
// look is bounded in seconds.
|
|
49
32
|
const [account, catalog] = await Promise.all([readClaudeSignIn(signal), readClaudeCatalog(signal)]);
|
|
50
33
|
if (!account.signedIn || !catalog.signedIn)
|
|
51
34
|
return SIGNED_OUT;
|
|
@@ -55,9 +38,6 @@ export function defaultSignInProbes() {
|
|
|
55
38
|
codex: async (signal) => {
|
|
56
39
|
if (!await present(() => resolveCodexExecutable({ signal })))
|
|
57
40
|
return SIGNED_OUT;
|
|
58
|
-
// The default home: a detected login is the one the person's own codex command uses. The
|
|
59
|
-
// connection is this probe's own and follows its signal, so a look that is abandoned stops the
|
|
60
|
-
// app-server it started instead of leaving it to finish on its own clock.
|
|
61
41
|
const rpc = await connectCodex(signal);
|
|
62
42
|
try {
|
|
63
43
|
const account = (await rpc.request('account/read', { refreshToken: false }))?.account;
|
|
@@ -112,17 +92,9 @@ function describe(type, probe) {
|
|
|
112
92
|
const email = displayText(probe.email, 320);
|
|
113
93
|
const planType = displayText(probe.planType, 100);
|
|
114
94
|
const detail = displayText(probe.detail, 200);
|
|
115
|
-
// OpenCode's catalog spans upstream providers the person may pay for per use: choosing one is theirs.
|
|
116
95
|
const model = type === 'opencode' ? undefined : probe.defaultModel !== undefined && models.includes(probe.defaultModel) ? probe.defaultModel : models[0];
|
|
117
96
|
return { type, ...(email ? { email } : {}), ...(planType ? { planType } : {}), ...(detail ? { detail } : {}), models, ...(model ? { model } : {}) };
|
|
118
97
|
}
|
|
119
|
-
/**
|
|
120
|
-
* Ask every CLI that has no provider yet whether it is signed in.
|
|
121
|
-
*
|
|
122
|
-
* Each probe stands alone: one that fails, is absent or outlives the bound contributes nothing and
|
|
123
|
-
* never fails the call. A type that already has a provider is not asked — for Codex that is any
|
|
124
|
-
* Codex provider, since a second one is always given a fresh, signed-out account slot.
|
|
125
|
-
*/
|
|
126
98
|
export async function detectSignIns(config, signal, options = {}) {
|
|
127
99
|
const probes = { ...(options.probes && DETECTABLE_SIGN_IN_TYPES.every(type => options.probes?.[type]) ? {} : defaultSignInProbes()), ...options.probes };
|
|
128
100
|
const timeoutMs = options.timeoutMs ?? 45_000;
|
|
@@ -133,7 +105,6 @@ export async function detectSignIns(config, signal, options = {}) {
|
|
|
133
105
|
const bounded = AbortSignal.any([signal, deadline]);
|
|
134
106
|
try {
|
|
135
107
|
const probe = await new Promise((resolve, reject) => {
|
|
136
|
-
// A reader that ignores its signal must not hold the call past the bound.
|
|
137
108
|
bounded.addEventListener('abort', () => reject(new Error('aborted')), { once: true });
|
|
138
109
|
if (bounded.aborted) {
|
|
139
110
|
reject(new Error('aborted'));
|
|
@@ -151,32 +122,18 @@ export async function detectSignIns(config, signal, options = {}) {
|
|
|
151
122
|
}));
|
|
152
123
|
return { signIns: found.filter((item) => item !== undefined), timedOut: DETECTABLE_SIGN_IN_TYPES.filter(type => timedOut.includes(type)) };
|
|
153
124
|
}
|
|
154
|
-
/** The provider entry for one detected sign-in with the model the person chose from its catalog. */
|
|
155
125
|
export function importedProvider(detected, model, taken) {
|
|
156
126
|
if (!detected.models.includes(model))
|
|
157
127
|
throw new Error(`${model} is not one of the models ${DISPLAY_NAME[detected.type]} lists.`);
|
|
158
128
|
const models = detected.type === 'opencode' ? [model] : [model, ...detected.models.filter(item => item !== model)];
|
|
159
129
|
return { id: uniqueProviderId(taken, detected.type), type: detected.type, baseUrl: FIXED_BASE_URL[detected.type], model, models, name: DISPLAY_NAME[detected.type] };
|
|
160
130
|
}
|
|
161
|
-
/**
|
|
162
|
-
* Whether the active provider could start a task as configured. Only two things say it could not:
|
|
163
|
-
* there is no active provider, or it names a key variable that is unset and holds no saved key. A
|
|
164
|
-
* provider that asks for no key at all (a local server, a private gateway) is someone's deliberate
|
|
165
|
-
* choice and is never displaced by an import.
|
|
166
|
-
*/
|
|
167
131
|
export function providerCanRun(config, env = process.env) {
|
|
168
132
|
const active = config.providers.find(provider => provider.id === config.provider);
|
|
169
133
|
if (!active)
|
|
170
134
|
return false;
|
|
171
135
|
return !(active.apiKeyEnv && !env[active.apiKeyEnv] && !active.apiKey);
|
|
172
136
|
}
|
|
173
|
-
/**
|
|
174
|
-
* The configuration after importing the chosen sign-ins.
|
|
175
|
-
*
|
|
176
|
-
* A type that gained a provider since detection is skipped rather than duplicated: the file is
|
|
177
|
-
* shared with other windows and the CLI. The first entry added becomes the active provider only
|
|
178
|
-
* when the current one could not start a task.
|
|
179
|
-
*/
|
|
180
137
|
export function applySignInImports(config, detected, imports, env = process.env) {
|
|
181
138
|
const providers = [...config.providers];
|
|
182
139
|
const added = [];
|
|
@@ -1,35 +1,17 @@
|
|
|
1
1
|
import { type DetectionResult } from './sign-in-detection.js';
|
|
2
|
-
/**
|
|
3
|
-
* The terminal's one-time offer to add the vendor CLIs a person is already signed in to.
|
|
4
|
-
*
|
|
5
|
-
* It runs before the interface starts, the way the update offer does, so it is bounded hard: the
|
|
6
|
-
* tools get eight seconds between them, and a tool that does not answer in time is tried again on
|
|
7
|
-
* the next launch, three launches at most. Nothing here may fail startup.
|
|
8
|
-
*/
|
|
9
2
|
export interface SignInOfferState {
|
|
10
3
|
done?: boolean;
|
|
11
|
-
attempts?: number;
|
|
4
|
+
attempts?: number;
|
|
12
5
|
answered?: string[];
|
|
13
6
|
}
|
|
14
7
|
export declare function readSignInOfferState(home?: string): Promise<SignInOfferState>;
|
|
15
8
|
export declare function writeSignInOfferState(state: SignInOfferState, home?: string): Promise<void>;
|
|
16
|
-
/**
|
|
17
|
-
* What a typed answer chooses among `count` listed accounts: every index for an empty answer or
|
|
18
|
-
* yes, `'none'` for no, the named ones for numbers, and undefined for anything else.
|
|
19
|
-
*/
|
|
20
9
|
export declare function parseSignInAnswer(answer: string, count: number): number[] | 'none' | undefined;
|
|
21
10
|
export interface SignInOfferOptions {
|
|
22
11
|
home?: string;
|
|
23
12
|
env?: NodeJS.ProcessEnv;
|
|
24
13
|
ask: (question: string) => Promise<string>;
|
|
25
14
|
write: (text: string) => void;
|
|
26
|
-
/** Overridable so a test never spawns a CLI. */
|
|
27
15
|
detect?: (home: string, signal: AbortSignal, skip: readonly string[]) => Promise<DetectionResult>;
|
|
28
16
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Offer once per configuration home. Returns the ids of the providers added; never throws.
|
|
31
|
-
*
|
|
32
|
-
* OpenCode is named but never added here: its models span upstream providers that may bill per use,
|
|
33
|
-
* and choosing one is what the `/providers` screen is for.
|
|
34
|
-
*/
|
|
35
17
|
export declare function offerSignInImport(options: SignInOfferOptions): Promise<string[]>;
|
|
@@ -30,10 +30,6 @@ export async function writeSignInOfferState(state, home = configDirectory()) {
|
|
|
30
30
|
await writeFile(temporary, JSON.stringify(state) + '\n', 'utf8');
|
|
31
31
|
await rename(temporary, target);
|
|
32
32
|
}
|
|
33
|
-
/**
|
|
34
|
-
* What a typed answer chooses among `count` listed accounts: every index for an empty answer or
|
|
35
|
-
* yes, `'none'` for no, the named ones for numbers, and undefined for anything else.
|
|
36
|
-
*/
|
|
37
33
|
export function parseSignInAnswer(answer, count) {
|
|
38
34
|
const value = answer.trim().toLowerCase();
|
|
39
35
|
if (value === '' || value === 'y' || value === 'yes')
|
|
@@ -55,12 +51,6 @@ function summary(signIn) {
|
|
|
55
51
|
function listed(names) {
|
|
56
52
|
return names.length <= 1 ? names.join('') : `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`;
|
|
57
53
|
}
|
|
58
|
-
/**
|
|
59
|
-
* Offer once per configuration home. Returns the ids of the providers added; never throws.
|
|
60
|
-
*
|
|
61
|
-
* OpenCode is named but never added here: its models span upstream providers that may bill per use,
|
|
62
|
-
* and choosing one is what the `/providers` screen is for.
|
|
63
|
-
*/
|
|
64
54
|
export async function offerSignInImport(options) {
|
|
65
55
|
const home = options.home ?? configDirectory();
|
|
66
56
|
const write = (text) => options.write(plain(text));
|
|
@@ -71,10 +61,8 @@ export async function offerSignInImport(options) {
|
|
|
71
61
|
const attempts = (state.attempts ?? 0) + 1;
|
|
72
62
|
write('Looking for accounts you\'re already signed in to...\n');
|
|
73
63
|
const detect = options.detect ?? (async (directory, signal, skip) => detectSignIns(await loadConfig(directory), signal, { timeoutMs: DETECT_TIMEOUT_MS, skip }));
|
|
74
|
-
// A tool the person already answered about is not looked for again while a slow one is retried.
|
|
75
64
|
const answered = state.answered ?? [];
|
|
76
65
|
const { signIns, timedOut } = await detect(home, AbortSignal.timeout(DETECT_TIMEOUT_MS + 1_000), answered);
|
|
77
|
-
// A tool that ran out of time gets another launch, but not forever.
|
|
78
66
|
const finished = timedOut.length === 0 || attempts >= MAX_ATTEMPTS;
|
|
79
67
|
const addable = signIns.filter(signIn => signIn.type !== 'opencode' && signIn.model !== undefined);
|
|
80
68
|
const settle = (asked = false) => {
|
|
@@ -110,7 +98,6 @@ export async function offerSignInImport(options) {
|
|
|
110
98
|
return added;
|
|
111
99
|
}
|
|
112
100
|
catch {
|
|
113
|
-
// Startup continues exactly as it would have: the offer is a convenience, not a step.
|
|
114
101
|
return [];
|
|
115
102
|
}
|
|
116
103
|
}
|