@akon-labs/nexus-cli 0.1.0
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/CHANGELOG.md +5342 -0
- package/LICENSE +22 -0
- package/README.md +677 -0
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +11 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -0
- package/dist/bun/register-bedrock.js +4 -0
- package/dist/bun/register-bedrock.js.map +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +17 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +36 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/cli/args.d.ts +59 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +408 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config-selector.d.ts +16 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/credential-print.d.ts +23 -0
- package/dist/cli/credential-print.d.ts.map +1 -0
- package/dist/cli/credential-print.js +118 -0
- package/dist/cli/credential-print.js.map +1 -0
- package/dist/cli/experimental/auth.d.ts +16 -0
- package/dist/cli/experimental/auth.d.ts.map +1 -0
- package/dist/cli/experimental/auth.js +13 -0
- package/dist/cli/experimental/auth.js.map +1 -0
- package/dist/cli/experimental/cli.d.ts +6 -0
- package/dist/cli/experimental/cli.d.ts.map +1 -0
- package/dist/cli/experimental/cli.js +5 -0
- package/dist/cli/experimental/cli.js.map +1 -0
- package/dist/cli/experimental/command-options.d.ts +17 -0
- package/dist/cli/experimental/command-options.d.ts.map +1 -0
- package/dist/cli/experimental/command-options.js +35 -0
- package/dist/cli/experimental/command-options.js.map +1 -0
- package/dist/cli/experimental/command.d.ts +63 -0
- package/dist/cli/experimental/command.d.ts.map +1 -0
- package/dist/cli/experimental/command.js +130 -0
- package/dist/cli/experimental/command.js.map +1 -0
- package/dist/cli/experimental/commands/client.d.ts +13 -0
- package/dist/cli/experimental/commands/client.d.ts.map +1 -0
- package/dist/cli/experimental/commands/client.js +25 -0
- package/dist/cli/experimental/commands/client.js.map +1 -0
- package/dist/cli/experimental/commands/pi.d.ts +15 -0
- package/dist/cli/experimental/commands/pi.d.ts.map +1 -0
- package/dist/cli/experimental/commands/pi.js +28 -0
- package/dist/cli/experimental/commands/pi.js.map +1 -0
- package/dist/cli/experimental/commands/server.d.ts +13 -0
- package/dist/cli/experimental/commands/server.d.ts.map +1 -0
- package/dist/cli/experimental/commands/server.js +25 -0
- package/dist/cli/experimental/commands/server.js.map +1 -0
- package/dist/cli/experimental/transport-address.d.ts +10 -0
- package/dist/cli/experimental/transport-address.d.ts.map +1 -0
- package/dist/cli/experimental/transport-address.js +38 -0
- package/dist/cli/experimental/transport-address.js.map +1 -0
- package/dist/cli/file-processor.d.ts +15 -0
- package/dist/cli/file-processor.d.ts.map +1 -0
- package/dist/cli/file-processor.js +70 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/initial-message.d.ts +18 -0
- package/dist/cli/initial-message.d.ts.map +1 -0
- package/dist/cli/initial-message.js +22 -0
- package/dist/cli/initial-message.js.map +1 -0
- package/dist/cli/list-models.d.ts +9 -0
- package/dist/cli/list-models.d.ts.map +1 -0
- package/dist/cli/list-models.js +98 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/project-trust.d.ts +10 -0
- package/dist/cli/project-trust.d.ts.map +1 -0
- package/dist/cli/project-trust.js +48 -0
- package/dist/cli/project-trust.js.map +1 -0
- package/dist/cli/require-login.d.ts +30 -0
- package/dist/cli/require-login.d.ts.map +1 -0
- package/dist/cli/require-login.js +96 -0
- package/dist/cli/require-login.js.map +1 -0
- package/dist/cli/session-picker.d.ts +10 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +36 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +20 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +185 -0
- package/dist/cli/startup-ui.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +69740 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +425 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/remote-session.d.ts +53 -0
- package/dist/client/remote-session.d.ts.map +1 -0
- package/dist/client/remote-session.js +340 -0
- package/dist/client/remote-session.js.map +1 -0
- package/dist/client/transcript.d.ts +12 -0
- package/dist/client/transcript.d.ts.map +1 -0
- package/dist/client/transcript.js +98 -0
- package/dist/client/transcript.js.map +1 -0
- package/dist/config.d.ts +99 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +482 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +119 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +309 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +86 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +134 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session.d.ts +644 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +2687 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-guidance.d.ts +5 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +39 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +62 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +350 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +32 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +111 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/cache-stats.d.ts +49 -0
- package/dist/core/cache-stats.d.ts.map +1 -0
- package/dist/core/cache-stats.js +101 -0
- package/dist/core/cache-stats.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +98 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +246 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +137 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +645 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.d.ts.map +1 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/index.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +38 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +142 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/defaults.d.ts +3 -0
- package/dist/core/defaults.d.ts.map +1 -0
- package/dist/core/defaults.js +2 -0
- package/dist/core/defaults.js.map +1 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +29 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +75 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/experimental.d.ts +2 -0
- package/dist/core/experimental.d.ts.map +1 -0
- package/dist/core/experimental.js +5 -0
- package/dist/core/experimental.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +37 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +226 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1864 -0
- package/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +108 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +78 -0
- package/dist/core/extensions/index.d.ts +12 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/index.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +23 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +581 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +173 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +967 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1288 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +45 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +41 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +64 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +338 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/graph-rail-store.d.ts +94 -0
- package/dist/core/graph-rail-store.d.ts.map +1 -0
- package/dist/core/graph-rail-store.js +86 -0
- package/dist/core/graph-rail-store.js.map +1 -0
- package/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -0
- package/dist/core/http-dispatcher.js +96 -0
- package/dist/core/http-dispatcher.js.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/keybindings.d.ts +395 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +297 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/messages.d.ts +77 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +123 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-config.d.ts +566 -0
- package/dist/core/model-config.d.ts.map +1 -0
- package/dist/core/model-config.js +253 -0
- package/dist/core/model-config.js.map +1 -0
- package/dist/core/model-registry.d.ts +45 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +107 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +127 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +541 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/model-runtime.d.ts +97 -0
- package/dist/core/model-runtime.d.ts.map +1 -0
- package/dist/core/model-runtime.js +594 -0
- package/dist/core/model-runtime.js.map +1 -0
- package/dist/core/models-dev-catalog.d.ts +63 -0
- package/dist/core/models-dev-catalog.d.ts.map +1 -0
- package/dist/core/models-dev-catalog.js +105 -0
- package/dist/core/models-dev-catalog.js.map +1 -0
- package/dist/core/models-store.d.ts +22 -0
- package/dist/core/models-store.d.ts.map +1 -0
- package/dist/core/models-store.js +114 -0
- package/dist/core/models-store.js.map +1 -0
- package/dist/core/observatory-cache.d.ts +16 -0
- package/dist/core/observatory-cache.d.ts.map +1 -0
- package/dist/core/observatory-cache.js +55 -0
- package/dist/core/observatory-cache.js.map +1 -0
- package/dist/core/output-guard.d.ts +7 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +89 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-manager.d.ts +213 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +2169 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/pi-manifest.d.ts +8 -0
- package/dist/core/pi-manifest.d.ts.map +1 -0
- package/dist/core/pi-manifest.js +25 -0
- package/dist/core/pi-manifest.js.map +1 -0
- package/dist/core/project-trust.d.ts +15 -0
- package/dist/core/project-trust.d.ts.map +1 -0
- package/dist/core/project-trust.js +59 -0
- package/dist/core/project-trust.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +54 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +236 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/provider-attribution.d.ts +4 -0
- package/dist/core/provider-attribution.d.ts.map +1 -0
- package/dist/core/provider-attribution.js +73 -0
- package/dist/core/provider-attribution.js.map +1 -0
- package/dist/core/provider-composer.d.ts +56 -0
- package/dist/core/provider-composer.d.ts.map +1 -0
- package/dist/core/provider-composer.js +395 -0
- package/dist/core/provider-composer.js.map +1 -0
- package/dist/core/radius.d.ts +2 -0
- package/dist/core/radius.d.ts.map +1 -0
- package/dist/core/radius.js +2 -0
- package/dist/core/radius.js.map +1 -0
- package/dist/core/remote-catalog-provider.d.ts +5 -0
- package/dist/core/remote-catalog-provider.d.ts.map +1 -0
- package/dist/core/remote-catalog-provider.js +106 -0
- package/dist/core/remote-catalog-provider.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +247 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +221 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +874 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/runtime-credentials.d.ts +15 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -0
- package/dist/core/runtime-credentials.js +39 -0
- package/dist/core/runtime-credentials.js.map +1 -0
- package/dist/core/sdk.d.ts +106 -0
- package/dist/core/sdk.d.ts.map +1 -0
- package/dist/core/sdk.js +267 -0
- package/dist/core/sdk.js.map +1 -0
- package/dist/core/session-cwd.d.ts +19 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +38 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/session-manager.d.ts +356 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1340 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/settings-manager.d.ts +304 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +912 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +60 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +387 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +21 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +39 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/source-info.d.ts +18 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +19 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/system-prompt.d.ts +28 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +130 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/telemetry.d.ts +3 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/core/telemetry.js +10 -0
- package/dist/core/telemetry.js.map +1 -0
- package/dist/core/timings.d.ts +6 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +42 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +70 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +389 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +106 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +424 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +51 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +284 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +52 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +38 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +298 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +37 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +304 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +43 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +129 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +37 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +167 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +52 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +185 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +10 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +99 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +35 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +284 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +24 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +65 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.js +36 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
- package/dist/core/tools/truncate.d.ts +70 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +215 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/websearch.d.ts +29 -0
- package/dist/core/tools/websearch.d.ts.map +1 -0
- package/dist/core/tools/websearch.js +145 -0
- package/dist/core/tools/websearch.js.map +1 -0
- package/dist/core/tools/write.d.ts +26 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +197 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/core/trust-manager.d.ts +36 -0
- package/dist/core/trust-manager.d.ts.map +1 -0
- package/dist/core/trust-manager.js +202 -0
- package/dist/core/trust-manager.js.map +1 -0
- package/dist/core/usage-totals.d.ts +19 -0
- package/dist/core/usage-totals.d.ts.map +1 -0
- package/dist/core/usage-totals.js +52 -0
- package/dist/core/usage-totals.js.map +1 -0
- package/dist/extensions/gitnexus/augment.d.ts +4 -0
- package/dist/extensions/gitnexus/augment.d.ts.map +1 -0
- package/dist/extensions/gitnexus/augment.js +60 -0
- package/dist/extensions/gitnexus/augment.js.map +1 -0
- package/dist/extensions/gitnexus/changes.d.ts +3 -0
- package/dist/extensions/gitnexus/changes.d.ts.map +1 -0
- package/dist/extensions/gitnexus/changes.js +58 -0
- package/dist/extensions/gitnexus/changes.js.map +1 -0
- package/dist/extensions/gitnexus/client.d.ts +39 -0
- package/dist/extensions/gitnexus/client.d.ts.map +1 -0
- package/dist/extensions/gitnexus/client.js +173 -0
- package/dist/extensions/gitnexus/client.js.map +1 -0
- package/dist/extensions/gitnexus/config.d.ts +25 -0
- package/dist/extensions/gitnexus/config.d.ts.map +1 -0
- package/dist/extensions/gitnexus/config.js +42 -0
- package/dist/extensions/gitnexus/config.js.map +1 -0
- package/dist/extensions/gitnexus/device-auth.d.ts +60 -0
- package/dist/extensions/gitnexus/device-auth.d.ts.map +1 -0
- package/dist/extensions/gitnexus/device-auth.js +130 -0
- package/dist/extensions/gitnexus/device-auth.js.map +1 -0
- package/dist/extensions/gitnexus/gateway.d.ts +57 -0
- package/dist/extensions/gitnexus/gateway.d.ts.map +1 -0
- package/dist/extensions/gitnexus/gateway.js +139 -0
- package/dist/extensions/gitnexus/gateway.js.map +1 -0
- package/dist/extensions/gitnexus/index.d.ts +14 -0
- package/dist/extensions/gitnexus/index.d.ts.map +1 -0
- package/dist/extensions/gitnexus/index.js +189 -0
- package/dist/extensions/gitnexus/index.js.map +1 -0
- package/dist/extensions/gitnexus/observatory.d.ts +13 -0
- package/dist/extensions/gitnexus/observatory.d.ts.map +1 -0
- package/dist/extensions/gitnexus/observatory.js +189 -0
- package/dist/extensions/gitnexus/observatory.js.map +1 -0
- package/dist/extensions/gitnexus/prompt.d.ts +11 -0
- package/dist/extensions/gitnexus/prompt.d.ts.map +1 -0
- package/dist/extensions/gitnexus/prompt.js +50 -0
- package/dist/extensions/gitnexus/prompt.js.map +1 -0
- package/dist/extensions/gitnexus/render.d.ts +61 -0
- package/dist/extensions/gitnexus/render.d.ts.map +1 -0
- package/dist/extensions/gitnexus/render.js +391 -0
- package/dist/extensions/gitnexus/render.js.map +1 -0
- package/dist/extensions/gitnexus/resolve.d.ts +22 -0
- package/dist/extensions/gitnexus/resolve.d.ts.map +1 -0
- package/dist/extensions/gitnexus/resolve.js +54 -0
- package/dist/extensions/gitnexus/resolve.js.map +1 -0
- package/dist/extensions/gitnexus/skills/gitnexus-debugging/SKILL.md +89 -0
- package/dist/extensions/gitnexus/skills/gitnexus-debugging/mcp.json +8 -0
- package/dist/extensions/gitnexus/skills/gitnexus-exploring/SKILL.md +78 -0
- package/dist/extensions/gitnexus/skills/gitnexus-exploring/mcp.json +8 -0
- package/dist/extensions/gitnexus/skills/gitnexus-guide/SKILL.md +64 -0
- package/dist/extensions/gitnexus/skills/gitnexus-guide/mcp.json +8 -0
- package/dist/extensions/gitnexus/skills/gitnexus-impact-analysis/SKILL.md +97 -0
- package/dist/extensions/gitnexus/skills/gitnexus-impact-analysis/mcp.json +8 -0
- package/dist/extensions/gitnexus/skills/gitnexus-pr-review/SKILL.md +163 -0
- package/dist/extensions/gitnexus/skills/gitnexus-refactoring/SKILL.md +121 -0
- package/dist/extensions/gitnexus/skills/gitnexus-refactoring/mcp.json +8 -0
- package/dist/extensions/gitnexus/tools.d.ts +15 -0
- package/dist/extensions/gitnexus/tools.d.ts.map +1 -0
- package/dist/extensions/gitnexus/tools.js +187 -0
- package/dist/extensions/gitnexus/tools.js.map +1 -0
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +10 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/llama/client.d.ts +61 -0
- package/dist/extensions/llama/client.d.ts.map +1 -0
- package/dist/extensions/llama/client.js +302 -0
- package/dist/extensions/llama/client.js.map +1 -0
- package/dist/extensions/llama/huggingface.d.ts +23 -0
- package/dist/extensions/llama/huggingface.d.ts.map +1 -0
- package/dist/extensions/llama/huggingface.js +141 -0
- package/dist/extensions/llama/huggingface.js.map +1 -0
- package/dist/extensions/llama/index.d.ts +3 -0
- package/dist/extensions/llama/index.d.ts.map +1 -0
- package/dist/extensions/llama/index.js +217 -0
- package/dist/extensions/llama/index.js.map +1 -0
- package/dist/extensions/llama/provider.d.ts +10 -0
- package/dist/extensions/llama/provider.d.ts.map +1 -0
- package/dist/extensions/llama/provider.js +121 -0
- package/dist/extensions/llama/provider.js.map +1 -0
- package/dist/extensions/llama/ui.d.ts +42 -0
- package/dist/extensions/llama/ui.d.ts.map +1 -0
- package/dist/extensions/llama/ui.js +416 -0
- package/dist/extensions/llama/ui.js.map +1 -0
- package/dist/extensions/mcp/client.d.ts +86 -0
- package/dist/extensions/mcp/client.d.ts.map +1 -0
- package/dist/extensions/mcp/client.js +275 -0
- package/dist/extensions/mcp/client.js.map +1 -0
- package/dist/extensions/mcp/config.d.ts +41 -0
- package/dist/extensions/mcp/config.d.ts.map +1 -0
- package/dist/extensions/mcp/config.js +85 -0
- package/dist/extensions/mcp/config.js.map +1 -0
- package/dist/extensions/mcp/index.d.ts +18 -0
- package/dist/extensions/mcp/index.d.ts.map +1 -0
- package/dist/extensions/mcp/index.js +95 -0
- package/dist/extensions/mcp/index.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69874 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +12 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +792 -0
- package/dist/main.js.map +1 -0
- package/dist/migrations.d.ts +33 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +281 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/index.d.ts +10 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +8 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +32 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +177 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +34 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +175 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +54 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +44 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/command-palette.d.ts +12 -0
- package/dist/modes/interactive/components/command-palette.d.ts.map +1 -0
- package/dist/modes/interactive/components/command-palette.js +67 -0
- package/dist/modes/interactive/components/command-palette.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +45 -0
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +102 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +761 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +23 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +85 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-entry.d.ts +19 -0
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-entry.js +52 -0
- package/dist/modes/interactive/components/custom-entry.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +22 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +87 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/dialog-frame.d.ts +37 -0
- package/dist/modes/interactive/components/dialog-frame.d.ts.map +1 -0
- package/dist/modes/interactive/components/dialog-frame.js +53 -0
- package/dist/modes/interactive/components/dialog-frame.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +133 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +19 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +36 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +21 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +98 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-input.js +61 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +26 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +83 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.js +103 -0
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +30 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +108 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/graph-rail.d.ts +44 -0
- package/dist/modes/interactive/components/graph-rail.d.ts.map +1 -0
- package/dist/modes/interactive/components/graph-rail.js +332 -0
- package/dist/modes/interactive/components/graph-rail.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +33 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/dist/modes/interactive/components/index.js +34 -0
- package/dist/modes/interactive/components/index.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +36 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/landing-panel.d.ts +14 -0
- package/dist/modes/interactive/components/landing-panel.d.ts.map +1 -0
- package/dist/modes/interactive/components/landing-panel.js +141 -0
- package/dist/modes/interactive/components/landing-panel.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +52 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +188 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.js +19 -0
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
- package/dist/modes/interactive/components/mermaid.d.ts +11 -0
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
- package/dist/modes/interactive/components/mermaid.js +80 -0
- package/dist/modes/interactive/components/mermaid.js.map +1 -0
- package/dist/modes/interactive/components/message-layout.d.ts +4 -0
- package/dist/modes/interactive/components/message-layout.d.ts.map +1 -0
- package/dist/modes/interactive/components/message-layout.js +4 -0
- package/dist/modes/interactive/components/message-layout.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +54 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +325 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/nexus-logo.d.ts +25 -0
- package/dist/modes/interactive/components/nexus-logo.d.ts.map +1 -0
- package/dist/modes/interactive/components/nexus-logo.js +115 -0
- package/dist/modes/interactive/components/nexus-logo.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +163 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/panel.d.ts +7 -0
- package/dist/modes/interactive/components/panel.d.ts.map +1 -0
- package/dist/modes/interactive/components/panel.js +18 -0
- package/dist/modes/interactive/components/panel.js.map +1 -0
- package/dist/modes/interactive/components/response-separator.d.ts +13 -0
- package/dist/modes/interactive/components/response-separator.d.ts.map +1 -0
- package/dist/modes/interactive/components/response-separator.js +23 -0
- package/dist/modes/interactive/components/response-separator.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +46 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +328 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +155 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +99 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +887 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +81 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +613 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +39 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +47 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/status-indicator.d.ts +37 -0
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
- package/dist/modes/interactive/components/status-indicator.js +116 -0
- package/dist/modes/interactive/components/status-indicator.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js +50 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.js +52 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +70 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +384 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +94 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1245 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/trust-selector.js +91 -0
- package/dist/modes/interactive/components/trust-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +114 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +17 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +51 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/dist/modes/interactive/external-editor.d.ts +12 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -0
- package/dist/modes/interactive/external-editor.js +37 -0
- package/dist/modes/interactive/external-editor.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +436 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +5462 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/model-search.d.ts +12 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -0
- package/dist/modes/interactive/model-search.js +15 -0
- package/dist/modes/interactive/model-search.js.map +1 -0
- package/dist/modes/interactive/theme/brand.d.ts +38 -0
- package/dist/modes/interactive/theme/brand.d.ts.map +1 -0
- package/dist/modes/interactive/theme/brand.js +108 -0
- package/dist/modes/interactive/theme/brand.js.map +1 -0
- package/dist/modes/interactive/theme/catppuccin-mocha.json +66 -0
- package/dist/modes/interactive/theme/dark.json +93 -0
- package/dist/modes/interactive/theme/dracula.json +66 -0
- package/dist/modes/interactive/theme/ember.json +85 -0
- package/dist/modes/interactive/theme/gruvbox.json +66 -0
- package/dist/modes/interactive/theme/light.json +91 -0
- package/dist/modes/interactive/theme/nord.json +66 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +32 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +111 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +344 -0
- package/dist/modes/interactive/theme/theme.d.ts +129 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +1101 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/interactive/theme/tokyonight.json +66 -0
- package/dist/modes/json-event.d.ts +28 -0
- package/dist/modes/json-event.d.ts.map +1 -0
- package/dist/modes/json-event.js +12 -0
- package/dist/modes/json-event.js.map +1 -0
- package/dist/modes/print-mode.d.ts +28 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +153 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +49 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +247 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +488 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +654 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +457 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/package-manager-cli.d.ts +8 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +777 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/rpc-entry.d.ts +3 -0
- package/dist/rpc-entry.d.ts.map +1 -0
- package/dist/rpc-entry.js +69740 -0
- package/dist/rpc-entry.js.map +1 -0
- package/dist/utils/abort.d.ts +5 -0
- package/dist/utils/abort.d.ts.map +1 -0
- package/dist/utils/abort.js +48 -0
- package/dist/utils/abort.js.map +1 -0
- package/dist/utils/ansi.d.ts +2 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +52 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/child-process.d.ts +18 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +106 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +245 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +20 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +4 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +161 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/deprecation.d.ts +4 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/deprecation.js +13 -0
- package/dist/utils/deprecation.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +158 -0
- package/dist/utils/exif-orientation.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/fs-watch.d.ts +5 -0
- package/dist/utils/fs-watch.d.ts.map +1 -0
- package/dist/utils/fs-watch.js +25 -0
- package/dist/utils/fs-watch.js.map +1 -0
- package/dist/utils/git.d.ts +26 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +195 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/image-convert.d.ts +10 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +45 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-process.d.ts +18 -0
- package/dist/utils/image-process.d.ts.map +1 -0
- package/dist/utils/image-process.js +83 -0
- package/dist/utils/image-process.js.map +1 -0
- package/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -0
- package/dist/utils/image-resize-core.js +124 -0
- package/dist/utils/image-resize-core.js.map +1 -0
- package/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/utils/image-resize-worker.d.ts.map +1 -0
- package/dist/utils/image-resize-worker.js +31 -0
- package/dist/utils/image-resize-worker.js.map +1 -0
- package/dist/utils/image-resize.d.ts +16 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +97 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +7 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/management-http.d.ts +23 -0
- package/dist/utils/management-http.d.ts.map +1 -0
- package/dist/utils/management-http.js +50 -0
- package/dist/utils/management-http.js.map +1 -0
- package/dist/utils/mime.d.ts +3 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +110 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +22 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/paths.d.ts +34 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +114 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/photon.d.ts +21 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +121 -0
- package/dist/utils/photon.js.map +1 -0
- package/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/utils/pi-user-agent.d.ts.map +1 -0
- package/dist/utils/pi-user-agent.js +5 -0
- package/dist/utils/pi-user-agent.js.map +1 -0
- package/dist/utils/shell.d.ts +31 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +202 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +118 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/tool-result-images.d.ts +19 -0
- package/dist/utils/tool-result-images.d.ts.map +1 -0
- package/dist/utils/tool-result-images.js +45 -0
- package/dist/utils/tool-result-images.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +3 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +326 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/dist/utils/version-check.d.ts +19 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +98 -0
- package/dist/utils/version-check.js.map +1 -0
- package/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/utils/windows-self-update.d.ts.map +1 -0
- package/dist/utils/windows-self-update.js +77 -0
- package/dist/utils/windows-self-update.js.map +1 -0
- package/docs/compaction.md +401 -0
- package/docs/containerization.md +111 -0
- package/docs/custom-provider.md +774 -0
- package/docs/development.md +71 -0
- package/docs/docs.json +156 -0
- package/docs/environment-variables.md +98 -0
- package/docs/extensions.md +2987 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +84 -0
- package/docs/json.md +91 -0
- package/docs/keybindings.md +226 -0
- package/docs/llama-cpp.md +99 -0
- package/docs/models.md +565 -0
- package/docs/packages.md +228 -0
- package/docs/prompt-templates.md +96 -0
- package/docs/providers.md +310 -0
- package/docs/quickstart.md +167 -0
- package/docs/rpc.md +1578 -0
- package/docs/sdk.md +1205 -0
- package/docs/security.md +59 -0
- package/docs/session-format.md +438 -0
- package/docs/sessions.md +145 -0
- package/docs/settings.md +322 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +231 -0
- package/docs/terminal-setup.md +142 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +299 -0
- package/docs/tmux.md +63 -0
- package/docs/tui.md +942 -0
- package/docs/usage.md +305 -0
- package/docs/windows.md +17 -0
- package/examples/README.md +25 -0
- package/examples/extensions/README.md +213 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +150 -0
- package/examples/extensions/built-in-tool-renderer.ts +249 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +117 -0
- package/examples/extensions/custom-footer.ts +64 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +611 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +15 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/entry-renderer.ts +41 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/gondolin/index.ts +531 -0
- package/examples/extensions/gondolin/package-lock.json +185 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/examples/extensions/handoff.ts +190 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform-streaming.ts +39 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/kimi-deferred-tools.ts +61 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +426 -0
- package/examples/extensions/modal-editor.ts +85 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +55 -0
- package/examples/extensions/overlay-qa-tests.ts +1450 -0
- package/examples/extensions/overlay-test.ts +153 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +66 -0
- package/examples/extensions/plan-mode/index.ts +390 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +436 -0
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +118 -0
- package/examples/extensions/question.ts +286 -0
- package/examples/extensions/questionnaire.ts +448 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/sandbox/index.ts +321 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +343 -0
- package/examples/extensions/space-invaders.ts +560 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +175 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +126 -0
- package/examples/extensions/subagent/index.ts +1015 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +199 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1008 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +297 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +146 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +195 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/rpc-extension-ui.ts +641 -0
- package/examples/sdk/01-minimal.ts +26 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +75 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +48 -0
- package/examples/sdk/06-extensions.ts +99 -0
- package/examples/sdk/07-context-files.ts +47 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +52 -0
- package/examples/sdk/12-full-control.ts +74 -0
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/README.md +140 -0
- package/npm-shrinkwrap.json +1817 -0
- package/package.json +145 -0
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;AACzB,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAChC,OAAO,CAAC,WAAW,GAAG,CAAC,GAAG,EAAE,CAAC,EAAC,CAAC,CAA+B,CAAC;AAE/D,4EAA4E;AAC5E,wFAAwF;AACxF,uBAAuB,EAAE,CAAC;AAE1B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * CLI entry point for the refactored coding agent.\n * Uses main.ts with AgentSession and new mode modules.\n *\n * Test with: npx tsx src/cli-new.ts [args...]\n */\nimport { APP_NAME, setAppEnv } from \"./config.ts\";\nimport { configureHttpDispatcher } from \"./core/http-dispatcher.ts\";\nimport { main } from \"./main.ts\";\n\nprocess.title = APP_NAME;\nsetAppEnv(\"CODING_AGENT\", \"true\");\nprocess.env.AI_AGENT = APP_NAME;\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\n// Configure undici's global dispatcher before provider SDKs issue requests.\n// Runtime settings are applied once SettingsManager has loaded global/project settings.\nconfigureHttpDispatcher();\n\nmain(process.argv.slice(2));\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { type CreateRemoteSessionOptions, RemoteSession, type RemoteSessionLifecycle, type RemoteSessionOperation, type RemoteSessionOptions, type RemoteSessionState, } from "./remote-session.ts";
|
|
2
|
+
export { applyTranscriptProgress, applyTranscriptSnapshot, createTranscriptState, selectTranscript, type TranscriptState, } from "./transcript.ts";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,0BAA0B,EAC/B,aAAa,EACb,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,eAAe,GACpB,MAAM,iBAAiB,CAAC","sourcesContent":["export {\n\ttype CreateRemoteSessionOptions,\n\tRemoteSession,\n\ttype RemoteSessionLifecycle,\n\ttype RemoteSessionOperation,\n\ttype RemoteSessionOptions,\n\ttype RemoteSessionState,\n} from \"./remote-session.ts\";\nexport {\n\tapplyTranscriptProgress,\n\tapplyTranscriptSnapshot,\n\tcreateTranscriptState,\n\tselectTranscript,\n\ttype TranscriptState,\n} from \"./transcript.ts\";\n"]}
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
// dist/client/transcript.js
|
|
2
|
+
function isJsonValue(value) {
|
|
3
|
+
if (value === null || typeof value === "boolean" || typeof value === "string")
|
|
4
|
+
return true;
|
|
5
|
+
if (typeof value === "number")
|
|
6
|
+
return Number.isFinite(value);
|
|
7
|
+
if (Array.isArray(value))
|
|
8
|
+
return value.every(isJsonValue);
|
|
9
|
+
if (typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype)
|
|
10
|
+
return false;
|
|
11
|
+
return Object.values(value).every(isJsonValue);
|
|
12
|
+
}
|
|
13
|
+
function parsePartialToolInput(value) {
|
|
14
|
+
try {
|
|
15
|
+
const parsed = JSON.parse(value);
|
|
16
|
+
if (isJsonValue(parsed))
|
|
17
|
+
return parsed;
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function createTranscriptState(snapshot) {
|
|
23
|
+
return {
|
|
24
|
+
snapshot: structuredClone(snapshot),
|
|
25
|
+
progressItems: /* @__PURE__ */ new Map(),
|
|
26
|
+
progressOrder: [],
|
|
27
|
+
toolCallBuffers: /* @__PURE__ */ new Map()
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function applyTranscriptSnapshot(state, snapshot) {
|
|
31
|
+
if (state.snapshot.id === snapshot.id && snapshot.revision < state.snapshot.revision)
|
|
32
|
+
return state;
|
|
33
|
+
return createTranscriptState(snapshot);
|
|
34
|
+
}
|
|
35
|
+
function applyTranscriptProgress(state, progress) {
|
|
36
|
+
if (progress.type === "item_started" || progress.type === "item_updated") {
|
|
37
|
+
return setProgressItem(state, progress.item);
|
|
38
|
+
}
|
|
39
|
+
if (progress.type === "item_finished") {
|
|
40
|
+
const toolCallBuffers2 = new Map(state.toolCallBuffers);
|
|
41
|
+
for (const key of toolCallBuffers2.keys()) {
|
|
42
|
+
if (key.startsWith(`${progress.item.id}:`))
|
|
43
|
+
toolCallBuffers2.delete(key);
|
|
44
|
+
}
|
|
45
|
+
return setProgressItem({ ...state, toolCallBuffers: toolCallBuffers2 }, progress.item);
|
|
46
|
+
}
|
|
47
|
+
const item = state.progressItems.get(progress.messageId) ?? state.snapshot.transcript.find(({ id }) => id === progress.messageId);
|
|
48
|
+
if (!item || item.role !== "assistant")
|
|
49
|
+
return state;
|
|
50
|
+
let toolCallBuffers = state.toolCallBuffers;
|
|
51
|
+
const content = item.content.map((part, index) => {
|
|
52
|
+
if (index !== progress.contentIndex)
|
|
53
|
+
return structuredClone(part);
|
|
54
|
+
if (progress.kind === "text" && part.type === "text")
|
|
55
|
+
return { ...part, text: part.text + progress.delta };
|
|
56
|
+
if (progress.kind === "thinking" && part.type === "thinking") {
|
|
57
|
+
return { ...part, thinking: part.thinking + progress.delta };
|
|
58
|
+
}
|
|
59
|
+
if (progress.kind === "toolCall" && part.type === "toolCall") {
|
|
60
|
+
const key = `${progress.messageId}:${progress.contentIndex}`;
|
|
61
|
+
const existing = state.toolCallBuffers.get(key) ?? (typeof part.input === "string" ? part.input : "");
|
|
62
|
+
const buffer = existing + progress.delta;
|
|
63
|
+
toolCallBuffers = new Map(state.toolCallBuffers).set(key, buffer);
|
|
64
|
+
return { ...part, input: parsePartialToolInput(buffer) };
|
|
65
|
+
}
|
|
66
|
+
return structuredClone(part);
|
|
67
|
+
});
|
|
68
|
+
return setProgressItem({ ...state, toolCallBuffers }, { ...item, content });
|
|
69
|
+
}
|
|
70
|
+
function selectTranscript(state) {
|
|
71
|
+
const transcript = state.snapshot.transcript.map((item) => state.progressItems.get(item.id) ?? item);
|
|
72
|
+
const ids = new Set(transcript.map((item) => item.id));
|
|
73
|
+
for (const id of state.progressOrder) {
|
|
74
|
+
if (ids.has(id))
|
|
75
|
+
continue;
|
|
76
|
+
const item = state.progressItems.get(id);
|
|
77
|
+
if (item) {
|
|
78
|
+
transcript.push(item);
|
|
79
|
+
ids.add(id);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
for (const item of state.snapshot.queuedSteer) {
|
|
83
|
+
if (ids.has(item.id))
|
|
84
|
+
continue;
|
|
85
|
+
transcript.push(item);
|
|
86
|
+
ids.add(item.id);
|
|
87
|
+
}
|
|
88
|
+
return transcript;
|
|
89
|
+
}
|
|
90
|
+
function setProgressItem(state, item) {
|
|
91
|
+
const progressItems = new Map(state.progressItems);
|
|
92
|
+
const progressOrder = progressItems.has(item.id) ? state.progressOrder : [...state.progressOrder, item.id];
|
|
93
|
+
progressItems.set(item.id, structuredClone(item));
|
|
94
|
+
return { ...state, progressItems, progressOrder };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// dist/client/remote-session.js
|
|
98
|
+
var RemoteSessionDisposedError = class extends Error {
|
|
99
|
+
constructor() {
|
|
100
|
+
super("Remote session is disposed");
|
|
101
|
+
this.name = "RemoteSessionDisposedError";
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
async function settleRemoteSessionDisposal(cleanup) {
|
|
105
|
+
const results = await Promise.allSettled(cleanup);
|
|
106
|
+
const errors = results.flatMap((result) => result.status === "rejected" && !(result.reason instanceof RemoteSessionDisposedError) ? [result.reason] : []);
|
|
107
|
+
if (errors.length === 1)
|
|
108
|
+
throw errors[0];
|
|
109
|
+
if (errors.length > 1)
|
|
110
|
+
throw new AggregateError(errors, "Failed to dispose remote session");
|
|
111
|
+
}
|
|
112
|
+
var RemoteSession = class _RemoteSession {
|
|
113
|
+
#client;
|
|
114
|
+
#onListenerError;
|
|
115
|
+
#lifecycle = { status: "unbound" };
|
|
116
|
+
#handle;
|
|
117
|
+
#transcript;
|
|
118
|
+
#unsubscribeSnapshot;
|
|
119
|
+
#unsubscribeEvents;
|
|
120
|
+
#listeners = /* @__PURE__ */ new Set();
|
|
121
|
+
#pendingAttachmentOperations = /* @__PURE__ */ new Set();
|
|
122
|
+
#activeOperationStates = /* @__PURE__ */ new Set();
|
|
123
|
+
#disposePromise;
|
|
124
|
+
#resolveDisposeSignal = () => {
|
|
125
|
+
};
|
|
126
|
+
#disposeSignal = new Promise((resolve) => {
|
|
127
|
+
this.#resolveDisposeSignal = resolve;
|
|
128
|
+
});
|
|
129
|
+
constructor(client, options = {}) {
|
|
130
|
+
this.#client = client;
|
|
131
|
+
this.#onListenerError = options.onListenerError;
|
|
132
|
+
}
|
|
133
|
+
get id() {
|
|
134
|
+
return this.#handle?.id;
|
|
135
|
+
}
|
|
136
|
+
get state() {
|
|
137
|
+
return {
|
|
138
|
+
lifecycle: this.#lifecycle,
|
|
139
|
+
snapshot: this.#transcript?.snapshot,
|
|
140
|
+
transcript: this.#transcript ? selectTranscript(this.#transcript) : []
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
get snapshot() {
|
|
144
|
+
return this.#transcript?.snapshot;
|
|
145
|
+
}
|
|
146
|
+
get phase() {
|
|
147
|
+
return this.snapshot?.phase;
|
|
148
|
+
}
|
|
149
|
+
get operation() {
|
|
150
|
+
return this.#lifecycle.status === "busy" ? this.#lifecycle.operation : void 0;
|
|
151
|
+
}
|
|
152
|
+
get models() {
|
|
153
|
+
return this.#client.snapshot?.models ?? [];
|
|
154
|
+
}
|
|
155
|
+
get sessions() {
|
|
156
|
+
return this.#client.snapshot?.sessions ?? [];
|
|
157
|
+
}
|
|
158
|
+
get connectionState() {
|
|
159
|
+
return this.#client.connectionState;
|
|
160
|
+
}
|
|
161
|
+
get disposed() {
|
|
162
|
+
return this.#lifecycle.status === "disposed";
|
|
163
|
+
}
|
|
164
|
+
subscribe(listener) {
|
|
165
|
+
this.#assertNotDisposed();
|
|
166
|
+
this.#listeners.add(listener);
|
|
167
|
+
this.#callListener(listener, this.state);
|
|
168
|
+
return () => this.#listeners.delete(listener);
|
|
169
|
+
}
|
|
170
|
+
onConnectionStateChange(listener) {
|
|
171
|
+
this.#assertNotDisposed();
|
|
172
|
+
return this.#client.onConnectionStateChange(listener);
|
|
173
|
+
}
|
|
174
|
+
static async open(client, sessionId, options = {}) {
|
|
175
|
+
const session = new _RemoteSession(client, options);
|
|
176
|
+
try {
|
|
177
|
+
await session.open(sessionId);
|
|
178
|
+
return session;
|
|
179
|
+
} catch (error) {
|
|
180
|
+
await session.dispose();
|
|
181
|
+
throw error;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async open(sessionId) {
|
|
185
|
+
if (this.#handle?.id === sessionId && this.#lifecycle.status === "ready")
|
|
186
|
+
return;
|
|
187
|
+
await this.#replace("open", () => this.#client.acquireSession(sessionId, { mode: "exclusive" }));
|
|
188
|
+
}
|
|
189
|
+
static async create(client, createOptions, options = {}) {
|
|
190
|
+
const session = new _RemoteSession(client, options);
|
|
191
|
+
try {
|
|
192
|
+
await session.create(createOptions);
|
|
193
|
+
return session;
|
|
194
|
+
} catch (error) {
|
|
195
|
+
await session.dispose();
|
|
196
|
+
throw error;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
async create(options) {
|
|
200
|
+
await this.#replace("create", () => this.#client.createSession(options));
|
|
201
|
+
}
|
|
202
|
+
async submit(text) {
|
|
203
|
+
const normalized = text.trim();
|
|
204
|
+
if (!normalized)
|
|
205
|
+
return;
|
|
206
|
+
this.#assertAvailable();
|
|
207
|
+
const handle = this.#requireHandle();
|
|
208
|
+
if (this.phase !== "idle" && this.phase !== "turn") {
|
|
209
|
+
throw new Error(`Session cannot accept input during ${this.phase ?? "unknown"} phase`);
|
|
210
|
+
}
|
|
211
|
+
await this.#runOperation("submit", () => (this.phase === "idle" ? handle.prompt(normalized) : handle.steer(normalized)).then(() => void 0));
|
|
212
|
+
}
|
|
213
|
+
async abort() {
|
|
214
|
+
const preemptingSubmit = this.#lifecycle.status === "busy" && this.#lifecycle.operation === "submit";
|
|
215
|
+
if (preemptingSubmit)
|
|
216
|
+
this.#assertNotDisposed();
|
|
217
|
+
else
|
|
218
|
+
this.#assertAvailable();
|
|
219
|
+
const handle = this.#requireHandle();
|
|
220
|
+
if (this.phase === "idle" && !preemptingSubmit)
|
|
221
|
+
return;
|
|
222
|
+
await this.#runOperation("abort", () => handle.abort().then(() => void 0), preemptingSubmit);
|
|
223
|
+
}
|
|
224
|
+
async setModel(model) {
|
|
225
|
+
await this.#runIdleOperation("setModel", "change model", () => this.#requireHandle().setModel(model).then(() => void 0));
|
|
226
|
+
}
|
|
227
|
+
async setThinking(thinkingLevel) {
|
|
228
|
+
await this.#runIdleOperation("setThinking", "change thinking level", () => this.#requireHandle().setThinking(thinkingLevel).then(() => void 0));
|
|
229
|
+
}
|
|
230
|
+
async reconnect() {
|
|
231
|
+
this.#assertAvailable();
|
|
232
|
+
const sessionId = this.#requireHandle().id;
|
|
233
|
+
await this.#runOperation("reconnect", () => this.#trackAttachmentOperation(async () => {
|
|
234
|
+
await this.#client.reconnect();
|
|
235
|
+
const handle = await this.#client.acquireSession(sessionId, { mode: "exclusive" });
|
|
236
|
+
await this.#assertNotDisposedAfterAwait(handle);
|
|
237
|
+
this.#bind(handle);
|
|
238
|
+
}));
|
|
239
|
+
}
|
|
240
|
+
dispose() {
|
|
241
|
+
if (this.#disposePromise)
|
|
242
|
+
return this.#disposePromise;
|
|
243
|
+
const handle = this.#handle;
|
|
244
|
+
this.#lifecycle = { status: "disposed" };
|
|
245
|
+
this.#resolveDisposeSignal();
|
|
246
|
+
this.#clearSubscriptions();
|
|
247
|
+
this.#handle = void 0;
|
|
248
|
+
this.#transcript = void 0;
|
|
249
|
+
const cleanup = [...this.#pendingAttachmentOperations];
|
|
250
|
+
if (handle)
|
|
251
|
+
cleanup.push(handle.dispose());
|
|
252
|
+
this.#disposePromise = settleRemoteSessionDisposal(cleanup);
|
|
253
|
+
this.#notify();
|
|
254
|
+
this.#listeners.clear();
|
|
255
|
+
return this.#disposePromise;
|
|
256
|
+
}
|
|
257
|
+
[Symbol.asyncDispose]() {
|
|
258
|
+
return this.dispose();
|
|
259
|
+
}
|
|
260
|
+
async #replace(operation, prepare) {
|
|
261
|
+
this.#assertAvailable();
|
|
262
|
+
if (this.#handle && this.phase !== "idle") {
|
|
263
|
+
throw new Error(`Cannot ${operation} a session while session is ${this.phase ?? "unavailable"}`);
|
|
264
|
+
}
|
|
265
|
+
await this.#runOperation(operation, () => this.#trackAttachmentOperation(() => this.#prepareReplacement(operation, prepare)));
|
|
266
|
+
}
|
|
267
|
+
async #trackAttachmentOperation(run) {
|
|
268
|
+
const pending = run();
|
|
269
|
+
this.#pendingAttachmentOperations.add(pending);
|
|
270
|
+
try {
|
|
271
|
+
await pending;
|
|
272
|
+
} finally {
|
|
273
|
+
this.#pendingAttachmentOperations.delete(pending);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
async #prepareReplacement(operation, prepare) {
|
|
277
|
+
const previous = this.#handle;
|
|
278
|
+
const next = await prepare();
|
|
279
|
+
await this.#assertNotDisposedAfterAwait(next);
|
|
280
|
+
const snapshot = next.snapshot;
|
|
281
|
+
if (!snapshot) {
|
|
282
|
+
await this.#detach(next);
|
|
283
|
+
throw new Error(`Session ${next.id} did not provide a snapshot`);
|
|
284
|
+
}
|
|
285
|
+
if (previous && previous.id !== next.id && previous.attached && this.phase !== "idle") {
|
|
286
|
+
await this.#detach(next);
|
|
287
|
+
throw new Error(`Cannot ${operation} a session while session is ${this.phase ?? "unavailable"}`);
|
|
288
|
+
}
|
|
289
|
+
if (previous && previous.id !== next.id && previous.attached) {
|
|
290
|
+
try {
|
|
291
|
+
await previous.detach();
|
|
292
|
+
} catch (error) {
|
|
293
|
+
try {
|
|
294
|
+
await this.#detach(next);
|
|
295
|
+
} catch (cleanupError) {
|
|
296
|
+
throw new AggregateError([error, cleanupError], "Failed to replace remote session attachment");
|
|
297
|
+
}
|
|
298
|
+
throw error;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
await this.#assertNotDisposedAfterAwait(next);
|
|
302
|
+
this.#bind(next, snapshot);
|
|
303
|
+
}
|
|
304
|
+
async #runIdleOperation(operation, description, run) {
|
|
305
|
+
this.#assertAvailable();
|
|
306
|
+
this.#requireHandle();
|
|
307
|
+
if (this.phase !== "idle") {
|
|
308
|
+
throw new Error(`Cannot ${description} while session is ${this.phase ?? "unavailable"}`);
|
|
309
|
+
}
|
|
310
|
+
await this.#runOperation(operation, run);
|
|
311
|
+
}
|
|
312
|
+
async #runOperation(operation, run, preempt = false) {
|
|
313
|
+
if (preempt)
|
|
314
|
+
this.#assertNotDisposed();
|
|
315
|
+
else
|
|
316
|
+
this.#assertAvailable();
|
|
317
|
+
const previous = this.#lifecycle;
|
|
318
|
+
const busy = { status: "busy", operation };
|
|
319
|
+
this.#lifecycle = busy;
|
|
320
|
+
this.#activeOperationStates.add(busy);
|
|
321
|
+
this.#notify();
|
|
322
|
+
const running = run();
|
|
323
|
+
try {
|
|
324
|
+
await Promise.race([
|
|
325
|
+
running,
|
|
326
|
+
this.#disposeSignal.then(() => {
|
|
327
|
+
throw new Error("Remote session is disposed");
|
|
328
|
+
})
|
|
329
|
+
]);
|
|
330
|
+
} finally {
|
|
331
|
+
this.#activeOperationStates.delete(busy);
|
|
332
|
+
if (!this.disposed && this.#lifecycle === busy) {
|
|
333
|
+
this.#lifecycle = preempt && this.#activeOperationStates.has(previous) ? previous : this.#handle ? { status: "ready" } : { status: "unbound" };
|
|
334
|
+
this.#notify();
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
#bind(handle, knownSnapshot) {
|
|
339
|
+
const snapshot = knownSnapshot ?? handle.snapshot;
|
|
340
|
+
if (!snapshot)
|
|
341
|
+
throw new Error(`Session ${handle.id} did not provide a snapshot`);
|
|
342
|
+
this.#clearSubscriptions();
|
|
343
|
+
this.#handle = handle;
|
|
344
|
+
this.#transcript = createTranscriptState(snapshot);
|
|
345
|
+
this.#unsubscribeSnapshot = handle.subscribe((next) => {
|
|
346
|
+
if (!this.#transcript)
|
|
347
|
+
return;
|
|
348
|
+
this.#transcript = applyTranscriptSnapshot(this.#transcript, next);
|
|
349
|
+
this.#notify();
|
|
350
|
+
});
|
|
351
|
+
this.#unsubscribeEvents = handle.onEvent((event) => this.#handleEvent(event));
|
|
352
|
+
}
|
|
353
|
+
#handleEvent(event) {
|
|
354
|
+
if (event.type === "session_removed") {
|
|
355
|
+
this.#clearSubscriptions();
|
|
356
|
+
this.#handle = void 0;
|
|
357
|
+
this.#transcript = void 0;
|
|
358
|
+
if (this.#lifecycle.status !== "busy")
|
|
359
|
+
this.#lifecycle = { status: "unbound" };
|
|
360
|
+
this.#notify();
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (event.type !== "session_progress" || !this.#transcript)
|
|
364
|
+
return;
|
|
365
|
+
this.#transcript = applyTranscriptProgress(this.#transcript, event.progress);
|
|
366
|
+
this.#notify();
|
|
367
|
+
}
|
|
368
|
+
#notify() {
|
|
369
|
+
const state = this.state;
|
|
370
|
+
for (const listener of this.#listeners)
|
|
371
|
+
this.#callListener(listener, state);
|
|
372
|
+
}
|
|
373
|
+
#callListener(listener, state) {
|
|
374
|
+
try {
|
|
375
|
+
listener(state);
|
|
376
|
+
} catch (error) {
|
|
377
|
+
this.#reportListenerError(error);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
#reportListenerError(error) {
|
|
381
|
+
if (!this.#onListenerError)
|
|
382
|
+
return;
|
|
383
|
+
try {
|
|
384
|
+
this.#onListenerError(error instanceof Error ? error : new Error(String(error)));
|
|
385
|
+
} catch {
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
#clearSubscriptions() {
|
|
389
|
+
this.#unsubscribeSnapshot?.();
|
|
390
|
+
this.#unsubscribeEvents?.();
|
|
391
|
+
this.#unsubscribeSnapshot = void 0;
|
|
392
|
+
this.#unsubscribeEvents = void 0;
|
|
393
|
+
}
|
|
394
|
+
#requireHandle() {
|
|
395
|
+
if (!this.#handle)
|
|
396
|
+
throw new Error("No remote session is attached");
|
|
397
|
+
return this.#handle;
|
|
398
|
+
}
|
|
399
|
+
#assertAvailable() {
|
|
400
|
+
this.#assertNotDisposed();
|
|
401
|
+
if (this.#lifecycle.status === "busy") {
|
|
402
|
+
throw new Error(`Remote session is busy with ${this.#lifecycle.operation}`);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
#assertNotDisposed() {
|
|
406
|
+
if (this.disposed)
|
|
407
|
+
throw new Error("Remote session is disposed");
|
|
408
|
+
}
|
|
409
|
+
async #assertNotDisposedAfterAwait(handle) {
|
|
410
|
+
if (!this.disposed)
|
|
411
|
+
return;
|
|
412
|
+
await this.#detach(handle);
|
|
413
|
+
throw new RemoteSessionDisposedError();
|
|
414
|
+
}
|
|
415
|
+
async #detach(handle) {
|
|
416
|
+
await handle.dispose();
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
export {
|
|
420
|
+
RemoteSession,
|
|
421
|
+
applyTranscriptProgress,
|
|
422
|
+
applyTranscriptSnapshot,
|
|
423
|
+
createTranscriptState,
|
|
424
|
+
selectTranscript
|
|
425
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,aAAa,GAKb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,GAEhB,MAAM,iBAAiB,CAAC","sourcesContent":["export {\n\ttype CreateRemoteSessionOptions,\n\tRemoteSession,\n\ttype RemoteSessionLifecycle,\n\ttype RemoteSessionOperation,\n\ttype RemoteSessionOptions,\n\ttype RemoteSessionState,\n} from \"./remote-session.ts\";\nexport {\n\tapplyTranscriptProgress,\n\tapplyTranscriptSnapshot,\n\tcreateTranscriptState,\n\tselectTranscript,\n\ttype TranscriptState,\n} from \"./transcript.ts\";\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ConnectionState, ConnectionStateChange, PiClient, Unsubscribe } from "@earendil-works/pi-client";
|
|
2
|
+
import type { ModelMetadata, ModelRef, SessionPhase, SessionSnapshot, SessionSummary, ThinkingLevel, TranscriptItem } from "@earendil-works/pi-protocol";
|
|
3
|
+
export type RemoteSessionOperation = "open" | "create" | "submit" | "abort" | "setModel" | "setThinking" | "reconnect";
|
|
4
|
+
export type RemoteSessionLifecycle = {
|
|
5
|
+
readonly status: "unbound";
|
|
6
|
+
} | {
|
|
7
|
+
readonly status: "ready";
|
|
8
|
+
} | {
|
|
9
|
+
readonly status: "busy";
|
|
10
|
+
readonly operation: RemoteSessionOperation;
|
|
11
|
+
} | {
|
|
12
|
+
readonly status: "disposed";
|
|
13
|
+
};
|
|
14
|
+
export interface RemoteSessionState {
|
|
15
|
+
readonly lifecycle: RemoteSessionLifecycle;
|
|
16
|
+
readonly snapshot?: SessionSnapshot;
|
|
17
|
+
readonly transcript: readonly TranscriptItem[];
|
|
18
|
+
}
|
|
19
|
+
export interface CreateRemoteSessionOptions {
|
|
20
|
+
cwd: string;
|
|
21
|
+
model?: ModelRef;
|
|
22
|
+
thinkingLevel?: ThinkingLevel;
|
|
23
|
+
}
|
|
24
|
+
export interface RemoteSessionOptions {
|
|
25
|
+
onListenerError?: (error: Error) => void;
|
|
26
|
+
}
|
|
27
|
+
export declare class RemoteSession {
|
|
28
|
+
#private;
|
|
29
|
+
private constructor();
|
|
30
|
+
get id(): string | undefined;
|
|
31
|
+
get state(): RemoteSessionState;
|
|
32
|
+
get snapshot(): SessionSnapshot | undefined;
|
|
33
|
+
get phase(): SessionPhase | undefined;
|
|
34
|
+
get operation(): RemoteSessionOperation | undefined;
|
|
35
|
+
get models(): readonly ModelMetadata[];
|
|
36
|
+
get sessions(): readonly SessionSummary[];
|
|
37
|
+
get connectionState(): ConnectionState;
|
|
38
|
+
get disposed(): boolean;
|
|
39
|
+
subscribe(listener: (state: RemoteSessionState) => void): Unsubscribe;
|
|
40
|
+
onConnectionStateChange(listener: (change: ConnectionStateChange) => void): Unsubscribe;
|
|
41
|
+
static open(client: PiClient, sessionId: string, options?: RemoteSessionOptions): Promise<RemoteSession>;
|
|
42
|
+
open(sessionId: string): Promise<void>;
|
|
43
|
+
static create(client: PiClient, createOptions: CreateRemoteSessionOptions, options?: RemoteSessionOptions): Promise<RemoteSession>;
|
|
44
|
+
create(options: CreateRemoteSessionOptions): Promise<void>;
|
|
45
|
+
submit(text: string): Promise<void>;
|
|
46
|
+
abort(): Promise<void>;
|
|
47
|
+
setModel(model: ModelRef): Promise<void>;
|
|
48
|
+
setThinking(thinkingLevel: ThinkingLevel): Promise<void>;
|
|
49
|
+
reconnect(): Promise<void>;
|
|
50
|
+
dispose(): Promise<void>;
|
|
51
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=remote-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-session.d.ts","sourceRoot":"","sources":["../../src/client/remote-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,eAAe,EACf,qBAAqB,EACrB,QAAQ,EAER,WAAW,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACX,aAAa,EACb,QAAQ,EAER,YAAY,EACZ,eAAe,EACf,cAAc,EACd,aAAa,EACb,cAAc,EACd,MAAM,6BAA6B,CAAC;AASrC,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,WAAW,CAAC;AAEvH,MAAM,MAAM,sBAAsB,GAC/B;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;CAAE,GAC9B;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAA;CAAE,GACvE;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;IAC3C,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,SAAS,cAAc,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,0BAA0B;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACpC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACzC;AAkBD,qBAAa,aAAa;;IAiBzB,OAAO,eAGN;IAED,IAAI,EAAE,IAAI,MAAM,GAAG,SAAS,CAE3B;IAED,IAAI,KAAK,IAAI,kBAAkB,CAM9B;IAED,IAAI,QAAQ,IAAI,eAAe,GAAG,SAAS,CAE1C;IAED,IAAI,KAAK,IAAI,YAAY,GAAG,SAAS,CAEpC;IAED,IAAI,SAAS,IAAI,sBAAsB,GAAG,SAAS,CAElD;IAED,IAAI,MAAM,IAAI,SAAS,aAAa,EAAE,CAErC;IAED,IAAI,QAAQ,IAAI,SAAS,cAAc,EAAE,CAExC;IAED,IAAI,eAAe,IAAI,eAAe,CAErC;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,GAAG,WAAW,CAKpE;IAED,uBAAuB,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,GAAG,WAAW,CAGtF;IAED,OAAa,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC,CASjH;IAEK,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG3C;IAED,OAAa,MAAM,CAClB,MAAM,EAAE,QAAQ,EAChB,aAAa,EAAE,0BAA0B,EACzC,OAAO,GAAE,oBAAyB,GAChC,OAAO,CAAC,aAAa,CAAC,CASxB;IAEK,MAAM,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;IAEK,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAWxC;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAO3B;IAEK,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7C;IAEK,WAAW,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7D;IAEK,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAW/B;IAED,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAcvB;IAED,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAErC;CAgLD","sourcesContent":["import type {\n\tConnectionState,\n\tConnectionStateChange,\n\tPiClient,\n\tSessionLease,\n\tUnsubscribe,\n} from \"@earendil-works/pi-client\";\nimport type {\n\tModelMetadata,\n\tModelRef,\n\tServerEvent,\n\tSessionPhase,\n\tSessionSnapshot,\n\tSessionSummary,\n\tThinkingLevel,\n\tTranscriptItem,\n} from \"@earendil-works/pi-protocol\";\nimport {\n\tapplyTranscriptProgress,\n\tapplyTranscriptSnapshot,\n\tcreateTranscriptState,\n\tselectTranscript,\n\ttype TranscriptState,\n} from \"./transcript.ts\";\n\nexport type RemoteSessionOperation = \"open\" | \"create\" | \"submit\" | \"abort\" | \"setModel\" | \"setThinking\" | \"reconnect\";\n\nexport type RemoteSessionLifecycle =\n\t| { readonly status: \"unbound\" }\n\t| { readonly status: \"ready\" }\n\t| { readonly status: \"busy\"; readonly operation: RemoteSessionOperation }\n\t| { readonly status: \"disposed\" };\n\nexport interface RemoteSessionState {\n\treadonly lifecycle: RemoteSessionLifecycle;\n\treadonly snapshot?: SessionSnapshot;\n\treadonly transcript: readonly TranscriptItem[];\n}\n\nexport interface CreateRemoteSessionOptions {\n\tcwd: string;\n\tmodel?: ModelRef;\n\tthinkingLevel?: ThinkingLevel;\n}\n\nexport interface RemoteSessionOptions {\n\tonListenerError?: (error: Error) => void;\n}\n\nclass RemoteSessionDisposedError extends Error {\n\tconstructor() {\n\t\tsuper(\"Remote session is disposed\");\n\t\tthis.name = \"RemoteSessionDisposedError\";\n\t}\n}\n\nasync function settleRemoteSessionDisposal(cleanup: readonly Promise<void>[]): Promise<void> {\n\tconst results = await Promise.allSettled(cleanup);\n\tconst errors = results.flatMap((result) =>\n\t\tresult.status === \"rejected\" && !(result.reason instanceof RemoteSessionDisposedError) ? [result.reason] : [],\n\t);\n\tif (errors.length === 1) throw errors[0];\n\tif (errors.length > 1) throw new AggregateError(errors, \"Failed to dispose remote session\");\n}\n\nexport class RemoteSession {\n\treadonly #client: PiClient;\n\treadonly #onListenerError: ((error: Error) => void) | undefined;\n\t#lifecycle: RemoteSessionLifecycle = { status: \"unbound\" };\n\t#handle: SessionLease | undefined;\n\t#transcript: TranscriptState | undefined;\n\t#unsubscribeSnapshot: Unsubscribe | undefined;\n\t#unsubscribeEvents: Unsubscribe | undefined;\n\treadonly #listeners = new Set<(state: RemoteSessionState) => void>();\n\treadonly #pendingAttachmentOperations = new Set<Promise<void>>();\n\treadonly #activeOperationStates = new Set<RemoteSessionLifecycle>();\n\t#disposePromise: Promise<void> | undefined;\n\t#resolveDisposeSignal: () => void = () => {};\n\treadonly #disposeSignal = new Promise<void>((resolve) => {\n\t\tthis.#resolveDisposeSignal = resolve;\n\t});\n\n\tprivate constructor(client: PiClient, options: RemoteSessionOptions = {}) {\n\t\tthis.#client = client;\n\t\tthis.#onListenerError = options.onListenerError;\n\t}\n\n\tget id(): string | undefined {\n\t\treturn this.#handle?.id;\n\t}\n\n\tget state(): RemoteSessionState {\n\t\treturn {\n\t\t\tlifecycle: this.#lifecycle,\n\t\t\tsnapshot: this.#transcript?.snapshot,\n\t\t\ttranscript: this.#transcript ? selectTranscript(this.#transcript) : [],\n\t\t};\n\t}\n\n\tget snapshot(): SessionSnapshot | undefined {\n\t\treturn this.#transcript?.snapshot;\n\t}\n\n\tget phase(): SessionPhase | undefined {\n\t\treturn this.snapshot?.phase;\n\t}\n\n\tget operation(): RemoteSessionOperation | undefined {\n\t\treturn this.#lifecycle.status === \"busy\" ? this.#lifecycle.operation : undefined;\n\t}\n\n\tget models(): readonly ModelMetadata[] {\n\t\treturn this.#client.snapshot?.models ?? [];\n\t}\n\n\tget sessions(): readonly SessionSummary[] {\n\t\treturn this.#client.snapshot?.sessions ?? [];\n\t}\n\n\tget connectionState(): ConnectionState {\n\t\treturn this.#client.connectionState;\n\t}\n\n\tget disposed(): boolean {\n\t\treturn this.#lifecycle.status === \"disposed\";\n\t}\n\n\tsubscribe(listener: (state: RemoteSessionState) => void): Unsubscribe {\n\t\tthis.#assertNotDisposed();\n\t\tthis.#listeners.add(listener);\n\t\tthis.#callListener(listener, this.state);\n\t\treturn () => this.#listeners.delete(listener);\n\t}\n\n\tonConnectionStateChange(listener: (change: ConnectionStateChange) => void): Unsubscribe {\n\t\tthis.#assertNotDisposed();\n\t\treturn this.#client.onConnectionStateChange(listener);\n\t}\n\n\tstatic async open(client: PiClient, sessionId: string, options: RemoteSessionOptions = {}): Promise<RemoteSession> {\n\t\tconst session = new RemoteSession(client, options);\n\t\ttry {\n\t\t\tawait session.open(sessionId);\n\t\t\treturn session;\n\t\t} catch (error) {\n\t\t\tawait session.dispose();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync open(sessionId: string): Promise<void> {\n\t\tif (this.#handle?.id === sessionId && this.#lifecycle.status === \"ready\") return;\n\t\tawait this.#replace(\"open\", () => this.#client.acquireSession(sessionId, { mode: \"exclusive\" }));\n\t}\n\n\tstatic async create(\n\t\tclient: PiClient,\n\t\tcreateOptions: CreateRemoteSessionOptions,\n\t\toptions: RemoteSessionOptions = {},\n\t): Promise<RemoteSession> {\n\t\tconst session = new RemoteSession(client, options);\n\t\ttry {\n\t\t\tawait session.create(createOptions);\n\t\t\treturn session;\n\t\t} catch (error) {\n\t\t\tawait session.dispose();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync create(options: CreateRemoteSessionOptions): Promise<void> {\n\t\tawait this.#replace(\"create\", () => this.#client.createSession(options));\n\t}\n\n\tasync submit(text: string): Promise<void> {\n\t\tconst normalized = text.trim();\n\t\tif (!normalized) return;\n\t\tthis.#assertAvailable();\n\t\tconst handle = this.#requireHandle();\n\t\tif (this.phase !== \"idle\" && this.phase !== \"turn\") {\n\t\t\tthrow new Error(`Session cannot accept input during ${this.phase ?? \"unknown\"} phase`);\n\t\t}\n\t\tawait this.#runOperation(\"submit\", () =>\n\t\t\t(this.phase === \"idle\" ? handle.prompt(normalized) : handle.steer(normalized)).then(() => undefined),\n\t\t);\n\t}\n\n\tasync abort(): Promise<void> {\n\t\tconst preemptingSubmit = this.#lifecycle.status === \"busy\" && this.#lifecycle.operation === \"submit\";\n\t\tif (preemptingSubmit) this.#assertNotDisposed();\n\t\telse this.#assertAvailable();\n\t\tconst handle = this.#requireHandle();\n\t\tif (this.phase === \"idle\" && !preemptingSubmit) return;\n\t\tawait this.#runOperation(\"abort\", () => handle.abort().then(() => undefined), preemptingSubmit);\n\t}\n\n\tasync setModel(model: ModelRef): Promise<void> {\n\t\tawait this.#runIdleOperation(\"setModel\", \"change model\", () =>\n\t\t\tthis.#requireHandle()\n\t\t\t\t.setModel(model)\n\t\t\t\t.then(() => undefined),\n\t\t);\n\t}\n\n\tasync setThinking(thinkingLevel: ThinkingLevel): Promise<void> {\n\t\tawait this.#runIdleOperation(\"setThinking\", \"change thinking level\", () =>\n\t\t\tthis.#requireHandle()\n\t\t\t\t.setThinking(thinkingLevel)\n\t\t\t\t.then(() => undefined),\n\t\t);\n\t}\n\n\tasync reconnect(): Promise<void> {\n\t\tthis.#assertAvailable();\n\t\tconst sessionId = this.#requireHandle().id;\n\t\tawait this.#runOperation(\"reconnect\", () =>\n\t\t\tthis.#trackAttachmentOperation(async () => {\n\t\t\t\tawait this.#client.reconnect();\n\t\t\t\tconst handle = await this.#client.acquireSession(sessionId, { mode: \"exclusive\" });\n\t\t\t\tawait this.#assertNotDisposedAfterAwait(handle);\n\t\t\t\tthis.#bind(handle);\n\t\t\t}),\n\t\t);\n\t}\n\n\tdispose(): Promise<void> {\n\t\tif (this.#disposePromise) return this.#disposePromise;\n\t\tconst handle = this.#handle;\n\t\tthis.#lifecycle = { status: \"disposed\" };\n\t\tthis.#resolveDisposeSignal();\n\t\tthis.#clearSubscriptions();\n\t\tthis.#handle = undefined;\n\t\tthis.#transcript = undefined;\n\t\tconst cleanup = [...this.#pendingAttachmentOperations];\n\t\tif (handle) cleanup.push(handle.dispose());\n\t\tthis.#disposePromise = settleRemoteSessionDisposal(cleanup);\n\t\tthis.#notify();\n\t\tthis.#listeners.clear();\n\t\treturn this.#disposePromise;\n\t}\n\n\t[Symbol.asyncDispose](): Promise<void> {\n\t\treturn this.dispose();\n\t}\n\n\tasync #replace(operation: \"open\" | \"create\", prepare: () => Promise<SessionLease>): Promise<void> {\n\t\tthis.#assertAvailable();\n\t\tif (this.#handle && this.phase !== \"idle\") {\n\t\t\tthrow new Error(`Cannot ${operation} a session while session is ${this.phase ?? \"unavailable\"}`);\n\t\t}\n\t\tawait this.#runOperation(operation, () =>\n\t\t\tthis.#trackAttachmentOperation(() => this.#prepareReplacement(operation, prepare)),\n\t\t);\n\t}\n\n\tasync #trackAttachmentOperation(run: () => Promise<void>): Promise<void> {\n\t\tconst pending = run();\n\t\tthis.#pendingAttachmentOperations.add(pending);\n\t\ttry {\n\t\t\tawait pending;\n\t\t} finally {\n\t\t\tthis.#pendingAttachmentOperations.delete(pending);\n\t\t}\n\t}\n\n\tasync #prepareReplacement(operation: \"open\" | \"create\", prepare: () => Promise<SessionLease>): Promise<void> {\n\t\tconst previous = this.#handle;\n\t\tconst next = await prepare();\n\t\tawait this.#assertNotDisposedAfterAwait(next);\n\t\tconst snapshot = next.snapshot;\n\t\tif (!snapshot) {\n\t\t\tawait this.#detach(next);\n\t\t\tthrow new Error(`Session ${next.id} did not provide a snapshot`);\n\t\t}\n\t\tif (previous && previous.id !== next.id && previous.attached && this.phase !== \"idle\") {\n\t\t\tawait this.#detach(next);\n\t\t\tthrow new Error(`Cannot ${operation} a session while session is ${this.phase ?? \"unavailable\"}`);\n\t\t}\n\t\tif (previous && previous.id !== next.id && previous.attached) {\n\t\t\ttry {\n\t\t\t\tawait previous.detach();\n\t\t\t} catch (error) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.#detach(next);\n\t\t\t\t} catch (cleanupError) {\n\t\t\t\t\tthrow new AggregateError([error, cleanupError], \"Failed to replace remote session attachment\");\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\tawait this.#assertNotDisposedAfterAwait(next);\n\t\tthis.#bind(next, snapshot);\n\t}\n\n\tasync #runIdleOperation(\n\t\toperation: \"setModel\" | \"setThinking\",\n\t\tdescription: string,\n\t\trun: () => Promise<void>,\n\t): Promise<void> {\n\t\tthis.#assertAvailable();\n\t\tthis.#requireHandle();\n\t\tif (this.phase !== \"idle\") {\n\t\t\tthrow new Error(`Cannot ${description} while session is ${this.phase ?? \"unavailable\"}`);\n\t\t}\n\t\tawait this.#runOperation(operation, run);\n\t}\n\n\tasync #runOperation(operation: RemoteSessionOperation, run: () => Promise<void>, preempt = false): Promise<void> {\n\t\tif (preempt) this.#assertNotDisposed();\n\t\telse this.#assertAvailable();\n\t\tconst previous = this.#lifecycle;\n\t\tconst busy: RemoteSessionLifecycle = { status: \"busy\", operation };\n\t\tthis.#lifecycle = busy;\n\t\tthis.#activeOperationStates.add(busy);\n\t\tthis.#notify();\n\t\tconst running = run();\n\t\ttry {\n\t\t\tawait Promise.race([\n\t\t\t\trunning,\n\t\t\t\tthis.#disposeSignal.then(() => {\n\t\t\t\t\tthrow new Error(\"Remote session is disposed\");\n\t\t\t\t}),\n\t\t\t]);\n\t\t} finally {\n\t\t\tthis.#activeOperationStates.delete(busy);\n\t\t\tif (!this.disposed && this.#lifecycle === busy) {\n\t\t\t\tthis.#lifecycle =\n\t\t\t\t\tpreempt && this.#activeOperationStates.has(previous)\n\t\t\t\t\t\t? previous\n\t\t\t\t\t\t: this.#handle\n\t\t\t\t\t\t\t? { status: \"ready\" }\n\t\t\t\t\t\t\t: { status: \"unbound\" };\n\t\t\t\tthis.#notify();\n\t\t\t}\n\t\t}\n\t}\n\n\t#bind(handle: SessionLease, knownSnapshot?: SessionSnapshot): void {\n\t\tconst snapshot = knownSnapshot ?? handle.snapshot;\n\t\tif (!snapshot) throw new Error(`Session ${handle.id} did not provide a snapshot`);\n\t\tthis.#clearSubscriptions();\n\t\tthis.#handle = handle;\n\t\tthis.#transcript = createTranscriptState(snapshot);\n\t\tthis.#unsubscribeSnapshot = handle.subscribe((next) => {\n\t\t\tif (!this.#transcript) return;\n\t\t\tthis.#transcript = applyTranscriptSnapshot(this.#transcript, next);\n\t\t\tthis.#notify();\n\t\t});\n\t\tthis.#unsubscribeEvents = handle.onEvent((event) => this.#handleEvent(event));\n\t}\n\n\t#handleEvent(event: ServerEvent): void {\n\t\tif (event.type === \"session_removed\") {\n\t\t\tthis.#clearSubscriptions();\n\t\t\tthis.#handle = undefined;\n\t\t\tthis.#transcript = undefined;\n\t\t\tif (this.#lifecycle.status !== \"busy\") this.#lifecycle = { status: \"unbound\" };\n\t\t\tthis.#notify();\n\t\t\treturn;\n\t\t}\n\t\tif (event.type !== \"session_progress\" || !this.#transcript) return;\n\t\tthis.#transcript = applyTranscriptProgress(this.#transcript, event.progress);\n\t\tthis.#notify();\n\t}\n\n\t#notify(): void {\n\t\tconst state = this.state;\n\t\tfor (const listener of this.#listeners) this.#callListener(listener, state);\n\t}\n\n\t#callListener(listener: (state: RemoteSessionState) => void, state: RemoteSessionState): void {\n\t\ttry {\n\t\t\tlistener(state);\n\t\t} catch (error) {\n\t\t\tthis.#reportListenerError(error);\n\t\t}\n\t}\n\n\t#reportListenerError(error: unknown): void {\n\t\tif (!this.#onListenerError) return;\n\t\ttry {\n\t\t\tthis.#onListenerError(error instanceof Error ? error : new Error(String(error)));\n\t\t} catch {\n\t\t\t// Diagnostics cannot affect session or transport state.\n\t\t}\n\t}\n\n\t#clearSubscriptions(): void {\n\t\tthis.#unsubscribeSnapshot?.();\n\t\tthis.#unsubscribeEvents?.();\n\t\tthis.#unsubscribeSnapshot = undefined;\n\t\tthis.#unsubscribeEvents = undefined;\n\t}\n\n\t#requireHandle(): SessionLease {\n\t\tif (!this.#handle) throw new Error(\"No remote session is attached\");\n\t\treturn this.#handle;\n\t}\n\n\t#assertAvailable(): void {\n\t\tthis.#assertNotDisposed();\n\t\tif (this.#lifecycle.status === \"busy\") {\n\t\t\tthrow new Error(`Remote session is busy with ${this.#lifecycle.operation}`);\n\t\t}\n\t}\n\n\t#assertNotDisposed(): void {\n\t\tif (this.disposed) throw new Error(\"Remote session is disposed\");\n\t}\n\n\tasync #assertNotDisposedAfterAwait(handle: SessionLease): Promise<void> {\n\t\tif (!this.disposed) return;\n\t\tawait this.#detach(handle);\n\t\tthrow new RemoteSessionDisposedError();\n\t}\n\n\tasync #detach(handle: SessionLease): Promise<void> {\n\t\tawait handle.dispose();\n\t}\n}\n"]}
|