@andorra-labs/code 0.1.12 → 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/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 +49 -416
- 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 +9 -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 +13 -245
- 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 +27 -927
- package/dist/src/app-server.js +537 -2992
- 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 +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 +4 -45
- 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 +47 -301
- package/dist/src/browser-view.js +333 -582
- 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 +80 -721
- 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 +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 +0 -98
- package/dist/src/completion.js +2 -239
- package/dist/src/config.d.ts +11 -116
- package/dist/src/config.js +39 -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 +0 -10
- 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 +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 +0 -63
- package/dist/src/graph-health.js +0 -57
- package/dist/src/graph-manager-chat.d.ts +5 -155
- package/dist/src/graph-manager-chat.js +2 -177
- 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 +31 -391
- package/dist/src/graph-selection.d.ts +0 -14
- package/dist/src/graph-selection.js +0 -14
- 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 +152 -491
- 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 +3 -180
- 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 +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 +6 -157
- package/dist/src/graphs.js +65 -266
- 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 +0 -99
- package/dist/src/mcp.js +4 -170
- 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 +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-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 +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 +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 +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 +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 +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 +95 -415
- 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 +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 +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 +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 +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 +10 -228
- 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 -122
- package/dist/src/sessions.js +7 -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/provenance.json +1 -1
- 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 +0 -163
- package/dist/src/subagent-run.js +4 -373
- 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 +14 -523
- package/dist/src/terminal-ui.js +74 -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 +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 +2 -60
- package/dist/src/types.d.ts +1 -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 +2 -2
package/dist/src/limits.d.ts
CHANGED
|
@@ -1,77 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Run bounds, and the single spelling of "unlimited".
|
|
3
|
-
*
|
|
4
|
-
* This module is deliberately dependency-free so configuration can describe bounds without
|
|
5
|
-
* importing the runtime that enforces them. Routing that import through `runtime.ts` would
|
|
6
|
-
* close a cycle (`runtime` re-exports the graph runner, which loads the configuration), so the
|
|
7
|
-
* shared vocabulary lives here and both sides depend on it.
|
|
8
|
-
* @module limits
|
|
9
|
-
*/
|
|
10
1
|
export interface Limits {
|
|
11
|
-
/**
|
|
12
|
-
* Model iterations allowed per node attempt. Optional by design: an absent value means
|
|
13
|
-
* no iteration ceiling, so a node keeps working until it completes, another limit stops
|
|
14
|
-
* it, a repeated tool failure trips, or it is cancelled.
|
|
15
|
-
*/
|
|
16
2
|
maxIterations?: number;
|
|
17
|
-
/**
|
|
18
|
-
* Wall-clock budget for the attempt, in milliseconds. Optional by design: an absent value
|
|
19
|
-
* arms no timer at all, so a long task is never stopped merely for taking a long time.
|
|
20
|
-
* Time spent waiting on the user is not charged to it; see `bindUserWaits`.
|
|
21
|
-
*/
|
|
22
3
|
wallTimeMs?: number;
|
|
23
4
|
maxContextChars: number;
|
|
24
5
|
maxCompletionRepairs: number;
|
|
25
|
-
/**
|
|
26
|
-
* Tool calls allowed per node attempt. Optional by design: an absent value means
|
|
27
|
-
* no tool-call ceiling at all, so a run continues until it finishes, another
|
|
28
|
-
* limit stops it, or it is cancelled. Only an explicit value bounds tool calls.
|
|
29
|
-
*/
|
|
30
6
|
maxToolCalls?: number;
|
|
31
7
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Every key `Limits` defines.
|
|
34
|
-
*
|
|
35
|
-
* Merging a node limit needs this list rather than `Object.hasOwn(DEFAULT_LIMITS, key)`:
|
|
36
|
-
* the unlimited-by-default keys are absent from the defaults, and testing the defaults
|
|
37
|
-
* would silently drop an explicitly configured node bound instead of applying it.
|
|
38
|
-
*/
|
|
39
8
|
export declare const LIMIT_KEYS: readonly ["maxIterations", "maxToolCalls", "wallTimeMs", "maxContextChars", "maxCompletionRepairs"];
|
|
40
9
|
export type LimitKey = typeof LIMIT_KEYS[number];
|
|
41
|
-
/**
|
|
42
|
-
* The bundled defaults: no wall clock and no iteration ceiling.
|
|
43
|
-
*
|
|
44
|
-
* A coding task that legitimately runs for hours must not be killed for being slow, and a
|
|
45
|
-
* person reading a question must never be on the clock. Runaway work is still bounded by a
|
|
46
|
-
* repeated tool failure, the context ceiling, an explicit config or graph bound, and
|
|
47
|
-
* cancellation.
|
|
48
|
-
*/
|
|
49
10
|
export declare const DEFAULT_LIMITS: Limits;
|
|
50
|
-
/**
|
|
51
|
-
* Whether a value is the explicit unlimited alias for a key rather than a real bound.
|
|
52
|
-
*
|
|
53
|
-
* Callers that *merge* bounds must consult this. Min-ing a zero alias against an enclosing
|
|
54
|
-
* bound computes zero, which the budget reads as unlimited, so the narrower scope would
|
|
55
|
-
* silently discard a bound it never intended to override instead of leaving it in force.
|
|
56
|
-
* @param key - a `Limits` key.
|
|
57
|
-
* @param value - the configured value.
|
|
58
|
-
* @returns whether the value means unlimited rather than a ceiling.
|
|
59
|
-
*/
|
|
60
11
|
export declare function isUnlimitedAlias(key: string, value: number | undefined): boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Whether a configured bound means "no bound at all".
|
|
63
|
-
*
|
|
64
|
-
* Deliberately a plain boolean rather than a type predicate: this returns true for a literal
|
|
65
|
-
* `0` as well as for `undefined`, so narrowing `value` to `undefined` on a true result would
|
|
66
|
-
* be unsound for callers that received a real zero.
|
|
67
|
-
* @param value - the configured bound, or undefined when unset.
|
|
68
|
-
* @returns whether the bound is unlimited.
|
|
69
|
-
*/
|
|
70
12
|
export declare function isUnlimited(value: number | undefined): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Normalize a caller-supplied bound set into effective limits.
|
|
73
|
-
*
|
|
74
|
-
* @param supplied - partial limits from config, a graph run, or an embedder.
|
|
75
|
-
* @returns complete limits, with every unlimited bound left absent.
|
|
76
|
-
*/
|
|
77
13
|
export declare function resolveLimits(supplied?: Partial<Limits>): Limits;
|
package/dist/src/limits.js
CHANGED
|
@@ -1,77 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Run bounds, and the single spelling of "unlimited".
|
|
3
|
-
*
|
|
4
|
-
* This module is deliberately dependency-free so configuration can describe bounds without
|
|
5
|
-
* importing the runtime that enforces them. Routing that import through `runtime.ts` would
|
|
6
|
-
* close a cycle (`runtime` re-exports the graph runner, which loads the configuration), so the
|
|
7
|
-
* shared vocabulary lives here and both sides depend on it.
|
|
8
|
-
* @module limits
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Every key `Limits` defines.
|
|
12
|
-
*
|
|
13
|
-
* Merging a node limit needs this list rather than `Object.hasOwn(DEFAULT_LIMITS, key)`:
|
|
14
|
-
* the unlimited-by-default keys are absent from the defaults, and testing the defaults
|
|
15
|
-
* would silently drop an explicitly configured node bound instead of applying it.
|
|
16
|
-
*/
|
|
17
1
|
export const LIMIT_KEYS = ['maxIterations', 'maxToolCalls', 'wallTimeMs', 'maxContextChars', 'maxCompletionRepairs'];
|
|
18
|
-
/**
|
|
19
|
-
* The bundled defaults: no wall clock and no iteration ceiling.
|
|
20
|
-
*
|
|
21
|
-
* A coding task that legitimately runs for hours must not be killed for being slow, and a
|
|
22
|
-
* person reading a question must never be on the clock. Runaway work is still bounded by a
|
|
23
|
-
* repeated tool failure, the context ceiling, an explicit config or graph bound, and
|
|
24
|
-
* cancellation.
|
|
25
|
-
*/
|
|
26
2
|
export const DEFAULT_LIMITS = {
|
|
27
|
-
// No implicit character ceiling. The engine resolves its safety allowance from
|
|
28
|
-
// the selected model; explicit configured character limits still tighten it.
|
|
29
3
|
maxContextChars: Number.MAX_SAFE_INTEGER,
|
|
30
|
-
// Each repair is one model turn; exhausting them ends a node whose work may already
|
|
31
|
-
// be done. Two was too thin for small and self-hosted models — one artifact-shaped
|
|
32
|
-
// rejection plus one mis-encoded retry could lose the whole attempt. The coercions
|
|
33
|
-
// in parseCompletion handle the mechanical envelope mistakes; these repairs are the
|
|
34
|
-
// model's own chances for everything else, so they are cheap next to what they save.
|
|
35
4
|
maxCompletionRepairs: 4,
|
|
36
5
|
};
|
|
37
|
-
/**
|
|
38
|
-
* The keys for which a literal `0` means "unlimited" rather than "no allowance".
|
|
39
|
-
*
|
|
40
|
-
* `maxToolCalls` is deliberately excluded: there a zero ceiling is meaningful, permitting a
|
|
41
|
-
* node to complete without tools while refusing every call.
|
|
42
|
-
*/
|
|
43
6
|
const UNLIMITED_ALIASES = ['wallTimeMs', 'maxIterations'];
|
|
44
|
-
/**
|
|
45
|
-
* Whether a value is the explicit unlimited alias for a key rather than a real bound.
|
|
46
|
-
*
|
|
47
|
-
* Callers that *merge* bounds must consult this. Min-ing a zero alias against an enclosing
|
|
48
|
-
* bound computes zero, which the budget reads as unlimited, so the narrower scope would
|
|
49
|
-
* silently discard a bound it never intended to override instead of leaving it in force.
|
|
50
|
-
* @param key - a `Limits` key.
|
|
51
|
-
* @param value - the configured value.
|
|
52
|
-
* @returns whether the value means unlimited rather than a ceiling.
|
|
53
|
-
*/
|
|
54
7
|
export function isUnlimitedAlias(key, value) {
|
|
55
8
|
return value === 0 && UNLIMITED_ALIASES.includes(key);
|
|
56
9
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Whether a configured bound means "no bound at all".
|
|
59
|
-
*
|
|
60
|
-
* Deliberately a plain boolean rather than a type predicate: this returns true for a literal
|
|
61
|
-
* `0` as well as for `undefined`, so narrowing `value` to `undefined` on a true result would
|
|
62
|
-
* be unsound for callers that received a real zero.
|
|
63
|
-
* @param value - the configured bound, or undefined when unset.
|
|
64
|
-
* @returns whether the bound is unlimited.
|
|
65
|
-
*/
|
|
66
10
|
export function isUnlimited(value) {
|
|
67
11
|
return value === undefined || value === 0;
|
|
68
12
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Normalize a caller-supplied bound set into effective limits.
|
|
71
|
-
*
|
|
72
|
-
* @param supplied - partial limits from config, a graph run, or an embedder.
|
|
73
|
-
* @returns complete limits, with every unlimited bound left absent.
|
|
74
|
-
*/
|
|
75
13
|
export function resolveLimits(supplied = {}) {
|
|
76
14
|
const resolved = { ...DEFAULT_LIMITS };
|
|
77
15
|
for (const key of LIMIT_KEYS) {
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
import { CliSignIn, type ManagedSignInState } from './cli-sign-in.js';
|
|
2
2
|
import { type OpenCodeServerLike, type OpenCodeSignInOption } from './opencode-cli-provider.js';
|
|
3
|
-
/** Claude subscription sign-in through the official Claude Code CLI's own login. */
|
|
4
3
|
export declare function claudeSignIn(): CliSignIn;
|
|
5
|
-
/** Grok subscription sign-in through the Grok CLI's device-code login, which opens no browser itself. */
|
|
6
4
|
export declare function grokSignIn(): CliSignIn;
|
|
7
|
-
/** OpenCode's state: the upstream providers it has connected, and the browser sign-ins it offers. */
|
|
8
5
|
export interface OpenCodeSignInState extends ManagedSignInState {
|
|
9
6
|
connected?: {
|
|
10
7
|
id: string;
|
|
11
8
|
name: string;
|
|
12
9
|
}[];
|
|
13
10
|
signInOptions?: OpenCodeSignInOption[];
|
|
14
|
-
/** The upstream provider the attempt in progress signs in to. */
|
|
15
11
|
signInProvider?: string;
|
|
16
12
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Sign-in to an upstream provider inside OpenCode, through its local server.
|
|
19
|
-
*
|
|
20
|
-
* OpenCode runs the OAuth exchange and stores the credential where its CLI keeps it; Andorra asks
|
|
21
|
-
* the server to begin, opens the page it names, and waits for — or forwards the code to — its
|
|
22
|
-
* callback. The connected providers are whatever OpenCode reports afterwards.
|
|
23
|
-
*/
|
|
24
13
|
export declare class OpenCodeSignIn {
|
|
25
14
|
private readonly server;
|
|
26
15
|
private attempt?;
|
|
@@ -32,7 +21,6 @@ export declare class OpenCodeSignIn {
|
|
|
32
21
|
private finish;
|
|
33
22
|
submitCode(attemptId: string, code: string): Promise<OpenCodeSignInState>;
|
|
34
23
|
cancel(attemptId: string): Promise<OpenCodeSignInState>;
|
|
35
|
-
/** Sign one upstream provider out of OpenCode. */
|
|
36
24
|
logout(providerId: unknown): Promise<OpenCodeSignInState>;
|
|
37
25
|
close(): Promise<void>;
|
|
38
26
|
}
|
|
@@ -4,7 +4,6 @@ import { claudeEnvironment, readClaudeSignIn } from './claude-provider.js';
|
|
|
4
4
|
import { resolveClaudeExecutable } from './claude-executable.js';
|
|
5
5
|
import { GROK_EXECUTABLE, grokEnvironment, readGrokCatalog } from './grok-provider.js';
|
|
6
6
|
import { authorizeOpenCode, completeOpenCode, listOpenCodeSignIns, readOpenCodeCatalog, sharedOpenCodeServer, signOutOpenCode, } from './opencode-cli-provider.js';
|
|
7
|
-
/** Claude subscription sign-in through the official Claude Code CLI's own login. */
|
|
8
7
|
export function claudeSignIn() {
|
|
9
8
|
return new CliSignIn({
|
|
10
9
|
product: 'Claude',
|
|
@@ -17,7 +16,6 @@ export function claudeSignIn() {
|
|
|
17
16
|
acceptsCode: true,
|
|
18
17
|
});
|
|
19
18
|
}
|
|
20
|
-
/** Grok subscription sign-in through the Grok CLI's device-code login, which opens no browser itself. */
|
|
21
19
|
export function grokSignIn() {
|
|
22
20
|
return new CliSignIn({
|
|
23
21
|
product: 'Grok',
|
|
@@ -30,13 +28,6 @@ export function grokSignIn() {
|
|
|
30
28
|
deviceCode: true,
|
|
31
29
|
});
|
|
32
30
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Sign-in to an upstream provider inside OpenCode, through its local server.
|
|
35
|
-
*
|
|
36
|
-
* OpenCode runs the OAuth exchange and stores the credential where its CLI keeps it; Andorra asks
|
|
37
|
-
* the server to begin, opens the page it names, and waits for — or forwards the code to — its
|
|
38
|
-
* callback. The connected providers are whatever OpenCode reports afterwards.
|
|
39
|
-
*/
|
|
40
31
|
export class OpenCodeSignIn {
|
|
41
32
|
server;
|
|
42
33
|
attempt;
|
|
@@ -60,7 +51,6 @@ export class OpenCodeSignIn {
|
|
|
60
51
|
const overview = await this.overview(AbortSignal.timeout(45_000));
|
|
61
52
|
if (attemptId !== undefined && attempt)
|
|
62
53
|
return { ...attempt.view, ...overview };
|
|
63
|
-
// OpenCode is usable as soon as it serves a model, including its own free tier.
|
|
64
54
|
return { state: overview.connected?.length ? 'signedIn' : 'signedOut', ...overview };
|
|
65
55
|
}
|
|
66
56
|
catch (error) {
|
|
@@ -92,12 +82,9 @@ export class OpenCodeSignIn {
|
|
|
92
82
|
return { ...attempt.view };
|
|
93
83
|
}
|
|
94
84
|
attempt.mode = authorization.method;
|
|
95
|
-
// A device flow (GitHub Copilot, for one) names the code to confirm inside its instructions; it
|
|
96
|
-
// is lifted out so the panel can show it as prominently as a CLI's own device code.
|
|
97
85
|
const userCode = authorization.instructions?.match(/\b([A-Z0-9]{4,5}-[A-Z0-9]{4,5})\b/)?.[1];
|
|
98
86
|
attempt.view = { state: 'waiting', attemptId, signInProvider: providerId, ...(authorization.method === 'code' ? { acceptsCode: true } : {}),
|
|
99
87
|
...(userCode ? { userCode } : {}), ...(authorization.instructions ? { message: authorization.instructions } : {}) };
|
|
100
|
-
// The automatic flow completes on OpenCode's own loopback callback; this call returns when it has.
|
|
101
88
|
if (authorization.method === 'auto')
|
|
102
89
|
void this.finish(attempt, undefined);
|
|
103
90
|
return { ...attempt.view, authUrl: authorization.url };
|
|
@@ -127,8 +114,6 @@ export class OpenCodeSignIn {
|
|
|
127
114
|
const value = code.trim();
|
|
128
115
|
if (!value || value.length > 2000 || /[\s\u0000-\u001f\u007f]/.test(value))
|
|
129
116
|
return { ...attempt.view, message: 'That code is not valid. Copy the whole code from the sign-in page.' };
|
|
130
|
-
// The exchange can outlast a request's deadline, so it finishes in the background and the
|
|
131
|
-
// panel's status polling reports the result.
|
|
132
117
|
attempt.submitted = true;
|
|
133
118
|
attempt.view = { ...attempt.view, acceptsCode: undefined, message: 'Checking the code with OpenCode…' };
|
|
134
119
|
void this.finish(attempt, value);
|
|
@@ -145,7 +130,6 @@ export class OpenCodeSignIn {
|
|
|
145
130
|
}
|
|
146
131
|
return { ...attempt.view };
|
|
147
132
|
}
|
|
148
|
-
/** Sign one upstream provider out of OpenCode. */
|
|
149
133
|
async logout(providerId) {
|
|
150
134
|
if (this.attempt?.live)
|
|
151
135
|
return { state: 'error', reason: 'busy', message: 'An OpenCode sign-in is in progress. Finish or cancel it before signing out.' };
|
package/dist/src/markdown.d.ts
CHANGED
|
@@ -1,36 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Render the markdown an agent writes into the plain text the transcript shows.
|
|
3
|
-
*
|
|
4
|
-
* The transcript paints whole lines, never spans, and picks colors from trusted
|
|
5
|
-
* presentation markers rather than provider-supplied ANSI. Markdown therefore
|
|
6
|
-
* becomes text that carries those markers: fenced code loses its fences and
|
|
7
|
-
* gains a `┆` gutter that reads as code, headings become `▌` lines, emphasis
|
|
8
|
-
* markers are dropped, and links collapse to label plus target. Prose without
|
|
9
|
-
* markdown passes through byte-identical, so non-markdown messages render
|
|
10
|
-
* exactly as they did before this module existed.
|
|
11
|
-
*
|
|
12
|
-
* Code blocks collapse in the summary view when they are long by line count or
|
|
13
|
-
* total size, with the full rendering returned as `detail` — the same contract
|
|
14
|
-
* truncated tool output already uses, which the terminal binds to Ctrl+O.
|
|
15
|
-
*/
|
|
16
1
|
export interface RenderedMarkdown {
|
|
17
2
|
text: string;
|
|
18
3
|
detail?: string;
|
|
19
4
|
}
|
|
20
|
-
/** Gutter prefix marking a rendered code-block line; `transcriptColor` maps it to gray. */
|
|
21
5
|
export declare const CODE_GUTTER = "\u2506";
|
|
22
|
-
/** Prefix marking a rendered heading line; `transcriptColor` maps it to white. */
|
|
23
6
|
export declare const HEADING_PREFIX = "\u258C";
|
|
24
|
-
/**
|
|
25
|
-
* Whether a line ends the paragraph, so emphasis or a code span cannot span across it. Exported so
|
|
26
|
-
* completion parsing finds the same multi-line code spans the transcript renders.
|
|
27
|
-
*/
|
|
28
7
|
export declare const interruptsParagraph: (line: string) => boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Render an agent message for the transcript.
|
|
31
|
-
* @param source - the message text, already stripped of control characters, with outer
|
|
32
|
-
* blank lines removed but first-line indentation preserved (it may be fence indentation).
|
|
33
|
-
* @returns the summary text, plus the full rendering as `detail` when any code
|
|
34
|
-
* block was collapsed.
|
|
35
|
-
*/
|
|
36
8
|
export declare function renderMarkdown(source: string): RenderedMarkdown;
|
package/dist/src/markdown.js
CHANGED
|
@@ -1,53 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Render the markdown an agent writes into the plain text the transcript shows.
|
|
3
|
-
*
|
|
4
|
-
* The transcript paints whole lines, never spans, and picks colors from trusted
|
|
5
|
-
* presentation markers rather than provider-supplied ANSI. Markdown therefore
|
|
6
|
-
* becomes text that carries those markers: fenced code loses its fences and
|
|
7
|
-
* gains a `┆` gutter that reads as code, headings become `▌` lines, emphasis
|
|
8
|
-
* markers are dropped, and links collapse to label plus target. Prose without
|
|
9
|
-
* markdown passes through byte-identical, so non-markdown messages render
|
|
10
|
-
* exactly as they did before this module existed.
|
|
11
|
-
*
|
|
12
|
-
* Code blocks collapse in the summary view when they are long by line count or
|
|
13
|
-
* total size, with the full rendering returned as `detail` — the same contract
|
|
14
|
-
* truncated tool output already uses, which the terminal binds to Ctrl+O.
|
|
15
|
-
*/
|
|
16
1
|
import { clipText } from './text.js';
|
|
17
|
-
/** Gutter prefix marking a rendered code-block line; `transcriptColor` maps it to gray. */
|
|
18
2
|
export const CODE_GUTTER = '┆';
|
|
19
|
-
/** Prefix marking a rendered heading line; `transcriptColor` maps it to white. */
|
|
20
3
|
export const HEADING_PREFIX = '▌';
|
|
21
|
-
/** A code block longer than this many lines collapses in the summary view. */
|
|
22
4
|
const COLLAPSE_OVER = 8;
|
|
23
|
-
/** A code block whose content exceeds this many characters also collapses: a minified or
|
|
24
|
-
* base64 single line would otherwise wrap into thousands of transcript rows. */
|
|
25
5
|
const COLLAPSE_CHARS = 1_200;
|
|
26
|
-
/** Leading code-block lines kept when a block collapses. */
|
|
27
6
|
const COLLAPSE_KEEP = 3;
|
|
28
|
-
/** Kept code lines are clipped to this width so one giant line cannot flood the summary. */
|
|
29
7
|
const COLLAPSE_CLIP = 240;
|
|
30
8
|
const FENCE = /^( {0,3})(`{3,}|~{3,})(.*)$/;
|
|
31
|
-
/**
|
|
32
|
-
* A line's opening code fence, or null for prose. GFM rejects a backtick fence whose
|
|
33
|
-
* info string contains a backtick — such a line is ordinary text, not a fence, and
|
|
34
|
-
* treating it as one would gutter everything after it.
|
|
35
|
-
*/
|
|
36
9
|
function openingFence(line) {
|
|
37
10
|
const match = FENCE.exec(line);
|
|
38
11
|
if (match && match[2][0] === '`' && match[3].includes('`'))
|
|
39
12
|
return null;
|
|
40
13
|
return match;
|
|
41
14
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Split a message into prose, fenced-code, and indented-code segments. Fences are ``` or ~~~
|
|
44
|
-
* runs at the start of a line (up to three leading spaces, per GFM); the closing fence
|
|
45
|
-
* uses the same character and is at least as long. An unclosed fence runs to the
|
|
46
|
-
* end of the message: a truncated response still deserves readable code rather
|
|
47
|
-
* than a stray literal fence. A four-space-indented run after a blank line (or at
|
|
48
|
-
* the message start) is an indented code block, which CommonMark forbids from
|
|
49
|
-
* interrupting a paragraph — that is why only those positions start one.
|
|
50
|
-
*/
|
|
51
15
|
function parseSegments(source) {
|
|
52
16
|
const segments = [];
|
|
53
17
|
const lines = source.split('\n');
|
|
@@ -64,8 +28,6 @@ function parseSegments(source) {
|
|
|
64
28
|
flushProse();
|
|
65
29
|
const marker = opening[2][0];
|
|
66
30
|
const closing = new RegExp(`^ {0,3}${marker}{${opening[2].length},}[ \t]*$`);
|
|
67
|
-
// GFM strips up to the opening fence's own indentation from every content line, so
|
|
68
|
-
// an indented opener does not leak its spaces into the rendered (and copied) code.
|
|
69
31
|
const dedent = new RegExp(`^ {0,${opening[1].length}}`);
|
|
70
32
|
index++;
|
|
71
33
|
const start = index;
|
|
@@ -81,7 +43,6 @@ function parseSegments(source) {
|
|
|
81
43
|
const start = index;
|
|
82
44
|
while (index < lines.length && (isIndentedCode(lines[index]) || lines[index].trim() === ''))
|
|
83
45
|
index++;
|
|
84
|
-
// Trailing blank lines belong to whatever prose follows the block.
|
|
85
46
|
while (index - 1 > start && lines[index - 1].trim() === '')
|
|
86
47
|
index--;
|
|
87
48
|
flushProse();
|
|
@@ -94,18 +55,8 @@ function parseSegments(source) {
|
|
|
94
55
|
flushProse();
|
|
95
56
|
return segments;
|
|
96
57
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Strip emphasis markers; runs after more specific constructs are protected. Nested
|
|
99
|
-
* emphasis (`**outer *inner* outer**`) converges across passes: inner delimiters match
|
|
100
|
-
* first, then the freed outer run. The loop is bounded — every pass only removes text.
|
|
101
|
-
* Flanking classes are Unicode-aware (`\p{L}\p{N}_`), so intraword underscores inside
|
|
102
|
-
* non-ASCII words (`привет_мир_снова`) are never emphasis, per CommonMark.
|
|
103
|
-
*/
|
|
104
58
|
const FLANK = '\\p{L}\\p{N}_';
|
|
105
59
|
const EMPHASIS_PATTERNS = [
|
|
106
|
-
// Asterisks may delimit intraword emphasis per CommonMark (`foo*bar*baz`); only the
|
|
107
|
-
// run boundaries are guarded. Underscores keep the alphanumeric flanking rule,
|
|
108
|
-
// because intraword `_` is never emphasis.
|
|
109
60
|
/(?<!\*)\*\*(?!\s)((?:[^*]|\*(?!\*))+?)(?<!\s)\*\*(?!\*)/gu,
|
|
110
61
|
new RegExp(`(?<![${FLANK}_])__(?!\\s)((?:[^_]|_(?!_))+?)(?<!\\s)__(?![${FLANK}_])`, 'gu'),
|
|
111
62
|
/(?<!\*)\*(?!\s)([^*]+?)(?<!\s)\*(?!\*)/gu,
|
|
@@ -121,17 +72,6 @@ function stripEmphasis(text) {
|
|
|
121
72
|
}
|
|
122
73
|
return current;
|
|
123
74
|
}
|
|
124
|
-
/**
|
|
125
|
-
* Parse the destination that follows a `](` at `labelEnd + 1`.
|
|
126
|
-
*
|
|
127
|
-
* Two forms are recognized: an angle-bracket destination `<...>`, which may contain
|
|
128
|
-
* spaces (`[file](<./my-*draft* file.md>)`) and ends at the first `>` on the same line,
|
|
129
|
-
* and the bare form, whose parentheses are balanced so
|
|
130
|
-
* `(https://example.com/a_(b)_v_)` is one destination, optionally followed by a
|
|
131
|
-
* double-quoted title. `url` is the destination as written (without angle brackets),
|
|
132
|
-
* `end` is the index just past the construct, and `render` says whether the destination
|
|
133
|
-
* is an http(s) URL the transcript renders as `label (url)`.
|
|
134
|
-
*/
|
|
135
75
|
function parseLinkDestination(text, labelEnd) {
|
|
136
76
|
let cursor = labelEnd + 2;
|
|
137
77
|
if (text[cursor] === '<') {
|
|
@@ -166,32 +106,12 @@ function parseLinkDestination(text, labelEnd) {
|
|
|
166
106
|
return undefined;
|
|
167
107
|
return { url, end: cursor + (title ? title[0].length : 1), render: /^https?:\/\//.test(url) };
|
|
168
108
|
}
|
|
169
|
-
/**
|
|
170
|
-
* Strip the inline markdown the transcript cannot style: emphasis markers and link syntax.
|
|
171
|
-
* Link destinations are tokenized before emphasis runs — otherwise emphasis inside a URL
|
|
172
|
-
* (`[docs](https://example.com/*path*)`) silently rewrites the target the user would open —
|
|
173
|
-
* and the destination is scanned with balanced-parenthesis counting, so
|
|
174
|
-
* `(https://example.com/a_(b)_v_)` is one destination, not a prefix. The label still gets
|
|
175
|
-
* emphasis stripping; the destination is restored verbatim. Images stay untouched. Valid
|
|
176
|
-
* non-HTTP destinations (relative paths, fragments) are not rendered as links but are still
|
|
177
|
-
* tokenized verbatim, so emphasis inside `./__init__.py` or `#_section_` cannot rewrite them.
|
|
178
|
-
*
|
|
179
|
-
* The scan is single-pass: unmatched `[` openers stack with the output watermark at push
|
|
180
|
-
* time, and each `]` pops the innermost one, so a label is only matched once even in prose
|
|
181
|
-
* full of brackets — rendering is O(n) in the line length. A link found inside another
|
|
182
|
-
* candidate's label supersedes it: the outer token truncates the inner one out of the
|
|
183
|
-
* output, so `[](dest)` is one construct, never two overlapping tokens. A label
|
|
184
|
-
* that contained such a construct keeps its text verbatim, since stripping emphasis inside
|
|
185
|
-
* it would corrupt the nested destination.
|
|
186
|
-
*/
|
|
187
109
|
function stripInlineMarkdown(text) {
|
|
188
110
|
const links = [];
|
|
189
111
|
const stack = [];
|
|
190
112
|
let masked = '';
|
|
191
113
|
let index = 0;
|
|
192
114
|
while (index < text.length) {
|
|
193
|
-
// An angle autolink (`<scheme:…>`, any URI scheme per CommonMark, case-insensitive)
|
|
194
|
-
// is left verbatim: emphasis inside its URL must not rewrite the target the user copies.
|
|
195
115
|
const autolink = /^<[A-Za-z][A-Za-z0-9+.-]{1,31}:[^\s<>]*>/.exec(text.slice(index));
|
|
196
116
|
if (autolink) {
|
|
197
117
|
links.push({ label: '', url: autolink[0], render: false, original: autolink[0], nested: false });
|
|
@@ -223,15 +143,10 @@ function stripInlineMarkdown(text) {
|
|
|
223
143
|
index++;
|
|
224
144
|
continue;
|
|
225
145
|
}
|
|
226
|
-
// Only http(s) destinations render as `label (url)`; every other well-formed
|
|
227
|
-
// destination is protected verbatim so its punctuation survives emphasis stripping.
|
|
228
146
|
const isImage = opener.pos > 0 && text[opener.pos - 1] === '!';
|
|
229
147
|
const render = !isImage && parsed.render;
|
|
230
148
|
const label = text.slice(opener.pos + 1, index);
|
|
231
149
|
links.push({ label, url: parsed.url, render, original: text.slice(opener.pos, parsed.end), nested: links.length > opener.tokens });
|
|
232
|
-
// The construct supersedes everything tokenized inside its label: taking the output
|
|
233
|
-
// back to the opener's watermark drops inner tokens, and the label reproduces the
|
|
234
|
-
// text they stood for, so `[](dest)` is one construct, never two overlapping.
|
|
235
150
|
masked = masked.slice(0, opener.out) + `\u0001${links.length - 1}\u0001`;
|
|
236
151
|
index = parsed.end;
|
|
237
152
|
}
|
|
@@ -243,25 +158,8 @@ function stripInlineMarkdown(text) {
|
|
|
243
158
|
return label === link.url ? link.url : `${label} (${link.url})`;
|
|
244
159
|
});
|
|
245
160
|
}
|
|
246
|
-
/** The ASCII punctuation GFM lets a backslash escape. */
|
|
247
161
|
const ESCAPABLE = new Set('!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~');
|
|
248
|
-
/**
|
|
249
|
-
* Whether a line ends the paragraph, so emphasis or a code span cannot span across it. Exported so
|
|
250
|
-
* completion parsing finds the same multi-line code spans the transcript renders.
|
|
251
|
-
*/
|
|
252
162
|
export const interruptsParagraph = (line) => line.trim() === '' || NON_PARAGRAPH.test(line) || THEMATIC_BREAK.test(line) || SETEXT_UNDERLINE.test(line);
|
|
253
|
-
/**
|
|
254
|
-
* Mask emphasis spans that cross a soft line break before the prose is split into lines.
|
|
255
|
-
* Line-level rendering cannot match delimiters across `\n`, which would leave both halves
|
|
256
|
-
* literal (`**first\nsecond**`). The token restores the fully rendered inline content with
|
|
257
|
-
* its line break intact — the same protected processing a single line gets, because the
|
|
258
|
-
* token bypasses `renderProseLine`: bare emphasis stripping here would let a link inside
|
|
259
|
-
* the span (`**[module](./__init__.py)\nnow**`) have its destination rewritten. Single-line
|
|
260
|
-
* matches are left for the line-level rules, which already run after link and code-span
|
|
261
|
-
* protection. A span is never taken across a block boundary — a blank line, list item,
|
|
262
|
-
* heading or blockquote ends the paragraph, so `**first\n- item\nlast**` leaves the list
|
|
263
|
-
* line to the block transforms.
|
|
264
|
-
*/
|
|
265
163
|
function maskSegmentMultilineEmphasis(source) {
|
|
266
164
|
const tokens = [];
|
|
267
165
|
let text = source;
|
|
@@ -276,20 +174,8 @@ function maskSegmentMultilineEmphasis(source) {
|
|
|
276
174
|
}
|
|
277
175
|
return { text, tokens };
|
|
278
176
|
}
|
|
279
|
-
/**
|
|
280
|
-
* Mask links whose label crosses a soft line break at segment scope. Per-line rendering
|
|
281
|
-
* would split `[long\nlabel](https://example.com)` in half and process the destination as
|
|
282
|
-
* ordinary second-line text, corrupting the target the user would copy. The token restores
|
|
283
|
-
* the fully rendered link with its line break intact; single-line links stay on the
|
|
284
|
-
* line-level path, and images or non-HTTP destinations restore verbatim. A construct is
|
|
285
|
-
* never taken across a paragraph boundary — a bracket pair spanning an interrupting block
|
|
286
|
-
* line (`[first\n- item](url)`) is left for the block transforms.
|
|
287
|
-
*/
|
|
288
177
|
function maskSegmentMultilineLinks(source) {
|
|
289
178
|
const tokens = [];
|
|
290
|
-
// Openers carry their masked-output watermark, like the single-line scanner: an inner
|
|
291
|
-
// construct (a nested image) shortens `masked`, so slicing by source offsets would
|
|
292
|
-
// eat the prose before the outer opener.
|
|
293
179
|
const stack = [];
|
|
294
180
|
let masked = '';
|
|
295
181
|
let index = 0;
|
|
@@ -328,20 +214,6 @@ function maskSegmentMultilineLinks(source) {
|
|
|
328
214
|
}
|
|
329
215
|
return { text: masked, tokens };
|
|
330
216
|
}
|
|
331
|
-
/**
|
|
332
|
-
* Mask code spans that may cross newlines before line-level rendering. A valid span is a
|
|
333
|
-
* backtick run of length N closing at the next run of exactly length N (CommonMark), and
|
|
334
|
-
* its contents — however many lines — must reach the transcript verbatim, so the whole
|
|
335
|
-
* span becomes one token the per-line renderer passes through untouched. A span is never
|
|
336
|
-
* taken across a paragraph boundary: a blank line or an interrupting block (list, heading,
|
|
337
|
-
* blockquote, break) ends the paragraph, so `` `first\n- item\nlast` `` leaves the list
|
|
338
|
-
* line to the block transforms instead of masking the whole range.
|
|
339
|
-
*
|
|
340
|
-
* Backslash escapes are consumed here and masked into their own tokens, each holding the
|
|
341
|
-
* bare escaped punctuation: an escaped delimiter never opens a code span, emphasis run, or
|
|
342
|
-
* link label in any later segment-level pass, and the per-line renderer never needs to
|
|
343
|
-
* re-resolve the pair.
|
|
344
|
-
*/
|
|
345
217
|
function maskSegmentCodeSpans(source) {
|
|
346
218
|
const tokens = [];
|
|
347
219
|
const runs = /`+/g;
|
|
@@ -360,8 +232,6 @@ function maskSegmentCodeSpans(source) {
|
|
|
360
232
|
continue;
|
|
361
233
|
}
|
|
362
234
|
if (source[index] === '\\') {
|
|
363
|
-
// A bare backslash (not an escape) is copied verbatim; nextSpecial would only
|
|
364
|
-
// rediscover it here and stop making progress.
|
|
365
235
|
masked += '\\';
|
|
366
236
|
index++;
|
|
367
237
|
continue;
|
|
@@ -396,14 +266,6 @@ function maskSegmentCodeSpans(source) {
|
|
|
396
266
|
}
|
|
397
267
|
return { text: masked, tokens };
|
|
398
268
|
}
|
|
399
|
-
/**
|
|
400
|
-
* Strip inline markdown everywhere except inside protected tokens. Code spans — a backtick
|
|
401
|
-
* run of length N closing at the next run of exactly length N, per CommonMark — backslash
|
|
402
|
-
* escapes, and unmatched backtick runs are masked into placeholder tokens first, then the
|
|
403
|
-
* emphasis and link substitutions run over the whole line, then the tokens are restored.
|
|
404
|
-
* Masking is what lets delimiters match across a protected span: `**Run `npm ci` now**`
|
|
405
|
-
* still loses its bold markers, while the span's contents stay verbatim for copying.
|
|
406
|
-
*/
|
|
407
269
|
function renderInline(source) {
|
|
408
270
|
const runs = /`+/g;
|
|
409
271
|
const tokens = [];
|
|
@@ -421,7 +283,6 @@ function renderInline(source) {
|
|
|
421
283
|
if (char === '\\') {
|
|
422
284
|
const escaped = source[index + 1];
|
|
423
285
|
if (escaped && ESCAPABLE.has(escaped)) {
|
|
424
|
-
// A backslash escape displays the bare punctuation and never forms markdown.
|
|
425
286
|
masked += protect(escaped);
|
|
426
287
|
index += 2;
|
|
427
288
|
}
|
|
@@ -449,7 +310,7 @@ function renderInline(source) {
|
|
|
449
310
|
}
|
|
450
311
|
}
|
|
451
312
|
if (closing === -1) {
|
|
452
|
-
masked += protect(opening);
|
|
313
|
+
masked += protect(opening);
|
|
453
314
|
index += opening.length;
|
|
454
315
|
}
|
|
455
316
|
else {
|
|
@@ -460,44 +321,21 @@ function renderInline(source) {
|
|
|
460
321
|
}
|
|
461
322
|
return stripInlineMarkdown(masked).replace(/\u0000(\d+)\u0000/g, (_match, slot) => tokens[Number(slot)]);
|
|
462
323
|
}
|
|
463
|
-
/** A GFM thematic break: three or more of the same marker, optionally spaced (`* * *`). */
|
|
464
324
|
const THEMATIC_BREAK = /^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/;
|
|
465
|
-
/** A setext underline: only dashes or equals, which double as the unspaced thematic break. */
|
|
466
325
|
const SETEXT_UNDERLINE = /^ {0,3}(?:-+|=+)[ \t]*$/;
|
|
467
|
-
/**
|
|
468
|
-
* Lines that open a block other than a paragraph, so a following underline is not setext:
|
|
469
|
-
* headings, unordered and ordered list items (GFM markers `1.` through `9.` with `.` or `)`),
|
|
470
|
-
* and blockquotes.
|
|
471
|
-
*/
|
|
472
326
|
const NON_PARAGRAPH = /^(?: {0,3}#{1,6}\s|\s*[-*+]\s| {0,3}\d{1,9}[.)]\s| {0,3}>)/;
|
|
473
|
-
/** How a thematic break renders: a fixed rule rather than a misread list bullet. */
|
|
474
327
|
const BREAK_RULE = '─'.repeat(16);
|
|
475
|
-
/** Whether this line can close a setext heading: only paragraphs end in one. A setext
|
|
476
|
-
* underline itself just closed a heading, so the next `---` is a thematic break. */
|
|
477
328
|
const closesSetextHeading = (previous) => previous.trim() !== '' && !NON_PARAGRAPH.test(previous) && !THEMATIC_BREAK.test(previous) && !SETEXT_UNDERLINE.test(previous);
|
|
478
|
-
/** Render one prose line's markdown syntax into marker-bearing plain text. */
|
|
479
329
|
function renderProseLine(source) {
|
|
480
|
-
// A trailing hash run only closes the heading when whitespace separates it from the text,
|
|
481
|
-
// so `# C#` keeps its language-name hash.
|
|
482
330
|
const heading = /^ {0,3}#{1,6}\s+(.+?)(?:\s+#+)?\s*$/.exec(source);
|
|
483
331
|
let out = heading ? `${HEADING_PREFIX} ${heading[1]}` : source;
|
|
484
|
-
// A thematic break takes precedence over list-item parsing in GFM.
|
|
485
332
|
if (THEMATIC_BREAK.test(out))
|
|
486
333
|
return BREAK_RULE;
|
|
487
|
-
// GFM keeps one space of marker padding and treats the rest as content indentation
|
|
488
|
-
// (`- code` is a code item), so only the first space is consumed.
|
|
489
334
|
out = out.replace(/^(\s*)[-*+]([ \t]+)/, (_match, indent, padding) => padding.length >= 5 ? `${indent}• ${' '.repeat(padding.length - 1)}` : `${indent}• `);
|
|
490
335
|
return renderInline(out);
|
|
491
336
|
}
|
|
492
337
|
const codeLine = (line) => (line ? `${CODE_GUTTER} ${line}` : CODE_GUTTER);
|
|
493
338
|
const summaryCodeLine = (line) => (line.length > COLLAPSE_CLIP ? `${clipText(line, COLLAPSE_CLIP - 1)}…` : line);
|
|
494
|
-
/**
|
|
495
|
-
* Render an agent message for the transcript.
|
|
496
|
-
* @param source - the message text, already stripped of control characters, with outer
|
|
497
|
-
* blank lines removed but first-line indentation preserved (it may be fence indentation).
|
|
498
|
-
* @returns the summary text, plus the full rendering as `detail` when any code
|
|
499
|
-
* block was collapsed.
|
|
500
|
-
*/
|
|
501
339
|
export function renderMarkdown(source) {
|
|
502
340
|
const segments = parseSegments(source);
|
|
503
341
|
const summary = [];
|
|
@@ -505,27 +343,15 @@ export function renderMarkdown(source) {
|
|
|
505
343
|
let collapsedAny = false;
|
|
506
344
|
for (const segment of segments) {
|
|
507
345
|
if (segment.kind === 'prose') {
|
|
508
|
-
// Code spans and escapes are masked across the whole segment first (a span may
|
|
509
|
-
// cross a newline), then links whose label crosses one — before emphasis, so an
|
|
510
|
-
// image label containing multiline emphasis (``) is protected
|
|
511
|
-
// whole — then emphasis spans that cross a soft line break, then the per-line
|
|
512
|
-
// block transforms run.
|
|
513
346
|
const codeMasked = maskSegmentCodeSpans(segment.lines.join('\n'));
|
|
514
347
|
const linked = maskSegmentMultilineLinks(codeMasked.text);
|
|
515
348
|
const masked = maskSegmentMultilineEmphasis(linked.text);
|
|
516
349
|
let previous = '';
|
|
517
350
|
const rendered = masked.text.split('\n').map(line => {
|
|
518
|
-
// `---` closing a paragraph is a setext underline, not a thematic break; after a
|
|
519
|
-
// heading, list item, break, or blockquote the same line is a real break.
|
|
520
351
|
const passThrough = closesSetextHeading(previous) && SETEXT_UNDERLINE.test(line);
|
|
521
352
|
previous = line;
|
|
522
353
|
return passThrough ? line : renderProseLine(line);
|
|
523
354
|
}).join('\n');
|
|
524
|
-
// Restore emphasis tokens first (bounded loop: a multiline emphasis token's value
|
|
525
|
-
// may itself contain link, code-span, or nested placeholders), then link tokens
|
|
526
|
-
// (their values may contain code-span placeholders), then code spans and escapes.
|
|
527
|
-
// Any other order would leave inner placeholders reaching the transcript, where
|
|
528
|
-
// control-character cleanup turns them into stray digits.
|
|
529
355
|
let restored = rendered;
|
|
530
356
|
for (let round = 0; round < 6 && restored.includes('\u0004'); round++) {
|
|
531
357
|
restored = restored.replace(/\u0004(\d+)\u0004/g, (_match, slot) => masked.tokens[Number(slot)]);
|