@subimpact/e 0.99.12 → 0.100.1
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 +37 -0
- package/README.md +7 -1
- package/dist/bundle/chunks/anthropic-messages-BGDBSRR2.js +6 -0
- package/dist/bundle/chunks/azure-openai-responses-ZCNWFVTX.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +3 -3
- package/dist/bundle/chunks/chunk-35AZPBGE.js +11 -0
- package/dist/bundle/chunks/{chunk-C47CLQZK.js → chunk-CMZY6PM7.js} +1 -1
- package/dist/bundle/chunks/{chunk-XVIZD2L5.js → chunk-DOSAFY5Y.js} +3 -3
- package/dist/bundle/chunks/{chunk-KAXC2ESR.js → chunk-GICF34HK.js} +8 -8
- package/dist/bundle/chunks/{chunk-GYREDKZT.js → chunk-HKQXO4IQ.js} +1 -1
- package/dist/bundle/chunks/chunk-K4O5WZC5.js +11 -0
- package/dist/bundle/chunks/{chunk-SVKJCAH2.js → chunk-NBSSK56J.js} +1 -1
- package/dist/bundle/chunks/{chunk-XZYVF4BW.js → chunk-RAB4RJZ2.js} +60 -60
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-NHSAQJW5.js → cloudflare-workers-ai-system-one-6FXZDK6A.js} +1 -1
- package/dist/bundle/chunks/{easter-egg-3d-DD22MRM3.js → easter-egg-3d-JQPBRQEU.js} +1 -1
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{google-generative-ai-ON7RPJHF.js → google-generative-ai-VJA5IOK3.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-6YO5GV2H.js → google-vertex-TI6AJXT2.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-NN33SMJ6.js → mistral-conversations-XTWEX6FG.js} +1 -1
- package/dist/bundle/chunks/openai-codex-responses-WGH4GHLE.js +10 -0
- package/dist/bundle/chunks/openai-completions-GXGEEHZH.js +7 -0
- package/dist/bundle/chunks/openai-responses-NLSL5UY4.js +3 -0
- package/dist/bundle/chunks/{typesafe-system-one-PRR5K6CI.js → typesafe-system-one-3OTHQPDL.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-6MDPJKNE.js → virtual-modules-L22CHFWU.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/docs/compaction.md +2 -2
- package/docs/extensions.md +4 -10
- package/docs/message-types.md +2 -4
- package/docs/session-format.md +4 -4
- package/docs/settings.md +1 -1
- package/docs/tui.md +1 -1
- package/examples/extensions/overlay-test.ts +2 -2
- package/package.json +31 -31
- package/dist/bun/cli.d.ts +0 -5
- package/dist/bun/cli.d.ts.map +0 -1
- package/dist/bun/cli.js +0 -5
- package/dist/bun/cli.js.map +0 -1
- package/dist/bun/restore-sandbox-env.d.ts +0 -17
- package/dist/bun/restore-sandbox-env.d.ts.map +0 -1
- package/dist/bun/restore-sandbox-env.js +0 -36
- package/dist/bun/restore-sandbox-env.js.map +0 -1
- package/dist/bun/runtime-setup.d.ts +0 -2
- package/dist/bun/runtime-setup.d.ts.map +0 -1
- package/dist/bun/runtime-setup.js +0 -9
- package/dist/bun/runtime-setup.js.map +0 -1
- package/dist/bun/sandbox-env-setup.d.ts +0 -2
- package/dist/bun/sandbox-env-setup.d.ts.map +0 -1
- package/dist/bun/sandbox-env-setup.js +0 -4
- package/dist/bun/sandbox-env-setup.js.map +0 -1
- package/dist/bundle/chunks/anthropic-messages-EGJT3PY6.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-JEEXH6HK.js +0 -2
- package/dist/bundle/chunks/chunk-IOJUMBW3.js +0 -11
- package/dist/bundle/chunks/chunk-KJUDFE6Y.js +0 -11
- package/dist/bundle/chunks/openai-codex-responses-CPSVXTKM.js +0 -10
- package/dist/bundle/chunks/openai-completions-T7GN33JE.js +0 -7
- package/dist/bundle/chunks/openai-responses-GPE3ZQ46.js +0 -3
- package/dist/cli/args.d.ts +0 -61
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -453
- package/dist/cli/args.js.map +0 -1
- package/dist/cli/auth-check.d.ts +0 -19
- package/dist/cli/auth-check.d.ts.map +0 -1
- package/dist/cli/auth-check.js +0 -50
- package/dist/cli/auth-check.js.map +0 -1
- package/dist/cli/auth-command.d.ts +0 -24
- package/dist/cli/auth-command.d.ts.map +0 -1
- package/dist/cli/auth-command.js +0 -103
- package/dist/cli/auth-command.js.map +0 -1
- package/dist/cli/config-selector.d.ts +0 -16
- package/dist/cli/config-selector.d.ts.map +0 -1
- package/dist/cli/config-selector.js +0 -32
- package/dist/cli/config-selector.js.map +0 -1
- package/dist/cli/credential-print.d.ts +0 -13
- package/dist/cli/credential-print.d.ts.map +0 -1
- package/dist/cli/credential-print.js +0 -76
- package/dist/cli/credential-print.js.map +0 -1
- package/dist/cli/file-processor.d.ts +0 -15
- package/dist/cli/file-processor.d.ts.map +0 -1
- package/dist/cli/file-processor.js +0 -71
- package/dist/cli/file-processor.js.map +0 -1
- package/dist/cli/initial-message.d.ts +0 -18
- package/dist/cli/initial-message.d.ts.map +0 -1
- package/dist/cli/initial-message.js +0 -22
- package/dist/cli/initial-message.js.map +0 -1
- package/dist/cli/list-models.d.ts +0 -9
- package/dist/cli/list-models.d.ts.map +0 -1
- package/dist/cli/list-models.js +0 -98
- package/dist/cli/list-models.js.map +0 -1
- package/dist/cli/project-trust.d.ts +0 -10
- package/dist/cli/project-trust.d.ts.map +0 -1
- package/dist/cli/project-trust.js +0 -48
- package/dist/cli/project-trust.js.map +0 -1
- package/dist/cli/session-picker.d.ts +0 -10
- package/dist/cli/session-picker.d.ts.map +0 -1
- package/dist/cli/session-picker.js +0 -36
- package/dist/cli/session-picker.js.map +0 -1
- package/dist/cli/setup.d.ts +0 -2
- package/dist/cli/setup.d.ts.map +0 -1
- package/dist/cli/setup.js +0 -12
- package/dist/cli/setup.js.map +0 -1
- package/dist/cli/startup-ui.d.ts +0 -20
- package/dist/cli/startup-ui.d.ts.map +0 -1
- package/dist/cli/startup-ui.js +0 -193
- package/dist/cli/startup-ui.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -6
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts +0 -107
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -486
- package/dist/config.js.map +0 -1
- package/dist/core/agent-session-runtime.d.ts +0 -119
- package/dist/core/agent-session-runtime.d.ts.map +0 -1
- package/dist/core/agent-session-runtime.js +0 -317
- package/dist/core/agent-session-runtime.js.map +0 -1
- package/dist/core/agent-session-services.d.ts +0 -86
- package/dist/core/agent-session-services.d.ts.map +0 -1
- package/dist/core/agent-session-services.js +0 -147
- package/dist/core/agent-session-services.js.map +0 -1
- package/dist/core/agent-session.d.ts +0 -881
- package/dist/core/agent-session.d.ts.map +0 -1
- package/dist/core/agent-session.js +0 -3524
- package/dist/core/agent-session.js.map +0 -1
- package/dist/core/auth-guidance.d.ts +0 -5
- package/dist/core/auth-guidance.d.ts.map +0 -1
- package/dist/core/auth-guidance.js +0 -21
- package/dist/core/auth-guidance.js.map +0 -1
- package/dist/core/auth-storage.d.ts +0 -72
- package/dist/core/auth-storage.d.ts.map +0 -1
- package/dist/core/auth-storage.js +0 -426
- package/dist/core/auth-storage.js.map +0 -1
- package/dist/core/bash-executor.d.ts +0 -32
- package/dist/core/bash-executor.d.ts.map +0 -1
- package/dist/core/bash-executor.js +0 -106
- package/dist/core/bash-executor.js.map +0 -1
- package/dist/core/bug-report-upload.d.ts +0 -12
- package/dist/core/bug-report-upload.d.ts.map +0 -1
- package/dist/core/bug-report-upload.js +0 -22
- package/dist/core/bug-report-upload.js.map +0 -1
- package/dist/core/bug-report.d.ts +0 -176
- package/dist/core/bug-report.d.ts.map +0 -1
- package/dist/core/bug-report.js +0 -292
- package/dist/core/bug-report.js.map +0 -1
- package/dist/core/cache-stats.d.ts +0 -49
- package/dist/core/cache-stats.d.ts.map +0 -1
- package/dist/core/cache-stats.js +0 -112
- package/dist/core/cache-stats.js.map +0 -1
- package/dist/core/cache-warmer.d.ts +0 -103
- package/dist/core/cache-warmer.d.ts.map +0 -1
- package/dist/core/cache-warmer.js +0 -359
- package/dist/core/cache-warmer.js.map +0 -1
- package/dist/core/compaction/branch-summarization.d.ts +0 -98
- package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
- package/dist/core/compaction/branch-summarization.js +0 -251
- package/dist/core/compaction/branch-summarization.js.map +0 -1
- package/dist/core/compaction/compaction.d.ts +0 -145
- package/dist/core/compaction/compaction.d.ts.map +0 -1
- package/dist/core/compaction/compaction.js +0 -744
- package/dist/core/compaction/compaction.js.map +0 -1
- package/dist/core/compaction/index.d.ts +0 -7
- package/dist/core/compaction/index.d.ts.map +0 -1
- package/dist/core/compaction/index.js +0 -7
- package/dist/core/compaction/index.js.map +0 -1
- package/dist/core/compaction/utils.d.ts +0 -39
- package/dist/core/compaction/utils.d.ts.map +0 -1
- package/dist/core/compaction/utils.js +0 -149
- package/dist/core/compaction/utils.js.map +0 -1
- package/dist/core/crash-log.d.ts +0 -27
- package/dist/core/crash-log.d.ts.map +0 -1
- package/dist/core/crash-log.js +0 -140
- package/dist/core/crash-log.js.map +0 -1
- package/dist/core/defaults.d.ts +0 -4
- package/dist/core/defaults.d.ts.map +0 -1
- package/dist/core/defaults.js +0 -11
- package/dist/core/defaults.js.map +0 -1
- package/dist/core/diagnostics.d.ts +0 -15
- package/dist/core/diagnostics.d.ts.map +0 -1
- package/dist/core/diagnostics.js +0 -2
- package/dist/core/diagnostics.js.map +0 -1
- package/dist/core/event-bus.d.ts +0 -9
- package/dist/core/event-bus.d.ts.map +0 -1
- package/dist/core/event-bus.js +0 -25
- package/dist/core/event-bus.js.map +0 -1
- package/dist/core/exec.d.ts +0 -29
- package/dist/core/exec.d.ts.map +0 -1
- package/dist/core/exec.js +0 -75
- package/dist/core/exec.js.map +0 -1
- package/dist/core/experimental.d.ts +0 -2
- package/dist/core/experimental.d.ts.map +0 -1
- package/dist/core/experimental.js +0 -6
- package/dist/core/experimental.js.map +0 -1
- package/dist/core/export-html/ansi-to-html.d.ts +0 -22
- package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
- package/dist/core/export-html/ansi-to-html.js +0 -249
- package/dist/core/export-html/ansi-to-html.js.map +0 -1
- package/dist/core/export-html/index.d.ts +0 -37
- package/dist/core/export-html/index.d.ts.map +0 -1
- package/dist/core/export-html/index.js +0 -226
- package/dist/core/export-html/index.js.map +0 -1
- package/dist/core/export-html/tool-renderer.d.ts +0 -34
- package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
- package/dist/core/export-html/tool-renderer.js +0 -109
- package/dist/core/export-html/tool-renderer.js.map +0 -1
- package/dist/core/extensions/index.d.ts +0 -12
- package/dist/core/extensions/index.d.ts.map +0 -1
- package/dist/core/extensions/index.js +0 -9
- package/dist/core/extensions/index.js.map +0 -1
- package/dist/core/extensions/jiti-loader.d.ts +0 -2
- package/dist/core/extensions/jiti-loader.d.ts.map +0 -1
- package/dist/core/extensions/jiti-loader.js +0 -4
- package/dist/core/extensions/jiti-loader.js.map +0 -1
- package/dist/core/extensions/jiti-static-loader.d.ts +0 -2
- package/dist/core/extensions/jiti-static-loader.d.ts.map +0 -1
- package/dist/core/extensions/jiti-static-loader.js +0 -4
- package/dist/core/extensions/jiti-static-loader.js.map +0 -1
- package/dist/core/extensions/loader.d.ts +0 -23
- package/dist/core/extensions/loader.d.ts.map +0 -1
- package/dist/core/extensions/loader.js +0 -667
- package/dist/core/extensions/loader.js.map +0 -1
- package/dist/core/extensions/runner.d.ts +0 -204
- package/dist/core/extensions/runner.d.ts.map +0 -1
- package/dist/core/extensions/runner.js +0 -1207
- package/dist/core/extensions/runner.js.map +0 -1
- package/dist/core/extensions/types.d.ts +0 -1669
- package/dist/core/extensions/types.d.ts.map +0 -1
- package/dist/core/extensions/types.js +0 -48
- package/dist/core/extensions/types.js.map +0 -1
- package/dist/core/extensions/virtual-modules.d.ts +0 -3
- package/dist/core/extensions/virtual-modules.d.ts.map +0 -1
- package/dist/core/extensions/virtual-modules.js +0 -38
- package/dist/core/extensions/virtual-modules.js.map +0 -1
- package/dist/core/extensions/wrapper.d.ts +0 -20
- package/dist/core/extensions/wrapper.d.ts.map +0 -1
- package/dist/core/extensions/wrapper.js +0 -22
- package/dist/core/extensions/wrapper.js.map +0 -1
- package/dist/core/footer-data-provider.d.ts +0 -64
- package/dist/core/footer-data-provider.d.ts.map +0 -1
- package/dist/core/footer-data-provider.js +0 -338
- package/dist/core/footer-data-provider.js.map +0 -1
- package/dist/core/http-dispatcher.d.ts +0 -22
- package/dist/core/http-dispatcher.d.ts.map +0 -1
- package/dist/core/http-dispatcher.js +0 -98
- package/dist/core/http-dispatcher.js.map +0 -1
- package/dist/core/index.d.ts +0 -14
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -13
- package/dist/core/index.js.map +0 -1
- package/dist/core/keybindings.d.ts +0 -428
- package/dist/core/keybindings.d.ts.map +0 -1
- package/dist/core/keybindings.js +0 -321
- package/dist/core/keybindings.js.map +0 -1
- package/dist/core/messages.d.ts +0 -77
- package/dist/core/messages.d.ts.map +0 -1
- package/dist/core/messages.js +0 -124
- package/dist/core/messages.js.map +0 -1
- package/dist/core/model-config.d.ts +0 -760
- package/dist/core/model-config.d.ts.map +0 -1
- package/dist/core/model-config.js +0 -294
- package/dist/core/model-config.js.map +0 -1
- package/dist/core/model-registry.d.ts +0 -61
- package/dist/core/model-registry.d.ts.map +0 -1
- package/dist/core/model-registry.js +0 -140
- package/dist/core/model-registry.js.map +0 -1
- package/dist/core/model-resolver.d.ts +0 -124
- package/dist/core/model-resolver.d.ts.map +0 -1
- package/dist/core/model-resolver.js +0 -590
- package/dist/core/model-resolver.js.map +0 -1
- package/dist/core/model-runtime.d.ts +0 -145
- package/dist/core/model-runtime.d.ts.map +0 -1
- package/dist/core/model-runtime.js +0 -758
- package/dist/core/model-runtime.js.map +0 -1
- package/dist/core/models-store.d.ts +0 -22
- package/dist/core/models-store.d.ts.map +0 -1
- package/dist/core/models-store.js +0 -115
- package/dist/core/models-store.js.map +0 -1
- package/dist/core/nested-tool-calls.d.ts +0 -102
- package/dist/core/nested-tool-calls.d.ts.map +0 -1
- package/dist/core/nested-tool-calls.js +0 -178
- package/dist/core/nested-tool-calls.js.map +0 -1
- package/dist/core/output-guard.d.ts +0 -7
- package/dist/core/output-guard.d.ts.map +0 -1
- package/dist/core/output-guard.js +0 -89
- package/dist/core/output-guard.js.map +0 -1
- package/dist/core/package-manager.d.ts +0 -217
- package/dist/core/package-manager.d.ts.map +0 -1
- package/dist/core/package-manager.js +0 -2224
- package/dist/core/package-manager.js.map +0 -1
- package/dist/core/pi-manifest.d.ts +0 -8
- package/dist/core/pi-manifest.d.ts.map +0 -1
- package/dist/core/pi-manifest.js +0 -26
- package/dist/core/pi-manifest.js.map +0 -1
- package/dist/core/project-trust.d.ts +0 -15
- package/dist/core/project-trust.d.ts.map +0 -1
- package/dist/core/project-trust.js +0 -59
- package/dist/core/project-trust.js.map +0 -1
- package/dist/core/prompt-templates.d.ts +0 -59
- package/dist/core/prompt-templates.d.ts.map +0 -1
- package/dist/core/prompt-templates.js +0 -262
- package/dist/core/prompt-templates.js.map +0 -1
- package/dist/core/provider-attribution.d.ts +0 -4
- package/dist/core/provider-attribution.d.ts.map +0 -1
- package/dist/core/provider-attribution.js +0 -72
- package/dist/core/provider-attribution.js.map +0 -1
- package/dist/core/provider-composer.d.ts +0 -80
- package/dist/core/provider-composer.d.ts.map +0 -1
- package/dist/core/provider-composer.js +0 -488
- package/dist/core/provider-composer.js.map +0 -1
- package/dist/core/radius.d.ts +0 -5
- package/dist/core/radius.d.ts.map +0 -1
- package/dist/core/radius.js +0 -9
- package/dist/core/radius.js.map +0 -1
- package/dist/core/remote-catalog-provider.d.ts +0 -12
- package/dist/core/remote-catalog-provider.d.ts.map +0 -1
- package/dist/core/remote-catalog-provider.js +0 -132
- package/dist/core/remote-catalog-provider.js.map +0 -1
- package/dist/core/resolve-config-value.d.ts +0 -30
- package/dist/core/resolve-config-value.d.ts.map +0 -1
- package/dist/core/resolve-config-value.js +0 -247
- package/dist/core/resolve-config-value.js.map +0 -1
- package/dist/core/resource-loader.d.ts +0 -227
- package/dist/core/resource-loader.d.ts.map +0 -1
- package/dist/core/resource-loader.js +0 -1008
- package/dist/core/resource-loader.js.map +0 -1
- package/dist/core/runtime-credentials.d.ts +0 -15
- package/dist/core/runtime-credentials.d.ts.map +0 -1
- package/dist/core/runtime-credentials.js +0 -39
- package/dist/core/runtime-credentials.js.map +0 -1
- package/dist/core/sdk.d.ts +0 -108
- package/dist/core/sdk.d.ts.map +0 -1
- package/dist/core/sdk.js +0 -315
- package/dist/core/sdk.js.map +0 -1
- package/dist/core/session-cwd.d.ts +0 -19
- package/dist/core/session-cwd.d.ts.map +0 -1
- package/dist/core/session-cwd.js +0 -38
- package/dist/core/session-cwd.js.map +0 -1
- package/dist/core/session-export.d.ts +0 -8
- package/dist/core/session-export.d.ts.map +0 -1
- package/dist/core/session-export.js +0 -33
- package/dist/core/session-export.js.map +0 -1
- package/dist/core/session-manager.d.ts +0 -416
- package/dist/core/session-manager.d.ts.map +0 -1
- package/dist/core/session-manager.js +0 -1523
- package/dist/core/session-manager.js.map +0 -1
- package/dist/core/settings-diagnostics.d.ts +0 -9
- package/dist/core/settings-diagnostics.d.ts.map +0 -1
- package/dist/core/settings-diagnostics.js +0 -21
- package/dist/core/settings-diagnostics.js.map +0 -1
- package/dist/core/settings-manager.d.ts +0 -362
- package/dist/core/settings-manager.d.ts.map +0 -1
- package/dist/core/settings-manager.js +0 -1107
- package/dist/core/settings-manager.js.map +0 -1
- package/dist/core/skills.d.ts +0 -60
- package/dist/core/skills.d.ts.map +0 -1
- package/dist/core/skills.js +0 -407
- package/dist/core/skills.js.map +0 -1
- package/dist/core/slash-commands.d.ts +0 -15
- package/dist/core/slash-commands.d.ts.map +0 -1
- package/dist/core/slash-commands.js +0 -28
- package/dist/core/slash-commands.js.map +0 -1
- package/dist/core/source-info.d.ts +0 -26
- package/dist/core/source-info.d.ts.map +0 -1
- package/dist/core/source-info.js +0 -35
- package/dist/core/source-info.js.map +0 -1
- package/dist/core/system-prompt.d.ts +0 -71
- package/dist/core/system-prompt.d.ts.map +0 -1
- package/dist/core/system-prompt.js +0 -147
- package/dist/core/system-prompt.js.map +0 -1
- package/dist/core/telemetry.d.ts +0 -3
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js +0 -10
- package/dist/core/telemetry.js.map +0 -1
- package/dist/core/timings.d.ts +0 -6
- package/dist/core/timings.d.ts.map +0 -1
- package/dist/core/timings.js +0 -42
- package/dist/core/timings.js.map +0 -1
- package/dist/core/tools/bash.d.ts +0 -101
- package/dist/core/tools/bash.d.ts.map +0 -1
- package/dist/core/tools/bash.js +0 -348
- package/dist/core/tools/bash.js.map +0 -1
- package/dist/core/tools/edit-diff.d.ts +0 -101
- package/dist/core/tools/edit-diff.d.ts.map +0 -1
- package/dist/core/tools/edit-diff.js +0 -421
- package/dist/core/tools/edit-diff.js.map +0 -1
- package/dist/core/tools/edit.d.ts +0 -44
- package/dist/core/tools/edit.d.ts.map +0 -1
- package/dist/core/tools/edit.js +0 -147
- package/dist/core/tools/edit.js.map +0 -1
- package/dist/core/tools/file-mutation-queue.d.ts +0 -6
- package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
- package/dist/core/tools/file-mutation-queue.js +0 -52
- package/dist/core/tools/file-mutation-queue.js.map +0 -1
- package/dist/core/tools/find.d.ts +0 -42
- package/dist/core/tools/find.d.ts.map +0 -1
- package/dist/core/tools/find.js +0 -251
- package/dist/core/tools/find.js.map +0 -1
- package/dist/core/tools/grep.d.ts +0 -41
- package/dist/core/tools/grep.d.ts.map +0 -1
- package/dist/core/tools/grep.js +0 -252
- package/dist/core/tools/grep.js.map +0 -1
- package/dist/core/tools/index.d.ts +0 -43
- package/dist/core/tools/index.d.ts.map +0 -1
- package/dist/core/tools/index.js +0 -129
- package/dist/core/tools/index.js.map +0 -1
- package/dist/core/tools/ls.d.ts +0 -41
- package/dist/core/tools/ls.d.ts.map +0 -1
- package/dist/core/tools/ls.js +0 -126
- package/dist/core/tools/ls.js.map +0 -1
- package/dist/core/tools/output-accumulator.d.ts +0 -63
- package/dist/core/tools/output-accumulator.d.ts.map +0 -1
- package/dist/core/tools/output-accumulator.js +0 -220
- package/dist/core/tools/output-accumulator.js.map +0 -1
- package/dist/core/tools/path-utils.d.ts +0 -10
- package/dist/core/tools/path-utils.d.ts.map +0 -1
- package/dist/core/tools/path-utils.js +0 -99
- package/dist/core/tools/path-utils.js.map +0 -1
- package/dist/core/tools/powershell.d.ts +0 -16
- package/dist/core/tools/powershell.d.ts.map +0 -1
- package/dist/core/tools/powershell.js +0 -39
- package/dist/core/tools/powershell.js.map +0 -1
- package/dist/core/tools/read.d.ts +0 -42
- package/dist/core/tools/read.d.ts.map +0 -1
- package/dist/core/tools/read.js +0 -169
- package/dist/core/tools/read.js.map +0 -1
- package/dist/core/tools/render-utils.d.ts +0 -30
- package/dist/core/tools/render-utils.d.ts.map +0 -1
- package/dist/core/tools/render-utils.js +0 -91
- package/dist/core/tools/render-utils.js.map +0 -1
- package/dist/core/tools/renderers/bash.d.ts +0 -12
- package/dist/core/tools/renderers/bash.d.ts.map +0 -1
- package/dist/core/tools/renderers/bash.js +0 -117
- package/dist/core/tools/renderers/bash.js.map +0 -1
- package/dist/core/tools/renderers/edit.d.ts +0 -23
- package/dist/core/tools/renderers/edit.d.ts.map +0 -1
- package/dist/core/tools/renderers/edit.js +0 -168
- package/dist/core/tools/renderers/edit.js.map +0 -1
- package/dist/core/tools/renderers/find.d.ts +0 -10
- package/dist/core/tools/renderers/find.d.ts.map +0 -1
- package/dist/core/tools/renderers/find.js +0 -64
- package/dist/core/tools/renderers/find.js.map +0 -1
- package/dist/core/tools/renderers/grep.d.ts +0 -10
- package/dist/core/tools/renderers/grep.d.ts.map +0 -1
- package/dist/core/tools/renderers/grep.js +0 -69
- package/dist/core/tools/renderers/grep.js.map +0 -1
- package/dist/core/tools/renderers/index.d.ts +0 -28
- package/dist/core/tools/renderers/index.d.ts.map +0 -1
- package/dist/core/tools/renderers/index.js +0 -47
- package/dist/core/tools/renderers/index.js.map +0 -1
- package/dist/core/tools/renderers/ls.d.ts +0 -10
- package/dist/core/tools/renderers/ls.d.ts.map +0 -1
- package/dist/core/tools/renderers/ls.js +0 -58
- package/dist/core/tools/renderers/ls.js.map +0 -1
- package/dist/core/tools/renderers/read.d.ts +0 -11
- package/dist/core/tools/renderers/read.d.ts.map +0 -1
- package/dist/core/tools/renderers/read.js +0 -130
- package/dist/core/tools/renderers/read.js.map +0 -1
- package/dist/core/tools/renderers/write.d.ts +0 -10
- package/dist/core/tools/renderers/write.d.ts.map +0 -1
- package/dist/core/tools/renderers/write.js +0 -153
- package/dist/core/tools/renderers/write.js.map +0 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts +0 -16
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
- package/dist/core/tools/tool-definition-wrapper.js +0 -38
- package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
- package/dist/core/tools/truncate.d.ts +0 -84
- package/dist/core/tools/truncate.d.ts.map +0 -1
- package/dist/core/tools/truncate.js +0 -244
- package/dist/core/tools/truncate.js.map +0 -1
- package/dist/core/tools/write.d.ts +0 -30
- package/dist/core/tools/write.d.ts.map +0 -1
- package/dist/core/tools/write.js +0 -61
- package/dist/core/tools/write.js.map +0 -1
- package/dist/core/trust-manager.d.ts +0 -36
- package/dist/core/trust-manager.d.ts.map +0 -1
- package/dist/core/trust-manager.js +0 -203
- package/dist/core/trust-manager.js.map +0 -1
- package/dist/core/usage-totals.d.ts +0 -21
- package/dist/core/usage-totals.d.ts.map +0 -1
- package/dist/core/usage-totals.js +0 -79
- package/dist/core/usage-totals.js.map +0 -1
- package/dist/core/virtual-models.d.ts +0 -117
- package/dist/core/virtual-models.d.ts.map +0 -1
- package/dist/core/virtual-models.js +0 -124
- package/dist/core/virtual-models.js.map +0 -1
- package/dist/extensions/index.d.ts +0 -3
- package/dist/extensions/index.d.ts.map +0 -1
- package/dist/extensions/index.js +0 -3
- package/dist/extensions/index.js.map +0 -1
- package/dist/extensions/llama/client.d.ts +0 -69
- package/dist/extensions/llama/client.d.ts.map +0 -1
- package/dist/extensions/llama/client.js +0 -313
- package/dist/extensions/llama/client.js.map +0 -1
- package/dist/extensions/llama/huggingface.d.ts +0 -23
- package/dist/extensions/llama/huggingface.d.ts.map +0 -1
- package/dist/extensions/llama/huggingface.js +0 -141
- package/dist/extensions/llama/huggingface.js.map +0 -1
- package/dist/extensions/llama/index.d.ts +0 -3
- package/dist/extensions/llama/index.d.ts.map +0 -1
- package/dist/extensions/llama/index.js +0 -219
- package/dist/extensions/llama/index.js.map +0 -1
- package/dist/extensions/llama/provider.d.ts +0 -12
- package/dist/extensions/llama/provider.d.ts.map +0 -1
- package/dist/extensions/llama/provider.js +0 -213
- package/dist/extensions/llama/provider.js.map +0 -1
- package/dist/extensions/llama/ui.d.ts +0 -42
- package/dist/extensions/llama/ui.d.ts.map +0 -1
- package/dist/extensions/llama/ui.js +0 -416
- package/dist/extensions/llama/ui.js.map +0 -1
- package/dist/index.d.ts +0 -38
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -49
- package/dist/index.js.map +0 -1
- package/dist/main.d.ts +0 -16
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js +0 -819
- package/dist/main.js.map +0 -1
- package/dist/migrations.d.ts +0 -33
- package/dist/migrations.d.ts.map +0 -1
- package/dist/migrations.js +0 -282
- package/dist/migrations.js.map +0 -1
- package/dist/modes/index.d.ts +0 -10
- package/dist/modes/index.d.ts.map +0 -1
- package/dist/modes/index.js +0 -8
- package/dist/modes/index.js.map +0 -1
- package/dist/modes/interactive/bug-report.d.ts +0 -16
- package/dist/modes/interactive/bug-report.d.ts.map +0 -1
- package/dist/modes/interactive/bug-report.js +0 -210
- package/dist/modes/interactive/bug-report.js.map +0 -1
- package/dist/modes/interactive/chat-viewport.d.ts +0 -20
- package/dist/modes/interactive/chat-viewport.d.ts.map +0 -1
- package/dist/modes/interactive/chat-viewport.js +0 -28
- package/dist/modes/interactive/chat-viewport.js.map +0 -1
- package/dist/modes/interactive/components/armin.d.ts +0 -37
- package/dist/modes/interactive/components/armin.d.ts.map +0 -1
- package/dist/modes/interactive/components/armin.js +0 -335
- package/dist/modes/interactive/components/armin.js.map +0 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +0 -26
- package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/assistant-message.js +0 -158
- package/dist/modes/interactive/components/assistant-message.js.map +0 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +0 -38
- package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
- package/dist/modes/interactive/components/bash-execution.js +0 -178
- package/dist/modes/interactive/components/bash-execution.js.map +0 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
- package/dist/modes/interactive/components/bordered-loader.js +0 -54
- package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -17
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/branch-summary-message.js +0 -54
- package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -17
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +0 -55
- package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
- package/dist/modes/interactive/components/config-selector.d.ts +0 -102
- package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/config-selector.js +0 -771
- package/dist/modes/interactive/components/config-selector.js.map +0 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
- package/dist/modes/interactive/components/countdown-timer.js +0 -33
- package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +0 -30
- package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-editor.js +0 -115
- package/dist/modes/interactive/components/custom-editor.js.map +0 -1
- package/dist/modes/interactive/components/custom-entry.d.ts +0 -21
- package/dist/modes/interactive/components/custom-entry.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-entry.js +0 -58
- package/dist/modes/interactive/components/custom-entry.js.map +0 -1
- package/dist/modes/interactive/components/custom-message.d.ts +0 -22
- package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-message.js +0 -88
- package/dist/modes/interactive/components/custom-message.js.map +0 -1
- package/dist/modes/interactive/components/diff.d.ts +0 -12
- package/dist/modes/interactive/components/diff.d.ts.map +0 -1
- package/dist/modes/interactive/components/diff.js +0 -133
- package/dist/modes/interactive/components/diff.js.map +0 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
- package/dist/modes/interactive/components/dynamic-border.js +0 -21
- package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
- package/dist/modes/interactive/components/e-logo.d.ts +0 -16
- package/dist/modes/interactive/components/e-logo.d.ts.map +0 -1
- package/dist/modes/interactive/components/e-logo.js +0 -29
- package/dist/modes/interactive/components/e-logo.js.map +0 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -5
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
- package/dist/modes/interactive/components/earendil-announcement.js +0 -40
- package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
- package/dist/modes/interactive/components/easter-egg-3d.d.ts +0 -104
- package/dist/modes/interactive/components/easter-egg-3d.d.ts.map +0 -1
- package/dist/modes/interactive/components/easter-egg-3d.js +0 -1138
- package/dist/modes/interactive/components/easter-egg-3d.js.map +0 -1
- package/dist/modes/interactive/components/easter-egg-3d.lazy.d.ts +0 -6
- package/dist/modes/interactive/components/easter-egg-3d.lazy.d.ts.map +0 -1
- package/dist/modes/interactive/components/easter-egg-3d.lazy.js +0 -23
- package/dist/modes/interactive/components/easter-egg-3d.lazy.js.map +0 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +0 -24
- package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-editor.js +0 -103
- package/dist/modes/interactive/components/extension-editor.js.map +0 -1
- package/dist/modes/interactive/components/extension-input.d.ts +0 -25
- package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-input.js +0 -67
- package/dist/modes/interactive/components/extension-input.js.map +0 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +0 -27
- package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-selector.js +0 -87
- package/dist/modes/interactive/components/extension-selector.js.map +0 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +0 -25
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +0 -1
- package/dist/modes/interactive/components/first-time-setup.js +0 -109
- package/dist/modes/interactive/components/first-time-setup.js.map +0 -1
- package/dist/modes/interactive/components/footer.d.ts +0 -39
- package/dist/modes/interactive/components/footer.d.ts.map +0 -1
- package/dist/modes/interactive/components/footer.js +0 -265
- package/dist/modes/interactive/components/footer.js.map +0 -1
- package/dist/modes/interactive/components/index.d.ts +0 -33
- package/dist/modes/interactive/components/index.d.ts.map +0 -1
- package/dist/modes/interactive/components/index.js +0 -34
- package/dist/modes/interactive/components/index.js.map +0 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -13
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
- package/dist/modes/interactive/components/keybinding-hints.js +0 -36
- package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +0 -52
- package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
- package/dist/modes/interactive/components/login-dialog.js +0 -188
- package/dist/modes/interactive/components/login-dialog.js.map +0 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts +0 -3
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +0 -1
- package/dist/modes/interactive/components/markdown-transform.js +0 -19
- package/dist/modes/interactive/components/markdown-transform.js.map +0 -1
- package/dist/modes/interactive/components/mermaid.d.ts +0 -11
- package/dist/modes/interactive/components/mermaid.d.ts.map +0 -1
- package/dist/modes/interactive/components/mermaid.js +0 -75
- package/dist/modes/interactive/components/mermaid.js.map +0 -1
- package/dist/modes/interactive/components/model-selector.d.ts +0 -60
- package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/model-selector.js +0 -361
- package/dist/modes/interactive/components/model-selector.js.map +0 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +0 -33
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/oauth-selector.js +0 -163
- package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -46
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +0 -326
- package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
- package/dist/modes/interactive/components/session-selector-search.js +0 -155
- package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
- package/dist/modes/interactive/components/session-selector.d.ts +0 -95
- package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/session-selector.js +0 -893
- package/dist/modes/interactive/components/session-selector.js.map +0 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +0 -96
- package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/settings-selector.js +0 -742
- package/dist/modes/interactive/components/settings-selector.js.map +0 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts +0 -72
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +0 -1
- package/dist/modes/interactive/components/settings-submenu.js +0 -165
- package/dist/modes/interactive/components/settings-submenu.js.map +0 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/show-images-selector.js +0 -39
- package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -18
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +0 -57
- package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +0 -30
- package/dist/modes/interactive/components/status-indicator.d.ts.map +0 -1
- package/dist/modes/interactive/components/status-indicator.js +0 -67
- package/dist/modes/interactive/components/status-indicator.js.map +0 -1
- package/dist/modes/interactive/components/theme-selector.d.ts +0 -11
- package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/theme-selector.js +0 -50
- package/dist/modes/interactive/components/theme-selector.js.map +0 -1
- package/dist/modes/interactive/components/themed-text.d.ts +0 -17
- package/dist/modes/interactive/components/themed-text.d.ts.map +0 -1
- package/dist/modes/interactive/components/themed-text.js +0 -29
- package/dist/modes/interactive/components/themed-text.js.map +0 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts +0 -23
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/thinking-selector.js +0 -109
- package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +0 -83
- package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
- package/dist/modes/interactive/components/tool-execution.js +0 -323
- package/dist/modes/interactive/components/tool-execution.js.map +0 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +0 -94
- package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/tree-selector.js +0 -1254
- package/dist/modes/interactive/components/tree-selector.js.map +0 -1
- package/dist/modes/interactive/components/trust-selector.d.ts +0 -23
- package/dist/modes/interactive/components/trust-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/trust-selector.js +0 -91
- package/dist/modes/interactive/components/trust-selector.js.map +0 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/user-message-selector.js +0 -114
- package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
- package/dist/modes/interactive/components/user-message.d.ts +0 -16
- package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/user-message.js +0 -50
- package/dist/modes/interactive/components/user-message.js.map +0 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +0 -48
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
- package/dist/modes/interactive/components/visual-truncate.js +0 -66
- package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
- package/dist/modes/interactive/external-editor.d.ts +0 -12
- package/dist/modes/interactive/external-editor.d.ts.map +0 -1
- package/dist/modes/interactive/external-editor.js +0 -38
- package/dist/modes/interactive/external-editor.js.map +0 -1
- package/dist/modes/interactive/interactive-mode.d.ts +0 -470
- package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
- package/dist/modes/interactive/interactive-mode.js +0 -5795
- package/dist/modes/interactive/interactive-mode.js.map +0 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts +0 -7
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +0 -1
- package/dist/modes/interactive/model-catalog-refresh.js +0 -34
- package/dist/modes/interactive/model-catalog-refresh.js.map +0 -1
- package/dist/modes/interactive/model-search.d.ts +0 -12
- package/dist/modes/interactive/model-search.d.ts.map +0 -1
- package/dist/modes/interactive/model-search.js +0 -15
- package/dist/modes/interactive/model-search.js.map +0 -1
- package/dist/modes/interactive/session-share.d.ts +0 -18
- package/dist/modes/interactive/session-share.d.ts.map +0 -1
- package/dist/modes/interactive/session-share.js +0 -188
- package/dist/modes/interactive/session-share.js.map +0 -1
- package/dist/modes/interactive/theme/system-theme.d.ts +0 -55
- package/dist/modes/interactive/theme/system-theme.d.ts.map +0 -1
- package/dist/modes/interactive/theme/system-theme.js +0 -546
- package/dist/modes/interactive/theme/system-theme.js.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +0 -81
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.js +0 -210
- package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +0 -85
- package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-json.js +0 -132
- package/dist/modes/interactive/theme/theme-json.js.map +0 -1
- package/dist/modes/interactive/theme/theme.d.ts +0 -158
- package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme.js +0 -913
- package/dist/modes/interactive/theme/theme.js.map +0 -1
- package/dist/modes/interactive/tui-renderer.d.ts +0 -22
- package/dist/modes/interactive/tui-renderer.d.ts.map +0 -1
- package/dist/modes/interactive/tui-renderer.js +0 -67
- package/dist/modes/interactive/tui-renderer.js.map +0 -1
- package/dist/modes/json-event.d.ts +0 -34
- package/dist/modes/json-event.d.ts.map +0 -1
- package/dist/modes/json-event.js +0 -29
- package/dist/modes/json-event.js.map +0 -1
- package/dist/modes/print-mode.d.ts +0 -28
- package/dist/modes/print-mode.d.ts.map +0 -1
- package/dist/modes/print-mode.js +0 -142
- package/dist/modes/print-mode.js.map +0 -1
- package/dist/modes/rpc/jsonl.d.ts +0 -17
- package/dist/modes/rpc/jsonl.d.ts.map +0 -1
- package/dist/modes/rpc/jsonl.js +0 -49
- package/dist/modes/rpc/jsonl.js.map +0 -1
- package/dist/modes/rpc/rpc-client.d.ts +0 -254
- package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
- package/dist/modes/rpc/rpc-client.js +0 -499
- package/dist/modes/rpc/rpc-client.js.map +0 -1
- package/dist/modes/rpc/rpc-mode.d.ts +0 -20
- package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
- package/dist/modes/rpc/rpc-mode.js +0 -655
- package/dist/modes/rpc/rpc-mode.js.map +0 -1
- package/dist/modes/rpc/rpc-types.d.ts +0 -478
- package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
- package/dist/modes/rpc/rpc-types.js +0 -8
- package/dist/modes/rpc/rpc-types.js.map +0 -1
- package/dist/package-manager-cli.d.ts +0 -9
- package/dist/package-manager-cli.d.ts.map +0 -1
- package/dist/package-manager-cli.js +0 -1000
- package/dist/package-manager-cli.js.map +0 -1
- package/dist/rpc-entry.d.ts +0 -3
- package/dist/rpc-entry.d.ts.map +0 -1
- package/dist/rpc-entry.js +0 -11
- package/dist/rpc-entry.js.map +0 -1
- package/dist/utils/abort.d.ts +0 -5
- package/dist/utils/abort.d.ts.map +0 -1
- package/dist/utils/abort.js +0 -48
- package/dist/utils/abort.js.map +0 -1
- package/dist/utils/ansi.d.ts +0 -10
- package/dist/utils/ansi.d.ts.map +0 -1
- package/dist/utils/ansi.js +0 -71
- package/dist/utils/ansi.js.map +0 -1
- package/dist/utils/changelog.d.ts +0 -22
- package/dist/utils/changelog.d.ts.map +0 -1
- package/dist/utils/changelog.js +0 -165
- package/dist/utils/changelog.js.map +0 -1
- package/dist/utils/child-process.d.ts +0 -18
- package/dist/utils/child-process.d.ts.map +0 -1
- package/dist/utils/child-process.js +0 -106
- package/dist/utils/child-process.js.map +0 -1
- package/dist/utils/clipboard-command.d.ts +0 -7
- package/dist/utils/clipboard-command.d.ts.map +0 -1
- package/dist/utils/clipboard-command.js +0 -45
- package/dist/utils/clipboard-command.js.map +0 -1
- package/dist/utils/clipboard-image.d.ts +0 -11
- package/dist/utils/clipboard-image.d.ts.map +0 -1
- package/dist/utils/clipboard-image.js +0 -214
- package/dist/utils/clipboard-image.js.map +0 -1
- package/dist/utils/clipboard.d.ts +0 -6
- package/dist/utils/clipboard.d.ts.map +0 -1
- package/dist/utils/clipboard.js +0 -157
- package/dist/utils/clipboard.js.map +0 -1
- package/dist/utils/deprecation.d.ts +0 -4
- package/dist/utils/deprecation.d.ts.map +0 -1
- package/dist/utils/deprecation.js +0 -13
- package/dist/utils/deprecation.js.map +0 -1
- package/dist/utils/exif-orientation.d.ts +0 -5
- package/dist/utils/exif-orientation.d.ts.map +0 -1
- package/dist/utils/exif-orientation.js +0 -157
- package/dist/utils/exif-orientation.js.map +0 -1
- package/dist/utils/frontmatter.d.ts +0 -8
- package/dist/utils/frontmatter.d.ts.map +0 -1
- package/dist/utils/frontmatter.js +0 -27
- package/dist/utils/frontmatter.js.map +0 -1
- package/dist/utils/fs-watch.d.ts +0 -5
- package/dist/utils/fs-watch.d.ts.map +0 -1
- package/dist/utils/fs-watch.js +0 -25
- package/dist/utils/fs-watch.js.map +0 -1
- package/dist/utils/git.d.ts +0 -26
- package/dist/utils/git.d.ts.map +0 -1
- package/dist/utils/git.js +0 -195
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/html.d.ts +0 -7
- package/dist/utils/html.d.ts.map +0 -1
- package/dist/utils/html.js +0 -40
- package/dist/utils/html.js.map +0 -1
- package/dist/utils/image-convert.d.ts +0 -22
- package/dist/utils/image-convert.d.ts.map +0 -1
- package/dist/utils/image-convert.js +0 -84
- package/dist/utils/image-convert.js.map +0 -1
- package/dist/utils/image-process.d.ts +0 -18
- package/dist/utils/image-process.d.ts.map +0 -1
- package/dist/utils/image-process.js +0 -83
- package/dist/utils/image-process.js.map +0 -1
- package/dist/utils/image-resize-core.d.ts +0 -42
- package/dist/utils/image-resize-core.d.ts.map +0 -1
- package/dist/utils/image-resize-core.js +0 -129
- package/dist/utils/image-resize-core.js.map +0 -1
- package/dist/utils/image-resize-worker.d.ts +0 -2
- package/dist/utils/image-resize-worker.d.ts.map +0 -1
- package/dist/utils/image-resize-worker.js +0 -32
- package/dist/utils/image-resize-worker.js.map +0 -1
- package/dist/utils/image-resize.d.ts +0 -16
- package/dist/utils/image-resize.d.ts.map +0 -1
- package/dist/utils/image-resize.js +0 -96
- package/dist/utils/image-resize.js.map +0 -1
- package/dist/utils/json.d.ts +0 -3
- package/dist/utils/json.d.ts.map +0 -1
- package/dist/utils/json.js +0 -7
- package/dist/utils/json.js.map +0 -1
- package/dist/utils/management-http.d.ts +0 -25
- package/dist/utils/management-http.d.ts.map +0 -1
- package/dist/utils/management-http.js +0 -54
- package/dist/utils/management-http.js.map +0 -1
- package/dist/utils/mime.d.ts +0 -3
- package/dist/utils/mime.d.ts.map +0 -1
- package/dist/utils/mime.js +0 -110
- package/dist/utils/mime.js.map +0 -1
- package/dist/utils/open-browser.d.ts +0 -9
- package/dist/utils/open-browser.d.ts.map +0 -1
- package/dist/utils/open-browser.js +0 -22
- package/dist/utils/open-browser.js.map +0 -1
- package/dist/utils/paths.d.ts +0 -34
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/paths.js +0 -115
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/photon.d.ts +0 -21
- package/dist/utils/photon.d.ts.map +0 -1
- package/dist/utils/photon.js +0 -121
- package/dist/utils/photon.js.map +0 -1
- package/dist/utils/pi-user-agent.d.ts +0 -2
- package/dist/utils/pi-user-agent.d.ts.map +0 -1
- package/dist/utils/pi-user-agent.js +0 -5
- package/dist/utils/pi-user-agent.js.map +0 -1
- package/dist/utils/shell.d.ts +0 -32
- package/dist/utils/shell.d.ts.map +0 -1
- package/dist/utils/shell.js +0 -189
- package/dist/utils/shell.js.map +0 -1
- package/dist/utils/sleep.d.ts +0 -5
- package/dist/utils/sleep.d.ts.map +0 -1
- package/dist/utils/sleep.js +0 -17
- package/dist/utils/sleep.js.map +0 -1
- package/dist/utils/syntax-highlight.d.ts +0 -13
- package/dist/utils/syntax-highlight.d.ts.map +0 -1
- package/dist/utils/syntax-highlight.js +0 -184
- package/dist/utils/syntax-highlight.js.map +0 -1
- package/dist/utils/text.d.ts +0 -8
- package/dist/utils/text.d.ts.map +0 -1
- package/dist/utils/text.js +0 -9
- package/dist/utils/text.js.map +0 -1
- package/dist/utils/tool-result-images.d.ts +0 -21
- package/dist/utils/tool-result-images.d.ts.map +0 -1
- package/dist/utils/tool-result-images.js +0 -48
- package/dist/utils/tool-result-images.js.map +0 -1
- package/dist/utils/tools-manager.d.ts +0 -13
- package/dist/utils/tools-manager.d.ts.map +0 -1
- package/dist/utils/tools-manager.js +0 -343
- package/dist/utils/tools-manager.js.map +0 -1
- package/dist/utils/version-check.d.ts +0 -19
- package/dist/utils/version-check.d.ts.map +0 -1
- package/dist/utils/version-check.js +0 -72
- package/dist/utils/version-check.js.map +0 -1
- package/dist/utils/windows-self-update.d.ts +0 -3
- package/dist/utils/windows-self-update.d.ts.map +0 -1
- package/dist/utils/windows-self-update.js +0 -77
- package/dist/utils/windows-self-update.js.map +0 -1
- package/dist/utils/wsl.d.ts +0 -3
- package/dist/utils/wsl.d.ts.map +0 -1
- package/dist/utils/wsl.js +0 -15
- package/dist/utils/wsl.js.map +0 -1
- package/dist/utils/zip.d.ts +0 -7
- package/dist/utils/zip.d.ts.map +0 -1
- package/dist/utils/zip.js +0 -60
- package/dist/utils/zip.js.map +0 -1
|
@@ -1,913 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import { backgroundAnsi, colorToHex, colorToOklch, foregroundAnsi, getTerminalColorMode, indexedColor, mixColors, parseColor, rgbColor, styleTextWithAnsi, } from "@earendil-works/pi-tui";
|
|
4
|
-
import chalk from "chalk";
|
|
5
|
-
import { getCustomThemesDir, getThemesDir } from "../../../config.js";
|
|
6
|
-
import { closeWatcher, watchWithErrorHandler } from "../../../utils/fs-watch.js";
|
|
7
|
-
import { highlight, supportsLanguage } from "../../../utils/syntax-highlight.js";
|
|
8
|
-
import { stripBom } from "../../../utils/text.js";
|
|
9
|
-
import { generateSystemThemeColors, SYSTEM_THEME_NAME, terminalAppearance } from "./system-theme.js";
|
|
10
|
-
export { SYSTEM_THEME_NAME } from "./system-theme.js";
|
|
11
|
-
let themeJsonValidator;
|
|
12
|
-
/**
|
|
13
|
-
* Install full theme validation. Without it, documents are accepted as-is, which is what built-in
|
|
14
|
-
* themes already do: validating user-authored JSON needs typebox, and a presentation that only uses
|
|
15
|
-
* built-in themes should not pay ~17 MB of module graph for it.
|
|
16
|
-
*/
|
|
17
|
-
export function setThemeJsonValidator(validator) {
|
|
18
|
-
themeJsonValidator = validator;
|
|
19
|
-
}
|
|
20
|
-
// ============================================================================
|
|
21
|
-
// Color Utilities
|
|
22
|
-
// ============================================================================
|
|
23
|
-
function resolveVarRefs(value, vars, visited = new Set()) {
|
|
24
|
-
if (typeof value === "number" || value === "" || value.startsWith("#") || /^ok(lch|hsl)\(/i.test(value)) {
|
|
25
|
-
return value;
|
|
26
|
-
}
|
|
27
|
-
if (visited.has(value)) {
|
|
28
|
-
throw new Error(`Circular variable reference detected: ${value}`);
|
|
29
|
-
}
|
|
30
|
-
if (!(value in vars)) {
|
|
31
|
-
throw new Error(`Variable reference not found: ${value}`);
|
|
32
|
-
}
|
|
33
|
-
visited.add(value);
|
|
34
|
-
return resolveVarRefs(vars[value], vars, visited);
|
|
35
|
-
}
|
|
36
|
-
function resolveThemeColors(colors, vars = {}) {
|
|
37
|
-
const resolved = {};
|
|
38
|
-
for (const [key, value] of Object.entries(colors)) {
|
|
39
|
-
resolved[key] = resolveVarRefs(value, vars);
|
|
40
|
-
}
|
|
41
|
-
return resolved;
|
|
42
|
-
}
|
|
43
|
-
function withThemeColorFallbacks(colors) {
|
|
44
|
-
return {
|
|
45
|
-
...colors,
|
|
46
|
-
scrollbarTrack: colors.scrollbarTrack ?? colors.muted,
|
|
47
|
-
scrollbarThumb: colors.scrollbarThumb ?? colors.text,
|
|
48
|
-
thinkingMax: colors.thinkingMax ?? colors.thinkingXhigh,
|
|
49
|
-
searchMatchBg: colors.searchMatchBg ?? colors.selectedBg,
|
|
50
|
-
searchMatchText: colors.searchMatchText ?? colors.text,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
// The terminal's reported colors. Replaced (never mutated) on update, so themes can cache resolved colors
|
|
54
|
-
// by identity.
|
|
55
|
-
let terminalColors = {};
|
|
56
|
-
// While the terminal color query is in flight, the system theme renders in grayscale.
|
|
57
|
-
let terminalColorsPending = false;
|
|
58
|
-
// The terminal's last light/dark report (mode 2031). Only used while it has not reported a background.
|
|
59
|
-
let terminalColorScheme;
|
|
60
|
-
/**
|
|
61
|
-
* Record the terminal's reported colors. Themes use the default colors for tokens set to "" (terminal
|
|
62
|
-
* default); the system theme is generated from all of them. Ends the pending state.
|
|
63
|
-
*/
|
|
64
|
-
export function setTerminalColors(colors) {
|
|
65
|
-
terminalColors = { ...colors };
|
|
66
|
-
terminalColorsPending = false;
|
|
67
|
-
}
|
|
68
|
-
/** Record the terminal's light/dark report, the fallback for terminals that do not report their background. */
|
|
69
|
-
export function setTerminalColorScheme(scheme) {
|
|
70
|
-
terminalColorScheme = scheme;
|
|
71
|
-
}
|
|
72
|
-
/** Render the system theme in grayscale until `setTerminalColors()` reports the terminal's colors. */
|
|
73
|
-
export function markTerminalColorsPending() {
|
|
74
|
-
terminalColorsPending = true;
|
|
75
|
-
}
|
|
76
|
-
/** Assumed terminal default colors when the terminal does not report them. */
|
|
77
|
-
const GUESSED_DEFAULT_COLORS = {
|
|
78
|
-
dark: { foreground: parseColor("#e5e5e7"), background: parseColor("#000000") },
|
|
79
|
-
light: { foreground: parseColor("#000000"), background: parseColor("#ffffff") },
|
|
80
|
-
};
|
|
81
|
-
function averageLightness(colors) {
|
|
82
|
-
// Palette colors 0-15 follow the user's terminal palette, so they say nothing about the theme.
|
|
83
|
-
const fixed = colors.filter((color) => color.kind !== "indexed" || color.index >= 16);
|
|
84
|
-
if (fixed.length === 0)
|
|
85
|
-
return undefined;
|
|
86
|
-
return fixed.reduce((sum, color) => sum + colorToOklch(color).l, 0) / fixed.length;
|
|
87
|
-
}
|
|
88
|
-
/** Detect the background a theme is designed for from the lightness of its own colors. */
|
|
89
|
-
function detectAppearance(foregrounds, backgrounds) {
|
|
90
|
-
const fg = averageLightness(foregrounds);
|
|
91
|
-
const bg = averageLightness(backgrounds);
|
|
92
|
-
if (fg !== undefined && bg !== undefined)
|
|
93
|
-
return bg < fg ? "dark" : "light";
|
|
94
|
-
if (bg !== undefined)
|
|
95
|
-
return bg < 0.5 ? "dark" : "light";
|
|
96
|
-
if (fg !== undefined)
|
|
97
|
-
return fg > 0.5 ? "dark" : "light";
|
|
98
|
-
return undefined;
|
|
99
|
-
}
|
|
100
|
-
// ============================================================================
|
|
101
|
-
// Theme Class
|
|
102
|
-
// ============================================================================
|
|
103
|
-
export class Theme {
|
|
104
|
-
name;
|
|
105
|
-
sourcePath;
|
|
106
|
-
sourceInfo;
|
|
107
|
-
mode;
|
|
108
|
-
// Precomputed escape sequences keep fg()/bg() on the render hot path to a lookup and concat.
|
|
109
|
-
fgAnsi = new Map();
|
|
110
|
-
bgAnsi = new Map();
|
|
111
|
-
// Tokens set to "" have no color of their own; `colors` fills them from the terminal defaults.
|
|
112
|
-
concreteColors = {};
|
|
113
|
-
defaultForegroundTokens = [];
|
|
114
|
-
defaultBackgroundTokens = [];
|
|
115
|
-
// Foreground tokens rendered faint (SGR 2) on top of their color.
|
|
116
|
-
dimTokens;
|
|
117
|
-
ownAppearance;
|
|
118
|
-
resolvedColors;
|
|
119
|
-
constructor(fgColors, bgColors, mode, options = {}) {
|
|
120
|
-
this.name = options.name;
|
|
121
|
-
this.sourcePath = options.sourcePath;
|
|
122
|
-
this.sourceInfo = options.sourceInfo;
|
|
123
|
-
this.mode = mode;
|
|
124
|
-
this.dimTokens = new Set(options.dim);
|
|
125
|
-
const foregrounds = {
|
|
126
|
-
...fgColors,
|
|
127
|
-
scrollbarTrack: fgColors.scrollbarTrack ?? fgColors.muted,
|
|
128
|
-
scrollbarThumb: fgColors.scrollbarThumb ?? fgColors.text,
|
|
129
|
-
thinkingMax: fgColors.thinkingMax ?? fgColors.thinkingXhigh,
|
|
130
|
-
searchMatchText: fgColors.searchMatchText ?? fgColors.text,
|
|
131
|
-
};
|
|
132
|
-
const backgrounds = { ...bgColors, searchMatchBg: bgColors.searchMatchBg ?? bgColors.selectedBg };
|
|
133
|
-
const concreteForegrounds = [];
|
|
134
|
-
const concreteBackgrounds = [];
|
|
135
|
-
// Returns the escape sequence for the token's own slot.
|
|
136
|
-
const addToken = (token, value, isBackground) => {
|
|
137
|
-
if (value === "") {
|
|
138
|
-
(isBackground ? this.defaultBackgroundTokens : this.defaultForegroundTokens).push(token);
|
|
139
|
-
return isBackground ? "\x1b[49m" : "\x1b[39m";
|
|
140
|
-
}
|
|
141
|
-
const color = parseColor(value);
|
|
142
|
-
this.concreteColors[token] = color;
|
|
143
|
-
(isBackground ? concreteBackgrounds : concreteForegrounds).push(color);
|
|
144
|
-
return isBackground ? backgroundAnsi(color, mode) : foregroundAnsi(color, mode);
|
|
145
|
-
};
|
|
146
|
-
for (const [token, value] of Object.entries(foregrounds)) {
|
|
147
|
-
this.fgAnsi.set(token, addToken(token, value, false));
|
|
148
|
-
}
|
|
149
|
-
for (const [token, value] of Object.entries(backgrounds)) {
|
|
150
|
-
this.bgAnsi.set(token, addToken(token, value, true));
|
|
151
|
-
}
|
|
152
|
-
this.ownAppearance = options.appearance ?? detectAppearance(concreteForegrounds, concreteBackgrounds);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* The background the theme is designed for: declared in the theme JSON, detected from its colors,
|
|
156
|
-
* or, for themes without usable colors, the terminal's appearance.
|
|
157
|
-
*/
|
|
158
|
-
get appearance() {
|
|
159
|
-
return this.ownAppearance ?? getTerminalTheme();
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Concrete colors for all tokens. Tokens set to "" (terminal default) use the terminal's reported
|
|
163
|
-
* default colors, or a guess based on `appearance` when the terminal did not report them. Faint
|
|
164
|
-
* tokens are approximated by mixing their color toward the background.
|
|
165
|
-
*/
|
|
166
|
-
get colors() {
|
|
167
|
-
const terminal = terminalColors;
|
|
168
|
-
if (this.resolvedColors?.terminal !== terminal) {
|
|
169
|
-
const guess = GUESSED_DEFAULT_COLORS[this.appearance];
|
|
170
|
-
const toColor = (rgb, fallback) => rgb ? rgbColor(rgb.r, rgb.g, rgb.b) : fallback;
|
|
171
|
-
const foreground = toColor(terminal.foreground, guess.foreground);
|
|
172
|
-
const background = toColor(terminal.background, guess.background);
|
|
173
|
-
const colors = { ...this.concreteColors };
|
|
174
|
-
for (const token of this.defaultForegroundTokens)
|
|
175
|
-
colors[token] = foreground;
|
|
176
|
-
for (const token of this.defaultBackgroundTokens)
|
|
177
|
-
colors[token] = background;
|
|
178
|
-
for (const token of this.dimTokens) {
|
|
179
|
-
const color = colors[token];
|
|
180
|
-
if (color)
|
|
181
|
-
colors[token] = mixColors(color, background, 0.4);
|
|
182
|
-
}
|
|
183
|
-
this.resolvedColors = { terminal, colors: Object.freeze(colors) };
|
|
184
|
-
}
|
|
185
|
-
return this.resolvedColors.colors;
|
|
186
|
-
}
|
|
187
|
-
style(text, options) {
|
|
188
|
-
const { fg, bg } = options;
|
|
189
|
-
if (typeof fg === "string" && this.dimTokens.has(fg))
|
|
190
|
-
options = { ...options, dim: true };
|
|
191
|
-
return styleTextWithAnsi(text, fg === undefined
|
|
192
|
-
? undefined
|
|
193
|
-
: typeof fg === "string"
|
|
194
|
-
? this.tokenAnsi(this.fgAnsi, fg)
|
|
195
|
-
: foregroundAnsi(fg, this.mode), bg === undefined
|
|
196
|
-
? undefined
|
|
197
|
-
: typeof bg === "string"
|
|
198
|
-
? this.tokenAnsi(this.bgAnsi, bg)
|
|
199
|
-
: backgroundAnsi(bg, this.mode), options);
|
|
200
|
-
}
|
|
201
|
-
fg(color, text) {
|
|
202
|
-
const ansi = this.tokenAnsi(this.fgAnsi, color);
|
|
203
|
-
if (this.dimTokens.has(color))
|
|
204
|
-
return `${ansi}\x1b[2m${text}\x1b[22;39m`;
|
|
205
|
-
return `${ansi}${text}\x1b[39m`;
|
|
206
|
-
}
|
|
207
|
-
bg(color, text) {
|
|
208
|
-
const ansi = this.tokenAnsi(this.bgAnsi, color);
|
|
209
|
-
return `${ansi}${text}\x1b[49m`;
|
|
210
|
-
}
|
|
211
|
-
tokenAnsi(ansi, token) {
|
|
212
|
-
const value = ansi.get(token);
|
|
213
|
-
if (value === undefined)
|
|
214
|
-
throw new Error(`Unknown theme color: ${token}`);
|
|
215
|
-
return value;
|
|
216
|
-
}
|
|
217
|
-
bold(text) {
|
|
218
|
-
return chalk.bold(text);
|
|
219
|
-
}
|
|
220
|
-
italic(text) {
|
|
221
|
-
return chalk.italic(text);
|
|
222
|
-
}
|
|
223
|
-
underline(text) {
|
|
224
|
-
return chalk.underline(text);
|
|
225
|
-
}
|
|
226
|
-
inverse(text) {
|
|
227
|
-
return chalk.inverse(text);
|
|
228
|
-
}
|
|
229
|
-
strikethrough(text) {
|
|
230
|
-
return chalk.strikethrough(text);
|
|
231
|
-
}
|
|
232
|
-
/** Opening escape sequence for a foreground token. Faint tokens include SGR 2, which `\x1b[22m` closes. */
|
|
233
|
-
getFgAnsi(color) {
|
|
234
|
-
const ansi = this.tokenAnsi(this.fgAnsi, color);
|
|
235
|
-
return this.dimTokens.has(color) ? `${ansi}\x1b[2m` : ansi;
|
|
236
|
-
}
|
|
237
|
-
getBgAnsi(color) {
|
|
238
|
-
return this.tokenAnsi(this.bgAnsi, color);
|
|
239
|
-
}
|
|
240
|
-
getColorMode() {
|
|
241
|
-
return this.mode;
|
|
242
|
-
}
|
|
243
|
-
getThinkingBorderColor(level) {
|
|
244
|
-
// Map thinking levels to dedicated theme colors
|
|
245
|
-
switch (level) {
|
|
246
|
-
case "off":
|
|
247
|
-
return (str) => this.fg("thinkingOff", str);
|
|
248
|
-
case "minimal":
|
|
249
|
-
return (str) => this.fg("thinkingMinimal", str);
|
|
250
|
-
case "low":
|
|
251
|
-
return (str) => this.fg("thinkingLow", str);
|
|
252
|
-
case "medium":
|
|
253
|
-
return (str) => this.fg("thinkingMedium", str);
|
|
254
|
-
case "high":
|
|
255
|
-
return (str) => this.fg("thinkingHigh", str);
|
|
256
|
-
case "xhigh":
|
|
257
|
-
return (str) => this.fg("thinkingXhigh", str);
|
|
258
|
-
case "max":
|
|
259
|
-
return (str) => this.fg("thinkingMax", str);
|
|
260
|
-
default:
|
|
261
|
-
return (str) => this.fg("thinkingOff", str);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
getBashModeBorderColor() {
|
|
265
|
-
return (str) => this.fg("bashMode", str);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
// ============================================================================
|
|
269
|
-
// Theme Loading
|
|
270
|
-
// ============================================================================
|
|
271
|
-
let BUILTIN_THEMES;
|
|
272
|
-
function getBuiltinThemes() {
|
|
273
|
-
if (!BUILTIN_THEMES) {
|
|
274
|
-
const themesDir = getThemesDir();
|
|
275
|
-
const darkPath = path.join(themesDir, "dark.json");
|
|
276
|
-
const lightPath = path.join(themesDir, "light.json");
|
|
277
|
-
BUILTIN_THEMES = {
|
|
278
|
-
dark: JSON.parse(stripBom(fs.readFileSync(darkPath, "utf-8"))),
|
|
279
|
-
light: JSON.parse(stripBom(fs.readFileSync(lightPath, "utf-8"))),
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
return BUILTIN_THEMES;
|
|
283
|
-
}
|
|
284
|
-
export function getAvailableThemes() {
|
|
285
|
-
return getAvailableThemesWithPaths().map(({ name }) => name);
|
|
286
|
-
}
|
|
287
|
-
export function getAvailableThemesWithPaths() {
|
|
288
|
-
const themesDir = getThemesDir();
|
|
289
|
-
const result = [];
|
|
290
|
-
const seen = new Set();
|
|
291
|
-
const addTheme = (themeInfo) => {
|
|
292
|
-
if (seen.has(themeInfo.name)) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
seen.add(themeInfo.name);
|
|
296
|
-
result.push(themeInfo);
|
|
297
|
-
};
|
|
298
|
-
// Built-in themes. The system theme is generated, so it has no file.
|
|
299
|
-
addTheme({ name: SYSTEM_THEME_NAME, path: undefined });
|
|
300
|
-
for (const name of Object.keys(getBuiltinThemes())) {
|
|
301
|
-
addTheme({ name, path: path.join(themesDir, `${name}.json`) });
|
|
302
|
-
}
|
|
303
|
-
// Custom themes
|
|
304
|
-
for (const themeInfo of getCustomThemeInfos()) {
|
|
305
|
-
addTheme(themeInfo);
|
|
306
|
-
}
|
|
307
|
-
for (const [name, theme] of registeredThemes.entries()) {
|
|
308
|
-
addTheme({ name, path: theme.sourcePath });
|
|
309
|
-
}
|
|
310
|
-
// The system theme comes first: it is the default and adapts to every terminal.
|
|
311
|
-
return result.sort((a, b) => a.name === SYSTEM_THEME_NAME ? -1 : b.name === SYSTEM_THEME_NAME ? 1 : a.name.localeCompare(b.name));
|
|
312
|
-
}
|
|
313
|
-
function getCustomThemeInfos() {
|
|
314
|
-
const customThemesDir = getCustomThemesDir();
|
|
315
|
-
const result = [];
|
|
316
|
-
if (!fs.existsSync(customThemesDir)) {
|
|
317
|
-
return result;
|
|
318
|
-
}
|
|
319
|
-
for (const file of fs.readdirSync(customThemesDir)) {
|
|
320
|
-
if (!file.endsWith(".json")) {
|
|
321
|
-
continue;
|
|
322
|
-
}
|
|
323
|
-
const themePath = path.join(customThemesDir, file);
|
|
324
|
-
try {
|
|
325
|
-
const customTheme = loadThemeFromPath(themePath);
|
|
326
|
-
if (customTheme.name) {
|
|
327
|
-
result.push({ name: customTheme.name, path: themePath });
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
catch {
|
|
331
|
-
// Invalid themes are ignored here; the resource loader reports them
|
|
332
|
-
// during normal startup/reload.
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
return result;
|
|
336
|
-
}
|
|
337
|
-
function assertThemeNameIsValid(name) {
|
|
338
|
-
if (name.includes("/")) {
|
|
339
|
-
throw new Error(`Invalid theme name "${name}": theme names cannot contain "/" because it is reserved for automatic light/dark theme settings.`);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
function parseThemeJson(label, json) {
|
|
343
|
-
if (themeJsonValidator)
|
|
344
|
-
return themeJsonValidator(label, json);
|
|
345
|
-
if (typeof json !== "object" || json === null || !("colors" in json)) {
|
|
346
|
-
throw new Error(`Invalid theme "${label}": expected an object with a "colors" map.`);
|
|
347
|
-
}
|
|
348
|
-
return json;
|
|
349
|
-
}
|
|
350
|
-
function parseThemeJsonContent(label, content) {
|
|
351
|
-
let json;
|
|
352
|
-
try {
|
|
353
|
-
json = JSON.parse(stripBom(content));
|
|
354
|
-
}
|
|
355
|
-
catch (error) {
|
|
356
|
-
throw new Error(`Failed to parse theme ${label}: ${error}`);
|
|
357
|
-
}
|
|
358
|
-
return parseThemeJson(label, json);
|
|
359
|
-
}
|
|
360
|
-
function loadThemeJson(name) {
|
|
361
|
-
const builtinThemes = getBuiltinThemes();
|
|
362
|
-
if (name in builtinThemes) {
|
|
363
|
-
return builtinThemes[name];
|
|
364
|
-
}
|
|
365
|
-
const registeredTheme = registeredThemes.get(name);
|
|
366
|
-
if (registeredTheme?.sourcePath) {
|
|
367
|
-
const content = fs.readFileSync(registeredTheme.sourcePath, "utf-8");
|
|
368
|
-
return parseThemeJsonContent(registeredTheme.sourcePath, content);
|
|
369
|
-
}
|
|
370
|
-
if (registeredTheme) {
|
|
371
|
-
throw new Error(`Theme "${name}" does not have a source path for export`);
|
|
372
|
-
}
|
|
373
|
-
const customThemesDir = getCustomThemesDir();
|
|
374
|
-
const themePath = path.join(customThemesDir, `${name}.json`);
|
|
375
|
-
if (!fs.existsSync(themePath)) {
|
|
376
|
-
throw new Error(`Theme not found: ${name}`);
|
|
377
|
-
}
|
|
378
|
-
const content = fs.readFileSync(themePath, "utf-8");
|
|
379
|
-
return parseThemeJsonContent(name, content);
|
|
380
|
-
}
|
|
381
|
-
const BACKGROUND_TOKENS = new Set([
|
|
382
|
-
"selectedBg",
|
|
383
|
-
"searchMatchBg",
|
|
384
|
-
"userMessageBg",
|
|
385
|
-
"customMessageBg",
|
|
386
|
-
"toolPendingBg",
|
|
387
|
-
"toolSuccessBg",
|
|
388
|
-
"toolErrorBg",
|
|
389
|
-
]);
|
|
390
|
-
function splitThemeColors(colors) {
|
|
391
|
-
const fgColors = {};
|
|
392
|
-
const bgColors = {};
|
|
393
|
-
for (const [key, value] of Object.entries(colors)) {
|
|
394
|
-
if (BACKGROUND_TOKENS.has(key)) {
|
|
395
|
-
bgColors[key] = value;
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
fgColors[key] = value;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
return { fgColors, bgColors };
|
|
402
|
-
}
|
|
403
|
-
function createTheme(themeJson, mode, sourcePath) {
|
|
404
|
-
const colorMode = mode ?? getTerminalColorMode();
|
|
405
|
-
const resolvedColors = resolveThemeColors(withThemeColorFallbacks(themeJson.colors), themeJson.vars);
|
|
406
|
-
const { fgColors, bgColors } = splitThemeColors(resolvedColors);
|
|
407
|
-
return new Theme(fgColors, bgColors, colorMode, {
|
|
408
|
-
name: themeJson.name,
|
|
409
|
-
sourcePath,
|
|
410
|
-
appearance: themeJson.appearance,
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
/** Generate the system theme from the terminal's reported colors (grayscale while they are pending). */
|
|
414
|
-
function createSystemTheme(mode) {
|
|
415
|
-
const generated = generateSystemThemeColors({
|
|
416
|
-
...terminalColors,
|
|
417
|
-
saturation: terminalColorsPending ? 0 : 1,
|
|
418
|
-
appearanceHint: getTerminalTheme(),
|
|
419
|
-
});
|
|
420
|
-
const { fgColors, bgColors } = splitThemeColors(generated.colors);
|
|
421
|
-
return new Theme(fgColors, bgColors, mode ?? getTerminalColorMode(), {
|
|
422
|
-
name: SYSTEM_THEME_NAME,
|
|
423
|
-
appearance: generated.appearance,
|
|
424
|
-
dim: generated.dim,
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
export function loadThemeFromPath(themePath, mode) {
|
|
428
|
-
const content = fs.readFileSync(themePath, "utf-8");
|
|
429
|
-
const themeJson = parseThemeJsonContent(themePath, content);
|
|
430
|
-
return createTheme(themeJson, mode, themePath);
|
|
431
|
-
}
|
|
432
|
-
function loadTheme(name, mode) {
|
|
433
|
-
// The system theme name is reserved: it takes precedence over custom themes of the same name.
|
|
434
|
-
if (name === SYSTEM_THEME_NAME)
|
|
435
|
-
return createSystemTheme(mode);
|
|
436
|
-
const registeredTheme = registeredThemes.get(name);
|
|
437
|
-
if (registeredTheme) {
|
|
438
|
-
return registeredTheme;
|
|
439
|
-
}
|
|
440
|
-
const themeJson = loadThemeJson(name);
|
|
441
|
-
return createTheme(themeJson, mode);
|
|
442
|
-
}
|
|
443
|
-
export function getThemeByName(name) {
|
|
444
|
-
try {
|
|
445
|
-
return loadTheme(name);
|
|
446
|
-
}
|
|
447
|
-
catch {
|
|
448
|
-
return undefined;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
export function parseAutoThemeSetting(themeSetting) {
|
|
452
|
-
if (!themeSetting)
|
|
453
|
-
return undefined;
|
|
454
|
-
const slashIndex = themeSetting.indexOf("/");
|
|
455
|
-
if (slashIndex === -1 || themeSetting.indexOf("/", slashIndex + 1) !== -1) {
|
|
456
|
-
return undefined;
|
|
457
|
-
}
|
|
458
|
-
const lightTheme = themeSetting.slice(0, slashIndex).trim();
|
|
459
|
-
const darkTheme = themeSetting.slice(slashIndex + 1).trim();
|
|
460
|
-
if (!lightTheme || !darkTheme) {
|
|
461
|
-
return undefined;
|
|
462
|
-
}
|
|
463
|
-
return { lightTheme, darkTheme };
|
|
464
|
-
}
|
|
465
|
-
export function resolveThemeSetting(themeSetting, terminalTheme) {
|
|
466
|
-
const autoTheme = parseAutoThemeSetting(themeSetting);
|
|
467
|
-
if (autoTheme) {
|
|
468
|
-
return terminalTheme === "light" ? autoTheme.lightTheme : autoTheme.darkTheme;
|
|
469
|
-
}
|
|
470
|
-
if (themeSetting?.includes("/"))
|
|
471
|
-
return undefined;
|
|
472
|
-
if (typeof themeSetting === "string")
|
|
473
|
-
return themeSetting;
|
|
474
|
-
return undefined;
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* Dark or light from the `COLORFGBG` environment variable some terminals set, or undefined without a
|
|
478
|
-
* usable background index. The value is `fg;bg` or `fg;xpm;bg` (rxvt), where a field is an ANSI color
|
|
479
|
-
* index or `default` when the color is not in the palette. The index refers to the terminal's own palette,
|
|
480
|
-
* whose colors are unknown here, so it is classified by index like Vim does: 0-6 and 8 (bright black, e.g.
|
|
481
|
-
* Solarized Dark's background) are dark, 7 and 9-15 are light.
|
|
482
|
-
*/
|
|
483
|
-
export function detectColorFgBgTheme(env = process.env) {
|
|
484
|
-
const bg = env.COLORFGBG?.split(";").at(-1)?.trim();
|
|
485
|
-
if (!bg || !/^\d{1,2}$/.test(bg))
|
|
486
|
-
return undefined;
|
|
487
|
-
const index = Number(bg);
|
|
488
|
-
if (index > 15)
|
|
489
|
-
return undefined;
|
|
490
|
-
return index <= 6 || index === 8 ? "dark" : "light";
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* Whether the terminal is dark or light. The background it renders decides, classified the same way the
|
|
494
|
-
* system theme does. Without a reported background: the terminal's light/dark report, then COLORFGBG,
|
|
495
|
-
* then dark.
|
|
496
|
-
*/
|
|
497
|
-
export function detectTerminalTheme(colors = {}, reportedScheme, env = process.env) {
|
|
498
|
-
const { background, foreground } = colors;
|
|
499
|
-
if (background)
|
|
500
|
-
return terminalAppearance(background, foreground);
|
|
501
|
-
return reportedScheme ?? detectColorFgBgTheme(env) ?? "dark";
|
|
502
|
-
}
|
|
503
|
-
/** Whether the terminal is dark or light, from everything it reported so far. See `detectTerminalTheme()`. */
|
|
504
|
-
export function getTerminalTheme() {
|
|
505
|
-
return detectTerminalTheme(terminalColors, terminalColorScheme);
|
|
506
|
-
}
|
|
507
|
-
// ============================================================================
|
|
508
|
-
// Global Theme Instance
|
|
509
|
-
// ============================================================================
|
|
510
|
-
// Use globalThis to share theme across module loaders (node + jiti in dev mode)
|
|
511
|
-
const THEME_KEY = Symbol.for("@earendil-works/pi-coding-agent:theme");
|
|
512
|
-
const THEME_KEY_OLD = Symbol.for("@mariozechner/pi-coding-agent:theme");
|
|
513
|
-
// Export theme as a getter that reads from globalThis
|
|
514
|
-
// This ensures all module instances (node, jiti) see the same theme
|
|
515
|
-
export const theme = new Proxy({}, {
|
|
516
|
-
get(_target, prop) {
|
|
517
|
-
const t = globalThis[THEME_KEY];
|
|
518
|
-
if (!t)
|
|
519
|
-
throw new Error("Theme not initialized. Call initTheme() first.");
|
|
520
|
-
return t[prop];
|
|
521
|
-
},
|
|
522
|
-
});
|
|
523
|
-
function setGlobalTheme(t) {
|
|
524
|
-
globalThis[THEME_KEY] = t;
|
|
525
|
-
globalThis[THEME_KEY_OLD] = t;
|
|
526
|
-
}
|
|
527
|
-
let currentThemeName;
|
|
528
|
-
let themeWatcher;
|
|
529
|
-
let themeReloadTimer;
|
|
530
|
-
let onThemeChangeCallback;
|
|
531
|
-
const registeredThemes = new Map();
|
|
532
|
-
export function setRegisteredThemes(themes) {
|
|
533
|
-
registeredThemes.clear();
|
|
534
|
-
for (const theme of themes) {
|
|
535
|
-
if (theme.name) {
|
|
536
|
-
assertThemeNameIsValid(theme.name);
|
|
537
|
-
registeredThemes.set(theme.name, theme);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
export function initTheme(themeName, enableWatcher = false) {
|
|
542
|
-
const name = themeName ?? SYSTEM_THEME_NAME;
|
|
543
|
-
currentThemeName = name;
|
|
544
|
-
try {
|
|
545
|
-
setGlobalTheme(loadTheme(name));
|
|
546
|
-
if (enableWatcher) {
|
|
547
|
-
startThemeWatcher();
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
catch (_error) {
|
|
551
|
-
// Theme is invalid - fall back to the system theme silently
|
|
552
|
-
currentThemeName = SYSTEM_THEME_NAME;
|
|
553
|
-
setGlobalTheme(loadTheme(SYSTEM_THEME_NAME));
|
|
554
|
-
// Don't start watcher for fallback theme
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
export function setTheme(name, enableWatcher = false) {
|
|
558
|
-
currentThemeName = name;
|
|
559
|
-
try {
|
|
560
|
-
setGlobalTheme(loadTheme(name));
|
|
561
|
-
if (enableWatcher) {
|
|
562
|
-
startThemeWatcher();
|
|
563
|
-
}
|
|
564
|
-
if (onThemeChangeCallback) {
|
|
565
|
-
onThemeChangeCallback();
|
|
566
|
-
}
|
|
567
|
-
return { success: true };
|
|
568
|
-
}
|
|
569
|
-
catch (error) {
|
|
570
|
-
// Theme is invalid - fall back to the system theme
|
|
571
|
-
currentThemeName = SYSTEM_THEME_NAME;
|
|
572
|
-
setGlobalTheme(loadTheme(SYSTEM_THEME_NAME));
|
|
573
|
-
// Don't start watcher for fallback theme
|
|
574
|
-
return {
|
|
575
|
-
success: false,
|
|
576
|
-
error: error instanceof Error ? error.message : String(error),
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
export function setThemeInstance(themeInstance) {
|
|
581
|
-
setGlobalTheme(themeInstance);
|
|
582
|
-
currentThemeName = "<in-memory>";
|
|
583
|
-
stopThemeWatcher(); // Can't watch a direct instance
|
|
584
|
-
if (onThemeChangeCallback) {
|
|
585
|
-
onThemeChangeCallback();
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
export function onThemeChange(callback) {
|
|
589
|
-
onThemeChangeCallback = callback;
|
|
590
|
-
}
|
|
591
|
-
function startThemeWatcher() {
|
|
592
|
-
stopThemeWatcher();
|
|
593
|
-
// Only watch if it's a custom theme (not built-in)
|
|
594
|
-
if (!currentThemeName ||
|
|
595
|
-
currentThemeName === "dark" ||
|
|
596
|
-
currentThemeName === "light" ||
|
|
597
|
-
currentThemeName === SYSTEM_THEME_NAME) {
|
|
598
|
-
return;
|
|
599
|
-
}
|
|
600
|
-
const customThemesDir = getCustomThemesDir();
|
|
601
|
-
const watchedThemeName = currentThemeName;
|
|
602
|
-
const watchedFileName = `${watchedThemeName}.json`;
|
|
603
|
-
const themeFile = path.join(customThemesDir, watchedFileName);
|
|
604
|
-
// Only watch if the file exists
|
|
605
|
-
if (!fs.existsSync(themeFile)) {
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
608
|
-
const scheduleReload = () => {
|
|
609
|
-
if (themeReloadTimer) {
|
|
610
|
-
clearTimeout(themeReloadTimer);
|
|
611
|
-
}
|
|
612
|
-
themeReloadTimer = setTimeout(() => {
|
|
613
|
-
themeReloadTimer = undefined;
|
|
614
|
-
// Ignore stale timers after switching themes or stopping the watcher
|
|
615
|
-
if (currentThemeName !== watchedThemeName) {
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
// Keep the last successfully loaded theme active if the file is temporarily missing
|
|
619
|
-
if (!fs.existsSync(themeFile)) {
|
|
620
|
-
return;
|
|
621
|
-
}
|
|
622
|
-
try {
|
|
623
|
-
// Reload the theme from disk and refresh the registry cache
|
|
624
|
-
const reloadedTheme = loadThemeFromPath(themeFile);
|
|
625
|
-
registeredThemes.set(watchedThemeName, reloadedTheme);
|
|
626
|
-
setGlobalTheme(reloadedTheme);
|
|
627
|
-
// Notify callback (to invalidate UI)
|
|
628
|
-
if (onThemeChangeCallback) {
|
|
629
|
-
onThemeChangeCallback();
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
catch (_error) {
|
|
633
|
-
// Ignore errors (file might be in invalid state while being edited)
|
|
634
|
-
}
|
|
635
|
-
}, 100);
|
|
636
|
-
};
|
|
637
|
-
themeWatcher =
|
|
638
|
-
watchWithErrorHandler(customThemesDir, (_eventType, filename) => {
|
|
639
|
-
if (currentThemeName !== watchedThemeName) {
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
if (!filename) {
|
|
643
|
-
scheduleReload();
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
if (filename !== watchedFileName) {
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
scheduleReload();
|
|
650
|
-
}, () => {
|
|
651
|
-
closeWatcher(themeWatcher);
|
|
652
|
-
themeWatcher = undefined;
|
|
653
|
-
}) ?? undefined;
|
|
654
|
-
}
|
|
655
|
-
export function stopThemeWatcher() {
|
|
656
|
-
if (themeReloadTimer) {
|
|
657
|
-
clearTimeout(themeReloadTimer);
|
|
658
|
-
themeReloadTimer = undefined;
|
|
659
|
-
}
|
|
660
|
-
closeWatcher(themeWatcher);
|
|
661
|
-
themeWatcher = undefined;
|
|
662
|
-
}
|
|
663
|
-
// ============================================================================
|
|
664
|
-
// HTML Export Helpers
|
|
665
|
-
// ============================================================================
|
|
666
|
-
/**
|
|
667
|
-
* Get resolved theme colors as CSS-compatible hex strings.
|
|
668
|
-
* Used by HTML export to generate CSS custom properties.
|
|
669
|
-
*/
|
|
670
|
-
export function getResolvedThemeColors(themeName) {
|
|
671
|
-
const colors = loadTheme(themeName ?? currentThemeName ?? SYSTEM_THEME_NAME).colors;
|
|
672
|
-
return Object.fromEntries(Object.entries(colors).map(([token, color]) => [token, colorToHex(color)]));
|
|
673
|
-
}
|
|
674
|
-
/**
|
|
675
|
-
* Check if a theme is a "light" theme (for CSS that needs light/dark variants).
|
|
676
|
-
*/
|
|
677
|
-
export function isLightTheme(themeName) {
|
|
678
|
-
return loadTheme(themeName ?? currentThemeName ?? SYSTEM_THEME_NAME).appearance === "light";
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* Get explicit export colors from theme JSON, if specified.
|
|
682
|
-
* Returns undefined for each color that isn't explicitly set.
|
|
683
|
-
*/
|
|
684
|
-
export function getThemeExportColors(themeName) {
|
|
685
|
-
const name = themeName ?? currentThemeName ?? SYSTEM_THEME_NAME;
|
|
686
|
-
if (name === SYSTEM_THEME_NAME)
|
|
687
|
-
return {};
|
|
688
|
-
try {
|
|
689
|
-
const themeJson = loadThemeJson(name);
|
|
690
|
-
const exportSection = themeJson.export;
|
|
691
|
-
if (!exportSection)
|
|
692
|
-
return {};
|
|
693
|
-
const vars = themeJson.vars ?? {};
|
|
694
|
-
// Export colors end up in CSS, which understands hex and oklch() values directly but not okhsl().
|
|
695
|
-
const resolve = (value) => {
|
|
696
|
-
if (value === undefined)
|
|
697
|
-
return undefined;
|
|
698
|
-
const resolved = resolveVarRefs(value, vars);
|
|
699
|
-
if (typeof resolved === "number")
|
|
700
|
-
return colorToHex(indexedColor(resolved));
|
|
701
|
-
if (resolved === "")
|
|
702
|
-
return undefined;
|
|
703
|
-
if (/^okhsl\(/i.test(resolved))
|
|
704
|
-
return colorToHex(parseColor(resolved));
|
|
705
|
-
return resolved;
|
|
706
|
-
};
|
|
707
|
-
return {
|
|
708
|
-
pageBg: resolve(exportSection.pageBg),
|
|
709
|
-
cardBg: resolve(exportSection.cardBg),
|
|
710
|
-
infoBg: resolve(exportSection.infoBg),
|
|
711
|
-
};
|
|
712
|
-
}
|
|
713
|
-
catch {
|
|
714
|
-
return {};
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
let cachedHighlightThemeFor;
|
|
718
|
-
let cachedCliHighlightTheme;
|
|
719
|
-
function buildCliHighlightTheme(t) {
|
|
720
|
-
return {
|
|
721
|
-
keyword: (s) => t.fg("syntaxKeyword", s),
|
|
722
|
-
built_in: (s) => t.fg("syntaxType", s),
|
|
723
|
-
literal: (s) => t.fg("syntaxNumber", s),
|
|
724
|
-
number: (s) => t.fg("syntaxNumber", s),
|
|
725
|
-
regexp: (s) => t.fg("syntaxString", s),
|
|
726
|
-
string: (s) => t.fg("syntaxString", s),
|
|
727
|
-
subst: (s) => t.fg("text", s),
|
|
728
|
-
comment: (s) => t.fg("syntaxComment", s),
|
|
729
|
-
doctag: (s) => t.fg("syntaxComment", s),
|
|
730
|
-
meta: (s) => t.fg("muted", s),
|
|
731
|
-
function: (s) => t.fg("syntaxFunction", s),
|
|
732
|
-
title: (s) => t.fg("syntaxFunction", s),
|
|
733
|
-
class: (s) => t.fg("syntaxType", s),
|
|
734
|
-
type: (s) => t.fg("syntaxType", s),
|
|
735
|
-
tag: (s) => t.fg("syntaxPunctuation", s),
|
|
736
|
-
name: (s) => t.fg("syntaxKeyword", s),
|
|
737
|
-
attr: (s) => t.fg("syntaxVariable", s),
|
|
738
|
-
variable: (s) => t.fg("syntaxVariable", s),
|
|
739
|
-
params: (s) => t.fg("syntaxVariable", s),
|
|
740
|
-
operator: (s) => t.fg("syntaxOperator", s),
|
|
741
|
-
punctuation: (s) => t.fg("syntaxPunctuation", s),
|
|
742
|
-
emphasis: (s) => t.italic(s),
|
|
743
|
-
strong: (s) => t.bold(s),
|
|
744
|
-
link: (s) => t.underline(s),
|
|
745
|
-
addition: (s) => t.fg("toolDiffAdded", s),
|
|
746
|
-
deletion: (s) => t.fg("toolDiffRemoved", s),
|
|
747
|
-
};
|
|
748
|
-
}
|
|
749
|
-
function getCliHighlightTheme(t) {
|
|
750
|
-
if (cachedHighlightThemeFor !== t || !cachedCliHighlightTheme) {
|
|
751
|
-
cachedHighlightThemeFor = t;
|
|
752
|
-
cachedCliHighlightTheme = buildCliHighlightTheme(t);
|
|
753
|
-
}
|
|
754
|
-
return cachedCliHighlightTheme;
|
|
755
|
-
}
|
|
756
|
-
/**
|
|
757
|
-
* Highlight code with syntax coloring based on file extension or language.
|
|
758
|
-
* Returns array of highlighted lines.
|
|
759
|
-
*/
|
|
760
|
-
export function highlightCode(code, lang) {
|
|
761
|
-
// Validate language before highlighting to avoid stderr spam from cli-highlight
|
|
762
|
-
const validLang = lang && supportsLanguage(lang) ? lang : undefined;
|
|
763
|
-
// Skip highlighting when no valid language is specified. cli-highlight's
|
|
764
|
-
// auto-detection is unreliable and can misidentify prose as AppleScript,
|
|
765
|
-
// LiveCodeServer, etc., coloring random English words as keywords.
|
|
766
|
-
if (!validLang) {
|
|
767
|
-
return code.split("\n").map((line) => theme.fg("mdCodeBlock", line));
|
|
768
|
-
}
|
|
769
|
-
const opts = {
|
|
770
|
-
language: validLang,
|
|
771
|
-
ignoreIllegals: true,
|
|
772
|
-
theme: getCliHighlightTheme(theme),
|
|
773
|
-
};
|
|
774
|
-
try {
|
|
775
|
-
return highlight(code, opts).split("\n");
|
|
776
|
-
}
|
|
777
|
-
catch {
|
|
778
|
-
return code.split("\n");
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* Get language identifier from file path extension.
|
|
783
|
-
*/
|
|
784
|
-
export function getLanguageFromPath(filePath) {
|
|
785
|
-
const ext = filePath.split(".").pop()?.toLowerCase();
|
|
786
|
-
if (!ext)
|
|
787
|
-
return undefined;
|
|
788
|
-
const extToLang = {
|
|
789
|
-
ts: "typescript",
|
|
790
|
-
tsx: "typescript",
|
|
791
|
-
js: "javascript",
|
|
792
|
-
jsx: "javascript",
|
|
793
|
-
mjs: "javascript",
|
|
794
|
-
cjs: "javascript",
|
|
795
|
-
py: "python",
|
|
796
|
-
rb: "ruby",
|
|
797
|
-
rs: "rust",
|
|
798
|
-
go: "go",
|
|
799
|
-
java: "java",
|
|
800
|
-
kt: "kotlin",
|
|
801
|
-
swift: "swift",
|
|
802
|
-
c: "c",
|
|
803
|
-
h: "c",
|
|
804
|
-
cpp: "cpp",
|
|
805
|
-
cc: "cpp",
|
|
806
|
-
cxx: "cpp",
|
|
807
|
-
hpp: "cpp",
|
|
808
|
-
cs: "csharp",
|
|
809
|
-
php: "php",
|
|
810
|
-
sh: "bash",
|
|
811
|
-
bash: "bash",
|
|
812
|
-
zsh: "bash",
|
|
813
|
-
fish: "fish",
|
|
814
|
-
ps1: "powershell",
|
|
815
|
-
sql: "sql",
|
|
816
|
-
html: "html",
|
|
817
|
-
htm: "html",
|
|
818
|
-
css: "css",
|
|
819
|
-
scss: "scss",
|
|
820
|
-
sass: "sass",
|
|
821
|
-
less: "less",
|
|
822
|
-
json: "json",
|
|
823
|
-
yaml: "yaml",
|
|
824
|
-
yml: "yaml",
|
|
825
|
-
toml: "toml",
|
|
826
|
-
xml: "xml",
|
|
827
|
-
md: "markdown",
|
|
828
|
-
markdown: "markdown",
|
|
829
|
-
dockerfile: "dockerfile",
|
|
830
|
-
makefile: "makefile",
|
|
831
|
-
cmake: "cmake",
|
|
832
|
-
lua: "lua",
|
|
833
|
-
perl: "perl",
|
|
834
|
-
r: "r",
|
|
835
|
-
scala: "scala",
|
|
836
|
-
clj: "clojure",
|
|
837
|
-
ex: "elixir",
|
|
838
|
-
exs: "elixir",
|
|
839
|
-
erl: "erlang",
|
|
840
|
-
hs: "haskell",
|
|
841
|
-
ml: "ocaml",
|
|
842
|
-
vim: "vim",
|
|
843
|
-
graphql: "graphql",
|
|
844
|
-
proto: "protobuf",
|
|
845
|
-
tf: "hcl",
|
|
846
|
-
hcl: "hcl",
|
|
847
|
-
};
|
|
848
|
-
return extToLang[ext];
|
|
849
|
-
}
|
|
850
|
-
export function getMarkdownTheme() {
|
|
851
|
-
return {
|
|
852
|
-
heading: (text) => theme.fg("mdHeading", text),
|
|
853
|
-
link: (text) => theme.fg("mdLink", text),
|
|
854
|
-
linkUrl: (text) => theme.fg("mdLinkUrl", text),
|
|
855
|
-
code: (text) => theme.fg("mdCode", text),
|
|
856
|
-
codeBlock: (text) => theme.fg("mdCodeBlock", text),
|
|
857
|
-
codeBlockBorder: (text) => theme.fg("mdCodeBlockBorder", text),
|
|
858
|
-
quote: (text) => theme.fg("mdQuote", text),
|
|
859
|
-
quoteBorder: (text) => theme.fg("mdQuoteBorder", text),
|
|
860
|
-
hr: (text) => theme.fg("mdHr", text),
|
|
861
|
-
listBullet: (text) => theme.fg("mdListBullet", text),
|
|
862
|
-
bold: (text) => theme.bold(text),
|
|
863
|
-
italic: (text) => theme.italic(text),
|
|
864
|
-
underline: (text) => theme.underline(text),
|
|
865
|
-
strikethrough: (text) => theme.strikethrough(text),
|
|
866
|
-
highlightCode: (code, lang) => {
|
|
867
|
-
// Validate language before highlighting to avoid stderr spam from cli-highlight
|
|
868
|
-
const validLang = lang && supportsLanguage(lang) ? lang : undefined;
|
|
869
|
-
// Skip highlighting when no valid language is specified. cli-highlight's
|
|
870
|
-
// auto-detection is unreliable and can misidentify prose as AppleScript,
|
|
871
|
-
// LiveCodeServer, etc., coloring random English words as keywords.
|
|
872
|
-
if (!validLang) {
|
|
873
|
-
return code.split("\n").map((line) => theme.fg("mdCodeBlock", line));
|
|
874
|
-
}
|
|
875
|
-
const opts = {
|
|
876
|
-
language: validLang,
|
|
877
|
-
ignoreIllegals: true,
|
|
878
|
-
theme: getCliHighlightTheme(theme),
|
|
879
|
-
};
|
|
880
|
-
try {
|
|
881
|
-
return highlight(code, opts).split("\n");
|
|
882
|
-
}
|
|
883
|
-
catch {
|
|
884
|
-
return code.split("\n").map((line) => theme.fg("mdCodeBlock", line));
|
|
885
|
-
}
|
|
886
|
-
},
|
|
887
|
-
};
|
|
888
|
-
}
|
|
889
|
-
export function getSelectListTheme() {
|
|
890
|
-
return {
|
|
891
|
-
selectedPrefix: (text) => theme.fg("accent", text),
|
|
892
|
-
selectedText: (text) => theme.fg("accent", text),
|
|
893
|
-
description: (text) => theme.fg("muted", text),
|
|
894
|
-
scrollInfo: (text) => theme.fg("muted", text),
|
|
895
|
-
noMatch: (text) => theme.fg("muted", text),
|
|
896
|
-
};
|
|
897
|
-
}
|
|
898
|
-
export function getEditorTheme() {
|
|
899
|
-
return {
|
|
900
|
-
borderColor: (text) => theme.fg("borderMuted", text),
|
|
901
|
-
selectList: getSelectListTheme(),
|
|
902
|
-
};
|
|
903
|
-
}
|
|
904
|
-
export function getSettingsListTheme() {
|
|
905
|
-
return {
|
|
906
|
-
label: (text, selected) => (selected ? theme.fg("accent", text) : text),
|
|
907
|
-
value: (text, selected) => (selected ? theme.fg("accent", text) : theme.fg("muted", text)),
|
|
908
|
-
description: (text) => theme.fg("dim", text),
|
|
909
|
-
cursor: theme.fg("accent", "→ "),
|
|
910
|
-
hint: (text) => theme.fg("dim", text),
|
|
911
|
-
};
|
|
912
|
-
}
|
|
913
|
-
//# sourceMappingURL=theme.js.map
|