@tuan_son.dinh/gsd 2.6.2 → 2.7.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/README.md +1 -0
- package/dist/cli.js +24 -10
- package/dist/loader.js +21 -3
- package/dist/logo.d.ts +3 -3
- package/dist/logo.js +2 -2
- package/dist/onboarding.d.ts +3 -3
- package/dist/onboarding.js +3 -4
- package/dist/pi-migration.d.ts +5 -1
- package/dist/pi-migration.js +19 -2
- package/dist/resource-loader.d.ts +2 -1
- package/dist/resource-loader.js +60 -4
- package/dist/wizard.d.ts +1 -1
- package/package.json +12 -6
- package/packages/pi-agent-core/dist/agent-loop.d.ts +21 -0
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -0
- package/packages/pi-agent-core/dist/agent-loop.js +308 -0
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -0
- package/packages/pi-agent-core/dist/agent.d.ts +162 -0
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -0
- package/packages/pi-agent-core/dist/agent.js +399 -0
- package/packages/pi-agent-core/dist/agent.js.map +1 -0
- package/packages/pi-agent-core/dist/index.d.ts +5 -0
- package/packages/pi-agent-core/dist/index.d.ts.map +1 -0
- package/packages/pi-agent-core/dist/index.js +9 -0
- package/packages/pi-agent-core/dist/index.js.map +1 -0
- package/packages/pi-agent-core/dist/proxy.d.ts +85 -0
- package/packages/pi-agent-core/dist/proxy.d.ts.map +1 -0
- package/packages/pi-agent-core/dist/proxy.js +268 -0
- package/packages/pi-agent-core/dist/proxy.js.map +1 -0
- package/packages/pi-agent-core/dist/types.d.ts +178 -0
- package/packages/pi-agent-core/dist/types.d.ts.map +1 -0
- package/packages/pi-agent-core/dist/types.js +2 -0
- package/packages/pi-agent-core/dist/types.js.map +1 -0
- package/packages/pi-agent-core/package.json +14 -0
- package/packages/pi-agent-core/src/agent-loop.ts +417 -0
- package/packages/pi-agent-core/src/agent.ts +568 -0
- package/packages/pi-agent-core/src/index.ts +8 -0
- package/packages/pi-agent-core/src/proxy.ts +340 -0
- package/packages/pi-agent-core/src/types.ts +194 -0
- package/packages/pi-agent-core/tsconfig.json +27 -0
- package/packages/pi-ai/bedrock-provider.d.ts +1 -0
- package/packages/pi-ai/bedrock-provider.js +1 -0
- package/packages/pi-ai/dist/api-registry.d.ts +20 -0
- package/packages/pi-ai/dist/api-registry.d.ts.map +1 -0
- package/packages/pi-ai/dist/api-registry.js +44 -0
- package/packages/pi-ai/dist/api-registry.js.map +1 -0
- package/packages/pi-ai/dist/bedrock-provider.d.ts +5 -0
- package/packages/pi-ai/dist/bedrock-provider.d.ts.map +1 -0
- package/packages/pi-ai/dist/bedrock-provider.js +6 -0
- package/packages/pi-ai/dist/bedrock-provider.js.map +1 -0
- package/packages/pi-ai/dist/cli.d.ts +3 -0
- package/packages/pi-ai/dist/cli.d.ts.map +1 -0
- package/packages/pi-ai/dist/cli.js +116 -0
- package/packages/pi-ai/dist/cli.js.map +1 -0
- package/packages/pi-ai/dist/env-api-keys.d.ts +9 -0
- package/packages/pi-ai/dist/env-api-keys.d.ts.map +1 -0
- package/packages/pi-ai/dist/env-api-keys.js +104 -0
- package/packages/pi-ai/dist/env-api-keys.js.map +1 -0
- package/packages/pi-ai/dist/index.d.ts +23 -0
- package/packages/pi-ai/dist/index.d.ts.map +1 -0
- package/packages/pi-ai/dist/index.js +21 -0
- package/packages/pi-ai/dist/index.js.map +1 -0
- package/packages/pi-ai/dist/models.d.ts +24 -0
- package/packages/pi-ai/dist/models.d.ts.map +1 -0
- package/packages/pi-ai/dist/models.generated.d.ts +13572 -0
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -0
- package/packages/pi-ai/dist/models.generated.js +13368 -0
- package/packages/pi-ai/dist/models.generated.js.map +1 -0
- package/packages/pi-ai/dist/models.js +55 -0
- package/packages/pi-ai/dist/models.js.map +1 -0
- package/packages/pi-ai/dist/oauth.d.ts +2 -0
- package/packages/pi-ai/dist/oauth.d.ts.map +1 -0
- package/packages/pi-ai/dist/oauth.js +2 -0
- package/packages/pi-ai/dist/oauth.js.map +1 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts +15 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.js +600 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic.d.ts +33 -0
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic.js +732 -0
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -0
- package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts +15 -0
- package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/azure-openai-responses.js +187 -0
- package/packages/pi-ai/dist/providers/azure-openai-responses.js.map +1 -0
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts +8 -0
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/github-copilot-headers.js +29 -0
- package/packages/pi-ai/dist/providers/github-copilot-headers.js.map +1 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts +74 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.js +757 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -0
- package/packages/pi-ai/dist/providers/google-shared.d.ts +65 -0
- package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/google-shared.js +300 -0
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -0
- package/packages/pi-ai/dist/providers/google-vertex.d.ts +15 -0
- package/packages/pi-ai/dist/providers/google-vertex.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/google-vertex.js +374 -0
- package/packages/pi-ai/dist/providers/google-vertex.js.map +1 -0
- package/packages/pi-ai/dist/providers/google.d.ts +13 -0
- package/packages/pi-ai/dist/providers/google.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/google.js +355 -0
- package/packages/pi-ai/dist/providers/google.js.map +1 -0
- package/packages/pi-ai/dist/providers/mistral.d.ts +22 -0
- package/packages/pi-ai/dist/providers/mistral.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/mistral.js +498 -0
- package/packages/pi-ai/dist/providers/mistral.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts +9 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.js +704 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-completions.d.ts +15 -0
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-completions.js +705 -0
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-responses-shared.d.ts +17 -0
- package/packages/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-responses-shared.js +442 -0
- package/packages/pi-ai/dist/providers/openai-responses-shared.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-responses.d.ts +13 -0
- package/packages/pi-ai/dist/providers/openai-responses.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-responses.js +201 -0
- package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -0
- package/packages/pi-ai/dist/providers/register-builtins.d.ts +11 -0
- package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/register-builtins.js +138 -0
- package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts +8 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.js +35 -0
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -0
- package/packages/pi-ai/dist/providers/transform-messages.d.ts +8 -0
- package/packages/pi-ai/dist/providers/transform-messages.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/transform-messages.js +155 -0
- package/packages/pi-ai/dist/providers/transform-messages.js.map +1 -0
- package/packages/pi-ai/dist/stream.d.ts +8 -0
- package/packages/pi-ai/dist/stream.d.ts.map +1 -0
- package/packages/pi-ai/dist/stream.js +27 -0
- package/packages/pi-ai/dist/stream.js.map +1 -0
- package/packages/pi-ai/dist/types.d.ts +285 -0
- package/packages/pi-ai/dist/types.d.ts.map +1 -0
- package/packages/pi-ai/dist/types.js +2 -0
- package/packages/pi-ai/dist/types.js.map +1 -0
- package/packages/pi-ai/dist/utils/event-stream.d.ts +21 -0
- package/packages/pi-ai/dist/utils/event-stream.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/event-stream.js +77 -0
- package/packages/pi-ai/dist/utils/event-stream.js.map +1 -0
- package/packages/pi-ai/dist/utils/hash.d.ts +3 -0
- package/packages/pi-ai/dist/utils/hash.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/hash.js +14 -0
- package/packages/pi-ai/dist/utils/hash.js.map +1 -0
- package/packages/pi-ai/dist/utils/json-parse.d.ts +9 -0
- package/packages/pi-ai/dist/utils/json-parse.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/json-parse.js +29 -0
- package/packages/pi-ai/dist/utils/json-parse.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/anthropic.d.ts +17 -0
- package/packages/pi-ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/anthropic.js +104 -0
- package/packages/pi-ai/dist/utils/oauth/anthropic.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts +30 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js +281 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts +26 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js +373 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts +26 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js +478 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/index.d.ts +61 -0
- package/packages/pi-ai/dist/utils/oauth/index.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/index.js +131 -0
- package/packages/pi-ai/dist/utils/oauth/index.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/openai-codex.d.ts +34 -0
- package/packages/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/openai-codex.js +380 -0
- package/packages/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/pkce.d.ts +13 -0
- package/packages/pi-ai/dist/utils/oauth/pkce.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/pkce.js +31 -0
- package/packages/pi-ai/dist/utils/oauth/pkce.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/types.d.ts +47 -0
- package/packages/pi-ai/dist/utils/oauth/types.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/types.js +2 -0
- package/packages/pi-ai/dist/utils/oauth/types.js.map +1 -0
- package/packages/pi-ai/dist/utils/overflow.d.ts +52 -0
- package/packages/pi-ai/dist/utils/overflow.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/overflow.js +117 -0
- package/packages/pi-ai/dist/utils/overflow.js.map +1 -0
- package/packages/pi-ai/dist/utils/sanitize-unicode.d.ts +22 -0
- package/packages/pi-ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/sanitize-unicode.js +26 -0
- package/packages/pi-ai/dist/utils/sanitize-unicode.js.map +1 -0
- package/packages/pi-ai/dist/utils/typebox-helpers.d.ts +17 -0
- package/packages/pi-ai/dist/utils/typebox-helpers.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/typebox-helpers.js +21 -0
- package/packages/pi-ai/dist/utils/typebox-helpers.js.map +1 -0
- package/packages/pi-ai/dist/utils/validation.d.ts +18 -0
- package/packages/pi-ai/dist/utils/validation.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/validation.js +72 -0
- package/packages/pi-ai/dist/utils/validation.js.map +1 -0
- package/packages/pi-ai/package.json +40 -0
- package/packages/pi-ai/src/api-registry.ts +98 -0
- package/packages/pi-ai/src/bedrock-provider.ts +6 -0
- package/packages/pi-ai/src/cli.ts +133 -0
- package/packages/pi-ai/src/env-api-keys.ts +129 -0
- package/packages/pi-ai/src/index.ts +32 -0
- package/packages/pi-ai/src/models.generated.ts +13370 -0
- package/packages/pi-ai/src/models.ts +77 -0
- package/packages/pi-ai/src/oauth.ts +1 -0
- package/packages/pi-ai/src/providers/amazon-bedrock.ts +751 -0
- package/packages/pi-ai/src/providers/anthropic.ts +883 -0
- package/packages/pi-ai/src/providers/azure-openai-responses.ts +259 -0
- package/packages/pi-ai/src/providers/github-copilot-headers.ts +37 -0
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +967 -0
- package/packages/pi-ai/src/providers/google-shared.ts +313 -0
- package/packages/pi-ai/src/providers/google-vertex.ts +485 -0
- package/packages/pi-ai/src/providers/google.ts +455 -0
- package/packages/pi-ai/src/providers/mistral.ts +582 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.ts +875 -0
- package/packages/pi-ai/src/providers/openai-completions.ts +820 -0
- package/packages/pi-ai/src/providers/openai-responses-shared.ts +496 -0
- package/packages/pi-ai/src/providers/openai-responses.ts +262 -0
- package/packages/pi-ai/src/providers/register-builtins.ts +186 -0
- package/packages/pi-ai/src/providers/simple-options.ts +46 -0
- package/packages/pi-ai/src/providers/transform-messages.ts +172 -0
- package/packages/pi-ai/src/stream.ts +59 -0
- package/packages/pi-ai/src/types.ts +321 -0
- package/packages/pi-ai/src/utils/event-stream.ts +87 -0
- package/packages/pi-ai/src/utils/hash.ts +13 -0
- package/packages/pi-ai/src/utils/json-parse.ts +28 -0
- package/packages/pi-ai/src/utils/oauth/anthropic.ts +138 -0
- package/packages/pi-ai/src/utils/oauth/github-copilot.ts +381 -0
- package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +457 -0
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +599 -0
- package/packages/pi-ai/src/utils/oauth/index.ts +162 -0
- package/packages/pi-ai/src/utils/oauth/openai-codex.ts +455 -0
- package/packages/pi-ai/src/utils/oauth/pkce.ts +34 -0
- package/packages/pi-ai/src/utils/oauth/types.ts +59 -0
- package/packages/pi-ai/src/utils/overflow.ts +123 -0
- package/packages/pi-ai/src/utils/sanitize-unicode.ts +25 -0
- package/packages/pi-ai/src/utils/typebox-helpers.ts +24 -0
- package/packages/pi-ai/src/utils/validation.ts +84 -0
- package/packages/pi-ai/tsconfig.json +27 -0
- package/packages/pi-coding-agent/dist/cli/args.d.ts +48 -0
- package/packages/pi-coding-agent/dist/cli/args.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli/args.js +299 -0
- package/packages/pi-coding-agent/dist/cli/args.js.map +1 -0
- package/packages/pi-coding-agent/dist/cli/config-selector.d.ts +14 -0
- package/packages/pi-coding-agent/dist/cli/config-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli/config-selector.js +31 -0
- package/packages/pi-coding-agent/dist/cli/config-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/cli/file-processor.d.ts +15 -0
- package/packages/pi-coding-agent/dist/cli/file-processor.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli/file-processor.js +79 -0
- package/packages/pi-coding-agent/dist/cli/file-processor.js.map +1 -0
- package/packages/pi-coding-agent/dist/cli/list-models.d.ts +9 -0
- package/packages/pi-coding-agent/dist/cli/list-models.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli/list-models.js +92 -0
- package/packages/pi-coding-agent/dist/cli/list-models.js.map +1 -0
- package/packages/pi-coding-agent/dist/cli/session-picker.d.ts +9 -0
- package/packages/pi-coding-agent/dist/cli/session-picker.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli/session-picker.js +34 -0
- package/packages/pi-coding-agent/dist/cli/session-picker.js.map +1 -0
- package/packages/pi-coding-agent/dist/cli.d.ts +3 -0
- package/packages/pi-coding-agent/dist/cli.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli.js +16 -0
- package/packages/pi-coding-agent/dist/cli.js.map +1 -0
- package/packages/pi-coding-agent/dist/config.d.ts +68 -0
- package/packages/pi-coding-agent/dist/config.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/config.js +203 -0
- package/packages/pi-coding-agent/dist/config.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +618 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js +2481 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +134 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.js +415 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/bash-executor.d.ts +47 -0
- package/packages/pi-coding-agent/dist/core/bash-executor.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/bash-executor.js +212 -0
- package/packages/pi-coding-agent/dist/core/bash-executor.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts +86 -0
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js +242 -0
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +121 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +610 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/index.d.ts +7 -0
- package/packages/pi-coding-agent/dist/core/compaction/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/index.js +7 -0
- package/packages/pi-coding-agent/dist/core/compaction/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts +38 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.js +153 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/defaults.d.ts +3 -0
- package/packages/pi-coding-agent/dist/core/defaults.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/defaults.js +2 -0
- package/packages/pi-coding-agent/dist/core/defaults.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/diagnostics.d.ts +15 -0
- package/packages/pi-coding-agent/dist/core/diagnostics.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/diagnostics.js +2 -0
- package/packages/pi-coding-agent/dist/core/diagnostics.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/event-bus.d.ts +9 -0
- package/packages/pi-coding-agent/dist/core/event-bus.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/event-bus.js +25 -0
- package/packages/pi-coding-agent/dist/core/event-bus.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/exec.d.ts +29 -0
- package/packages/pi-coding-agent/dist/core/exec.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/exec.js +71 -0
- package/packages/pi-coding-agent/dist/core/exec.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js +249 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/index.d.ts +37 -0
- package/packages/pi-coding-agent/dist/core/export-html/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/index.js +223 -0
- package/packages/pi-coding-agent/dist/core/export-html/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/template.css +971 -0
- package/packages/pi-coding-agent/dist/core/export-html/template.html +54 -0
- package/packages/pi-coding-agent/dist/core/export-html/template.js +1583 -0
- package/packages/pi-coding-agent/dist/core/export-html/tool-renderer.d.ts +38 -0
- package/packages/pi-coding-agent/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/tool-renderer.js +70 -0
- package/packages/pi-coding-agent/dist/core/export-html/tool-renderer.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/vendor/.gitkeep +0 -0
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +11 -0
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/index.js +9 -0
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +25 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +426 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +147 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +672 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +1040 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.js +35 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/wrapper.d.ts +27 -0
- package/packages/pi-coding-agent/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/wrapper.js +102 -0
- package/packages/pi-coding-agent/dist/core/extensions/wrapper.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/footer-data-provider.d.ts +32 -0
- package/packages/pi-coding-agent/dist/core/footer-data-provider.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/footer-data-provider.js +134 -0
- package/packages/pi-coding-agent/dist/core/footer-data-provider.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/index.d.ts +9 -0
- package/packages/pi-coding-agent/dist/core/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/index.js +9 -0
- package/packages/pi-coding-agent/dist/core/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts +55 -0
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/keybindings.js +151 -0
- package/packages/pi-coding-agent/dist/core/keybindings.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/messages.d.ts +77 -0
- package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/messages.js +123 -0
- package/packages/pi-coding-agent/dist/core/messages.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +113 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.js +537 -0
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts +104 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.js +462 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/package-manager.d.ts +156 -0
- package/packages/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/package-manager.js +1442 -0
- package/packages/pi-coding-agent/dist/core/package-manager.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts +50 -0
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/prompt-templates.js +251 -0
- package/packages/pi-coding-agent/dist/core/prompt-templates.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.d.ts +17 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.js +59 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +184 -0
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/resource-loader.js +633 -0
- package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/sdk.d.ts +90 -0
- package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/sdk.js +242 -0
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts +323 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.js +1094 -0
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +232 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.js +682 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/skills.d.ts +58 -0
- package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/skills.js +364 -0
- package/packages/pi-coding-agent/dist/core/skills.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/slash-commands.d.ts +15 -0
- package/packages/pi-coding-agent/dist/core/slash-commands.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/slash-commands.js +22 -0
- package/packages/pi-coding-agent/dist/core/slash-commands.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts +28 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.js +159 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/timings.d.ts +7 -0
- package/packages/pi-coding-agent/dist/core/timings.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/timings.js +25 -0
- package/packages/pi-coding-agent/dist/core/timings.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts +55 -0
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/bash.js +269 -0
- package/packages/pi-coding-agent/dist/core/tools/bash.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/edit-diff.d.ts +63 -0
- package/packages/pi-coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/edit-diff.js +243 -0
- package/packages/pi-coding-agent/dist/core/tools/edit-diff.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/edit.d.ts +39 -0
- package/packages/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/edit.js +146 -0
- package/packages/pi-coding-agent/dist/core/tools/edit.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/find.d.ts +39 -0
- package/packages/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/find.js +206 -0
- package/packages/pi-coding-agent/dist/core/tools/find.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/grep.d.ts +45 -0
- package/packages/pi-coding-agent/dist/core/tools/grep.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/grep.js +239 -0
- package/packages/pi-coding-agent/dist/core/tools/grep.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts +73 -0
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/index.js +61 -0
- package/packages/pi-coding-agent/dist/core/tools/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/ls.d.ts +40 -0
- package/packages/pi-coding-agent/dist/core/tools/ls.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/ls.js +118 -0
- package/packages/pi-coding-agent/dist/core/tools/ls.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/path-utils.d.ts +8 -0
- package/packages/pi-coding-agent/dist/core/tools/path-utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/path-utils.js +81 -0
- package/packages/pi-coding-agent/dist/core/tools/path-utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/read.d.ts +39 -0
- package/packages/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/read.js +166 -0
- package/packages/pi-coding-agent/dist/core/tools/read.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/truncate.d.ts +70 -0
- package/packages/pi-coding-agent/dist/core/tools/truncate.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/truncate.js +205 -0
- package/packages/pi-coding-agent/dist/core/tools/truncate.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/write.d.ts +29 -0
- package/packages/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/write.js +78 -0
- package/packages/pi-coding-agent/dist/core/tools/write.js.map +1 -0
- package/packages/pi-coding-agent/dist/index.d.ts +27 -0
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/index.js +42 -0
- package/packages/pi-coding-agent/dist/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/main.d.ts +8 -0
- package/packages/pi-coding-agent/dist/main.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/main.js +691 -0
- package/packages/pi-coding-agent/dist/main.js.map +1 -0
- package/packages/pi-coding-agent/dist/migrations.d.ts +33 -0
- package/packages/pi-coding-agent/dist/migrations.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/migrations.js +261 -0
- package/packages/pi-coding-agent/dist/migrations.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/index.d.ts +9 -0
- package/packages/pi-coding-agent/dist/modes/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/index.js +8 -0
- package/packages/pi-coding-agent/dist/modes/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/armin.d.ts +34 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/armin.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/armin.js +329 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/armin.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts +16 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +92 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts +35 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +156 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bordered-loader.js +48 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js +42 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +43 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/config-selector.d.ts +71 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/config-selector.js +470 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js +28 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-editor.js +63 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-message.js +74 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/daxnuts.js +138 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/daxnuts.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/diff.d.ts +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/diff.js +133 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/diff.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js +20 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-editor.d.ts +20 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-editor.js +106 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-input.js +55 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-selector.d.ts +24 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-selector.js +71 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts +26 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +196 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/index.d.ts +32 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/index.js +33 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts +41 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.js +61 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts +42 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +139 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts +47 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js +259 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/oauth-selector.d.ts +19 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/oauth-selector.js +92 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts +49 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js +271 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +155 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js +825 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts +58 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +295 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/show-images-selector.js +34 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +45 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/theme-selector.js +44 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/thinking-selector.js +46 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +77 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +773 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts +87 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +1026 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message-selector.js +110 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts +9 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js +27 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +330 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +3755 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/dark.json +86 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/light.json +85 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +78 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +944 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.d.ts +28 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.js +101 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/jsonl.d.ts +17 -0
- package/packages/pi-coding-agent/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/jsonl.js +49 -0
- package/packages/pi-coding-agent/dist/modes/rpc/jsonl.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-client.d.ts +217 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-client.js +400 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-client.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js +509 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.d.ts +409 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.js +8 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts +21 -0
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/changelog.js +87 -0
- package/packages/pi-coding-agent/dist/utils/changelog.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts +11 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js +162 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-native.d.ts +7 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-native.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-native.js +14 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-native.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/clipboard.d.ts +2 -0
- package/packages/pi-coding-agent/dist/utils/clipboard.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/clipboard.js +67 -0
- package/packages/pi-coding-agent/dist/utils/clipboard.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/frontmatter.d.ts +8 -0
- package/packages/pi-coding-agent/dist/utils/frontmatter.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/frontmatter.js +26 -0
- package/packages/pi-coding-agent/dist/utils/frontmatter.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/git.d.ts +26 -0
- package/packages/pi-coding-agent/dist/utils/git.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/git.js +163 -0
- package/packages/pi-coding-agent/dist/utils/git.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/image-convert.d.ts +9 -0
- package/packages/pi-coding-agent/dist/utils/image-convert.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/image-convert.js +35 -0
- package/packages/pi-coding-agent/dist/utils/image-convert.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/image-resize.d.ts +36 -0
- package/packages/pi-coding-agent/dist/utils/image-resize.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/image-resize.js +181 -0
- package/packages/pi-coding-agent/dist/utils/image-resize.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/mime.d.ts +2 -0
- package/packages/pi-coding-agent/dist/utils/mime.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/mime.js +26 -0
- package/packages/pi-coding-agent/dist/utils/mime.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/photon.d.ts +21 -0
- package/packages/pi-coding-agent/dist/utils/photon.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/photon.js +121 -0
- package/packages/pi-coding-agent/dist/utils/photon.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/shell.d.ts +26 -0
- package/packages/pi-coding-agent/dist/utils/shell.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/shell.js +186 -0
- package/packages/pi-coding-agent/dist/utils/shell.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/sleep.d.ts +5 -0
- package/packages/pi-coding-agent/dist/utils/sleep.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/sleep.js +17 -0
- package/packages/pi-coding-agent/dist/utils/sleep.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts +3 -0
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/tools-manager.js +251 -0
- package/packages/pi-coding-agent/dist/utils/tools-manager.js.map +1 -0
- package/packages/pi-coding-agent/package.json +55 -0
- package/packages/pi-coding-agent/src/cli/args.ts +316 -0
- package/packages/pi-coding-agent/src/cli/config-selector.ts +52 -0
- package/packages/pi-coding-agent/src/cli/file-processor.ts +96 -0
- package/packages/pi-coding-agent/src/cli/list-models.ts +104 -0
- package/packages/pi-coding-agent/src/cli/session-picker.ts +51 -0
- package/packages/pi-coding-agent/src/cli.ts +18 -0
- package/packages/pi-coding-agent/src/config.ts +241 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +3050 -0
- package/packages/pi-coding-agent/src/core/auth-storage.ts +489 -0
- package/packages/pi-coding-agent/src/core/bash-executor.ts +278 -0
- package/packages/pi-coding-agent/src/core/compaction/branch-summarization.ts +352 -0
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +813 -0
- package/packages/pi-coding-agent/src/core/compaction/index.ts +7 -0
- package/packages/pi-coding-agent/src/core/compaction/utils.ts +170 -0
- package/packages/pi-coding-agent/src/core/defaults.ts +3 -0
- package/packages/pi-coding-agent/src/core/diagnostics.ts +15 -0
- package/packages/pi-coding-agent/src/core/event-bus.ts +33 -0
- package/packages/pi-coding-agent/src/core/exec.ts +104 -0
- package/packages/pi-coding-agent/src/core/export-html/ansi-to-html.ts +258 -0
- package/packages/pi-coding-agent/src/core/export-html/index.ts +306 -0
- package/packages/pi-coding-agent/src/core/export-html/template.css +971 -0
- package/packages/pi-coding-agent/src/core/export-html/template.html +54 -0
- package/packages/pi-coding-agent/src/core/export-html/template.js +1583 -0
- package/packages/pi-coding-agent/src/core/export-html/tool-renderer.ts +114 -0
- package/packages/pi-coding-agent/src/core/export-html/vendor/.gitkeep +0 -0
- package/packages/pi-coding-agent/src/core/extensions/index.ts +171 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +545 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +884 -0
- package/packages/pi-coding-agent/src/core/extensions/types.ts +1411 -0
- package/packages/pi-coding-agent/src/core/extensions/wrapper.ts +118 -0
- package/packages/pi-coding-agent/src/core/footer-data-provider.ts +144 -0
- package/packages/pi-coding-agent/src/core/index.ts +61 -0
- package/packages/pi-coding-agent/src/core/keybindings.ts +211 -0
- package/packages/pi-coding-agent/src/core/messages.ts +195 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +694 -0
- package/packages/pi-coding-agent/src/core/model-resolver.ts +594 -0
- package/packages/pi-coding-agent/src/core/package-manager.ts +1794 -0
- package/packages/pi-coding-agent/src/core/prompt-templates.ts +299 -0
- package/packages/pi-coding-agent/src/core/resolve-config-value.ts +64 -0
- package/packages/pi-coding-agent/src/core/resource-loader.ts +868 -0
- package/packages/pi-coding-agent/src/core/sdk.ts +373 -0
- package/packages/pi-coding-agent/src/core/session-manager.ts +1410 -0
- package/packages/pi-coding-agent/src/core/settings-manager.ts +942 -0
- package/packages/pi-coding-agent/src/core/skills.ts +459 -0
- package/packages/pi-coding-agent/src/core/slash-commands.ts +38 -0
- package/packages/pi-coding-agent/src/core/system-prompt.ts +218 -0
- package/packages/pi-coding-agent/src/core/timings.ts +25 -0
- package/packages/pi-coding-agent/src/core/tools/bash.ts +347 -0
- package/packages/pi-coding-agent/src/core/tools/edit-diff.ts +308 -0
- package/packages/pi-coding-agent/src/core/tools/edit.ts +227 -0
- package/packages/pi-coding-agent/src/core/tools/find.ts +273 -0
- package/packages/pi-coding-agent/src/core/tools/grep.ts +346 -0
- package/packages/pi-coding-agent/src/core/tools/index.ts +139 -0
- package/packages/pi-coding-agent/src/core/tools/ls.ts +170 -0
- package/packages/pi-coding-agent/src/core/tools/path-utils.ts +94 -0
- package/packages/pi-coding-agent/src/core/tools/read.ts +222 -0
- package/packages/pi-coding-agent/src/core/tools/truncate.ts +265 -0
- package/packages/pi-coding-agent/src/core/tools/write.ts +118 -0
- package/packages/pi-coding-agent/src/index.ts +333 -0
- package/packages/pi-coding-agent/src/main.ts +821 -0
- package/packages/pi-coding-agent/src/migrations.ts +295 -0
- package/packages/pi-coding-agent/src/modes/index.ts +9 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/armin.ts +382 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +115 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/bash-execution.ts +210 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/bordered-loader.ts +66 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/branch-summary-message.ts +58 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/compaction-summary-message.ts +59 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/config-selector.ts +592 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/countdown-timer.ts +38 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/custom-editor.ts +80 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/custom-message.ts +99 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/daxnuts.ts +164 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/diff.ts +147 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.ts +25 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/extension-editor.ts +147 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/extension-input.ts +85 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/extension-selector.ts +107 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +216 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/index.ts +32 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/keybinding-hints.ts +66 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/login-dialog.ts +174 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts +329 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/oauth-selector.ts +121 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/scoped-models-selector.ts +346 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector-search.ts +194 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector.ts +1019 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/settings-selector.ts +421 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/show-images-selector.ts +45 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/skill-invocation-message.ts +55 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/theme-selector.ts +62 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/thinking-selector.ts +64 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +916 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-selector.ts +1184 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/user-message-selector.ts +143 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/user-message.ts +32 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/visual-truncate.ts +50 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +4464 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/dark.json +86 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/light.json +85 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.json +335 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +1105 -0
- package/packages/pi-coding-agent/src/modes/print-mode.ts +124 -0
- package/packages/pi-coding-agent/src/modes/rpc/jsonl.ts +58 -0
- package/packages/pi-coding-agent/src/modes/rpc/rpc-client.ts +505 -0
- package/packages/pi-coding-agent/src/modes/rpc/rpc-mode.ts +638 -0
- package/packages/pi-coding-agent/src/modes/rpc/rpc-types.ts +263 -0
- package/packages/pi-coding-agent/src/utils/changelog.ts +99 -0
- package/packages/pi-coding-agent/src/utils/clipboard-image.ts +207 -0
- package/packages/pi-coding-agent/src/utils/clipboard-native.ts +21 -0
- package/packages/pi-coding-agent/src/utils/clipboard.ts +62 -0
- package/packages/pi-coding-agent/src/utils/frontmatter.ts +39 -0
- package/packages/pi-coding-agent/src/utils/git.ts +192 -0
- package/packages/pi-coding-agent/src/utils/image-convert.ts +38 -0
- package/packages/pi-coding-agent/src/utils/image-resize.ts +231 -0
- package/packages/pi-coding-agent/src/utils/mime.ts +30 -0
- package/packages/pi-coding-agent/src/utils/photon.ts +139 -0
- package/packages/pi-coding-agent/src/utils/shell.ts +202 -0
- package/packages/pi-coding-agent/src/utils/sleep.ts +18 -0
- package/packages/pi-coding-agent/src/utils/tools-manager.ts +286 -0
- package/packages/pi-coding-agent/tsconfig.json +27 -0
- package/packages/pi-tui/dist/autocomplete.d.ts +50 -0
- package/packages/pi-tui/dist/autocomplete.d.ts.map +1 -0
- package/packages/pi-tui/dist/autocomplete.js +593 -0
- package/packages/pi-tui/dist/autocomplete.js.map +1 -0
- package/packages/pi-tui/dist/components/box.d.ts +22 -0
- package/packages/pi-tui/dist/components/box.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/box.js +99 -0
- package/packages/pi-tui/dist/components/box.js.map +1 -0
- package/packages/pi-tui/dist/components/cancellable-loader.d.ts +22 -0
- package/packages/pi-tui/dist/components/cancellable-loader.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/cancellable-loader.js +36 -0
- package/packages/pi-tui/dist/components/cancellable-loader.js.map +1 -0
- package/packages/pi-tui/dist/components/editor.d.ts +219 -0
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/editor.js +1693 -0
- package/packages/pi-tui/dist/components/editor.js.map +1 -0
- package/packages/pi-tui/dist/components/image.d.ts +28 -0
- package/packages/pi-tui/dist/components/image.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/image.js +61 -0
- package/packages/pi-tui/dist/components/image.js.map +1 -0
- package/packages/pi-tui/dist/components/input.d.ts +37 -0
- package/packages/pi-tui/dist/components/input.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/input.js +443 -0
- package/packages/pi-tui/dist/components/input.js.map +1 -0
- package/packages/pi-tui/dist/components/loader.d.ts +21 -0
- package/packages/pi-tui/dist/components/loader.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/loader.js +46 -0
- package/packages/pi-tui/dist/components/loader.js.map +1 -0
- package/packages/pi-tui/dist/components/markdown.d.ts +95 -0
- package/packages/pi-tui/dist/components/markdown.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/markdown.js +641 -0
- package/packages/pi-tui/dist/components/markdown.js.map +1 -0
- package/packages/pi-tui/dist/components/select-list.d.ts +32 -0
- package/packages/pi-tui/dist/components/select-list.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/select-list.js +148 -0
- package/packages/pi-tui/dist/components/select-list.js.map +1 -0
- package/packages/pi-tui/dist/components/settings-list.d.ts +50 -0
- package/packages/pi-tui/dist/components/settings-list.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/settings-list.js +177 -0
- package/packages/pi-tui/dist/components/settings-list.js.map +1 -0
- package/packages/pi-tui/dist/components/spacer.d.ts +12 -0
- package/packages/pi-tui/dist/components/spacer.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/spacer.js +22 -0
- package/packages/pi-tui/dist/components/spacer.js.map +1 -0
- package/packages/pi-tui/dist/components/text.d.ts +19 -0
- package/packages/pi-tui/dist/components/text.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/text.js +81 -0
- package/packages/pi-tui/dist/components/text.js.map +1 -0
- package/packages/pi-tui/dist/components/truncated-text.d.ts +13 -0
- package/packages/pi-tui/dist/components/truncated-text.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/truncated-text.js +48 -0
- package/packages/pi-tui/dist/components/truncated-text.js.map +1 -0
- package/packages/pi-tui/dist/editor-component.d.ts +39 -0
- package/packages/pi-tui/dist/editor-component.d.ts.map +1 -0
- package/packages/pi-tui/dist/editor-component.js +2 -0
- package/packages/pi-tui/dist/editor-component.js.map +1 -0
- package/packages/pi-tui/dist/fuzzy.d.ts +16 -0
- package/packages/pi-tui/dist/fuzzy.d.ts.map +1 -0
- package/packages/pi-tui/dist/fuzzy.js +107 -0
- package/packages/pi-tui/dist/fuzzy.js.map +1 -0
- package/packages/pi-tui/dist/index.d.ts +23 -0
- package/packages/pi-tui/dist/index.d.ts.map +1 -0
- package/packages/pi-tui/dist/index.js +32 -0
- package/packages/pi-tui/dist/index.js.map +1 -0
- package/packages/pi-tui/dist/keybindings.d.ts +39 -0
- package/packages/pi-tui/dist/keybindings.d.ts.map +1 -0
- package/packages/pi-tui/dist/keybindings.js +116 -0
- package/packages/pi-tui/dist/keybindings.js.map +1 -0
- package/packages/pi-tui/dist/keys.d.ts +170 -0
- package/packages/pi-tui/dist/keys.d.ts.map +1 -0
- package/packages/pi-tui/dist/keys.js +1046 -0
- package/packages/pi-tui/dist/keys.js.map +1 -0
- package/packages/pi-tui/dist/kill-ring.d.ts +28 -0
- package/packages/pi-tui/dist/kill-ring.d.ts.map +1 -0
- package/packages/pi-tui/dist/kill-ring.js +46 -0
- package/packages/pi-tui/dist/kill-ring.js.map +1 -0
- package/packages/pi-tui/dist/stdin-buffer.d.ts +48 -0
- package/packages/pi-tui/dist/stdin-buffer.d.ts.map +1 -0
- package/packages/pi-tui/dist/stdin-buffer.js +316 -0
- package/packages/pi-tui/dist/stdin-buffer.js.map +1 -0
- package/packages/pi-tui/dist/terminal-image.d.ts +68 -0
- package/packages/pi-tui/dist/terminal-image.d.ts.map +1 -0
- package/packages/pi-tui/dist/terminal-image.js +288 -0
- package/packages/pi-tui/dist/terminal-image.js.map +1 -0
- package/packages/pi-tui/dist/terminal.d.ts +85 -0
- package/packages/pi-tui/dist/terminal.d.ts.map +1 -0
- package/packages/pi-tui/dist/terminal.js +271 -0
- package/packages/pi-tui/dist/terminal.js.map +1 -0
- package/packages/pi-tui/dist/tui.d.ts +220 -0
- package/packages/pi-tui/dist/tui.d.ts.map +1 -0
- package/packages/pi-tui/dist/tui.js +976 -0
- package/packages/pi-tui/dist/tui.js.map +1 -0
- package/packages/pi-tui/dist/undo-stack.d.ts +17 -0
- package/packages/pi-tui/dist/undo-stack.d.ts.map +1 -0
- package/packages/pi-tui/dist/undo-stack.js +27 -0
- package/packages/pi-tui/dist/undo-stack.js.map +1 -0
- package/packages/pi-tui/dist/utils.d.ts +78 -0
- package/packages/pi-tui/dist/utils.d.ts.map +1 -0
- package/packages/pi-tui/dist/utils.js +817 -0
- package/packages/pi-tui/dist/utils.js.map +1 -0
- package/packages/pi-tui/package.json +21 -0
- package/packages/pi-tui/src/autocomplete.ts +736 -0
- package/packages/pi-tui/src/components/box.ts +137 -0
- package/packages/pi-tui/src/components/cancellable-loader.ts +40 -0
- package/packages/pi-tui/src/components/editor.ts +2035 -0
- package/packages/pi-tui/src/components/image.ts +104 -0
- package/packages/pi-tui/src/components/input.ts +521 -0
- package/packages/pi-tui/src/components/loader.ts +55 -0
- package/packages/pi-tui/src/components/markdown.ts +806 -0
- package/packages/pi-tui/src/components/select-list.ts +188 -0
- package/packages/pi-tui/src/components/settings-list.ts +250 -0
- package/packages/pi-tui/src/components/spacer.ts +28 -0
- package/packages/pi-tui/src/components/text.ts +106 -0
- package/packages/pi-tui/src/components/truncated-text.ts +65 -0
- package/packages/pi-tui/src/editor-component.ts +74 -0
- package/packages/pi-tui/src/fuzzy.ts +133 -0
- package/packages/pi-tui/src/index.ts +93 -0
- package/packages/pi-tui/src/keybindings.ts +189 -0
- package/packages/pi-tui/src/keys.ts +1255 -0
- package/packages/pi-tui/src/kill-ring.ts +46 -0
- package/packages/pi-tui/src/stdin-buffer.ts +386 -0
- package/packages/pi-tui/src/terminal-image.ts +381 -0
- package/packages/pi-tui/src/terminal.ts +349 -0
- package/packages/pi-tui/src/tui.ts +1212 -0
- package/packages/pi-tui/src/undo-stack.ts +28 -0
- package/packages/pi-tui/src/utils.ts +905 -0
- package/packages/pi-tui/tsconfig.json +27 -0
- package/pkg/dist/modes/interactive/theme/dark.json +6 -6
- package/pkg/dist/modes/interactive/theme/light.json +6 -5
- package/pkg/dist/modes/interactive/theme/theme.d.ts +2 -2
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +1 -6
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
- package/scripts/postinstall.js +2 -17
- package/src/resources/extensions/ask-user-questions.ts +2 -2
- package/src/resources/extensions/bg-shell/index.ts +4 -4
- package/src/resources/extensions/browser-tools/index.ts +3 -3
- package/src/resources/extensions/context7/index.ts +3 -3
- package/src/resources/extensions/get-secrets-from-user.ts +331 -59
- package/src/resources/extensions/google-search/index.ts +20 -7
- package/src/resources/extensions/gsd/activity-log.ts +1 -1
- package/src/resources/extensions/gsd/auto.ts +106 -21
- package/src/resources/extensions/gsd/commands.ts +2 -2
- package/src/resources/extensions/gsd/dashboard-overlay.ts +2 -2
- package/src/resources/extensions/gsd/docs/preferences-reference.md +45 -1
- package/src/resources/extensions/gsd/doctor.ts +23 -4
- package/src/resources/extensions/gsd/files.ts +115 -1
- package/src/resources/extensions/gsd/git-service.ts +64 -111
- package/src/resources/extensions/gsd/guided-flow.ts +3 -2
- package/src/resources/extensions/gsd/index.ts +18 -7
- package/src/resources/extensions/gsd/metrics.ts +1 -1
- package/src/resources/extensions/gsd/migrate/command.ts +1 -1
- package/src/resources/extensions/gsd/preferences.ts +72 -10
- package/src/resources/extensions/gsd/prompts/guided-plan-milestone.md +4 -0
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +17 -0
- package/src/resources/extensions/gsd/session-forensics.ts +19 -6
- package/src/resources/extensions/gsd/skill-discovery.ts +1 -1
- package/src/resources/extensions/gsd/templates/secrets-manifest.md +22 -0
- package/src/resources/extensions/gsd/tests/auto-secrets-gate.test.ts +196 -0
- package/src/resources/extensions/gsd/tests/collect-from-manifest.test.ts +469 -0
- package/src/resources/extensions/gsd/tests/doctor-fixlevel.test.ts +170 -0
- package/src/resources/extensions/gsd/tests/git-service.test.ts +43 -0
- package/src/resources/extensions/gsd/tests/manifest-status.test.ts +283 -0
- package/src/resources/extensions/gsd/tests/parsers.test.ts +401 -65
- package/src/resources/extensions/gsd/tests/resolve-ts-hooks.mjs +2 -1
- package/src/resources/extensions/gsd/tests/secure-env-collect.test.ts +185 -0
- package/src/resources/extensions/gsd/types.ts +27 -0
- package/src/resources/extensions/gsd/worktree-command.ts +2 -2
- package/src/resources/extensions/mac-tools/index.ts +2 -2
- package/src/resources/extensions/mcporter/index.ts +3 -3
- package/src/resources/extensions/remote-questions/remote-command.ts +3 -3
- package/src/resources/extensions/search-the-web/command-search-provider.ts +2 -2
- package/src/resources/extensions/search-the-web/index.ts +1 -1
- package/src/resources/extensions/search-the-web/provider.ts +1 -1
- package/src/resources/extensions/search-the-web/tool-fetch-page.ts +3 -3
- package/src/resources/extensions/search-the-web/tool-llm-context.ts +4 -4
- package/src/resources/extensions/search-the-web/tool-search.ts +4 -4
- package/src/resources/extensions/shared/confirm-ui.ts +3 -3
- package/src/resources/extensions/shared/interview-ui.ts +3 -3
- package/src/resources/extensions/shared/next-action-ui.ts +3 -3
- package/src/resources/extensions/shared/progress-widget.ts +2 -2
- package/src/resources/extensions/shared/thinking-widget.ts +3 -3
- package/src/resources/extensions/shared/ui.ts +4 -4
- package/src/resources/extensions/shared/wizard-ui.ts +4 -4
- package/src/resources/extensions/slash-commands/audit.ts +1 -1
- package/src/resources/extensions/slash-commands/clear.ts +1 -1
- package/src/resources/extensions/slash-commands/create-extension.ts +2 -2
- package/src/resources/extensions/slash-commands/create-slash-command.ts +2 -2
- package/src/resources/extensions/slash-commands/index.ts +1 -1
- package/src/resources/extensions/subagent/agents.ts +1 -1
- package/src/resources/extensions/subagent/index.ts +5 -5
- package/src/resources/extensions/voice/index.ts +3 -3
- package/patches/@mariozechner+pi-coding-agent+0.57.1.patch +0 -78
- package/patches/@mariozechner+pi-tui+0.57.1.patch +0 -47
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANSI escape code to HTML converter.
|
|
3
|
+
*
|
|
4
|
+
* Converts terminal ANSI color/style codes to HTML with inline styles.
|
|
5
|
+
* Supports:
|
|
6
|
+
* - Standard foreground colors (30-37) and bright variants (90-97)
|
|
7
|
+
* - Standard background colors (40-47) and bright variants (100-107)
|
|
8
|
+
* - 256-color palette (38;5;N and 48;5;N)
|
|
9
|
+
* - RGB true color (38;2;R;G;B and 48;2;R;G;B)
|
|
10
|
+
* - Text styles: bold (1), dim (2), italic (3), underline (4)
|
|
11
|
+
* - Reset (0)
|
|
12
|
+
*/
|
|
13
|
+
// Standard ANSI color palette (0-15)
|
|
14
|
+
const ANSI_COLORS = [
|
|
15
|
+
"#000000", // 0: black
|
|
16
|
+
"#800000", // 1: red
|
|
17
|
+
"#008000", // 2: green
|
|
18
|
+
"#808000", // 3: yellow
|
|
19
|
+
"#000080", // 4: blue
|
|
20
|
+
"#800080", // 5: magenta
|
|
21
|
+
"#008080", // 6: cyan
|
|
22
|
+
"#c0c0c0", // 7: white
|
|
23
|
+
"#808080", // 8: bright black
|
|
24
|
+
"#ff0000", // 9: bright red
|
|
25
|
+
"#00ff00", // 10: bright green
|
|
26
|
+
"#ffff00", // 11: bright yellow
|
|
27
|
+
"#0000ff", // 12: bright blue
|
|
28
|
+
"#ff00ff", // 13: bright magenta
|
|
29
|
+
"#00ffff", // 14: bright cyan
|
|
30
|
+
"#ffffff", // 15: bright white
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* Convert 256-color index to hex.
|
|
34
|
+
*/
|
|
35
|
+
function color256ToHex(index) {
|
|
36
|
+
// Standard colors (0-15)
|
|
37
|
+
if (index < 16) {
|
|
38
|
+
return ANSI_COLORS[index];
|
|
39
|
+
}
|
|
40
|
+
// Color cube (16-231): 6x6x6 = 216 colors
|
|
41
|
+
if (index < 232) {
|
|
42
|
+
const cubeIndex = index - 16;
|
|
43
|
+
const r = Math.floor(cubeIndex / 36);
|
|
44
|
+
const g = Math.floor((cubeIndex % 36) / 6);
|
|
45
|
+
const b = cubeIndex % 6;
|
|
46
|
+
const toComponent = (n) => (n === 0 ? 0 : 55 + n * 40);
|
|
47
|
+
const toHex = (n) => toComponent(n).toString(16).padStart(2, "0");
|
|
48
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
49
|
+
}
|
|
50
|
+
// Grayscale (232-255): 24 shades
|
|
51
|
+
const gray = 8 + (index - 232) * 10;
|
|
52
|
+
const grayHex = gray.toString(16).padStart(2, "0");
|
|
53
|
+
return `#${grayHex}${grayHex}${grayHex}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Escape HTML special characters.
|
|
57
|
+
*/
|
|
58
|
+
function escapeHtml(text) {
|
|
59
|
+
return text
|
|
60
|
+
.replace(/&/g, "&")
|
|
61
|
+
.replace(/</g, "<")
|
|
62
|
+
.replace(/>/g, ">")
|
|
63
|
+
.replace(/"/g, """)
|
|
64
|
+
.replace(/'/g, "'");
|
|
65
|
+
}
|
|
66
|
+
function createEmptyStyle() {
|
|
67
|
+
return {
|
|
68
|
+
fg: null,
|
|
69
|
+
bg: null,
|
|
70
|
+
bold: false,
|
|
71
|
+
dim: false,
|
|
72
|
+
italic: false,
|
|
73
|
+
underline: false,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function styleToInlineCSS(style) {
|
|
77
|
+
const parts = [];
|
|
78
|
+
if (style.fg)
|
|
79
|
+
parts.push(`color:${style.fg}`);
|
|
80
|
+
if (style.bg)
|
|
81
|
+
parts.push(`background-color:${style.bg}`);
|
|
82
|
+
if (style.bold)
|
|
83
|
+
parts.push("font-weight:bold");
|
|
84
|
+
if (style.dim)
|
|
85
|
+
parts.push("opacity:0.6");
|
|
86
|
+
if (style.italic)
|
|
87
|
+
parts.push("font-style:italic");
|
|
88
|
+
if (style.underline)
|
|
89
|
+
parts.push("text-decoration:underline");
|
|
90
|
+
return parts.join(";");
|
|
91
|
+
}
|
|
92
|
+
function hasStyle(style) {
|
|
93
|
+
return style.fg !== null || style.bg !== null || style.bold || style.dim || style.italic || style.underline;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Parse ANSI SGR (Select Graphic Rendition) codes and update style.
|
|
97
|
+
*/
|
|
98
|
+
function applySgrCode(params, style) {
|
|
99
|
+
let i = 0;
|
|
100
|
+
while (i < params.length) {
|
|
101
|
+
const code = params[i];
|
|
102
|
+
if (code === 0) {
|
|
103
|
+
// Reset all
|
|
104
|
+
style.fg = null;
|
|
105
|
+
style.bg = null;
|
|
106
|
+
style.bold = false;
|
|
107
|
+
style.dim = false;
|
|
108
|
+
style.italic = false;
|
|
109
|
+
style.underline = false;
|
|
110
|
+
}
|
|
111
|
+
else if (code === 1) {
|
|
112
|
+
style.bold = true;
|
|
113
|
+
}
|
|
114
|
+
else if (code === 2) {
|
|
115
|
+
style.dim = true;
|
|
116
|
+
}
|
|
117
|
+
else if (code === 3) {
|
|
118
|
+
style.italic = true;
|
|
119
|
+
}
|
|
120
|
+
else if (code === 4) {
|
|
121
|
+
style.underline = true;
|
|
122
|
+
}
|
|
123
|
+
else if (code === 22) {
|
|
124
|
+
// Reset bold/dim
|
|
125
|
+
style.bold = false;
|
|
126
|
+
style.dim = false;
|
|
127
|
+
}
|
|
128
|
+
else if (code === 23) {
|
|
129
|
+
style.italic = false;
|
|
130
|
+
}
|
|
131
|
+
else if (code === 24) {
|
|
132
|
+
style.underline = false;
|
|
133
|
+
}
|
|
134
|
+
else if (code >= 30 && code <= 37) {
|
|
135
|
+
// Standard foreground colors
|
|
136
|
+
style.fg = ANSI_COLORS[code - 30];
|
|
137
|
+
}
|
|
138
|
+
else if (code === 38) {
|
|
139
|
+
// Extended foreground color
|
|
140
|
+
if (params[i + 1] === 5 && params.length > i + 2) {
|
|
141
|
+
// 256-color: 38;5;N
|
|
142
|
+
style.fg = color256ToHex(params[i + 2]);
|
|
143
|
+
i += 2;
|
|
144
|
+
}
|
|
145
|
+
else if (params[i + 1] === 2 && params.length > i + 4) {
|
|
146
|
+
// RGB: 38;2;R;G;B
|
|
147
|
+
const r = params[i + 2];
|
|
148
|
+
const g = params[i + 3];
|
|
149
|
+
const b = params[i + 4];
|
|
150
|
+
style.fg = `rgb(${r},${g},${b})`;
|
|
151
|
+
i += 4;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else if (code === 39) {
|
|
155
|
+
// Default foreground
|
|
156
|
+
style.fg = null;
|
|
157
|
+
}
|
|
158
|
+
else if (code >= 40 && code <= 47) {
|
|
159
|
+
// Standard background colors
|
|
160
|
+
style.bg = ANSI_COLORS[code - 40];
|
|
161
|
+
}
|
|
162
|
+
else if (code === 48) {
|
|
163
|
+
// Extended background color
|
|
164
|
+
if (params[i + 1] === 5 && params.length > i + 2) {
|
|
165
|
+
// 256-color: 48;5;N
|
|
166
|
+
style.bg = color256ToHex(params[i + 2]);
|
|
167
|
+
i += 2;
|
|
168
|
+
}
|
|
169
|
+
else if (params[i + 1] === 2 && params.length > i + 4) {
|
|
170
|
+
// RGB: 48;2;R;G;B
|
|
171
|
+
const r = params[i + 2];
|
|
172
|
+
const g = params[i + 3];
|
|
173
|
+
const b = params[i + 4];
|
|
174
|
+
style.bg = `rgb(${r},${g},${b})`;
|
|
175
|
+
i += 4;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
else if (code === 49) {
|
|
179
|
+
// Default background
|
|
180
|
+
style.bg = null;
|
|
181
|
+
}
|
|
182
|
+
else if (code >= 90 && code <= 97) {
|
|
183
|
+
// Bright foreground colors
|
|
184
|
+
style.fg = ANSI_COLORS[code - 90 + 8];
|
|
185
|
+
}
|
|
186
|
+
else if (code >= 100 && code <= 107) {
|
|
187
|
+
// Bright background colors
|
|
188
|
+
style.bg = ANSI_COLORS[code - 100 + 8];
|
|
189
|
+
}
|
|
190
|
+
// Ignore unrecognized codes
|
|
191
|
+
i++;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// Match ANSI escape sequences: ESC[ followed by params and ending with 'm'
|
|
195
|
+
const ANSI_REGEX = /\x1b\[([\d;]*)m/g;
|
|
196
|
+
/**
|
|
197
|
+
* Convert ANSI-escaped text to HTML with inline styles.
|
|
198
|
+
*/
|
|
199
|
+
export function ansiToHtml(text) {
|
|
200
|
+
const style = createEmptyStyle();
|
|
201
|
+
let result = "";
|
|
202
|
+
let lastIndex = 0;
|
|
203
|
+
let inSpan = false;
|
|
204
|
+
// Reset regex state
|
|
205
|
+
ANSI_REGEX.lastIndex = 0;
|
|
206
|
+
let match = ANSI_REGEX.exec(text);
|
|
207
|
+
while (match !== null) {
|
|
208
|
+
// Add text before this escape sequence
|
|
209
|
+
const beforeText = text.slice(lastIndex, match.index);
|
|
210
|
+
if (beforeText) {
|
|
211
|
+
result += escapeHtml(beforeText);
|
|
212
|
+
}
|
|
213
|
+
// Parse SGR parameters
|
|
214
|
+
const paramStr = match[1];
|
|
215
|
+
const params = paramStr ? paramStr.split(";").map((p) => parseInt(p, 10) || 0) : [0];
|
|
216
|
+
// Close existing span if we have one
|
|
217
|
+
if (inSpan) {
|
|
218
|
+
result += "</span>";
|
|
219
|
+
inSpan = false;
|
|
220
|
+
}
|
|
221
|
+
// Apply the codes
|
|
222
|
+
applySgrCode(params, style);
|
|
223
|
+
// Open new span if we have any styling
|
|
224
|
+
if (hasStyle(style)) {
|
|
225
|
+
result += `<span style="${styleToInlineCSS(style)}">`;
|
|
226
|
+
inSpan = true;
|
|
227
|
+
}
|
|
228
|
+
lastIndex = match.index + match[0].length;
|
|
229
|
+
match = ANSI_REGEX.exec(text);
|
|
230
|
+
}
|
|
231
|
+
// Add remaining text
|
|
232
|
+
const remainingText = text.slice(lastIndex);
|
|
233
|
+
if (remainingText) {
|
|
234
|
+
result += escapeHtml(remainingText);
|
|
235
|
+
}
|
|
236
|
+
// Close any open span
|
|
237
|
+
if (inSpan) {
|
|
238
|
+
result += "</span>";
|
|
239
|
+
}
|
|
240
|
+
return result;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Convert array of ANSI-escaped lines to HTML.
|
|
244
|
+
* Each line is wrapped in a div element.
|
|
245
|
+
*/
|
|
246
|
+
export function ansiLinesToHtml(lines) {
|
|
247
|
+
return lines.map((line) => `<div class="ansi-line">${ansiToHtml(line) || " "}</div>`).join("\n");
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=ansi-to-html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansi-to-html.js","sourceRoot":"","sources":["../../../src/core/export-html/ansi-to-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,qCAAqC;AACrC,MAAM,WAAW,GAAG;IACnB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,UAAU;IACrB,SAAS,EAAE,aAAa;IACxB,SAAS,EAAE,UAAU;IACrB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,kBAAkB;IAC7B,SAAS,EAAE,gBAAgB;IAC3B,SAAS,EAAE,mBAAmB;IAC9B,SAAS,EAAE,oBAAoB;IAC/B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AAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAErF,qCAAqC;QACrC,IAAI,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,SAAS,CAAC;YACpB,MAAM,GAAG,KAAK,CAAC;QAChB,CAAC;QAED,kBAAkB;QAClB,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAE5B,uCAAuC;QACvC,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,gBAAgB,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC;YACtD,MAAM,GAAG,IAAI,CAAC;QACf,CAAC;QAED,SAAS,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAC1C,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,qBAAqB;IACrB,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC5C,IAAI,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED,sBAAsB;IACtB,IAAI,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAe;IAC9C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,0BAA0B,UAAU,CAAC,IAAI,CAAC,IAAI,QAAQ,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvG,CAAC","sourcesContent":["/**\n * ANSI escape code to HTML converter.\n *\n * Converts terminal ANSI color/style codes to HTML with inline styles.\n * Supports:\n * - Standard foreground colors (30-37) and bright variants (90-97)\n * - Standard background colors (40-47) and bright variants (100-107)\n * - 256-color palette (38;5;N and 48;5;N)\n * - RGB true color (38;2;R;G;B and 48;2;R;G;B)\n * - Text styles: bold (1), dim (2), italic (3), underline (4)\n * - Reset (0)\n */\n\n// Standard ANSI color palette (0-15)\nconst ANSI_COLORS = [\n\t\"#000000\", // 0: black\n\t\"#800000\", // 1: red\n\t\"#008000\", // 2: green\n\t\"#808000\", // 3: yellow\n\t\"#000080\", // 4: blue\n\t\"#800080\", // 5: magenta\n\t\"#008080\", // 6: cyan\n\t\"#c0c0c0\", // 7: white\n\t\"#808080\", // 8: bright black\n\t\"#ff0000\", // 9: bright red\n\t\"#00ff00\", // 10: bright green\n\t\"#ffff00\", // 11: bright yellow\n\t\"#0000ff\", // 12: bright blue\n\t\"#ff00ff\", // 13: bright magenta\n\t\"#00ffff\", // 14: bright cyan\n\t\"#ffffff\", // 15: bright white\n];\n\n/**\n * Convert 256-color index to hex.\n */\nfunction color256ToHex(index: number): string {\n\t// Standard colors (0-15)\n\tif (index < 16) {\n\t\treturn ANSI_COLORS[index];\n\t}\n\n\t// Color cube (16-231): 6x6x6 = 216 colors\n\tif (index < 232) {\n\t\tconst cubeIndex = index - 16;\n\t\tconst r = Math.floor(cubeIndex / 36);\n\t\tconst g = Math.floor((cubeIndex % 36) / 6);\n\t\tconst b = cubeIndex % 6;\n\t\tconst toComponent = (n: number) => (n === 0 ? 0 : 55 + n * 40);\n\t\tconst toHex = (n: number) => toComponent(n).toString(16).padStart(2, \"0\");\n\t\treturn `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n\t}\n\n\t// Grayscale (232-255): 24 shades\n\tconst gray = 8 + (index - 232) * 10;\n\tconst grayHex = gray.toString(16).padStart(2, \"0\");\n\treturn `#${grayHex}${grayHex}${grayHex}`;\n}\n\n/**\n * Escape HTML special characters.\n */\nfunction escapeHtml(text: string): string {\n\treturn text\n\t\t.replace(/&/g, \"&\")\n\t\t.replace(/</g, \"<\")\n\t\t.replace(/>/g, \">\")\n\t\t.replace(/\"/g, \""\")\n\t\t.replace(/'/g, \"'\");\n}\n\ninterface TextStyle {\n\tfg: string | null;\n\tbg: string | null;\n\tbold: boolean;\n\tdim: boolean;\n\titalic: boolean;\n\tunderline: boolean;\n}\n\nfunction createEmptyStyle(): TextStyle {\n\treturn {\n\t\tfg: null,\n\t\tbg: null,\n\t\tbold: false,\n\t\tdim: false,\n\t\titalic: false,\n\t\tunderline: false,\n\t};\n}\n\nfunction styleToInlineCSS(style: TextStyle): string {\n\tconst parts: string[] = [];\n\tif (style.fg) parts.push(`color:${style.fg}`);\n\tif (style.bg) parts.push(`background-color:${style.bg}`);\n\tif (style.bold) parts.push(\"font-weight:bold\");\n\tif (style.dim) parts.push(\"opacity:0.6\");\n\tif (style.italic) parts.push(\"font-style:italic\");\n\tif (style.underline) parts.push(\"text-decoration:underline\");\n\treturn parts.join(\";\");\n}\n\nfunction hasStyle(style: TextStyle): boolean {\n\treturn style.fg !== null || style.bg !== null || style.bold || style.dim || style.italic || style.underline;\n}\n\n/**\n * Parse ANSI SGR (Select Graphic Rendition) codes and update style.\n */\nfunction applySgrCode(params: number[], style: TextStyle): void {\n\tlet i = 0;\n\twhile (i < params.length) {\n\t\tconst code = params[i];\n\n\t\tif (code === 0) {\n\t\t\t// Reset all\n\t\t\tstyle.fg = null;\n\t\t\tstyle.bg = null;\n\t\t\tstyle.bold = false;\n\t\t\tstyle.dim = false;\n\t\t\tstyle.italic = false;\n\t\t\tstyle.underline = false;\n\t\t} else if (code === 1) {\n\t\t\tstyle.bold = true;\n\t\t} else if (code === 2) {\n\t\t\tstyle.dim = true;\n\t\t} else if (code === 3) {\n\t\t\tstyle.italic = true;\n\t\t} else if (code === 4) {\n\t\t\tstyle.underline = true;\n\t\t} else if (code === 22) {\n\t\t\t// Reset bold/dim\n\t\t\tstyle.bold = false;\n\t\t\tstyle.dim = false;\n\t\t} else if (code === 23) {\n\t\t\tstyle.italic = false;\n\t\t} else if (code === 24) {\n\t\t\tstyle.underline = false;\n\t\t} else if (code >= 30 && code <= 37) {\n\t\t\t// Standard foreground colors\n\t\t\tstyle.fg = ANSI_COLORS[code - 30];\n\t\t} else if (code === 38) {\n\t\t\t// Extended foreground color\n\t\t\tif (params[i + 1] === 5 && params.length > i + 2) {\n\t\t\t\t// 256-color: 38;5;N\n\t\t\t\tstyle.fg = color256ToHex(params[i + 2]);\n\t\t\t\ti += 2;\n\t\t\t} else if (params[i + 1] === 2 && params.length > i + 4) {\n\t\t\t\t// RGB: 38;2;R;G;B\n\t\t\t\tconst r = params[i + 2];\n\t\t\t\tconst g = params[i + 3];\n\t\t\t\tconst b = params[i + 4];\n\t\t\t\tstyle.fg = `rgb(${r},${g},${b})`;\n\t\t\t\ti += 4;\n\t\t\t}\n\t\t} else if (code === 39) {\n\t\t\t// Default foreground\n\t\t\tstyle.fg = null;\n\t\t} else if (code >= 40 && code <= 47) {\n\t\t\t// Standard background colors\n\t\t\tstyle.bg = ANSI_COLORS[code - 40];\n\t\t} else if (code === 48) {\n\t\t\t// Extended background color\n\t\t\tif (params[i + 1] === 5 && params.length > i + 2) {\n\t\t\t\t// 256-color: 48;5;N\n\t\t\t\tstyle.bg = color256ToHex(params[i + 2]);\n\t\t\t\ti += 2;\n\t\t\t} else if (params[i + 1] === 2 && params.length > i + 4) {\n\t\t\t\t// RGB: 48;2;R;G;B\n\t\t\t\tconst r = params[i + 2];\n\t\t\t\tconst g = params[i + 3];\n\t\t\t\tconst b = params[i + 4];\n\t\t\t\tstyle.bg = `rgb(${r},${g},${b})`;\n\t\t\t\ti += 4;\n\t\t\t}\n\t\t} else if (code === 49) {\n\t\t\t// Default background\n\t\t\tstyle.bg = null;\n\t\t} else if (code >= 90 && code <= 97) {\n\t\t\t// Bright foreground colors\n\t\t\tstyle.fg = ANSI_COLORS[code - 90 + 8];\n\t\t} else if (code >= 100 && code <= 107) {\n\t\t\t// Bright background colors\n\t\t\tstyle.bg = ANSI_COLORS[code - 100 + 8];\n\t\t}\n\t\t// Ignore unrecognized codes\n\n\t\ti++;\n\t}\n}\n\n// Match ANSI escape sequences: ESC[ followed by params and ending with 'm'\nconst ANSI_REGEX = /\\x1b\\[([\\d;]*)m/g;\n\n/**\n * Convert ANSI-escaped text to HTML with inline styles.\n */\nexport function ansiToHtml(text: string): string {\n\tconst style = createEmptyStyle();\n\tlet result = \"\";\n\tlet lastIndex = 0;\n\tlet inSpan = false;\n\n\t// Reset regex state\n\tANSI_REGEX.lastIndex = 0;\n\n\tlet match = ANSI_REGEX.exec(text);\n\twhile (match !== null) {\n\t\t// Add text before this escape sequence\n\t\tconst beforeText = text.slice(lastIndex, match.index);\n\t\tif (beforeText) {\n\t\t\tresult += escapeHtml(beforeText);\n\t\t}\n\n\t\t// Parse SGR parameters\n\t\tconst paramStr = match[1];\n\t\tconst params = paramStr ? paramStr.split(\";\").map((p) => parseInt(p, 10) || 0) : [0];\n\n\t\t// Close existing span if we have one\n\t\tif (inSpan) {\n\t\t\tresult += \"</span>\";\n\t\t\tinSpan = false;\n\t\t}\n\n\t\t// Apply the codes\n\t\tapplySgrCode(params, style);\n\n\t\t// Open new span if we have any styling\n\t\tif (hasStyle(style)) {\n\t\t\tresult += `<span style=\"${styleToInlineCSS(style)}\">`;\n\t\t\tinSpan = true;\n\t\t}\n\n\t\tlastIndex = match.index + match[0].length;\n\t\tmatch = ANSI_REGEX.exec(text);\n\t}\n\n\t// Add remaining text\n\tconst remainingText = text.slice(lastIndex);\n\tif (remainingText) {\n\t\tresult += escapeHtml(remainingText);\n\t}\n\n\t// Close any open span\n\tif (inSpan) {\n\t\tresult += \"</span>\";\n\t}\n\n\treturn result;\n}\n\n/**\n * Convert array of ANSI-escaped lines to HTML.\n * Each line is wrapped in a div element.\n */\nexport function ansiLinesToHtml(lines: string[]): string {\n\treturn lines.map((line) => `<div class=\"ansi-line\">${ansiToHtml(line) || \" \"}</div>`).join(\"\\n\");\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AgentState } from "@gsd/pi-agent-core";
|
|
2
|
+
import { SessionManager } from "../session-manager.js";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for rendering custom tools to HTML.
|
|
5
|
+
* Used by agent-session to pre-render extension tool output.
|
|
6
|
+
*/
|
|
7
|
+
export interface ToolHtmlRenderer {
|
|
8
|
+
/** Render a tool call to HTML. Returns undefined if tool has no custom renderer. */
|
|
9
|
+
renderCall(toolName: string, args: unknown): string | undefined;
|
|
10
|
+
/** Render a tool result to HTML. Returns collapsed/expanded or undefined if tool has no custom renderer. */
|
|
11
|
+
renderResult(toolName: string, result: Array<{
|
|
12
|
+
type: string;
|
|
13
|
+
text?: string;
|
|
14
|
+
data?: string;
|
|
15
|
+
mimeType?: string;
|
|
16
|
+
}>, details: unknown, isError: boolean): {
|
|
17
|
+
collapsed?: string;
|
|
18
|
+
expanded?: string;
|
|
19
|
+
} | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface ExportOptions {
|
|
22
|
+
outputPath?: string;
|
|
23
|
+
themeName?: string;
|
|
24
|
+
/** Optional tool renderer for custom tools */
|
|
25
|
+
toolRenderer?: ToolHtmlRenderer;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Export session to HTML using SessionManager and AgentState.
|
|
29
|
+
* Used by TUI's /export command.
|
|
30
|
+
*/
|
|
31
|
+
export declare function exportSessionToHtml(sm: SessionManager, state?: AgentState, options?: ExportOptions | string): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Export session file to HTML (standalone, without AgentState).
|
|
34
|
+
* Used by CLI for exporting arbitrary session files.
|
|
35
|
+
*/
|
|
36
|
+
export declare function exportFromFile(inputPath: string, options?: ExportOptions | string): Promise<string>;
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/export-html/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,oFAAoF;IACpF,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IAChE,4GAA4G;IAC5G,YAAY,CACX,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAChF,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,GACd;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACzD;AASD,MAAM,WAAW,aAAa;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAyLD;;;GAGG;AACH,wBAAsB,mBAAmB,CACxC,EAAE,EAAE,cAAc,EAClB,KAAK,CAAC,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,GAC9B,OAAO,CAAC,MAAM,CAAC,CA0CjB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA2BzG"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
2
|
+
import { basename, join } from "path";
|
|
3
|
+
import { APP_NAME, getExportTemplateDir } from "../../config.js";
|
|
4
|
+
import { getResolvedThemeColors, getThemeExportColors } from "../../modes/interactive/theme/theme.js";
|
|
5
|
+
import { SessionManager } from "../session-manager.js";
|
|
6
|
+
/** Parse a color string to RGB values. Supports hex (#RRGGBB) and rgb(r,g,b) formats. */
|
|
7
|
+
function parseColor(color) {
|
|
8
|
+
const hexMatch = color.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);
|
|
9
|
+
if (hexMatch) {
|
|
10
|
+
return {
|
|
11
|
+
r: Number.parseInt(hexMatch[1], 16),
|
|
12
|
+
g: Number.parseInt(hexMatch[2], 16),
|
|
13
|
+
b: Number.parseInt(hexMatch[3], 16),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const rgbMatch = color.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);
|
|
17
|
+
if (rgbMatch) {
|
|
18
|
+
return {
|
|
19
|
+
r: Number.parseInt(rgbMatch[1], 10),
|
|
20
|
+
g: Number.parseInt(rgbMatch[2], 10),
|
|
21
|
+
b: Number.parseInt(rgbMatch[3], 10),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
/** Calculate relative luminance of a color (0-1, higher = lighter). */
|
|
27
|
+
function getLuminance(r, g, b) {
|
|
28
|
+
const toLinear = (c) => {
|
|
29
|
+
const s = c / 255;
|
|
30
|
+
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
31
|
+
};
|
|
32
|
+
return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
|
|
33
|
+
}
|
|
34
|
+
/** Adjust color brightness. Factor > 1 lightens, < 1 darkens. */
|
|
35
|
+
function adjustBrightness(color, factor) {
|
|
36
|
+
const parsed = parseColor(color);
|
|
37
|
+
if (!parsed)
|
|
38
|
+
return color;
|
|
39
|
+
const adjust = (c) => Math.min(255, Math.max(0, Math.round(c * factor)));
|
|
40
|
+
return `rgb(${adjust(parsed.r)}, ${adjust(parsed.g)}, ${adjust(parsed.b)})`;
|
|
41
|
+
}
|
|
42
|
+
/** Derive export background colors from a base color (e.g., userMessageBg). */
|
|
43
|
+
function deriveExportColors(baseColor) {
|
|
44
|
+
const parsed = parseColor(baseColor);
|
|
45
|
+
if (!parsed) {
|
|
46
|
+
return {
|
|
47
|
+
pageBg: "rgb(24, 24, 30)",
|
|
48
|
+
cardBg: "rgb(30, 30, 36)",
|
|
49
|
+
infoBg: "rgb(60, 55, 40)",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const luminance = getLuminance(parsed.r, parsed.g, parsed.b);
|
|
53
|
+
const isLight = luminance > 0.5;
|
|
54
|
+
if (isLight) {
|
|
55
|
+
return {
|
|
56
|
+
pageBg: adjustBrightness(baseColor, 0.96),
|
|
57
|
+
cardBg: baseColor,
|
|
58
|
+
infoBg: `rgb(${Math.min(255, parsed.r + 10)}, ${Math.min(255, parsed.g + 5)}, ${Math.max(0, parsed.b - 20)})`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
pageBg: adjustBrightness(baseColor, 0.7),
|
|
63
|
+
cardBg: adjustBrightness(baseColor, 0.85),
|
|
64
|
+
infoBg: `rgb(${Math.min(255, parsed.r + 20)}, ${Math.min(255, parsed.g + 15)}, ${parsed.b})`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Generate CSS custom property declarations from theme colors.
|
|
69
|
+
*/
|
|
70
|
+
function generateThemeVars(themeName) {
|
|
71
|
+
const colors = getResolvedThemeColors(themeName);
|
|
72
|
+
const lines = [];
|
|
73
|
+
for (const [key, value] of Object.entries(colors)) {
|
|
74
|
+
lines.push(`--${key}: ${value};`);
|
|
75
|
+
}
|
|
76
|
+
// Use explicit theme export colors if available, otherwise derive from userMessageBg
|
|
77
|
+
const themeExport = getThemeExportColors(themeName);
|
|
78
|
+
const userMessageBg = colors.userMessageBg || "#343541";
|
|
79
|
+
const derivedColors = deriveExportColors(userMessageBg);
|
|
80
|
+
lines.push(`--exportPageBg: ${themeExport.pageBg ?? derivedColors.pageBg};`);
|
|
81
|
+
lines.push(`--exportCardBg: ${themeExport.cardBg ?? derivedColors.cardBg};`);
|
|
82
|
+
lines.push(`--exportInfoBg: ${themeExport.infoBg ?? derivedColors.infoBg};`);
|
|
83
|
+
return lines.join("\n ");
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Core HTML generation logic shared by both export functions.
|
|
87
|
+
*/
|
|
88
|
+
function generateHtml(sessionData, themeName) {
|
|
89
|
+
const templateDir = getExportTemplateDir();
|
|
90
|
+
const template = readFileSync(join(templateDir, "template.html"), "utf-8");
|
|
91
|
+
const templateCss = readFileSync(join(templateDir, "template.css"), "utf-8");
|
|
92
|
+
const templateJs = readFileSync(join(templateDir, "template.js"), "utf-8");
|
|
93
|
+
const markedJs = readFileSync(join(templateDir, "vendor", "marked.min.js"), "utf-8");
|
|
94
|
+
const hljsJs = readFileSync(join(templateDir, "vendor", "highlight.min.js"), "utf-8");
|
|
95
|
+
const themeVars = generateThemeVars(themeName);
|
|
96
|
+
const colors = getResolvedThemeColors(themeName);
|
|
97
|
+
const exportColors = deriveExportColors(colors.userMessageBg || "#343541");
|
|
98
|
+
const bodyBg = exportColors.pageBg;
|
|
99
|
+
const containerBg = exportColors.cardBg;
|
|
100
|
+
const infoBg = exportColors.infoBg;
|
|
101
|
+
// Base64 encode session data to avoid escaping issues
|
|
102
|
+
const sessionDataBase64 = Buffer.from(JSON.stringify(sessionData)).toString("base64");
|
|
103
|
+
// Build the CSS with theme variables injected
|
|
104
|
+
const css = templateCss
|
|
105
|
+
.replace("{{THEME_VARS}}", themeVars)
|
|
106
|
+
.replace("{{BODY_BG}}", bodyBg)
|
|
107
|
+
.replace("{{CONTAINER_BG}}", containerBg)
|
|
108
|
+
.replace("{{INFO_BG}}", infoBg);
|
|
109
|
+
return template
|
|
110
|
+
.replace("{{CSS}}", css)
|
|
111
|
+
.replace("{{JS}}", templateJs)
|
|
112
|
+
.replace("{{SESSION_DATA}}", sessionDataBase64)
|
|
113
|
+
.replace("{{MARKED_JS}}", markedJs)
|
|
114
|
+
.replace("{{HIGHLIGHT_JS}}", hljsJs);
|
|
115
|
+
}
|
|
116
|
+
/** Built-in tool names that have custom rendering in template.js */
|
|
117
|
+
const BUILTIN_TOOLS = new Set(["bash", "read", "write", "edit", "ls", "find", "grep"]);
|
|
118
|
+
/**
|
|
119
|
+
* Pre-render custom tools to HTML using their TUI renderers.
|
|
120
|
+
*/
|
|
121
|
+
function preRenderCustomTools(entries, toolRenderer) {
|
|
122
|
+
const renderedTools = {};
|
|
123
|
+
for (const entry of entries) {
|
|
124
|
+
if (entry.type !== "message")
|
|
125
|
+
continue;
|
|
126
|
+
const msg = entry.message;
|
|
127
|
+
// Find tool calls in assistant messages
|
|
128
|
+
if (msg.role === "assistant" && Array.isArray(msg.content)) {
|
|
129
|
+
for (const block of msg.content) {
|
|
130
|
+
if (block.type === "toolCall" && !BUILTIN_TOOLS.has(block.name)) {
|
|
131
|
+
const callHtml = toolRenderer.renderCall(block.name, block.arguments);
|
|
132
|
+
if (callHtml) {
|
|
133
|
+
renderedTools[block.id] = { callHtml };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Find tool results
|
|
139
|
+
if (msg.role === "toolResult" && msg.toolCallId) {
|
|
140
|
+
const toolName = msg.toolName || "";
|
|
141
|
+
// Only render if we have a pre-rendered call OR it's not a built-in tool
|
|
142
|
+
const existing = renderedTools[msg.toolCallId];
|
|
143
|
+
if (existing || !BUILTIN_TOOLS.has(toolName)) {
|
|
144
|
+
const rendered = toolRenderer.renderResult(toolName, msg.content, msg.details, msg.isError || false);
|
|
145
|
+
if (rendered) {
|
|
146
|
+
renderedTools[msg.toolCallId] = {
|
|
147
|
+
...existing,
|
|
148
|
+
resultHtmlCollapsed: rendered.collapsed,
|
|
149
|
+
resultHtmlExpanded: rendered.expanded,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return renderedTools;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Export session to HTML using SessionManager and AgentState.
|
|
159
|
+
* Used by TUI's /export command.
|
|
160
|
+
*/
|
|
161
|
+
export async function exportSessionToHtml(sm, state, options) {
|
|
162
|
+
const opts = typeof options === "string" ? { outputPath: options } : options || {};
|
|
163
|
+
const sessionFile = sm.getSessionFile();
|
|
164
|
+
if (!sessionFile) {
|
|
165
|
+
throw new Error("Cannot export in-memory session to HTML");
|
|
166
|
+
}
|
|
167
|
+
if (!existsSync(sessionFile)) {
|
|
168
|
+
throw new Error("Nothing to export yet - start a conversation first");
|
|
169
|
+
}
|
|
170
|
+
const entries = sm.getEntries();
|
|
171
|
+
// Pre-render custom tools if a tool renderer is provided
|
|
172
|
+
let renderedTools;
|
|
173
|
+
if (opts.toolRenderer) {
|
|
174
|
+
renderedTools = preRenderCustomTools(entries, opts.toolRenderer);
|
|
175
|
+
// Only include if we actually rendered something
|
|
176
|
+
if (Object.keys(renderedTools).length === 0) {
|
|
177
|
+
renderedTools = undefined;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const sessionData = {
|
|
181
|
+
header: sm.getHeader(),
|
|
182
|
+
entries,
|
|
183
|
+
leafId: sm.getLeafId(),
|
|
184
|
+
systemPrompt: state?.systemPrompt,
|
|
185
|
+
tools: state?.tools?.map((t) => ({ name: t.name, description: t.description, parameters: t.parameters })),
|
|
186
|
+
renderedTools,
|
|
187
|
+
};
|
|
188
|
+
const html = generateHtml(sessionData, opts.themeName);
|
|
189
|
+
let outputPath = opts.outputPath;
|
|
190
|
+
if (!outputPath) {
|
|
191
|
+
const sessionBasename = basename(sessionFile, ".jsonl");
|
|
192
|
+
outputPath = `${APP_NAME}-session-${sessionBasename}.html`;
|
|
193
|
+
}
|
|
194
|
+
writeFileSync(outputPath, html, "utf8");
|
|
195
|
+
return outputPath;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Export session file to HTML (standalone, without AgentState).
|
|
199
|
+
* Used by CLI for exporting arbitrary session files.
|
|
200
|
+
*/
|
|
201
|
+
export async function exportFromFile(inputPath, options) {
|
|
202
|
+
const opts = typeof options === "string" ? { outputPath: options } : options || {};
|
|
203
|
+
if (!existsSync(inputPath)) {
|
|
204
|
+
throw new Error(`File not found: ${inputPath}`);
|
|
205
|
+
}
|
|
206
|
+
const sm = SessionManager.open(inputPath);
|
|
207
|
+
const sessionData = {
|
|
208
|
+
header: sm.getHeader(),
|
|
209
|
+
entries: sm.getEntries(),
|
|
210
|
+
leafId: sm.getLeafId(),
|
|
211
|
+
systemPrompt: undefined,
|
|
212
|
+
tools: undefined,
|
|
213
|
+
};
|
|
214
|
+
const html = generateHtml(sessionData, opts.themeName);
|
|
215
|
+
let outputPath = opts.outputPath;
|
|
216
|
+
if (!outputPath) {
|
|
217
|
+
const inputBasename = basename(inputPath, ".jsonl");
|
|
218
|
+
outputPath = `${APP_NAME}-session-${inputBasename}.html`;
|
|
219
|
+
}
|
|
220
|
+
writeFileSync(outputPath, html, "utf8");
|
|
221
|
+
return outputPath;
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/export-html/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAGtG,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAgCvD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MAAM,CAAC,CAAC;IACxC,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["import type { AgentState } from \"@gsd/pi-agent-core\";\nimport { existsSync, readFileSync, writeFileSync } from \"fs\";\nimport { basename, join } from \"path\";\nimport { APP_NAME, getExportTemplateDir } from \"../../config.js\";\nimport { getResolvedThemeColors, getThemeExportColors } from \"../../modes/interactive/theme/theme.js\";\nimport type { ToolInfo } from \"../extensions/types.js\";\nimport type { SessionEntry } from \"../session-manager.js\";\nimport { SessionManager } from \"../session-manager.js\";\n\n/**\n * Interface for rendering custom tools to HTML.\n * Used by agent-session to pre-render extension tool output.\n */\nexport interface ToolHtmlRenderer {\n\t/** Render a tool call to HTML. Returns undefined if tool has no custom renderer. */\n\trenderCall(toolName: string, args: unknown): string | undefined;\n\t/** Render a tool result to HTML. Returns collapsed/expanded or undefined if tool has no custom renderer. */\n\trenderResult(\n\t\ttoolName: string,\n\t\tresult: Array<{ type: string; text?: string; data?: string; mimeType?: string }>,\n\t\tdetails: unknown,\n\t\tisError: boolean,\n\t): { collapsed?: string; expanded?: string } | undefined;\n}\n\n/** Pre-rendered HTML for a custom tool call and result */\ninterface RenderedToolHtml {\n\tcallHtml?: string;\n\tresultHtmlCollapsed?: string;\n\tresultHtmlExpanded?: string;\n}\n\nexport interface ExportOptions {\n\toutputPath?: string;\n\tthemeName?: string;\n\t/** Optional tool renderer for custom tools */\n\ttoolRenderer?: ToolHtmlRenderer;\n}\n\n/** Parse a color string to RGB values. Supports hex (#RRGGBB) and rgb(r,g,b) formats. */\nfunction parseColor(color: string): { r: number; g: number; b: number } | undefined {\n\tconst hexMatch = color.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);\n\tif (hexMatch) {\n\t\treturn {\n\t\t\tr: Number.parseInt(hexMatch[1], 16),\n\t\t\tg: Number.parseInt(hexMatch[2], 16),\n\t\t\tb: Number.parseInt(hexMatch[3], 16),\n\t\t};\n\t}\n\tconst rgbMatch = color.match(/^rgb\\s*\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)$/);\n\tif (rgbMatch) {\n\t\treturn {\n\t\t\tr: Number.parseInt(rgbMatch[1], 10),\n\t\t\tg: Number.parseInt(rgbMatch[2], 10),\n\t\t\tb: Number.parseInt(rgbMatch[3], 10),\n\t\t};\n\t}\n\treturn undefined;\n}\n\n/** Calculate relative luminance of a color (0-1, higher = lighter). */\nfunction getLuminance(r: number, g: number, b: number): number {\n\tconst toLinear = (c: number) => {\n\t\tconst s = c / 255;\n\t\treturn s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;\n\t};\n\treturn 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);\n}\n\n/** Adjust color brightness. Factor > 1 lightens, < 1 darkens. */\nfunction adjustBrightness(color: string, factor: number): string {\n\tconst parsed = parseColor(color);\n\tif (!parsed) return color;\n\tconst adjust = (c: number) => Math.min(255, Math.max(0, Math.round(c * factor)));\n\treturn `rgb(${adjust(parsed.r)}, ${adjust(parsed.g)}, ${adjust(parsed.b)})`;\n}\n\n/** Derive export background colors from a base color (e.g., userMessageBg). */\nfunction deriveExportColors(baseColor: string): { pageBg: string; cardBg: string; infoBg: string } {\n\tconst parsed = parseColor(baseColor);\n\tif (!parsed) {\n\t\treturn {\n\t\t\tpageBg: \"rgb(24, 24, 30)\",\n\t\t\tcardBg: \"rgb(30, 30, 36)\",\n\t\t\tinfoBg: \"rgb(60, 55, 40)\",\n\t\t};\n\t}\n\n\tconst luminance = getLuminance(parsed.r, parsed.g, parsed.b);\n\tconst isLight = luminance > 0.5;\n\n\tif (isLight) {\n\t\treturn {\n\t\t\tpageBg: adjustBrightness(baseColor, 0.96),\n\t\t\tcardBg: baseColor,\n\t\t\tinfoBg: `rgb(${Math.min(255, parsed.r + 10)}, ${Math.min(255, parsed.g + 5)}, ${Math.max(0, parsed.b - 20)})`,\n\t\t};\n\t}\n\treturn {\n\t\tpageBg: adjustBrightness(baseColor, 0.7),\n\t\tcardBg: adjustBrightness(baseColor, 0.85),\n\t\tinfoBg: `rgb(${Math.min(255, parsed.r + 20)}, ${Math.min(255, parsed.g + 15)}, ${parsed.b})`,\n\t};\n}\n\n/**\n * Generate CSS custom property declarations from theme colors.\n */\nfunction generateThemeVars(themeName?: string): string {\n\tconst colors = getResolvedThemeColors(themeName);\n\tconst lines: string[] = [];\n\tfor (const [key, value] of Object.entries(colors)) {\n\t\tlines.push(`--${key}: ${value};`);\n\t}\n\n\t// Use explicit theme export colors if available, otherwise derive from userMessageBg\n\tconst themeExport = getThemeExportColors(themeName);\n\tconst userMessageBg = colors.userMessageBg || \"#343541\";\n\tconst derivedColors = deriveExportColors(userMessageBg);\n\n\tlines.push(`--exportPageBg: ${themeExport.pageBg ?? derivedColors.pageBg};`);\n\tlines.push(`--exportCardBg: ${themeExport.cardBg ?? derivedColors.cardBg};`);\n\tlines.push(`--exportInfoBg: ${themeExport.infoBg ?? derivedColors.infoBg};`);\n\n\treturn lines.join(\"\\n \");\n}\n\ninterface SessionData {\n\theader: ReturnType<SessionManager[\"getHeader\"]>;\n\tentries: ReturnType<SessionManager[\"getEntries\"]>;\n\tleafId: string | null;\n\tsystemPrompt?: string;\n\ttools?: ToolInfo[];\n\t/** Pre-rendered HTML for custom tool calls/results, keyed by tool call ID */\n\trenderedTools?: Record<string, RenderedToolHtml>;\n}\n\n/**\n * Core HTML generation logic shared by both export functions.\n */\nfunction generateHtml(sessionData: SessionData, themeName?: string): string {\n\tconst templateDir = getExportTemplateDir();\n\tconst template = readFileSync(join(templateDir, \"template.html\"), \"utf-8\");\n\tconst templateCss = readFileSync(join(templateDir, \"template.css\"), \"utf-8\");\n\tconst templateJs = readFileSync(join(templateDir, \"template.js\"), \"utf-8\");\n\tconst markedJs = readFileSync(join(templateDir, \"vendor\", \"marked.min.js\"), \"utf-8\");\n\tconst hljsJs = readFileSync(join(templateDir, \"vendor\", \"highlight.min.js\"), \"utf-8\");\n\n\tconst themeVars = generateThemeVars(themeName);\n\tconst colors = getResolvedThemeColors(themeName);\n\tconst exportColors = deriveExportColors(colors.userMessageBg || \"#343541\");\n\tconst bodyBg = exportColors.pageBg;\n\tconst containerBg = exportColors.cardBg;\n\tconst infoBg = exportColors.infoBg;\n\n\t// Base64 encode session data to avoid escaping issues\n\tconst sessionDataBase64 = Buffer.from(JSON.stringify(sessionData)).toString(\"base64\");\n\n\t// Build the CSS with theme variables injected\n\tconst css = templateCss\n\t\t.replace(\"{{THEME_VARS}}\", themeVars)\n\t\t.replace(\"{{BODY_BG}}\", bodyBg)\n\t\t.replace(\"{{CONTAINER_BG}}\", containerBg)\n\t\t.replace(\"{{INFO_BG}}\", infoBg);\n\n\treturn template\n\t\t.replace(\"{{CSS}}\", css)\n\t\t.replace(\"{{JS}}\", templateJs)\n\t\t.replace(\"{{SESSION_DATA}}\", sessionDataBase64)\n\t\t.replace(\"{{MARKED_JS}}\", markedJs)\n\t\t.replace(\"{{HIGHLIGHT_JS}}\", hljsJs);\n}\n\n/** Built-in tool names that have custom rendering in template.js */\nconst BUILTIN_TOOLS = new Set([\"bash\", \"read\", \"write\", \"edit\", \"ls\", \"find\", \"grep\"]);\n\n/**\n * Pre-render custom tools to HTML using their TUI renderers.\n */\nfunction preRenderCustomTools(\n\tentries: SessionEntry[],\n\ttoolRenderer: ToolHtmlRenderer,\n): Record<string, RenderedToolHtml> {\n\tconst renderedTools: Record<string, RenderedToolHtml> = {};\n\n\tfor (const entry of entries) {\n\t\tif (entry.type !== \"message\") continue;\n\t\tconst msg = entry.message;\n\n\t\t// Find tool calls in assistant messages\n\t\tif (msg.role === \"assistant\" && Array.isArray(msg.content)) {\n\t\t\tfor (const block of msg.content) {\n\t\t\t\tif (block.type === \"toolCall\" && !BUILTIN_TOOLS.has(block.name)) {\n\t\t\t\t\tconst callHtml = toolRenderer.renderCall(block.name, block.arguments);\n\t\t\t\t\tif (callHtml) {\n\t\t\t\t\t\trenderedTools[block.id] = { callHtml };\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Find tool results\n\t\tif (msg.role === \"toolResult\" && msg.toolCallId) {\n\t\t\tconst toolName = msg.toolName || \"\";\n\t\t\t// Only render if we have a pre-rendered call OR it's not a built-in tool\n\t\t\tconst existing = renderedTools[msg.toolCallId];\n\t\t\tif (existing || !BUILTIN_TOOLS.has(toolName)) {\n\t\t\t\tconst rendered = toolRenderer.renderResult(toolName, msg.content, msg.details, msg.isError || false);\n\t\t\t\tif (rendered) {\n\t\t\t\t\trenderedTools[msg.toolCallId] = {\n\t\t\t\t\t\t...existing,\n\t\t\t\t\t\tresultHtmlCollapsed: rendered.collapsed,\n\t\t\t\t\t\tresultHtmlExpanded: rendered.expanded,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn renderedTools;\n}\n\n/**\n * Export session to HTML using SessionManager and AgentState.\n * Used by TUI's /export command.\n */\nexport async function exportSessionToHtml(\n\tsm: SessionManager,\n\tstate?: AgentState,\n\toptions?: ExportOptions | string,\n): Promise<string> {\n\tconst opts: ExportOptions = typeof options === \"string\" ? { outputPath: options } : options || {};\n\n\tconst sessionFile = sm.getSessionFile();\n\tif (!sessionFile) {\n\t\tthrow new Error(\"Cannot export in-memory session to HTML\");\n\t}\n\tif (!existsSync(sessionFile)) {\n\t\tthrow new Error(\"Nothing to export yet - start a conversation first\");\n\t}\n\n\tconst entries = sm.getEntries();\n\n\t// Pre-render custom tools if a tool renderer is provided\n\tlet renderedTools: Record<string, RenderedToolHtml> | undefined;\n\tif (opts.toolRenderer) {\n\t\trenderedTools = preRenderCustomTools(entries, opts.toolRenderer);\n\t\t// Only include if we actually rendered something\n\t\tif (Object.keys(renderedTools).length === 0) {\n\t\t\trenderedTools = undefined;\n\t\t}\n\t}\n\n\tconst sessionData: SessionData = {\n\t\theader: sm.getHeader(),\n\t\tentries,\n\t\tleafId: sm.getLeafId(),\n\t\tsystemPrompt: state?.systemPrompt,\n\t\ttools: state?.tools?.map((t) => ({ name: t.name, description: t.description, parameters: t.parameters })),\n\t\trenderedTools,\n\t};\n\n\tconst html = generateHtml(sessionData, opts.themeName);\n\n\tlet outputPath = opts.outputPath;\n\tif (!outputPath) {\n\t\tconst sessionBasename = basename(sessionFile, \".jsonl\");\n\t\toutputPath = `${APP_NAME}-session-${sessionBasename}.html`;\n\t}\n\n\twriteFileSync(outputPath, html, \"utf8\");\n\treturn outputPath;\n}\n\n/**\n * Export session file to HTML (standalone, without AgentState).\n * Used by CLI for exporting arbitrary session files.\n */\nexport async function exportFromFile(inputPath: string, options?: ExportOptions | string): Promise<string> {\n\tconst opts: ExportOptions = typeof options === \"string\" ? { outputPath: options } : options || {};\n\n\tif (!existsSync(inputPath)) {\n\t\tthrow new Error(`File not found: ${inputPath}`);\n\t}\n\n\tconst sm = SessionManager.open(inputPath);\n\n\tconst sessionData: SessionData = {\n\t\theader: sm.getHeader(),\n\t\tentries: sm.getEntries(),\n\t\tleafId: sm.getLeafId(),\n\t\tsystemPrompt: undefined,\n\t\ttools: undefined,\n\t};\n\n\tconst html = generateHtml(sessionData, opts.themeName);\n\n\tlet outputPath = opts.outputPath;\n\tif (!outputPath) {\n\t\tconst inputBasename = basename(inputPath, \".jsonl\");\n\t\toutputPath = `${APP_NAME}-session-${inputBasename}.html`;\n\t}\n\n\twriteFileSync(outputPath, html, \"utf8\");\n\treturn outputPath;\n}\n"]}
|