@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
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The editor's model picker: the desktop's chat model control (desktop/src/components/ProviderModelPicker.tsx)
|
|
3
|
-
* drawn without React, so a step's model and Graph Manager's model are chosen the way a task's is.
|
|
4
|
-
*
|
|
5
|
-
* The closed control is a field-sized button naming the model, with its provider's mark and name. It
|
|
6
|
-
* opens one column on the menu material: a search field, an optional pinned default row, and every
|
|
7
|
-
* model grouped under its provider's name, each row with the provider's mark and a check on the chosen
|
|
8
|
-
* one. The keys stay in the search field: Up and Down walk the rows, Enter chooses, Escape and Tab close.
|
|
9
|
-
*
|
|
10
|
-
* The caller owns the data. `modelPickerButton` in app.js builds the trigger and hangs a spec on it:
|
|
11
|
-
*
|
|
12
|
-
* { ariaLabel, groups() -> [{ provider: {id, label, type, baseUrl}, models: [{model, note}] }],
|
|
13
|
-
* selected() -> {provider, model} | null, defaultRow() -> {label, hint, selected} | undefined,
|
|
14
|
-
* pick({provider, model}), pickDefault(), onOpen() }
|
|
15
|
-
*
|
|
16
|
-
* The panel reads the spec each time it draws, so `refresh(trigger)` redraws an open panel when
|
|
17
|
-
* discovery adds models while it is open.
|
|
18
|
-
*/
|
|
19
1
|
'use strict';
|
|
20
2
|
(() => {
|
|
21
3
|
if (typeof document === 'undefined' || typeof window === 'undefined') return;
|
|
@@ -33,9 +15,6 @@
|
|
|
33
15
|
};
|
|
34
16
|
const icon = (name, size = 14) => globalThis.AndorraIcons?.icon?.(name, size) || null;
|
|
35
17
|
|
|
36
|
-
// The provider marks the desktop draws (desktop/src/engine/providerPresets.ts `providerLogo`): by the
|
|
37
|
-
// provider's type first, then by the vendor domain its endpoint is on. The glyph files are the
|
|
38
|
-
// desktop's own (desktop/src/assets/providers/glyphs), copied beside the editor at build time.
|
|
39
18
|
const TYPE_LOGOS = { codex: 'openai', claude: 'claude', 'opencode-go': 'opencode', grok: 'xai', opencode: 'opencode' };
|
|
40
19
|
const DOMAIN_LOGOS = {
|
|
41
20
|
'openai.com': 'openai', 'anthropic.com': 'anthropic', 'x.ai': 'xai', 'moonshot.ai': 'kimi', 'kimi.ai': 'kimi',
|
|
@@ -52,7 +31,6 @@
|
|
|
52
31
|
return undefined;
|
|
53
32
|
}
|
|
54
33
|
|
|
55
|
-
/** A provider's mark: its vendor glyph in the row's icon ink, or the neutral boxes. */
|
|
56
34
|
function mark(provider) {
|
|
57
35
|
const holder = make('span', 'select-option-icon model-picker-mark');
|
|
58
36
|
holder.setAttribute('aria-hidden', 'true');
|
|
@@ -108,7 +86,6 @@
|
|
|
108
86
|
list.id = `${id}-list`;
|
|
109
87
|
list.setAttribute('role', 'listbox');
|
|
110
88
|
list.setAttribute('aria-label', 'Models');
|
|
111
|
-
// A press on a row must not take the caret out of the search field, where the keys live.
|
|
112
89
|
list.addEventListener('mousedown', event => event.preventDefault());
|
|
113
90
|
panel.append(search, list);
|
|
114
91
|
|
|
@@ -137,8 +114,6 @@
|
|
|
137
114
|
const keyOf = row => row ? (row.kind === 'default' ? 'default' : JSON.stringify([row.choice.provider, row.choice.model])) : undefined;
|
|
138
115
|
function draw() {
|
|
139
116
|
const q = input.value.trim().toLowerCase();
|
|
140
|
-
// A redraw (discovery adding models) must keep the walker on the same row, not the same index:
|
|
141
|
-
// a group growing above it would otherwise move Enter onto another model.
|
|
142
117
|
const walked = keyOf(rows[active]);
|
|
143
118
|
const chosen = spec.selected?.() || null;
|
|
144
119
|
const fallback = spec.defaultRow?.();
|
|
@@ -199,7 +174,6 @@
|
|
|
199
174
|
}
|
|
200
175
|
if (!rows.length) list.append(make('div', 'select-empty', 'No matching models'));
|
|
201
176
|
|
|
202
|
-
// The walker starts on what the eye already has: the chosen model, else the chosen default.
|
|
203
177
|
if (!seeded || q !== draw.lastQuery) {
|
|
204
178
|
const picked = rows.findIndex(item => item.element.getAttribute('aria-selected') === 'true');
|
|
205
179
|
active = !q && picked >= 0 ? picked : 0;
|
|
@@ -209,14 +183,12 @@
|
|
|
209
183
|
if (kept >= 0) active = kept;
|
|
210
184
|
}
|
|
211
185
|
draw.lastQuery = q;
|
|
212
|
-
// The pinned default row must not cover the walked row when it scrolls into view.
|
|
213
186
|
const pinned = list.querySelector('.model-picker-default');
|
|
214
187
|
list.style.scrollPaddingTop = pinned ? `${pinned.offsetHeight}px` : '';
|
|
215
188
|
setActive(active);
|
|
216
189
|
place();
|
|
217
190
|
}
|
|
218
191
|
|
|
219
|
-
/** The column hangs from the trigger: below it when there is room, above otherwise. */
|
|
220
192
|
function place() {
|
|
221
193
|
if (!trigger.isConnected) { close(); return; }
|
|
222
194
|
const anchor = trigger.getBoundingClientRect();
|
|
@@ -272,7 +244,6 @@
|
|
|
272
244
|
}
|
|
273
245
|
|
|
274
246
|
function toggle(trigger) { if (current?.trigger === trigger) close(true); else open(trigger); }
|
|
275
|
-
/** Redraw an open panel after its models changed; a closed trigger needs nothing. */
|
|
276
247
|
function refresh(trigger) { if (current?.trigger === trigger) current.draw(); }
|
|
277
248
|
|
|
278
249
|
window.AndorraModelPicker = Object.freeze({ open, close, toggle, refresh, mark, logoFor });
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* Sidebar layout preferences are local to this browser, separate from graph data. */
|
|
2
1
|
(() => {
|
|
3
2
|
const rail = document.getElementById('library-rail');
|
|
4
3
|
const handle = document.getElementById('rail-resize');
|
|
@@ -9,7 +8,7 @@
|
|
|
9
8
|
return {min, max:Math.max(min, Math.min(480, innerWidth - 320))};
|
|
10
9
|
};
|
|
11
10
|
let preferred = innerWidth <= 760 ? 180 : 238;
|
|
12
|
-
try { const saved = Number(localStorage.getItem(key)); if (Number.isFinite(saved) && saved >= 100 && saved <= 480) preferred = saved; } catch {
|
|
11
|
+
try { const saved = Number(localStorage.getItem(key)); if (Number.isFinite(saved) && saved >= 100 && saved <= 480) preferred = saved; } catch { }
|
|
13
12
|
const apply = (width, remember = false) => {
|
|
14
13
|
const {min, max} = limits();
|
|
15
14
|
const value = Math.round(Math.max(min, Math.min(max, width)));
|
|
@@ -19,7 +18,7 @@
|
|
|
19
18
|
handle.setAttribute('aria-valuenow', String(value));
|
|
20
19
|
if (remember) {
|
|
21
20
|
preferred = value;
|
|
22
|
-
try { localStorage.setItem(key, String(value)); } catch {
|
|
21
|
+
try { localStorage.setItem(key, String(value)); } catch { }
|
|
23
22
|
}
|
|
24
23
|
};
|
|
25
24
|
let drag;
|
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Skills in graph prompts. Typing `/` in a prompt opens a browser of this machine's skills, and
|
|
3
|
-
* picking one writes its `/command` where the slash was. When the graph runs, the node loads every
|
|
4
|
-
* skill its prompts name (src/skills/prompt-skills.ts finds them with the same pattern as below).
|
|
5
|
-
*
|
|
6
|
-
* A name no skill on this machine answers to is a warning under the prompt, never an error: the
|
|
7
|
-
* graph still saves and runs, and the agent is told to go on without that skill. A graph can be
|
|
8
|
-
* built on one machine and run on another, and a project's own skills (.agents/skills) are only
|
|
9
|
-
* known when the run starts in that project.
|
|
10
|
-
*/
|
|
11
1
|
'use strict';
|
|
12
2
|
(() => {
|
|
13
3
|
const REFERENCE = /(^|[\s([{])\/((?:skill::)?[A-Za-z0-9][\w-]*(?::(?:\.|[\w-]+(?:\.[\w-]+)*(?:\/[\w-]+(?:\.[\w-]+)*)*))?)(?![\w:/-])(?!\.\w)/g;
|
|
14
|
-
// A qualified command (`/team:skills/review`) keeps filtering through its slashes and dots.
|
|
15
4
|
const QUERY = /(^|[\s([{])\/([\w-]*(?::[\w.\/:-]*)?)$/;
|
|
16
5
|
const STALE_MS = 15_000;
|
|
17
6
|
const MAX_SHOWN = 60;
|
|
7
|
+
const CHIP_SCAN = /(^|\s)(\/\S+)(?=\s|$)/g;
|
|
8
|
+
const LAYER_METRICS = ['fontFamily', 'fontSize', 'fontWeight', 'fontStyle', 'lineHeight', 'letterSpacing', 'wordSpacing', 'tabSize', 'textIndent',
|
|
9
|
+
'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'];
|
|
18
10
|
let cache = { at: 0, value: undefined, error: undefined, pending: undefined };
|
|
19
11
|
let pickerSeq = 0;
|
|
20
|
-
// One picker is open at a time; a window resize moves that one. The inspector redraws its fields
|
|
21
|
-
// often, so no per-field window listener is left behind.
|
|
22
12
|
let openPlace;
|
|
23
13
|
window.addEventListener('resize', () => openPlace?.());
|
|
24
14
|
|
|
25
15
|
const el = (tag, text, className) => { const item = document.createElement(tag); if (text !== undefined) item.textContent = text; if (className) item.className = className; return item; };
|
|
26
16
|
const icon = (name, size = 14) => globalThis.AndorraIcons?.icon?.(name, size);
|
|
27
17
|
|
|
28
|
-
/** The catalog, refetched when older than a few seconds so a skill turned on in Settings shows up. */
|
|
29
18
|
function catalog(load, force = false) {
|
|
30
19
|
if (cache.pending) return cache.pending;
|
|
31
20
|
if (!force && cache.value && Date.now() - cache.at < STALE_MS) return Promise.resolve(cache.value);
|
|
@@ -33,14 +22,12 @@
|
|
|
33
22
|
cache = { at: Date.now(), value: { skills: Array.isArray(value?.skills) ? value.skills : [], inactive: Array.isArray(value?.inactive) ? value.inactive : [], reserved: Array.isArray(value?.reserved) ? value.reserved : [] }, error: undefined, pending: undefined };
|
|
34
23
|
return cache.value;
|
|
35
24
|
}, error => {
|
|
36
|
-
// A failed refresh keeps the last catalog that loaded; with none, nothing is judged missing.
|
|
37
25
|
cache = { ...cache, at: Date.now(), error: error?.message || String(error), pending: undefined };
|
|
38
26
|
return cache.value;
|
|
39
27
|
});
|
|
40
28
|
return cache.pending;
|
|
41
29
|
}
|
|
42
30
|
|
|
43
|
-
/** Every `/name` a prompt names, in order, without built-in commands. */
|
|
44
31
|
function references(text, reserved = []) {
|
|
45
32
|
const names = [];
|
|
46
33
|
if (typeof text !== 'string' || !text.includes('/')) return names;
|
|
@@ -54,11 +41,6 @@
|
|
|
54
41
|
const named = (skill, name) => skill.command === '/' + name || skill.id === name;
|
|
55
42
|
const answers = (skill, name) => named(skill, name) || skill.name === name;
|
|
56
43
|
|
|
57
|
-
/**
|
|
58
|
-
* The names in a prompt this machine cannot load, each with the reason. An installed skill owns
|
|
59
|
-
* its name even while turned off or broken, as it does for a typed command: Andorra's skill of the
|
|
60
|
-
* same name then answers only to `/andorra:name`, so the short name is reported, not substituted.
|
|
61
|
-
*/
|
|
62
44
|
function problems(text, value) {
|
|
63
45
|
if (!value) return [];
|
|
64
46
|
const result = [];
|
|
@@ -77,6 +59,53 @@
|
|
|
77
59
|
return `Skill /${name} not found on this machine. The step still runs, without it.`;
|
|
78
60
|
}
|
|
79
61
|
|
|
62
|
+
// Chip handling, ported from desktop/src/engine/slashSuggestions.ts and generalized to many chips per text.
|
|
63
|
+
function chipSpan(value, chip) {
|
|
64
|
+
return { start: chip.start, end: value[chip.end] === ' ' ? chip.end + 1 : chip.end };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function skillChipRanges(value, commands) {
|
|
68
|
+
if (typeof value !== 'string' || !Array.isArray(commands) || !value.includes('/')) return [];
|
|
69
|
+
const found = [];
|
|
70
|
+
for (const match of value.matchAll(CHIP_SCAN)) {
|
|
71
|
+
if (!commands.includes(match[2])) continue;
|
|
72
|
+
const start = match.index + match[1].length;
|
|
73
|
+
found.push({ start, end: start + match[2].length });
|
|
74
|
+
}
|
|
75
|
+
return found;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function chipSelection(chips, selectionStart, selectionEnd) {
|
|
79
|
+
let start = selectionStart, end = selectionEnd, expanded = false;
|
|
80
|
+
for (const chip of chips ?? []) {
|
|
81
|
+
const overlaps = start < chip.end && end > chip.start;
|
|
82
|
+
const covers = start <= chip.start && end >= chip.end;
|
|
83
|
+
if (!overlaps || covers) continue;
|
|
84
|
+
start = Math.min(start, chip.start);
|
|
85
|
+
end = Math.max(end, chip.end);
|
|
86
|
+
expanded = true;
|
|
87
|
+
}
|
|
88
|
+
return expanded ? { start, end } : undefined;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function chipDeletion(value, chips, selectionStart, selectionEnd, key) {
|
|
92
|
+
if (selectionStart !== selectionEnd) return chipSelection(chips, selectionStart, selectionEnd);
|
|
93
|
+
for (const chip of chips ?? []) {
|
|
94
|
+
const span = chipSpan(value, chip);
|
|
95
|
+
if (key === 'Backspace' && (selectionStart === chip.end || selectionStart === span.end) && selectionStart > chip.start) return span;
|
|
96
|
+
if (key === 'Delete' && selectionStart === chip.start) return span;
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function snapOutOfChip(chips, caret) {
|
|
102
|
+
for (const chip of chips ?? []) {
|
|
103
|
+
if (caret <= chip.start || caret >= chip.end) continue;
|
|
104
|
+
return caret - chip.start < chip.end - caret ? chip.start : chip.end;
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
80
109
|
function matching(skills, query) {
|
|
81
110
|
const needle = query.toLowerCase();
|
|
82
111
|
const rank = skill => skill.command.slice(1).toLowerCase().startsWith(needle) ? 0 : String(skill.name).toLowerCase().startsWith(needle) ? 1 : 2;
|
|
@@ -85,7 +114,6 @@
|
|
|
85
114
|
.sort((a, b) => rank(a) - rank(b) || (a.source === b.source ? 0 : a.source === 'installed' ? -1 : 1) || a.command.localeCompare(b.command));
|
|
86
115
|
}
|
|
87
116
|
|
|
88
|
-
/** The caret's box in the viewport, measured on a mirror of the textarea. */
|
|
89
117
|
function caretRect(textarea) {
|
|
90
118
|
const box = textarea.getBoundingClientRect();
|
|
91
119
|
try {
|
|
@@ -105,10 +133,6 @@
|
|
|
105
133
|
} catch { return { left: box.left, top: box.bottom, bottom: box.bottom }; }
|
|
106
134
|
}
|
|
107
135
|
|
|
108
|
-
/**
|
|
109
|
-
* Gives a prompt textarea the `/` picker and the warning row. `load` fetches the catalog;
|
|
110
|
-
* `onPick` runs after a picked command is written, so the caller can record the change.
|
|
111
|
-
*/
|
|
112
136
|
function attach(textarea, { load, onPick } = {}) {
|
|
113
137
|
if (!textarea || typeof load !== 'function' || textarea.dataset?.skillPicker) return;
|
|
114
138
|
textarea.dataset.skillPicker = 'on';
|
|
@@ -131,7 +155,135 @@
|
|
|
131
155
|
warnings.hidden = !warnings.childElementCount;
|
|
132
156
|
};
|
|
133
157
|
let warnTimer;
|
|
134
|
-
|
|
158
|
+
let syncChips = () => { };
|
|
159
|
+
const applyCatalog = value => { renderWarnings(value); syncChips(); };
|
|
160
|
+
const refreshWarnings = (force = false) => { void catalog(load, force).then(applyCatalog); };
|
|
161
|
+
|
|
162
|
+
// Chip overlay: a sibling layer that draws the highlighted /names behind the (transparent) textarea text.
|
|
163
|
+
const commands = () => {
|
|
164
|
+
const skills = cache.value?.skills;
|
|
165
|
+
return Array.isArray(skills) ? skills.map(skill => skill.command).filter(command => typeof command === 'string' && command.startsWith('/')) : [];
|
|
166
|
+
};
|
|
167
|
+
const currentChips = () => { const list = commands(); return list.length ? skillChipRanges(textarea.value, list) : []; };
|
|
168
|
+
const snapCaret = () => {
|
|
169
|
+
const chips = currentChips();
|
|
170
|
+
if (!chips.length || textarea.selectionStart !== textarea.selectionEnd) return;
|
|
171
|
+
const snapped = snapOutOfChip(chips, textarea.selectionStart);
|
|
172
|
+
if (snapped !== undefined && snapped !== textarea.selectionStart) textarea.setSelectionRange(snapped, snapped);
|
|
173
|
+
};
|
|
174
|
+
const removeRange = (start, end) => {
|
|
175
|
+
try { textarea.focus(); } catch { }
|
|
176
|
+
textarea.setSelectionRange(start, end);
|
|
177
|
+
let removed = false;
|
|
178
|
+
try { removed = typeof document.execCommand === 'function' && document.execCommand('delete'); } catch { removed = false; }
|
|
179
|
+
if (removed) return;
|
|
180
|
+
textarea.value = textarea.value.slice(0, start) + textarea.value.slice(end);
|
|
181
|
+
textarea.setSelectionRange(start, start);
|
|
182
|
+
textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
183
|
+
};
|
|
184
|
+
const chipKey = event => {
|
|
185
|
+
const chips = currentChips();
|
|
186
|
+
if (!chips.length || event.altKey || event.metaKey || event.ctrlKey) return false;
|
|
187
|
+
const start = textarea.selectionStart, end = textarea.selectionEnd;
|
|
188
|
+
if (start === end && !event.shiftKey && (event.key === 'ArrowRight' || event.key === 'ArrowLeft')) {
|
|
189
|
+
const chip = event.key === 'ArrowRight' ? chips.find(item => item.start === start) : chips.find(item => item.end === start);
|
|
190
|
+
if (chip) {
|
|
191
|
+
event.preventDefault();
|
|
192
|
+
const target = event.key === 'ArrowRight' ? chip.end : chip.start;
|
|
193
|
+
textarea.setSelectionRange(target, target);
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// Shift+Delete is cut on Windows and Linux: leave it to the browser so the text reaches the
|
|
198
|
+
// clipboard, and let the 'cut' listener below grow a selection that partly covers a chip.
|
|
199
|
+
if (event.key === 'Delete' && event.shiftKey) return false;
|
|
200
|
+
if (event.key === 'Backspace' || event.key === 'Delete') {
|
|
201
|
+
const range = chipDeletion(textarea.value, chips, start, end, event.key);
|
|
202
|
+
if (!range) return false;
|
|
203
|
+
event.preventDefault();
|
|
204
|
+
removeRange(range.start, range.end);
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
if (start !== end && (event.key === 'Enter' || event.key.length === 1)) {
|
|
208
|
+
const grown = chipSelection(chips, start, end);
|
|
209
|
+
if (grown) textarea.setSelectionRange(grown.start, grown.end);
|
|
210
|
+
}
|
|
211
|
+
return false;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
let layer, layerInner, layerValue = '', layerCommands = '';
|
|
215
|
+
const hideChips = () => {
|
|
216
|
+
layer?.remove?.(); layer = undefined; layerInner = undefined; layerValue = ''; layerCommands = '';
|
|
217
|
+
textarea.parentElement?.classList?.remove?.('hosts-skill-chips');
|
|
218
|
+
delete textarea.dataset.skillChips;
|
|
219
|
+
};
|
|
220
|
+
const positionLayer = () => {
|
|
221
|
+
if (!layer) return;
|
|
222
|
+
const parent = textarea.parentElement;
|
|
223
|
+
if (parent && layer.parentElement !== parent) {
|
|
224
|
+
layer.parentElement?.classList?.remove?.('hosts-skill-chips');
|
|
225
|
+
try { if (getComputedStyle(parent).position === 'static') parent.classList.add('hosts-skill-chips'); } catch { }
|
|
226
|
+
parent.append(layer);
|
|
227
|
+
}
|
|
228
|
+
try {
|
|
229
|
+
const style = getComputedStyle(textarea);
|
|
230
|
+
for (const property of LAYER_METRICS) layer.style[property] = style[property];
|
|
231
|
+
// The layer paints the input background inside the textarea's border box: offsetTop/Left are the
|
|
232
|
+
// border-box origin while clientWidth/Height exclude the border, so inset by the border widths
|
|
233
|
+
// and size to the padding box. That also lines the layer text up exactly with the textarea's text.
|
|
234
|
+
layer.style.top = `${textarea.offsetTop + (parseFloat(style.borderTopWidth) || 0)}px`;
|
|
235
|
+
layer.style.left = `${textarea.offsetLeft + (parseFloat(style.borderLeftWidth) || 0)}px`;
|
|
236
|
+
} catch {
|
|
237
|
+
layer.style.top = `${textarea.offsetTop}px`; layer.style.left = `${textarea.offsetLeft}px`;
|
|
238
|
+
}
|
|
239
|
+
layer.style.width = `${textarea.clientWidth}px`; layer.style.height = `${textarea.clientHeight}px`;
|
|
240
|
+
if (layerInner) layerInner.style.transform = `translateY(${-textarea.scrollTop}px)`;
|
|
241
|
+
};
|
|
242
|
+
const drawChips = () => {
|
|
243
|
+
if (!layer || !layerInner) return;
|
|
244
|
+
const value = textarea.value;
|
|
245
|
+
const list = commands();
|
|
246
|
+
const chips = list.length ? skillChipRanges(value, list) : [];
|
|
247
|
+
if (!chips.length) { hideChips(); return; }
|
|
248
|
+
const key = list.join('\n');
|
|
249
|
+
if (value === layerValue && key === layerCommands) return;
|
|
250
|
+
layerValue = value; layerCommands = key;
|
|
251
|
+
layerInner.replaceChildren();
|
|
252
|
+
let at = 0;
|
|
253
|
+
for (const chip of chips) {
|
|
254
|
+
if (chip.start > at) layerInner.append(document.createTextNode(value.slice(at, chip.start)));
|
|
255
|
+
const chipNode = el('span', undefined, 'skill-chip');
|
|
256
|
+
chipNode.append(el('span', '/', 'skill-chip-slash'), el('span', value.slice(chip.start + 1, chip.end)));
|
|
257
|
+
layerInner.append(chipNode);
|
|
258
|
+
at = chip.end;
|
|
259
|
+
}
|
|
260
|
+
if (at < value.length) layerInner.append(document.createTextNode(value.slice(at)));
|
|
261
|
+
layerInner.append(document.createTextNode('\u200b'));
|
|
262
|
+
};
|
|
263
|
+
const renderChips = () => {
|
|
264
|
+
if (!commands().length || !skillChipRanges(textarea.value, commands()).length) { hideChips(); return; }
|
|
265
|
+
if (!layer) {
|
|
266
|
+
layer = el('div', undefined, 'skill-chip-layer'); layer.setAttribute('aria-hidden', 'true');
|
|
267
|
+
layerInner = el('div'); layer.append(layerInner);
|
|
268
|
+
const parent = textarea.parentElement;
|
|
269
|
+
try { if (parent && getComputedStyle(parent).position === 'static') parent.classList.add('hosts-skill-chips'); } catch { }
|
|
270
|
+
parent?.append?.(layer);
|
|
271
|
+
textarea.dataset.skillChips = 'true';
|
|
272
|
+
}
|
|
273
|
+
positionLayer();
|
|
274
|
+
drawChips();
|
|
275
|
+
};
|
|
276
|
+
syncChips = () => { renderChips(); };
|
|
277
|
+
// Inspector renders replace prompt textareas, so the observer lets go of a removed one; otherwise its
|
|
278
|
+
// callback would keep the detached prompt and its picker state alive for the rest of the session.
|
|
279
|
+
let resizeObserver;
|
|
280
|
+
const stopObserving = () => { resizeObserver?.disconnect(); resizeObserver = undefined; };
|
|
281
|
+
try {
|
|
282
|
+
if (typeof ResizeObserver === 'function') {
|
|
283
|
+
resizeObserver = new ResizeObserver(() => { if (!textarea.isConnected) { stopObserving(); return; } renderChips(); });
|
|
284
|
+
resizeObserver.observe(textarea);
|
|
285
|
+
}
|
|
286
|
+
} catch { }
|
|
135
287
|
|
|
136
288
|
let panel, list, options = [], active = 0, query;
|
|
137
289
|
const close = () => {
|
|
@@ -149,7 +301,6 @@
|
|
|
149
301
|
const accept = skill => {
|
|
150
302
|
if (!query || !skill) return;
|
|
151
303
|
const value = textarea.value;
|
|
152
|
-
// A pick replaces the whole token under the caret, including any part typed after it.
|
|
153
304
|
const tail = /^[\w:.\/-]*/.exec(value.slice(query.end))[0].length;
|
|
154
305
|
const after = value.slice(query.end + tail);
|
|
155
306
|
const insert = skill.command + (/^\s/.test(after) ? '' : ' ');
|
|
@@ -176,7 +327,6 @@
|
|
|
176
327
|
if (!panel) {
|
|
177
328
|
panel = el('div', undefined, 'select-panel skill-picker'); panel.id = id;
|
|
178
329
|
panel.setAttribute('role', 'listbox'); panel.setAttribute('aria-label', 'Skills');
|
|
179
|
-
// Keep focus in the prompt while the pointer chooses.
|
|
180
330
|
panel.addEventListener('mousedown', event => event.preventDefault());
|
|
181
331
|
(textarea.closest('dialog') ?? document.body).append(panel);
|
|
182
332
|
textarea.setAttribute('aria-expanded', 'true'); textarea.setAttribute('aria-controls', id);
|
|
@@ -217,26 +367,210 @@
|
|
|
217
367
|
if (query?.text !== next.text) active = 0;
|
|
218
368
|
query = next;
|
|
219
369
|
render(cache.value);
|
|
220
|
-
void catalog(load).then(value => { if (query === next) render(value); });
|
|
370
|
+
void catalog(load).then(value => { if (query === next) render(value); applyCatalog(value); });
|
|
221
371
|
};
|
|
222
372
|
|
|
223
|
-
textarea.addEventListener('input', () => { update(); clearTimeout(warnTimer); warnTimer = setTimeout(() => refreshWarnings(), 200); });
|
|
373
|
+
textarea.addEventListener('input', () => { renderChips(); snapCaret(); update(); clearTimeout(warnTimer); warnTimer = setTimeout(() => refreshWarnings(), 200); });
|
|
224
374
|
textarea.addEventListener('click', update);
|
|
225
|
-
textarea.addEventListener('
|
|
375
|
+
textarea.addEventListener('select', snapCaret);
|
|
376
|
+
textarea.addEventListener('focus', () => { renderChips(); snapCaret(); refreshWarnings(); });
|
|
226
377
|
textarea.addEventListener('blur', close);
|
|
378
|
+
textarea.addEventListener('scroll', () => { place(); positionLayer(); });
|
|
379
|
+
textarea.addEventListener('keydown', event => {
|
|
380
|
+
if (event.isComposing) return;
|
|
381
|
+
if (!panel) { chipKey(event); return; }
|
|
382
|
+
if (event.key === 'Escape') { event.preventDefault(); event.stopImmediatePropagation(); close(); return; }
|
|
383
|
+
if (!event.shiftKey && !event.ctrlKey && !event.metaKey && !event.altKey && options.length) {
|
|
384
|
+
if (event.key === 'ArrowDown') { event.preventDefault(); highlight((active + 1) % options.length); return; }
|
|
385
|
+
if (event.key === 'ArrowUp') { event.preventDefault(); highlight((active - 1 + options.length) % options.length); return; }
|
|
386
|
+
if (event.key === 'Enter' || event.key === 'Tab') { event.preventDefault(); accept(options[active]?.skill); return; }
|
|
387
|
+
}
|
|
388
|
+
chipKey(event);
|
|
389
|
+
}, true);
|
|
390
|
+
// Paste and cut also replace or remove the current selection, and their keydowns exit at the
|
|
391
|
+
// modifier guard above, so grow a selection that partly covers a chip before the edit lands.
|
|
392
|
+
const growEditSelection = () => {
|
|
393
|
+
const chips = currentChips();
|
|
394
|
+
const start = textarea.selectionStart, end = textarea.selectionEnd;
|
|
395
|
+
if (!chips.length || start === end) return;
|
|
396
|
+
const grown = chipSelection(chips, start, end);
|
|
397
|
+
if (grown) textarea.setSelectionRange(grown.start, grown.end);
|
|
398
|
+
};
|
|
399
|
+
textarea.addEventListener('paste', growEditSelection);
|
|
400
|
+
textarea.addEventListener('cut', growEditSelection);
|
|
401
|
+
// The browser fires 'select' only for real text selections; plain caret moves (a click, Up/Down/Home/End)
|
|
402
|
+
// surface as document selectionchange, so this is what keeps the caret out of chips the way the chat
|
|
403
|
+
// composer's React onSelect does. The listener removes itself, and the resize observer, once the
|
|
404
|
+
// textarea leaves the DOM.
|
|
405
|
+
const onSelectionChange = () => {
|
|
406
|
+
if (!textarea.isConnected) { document.removeEventListener('selectionchange', onSelectionChange); stopObserving(); return; }
|
|
407
|
+
if (document.activeElement === textarea) snapCaret();
|
|
408
|
+
};
|
|
409
|
+
document.addEventListener('selectionchange', onSelectionChange);
|
|
410
|
+
refreshWarnings();
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// Where the caret sits in a JSON draft: undefined unless it is where a key of an object goes.
|
|
414
|
+
function keyContext(text) {
|
|
415
|
+
const stack = [];
|
|
416
|
+
let expectKey = false, structural = -1;
|
|
417
|
+
for (let i = 0; i < text.length; i++) {
|
|
418
|
+
const char = text[i], top = stack.at(-1);
|
|
419
|
+
if (char === '"') {
|
|
420
|
+
let end = i + 1;
|
|
421
|
+
while (end < text.length && text[end] !== '"') end += text[end] === '\\' ? 2 : 1;
|
|
422
|
+
if (end >= text.length) {
|
|
423
|
+
const typed = text.slice(i + 1);
|
|
424
|
+
if (top?.kind !== 'object' || !expectKey || !/^\w*$/.test(typed)) return undefined;
|
|
425
|
+
return { start: i, text: typed, depth: stack.length, parentKey: top.parentKey, present: top.keys };
|
|
426
|
+
}
|
|
427
|
+
if (top?.kind === 'object' && expectKey) { top.key = text.slice(i + 1, end); top.keys.push(top.key); expectKey = false; structural = end; }
|
|
428
|
+
i = end;
|
|
429
|
+
} else if (char === '{') { stack.push({ kind: 'object', parentKey: top?.key, keys: [] }); expectKey = true; structural = i; }
|
|
430
|
+
else if (char === '[') { stack.push({ kind: 'array', key: top?.key }); expectKey = false; structural = i; }
|
|
431
|
+
else if (char === '}' || char === ']') { stack.pop(); expectKey = false; structural = i; }
|
|
432
|
+
else if (char === ',') { expectKey = stack.at(-1)?.kind === 'object'; structural = i; }
|
|
433
|
+
else if (char === ':') { expectKey = false; structural = i; }
|
|
434
|
+
}
|
|
435
|
+
const word = /^\s*([A-Za-z]\w*)?$/.exec(text.slice(structural + 1));
|
|
436
|
+
if (!word) return undefined;
|
|
437
|
+
const typed = word[1] ?? '';
|
|
438
|
+
const top = stack.at(-1);
|
|
439
|
+
if (!stack.length) return structural === -1 ? { start: text.length - typed.length, text: typed, depth: 0, parentKey: undefined, present: [], wrap: true } : undefined;
|
|
440
|
+
if (top.kind !== 'object' || !expectKey) return undefined;
|
|
441
|
+
return { start: text.length - typed.length, text: typed, depth: stack.length, parentKey: top.parentKey, present: top.keys };
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// The rest of the key under the caret. A quote counts as its closing quote only where a key can end.
|
|
445
|
+
const KEY_TAIL = /^\w*(?:"(?=\s*(?:[:,}]|$)))?/;
|
|
446
|
+
// Keys the enclosing object already has after the caret, up to its closing brace.
|
|
447
|
+
function keysAhead(text) {
|
|
448
|
+
const keys = [];
|
|
449
|
+
let depth = 0;
|
|
450
|
+
for (let i = 0; i < text.length; i++) {
|
|
451
|
+
const char = text[i];
|
|
452
|
+
if (char === '"') {
|
|
453
|
+
let end = i + 1;
|
|
454
|
+
while (end < text.length && text[end] !== '"') end += text[end] === '\\' ? 2 : 1;
|
|
455
|
+
if (depth === 0 && /^\s*:/.test(text.slice(end + 1))) keys.push(text.slice(i + 1, end));
|
|
456
|
+
i = end;
|
|
457
|
+
} else if (char === '{' || char === '[') depth++;
|
|
458
|
+
else if (char === '}' || char === ']') { if (depth === 0) break; depth--; }
|
|
459
|
+
}
|
|
460
|
+
return keys;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function matchingKeys(keys, context) {
|
|
464
|
+
const needle = context.text.toLowerCase();
|
|
465
|
+
return keys
|
|
466
|
+
.filter(item => !context.present.includes(item.key) && item.key.toLowerCase().includes(needle))
|
|
467
|
+
.sort((a, b) => Number(!a.key.toLowerCase().startsWith(needle)) - Number(!b.key.toLowerCase().startsWith(needle)));
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// The same menu as the skills browser, over the key names a JSON field accepts.
|
|
471
|
+
function attachKeys(textarea, { keys, offer, label = 'Accepted settings' } = {}) {
|
|
472
|
+
if (!textarea || !Array.isArray(keys) || !keys.length || textarea.dataset?.keyPicker) return;
|
|
473
|
+
textarea.dataset.keyPicker = 'on';
|
|
474
|
+
const id = `key-picker-${++pickerSeq}`;
|
|
475
|
+
textarea.setAttribute('aria-autocomplete', 'list');
|
|
476
|
+
textarea.setAttribute('aria-haspopup', 'listbox');
|
|
477
|
+
textarea.setAttribute('aria-expanded', 'false');
|
|
478
|
+
|
|
479
|
+
let panel, options = [], active = 0, context, navigated = false, picked = false;
|
|
480
|
+
const close = () => {
|
|
481
|
+
panel?.remove(); panel = undefined; options = []; context = undefined; navigated = false;
|
|
482
|
+
if (openPlace === place) openPlace = undefined;
|
|
483
|
+
textarea.setAttribute('aria-expanded', 'false'); textarea.removeAttribute('aria-controls'); textarea.removeAttribute('aria-activedescendant');
|
|
484
|
+
};
|
|
485
|
+
const highlight = index => {
|
|
486
|
+
active = index;
|
|
487
|
+
options.forEach((option, i) => { option.row.dataset.active = String(i === index); option.row.setAttribute('aria-selected', String(i === index)); });
|
|
488
|
+
const current = options[index]?.row;
|
|
489
|
+
if (current) { textarea.setAttribute('aria-activedescendant', current.id); current.scrollIntoView?.({ block: 'nearest' }); }
|
|
490
|
+
else textarea.removeAttribute('aria-activedescendant');
|
|
491
|
+
};
|
|
492
|
+
const accept = item => {
|
|
493
|
+
if (!context || !item) return;
|
|
494
|
+
if (moved()) { update(); return; }
|
|
495
|
+
const value = textarea.value;
|
|
496
|
+
const rest = value.slice(context.end), own = KEY_TAIL.exec(rest)[0].length;
|
|
497
|
+
const tail = own + /^(?:[ \t]*:)?[ \t]*/.exec(rest.slice(own))[0].length;
|
|
498
|
+
const before = value.slice(0, context.start), after = value.slice(context.end + tail);
|
|
499
|
+
const insert = `${context.wrap ? '{\n ' : ''}"${item.key}": `;
|
|
500
|
+
textarea.value = before + insert + (context.wrap ? `${after.trimEnd()}\n}` : after);
|
|
501
|
+
const caret = before.length + insert.length;
|
|
502
|
+
textarea.setSelectionRange(caret, caret);
|
|
503
|
+
close();
|
|
504
|
+
picked = true;
|
|
505
|
+
textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
506
|
+
};
|
|
507
|
+
const place = () => {
|
|
508
|
+
if (!panel) return;
|
|
509
|
+
const caret = caretRect(textarea);
|
|
510
|
+
const width = Math.min(380, window.innerWidth - 16);
|
|
511
|
+
panel.style.width = `${width}px`;
|
|
512
|
+
panel.style.left = `${Math.min(Math.max(8, caret.left - 12), window.innerWidth - width - 8)}px`;
|
|
513
|
+
const below = window.innerHeight - caret.bottom - 12, above = caret.top - 12;
|
|
514
|
+
if (below >= 180 || below >= above) { panel.style.top = `${caret.bottom + 4}px`; panel.style.bottom = ''; panel.style.maxHeight = `${Math.max(120, below)}px`; }
|
|
515
|
+
else { panel.style.bottom = `${window.innerHeight - caret.top + 4}px`; panel.style.top = ''; panel.style.maxHeight = `${Math.max(120, above)}px`; }
|
|
516
|
+
};
|
|
517
|
+
const update = () => {
|
|
518
|
+
const start = textarea.selectionStart, end = textarea.selectionEnd;
|
|
519
|
+
const next = start === end && document.activeElement === textarea ? keyContext(textarea.value.slice(0, start)) : undefined;
|
|
520
|
+
// The key under the caret is the one being replaced; every other key of the object is taken.
|
|
521
|
+
if (next) next.present = [...next.present, ...keysAhead(textarea.value.slice(start).replace(KEY_TAIL, ''))];
|
|
522
|
+
const found = next && (!offer || offer(next)) ? matchingKeys(keys, next) : [];
|
|
523
|
+
if (!found.length) { close(); return; }
|
|
524
|
+
if (context?.text !== next.text) active = 0;
|
|
525
|
+
context = { ...next, end: start };
|
|
526
|
+
if (!panel) {
|
|
527
|
+
panel = el('div', undefined, 'select-panel skill-picker key-picker'); panel.id = id;
|
|
528
|
+
panel.setAttribute('role', 'listbox'); panel.setAttribute('aria-label', label);
|
|
529
|
+
panel.addEventListener('mousedown', event => event.preventDefault());
|
|
530
|
+
(textarea.closest('dialog') ?? document.body).append(panel);
|
|
531
|
+
textarea.setAttribute('aria-expanded', 'true'); textarea.setAttribute('aria-controls', id);
|
|
532
|
+
openPlace = place;
|
|
533
|
+
}
|
|
534
|
+
panel.replaceChildren();
|
|
535
|
+
const list = el('div', undefined, 'select-list'); panel.append(list);
|
|
536
|
+
list.append(el('div', label, 'select-group'));
|
|
537
|
+
options = [];
|
|
538
|
+
for (const item of found) {
|
|
539
|
+
const row = el('div', undefined, 'select-option skill-option'); row.id = `${id}-${options.length}`;
|
|
540
|
+
row.setAttribute('role', 'option');
|
|
541
|
+
row.append(el('span', item.key, 'skill-option-command'));
|
|
542
|
+
if (item.description) { row.title = item.description; row.append(el('span', item.description, 'skill-option-description')); }
|
|
543
|
+
const index = options.length;
|
|
544
|
+
row.addEventListener('mousemove', () => { if (active !== index) highlight(index); });
|
|
545
|
+
row.addEventListener('click', () => accept(item));
|
|
546
|
+
options.push({ item, row }); list.append(row);
|
|
547
|
+
}
|
|
548
|
+
panel.append(el('div', 'Up/Down to choose, Enter to insert, Esc to close', 'skill-picker-hint'));
|
|
549
|
+
highlight(Math.min(active, options.length - 1));
|
|
550
|
+
place();
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
// Arrow keys, Home and End move the caret without an input event.
|
|
554
|
+
const moved = () => !!context && (textarea.selectionStart !== context.end || textarea.selectionEnd !== context.end);
|
|
555
|
+
// A pick changes the value from script, which the browser does not report as a change when the
|
|
556
|
+
// field is left. Typing afterwards does get reported, so only an untouched pick is sent here.
|
|
557
|
+
textarea.addEventListener('input', event => { if (event.isTrusted) picked = false; update(); });
|
|
558
|
+
textarea.addEventListener('change', () => { picked = false; });
|
|
559
|
+
textarea.addEventListener('click', update);
|
|
560
|
+
textarea.addEventListener('keyup', () => { if (moved()) update(); });
|
|
561
|
+
textarea.addEventListener('blur', () => { close(); if (picked) textarea.dispatchEvent(new Event('change', { bubbles: true })); });
|
|
227
562
|
textarea.addEventListener('scroll', () => place());
|
|
228
|
-
// Capture runs before the prompt's own Escape handling (leaving full screen), so Escape closes
|
|
229
|
-
// only the picker while it is open.
|
|
230
563
|
textarea.addEventListener('keydown', event => {
|
|
564
|
+
if (panel && moved()) update();
|
|
231
565
|
if (!panel || event.isComposing) return;
|
|
232
566
|
if (event.key === 'Escape') { event.preventDefault(); event.stopImmediatePropagation(); close(); return; }
|
|
233
567
|
if (event.shiftKey || event.ctrlKey || event.metaKey || event.altKey || !options.length) return;
|
|
234
|
-
if (event.key === 'ArrowDown') { event.preventDefault(); highlight((active + 1) % options.length); }
|
|
235
|
-
else if (event.key === 'ArrowUp') { event.preventDefault(); highlight((active - 1 + options.length) % options.length); }
|
|
236
|
-
|
|
568
|
+
if (event.key === 'ArrowDown') { event.preventDefault(); navigated = true; highlight((active + 1) % options.length); }
|
|
569
|
+
else if (event.key === 'ArrowUp') { event.preventDefault(); navigated = true; highlight((active - 1 + options.length) % options.length); }
|
|
570
|
+
// Enter straight after { or , is the author starting a new line, not a pick.
|
|
571
|
+
else if (event.key === 'Tab' || (event.key === 'Enter' && (navigated || context.text !== ''))) { event.preventDefault(); accept(options[active]?.item); }
|
|
237
572
|
}, true);
|
|
238
|
-
refreshWarnings();
|
|
239
573
|
}
|
|
240
574
|
|
|
241
|
-
globalThis.AndorraSkillPicker = { attach, references, problems, problemText, invalidate: () => { cache = { at: 0, value: undefined, error: undefined, pending: undefined }; } };
|
|
575
|
+
globalThis.AndorraSkillPicker = { attach, attachKeys, keyContext, keysAhead, references, problems, problemText, skillChipRanges, chipSpan, chipSelection, chipDeletion, snapOutOfChip, invalidate: () => { cache = { at: 0, value: undefined, error: undefined, pending: undefined }; } };
|
|
242
576
|
})();
|