@code-yeongyu/senpi 2026.8.23 → 2026.8.25
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 +101 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +24 -9
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +2 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/config.d.ts +6 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +24 -14
- package/dist/config.js.map +1 -1
- package/dist/core/agent-abort-provenance.d.ts +5 -5
- package/dist/core/agent-abort-provenance.d.ts.map +1 -1
- package/dist/core/agent-abort-provenance.js +8 -1
- package/dist/core/agent-abort-provenance.js.map +1 -1
- package/dist/core/agent-session.d.ts +14 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +129 -29
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +35 -8
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/brand.d.ts +2 -0
- package/dist/core/brand.d.ts.map +1 -1
- package/dist/core/brand.js +1 -0
- package/dist/core/brand.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +1 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +24 -8
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/defaults.d.ts +1 -0
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/defaults.js +9 -0
- package/dist/core/defaults.js.map +1 -1
- package/dist/core/extensions/builtin/goal/agent-end-continuation.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/agent-end-continuation.js +10 -0
- package/dist/core/extensions/builtin/goal/agent-end-continuation.js.map +1 -1
- package/dist/core/extensions/builtin/goal/continuation.d.ts +1 -1
- package/dist/core/extensions/builtin/goal/continuation.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/continuation.js +1 -1
- package/dist/core/extensions/builtin/goal/continuation.js.map +1 -1
- package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/index.js +0 -8
- package/dist/core/extensions/builtin/goal/index.js.map +1 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation-types.d.ts +1 -0
- package/dist/core/extensions/builtin/goal/monitor-continuation-types.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation-types.js.map +1 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts +2 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation.js +31 -3
- package/dist/core/extensions/builtin/goal/monitor-continuation.js.map +1 -1
- package/dist/core/extensions/builtin/goal/terminal-provider-error.js +1 -1
- package/dist/core/extensions/builtin/goal/terminal-provider-error.js.map +1 -1
- package/dist/core/extensions/builtin/goal/wait-ticker.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/wait-ticker.js +14 -9
- package/dist/core/extensions/builtin/goal/wait-ticker.js.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/notice.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/notice.js +5 -1
- package/dist/core/extensions/builtin/loop-guard/notice.js.map +1 -1
- package/dist/core/extensions/builtin/mcp/config-schema.d.ts +2 -2
- package/dist/core/extensions/builtin/ttsr/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/index.js +6 -6
- package/dist/core/extensions/builtin/ttsr/index.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/message-update.d.ts +10 -0
- package/dist/core/extensions/builtin/ttsr/message-update.d.ts.map +1 -0
- package/dist/core/extensions/builtin/ttsr/message-update.js +38 -0
- package/dist/core/extensions/builtin/ttsr/message-update.js.map +1 -0
- package/dist/core/extensions/builtin/ttsr/remediation.d.ts +5 -10
- package/dist/core/extensions/builtin/ttsr/remediation.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/remediation.js +19 -3
- package/dist/core/extensions/builtin/ttsr/remediation.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/stream-remediation.d.ts +1 -1
- package/dist/core/extensions/builtin/ttsr/stream-remediation.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/stream-remediation.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/types.d.ts +1 -1
- package/dist/core/extensions/builtin/ttsr/types.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/types.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/watch.d.ts +1 -1
- package/dist/core/extensions/builtin/ttsr/watch.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/watch.js +2 -2
- package/dist/core/extensions/builtin/ttsr/watch.js.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/fetcher.d.ts.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/fetcher.js +5 -23
- package/dist/core/extensions/builtin/webfetch/webfetch/fetcher.js.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/response-body.d.ts +11 -0
- package/dist/core/extensions/builtin/webfetch/webfetch/response-body.d.ts.map +1 -0
- package/dist/core/extensions/builtin/webfetch/webfetch/response-body.js +54 -0
- package/dist/core/extensions/builtin/webfetch/webfetch/response-body.js.map +1 -0
- package/dist/core/extensions/index.d.ts +2 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +107 -45
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +17 -6
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +3 -0
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +1 -1
- package/dist/core/footer-data-provider.js +1 -1
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/keybindings.d.ts +20 -19
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +26 -5
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-config-schema.d.ts +17 -5
- package/dist/core/model-config-schema.d.ts.map +1 -1
- package/dist/core/model-config-schema.js +1 -1
- package/dist/core/model-config-schema.js.map +1 -1
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +7 -5
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.d.ts +3 -2
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +3 -2
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +0 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +0 -18
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js +2 -1
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +14 -10
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-manifest.d.ts.map +1 -1
- package/dist/core/pi-manifest.js +2 -1
- package/dist/core/pi-manifest.js.map +1 -1
- package/dist/core/provider-composer.d.ts +2 -0
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +3 -6
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +0 -1
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/provider-timeout-retry.d.ts.map +1 -1
- package/dist/core/provider-timeout-retry.js +8 -12
- package/dist/core/provider-timeout-retry.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +3 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/retry-fallback/profile-override.d.ts +24 -0
- package/dist/core/retry-fallback/profile-override.d.ts.map +1 -0
- package/dist/core/retry-fallback/profile-override.js +138 -0
- package/dist/core/retry-fallback/profile-override.js.map +1 -0
- package/dist/core/retry-fallback/settings.d.ts +1 -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 +2 -2
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +20 -5
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-export.d.ts +4 -0
- package/dist/core/session-export.d.ts.map +1 -0
- package/dist/core/session-export.js +32 -0
- package/dist/core/session-export.js.map +1 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +2 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-diagnostics.d.ts +9 -0
- package/dist/core/settings-diagnostics.d.ts.map +1 -0
- package/dist/core/settings-diagnostics.js +21 -0
- package/dist/core/settings-diagnostics.js.map +1 -0
- package/dist/core/settings-manager.d.ts +18 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +88 -7
- 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/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +11 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +14 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +35 -19
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +0 -5
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +2 -5
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +3 -2
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/index.d.ts +4 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +13 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/powershell.d.ts +16 -0
- package/dist/core/tools/powershell.d.ts.map +1 -0
- package/dist/core/tools/powershell.js +39 -0
- package/dist/core/tools/powershell.js.map +1 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +5 -0
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +2 -1
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/extensions/llama/client.d.ts +6 -0
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +7 -0
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +3 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +27 -6
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +13 -2
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +4 -3
- package/dist/migrations.js.map +1 -1
- package/dist/modes/app-server/daemon/probe.js +1 -1
- package/dist/modes/app-server/daemon/probe.js.map +1 -1
- package/dist/modes/app-server/daemon.js +13 -2
- package/dist/modes/app-server/daemon.js.map +1 -1
- package/dist/modes/app-server/transports/websocket-connection-handler.d.ts.map +1 -1
- package/dist/modes/app-server/transports/websocket-connection-handler.js +4 -0
- package/dist/modes/app-server/transports/websocket-connection-handler.js.map +1 -1
- package/dist/modes/interactive/aborted-error-label.d.ts +4 -1
- package/dist/modes/interactive/aborted-error-label.d.ts.map +1 -1
- package/dist/modes/interactive/aborted-error-label.js +27 -5
- package/dist/modes/interactive/aborted-error-label.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +68 -17
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +2 -1
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +6 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +28 -13
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/streaming-reveal.d.ts +8 -0
- package/dist/modes/interactive/streaming-reveal.d.ts.map +1 -1
- package/dist/modes/interactive/streaming-reveal.js +12 -0
- package/dist/modes/interactive/streaming-reveal.js.map +1 -1
- package/dist/modes/json-event.d.ts +16 -13
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js +20 -6
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +3 -0
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +7 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +7 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +12 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +186 -2
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +2 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/shell.d.ts +3 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +17 -5
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +60 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/text.d.ts +8 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +9 -0
- package/dist/utils/text.js.map +1 -0
- package/docs/AGENTS.md +3 -1
- package/docs/compaction.md +0 -2
- package/docs/custom-provider.md +6 -6
- package/docs/environment-variables.md +8 -8
- package/docs/extensions.md +6 -5
- package/docs/json.md +7 -2
- package/docs/keybindings.md +1 -1
- package/docs/packages.md +2 -2
- package/docs/rpc.md +32 -3
- package/docs/sdk.md +7 -2
- package/docs/settings.md +9 -1
- package/docs/terminal-setup.md +11 -9
- package/docs/usage.md +4 -1
- package/docs/windows.md +24 -2
- package/examples/AGENTS.md +21 -6
- package/examples/extensions/AGENTS.md +50 -0
- package/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +90 -88
- package/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +40 -40
- package/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +20 -21
- package/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +24 -25
- package/node_modules/@anthropic-ai/claude-agent-sdk/package.json +2 -2
- package/node_modules/@anthropic-ai/claude-agent-sdk/sdk-tools.d.ts +102 -5
- package/node_modules/@anthropic-ai/claude-agent-sdk/sdk.d.ts +31 -15
- package/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +80 -78
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +13 -13
- package/node_modules/@aws-sdk/core/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-env/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-http/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +12 -12
- package/node_modules/@aws-sdk/credential-provider-login/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-node/package.json +10 -10
- package/node_modules/@aws-sdk/credential-provider-process/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +6 -6
- package/node_modules/@aws-sdk/eventstream-handler-node/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-eventstream/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-websocket/package.json +6 -6
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +8 -8
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +3 -3
- package/node_modules/@aws-sdk/token-providers/package.json +6 -6
- package/node_modules/@aws-sdk/types/package.json +2 -2
- package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +26 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +5 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/extension/session-manager-proxy.ts +39 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/AGENTS.md +40 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/AGENTS.md +40 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-manager.ts +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-notification.ts +3 -8
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-notification-queue.ts +2 -6
- 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 +7 -4
- 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 +2 -3
- 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 +7 -6
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.d.ts +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.js +8 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +1 -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 +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +6 -6
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts +1 -5
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +25 -13
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +91 -5
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +93 -54
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +2 -5
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js +97 -46
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js +1 -14
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts +50 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js +129 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +3 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +8 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js +16 -3
- package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts +3 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js +10 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.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/anthropic.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opengateway.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/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +8 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +16 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +17 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/backoff.d.ts +14 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/backoff.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/backoff.js +24 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/backoff.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.d.ts +36 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.js +109 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/failure.d.ts +12 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/failure.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/failure.js +109 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/failure.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/index.d.ts +9 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/index.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/planner.d.ts +46 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/planner.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/planner.js +41 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/planner.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.js +93 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.d.ts +121 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.js +11 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +12 -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 +25 -5
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/sleep.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/sleep.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/sleep.js +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/sleep.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/package.json +22 -18
- package/node_modules/@earendil-works/pi-pty/dist/index.d.ts +1 -0
- package/node_modules/@earendil-works/pi-pty/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-pty/dist/index.js +1 -0
- package/node_modules/@earendil-works/pi-pty/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-pty/dist/session-bun.d.ts +30 -0
- package/node_modules/@earendil-works/pi-pty/dist/session-bun.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-pty/dist/session-bun.js +76 -0
- package/node_modules/@earendil-works/pi-pty/dist/session-bun.js.map +1 -0
- package/node_modules/@earendil-works/pi-pty/dist/session-types.d.ts +3 -1
- package/node_modules/@earendil-works/pi-pty/dist/session-types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-pty/dist/session-types.js.map +1 -1
- package/node_modules/@earendil-works/pi-pty/dist/session.d.ts +2 -0
- package/node_modules/@earendil-works/pi-pty/dist/session.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-pty/dist/session.js +19 -9
- package/node_modules/@earendil-works/pi-pty/dist/session.js.map +1 -1
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +3 -3
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +9 -4
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +8 -2
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +24 -4
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +2 -2
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +2 -2
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +2 -8
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-module-path.d.ts +7 -0
- package/node_modules/@earendil-works/pi-tui/dist/native-module-path.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/native-module-path.js +19 -0
- package/node_modules/@earendil-works/pi-tui/dist/native-module-path.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +11 -14
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +5 -5
- package/node_modules/@smithy/signature-v4/dist-cjs/index.js +19 -7
- package/node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js +4 -1
- package/node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js +4 -1
- package/node_modules/@smithy/signature-v4/dist-es/getPayloadHash.js +4 -1
- package/node_modules/@smithy/signature-v4/dist-es/headerUtil.js +10 -3
- package/node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js +4 -1
- package/node_modules/@smithy/signature-v4/dist-es/prepareRequest.js +4 -1
- package/node_modules/@smithy/signature-v4/package.json +2 -2
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
- package/node_modules/typebox/build/system/memory/create.mjs +3 -4
- package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
- package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
- package/node_modules/typebox/build/system/memory/update.mjs +3 -2
- package/node_modules/typebox/package.json +1 -1
- package/package.json +110 -108
- package/dist/core/radius.d.ts +0 -2
- package/dist/core/radius.d.ts.map +0 -1
- package/dist/core/radius.js +0 -2
- package/dist/core/radius.js.map +0 -1
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/LICENSE +0 -201
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/README.md +0 -62
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +0 -154
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/constants.js +0 -2
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromEnvSigningName.js +0 -16
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +0 -80
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromStatic.js +0 -8
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js +0 -11
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js +0 -10
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/index.js +0 -4
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/nodeProvider.js +0 -5
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js +0 -7
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js +0 -7
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js +0 -8
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/constants.d.ts +0 -8
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/fromEnvSigningName.d.ts +0 -18
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/fromSso.d.ts +0 -12
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/fromStatic.d.ts +0 -9
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/getNewSsoOidcToken.d.ts +0 -8
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/getSsoOidcClient.d.ts +0 -7
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/index.d.ts +0 -7
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/nodeProvider.d.ts +0 -18
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/constants.d.ts +0 -3
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/fromEnvSigningName.d.ts +0 -8
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/fromSso.d.ts +0 -10
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/fromStatic.d.ts +0 -5
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/getNewSsoOidcToken.d.ts +0 -9
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/getSsoOidcClient.d.ts +0 -7
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/index.d.ts +0 -7
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/nodeProvider.d.ts +0 -3
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/validateTokenExpiry.d.ts +0 -2
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/validateTokenKey.d.ts +0 -1
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/writeSSOTokenToFile.d.ts +0 -2
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/validateTokenExpiry.d.ts +0 -5
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/validateTokenKey.d.ts +0 -4
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/writeSSOTokenToFile.d.ts +0 -5
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +0 -69
|
@@ -15,6 +15,14 @@ export declare class StreamingRevealController {
|
|
|
15
15
|
begin(component: StreamingRevealComponent, message: AssistantMessage): void;
|
|
16
16
|
setTarget(message: AssistantMessage): void;
|
|
17
17
|
resyncVisibility(): void;
|
|
18
|
+
/**
|
|
19
|
+
* True while this controller is the pacing writer for the given head message:
|
|
20
|
+
* smooth streaming is on, the head carries no toolCall block (those dump in
|
|
21
|
+
* full), and a component is still bound (before stop()). While true, callers
|
|
22
|
+
* must not overwrite the component's content, or the next reveal tick
|
|
23
|
+
* repaints a shorter prefix after their full write (dual-write flicker).
|
|
24
|
+
*/
|
|
25
|
+
isPacingHead(message: AssistantMessage): boolean;
|
|
18
26
|
stop(): void;
|
|
19
27
|
}
|
|
20
28
|
//# sourceMappingURL=streaming-reveal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streaming-reveal.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/streaming-reveal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAWnF,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAE7C,KAAK,wBAAwB,GAAG,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC;AAEjF,MAAM,MAAM,gCAAgC,GAAG;IAC9C,QAAQ,CAAC,kBAAkB,EAAE,MAAM,OAAO,CAAC;IAC3C,QAAQ,CAAC,qBAAqB,EAAE,MAAM,MAAM,CAAC;IAC7C,QAAQ,CAAC,oBAAoB,EAAE,MAAM,OAAO,CAAC;IAC7C,QAAQ,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AAEF,qBAAa,yBAAyB;;gBAqBzB,OAAO,EAAE,gCAAgC;IAOrD,KAAK,CAAC,SAAS,EAAE,wBAAwB,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAa3E,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAiB1C,gBAAgB,IAAI,IAAI;IAOxB,IAAI,IAAI,IAAI;CAkGZ"}
|
|
1
|
+
{"version":3,"file":"streaming-reveal.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/streaming-reveal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAWnF,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAE7C,KAAK,wBAAwB,GAAG,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC;AAEjF,MAAM,MAAM,gCAAgC,GAAG;IAC9C,QAAQ,CAAC,kBAAkB,EAAE,MAAM,OAAO,CAAC;IAC3C,QAAQ,CAAC,qBAAqB,EAAE,MAAM,MAAM,CAAC;IAC7C,QAAQ,CAAC,oBAAoB,EAAE,MAAM,OAAO,CAAC;IAC7C,QAAQ,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AAEF,qBAAa,yBAAyB;;gBAqBzB,OAAO,EAAE,gCAAgC;IAOrD,KAAK,CAAC,SAAS,EAAE,wBAAwB,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAa3E,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAiB1C,gBAAgB,IAAI,IAAI;IAOxB;;;;;;OAMG;IACH,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;IAKhD,IAAI,IAAI,IAAI;CAkGZ"}
|
|
@@ -64,6 +64,18 @@ export class StreamingRevealController {
|
|
|
64
64
|
this.#revealed = Math.min(this.#revealed, this.#visibleUnits(this.#target));
|
|
65
65
|
this.#applyTarget();
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* True while this controller is the pacing writer for the given head message:
|
|
69
|
+
* smooth streaming is on, the head carries no toolCall block (those dump in
|
|
70
|
+
* full), and a component is still bound (before stop()). While true, callers
|
|
71
|
+
* must not overwrite the component's content, or the next reveal tick
|
|
72
|
+
* repaints a shorter prefix after their full write (dual-write flicker).
|
|
73
|
+
*/
|
|
74
|
+
isPacingHead(message) {
|
|
75
|
+
if (!this.#target || !this.#component)
|
|
76
|
+
return false;
|
|
77
|
+
return this.#getSmoothStreaming() && !message.content.some((block) => block.type === "toolCall");
|
|
78
|
+
}
|
|
67
79
|
stop() {
|
|
68
80
|
this.#stopTimer();
|
|
69
81
|
this.#target = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streaming-reveal.js","sourceRoot":"","sources":["../../../src/modes/interactive/streaming-reveal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACzG,OAAO,EACN,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,QAAQ,EACR,iBAAiB,GACjB,MAAM,8BAA8B,CAAC;AAEtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAW7C,MAAM,OAAO,yBAAyB;IAC5B,mBAAmB,CAAgB;IACnC,sBAAsB,CAAe;IACrC,qBAAqB,CAAgB;IACrC,cAAc,CAAa;IAC3B,YAAY,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACtC,QAAQ,GAAG,CAAC,KAAa,EAAE,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACzF,QAAQ,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,KAAa,EAAU,EAAE,CAC1E,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7C,OAAO,CAA+B;IACtC,UAAU,CAAuC;IACjD,MAAM,CAA6B;IACnC,SAAS,CAAqB;IAC9B,SAAS,GAAG,CAAC,CAAC;IACd,WAAW,GAAG,CAAC,CAAC;IAChB,gBAAgB,CAAqB;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IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;YACpB,IAAI,CAAC,UAAU,EAAE,CAAC;QACnB,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { AssistantMessage } from \"@earendil-works/pi-ai\";\nimport type { AssistantMessageComponent } from \"./components/assistant-message.ts\";\nimport { BlockUnitCounter, buildDisplayMessage, countVisibleUnits } from \"./streaming-reveal-content.ts\";\nimport {\n\tDEFAULT_SMOOTH_FPS,\n\tINITIAL_BUFFER_MS,\n\tMAX_SMOOTH_FPS,\n\tMIN_SMOOTH_FPS,\n\tnextStep,\n\tupdateArrivalRate,\n} from \"./streaming-reveal-pacing.ts\";\n\nexport * from \"./streaming-reveal-content.ts\";\nexport * from \"./streaming-reveal-pacing.ts\";\n\ntype StreamingRevealComponent = Pick<AssistantMessageComponent, \"updateContent\">;\n\nexport type StreamingRevealControllerOptions = {\n\treadonly getSmoothStreaming: () => boolean;\n\treadonly getSmoothStreamingFps: () => number;\n\treadonly getHideThinkingBlock: () => boolean;\n\treadonly requestRender: () => void;\n};\n\nexport class StreamingRevealController {\n\treadonly #getSmoothStreaming: () => boolean;\n\treadonly #getSmoothStreamingFps: () => number;\n\treadonly #getHideThinkingBlock: () => boolean;\n\treadonly #requestRender: () => void;\n\treadonly #unitCounter = new BlockUnitCounter();\n\treadonly #countOf = (index: number, text: string): number => this.#unitCounter.count(index, text);\n\treadonly #sliceOf = (index: number, text: string, units: number): string =>\n\t\tthis.#unitCounter.slice(index, text, units);\n\t#target: AssistantMessage | undefined;\n\t#component: StreamingRevealComponent | undefined;\n\t#timer: NodeJS.Timeout | undefined;\n\t#timerFps: number | undefined;\n\t#revealed = 0;\n\t#lastTickAt = 0;\n\t#firstBufferedAt: number | undefined;\n\t#lastTargetAt: number | undefined;\n\t#arrivalRate = 90;\n\t#stepCarry = 0;\n\t#hideThinkingBlock = false;\n\n\tconstructor(options: StreamingRevealControllerOptions) {\n\t\tthis.#getSmoothStreaming = options.getSmoothStreaming;\n\t\tthis.#getSmoothStreamingFps = options.getSmoothStreamingFps;\n\t\tthis.#getHideThinkingBlock = options.getHideThinkingBlock;\n\t\tthis.#requestRender = options.requestRender;\n\t}\n\n\tbegin(component: StreamingRevealComponent, message: AssistantMessage): void {\n\t\tthis.stop();\n\t\tthis.#component = component;\n\t\tthis.#target = message;\n\t\tthis.#hideThinkingBlock = this.#getHideThinkingBlock();\n\t\tif (this.#visibleUnits(message) > 0) {\n\t\t\tconst now = performance.now();\n\t\t\tthis.#firstBufferedAt = now;\n\t\t\tthis.#lastTargetAt = now;\n\t\t}\n\t\tthis.#applyTarget();\n\t}\n\n\tsetTarget(message: AssistantMessage): void {\n\t\tconst now = performance.now();\n\t\tconst previousUnits = this.#target ? this.#visibleUnits(this.#target) : 0;\n\t\tthis.#target = message;\n\t\tthis.#hideThinkingBlock = this.#getHideThinkingBlock();\n\t\tconst total = this.#visibleUnits(message);\n\t\tconst appended = Math.max(0, total - previousUnits);\n\t\tif (appended > 0) {\n\t\t\tif (this.#firstBufferedAt === undefined) this.#firstBufferedAt = now;\n\t\t\tif (this.#lastTargetAt !== undefined && now > this.#lastTargetAt) {\n\t\t\t\tthis.#arrivalRate = updateArrivalRate(this.#arrivalRate, appended, now - this.#lastTargetAt);\n\t\t\t}\n\t\t\tthis.#lastTargetAt = now;\n\t\t}\n\t\tif (this.#component) this.#applyTarget();\n\t}\n\n\tresyncVisibility(): void {\n\t\tif (!this.#target || !this.#component) return;\n\t\tthis.#hideThinkingBlock = this.#getHideThinkingBlock();\n\t\tthis.#revealed = Math.min(this.#revealed, this.#visibleUnits(this.#target));\n\t\tthis.#applyTarget();\n\t}\n\n\tstop(): void {\n\t\tthis.#stopTimer();\n\t\tthis.#target = undefined;\n\t\tthis.#component = undefined;\n\t\tthis.#revealed = 0;\n\t\tthis.#lastTickAt = 0;\n\t\tthis.#unitCounter.reset();\n\t\tthis.#firstBufferedAt = undefined;\n\t\tthis.#lastTargetAt = undefined;\n\t\tthis.#arrivalRate = 90;\n\t\tthis.#stepCarry = 0;\n\t}\n\n\t#applyTarget(): void {\n\t\tconst target = this.#target;\n\t\tconst component = this.#component;\n\t\tif (!target || !component) return;\n\t\tconst total = this.#visibleUnits(target);\n\t\tif (!this.#getSmoothStreaming() || target.content.some((block) => block.type === \"toolCall\")) {\n\t\t\tthis.#revealed = total;\n\t\t\tthis.#stepCarry = 0;\n\t\t\tthis.#stopTimer();\n\t\t\tcomponent.updateContent(target);\n\t\t\treturn;\n\t\t}\n\t\tthis.#revealed = Math.min(this.#revealed, total);\n\t\tthis.#renderCurrent();\n\t\tthis.#syncTimer(total);\n\t}\n\n\t#visibleUnits(message: AssistantMessage): number {\n\t\treturn countVisibleUnits(message, this.#hideThinkingBlock, this.#countOf);\n\t}\n\n\t#renderCurrent(): void {\n\t\tif (!this.#target || !this.#component) return;\n\t\tthis.#component.updateContent(\n\t\t\tbuildDisplayMessage(this.#target, this.#revealed, this.#hideThinkingBlock, this.#countOf, this.#sliceOf),\n\t\t);\n\t}\n\n\t#syncTimer(total: number): void {\n\t\tif (this.#revealed >= total) {\n\t\t\tthis.#stepCarry = 0;\n\t\t\tthis.#stopTimer();\n\t\t\treturn;\n\t\t}\n\t\tthis.#startTimer();\n\t}\n\n\t#startTimer(): void {\n\t\tconst configuredFps = this.#getSmoothStreamingFps();\n\t\tconst fps = Number.isFinite(configuredFps)\n\t\t\t? Math.min(MAX_SMOOTH_FPS, Math.max(MIN_SMOOTH_FPS, configuredFps))\n\t\t\t: DEFAULT_SMOOTH_FPS;\n\t\tif (this.#timer && this.#timerFps === fps) return;\n\t\tthis.#stopTimer();\n\t\tthis.#lastTickAt = performance.now();\n\t\tconst timer = setInterval(() => this.#tick(), 1000 / fps);\n\t\ttimer.unref();\n\t\tthis.#timer = timer;\n\t\tthis.#timerFps = fps;\n\t}\n\n\t#stopTimer(): void {\n\t\tif (this.#timer) clearInterval(this.#timer);\n\t\tthis.#timer = undefined;\n\t\tthis.#timerFps = undefined;\n\t}\n\n\t#tick(): void {\n\t\tconst target = this.#target;\n\t\tif (!target || !this.#component) {\n\t\t\tthis.stop();\n\t\t\treturn;\n\t\t}\n\t\tconst total = this.#visibleUnits(target);\n\t\tif (this.#revealed >= total) {\n\t\t\tthis.#stepCarry = 0;\n\t\t\tthis.#stopTimer();\n\t\t\treturn;\n\t\t}\n\t\tconst now = performance.now();\n\t\tconst dt = now - this.#lastTickAt;\n\t\tthis.#lastTickAt = now;\n\t\tif (this.#firstBufferedAt !== undefined && now - this.#firstBufferedAt < INITIAL_BUFFER_MS) return;\n\t\tthis.#stepCarry += nextStep(total - this.#revealed, dt, this.#arrivalRate);\n\t\tconst wholeStep = Math.floor(this.#stepCarry);\n\t\tif (wholeStep <= 0) return;\n\t\tthis.#stepCarry -= wholeStep;\n\t\tthis.#revealed = Math.min(total, this.#revealed + wholeStep);\n\t\tthis.#renderCurrent();\n\t\tthis.#requestRender();\n\t\tif (this.#revealed >= total) {\n\t\t\tthis.#stepCarry = 0;\n\t\t\tthis.#stopTimer();\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"streaming-reveal.js","sourceRoot":"","sources":["../../../src/modes/interactive/streaming-reveal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACzG,OAAO,EACN,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,QAAQ,EACR,iBAAiB,GACjB,MAAM,8BAA8B,CAAC;AAEtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAW7C,MAAM,OAAO,yBAAyB;IAC5B,mBAAmB,CAAgB;IACnC,sBAAsB,CAAe;IACrC,qBAAqB,CAAgB;IACrC,cAAc,CAAa;IAC3B,YAAY,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACtC,QAAQ,GAAG,CAAC,KAAa,EAAE,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,C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G,CAAC;QACvB,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS,IAAI,GAAG,GAAG,IAAI,CAAC,gBAAgB,GAAG,iBAAiB;YAAE,OAAO;QACnG,IAAI,CAAC,UAAU,IAAI,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3E,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9C,IAAI,SAAS,IAAI,CAAC;YAAE,OAAO;QAC3B,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;QAC7D,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,IAAI,CAAC,SAAS,IAAI,KAAK,EAAE,CAAC;YAC7B,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;YACpB,IAAI,CAAC,UAAU,EAAE,CAAC;QACnB,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { AssistantMessage } from \"@earendil-works/pi-ai\";\nimport type { AssistantMessageComponent } from \"./components/assistant-message.ts\";\nimport { BlockUnitCounter, buildDisplayMessage, countVisibleUnits } from \"./streaming-reveal-content.ts\";\nimport {\n\tDEFAULT_SMOOTH_FPS,\n\tINITIAL_BUFFER_MS,\n\tMAX_SMOOTH_FPS,\n\tMIN_SMOOTH_FPS,\n\tnextStep,\n\tupdateArrivalRate,\n} from \"./streaming-reveal-pacing.ts\";\n\nexport * from \"./streaming-reveal-content.ts\";\nexport * from \"./streaming-reveal-pacing.ts\";\n\ntype StreamingRevealComponent = Pick<AssistantMessageComponent, \"updateContent\">;\n\nexport type StreamingRevealControllerOptions = {\n\treadonly getSmoothStreaming: () => boolean;\n\treadonly getSmoothStreamingFps: () => number;\n\treadonly getHideThinkingBlock: () => boolean;\n\treadonly requestRender: () => void;\n};\n\nexport class StreamingRevealController {\n\treadonly #getSmoothStreaming: () => boolean;\n\treadonly #getSmoothStreamingFps: () => number;\n\treadonly #getHideThinkingBlock: () => boolean;\n\treadonly #requestRender: () => void;\n\treadonly #unitCounter = new BlockUnitCounter();\n\treadonly #countOf = (index: number, text: string): number => this.#unitCounter.count(index, text);\n\treadonly #sliceOf = (index: number, text: string, units: number): string =>\n\t\tthis.#unitCounter.slice(index, text, units);\n\t#target: AssistantMessage | undefined;\n\t#component: StreamingRevealComponent | undefined;\n\t#timer: NodeJS.Timeout | undefined;\n\t#timerFps: number | undefined;\n\t#revealed = 0;\n\t#lastTickAt = 0;\n\t#firstBufferedAt: number | undefined;\n\t#lastTargetAt: number | undefined;\n\t#arrivalRate = 90;\n\t#stepCarry = 0;\n\t#hideThinkingBlock = false;\n\n\tconstructor(options: StreamingRevealControllerOptions) {\n\t\tthis.#getSmoothStreaming = options.getSmoothStreaming;\n\t\tthis.#getSmoothStreamingFps = options.getSmoothStreamingFps;\n\t\tthis.#getHideThinkingBlock = options.getHideThinkingBlock;\n\t\tthis.#requestRender = options.requestRender;\n\t}\n\n\tbegin(component: StreamingRevealComponent, message: AssistantMessage): void {\n\t\tthis.stop();\n\t\tthis.#component = component;\n\t\tthis.#target = message;\n\t\tthis.#hideThinkingBlock = this.#getHideThinkingBlock();\n\t\tif (this.#visibleUnits(message) > 0) {\n\t\t\tconst now = performance.now();\n\t\t\tthis.#firstBufferedAt = now;\n\t\t\tthis.#lastTargetAt = now;\n\t\t}\n\t\tthis.#applyTarget();\n\t}\n\n\tsetTarget(message: AssistantMessage): void {\n\t\tconst now = performance.now();\n\t\tconst previousUnits = this.#target ? this.#visibleUnits(this.#target) : 0;\n\t\tthis.#target = message;\n\t\tthis.#hideThinkingBlock = this.#getHideThinkingBlock();\n\t\tconst total = this.#visibleUnits(message);\n\t\tconst appended = Math.max(0, total - previousUnits);\n\t\tif (appended > 0) {\n\t\t\tif (this.#firstBufferedAt === undefined) this.#firstBufferedAt = now;\n\t\t\tif (this.#lastTargetAt !== undefined && now > this.#lastTargetAt) {\n\t\t\t\tthis.#arrivalRate = updateArrivalRate(this.#arrivalRate, appended, now - this.#lastTargetAt);\n\t\t\t}\n\t\t\tthis.#lastTargetAt = now;\n\t\t}\n\t\tif (this.#component) this.#applyTarget();\n\t}\n\n\tresyncVisibility(): void {\n\t\tif (!this.#target || !this.#component) return;\n\t\tthis.#hideThinkingBlock = this.#getHideThinkingBlock();\n\t\tthis.#revealed = Math.min(this.#revealed, this.#visibleUnits(this.#target));\n\t\tthis.#applyTarget();\n\t}\n\n\t/**\n\t * True while this controller is the pacing writer for the given head message:\n\t * smooth streaming is on, the head carries no toolCall block (those dump in\n\t * full), and a component is still bound (before stop()). While true, callers\n\t * must not overwrite the component's content, or the next reveal tick\n\t * repaints a shorter prefix after their full write (dual-write flicker).\n\t */\n\tisPacingHead(message: AssistantMessage): boolean {\n\t\tif (!this.#target || !this.#component) return false;\n\t\treturn this.#getSmoothStreaming() && !message.content.some((block) => block.type === \"toolCall\");\n\t}\n\n\tstop(): void {\n\t\tthis.#stopTimer();\n\t\tthis.#target = undefined;\n\t\tthis.#component = undefined;\n\t\tthis.#revealed = 0;\n\t\tthis.#lastTickAt = 0;\n\t\tthis.#unitCounter.reset();\n\t\tthis.#firstBufferedAt = undefined;\n\t\tthis.#lastTargetAt = undefined;\n\t\tthis.#arrivalRate = 90;\n\t\tthis.#stepCarry = 0;\n\t}\n\n\t#applyTarget(): void {\n\t\tconst target = this.#target;\n\t\tconst component = this.#component;\n\t\tif (!target || !component) return;\n\t\tconst total = this.#visibleUnits(target);\n\t\tif (!this.#getSmoothStreaming() || target.content.some((block) => block.type === \"toolCall\")) {\n\t\t\tthis.#revealed = total;\n\t\t\tthis.#stepCarry = 0;\n\t\t\tthis.#stopTimer();\n\t\t\tcomponent.updateContent(target);\n\t\t\treturn;\n\t\t}\n\t\tthis.#revealed = Math.min(this.#revealed, total);\n\t\tthis.#renderCurrent();\n\t\tthis.#syncTimer(total);\n\t}\n\n\t#visibleUnits(message: AssistantMessage): number {\n\t\treturn countVisibleUnits(message, this.#hideThinkingBlock, this.#countOf);\n\t}\n\n\t#renderCurrent(): void {\n\t\tif (!this.#target || !this.#component) return;\n\t\tthis.#component.updateContent(\n\t\t\tbuildDisplayMessage(this.#target, this.#revealed, this.#hideThinkingBlock, this.#countOf, this.#sliceOf),\n\t\t);\n\t}\n\n\t#syncTimer(total: number): void {\n\t\tif (this.#revealed >= total) {\n\t\t\tthis.#stepCarry = 0;\n\t\t\tthis.#stopTimer();\n\t\t\treturn;\n\t\t}\n\t\tthis.#startTimer();\n\t}\n\n\t#startTimer(): void {\n\t\tconst configuredFps = this.#getSmoothStreamingFps();\n\t\tconst fps = Number.isFinite(configuredFps)\n\t\t\t? Math.min(MAX_SMOOTH_FPS, Math.max(MIN_SMOOTH_FPS, configuredFps))\n\t\t\t: DEFAULT_SMOOTH_FPS;\n\t\tif (this.#timer && this.#timerFps === fps) return;\n\t\tthis.#stopTimer();\n\t\tthis.#lastTickAt = performance.now();\n\t\tconst timer = setInterval(() => this.#tick(), 1000 / fps);\n\t\ttimer.unref();\n\t\tthis.#timer = timer;\n\t\tthis.#timerFps = fps;\n\t}\n\n\t#stopTimer(): void {\n\t\tif (this.#timer) clearInterval(this.#timer);\n\t\tthis.#timer = undefined;\n\t\tthis.#timerFps = undefined;\n\t}\n\n\t#tick(): void {\n\t\tconst target = this.#target;\n\t\tif (!target || !this.#component) {\n\t\t\tthis.stop();\n\t\t\treturn;\n\t\t}\n\t\tconst total = this.#visibleUnits(target);\n\t\tif (this.#revealed >= total) {\n\t\t\tthis.#stepCarry = 0;\n\t\t\tthis.#stopTimer();\n\t\t\treturn;\n\t\t}\n\t\tconst now = performance.now();\n\t\tconst dt = now - this.#lastTickAt;\n\t\tthis.#lastTickAt = now;\n\t\tif (this.#firstBufferedAt !== undefined && now - this.#firstBufferedAt < INITIAL_BUFFER_MS) return;\n\t\tthis.#stepCarry += nextStep(total - this.#revealed, dt, this.#arrivalRate);\n\t\tconst wholeStep = Math.floor(this.#stepCarry);\n\t\tif (wholeStep <= 0) return;\n\t\tthis.#stepCarry -= wholeStep;\n\t\tthis.#revealed = Math.min(total, this.#revealed + wholeStep);\n\t\tthis.#renderCurrent();\n\t\tthis.#requestRender();\n\t\tif (this.#revealed >= total) {\n\t\t\tthis.#stepCarry = 0;\n\t\t\tthis.#stopTimer();\n\t\t}\n\t}\n}\n"]}
|
|
@@ -3,27 +3,30 @@ import type { AgentSessionEvent } from "../core/agent-session.ts";
|
|
|
3
3
|
type WithoutPartial<T> = T extends {
|
|
4
4
|
partial: unknown;
|
|
5
5
|
} ? Omit<T, "partial"> : T;
|
|
6
|
-
type
|
|
6
|
+
type ToJsonAssistantMessageEvent<T> = T extends {
|
|
7
|
+
type: "toolcall_start";
|
|
8
|
+
partial: unknown;
|
|
9
|
+
} ? WithoutPartial<T> & {
|
|
10
|
+
id: string;
|
|
11
|
+
toolName: string;
|
|
12
|
+
} : WithoutPartial<T>;
|
|
13
|
+
type MessageUpdateEvent = Extract<AgentSessionEvent, {
|
|
7
14
|
type: "message_update";
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
}>;
|
|
16
|
+
type JsonMessageUpdateEvent = {
|
|
10
17
|
type: "message_update";
|
|
11
18
|
usage: Usage;
|
|
12
|
-
assistantMessageEvent:
|
|
13
|
-
}
|
|
19
|
+
assistantMessageEvent: ToJsonAssistantMessageEvent<MessageUpdateEvent["assistantMessageEvent"]>;
|
|
20
|
+
};
|
|
14
21
|
/** Session event shape emitted by the JSON and RPC stdout protocols. */
|
|
15
|
-
export type JsonAgentSessionEvent =
|
|
16
|
-
type MessageUpdateEvent = Extract<AgentSessionEvent, {
|
|
22
|
+
export type JsonAgentSessionEvent = Exclude<AgentSessionEvent, {
|
|
17
23
|
type: "message_update";
|
|
18
|
-
}
|
|
19
|
-
type JsonMessageUpdateEvent = Extract<JsonAgentSessionEvent, {
|
|
20
|
-
type: "message_update";
|
|
21
|
-
}>;
|
|
24
|
+
}> | JsonMessageUpdateEvent;
|
|
22
25
|
/**
|
|
23
26
|
* Remove cumulative assistant snapshots from streaming wire events.
|
|
24
27
|
* `message_start` provides the initial message, deltas build it, and
|
|
25
|
-
* `message_end` provides the final authoritative message. Cumulative usage
|
|
26
|
-
*
|
|
28
|
+
* `message_end` provides the final authoritative message. Cumulative usage,
|
|
29
|
+
* tool-call ids, and tool names remain available because their size is constant.
|
|
27
30
|
*/
|
|
28
31
|
export declare function toJsonEvent(event: MessageUpdateEvent): JsonMessageUpdateEvent;
|
|
29
32
|
export declare function toJsonEvent(event: AgentSessionEvent): JsonAgentSessionEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-event.d.ts","sourceRoot":"","sources":["../../src/modes/json-event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;AAEjF,KAAK,
|
|
1
|
+
{"version":3,"file":"json-event.d.ts","sourceRoot":"","sources":["../../src/modes/json-event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;AAEjF,KAAK,2BAA2B,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GACzF,cAAc,CAAC,CAAC,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACpD,cAAc,CAAC,CAAC,CAAC,CAAC;AAErB,KAAK,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,EAAE;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAAC;AACjF,KAAK,sBAAsB,GAAG;IAC7B,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,qBAAqB,EAAE,2BAA2B,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAC,CAAC;CAChG,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,EAAE;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC,GAAG,sBAAsB,CAAC;AAsBpH;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,kBAAkB,GAAG,sBAAsB,CAAC;AAC/E,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,qBAAqB,CAAC"}
|
package/dist/modes/json-event.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
function toJsonAssistantMessageEvent(event) {
|
|
2
|
+
if (event.type === "toolcall_start") {
|
|
3
|
+
const toolCall = event.partial.content[event.contentIndex];
|
|
4
|
+
if (toolCall?.type !== "toolCall") {
|
|
5
|
+
throw new Error(`toolcall_start content at index ${event.contentIndex} is not a tool call`);
|
|
6
|
+
}
|
|
7
|
+
const { partial: _partial, ...deltaEvent } = event;
|
|
8
|
+
return { ...deltaEvent, id: toolCall.id, toolName: toolCall.name };
|
|
9
|
+
}
|
|
10
|
+
if (!("partial" in event)) {
|
|
11
|
+
return event;
|
|
12
|
+
}
|
|
13
|
+
const { partial: _partial, ...deltaEvent } = event;
|
|
14
|
+
return deltaEvent;
|
|
15
|
+
}
|
|
1
16
|
export function toJsonEvent(event) {
|
|
2
17
|
if (event.type !== "message_update") {
|
|
3
18
|
return event;
|
|
@@ -5,11 +20,10 @@ export function toJsonEvent(event) {
|
|
|
5
20
|
if (event.message.role !== "assistant") {
|
|
6
21
|
throw new Error("message_update message is not an assistant message");
|
|
7
22
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return { type: "message_update", usage: event.message.usage, assistantMessageEvent: deltaEvent };
|
|
23
|
+
return {
|
|
24
|
+
type: "message_update",
|
|
25
|
+
usage: event.message.usage,
|
|
26
|
+
assistantMessageEvent: toJsonAssistantMessageEvent(event.assistantMessageEvent),
|
|
27
|
+
};
|
|
14
28
|
}
|
|
15
29
|
//# sourceMappingURL=json-event.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-event.js","sourceRoot":"","sources":["../../src/modes/json-event.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-event.js","sourceRoot":"","sources":["../../src/modes/json-event.ts"],"names":[],"mappings":"AAmBA,SAAS,2BAA2B,CACnC,KAAkD;IAElD,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC3D,IAAI,QAAQ,EAAE,IAAI,KAAK,UAAU,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,mCAAmC,KAAK,CAAC,YAAY,qBAAqB,CAAC,CAAC;QAC7F,CAAC;QACD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;QACnD,OAAO,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;IACpE,CAAC;IAED,IAAI,CAAC,CAAC,SAAS,IAAI,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACd,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACnD,OAAO,UAAU,CAAC;AACnB,CAAC;AAUD,MAAM,UAAU,WAAW,CAAC,KAAwB;IACnD,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC;IACd,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACvE,CAAC;IAED,OAAO;QACN,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;QAC1B,qBAAqB,EAAE,2BAA2B,CAAC,KAAK,CAAC,qBAAqB,CAAC;KAC/E,CAAC;AACH,CAAC","sourcesContent":["import type { Usage } from \"@earendil-works/pi-ai\";\nimport type { AgentSessionEvent } from \"../core/agent-session.ts\";\n\ntype WithoutPartial<T> = T extends { partial: unknown } ? Omit<T, \"partial\"> : T;\n\ntype ToJsonAssistantMessageEvent<T> = T extends { type: \"toolcall_start\"; partial: unknown }\n\t? WithoutPartial<T> & { id: string; toolName: string }\n\t: WithoutPartial<T>;\n\ntype MessageUpdateEvent = Extract<AgentSessionEvent, { type: \"message_update\" }>;\ntype JsonMessageUpdateEvent = {\n\ttype: \"message_update\";\n\tusage: Usage;\n\tassistantMessageEvent: ToJsonAssistantMessageEvent<MessageUpdateEvent[\"assistantMessageEvent\"]>;\n};\n\n/** Session event shape emitted by the JSON and RPC stdout protocols. */\nexport type JsonAgentSessionEvent = Exclude<AgentSessionEvent, { type: \"message_update\" }> | JsonMessageUpdateEvent;\n\nfunction toJsonAssistantMessageEvent(\n\tevent: MessageUpdateEvent[\"assistantMessageEvent\"],\n): JsonMessageUpdateEvent[\"assistantMessageEvent\"] {\n\tif (event.type === \"toolcall_start\") {\n\t\tconst toolCall = event.partial.content[event.contentIndex];\n\t\tif (toolCall?.type !== \"toolCall\") {\n\t\t\tthrow new Error(`toolcall_start content at index ${event.contentIndex} is not a tool call`);\n\t\t}\n\t\tconst { partial: _partial, ...deltaEvent } = event;\n\t\treturn { ...deltaEvent, id: toolCall.id, toolName: toolCall.name };\n\t}\n\n\tif (!(\"partial\" in event)) {\n\t\treturn event;\n\t}\n\n\tconst { partial: _partial, ...deltaEvent } = event;\n\treturn deltaEvent;\n}\n\n/**\n * Remove cumulative assistant snapshots from streaming wire events.\n * `message_start` provides the initial message, deltas build it, and\n * `message_end` provides the final authoritative message. Cumulative usage,\n * tool-call ids, and tool names remain available because their size is constant.\n */\nexport function toJsonEvent(event: MessageUpdateEvent): JsonMessageUpdateEvent;\nexport function toJsonEvent(event: AgentSessionEvent): JsonAgentSessionEvent;\nexport function toJsonEvent(event: AgentSessionEvent): JsonAgentSessionEvent {\n\tif (event.type !== \"message_update\") {\n\t\treturn event;\n\t}\n\tif (event.message.role !== \"assistant\") {\n\t\tthrow new Error(\"message_update message is not an assistant message\");\n\t}\n\n\treturn {\n\t\ttype: \"message_update\",\n\t\tusage: event.message.usage,\n\t\tassistantMessageEvent: toJsonAssistantMessageEvent(event.assistantMessageEvent),\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-handler.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/connection-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAwC/E,OAAO,KAAK,EAWX,eAAe,EAEf,MAAM,gBAAgB,CAAC;AAGxB,kFA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C;AAGxB,kFAAkF;AAClF,MAAM,WAAW,oBAAoB;IACpC,mFAAmF;IACnF,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,0DAA0D;IAC1D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,sEAAsE;IACtE,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C;;;OAGG;IACH,mBAAmB,IAAI,OAAO,CAAC;IAC/B,iFAAiF;IACjF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AA4BD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,eAAe,CAiB3E;AA4BD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACzC,WAAW,EAAE,mBAAmB,EAChC,IAAI,EAAE,iBAAiB,EACvB,OAAO,GAAE,oBAAyB,GAChC,oBAAoB,CA8hCtB"}
|
|
@@ -614,6 +614,9 @@ export function createRpcConnectionHandler(runtimeHost, sink, options = {}) {
|
|
|
614
614
|
await session.abort();
|
|
615
615
|
return success(id, "abort");
|
|
616
616
|
}
|
|
617
|
+
case "clear_queue": {
|
|
618
|
+
return success(id, "clear_queue", session.clearQueue());
|
|
619
|
+
}
|
|
617
620
|
case "new_session": {
|
|
618
621
|
const options = command.parentSession ? { parentSession: command.parentSession } : undefined;
|
|
619
622
|
const result = await runtimeHost.newSession(options);
|