@code-yeongyu/senpi 2026.9.15 → 2026.9.16-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -0
- package/README.md +1 -1
- package/dist/core/agent-session.d.ts +28 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +111 -13
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +4 -2
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/stream-watchdog.d.ts +56 -2
- package/dist/core/compaction/stream-watchdog.d.ts.map +1 -1
- package/dist/core/compaction/stream-watchdog.js +93 -15
- package/dist/core/compaction/stream-watchdog.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts +6 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js +17 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts +4 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js +31 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts +2 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js +16 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js +19 -8
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js +2 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts +13 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js +66 -2
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.js +16 -10
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative-summary.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative-summary.js +4 -2
- package/dist/core/extensions/builtin/compaction/speculative-summary.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.d.ts +8 -1
- package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js +31 -7
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/transient-failure.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/transient-failure.js +6 -3
- package/dist/core/extensions/builtin/compaction/transient-failure.js.map +1 -1
- package/dist/core/extensions/builtin/config-reload/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/config-reload/index.js +25 -8
- package/dist/core/extensions/builtin/config-reload/index.js.map +1 -1
- package/dist/core/extensions/builtin/config-reload/watch-engine.d.ts +4 -5
- package/dist/core/extensions/builtin/config-reload/watch-engine.d.ts.map +1 -1
- package/dist/core/extensions/builtin/config-reload/watch-engine.js +14 -18
- package/dist/core/extensions/builtin/config-reload/watch-engine.js.map +1 -1
- package/dist/core/extensions/builtin/config-reload/watch-event-source.d.ts.map +1 -1
- package/dist/core/extensions/builtin/config-reload/watch-event-source.js +32 -9
- package/dist/core/extensions/builtin/config-reload/watch-event-source.js.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/catalog-refresh.d.ts +23 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/catalog-refresh.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/catalog-refresh.js +48 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/catalog-refresh.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/environment.d.ts +13 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/environment.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/environment.js +24 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/environment.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/executable.d.ts +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/executable.d.ts.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/executable.js +7 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/executable.js.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/index.d.ts +2 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/index.js +11 -9
- package/dist/core/extensions/builtin/cursor-cli-oauth/index.js.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/models-probe.d.ts +18 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/models-probe.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/models-probe.js +61 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/models-probe.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.d.ts +4 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.d.ts.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.js +1 -44
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.js.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/oauth-login.d.ts +22 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/oauth-login.d.ts.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/oauth-login.js +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/oauth-login.js.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/transport.d.ts.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/transport.js +2 -13
- package/dist/core/extensions/builtin/cursor-cli-oauth/transport.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-file-digest.d.ts +3 -0
- package/dist/core/extensions/builtin/terminal/monitor-file-digest.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-file-digest.js +25 -0
- package/dist/core/extensions/builtin/terminal/monitor-file-digest.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-file-watch.d.ts +9 -0
- package/dist/core/extensions/builtin/terminal/monitor-file-watch.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-file-watch.js +33 -0
- package/dist/core/extensions/builtin/terminal/monitor-file-watch.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-line-buffer.d.ts +6 -0
- package/dist/core/extensions/builtin/terminal/monitor-line-buffer.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-line-buffer.js +22 -0
- package/dist/core/extensions/builtin/terminal/monitor-line-buffer.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-registry.js +14 -35
- package/dist/core/extensions/builtin/terminal/monitor-registry.js.map +1 -1
- package/dist/core/extensions/kernel-tools-context.d.ts +13 -0
- package/dist/core/extensions/kernel-tools-context.d.ts.map +1 -0
- package/dist/core/extensions/kernel-tools-context.js +3 -0
- package/dist/core/extensions/kernel-tools-context.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +19 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +103 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +21 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/keybindings.d.ts +5 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +1 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +9 -17
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/retry-fallback/settings.d.ts +3 -0
- package/dist/core/retry-fallback/settings.d.ts.map +1 -1
- package/dist/core/retry-fallback/settings.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +1 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +30 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +92 -5
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-resident-store.d.ts +33 -7
- package/dist/core/session-resident-store.d.ts.map +1 -1
- package/dist/core/session-resident-store.js +163 -14
- package/dist/core/session-resident-store.js.map +1 -1
- package/dist/core/session-write-reservation.d.ts +6 -0
- package/dist/core/session-write-reservation.d.ts.map +1 -1
- package/dist/core/session-write-reservation.js +19 -0
- package/dist/core/session-write-reservation.js.map +1 -1
- package/dist/core/settings-manager.d.ts +35 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +62 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +2 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/index.d.ts +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +4 -3
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/read.d.ts +3 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +16 -2
- package/dist/core/tools/read.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/assistant-render-descriptors.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-render-descriptors.js +12 -5
- package/dist/modes/interactive/components/assistant-render-descriptors.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +2 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +5 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +19 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +69 -17
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/tips/catalog/session-tips.js +1 -1
- package/dist/modes/interactive/tips/catalog/session-tips.js.map +1 -1
- package/dist/modes/interactive/working-status.d.ts +3 -2
- package/dist/modes/interactive/working-status.d.ts.map +1 -1
- package/dist/modes/interactive/working-status.js +17 -4
- package/dist/modes/interactive/working-status.js.map +1 -1
- package/dist/modes/print-mode.d.ts +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +5 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/host-watchdog.d.ts.map +1 -1
- package/dist/modes/rpc/host-watchdog.js +5 -24
- package/dist/modes/rpc/host-watchdog.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +3 -8
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
- package/dist/modes/rpc/session-command-router.js +3 -0
- package/dist/modes/rpc/session-command-router.js.map +1 -1
- package/dist/modes/rpc/session-worker-client.d.ts +3 -0
- package/dist/modes/rpc/session-worker-client.d.ts.map +1 -1
- package/dist/modes/rpc/session-worker-client.js +17 -6
- package/dist/modes/rpc/session-worker-client.js.map +1 -1
- package/dist/modes/rpc/shutdown.d.ts +3 -0
- package/dist/modes/rpc/shutdown.d.ts.map +1 -0
- package/dist/modes/rpc/shutdown.js +17 -0
- package/dist/modes/rpc/shutdown.js.map +1 -0
- package/docs/extensions.md +5 -2
- package/docs/keybindings.md +1 -0
- package/docs/session-format.md +1 -1
- package/docs/sessions.md +3 -3
- package/docs/settings.md +31 -1
- package/docs/usage.md +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +50 -0
- package/node_modules/@code-yeongyu/senpi-codemode/README.md +24 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridge/http-server.ts +7 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridge/kernel-tools-protocol.ts +85 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridge/protocol.ts +6 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridges/agent-bridge.ts +30 -11
- package/node_modules/@code-yeongyu/senpi-codemode/src/extension/session-manager.ts +11 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +10 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/jl/prelude.jl +46 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/jl/runner.jl +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/context-manager.ts +58 -10
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-contract.ts +12 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-context.d.ts +13 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-context.js +7 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-define.d.ts +10 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-define.js +12 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-errors.js +22 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-errors.ts +26 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-host.ts +134 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-naming.js +28 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-parse.d.ts +5 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-parse.js +255 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-pump.js +105 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-registry.d.ts +27 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-registry.js +127 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-schema.js +69 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-tools-types.ts +42 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/prelude.ts +2 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-core.js +26 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-runtime.js +20 -8
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-slot.ts +6 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-startup.ts +9 -7
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/workpool.js +37 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/kernel-tools-unavailable.ts +5 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/kernel.ts +13 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/prelude.py +57 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/rb/prelude.rb +13 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/rb/workpool.rb +38 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-kernel.ts +13 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-queue.ts +9 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt-template.ts +4 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-handler.ts +31 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-manager.ts +36 -71
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/image-resize.ts +52 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/image.ts +37 -72
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/managed-cell.ts +78 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +30 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/run-eval-cell.ts +52 -30
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/terminal-snapshot-store.ts +35 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/tool-result-marshal.ts +23 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +30 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +5 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/empty-assistant-recovery.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/empty-assistant-recovery.js +51 -12
- package/node_modules/@earendil-works/pi-agent-core/dist/empty-assistant-recovery.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts +3 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js +18 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/brace-scanner.d.ts +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/brace-scanner.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/brace-scanner.js +268 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/brace-scanner.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/header-protection.d.ts +18 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/header-protection.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/header-protection.js +69 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/header-protection.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/index.d.ts +27 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/index.js +118 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/lexical-context.d.ts +21 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/lexical-context.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/lexical-context.js +24 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/lexical-context.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/lexical-spans.d.ts +12 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/lexical-spans.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/lexical-spans.js +92 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/lexical-spans.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/types.d.ts +47 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/types.js +8 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/types.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/segmented-read-view.d.ts +52 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/segmented-read-view.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/segmented-read-view.js +155 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/segmented-read-view.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js +3 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/stream-throughput-watchdog.d.ts +101 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/stream-throughput-watchdog.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/stream-throughput-watchdog.js +178 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/stream-throughput-watchdog.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +9 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/alibaba-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/empty-response-errors.d.ts +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/empty-response-errors.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/empty-response-errors.js +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/empty-response-errors.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +24 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +92 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const expressionKeywords = new Set([
|
|
2
|
+
"return",
|
|
3
|
+
"throw",
|
|
4
|
+
"yield",
|
|
5
|
+
"await",
|
|
6
|
+
"case",
|
|
7
|
+
"typeof",
|
|
8
|
+
"void",
|
|
9
|
+
"delete",
|
|
10
|
+
"in",
|
|
11
|
+
"of",
|
|
12
|
+
"instanceof",
|
|
13
|
+
]);
|
|
14
|
+
export const controls = new Set(["if", "while", "for", "switch", "catch", "with"]);
|
|
15
|
+
export const signatureDeclarations = new Set(["type", "interface", "enum", "namespace", "module", "declare"]);
|
|
16
|
+
/** Only expression callees release argument values; declarations retain parameter protection. */
|
|
17
|
+
export function isCallCallee(previous, beforeWord) {
|
|
18
|
+
return (/^[A-Za-z_$][\w$]*$/.test(previous) &&
|
|
19
|
+
!["function", "async", "new"].includes(previous) &&
|
|
20
|
+
!expressionKeywords.has(previous) &&
|
|
21
|
+
!controls.has(previous) &&
|
|
22
|
+
[".", "=", ":", "return", "await", "new"].includes(beforeWord));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=lexical-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lexical-context.js","sourceRoot":"","sources":["../../../../src/harness/utils/read-folders/lexical-context.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACzC,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,YAAY;CACZ,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACnF,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAE9G,iGAAiG;AACjG,MAAM,UAAU,YAAY,CAAC,QAAgB,EAAE,UAAkB;IAChE,OAAO,CACN,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC;QACnC,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAChD,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC;QACjC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;QACvB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAC9D,CAAC;AACH,CAAC","sourcesContent":["export type Open = {\n\treadonly char: \"{\" | \"[\" | \"(\";\n\treadonly line: number;\n\treadonly headerLine?: number;\n\t/** Opened where a value may start, so it can still turn out to be an assignment target. */\n\treadonly target?: boolean;\n\treadonly foldable: boolean;\n\treadonly protected: boolean;\n\treadonly signature: boolean;\n\treadonly interpolation: boolean;\n\treadonly control: boolean;\n\treadonly call: boolean;\n\treadonly valueParameters: boolean;\n\treadonly declaration: boolean;\n};\n\nexport const expressionKeywords = new Set([\n\t\"return\",\n\t\"throw\",\n\t\"yield\",\n\t\"await\",\n\t\"case\",\n\t\"typeof\",\n\t\"void\",\n\t\"delete\",\n\t\"in\",\n\t\"of\",\n\t\"instanceof\",\n]);\nexport const controls = new Set([\"if\", \"while\", \"for\", \"switch\", \"catch\", \"with\"]);\nexport const signatureDeclarations = new Set([\"type\", \"interface\", \"enum\", \"namespace\", \"module\", \"declare\"]);\n\n/** Only expression callees release argument values; declarations retain parameter protection. */\nexport function isCallCallee(previous: string, beforeWord: string): boolean {\n\treturn (\n\t\t/^[A-Za-z_$][\\w$]*$/.test(previous) &&\n\t\t![\"function\", \"async\", \"new\"].includes(previous) &&\n\t\t!expressionKeywords.has(previous) &&\n\t\t!controls.has(previous) &&\n\t\t[\".\", \"=\", \":\", \"return\", \"await\", \"new\"].includes(beforeWord)\n\t);\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type Span = {
|
|
2
|
+
readonly end: number;
|
|
3
|
+
readonly newlines: number;
|
|
4
|
+
};
|
|
5
|
+
export declare function stringSpan(source: string, start: number, delimiter: string): Span | undefined;
|
|
6
|
+
/** Skip only brace-free type arguments; constraints/object types still take the protected/raw path. */
|
|
7
|
+
export declare function typeArgumentsSpan(source: string, start: number): Span | undefined;
|
|
8
|
+
export declare function lineCommentEnd(source: string, start: number): number;
|
|
9
|
+
export declare function commentSpan(source: string, start: number): Span | undefined;
|
|
10
|
+
export declare function regexSpan(source: string, start: number): Span | undefined;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=lexical-spans.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lexical-spans.d.ts","sourceRoot":"","sources":["../../../../src/harness/utils/read-folders/lexical-spans.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAIhE,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAY7F;AAED,uGAAuG;AACvG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAkBjF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIpE;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAO3E;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAsBzE"}
|
package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/lexical-spans.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Selected TS/JS/JSON branches of row 17's measured literal scanner.
|
|
2
|
+
// Offsets are UTF-16 indices; output coordinates always describe whole source lines.
|
|
3
|
+
export function stringSpan(source, start, delimiter) {
|
|
4
|
+
let newlines = 0;
|
|
5
|
+
for (let i = start; i < source.length; i++) {
|
|
6
|
+
if (source[i] === delimiter)
|
|
7
|
+
return { end: i + 1, newlines };
|
|
8
|
+
if (source[i] === "\n" || source[i] === "\r")
|
|
9
|
+
return undefined;
|
|
10
|
+
if (source[i] === "\\") {
|
|
11
|
+
if (source[i + 1] === "\r" && source[i + 2] === "\n")
|
|
12
|
+
i++;
|
|
13
|
+
if (source[i + 1] === "\n")
|
|
14
|
+
newlines++;
|
|
15
|
+
i++;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
/** Skip only brace-free type arguments; constraints/object types still take the protected/raw path. */
|
|
21
|
+
export function typeArgumentsSpan(source, start) {
|
|
22
|
+
const delimiters = ["<"];
|
|
23
|
+
let newlines = 0;
|
|
24
|
+
for (let i = start; i < source.length; i++) {
|
|
25
|
+
const char = source[i];
|
|
26
|
+
if (char === "\n")
|
|
27
|
+
newlines++;
|
|
28
|
+
if (char === '"' || char === "'") {
|
|
29
|
+
const span = stringSpan(source, i + 1, char);
|
|
30
|
+
if (!span)
|
|
31
|
+
return undefined;
|
|
32
|
+
newlines += span.newlines;
|
|
33
|
+
i = span.end - 1;
|
|
34
|
+
}
|
|
35
|
+
else if (char === "<" || char === "[")
|
|
36
|
+
delimiters.push(char);
|
|
37
|
+
else if (char === ">" || char === "]") {
|
|
38
|
+
if (delimiters.pop() !== (char === ">" ? "<" : "["))
|
|
39
|
+
return undefined;
|
|
40
|
+
if (!delimiters.length)
|
|
41
|
+
return { end: i + 1, newlines };
|
|
42
|
+
}
|
|
43
|
+
else if (!/[A-Za-z_$0-9\s,.?|&]/.test(char))
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
export function lineCommentEnd(source, start) {
|
|
49
|
+
let end = start;
|
|
50
|
+
while (end < source.length && !/[\n\r\u2028\u2029]/.test(source[end]))
|
|
51
|
+
end++;
|
|
52
|
+
return end;
|
|
53
|
+
}
|
|
54
|
+
export function commentSpan(source, start) {
|
|
55
|
+
let newlines = 0;
|
|
56
|
+
for (let i = start; i < source.length; i++) {
|
|
57
|
+
if (source[i] === "\n")
|
|
58
|
+
newlines++;
|
|
59
|
+
if (source.startsWith("*/", i))
|
|
60
|
+
return { end: i + 2, newlines };
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
export function regexSpan(source, start) {
|
|
65
|
+
let characterClass = false;
|
|
66
|
+
for (let i = start; i < source.length; i++) {
|
|
67
|
+
if (source[i] === "\n" || source[i] === "\r" || source[i] === "\u2028" || source[i] === "\u2029")
|
|
68
|
+
return undefined;
|
|
69
|
+
if (source[i] === "\\") {
|
|
70
|
+
if (/[\r\n\u2028\u2029]/.test(source[i + 1] ?? ""))
|
|
71
|
+
return undefined;
|
|
72
|
+
i++;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (source[i] === "[")
|
|
76
|
+
characterClass = true;
|
|
77
|
+
if (source[i] === "]")
|
|
78
|
+
characterClass = false;
|
|
79
|
+
if (source[i] === "/" && !characterClass) {
|
|
80
|
+
let end = i + 1;
|
|
81
|
+
while (/[a-z]/i.test(source[end] ?? ""))
|
|
82
|
+
end++;
|
|
83
|
+
const flags = source.slice(i + 1, end);
|
|
84
|
+
// Unicode-set regexes need a different nested-class grammar; do not guess.
|
|
85
|
+
if (/[^dgimsuy]/.test(flags) || new Set(flags).size !== flags.length)
|
|
86
|
+
return undefined;
|
|
87
|
+
return { end, newlines: 0 };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=lexical-spans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lexical-spans.js","sourceRoot":"","sources":["../../../../src/harness/utils/read-folders/lexical-spans.ts"],"names":[],"mappings":"AAEA,qEAAqE;AACrE,qFAAqF;AACrF,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,KAAa,EAAE,SAAiB;IAC1E,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,SAAS;YAAE,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC;QAC7D,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,OAAO,SAAS,CAAC;QAC/D,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACxB,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI;gBAAE,CAAC,EAAE,CAAC;YAC1D,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI;gBAAE,QAAQ,EAAE,CAAC;YACvC,CAAC,EAAE,CAAC;QACL,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,iBAAiB,CAAC,MAA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C;YACrE,CAAC,EAAE,CAAC;YACJ,SAAS;QACV,CAAC;QACD,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG;YAAE,cAAc,GAAG,IAAI,CAAC;QAC7C,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG;YAAE,cAAc,GAAG,KAAK,CAAC;QAC9C,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1C,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YAChB,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;gBAAE,GAAG,EAAE,CAAC;YAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;YACvC,2EAA2E;YAC3E,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM;gBAAE,OAAO,SAAS,CAAC;YACvF,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;QAC7B,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["type Span = { readonly end: number; readonly newlines: number };\n\n// Selected TS/JS/JSON branches of row 17's measured literal scanner.\n// Offsets are UTF-16 indices; output coordinates always describe whole source lines.\nexport function stringSpan(source: string, start: number, delimiter: string): Span | undefined {\n\tlet newlines = 0;\n\tfor (let i = start; i < source.length; i++) {\n\t\tif (source[i] === delimiter) return { end: i + 1, newlines };\n\t\tif (source[i] === \"\\n\" || source[i] === \"\\r\") return undefined;\n\t\tif (source[i] === \"\\\\\") {\n\t\t\tif (source[i + 1] === \"\\r\" && source[i + 2] === \"\\n\") i++;\n\t\t\tif (source[i + 1] === \"\\n\") newlines++;\n\t\t\ti++;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/** Skip only brace-free type arguments; constraints/object types still take the protected/raw path. */\nexport function typeArgumentsSpan(source: string, start: number): Span | undefined {\n\tconst delimiters = [\"<\"];\n\tlet newlines = 0;\n\tfor (let i = start; i < source.length; i++) {\n\t\tconst char = source[i];\n\t\tif (char === \"\\n\") newlines++;\n\t\tif (char === '\"' || char === \"'\") {\n\t\t\tconst span = stringSpan(source, i + 1, char);\n\t\t\tif (!span) return undefined;\n\t\t\tnewlines += span.newlines;\n\t\t\ti = span.end - 1;\n\t\t} else if (char === \"<\" || char === \"[\") delimiters.push(char);\n\t\telse if (char === \">\" || char === \"]\") {\n\t\t\tif (delimiters.pop() !== (char === \">\" ? \"<\" : \"[\")) return undefined;\n\t\t\tif (!delimiters.length) return { end: i + 1, newlines };\n\t\t} else if (!/[A-Za-z_$0-9\\s,.?|&]/.test(char)) return undefined;\n\t}\n\treturn undefined;\n}\n\nexport function lineCommentEnd(source: string, start: number): number {\n\tlet end = start;\n\twhile (end < source.length && !/[\\n\\r\\u2028\\u2029]/.test(source[end])) end++;\n\treturn end;\n}\n\nexport function commentSpan(source: string, start: number): Span | undefined {\n\tlet newlines = 0;\n\tfor (let i = start; i < source.length; i++) {\n\t\tif (source[i] === \"\\n\") newlines++;\n\t\tif (source.startsWith(\"*/\", i)) return { end: i + 2, newlines };\n\t}\n\treturn undefined;\n}\n\nexport function regexSpan(source: string, start: number): Span | undefined {\n\tlet characterClass = false;\n\tfor (let i = start; i < source.length; i++) {\n\t\tif (source[i] === \"\\n\" || source[i] === \"\\r\" || source[i] === \"\\u2028\" || source[i] === \"\\u2029\")\n\t\t\treturn undefined;\n\t\tif (source[i] === \"\\\\\") {\n\t\t\tif (/[\\r\\n\\u2028\\u2029]/.test(source[i + 1] ?? \"\")) return undefined;\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (source[i] === \"[\") characterClass = true;\n\t\tif (source[i] === \"]\") characterClass = false;\n\t\tif (source[i] === \"/\" && !characterClass) {\n\t\t\tlet end = i + 1;\n\t\t\twhile (/[a-z]/i.test(source[end] ?? \"\")) end++;\n\t\t\tconst flags = source.slice(i + 1, end);\n\t\t\t// Unicode-set regexes need a different nested-class grammar; do not guess.\n\t\t\tif (/[^dgimsuy]/.test(flags) || new Set(flags).size !== flags.length) return undefined;\n\t\t\treturn { end, newlines: 0 };\n\t\t}\n\t}\n\treturn undefined;\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const READ_FOLD_SETTINGS: Readonly<{
|
|
2
|
+
readonly minBodyLines: 4;
|
|
3
|
+
readonly minCommentLines: 6;
|
|
4
|
+
readonly minTotalLines: 100;
|
|
5
|
+
readonly unfoldUntil: 50;
|
|
6
|
+
readonly unfoldLimit: 100;
|
|
7
|
+
}>;
|
|
8
|
+
/** Internal policy constants, not a user-configurable settings surface. */
|
|
9
|
+
export type ReadFoldSettings = typeof READ_FOLD_SETTINGS;
|
|
10
|
+
export type ReadLineRange = {
|
|
11
|
+
readonly startLine: number;
|
|
12
|
+
readonly endLine: number;
|
|
13
|
+
};
|
|
14
|
+
export type ReadBraceScan = {
|
|
15
|
+
readonly status: "parsed";
|
|
16
|
+
readonly ranges: readonly ReadLineRange[];
|
|
17
|
+
} | {
|
|
18
|
+
readonly status: "parse_failure";
|
|
19
|
+
readonly reason: string;
|
|
20
|
+
};
|
|
21
|
+
/** Inclusive, 1-based omitted interiors. Children exclude their parent's boundary lines. */
|
|
22
|
+
export type ReadFoldRange = ReadLineRange & {
|
|
23
|
+
readonly children: readonly ReadFoldRange[];
|
|
24
|
+
};
|
|
25
|
+
export type ReadFolderInput = {
|
|
26
|
+
readonly path: string;
|
|
27
|
+
readonly text: string;
|
|
28
|
+
readonly settings: ReadFoldSettings;
|
|
29
|
+
};
|
|
30
|
+
export type ReadFolderResult = {
|
|
31
|
+
readonly status: "parsed";
|
|
32
|
+
readonly text: string;
|
|
33
|
+
readonly ranges: readonly ReadFoldRange[];
|
|
34
|
+
} | {
|
|
35
|
+
readonly status: "unsupported";
|
|
36
|
+
readonly reason: "unsupported_language" | "prose_exempt";
|
|
37
|
+
} | {
|
|
38
|
+
readonly status: "parse_failure";
|
|
39
|
+
readonly reason: string;
|
|
40
|
+
};
|
|
41
|
+
/** Synchronous and pure. I/O, cancellation and unexpected exceptions belong to the caller. */
|
|
42
|
+
export interface ReadFolder {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly version: string;
|
|
45
|
+
fold(input: ReadFolderInput): ReadFolderResult;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/types.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/harness/utils/read-folders/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;2BAChB,CAAC;8BACE,CAAC;4BACH,GAAG;0BACL,EAAE;0BACF,GAAG;EACN,CAAC;AAEZ,2EAA2E;AAC3E,MAAM,MAAM,gBAAgB,GAAG,OAAO,kBAAkB,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AACrF,MAAM,MAAM,aAAa,GACtB;IAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,GACxE;IAAE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AACjE,4FAA4F;AAC5F,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,CAAC;AAC5F,MAAM,MAAM,eAAe,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;CACpC,CAAC;AACF,MAAM,MAAM,gBAAgB,GACzB;IAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,GAC/F;IAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,sBAAsB,GAAG,cAAc,CAAA;CAAE,GAC5F;IAAE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,8FAA8F;AAC9F,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CAAC;CAC/C"}
|
package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/read-folders/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/harness/utils/read-folders/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/C,YAAY,EAAE,CAAC;IACf,eAAe,EAAE,CAAC;IAClB,aAAa,EAAE,GAAG;IAClB,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,GAAG;CACP,CAAC,CAAC","sourcesContent":["export const READ_FOLD_SETTINGS = Object.freeze({\n\tminBodyLines: 4,\n\tminCommentLines: 6,\n\tminTotalLines: 100,\n\tunfoldUntil: 50,\n\tunfoldLimit: 100,\n} as const);\n\n/** Internal policy constants, not a user-configurable settings surface. */\nexport type ReadFoldSettings = typeof READ_FOLD_SETTINGS;\nexport type ReadLineRange = { readonly startLine: number; readonly endLine: number };\nexport type ReadBraceScan =\n\t| { readonly status: \"parsed\"; readonly ranges: readonly ReadLineRange[] }\n\t| { readonly status: \"parse_failure\"; readonly reason: string };\n/** Inclusive, 1-based omitted interiors. Children exclude their parent's boundary lines. */\nexport type ReadFoldRange = ReadLineRange & { readonly children: readonly ReadFoldRange[] };\nexport type ReadFolderInput = {\n\treadonly path: string;\n\treadonly text: string;\n\treadonly settings: ReadFoldSettings;\n};\nexport type ReadFolderResult =\n\t| { readonly status: \"parsed\"; readonly text: string; readonly ranges: readonly ReadFoldRange[] }\n\t| { readonly status: \"unsupported\"; readonly reason: \"unsupported_language\" | \"prose_exempt\" }\n\t| { readonly status: \"parse_failure\"; readonly reason: string };\n\n/** Synchronous and pure. I/O, cancellation and unexpected exceptions belong to the caller. */\nexport interface ReadFolder {\n\treadonly id: string;\n\treadonly version: string;\n\tfold(input: ReadFolderInput): ReadFolderResult;\n}\n"]}
|
package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/segmented-read-view.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ReadFolder, type ReadFolderResult, type ReadLineRange } from "./read-folders/types.ts";
|
|
2
|
+
export type ReadSegment = (ReadLineRange & {
|
|
3
|
+
readonly kind: "kept";
|
|
4
|
+
readonly text: string;
|
|
5
|
+
}) | (ReadLineRange & {
|
|
6
|
+
readonly kind: "elided";
|
|
7
|
+
});
|
|
8
|
+
export type RenderedReadView = {
|
|
9
|
+
readonly text: string;
|
|
10
|
+
readonly elidedRanges: readonly ReadLineRange[];
|
|
11
|
+
readonly footer: {
|
|
12
|
+
readonly text: string;
|
|
13
|
+
readonly rereads: readonly {
|
|
14
|
+
readonly offset: number;
|
|
15
|
+
readonly limit: number;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type ReadSummaryFallback = "unsupported_language" | "prose_exempt" | "parse_failure" | "stale_source" | "invalid_ranges" | "too_short" | "no_elision" | "skeleton_exceeds_budget" | "visible_budget_unreachable" | "no_output_saving";
|
|
20
|
+
export type SegmentedReadView = {
|
|
21
|
+
readonly status: "summary";
|
|
22
|
+
readonly segments: readonly ReadSegment[];
|
|
23
|
+
readonly visibleSourceLines: number;
|
|
24
|
+
readonly rendered: RenderedReadView;
|
|
25
|
+
} | {
|
|
26
|
+
readonly status: "no_summary";
|
|
27
|
+
readonly reason: ReadSummaryFallback;
|
|
28
|
+
};
|
|
29
|
+
/** Compose only untruncated default text reads; each reader owns its existing raw path. */
|
|
30
|
+
export declare function createDefaultReadSummary(input: {
|
|
31
|
+
readonly path: string;
|
|
32
|
+
readonly text: string;
|
|
33
|
+
readonly offset?: number;
|
|
34
|
+
readonly limit?: number;
|
|
35
|
+
readonly folder?: ReadFolder;
|
|
36
|
+
readonly truncated: boolean;
|
|
37
|
+
}): RenderedReadView | undefined;
|
|
38
|
+
export declare class InvalidReadSegmentsError extends Error {
|
|
39
|
+
readonly code = "invalid_segments";
|
|
40
|
+
constructor();
|
|
41
|
+
}
|
|
42
|
+
/** The sole validator/renderer/footer implementation. Synthetic lines are never source slices. */
|
|
43
|
+
export declare function renderSegmentedReadView({ text, segments, }: {
|
|
44
|
+
readonly text: string;
|
|
45
|
+
readonly segments: readonly ReadSegment[];
|
|
46
|
+
}): RenderedReadView;
|
|
47
|
+
/** Breadth-first refinement counts only retained source lines, never sentinels/footer lines. */
|
|
48
|
+
export declare function createSegmentedReadView({ text, parsed, }: {
|
|
49
|
+
readonly text: string;
|
|
50
|
+
readonly parsed: ReadFolderResult;
|
|
51
|
+
}): SegmentedReadView;
|
|
52
|
+
//# sourceMappingURL=segmented-read-view.d.ts.map
|
package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/segmented-read-view.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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AAQ,CAAC,MAAM,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAE3E,2FAA2F;AAC3F,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC5B,GAAG,gBAAgB,GAAG,SAAS,CAc/B;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IAClD,QAAQ,CAAC,IAAI,sBAAsB;IACnC,cAEC;CACD;AAYD,kGAAkG;AAClG,wBAAgB,uBAAuB,CAAC,EACvC,IAAI,EACJ,QAAQ,GACR,EAAE;IACF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;CAC1C,GAAG,gBAAgB,CAiCnB;AAkBD,gGAAgG;AAChG,wBAAgB,uBAAuB,CAAC,EACvC,IAAI,EACJ,MAAM,GACN,EAAE;IACF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;CAClC,GAAG,iBAAiB,CAyDpB"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { isReadSummaryPath } from "./read-folders/index.js";
|
|
2
|
+
import { READ_FOLD_SETTINGS, } from "./read-folders/types.js";
|
|
3
|
+
/** Compose only untruncated default text reads; each reader owns its existing raw path. */
|
|
4
|
+
export function createDefaultReadSummary(input) {
|
|
5
|
+
const { path, text, offset, limit, folder, truncated } = input;
|
|
6
|
+
if (!folder || offset !== undefined || limit !== undefined || truncated || !isReadSummaryPath(path))
|
|
7
|
+
return undefined;
|
|
8
|
+
if (text.includes("\0") || text.split("\n").length < READ_FOLD_SETTINGS.minTotalLines)
|
|
9
|
+
return undefined;
|
|
10
|
+
const view = createSegmentedReadView({ text, parsed: folder.fold({ path, text, settings: READ_FOLD_SETTINGS }) });
|
|
11
|
+
switch (view.status) {
|
|
12
|
+
case "summary":
|
|
13
|
+
return view.rendered;
|
|
14
|
+
case "no_summary":
|
|
15
|
+
return undefined;
|
|
16
|
+
default:
|
|
17
|
+
return view;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export class InvalidReadSegmentsError extends Error {
|
|
21
|
+
constructor() {
|
|
22
|
+
super("Read segments must cover the source exactly, in order, without altering kept lines");
|
|
23
|
+
this.code = "invalid_segments";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function validRange(range, total) {
|
|
27
|
+
return (Number.isSafeInteger(range.startLine) &&
|
|
28
|
+
Number.isSafeInteger(range.endLine) &&
|
|
29
|
+
range.startLine >= 1 &&
|
|
30
|
+
range.endLine >= range.startLine &&
|
|
31
|
+
range.endLine <= total);
|
|
32
|
+
}
|
|
33
|
+
/** The sole validator/renderer/footer implementation. Synthetic lines are never source slices. */
|
|
34
|
+
export function renderSegmentedReadView({ text, segments, }) {
|
|
35
|
+
const lines = text.split("\n");
|
|
36
|
+
const parts = [];
|
|
37
|
+
const elidedRanges = [];
|
|
38
|
+
let cursor = 1;
|
|
39
|
+
for (const segment of segments) {
|
|
40
|
+
if (!validRange(segment, lines.length) || segment.startLine !== cursor)
|
|
41
|
+
throw new InvalidReadSegmentsError();
|
|
42
|
+
switch (segment.kind) {
|
|
43
|
+
case "kept":
|
|
44
|
+
if (segment.text !== lines.slice(segment.startLine - 1, segment.endLine).join("\n"))
|
|
45
|
+
throw new InvalidReadSegmentsError();
|
|
46
|
+
parts.push(segment.text);
|
|
47
|
+
break;
|
|
48
|
+
case "elided":
|
|
49
|
+
parts.push("…");
|
|
50
|
+
elidedRanges.push({ startLine: segment.startLine, endLine: segment.endLine });
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
segment;
|
|
54
|
+
throw new InvalidReadSegmentsError();
|
|
55
|
+
}
|
|
56
|
+
cursor = segment.endLine + 1;
|
|
57
|
+
}
|
|
58
|
+
if (cursor !== lines.length + 1)
|
|
59
|
+
throw new InvalidReadSegmentsError();
|
|
60
|
+
const rereads = elidedRanges.map((range) => ({
|
|
61
|
+
offset: range.startLine,
|
|
62
|
+
limit: range.endLine - range.startLine + 1,
|
|
63
|
+
}));
|
|
64
|
+
const footerText = rereads.length
|
|
65
|
+
? `[Elided source: ${rereads.map((r) => `offset=${r.offset} limit=${r.limit}`).join("; ")}. Reread source before editing; markers are not source.]`
|
|
66
|
+
: "";
|
|
67
|
+
if (footerText)
|
|
68
|
+
parts.push("", footerText);
|
|
69
|
+
return { text: parts.join("\n"), elidedRanges, footer: { text: footerText, rereads } };
|
|
70
|
+
}
|
|
71
|
+
function validHierarchy(ranges, total) {
|
|
72
|
+
const queue = [{ ranges, startLine: 0, endLine: total + 1 }];
|
|
73
|
+
for (let i = 0; i < queue.length; i++) {
|
|
74
|
+
const parent = queue[i];
|
|
75
|
+
let previous = parent.startLine;
|
|
76
|
+
for (const range of parent.ranges) {
|
|
77
|
+
if (!validRange(range, total) || range.startLine <= previous || range.endLine >= parent.endLine)
|
|
78
|
+
return false;
|
|
79
|
+
previous = range.endLine;
|
|
80
|
+
queue.push({ ranges: range.children, startLine: range.startLine, endLine: range.endLine });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
const lengthOf = (range) => range.endLine - range.startLine + 1;
|
|
86
|
+
/** Breadth-first refinement counts only retained source lines, never sentinels/footer lines. */
|
|
87
|
+
export function createSegmentedReadView({ text, parsed, }) {
|
|
88
|
+
const raw = (reason) => ({ status: "no_summary", reason });
|
|
89
|
+
switch (parsed.status) {
|
|
90
|
+
case "unsupported":
|
|
91
|
+
return raw(parsed.reason);
|
|
92
|
+
case "parse_failure":
|
|
93
|
+
return raw("parse_failure");
|
|
94
|
+
case "parsed":
|
|
95
|
+
break;
|
|
96
|
+
default:
|
|
97
|
+
return parsed;
|
|
98
|
+
}
|
|
99
|
+
if (parsed.text !== text)
|
|
100
|
+
return raw("stale_source");
|
|
101
|
+
const lines = text.split("\n");
|
|
102
|
+
if (!validHierarchy(parsed.ranges, lines.length))
|
|
103
|
+
return raw("invalid_ranges");
|
|
104
|
+
if (lines.length < READ_FOLD_SETTINGS.minTotalLines)
|
|
105
|
+
return raw("too_short");
|
|
106
|
+
if (!parsed.ranges.length)
|
|
107
|
+
return raw("no_elision");
|
|
108
|
+
let visible = lines.length - parsed.ranges.reduce((sum, r) => sum + lengthOf(r), 0);
|
|
109
|
+
if (visible > READ_FOLD_SETTINGS.unfoldLimit)
|
|
110
|
+
return raw("skeleton_exceeds_budget");
|
|
111
|
+
const selected = new Set(parsed.ranges);
|
|
112
|
+
const queue = [...parsed.ranges];
|
|
113
|
+
for (let i = 0; visible < READ_FOLD_SETTINGS.unfoldUntil && i < queue.length; i++) {
|
|
114
|
+
const parent = queue[i];
|
|
115
|
+
const nextVisible = visible + lengthOf(parent) - parent.children.reduce((sum, r) => sum + lengthOf(r), 0);
|
|
116
|
+
// Later steps only increase visibility, so an oversized step cannot become safe later.
|
|
117
|
+
if (nextVisible > READ_FOLD_SETTINGS.unfoldLimit)
|
|
118
|
+
continue;
|
|
119
|
+
selected.delete(parent);
|
|
120
|
+
for (const child of parent.children)
|
|
121
|
+
selected.add(child);
|
|
122
|
+
queue.push(...parent.children);
|
|
123
|
+
visible = nextVisible;
|
|
124
|
+
}
|
|
125
|
+
if (visible < READ_FOLD_SETTINGS.unfoldUntil)
|
|
126
|
+
return raw("visible_budget_unreachable");
|
|
127
|
+
if (!selected.size)
|
|
128
|
+
return raw("no_elision");
|
|
129
|
+
const segments = [];
|
|
130
|
+
let cursor = 1;
|
|
131
|
+
for (const range of [...selected].sort((a, b) => a.startLine - b.startLine)) {
|
|
132
|
+
if (cursor < range.startLine)
|
|
133
|
+
segments.push({
|
|
134
|
+
kind: "kept",
|
|
135
|
+
startLine: cursor,
|
|
136
|
+
endLine: range.startLine - 1,
|
|
137
|
+
text: lines.slice(cursor - 1, range.startLine - 1).join("\n"),
|
|
138
|
+
});
|
|
139
|
+
segments.push({ kind: "elided", startLine: range.startLine, endLine: range.endLine });
|
|
140
|
+
cursor = range.endLine + 1;
|
|
141
|
+
}
|
|
142
|
+
if (cursor <= lines.length)
|
|
143
|
+
segments.push({
|
|
144
|
+
kind: "kept",
|
|
145
|
+
startLine: cursor,
|
|
146
|
+
endLine: lines.length,
|
|
147
|
+
text: lines.slice(cursor - 1).join("\n"),
|
|
148
|
+
});
|
|
149
|
+
const rendered = renderSegmentedReadView({ text, segments });
|
|
150
|
+
const encoder = new TextEncoder();
|
|
151
|
+
if (encoder.encode(rendered.text).length >= encoder.encode(text).length)
|
|
152
|
+
return raw("no_output_saving");
|
|
153
|
+
return { status: "summary", segments, visibleSourceLines: visible, rendered };
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=segmented-read-view.js.map
|
package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/segmented-read-view.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmented-read-view.js","sourceRoot":"","sources":["../../../src/harness/utils/segmented-read-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACN,kBAAkB,GAKlB,MAAM,yBAAyB,CAAC;AAiCjC,2FAA2F;AAC3F,MAAM,UAAU,wBAAwB,CAAC,KAOxC;IACA,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC/D,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,IAAI,SAAS,IAAI,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C,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM;QAAE,OAAO,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACxG,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC/E,CAAC","sourcesContent":["import { isReadSummaryPath } from \"./read-folders/index.ts\";\nimport {\n\tREAD_FOLD_SETTINGS,\n\ttype ReadFolder,\n\ttype ReadFolderResult,\n\ttype ReadFoldRange,\n\ttype ReadLineRange,\n} from \"./read-folders/types.ts\";\n\nexport type ReadSegment =\n\t| (ReadLineRange & { readonly kind: \"kept\"; readonly text: string })\n\t| (ReadLineRange & { readonly kind: \"elided\" });\nexport type RenderedReadView = {\n\treadonly text: string;\n\treadonly elidedRanges: readonly ReadLineRange[];\n\treadonly footer: {\n\t\treadonly text: string;\n\t\treadonly rereads: readonly { readonly offset: number; readonly limit: number }[];\n\t};\n};\nexport type ReadSummaryFallback =\n\t| \"unsupported_language\"\n\t| \"prose_exempt\"\n\t| \"parse_failure\"\n\t| \"stale_source\"\n\t| \"invalid_ranges\"\n\t| \"too_short\"\n\t| \"no_elision\"\n\t| \"skeleton_exceeds_budget\"\n\t| \"visible_budget_unreachable\"\n\t| \"no_output_saving\";\nexport type SegmentedReadView =\n\t| {\n\t\t\treadonly status: \"summary\";\n\t\t\treadonly segments: readonly ReadSegment[];\n\t\t\treadonly visibleSourceLines: number;\n\t\t\treadonly rendered: RenderedReadView;\n\t }\n\t| { readonly status: \"no_summary\"; readonly reason: ReadSummaryFallback };\n\n/** Compose only untruncated default text reads; each reader owns its existing raw path. */\nexport function createDefaultReadSummary(input: {\n\treadonly path: string;\n\treadonly text: string;\n\treadonly offset?: number;\n\treadonly limit?: number;\n\treadonly folder?: ReadFolder;\n\treadonly truncated: boolean;\n}): RenderedReadView | undefined {\n\tconst { path, text, offset, limit, folder, truncated } = input;\n\tif (!folder || offset !== undefined || limit !== undefined || truncated || !isReadSummaryPath(path))\n\t\treturn undefined;\n\tif (text.includes(\"\\0\") || text.split(\"\\n\").length < READ_FOLD_SETTINGS.minTotalLines) return undefined;\n\tconst view = createSegmentedReadView({ text, parsed: folder.fold({ path, text, settings: READ_FOLD_SETTINGS }) });\n\tswitch (view.status) {\n\t\tcase \"summary\":\n\t\t\treturn view.rendered;\n\t\tcase \"no_summary\":\n\t\t\treturn undefined;\n\t\tdefault:\n\t\t\treturn view satisfies never;\n\t}\n}\n\nexport class InvalidReadSegmentsError extends Error {\n\treadonly code = \"invalid_segments\";\n\tconstructor() {\n\t\tsuper(\"Read segments must cover the source exactly, in order, without altering kept lines\");\n\t}\n}\n\nfunction validRange(range: ReadLineRange, total: number): boolean {\n\treturn (\n\t\tNumber.isSafeInteger(range.startLine) &&\n\t\tNumber.isSafeInteger(range.endLine) &&\n\t\trange.startLine >= 1 &&\n\t\trange.endLine >= range.startLine &&\n\t\trange.endLine <= total\n\t);\n}\n\n/** The sole validator/renderer/footer implementation. Synthetic lines are never source slices. */\nexport function renderSegmentedReadView({\n\ttext,\n\tsegments,\n}: {\n\treadonly text: string;\n\treadonly segments: readonly ReadSegment[];\n}): RenderedReadView {\n\tconst lines = text.split(\"\\n\");\n\tconst parts: string[] = [];\n\tconst elidedRanges: ReadLineRange[] = [];\n\tlet cursor = 1;\n\tfor (const segment of segments) {\n\t\tif (!validRange(segment, lines.length) || segment.startLine !== cursor) throw new InvalidReadSegmentsError();\n\t\tswitch (segment.kind) {\n\t\t\tcase \"kept\":\n\t\t\t\tif (segment.text !== lines.slice(segment.startLine - 1, segment.endLine).join(\"\\n\"))\n\t\t\t\t\tthrow new InvalidReadSegmentsError();\n\t\t\t\tparts.push(segment.text);\n\t\t\t\tbreak;\n\t\t\tcase \"elided\":\n\t\t\t\tparts.push(\"…\");\n\t\t\t\telidedRanges.push({ startLine: segment.startLine, endLine: segment.endLine });\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tsegment satisfies never;\n\t\t\t\tthrow new InvalidReadSegmentsError();\n\t\t}\n\t\tcursor = segment.endLine + 1;\n\t}\n\tif (cursor !== lines.length + 1) throw new InvalidReadSegmentsError();\n\tconst rereads = elidedRanges.map((range) => ({\n\t\toffset: range.startLine,\n\t\tlimit: range.endLine - range.startLine + 1,\n\t}));\n\tconst footerText = rereads.length\n\t\t? `[Elided source: ${rereads.map((r) => `offset=${r.offset} limit=${r.limit}`).join(\"; \")}. Reread source before editing; markers are not source.]`\n\t\t: \"\";\n\tif (footerText) parts.push(\"\", footerText);\n\treturn { text: parts.join(\"\\n\"), elidedRanges, footer: { text: footerText, rereads } };\n}\n\nfunction validHierarchy(ranges: readonly ReadFoldRange[], total: number): boolean {\n\tconst queue = [{ ranges, startLine: 0, endLine: total + 1 }];\n\tfor (let i = 0; i < queue.length; i++) {\n\t\tconst parent = queue[i];\n\t\tlet previous = parent.startLine;\n\t\tfor (const range of parent.ranges) {\n\t\t\tif (!validRange(range, total) || range.startLine <= previous || range.endLine >= parent.endLine) return false;\n\t\t\tprevious = range.endLine;\n\t\t\tqueue.push({ ranges: range.children, startLine: range.startLine, endLine: range.endLine });\n\t\t}\n\t}\n\treturn true;\n}\n\nconst lengthOf = (range: ReadLineRange) => range.endLine - range.startLine + 1;\n\n/** Breadth-first refinement counts only retained source lines, never sentinels/footer lines. */\nexport function createSegmentedReadView({\n\ttext,\n\tparsed,\n}: {\n\treadonly text: string;\n\treadonly parsed: ReadFolderResult;\n}): SegmentedReadView {\n\tconst raw = (reason: ReadSummaryFallback): SegmentedReadView => ({ status: \"no_summary\", reason });\n\tswitch (parsed.status) {\n\t\tcase \"unsupported\":\n\t\t\treturn raw(parsed.reason);\n\t\tcase \"parse_failure\":\n\t\t\treturn raw(\"parse_failure\");\n\t\tcase \"parsed\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn parsed satisfies never;\n\t}\n\tif (parsed.text !== text) return raw(\"stale_source\");\n\tconst lines = text.split(\"\\n\");\n\tif (!validHierarchy(parsed.ranges, lines.length)) return raw(\"invalid_ranges\");\n\tif (lines.length < READ_FOLD_SETTINGS.minTotalLines) return raw(\"too_short\");\n\tif (!parsed.ranges.length) return raw(\"no_elision\");\n\tlet visible = lines.length - parsed.ranges.reduce((sum, r) => sum + lengthOf(r), 0);\n\tif (visible > READ_FOLD_SETTINGS.unfoldLimit) return raw(\"skeleton_exceeds_budget\");\n\tconst selected = new Set(parsed.ranges);\n\tconst queue = [...parsed.ranges];\n\tfor (let i = 0; visible < READ_FOLD_SETTINGS.unfoldUntil && i < queue.length; i++) {\n\t\tconst parent = queue[i];\n\t\tconst nextVisible = visible + lengthOf(parent) - parent.children.reduce((sum, r) => sum + lengthOf(r), 0);\n\t\t// Later steps only increase visibility, so an oversized step cannot become safe later.\n\t\tif (nextVisible > READ_FOLD_SETTINGS.unfoldLimit) continue;\n\t\tselected.delete(parent);\n\t\tfor (const child of parent.children) selected.add(child);\n\t\tqueue.push(...parent.children);\n\t\tvisible = nextVisible;\n\t}\n\tif (visible < READ_FOLD_SETTINGS.unfoldUntil) return raw(\"visible_budget_unreachable\");\n\tif (!selected.size) return raw(\"no_elision\");\n\tconst segments: ReadSegment[] = [];\n\tlet cursor = 1;\n\tfor (const range of [...selected].sort((a, b) => a.startLine - b.startLine)) {\n\t\tif (cursor < range.startLine)\n\t\t\tsegments.push({\n\t\t\t\tkind: \"kept\",\n\t\t\t\tstartLine: cursor,\n\t\t\t\tendLine: range.startLine - 1,\n\t\t\t\ttext: lines.slice(cursor - 1, range.startLine - 1).join(\"\\n\"),\n\t\t\t});\n\t\tsegments.push({ kind: \"elided\", startLine: range.startLine, endLine: range.endLine });\n\t\tcursor = range.endLine + 1;\n\t}\n\tif (cursor <= lines.length)\n\t\tsegments.push({\n\t\t\tkind: \"kept\",\n\t\t\tstartLine: cursor,\n\t\t\tendLine: lines.length,\n\t\t\ttext: lines.slice(cursor - 1).join(\"\\n\"),\n\t\t});\n\tconst rendered = renderSegmentedReadView({ text, segments });\n\tconst encoder = new TextEncoder();\n\tif (encoder.encode(rendered.text).length >= encoder.encode(text).length) return raw(\"no_output_saving\");\n\treturn { status: \"summary\", segments, visibleSourceLines: visible, rendered };\n}\n"]}
|
|
@@ -20,10 +20,14 @@ export { AGENT_TELEMETRY_SCHEMAS, AI_TELEMETRY_SCHEMA, HARNESS_TELEMETRY_SCHEMA,
|
|
|
20
20
|
export * from "./harness/tools/index.ts";
|
|
21
21
|
export { type AgentHarnessResources, type AgentHarnessStreamOptions, type AgentHarnessStreamOptionsPatch, type AgentHarnessTool, type AgentHarnessToolContextSource, type AgentHarnessToolInvocation, type AgentHarnessToolUpdateCallback, type AgentHarnessToolUpdateOptions, BranchSummaryError, type BranchSummaryErrorCode, CompactionError, type CompactionErrorCode, type ExecutionEnv, ExecutionError, type ExecutionErrorCode, err, FileError, type FileErrorCode, type FileInfo, type FileKind, type FileSystem, getOrThrow, getOrUndefined, ok, type PromptTemplate, type Shell, type ShellExecOptions, type ShellExecResult, type ShellOutputCaptureOptions, type ShellOutputLimits, type ShellOutputMetadata, type ShellOutputRetention, type ShellOutputTruncation, type ShellOutputUpdate, type ShellOutputView, type Skill, toError, } from "./harness/types.ts";
|
|
22
22
|
export { applyShellOutputUpdate } from "./harness/utils/output-capture.ts";
|
|
23
|
+
export * from "./harness/utils/read-folders/index.ts";
|
|
24
|
+
export * from "./harness/utils/segmented-read-view.ts";
|
|
23
25
|
export * from "./harness/utils/shell-output.ts";
|
|
24
26
|
export * from "./harness/utils/truncate.ts";
|
|
25
27
|
export * from "./proxy.ts";
|
|
26
28
|
export * from "./search/index.ts";
|
|
27
29
|
export { setDefaultStreamFn } from "./stream-fn.ts";
|
|
30
|
+
export type { StreamThroughputOptions, StreamThroughputWatchdog } from "./stream-throughput-watchdog.ts";
|
|
31
|
+
export { createStreamThroughputWatchdog, DEFAULT_STREAM_THROUGHPUT_FLOOR_TOKENS_PER_SECOND, DEFAULT_STREAM_THROUGHPUT_GRACE_MS, DEFAULT_STREAM_THROUGHPUT_WINDOW_MS, estimateStreamedUnits, formatStreamThroughputDegradedMessage, STREAM_THROUGHPUT_MIN_UNITS, StreamRateMeter, StreamThroughputDegradedError, } from "./stream-throughput-watchdog.ts";
|
|
28
32
|
export * from "./types.ts";
|
|
29
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,YAAY,EACX,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,kCAAkC,EAClC,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,cAAc,IAAI,uBAAuB,EACzC,WAAW,EACX,UAAU,EACV,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EACtB,gBAAgB,EAChB,iCAAiC,EACjC,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,gCAAgC,EAChC,kCAAkC,EAClC,4BAA4B,EAC5B,uBAAuB,EACvB,kCAAkC,EAClC,wBAAwB,EACxB,aAAa,EACb,uBAAuB,EACvB,iCAAiC,EACjC,gBAAgB,GAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,GACtB,MAAM,8BAA8B,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,kCAAkC,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AACpH,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,8BAA8B,EAC9B,KAAK,cAAc,EACnB,KAAK,4BAA4B,EACjC,qBAAqB,E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ACd,KAAK,kBAAkB,EACvB,GAAG,EACH,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,UAAU,EACV,cAAc,EACd,EAAE,EACF,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,KAAK,EACV,OAAO,GACP,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,YAAY,EACX,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,kCAAkC,EAClC,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,cAAc,IAAI,uBAAuB,EACzC,WAAW,EACX,UAAU,EACV,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EACtB,gBAAgB,EAChB,iCAAiC,EACjC,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,gCAAgC,EAChC,kCAAkC,EAClC,4BAA4B,EAC5B,uBAAuB,EACvB,kCAAkC,EAClC,wBAAwB,EACxB,aAAa,EACb,uBAAuB,EACvB,iCAAiC,EACjC,gBAAg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AkC,EAClC,mCAAmC,EACnC,qBAAqB,EACrB,qCAAqC,EACrC,2BAA2B,EAC3B,eAAe,EACf,6BAA6B,GAC7B,MAAM,iCAAiC,CAAC;AACzC,cAAc,YAAY,CAAC"}
|
|
@@ -18,10 +18,13 @@ export { AGENT_TELEMETRY_SCHEMAS, AI_TELEMETRY_SCHEMA, HARNESS_TELEMETRY_SCHEMA,
|
|
|
18
18
|
export * from "./harness/tools/index.js";
|
|
19
19
|
export { BranchSummaryError, CompactionError, ExecutionError, err, FileError, getOrThrow, getOrUndefined, ok, toError, } from "./harness/types.js";
|
|
20
20
|
export { applyShellOutputUpdate } from "./harness/utils/output-capture.js";
|
|
21
|
+
export * from "./harness/utils/read-folders/index.js";
|
|
22
|
+
export * from "./harness/utils/segmented-read-view.js";
|
|
21
23
|
export * from "./harness/utils/shell-output.js";
|
|
22
24
|
export * from "./harness/utils/truncate.js";
|
|
23
25
|
export * from "./proxy.js";
|
|
24
26
|
export * from "./search/index.js";
|
|
25
27
|
export { setDefaultStreamFn } from "./stream-fn.js";
|
|
28
|
+
export { createStreamThroughputWatchdog, DEFAULT_STREAM_THROUGHPUT_FLOOR_TOKENS_PER_SECOND, DEFAULT_STREAM_THROUGHPUT_GRACE_MS, DEFAULT_STREAM_THROUGHPUT_WINDOW_MS, estimateStreamedUnits, formatStreamThroughputDegradedMessage, STREAM_THROUGHPUT_MIN_UNITS, StreamRateMeter, StreamThroughputDegradedError, } from "./stream-throughput-watchdog.js";
|
|
26
29
|
export * from "./types.js";
|
|
27
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAkC/C,OAAO,EACN,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,GACtB,MAAM,8BAA8B,CAAC;AACtC,cAAc,YAAY,CAA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CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EACN,8BAA8B,EAC9B,iDAAiD,EACjD,kCAAkC,EAClC,mCAAmC,EACnC,qBAAqB,EACrB,qCAAqC,EACrC,2BAA2B,EAC3B,eAAe,EACf,6BAA6B,GAC7B,MAAM,iCAAiC,CAAC;AACzC,cAAc,YAAY,CAAC","sourcesContent":["export { uuidv7 } from \"@earendil-works/pi-ai\";\nexport type {\n\tAttributeValue,\n\tExactTelemetryAttributes,\n\tInferEventAttributes,\n\tInferOptionalAttributes,\n\tInferRequiredAndOptionalAttributes,\n\tInferStartAttributes,\n\tRecordedTelemetryEvent,\n\tRecordedTelemetrySpan,\n\tSchemaTelemetrySpan,\n\tSpanAttributes,\n\tSpanAttributes as TelemetrySpanAttributes,\n\tSpanOptions,\n\tSpanStatus,\n\tTelemetryAttributeDefinition,\n\tTelemetryAttributeMetadata,\n\tTelemetryAttributeType,\n\tTelemetryContext,\n\tTelemetryEventAttributeDefinition,\n\tTelemetryEventDefinition,\n\tTelemetryParentDefinition,\n\tTelemetrySchemaDefinition,\n\tTelemetrySchemaSpanEndAttributes,\n\tTelemetrySchemaSpanEventAttributes,\n\tTelemetrySchemaSpanEventName,\n\tTelemetrySchemaSpanName,\n\tTelemetrySchemaSpanStartAttributes,\n\tTelemetrySchemaSpanUnion,\n\tTelemetrySpan,\n\tTelemetrySpanDefinition,\n\tTelemetryStartAttributeDefinition,\n\tTypedSpanStarter,\n} from \"@earendil-works/pi-telemetry\";\nexport {\n\tcreateTypedSpanStarter,\n\tdefineTelemetrySchema,\n\tInMemoryTelemetryContext,\n\tNOOP_TELEMETRY_CONTEXT,\n} from \"@earendil-works/pi-telemetry\";\nexport * from \"./agent.ts\";\nexport * from \"./agent-loop.ts\";\nexport { EMPTY_TOOL_USE_DEMOTION_DIAGNOSTIC, ProviderRetryWatchdogAbortError } from \"./assistant-terminal-state.ts\";\nexport * from \"./harness/agent-harness.ts\";\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryDetails,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\tcollectEntriesForBranchSummary,\n\ttype FileOperations,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tprepareBranchEntries,\n} from \"./harness/compaction/branch-summarization.ts\";\nexport {\n\ttype CompactionPreparation,\n\ttype CompactionSettings,\n\ttype CompactResult,\n\tcalculateContextTokens,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateContextTokens,\n\testimateTokens,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\tgenerateSummary,\n\tgenerateSummaryWithUsage,\n\tgetLastAssistantUsage,\n\tprepareCompaction,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./harness/compaction/compaction.ts\";\nexport * from \"./harness/context.ts\";\nexport * from \"./harness/messages.ts\";\nexport * from \"./harness/prompt-templates.ts\";\nexport * from \"./harness/result.ts\";\nexport { type LaneSnapshotReduction, reduceLaneSnapshot } from \"./harness/runtime/reducer.ts\";\nexport * from \"./harness/session/index.ts\";\nexport * from \"./harness/skills.ts\";\nexport * from \"./harness/system-prompt.ts\";\nexport type {\n\tAiSpan,\n\tAiSpanAttributes,\n\tAiSpanEndAttributes,\n\tAiSpanEventAttributes,\n\tAiSpanEventName,\n\tAiSpanName,\n\tAiSpanStartAttributes,\n\tAiTelemetrySpan,\n\tHarnessSpan,\n\tHarnessSpanAttributes,\n\tHarnessSpanEndAttributes,\n\tHarnessSpanEventAttributes,\n\tHarnessSpanEventName,\n\tHarnessSpanName,\n\tHarnessSpanStartAttributes,\n\tHarnessTelemetrySpan,\n} from \"./harness/telemetry.ts\";\nexport {\n\tAGENT_TELEMETRY_SCHEMAS,\n\tAI_TELEMETRY_SCHEMA,\n\tHARNESS_TELEMETRY_SCHEMA,\n\tstartAiSpan,\n\tstartHarnessSpan,\n} from \"./harness/telemetry.ts\";\nexport * from \"./harness/tools/index.ts\";\nexport {\n\ttype AgentHarnessResources,\n\ttype AgentHarnessStreamOptions,\n\ttype AgentHarnessStreamOptionsPatch,\n\ttype AgentHarnessTool,\n\ttype AgentHarnessToolContextSource,\n\ttype AgentHarnessToolInvocation,\n\ttype AgentHarnessToolUpdateCallback,\n\ttype AgentHarnessToolUpdateOptions,\n\tBranchSummaryError,\n\ttype BranchSummaryErrorCode,\n\tCompactionError,\n\ttype CompactionErrorCode,\n\ttype ExecutionEnv,\n\tExecutionError,\n\ttype ExecutionErrorCode,\n\terr,\n\tFileError,\n\ttype FileErrorCode,\n\ttype FileInfo,\n\ttype FileKind,\n\ttype FileSystem,\n\tgetOrThrow,\n\tgetOrUndefined,\n\tok,\n\ttype PromptTemplate,\n\ttype Shell,\n\ttype ShellExecOptions,\n\ttype ShellExecResult,\n\ttype ShellOutputCaptureOptions,\n\ttype ShellOutputLimits,\n\ttype ShellOutputMetadata,\n\ttype ShellOutputRetention,\n\ttype ShellOutputTruncation,\n\ttype ShellOutputUpdate,\n\ttype ShellOutputView,\n\ttype Skill,\n\ttoError,\n} from \"./harness/types.ts\";\nexport { applyShellOutputUpdate } from \"./harness/utils/output-capture.ts\";\nexport * from \"./harness/utils/read-folders/index.ts\";\nexport * from \"./harness/utils/segmented-read-view.ts\";\nexport * from \"./harness/utils/shell-output.ts\";\nexport * from \"./harness/utils/truncate.ts\";\nexport * from \"./proxy.ts\";\nexport * from \"./search/index.ts\";\nexport { setDefaultStreamFn } from \"./stream-fn.ts\";\nexport type { StreamThroughputOptions, StreamThroughputWatchdog } from \"./stream-throughput-watchdog.ts\";\nexport {\n\tcreateStreamThroughputWatchdog,\n\tDEFAULT_STREAM_THROUGHPUT_FLOOR_TOKENS_PER_SECOND,\n\tDEFAULT_STREAM_THROUGHPUT_GRACE_MS,\n\tDEFAULT_STREAM_THROUGHPUT_WINDOW_MS,\n\testimateStreamedUnits,\n\tformatStreamThroughputDegradedMessage,\n\tSTREAM_THROUGHPUT_MIN_UNITS,\n\tStreamRateMeter,\n\tStreamThroughputDegradedError,\n} from \"./stream-throughput-watchdog.ts\";\nexport * from \"./types.ts\";\n"]}
|