@andorra-labs/code 0.0.0-stage → 0.1.4
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/LICENSE.md +38 -0
- package/README.md +231 -3
- package/THIRD_PARTY_NOTICES.md +56 -0
- package/dist/src/account-presentation.d.ts +53 -0
- package/dist/src/account-presentation.js +99 -0
- package/dist/src/activity.d.ts +41 -0
- package/dist/src/activity.js +79 -0
- package/dist/src/agent-definitions.d.ts +61 -0
- package/dist/src/agent-definitions.js +303 -0
- package/dist/src/agent-execution.d.ts +4 -0
- package/dist/src/agent-execution.js +1198 -0
- package/dist/src/agent-mcp.d.ts +105 -0
- package/dist/src/agent-mcp.js +859 -0
- package/dist/src/agent-modifiers.d.ts +8 -0
- package/dist/src/agent-modifiers.js +333 -0
- package/dist/src/analytics.d.ts +81 -0
- package/dist/src/analytics.js +81 -0
- package/dist/src/anthropic-console-auth.d.ts +68 -0
- package/dist/src/anthropic-console-auth.js +318 -0
- package/dist/src/anthropic-credentials.d.ts +41 -0
- package/dist/src/anthropic-credentials.js +107 -0
- package/dist/src/app-server/protocol.d.ts +500 -0
- package/dist/src/app-server/protocol.js +106 -0
- package/dist/src/app-server/reasoning.d.ts +43 -0
- package/dist/src/app-server/reasoning.js +173 -0
- package/dist/src/app-server/terminal.d.ts +77 -0
- package/dist/src/app-server/terminal.js +177 -0
- package/dist/src/app-server/workspace.d.ts +247 -0
- package/dist/src/app-server/workspace.js +1098 -0
- package/dist/src/app-server.d.ts +1039 -0
- package/dist/src/app-server.js +6594 -0
- package/dist/src/artifacts.d.ts +27 -0
- package/dist/src/artifacts.js +103 -0
- package/dist/src/attachments.d.ts +158 -0
- package/dist/src/attachments.js +466 -0
- package/dist/src/auth/AuthManager.d.ts +110 -0
- package/dist/src/auth/AuthManager.js +435 -0
- package/dist/src/auth/callback.d.ts +10 -0
- package/dist/src/auth/callback.js +96 -0
- package/dist/src/auth/deployment.d.ts +18 -0
- package/dist/src/auth/deployment.js +18 -0
- package/dist/src/auth/index.d.ts +31 -0
- package/dist/src/auth/index.js +27 -0
- package/dist/src/auth/lock.d.ts +2 -0
- package/dist/src/auth/lock.js +29 -0
- package/dist/src/auth/store.d.ts +20 -0
- package/dist/src/auth/store.js +93 -0
- package/dist/src/auth/types.d.ts +24 -0
- package/dist/src/auth/types.js +8 -0
- package/dist/src/auth-commands.d.ts +5 -0
- package/dist/src/auth-commands.js +28 -0
- package/dist/src/automation-runner.d.ts +7 -0
- package/dist/src/automation-runner.js +113 -0
- package/dist/src/automation-service.d.ts +28 -0
- package/dist/src/automation-service.js +299 -0
- package/dist/src/automation-tool.d.ts +2 -0
- package/dist/src/automation-tool.js +49 -0
- package/dist/src/automation-worker-shutdown.d.ts +3 -0
- package/dist/src/automation-worker-shutdown.js +13 -0
- package/dist/src/automations.d.ts +63 -0
- package/dist/src/automations.js +265 -0
- package/dist/src/boot-trace.d.ts +15 -0
- package/dist/src/boot-trace.js +25 -0
- package/dist/src/browser-activity.d.ts +4 -0
- package/dist/src/browser-activity.js +18 -0
- package/dist/src/browser-bridge.d.ts +56 -0
- package/dist/src/browser-bridge.js +372 -0
- package/dist/src/browser-observation.d.ts +24 -0
- package/dist/src/browser-observation.js +104 -0
- package/dist/src/browser-panel-tool.d.ts +39 -0
- package/dist/src/browser-panel-tool.js +227 -0
- package/dist/src/browser-runner.d.ts +16 -0
- package/dist/src/browser-runner.js +302 -0
- package/dist/src/browser-server.d.ts +31 -0
- package/dist/src/browser-server.js +1189 -0
- package/dist/src/browser-session.d.ts +19 -0
- package/dist/src/browser-session.js +649 -0
- package/dist/src/browser-ui/andorra-logo.png +0 -0
- package/dist/src/browser-ui/app.js +419 -0
- package/dist/src/browser-ui/index.html +13 -0
- package/dist/src/browser-ui/style.css +243 -0
- package/dist/src/browser-view.d.ts +348 -0
- package/dist/src/browser-view.js +1487 -0
- package/dist/src/capabilities.d.ts +9 -0
- package/dist/src/capabilities.js +135 -0
- package/dist/src/clarification-ui.d.ts +23 -0
- package/dist/src/clarification-ui.js +59 -0
- package/dist/src/claude-executable.d.ts +6 -0
- package/dist/src/claude-executable.js +56 -0
- package/dist/src/claude-provider.d.ts +35 -0
- package/dist/src/claude-provider.js +391 -0
- package/dist/src/cli.d.ts +85 -0
- package/dist/src/cli.js +2564 -0
- package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +108 -0
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +616 -0
- package/dist/src/code-intelligence/ContextLedger.d.ts +32 -0
- package/dist/src/code-intelligence/ContextLedger.js +77 -0
- package/dist/src/code-intelligence/ContextRouter.d.ts +8 -0
- package/dist/src/code-intelligence/ContextRouter.js +18 -0
- package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.d.ts +82 -0
- package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.js +444 -0
- package/dist/src/code-intelligence/codegraph/CodeGraphProvider.d.ts +40 -0
- package/dist/src/code-intelligence/codegraph/CodeGraphProvider.js +84 -0
- package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.d.ts +22 -0
- package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.js +71 -0
- package/dist/src/code-intelligence/codegraph/repoExploreTool.d.ts +9 -0
- package/dist/src/code-intelligence/codegraph/repoExploreTool.js +26 -0
- package/dist/src/code-intelligence/repository.d.ts +13 -0
- package/dist/src/code-intelligence/repository.js +48 -0
- package/dist/src/code-intelligence/types.d.ts +78 -0
- package/dist/src/code-intelligence/types.js +3 -0
- package/dist/src/codex-auth.d.ts +83 -0
- package/dist/src/codex-auth.js +168 -0
- package/dist/src/codex-browser-auth.d.ts +74 -0
- package/dist/src/codex-browser-auth.js +429 -0
- package/dist/src/codex-errors.d.ts +3 -0
- package/dist/src/codex-errors.js +50 -0
- package/dist/src/codex-executable.d.ts +12 -0
- package/dist/src/codex-executable.js +154 -0
- package/dist/src/codex-provider.d.ts +25 -0
- package/dist/src/codex-provider.js +211 -0
- package/dist/src/codex-rpc.d.ts +43 -0
- package/dist/src/codex-rpc.js +136 -0
- package/dist/src/coding-tools.d.ts +19 -0
- package/dist/src/coding-tools.js +875 -0
- package/dist/src/command-metrics.d.ts +17 -0
- package/dist/src/command-metrics.js +34 -0
- package/dist/src/command-screens.d.ts +44 -0
- package/dist/src/command-screens.js +601 -0
- package/dist/src/commands.d.ts +111 -0
- package/dist/src/commands.js +550 -0
- package/dist/src/completion.d.ts +45 -0
- package/dist/src/completion.js +195 -0
- package/dist/src/config.d.ts +163 -0
- package/dist/src/config.js +663 -0
- package/dist/src/context-budget.d.ts +32 -0
- package/dist/src/context-budget.js +151 -0
- package/dist/src/context-compaction.d.ts +43 -0
- package/dist/src/context-compaction.js +269 -0
- package/dist/src/context-selection.d.ts +65 -0
- package/dist/src/context-selection.js +130 -0
- package/dist/src/dashboard-view.d.ts +37 -0
- package/dist/src/dashboard-view.js +254 -0
- package/dist/src/dashboard.d.ts +41 -0
- package/dist/src/dashboard.js +160 -0
- package/dist/src/deadline.d.ts +55 -0
- package/dist/src/deadline.js +164 -0
- package/dist/src/decision/ContinuationAdapter.d.ts +6 -0
- package/dist/src/decision/ContinuationAdapter.js +11 -0
- package/dist/src/decision/DecisionEngine.d.ts +23 -0
- package/dist/src/decision/DecisionEngine.js +1 -0
- package/dist/src/decision/DecisionManager.d.ts +47 -0
- package/dist/src/decision/DecisionManager.js +280 -0
- package/dist/src/decision/DecisionPolicy.d.ts +8 -0
- package/dist/src/decision/DecisionPolicy.js +54 -0
- package/dist/src/decision/FactContinuations.d.ts +147 -0
- package/dist/src/decision/FactContinuations.js +472 -0
- package/dist/src/decision/FactServiceGate.d.ts +12 -0
- package/dist/src/decision/FactServiceGate.js +37 -0
- package/dist/src/decision/PreparedSteps.d.ts +51 -0
- package/dist/src/decision/PreparedSteps.js +147 -0
- package/dist/src/decision/applyToolMenu.d.ts +3 -0
- package/dist/src/decision/applyToolMenu.js +61 -0
- package/dist/src/decision/checks.d.ts +13 -0
- package/dist/src/decision/checks.js +104 -0
- package/dist/src/decision/facts.d.ts +64 -0
- package/dist/src/decision/facts.js +90 -0
- package/dist/src/decision/guidancePolicy.d.ts +3 -0
- package/dist/src/decision/guidancePolicy.js +10 -0
- package/dist/src/decision/hostedPolicy.d.ts +14 -0
- package/dist/src/decision/hostedPolicy.js +21 -0
- package/dist/src/decision/index.d.ts +6 -0
- package/dist/src/decision/index.js +6 -0
- package/dist/src/decision/optimizationPolicy.d.ts +26 -0
- package/dist/src/decision/optimizationPolicy.js +38 -0
- package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +17 -0
- package/dist/src/decision/providers/AndorraDecisionProvider.js +251 -0
- package/dist/src/decision/providers/HttpDecisionProvider.d.ts +16 -0
- package/dist/src/decision/providers/HttpDecisionProvider.js +105 -0
- package/dist/src/decision/providers/NoOpDecisionProvider.d.ts +4 -0
- package/dist/src/decision/providers/NoOpDecisionProvider.js +3 -0
- package/dist/src/decision/providers/index.d.ts +3 -0
- package/dist/src/decision/providers/index.js +13 -0
- package/dist/src/decision/providers/questions.d.ts +3 -0
- package/dist/src/decision/providers/questions.js +31 -0
- package/dist/src/decision/routeTools.d.ts +59 -0
- package/dist/src/decision/routeTools.js +131 -0
- package/dist/src/decision/toolFamilies.d.ts +7 -0
- package/dist/src/decision/toolFamilies.js +55 -0
- package/dist/src/decision/toolMenu.d.ts +35 -0
- package/dist/src/decision/toolMenu.js +73 -0
- package/dist/src/decision/types.d.ts +99 -0
- package/dist/src/decision/types.js +1 -0
- package/dist/src/diff-preview.d.ts +6 -0
- package/dist/src/diff-preview.js +120 -0
- package/dist/src/duration.d.ts +44 -0
- package/dist/src/duration.js +72 -0
- package/dist/src/efficiency.d.ts +101 -0
- package/dist/src/efficiency.js +104 -0
- package/dist/src/engine/protocol.d.ts +11 -0
- package/dist/src/engine/protocol.js +51 -0
- package/dist/src/extensions.d.ts +46 -0
- package/dist/src/extensions.js +846 -0
- package/dist/src/favicons.d.ts +37 -0
- package/dist/src/favicons.js +216 -0
- package/dist/src/file-read-state.d.ts +8 -0
- package/dist/src/file-read-state.js +31 -0
- package/dist/src/git-summary.d.ts +67 -0
- package/dist/src/git-summary.js +461 -0
- package/dist/src/goal-completion-verification.d.ts +18 -0
- package/dist/src/goal-completion-verification.js +43 -0
- package/dist/src/graph-account.d.ts +31 -0
- package/dist/src/graph-account.js +57 -0
- package/dist/src/graph-editor-session.d.ts +15 -0
- package/dist/src/graph-editor-session.js +70 -0
- package/dist/src/graph-health.d.ts +88 -0
- package/dist/src/graph-health.js +243 -0
- package/dist/src/graph-provider-portability.d.ts +30 -0
- package/dist/src/graph-provider-portability.js +197 -0
- package/dist/src/graph-quota.d.ts +55 -0
- package/dist/src/graph-quota.js +131 -0
- package/dist/src/graph-runner.d.ts +4 -0
- package/dist/src/graph-runner.js +1356 -0
- package/dist/src/graph-selection.d.ts +17 -0
- package/dist/src/graph-selection.js +31 -0
- package/dist/src/graph-server.d.ts +13 -0
- package/dist/src/graph-server.js +483 -0
- package/dist/src/graph-studio-features.d.ts +61 -0
- package/dist/src/graph-studio-features.js +348 -0
- package/dist/src/graph-sync.d.ts +76 -0
- package/dist/src/graph-sync.js +619 -0
- package/dist/src/graph-ui/andorra-logo.png +0 -0
- package/dist/src/graph-ui/app.js +1803 -0
- package/dist/src/graph-ui/compat.js +43 -0
- package/dist/src/graph-ui/controls.css +190 -0
- package/dist/src/graph-ui/controls.js +567 -0
- package/dist/src/graph-ui/edge-router.js +117 -0
- package/dist/src/graph-ui/embed.js +324 -0
- package/dist/src/graph-ui/fonts/geist-mono-latin-400-normal.woff2 +0 -0
- package/dist/src/graph-ui/fonts/geist-sans-latin-400-normal.woff2 +0 -0
- package/dist/src/graph-ui/fonts/geist-sans-latin-500-normal.woff2 +0 -0
- package/dist/src/graph-ui/icons.js +117 -0
- package/dist/src/graph-ui/index.html +7 -0
- package/dist/src/graph-ui/library.css +26 -0
- package/dist/src/graph-ui/sidebar.js +61 -0
- package/dist/src/graph-ui/studio-canvas.js +454 -0
- package/dist/src/graph-ui/studio.css +110 -0
- package/dist/src/graph-ui/studio.js +720 -0
- package/dist/src/graph-ui/style.css +477 -0
- package/dist/src/graph-ui/theme.js +92 -0
- package/dist/src/graph-ui/tokens.css +187 -0
- package/dist/src/graphs.d.ts +270 -0
- package/dist/src/graphs.js +1102 -0
- package/dist/src/grep-regex-worker.d.ts +1 -0
- package/dist/src/grep-regex-worker.js +20 -0
- package/dist/src/grep-regex.d.ts +11 -0
- package/dist/src/grep-regex.js +64 -0
- package/dist/src/handoffs.d.ts +34 -0
- package/dist/src/handoffs.js +229 -0
- package/dist/src/hardened-runtime.d.ts +14 -0
- package/dist/src/hardened-runtime.js +264 -0
- package/dist/src/limits.d.ts +77 -0
- package/dist/src/limits.js +88 -0
- package/dist/src/markdown.d.ts +31 -0
- package/dist/src/markdown.js +553 -0
- package/dist/src/mcp.d.ts +11 -0
- package/dist/src/mcp.js +175 -0
- package/dist/src/membership-errors.d.ts +4 -0
- package/dist/src/membership-errors.js +4 -0
- package/dist/src/membership.d.ts +81 -0
- package/dist/src/membership.js +247 -0
- package/dist/src/memory/LocalToolMemory.d.ts +20 -0
- package/dist/src/memory/LocalToolMemory.js +114 -0
- package/dist/src/memory/MemoryDistiller.d.ts +35 -0
- package/dist/src/memory/MemoryDistiller.js +216 -0
- package/dist/src/memory/MemoryManager.d.ts +76 -0
- package/dist/src/memory/MemoryManager.js +386 -0
- package/dist/src/memory/MemoryPolicy.d.ts +30 -0
- package/dist/src/memory/MemoryPolicy.js +96 -0
- package/dist/src/memory/MemoryProvider.d.ts +18 -0
- package/dist/src/memory/MemoryProvider.js +1 -0
- package/dist/src/memory/MemoryRetriever.d.ts +27 -0
- package/dist/src/memory/MemoryRetriever.js +149 -0
- package/dist/src/memory/PermissionMemoryProvider.d.ts +22 -0
- package/dist/src/memory/PermissionMemoryProvider.js +50 -0
- package/dist/src/memory/ToolFailureLessons.d.ts +39 -0
- package/dist/src/memory/ToolFailureLessons.js +167 -0
- package/dist/src/memory/index.d.ts +12 -0
- package/dist/src/memory/index.js +11 -0
- package/dist/src/memory/providers/NoOpMemoryProvider.d.ts +13 -0
- package/dist/src/memory/providers/NoOpMemoryProvider.js +15 -0
- package/dist/src/memory/providers/graphiti/GraphitiClient.d.ts +27 -0
- package/dist/src/memory/providers/graphiti/GraphitiClient.js +76 -0
- package/dist/src/memory/providers/graphiti/GraphitiMapper.d.ts +6 -0
- package/dist/src/memory/providers/graphiti/GraphitiMapper.js +116 -0
- package/dist/src/memory/providers/graphiti/GraphitiMemoryProvider.d.ts +27 -0
- package/dist/src/memory/providers/graphiti/GraphitiMemoryProvider.js +137 -0
- package/dist/src/memory/providers/graphiti/GraphitiTypes.d.ts +57 -0
- package/dist/src/memory/providers/graphiti/GraphitiTypes.js +2 -0
- package/dist/src/memory/redaction.d.ts +11 -0
- package/dist/src/memory/redaction.js +58 -0
- package/dist/src/memory/repository.d.ts +11 -0
- package/dist/src/memory/repository.js +74 -0
- package/dist/src/memory/tools/memorySearchTool.d.ts +4 -0
- package/dist/src/memory/tools/memorySearchTool.js +77 -0
- package/dist/src/memory/types.d.ts +112 -0
- package/dist/src/memory/types.js +7 -0
- package/dist/src/model-metadata.d.ts +28 -0
- package/dist/src/model-metadata.js +274 -0
- package/dist/src/model-override.d.ts +60 -0
- package/dist/src/model-override.js +146 -0
- package/dist/src/model-tiers.d.ts +61 -0
- package/dist/src/model-tiers.js +109 -0
- package/dist/src/opencode-catalog.d.ts +16 -0
- package/dist/src/opencode-catalog.js +135 -0
- package/dist/src/opencode-provider.d.ts +10 -0
- package/dist/src/opencode-provider.js +525 -0
- package/dist/src/paged-transcript.d.ts +58 -0
- package/dist/src/paged-transcript.js +205 -0
- package/dist/src/palette.d.ts +61 -0
- package/dist/src/palette.js +63 -0
- package/dist/src/permissions.d.ts +36 -0
- package/dist/src/permissions.js +93 -0
- package/dist/src/powershell-pool.d.ts +26 -0
- package/dist/src/powershell-pool.js +235 -0
- package/dist/src/profile.d.ts +80 -0
- package/dist/src/profile.js +200 -0
- package/dist/src/provider-connection.d.ts +36 -0
- package/dist/src/provider-connection.js +222 -0
- package/dist/src/provider-engine.d.ts +37 -0
- package/dist/src/provider-engine.js +401 -0
- package/dist/src/provider-import.d.ts +68 -0
- package/dist/src/provider-import.js +355 -0
- package/dist/src/provider-settings.d.ts +8 -0
- package/dist/src/provider-settings.js +451 -0
- package/dist/src/providers.d.ts +219 -0
- package/dist/src/providers.js +1230 -0
- package/dist/src/pull-requests.d.ts +195 -0
- package/dist/src/pull-requests.js +514 -0
- package/dist/src/qa/api/http-runner.d.ts +3 -0
- package/dist/src/qa/api/http-runner.js +47 -0
- package/dist/src/qa/browser/PlaywrightRunner.d.ts +21 -0
- package/dist/src/qa/browser/PlaywrightRunner.js +190 -0
- package/dist/src/qa/command-policy.d.ts +28 -0
- package/dist/src/qa/command-policy.js +122 -0
- package/dist/src/qa/git/ChangeDetector.d.ts +26 -0
- package/dist/src/qa/git/ChangeDetector.js +177 -0
- package/dist/src/qa/git/DiffReviewer.d.ts +28 -0
- package/dist/src/qa/git/DiffReviewer.js +115 -0
- package/dist/src/qa/index.d.ts +11 -0
- package/dist/src/qa/index.js +19 -0
- package/dist/src/qa/orchestrator/ChangeClassifier.d.ts +14 -0
- package/dist/src/qa/orchestrator/ChangeClassifier.js +28 -0
- package/dist/src/qa/orchestrator/MergeGate.d.ts +14 -0
- package/dist/src/qa/orchestrator/MergeGate.js +40 -0
- package/dist/src/qa/orchestrator/QaOrchestrator.d.ts +79 -0
- package/dist/src/qa/orchestrator/QaOrchestrator.js +373 -0
- package/dist/src/qa/profile/ProjectInspector.d.ts +9 -0
- package/dist/src/qa/profile/ProjectInspector.js +295 -0
- package/dist/src/qa/profile/QaConfigLoader.d.ts +43 -0
- package/dist/src/qa/profile/QaConfigLoader.js +261 -0
- package/dist/src/qa/profile/QaProfile.d.ts +17 -0
- package/dist/src/qa/profile/QaProfile.js +15 -0
- package/dist/src/qa/profile/yaml.d.ts +12 -0
- package/dist/src/qa/profile/yaml.js +203 -0
- package/dist/src/qa/qa-authorize.d.ts +25 -0
- package/dist/src/qa/qa-authorize.js +82 -0
- package/dist/src/qa/runners/CommandRunner.d.ts +22 -0
- package/dist/src/qa/runners/CommandRunner.js +96 -0
- package/dist/src/qa/runners/TestRunner.d.ts +21 -0
- package/dist/src/qa/runners/TestRunner.js +66 -0
- package/dist/src/qa/runtime/ProcessManager.d.ts +53 -0
- package/dist/src/qa/runtime/ProcessManager.js +225 -0
- package/dist/src/qa/runtime/PtyManager.d.ts +57 -0
- package/dist/src/qa/runtime/PtyManager.js +338 -0
- package/dist/src/qa/runtime/RuntimeSmoke.d.ts +11 -0
- package/dist/src/qa/runtime/RuntimeSmoke.js +78 -0
- package/dist/src/qa/runtime-detect.d.ts +10 -0
- package/dist/src/qa/runtime-detect.js +72 -0
- package/dist/src/qa/security/DependencyScanner.d.ts +19 -0
- package/dist/src/qa/security/DependencyScanner.js +167 -0
- package/dist/src/qa/security/SecretScanner.d.ts +3 -0
- package/dist/src/qa/security/SecretScanner.js +55 -0
- package/dist/src/qa/tools.d.ts +3 -0
- package/dist/src/qa/tools.js +301 -0
- package/dist/src/qa/types.d.ts +134 -0
- package/dist/src/qa/types.js +3 -0
- package/dist/src/react-runtime.d.ts +53 -0
- package/dist/src/react-runtime.js +1753 -0
- package/dist/src/remote/cert.d.ts +29 -0
- package/dist/src/remote/cert.js +136 -0
- package/dist/src/remote/client.d.ts +189 -0
- package/dist/src/remote/client.js +659 -0
- package/dist/src/remote/command.d.ts +4 -0
- package/dist/src/remote/command.js +211 -0
- package/dist/src/remote/engine-pool.d.ts +230 -0
- package/dist/src/remote/engine-pool.js +1160 -0
- package/dist/src/remote/errors.d.ts +26 -0
- package/dist/src/remote/errors.js +21 -0
- package/dist/src/remote/network.d.ts +48 -0
- package/dist/src/remote/network.js +135 -0
- package/dist/src/remote/pairing.d.ts +98 -0
- package/dist/src/remote/pairing.js +306 -0
- package/dist/src/remote/roots.d.ts +29 -0
- package/dist/src/remote/roots.js +44 -0
- package/dist/src/remote/serve.d.ts +115 -0
- package/dist/src/remote/serve.js +274 -0
- package/dist/src/remote/server.d.ts +35 -0
- package/dist/src/remote/server.js +484 -0
- package/dist/src/remote/types.d.ts +86 -0
- package/dist/src/remote/types.js +11 -0
- package/dist/src/run-control.d.ts +17 -0
- package/dist/src/run-control.js +52 -0
- package/dist/src/run-progress.d.ts +226 -0
- package/dist/src/run-progress.js +724 -0
- package/dist/src/run-records.d.ts +500 -0
- package/dist/src/run-records.js +1678 -0
- package/dist/src/runtime.d.ts +418 -0
- package/dist/src/runtime.js +247 -0
- package/dist/src/sandbox-child.d.ts +1 -0
- package/dist/src/sandbox-child.js +14 -0
- package/dist/src/save-lock.d.ts +9 -0
- package/dist/src/save-lock.js +186 -0
- package/dist/src/session-monitor.d.ts +98 -0
- package/dist/src/session-monitor.js +323 -0
- package/dist/src/session-reaper.d.ts +23 -0
- package/dist/src/session-reaper.js +33 -0
- package/dist/src/session-summary.d.ts +27 -0
- package/dist/src/session-summary.js +66 -0
- package/dist/src/session-title.d.ts +18 -0
- package/dist/src/session-title.js +54 -0
- package/dist/src/sessions.d.ts +211 -0
- package/dist/src/sessions.js +620 -0
- package/dist/src/shell.d.ts +40 -0
- package/dist/src/shell.js +504 -0
- package/dist/src/side-panel.d.ts +144 -0
- package/dist/src/side-panel.js +366 -0
- package/dist/src/skill-commands.d.ts +1 -0
- package/dist/src/skill-commands.js +11 -0
- package/dist/src/skills/bundled/ai-elements/SKILL.md +155 -0
- package/dist/src/skills/bundled/ai-elements/references/agent.md +138 -0
- package/dist/src/skills/bundled/ai-elements/references/artifact.md +91 -0
- package/dist/src/skills/bundled/ai-elements/references/attachments.md +197 -0
- package/dist/src/skills/bundled/ai-elements/references/audio-player.md +141 -0
- package/dist/src/skills/bundled/ai-elements/references/canvas.md +39 -0
- package/dist/src/skills/bundled/ai-elements/references/chain-of-thought.md +88 -0
- package/dist/src/skills/bundled/ai-elements/references/checkpoint.md +171 -0
- package/dist/src/skills/bundled/ai-elements/references/code-block.md +177 -0
- package/dist/src/skills/bundled/ai-elements/references/commit.md +184 -0
- package/dist/src/skills/bundled/ai-elements/references/confirmation.md +268 -0
- package/dist/src/skills/bundled/ai-elements/references/connection.md +39 -0
- package/dist/src/skills/bundled/ai-elements/references/context.md +133 -0
- package/dist/src/skills/bundled/ai-elements/references/controls.md +37 -0
- package/dist/src/skills/bundled/ai-elements/references/conversation.md +224 -0
- package/dist/src/skills/bundled/ai-elements/references/edge.md +57 -0
- package/dist/src/skills/bundled/ai-elements/references/environment-variables.md +109 -0
- package/dist/src/skills/bundled/ai-elements/references/file-tree.md +79 -0
- package/dist/src/skills/bundled/ai-elements/references/image.md +150 -0
- package/dist/src/skills/bundled/ai-elements/references/inline-citation.md +300 -0
- package/dist/src/skills/bundled/ai-elements/references/jsx-preview.md +108 -0
- package/dist/src/skills/bundled/ai-elements/references/message.md +231 -0
- package/dist/src/skills/bundled/ai-elements/references/mic-selector.md +193 -0
- package/dist/src/skills/bundled/ai-elements/references/model-selector.md +119 -0
- package/dist/src/skills/bundled/ai-elements/references/node.md +78 -0
- package/dist/src/skills/bundled/ai-elements/references/open-in-chat.md +74 -0
- package/dist/src/skills/bundled/ai-elements/references/package-info.md +102 -0
- package/dist/src/skills/bundled/ai-elements/references/panel.md +38 -0
- package/dist/src/skills/bundled/ai-elements/references/persona.md +173 -0
- package/dist/src/skills/bundled/ai-elements/references/plan.md +86 -0
- package/dist/src/skills/bundled/ai-elements/references/prompt-input.md +572 -0
- package/dist/src/skills/bundled/ai-elements/references/queue.md +179 -0
- package/dist/src/skills/bundled/ai-elements/references/reasoning.md +226 -0
- package/dist/src/skills/bundled/ai-elements/references/sandbox.md +133 -0
- package/dist/src/skills/bundled/ai-elements/references/schema-display.md +109 -0
- package/dist/src/skills/bundled/ai-elements/references/shimmer.md +55 -0
- package/dist/src/skills/bundled/ai-elements/references/snippet.md +71 -0
- package/dist/src/skills/bundled/ai-elements/references/sources.md +200 -0
- package/dist/src/skills/bundled/ai-elements/references/speech-input.md +167 -0
- package/dist/src/skills/bundled/ai-elements/references/stack-trace.md +225 -0
- package/dist/src/skills/bundled/ai-elements/references/suggestion.md +128 -0
- package/dist/src/skills/bundled/ai-elements/references/task.md +222 -0
- package/dist/src/skills/bundled/ai-elements/references/terminal.md +110 -0
- package/dist/src/skills/bundled/ai-elements/references/test-results.md +164 -0
- package/dist/src/skills/bundled/ai-elements/references/tool.md +282 -0
- package/dist/src/skills/bundled/ai-elements/references/toolbar.md +37 -0
- package/dist/src/skills/bundled/ai-elements/references/transcription.md +127 -0
- package/dist/src/skills/bundled/ai-elements/references/voice-selector.md +248 -0
- package/dist/src/skills/bundled/ai-elements/references/web-preview.md +204 -0
- package/dist/src/skills/bundled/ai-elements/scripts/agent.tsx +67 -0
- package/dist/src/skills/bundled/ai-elements/scripts/artifact.tsx +117 -0
- package/dist/src/skills/bundled/ai-elements/scripts/attachments-inline.tsx +123 -0
- package/dist/src/skills/bundled/ai-elements/scripts/attachments-list.tsx +94 -0
- package/dist/src/skills/bundled/ai-elements/scripts/attachments.tsx +84 -0
- package/dist/src/skills/bundled/ai-elements/scripts/audio-player-remote.tsx +35 -0
- package/dist/src/skills/bundled/ai-elements/scripts/audio-player.tsx +74 -0
- package/dist/src/skills/bundled/ai-elements/scripts/chain-of-thought.tsx +80 -0
- package/dist/src/skills/bundled/ai-elements/scripts/checkpoint.tsx +96 -0
- package/dist/src/skills/bundled/ai-elements/scripts/code-block-dark.tsx +46 -0
- package/dist/src/skills/bundled/ai-elements/scripts/code-block.tsx +120 -0
- package/dist/src/skills/bundled/ai-elements/scripts/commit.tsx +94 -0
- package/dist/src/skills/bundled/ai-elements/scripts/confirmation-accepted.tsx +41 -0
- package/dist/src/skills/bundled/ai-elements/scripts/confirmation-rejected.tsx +41 -0
- package/dist/src/skills/bundled/ai-elements/scripts/confirmation-request.tsx +54 -0
- package/dist/src/skills/bundled/ai-elements/scripts/confirmation.tsx +59 -0
- package/dist/src/skills/bundled/ai-elements/scripts/context.tsx +45 -0
- package/dist/src/skills/bundled/ai-elements/scripts/conversation.tsx +182 -0
- package/dist/src/skills/bundled/ai-elements/scripts/environment-variables.tsx +61 -0
- package/dist/src/skills/bundled/ai-elements/scripts/file-tree-basic.tsx +20 -0
- package/dist/src/skills/bundled/ai-elements/scripts/file-tree-expanded.tsx +23 -0
- package/dist/src/skills/bundled/ai-elements/scripts/file-tree-selection.tsx +26 -0
- package/dist/src/skills/bundled/ai-elements/scripts/file-tree.tsx +44 -0
- package/dist/src/skills/bundled/ai-elements/scripts/image.tsx +20 -0
- package/dist/src/skills/bundled/ai-elements/scripts/inline-citation.tsx +101 -0
- package/dist/src/skills/bundled/ai-elements/scripts/jsx-preview.tsx +105 -0
- package/dist/src/skills/bundled/ai-elements/scripts/message.tsx +330 -0
- package/dist/src/skills/bundled/ai-elements/scripts/mic-selector.tsx +52 -0
- package/dist/src/skills/bundled/ai-elements/scripts/model-selector.tsx +368 -0
- package/dist/src/skills/bundled/ai-elements/scripts/open-in-chat.tsx +33 -0
- package/dist/src/skills/bundled/ai-elements/scripts/package-info.tsx +52 -0
- package/dist/src/skills/bundled/ai-elements/scripts/persona-command.tsx +101 -0
- package/dist/src/skills/bundled/ai-elements/scripts/persona-glint.tsx +101 -0
- package/dist/src/skills/bundled/ai-elements/scripts/persona-halo.tsx +101 -0
- package/dist/src/skills/bundled/ai-elements/scripts/persona-mana.tsx +101 -0
- package/dist/src/skills/bundled/ai-elements/scripts/persona-obsidian.tsx +101 -0
- package/dist/src/skills/bundled/ai-elements/scripts/persona-opal.tsx +101 -0
- package/dist/src/skills/bundled/ai-elements/scripts/plan.tsx +69 -0
- package/dist/src/skills/bundled/ai-elements/scripts/prompt-input-cursor.tsx +462 -0
- package/dist/src/skills/bundled/ai-elements/scripts/prompt-input-tooltip.tsx +46 -0
- package/dist/src/skills/bundled/ai-elements/scripts/prompt-input.tsx +254 -0
- package/dist/src/skills/bundled/ai-elements/scripts/queue-prompt-input.tsx +372 -0
- package/dist/src/skills/bundled/ai-elements/scripts/queue.tsx +281 -0
- package/dist/src/skills/bundled/ai-elements/scripts/reasoning.tsx +73 -0
- package/dist/src/skills/bundled/ai-elements/scripts/sandbox.tsx +171 -0
- package/dist/src/skills/bundled/ai-elements/scripts/schema-display-basic.tsx +13 -0
- package/dist/src/skills/bundled/ai-elements/scripts/schema-display-body.tsx +20 -0
- package/dist/src/skills/bundled/ai-elements/scripts/schema-display-nested.tsx +23 -0
- package/dist/src/skills/bundled/ai-elements/scripts/schema-display-params.tsx +16 -0
- package/dist/src/skills/bundled/ai-elements/scripts/schema-display.tsx +110 -0
- package/dist/src/skills/bundled/ai-elements/scripts/shimmer-duration.tsx +35 -0
- package/dist/src/skills/bundled/ai-elements/scripts/shimmer-elements.tsx +45 -0
- package/dist/src/skills/bundled/ai-elements/scripts/shimmer.tsx +17 -0
- package/dist/src/skills/bundled/ai-elements/scripts/snippet-plain.tsx +19 -0
- package/dist/src/skills/bundled/ai-elements/scripts/snippet.tsx +25 -0
- package/dist/src/skills/bundled/ai-elements/scripts/sources-custom.tsx +40 -0
- package/dist/src/skills/bundled/ai-elements/scripts/sources.tsx +33 -0
- package/dist/src/skills/bundled/ai-elements/scripts/speech-input.tsx +85 -0
- package/dist/src/skills/bundled/ai-elements/scripts/stack-trace-collapsed.tsx +39 -0
- package/dist/src/skills/bundled/ai-elements/scripts/stack-trace-no-internal.tsx +41 -0
- package/dist/src/skills/bundled/ai-elements/scripts/stack-trace.tsx +60 -0
- package/dist/src/skills/bundled/ai-elements/scripts/suggestion-input.tsx +142 -0
- package/dist/src/skills/bundled/ai-elements/scripts/suggestion.tsx +34 -0
- package/dist/src/skills/bundled/ai-elements/scripts/task.tsx +59 -0
- package/dist/src/skills/bundled/ai-elements/scripts/terminal-basic.tsx +7 -0
- package/dist/src/skills/bundled/ai-elements/scripts/terminal-clear.tsx +19 -0
- package/dist/src/skills/bundled/ai-elements/scripts/terminal-streaming.tsx +38 -0
- package/dist/src/skills/bundled/ai-elements/scripts/terminal.tsx +83 -0
- package/dist/src/skills/bundled/ai-elements/scripts/test-results-basic.tsx +27 -0
- package/dist/src/skills/bundled/ai-elements/scripts/test-results-errors.tsx +51 -0
- package/dist/src/skills/bundled/ai-elements/scripts/test-results-suites.tsx +40 -0
- package/dist/src/skills/bundled/ai-elements/scripts/test-results.tsx +84 -0
- package/dist/src/skills/bundled/ai-elements/scripts/tool-input-available.tsx +31 -0
- package/dist/src/skills/bundled/ai-elements/scripts/tool-input-streaming.tsx +30 -0
- package/dist/src/skills/bundled/ai-elements/scripts/tool-output-available.tsx +81 -0
- package/dist/src/skills/bundled/ai-elements/scripts/tool-output-error.tsx +50 -0
- package/dist/src/skills/bundled/ai-elements/scripts/tool.tsx +210 -0
- package/dist/src/skills/bundled/ai-elements/scripts/transcription.tsx +289 -0
- package/dist/src/skills/bundled/ai-elements/scripts/voice-selector.tsx +233 -0
- package/dist/src/skills/bundled/ai-elements/scripts/web-preview.tsx +105 -0
- package/dist/src/skills/bundled/control-browser/SKILL.md +21 -0
- package/dist/src/skills/bundled/dynamic-workflows/SKILL.md +1520 -0
- package/dist/src/skills/bundled/dynamic-workflows/examples.md +801 -0
- package/dist/src/skills/bundled/dynamic-workflows/patterns.md +460 -0
- package/dist/src/skills/bundled/provenance.json +684 -0
- package/dist/src/skills/bundled/web-gui-tester/SKILL.md +159 -0
- package/dist/src/skills/project-skills.d.ts +11 -0
- package/dist/src/skills/project-skills.js +132 -0
- package/dist/src/skills/runtime-skills.d.ts +10 -0
- package/dist/src/skills/runtime-skills.js +237 -0
- package/dist/src/subagent-run.d.ts +278 -0
- package/dist/src/subagent-run.js +930 -0
- package/dist/src/telemetry/aggregate.d.ts +80 -0
- package/dist/src/telemetry/aggregate.js +217 -0
- package/dist/src/telemetry/capture-core.d.ts +190 -0
- package/dist/src/telemetry/capture-core.js +374 -0
- package/dist/src/telemetry/capture.d.ts +5 -0
- package/dist/src/telemetry/capture.js +16 -0
- package/dist/src/telemetry/classify.d.ts +102 -0
- package/dist/src/telemetry/classify.js +252 -0
- package/dist/src/telemetry/decision-capture.d.ts +13 -0
- package/dist/src/telemetry/decision-capture.js +40 -0
- package/dist/src/telemetry/emitter.d.ts +77 -0
- package/dist/src/telemetry/emitter.js +279 -0
- package/dist/src/telemetry/gate.d.ts +48 -0
- package/dist/src/telemetry/gate.js +55 -0
- package/dist/src/telemetry/identity.d.ts +19 -0
- package/dist/src/telemetry/identity.js +109 -0
- package/dist/src/telemetry/outbox.d.ts +91 -0
- package/dist/src/telemetry/outbox.js +356 -0
- package/dist/src/telemetry/schema.d.ts +184 -0
- package/dist/src/telemetry/schema.js +492 -0
- package/dist/src/telemetry/state.d.ts +90 -0
- package/dist/src/telemetry/state.js +195 -0
- package/dist/src/telemetry/surface.d.ts +76 -0
- package/dist/src/telemetry/surface.js +116 -0
- package/dist/src/telemetry/uploader.d.ts +29 -0
- package/dist/src/telemetry/uploader.js +151 -0
- package/dist/src/telemetry/uploads.d.ts +13 -0
- package/dist/src/telemetry/uploads.js +19 -0
- package/dist/src/telemetry/version.d.ts +5 -0
- package/dist/src/telemetry/version.js +25 -0
- package/dist/src/telemetry/workspace.d.ts +14 -0
- package/dist/src/telemetry/workspace.js +93 -0
- package/dist/src/terminal-ui.d.ts +744 -0
- package/dist/src/terminal-ui.js +3012 -0
- package/dist/src/text.d.ts +2 -0
- package/dist/src/text.js +8 -0
- package/dist/src/timers.d.ts +189 -0
- package/dist/src/timers.js +244 -0
- package/dist/src/todos.d.ts +12 -0
- package/dist/src/todos.js +33 -0
- package/dist/src/token-rate.d.ts +119 -0
- package/dist/src/token-rate.js +287 -0
- package/dist/src/tool-activity.d.ts +20 -0
- package/dist/src/tool-activity.js +76 -0
- package/dist/src/tool-call-clock.d.ts +32 -0
- package/dist/src/tool-call-clock.js +157 -0
- package/dist/src/tool-catalog.d.ts +40 -0
- package/dist/src/tool-catalog.js +100 -0
- package/dist/src/tool-dependencies.d.ts +23 -0
- package/dist/src/tool-dependencies.js +36 -0
- package/dist/src/tool-diff-stats.d.ts +24 -0
- package/dist/src/tool-diff-stats.js +122 -0
- package/dist/src/tool-errors.d.ts +12 -0
- package/dist/src/tool-errors.js +13 -0
- package/dist/src/tool-failure-tracker.d.ts +17 -0
- package/dist/src/tool-failure-tracker.js +71 -0
- package/dist/src/tool-names.d.ts +16 -0
- package/dist/src/tool-names.js +75 -0
- package/dist/src/tool-result-filter.d.ts +65 -0
- package/dist/src/tool-result-filter.js +447 -0
- package/dist/src/tool-schema-compatibility.d.ts +2 -0
- package/dist/src/tool-schema-compatibility.js +42 -0
- package/dist/src/tools.d.ts +3 -0
- package/dist/src/tools.js +663 -0
- package/dist/src/trajectory.d.ts +34 -0
- package/dist/src/trajectory.js +426 -0
- package/dist/src/transcript.d.ts +45 -0
- package/dist/src/transcript.js +228 -0
- package/dist/src/types.d.ts +248 -0
- package/dist/src/types.js +1 -0
- package/dist/src/update.d.ts +48 -0
- package/dist/src/update.js +614 -0
- package/dist/src/usage-analytics.d.ts +48 -0
- package/dist/src/usage-analytics.js +663 -0
- package/dist/src/widgets.d.ts +45 -0
- package/dist/src/widgets.js +71 -0
- package/dist/src/workspace-facts.d.ts +35 -0
- package/dist/src/workspace-facts.js +85 -0
- package/dist/src/workspace-git-metadata.d.ts +6 -0
- package/dist/src/workspace-git-metadata.js +114 -0
- package/dist/src/workspace-instructions.d.ts +7 -0
- package/dist/src/workspace-instructions.js +46 -0
- package/dist/vendor/engine/LICENSE.upstream +21 -0
- package/dist/vendor/engine/provenance.json +17923 -0
- package/dist/vendor/engine/runtime/agent/agent-loop.d.ts +23 -0
- package/dist/vendor/engine/runtime/agent/agent-loop.js +601 -0
- package/dist/vendor/engine/runtime/agent/agent.d.ts +130 -0
- package/dist/vendor/engine/runtime/agent/agent.js +430 -0
- package/dist/vendor/engine/runtime/agent/harness/agent-harness.d.ts +715 -0
- package/dist/vendor/engine/runtime/agent/harness/agent-harness.js +5 -0
- package/dist/vendor/engine/runtime/agent/harness/compaction/branch-summarization.d.ts +67 -0
- package/dist/vendor/engine/runtime/agent/harness/compaction/branch-summarization.js +175 -0
- package/dist/vendor/engine/runtime/agent/harness/compaction/compaction.d.ts +125 -0
- package/dist/vendor/engine/runtime/agent/harness/compaction/compaction.js +559 -0
- package/dist/vendor/engine/runtime/agent/harness/compaction/utils.d.ts +24 -0
- package/dist/vendor/engine/runtime/agent/harness/compaction/utils.js +119 -0
- package/dist/vendor/engine/runtime/agent/harness/config.d.ts +8 -0
- package/dist/vendor/engine/runtime/agent/harness/config.js +34 -0
- package/dist/vendor/engine/runtime/agent/harness/context.d.ts +8 -0
- package/dist/vendor/engine/runtime/agent/harness/context.js +12 -0
- package/dist/vendor/engine/runtime/agent/harness/events.d.ts +24 -0
- package/dist/vendor/engine/runtime/agent/harness/events.js +249 -0
- package/dist/vendor/engine/runtime/agent/harness/execution/assistant.d.ts +41 -0
- package/dist/vendor/engine/runtime/agent/harness/execution/assistant.js +81 -0
- package/dist/vendor/engine/runtime/agent/harness/execution/effect-gate.d.ts +21 -0
- package/dist/vendor/engine/runtime/agent/harness/execution/effect-gate.js +48 -0
- package/dist/vendor/engine/runtime/agent/harness/execution/tools.d.ts +66 -0
- package/dist/vendor/engine/runtime/agent/harness/execution/tools.js +118 -0
- package/dist/vendor/engine/runtime/agent/harness/hooks.d.ts +37 -0
- package/dist/vendor/engine/runtime/agent/harness/hooks.js +405 -0
- package/dist/vendor/engine/runtime/agent/harness/messages.d.ts +50 -0
- package/dist/vendor/engine/runtime/agent/harness/messages.js +102 -0
- package/dist/vendor/engine/runtime/agent/harness/prompt-templates.d.ts +48 -0
- package/dist/vendor/engine/runtime/agent/harness/prompt-templates.js +224 -0
- package/dist/vendor/engine/runtime/agent/harness/result.d.ts +132 -0
- package/dist/vendor/engine/runtime/agent/harness/result.js +80 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/boundary.d.ts +27 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/boundary.js +172 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/checkpoint.d.ts +7 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/checkpoint.js +132 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/deferred.d.ts +14 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/deferred.js +178 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/generation.d.ts +7 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/generation.js +204 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/reconcile.d.ts +4 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/reconcile.js +139 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/recovery.d.ts +7 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/recovery.js +84 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/response.d.ts +22 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/response.js +393 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/retry.d.ts +3 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/retry.js +33 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/structural.d.ts +31 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/structural.js +928 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/terminal.d.ts +6 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/terminal.js +48 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/tool-placement.d.ts +13 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/tool-placement.js +218 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/tools.d.ts +5 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive/tools.js +448 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive.d.ts +5 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/drive.js +92 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/harness.d.ts +58 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/harness.js +310 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/lane.d.ts +117 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/lane.js +1574 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/progress.d.ts +14 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/progress.js +65 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/reducer.d.ts +4 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/reducer.js +239 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/restore.d.ts +23 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/restore.js +116 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/transcript.d.ts +20 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/transcript.js +71 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/types.d.ts +104 -0
- package/dist/vendor/engine/runtime/agent/harness/runtime/types.js +60 -0
- package/dist/vendor/engine/runtime/agent/harness/session/commit.d.ts +52 -0
- package/dist/vendor/engine/runtime/agent/harness/session/commit.js +56 -0
- package/dist/vendor/engine/runtime/agent/harness/session/context.d.ts +9 -0
- package/dist/vendor/engine/runtime/agent/harness/session/context.js +48 -0
- package/dist/vendor/engine/runtime/agent/harness/session/fork-policy.d.ts +20 -0
- package/dist/vendor/engine/runtime/agent/harness/session/fork-policy.js +54 -0
- package/dist/vendor/engine/runtime/agent/harness/session/fork.d.ts +15 -0
- package/dist/vendor/engine/runtime/agent/harness/session/fork.js +78 -0
- package/dist/vendor/engine/runtime/agent/harness/session/in-memory-storage-state.d.ts +38 -0
- package/dist/vendor/engine/runtime/agent/harness/session/in-memory-storage-state.js +275 -0
- package/dist/vendor/engine/runtime/agent/harness/session/index.d.ts +10 -0
- package/dist/vendor/engine/runtime/agent/harness/session/index.js +8 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/codec.d.ts +20 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/codec.js +44 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/fork.d.ts +37 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/fork.js +263 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/index.d.ts +3 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/index.js +3 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/io.d.ts +13 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/io.js +85 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/legacy-v3.d.ts +43 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/legacy-v3.js +461 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/repo.d.ts +34 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/repo.js +300 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/storage.d.ts +40 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/storage.js +199 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/types.d.ts +38 -0
- package/dist/vendor/engine/runtime/agent/harness/session/jsonl/types.js +2 -0
- package/dist/vendor/engine/runtime/agent/harness/session/memory.d.ts +47 -0
- package/dist/vendor/engine/runtime/agent/harness/session/memory.js +368 -0
- package/dist/vendor/engine/runtime/agent/harness/session/mutation-line.d.ts +7 -0
- package/dist/vendor/engine/runtime/agent/harness/session/mutation-line.js +20 -0
- package/dist/vendor/engine/runtime/agent/harness/session/session.d.ts +81 -0
- package/dist/vendor/engine/runtime/agent/harness/session/session.js +360 -0
- package/dist/vendor/engine/runtime/agent/harness/session/types.d.ts +511 -0
- package/dist/vendor/engine/runtime/agent/harness/session/types.js +8 -0
- package/dist/vendor/engine/runtime/agent/harness/session/values.d.ts +94 -0
- package/dist/vendor/engine/runtime/agent/harness/session/values.js +80 -0
- package/dist/vendor/engine/runtime/agent/harness/skills.d.ts +45 -0
- package/dist/vendor/engine/runtime/agent/harness/skills.js +325 -0
- package/dist/vendor/engine/runtime/agent/harness/system-prompt.d.ts +2 -0
- package/dist/vendor/engine/runtime/agent/harness/system-prompt.js +29 -0
- package/dist/vendor/engine/runtime/agent/harness/telemetry.d.ts +1241 -0
- package/dist/vendor/engine/runtime/agent/harness/telemetry.js +526 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/bash.d.ts +26 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/bash.js +104 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/edit-diff.d.ts +88 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/edit-diff.js +385 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/edit.d.ts +18 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/edit.js +107 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/file-mutation-queue.d.ts +4 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/file-mutation-queue.js +45 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/image.d.ts +2 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/image.js +105 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/index.d.ts +5 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/index.js +4 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/path-utils.d.ts +4 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/path-utils.js +25 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/read.d.ts +34 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/read.js +107 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/tool-context.d.ts +5 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/tool-context.js +1 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/write.d.ts +10 -0
- package/dist/vendor/engine/runtime/agent/harness/tools/write.js +30 -0
- package/dist/vendor/engine/runtime/agent/harness/types.d.ts +304 -0
- package/dist/vendor/engine/runtime/agent/harness/types.js +74 -0
- package/dist/vendor/engine/runtime/agent/harness/utils/adaptive-publisher.d.ts +23 -0
- package/dist/vendor/engine/runtime/agent/harness/utils/adaptive-publisher.js +78 -0
- package/dist/vendor/engine/runtime/agent/harness/utils/output-capture.d.ts +30 -0
- package/dist/vendor/engine/runtime/agent/harness/utils/output-capture.js +216 -0
- package/dist/vendor/engine/runtime/agent/harness/utils/shell-output.d.ts +28 -0
- package/dist/vendor/engine/runtime/agent/harness/utils/shell-output.js +70 -0
- package/dist/vendor/engine/runtime/agent/harness/utils/truncate.d.ts +70 -0
- package/dist/vendor/engine/runtime/agent/harness/utils/truncate.js +295 -0
- package/dist/vendor/engine/runtime/agent/harness/utils/usage.d.ts +3 -0
- package/dist/vendor/engine/runtime/agent/harness/utils/usage.js +32 -0
- package/dist/vendor/engine/runtime/agent/index.d.ts +27 -0
- package/dist/vendor/engine/runtime/agent/index.js +25 -0
- package/dist/vendor/engine/runtime/agent/proxy.d.ts +71 -0
- package/dist/vendor/engine/runtime/agent/proxy.js +309 -0
- package/dist/vendor/engine/runtime/agent/search/index.d.ts +28 -0
- package/dist/vendor/engine/runtime/agent/search/index.js +1 -0
- package/dist/vendor/engine/runtime/agent/stream-fn.d.ts +9 -0
- package/dist/vendor/engine/runtime/agent/stream-fn.js +16 -0
- package/dist/vendor/engine/runtime/agent/types.d.ts +431 -0
- package/dist/vendor/engine/runtime/agent/types.js +1 -0
- package/dist/vendor/engine/runtime/ai/api/anthropic-messages.d.ts +70 -0
- package/dist/vendor/engine/runtime/ai/api/anthropic-messages.js +1204 -0
- package/dist/vendor/engine/runtime/ai/api/anthropic-messages.lazy.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/api/anthropic-messages.lazy.js +2 -0
- package/dist/vendor/engine/runtime/ai/api/azure-openai-responses.d.ts +16 -0
- package/dist/vendor/engine/runtime/ai/api/azure-openai-responses.js +260 -0
- package/dist/vendor/engine/runtime/ai/api/azure-openai-responses.lazy.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/api/azure-openai-responses.lazy.js +2 -0
- package/dist/vendor/engine/runtime/ai/api/bedrock-converse-stream.d.ts +37 -0
- package/dist/vendor/engine/runtime/ai/api/bedrock-converse-stream.js +1091 -0
- package/dist/vendor/engine/runtime/ai/api/bedrock-converse-stream.lazy.d.ts +9 -0
- package/dist/vendor/engine/runtime/ai/api/bedrock-converse-stream.lazy.js +21 -0
- package/dist/vendor/engine/runtime/ai/api/constrained-sampling.d.ts +19 -0
- package/dist/vendor/engine/runtime/ai/api/constrained-sampling.js +221 -0
- package/dist/vendor/engine/runtime/ai/api/github-copilot-headers.d.ts +7 -0
- package/dist/vendor/engine/runtime/ai/api/github-copilot-headers.js +28 -0
- package/dist/vendor/engine/runtime/ai/api/google-generative-ai.d.ts +12 -0
- package/dist/vendor/engine/runtime/ai/api/google-generative-ai.js +368 -0
- package/dist/vendor/engine/runtime/ai/api/google-generative-ai.lazy.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/api/google-generative-ai.lazy.js +2 -0
- package/dist/vendor/engine/runtime/ai/api/google-shared.d.ts +92 -0
- package/dist/vendor/engine/runtime/ai/api/google-shared.js +450 -0
- package/dist/vendor/engine/runtime/ai/api/google-vertex.d.ts +14 -0
- package/dist/vendor/engine/runtime/ai/api/google-vertex.js +429 -0
- package/dist/vendor/engine/runtime/ai/api/google-vertex.lazy.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/api/google-vertex.lazy.js +2 -0
- package/dist/vendor/engine/runtime/ai/api/lazy.d.ts +24 -0
- package/dist/vendor/engine/runtime/ai/api/lazy.js +69 -0
- package/dist/vendor/engine/runtime/ai/api/mistral-conversations.d.ts +24 -0
- package/dist/vendor/engine/runtime/ai/api/mistral-conversations.js +747 -0
- package/dist/vendor/engine/runtime/ai/api/mistral-conversations.lazy.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/api/mistral-conversations.lazy.js +2 -0
- package/dist/vendor/engine/runtime/ai/api/openai-codex-responses.d.ts +30 -0
- package/dist/vendor/engine/runtime/ai/api/openai-codex-responses.js +1302 -0
- package/dist/vendor/engine/runtime/ai/api/openai-codex-responses.lazy.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/api/openai-codex-responses.lazy.js +2 -0
- package/dist/vendor/engine/runtime/ai/api/openai-completions.d.ts +25 -0
- package/dist/vendor/engine/runtime/ai/api/openai-completions.js +1339 -0
- package/dist/vendor/engine/runtime/ai/api/openai-completions.lazy.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/api/openai-completions.lazy.js +2 -0
- package/dist/vendor/engine/runtime/ai/api/openai-prompt-cache.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/api/openai-prompt-cache.js +9 -0
- package/dist/vendor/engine/runtime/ai/api/openai-responses-shared.d.ts +27 -0
- package/dist/vendor/engine/runtime/ai/api/openai-responses-shared.js +688 -0
- package/dist/vendor/engine/runtime/ai/api/openai-responses.d.ts +13 -0
- package/dist/vendor/engine/runtime/ai/api/openai-responses.js +292 -0
- package/dist/vendor/engine/runtime/ai/api/openai-responses.lazy.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/api/openai-responses.lazy.js +2 -0
- package/dist/vendor/engine/runtime/ai/api/openrouter-images.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/api/openrouter-images.js +131 -0
- package/dist/vendor/engine/runtime/ai/api/openrouter-images.lazy.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/api/openrouter-images.lazy.js +3 -0
- package/dist/vendor/engine/runtime/ai/api/pi-messages.d.ts +98 -0
- package/dist/vendor/engine/runtime/ai/api/pi-messages.js +312 -0
- package/dist/vendor/engine/runtime/ai/api/pi-messages.lazy.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/api/pi-messages.lazy.js +2 -0
- package/dist/vendor/engine/runtime/ai/api/simple-options.d.ts +14 -0
- package/dist/vendor/engine/runtime/ai/api/simple-options.js +65 -0
- package/dist/vendor/engine/runtime/ai/api/transform-messages.d.ts +7 -0
- package/dist/vendor/engine/runtime/ai/api/transform-messages.js +200 -0
- package/dist/vendor/engine/runtime/ai/auth/context.d.ts +6 -0
- package/dist/vendor/engine/runtime/ai/auth/context.js +33 -0
- package/dist/vendor/engine/runtime/ai/auth/credential-store.d.ts +16 -0
- package/dist/vendor/engine/runtime/ai/auth/credential-store.js +50 -0
- package/dist/vendor/engine/runtime/ai/auth/helpers.d.ts +21 -0
- package/dist/vendor/engine/runtime/ai/auth/helpers.js +52 -0
- package/dist/vendor/engine/runtime/ai/auth/oauth/load.d.ts +28 -0
- package/dist/vendor/engine/runtime/ai/auth/oauth/load.js +55 -0
- package/dist/vendor/engine/runtime/ai/auth/resolve.d.ts +26 -0
- package/dist/vendor/engine/runtime/ai/auth/resolve.js +131 -0
- package/dist/vendor/engine/runtime/ai/auth/types.d.ts +230 -0
- package/dist/vendor/engine/runtime/ai/auth/types.js +1 -0
- package/dist/vendor/engine/runtime/ai/compat/extension-oauth-types.d.ts +38 -0
- package/dist/vendor/engine/runtime/ai/compat/extension-oauth-types.js +1 -0
- package/dist/vendor/engine/runtime/ai/compat.d.ts +66 -0
- package/dist/vendor/engine/runtime/ai/compat.js +201 -0
- package/dist/vendor/engine/runtime/ai/env-api-keys.d.ts +20 -0
- package/dist/vendor/engine/runtime/ai/env-api-keys.js +148 -0
- package/dist/vendor/engine/runtime/ai/image-models.d.ts +9 -0
- package/dist/vendor/engine/runtime/ai/image-models.generated.d.ts +814 -0
- package/dist/vendor/engine/runtime/ai/image-models.generated.js +816 -0
- package/dist/vendor/engine/runtime/ai/image-models.js +22 -0
- package/dist/vendor/engine/runtime/ai/images-api-registry.d.ts +13 -0
- package/dist/vendor/engine/runtime/ai/images-api-registry.js +21 -0
- package/dist/vendor/engine/runtime/ai/images-models.d.ts +94 -0
- package/dist/vendor/engine/runtime/ai/images-models.js +142 -0
- package/dist/vendor/engine/runtime/ai/images.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/images.js +13 -0
- package/dist/vendor/engine/runtime/ai/index.d.ts +36 -0
- package/dist/vendor/engine/runtime/ai/index.js +23 -0
- package/dist/vendor/engine/runtime/ai/legacy-api-aliases.d.ts +41 -0
- package/dist/vendor/engine/runtime/ai/legacy-api-aliases.js +48 -0
- package/dist/vendor/engine/runtime/ai/model-catalog.d.ts +16 -0
- package/dist/vendor/engine/runtime/ai/model-catalog.js +3 -0
- package/dist/vendor/engine/runtime/ai/models-store.d.ts +28 -0
- package/dist/vendor/engine/runtime/ai/models-store.js +16 -0
- package/dist/vendor/engine/runtime/ai/models.d.ts +201 -0
- package/dist/vendor/engine/runtime/ai/models.generated.d.ts +84 -0
- package/dist/vendor/engine/runtime/ai/models.generated.js +86 -0
- package/dist/vendor/engine/runtime/ai/models.js +593 -0
- package/dist/vendor/engine/runtime/ai/oauth.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/oauth.js +1 -0
- package/dist/vendor/engine/runtime/ai/providers/all.d.ts +27 -0
- package/dist/vendor/engine/runtime/ai/providers/all.js +132 -0
- package/dist/vendor/engine/runtime/ai/providers/amazon-bedrock.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/amazon-bedrock.js +92 -0
- package/dist/vendor/engine/runtime/ai/providers/amazon-bedrock.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/amazon-bedrock.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/ant-ling.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/ant-ling.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/ant-ling.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/ant-ling.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/anthropic.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/anthropic.js +55 -0
- package/dist/vendor/engine/runtime/ai/providers/anthropic.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/anthropic.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/azure-openai-responses.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/azure-openai-responses.js +13 -0
- package/dist/vendor/engine/runtime/ai/providers/azure-openai-responses.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/azure-openai-responses.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/baseten.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/baseten.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/baseten.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/baseten.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/cerebras.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/cerebras.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/cerebras.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/cerebras.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/cloudflare-ai-gateway.d.ts +4 -0
- package/dist/vendor/engine/runtime/ai/providers/cloudflare-ai-gateway.js +24 -0
- package/dist/vendor/engine/runtime/ai/providers/cloudflare-ai-gateway.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/cloudflare-ai-gateway.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/cloudflare-auth.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/cloudflare-auth.js +85 -0
- package/dist/vendor/engine/runtime/ai/providers/cloudflare-stream.d.ts +7 -0
- package/dist/vendor/engine/runtime/ai/providers/cloudflare-stream.js +20 -0
- package/dist/vendor/engine/runtime/ai/providers/cloudflare-workers-ai.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/cloudflare-workers-ai.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/cloudflare-workers-ai.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/cloudflare-workers-ai.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/data/.manifest.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/amazon-bedrock.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/ant-ling.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/anthropic.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/azure-openai-responses.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/baseten.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/cerebras.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/cloudflare-ai-gateway.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/cloudflare-workers-ai.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/deepseek.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/fireworks.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/github-copilot.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/google-vertex.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/google.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/groq.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/huggingface.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/kimi-coding.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/meta.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/minimax-cn.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/minimax.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/mistral.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/moonshotai-cn.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/moonshotai.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/nvidia.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/openai-codex.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/openai.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/opencode-go.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/opencode.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/openrouter.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/qwen-token-plan-cn.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/qwen-token-plan-individual.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/qwen-token-plan.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/radius.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/together.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/vercel-ai-gateway.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/xai.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/xiaomi-token-plan-ams.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/xiaomi-token-plan-cn.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/xiaomi-token-plan-sgp.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/xiaomi.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/zai-coding-cn.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/data/zai.json +1 -0
- package/dist/vendor/engine/runtime/ai/providers/deepseek.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/deepseek.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/deepseek.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/deepseek.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/faux.d.ts +102 -0
- package/dist/vendor/engine/runtime/ai/providers/faux.js +488 -0
- package/dist/vendor/engine/runtime/ai/providers/fireworks.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/fireworks.js +18 -0
- package/dist/vendor/engine/runtime/ai/providers/fireworks.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/fireworks.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/github-copilot.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/github-copilot.js +34 -0
- package/dist/vendor/engine/runtime/ai/providers/github-copilot.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/github-copilot.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/google-vertex.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/google-vertex.js +93 -0
- package/dist/vendor/engine/runtime/ai/providers/google-vertex.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/google-vertex.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/google.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/google.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/google.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/google.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/groq.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/groq.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/groq.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/groq.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/huggingface.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/huggingface.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/huggingface.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/huggingface.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/images/register-builtins.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/images/register-builtins.js +33 -0
- package/dist/vendor/engine/runtime/ai/providers/kimi-coding.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/kimi-coding.js +23 -0
- package/dist/vendor/engine/runtime/ai/providers/kimi-coding.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/kimi-coding.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/meta.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/meta.js +23 -0
- package/dist/vendor/engine/runtime/ai/providers/meta.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/meta.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/minimax-cn.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/minimax-cn.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/minimax-cn.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/minimax-cn.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/minimax.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/minimax.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/minimax.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/minimax.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/mistral.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/mistral.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/mistral.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/mistral.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/moonshotai-cn.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/moonshotai-cn.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/moonshotai-cn.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/moonshotai-cn.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/moonshotai.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/moonshotai.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/moonshotai.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/moonshotai.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/nvidia.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/nvidia.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/nvidia.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/nvidia.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/openai-codex.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/openai-codex.js +21 -0
- package/dist/vendor/engine/runtime/ai/providers/openai-codex.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/openai-codex.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/openai.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/openai.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/openai.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/openai.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/opencode-go.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/opencode-go.js +20 -0
- package/dist/vendor/engine/runtime/ai/providers/opencode-go.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/opencode-go.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/opencode-headers.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/opencode-headers.js +21 -0
- package/dist/vendor/engine/runtime/ai/providers/opencode.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/opencode.js +22 -0
- package/dist/vendor/engine/runtime/ai/providers/opencode.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/opencode.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/openrouter-images.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/openrouter-images.js +21 -0
- package/dist/vendor/engine/runtime/ai/providers/openrouter.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/openrouter.js +26 -0
- package/dist/vendor/engine/runtime/ai/providers/openrouter.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/openrouter.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-cn.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-cn.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-cn.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-cn.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-individual.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-individual.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-individual.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan-individual.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/qwen-token-plan.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/radius-config.d.ts +25 -0
- package/dist/vendor/engine/runtime/ai/providers/radius-config.js +62 -0
- package/dist/vendor/engine/runtime/ai/providers/radius.d.ts +8 -0
- package/dist/vendor/engine/runtime/ai/providers/radius.js +77 -0
- package/dist/vendor/engine/runtime/ai/providers/radius.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/radius.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/together.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/together.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/together.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/together.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/vercel-ai-gateway.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/vercel-ai-gateway.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/vercel-ai-gateway.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/vercel-ai-gateway.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/xai.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/xai.js +23 -0
- package/dist/vendor/engine/runtime/ai/providers/xai.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/xai.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-ams.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-ams.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-ams.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-ams.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-cn.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-cn.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-cn.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-cn.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-sgp.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-sgp.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-sgp.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi-token-plan-sgp.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/xiaomi.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/zai-coding-cn.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/zai-coding-cn.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/zai-coding-cn.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/zai-coding-cn.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/providers/zai.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/providers/zai.js +14 -0
- package/dist/vendor/engine/runtime/ai/providers/zai.models.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/providers/zai.models.js +5 -0
- package/dist/vendor/engine/runtime/ai/session-resources.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/session-resources.js +21 -0
- package/dist/vendor/engine/runtime/ai/types.d.ts +835 -0
- package/dist/vendor/engine/runtime/ai/types.js +1 -0
- package/dist/vendor/engine/runtime/ai/utils/abort-signals.d.ts +5 -0
- package/dist/vendor/engine/runtime/ai/utils/abort-signals.js +33 -0
- package/dist/vendor/engine/runtime/ai/utils/abort.d.ts +7 -0
- package/dist/vendor/engine/runtime/ai/utils/abort.js +48 -0
- package/dist/vendor/engine/runtime/ai/utils/assistant-message-frame.d.ts +76 -0
- package/dist/vendor/engine/runtime/ai/utils/assistant-message-frame.js +424 -0
- package/dist/vendor/engine/runtime/ai/utils/diagnostics.d.ts +19 -0
- package/dist/vendor/engine/runtime/ai/utils/diagnostics.js +24 -0
- package/dist/vendor/engine/runtime/ai/utils/error-body.d.ts +24 -0
- package/dist/vendor/engine/runtime/ai/utils/error-body.js +132 -0
- package/dist/vendor/engine/runtime/ai/utils/estimate.d.ts +16 -0
- package/dist/vendor/engine/runtime/ai/utils/estimate.js +94 -0
- package/dist/vendor/engine/runtime/ai/utils/event-stream.d.ts +20 -0
- package/dist/vendor/engine/runtime/ai/utils/event-stream.js +98 -0
- package/dist/vendor/engine/runtime/ai/utils/hash.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/utils/hash.js +13 -0
- package/dist/vendor/engine/runtime/ai/utils/headers.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/utils/headers.js +17 -0
- package/dist/vendor/engine/runtime/ai/utils/json-parse.d.ts +15 -0
- package/dist/vendor/engine/runtime/ai/utils/json-parse.js +112 -0
- package/dist/vendor/engine/runtime/ai/utils/node-http-proxy.d.ts +3 -0
- package/dist/vendor/engine/runtime/ai/utils/node-http-proxy.js +132 -0
- package/dist/vendor/engine/runtime/ai/utils/overflow.d.ts +68 -0
- package/dist/vendor/engine/runtime/ai/utils/overflow.js +177 -0
- package/dist/vendor/engine/runtime/ai/utils/pi-user-agent.d.ts +1 -0
- package/dist/vendor/engine/runtime/ai/utils/pi-user-agent.js +11 -0
- package/dist/vendor/engine/runtime/ai/utils/provider-env.d.ts +6 -0
- package/dist/vendor/engine/runtime/ai/utils/provider-env.js +43 -0
- package/dist/vendor/engine/runtime/ai/utils/provider-retry.d.ts +15 -0
- package/dist/vendor/engine/runtime/ai/utils/provider-retry.js +93 -0
- package/dist/vendor/engine/runtime/ai/utils/retry.d.ts +57 -0
- package/dist/vendor/engine/runtime/ai/utils/retry.js +182 -0
- package/dist/vendor/engine/runtime/ai/utils/sanitize-unicode.d.ts +21 -0
- package/dist/vendor/engine/runtime/ai/utils/sanitize-unicode.js +25 -0
- package/dist/vendor/engine/runtime/ai/utils/text.d.ts +13 -0
- package/dist/vendor/engine/runtime/ai/utils/text.js +35 -0
- package/dist/vendor/engine/runtime/ai/utils/transcript.d.ts +83 -0
- package/dist/vendor/engine/runtime/ai/utils/transcript.js +203 -0
- package/dist/vendor/engine/runtime/ai/utils/typebox-helpers.d.ts +16 -0
- package/dist/vendor/engine/runtime/ai/utils/typebox-helpers.js +20 -0
- package/dist/vendor/engine/runtime/ai/utils/uuid.d.ts +2 -0
- package/dist/vendor/engine/runtime/ai/utils/uuid.js +41 -0
- package/dist/vendor/engine/runtime/ai/utils/validation.d.ts +17 -0
- package/dist/vendor/engine/runtime/ai/utils/validation.js +308 -0
- package/dist/vendor/engine/runtime/chord/api.d.ts +14 -0
- package/dist/vendor/engine/runtime/chord/api.js +71 -0
- package/dist/vendor/engine/runtime/chord/context/index.d.ts +23 -0
- package/dist/vendor/engine/runtime/chord/context/index.js +96 -0
- package/dist/vendor/engine/runtime/chord/delta/index.d.ts +118 -0
- package/dist/vendor/engine/runtime/chord/delta/index.js +1903 -0
- package/dist/vendor/engine/runtime/chord/facets/host.d.ts +11 -0
- package/dist/vendor/engine/runtime/chord/facets/host.js +762 -0
- package/dist/vendor/engine/runtime/chord/facets/loader.d.ts +2 -0
- package/dist/vendor/engine/runtime/chord/facets/loader.js +4 -0
- package/dist/vendor/engine/runtime/chord/index.d.ts +10 -0
- package/dist/vendor/engine/runtime/chord/index.js +9 -0
- package/dist/vendor/engine/runtime/chord/json.d.ts +3 -0
- package/dist/vendor/engine/runtime/chord/json.js +56 -0
- package/dist/vendor/engine/runtime/chord/services/consumer.d.ts +10 -0
- package/dist/vendor/engine/runtime/chord/services/consumer.js +536 -0
- package/dist/vendor/engine/runtime/chord/services/errors.d.ts +7 -0
- package/dist/vendor/engine/runtime/chord/services/errors.js +21 -0
- package/dist/vendor/engine/runtime/chord/services/handle.d.ts +14 -0
- package/dist/vendor/engine/runtime/chord/services/handle.js +100 -0
- package/dist/vendor/engine/runtime/chord/services/instances.d.ts +24 -0
- package/dist/vendor/engine/runtime/chord/services/instances.js +136 -0
- package/dist/vendor/engine/runtime/chord/services/loopback.d.ts +4 -0
- package/dist/vendor/engine/runtime/chord/services/loopback.js +14 -0
- package/dist/vendor/engine/runtime/chord/services/provider.d.ts +36 -0
- package/dist/vendor/engine/runtime/chord/services/provider.js +471 -0
- package/dist/vendor/engine/runtime/chord/services/state-codec.d.ts +14 -0
- package/dist/vendor/engine/runtime/chord/services/state-codec.js +114 -0
- package/dist/vendor/engine/runtime/chord/services/state-internals.d.ts +10 -0
- package/dist/vendor/engine/runtime/chord/services/state-internals.js +9 -0
- package/dist/vendor/engine/runtime/chord/services/state.d.ts +22 -0
- package/dist/vendor/engine/runtime/chord/services/state.js +123 -0
- package/dist/vendor/engine/runtime/chord/services/wire.d.ts +59 -0
- package/dist/vendor/engine/runtime/chord/services/wire.js +172 -0
- package/dist/vendor/engine/runtime/chord/types.d.ts +202 -0
- package/dist/vendor/engine/runtime/chord/types.js +1 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/args.d.ts +60 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/args.js +439 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/auth-check.d.ts +18 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/auth-check.js +49 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/auth-command.d.ts +23 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/auth-command.js +102 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/config-selector.d.ts +15 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/config-selector.js +31 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/credential-print.d.ts +12 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/credential-print.js +75 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/file-processor.d.ts +14 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/file-processor.js +70 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/initial-message.d.ts +17 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/initial-message.js +21 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/list-models.d.ts +8 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/list-models.js +97 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/project-trust.d.ts +9 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/project-trust.js +47 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/session-picker.d.ts +9 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/session-picker.js +35 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/startup-ui.d.ts +19 -0
- package/dist/vendor/engine/runtime/coding-agent/cli/startup-ui.js +184 -0
- package/dist/vendor/engine/runtime/coding-agent/config.d.ts +97 -0
- package/dist/vendor/engine/runtime/coding-agent/config.js +463 -0
- package/dist/vendor/engine/runtime/coding-agent/core/agent-session-runtime.d.ts +118 -0
- package/dist/vendor/engine/runtime/coding-agent/core/agent-session-runtime.js +316 -0
- package/dist/vendor/engine/runtime/coding-agent/core/agent-session-services.d.ts +85 -0
- package/dist/vendor/engine/runtime/coding-agent/core/agent-session-services.js +133 -0
- package/dist/vendor/engine/runtime/coding-agent/core/agent-session.d.ts +771 -0
- package/dist/vendor/engine/runtime/coding-agent/core/agent-session.js +2990 -0
- package/dist/vendor/engine/runtime/coding-agent/core/auth-guidance.d.ts +4 -0
- package/dist/vendor/engine/runtime/coding-agent/core/auth-guidance.js +20 -0
- package/dist/vendor/engine/runtime/coding-agent/core/auth-storage.d.ts +71 -0
- package/dist/vendor/engine/runtime/coding-agent/core/auth-storage.js +425 -0
- package/dist/vendor/engine/runtime/coding-agent/core/bash-executor.d.ts +31 -0
- package/dist/vendor/engine/runtime/coding-agent/core/bash-executor.js +110 -0
- package/dist/vendor/engine/runtime/coding-agent/core/bug-report-upload.d.ts +11 -0
- package/dist/vendor/engine/runtime/coding-agent/core/bug-report-upload.js +21 -0
- package/dist/vendor/engine/runtime/coding-agent/core/bug-report.d.ts +175 -0
- package/dist/vendor/engine/runtime/coding-agent/core/bug-report.js +291 -0
- package/dist/vendor/engine/runtime/coding-agent/core/cache-stats.d.ts +48 -0
- package/dist/vendor/engine/runtime/coding-agent/core/cache-stats.js +111 -0
- package/dist/vendor/engine/runtime/coding-agent/core/cache-warmer.d.ts +102 -0
- package/dist/vendor/engine/runtime/coding-agent/core/cache-warmer.js +355 -0
- package/dist/vendor/engine/runtime/coding-agent/core/compaction/branch-summarization.d.ts +97 -0
- package/dist/vendor/engine/runtime/coding-agent/core/compaction/branch-summarization.js +250 -0
- package/dist/vendor/engine/runtime/coding-agent/core/compaction/compaction.d.ts +142 -0
- package/dist/vendor/engine/runtime/coding-agent/core/compaction/compaction.js +666 -0
- package/dist/vendor/engine/runtime/coding-agent/core/compaction/index.d.ts +6 -0
- package/dist/vendor/engine/runtime/coding-agent/core/compaction/index.js +6 -0
- package/dist/vendor/engine/runtime/coding-agent/core/compaction/utils.d.ts +37 -0
- package/dist/vendor/engine/runtime/coding-agent/core/compaction/utils.js +141 -0
- package/dist/vendor/engine/runtime/coding-agent/core/crash-log.d.ts +26 -0
- package/dist/vendor/engine/runtime/coding-agent/core/crash-log.js +138 -0
- package/dist/vendor/engine/runtime/coding-agent/core/defaults.d.ts +3 -0
- package/dist/vendor/engine/runtime/coding-agent/core/defaults.js +10 -0
- package/dist/vendor/engine/runtime/coding-agent/core/diagnostics.d.ts +14 -0
- package/dist/vendor/engine/runtime/coding-agent/core/diagnostics.js +1 -0
- package/dist/vendor/engine/runtime/coding-agent/core/event-bus.d.ts +8 -0
- package/dist/vendor/engine/runtime/coding-agent/core/event-bus.js +24 -0
- package/dist/vendor/engine/runtime/coding-agent/core/exec.d.ts +28 -0
- package/dist/vendor/engine/runtime/coding-agent/core/exec.js +74 -0
- package/dist/vendor/engine/runtime/coding-agent/core/experimental.d.ts +1 -0
- package/dist/vendor/engine/runtime/coding-agent/core/experimental.js +3 -0
- package/dist/vendor/engine/runtime/coding-agent/core/export-html/ansi-to-html.d.ts +21 -0
- package/dist/vendor/engine/runtime/coding-agent/core/export-html/ansi-to-html.js +248 -0
- package/dist/vendor/engine/runtime/coding-agent/core/export-html/index.d.ts +36 -0
- package/dist/vendor/engine/runtime/coding-agent/core/export-html/index.js +225 -0
- package/dist/vendor/engine/runtime/coding-agent/core/export-html/template.css +1066 -0
- package/dist/vendor/engine/runtime/coding-agent/core/export-html/template.html +55 -0
- package/dist/vendor/engine/runtime/coding-agent/core/export-html/template.js +1864 -0
- package/dist/vendor/engine/runtime/coding-agent/core/export-html/tool-renderer.d.ts +33 -0
- package/dist/vendor/engine/runtime/coding-agent/core/export-html/tool-renderer.js +107 -0
- package/dist/vendor/engine/runtime/coding-agent/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/vendor/engine/runtime/coding-agent/core/export-html/vendor/marked.min.js +78 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/index.d.ts +11 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/index.js +8 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/jiti-loader.d.ts +1 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/jiti-loader.js +3 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/jiti-static-loader.d.ts +1 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/jiti-static-loader.js +3 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/loader.d.ts +22 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/loader.js +633 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/runner.d.ts +180 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/runner.js +1028 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/types.d.ts +1362 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/types.js +47 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/virtual-modules.d.ts +2 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/virtual-modules.js +37 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/wrapper.d.ts +19 -0
- package/dist/vendor/engine/runtime/coding-agent/core/extensions/wrapper.js +21 -0
- package/dist/vendor/engine/runtime/coding-agent/core/footer-data-provider.d.ts +63 -0
- package/dist/vendor/engine/runtime/coding-agent/core/footer-data-provider.js +337 -0
- package/dist/vendor/engine/runtime/coding-agent/core/http-dispatcher.d.ts +21 -0
- package/dist/vendor/engine/runtime/coding-agent/core/http-dispatcher.js +97 -0
- package/dist/vendor/engine/runtime/coding-agent/core/keybindings.d.ts +427 -0
- package/dist/vendor/engine/runtime/coding-agent/core/keybindings.js +320 -0
- package/dist/vendor/engine/runtime/coding-agent/core/messages.d.ts +76 -0
- package/dist/vendor/engine/runtime/coding-agent/core/messages.js +123 -0
- package/dist/vendor/engine/runtime/coding-agent/core/model-config.d.ts +723 -0
- package/dist/vendor/engine/runtime/coding-agent/core/model-config.js +281 -0
- package/dist/vendor/engine/runtime/coding-agent/core/model-registry.d.ts +48 -0
- package/dist/vendor/engine/runtime/coding-agent/core/model-registry.js +114 -0
- package/dist/vendor/engine/runtime/coding-agent/core/model-resolver.d.ts +123 -0
- package/dist/vendor/engine/runtime/coding-agent/core/model-resolver.js +589 -0
- package/dist/vendor/engine/runtime/coding-agent/core/model-runtime.d.ts +100 -0
- package/dist/vendor/engine/runtime/coding-agent/core/model-runtime.js +603 -0
- package/dist/vendor/engine/runtime/coding-agent/core/models-store.d.ts +21 -0
- package/dist/vendor/engine/runtime/coding-agent/core/models-store.js +114 -0
- package/dist/vendor/engine/runtime/coding-agent/core/output-guard.d.ts +6 -0
- package/dist/vendor/engine/runtime/coding-agent/core/output-guard.js +88 -0
- package/dist/vendor/engine/runtime/coding-agent/core/package-manager.d.ts +212 -0
- package/dist/vendor/engine/runtime/coding-agent/core/package-manager.js +2176 -0
- package/dist/vendor/engine/runtime/coding-agent/core/pi-manifest.d.ts +7 -0
- package/dist/vendor/engine/runtime/coding-agent/core/pi-manifest.js +25 -0
- package/dist/vendor/engine/runtime/coding-agent/core/project-trust.d.ts +14 -0
- package/dist/vendor/engine/runtime/coding-agent/core/project-trust.js +58 -0
- package/dist/vendor/engine/runtime/coding-agent/core/prompt-templates.d.ts +53 -0
- package/dist/vendor/engine/runtime/coding-agent/core/prompt-templates.js +235 -0
- package/dist/vendor/engine/runtime/coding-agent/core/provider-attribution.d.ts +3 -0
- package/dist/vendor/engine/runtime/coding-agent/core/provider-attribution.js +71 -0
- package/dist/vendor/engine/runtime/coding-agent/core/provider-composer.d.ts +59 -0
- package/dist/vendor/engine/runtime/coding-agent/core/provider-composer.js +422 -0
- package/dist/vendor/engine/runtime/coding-agent/core/radius.d.ts +4 -0
- package/dist/vendor/engine/runtime/coding-agent/core/radius.js +7 -0
- package/dist/vendor/engine/runtime/coding-agent/core/remote-catalog-provider.d.ts +4 -0
- package/dist/vendor/engine/runtime/coding-agent/core/remote-catalog-provider.js +121 -0
- package/dist/vendor/engine/runtime/coding-agent/core/resolve-config-value.d.ts +29 -0
- package/dist/vendor/engine/runtime/coding-agent/core/resolve-config-value.js +246 -0
- package/dist/vendor/engine/runtime/coding-agent/core/resource-loader.d.ts +220 -0
- package/dist/vendor/engine/runtime/coding-agent/core/resource-loader.js +874 -0
- package/dist/vendor/engine/runtime/coding-agent/core/runtime-credentials.d.ts +14 -0
- package/dist/vendor/engine/runtime/coding-agent/core/runtime-credentials.js +38 -0
- package/dist/vendor/engine/runtime/coding-agent/core/sdk.d.ts +107 -0
- package/dist/vendor/engine/runtime/coding-agent/core/sdk.js +296 -0
- package/dist/vendor/engine/runtime/coding-agent/core/session-cwd.d.ts +18 -0
- package/dist/vendor/engine/runtime/coding-agent/core/session-cwd.js +37 -0
- package/dist/vendor/engine/runtime/coding-agent/core/session-export.d.ts +7 -0
- package/dist/vendor/engine/runtime/coding-agent/core/session-export.js +32 -0
- package/dist/vendor/engine/runtime/coding-agent/core/session-manager.d.ts +379 -0
- package/dist/vendor/engine/runtime/coding-agent/core/session-manager.js +1432 -0
- package/dist/vendor/engine/runtime/coding-agent/core/settings-diagnostics.d.ts +8 -0
- package/dist/vendor/engine/runtime/coding-agent/core/settings-diagnostics.js +20 -0
- package/dist/vendor/engine/runtime/coding-agent/core/settings-manager.d.ts +346 -0
- package/dist/vendor/engine/runtime/coding-agent/core/settings-manager.js +1032 -0
- package/dist/vendor/engine/runtime/coding-agent/core/skills.d.ts +59 -0
- package/dist/vendor/engine/runtime/coding-agent/core/skills.js +406 -0
- package/dist/vendor/engine/runtime/coding-agent/core/slash-commands.d.ts +14 -0
- package/dist/vendor/engine/runtime/coding-agent/core/slash-commands.js +27 -0
- package/dist/vendor/engine/runtime/coding-agent/core/source-info.d.ts +17 -0
- package/dist/vendor/engine/runtime/coding-agent/core/source-info.js +18 -0
- package/dist/vendor/engine/runtime/coding-agent/core/system-prompt.d.ts +70 -0
- package/dist/vendor/engine/runtime/coding-agent/core/system-prompt.js +146 -0
- package/dist/vendor/engine/runtime/coding-agent/core/telemetry.d.ts +2 -0
- package/dist/vendor/engine/runtime/coding-agent/core/telemetry.js +8 -0
- package/dist/vendor/engine/runtime/coding-agent/core/timings.d.ts +9 -0
- package/dist/vendor/engine/runtime/coding-agent/core/timings.js +40 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/bash.d.ts +89 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/bash.js +303 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/edit-diff.d.ts +100 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/edit-diff.js +420 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/edit.d.ts +43 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/edit.js +146 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/file-mutation-queue.d.ts +5 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/file-mutation-queue.js +51 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/find.d.ts +41 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/find.js +250 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/grep.d.ts +40 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/grep.js +251 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/index.d.ts +42 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/index.js +128 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/ls.d.ts +40 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/ls.js +125 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/output-accumulator.d.ts +54 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/output-accumulator.js +189 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/path-utils.d.ts +9 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/path-utils.js +98 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/powershell.d.ts +15 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/powershell.js +38 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/read.d.ts +41 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/read.js +168 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/render-utils.d.ts +23 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/render-utils.js +64 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/bash.d.ts +11 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/bash.js +137 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/edit.d.ts +22 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/edit.js +166 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/find.d.ts +9 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/find.js +63 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/grep.d.ts +9 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/grep.js +68 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/index.d.ts +27 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/index.js +46 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/ls.d.ts +9 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/ls.js +57 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/read.d.ts +10 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/read.js +128 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/write.d.ts +9 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/renderers/write.js +152 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/tool-definition-wrapper.d.ts +13 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/tool-definition-wrapper.js +35 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/truncate.d.ts +69 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/truncate.js +214 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/write.d.ts +29 -0
- package/dist/vendor/engine/runtime/coding-agent/core/tools/write.js +60 -0
- package/dist/vendor/engine/runtime/coding-agent/core/trust-manager.d.ts +35 -0
- package/dist/vendor/engine/runtime/coding-agent/core/trust-manager.js +202 -0
- package/dist/vendor/engine/runtime/coding-agent/core/usage-totals.d.ts +18 -0
- package/dist/vendor/engine/runtime/coding-agent/core/usage-totals.js +55 -0
- package/dist/vendor/engine/runtime/coding-agent/extensions/index.d.ts +2 -0
- package/dist/vendor/engine/runtime/coding-agent/extensions/index.js +2 -0
- package/dist/vendor/engine/runtime/coding-agent/extensions/llama/client.d.ts +68 -0
- package/dist/vendor/engine/runtime/coding-agent/extensions/llama/client.js +312 -0
- package/dist/vendor/engine/runtime/coding-agent/extensions/llama/huggingface.d.ts +22 -0
- package/dist/vendor/engine/runtime/coding-agent/extensions/llama/huggingface.js +140 -0
- package/dist/vendor/engine/runtime/coding-agent/extensions/llama/index.d.ts +2 -0
- package/dist/vendor/engine/runtime/coding-agent/extensions/llama/index.js +218 -0
- package/dist/vendor/engine/runtime/coding-agent/extensions/llama/provider.d.ts +11 -0
- package/dist/vendor/engine/runtime/coding-agent/extensions/llama/provider.js +160 -0
- package/dist/vendor/engine/runtime/coding-agent/extensions/llama/ui.d.ts +41 -0
- package/dist/vendor/engine/runtime/coding-agent/extensions/llama/ui.js +415 -0
- package/dist/vendor/engine/runtime/coding-agent/index.d.ts +36 -0
- package/dist/vendor/engine/runtime/coding-agent/index.js +47 -0
- package/dist/vendor/engine/runtime/coding-agent/main.d.ts +15 -0
- package/dist/vendor/engine/runtime/coding-agent/main.js +808 -0
- package/dist/vendor/engine/runtime/coding-agent/migrations.d.ts +32 -0
- package/dist/vendor/engine/runtime/coding-agent/migrations.js +281 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/index.d.ts +9 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/index.js +7 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/bug-report.d.ts +15 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/bug-report.js +209 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/chat-viewport.d.ts +19 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/chat-viewport.js +27 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/armin.d.ts +33 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/armin.js +332 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/assistant-message.d.ts +25 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/assistant-message.js +157 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/bash-execution.d.ts +33 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/bash-execution.js +174 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/bordered-loader.d.ts +15 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/bordered-loader.js +53 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/branch-summary-message.d.ts +15 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/branch-summary-message.js +50 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/compaction-summary-message.d.ts +15 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/compaction-summary-message.js +51 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/config-selector.d.ts +101 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/config-selector.js +760 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/countdown-timer.d.ts +13 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/countdown-timer.js +32 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/custom-editor.d.ts +29 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/custom-editor.js +114 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/custom-entry.d.ts +18 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/custom-entry.js +51 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/custom-message.d.ts +21 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/custom-message.js +86 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/daxnuts.d.ts +22 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/daxnuts.js +139 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/diff.d.ts +11 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/diff.js +132 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/dynamic-border.d.ts +14 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/dynamic-border.js +20 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/earendil-announcement.d.ts +4 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/earendil-announcement.js +39 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/extension-editor.d.ts +23 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/extension-editor.js +102 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/extension-input.d.ts +24 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/extension-input.js +66 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/extension-selector.d.ts +26 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/extension-selector.js +86 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/first-time-setup.d.ts +24 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/first-time-setup.js +102 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/footer.d.ts +31 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/footer.js +224 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/index.d.ts +33 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/index.js +34 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/keybinding-hints.d.ts +12 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/keybinding-hints.js +35 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/login-dialog.d.ts +51 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/login-dialog.js +187 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/markdown-transform.d.ts +2 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/markdown-transform.js +18 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/mermaid.d.ts +10 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/mermaid.js +74 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/model-selector.d.ts +59 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/model-selector.js +360 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/oauth-selector.d.ts +32 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/oauth-selector.js +162 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/scoped-models-selector.d.ts +45 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/scoped-models-selector.js +325 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/session-selector-search.d.ts +22 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/session-selector-search.js +154 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/session-selector.d.ts +94 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/session-selector.js +892 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/settings-selector.d.ts +93 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/settings-selector.js +719 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/settings-submenu.d.ts +71 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/settings-submenu.js +164 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/show-images-selector.d.ts +9 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/show-images-selector.js +38 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/skill-invocation-message.d.ts +16 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/skill-invocation-message.js +53 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/status-indicator.d.ts +29 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/status-indicator.js +66 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/theme-selector.d.ts +10 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/theme-selector.js +49 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/thinking-selector.d.ts +22 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/thinking-selector.js +108 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/tool-execution.d.ts +79 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/tool-execution.js +336 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/tree-selector.d.ts +93 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/tree-selector.js +1246 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/trust-selector.d.ts +22 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/trust-selector.js +90 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/user-message-selector.d.ts +29 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/user-message-selector.js +113 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/user-message.d.ts +15 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/user-message.js +48 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/visual-truncate.d.ts +23 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/components/visual-truncate.js +32 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/external-editor.d.ts +11 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/external-editor.js +37 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/interactive-mode.d.ts +467 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/interactive-mode.js +5720 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/model-catalog-refresh.d.ts +6 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/model-catalog-refresh.js +33 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/model-search.d.ts +11 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/model-search.js +14 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/session-share.d.ts +17 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/session-share.js +187 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/dark.json +91 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/light.json +90 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme-controller.d.ts +40 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme-controller.js +129 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme-json.d.ts +83 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme-json.js +129 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme-schema.json +356 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme.d.ts +130 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/theme/theme.js +990 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/tui-renderer.d.ts +20 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/interactive/tui-renderer.js +65 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/json-event.d.ts +33 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/json-event.js +28 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/print-mode.d.ts +27 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/print-mode.js +141 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/rpc/jsonl.d.ts +16 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/rpc/jsonl.js +48 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/rpc/rpc-client.d.ts +253 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/rpc/rpc-client.js +494 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/rpc/rpc-mode.d.ts +19 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/rpc/rpc-mode.js +656 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/rpc/rpc-types.d.ts +468 -0
- package/dist/vendor/engine/runtime/coding-agent/modes/rpc/rpc-types.js +7 -0
- package/dist/vendor/engine/runtime/coding-agent/package-manager-cli.d.ts +8 -0
- package/dist/vendor/engine/runtime/coding-agent/package-manager-cli.js +960 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/abort.d.ts +4 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/abort.js +47 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/ansi.d.ts +1 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/ansi.js +51 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/changelog.d.ts +21 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/changelog.js +164 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/child-process.d.ts +17 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/child-process.js +105 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/clipboard-command.d.ts +6 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/clipboard-command.js +44 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/clipboard-image.d.ts +10 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/clipboard-image.js +216 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/clipboard.d.ts +3 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/clipboard.js +150 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/exif-orientation.d.ts +4 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/exif-orientation.js +156 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/frontmatter.d.ts +7 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/frontmatter.js +26 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/fs-watch.d.ts +4 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/fs-watch.js +24 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/git.d.ts +25 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/git.js +194 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/html.d.ts +6 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/html.js +39 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/image-convert.d.ts +9 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/image-convert.js +44 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/image-process.d.ts +17 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/image-process.js +82 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/image-resize-core.d.ts +29 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/image-resize-core.js +123 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/image-resize-worker.d.ts +1 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/image-resize-worker.js +30 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/image-resize.d.ts +15 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/image-resize.js +96 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/json.d.ts +2 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/json.js +6 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/management-http.d.ts +24 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/management-http.js +53 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/mime.d.ts +2 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/mime.js +109 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/open-browser.d.ts +8 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/open-browser.js +21 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/paths.d.ts +33 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/paths.js +113 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/photon.d.ts +20 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/photon.js +120 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/pi-user-agent.d.ts +1 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/pi-user-agent.js +4 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/shell.d.ts +33 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/shell.js +215 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/sleep.d.ts +4 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/sleep.js +16 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/syntax-highlight.d.ts +12 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/syntax-highlight.js +176 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/text.d.ts +7 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/text.js +8 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/tool-result-images.d.ts +20 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/tool-result-images.js +47 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/tools-manager.d.ts +12 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/tools-manager.js +308 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/version-check.d.ts +18 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/version-check.js +78 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/windows-self-update.d.ts +2 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/windows-self-update.js +76 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/wsl.d.ts +2 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/wsl.js +14 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/zip.d.ts +6 -0
- package/dist/vendor/engine/runtime/coding-agent/utils/zip.js +59 -0
- package/dist/vendor/engine/runtime/package.json +9 -0
- package/dist/vendor/engine/runtime/telemetry/index.d.ts +193 -0
- package/dist/vendor/engine/runtime/telemetry/index.js +17 -0
- package/dist/vendor/engine/runtime/telemetry/memory.d.ts +25 -0
- package/dist/vendor/engine/runtime/telemetry/memory.js +153 -0
- package/dist/vendor/engine/runtime/telemetry/noop.d.ts +3 -0
- package/dist/vendor/engine/runtime/telemetry/noop.js +17 -0
- package/dist/vendor/engine/runtime/tui/alt-screen-search.d.ts +45 -0
- package/dist/vendor/engine/runtime/tui/alt-screen-search.js +281 -0
- package/dist/vendor/engine/runtime/tui/autocomplete.d.ts +56 -0
- package/dist/vendor/engine/runtime/tui/autocomplete.js +671 -0
- package/dist/vendor/engine/runtime/tui/components/alt-screen-flash.d.ts +12 -0
- package/dist/vendor/engine/runtime/tui/components/alt-screen-flash.js +36 -0
- package/dist/vendor/engine/runtime/tui/components/box.d.ts +23 -0
- package/dist/vendor/engine/runtime/tui/components/box.js +132 -0
- package/dist/vendor/engine/runtime/tui/components/cancellable-loader.d.ts +21 -0
- package/dist/vendor/engine/runtime/tui/components/cancellable-loader.js +34 -0
- package/dist/vendor/engine/runtime/tui/components/editor.d.ts +259 -0
- package/dist/vendor/engine/runtime/tui/components/editor.js +2041 -0
- package/dist/vendor/engine/runtime/tui/components/h-stack.d.ts +6 -0
- package/dist/vendor/engine/runtime/tui/components/h-stack.js +42 -0
- package/dist/vendor/engine/runtime/tui/components/image.d.ts +27 -0
- package/dist/vendor/engine/runtime/tui/components/image.js +89 -0
- package/dist/vendor/engine/runtime/tui/components/input.d.ts +47 -0
- package/dist/vendor/engine/runtime/tui/components/input.js +416 -0
- package/dist/vendor/engine/runtime/tui/components/loader.d.ts +32 -0
- package/dist/vendor/engine/runtime/tui/components/loader.js +75 -0
- package/dist/vendor/engine/runtime/tui/components/markdown.d.ts +102 -0
- package/dist/vendor/engine/runtime/tui/components/markdown.js +810 -0
- package/dist/vendor/engine/runtime/tui/components/mouse-region.d.ts +11 -0
- package/dist/vendor/engine/runtime/tui/components/mouse-region.js +20 -0
- package/dist/vendor/engine/runtime/tui/components/scroll-view.d.ts +58 -0
- package/dist/vendor/engine/runtime/tui/components/scroll-view.js +194 -0
- package/dist/vendor/engine/runtime/tui/components/select-list.d.ts +52 -0
- package/dist/vendor/engine/runtime/tui/components/select-list.js +205 -0
- package/dist/vendor/engine/runtime/tui/components/settings-list.d.ts +59 -0
- package/dist/vendor/engine/runtime/tui/components/settings-list.js +251 -0
- package/dist/vendor/engine/runtime/tui/components/spacer.d.ts +11 -0
- package/dist/vendor/engine/runtime/tui/components/spacer.js +22 -0
- package/dist/vendor/engine/runtime/tui/components/stack.d.ts +31 -0
- package/dist/vendor/engine/runtime/tui/components/stack.js +110 -0
- package/dist/vendor/engine/runtime/tui/components/text.d.ts +18 -0
- package/dist/vendor/engine/runtime/tui/components/text.js +89 -0
- package/dist/vendor/engine/runtime/tui/components/truncated-text.d.ts +12 -0
- package/dist/vendor/engine/runtime/tui/components/truncated-text.js +50 -0
- package/dist/vendor/engine/runtime/tui/components/v-stack.d.ts +7 -0
- package/dist/vendor/engine/runtime/tui/components/v-stack.js +25 -0
- package/dist/vendor/engine/runtime/tui/editor-component.d.ts +38 -0
- package/dist/vendor/engine/runtime/tui/editor-component.js +1 -0
- package/dist/vendor/engine/runtime/tui/fuzzy.d.ts +15 -0
- package/dist/vendor/engine/runtime/tui/fuzzy.js +110 -0
- package/dist/vendor/engine/runtime/tui/index.d.ts +32 -0
- package/dist/vendor/engine/runtime/tui/index.js +44 -0
- package/dist/vendor/engine/runtime/tui/keybindings.d.ts +272 -0
- package/dist/vendor/engine/runtime/tui/keybindings.js +232 -0
- package/dist/vendor/engine/runtime/tui/keys.d.ts +183 -0
- package/dist/vendor/engine/runtime/tui/keys.js +1173 -0
- package/dist/vendor/engine/runtime/tui/kill-ring.d.ts +27 -0
- package/dist/vendor/engine/runtime/tui/kill-ring.js +43 -0
- package/dist/vendor/engine/runtime/tui/latex.d.ts +9 -0
- package/dist/vendor/engine/runtime/tui/latex.js +1377 -0
- package/dist/vendor/engine/runtime/tui/layout-node.d.ts +39 -0
- package/dist/vendor/engine/runtime/tui/layout-node.js +5 -0
- package/dist/vendor/engine/runtime/tui/layout.d.ts +41 -0
- package/dist/vendor/engine/runtime/tui/layout.js +343 -0
- package/dist/vendor/engine/runtime/tui/native-modifiers.d.ts +3 -0
- package/dist/vendor/engine/runtime/tui/native-modifiers.js +12 -0
- package/dist/vendor/engine/runtime/tui/native-module-path.d.ts +6 -0
- package/dist/vendor/engine/runtime/tui/native-module-path.js +18 -0
- package/dist/vendor/engine/runtime/tui/native-platform.d.ts +17 -0
- package/dist/vendor/engine/runtime/tui/native-platform.js +41 -0
- package/dist/vendor/engine/runtime/tui/stdin-buffer.d.ts +55 -0
- package/dist/vendor/engine/runtime/tui/stdin-buffer.js +365 -0
- package/dist/vendor/engine/runtime/tui/terminal-colors.d.ts +9 -0
- package/dist/vendor/engine/runtime/tui/terminal-colors.js +58 -0
- package/dist/vendor/engine/runtime/tui/terminal-image.d.ts +117 -0
- package/dist/vendor/engine/runtime/tui/terminal-image.js +549 -0
- package/dist/vendor/engine/runtime/tui/terminal.d.ts +122 -0
- package/dist/vendor/engine/runtime/tui/terminal.js +441 -0
- package/dist/vendor/engine/runtime/tui/tui-alt-screen.d.ts +159 -0
- package/dist/vendor/engine/runtime/tui/tui-alt-screen.js +1507 -0
- package/dist/vendor/engine/runtime/tui/tui-main-screen.d.ts +38 -0
- package/dist/vendor/engine/runtime/tui/tui-main-screen.js +593 -0
- package/dist/vendor/engine/runtime/tui/tui.d.ts +385 -0
- package/dist/vendor/engine/runtime/tui/tui.js +1054 -0
- package/dist/vendor/engine/runtime/tui/undo-stack.d.ts +16 -0
- package/dist/vendor/engine/runtime/tui/undo-stack.js +24 -0
- package/dist/vendor/engine/runtime/tui/utils.d.ts +100 -0
- package/dist/vendor/engine/runtime/tui/utils.js +1203 -0
- package/dist/vendor/engine/runtime/tui/word-navigation.d.ts +24 -0
- package/dist/vendor/engine/runtime/tui/word-navigation.js +95 -0
- package/dist/vendor/zcode/LICENSE.upstream +202 -0
- package/dist/vendor/zcode/provenance.json +141 -0
- package/dist/vendor/zcode/source/agent/turn-machine.d.ts +56 -0
- package/dist/vendor/zcode/source/agent/turn-machine.js +214 -0
- package/dist/vendor/zcode/source/agent/turn-state.d.ts +118 -0
- package/dist/vendor/zcode/source/agent/turn-state.js +93 -0
- package/dist/vendor/zcode/source/compact/manual.d.ts +11 -0
- package/dist/vendor/zcode/source/compact/manual.js +38 -0
- package/dist/vendor/zcode/source/compact/microcompact.d.ts +47 -0
- package/dist/vendor/zcode/source/compact/microcompact.js +194 -0
- package/dist/vendor/zcode/source/compact/policy.d.ts +59 -0
- package/dist/vendor/zcode/source/compact/policy.js +89 -0
- package/dist/vendor/zcode/source/compact/selection.d.ts +6 -0
- package/dist/vendor/zcode/source/compact/selection.js +12 -0
- package/dist/vendor/zcode/source/contracts.d.ts +52 -0
- package/dist/vendor/zcode/source/contracts.js +9 -0
- package/dist/vendor/zcode/source/runtime/goal-completion-verification.d.ts +17 -0
- package/dist/vendor/zcode/source/runtime/goal-completion-verification.js +138 -0
- package/dist/vendor/zcode/source/runtime/turn-loop.d.ts +3 -0
- package/dist/vendor/zcode/source/runtime/turn-loop.js +21 -0
- package/dist/vendor/zcode/source/runtime/turn-model-step.d.ts +54 -0
- package/dist/vendor/zcode/source/runtime/turn-model-step.js +97 -0
- package/dist/vendor/zcode/source/runtime/turn-output-token-continuation.d.ts +8 -0
- package/dist/vendor/zcode/source/runtime/turn-output-token-continuation.js +15 -0
- package/dist/vendor/zcode/source/runtime/turn-stop.d.ts +6 -0
- package/dist/vendor/zcode/source/runtime/turn-stop.js +18 -0
- package/dist/vendor/zcode/source/tool/executor/validation.d.ts +6 -0
- package/dist/vendor/zcode/source/tool/executor/validation.js +76 -0
- package/dist/vendor/zcode/source/tool/input-normalization.d.ts +16 -0
- package/dist/vendor/zcode/source/tool/input-normalization.js +62 -0
- package/dist/vendor/zcode/source/tool/input-validation-model-content.d.ts +4 -0
- package/dist/vendor/zcode/source/tool/input-validation-model-content.js +263 -0
- package/dist/vendor/zcode/source/tool/json-schema.d.ts +9 -0
- package/dist/vendor/zcode/source/tool/json-schema.js +230 -0
- package/dist/vendor/zcode/source/tool/scheduler.d.ts +43 -0
- package/dist/vendor/zcode/source/tool/scheduler.js +167 -0
- package/dist/vendor/zcode/source/tool/tool-input-validation-issues.d.ts +76 -0
- package/dist/vendor/zcode/source/tool/tool-input-validation-issues.js +148 -0
- package/dist/vendor/zcode/source/tool/validation-contracts.d.ts +27 -0
- package/dist/vendor/zcode/source/tool/validation-contracts.js +8 -0
- package/docs/README.md +36 -0
- package/docs/agents/README.md +62 -0
- package/docs/agents/install-for-agents.md +64 -0
- package/docs/agents/mcp-server.md +187 -0
- package/docs/agents/subagent-mode.md +146 -0
- package/docs/concepts/README.md +47 -0
- package/docs/concepts/jev-actionable-routing.md +113 -0
- package/docs/concepts/jev-decision-thresholds.md +412 -0
- package/docs/concepts/jev-efficiency.md +216 -0
- package/docs/concepts/jev-eval-2026-11-01.md +78 -0
- package/docs/concepts/limits.md +43 -0
- package/docs/concepts/memory.md +30 -0
- package/docs/concepts/security.md +40 -0
- package/docs/concepts/workspace-instructions.md +28 -0
- package/docs/getting-started/README.md +74 -0
- package/docs/getting-started/accounts.md +67 -0
- package/docs/getting-started/configure-providers.md +103 -0
- package/docs/guides/README.md +12 -0
- package/docs/guides/browser.md +15 -0
- package/docs/guides/desktop-app.md +325 -0
- package/docs/guides/extensions.md +100 -0
- package/docs/guides/graph-builder.md +93 -0
- package/docs/guides/headless.md +45 -0
- package/docs/guides/tui.md +75 -0
- package/docs/guides/update.md +47 -0
- package/docs/guides/windows-code-signing.md +316 -0
- package/docs/llms.txt +45 -0
- package/docs/reference/README.md +7 -0
- package/docs/reference/cli.md +70 -0
- package/docs/reference/config.md +85 -0
- package/docs/reference/slash-commands.md +54 -0
- package/docs/superpowers/plans/2026-11-01-claude-console-sign-in.md +111 -0
- package/docs/superpowers/plans/2026-11-01-jev-node-opt-in.md +910 -0
- package/docs/superpowers/plans/2026-11-02-workflow-pane.md +398 -0
- package/docs/superpowers/specs/2026-10-31-work-line-summary-design.md +50 -0
- package/docs/superpowers/specs/2026-11-01-claude-console-sign-in-design.md +176 -0
- package/docs/superpowers/specs/2026-11-01-jev-node-opt-in-design.md +164 -0
- package/docs/superpowers/specs/2026-11-01-pr-section-design.md +104 -0
- package/docs/superpowers/specs/2026-11-02-workflow-pane-design.md +130 -0
- package/licenses/GEIST-OFL-1.1.txt +92 -0
- package/licenses/ZCODE-APACHE-2.0.txt +202 -0
- package/package.json +118 -6
- package/scripts/jev-efficiency-eval.mjs +187 -0
- package/scripts/jev-efficiency-live.mjs +193 -0
- package/scripts/zcode-engine-replay.mjs +223 -0
- package/tests/agent-centric-mcp-test-plan.md +208 -0
- package/tests/analytics-settings-test-plan.md +165 -0
- package/tests/browser-cli-smoke.mjs +276 -0
- package/tests/browser-test-plan.md +280 -0
- package/tests/chat-side-panel-test-plan.md +309 -0
- package/tests/decision-engine-test-plan.md +163 -0
- package/tests/default-active-jev-test-plan.md +85 -0
- package/tests/graphiti-test-plan.md +359 -0
- package/tests/harness-extensions-test-plan.md +110 -0
- package/tests/jev-all-decisions-test-plan.md +156 -0
- package/tests/jev-efficiency/criteria.json +158 -0
- package/tests/jev-efficiency/workloads.mjs +242 -0
- package/tests/jev-efficiency-test-plan.md +198 -0
- package/tests/mock-graphiti.mjs +106 -0
- package/tests/permissions-sandbox-probe.mjs +74 -0
- package/tests/permissions-test-plan.md +190 -0
- package/tests/product-telemetry-test-plan.md +536 -0
- package/tests/thinking-stream-preview-test-plan.md +136 -0
- package/tests/zcode-react-engine-test-plan.md +396 -0
|
@@ -0,0 +1,1903 @@
|
|
|
1
|
+
// ─── Classification ──────────────────────────────────────────────────────────
|
|
2
|
+
export const andorraIsReplace = (op) => op[0] === "r";
|
|
3
|
+
/**
|
|
4
|
+
* A batch begins with a replacement. Flush guarantees `r` is at index 0 or absent,
|
|
5
|
+
* so this is exact rather than a heuristic.
|
|
6
|
+
*/
|
|
7
|
+
export const andorraIsBase = (ops) => ops.length > 0 && ops[0][0] === "r";
|
|
8
|
+
// ─── Overlap ─────────────────────────────────────────────────────────────────
|
|
9
|
+
/**
|
|
10
|
+
* Longest suffix of `a` that is a prefix of `b`. Probes with indexOf and verifies
|
|
11
|
+
* exact substring equality, so the hot loops are native. A hand-written KMP is
|
|
12
|
+
* asymptotically equivalent and much slower in practice.
|
|
13
|
+
*
|
|
14
|
+
* Always correct: the returned n satisfies a.slice(a.length - n) === b.slice(0, n).
|
|
15
|
+
*/
|
|
16
|
+
export function andorraOverlap(a, b, scan, probe = 64, maxCandidates = 8) {
|
|
17
|
+
if (a.length === 0 || b.length === 0 || scan === 0)
|
|
18
|
+
return 0;
|
|
19
|
+
const tail = a.length > scan ? a.slice(a.length - scan) : a;
|
|
20
|
+
// A probe of length h can only find overlaps of at least h — the head must
|
|
21
|
+
// actually occur in `a`. So try a long head first (few candidates, and it
|
|
22
|
+
// catches the large overlaps a rolling window produces), then fall back to one
|
|
23
|
+
// character, which finds any overlap at the cost of more candidates.
|
|
24
|
+
//
|
|
25
|
+
// Candidates are bounded because repetitive output — a build log, or any run of
|
|
26
|
+
// one character — makes a long head match at thousands of positions. Giving up
|
|
27
|
+
// returns 0, which emits a set: larger, never wrong.
|
|
28
|
+
for (const h of [Math.min(probe, b.length), 1]) {
|
|
29
|
+
const head = b.slice(0, h);
|
|
30
|
+
let tried = 0;
|
|
31
|
+
for (let k = tail.indexOf(head); k !== -1; k = tail.indexOf(head, k + 1)) {
|
|
32
|
+
if (++tried > maxCandidates)
|
|
33
|
+
break;
|
|
34
|
+
const n = tail.length - k;
|
|
35
|
+
if (n <= b.length && tail.slice(k) === b.slice(0, n))
|
|
36
|
+
return n;
|
|
37
|
+
}
|
|
38
|
+
if (h === 1)
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
const andorraIsObj = (value) => value !== null && typeof value === "object";
|
|
44
|
+
const andorraCloneJson = (value) => {
|
|
45
|
+
if (!andorraIsObj(value))
|
|
46
|
+
return value;
|
|
47
|
+
if (Array.isArray(value))
|
|
48
|
+
return value.map((item) => andorraCloneJson(item));
|
|
49
|
+
// Spread preserves compact object layouts instead of reserving extra slots
|
|
50
|
+
// while growing an empty object. Both branches create own writable properties.
|
|
51
|
+
const result = (Object.getPrototypeOf(value) === null ? Object.assign(Object.create(null), value) : { ...value });
|
|
52
|
+
for (const key of Object.keys(result)) {
|
|
53
|
+
const child = result[key];
|
|
54
|
+
if (andorraIsObj(child))
|
|
55
|
+
result[key] = andorraCloneJson(child);
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
const INDEX = /^(?:0|[1-9]\d*)$/;
|
|
60
|
+
const andorraNorm = (target, key) => typeof key === "symbol" ? key : Array.isArray(target) && INDEX.test(key) ? Number(key) : key;
|
|
61
|
+
const MUTATORS = new Set(["push", "pop", "shift", "unshift", "splice", "sort", "reverse", "fill", "copyWithin"]);
|
|
62
|
+
const MISSING = Symbol("missing");
|
|
63
|
+
const andorraSpliceItems = (target, index, remove, items) => {
|
|
64
|
+
const removed = Reflect.apply(Array.prototype.splice, target, [index, remove]);
|
|
65
|
+
const chunkSize = 10_000;
|
|
66
|
+
for (let offset = 0; offset < items.length; offset += chunkSize) {
|
|
67
|
+
Reflect.apply(Array.prototype.splice, target, [index + offset, 0, ...items.slice(offset, offset + chunkSize)]);
|
|
68
|
+
}
|
|
69
|
+
return removed;
|
|
70
|
+
};
|
|
71
|
+
const andorraJsonEqual = (left, right) => {
|
|
72
|
+
if (left === right)
|
|
73
|
+
return true;
|
|
74
|
+
if (!andorraIsObj(left) || !andorraIsObj(right) || Array.isArray(left) !== Array.isArray(right))
|
|
75
|
+
return false;
|
|
76
|
+
if (Array.isArray(left) && Array.isArray(right)) {
|
|
77
|
+
if (left.length !== right.length)
|
|
78
|
+
return false;
|
|
79
|
+
for (let index = 0; index < left.length; index++) {
|
|
80
|
+
if (!andorraJsonEqual(left[index], right[index]))
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
const leftObject = left;
|
|
86
|
+
const rightObject = right;
|
|
87
|
+
const leftKeys = Object.keys(leftObject);
|
|
88
|
+
const rightKeys = Object.keys(rightObject);
|
|
89
|
+
if (leftKeys.length !== rightKeys.length)
|
|
90
|
+
return false;
|
|
91
|
+
for (const key of leftKeys) {
|
|
92
|
+
if (!Object.hasOwn(rightObject, key) || !andorraJsonEqual(leftObject[key], rightObject[key]))
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
};
|
|
97
|
+
const andorraEmitSet = (path, value, out) => {
|
|
98
|
+
const snapshot = andorraCloneJson(value);
|
|
99
|
+
if (path.length === 0)
|
|
100
|
+
out.push(["r", snapshot]);
|
|
101
|
+
else
|
|
102
|
+
out.push(["s", [...path], snapshot]);
|
|
103
|
+
};
|
|
104
|
+
const andorraEmitDelete = (path, out) => {
|
|
105
|
+
if (path.length === 0)
|
|
106
|
+
throw new TypeError("the tracked root cannot be deleted");
|
|
107
|
+
out.push(["d", [...path]]);
|
|
108
|
+
};
|
|
109
|
+
const andorraDiffString = (before, after, path, scan, out) => {
|
|
110
|
+
if (before === after)
|
|
111
|
+
return;
|
|
112
|
+
if (path.length === 0) {
|
|
113
|
+
andorraEmitSet(path, after, out);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const at = [...path];
|
|
117
|
+
// NOT `after.startsWith(before)`. `after` is usually a cons string — the
|
|
118
|
+
// producer just did `s += chunk` — and V8's startsWith walks a cons char by
|
|
119
|
+
// char. `slice(...) === before` flattens once and compares with memcmp.
|
|
120
|
+
// Measured on a 200 KB string growing by 8 bytes per flush: 845 us -> 42 us.
|
|
121
|
+
if (after.length > before.length && after.slice(0, before.length) === before) {
|
|
122
|
+
out.push(["a", at, after.slice(before.length)]);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const shared = andorraOverlap(before, after, scan);
|
|
126
|
+
if (shared === 0) {
|
|
127
|
+
out.push(["s", at, after]);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
out.push(["t", at, before.length - shared]);
|
|
131
|
+
if (after.length > shared)
|
|
132
|
+
out.push(["a", at, after.slice(shared)]);
|
|
133
|
+
};
|
|
134
|
+
const andorraDiffValue = (before, after, path, scan, out) => {
|
|
135
|
+
if (before === MISSING) {
|
|
136
|
+
if (after !== MISSING)
|
|
137
|
+
andorraEmitSet(path, after, out);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (after === MISSING) {
|
|
141
|
+
andorraEmitDelete(path, out);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (before === after)
|
|
145
|
+
return;
|
|
146
|
+
if (typeof before === "string" && typeof after === "string") {
|
|
147
|
+
andorraDiffString(before, after, path, scan, out);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (Array.isArray(before) && Array.isArray(after)) {
|
|
151
|
+
andorraDiffArray(before, after, path, scan, out);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (andorraIsObj(before) && andorraIsObj(after) && !Array.isArray(before) && !Array.isArray(after)) {
|
|
155
|
+
andorraDiffObject(before, after, path, scan, out);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
andorraEmitSet(path, after, out);
|
|
159
|
+
};
|
|
160
|
+
function andorraDiffObject(before, after, path, scan, out) {
|
|
161
|
+
if ([...Object.keys(before), ...Object.keys(after)].some((key) => RESERVED_SEGMENTS.has(key))) {
|
|
162
|
+
andorraEmitSet(path, after, out);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
for (const key of Object.keys(after)) {
|
|
166
|
+
andorraDiffValue(Object.hasOwn(before, key) ? before[key] : MISSING, after[key], [...path, key], scan, out);
|
|
167
|
+
}
|
|
168
|
+
for (const key of Object.keys(before)) {
|
|
169
|
+
if (!Object.hasOwn(after, key))
|
|
170
|
+
andorraEmitDelete([...path, key], out);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function andorraDiffArray(before, after, path, scan, out) {
|
|
174
|
+
if (before.length === after.length) {
|
|
175
|
+
for (let index = 0; index < after.length; index++) {
|
|
176
|
+
andorraDiffValue(before[index], after[index], [...path, index], scan, out);
|
|
177
|
+
}
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
let prefix = 0;
|
|
181
|
+
while (prefix < before.length && prefix < after.length && andorraJsonEqual(before[prefix], after[prefix]))
|
|
182
|
+
prefix++;
|
|
183
|
+
let suffix = 0;
|
|
184
|
+
while (suffix < before.length - prefix &&
|
|
185
|
+
suffix < after.length - prefix &&
|
|
186
|
+
andorraJsonEqual(before[before.length - 1 - suffix], after[after.length - 1 - suffix])) {
|
|
187
|
+
suffix++;
|
|
188
|
+
}
|
|
189
|
+
const shorter = Math.min(before.length, after.length);
|
|
190
|
+
if (prefix + suffix === shorter) {
|
|
191
|
+
const remove = before.length - prefix - suffix;
|
|
192
|
+
const items = after.slice(prefix, after.length - suffix);
|
|
193
|
+
if (prefix === 0 && remove === before.length)
|
|
194
|
+
andorraEmitSet(path, after, out);
|
|
195
|
+
else
|
|
196
|
+
out.push(["p", [...path], prefix, remove, andorraCloneJson(items)]);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
// Structural movement combined with retained-index edits has no unique
|
|
200
|
+
// alignment. Preserve the retained index deltas and express only the tail
|
|
201
|
+
// length change structurally. It may be broader than the producer's intent,
|
|
202
|
+
// but never degrades those edits to a whole-array replacement.
|
|
203
|
+
for (let index = 0; index < shorter; index++) {
|
|
204
|
+
andorraDiffValue(before[index], after[index], [...path, index], scan, out);
|
|
205
|
+
}
|
|
206
|
+
if (after.length > before.length) {
|
|
207
|
+
out.push(["p", [...path], before.length, 0, andorraCloneJson(after.slice(before.length))]);
|
|
208
|
+
}
|
|
209
|
+
else if (before.length > after.length) {
|
|
210
|
+
if (after.length === 0)
|
|
211
|
+
andorraEmitSet(path, after, out);
|
|
212
|
+
else
|
|
213
|
+
out.push(["p", [...path], after.length, before.length - after.length, []]);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
export function andorraTrack(root, options = {}) {
|
|
217
|
+
const scan = options.maxOverlapScan ?? 65_536;
|
|
218
|
+
let log = [];
|
|
219
|
+
let trie = {};
|
|
220
|
+
let nextOrder = 0;
|
|
221
|
+
let tombstones = 0;
|
|
222
|
+
let liveSlots = 0;
|
|
223
|
+
let nodeCount = 1;
|
|
224
|
+
let lastAddedSlot;
|
|
225
|
+
let hasPending = false;
|
|
226
|
+
let forceBase = true;
|
|
227
|
+
const andorraClearPending = () => {
|
|
228
|
+
log = [];
|
|
229
|
+
trie = {};
|
|
230
|
+
nextOrder = 0;
|
|
231
|
+
tombstones = 0;
|
|
232
|
+
liveSlots = 0;
|
|
233
|
+
nodeCount = 1;
|
|
234
|
+
lastAddedSlot = undefined;
|
|
235
|
+
hasPending = false;
|
|
236
|
+
};
|
|
237
|
+
const andorraLogNode = (path) => {
|
|
238
|
+
let at = trie;
|
|
239
|
+
for (const segment of path) {
|
|
240
|
+
if (!at.kids)
|
|
241
|
+
at.kids = new Map();
|
|
242
|
+
let next = at.kids.get(segment);
|
|
243
|
+
if (next === undefined) {
|
|
244
|
+
next = {};
|
|
245
|
+
at.kids.set(segment, next);
|
|
246
|
+
nodeCount++;
|
|
247
|
+
}
|
|
248
|
+
at = next;
|
|
249
|
+
}
|
|
250
|
+
return at;
|
|
251
|
+
};
|
|
252
|
+
const andorraFindLogNode = (path) => {
|
|
253
|
+
let at = trie;
|
|
254
|
+
for (const segment of path) {
|
|
255
|
+
const next = at.kids?.get(segment);
|
|
256
|
+
if (next === undefined)
|
|
257
|
+
return undefined;
|
|
258
|
+
at = next;
|
|
259
|
+
}
|
|
260
|
+
return at;
|
|
261
|
+
};
|
|
262
|
+
const andorraCompactLog = () => {
|
|
263
|
+
if (tombstones < 1_024 || tombstones * 2 < log.length)
|
|
264
|
+
return;
|
|
265
|
+
const compacted = [];
|
|
266
|
+
for (const slot of log) {
|
|
267
|
+
if (slot === undefined)
|
|
268
|
+
continue;
|
|
269
|
+
slot.index = compacted.length;
|
|
270
|
+
compacted.push(slot);
|
|
271
|
+
}
|
|
272
|
+
log = compacted;
|
|
273
|
+
tombstones = 0;
|
|
274
|
+
};
|
|
275
|
+
const andorraKillSlot = (slot) => {
|
|
276
|
+
if (slot.dead)
|
|
277
|
+
return;
|
|
278
|
+
slot.dead = true;
|
|
279
|
+
liveSlots--;
|
|
280
|
+
if (log[slot.index] === slot) {
|
|
281
|
+
log[slot.index] = undefined;
|
|
282
|
+
tombstones++;
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
const andorraLiveSlot = (at) => {
|
|
286
|
+
const slots = at.slots;
|
|
287
|
+
if (slots === undefined)
|
|
288
|
+
return undefined;
|
|
289
|
+
while (slots.length > 0 && slots[slots.length - 1].dead)
|
|
290
|
+
slots.pop();
|
|
291
|
+
if (slots.length === 0) {
|
|
292
|
+
at.slots = undefined;
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
return slots[slots.length - 1];
|
|
296
|
+
};
|
|
297
|
+
const andorraKillHere = (at) => {
|
|
298
|
+
if (at.slots === undefined)
|
|
299
|
+
return;
|
|
300
|
+
for (const slot of at.slots)
|
|
301
|
+
andorraKillSlot(slot);
|
|
302
|
+
at.slots = undefined;
|
|
303
|
+
};
|
|
304
|
+
const andorraAddSlot = (at, slot) => {
|
|
305
|
+
andorraCompactLog();
|
|
306
|
+
slot.order = nextOrder++;
|
|
307
|
+
slot.index = log.length;
|
|
308
|
+
at.lastOrder = slot.order;
|
|
309
|
+
if (at.slots === undefined)
|
|
310
|
+
at.slots = [];
|
|
311
|
+
at.slots.push(slot);
|
|
312
|
+
log.push(slot);
|
|
313
|
+
liveSlots++;
|
|
314
|
+
lastAddedSlot = slot;
|
|
315
|
+
};
|
|
316
|
+
const andorraCollapsePending = () => {
|
|
317
|
+
// Long mutation windows can otherwise retain operations and retired path
|
|
318
|
+
// generations indefinitely. Fall back to a complete snapshot once either
|
|
319
|
+
// history exceeds a bounded coalescing window. Payload bytes and transient
|
|
320
|
+
// allocation remain workload-dependent.
|
|
321
|
+
if (forceBase || (liveSlots <= 4_096 && nodeCount <= 4_096))
|
|
322
|
+
return;
|
|
323
|
+
const value = andorraCloneJson(root);
|
|
324
|
+
andorraClearPending();
|
|
325
|
+
hasPending = true;
|
|
326
|
+
andorraAddSlot(trie, { op: ["r", value], dead: false, order: 0, index: 0 });
|
|
327
|
+
};
|
|
328
|
+
const andorraKillSubtree = (at) => {
|
|
329
|
+
andorraKillHere(at);
|
|
330
|
+
if (at.kids !== undefined) {
|
|
331
|
+
for (const child of at.kids.values())
|
|
332
|
+
andorraKillSubtree(child);
|
|
333
|
+
at.kids = undefined;
|
|
334
|
+
}
|
|
335
|
+
if (at.retiredKids !== undefined) {
|
|
336
|
+
for (const generation of at.retiredKids) {
|
|
337
|
+
for (const child of generation.values())
|
|
338
|
+
andorraKillSubtree(child);
|
|
339
|
+
}
|
|
340
|
+
at.retiredKids = undefined;
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
const andorraRetireKids = (at) => {
|
|
344
|
+
if (at.kids === undefined)
|
|
345
|
+
return;
|
|
346
|
+
if (at.retiredKids === undefined)
|
|
347
|
+
at.retiredKids = [];
|
|
348
|
+
at.retiredKids.push(at.kids);
|
|
349
|
+
at.kids = undefined;
|
|
350
|
+
};
|
|
351
|
+
// Deepest live ancestor op carrying a payload we can fold a later write into.
|
|
352
|
+
// `s`/`r` carry the whole subtree; `p` carries the items it inserted, so a
|
|
353
|
+
// write to one of those indices belongs inside the payload rather than after it.
|
|
354
|
+
const andorraFoldTarget = (path) => {
|
|
355
|
+
let at = trie;
|
|
356
|
+
let found;
|
|
357
|
+
let ancestorMax = -1;
|
|
358
|
+
for (let depth = 0; depth < path.length; depth++) {
|
|
359
|
+
if (found !== undefined && at.lastOrder !== undefined && at.lastOrder > found.slot.order) {
|
|
360
|
+
found = undefined;
|
|
361
|
+
}
|
|
362
|
+
const slot = andorraLiveSlot(at);
|
|
363
|
+
// A fold is sound only if nothing has been recorded at this path or above it
|
|
364
|
+
// since: a later op there (a splice on the same array, a replacement of an
|
|
365
|
+
// ancestor) would have to apply after this write, not before it. Writes to
|
|
366
|
+
// other branches are irrelevant, which is why this is not "the most recent op".
|
|
367
|
+
if (slot !== undefined && slot.order >= ancestorMax && at.lastOrder === slot.order) {
|
|
368
|
+
if (slot.op[0] === "s" || slot.op[0] === "r")
|
|
369
|
+
found = { slot, depth };
|
|
370
|
+
else if (slot.op[0] === "p") {
|
|
371
|
+
const index = path[depth];
|
|
372
|
+
const items = slot.op[4];
|
|
373
|
+
if (typeof index === "number" && index >= slot.op[2] && index < slot.op[2] + items.length) {
|
|
374
|
+
found = { slot, depth: depth + 1, item: index - slot.op[2] };
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (at.lastOrder !== undefined && at.lastOrder > ancestorMax)
|
|
379
|
+
ancestorMax = at.lastOrder;
|
|
380
|
+
const next = at.kids?.get(path[depth]);
|
|
381
|
+
if (next === undefined)
|
|
382
|
+
break;
|
|
383
|
+
at = next;
|
|
384
|
+
}
|
|
385
|
+
if (found === undefined)
|
|
386
|
+
return undefined;
|
|
387
|
+
return { slot: found.slot, rest: path.slice(found.depth), item: found.item };
|
|
388
|
+
};
|
|
389
|
+
const andorraFoldInto = (container, rest, op) => {
|
|
390
|
+
if (rest.length === 0)
|
|
391
|
+
return false;
|
|
392
|
+
let target = container;
|
|
393
|
+
for (let index = 0; index < rest.length - 1; index++) {
|
|
394
|
+
if (!andorraIsObj(target))
|
|
395
|
+
return false;
|
|
396
|
+
target = target[rest[index]];
|
|
397
|
+
}
|
|
398
|
+
if (!andorraIsObj(target))
|
|
399
|
+
return false;
|
|
400
|
+
const key = rest[rest.length - 1];
|
|
401
|
+
const holder = target;
|
|
402
|
+
const andorraWrite = (value) => {
|
|
403
|
+
Object.defineProperty(holder, key, { value, writable: true, enumerable: true, configurable: true });
|
|
404
|
+
};
|
|
405
|
+
switch (op[0]) {
|
|
406
|
+
case "s":
|
|
407
|
+
if (key === "__proto__")
|
|
408
|
+
return false;
|
|
409
|
+
andorraWrite(andorraCloneJson(op[2]));
|
|
410
|
+
return true;
|
|
411
|
+
case "d":
|
|
412
|
+
delete holder[key];
|
|
413
|
+
return true;
|
|
414
|
+
case "a": {
|
|
415
|
+
const value = holder[key];
|
|
416
|
+
if (typeof value !== "string")
|
|
417
|
+
return false;
|
|
418
|
+
andorraWrite(value + op[2]);
|
|
419
|
+
return true;
|
|
420
|
+
}
|
|
421
|
+
case "t": {
|
|
422
|
+
const value = holder[key];
|
|
423
|
+
if (typeof value !== "string")
|
|
424
|
+
return false;
|
|
425
|
+
andorraWrite(value.slice(op[2]));
|
|
426
|
+
return true;
|
|
427
|
+
}
|
|
428
|
+
case "p": {
|
|
429
|
+
const value = holder[key];
|
|
430
|
+
if (!Array.isArray(value))
|
|
431
|
+
return false;
|
|
432
|
+
andorraSpliceItems(value, op[2], op[3], andorraCloneJson(op[4]));
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
435
|
+
default:
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
const andorraRecordString = (path, previous, value) => {
|
|
440
|
+
if (forceBase)
|
|
441
|
+
return;
|
|
442
|
+
hasPending = true;
|
|
443
|
+
// a string inside a pending payload belongs in that payload, as for any write
|
|
444
|
+
const fold = andorraFoldTarget(path);
|
|
445
|
+
if (fold !== undefined) {
|
|
446
|
+
const op = ["s", path, value];
|
|
447
|
+
if (fold.item !== undefined) {
|
|
448
|
+
const items = fold.slot.op[4];
|
|
449
|
+
if (fold.rest.length === 0) {
|
|
450
|
+
items[fold.item] = value;
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
if (andorraFoldInto(items[fold.item], fold.rest, op))
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
const payload = fold.slot.op[0] === "r" ? fold.slot.op[1] : fold.slot.op[2];
|
|
458
|
+
if (andorraFoldInto(payload, fold.rest, op))
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
const at = andorraLogNode(path);
|
|
463
|
+
const live = andorraLiveSlot(at);
|
|
464
|
+
if (live?.str !== undefined) {
|
|
465
|
+
live.str.value = value;
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (live !== undefined) {
|
|
469
|
+
// a pending set or delete at this path already replaced the value; keep that
|
|
470
|
+
// op and carry the new value in it rather than anchoring to it
|
|
471
|
+
if (live.op[0] === "s" || live.op[0] === "r") {
|
|
472
|
+
live.op = live.op[0] === "r" ? ["r", value] : ["s", live.op[1], value];
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
if (live.op[0] === "d") {
|
|
476
|
+
andorraKillHere(at);
|
|
477
|
+
andorraAddSlot(at, {
|
|
478
|
+
op: ["s", path, value],
|
|
479
|
+
dead: false,
|
|
480
|
+
order: 0,
|
|
481
|
+
index: 0,
|
|
482
|
+
});
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
// a truncate/append pair from an earlier string diff: both must go
|
|
486
|
+
andorraKillHere(at);
|
|
487
|
+
}
|
|
488
|
+
andorraKillSubtree(at);
|
|
489
|
+
andorraAddSlot(at, {
|
|
490
|
+
op: ["s", path, value],
|
|
491
|
+
dead: false,
|
|
492
|
+
order: 0,
|
|
493
|
+
index: 0,
|
|
494
|
+
str: { anchor: previous, value },
|
|
495
|
+
});
|
|
496
|
+
};
|
|
497
|
+
const andorraRecord = (op) => {
|
|
498
|
+
if (forceBase)
|
|
499
|
+
return;
|
|
500
|
+
hasPending = true;
|
|
501
|
+
const path = (op[0] === "r" ? [] : op[1]);
|
|
502
|
+
const existing = andorraFindLogNode(path);
|
|
503
|
+
const anchored = existing === undefined ? undefined : andorraLiveSlot(existing);
|
|
504
|
+
if (anchored?.str !== undefined) {
|
|
505
|
+
switch (op[0]) {
|
|
506
|
+
case "a":
|
|
507
|
+
anchored.str.value += op[2];
|
|
508
|
+
return;
|
|
509
|
+
case "t":
|
|
510
|
+
anchored.str.value = anchored.str.value.slice(op[2]);
|
|
511
|
+
return;
|
|
512
|
+
case "s":
|
|
513
|
+
if (typeof op[2] === "string") {
|
|
514
|
+
anchored.str.value = op[2];
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
if (existing !== undefined)
|
|
519
|
+
andorraKillSubtree(existing);
|
|
520
|
+
}
|
|
521
|
+
else if (existing !== undefined && (op[0] === "s" || op[0] === "d" || op[0] === "r")) {
|
|
522
|
+
// A replacement absorbed into an ancestor payload must still invalidate
|
|
523
|
+
// operations already recorded at and below its destination.
|
|
524
|
+
andorraKillSubtree(existing);
|
|
525
|
+
}
|
|
526
|
+
if (path.length > 0) {
|
|
527
|
+
const fold = andorraFoldTarget(path);
|
|
528
|
+
if (fold !== undefined) {
|
|
529
|
+
if (fold.item !== undefined) {
|
|
530
|
+
const items = fold.slot.op[4];
|
|
531
|
+
if (fold.rest.length === 0) {
|
|
532
|
+
if (op[0] === "s") {
|
|
533
|
+
items[fold.item] = andorraCloneJson(op[2]);
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
else if (andorraFoldInto(items[fold.item], fold.rest, op))
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
const payload = fold.slot.op[0] === "r" ? fold.slot.op[1] : fold.slot.op[2];
|
|
542
|
+
if (andorraFoldInto(payload, fold.rest, op))
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
const at = andorraLogNode(path);
|
|
548
|
+
const live = andorraLiveSlot(at);
|
|
549
|
+
if (live !== undefined) {
|
|
550
|
+
const previous = live.op;
|
|
551
|
+
if (op[0] === "a" && previous[0] === "a") {
|
|
552
|
+
live.op = ["a", previous[1], previous[2] + op[2]];
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
if (op[0] === "a" && (previous[0] === "s" || previous[0] === "r")) {
|
|
556
|
+
const value = previous[0] === "r" ? previous[1] : previous[2];
|
|
557
|
+
if (typeof value === "string") {
|
|
558
|
+
live.op = previous[0] === "r" ? ["r", value + op[2]] : ["s", previous[1], value + op[2]];
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
if (op[0] === "t" && (previous[0] === "s" || previous[0] === "r")) {
|
|
563
|
+
const value = previous[0] === "r" ? previous[1] : previous[2];
|
|
564
|
+
if (typeof value === "string") {
|
|
565
|
+
const cut = value.slice(op[2]);
|
|
566
|
+
live.op = previous[0] === "r" ? ["r", cut] : ["s", previous[1], cut];
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
if (op[0] === "p" && previous[0] === "p") {
|
|
571
|
+
const previousItems = previous[4];
|
|
572
|
+
// These rewrites are sound only for adjacent recorded operations. A
|
|
573
|
+
// tombstoned operation remains a barrier through lastAddedSlot.
|
|
574
|
+
if (previous[3] === 0 &&
|
|
575
|
+
op[3] === 0 &&
|
|
576
|
+
previous[2] + previousItems.length === op[2] &&
|
|
577
|
+
lastAddedSlot === live) {
|
|
578
|
+
const items = op[4];
|
|
579
|
+
for (let index = 0; index < items.length; index++)
|
|
580
|
+
previousItems.push(items[index]);
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
if (previous[3] === 0 &&
|
|
584
|
+
lastAddedSlot === live &&
|
|
585
|
+
op[2] >= previous[2] &&
|
|
586
|
+
op[2] + op[3] <= previous[2] + previousItems.length) {
|
|
587
|
+
andorraSpliceItems(previousItems, op[2] - previous[2], op[3], op[4]);
|
|
588
|
+
if (previousItems.length === 0 && previous[3] === 0)
|
|
589
|
+
andorraKillSlot(live);
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
if (op[3] > 0 &&
|
|
593
|
+
op[4].length === 0 &&
|
|
594
|
+
previousItems.length > 0 &&
|
|
595
|
+
lastAddedSlot === live) {
|
|
596
|
+
const from = op[2] - previous[2];
|
|
597
|
+
if (from >= 0 && from + op[3] === previousItems.length) {
|
|
598
|
+
previousItems.length = from;
|
|
599
|
+
if (previousItems.length === 0 && previous[3] === 0)
|
|
600
|
+
andorraKillSlot(live);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
if (op[0] === "s" || op[0] === "d" || op[0] === "r")
|
|
606
|
+
andorraKillHere(at);
|
|
607
|
+
}
|
|
608
|
+
if (op[0] === "s" || op[0] === "r" || op[0] === "d") {
|
|
609
|
+
// Replacements dominate all earlier descendants, including generations
|
|
610
|
+
// detached by array splices.
|
|
611
|
+
andorraKillSubtree(at);
|
|
612
|
+
}
|
|
613
|
+
else if (op[0] === "p") {
|
|
614
|
+
// Splices preserve earlier writes but form a barrier for later folding.
|
|
615
|
+
andorraRetireKids(at);
|
|
616
|
+
}
|
|
617
|
+
andorraAddSlot(at, { op, dead: false, order: 0, index: 0 });
|
|
618
|
+
};
|
|
619
|
+
// Local diff, used when a whole container is assigned: keeps op quality
|
|
620
|
+
// without a baseline by comparing the outgoing value with the incoming one at
|
|
621
|
+
// the moment of the write. String leaves go through recordString so every
|
|
622
|
+
// string path keeps a single anchored slot; otherwise a later write to the
|
|
623
|
+
// same string would have to supersede ops whose starting value it no longer
|
|
624
|
+
// knows.
|
|
625
|
+
const andorraDiffInto = (before, after, at) => {
|
|
626
|
+
if (forceBase)
|
|
627
|
+
return;
|
|
628
|
+
hasPending = true;
|
|
629
|
+
if (before === after)
|
|
630
|
+
return;
|
|
631
|
+
if (typeof before === "string" && typeof after === "string") {
|
|
632
|
+
andorraRecordString(at.slice(), before, after);
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
if (Array.isArray(before) && Array.isArray(after) && before.length === after.length) {
|
|
636
|
+
for (let index = 0; index < after.length; index++) {
|
|
637
|
+
at.push(index);
|
|
638
|
+
andorraDiffInto(before[index], after[index], at);
|
|
639
|
+
at.pop();
|
|
640
|
+
}
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (andorraIsObj(before) && andorraIsObj(after) && !Array.isArray(before) && !Array.isArray(after)) {
|
|
644
|
+
const beforeObject = before;
|
|
645
|
+
const afterObject = after;
|
|
646
|
+
const beforeKeys = Object.keys(beforeObject);
|
|
647
|
+
const afterKeys = Object.keys(afterObject);
|
|
648
|
+
if ([...beforeKeys, ...afterKeys].some((key) => RESERVED_SEGMENTS.has(key))) {
|
|
649
|
+
andorraRecord(["s", at.slice(), andorraCloneJson(after)]);
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
for (const key of afterKeys) {
|
|
653
|
+
at.push(key);
|
|
654
|
+
if (Object.hasOwn(beforeObject, key))
|
|
655
|
+
andorraDiffInto(beforeObject[key], afterObject[key], at);
|
|
656
|
+
else
|
|
657
|
+
andorraRecord(["s", at.slice(), andorraCloneJson(afterObject[key])]);
|
|
658
|
+
at.pop();
|
|
659
|
+
}
|
|
660
|
+
for (const key of beforeKeys) {
|
|
661
|
+
if (!Object.hasOwn(afterObject, key))
|
|
662
|
+
andorraRecord(["d", [...at, key]]);
|
|
663
|
+
}
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
// arrays of differing length, and everything else: chord's own diff
|
|
667
|
+
const out = [];
|
|
668
|
+
andorraDiffValue(before, after, at, scan, out);
|
|
669
|
+
for (const op of out)
|
|
670
|
+
andorraRecord(op);
|
|
671
|
+
};
|
|
672
|
+
const andorraGuard = (segment) => {
|
|
673
|
+
if (typeof segment === "symbol")
|
|
674
|
+
throw new AndorraUnsafePathError(String(segment));
|
|
675
|
+
if (typeof segment === "string" && RESERVED_SEGMENTS.has(segment))
|
|
676
|
+
throw new AndorraUnsafePathError(segment);
|
|
677
|
+
return segment;
|
|
678
|
+
};
|
|
679
|
+
const andorraInteger = (value) => {
|
|
680
|
+
const number = Number(value);
|
|
681
|
+
if (Number.isNaN(number) || number === 0)
|
|
682
|
+
return 0;
|
|
683
|
+
return Number.isFinite(number) ? Math.trunc(number) : number;
|
|
684
|
+
};
|
|
685
|
+
const andorraSpliceRange = (length, args) => {
|
|
686
|
+
const rawStart = args.length === 0 ? 0 : andorraInteger(args[0]);
|
|
687
|
+
const index = rawStart < 0 ? Math.max(0, length + rawStart) : Math.min(rawStart, length);
|
|
688
|
+
const remove = args.length === 0
|
|
689
|
+
? 0
|
|
690
|
+
: args.length === 1
|
|
691
|
+
? length - index
|
|
692
|
+
: Math.max(0, Math.min(andorraInteger(args[1]), length - index));
|
|
693
|
+
return { index, remove };
|
|
694
|
+
};
|
|
695
|
+
// Paths are walked from placement cells rather than baked into proxies. A held
|
|
696
|
+
// descendant keeps its cells and their owner entries alive, so an ancestor can
|
|
697
|
+
// be re-created after GC without losing array-renumbering metadata. Entries keep
|
|
698
|
+
// only weak references to public proxies; parent caches keep only weak cells.
|
|
699
|
+
let shape = 0;
|
|
700
|
+
// Ordinary tree entries are weak values. Explicit aliases are sparse and stay
|
|
701
|
+
// strong while their raw weak key is alive so alias locations survive a period
|
|
702
|
+
// in which no public proxy exists.
|
|
703
|
+
const entries = new WeakMap();
|
|
704
|
+
const aliases = new WeakMap();
|
|
705
|
+
// A live public proxy retains its entry through this ephemeron. Raw proxy RHS
|
|
706
|
+
// values can therefore be unwrapped before they are written into plain targets.
|
|
707
|
+
const proxyEntries = new WeakMap();
|
|
708
|
+
// WeakRef targets already stay alive through the current JavaScript job. These
|
|
709
|
+
// strong job-local caches avoid repeated deref bookkeeping without extending
|
|
710
|
+
// that lifetime; one microtask drops both maps before the next job.
|
|
711
|
+
let jobCells = new WeakMap();
|
|
712
|
+
let jobProxies = new WeakMap();
|
|
713
|
+
let jobCleanupScheduled = false;
|
|
714
|
+
const andorraScheduleJobCleanup = () => {
|
|
715
|
+
if (jobCleanupScheduled)
|
|
716
|
+
return;
|
|
717
|
+
jobCleanupScheduled = true;
|
|
718
|
+
queueMicrotask(() => {
|
|
719
|
+
jobCells = new WeakMap();
|
|
720
|
+
jobProxies = new WeakMap();
|
|
721
|
+
jobCleanupScheduled = false;
|
|
722
|
+
});
|
|
723
|
+
};
|
|
724
|
+
const andorraKeepCellForJob = (ref, cell) => {
|
|
725
|
+
jobCells.set(ref, cell);
|
|
726
|
+
andorraScheduleJobCleanup();
|
|
727
|
+
};
|
|
728
|
+
const andorraDerefCell = (ref) => {
|
|
729
|
+
const cached = jobCells.get(ref);
|
|
730
|
+
if (cached !== undefined)
|
|
731
|
+
return cached;
|
|
732
|
+
const cell = ref.deref();
|
|
733
|
+
if (cell !== undefined)
|
|
734
|
+
andorraKeepCellForJob(ref, cell);
|
|
735
|
+
return cell;
|
|
736
|
+
};
|
|
737
|
+
const entryFinalizer = new FinalizationRegistry(({ target, token }) => {
|
|
738
|
+
const raw = target.deref();
|
|
739
|
+
if (raw !== undefined && entries.get(raw)?.token === token)
|
|
740
|
+
entries.delete(raw);
|
|
741
|
+
});
|
|
742
|
+
const cellFinalizer = new FinalizationRegistry(({ owner, key, ref }) => {
|
|
743
|
+
const entry = owner.deref();
|
|
744
|
+
if (entry === undefined)
|
|
745
|
+
return;
|
|
746
|
+
if (key !== undefined && entry.childProxies?.get(key) === ref)
|
|
747
|
+
entry.childProxies.delete(key);
|
|
748
|
+
entry.childCells?.delete(ref);
|
|
749
|
+
});
|
|
750
|
+
// Almost no document ever puts one object at two positions. Until one does,
|
|
751
|
+
// every write has exactly one path, so the per-write cell walk is skipped.
|
|
752
|
+
let aliased = false;
|
|
753
|
+
const andorraIsDetached = (cell) => {
|
|
754
|
+
for (let c = cell; c !== undefined; c = c.parent)
|
|
755
|
+
if (c.dead)
|
|
756
|
+
return true;
|
|
757
|
+
return false;
|
|
758
|
+
};
|
|
759
|
+
const andorraPathOf = (cell) => {
|
|
760
|
+
if (cell.at === shape && cell.cached !== undefined)
|
|
761
|
+
return cell.cached;
|
|
762
|
+
const out = [];
|
|
763
|
+
for (let c = cell; c !== undefined && c.parent !== undefined; c = c.parent)
|
|
764
|
+
out.push(c.seg);
|
|
765
|
+
out.reverse();
|
|
766
|
+
cell.at = shape;
|
|
767
|
+
cell.cached = out;
|
|
768
|
+
return out;
|
|
769
|
+
};
|
|
770
|
+
const andorraLiveCells = (entry) => {
|
|
771
|
+
const out = [];
|
|
772
|
+
for (const cell of entry.cells)
|
|
773
|
+
if (!andorraIsDetached(cell))
|
|
774
|
+
out.push(cell);
|
|
775
|
+
return out;
|
|
776
|
+
};
|
|
777
|
+
const andorraPrimary = (entry) => (aliased ? (andorraLiveCells(entry)[0] ?? entry.fallback) : entry.fallback);
|
|
778
|
+
const andorraPathNow = (entry) => andorraPathOf(andorraPrimary(entry));
|
|
779
|
+
const andorraFindEntry = (target) => {
|
|
780
|
+
const alias = aliases.get(target);
|
|
781
|
+
if (alias !== undefined)
|
|
782
|
+
return alias;
|
|
783
|
+
const slot = entries.get(target);
|
|
784
|
+
const entry = slot?.ref.deref();
|
|
785
|
+
if (slot !== undefined && entry === undefined)
|
|
786
|
+
entries.delete(target);
|
|
787
|
+
return entry;
|
|
788
|
+
};
|
|
789
|
+
const andorraIndexEntry = (entry) => {
|
|
790
|
+
const token = {};
|
|
791
|
+
entries.set(entry.target, { ref: new WeakRef(entry), token });
|
|
792
|
+
entryFinalizer.register(entry, { target: new WeakRef(entry.target), token });
|
|
793
|
+
};
|
|
794
|
+
const andorraAddPlacement = (entry, cell) => {
|
|
795
|
+
if (entry.cells.has(cell))
|
|
796
|
+
return;
|
|
797
|
+
let hasLive = false;
|
|
798
|
+
for (const existing of entry.cells) {
|
|
799
|
+
if (!andorraIsDetached(existing)) {
|
|
800
|
+
hasLive = true;
|
|
801
|
+
break;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
cell.entry = entry;
|
|
805
|
+
cell.target = entry.target;
|
|
806
|
+
entry.cells.add(cell);
|
|
807
|
+
if (!hasLive) {
|
|
808
|
+
const previous = entry.fallback;
|
|
809
|
+
entry.fallback = cell;
|
|
810
|
+
if (previous !== cell) {
|
|
811
|
+
shape++;
|
|
812
|
+
// Reattaching a held container moves every known immediate child to
|
|
813
|
+
// its new placement. Array registrations survive cache clears.
|
|
814
|
+
const children = new Set();
|
|
815
|
+
for (const ref of entry.childProxies?.values() ?? []) {
|
|
816
|
+
const child = andorraDerefCell(ref);
|
|
817
|
+
if (child !== undefined)
|
|
818
|
+
children.add(child);
|
|
819
|
+
}
|
|
820
|
+
for (const ref of entry.childCells ?? []) {
|
|
821
|
+
const child = andorraDerefCell(ref);
|
|
822
|
+
if (child !== undefined)
|
|
823
|
+
children.add(child);
|
|
824
|
+
}
|
|
825
|
+
for (const child of children) {
|
|
826
|
+
if (!child.dead && child.parent === previous)
|
|
827
|
+
child.parent = cell;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
else if (entry.blocked === undefined) {
|
|
832
|
+
aliased = true;
|
|
833
|
+
aliases.set(entry.target, entry);
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
const andorraCachePlacement = (owner, key, cell) => {
|
|
837
|
+
let cleanup = cell.cleanup;
|
|
838
|
+
if (cleanup === undefined) {
|
|
839
|
+
cleanup = { owner: new WeakRef(owner), key: undefined, ref: new WeakRef(cell) };
|
|
840
|
+
cell.cleanup = cleanup;
|
|
841
|
+
cellFinalizer.register(cell, cleanup);
|
|
842
|
+
}
|
|
843
|
+
andorraKeepCellForJob(cleanup.ref, cell);
|
|
844
|
+
if (cleanup.key !== undefined && cleanup.key !== key && owner.childProxies?.get(cleanup.key) === cleanup.ref) {
|
|
845
|
+
owner.childProxies.delete(cleanup.key);
|
|
846
|
+
}
|
|
847
|
+
if (owner.childProxies === undefined)
|
|
848
|
+
owner.childProxies = new Map();
|
|
849
|
+
owner.childProxies.set(key, cleanup.ref);
|
|
850
|
+
cleanup.key = key;
|
|
851
|
+
if (Array.isArray(owner.target)) {
|
|
852
|
+
if (owner.childCells === undefined)
|
|
853
|
+
owner.childCells = new Set();
|
|
854
|
+
owner.childCells.add(cleanup.ref);
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
const andorraFindPlacement = (owner, parent, segment, target, blocked) => {
|
|
858
|
+
if (blocked === undefined) {
|
|
859
|
+
const known = andorraFindEntry(target);
|
|
860
|
+
if (known !== undefined) {
|
|
861
|
+
for (const cell of known.cells) {
|
|
862
|
+
if (!cell.dead && cell.owner === owner && cell.parent === parent && cell.seg === segment)
|
|
863
|
+
return cell;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return undefined;
|
|
867
|
+
}
|
|
868
|
+
// Blocked views are intentionally absent from the ordinary raw-entry index.
|
|
869
|
+
for (const ref of owner.childCells ?? []) {
|
|
870
|
+
const cell = andorraDerefCell(ref);
|
|
871
|
+
if (cell !== undefined &&
|
|
872
|
+
!cell.dead &&
|
|
873
|
+
cell.target === target &&
|
|
874
|
+
cell.entry?.blocked === blocked &&
|
|
875
|
+
cell.parent === parent &&
|
|
876
|
+
cell.seg === segment) {
|
|
877
|
+
return cell;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
return undefined;
|
|
881
|
+
};
|
|
882
|
+
const andorraUnwrap = (value) => (andorraIsObj(value) ? (proxyEntries.get(value)?.target ?? value) : value);
|
|
883
|
+
const andorraAdoptItems = (values) => values.map(andorraUnwrap);
|
|
884
|
+
// Every operation is emitted once per live location of an explicitly aliased
|
|
885
|
+
// object. Alias cells are independent of public proxy lifetimes.
|
|
886
|
+
const andorraEmit = (entry, op) => {
|
|
887
|
+
andorraRecord(op);
|
|
888
|
+
if (!aliased)
|
|
889
|
+
return;
|
|
890
|
+
const live = andorraLiveCells(entry);
|
|
891
|
+
if (live.length <= 1)
|
|
892
|
+
return;
|
|
893
|
+
const base = andorraPathNow(entry);
|
|
894
|
+
const head = andorraPrimary(entry);
|
|
895
|
+
for (const cell of live) {
|
|
896
|
+
if (cell === head || op[0] === "r")
|
|
897
|
+
continue;
|
|
898
|
+
const rest = op[1].slice(base.length);
|
|
899
|
+
const cloned = [...op];
|
|
900
|
+
cloned[1] = [...andorraPathOf(cell), ...rest];
|
|
901
|
+
andorraRecord(cloned);
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
// Structural mutation updates every still-live placement cell, including cells
|
|
905
|
+
// retained only by held descendants. Dead weak registrations are pruned lazily;
|
|
906
|
+
// finalizers keep idle live parents from accumulating them indefinitely.
|
|
907
|
+
const andorraRenumber = (entry, key, before, after, spliceAt, spliceRemove, spliceInsert) => {
|
|
908
|
+
shape++;
|
|
909
|
+
const childCells = entry.childCells;
|
|
910
|
+
if (key === "push" || !Array.isArray(entry.target) || childCells === undefined || childCells.size === 0)
|
|
911
|
+
return;
|
|
912
|
+
let index;
|
|
913
|
+
let remove = 0;
|
|
914
|
+
let insert = 0;
|
|
915
|
+
if (key === "pop") {
|
|
916
|
+
index = before - 1;
|
|
917
|
+
remove = before > 0 ? 1 : 0;
|
|
918
|
+
}
|
|
919
|
+
else if (key === "shift") {
|
|
920
|
+
index = 0;
|
|
921
|
+
remove = before > 0 ? 1 : 0;
|
|
922
|
+
}
|
|
923
|
+
else if (key === "unshift") {
|
|
924
|
+
index = 0;
|
|
925
|
+
insert = after - before;
|
|
926
|
+
}
|
|
927
|
+
else if (key === "splice") {
|
|
928
|
+
index = spliceAt;
|
|
929
|
+
remove = spliceRemove;
|
|
930
|
+
insert = spliceInsert;
|
|
931
|
+
}
|
|
932
|
+
else {
|
|
933
|
+
for (const ref of [...childCells]) {
|
|
934
|
+
const cell = andorraDerefCell(ref);
|
|
935
|
+
if (cell === undefined) {
|
|
936
|
+
childCells.delete(ref);
|
|
937
|
+
continue;
|
|
938
|
+
}
|
|
939
|
+
const at = entry.target.indexOf(cell.target);
|
|
940
|
+
if (at < 0) {
|
|
941
|
+
cell.dead = true;
|
|
942
|
+
childCells.delete(ref);
|
|
943
|
+
}
|
|
944
|
+
else
|
|
945
|
+
cell.seg = at;
|
|
946
|
+
}
|
|
947
|
+
entry.childProxies?.clear();
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
const delta = insert - remove;
|
|
951
|
+
for (const ref of [...childCells]) {
|
|
952
|
+
const cell = andorraDerefCell(ref);
|
|
953
|
+
if (cell === undefined) {
|
|
954
|
+
childCells.delete(ref);
|
|
955
|
+
continue;
|
|
956
|
+
}
|
|
957
|
+
const at = cell.seg;
|
|
958
|
+
if (typeof at !== "number")
|
|
959
|
+
continue;
|
|
960
|
+
if (at >= index && at < index + remove) {
|
|
961
|
+
cell.dead = true;
|
|
962
|
+
childCells.delete(ref);
|
|
963
|
+
}
|
|
964
|
+
else if (at >= index + remove)
|
|
965
|
+
cell.seg = at + delta;
|
|
966
|
+
}
|
|
967
|
+
entry.childProxies?.clear();
|
|
968
|
+
};
|
|
969
|
+
const andorraWrap = (object, cell, blockedSegment) => {
|
|
970
|
+
const placed = cell.entry;
|
|
971
|
+
if (placed !== undefined && placed.target === object && placed.blocked === blockedSegment) {
|
|
972
|
+
return andorraProxyFor(placed);
|
|
973
|
+
}
|
|
974
|
+
const existing = blockedSegment === undefined ? andorraFindEntry(object) : undefined;
|
|
975
|
+
if (existing !== undefined) {
|
|
976
|
+
andorraAddPlacement(existing, cell);
|
|
977
|
+
return andorraProxyFor(existing);
|
|
978
|
+
}
|
|
979
|
+
const entry = {
|
|
980
|
+
target: object,
|
|
981
|
+
cells: new Set(),
|
|
982
|
+
fallback: cell,
|
|
983
|
+
blocked: blockedSegment,
|
|
984
|
+
proxy: undefined,
|
|
985
|
+
childProxies: undefined,
|
|
986
|
+
childCells: undefined,
|
|
987
|
+
};
|
|
988
|
+
andorraAddPlacement(entry, cell);
|
|
989
|
+
if (blockedSegment === undefined)
|
|
990
|
+
andorraIndexEntry(entry);
|
|
991
|
+
return andorraProxyFor(entry);
|
|
992
|
+
};
|
|
993
|
+
const handlerPrototype = {
|
|
994
|
+
get(target, key, receiver) {
|
|
995
|
+
const entry = this.entry;
|
|
996
|
+
if (Array.isArray(target) && typeof key === "string" && MUTATORS.has(key)) {
|
|
997
|
+
return (...args) => {
|
|
998
|
+
if (entry.blocked !== undefined)
|
|
999
|
+
throw new AndorraUnsafePathError(entry.blocked);
|
|
1000
|
+
const detached = aliased ? andorraLiveCells(entry).length === 0 : andorraIsDetached(entry.fallback);
|
|
1001
|
+
if (detached) {
|
|
1002
|
+
return Reflect.apply(Array.prototype[key], target, args.map(andorraUnwrap));
|
|
1003
|
+
}
|
|
1004
|
+
const before = target.length;
|
|
1005
|
+
let spliceAt = -1;
|
|
1006
|
+
let spliceRemove = 0;
|
|
1007
|
+
let spliceInsert = 0;
|
|
1008
|
+
let insertAt = -1;
|
|
1009
|
+
let insertCount = 0;
|
|
1010
|
+
let result;
|
|
1011
|
+
switch (key) {
|
|
1012
|
+
case "push": {
|
|
1013
|
+
const items = andorraAdoptItems(args);
|
|
1014
|
+
if (items.length > 0)
|
|
1015
|
+
andorraEmit(entry, ["p", [...andorraPathNow(entry)], before, 0, andorraCloneJson(items)]);
|
|
1016
|
+
insertAt = before;
|
|
1017
|
+
insertCount = items.length;
|
|
1018
|
+
andorraSpliceItems(target, before, 0, items);
|
|
1019
|
+
result = target.length;
|
|
1020
|
+
break;
|
|
1021
|
+
}
|
|
1022
|
+
case "unshift": {
|
|
1023
|
+
const items = andorraAdoptItems(args);
|
|
1024
|
+
if (items.length > 0)
|
|
1025
|
+
andorraEmit(entry, ["p", [...andorraPathNow(entry)], 0, 0, andorraCloneJson(items)]);
|
|
1026
|
+
insertAt = 0;
|
|
1027
|
+
insertCount = items.length;
|
|
1028
|
+
andorraSpliceItems(target, 0, 0, items);
|
|
1029
|
+
result = target.length;
|
|
1030
|
+
break;
|
|
1031
|
+
}
|
|
1032
|
+
case "pop":
|
|
1033
|
+
if (before > 0)
|
|
1034
|
+
andorraEmit(entry, ["p", [...andorraPathNow(entry)], before - 1, 1, []]);
|
|
1035
|
+
result = Reflect.apply(Array.prototype.pop, target, args);
|
|
1036
|
+
break;
|
|
1037
|
+
case "shift":
|
|
1038
|
+
if (before > 0)
|
|
1039
|
+
andorraEmit(entry, ["p", [...andorraPathNow(entry)], 0, 1, []]);
|
|
1040
|
+
result = Reflect.apply(Array.prototype.shift, target, args);
|
|
1041
|
+
break;
|
|
1042
|
+
case "splice": {
|
|
1043
|
+
const items = andorraAdoptItems(args.slice(2));
|
|
1044
|
+
const { index, remove } = andorraSpliceRange(before, args);
|
|
1045
|
+
spliceAt = index;
|
|
1046
|
+
spliceRemove = remove;
|
|
1047
|
+
spliceInsert = items.length;
|
|
1048
|
+
insertAt = index;
|
|
1049
|
+
insertCount = items.length;
|
|
1050
|
+
if (remove > 0 || items.length > 0) {
|
|
1051
|
+
if (index === 0 && remove === before) {
|
|
1052
|
+
if (andorraPathNow(entry).length === 0)
|
|
1053
|
+
andorraEmit(entry, ["r", andorraCloneJson(items)]);
|
|
1054
|
+
else
|
|
1055
|
+
andorraEmit(entry, [
|
|
1056
|
+
"s",
|
|
1057
|
+
[...andorraPathNow(entry)],
|
|
1058
|
+
andorraCloneJson(items),
|
|
1059
|
+
]);
|
|
1060
|
+
}
|
|
1061
|
+
else
|
|
1062
|
+
andorraEmit(entry, ["p", [...andorraPathNow(entry)], index, remove, andorraCloneJson(items)]);
|
|
1063
|
+
}
|
|
1064
|
+
result = andorraSpliceItems(target, index, remove, items);
|
|
1065
|
+
break;
|
|
1066
|
+
}
|
|
1067
|
+
default: {
|
|
1068
|
+
result = Reflect.apply(Array.prototype[key], target, args.map(andorraUnwrap));
|
|
1069
|
+
if (andorraPathNow(entry).length === 0)
|
|
1070
|
+
andorraEmit(entry, ["r", andorraCloneJson(target)]);
|
|
1071
|
+
else
|
|
1072
|
+
andorraEmit(entry, [
|
|
1073
|
+
"s",
|
|
1074
|
+
[...andorraPathNow(entry)],
|
|
1075
|
+
andorraCloneJson(target),
|
|
1076
|
+
]);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
andorraCollapsePending();
|
|
1080
|
+
andorraRenumber(entry, key, before, target.length, spliceAt, spliceRemove, spliceInsert);
|
|
1081
|
+
for (let index = insertAt; insertCount > 0 && index < insertAt + insertCount; index++) {
|
|
1082
|
+
const item = target[index];
|
|
1083
|
+
if (!andorraIsObj(item))
|
|
1084
|
+
continue;
|
|
1085
|
+
const known = andorraFindEntry(item);
|
|
1086
|
+
if (known === undefined || known.target === entry.target)
|
|
1087
|
+
continue;
|
|
1088
|
+
const parent = andorraPrimary(entry);
|
|
1089
|
+
let seen = false;
|
|
1090
|
+
for (const existingCell of known.cells) {
|
|
1091
|
+
if (!existingCell.dead && existingCell.parent === parent && existingCell.seg === index)
|
|
1092
|
+
seen = true;
|
|
1093
|
+
}
|
|
1094
|
+
if (!seen) {
|
|
1095
|
+
const inserted = {
|
|
1096
|
+
parent,
|
|
1097
|
+
owner: entry,
|
|
1098
|
+
entry: undefined,
|
|
1099
|
+
target: item,
|
|
1100
|
+
seg: index,
|
|
1101
|
+
dead: false,
|
|
1102
|
+
};
|
|
1103
|
+
andorraAddPlacement(known, inserted);
|
|
1104
|
+
andorraCachePlacement(entry, String(index), inserted);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
return key === "sort" || key === "reverse" || key === "fill" || key === "copyWithin" ? receiver : result;
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
const value = Reflect.get(target, key, receiver);
|
|
1111
|
+
if (!andorraIsObj(value))
|
|
1112
|
+
return value;
|
|
1113
|
+
const cachedRef = entry.childProxies?.get(key);
|
|
1114
|
+
const cached = cachedRef === undefined ? undefined : andorraDerefCell(cachedRef);
|
|
1115
|
+
if (cached !== undefined && cached.target === value && cached.entry !== undefined) {
|
|
1116
|
+
return andorraProxyFor(cached.entry);
|
|
1117
|
+
}
|
|
1118
|
+
if (cachedRef !== undefined && cached === undefined && entry.childProxies?.get(key) === cachedRef) {
|
|
1119
|
+
entry.childProxies?.delete(key);
|
|
1120
|
+
}
|
|
1121
|
+
const rawSegment = andorraNorm(target, key);
|
|
1122
|
+
let segment;
|
|
1123
|
+
let childBlocked = entry.blocked;
|
|
1124
|
+
if (entry.blocked !== undefined) {
|
|
1125
|
+
if (typeof rawSegment === "symbol")
|
|
1126
|
+
throw new AndorraUnsafePathError(String(rawSegment));
|
|
1127
|
+
segment = rawSegment;
|
|
1128
|
+
}
|
|
1129
|
+
else if (typeof rawSegment === "string" && RESERVED_SEGMENTS.has(rawSegment) && Object.hasOwn(target, key)) {
|
|
1130
|
+
segment = rawSegment;
|
|
1131
|
+
childBlocked = rawSegment;
|
|
1132
|
+
}
|
|
1133
|
+
else
|
|
1134
|
+
segment = andorraGuard(rawSegment);
|
|
1135
|
+
const parent = andorraPrimary(entry);
|
|
1136
|
+
const existingCell = andorraFindPlacement(entry, parent, segment, value, childBlocked);
|
|
1137
|
+
if (existingCell?.entry !== undefined) {
|
|
1138
|
+
andorraCachePlacement(entry, key, existingCell);
|
|
1139
|
+
return andorraProxyFor(existingCell.entry);
|
|
1140
|
+
}
|
|
1141
|
+
const childCell = {
|
|
1142
|
+
parent,
|
|
1143
|
+
owner: entry,
|
|
1144
|
+
entry: undefined,
|
|
1145
|
+
target: value,
|
|
1146
|
+
seg: segment,
|
|
1147
|
+
dead: false,
|
|
1148
|
+
};
|
|
1149
|
+
const child = andorraWrap(value, childCell, childBlocked);
|
|
1150
|
+
andorraCachePlacement(entry, key, childCell);
|
|
1151
|
+
return child;
|
|
1152
|
+
},
|
|
1153
|
+
set(target, key, value) {
|
|
1154
|
+
const entry = this.entry;
|
|
1155
|
+
if (entry.blocked !== undefined)
|
|
1156
|
+
throw new AndorraUnsafePathError(entry.blocked);
|
|
1157
|
+
const rawValue = andorraUnwrap(value);
|
|
1158
|
+
if (aliased ? andorraLiveCells(entry).length === 0 : andorraIsDetached(entry.fallback)) {
|
|
1159
|
+
return Reflect.set(target, key, rawValue);
|
|
1160
|
+
}
|
|
1161
|
+
if (Array.isArray(target) && key === "length") {
|
|
1162
|
+
const before = target.length;
|
|
1163
|
+
const next = Number(rawValue);
|
|
1164
|
+
if (!Number.isSafeInteger(next) || next < 0 || next > 4_294_967_295) {
|
|
1165
|
+
return Reflect.set(target, key, rawValue);
|
|
1166
|
+
}
|
|
1167
|
+
if (next < before) {
|
|
1168
|
+
if (next === 0) {
|
|
1169
|
+
if (andorraPathNow(entry).length === 0)
|
|
1170
|
+
andorraEmit(entry, ["r", []]);
|
|
1171
|
+
else
|
|
1172
|
+
andorraEmit(entry, ["s", [...andorraPathNow(entry)], []]);
|
|
1173
|
+
}
|
|
1174
|
+
else
|
|
1175
|
+
andorraEmit(entry, ["p", [...andorraPathNow(entry)], next, before - next, []]);
|
|
1176
|
+
Reflect.set(target, key, next);
|
|
1177
|
+
andorraRenumber(entry, "splice", before, next, next, before - next, 0);
|
|
1178
|
+
entry.childProxies?.clear();
|
|
1179
|
+
}
|
|
1180
|
+
else if (next > before) {
|
|
1181
|
+
target.length = next;
|
|
1182
|
+
target.fill(null, before);
|
|
1183
|
+
const grown = new Array(next - before).fill(null);
|
|
1184
|
+
andorraEmit(entry, ["p", [...andorraPathNow(entry)], before, 0, grown]);
|
|
1185
|
+
}
|
|
1186
|
+
andorraCollapsePending();
|
|
1187
|
+
return true;
|
|
1188
|
+
}
|
|
1189
|
+
const segment = andorraGuard(andorraNorm(target, key));
|
|
1190
|
+
if (Array.isArray(target)) {
|
|
1191
|
+
if (typeof segment !== "number")
|
|
1192
|
+
throw new AndorraUnsafePathError(segment);
|
|
1193
|
+
if (segment > target.length)
|
|
1194
|
+
throw new AndorraUnsafePathError(segment);
|
|
1195
|
+
}
|
|
1196
|
+
const at = [...andorraPathNow(entry), segment];
|
|
1197
|
+
if (rawValue === undefined) {
|
|
1198
|
+
if (Array.isArray(target))
|
|
1199
|
+
throw new TypeError("undefined would create a sparse array; use splice instead");
|
|
1200
|
+
if (Object.hasOwn(target, key))
|
|
1201
|
+
andorraEmit(entry, ["d", at]);
|
|
1202
|
+
entry.childProxies?.delete(key);
|
|
1203
|
+
const deleted = Reflect.deleteProperty(target, key);
|
|
1204
|
+
if (deleted)
|
|
1205
|
+
andorraCollapsePending();
|
|
1206
|
+
return deleted;
|
|
1207
|
+
}
|
|
1208
|
+
const previous = target[key];
|
|
1209
|
+
if (previous === rawValue)
|
|
1210
|
+
return true;
|
|
1211
|
+
if (Array.isArray(target) && segment === target.length) {
|
|
1212
|
+
andorraEmit(entry, ["p", [...andorraPathNow(entry)], target.length, 0, [andorraCloneJson(rawValue)]]);
|
|
1213
|
+
}
|
|
1214
|
+
else if (andorraIsObj(previous) && andorraIsObj(rawValue)) {
|
|
1215
|
+
andorraDiffInto(previous, rawValue, [...andorraPathNow(entry), segment]);
|
|
1216
|
+
}
|
|
1217
|
+
else if (typeof previous === "string" && typeof rawValue === "string") {
|
|
1218
|
+
if (!aliased)
|
|
1219
|
+
andorraRecordString([...andorraPathNow(entry), segment], previous, rawValue);
|
|
1220
|
+
else
|
|
1221
|
+
for (const cell of andorraLiveCells(entry))
|
|
1222
|
+
andorraRecordString([...andorraPathOf(cell), segment], previous, rawValue);
|
|
1223
|
+
}
|
|
1224
|
+
else {
|
|
1225
|
+
andorraEmit(entry, ["s", at, andorraCloneJson(rawValue)]);
|
|
1226
|
+
}
|
|
1227
|
+
entry.childProxies?.delete(key);
|
|
1228
|
+
const updated = Reflect.set(target, key, rawValue);
|
|
1229
|
+
if (updated) {
|
|
1230
|
+
if (andorraIsObj(rawValue)) {
|
|
1231
|
+
const known = andorraFindEntry(rawValue);
|
|
1232
|
+
if (known !== undefined) {
|
|
1233
|
+
const placement = {
|
|
1234
|
+
parent: andorraPrimary(entry),
|
|
1235
|
+
owner: entry,
|
|
1236
|
+
entry: undefined,
|
|
1237
|
+
target: rawValue,
|
|
1238
|
+
seg: segment,
|
|
1239
|
+
dead: false,
|
|
1240
|
+
};
|
|
1241
|
+
andorraAddPlacement(known, placement);
|
|
1242
|
+
andorraCachePlacement(entry, key, placement);
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
andorraCollapsePending();
|
|
1246
|
+
}
|
|
1247
|
+
return updated;
|
|
1248
|
+
},
|
|
1249
|
+
deleteProperty(target, key) {
|
|
1250
|
+
const entry = this.entry;
|
|
1251
|
+
if (entry.blocked !== undefined)
|
|
1252
|
+
throw new AndorraUnsafePathError(entry.blocked);
|
|
1253
|
+
if (aliased ? andorraLiveCells(entry).length === 0 : andorraIsDetached(entry.fallback)) {
|
|
1254
|
+
return Reflect.deleteProperty(target, key);
|
|
1255
|
+
}
|
|
1256
|
+
const segment = andorraGuard(andorraNorm(target, key));
|
|
1257
|
+
if (Array.isArray(target)) {
|
|
1258
|
+
if (typeof segment !== "number")
|
|
1259
|
+
throw new AndorraUnsafePathError(segment);
|
|
1260
|
+
throw new TypeError("delete would create a sparse array; use splice instead");
|
|
1261
|
+
}
|
|
1262
|
+
if (Object.hasOwn(target, key))
|
|
1263
|
+
andorraEmit(entry, ["d", [...andorraPathNow(entry), segment]]);
|
|
1264
|
+
entry.childProxies?.delete(key);
|
|
1265
|
+
const deleted = Reflect.deleteProperty(target, key);
|
|
1266
|
+
if (deleted)
|
|
1267
|
+
andorraCollapsePending();
|
|
1268
|
+
return deleted;
|
|
1269
|
+
},
|
|
1270
|
+
defineProperty() {
|
|
1271
|
+
throw new TypeError("defineProperty is not supported on tracked state; use assignment");
|
|
1272
|
+
},
|
|
1273
|
+
setPrototypeOf() {
|
|
1274
|
+
throw new TypeError("setPrototypeOf is not supported on tracked state");
|
|
1275
|
+
},
|
|
1276
|
+
preventExtensions() {
|
|
1277
|
+
throw new TypeError("preventExtensions is not supported on tracked state");
|
|
1278
|
+
},
|
|
1279
|
+
};
|
|
1280
|
+
function andorraProxyFor(entry) {
|
|
1281
|
+
const cached = jobProxies.get(entry);
|
|
1282
|
+
if (cached !== undefined)
|
|
1283
|
+
return cached;
|
|
1284
|
+
const existing = entry.proxy?.deref();
|
|
1285
|
+
if (existing !== undefined) {
|
|
1286
|
+
jobProxies.set(entry, existing);
|
|
1287
|
+
andorraScheduleJobCleanup();
|
|
1288
|
+
return existing;
|
|
1289
|
+
}
|
|
1290
|
+
const handler = Object.create(handlerPrototype);
|
|
1291
|
+
handler.entry = entry;
|
|
1292
|
+
const proxy = new Proxy(entry.target, handler);
|
|
1293
|
+
entry.proxy = new WeakRef(proxy);
|
|
1294
|
+
jobProxies.set(entry, proxy);
|
|
1295
|
+
andorraScheduleJobCleanup();
|
|
1296
|
+
proxyEntries.set(proxy, entry);
|
|
1297
|
+
return proxy;
|
|
1298
|
+
}
|
|
1299
|
+
const rootCell = {
|
|
1300
|
+
parent: undefined,
|
|
1301
|
+
owner: undefined,
|
|
1302
|
+
entry: undefined,
|
|
1303
|
+
target: root,
|
|
1304
|
+
seg: "",
|
|
1305
|
+
dead: false,
|
|
1306
|
+
};
|
|
1307
|
+
let state = andorraWrap(root, rootCell);
|
|
1308
|
+
return {
|
|
1309
|
+
get state() {
|
|
1310
|
+
return state;
|
|
1311
|
+
},
|
|
1312
|
+
get target() {
|
|
1313
|
+
return root;
|
|
1314
|
+
},
|
|
1315
|
+
set state(next) {
|
|
1316
|
+
const rawNext = andorraUnwrap(next);
|
|
1317
|
+
if (rawNext === root) {
|
|
1318
|
+
andorraClearPending();
|
|
1319
|
+
forceBase = true;
|
|
1320
|
+
return;
|
|
1321
|
+
}
|
|
1322
|
+
andorraClearPending();
|
|
1323
|
+
root = rawNext;
|
|
1324
|
+
state = andorraWrap(root, {
|
|
1325
|
+
parent: undefined,
|
|
1326
|
+
owner: undefined,
|
|
1327
|
+
entry: undefined,
|
|
1328
|
+
target: root,
|
|
1329
|
+
seg: "",
|
|
1330
|
+
dead: false,
|
|
1331
|
+
});
|
|
1332
|
+
forceBase = true;
|
|
1333
|
+
},
|
|
1334
|
+
rebase() {
|
|
1335
|
+
andorraClearPending();
|
|
1336
|
+
forceBase = true;
|
|
1337
|
+
},
|
|
1338
|
+
get dirty() {
|
|
1339
|
+
// conservative: true if anything was written since the last flush, even
|
|
1340
|
+
// if the writes cancelled out
|
|
1341
|
+
return forceBase || hasPending;
|
|
1342
|
+
},
|
|
1343
|
+
discard() {
|
|
1344
|
+
andorraClearPending();
|
|
1345
|
+
},
|
|
1346
|
+
flush() {
|
|
1347
|
+
if (forceBase) {
|
|
1348
|
+
const value = andorraCloneJson(root);
|
|
1349
|
+
forceBase = false;
|
|
1350
|
+
andorraClearPending();
|
|
1351
|
+
return [["r", value]];
|
|
1352
|
+
}
|
|
1353
|
+
if (!hasPending)
|
|
1354
|
+
return [];
|
|
1355
|
+
const out = [];
|
|
1356
|
+
for (const slot of log) {
|
|
1357
|
+
if (slot === undefined || slot.dead)
|
|
1358
|
+
continue;
|
|
1359
|
+
if (slot.str !== undefined) {
|
|
1360
|
+
andorraDiffValue(slot.str.anchor, slot.str.value, slot.op[1], scan, out);
|
|
1361
|
+
continue;
|
|
1362
|
+
}
|
|
1363
|
+
out.push(slot.op);
|
|
1364
|
+
}
|
|
1365
|
+
andorraClearPending();
|
|
1366
|
+
return out;
|
|
1367
|
+
},
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
// ─── Path safety ─────────────────────────────────────────────────────────────
|
|
1371
|
+
/**
|
|
1372
|
+
* Segments that reach the prototype chain.
|
|
1373
|
+
*
|
|
1374
|
+
* `JSON.parse` is safe on its own — it makes `__proto__` an own property. What is
|
|
1375
|
+
* not safe is `parent[key] = value`, which is exactly what an applier does, and
|
|
1376
|
+
* paths are data: `["s", ["__proto__", "isAdmin"], true]` pollutes
|
|
1377
|
+
* `Object.prototype` for the whole process.
|
|
1378
|
+
*
|
|
1379
|
+
* Ops arrive from a facet, a plugin compartment, or a tool whose details may echo
|
|
1380
|
+
* model output, so none of it is trusted input.
|
|
1381
|
+
*/
|
|
1382
|
+
export const RESERVED_SEGMENTS = new Set(["__proto__", "constructor", "prototype"]);
|
|
1383
|
+
export class AndorraUnsafePathError extends Error {
|
|
1384
|
+
// Not a parameter property: Node's --experimental-strip-types rejects those,
|
|
1385
|
+
// and these files are meant to run under it directly.
|
|
1386
|
+
segment;
|
|
1387
|
+
constructor(segment) {
|
|
1388
|
+
super(`unsafe path segment: ${String(segment)}`);
|
|
1389
|
+
this.segment = segment;
|
|
1390
|
+
this.name = "UnsafePathError";
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Verb, arity and payload shape for a **decoded** op: paths inline, no `#`, no
|
|
1395
|
+
* short forms. `apply` uses this.
|
|
1396
|
+
*
|
|
1397
|
+
* Validating `Op` against the wire grammar would be laxer than the type: a
|
|
1398
|
+
* two-element `["s", value]` would pass, and `apply` would then read the value as
|
|
1399
|
+
* a path. Each vocabulary gets the validator that matches it.
|
|
1400
|
+
*/
|
|
1401
|
+
export function andorraAssertValidOp(op) {
|
|
1402
|
+
if (!Array.isArray(op) || op.length === 0)
|
|
1403
|
+
throw new TypeError("op is not a tuple");
|
|
1404
|
+
switch (op[0]) {
|
|
1405
|
+
case "r":
|
|
1406
|
+
if (op.length !== 2)
|
|
1407
|
+
throw new TypeError("r arity");
|
|
1408
|
+
return;
|
|
1409
|
+
case "s":
|
|
1410
|
+
if (op.length !== 3)
|
|
1411
|
+
throw new TypeError("s arity");
|
|
1412
|
+
andorraAssertPathArg(op[1], true);
|
|
1413
|
+
return;
|
|
1414
|
+
case "d":
|
|
1415
|
+
if (op.length !== 2)
|
|
1416
|
+
throw new TypeError("d arity");
|
|
1417
|
+
andorraAssertPathArg(op[1], true);
|
|
1418
|
+
return;
|
|
1419
|
+
case "a":
|
|
1420
|
+
if (op.length !== 3 || typeof op[2] !== "string")
|
|
1421
|
+
throw new TypeError("a shape");
|
|
1422
|
+
andorraAssertPathArg(op[1], true);
|
|
1423
|
+
return;
|
|
1424
|
+
case "t":
|
|
1425
|
+
if (op.length !== 3 || !Number.isInteger(op[2]) || op[2] < 0)
|
|
1426
|
+
throw new TypeError("t shape");
|
|
1427
|
+
andorraAssertPathArg(op[1], true);
|
|
1428
|
+
return;
|
|
1429
|
+
case "p": {
|
|
1430
|
+
if (op.length !== 5)
|
|
1431
|
+
throw new TypeError("p arity");
|
|
1432
|
+
andorraAssertPathArg(op[1]);
|
|
1433
|
+
if (!Number.isInteger(op[2]) || op[2] < 0)
|
|
1434
|
+
throw new TypeError("p index");
|
|
1435
|
+
if (!Number.isInteger(op[3]) || op[3] < 0)
|
|
1436
|
+
throw new TypeError("p remove");
|
|
1437
|
+
if (!Array.isArray(op[4]))
|
|
1438
|
+
throw new TypeError("p items");
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
// Silently skipping an unknown verb is how a newer producer's op vanishes.
|
|
1442
|
+
default:
|
|
1443
|
+
throw new TypeError(`unknown op verb: ${String(op[0])}`);
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
function andorraAssertPathArg(p, nonEmpty = false) {
|
|
1447
|
+
if (!Array.isArray(p))
|
|
1448
|
+
throw new TypeError("path is not an array");
|
|
1449
|
+
if (nonEmpty && p.length === 0)
|
|
1450
|
+
throw new TypeError("path is empty");
|
|
1451
|
+
andorraAssertSafePath(p);
|
|
1452
|
+
}
|
|
1453
|
+
/** The same, for the wire grammar: ids and short forms are legal here. */
|
|
1454
|
+
export function andorraAssertValidWireOp(op) {
|
|
1455
|
+
if (!Array.isArray(op) || op.length === 0)
|
|
1456
|
+
throw new TypeError("op is not a tuple");
|
|
1457
|
+
const [verb] = op;
|
|
1458
|
+
const andorraOkRef = (r) => {
|
|
1459
|
+
if (typeof r === "number") {
|
|
1460
|
+
if (!Number.isInteger(r) || r < 0)
|
|
1461
|
+
throw new TypeError("bad path id");
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
// A string is not a path. Unchecked, `"a".slice(0, -1)` is `""`, so it
|
|
1465
|
+
// resolves to the ROOT and writes there — a path that is not a path, accepted.
|
|
1466
|
+
if (!Array.isArray(r))
|
|
1467
|
+
throw new TypeError("path is not an array");
|
|
1468
|
+
andorraAssertSafePath(r);
|
|
1469
|
+
};
|
|
1470
|
+
switch (verb) {
|
|
1471
|
+
case "r":
|
|
1472
|
+
if (op.length !== 2)
|
|
1473
|
+
throw new TypeError("r arity");
|
|
1474
|
+
return;
|
|
1475
|
+
case "s":
|
|
1476
|
+
if (op.length === 3)
|
|
1477
|
+
andorraOkRef(op[1]);
|
|
1478
|
+
else if (op.length !== 2)
|
|
1479
|
+
throw new TypeError("s arity");
|
|
1480
|
+
return;
|
|
1481
|
+
case "d":
|
|
1482
|
+
if (op.length === 2)
|
|
1483
|
+
andorraOkRef(op[1]);
|
|
1484
|
+
else if (op.length !== 1)
|
|
1485
|
+
throw new TypeError("d arity");
|
|
1486
|
+
return;
|
|
1487
|
+
case "a":
|
|
1488
|
+
if (op.length === 3) {
|
|
1489
|
+
andorraOkRef(op[1]);
|
|
1490
|
+
if (typeof op[2] !== "string")
|
|
1491
|
+
throw new TypeError("a value");
|
|
1492
|
+
}
|
|
1493
|
+
else if (op.length === 2) {
|
|
1494
|
+
if (typeof op[1] !== "string")
|
|
1495
|
+
throw new TypeError("a value");
|
|
1496
|
+
}
|
|
1497
|
+
else
|
|
1498
|
+
throw new TypeError("a arity");
|
|
1499
|
+
return;
|
|
1500
|
+
case "t":
|
|
1501
|
+
if (op.length === 3) {
|
|
1502
|
+
andorraOkRef(op[1]);
|
|
1503
|
+
if (!Number.isInteger(op[2]) || op[2] < 0)
|
|
1504
|
+
throw new TypeError("t count");
|
|
1505
|
+
}
|
|
1506
|
+
else if (op.length === 2) {
|
|
1507
|
+
if (!Number.isInteger(op[1]) || op[1] < 0)
|
|
1508
|
+
throw new TypeError("t count");
|
|
1509
|
+
}
|
|
1510
|
+
else
|
|
1511
|
+
throw new TypeError("t arity");
|
|
1512
|
+
return;
|
|
1513
|
+
case "p": {
|
|
1514
|
+
const [i, r, items] = op.length === 5 ? [op[2], op[3], op[4]] : op.length === 4 ? [op[1], op[2], op[3]] : [];
|
|
1515
|
+
if (items === undefined)
|
|
1516
|
+
throw new TypeError("p arity");
|
|
1517
|
+
if (op.length === 5)
|
|
1518
|
+
andorraOkRef(op[1]);
|
|
1519
|
+
if (!Number.isInteger(i) || i < 0)
|
|
1520
|
+
throw new TypeError("p index");
|
|
1521
|
+
if (!Number.isInteger(r) || r < 0)
|
|
1522
|
+
throw new TypeError("p remove");
|
|
1523
|
+
if (!Array.isArray(items))
|
|
1524
|
+
throw new TypeError("p items");
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
case "#": {
|
|
1528
|
+
if (op.length !== 3 || !Number.isInteger(op[1]) || op[1] < 0 || !Array.isArray(op[2])) {
|
|
1529
|
+
throw new TypeError("# shape");
|
|
1530
|
+
}
|
|
1531
|
+
andorraAssertSafePath(op[2]);
|
|
1532
|
+
return;
|
|
1533
|
+
}
|
|
1534
|
+
// Silently skipping an unknown verb is how a newer producer's op vanishes.
|
|
1535
|
+
default:
|
|
1536
|
+
throw new TypeError(`unknown op verb: ${String(verb)}`);
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
export function andorraAssertSafePath(path) {
|
|
1540
|
+
for (const seg of path) {
|
|
1541
|
+
if (typeof seg === "string") {
|
|
1542
|
+
if (RESERVED_SEGMENTS.has(seg))
|
|
1543
|
+
throw new AndorraUnsafePathError(seg);
|
|
1544
|
+
}
|
|
1545
|
+
else if (!Number.isInteger(seg) || seg < 0) {
|
|
1546
|
+
throw new AndorraUnsafePathError(seg);
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* An index may address an existing element or append exactly one past the end.
|
|
1552
|
+
*
|
|
1553
|
+
* This is not an arbitrary cap — it is what keeps the value a `JsonValue`. A
|
|
1554
|
+
* sparse array does not survive a JSON round trip: holes serialise to `null` and
|
|
1555
|
+
* return as real properties, so `arr[7] = x` on a length-3 array already produces
|
|
1556
|
+
* state a replica cannot match. Rejecting the write is more honest than silently
|
|
1557
|
+
* diverging.
|
|
1558
|
+
*
|
|
1559
|
+
* It also removes the denial of service it would otherwise permit:
|
|
1560
|
+
* `["s", ["xs", 4294967290], 1]` allocates a 4.29-billion-entry array from one op.
|
|
1561
|
+
* Growth stays possible and stays proportional — the tracker already emits
|
|
1562
|
+
* `arr.length = n` as a splice of explicit nulls, whose op size grows with the
|
|
1563
|
+
* gap, so a large growth costs a large op rather than a small one.
|
|
1564
|
+
*/
|
|
1565
|
+
function andorraAssertIndexInRange(parent, index) {
|
|
1566
|
+
if (index > parent.length)
|
|
1567
|
+
throw new AndorraUnsafePathError(index);
|
|
1568
|
+
}
|
|
1569
|
+
// ─── Applier ─────────────────────────────────────────────────────────────────
|
|
1570
|
+
export class AndorraPathError extends Error {
|
|
1571
|
+
path;
|
|
1572
|
+
constructor(path) {
|
|
1573
|
+
super(`unresolvable path: ${JSON.stringify(path)}`);
|
|
1574
|
+
this.path = path;
|
|
1575
|
+
this.name = "PathError";
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
/**
|
|
1579
|
+
* Apply ops to a plain mutable value. Returns the value, because `r` replaces it
|
|
1580
|
+
* outright and cannot be done in place.
|
|
1581
|
+
*
|
|
1582
|
+
* Takes decoded ops. Path ids and omitted paths are a wire concern — run
|
|
1583
|
+
* `decode` first if the ops came from a boundary.
|
|
1584
|
+
*/
|
|
1585
|
+
export function andorraApply(target, ops) {
|
|
1586
|
+
return andorraApplyOps(target, ops);
|
|
1587
|
+
}
|
|
1588
|
+
function andorraApplyOps(target, ops) {
|
|
1589
|
+
let root = target;
|
|
1590
|
+
for (const op of ops) {
|
|
1591
|
+
andorraAssertValidOp(op);
|
|
1592
|
+
if (op[0] === "r") {
|
|
1593
|
+
// Adopted, not copied. The consumer owns the batch it was handed.
|
|
1594
|
+
//
|
|
1595
|
+
// Fanning one batch out to several consumers in-process therefore makes
|
|
1596
|
+
// their replicas alias each other. That is an ownership rule, not a
|
|
1597
|
+
// defect: copy the batch at the fan-out point, or let each consumer
|
|
1598
|
+
// decode its own. A batch that crosses a real boundary is already
|
|
1599
|
+
// distinct, because serialisation produces fresh objects.
|
|
1600
|
+
root = op[1];
|
|
1601
|
+
continue;
|
|
1602
|
+
}
|
|
1603
|
+
const path = op[1];
|
|
1604
|
+
andorraAssertSafePath(path);
|
|
1605
|
+
if (op[0] === "p") {
|
|
1606
|
+
const target_ = path.length === 0 ? root : andorraResolve(root, path);
|
|
1607
|
+
if (!Array.isArray(target_))
|
|
1608
|
+
throw new AndorraPathError(path);
|
|
1609
|
+
target_.splice(op[2], op[3]);
|
|
1610
|
+
const chunkSize = 10_000;
|
|
1611
|
+
for (let offset = 0; offset < op[4].length; offset += chunkSize) {
|
|
1612
|
+
target_.splice(op[2] + offset, 0, ...op[4].slice(offset, offset + chunkSize));
|
|
1613
|
+
}
|
|
1614
|
+
continue;
|
|
1615
|
+
}
|
|
1616
|
+
// s/d/a/t can never target the root — the type forbids it.
|
|
1617
|
+
const parent = andorraResolve(root, path.slice(0, -1));
|
|
1618
|
+
const key = path[path.length - 1];
|
|
1619
|
+
if (Array.isArray(parent)) {
|
|
1620
|
+
if (typeof key !== "number")
|
|
1621
|
+
throw new AndorraUnsafePathError(key);
|
|
1622
|
+
andorraAssertIndexInRange(parent, key);
|
|
1623
|
+
}
|
|
1624
|
+
// defineProperty rather than assignment: a setter inherited from the prototype
|
|
1625
|
+
// chain would otherwise run on write.
|
|
1626
|
+
const andorraWrite = (value) => {
|
|
1627
|
+
Object.defineProperty(parent, key, { value, writable: true, enumerable: true, configurable: true });
|
|
1628
|
+
};
|
|
1629
|
+
const andorraRead = () => (Object.hasOwn(parent, key) ? parent[key] : undefined);
|
|
1630
|
+
switch (op[0]) {
|
|
1631
|
+
case "s":
|
|
1632
|
+
andorraWrite(op[2]);
|
|
1633
|
+
break;
|
|
1634
|
+
case "d":
|
|
1635
|
+
if (Array.isArray(parent)) {
|
|
1636
|
+
if (typeof key !== "number" || key >= parent.length)
|
|
1637
|
+
throw new AndorraPathError(path);
|
|
1638
|
+
parent.splice(key, 1);
|
|
1639
|
+
}
|
|
1640
|
+
else
|
|
1641
|
+
delete parent[key];
|
|
1642
|
+
break;
|
|
1643
|
+
case "a": {
|
|
1644
|
+
const current = andorraRead();
|
|
1645
|
+
if (typeof current !== "string")
|
|
1646
|
+
throw new AndorraPathError(path);
|
|
1647
|
+
andorraWrite(`${current}${op[2]}`);
|
|
1648
|
+
break;
|
|
1649
|
+
}
|
|
1650
|
+
case "t": {
|
|
1651
|
+
const current = andorraRead();
|
|
1652
|
+
if (typeof current !== "string")
|
|
1653
|
+
throw new AndorraPathError(path);
|
|
1654
|
+
andorraWrite(current.slice(op[2]));
|
|
1655
|
+
break;
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
return root;
|
|
1660
|
+
}
|
|
1661
|
+
/** Apply decoded operations without mutating the previous immutable value. */
|
|
1662
|
+
export function andorraApplyImmutable(target, ops) {
|
|
1663
|
+
let root = target;
|
|
1664
|
+
for (const op of ops) {
|
|
1665
|
+
if (op[0] === "r") {
|
|
1666
|
+
andorraAssertValidOp(op);
|
|
1667
|
+
root = op[1];
|
|
1668
|
+
continue;
|
|
1669
|
+
}
|
|
1670
|
+
root = andorraCopyContainers(root, op[0] === "p" ? op[1] : op[1].slice(0, -1));
|
|
1671
|
+
root = andorraApplyOps(root, [op]);
|
|
1672
|
+
}
|
|
1673
|
+
return root;
|
|
1674
|
+
}
|
|
1675
|
+
function andorraCopyContainers(root, path) {
|
|
1676
|
+
const andorraCopy = (value) => {
|
|
1677
|
+
if (Array.isArray(value))
|
|
1678
|
+
return value.slice();
|
|
1679
|
+
if (!andorraIsObj(value))
|
|
1680
|
+
throw new AndorraPathError(path);
|
|
1681
|
+
const result = Object.create(Object.getPrototypeOf(value) === null ? null : Object.prototype);
|
|
1682
|
+
for (const key of Object.keys(value)) {
|
|
1683
|
+
Object.defineProperty(result, key, {
|
|
1684
|
+
value: value[key],
|
|
1685
|
+
writable: true,
|
|
1686
|
+
enumerable: true,
|
|
1687
|
+
configurable: true,
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
return result;
|
|
1691
|
+
};
|
|
1692
|
+
const copiedRoot = andorraCopy(root);
|
|
1693
|
+
let source = root;
|
|
1694
|
+
let destination = copiedRoot;
|
|
1695
|
+
for (const segment of path) {
|
|
1696
|
+
if (!andorraIsObj(source) || !Object.hasOwn(source, segment))
|
|
1697
|
+
throw new AndorraPathError(path);
|
|
1698
|
+
if (Array.isArray(source) && typeof segment !== "number")
|
|
1699
|
+
throw new AndorraUnsafePathError(segment);
|
|
1700
|
+
const child = source[segment];
|
|
1701
|
+
const copiedChild = andorraCopy(child);
|
|
1702
|
+
Object.defineProperty(destination, segment, {
|
|
1703
|
+
value: copiedChild,
|
|
1704
|
+
writable: true,
|
|
1705
|
+
enumerable: true,
|
|
1706
|
+
configurable: true,
|
|
1707
|
+
});
|
|
1708
|
+
source = child;
|
|
1709
|
+
destination = copiedChild;
|
|
1710
|
+
}
|
|
1711
|
+
return copiedRoot;
|
|
1712
|
+
}
|
|
1713
|
+
function andorraResolveValue(root, path) {
|
|
1714
|
+
let node = root;
|
|
1715
|
+
for (const seg of path) {
|
|
1716
|
+
if (!andorraIsObj(node))
|
|
1717
|
+
throw new AndorraPathError(path);
|
|
1718
|
+
if (Array.isArray(node) && typeof seg !== "number")
|
|
1719
|
+
throw new AndorraUnsafePathError(seg);
|
|
1720
|
+
// Own properties only: an inherited getter must not run, and a walk must not
|
|
1721
|
+
// escape the value into the prototype chain.
|
|
1722
|
+
if (!Object.hasOwn(node, seg))
|
|
1723
|
+
throw new AndorraPathError(path);
|
|
1724
|
+
node = node[seg];
|
|
1725
|
+
}
|
|
1726
|
+
return node;
|
|
1727
|
+
}
|
|
1728
|
+
function andorraResolve(root, path) {
|
|
1729
|
+
const node = andorraResolveValue(root, path);
|
|
1730
|
+
if (!andorraIsObj(node))
|
|
1731
|
+
throw new AndorraPathError(path);
|
|
1732
|
+
return node;
|
|
1733
|
+
}
|
|
1734
|
+
// ─── Codec ───────────────────────────────────────────────────────────────────
|
|
1735
|
+
//
|
|
1736
|
+
// Path interning and arity omission live between the tracker and a boundary;
|
|
1737
|
+
// `Op` and `apply` know nothing about them.
|
|
1738
|
+
//
|
|
1739
|
+
// ONE PAIR PER INDEPENDENT STATE STREAM. Every decoder must observe exactly the
|
|
1740
|
+
// batches encoded by its matching encoder, beginning with that state's base.
|
|
1741
|
+
// Sharing a transport connection does not make separately hydrated states one
|
|
1742
|
+
// stream.
|
|
1743
|
+
const andorraPathKey = (path) => JSON.stringify(path);
|
|
1744
|
+
/**
|
|
1745
|
+
* Intern on SECOND use. A definition costs more than the path it replaces, so
|
|
1746
|
+
* interning on first use loses on the many paths written exactly once.
|
|
1747
|
+
*/
|
|
1748
|
+
export function andorraEncoder() {
|
|
1749
|
+
const seen = new Set();
|
|
1750
|
+
const ids = new Map();
|
|
1751
|
+
let nextId = 0;
|
|
1752
|
+
let previous; // last path in THIS batch
|
|
1753
|
+
return {
|
|
1754
|
+
encode(ops) {
|
|
1755
|
+
// Arity omission is scoped to a batch. Letting it span batches would make
|
|
1756
|
+
// a batch's first op depend on the previous batch's last one, so a reader
|
|
1757
|
+
// that skips or reorders a batch decodes into the wrong path. Ids are the
|
|
1758
|
+
// only cross-batch state, and the dictionary makes those explicit.
|
|
1759
|
+
previous = undefined;
|
|
1760
|
+
const out = [];
|
|
1761
|
+
for (const op of ops) {
|
|
1762
|
+
if (op[0] === "r") {
|
|
1763
|
+
out.push(op);
|
|
1764
|
+
// A base batch is a RECOVERY POINT: a reader replays from the last one
|
|
1765
|
+
// with a fresh decoder. So everything after it must be self-contained.
|
|
1766
|
+
// Keeping ids across a replacement emits references to definitions the
|
|
1767
|
+
// reader never saw — recovery fails with an unresolvable path id.
|
|
1768
|
+
seen.clear();
|
|
1769
|
+
ids.clear();
|
|
1770
|
+
nextId = 0;
|
|
1771
|
+
previous = undefined;
|
|
1772
|
+
continue;
|
|
1773
|
+
}
|
|
1774
|
+
const path = op[1];
|
|
1775
|
+
const key = andorraPathKey(path);
|
|
1776
|
+
// Same path as the previous op: drop the ref entirely.
|
|
1777
|
+
if (key === previous) {
|
|
1778
|
+
switch (op[0]) {
|
|
1779
|
+
case "s":
|
|
1780
|
+
out.push(["s", op[2]]);
|
|
1781
|
+
break;
|
|
1782
|
+
case "d":
|
|
1783
|
+
out.push(["d"]);
|
|
1784
|
+
break;
|
|
1785
|
+
case "a":
|
|
1786
|
+
out.push(["a", op[2]]);
|
|
1787
|
+
break;
|
|
1788
|
+
case "t":
|
|
1789
|
+
out.push(["t", op[2]]);
|
|
1790
|
+
break;
|
|
1791
|
+
case "p":
|
|
1792
|
+
out.push(["p", op[2], op[3], op[4]]);
|
|
1793
|
+
break;
|
|
1794
|
+
}
|
|
1795
|
+
continue;
|
|
1796
|
+
}
|
|
1797
|
+
let ref = path;
|
|
1798
|
+
const existing = ids.get(key);
|
|
1799
|
+
if (existing !== undefined) {
|
|
1800
|
+
ref = existing;
|
|
1801
|
+
}
|
|
1802
|
+
else if (seen.has(key)) {
|
|
1803
|
+
const id = nextId++;
|
|
1804
|
+
ids.set(key, id);
|
|
1805
|
+
out.push(["#", id, path]); // second use: define, then reference
|
|
1806
|
+
ref = id;
|
|
1807
|
+
}
|
|
1808
|
+
else {
|
|
1809
|
+
seen.add(key); // first use: inline
|
|
1810
|
+
}
|
|
1811
|
+
switch (op[0]) {
|
|
1812
|
+
case "s":
|
|
1813
|
+
out.push(["s", ref, op[2]]);
|
|
1814
|
+
break;
|
|
1815
|
+
case "d":
|
|
1816
|
+
out.push(["d", ref]);
|
|
1817
|
+
break;
|
|
1818
|
+
case "a":
|
|
1819
|
+
out.push(["a", ref, op[2]]);
|
|
1820
|
+
break;
|
|
1821
|
+
case "t":
|
|
1822
|
+
out.push(["t", ref, op[2]]);
|
|
1823
|
+
break;
|
|
1824
|
+
case "p":
|
|
1825
|
+
out.push(["p", ref, op[2], op[3], op[4]]);
|
|
1826
|
+
break;
|
|
1827
|
+
}
|
|
1828
|
+
previous = key;
|
|
1829
|
+
}
|
|
1830
|
+
return out;
|
|
1831
|
+
},
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
export function andorraDecoder() {
|
|
1835
|
+
const paths = new Map();
|
|
1836
|
+
return {
|
|
1837
|
+
decode(wire) {
|
|
1838
|
+
let previous; // scoped to the batch, as in encode
|
|
1839
|
+
const out = [];
|
|
1840
|
+
for (const op of wire) {
|
|
1841
|
+
andorraAssertValidWireOp(op);
|
|
1842
|
+
if (op[0] === "#") {
|
|
1843
|
+
andorraAssertSafePath(op[2]);
|
|
1844
|
+
paths.set(op[1], op[2]);
|
|
1845
|
+
continue;
|
|
1846
|
+
}
|
|
1847
|
+
if (op[0] === "r") {
|
|
1848
|
+
out.push(op);
|
|
1849
|
+
paths.clear();
|
|
1850
|
+
previous = undefined;
|
|
1851
|
+
continue;
|
|
1852
|
+
}
|
|
1853
|
+
// Arity tells us whether a ref is present: the short forms omit it.
|
|
1854
|
+
const short = (op[0] === "d" && op.length === 1) ||
|
|
1855
|
+
(op[0] !== "d" && op[0] !== "p" && op.length === 2) ||
|
|
1856
|
+
(op[0] === "p" && op.length === 4);
|
|
1857
|
+
let path;
|
|
1858
|
+
if (short) {
|
|
1859
|
+
if (previous === undefined)
|
|
1860
|
+
throw new AndorraPathError([]);
|
|
1861
|
+
path = previous;
|
|
1862
|
+
}
|
|
1863
|
+
else {
|
|
1864
|
+
const ref = op[1];
|
|
1865
|
+
if (typeof ref === "number") {
|
|
1866
|
+
const resolved = paths.get(ref);
|
|
1867
|
+
if (resolved === undefined)
|
|
1868
|
+
throw new AndorraPathError(ref);
|
|
1869
|
+
path = resolved;
|
|
1870
|
+
}
|
|
1871
|
+
else {
|
|
1872
|
+
path = ref;
|
|
1873
|
+
}
|
|
1874
|
+
previous = path;
|
|
1875
|
+
}
|
|
1876
|
+
if (op[0] !== "p" && path.length === 0)
|
|
1877
|
+
throw new AndorraPathError(path);
|
|
1878
|
+
switch (op[0]) {
|
|
1879
|
+
case "s":
|
|
1880
|
+
out.push(["s", path, (short ? op[1] : op[2])]);
|
|
1881
|
+
break;
|
|
1882
|
+
case "d":
|
|
1883
|
+
out.push(["d", path]);
|
|
1884
|
+
break;
|
|
1885
|
+
case "a":
|
|
1886
|
+
out.push(["a", path, (short ? op[1] : op[2])]);
|
|
1887
|
+
break;
|
|
1888
|
+
case "t":
|
|
1889
|
+
out.push(["t", path, (short ? op[1] : op[2])]);
|
|
1890
|
+
break;
|
|
1891
|
+
case "p": {
|
|
1892
|
+
const [i, r, items] = short
|
|
1893
|
+
? [op[1], op[2], op[3]]
|
|
1894
|
+
: [op[2], op[3], op[4]];
|
|
1895
|
+
out.push(["p", path, i, r, items]);
|
|
1896
|
+
break;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
return out;
|
|
1901
|
+
},
|
|
1902
|
+
};
|
|
1903
|
+
}
|