pi-usereq 0.49.0 → 0.50.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 -1
- package/package.json +5 -1
- package/scripts/lib/extension-debug-harness.ts +443 -0
- package/scripts/lib/recording-extension-api.ts +855 -0
- package/scripts/lib/sdk-smoke.ts +503 -0
- package/.g.conf +0 -16
- package/.github/workflows/release-npm.yml +0 -134
- package/.gitignore +0 -274
- package/CHANGELOG.md +0 -706
- package/TODO.md +0 -20
- package/docs/pi.dev/agent-document-manifest.json +0 -6399
- package/docs/pi.dev/coding-agent-docs/compaction.md +0 -394
- package/docs/pi.dev/coding-agent-docs/custom-provider.md +0 -637
- package/docs/pi.dev/coding-agent-docs/development.md +0 -71
- package/docs/pi.dev/coding-agent-docs/extensions.md +0 -2536
- package/docs/pi.dev/coding-agent-docs/images/doom-extension.png +0 -0
- package/docs/pi.dev/coding-agent-docs/images/exy.png +0 -0
- package/docs/pi.dev/coding-agent-docs/images/interactive-mode.png +0 -0
- package/docs/pi.dev/coding-agent-docs/images/tree-view.png +0 -0
- package/docs/pi.dev/coding-agent-docs/json.md +0 -82
- package/docs/pi.dev/coding-agent-docs/keybindings.md +0 -197
- package/docs/pi.dev/coding-agent-docs/models.md +0 -395
- package/docs/pi.dev/coding-agent-docs/packages.md +0 -218
- package/docs/pi.dev/coding-agent-docs/prompt-templates.md +0 -88
- package/docs/pi.dev/coding-agent-docs/providers.md +0 -196
- package/docs/pi.dev/coding-agent-docs/rpc.md +0 -1407
- package/docs/pi.dev/coding-agent-docs/sdk.md +0 -1149
- package/docs/pi.dev/coding-agent-docs/session.md +0 -412
- package/docs/pi.dev/coding-agent-docs/settings.md +0 -248
- package/docs/pi.dev/coding-agent-docs/shell-aliases.md +0 -13
- package/docs/pi.dev/coding-agent-docs/skills.md +0 -232
- package/docs/pi.dev/coding-agent-docs/terminal-setup.md +0 -106
- package/docs/pi.dev/coding-agent-docs/termux.md +0 -127
- package/docs/pi.dev/coding-agent-docs/themes.md +0 -295
- package/docs/pi.dev/coding-agent-docs/tmux.md +0 -61
- package/docs/pi.dev/coding-agent-docs/tree.md +0 -233
- package/docs/pi.dev/coding-agent-docs/tui.md +0 -918
- package/docs/pi.dev/coding-agent-docs/windows.md +0 -17
- package/docs/pi.dev/mom-docs/artifacts-server.md +0 -475
- package/docs/pi.dev/mom-docs/events.md +0 -307
- package/docs/pi.dev/mom-docs/new.md +0 -970
- package/docs/pi.dev/mom-docs/sandbox.md +0 -153
- package/docs/pi.dev/mom-docs/slack-bot-minimal-guide.md +0 -399
- package/docs/pi.dev/mom-docs/v86.md +0 -319
- package/docs/pi.dev/pods-docs/gml-4.5.md +0 -189
- package/docs/pi.dev/pods-docs/gpt-oss.md +0 -233
- package/docs/pi.dev/pods-docs/implementation-plan.md +0 -183
- package/docs/pi.dev/pods-docs/kimi-k2.md +0 -197
- package/docs/pi.dev/pods-docs/models.md +0 -116
- package/docs/pi.dev/pods-docs/plan.md +0 -166
- package/docs/pi.dev/pods-docs/qwen3-coder.md +0 -132
- package/images/flowchart-bw.png +0 -0
- package/images/flowchart-bw.svg +0 -102
- package/images/flowchart.md +0 -100
- package/images/flowchart.png +0 -0
- package/images/flowchart.svg +0 -3
- package/pi-usereq/docs/REFERENCES.md +0 -5713
- package/pi-usereq/docs/REQUIREMENTS.md +0 -781
- package/pi-usereq/docs/WORKFLOW.md +0 -1341
- package/pi.dev-src/pi-mono/agent/src/agent-loop.ts +0 -683
- package/pi.dev-src/pi-mono/agent/src/agent.ts +0 -543
- package/pi.dev-src/pi-mono/agent/src/index.ts +0 -8
- package/pi.dev-src/pi-mono/agent/src/proxy.ts +0 -367
- package/pi.dev-src/pi-mono/agent/src/types.ts +0 -364
- package/pi.dev-src/pi-mono/agent/test/agent-loop.test.ts +0 -1181
- package/pi.dev-src/pi-mono/agent/test/agent.test.ts +0 -463
- package/pi.dev-src/pi-mono/agent/test/e2e.test.ts +0 -404
- package/pi.dev-src/pi-mono/agent/test/utils/calculate.ts +0 -32
- package/pi.dev-src/pi-mono/agent/test/utils/get-current-time.ts +0 -46
- package/pi.dev-src/pi-mono/agent/vitest.config.ts +0 -9
- package/pi.dev-src/pi-mono/ai/bedrock-provider.d.ts +0 -1
- package/pi.dev-src/pi-mono/ai/bedrock-provider.js +0 -1
- package/pi.dev-src/pi-mono/ai/scripts/generate-models.ts +0 -1635
- package/pi.dev-src/pi-mono/ai/scripts/generate-test-image.ts +0 -34
- package/pi.dev-src/pi-mono/ai/src/api-registry.ts +0 -98
- package/pi.dev-src/pi-mono/ai/src/bedrock-provider.ts +0 -6
- package/pi.dev-src/pi-mono/ai/src/cli.ts +0 -133
- package/pi.dev-src/pi-mono/ai/src/env-api-keys.ts +0 -134
- package/pi.dev-src/pi-mono/ai/src/index.ts +0 -35
- package/pi.dev-src/pi-mono/ai/src/models.generated.ts +0 -14928
- package/pi.dev-src/pi-mono/ai/src/models.ts +0 -82
- package/pi.dev-src/pi-mono/ai/src/oauth.ts +0 -1
- package/pi.dev-src/pi-mono/ai/src/providers/amazon-bedrock.ts +0 -929
- package/pi.dev-src/pi-mono/ai/src/providers/anthropic.ts +0 -1125
- package/pi.dev-src/pi-mono/ai/src/providers/azure-openai-responses.ts +0 -253
- package/pi.dev-src/pi-mono/ai/src/providers/faux.ts +0 -499
- package/pi.dev-src/pi-mono/ai/src/providers/github-copilot-headers.ts +0 -37
- package/pi.dev-src/pi-mono/ai/src/providers/google-gemini-cli.ts +0 -996
- package/pi.dev-src/pi-mono/ai/src/providers/google-shared.ts +0 -354
- package/pi.dev-src/pi-mono/ai/src/providers/google-vertex.ts +0 -543
- package/pi.dev-src/pi-mono/ai/src/providers/google.ts +0 -500
- package/pi.dev-src/pi-mono/ai/src/providers/mistral.ts +0 -629
- package/pi.dev-src/pi-mono/ai/src/providers/openai-codex-responses.ts +0 -984
- package/pi.dev-src/pi-mono/ai/src/providers/openai-completions.ts +0 -1063
- package/pi.dev-src/pi-mono/ai/src/providers/openai-responses-shared.ts +0 -539
- package/pi.dev-src/pi-mono/ai/src/providers/openai-responses.ts +0 -264
- package/pi.dev-src/pi-mono/ai/src/providers/register-builtins.ts +0 -433
- package/pi.dev-src/pi-mono/ai/src/providers/simple-options.ts +0 -47
- package/pi.dev-src/pi-mono/ai/src/providers/transform-messages.ts +0 -220
- package/pi.dev-src/pi-mono/ai/src/stream.ts +0 -59
- package/pi.dev-src/pi-mono/ai/src/types.ts +0 -417
- package/pi.dev-src/pi-mono/ai/src/utils/event-stream.ts +0 -87
- package/pi.dev-src/pi-mono/ai/src/utils/hash.ts +0 -13
- package/pi.dev-src/pi-mono/ai/src/utils/headers.ts +0 -7
- package/pi.dev-src/pi-mono/ai/src/utils/json-parse.ts +0 -124
- package/pi.dev-src/pi-mono/ai/src/utils/overflow.ts +0 -138
- package/pi.dev-src/pi-mono/ai/src/utils/sanitize-unicode.ts +0 -25
- package/pi.dev-src/pi-mono/ai/src/utils/typebox-helpers.ts +0 -24
- package/pi.dev-src/pi-mono/ai/src/utils/validation.ts +0 -324
- package/pi.dev-src/pi-mono/ai/test/abort.test.ts +0 -260
- package/pi.dev-src/pi-mono/ai/test/anthropic-oauth.test.ts +0 -99
- package/pi.dev-src/pi-mono/ai/test/anthropic-opus-4-7-smoke.test.ts +0 -72
- package/pi.dev-src/pi-mono/ai/test/anthropic-sse-parsing.test.ts +0 -113
- package/pi.dev-src/pi-mono/ai/test/anthropic-thinking-disable.test.ts +0 -152
- package/pi.dev-src/pi-mono/ai/test/anthropic-tool-name-normalization.test.ts +0 -205
- package/pi.dev-src/pi-mono/ai/test/azure-utils.ts +0 -28
- package/pi.dev-src/pi-mono/ai/test/bedrock-endpoint-resolution.test.ts +0 -131
- package/pi.dev-src/pi-mono/ai/test/bedrock-models.test.ts +0 -66
- package/pi.dev-src/pi-mono/ai/test/bedrock-thinking-payload.test.ts +0 -107
- package/pi.dev-src/pi-mono/ai/test/bedrock-utils.ts +0 -18
- package/pi.dev-src/pi-mono/ai/test/cache-retention.test.ts +0 -335
- package/pi.dev-src/pi-mono/ai/test/context-overflow.test.ts +0 -714
- package/pi.dev-src/pi-mono/ai/test/cross-provider-handoff.test.ts +0 -458
- package/pi.dev-src/pi-mono/ai/test/data/red-circle.png +0 -0
- package/pi.dev-src/pi-mono/ai/test/empty.test.ts +0 -742
- package/pi.dev-src/pi-mono/ai/test/faux-provider.test.ts +0 -597
- package/pi.dev-src/pi-mono/ai/test/fireworks-models.test.ts +0 -49
- package/pi.dev-src/pi-mono/ai/test/github-copilot-anthropic.test.ts +0 -108
- package/pi.dev-src/pi-mono/ai/test/github-copilot-oauth.test.ts +0 -196
- package/pi.dev-src/pi-mono/ai/test/google-gemini-cli-claude-thinking-header.test.ts +0 -103
- package/pi.dev-src/pi-mono/ai/test/google-gemini-cli-empty-stream.test.ts +0 -108
- package/pi.dev-src/pi-mono/ai/test/google-gemini-cli-retry-delay.test.ts +0 -53
- package/pi.dev-src/pi-mono/ai/test/google-shared-convert-tools.test.ts +0 -187
- package/pi.dev-src/pi-mono/ai/test/google-shared-gemini3-unsigned-tool-call.test.ts +0 -172
- package/pi.dev-src/pi-mono/ai/test/google-shared-image-tool-result-routing.test.ts +0 -124
- package/pi.dev-src/pi-mono/ai/test/google-thinking-disable.test.ts +0 -183
- package/pi.dev-src/pi-mono/ai/test/google-thinking-signature.test.ts +0 -38
- package/pi.dev-src/pi-mono/ai/test/google-tool-call-missing-args.test.ts +0 -105
- package/pi.dev-src/pi-mono/ai/test/google-vertex-api-key-resolution.test.ts +0 -144
- package/pi.dev-src/pi-mono/ai/test/image-tool-result.test.ts +0 -481
- package/pi.dev-src/pi-mono/ai/test/interleaved-thinking.test.ts +0 -145
- package/pi.dev-src/pi-mono/ai/test/lazy-module-load.test.ts +0 -102
- package/pi.dev-src/pi-mono/ai/test/mistral-reasoning-mode.test.ts +0 -66
- package/pi.dev-src/pi-mono/ai/test/mistral-tool-schema.test.ts +0 -61
- package/pi.dev-src/pi-mono/ai/test/oauth.ts +0 -89
- package/pi.dev-src/pi-mono/ai/test/openai-codex-cache-affinity-e2e.test.ts +0 -36
- package/pi.dev-src/pi-mono/ai/test/openai-codex-stream.test.ts +0 -686
- package/pi.dev-src/pi-mono/ai/test/openai-completions-cache-control-format.test.ts +0 -189
- package/pi.dev-src/pi-mono/ai/test/openai-completions-prompt-cache.test.ts +0 -198
- package/pi.dev-src/pi-mono/ai/test/openai-completions-thinking-as-text.test.ts +0 -214
- package/pi.dev-src/pi-mono/ai/test/openai-completions-tool-choice.test.ts +0 -560
- package/pi.dev-src/pi-mono/ai/test/openai-completions-tool-result-images.test.ts +0 -101
- package/pi.dev-src/pi-mono/ai/test/openai-responses-cache-affinity-e2e.test.ts +0 -32
- package/pi.dev-src/pi-mono/ai/test/openai-responses-copilot-provider.test.ts +0 -128
- package/pi.dev-src/pi-mono/ai/test/openai-responses-foreign-toolcall-id.test.ts +0 -66
- package/pi.dev-src/pi-mono/ai/test/openai-responses-partial-json-cleanup.test.ts +0 -101
- package/pi.dev-src/pi-mono/ai/test/openai-responses-reasoning-replay-e2e.test.ts +0 -292
- package/pi.dev-src/pi-mono/ai/test/openai-responses-tool-result-images.test.ts +0 -200
- package/pi.dev-src/pi-mono/ai/test/openrouter-cache-write-repro.test.ts +0 -78
- package/pi.dev-src/pi-mono/ai/test/overflow.test.ts +0 -64
- package/pi.dev-src/pi-mono/ai/test/responseid.test.ts +0 -145
- package/pi.dev-src/pi-mono/ai/test/stream.test.ts +0 -1405
- package/pi.dev-src/pi-mono/ai/test/supports-xhigh.test.ts +0 -34
- package/pi.dev-src/pi-mono/ai/test/tokens.test.ts +0 -304
- package/pi.dev-src/pi-mono/ai/test/tool-call-id-normalization.test.ts +0 -291
- package/pi.dev-src/pi-mono/ai/test/tool-call-without-result.test.ts +0 -313
- package/pi.dev-src/pi-mono/ai/test/total-tokens.test.ts +0 -695
- package/pi.dev-src/pi-mono/ai/test/transform-messages-copilot-openai-to-anthropic.test.ts +0 -191
- package/pi.dev-src/pi-mono/ai/test/unicode-surrogate.test.ts +0 -754
- package/pi.dev-src/pi-mono/ai/test/validation.test.ts +0 -116
- package/pi.dev-src/pi-mono/ai/test/xhigh.test.ts +0 -71
- package/pi.dev-src/pi-mono/ai/test/zen.test.ts +0 -25
- package/pi.dev-src/pi-mono/ai/vitest.config.ts +0 -9
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/antigravity-image-gen.ts +0 -418
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/auto-commit-on-exit.ts +0 -49
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/bash-spawn-hook.ts +0 -30
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/bookmark.ts +0 -50
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/built-in-tool-renderer.ts +0 -249
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/claude-rules.ts +0 -86
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/commands.ts +0 -72
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/confirm-destructive.ts +0 -59
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-compaction.ts +0 -127
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-footer.ts +0 -64
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-header.ts +0 -73
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-anthropic/index.ts +0 -604
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +0 -24
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-gitlab-duo/index.ts +0 -349
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-gitlab-duo/test.ts +0 -82
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-qwen-cli/index.ts +0 -345
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dirty-repo-guard.ts +0 -56
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom/build.sh +0 -152
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +0 -72
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom-component.ts +0 -132
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom-engine.ts +0 -173
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom-keys.ts +0 -104
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/index.ts +0 -74
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/wad-finder.ts +0 -51
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-resources/SKILL.md +0 -8
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-resources/dynamic.json +0 -79
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-resources/dynamic.md +0 -5
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-resources/index.ts +0 -15
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-tools.ts +0 -74
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/event-bus.ts +0 -43
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/file-trigger.ts +0 -41
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/git-checkpoint.ts +0 -53
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/github-issue-autocomplete.ts +0 -185
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/handoff.ts +0 -153
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/hello.ts +0 -26
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/hidden-thinking-label.ts +0 -53
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/inline-bash.ts +0 -94
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/input-transform.ts +0 -43
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/interactive-shell.ts +0 -196
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/mac-system-theme.ts +0 -47
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/message-renderer.ts +0 -59
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/minimal-mode.ts +0 -426
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/modal-editor.ts +0 -85
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/model-status.ts +0 -31
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/notify.ts +0 -55
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/overlay-qa-tests.ts +0 -1348
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/overlay-test.ts +0 -150
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/permission-gate.ts +0 -34
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/pirate.ts +0 -47
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/plan-mode/index.ts +0 -340
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/plan-mode/utils.ts +0 -168
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/preset.ts +0 -430
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/prompt-customizer.ts +0 -97
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/protected-paths.ts +0 -30
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/provider-payload.ts +0 -18
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/qna.ts +0 -122
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/question.ts +0 -264
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/questionnaire.ts +0 -427
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/rainbow-editor.ts +0 -88
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/reload-runtime.ts +0 -37
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/rpc-demo.ts +0 -118
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/sandbox/index.ts +0 -321
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/sandbox/package-lock.json +0 -92
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/send-user-message.ts +0 -97
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/session-name.ts +0 -27
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/shutdown-command.ts +0 -63
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/snake.ts +0 -343
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/space-invaders.ts +0 -560
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/ssh.ts +0 -220
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/status-line.ts +0 -32
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/structured-output.ts +0 -65
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents/planner.md +0 -37
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents/reviewer.md +0 -35
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents/scout.md +0 -50
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents/worker.md +0 -24
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents.ts +0 -126
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/index.ts +0 -987
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/prompts/implement.md +0 -10
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/summarize.ts +0 -206
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/system-prompt-header.ts +0 -17
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/tic-tac-toe.ts +0 -1008
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/timed-confirm.ts +0 -70
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/titlebar-spinner.ts +0 -58
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/todo.ts +0 -297
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/tool-override.ts +0 -144
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/tools.ts +0 -141
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/trigger-compact.ts +0 -50
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/truncated-tool.ts +0 -195
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/widget-placement.ts +0 -9
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/with-deps/index.ts +0 -32
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/with-deps/package-lock.json +0 -31
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/working-indicator.ts +0 -123
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/working-message-test.ts +0 -25
- package/pi.dev-src/pi-mono/coding-agent/examples/rpc-extension-ui.ts +0 -632
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/01-minimal.ts +0 -22
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/02-custom-model.ts +0 -49
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/03-custom-prompt.ts +0 -62
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/04-skills.ts +0 -55
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/05-tools.ts +0 -44
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/06-extensions.ts +0 -90
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/07-context-files.ts +0 -42
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/08-prompt-templates.ts +0 -51
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/09-api-keys-and-oauth.ts +0 -48
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/10-settings.ts +0 -53
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/11-sessions.ts +0 -48
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/12-full-control.ts +0 -73
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/13-session-runtime.ts +0 -67
- package/pi.dev-src/pi-mono/coding-agent/scripts/migrate-sessions.sh +0 -93
- package/pi.dev-src/pi-mono/coding-agent/src/bun/cli.ts +0 -6
- package/pi.dev-src/pi-mono/coding-agent/src/bun/register-bedrock.ts +0 -4
- package/pi.dev-src/pi-mono/coding-agent/src/cli/args.ts +0 -335
- package/pi.dev-src/pi-mono/coding-agent/src/cli/config-selector.ts +0 -52
- package/pi.dev-src/pi-mono/coding-agent/src/cli/file-processor.ts +0 -100
- package/pi.dev-src/pi-mono/coding-agent/src/cli/initial-message.ts +0 -43
- package/pi.dev-src/pi-mono/coding-agent/src/cli/list-models.ts +0 -110
- package/pi.dev-src/pi-mono/coding-agent/src/cli/session-picker.ts +0 -52
- package/pi.dev-src/pi-mono/coding-agent/src/cli.ts +0 -17
- package/pi.dev-src/pi-mono/coding-agent/src/config.ts +0 -261
- package/pi.dev-src/pi-mono/coding-agent/src/core/agent-session-runtime.ts +0 -394
- package/pi.dev-src/pi-mono/coding-agent/src/core/agent-session-services.ts +0 -196
- package/pi.dev-src/pi-mono/coding-agent/src/core/agent-session.ts +0 -3096
- package/pi.dev-src/pi-mono/coding-agent/src/core/auth-storage.ts +0 -493
- package/pi.dev-src/pi-mono/coding-agent/src/core/bash-executor.ts +0 -154
- package/pi.dev-src/pi-mono/coding-agent/src/core/compaction/branch-summarization.ts +0 -355
- package/pi.dev-src/pi-mono/coding-agent/src/core/compaction/compaction.ts +0 -839
- package/pi.dev-src/pi-mono/coding-agent/src/core/compaction/index.ts +0 -7
- package/pi.dev-src/pi-mono/coding-agent/src/core/compaction/utils.ts +0 -170
- package/pi.dev-src/pi-mono/coding-agent/src/core/defaults.ts +0 -3
- package/pi.dev-src/pi-mono/coding-agent/src/core/diagnostics.ts +0 -15
- package/pi.dev-src/pi-mono/coding-agent/src/core/event-bus.ts +0 -33
- package/pi.dev-src/pi-mono/coding-agent/src/core/exec.ts +0 -107
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/ansi-to-html.ts +0 -258
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/index.ts +0 -314
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/template.css +0 -1017
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/template.html +0 -55
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/template.js +0 -1770
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/tool-renderer.ts +0 -158
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/vendor/highlight.min.js +0 -1213
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/vendor/marked.min.js +0 -6
- package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/index.ts +0 -171
- package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/loader.ts +0 -606
- package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/runner.ts +0 -1019
- package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/types.ts +0 -1542
- package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/wrapper.ts +0 -30
- package/pi.dev-src/pi-mono/coding-agent/src/core/footer-data-provider.ts +0 -354
- package/pi.dev-src/pi-mono/coding-agent/src/core/index.ts +0 -77
- package/pi.dev-src/pi-mono/coding-agent/src/core/keybindings.ts +0 -370
- package/pi.dev-src/pi-mono/coding-agent/src/core/messages.ts +0 -195
- package/pi.dev-src/pi-mono/coding-agent/src/core/model-registry.ts +0 -858
- package/pi.dev-src/pi-mono/coding-agent/src/core/model-resolver.ts +0 -629
- package/pi.dev-src/pi-mono/coding-agent/src/core/output-guard.ts +0 -74
- package/pi.dev-src/pi-mono/coding-agent/src/core/package-manager.ts +0 -2408
- package/pi.dev-src/pi-mono/coding-agent/src/core/prompt-templates.ts +0 -296
- package/pi.dev-src/pi-mono/coding-agent/src/core/resolve-config-value.ts +0 -142
- package/pi.dev-src/pi-mono/coding-agent/src/core/resource-loader.ts +0 -917
- package/pi.dev-src/pi-mono/coding-agent/src/core/sdk.ts +0 -380
- package/pi.dev-src/pi-mono/coding-agent/src/core/session-cwd.ts +0 -59
- package/pi.dev-src/pi-mono/coding-agent/src/core/session-manager.ts +0 -1425
- package/pi.dev-src/pi-mono/coding-agent/src/core/settings-manager.ts +0 -999
- package/pi.dev-src/pi-mono/coding-agent/src/core/skills.ts +0 -508
- package/pi.dev-src/pi-mono/coding-agent/src/core/slash-commands.ts +0 -39
- package/pi.dev-src/pi-mono/coding-agent/src/core/source-info.ts +0 -40
- package/pi.dev-src/pi-mono/coding-agent/src/core/system-prompt.ts +0 -172
- package/pi.dev-src/pi-mono/coding-agent/src/core/telemetry.ts +0 -13
- package/pi.dev-src/pi-mono/coding-agent/src/core/timings.ts +0 -31
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/bash.ts +0 -448
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/edit-diff.ts +0 -445
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/edit.ts +0 -487
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/file-mutation-queue.ts +0 -39
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/find.ts +0 -370
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/grep.ts +0 -384
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/index.ts +0 -196
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/ls.ts +0 -229
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/path-utils.ts +0 -94
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/read.ts +0 -273
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/render-utils.ts +0 -64
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/tool-definition-wrapper.ts +0 -45
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/truncate.ts +0 -265
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/write.ts +0 -281
- package/pi.dev-src/pi-mono/coding-agent/src/index.ts +0 -352
- package/pi.dev-src/pi-mono/coding-agent/src/main.ts +0 -731
- package/pi.dev-src/pi-mono/coding-agent/src/migrations.ts +0 -314
- package/pi.dev-src/pi-mono/coding-agent/src/modes/index.ts +0 -9
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/assets/clankolas.png +0 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/armin.ts +0 -382
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/assistant-message.ts +0 -147
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/bash-execution.ts +0 -218
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/bordered-loader.ts +0 -68
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/branch-summary-message.ts +0 -58
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/compaction-summary-message.ts +0 -59
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/config-selector.ts +0 -592
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/countdown-timer.ts +0 -38
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/custom-editor.ts +0 -80
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/custom-message.ts +0 -99
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/daxnuts.ts +0 -164
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/diff.ts +0 -147
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/dynamic-border.ts +0 -25
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/earendil-announcement.ts +0 -53
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/extension-editor.ts +0 -147
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/extension-input.ts +0 -87
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/extension-selector.ts +0 -107
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/footer.ts +0 -220
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/index.ts +0 -32
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/keybinding-hints.ts +0 -24
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/login-dialog.ts +0 -178
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/model-selector.ts +0 -338
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/oauth-selector.ts +0 -121
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/scoped-models-selector.ts +0 -355
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/session-selector-search.ts +0 -194
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/session-selector.ts +0 -1026
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/settings-selector.ts +0 -456
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/show-images-selector.ts +0 -50
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/skill-invocation-message.ts +0 -55
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/theme-selector.ts +0 -67
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/thinking-selector.ts +0 -74
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/tool-execution.ts +0 -352
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/tree-selector.ts +0 -1246
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/user-message-selector.ts +0 -155
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/user-message.ts +0 -35
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/visual-truncate.ts +0 -50
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/interactive-mode.ts +0 -5155
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/theme/dark.json +0 -85
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/theme/light.json +0 -84
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/theme/theme-schema.json +0 -335
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/theme/theme.ts +0 -1141
- package/pi.dev-src/pi-mono/coding-agent/src/modes/print-mode.ts +0 -158
- package/pi.dev-src/pi-mono/coding-agent/src/modes/rpc/jsonl.ts +0 -58
- package/pi.dev-src/pi-mono/coding-agent/src/modes/rpc/rpc-client.ts +0 -515
- package/pi.dev-src/pi-mono/coding-agent/src/modes/rpc/rpc-mode.ts +0 -745
- package/pi.dev-src/pi-mono/coding-agent/src/modes/rpc/rpc-types.ts +0 -264
- package/pi.dev-src/pi-mono/coding-agent/src/package-manager-cli.ts +0 -270
- package/pi.dev-src/pi-mono/coding-agent/src/utils/changelog.ts +0 -99
- package/pi.dev-src/pi-mono/coding-agent/src/utils/child-process.ts +0 -86
- package/pi.dev-src/pi-mono/coding-agent/src/utils/clipboard-image.ts +0 -300
- package/pi.dev-src/pi-mono/coding-agent/src/utils/clipboard-native.ts +0 -22
- package/pi.dev-src/pi-mono/coding-agent/src/utils/clipboard.ts +0 -81
- package/pi.dev-src/pi-mono/coding-agent/src/utils/exif-orientation.ts +0 -183
- package/pi.dev-src/pi-mono/coding-agent/src/utils/frontmatter.ts +0 -39
- package/pi.dev-src/pi-mono/coding-agent/src/utils/fs-watch.ts +0 -30
- package/pi.dev-src/pi-mono/coding-agent/src/utils/git.ts +0 -192
- package/pi.dev-src/pi-mono/coding-agent/src/utils/image-convert.ts +0 -41
- package/pi.dev-src/pi-mono/coding-agent/src/utils/image-resize.ts +0 -176
- package/pi.dev-src/pi-mono/coding-agent/src/utils/mime.ts +0 -30
- package/pi.dev-src/pi-mono/coding-agent/src/utils/paths.ts +0 -20
- package/pi.dev-src/pi-mono/coding-agent/src/utils/photon.ts +0 -139
- package/pi.dev-src/pi-mono/coding-agent/src/utils/shell.ts +0 -210
- package/pi.dev-src/pi-mono/coding-agent/src/utils/sleep.ts +0 -18
- package/pi.dev-src/pi-mono/coding-agent/src/utils/tools-manager.ts +0 -287
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-auto-compaction-queue.test.ts +0 -437
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-branching.test.ts +0 -156
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-compaction.test.ts +0 -208
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-concurrent.test.ts +0 -618
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-dynamic-provider.test.ts +0 -117
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-dynamic-tools.test.ts +0 -182
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-retry.test.ts +0 -318
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-runtime-events.test.ts +0 -208
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-stats.test.ts +0 -143
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-tree-navigation.test.ts +0 -323
- package/pi.dev-src/pi-mono/coding-agent/test/args.test.ts +0 -328
- package/pi.dev-src/pi-mono/coding-agent/test/assistant-message.test.ts +0 -57
- package/pi.dev-src/pi-mono/coding-agent/test/auth-storage.test.ts +0 -462
- package/pi.dev-src/pi-mono/coding-agent/test/bash-close-hang-windows.test.ts +0 -126
- package/pi.dev-src/pi-mono/coding-agent/test/bash-execution-width.test.ts +0 -80
- package/pi.dev-src/pi-mono/coding-agent/test/block-images.test.ts +0 -120
- package/pi.dev-src/pi-mono/coding-agent/test/clipboard-image-bmp-conversion.test.ts +0 -88
- package/pi.dev-src/pi-mono/coding-agent/test/clipboard-image.test.ts +0 -136
- package/pi.dev-src/pi-mono/coding-agent/test/compaction-extensions-example.test.ts +0 -66
- package/pi.dev-src/pi-mono/coding-agent/test/compaction-extensions.test.ts +0 -415
- package/pi.dev-src/pi-mono/coding-agent/test/compaction-serialization.test.ts +0 -79
- package/pi.dev-src/pi-mono/coding-agent/test/compaction-summary-reasoning.test.ts +0 -118
- package/pi.dev-src/pi-mono/coding-agent/test/compaction-thinking-model.test.ts +0 -223
- package/pi.dev-src/pi-mono/coding-agent/test/compaction.test.ts +0 -550
- package/pi.dev-src/pi-mono/coding-agent/test/config.test.ts +0 -30
- package/pi.dev-src/pi-mono/coding-agent/test/edit-tool-legacy-input.test.ts +0 -116
- package/pi.dev-src/pi-mono/coding-agent/test/edit-tool-no-full-redraw.test.ts +0 -235
- package/pi.dev-src/pi-mono/coding-agent/test/export-html-whitespace.test.ts +0 -12
- package/pi.dev-src/pi-mono/coding-agent/test/export-html-xss.test.ts +0 -28
- package/pi.dev-src/pi-mono/coding-agent/test/extensions-discovery.test.ts +0 -463
- package/pi.dev-src/pi-mono/coding-agent/test/extensions-input-event.test.ts +0 -112
- package/pi.dev-src/pi-mono/coding-agent/test/extensions-runner.test.ts +0 -805
- package/pi.dev-src/pi-mono/coding-agent/test/file-mutation-queue.test.ts +0 -163
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/assistant-message-with-thinking-code.json +0 -33
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/before-compaction.jsonl +0 -1003
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/empty-agent/.gitkeep +0 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/empty-cwd/.gitkeep +0 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/large-session.jsonl +0 -1019
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/consecutive-hyphens/SKILL.md +0 -8
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/disable-model-invocation/SKILL.md +0 -9
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/invalid-name-chars/SKILL.md +0 -8
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/invalid-yaml/SKILL.md +0 -8
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/long-name/SKILL.md +0 -8
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/missing-description/SKILL.md +0 -7
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/multiline-description/SKILL.md +0 -11
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/name-mismatch/SKILL.md +0 -8
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/nested/child-skill/SKILL.md +0 -8
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/no-frontmatter/SKILL.md +0 -3
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/root-skill-preferred/SKILL.md +0 -3
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/root-skill-preferred/nested-child/SKILL.md +0 -3
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/unknown-field/SKILL.md +0 -10
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/valid-skill/SKILL.md +0 -8
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills-collision/first/calendar/SKILL.md +0 -8
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills-collision/second/calendar/SKILL.md +0 -8
- package/pi.dev-src/pi-mono/coding-agent/test/footer-data-provider.test.ts +0 -265
- package/pi.dev-src/pi-mono/coding-agent/test/footer-width.test.ts +0 -115
- package/pi.dev-src/pi-mono/coding-agent/test/frontmatter.test.ts +0 -60
- package/pi.dev-src/pi-mono/coding-agent/test/git-ssh-url.test.ts +0 -78
- package/pi.dev-src/pi-mono/coding-agent/test/git-update.test.ts +0 -411
- package/pi.dev-src/pi-mono/coding-agent/test/image-processing.test.ts +0 -145
- package/pi.dev-src/pi-mono/coding-agent/test/image-resize-callers.test.ts +0 -53
- package/pi.dev-src/pi-mono/coding-agent/test/initial-message.test.ts +0 -48
- package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-anthropic-warning.test.ts +0 -73
- package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-clone-command.test.ts +0 -77
- package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-compaction.test.ts +0 -57
- package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-import-command.test.ts +0 -144
- package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-status.test.ts +0 -635
- package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-suspend.test.ts +0 -149
- package/pi.dev-src/pi-mono/coding-agent/test/keybindings-migration.test.ts +0 -88
- package/pi.dev-src/pi-mono/coding-agent/test/model-registry.test.ts +0 -1209
- package/pi.dev-src/pi-mono/coding-agent/test/model-resolver.test.ts +0 -436
- package/pi.dev-src/pi-mono/coding-agent/test/package-command-paths.test.ts +0 -144
- package/pi.dev-src/pi-mono/coding-agent/test/package-manager-ssh.test.ts +0 -97
- package/pi.dev-src/pi-mono/coding-agent/test/package-manager.test.ts +0 -1795
- package/pi.dev-src/pi-mono/coding-agent/test/path-utils.test.ts +0 -162
- package/pi.dev-src/pi-mono/coding-agent/test/plan-mode-utils.test.ts +0 -261
- package/pi.dev-src/pi-mono/coding-agent/test/print-mode.test.ts +0 -140
- package/pi.dev-src/pi-mono/coding-agent/test/prompt-templates.test.ts +0 -515
- package/pi.dev-src/pi-mono/coding-agent/test/resource-loader.test.ts +0 -576
- package/pi.dev-src/pi-mono/coding-agent/test/rpc-client-clone.test.ts +0 -29
- package/pi.dev-src/pi-mono/coding-agent/test/rpc-example.ts +0 -86
- package/pi.dev-src/pi-mono/coding-agent/test/rpc-jsonl.test.ts +0 -65
- package/pi.dev-src/pi-mono/coding-agent/test/rpc-prompt-response-semantics.test.ts +0 -285
- package/pi.dev-src/pi-mono/coding-agent/test/rpc.test.ts +0 -321
- package/pi.dev-src/pi-mono/coding-agent/test/sdk-codex-cache-probe-tool-loop.ts +0 -364
- package/pi.dev-src/pi-mono/coding-agent/test/sdk-openrouter-attribution.test.ts +0 -181
- package/pi.dev-src/pi-mono/coding-agent/test/sdk-session-manager.test.ts +0 -95
- package/pi.dev-src/pi-mono/coding-agent/test/sdk-skills.test.ts +0 -109
- package/pi.dev-src/pi-mono/coding-agent/test/session-cwd.test.ts +0 -91
- package/pi.dev-src/pi-mono/coding-agent/test/session-info-modified-timestamp.test.ts +0 -83
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/build-context.test.ts +0 -268
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/custom-session-id.test.ts +0 -109
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/file-operations.test.ts +0 -208
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/labels.test.ts +0 -198
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/migration.test.ts +0 -78
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/save-entry.test.ts +0 -55
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/tree-traversal.test.ts +0 -533
- package/pi.dev-src/pi-mono/coding-agent/test/session-selector-path-delete.test.ts +0 -315
- package/pi.dev-src/pi-mono/coding-agent/test/session-selector-rename.test.ts +0 -111
- package/pi.dev-src/pi-mono/coding-agent/test/session-selector-search.test.ts +0 -195
- package/pi.dev-src/pi-mono/coding-agent/test/settings-manager-bug.test.ts +0 -147
- package/pi.dev-src/pi-mono/coding-agent/test/settings-manager.test.ts +0 -319
- package/pi.dev-src/pi-mono/coding-agent/test/skills.test.ts +0 -432
- package/pi.dev-src/pi-mono/coding-agent/test/stdout-cleanliness.test.ts +0 -103
- package/pi.dev-src/pi-mono/coding-agent/test/streaming-render-debug.ts +0 -97
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-bash-persistence.test.ts +0 -242
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-compaction.test.ts +0 -343
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-model-extension.test.ts +0 -325
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-prompt.test.ts +0 -323
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-queue.test.ts +0 -422
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-retry-events.test.ts +0 -358
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-runtime.test.ts +0 -553
- package/pi.dev-src/pi-mono/coding-agent/test/suite/harness.ts +0 -208
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2023-queued-slash-command-followup.test.ts +0 -80
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2753-reload-stale-resource-settings.test.ts +0 -100
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2781-skill-collision-precedence.test.ts +0 -120
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2791-fswatch-error-crash.test.ts +0 -106
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2835-tools-allowlist-filters-extension-tools.test.ts +0 -94
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2860-replaced-session-context.test.ts +0 -274
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/3217-scoped-model-order.test.ts +0 -104
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/3302-find-path-glob.test.ts +0 -72
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/3303-find-nested-gitignore.test.ts +0 -83
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/3317-network-connection-lost-retry.test.ts +0 -33
- package/pi.dev-src/pi-mono/coding-agent/test/system-prompt.test.ts +0 -102
- package/pi.dev-src/pi-mono/coding-agent/test/test-harness.test.ts +0 -321
- package/pi.dev-src/pi-mono/coding-agent/test/test-harness.ts +0 -446
- package/pi.dev-src/pi-mono/coding-agent/test/test-theme-colors.ts +0 -246
- package/pi.dev-src/pi-mono/coding-agent/test/theme-export.test.ts +0 -104
- package/pi.dev-src/pi-mono/coding-agent/test/tool-execution-component.test.ts +0 -331
- package/pi.dev-src/pi-mono/coding-agent/test/tools.test.ts +0 -889
- package/pi.dev-src/pi-mono/coding-agent/test/tree-selector.test.ts +0 -655
- package/pi.dev-src/pi-mono/coding-agent/test/trigger-compact-extension.test.ts +0 -57
- package/pi.dev-src/pi-mono/coding-agent/test/truncate-to-width.test.ts +0 -81
- package/pi.dev-src/pi-mono/coding-agent/test/user-message.test.ts +0 -25
- package/pi.dev-src/pi-mono/coding-agent/test/utilities.ts +0 -316
- package/pi.dev-src/pi-mono/coding-agent/tsconfig.examples.json +0 -16
- package/pi.dev-src/pi-mono/coding-agent/vitest.config.ts +0 -26
- package/pi.dev-src/pi-mono/mom/dev.sh +0 -30
- package/pi.dev-src/pi-mono/mom/docker.sh +0 -95
- package/pi.dev-src/pi-mono/mom/scripts/migrate-timestamps.ts +0 -121
- package/pi.dev-src/pi-mono/mom/src/agent.ts +0 -882
- package/pi.dev-src/pi-mono/mom/src/context.ts +0 -180
- package/pi.dev-src/pi-mono/mom/src/download.ts +0 -117
- package/pi.dev-src/pi-mono/mom/src/events.ts +0 -442
- package/pi.dev-src/pi-mono/mom/src/fs-watch.ts +0 -30
- package/pi.dev-src/pi-mono/mom/src/log.ts +0 -271
- package/pi.dev-src/pi-mono/mom/src/main.ts +0 -367
- package/pi.dev-src/pi-mono/mom/src/sandbox.ts +0 -221
- package/pi.dev-src/pi-mono/mom/src/slack.ts +0 -623
- package/pi.dev-src/pi-mono/mom/src/store.ts +0 -234
- package/pi.dev-src/pi-mono/mom/src/tools/attach.ts +0 -47
- package/pi.dev-src/pi-mono/mom/src/tools/bash.ts +0 -97
- package/pi.dev-src/pi-mono/mom/src/tools/edit.ts +0 -165
- package/pi.dev-src/pi-mono/mom/src/tools/index.ts +0 -19
- package/pi.dev-src/pi-mono/mom/src/tools/read.ts +0 -159
- package/pi.dev-src/pi-mono/mom/src/tools/truncate.ts +0 -236
- package/pi.dev-src/pi-mono/mom/src/tools/write.ts +0 -45
- package/pi.dev-src/pi-mono/mom/test/events.test.ts +0 -50
- package/pi.dev-src/pi-mono/pods/scripts/model_run.sh +0 -83
- package/pi.dev-src/pi-mono/pods/scripts/pod_setup.sh +0 -336
- package/pi.dev-src/pi-mono/pods/src/cli.ts +0 -360
- package/pi.dev-src/pi-mono/pods/src/commands/models.ts +0 -753
- package/pi.dev-src/pi-mono/pods/src/commands/pods.ts +0 -205
- package/pi.dev-src/pi-mono/pods/src/commands/prompt.ts +0 -84
- package/pi.dev-src/pi-mono/pods/src/config.ts +0 -80
- package/pi.dev-src/pi-mono/pods/src/index.ts +0 -2
- package/pi.dev-src/pi-mono/pods/src/model-configs.ts +0 -111
- package/pi.dev-src/pi-mono/pods/src/models.json +0 -295
- package/pi.dev-src/pi-mono/pods/src/ssh.ts +0 -151
- package/pi.dev-src/pi-mono/pods/src/types.ts +0 -27
- package/pi.dev-src/pi-mono/tui/src/autocomplete.ts +0 -783
- package/pi.dev-src/pi-mono/tui/src/components/box.ts +0 -137
- package/pi.dev-src/pi-mono/tui/src/components/cancellable-loader.ts +0 -40
- package/pi.dev-src/pi-mono/tui/src/components/editor.ts +0 -2280
- package/pi.dev-src/pi-mono/tui/src/components/image.ts +0 -104
- package/pi.dev-src/pi-mono/tui/src/components/input.ts +0 -503
- package/pi.dev-src/pi-mono/tui/src/components/loader.ts +0 -86
- package/pi.dev-src/pi-mono/tui/src/components/markdown.ts +0 -852
- package/pi.dev-src/pi-mono/tui/src/components/select-list.ts +0 -229
- package/pi.dev-src/pi-mono/tui/src/components/settings-list.ts +0 -250
- package/pi.dev-src/pi-mono/tui/src/components/spacer.ts +0 -28
- package/pi.dev-src/pi-mono/tui/src/components/text.ts +0 -106
- package/pi.dev-src/pi-mono/tui/src/components/truncated-text.ts +0 -65
- package/pi.dev-src/pi-mono/tui/src/editor-component.ts +0 -74
- package/pi.dev-src/pi-mono/tui/src/fuzzy.ts +0 -133
- package/pi.dev-src/pi-mono/tui/src/index.ts +0 -106
- package/pi.dev-src/pi-mono/tui/src/keybindings.ts +0 -244
- package/pi.dev-src/pi-mono/tui/src/keys.ts +0 -1400
- package/pi.dev-src/pi-mono/tui/src/kill-ring.ts +0 -46
- package/pi.dev-src/pi-mono/tui/src/stdin-buffer.ts +0 -386
- package/pi.dev-src/pi-mono/tui/src/terminal-image.ts +0 -414
- package/pi.dev-src/pi-mono/tui/src/terminal.ts +0 -373
- package/pi.dev-src/pi-mono/tui/src/tui.ts +0 -1243
- package/pi.dev-src/pi-mono/tui/src/undo-stack.ts +0 -28
- package/pi.dev-src/pi-mono/tui/src/utils.ts +0 -1085
- package/pi.dev-src/pi-mono/tui/test/autocomplete.test.ts +0 -542
- package/pi.dev-src/pi-mono/tui/test/bug-regression-isimageline-startswith-bug.test.ts +0 -237
- package/pi.dev-src/pi-mono/tui/test/chat-simple.ts +0 -129
- package/pi.dev-src/pi-mono/tui/test/editor.test.ts +0 -3812
- package/pi.dev-src/pi-mono/tui/test/fuzzy.test.ts +0 -98
- package/pi.dev-src/pi-mono/tui/test/image-test.ts +0 -56
- package/pi.dev-src/pi-mono/tui/test/input.test.ts +0 -580
- package/pi.dev-src/pi-mono/tui/test/key-tester.ts +0 -105
- package/pi.dev-src/pi-mono/tui/test/keybindings.test.ts +0 -38
- package/pi.dev-src/pi-mono/tui/test/keys.test.ts +0 -614
- package/pi.dev-src/pi-mono/tui/test/markdown.test.ts +0 -1236
- package/pi.dev-src/pi-mono/tui/test/overlay-non-capturing.test.ts +0 -609
- package/pi.dev-src/pi-mono/tui/test/overlay-options.test.ts +0 -538
- package/pi.dev-src/pi-mono/tui/test/overlay-short-content.test.ts +0 -56
- package/pi.dev-src/pi-mono/tui/test/regression-regional-indicator-width.test.ts +0 -52
- package/pi.dev-src/pi-mono/tui/test/select-list.test.ts +0 -116
- package/pi.dev-src/pi-mono/tui/test/stdin-buffer.test.ts +0 -422
- package/pi.dev-src/pi-mono/tui/test/terminal-image.test.ts +0 -279
- package/pi.dev-src/pi-mono/tui/test/test-themes.ts +0 -38
- package/pi.dev-src/pi-mono/tui/test/truncate-to-width.test.ts +0 -62
- package/pi.dev-src/pi-mono/tui/test/truncated-text.test.ts +0 -129
- package/pi.dev-src/pi-mono/tui/test/tui-cell-size-input.test.ts +0 -81
- package/pi.dev-src/pi-mono/tui/test/tui-overlay-style-leak.test.ts +0 -72
- package/pi.dev-src/pi-mono/tui/test/tui-render.test.ts +0 -509
- package/pi.dev-src/pi-mono/tui/test/viewport-overwrite-repro.ts +0 -106
- package/pi.dev-src/pi-mono/tui/test/virtual-terminal.ts +0 -218
- package/pi.dev-src/pi-mono/tui/test/wrap-ansi.test.ts +0 -207
- package/pi.dev-src/pi-mono/tui/vitest.config.ts +0 -7
- package/pi.dev-src/pi-mono/web-ui/example/index.html +0 -13
- package/pi.dev-src/pi-mono/web-ui/example/src/app.css +0 -1
- package/pi.dev-src/pi-mono/web-ui/example/src/custom-messages.ts +0 -99
- package/pi.dev-src/pi-mono/web-ui/example/src/main.ts +0 -421
- package/pi.dev-src/pi-mono/web-ui/example/tsconfig.json +0 -23
- package/pi.dev-src/pi-mono/web-ui/example/vite.config.ts +0 -6
- package/pi.dev-src/pi-mono/web-ui/scripts/count-prompt-tokens.ts +0 -88
- package/pi.dev-src/pi-mono/web-ui/src/ChatPanel.ts +0 -209
- package/pi.dev-src/pi-mono/web-ui/src/app.css +0 -68
- package/pi.dev-src/pi-mono/web-ui/src/components/AgentInterface.ts +0 -403
- package/pi.dev-src/pi-mono/web-ui/src/components/AttachmentTile.ts +0 -107
- package/pi.dev-src/pi-mono/web-ui/src/components/ConsoleBlock.ts +0 -72
- package/pi.dev-src/pi-mono/web-ui/src/components/CustomProviderCard.ts +0 -100
- package/pi.dev-src/pi-mono/web-ui/src/components/ExpandableSection.ts +0 -46
- package/pi.dev-src/pi-mono/web-ui/src/components/Input.ts +0 -113
- package/pi.dev-src/pi-mono/web-ui/src/components/MessageEditor.ts +0 -405
- package/pi.dev-src/pi-mono/web-ui/src/components/MessageList.ts +0 -98
- package/pi.dev-src/pi-mono/web-ui/src/components/Messages.ts +0 -383
- package/pi.dev-src/pi-mono/web-ui/src/components/ProviderKeyInput.ts +0 -153
- package/pi.dev-src/pi-mono/web-ui/src/components/SandboxedIframe.ts +0 -626
- package/pi.dev-src/pi-mono/web-ui/src/components/StreamingMessageContainer.ts +0 -103
- package/pi.dev-src/pi-mono/web-ui/src/components/ThinkingBlock.ts +0 -43
- package/pi.dev-src/pi-mono/web-ui/src/components/message-renderer-registry.ts +0 -28
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/ArtifactsRuntimeProvider.ts +0 -220
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/AttachmentsRuntimeProvider.ts +0 -66
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/ConsoleRuntimeProvider.ts +0 -186
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/FileDownloadRuntimeProvider.ts +0 -110
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/RuntimeMessageBridge.ts +0 -82
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/RuntimeMessageRouter.ts +0 -216
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/SandboxRuntimeProvider.ts +0 -52
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/ApiKeyPromptDialog.ts +0 -75
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/AttachmentOverlay.ts +0 -636
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/CustomProviderDialog.ts +0 -274
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/ModelSelector.ts +0 -370
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/PersistentStorageDialog.ts +0 -144
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/ProvidersModelsTab.ts +0 -212
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/SessionListDialog.ts +0 -150
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/SettingsDialog.ts +0 -218
- package/pi.dev-src/pi-mono/web-ui/src/index.ts +0 -120
- package/pi.dev-src/pi-mono/web-ui/src/prompts/prompts.ts +0 -282
- package/pi.dev-src/pi-mono/web-ui/src/storage/app-storage.ts +0 -60
- package/pi.dev-src/pi-mono/web-ui/src/storage/backends/indexeddb-storage-backend.ts +0 -193
- package/pi.dev-src/pi-mono/web-ui/src/storage/store.ts +0 -33
- package/pi.dev-src/pi-mono/web-ui/src/storage/stores/custom-providers-store.ts +0 -62
- package/pi.dev-src/pi-mono/web-ui/src/storage/stores/provider-keys-store.ts +0 -33
- package/pi.dev-src/pi-mono/web-ui/src/storage/stores/sessions-store.ts +0 -136
- package/pi.dev-src/pi-mono/web-ui/src/storage/stores/settings-store.ts +0 -34
- package/pi.dev-src/pi-mono/web-ui/src/storage/types.ts +0 -206
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/ArtifactElement.ts +0 -14
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/ArtifactPill.ts +0 -26
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/Console.ts +0 -93
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/DocxArtifact.ts +0 -213
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/ExcelArtifact.ts +0 -231
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/GenericArtifact.ts +0 -117
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/HtmlArtifact.ts +0 -195
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/ImageArtifact.ts +0 -116
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/MarkdownArtifact.ts +0 -82
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/PdfArtifact.ts +0 -201
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/SvgArtifact.ts +0 -119
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/TextArtifact.ts +0 -148
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/artifacts-tool-renderer.ts +0 -310
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/artifacts.ts +0 -713
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/index.ts +0 -7
- package/pi.dev-src/pi-mono/web-ui/src/tools/extract-document.ts +0 -275
- package/pi.dev-src/pi-mono/web-ui/src/tools/index.ts +0 -46
- package/pi.dev-src/pi-mono/web-ui/src/tools/javascript-repl.ts +0 -293
- package/pi.dev-src/pi-mono/web-ui/src/tools/renderer-registry.ts +0 -130
- package/pi.dev-src/pi-mono/web-ui/src/tools/renderers/BashRenderer.ts +0 -52
- package/pi.dev-src/pi-mono/web-ui/src/tools/renderers/CalculateRenderer.ts +0 -58
- package/pi.dev-src/pi-mono/web-ui/src/tools/renderers/DefaultRenderer.ts +0 -103
- package/pi.dev-src/pi-mono/web-ui/src/tools/renderers/GetCurrentTimeRenderer.ts +0 -92
- package/pi.dev-src/pi-mono/web-ui/src/tools/types.ts +0 -15
- package/pi.dev-src/pi-mono/web-ui/src/utils/attachment-utils.ts +0 -472
- package/pi.dev-src/pi-mono/web-ui/src/utils/auth-token.ts +0 -22
- package/pi.dev-src/pi-mono/web-ui/src/utils/format.ts +0 -42
- package/pi.dev-src/pi-mono/web-ui/src/utils/i18n.ts +0 -653
- package/pi.dev-src/pi-mono/web-ui/src/utils/model-discovery.ts +0 -277
- package/pi.dev-src/pi-mono/web-ui/src/utils/proxy-utils.ts +0 -139
- package/pi.dev-src/pi-mono/web-ui/src/utils/test-sessions.ts +0 -2357
- package/pi.dev-src/pi-mono/web-ui/tsconfig.json +0 -7
- package/tests/attended-results-scenarios.ts +0 -648
- package/tests/attended-results.test.ts +0 -39
- package/tests/cli-command-option-parity.test.ts +0 -798
- package/tests/debug-extension-harness.test.ts +0 -466
- package/tests/extension-registration.test.ts +0 -6785
- package/tests/fixtures/fixture_c.c +0 -361
- package/tests/fixtures/fixture_cpp.cpp +0 -407
- package/tests/fixtures/fixture_csharp.cs +0 -411
- package/tests/fixtures/fixture_elixir.ex +0 -409
- package/tests/fixtures/fixture_go.go +0 -341
- package/tests/fixtures/fixture_haskell.hs +0 -250
- package/tests/fixtures/fixture_java.java +0 -430
- package/tests/fixtures/fixture_javascript.js +0 -383
- package/tests/fixtures/fixture_kotlin.kt +0 -451
- package/tests/fixtures/fixture_lua.lua +0 -276
- package/tests/fixtures/fixture_perl.pl +0 -310
- package/tests/fixtures/fixture_php.php +0 -433
- package/tests/fixtures/fixture_python.py +0 -502
- package/tests/fixtures/fixture_ruby.rb +0 -345
- package/tests/fixtures/fixture_rust.rs +0 -380
- package/tests/fixtures/fixture_scala.scala +0 -398
- package/tests/fixtures/fixture_shell.sh +0 -276
- package/tests/fixtures/fixture_swift.swift +0 -397
- package/tests/fixtures/fixture_typescript.ts +0 -434
- package/tests/fixtures/fixture_zig.zig +0 -295
- package/tests/fixtures_attended_results/project/compress-line-numbers.json +0 -5
- package/tests/fixtures_attended_results/project/compress.json +0 -5
- package/tests/fixtures_attended_results/project/enable-static-check-invalid-command.json +0 -5
- package/tests/fixtures_attended_results/project/enable-static-check-valid.json +0 -5
- package/tests/fixtures_attended_results/project/files-static-check.json +0 -5
- package/tests/fixtures_attended_results/project/find-line-numbers.json +0 -5
- package/tests/fixtures_attended_results/project/find.json +0 -5
- package/tests/fixtures_attended_results/project/get-base-path.json +0 -5
- package/tests/fixtures_attended_results/project/git-check-clean.json +0 -5
- package/tests/fixtures_attended_results/project/git-check-dirty.json +0 -5
- package/tests/fixtures_attended_results/project/git-path.json +0 -5
- package/tests/fixtures_attended_results/project/git-wt-create-invalid.json +0 -5
- package/tests/fixtures_attended_results/project/git-wt-create-valid.json +0 -5
- package/tests/fixtures_attended_results/project/git-wt-delete-nonexistent.json +0 -5
- package/tests/fixtures_attended_results/project/git-wt-delete-valid.json +0 -5
- package/tests/fixtures_attended_results/project/git-wt-name.json +0 -5
- package/tests/fixtures_attended_results/project/static-check.json +0 -5
- package/tests/fixtures_attended_results/project/summarize.json +0 -5
- package/tests/fixtures_attended_results/project/tokens.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_c.c.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_cpp.cpp.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_csharp.cs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_elixir.ex.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_go.go.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_haskell.hs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_java.java.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_javascript.js.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_kotlin.kt.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_lua.lua.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_perl.pl.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_php.php.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_python.py.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_ruby.rb.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_rust.rs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_scala.scala.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_shell.sh.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_swift.swift.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_typescript.ts.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_zig.zig.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_c.c.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_cpp.cpp.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_csharp.cs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_elixir.ex.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_go.go.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_haskell.hs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_java.java.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_javascript.js.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_kotlin.kt.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_lua.lua.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_perl.pl.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_php.php.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_python.py.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_ruby.rb.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_rust.rs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_scala.scala.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_shell.sh.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_swift.swift.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_typescript.ts.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_zig.zig.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_c.c.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_cpp.cpp.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_csharp.cs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_elixir.ex.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_go.go.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_haskell.hs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_java.java.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_javascript.js.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_kotlin.kt.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_lua.lua.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_perl.pl.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_php.php.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_python.py.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_ruby.rb.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_rust.rs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_scala.scala.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_shell.sh.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_swift.swift.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_typescript.ts.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find/fixture_zig.zig.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_c.c.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_cpp.cpp.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_csharp.cs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_elixir.ex.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_go.go.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_haskell.hs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_java.java.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_javascript.js.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_kotlin.kt.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_lua.lua.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_perl.pl.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_php.php.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_python.py.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_ruby.rb.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_rust.rs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_scala.scala.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_shell.sh.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_swift.swift.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_typescript.ts.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_zig.zig.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_c.c.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_cpp.cpp.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_csharp.cs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_elixir.ex.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_go.go.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_haskell.hs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_java.java.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_javascript.js.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_kotlin.kt.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_lua.lua.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_perl.pl.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_php.php.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_python.py.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_ruby.rb.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_rust.rs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_scala.scala.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_shell.sh.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_swift.swift.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_typescript.ts.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-summarize/fixture_zig.zig.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_c.c.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_cpp.cpp.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_csharp.cs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_elixir.ex.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_go.go.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_haskell.hs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_java.java.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_javascript.js.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_kotlin.kt.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_lua.lua.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_perl.pl.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_php.php.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_python.py.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_ruby.rb.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_rust.rs.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_scala.scala.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_shell.sh.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_swift.swift.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_typescript.ts.json +0 -5
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_zig.zig.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_c.c.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_cpp.cpp.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_csharp.cs.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_elixir.ex.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_go.go.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_haskell.hs.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_java.java.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_javascript.js.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_kotlin.kt.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_lua.lua.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_perl.pl.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_php.php.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_python.py.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_ruby.rb.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_rust.rs.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_scala.scala.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_shell.sh.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_swift.swift.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_typescript.ts.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_zig.zig.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_c.c.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_cpp.cpp.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_csharp.cs.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_elixir.ex.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_go.go.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_haskell.hs.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_java.java.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_javascript.js.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_kotlin.kt.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_lua.lua.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_perl.pl.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_php.php.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_python.py.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_ruby.rb.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_rust.rs.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_scala.scala.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_shell.sh.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_swift.swift.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_typescript.ts.json +0 -5
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_zig.zig.json +0 -5
- package/tests/helpers.ts +0 -236
- package/tests/oracle-project.test.ts +0 -67
- package/tests/oracle-standalone.test.ts +0 -68
- package/tests/prompt-command-summary.test.ts +0 -36
- package/tests/prompt-rendering.test.ts +0 -103
- package/tests/python_oracle_stubs/tiktoken.py +0 -76
- package/tests/release-workflow.test.ts +0 -195
- package/tests/static-check-bundled.test.ts +0 -332
|
@@ -1,1085 +0,0 @@
|
|
|
1
|
-
import { eastAsianWidth } from "get-east-asian-width";
|
|
2
|
-
|
|
3
|
-
// Grapheme segmenter (shared instance)
|
|
4
|
-
const segmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Get the shared grapheme segmenter instance.
|
|
8
|
-
*/
|
|
9
|
-
export function getSegmenter(): Intl.Segmenter {
|
|
10
|
-
return segmenter;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Check if a grapheme cluster (after segmentation) could possibly be an RGI emoji.
|
|
15
|
-
* This is a fast heuristic to avoid the expensive rgiEmojiRegex test.
|
|
16
|
-
* The tested Unicode blocks are deliberately broad to account for future
|
|
17
|
-
* Unicode additions.
|
|
18
|
-
*/
|
|
19
|
-
function couldBeEmoji(segment: string): boolean {
|
|
20
|
-
const cp = segment.codePointAt(0)!;
|
|
21
|
-
return (
|
|
22
|
-
(cp >= 0x1f000 && cp <= 0x1fbff) || // Emoji and Pictograph
|
|
23
|
-
(cp >= 0x2300 && cp <= 0x23ff) || // Misc technical
|
|
24
|
-
(cp >= 0x2600 && cp <= 0x27bf) || // Misc symbols, dingbats
|
|
25
|
-
(cp >= 0x2b50 && cp <= 0x2b55) || // Specific stars/circles
|
|
26
|
-
segment.includes("\uFE0F") || // Contains VS16 (emoji presentation selector)
|
|
27
|
-
segment.length > 2 // Multi-codepoint sequences (ZWJ, skin tones, etc.)
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Regexes for character classification (same as string-width library)
|
|
32
|
-
const zeroWidthRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v;
|
|
33
|
-
const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v;
|
|
34
|
-
const rgiEmojiRegex = /^\p{RGI_Emoji}$/v;
|
|
35
|
-
|
|
36
|
-
// Cache for non-ASCII strings
|
|
37
|
-
const WIDTH_CACHE_SIZE = 512;
|
|
38
|
-
const widthCache = new Map<string, number>();
|
|
39
|
-
|
|
40
|
-
function isPrintableAscii(str: string): boolean {
|
|
41
|
-
for (let i = 0; i < str.length; i++) {
|
|
42
|
-
const code = str.charCodeAt(i);
|
|
43
|
-
if (code < 0x20 || code > 0x7e) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function truncateFragmentToWidth(text: string, maxWidth: number): { text: string; width: number } {
|
|
51
|
-
if (maxWidth <= 0 || text.length === 0) {
|
|
52
|
-
return { text: "", width: 0 };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (isPrintableAscii(text)) {
|
|
56
|
-
const clipped = text.slice(0, maxWidth);
|
|
57
|
-
return { text: clipped, width: clipped.length };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const hasAnsi = text.includes("\x1b");
|
|
61
|
-
const hasTabs = text.includes("\t");
|
|
62
|
-
if (!hasAnsi && !hasTabs) {
|
|
63
|
-
let result = "";
|
|
64
|
-
let width = 0;
|
|
65
|
-
for (const { segment } of segmenter.segment(text)) {
|
|
66
|
-
const w = graphemeWidth(segment);
|
|
67
|
-
if (width + w > maxWidth) {
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
result += segment;
|
|
71
|
-
width += w;
|
|
72
|
-
}
|
|
73
|
-
return { text: result, width };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
let result = "";
|
|
77
|
-
let width = 0;
|
|
78
|
-
let i = 0;
|
|
79
|
-
let pendingAnsi = "";
|
|
80
|
-
|
|
81
|
-
while (i < text.length) {
|
|
82
|
-
const ansi = extractAnsiCode(text, i);
|
|
83
|
-
if (ansi) {
|
|
84
|
-
pendingAnsi += ansi.code;
|
|
85
|
-
i += ansi.length;
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (text[i] === "\t") {
|
|
90
|
-
if (width + 3 > maxWidth) {
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
if (pendingAnsi) {
|
|
94
|
-
result += pendingAnsi;
|
|
95
|
-
pendingAnsi = "";
|
|
96
|
-
}
|
|
97
|
-
result += "\t";
|
|
98
|
-
width += 3;
|
|
99
|
-
i++;
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
let end = i;
|
|
104
|
-
while (end < text.length && text[end] !== "\t") {
|
|
105
|
-
const nextAnsi = extractAnsiCode(text, end);
|
|
106
|
-
if (nextAnsi) {
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
end++;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
for (const { segment } of segmenter.segment(text.slice(i, end))) {
|
|
113
|
-
const w = graphemeWidth(segment);
|
|
114
|
-
if (width + w > maxWidth) {
|
|
115
|
-
return { text: result, width };
|
|
116
|
-
}
|
|
117
|
-
if (pendingAnsi) {
|
|
118
|
-
result += pendingAnsi;
|
|
119
|
-
pendingAnsi = "";
|
|
120
|
-
}
|
|
121
|
-
result += segment;
|
|
122
|
-
width += w;
|
|
123
|
-
}
|
|
124
|
-
i = end;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return { text: result, width };
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function finalizeTruncatedResult(
|
|
131
|
-
prefix: string,
|
|
132
|
-
prefixWidth: number,
|
|
133
|
-
ellipsis: string,
|
|
134
|
-
ellipsisWidth: number,
|
|
135
|
-
maxWidth: number,
|
|
136
|
-
pad: boolean,
|
|
137
|
-
): string {
|
|
138
|
-
const reset = "\x1b[0m";
|
|
139
|
-
const visibleWidth = prefixWidth + ellipsisWidth;
|
|
140
|
-
let result: string;
|
|
141
|
-
|
|
142
|
-
if (ellipsis.length > 0) {
|
|
143
|
-
result = `${prefix}${reset}${ellipsis}${reset}`;
|
|
144
|
-
} else {
|
|
145
|
-
result = `${prefix}${reset}`;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return pad ? result + " ".repeat(Math.max(0, maxWidth - visibleWidth)) : result;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Calculate the terminal width of a single grapheme cluster.
|
|
153
|
-
* Based on code from the string-width library, but includes a possible-emoji
|
|
154
|
-
* check to avoid running the RGI_Emoji regex unnecessarily.
|
|
155
|
-
*/
|
|
156
|
-
function graphemeWidth(segment: string): number {
|
|
157
|
-
// Zero-width clusters
|
|
158
|
-
if (zeroWidthRegex.test(segment)) {
|
|
159
|
-
return 0;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// Emoji check with pre-filter
|
|
163
|
-
if (couldBeEmoji(segment) && rgiEmojiRegex.test(segment)) {
|
|
164
|
-
return 2;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Get base visible codepoint
|
|
168
|
-
const base = segment.replace(leadingNonPrintingRegex, "");
|
|
169
|
-
const cp = base.codePointAt(0);
|
|
170
|
-
if (cp === undefined) {
|
|
171
|
-
return 0;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// Regional indicator symbols (U+1F1E6..U+1F1FF) are often rendered as
|
|
175
|
-
// full-width emoji in terminals, even when isolated during streaming.
|
|
176
|
-
// Keep width conservative (2) to avoid terminal auto-wrap drift artifacts.
|
|
177
|
-
if (cp >= 0x1f1e6 && cp <= 0x1f1ff) {
|
|
178
|
-
return 2;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
let width = eastAsianWidth(cp);
|
|
182
|
-
|
|
183
|
-
// Trailing halfwidth/fullwidth forms
|
|
184
|
-
if (segment.length > 1) {
|
|
185
|
-
for (const char of segment.slice(1)) {
|
|
186
|
-
const c = char.codePointAt(0)!;
|
|
187
|
-
if (c >= 0xff00 && c <= 0xffef) {
|
|
188
|
-
width += eastAsianWidth(c);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
return width;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Calculate the visible width of a string in terminal columns.
|
|
198
|
-
*/
|
|
199
|
-
export function visibleWidth(str: string): number {
|
|
200
|
-
if (str.length === 0) {
|
|
201
|
-
return 0;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Fast path: pure ASCII printable
|
|
205
|
-
if (isPrintableAscii(str)) {
|
|
206
|
-
return str.length;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// Check cache
|
|
210
|
-
const cached = widthCache.get(str);
|
|
211
|
-
if (cached !== undefined) {
|
|
212
|
-
return cached;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Normalize: tabs to 3 spaces, strip ANSI escape codes
|
|
216
|
-
let clean = str;
|
|
217
|
-
if (str.includes("\t")) {
|
|
218
|
-
clean = clean.replace(/\t/g, " ");
|
|
219
|
-
}
|
|
220
|
-
if (clean.includes("\x1b")) {
|
|
221
|
-
// Strip supported ANSI/OSC/APC escape sequences in one pass.
|
|
222
|
-
// This covers CSI styling/cursor codes, OSC hyperlinks and prompt markers,
|
|
223
|
-
// and APC sequences like CURSOR_MARKER.
|
|
224
|
-
let stripped = "";
|
|
225
|
-
let i = 0;
|
|
226
|
-
while (i < clean.length) {
|
|
227
|
-
const ansi = extractAnsiCode(clean, i);
|
|
228
|
-
if (ansi) {
|
|
229
|
-
i += ansi.length;
|
|
230
|
-
continue;
|
|
231
|
-
}
|
|
232
|
-
stripped += clean[i];
|
|
233
|
-
i++;
|
|
234
|
-
}
|
|
235
|
-
clean = stripped;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// Calculate width
|
|
239
|
-
let width = 0;
|
|
240
|
-
for (const { segment } of segmenter.segment(clean)) {
|
|
241
|
-
width += graphemeWidth(segment);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Cache result
|
|
245
|
-
if (widthCache.size >= WIDTH_CACHE_SIZE) {
|
|
246
|
-
const firstKey = widthCache.keys().next().value;
|
|
247
|
-
if (firstKey !== undefined) {
|
|
248
|
-
widthCache.delete(firstKey);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
widthCache.set(str, width);
|
|
252
|
-
|
|
253
|
-
return width;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Extract ANSI escape sequences from a string at the given position.
|
|
258
|
-
*/
|
|
259
|
-
export function extractAnsiCode(str: string, pos: number): { code: string; length: number } | null {
|
|
260
|
-
if (pos >= str.length || str[pos] !== "\x1b") return null;
|
|
261
|
-
|
|
262
|
-
const next = str[pos + 1];
|
|
263
|
-
|
|
264
|
-
// CSI sequence: ESC [ ... m/G/K/H/J
|
|
265
|
-
if (next === "[") {
|
|
266
|
-
let j = pos + 2;
|
|
267
|
-
while (j < str.length && !/[mGKHJ]/.test(str[j]!)) j++;
|
|
268
|
-
if (j < str.length) return { code: str.substring(pos, j + 1), length: j + 1 - pos };
|
|
269
|
-
return null;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// OSC sequence: ESC ] ... BEL or ESC ] ... ST (ESC \)
|
|
273
|
-
// Used for hyperlinks (OSC 8), window titles, etc.
|
|
274
|
-
if (next === "]") {
|
|
275
|
-
let j = pos + 2;
|
|
276
|
-
while (j < str.length) {
|
|
277
|
-
if (str[j] === "\x07") return { code: str.substring(pos, j + 1), length: j + 1 - pos };
|
|
278
|
-
if (str[j] === "\x1b" && str[j + 1] === "\\") return { code: str.substring(pos, j + 2), length: j + 2 - pos };
|
|
279
|
-
j++;
|
|
280
|
-
}
|
|
281
|
-
return null;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// APC sequence: ESC _ ... BEL or ESC _ ... ST (ESC \)
|
|
285
|
-
// Used for cursor marker and application-specific commands
|
|
286
|
-
if (next === "_") {
|
|
287
|
-
let j = pos + 2;
|
|
288
|
-
while (j < str.length) {
|
|
289
|
-
if (str[j] === "\x07") return { code: str.substring(pos, j + 1), length: j + 1 - pos };
|
|
290
|
-
if (str[j] === "\x1b" && str[j + 1] === "\\") return { code: str.substring(pos, j + 2), length: j + 2 - pos };
|
|
291
|
-
j++;
|
|
292
|
-
}
|
|
293
|
-
return null;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
return null;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Track active ANSI SGR codes to preserve styling across line breaks.
|
|
301
|
-
*/
|
|
302
|
-
class AnsiCodeTracker {
|
|
303
|
-
// Track individual attributes separately so we can reset them specifically
|
|
304
|
-
private bold = false;
|
|
305
|
-
private dim = false;
|
|
306
|
-
private italic = false;
|
|
307
|
-
private underline = false;
|
|
308
|
-
private blink = false;
|
|
309
|
-
private inverse = false;
|
|
310
|
-
private hidden = false;
|
|
311
|
-
private strikethrough = false;
|
|
312
|
-
private fgColor: string | null = null; // Stores the full code like "31" or "38;5;240"
|
|
313
|
-
private bgColor: string | null = null; // Stores the full code like "41" or "48;5;240"
|
|
314
|
-
private activeHyperlink: string | null = null; // Active OSC 8 hyperlink URL, or null
|
|
315
|
-
|
|
316
|
-
process(ansiCode: string): void {
|
|
317
|
-
// OSC 8 hyperlink: \x1b]8;;<url>\x1b\\ (open) or \x1b]8;;\x1b\\ (close)
|
|
318
|
-
if (ansiCode.startsWith("\x1b]8;")) {
|
|
319
|
-
const m = ansiCode.match(/^\x1b\]8;[^;]*;([^\x1b\x07]*)/);
|
|
320
|
-
this.activeHyperlink = m?.[1] ? m[1] : null;
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (!ansiCode.endsWith("m")) {
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
// Extract the parameters between \x1b[ and m
|
|
329
|
-
const match = ansiCode.match(/\x1b\[([\d;]*)m/);
|
|
330
|
-
if (!match) return;
|
|
331
|
-
|
|
332
|
-
const params = match[1];
|
|
333
|
-
if (params === "" || params === "0") {
|
|
334
|
-
// Full reset
|
|
335
|
-
this.reset();
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Parse parameters (can be semicolon-separated)
|
|
340
|
-
const parts = params.split(";");
|
|
341
|
-
let i = 0;
|
|
342
|
-
while (i < parts.length) {
|
|
343
|
-
const code = Number.parseInt(parts[i], 10);
|
|
344
|
-
|
|
345
|
-
// Handle 256-color and RGB codes which consume multiple parameters
|
|
346
|
-
if (code === 38 || code === 48) {
|
|
347
|
-
// 38;5;N (256 color fg) or 38;2;R;G;B (RGB fg)
|
|
348
|
-
// 48;5;N (256 color bg) or 48;2;R;G;B (RGB bg)
|
|
349
|
-
if (parts[i + 1] === "5" && parts[i + 2] !== undefined) {
|
|
350
|
-
// 256 color: 38;5;N or 48;5;N
|
|
351
|
-
const colorCode = `${parts[i]};${parts[i + 1]};${parts[i + 2]}`;
|
|
352
|
-
if (code === 38) {
|
|
353
|
-
this.fgColor = colorCode;
|
|
354
|
-
} else {
|
|
355
|
-
this.bgColor = colorCode;
|
|
356
|
-
}
|
|
357
|
-
i += 3;
|
|
358
|
-
continue;
|
|
359
|
-
} else if (parts[i + 1] === "2" && parts[i + 4] !== undefined) {
|
|
360
|
-
// RGB color: 38;2;R;G;B or 48;2;R;G;B
|
|
361
|
-
const colorCode = `${parts[i]};${parts[i + 1]};${parts[i + 2]};${parts[i + 3]};${parts[i + 4]}`;
|
|
362
|
-
if (code === 38) {
|
|
363
|
-
this.fgColor = colorCode;
|
|
364
|
-
} else {
|
|
365
|
-
this.bgColor = colorCode;
|
|
366
|
-
}
|
|
367
|
-
i += 5;
|
|
368
|
-
continue;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// Standard SGR codes
|
|
373
|
-
switch (code) {
|
|
374
|
-
case 0:
|
|
375
|
-
this.reset();
|
|
376
|
-
break;
|
|
377
|
-
case 1:
|
|
378
|
-
this.bold = true;
|
|
379
|
-
break;
|
|
380
|
-
case 2:
|
|
381
|
-
this.dim = true;
|
|
382
|
-
break;
|
|
383
|
-
case 3:
|
|
384
|
-
this.italic = true;
|
|
385
|
-
break;
|
|
386
|
-
case 4:
|
|
387
|
-
this.underline = true;
|
|
388
|
-
break;
|
|
389
|
-
case 5:
|
|
390
|
-
this.blink = true;
|
|
391
|
-
break;
|
|
392
|
-
case 7:
|
|
393
|
-
this.inverse = true;
|
|
394
|
-
break;
|
|
395
|
-
case 8:
|
|
396
|
-
this.hidden = true;
|
|
397
|
-
break;
|
|
398
|
-
case 9:
|
|
399
|
-
this.strikethrough = true;
|
|
400
|
-
break;
|
|
401
|
-
case 21:
|
|
402
|
-
this.bold = false;
|
|
403
|
-
break; // Some terminals
|
|
404
|
-
case 22:
|
|
405
|
-
this.bold = false;
|
|
406
|
-
this.dim = false;
|
|
407
|
-
break;
|
|
408
|
-
case 23:
|
|
409
|
-
this.italic = false;
|
|
410
|
-
break;
|
|
411
|
-
case 24:
|
|
412
|
-
this.underline = false;
|
|
413
|
-
break;
|
|
414
|
-
case 25:
|
|
415
|
-
this.blink = false;
|
|
416
|
-
break;
|
|
417
|
-
case 27:
|
|
418
|
-
this.inverse = false;
|
|
419
|
-
break;
|
|
420
|
-
case 28:
|
|
421
|
-
this.hidden = false;
|
|
422
|
-
break;
|
|
423
|
-
case 29:
|
|
424
|
-
this.strikethrough = false;
|
|
425
|
-
break;
|
|
426
|
-
case 39:
|
|
427
|
-
this.fgColor = null;
|
|
428
|
-
break; // Default fg
|
|
429
|
-
case 49:
|
|
430
|
-
this.bgColor = null;
|
|
431
|
-
break; // Default bg
|
|
432
|
-
default:
|
|
433
|
-
// Standard foreground colors 30-37, 90-97
|
|
434
|
-
if ((code >= 30 && code <= 37) || (code >= 90 && code <= 97)) {
|
|
435
|
-
this.fgColor = String(code);
|
|
436
|
-
}
|
|
437
|
-
// Standard background colors 40-47, 100-107
|
|
438
|
-
else if ((code >= 40 && code <= 47) || (code >= 100 && code <= 107)) {
|
|
439
|
-
this.bgColor = String(code);
|
|
440
|
-
}
|
|
441
|
-
break;
|
|
442
|
-
}
|
|
443
|
-
i++;
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
private reset(): void {
|
|
448
|
-
this.bold = false;
|
|
449
|
-
this.dim = false;
|
|
450
|
-
this.italic = false;
|
|
451
|
-
this.underline = false;
|
|
452
|
-
this.blink = false;
|
|
453
|
-
this.inverse = false;
|
|
454
|
-
this.hidden = false;
|
|
455
|
-
this.strikethrough = false;
|
|
456
|
-
this.fgColor = null;
|
|
457
|
-
this.bgColor = null;
|
|
458
|
-
// SGR reset does not affect OSC 8 hyperlink state
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
/** Clear all state for reuse. */
|
|
462
|
-
clear(): void {
|
|
463
|
-
this.reset();
|
|
464
|
-
this.activeHyperlink = null;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
getActiveCodes(): string {
|
|
468
|
-
const codes: string[] = [];
|
|
469
|
-
if (this.bold) codes.push("1");
|
|
470
|
-
if (this.dim) codes.push("2");
|
|
471
|
-
if (this.italic) codes.push("3");
|
|
472
|
-
if (this.underline) codes.push("4");
|
|
473
|
-
if (this.blink) codes.push("5");
|
|
474
|
-
if (this.inverse) codes.push("7");
|
|
475
|
-
if (this.hidden) codes.push("8");
|
|
476
|
-
if (this.strikethrough) codes.push("9");
|
|
477
|
-
if (this.fgColor) codes.push(this.fgColor);
|
|
478
|
-
if (this.bgColor) codes.push(this.bgColor);
|
|
479
|
-
|
|
480
|
-
let result = codes.length > 0 ? `\x1b[${codes.join(";")}m` : "";
|
|
481
|
-
if (this.activeHyperlink) {
|
|
482
|
-
result += `\x1b]8;;${this.activeHyperlink}\x1b\\`;
|
|
483
|
-
}
|
|
484
|
-
return result;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
hasActiveCodes(): boolean {
|
|
488
|
-
return (
|
|
489
|
-
this.bold ||
|
|
490
|
-
this.dim ||
|
|
491
|
-
this.italic ||
|
|
492
|
-
this.underline ||
|
|
493
|
-
this.blink ||
|
|
494
|
-
this.inverse ||
|
|
495
|
-
this.hidden ||
|
|
496
|
-
this.strikethrough ||
|
|
497
|
-
this.fgColor !== null ||
|
|
498
|
-
this.bgColor !== null ||
|
|
499
|
-
this.activeHyperlink !== null
|
|
500
|
-
);
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
/**
|
|
504
|
-
* Get reset codes for attributes that need to be turned off at line end.
|
|
505
|
-
* Underline must be closed to prevent bleeding into padding.
|
|
506
|
-
* Active OSC 8 hyperlinks must be closed and re-opened on the next line.
|
|
507
|
-
* Returns empty string if no attributes need closing.
|
|
508
|
-
*/
|
|
509
|
-
getLineEndReset(): string {
|
|
510
|
-
let result = "";
|
|
511
|
-
if (this.underline) {
|
|
512
|
-
result += "\x1b[24m"; // Underline off only
|
|
513
|
-
}
|
|
514
|
-
if (this.activeHyperlink) {
|
|
515
|
-
result += "\x1b]8;;\x1b\\"; // Close hyperlink; re-opened at line start via getActiveCodes()
|
|
516
|
-
}
|
|
517
|
-
return result;
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
function updateTrackerFromText(text: string, tracker: AnsiCodeTracker): void {
|
|
522
|
-
let i = 0;
|
|
523
|
-
while (i < text.length) {
|
|
524
|
-
const ansiResult = extractAnsiCode(text, i);
|
|
525
|
-
if (ansiResult) {
|
|
526
|
-
tracker.process(ansiResult.code);
|
|
527
|
-
i += ansiResult.length;
|
|
528
|
-
} else {
|
|
529
|
-
i++;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* Split text into words while keeping ANSI codes attached.
|
|
536
|
-
*/
|
|
537
|
-
function splitIntoTokensWithAnsi(text: string): string[] {
|
|
538
|
-
const tokens: string[] = [];
|
|
539
|
-
let current = "";
|
|
540
|
-
let pendingAnsi = ""; // ANSI codes waiting to be attached to next visible content
|
|
541
|
-
let inWhitespace = false;
|
|
542
|
-
let i = 0;
|
|
543
|
-
|
|
544
|
-
while (i < text.length) {
|
|
545
|
-
const ansiResult = extractAnsiCode(text, i);
|
|
546
|
-
if (ansiResult) {
|
|
547
|
-
// Hold ANSI codes separately - they'll be attached to the next visible char
|
|
548
|
-
pendingAnsi += ansiResult.code;
|
|
549
|
-
i += ansiResult.length;
|
|
550
|
-
continue;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
const char = text[i];
|
|
554
|
-
const charIsSpace = char === " ";
|
|
555
|
-
|
|
556
|
-
if (charIsSpace !== inWhitespace && current) {
|
|
557
|
-
// Switching between whitespace and non-whitespace, push current token
|
|
558
|
-
tokens.push(current);
|
|
559
|
-
current = "";
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
// Attach any pending ANSI codes to this visible character
|
|
563
|
-
if (pendingAnsi) {
|
|
564
|
-
current += pendingAnsi;
|
|
565
|
-
pendingAnsi = "";
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
inWhitespace = charIsSpace;
|
|
569
|
-
current += char;
|
|
570
|
-
i++;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
// Handle any remaining pending ANSI codes (attach to last token)
|
|
574
|
-
if (pendingAnsi) {
|
|
575
|
-
current += pendingAnsi;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
if (current) {
|
|
579
|
-
tokens.push(current);
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
return tokens;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* Wrap text with ANSI codes preserved.
|
|
587
|
-
*
|
|
588
|
-
* ONLY does word wrapping - NO padding, NO background colors.
|
|
589
|
-
* Returns lines where each line is <= width visible chars.
|
|
590
|
-
* Active ANSI codes are preserved across line breaks.
|
|
591
|
-
*
|
|
592
|
-
* @param text - Text to wrap (may contain ANSI codes and newlines)
|
|
593
|
-
* @param width - Maximum visible width per line
|
|
594
|
-
* @returns Array of wrapped lines (NOT padded to width)
|
|
595
|
-
*/
|
|
596
|
-
export function wrapTextWithAnsi(text: string, width: number): string[] {
|
|
597
|
-
if (!text) {
|
|
598
|
-
return [""];
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
// Handle newlines by processing each line separately
|
|
602
|
-
// Track ANSI state across lines so styles carry over after literal newlines
|
|
603
|
-
const inputLines = text.split("\n");
|
|
604
|
-
const result: string[] = [];
|
|
605
|
-
const tracker = new AnsiCodeTracker();
|
|
606
|
-
|
|
607
|
-
for (const inputLine of inputLines) {
|
|
608
|
-
// Prepend active ANSI codes from previous lines (except for first line)
|
|
609
|
-
const prefix = result.length > 0 ? tracker.getActiveCodes() : "";
|
|
610
|
-
result.push(...wrapSingleLine(prefix + inputLine, width));
|
|
611
|
-
// Update tracker with codes from this line for next iteration
|
|
612
|
-
updateTrackerFromText(inputLine, tracker);
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
return result.length > 0 ? result : [""];
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
function wrapSingleLine(line: string, width: number): string[] {
|
|
619
|
-
if (!line) {
|
|
620
|
-
return [""];
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
const visibleLength = visibleWidth(line);
|
|
624
|
-
if (visibleLength <= width) {
|
|
625
|
-
return [line];
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
const wrapped: string[] = [];
|
|
629
|
-
const tracker = new AnsiCodeTracker();
|
|
630
|
-
const tokens = splitIntoTokensWithAnsi(line);
|
|
631
|
-
|
|
632
|
-
let currentLine = "";
|
|
633
|
-
let currentVisibleLength = 0;
|
|
634
|
-
|
|
635
|
-
for (const token of tokens) {
|
|
636
|
-
const tokenVisibleLength = visibleWidth(token);
|
|
637
|
-
const isWhitespace = token.trim() === "";
|
|
638
|
-
|
|
639
|
-
// Token itself is too long - break it character by character
|
|
640
|
-
if (tokenVisibleLength > width && !isWhitespace) {
|
|
641
|
-
if (currentLine) {
|
|
642
|
-
// Add specific reset for underline only (preserves background)
|
|
643
|
-
const lineEndReset = tracker.getLineEndReset();
|
|
644
|
-
if (lineEndReset) {
|
|
645
|
-
currentLine += lineEndReset;
|
|
646
|
-
}
|
|
647
|
-
wrapped.push(currentLine);
|
|
648
|
-
currentLine = "";
|
|
649
|
-
currentVisibleLength = 0;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
// Break long token - breakLongWord handles its own resets
|
|
653
|
-
const broken = breakLongWord(token, width, tracker);
|
|
654
|
-
wrapped.push(...broken.slice(0, -1));
|
|
655
|
-
currentLine = broken[broken.length - 1];
|
|
656
|
-
currentVisibleLength = visibleWidth(currentLine);
|
|
657
|
-
continue;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
// Check if adding this token would exceed width
|
|
661
|
-
const totalNeeded = currentVisibleLength + tokenVisibleLength;
|
|
662
|
-
|
|
663
|
-
if (totalNeeded > width && currentVisibleLength > 0) {
|
|
664
|
-
// Trim trailing whitespace, then add underline reset (not full reset, to preserve background)
|
|
665
|
-
let lineToWrap = currentLine.trimEnd();
|
|
666
|
-
const lineEndReset = tracker.getLineEndReset();
|
|
667
|
-
if (lineEndReset) {
|
|
668
|
-
lineToWrap += lineEndReset;
|
|
669
|
-
}
|
|
670
|
-
wrapped.push(lineToWrap);
|
|
671
|
-
if (isWhitespace) {
|
|
672
|
-
// Don't start new line with whitespace
|
|
673
|
-
currentLine = tracker.getActiveCodes();
|
|
674
|
-
currentVisibleLength = 0;
|
|
675
|
-
} else {
|
|
676
|
-
currentLine = tracker.getActiveCodes() + token;
|
|
677
|
-
currentVisibleLength = tokenVisibleLength;
|
|
678
|
-
}
|
|
679
|
-
} else {
|
|
680
|
-
// Add to current line
|
|
681
|
-
currentLine += token;
|
|
682
|
-
currentVisibleLength += tokenVisibleLength;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
updateTrackerFromText(token, tracker);
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
if (currentLine) {
|
|
689
|
-
// No reset at end of final line - let caller handle it
|
|
690
|
-
wrapped.push(currentLine);
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
// Trailing whitespace can cause lines to exceed the requested width
|
|
694
|
-
return wrapped.length > 0 ? wrapped.map((line) => line.trimEnd()) : [""];
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
const PUNCTUATION_REGEX = /[(){}[\]<>.,;:'"!?+\-=*/\\|&%^$#@~`]/;
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* Check if a character is whitespace.
|
|
701
|
-
*/
|
|
702
|
-
export function isWhitespaceChar(char: string): boolean {
|
|
703
|
-
return /\s/.test(char);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* Check if a character is punctuation.
|
|
708
|
-
*/
|
|
709
|
-
export function isPunctuationChar(char: string): boolean {
|
|
710
|
-
return PUNCTUATION_REGEX.test(char);
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
function breakLongWord(word: string, width: number, tracker: AnsiCodeTracker): string[] {
|
|
714
|
-
const lines: string[] = [];
|
|
715
|
-
let currentLine = tracker.getActiveCodes();
|
|
716
|
-
let currentWidth = 0;
|
|
717
|
-
|
|
718
|
-
// First, separate ANSI codes from visible content
|
|
719
|
-
// We need to handle ANSI codes specially since they're not graphemes
|
|
720
|
-
let i = 0;
|
|
721
|
-
const segments: Array<{ type: "ansi" | "grapheme"; value: string }> = [];
|
|
722
|
-
|
|
723
|
-
while (i < word.length) {
|
|
724
|
-
const ansiResult = extractAnsiCode(word, i);
|
|
725
|
-
if (ansiResult) {
|
|
726
|
-
segments.push({ type: "ansi", value: ansiResult.code });
|
|
727
|
-
i += ansiResult.length;
|
|
728
|
-
} else {
|
|
729
|
-
// Find the next ANSI code or end of string
|
|
730
|
-
let end = i;
|
|
731
|
-
while (end < word.length) {
|
|
732
|
-
const nextAnsi = extractAnsiCode(word, end);
|
|
733
|
-
if (nextAnsi) break;
|
|
734
|
-
end++;
|
|
735
|
-
}
|
|
736
|
-
// Segment this non-ANSI portion into graphemes
|
|
737
|
-
const textPortion = word.slice(i, end);
|
|
738
|
-
for (const seg of segmenter.segment(textPortion)) {
|
|
739
|
-
segments.push({ type: "grapheme", value: seg.segment });
|
|
740
|
-
}
|
|
741
|
-
i = end;
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
// Now process segments
|
|
746
|
-
for (const seg of segments) {
|
|
747
|
-
if (seg.type === "ansi") {
|
|
748
|
-
currentLine += seg.value;
|
|
749
|
-
tracker.process(seg.value);
|
|
750
|
-
continue;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
const grapheme = seg.value;
|
|
754
|
-
// Skip empty graphemes to avoid issues with string-width calculation
|
|
755
|
-
if (!grapheme) continue;
|
|
756
|
-
|
|
757
|
-
const graphemeWidth = visibleWidth(grapheme);
|
|
758
|
-
|
|
759
|
-
if (currentWidth + graphemeWidth > width) {
|
|
760
|
-
// Add specific reset for underline only (preserves background)
|
|
761
|
-
const lineEndReset = tracker.getLineEndReset();
|
|
762
|
-
if (lineEndReset) {
|
|
763
|
-
currentLine += lineEndReset;
|
|
764
|
-
}
|
|
765
|
-
lines.push(currentLine);
|
|
766
|
-
currentLine = tracker.getActiveCodes();
|
|
767
|
-
currentWidth = 0;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
currentLine += grapheme;
|
|
771
|
-
currentWidth += graphemeWidth;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
if (currentLine) {
|
|
775
|
-
// No reset at end of final segment - caller handles continuation
|
|
776
|
-
lines.push(currentLine);
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
return lines.length > 0 ? lines : [""];
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
/**
|
|
783
|
-
* Apply background color to a line, padding to full width.
|
|
784
|
-
*
|
|
785
|
-
* @param line - Line of text (may contain ANSI codes)
|
|
786
|
-
* @param width - Total width to pad to
|
|
787
|
-
* @param bgFn - Background color function
|
|
788
|
-
* @returns Line with background applied and padded to width
|
|
789
|
-
*/
|
|
790
|
-
export function applyBackgroundToLine(line: string, width: number, bgFn: (text: string) => string): string {
|
|
791
|
-
// Calculate padding needed
|
|
792
|
-
const visibleLen = visibleWidth(line);
|
|
793
|
-
const paddingNeeded = Math.max(0, width - visibleLen);
|
|
794
|
-
const padding = " ".repeat(paddingNeeded);
|
|
795
|
-
|
|
796
|
-
// Apply background to content + padding
|
|
797
|
-
const withPadding = line + padding;
|
|
798
|
-
return bgFn(withPadding);
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
/**
|
|
802
|
-
* Truncate text to fit within a maximum visible width, adding ellipsis if needed.
|
|
803
|
-
* Optionally pad with spaces to reach exactly maxWidth.
|
|
804
|
-
* Properly handles ANSI escape codes (they don't count toward width).
|
|
805
|
-
*
|
|
806
|
-
* @param text - Text to truncate (may contain ANSI codes)
|
|
807
|
-
* @param maxWidth - Maximum visible width
|
|
808
|
-
* @param ellipsis - Ellipsis string to append when truncating (default: "...")
|
|
809
|
-
* @param pad - If true, pad result with spaces to exactly maxWidth (default: false)
|
|
810
|
-
* @returns Truncated text, optionally padded to exactly maxWidth
|
|
811
|
-
*/
|
|
812
|
-
export function truncateToWidth(
|
|
813
|
-
text: string,
|
|
814
|
-
maxWidth: number,
|
|
815
|
-
ellipsis: string = "...",
|
|
816
|
-
pad: boolean = false,
|
|
817
|
-
): string {
|
|
818
|
-
if (maxWidth <= 0) {
|
|
819
|
-
return "";
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
if (text.length === 0) {
|
|
823
|
-
return pad ? " ".repeat(maxWidth) : "";
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
const ellipsisWidth = visibleWidth(ellipsis);
|
|
827
|
-
if (ellipsisWidth >= maxWidth) {
|
|
828
|
-
const textWidth = visibleWidth(text);
|
|
829
|
-
if (textWidth <= maxWidth) {
|
|
830
|
-
return pad ? text + " ".repeat(maxWidth - textWidth) : text;
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
const clippedEllipsis = truncateFragmentToWidth(ellipsis, maxWidth);
|
|
834
|
-
if (clippedEllipsis.width === 0) {
|
|
835
|
-
return pad ? " ".repeat(maxWidth) : "";
|
|
836
|
-
}
|
|
837
|
-
return finalizeTruncatedResult("", 0, clippedEllipsis.text, clippedEllipsis.width, maxWidth, pad);
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
if (isPrintableAscii(text)) {
|
|
841
|
-
if (text.length <= maxWidth) {
|
|
842
|
-
return pad ? text + " ".repeat(maxWidth - text.length) : text;
|
|
843
|
-
}
|
|
844
|
-
const targetWidth = maxWidth - ellipsisWidth;
|
|
845
|
-
return finalizeTruncatedResult(text.slice(0, targetWidth), targetWidth, ellipsis, ellipsisWidth, maxWidth, pad);
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
const targetWidth = maxWidth - ellipsisWidth;
|
|
849
|
-
let result = "";
|
|
850
|
-
let pendingAnsi = "";
|
|
851
|
-
let visibleSoFar = 0;
|
|
852
|
-
let keptWidth = 0;
|
|
853
|
-
let keepContiguousPrefix = true;
|
|
854
|
-
let overflowed = false;
|
|
855
|
-
let exhaustedInput = false;
|
|
856
|
-
const hasAnsi = text.includes("\x1b");
|
|
857
|
-
const hasTabs = text.includes("\t");
|
|
858
|
-
|
|
859
|
-
if (!hasAnsi && !hasTabs) {
|
|
860
|
-
for (const { segment } of segmenter.segment(text)) {
|
|
861
|
-
const width = graphemeWidth(segment);
|
|
862
|
-
if (keepContiguousPrefix && keptWidth + width <= targetWidth) {
|
|
863
|
-
result += segment;
|
|
864
|
-
keptWidth += width;
|
|
865
|
-
} else {
|
|
866
|
-
keepContiguousPrefix = false;
|
|
867
|
-
}
|
|
868
|
-
visibleSoFar += width;
|
|
869
|
-
if (visibleSoFar > maxWidth) {
|
|
870
|
-
overflowed = true;
|
|
871
|
-
break;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
exhaustedInput = !overflowed;
|
|
875
|
-
} else {
|
|
876
|
-
let i = 0;
|
|
877
|
-
while (i < text.length) {
|
|
878
|
-
const ansi = extractAnsiCode(text, i);
|
|
879
|
-
if (ansi) {
|
|
880
|
-
pendingAnsi += ansi.code;
|
|
881
|
-
i += ansi.length;
|
|
882
|
-
continue;
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
if (text[i] === "\t") {
|
|
886
|
-
if (keepContiguousPrefix && keptWidth + 3 <= targetWidth) {
|
|
887
|
-
if (pendingAnsi) {
|
|
888
|
-
result += pendingAnsi;
|
|
889
|
-
pendingAnsi = "";
|
|
890
|
-
}
|
|
891
|
-
result += "\t";
|
|
892
|
-
keptWidth += 3;
|
|
893
|
-
} else {
|
|
894
|
-
keepContiguousPrefix = false;
|
|
895
|
-
pendingAnsi = "";
|
|
896
|
-
}
|
|
897
|
-
visibleSoFar += 3;
|
|
898
|
-
if (visibleSoFar > maxWidth) {
|
|
899
|
-
overflowed = true;
|
|
900
|
-
break;
|
|
901
|
-
}
|
|
902
|
-
i++;
|
|
903
|
-
continue;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
let end = i;
|
|
907
|
-
while (end < text.length && text[end] !== "\t") {
|
|
908
|
-
const nextAnsi = extractAnsiCode(text, end);
|
|
909
|
-
if (nextAnsi) {
|
|
910
|
-
break;
|
|
911
|
-
}
|
|
912
|
-
end++;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
for (const { segment } of segmenter.segment(text.slice(i, end))) {
|
|
916
|
-
const width = graphemeWidth(segment);
|
|
917
|
-
if (keepContiguousPrefix && keptWidth + width <= targetWidth) {
|
|
918
|
-
if (pendingAnsi) {
|
|
919
|
-
result += pendingAnsi;
|
|
920
|
-
pendingAnsi = "";
|
|
921
|
-
}
|
|
922
|
-
result += segment;
|
|
923
|
-
keptWidth += width;
|
|
924
|
-
} else {
|
|
925
|
-
keepContiguousPrefix = false;
|
|
926
|
-
pendingAnsi = "";
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
visibleSoFar += width;
|
|
930
|
-
if (visibleSoFar > maxWidth) {
|
|
931
|
-
overflowed = true;
|
|
932
|
-
break;
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
if (overflowed) {
|
|
936
|
-
break;
|
|
937
|
-
}
|
|
938
|
-
i = end;
|
|
939
|
-
}
|
|
940
|
-
exhaustedInput = i >= text.length;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
if (!overflowed && exhaustedInput) {
|
|
944
|
-
return pad ? text + " ".repeat(Math.max(0, maxWidth - visibleSoFar)) : text;
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
return finalizeTruncatedResult(result, keptWidth, ellipsis, ellipsisWidth, maxWidth, pad);
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
/**
|
|
951
|
-
* Extract a range of visible columns from a line. Handles ANSI codes and wide chars.
|
|
952
|
-
* @param strict - If true, exclude wide chars at boundary that would extend past the range
|
|
953
|
-
*/
|
|
954
|
-
export function sliceByColumn(line: string, startCol: number, length: number, strict = false): string {
|
|
955
|
-
return sliceWithWidth(line, startCol, length, strict).text;
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
/** Like sliceByColumn but also returns the actual visible width of the result. */
|
|
959
|
-
export function sliceWithWidth(
|
|
960
|
-
line: string,
|
|
961
|
-
startCol: number,
|
|
962
|
-
length: number,
|
|
963
|
-
strict = false,
|
|
964
|
-
): { text: string; width: number } {
|
|
965
|
-
if (length <= 0) return { text: "", width: 0 };
|
|
966
|
-
const endCol = startCol + length;
|
|
967
|
-
let result = "",
|
|
968
|
-
resultWidth = 0,
|
|
969
|
-
currentCol = 0,
|
|
970
|
-
i = 0,
|
|
971
|
-
pendingAnsi = "";
|
|
972
|
-
|
|
973
|
-
while (i < line.length) {
|
|
974
|
-
const ansi = extractAnsiCode(line, i);
|
|
975
|
-
if (ansi) {
|
|
976
|
-
if (currentCol >= startCol && currentCol < endCol) result += ansi.code;
|
|
977
|
-
else if (currentCol < startCol) pendingAnsi += ansi.code;
|
|
978
|
-
i += ansi.length;
|
|
979
|
-
continue;
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
let textEnd = i;
|
|
983
|
-
while (textEnd < line.length && !extractAnsiCode(line, textEnd)) textEnd++;
|
|
984
|
-
|
|
985
|
-
for (const { segment } of segmenter.segment(line.slice(i, textEnd))) {
|
|
986
|
-
const w = graphemeWidth(segment);
|
|
987
|
-
const inRange = currentCol >= startCol && currentCol < endCol;
|
|
988
|
-
const fits = !strict || currentCol + w <= endCol;
|
|
989
|
-
if (inRange && fits) {
|
|
990
|
-
if (pendingAnsi) {
|
|
991
|
-
result += pendingAnsi;
|
|
992
|
-
pendingAnsi = "";
|
|
993
|
-
}
|
|
994
|
-
result += segment;
|
|
995
|
-
resultWidth += w;
|
|
996
|
-
}
|
|
997
|
-
currentCol += w;
|
|
998
|
-
if (currentCol >= endCol) break;
|
|
999
|
-
}
|
|
1000
|
-
i = textEnd;
|
|
1001
|
-
if (currentCol >= endCol) break;
|
|
1002
|
-
}
|
|
1003
|
-
return { text: result, width: resultWidth };
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
// Pooled tracker instance for extractSegments (avoids allocation per call)
|
|
1007
|
-
const pooledStyleTracker = new AnsiCodeTracker();
|
|
1008
|
-
|
|
1009
|
-
/**
|
|
1010
|
-
* Extract "before" and "after" segments from a line in a single pass.
|
|
1011
|
-
* Used for overlay compositing where we need content before and after the overlay region.
|
|
1012
|
-
* Preserves styling from before the overlay that should affect content after it.
|
|
1013
|
-
*/
|
|
1014
|
-
export function extractSegments(
|
|
1015
|
-
line: string,
|
|
1016
|
-
beforeEnd: number,
|
|
1017
|
-
afterStart: number,
|
|
1018
|
-
afterLen: number,
|
|
1019
|
-
strictAfter = false,
|
|
1020
|
-
): { before: string; beforeWidth: number; after: string; afterWidth: number } {
|
|
1021
|
-
let before = "",
|
|
1022
|
-
beforeWidth = 0,
|
|
1023
|
-
after = "",
|
|
1024
|
-
afterWidth = 0;
|
|
1025
|
-
let currentCol = 0,
|
|
1026
|
-
i = 0;
|
|
1027
|
-
let pendingAnsiBefore = "";
|
|
1028
|
-
let afterStarted = false;
|
|
1029
|
-
const afterEnd = afterStart + afterLen;
|
|
1030
|
-
|
|
1031
|
-
// Track styling state so "after" inherits styling from before the overlay
|
|
1032
|
-
pooledStyleTracker.clear();
|
|
1033
|
-
|
|
1034
|
-
while (i < line.length) {
|
|
1035
|
-
const ansi = extractAnsiCode(line, i);
|
|
1036
|
-
if (ansi) {
|
|
1037
|
-
// Track all SGR codes to know styling state at afterStart
|
|
1038
|
-
pooledStyleTracker.process(ansi.code);
|
|
1039
|
-
// Include ANSI codes in their respective segments
|
|
1040
|
-
if (currentCol < beforeEnd) {
|
|
1041
|
-
pendingAnsiBefore += ansi.code;
|
|
1042
|
-
} else if (currentCol >= afterStart && currentCol < afterEnd && afterStarted) {
|
|
1043
|
-
// Only include after we've started "after" (styling already prepended)
|
|
1044
|
-
after += ansi.code;
|
|
1045
|
-
}
|
|
1046
|
-
i += ansi.length;
|
|
1047
|
-
continue;
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
let textEnd = i;
|
|
1051
|
-
while (textEnd < line.length && !extractAnsiCode(line, textEnd)) textEnd++;
|
|
1052
|
-
|
|
1053
|
-
for (const { segment } of segmenter.segment(line.slice(i, textEnd))) {
|
|
1054
|
-
const w = graphemeWidth(segment);
|
|
1055
|
-
|
|
1056
|
-
if (currentCol < beforeEnd) {
|
|
1057
|
-
if (pendingAnsiBefore) {
|
|
1058
|
-
before += pendingAnsiBefore;
|
|
1059
|
-
pendingAnsiBefore = "";
|
|
1060
|
-
}
|
|
1061
|
-
before += segment;
|
|
1062
|
-
beforeWidth += w;
|
|
1063
|
-
} else if (currentCol >= afterStart && currentCol < afterEnd) {
|
|
1064
|
-
const fits = !strictAfter || currentCol + w <= afterEnd;
|
|
1065
|
-
if (fits) {
|
|
1066
|
-
// On first "after" grapheme, prepend inherited styling from before overlay
|
|
1067
|
-
if (!afterStarted) {
|
|
1068
|
-
after += pooledStyleTracker.getActiveCodes();
|
|
1069
|
-
afterStarted = true;
|
|
1070
|
-
}
|
|
1071
|
-
after += segment;
|
|
1072
|
-
afterWidth += w;
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
currentCol += w;
|
|
1077
|
-
// Early exit: done with "before" only, or done with both segments
|
|
1078
|
-
if (afterLen <= 0 ? currentCol >= beforeEnd : currentCol >= afterEnd) break;
|
|
1079
|
-
}
|
|
1080
|
-
i = textEnd;
|
|
1081
|
-
if (afterLen <= 0 ? currentCol >= beforeEnd : currentCol >= afterEnd) break;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
return { before, beforeWidth, after, afterWidth };
|
|
1085
|
-
}
|