@code-yeongyu/senpi 2026.5.20-3 → 2026.5.21
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 +26 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -10
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -4
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +2 -3
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts +21 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -0
- package/dist/core/http-dispatcher.js +48 -0
- package/dist/core/http-dispatcher.js.map +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +2 -1
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +3 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +20 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +15 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +10 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/senpi +4 -10
- package/dist/utils/paths.d.ts +1 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +16 -0
- package/dist/utils/paths.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +3 -3
- package/node_modules/@earendil-works/pi-agent-core/README.md +488 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +24 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +610 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +120 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +405 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +92 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +904 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +53 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +174 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +95 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +533 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts +25 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +131 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts +51 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +486 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +52 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +102 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts +48 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +230 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts +26 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +101 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts +33 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +231 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts +18 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +42 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts +25 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +114 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts +11 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +39 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +32 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +197 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js +50 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts +44 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +311 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts +3 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +30 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +604 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +103 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +14 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +126 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts +70 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +290 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +20 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js +25 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts +3 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/node.js +3 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/node.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +69 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +278 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +394 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.js +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/package.json +61 -0
- package/node_modules/@earendil-works/pi-ai/README.md +1386 -0
- package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts +20 -0
- package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api-registry.js +44 -0
- package/node_modules/@earendil-works/pi-ai/dist/api-registry.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts +5 -0
- package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/cli.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/cli.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/cli.js +116 -0
- package/node_modules/@earendil-works/pi-ai/dist/cli.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts +18 -0
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +178 -0
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts +10 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +440 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +442 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.js +23 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts +14 -0
- package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js +22 -0
- package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/images.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/images.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/images.js +14 -0
- package/node_modules/@earendil-works/pi-ai/dist/images.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +33 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.js +21 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +37 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +17658 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +16510 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.js +114 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/oauth.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/oauth.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts +38 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +787 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts +52 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +1127 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +229 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts +13 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js +26 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +66 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +401 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js +29 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts +73 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js +359 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js +465 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts +13 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.js +431 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +129 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js +34 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts +25 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js +542 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts +30 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +1112 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts +22 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +977 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js +10 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js +579 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts +13 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +651 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts +35 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js +254 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts +38 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +174 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts +16 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js +186 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/session-resources.js +22 -0
- package/node_modules/@earendil-works/pi-ai/dist/session-resources.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/stream.js +42 -0
- package/node_modules/@earendil-works/pi-ai/dist/stream.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts +22 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js +161 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts +13 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js +23 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.d.ts +21 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.js +559 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.d.ts +21 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.js +69 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.d.ts +12 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.js +570 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.d.ts +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.js +935 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.d.ts +14 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.js +54 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.d.ts +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.js +295 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.js +336 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts +103 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +543 -0
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/types.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js +25 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +21 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +81 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/hash.js +14 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/hash.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts +16 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js +113 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts +10 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js +97 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts +25 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js +335 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts +30 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +292 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts +57 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js +121 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.js +105 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts +34 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +385 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.d.ts +13 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.js +31 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts +57 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +56 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +151 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts +22 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js +26 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.d.ts +5 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.js +49 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts +17 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js +21 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts +18 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js +281 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/package.json +113 -0
- package/node_modules/@earendil-works/pi-tui/README.md +779 -0
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +54 -0
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +632 -0
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +22 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js +104 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +22 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js +35 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +249 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +1916 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +28 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/image.js +89 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +37 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js +426 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +40 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +95 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +90 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +634 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +50 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +159 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +50 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +185 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +12 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js +23 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +19 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/text.js +89 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +13 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js +51 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +39 -0
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.js +2 -0
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +16 -0
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +110 -0
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +23 -0
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/index.js +32 -0
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +193 -0
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +174 -0
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +184 -0
- package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/keys.js +1173 -0
- package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts +28 -0
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js +44 -0
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +50 -0
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +361 -0
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +90 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +336 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +88 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +329 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +231 -0
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +1230 -0
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts +17 -0
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js +25 -0
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +79 -0
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +1031 -0
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/package.json +48 -0
- package/node_modules/@smithy/node-http-handler/LICENSE +201 -0
- package/node_modules/@smithy/node-http-handler/README.md +9 -0
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +724 -0
- package/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
- package/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +9 -0
- package/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +216 -0
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +87 -0
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +32 -0
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +170 -0
- package/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +21 -0
- package/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +88 -0
- package/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
- package/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
- package/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
- package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
- package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +8 -0
- package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +41 -0
- package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +21 -0
- package/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
- package/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +56 -0
- package/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +5 -0
- package/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +4 -0
- package/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +3 -0
- package/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +46 -0
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +24 -0
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +12 -0
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +63 -0
- package/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +13 -0
- package/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +12 -0
- package/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +2 -0
- package/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +6 -0
- package/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +6 -0
- package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +2 -0
- package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +5 -0
- package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +6 -0
- package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +13 -0
- package/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +8 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +5 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +4 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +3 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +46 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +24 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +12 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +63 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +13 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +12 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +2 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +6 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +6 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +2 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +5 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/index.d.ts +6 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +13 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +8 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +11 -0
- package/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +11 -0
- package/node_modules/@smithy/node-http-handler/package.json +68 -0
- package/node_modules/@smithy/types/LICENSE +201 -0
- package/node_modules/@smithy/types/README.md +115 -0
- package/node_modules/@smithy/types/dist-cjs/index.js +91 -0
- package/node_modules/@smithy/types/dist-es/abort-handler.js +1 -0
- package/node_modules/@smithy/types/dist-es/abort.js +1 -0
- package/node_modules/@smithy/types/dist-es/auth/HttpApiKeyAuth.js +5 -0
- package/node_modules/@smithy/types/dist-es/auth/HttpAuthScheme.js +1 -0
- package/node_modules/@smithy/types/dist-es/auth/HttpAuthSchemeProvider.js +1 -0
- package/node_modules/@smithy/types/dist-es/auth/HttpSigner.js +1 -0
- package/node_modules/@smithy/types/dist-es/auth/IdentityProviderConfig.js +1 -0
- package/node_modules/@smithy/types/dist-es/auth/auth.js +5 -0
- package/node_modules/@smithy/types/dist-es/auth/index.js +6 -0
- package/node_modules/@smithy/types/dist-es/blob/blob-payload-input-types.js +1 -0
- package/node_modules/@smithy/types/dist-es/checksum.js +1 -0
- package/node_modules/@smithy/types/dist-es/client.js +1 -0
- package/node_modules/@smithy/types/dist-es/command.js +1 -0
- package/node_modules/@smithy/types/dist-es/connection/config.js +1 -0
- package/node_modules/@smithy/types/dist-es/connection/index.js +3 -0
- package/node_modules/@smithy/types/dist-es/connection/manager.js +1 -0
- package/node_modules/@smithy/types/dist-es/connection/pool.js +1 -0
- package/node_modules/@smithy/types/dist-es/crypto.js +1 -0
- package/node_modules/@smithy/types/dist-es/downlevel-ts3.4/transform/type-transform.js +1 -0
- package/node_modules/@smithy/types/dist-es/encode.js +1 -0
- package/node_modules/@smithy/types/dist-es/endpoint.js +5 -0
- package/node_modules/@smithy/types/dist-es/endpoints/EndpointRuleObject.js +1 -0
- package/node_modules/@smithy/types/dist-es/endpoints/ErrorRuleObject.js +1 -0
- package/node_modules/@smithy/types/dist-es/endpoints/RuleSetObject.js +1 -0
- package/node_modules/@smithy/types/dist-es/endpoints/TreeRuleObject.js +1 -0
- package/node_modules/@smithy/types/dist-es/endpoints/index.js +5 -0
- package/node_modules/@smithy/types/dist-es/endpoints/shared.js +1 -0
- package/node_modules/@smithy/types/dist-es/eventStream.js +1 -0
- package/node_modules/@smithy/types/dist-es/extensions/checksum.js +38 -0
- package/node_modules/@smithy/types/dist-es/extensions/defaultClientConfiguration.js +7 -0
- package/node_modules/@smithy/types/dist-es/extensions/defaultExtensionConfiguration.js +1 -0
- package/node_modules/@smithy/types/dist-es/extensions/index.js +3 -0
- package/node_modules/@smithy/types/dist-es/extensions/retry.js +1 -0
- package/node_modules/@smithy/types/dist-es/externals-check/browser-externals-check.js +1 -0
- package/node_modules/@smithy/types/dist-es/feature-ids.js +1 -0
- package/node_modules/@smithy/types/dist-es/http/httpHandlerInitialization.js +1 -0
- package/node_modules/@smithy/types/dist-es/http.js +5 -0
- package/node_modules/@smithy/types/dist-es/identity/apiKeyIdentity.js +1 -0
- package/node_modules/@smithy/types/dist-es/identity/awsCredentialIdentity.js +1 -0
- package/node_modules/@smithy/types/dist-es/identity/identity.js +1 -0
- package/node_modules/@smithy/types/dist-es/identity/index.js +4 -0
- package/node_modules/@smithy/types/dist-es/identity/tokenIdentity.js +1 -0
- package/node_modules/@smithy/types/dist-es/index.js +42 -0
- package/node_modules/@smithy/types/dist-es/logger.js +1 -0
- package/node_modules/@smithy/types/dist-es/middleware.js +1 -0
- package/node_modules/@smithy/types/dist-es/pagination.js +1 -0
- package/node_modules/@smithy/types/dist-es/profile.js +6 -0
- package/node_modules/@smithy/types/dist-es/response.js +1 -0
- package/node_modules/@smithy/types/dist-es/retry.js +1 -0
- package/node_modules/@smithy/types/dist-es/schema/schema-deprecated.js +1 -0
- package/node_modules/@smithy/types/dist-es/schema/schema.js +1 -0
- package/node_modules/@smithy/types/dist-es/schema/sentinels.js +1 -0
- package/node_modules/@smithy/types/dist-es/schema/static-schemas.js +1 -0
- package/node_modules/@smithy/types/dist-es/schema/traits.js +1 -0
- package/node_modules/@smithy/types/dist-es/serde.js +1 -0
- package/node_modules/@smithy/types/dist-es/shapes.js +1 -0
- package/node_modules/@smithy/types/dist-es/signature.js +1 -0
- package/node_modules/@smithy/types/dist-es/stream.js +1 -0
- package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-common-types.js +1 -0
- package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-input-types.js +1 -0
- package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-output-types.js +1 -0
- package/node_modules/@smithy/types/dist-es/transfer.js +6 -0
- package/node_modules/@smithy/types/dist-es/transform/client-method-transforms.js +1 -0
- package/node_modules/@smithy/types/dist-es/transform/client-payload-blob-type-narrow.js +1 -0
- package/node_modules/@smithy/types/dist-es/transform/exact.js +1 -0
- package/node_modules/@smithy/types/dist-es/transform/mutable.js +1 -0
- package/node_modules/@smithy/types/dist-es/transform/no-undefined.js +1 -0
- package/node_modules/@smithy/types/dist-es/transform/type-transform.js +1 -0
- package/node_modules/@smithy/types/dist-es/uri.js +1 -0
- package/node_modules/@smithy/types/dist-es/util.js +1 -0
- package/node_modules/@smithy/types/dist-es/waiter.js +1 -0
- package/node_modules/@smithy/types/dist-types/abort-handler.d.ts +7 -0
- package/node_modules/@smithy/types/dist-types/abort.d.ts +50 -0
- package/node_modules/@smithy/types/dist-types/auth/HttpApiKeyAuth.d.ts +7 -0
- package/node_modules/@smithy/types/dist-types/auth/HttpAuthScheme.d.ts +49 -0
- package/node_modules/@smithy/types/dist-types/auth/HttpAuthSchemeProvider.d.ts +20 -0
- package/node_modules/@smithy/types/dist-types/auth/HttpSigner.d.ts +41 -0
- package/node_modules/@smithy/types/dist-types/auth/IdentityProviderConfig.d.ts +14 -0
- package/node_modules/@smithy/types/dist-types/auth/auth.d.ts +57 -0
- package/node_modules/@smithy/types/dist-types/auth/index.d.ts +6 -0
- package/node_modules/@smithy/types/dist-types/blob/blob-payload-input-types.d.ts +40 -0
- package/node_modules/@smithy/types/dist-types/checksum.d.ts +63 -0
- package/node_modules/@smithy/types/dist-types/client.d.ts +57 -0
- package/node_modules/@smithy/types/dist-types/command.d.ts +28 -0
- package/node_modules/@smithy/types/dist-types/connection/config.d.ts +10 -0
- package/node_modules/@smithy/types/dist-types/connection/index.d.ts +3 -0
- package/node_modules/@smithy/types/dist-types/connection/manager.d.ts +34 -0
- package/node_modules/@smithy/types/dist-types/connection/pool.d.ts +32 -0
- package/node_modules/@smithy/types/dist-types/crypto.d.ts +60 -0
- package/node_modules/@smithy/types/dist-types/downlevel-ts3.4/transform/type-transform.d.ts +25 -0
- package/node_modules/@smithy/types/dist-types/encode.d.ts +31 -0
- package/node_modules/@smithy/types/dist-types/endpoint.d.ts +77 -0
- package/node_modules/@smithy/types/dist-types/endpoints/EndpointRuleObject.d.ts +27 -0
- package/node_modules/@smithy/types/dist-types/endpoints/ErrorRuleObject.d.ts +10 -0
- package/node_modules/@smithy/types/dist-types/endpoints/RuleSetObject.d.ts +28 -0
- package/node_modules/@smithy/types/dist-types/endpoints/TreeRuleObject.d.ts +16 -0
- package/node_modules/@smithy/types/dist-types/endpoints/index.d.ts +5 -0
- package/node_modules/@smithy/types/dist-types/endpoints/shared.d.ts +55 -0
- package/node_modules/@smithy/types/dist-types/eventStream.d.ts +137 -0
- package/node_modules/@smithy/types/dist-types/extensions/checksum.d.ts +58 -0
- package/node_modules/@smithy/types/dist-types/extensions/defaultClientConfiguration.d.ts +33 -0
- package/node_modules/@smithy/types/dist-types/extensions/defaultExtensionConfiguration.d.ts +9 -0
- package/node_modules/@smithy/types/dist-types/extensions/index.d.ts +4 -0
- package/node_modules/@smithy/types/dist-types/extensions/retry.d.ts +18 -0
- package/node_modules/@smithy/types/dist-types/externals-check/browser-externals-check.d.ts +35 -0
- package/node_modules/@smithy/types/dist-types/feature-ids.d.ts +16 -0
- package/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts +128 -0
- package/node_modules/@smithy/types/dist-types/http.d.ts +112 -0
- package/node_modules/@smithy/types/dist-types/identity/apiKeyIdentity.d.ts +14 -0
- package/node_modules/@smithy/types/dist-types/identity/awsCredentialIdentity.d.ts +31 -0
- package/node_modules/@smithy/types/dist-types/identity/identity.d.ts +15 -0
- package/node_modules/@smithy/types/dist-types/identity/index.d.ts +4 -0
- package/node_modules/@smithy/types/dist-types/identity/tokenIdentity.d.ts +14 -0
- package/node_modules/@smithy/types/dist-types/index.d.ts +42 -0
- package/node_modules/@smithy/types/dist-types/logger.d.ts +13 -0
- package/node_modules/@smithy/types/dist-types/middleware.d.ts +534 -0
- package/node_modules/@smithy/types/dist-types/pagination.d.ts +33 -0
- package/node_modules/@smithy/types/dist-types/profile.d.ts +30 -0
- package/node_modules/@smithy/types/dist-types/response.d.ts +40 -0
- package/node_modules/@smithy/types/dist-types/retry.d.ts +133 -0
- package/node_modules/@smithy/types/dist-types/schema/schema-deprecated.d.ts +136 -0
- package/node_modules/@smithy/types/dist-types/schema/schema.d.ts +230 -0
- package/node_modules/@smithy/types/dist-types/schema/sentinels.d.ts +65 -0
- package/node_modules/@smithy/types/dist-types/schema/static-schemas.d.ts +82 -0
- package/node_modules/@smithy/types/dist-types/schema/traits.d.ts +46 -0
- package/node_modules/@smithy/types/dist-types/serde.d.ts +114 -0
- package/node_modules/@smithy/types/dist-types/shapes.d.ts +82 -0
- package/node_modules/@smithy/types/dist-types/signature.d.ts +155 -0
- package/node_modules/@smithy/types/dist-types/stream.d.ts +22 -0
- package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-common-types.d.ts +32 -0
- package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-input-types.d.ts +60 -0
- package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types.d.ts +51 -0
- package/node_modules/@smithy/types/dist-types/transfer.d.ts +41 -0
- package/node_modules/@smithy/types/dist-types/transform/client-method-transforms.d.ts +26 -0
- package/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts +77 -0
- package/node_modules/@smithy/types/dist-types/transform/exact.d.ts +6 -0
- package/node_modules/@smithy/types/dist-types/transform/mutable.d.ts +6 -0
- package/node_modules/@smithy/types/dist-types/transform/no-undefined.d.ts +68 -0
- package/node_modules/@smithy/types/dist-types/transform/type-transform.d.ts +34 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/abort-handler.d.ts +7 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/abort.d.ts +50 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpApiKeyAuth.d.ts +7 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthScheme.d.ts +49 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthSchemeProvider.d.ts +20 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpSigner.d.ts +41 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/auth/IdentityProviderConfig.d.ts +14 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/auth/auth.d.ts +57 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/auth/index.d.ts +6 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/blob/blob-payload-input-types.d.ts +40 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/checksum.d.ts +63 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/client.d.ts +57 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/command.d.ts +28 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/connection/config.d.ts +10 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/connection/index.d.ts +3 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/connection/manager.d.ts +34 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/connection/pool.d.ts +32 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/crypto.d.ts +60 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/downlevel-ts3.4/transform/type-transform.d.ts +41 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/encode.d.ts +31 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/endpoint.d.ts +77 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/EndpointRuleObject.d.ts +27 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/ErrorRuleObject.d.ts +10 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/RuleSetObject.d.ts +28 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/TreeRuleObject.d.ts +16 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/index.d.ts +5 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/shared.d.ts +55 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/eventStream.d.ts +137 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/extensions/checksum.d.ts +58 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultClientConfiguration.d.ts +33 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultExtensionConfiguration.d.ts +9 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/extensions/index.d.ts +4 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/extensions/retry.d.ts +18 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/externals-check/browser-externals-check.d.ts +35 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/feature-ids.d.ts +16 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/http/httpHandlerInitialization.d.ts +128 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/http.d.ts +112 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/identity/apiKeyIdentity.d.ts +14 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/identity/awsCredentialIdentity.d.ts +31 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/identity/identity.d.ts +15 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/identity/index.d.ts +4 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/identity/tokenIdentity.d.ts +14 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/index.d.ts +42 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/logger.d.ts +13 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/middleware.d.ts +534 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/pagination.d.ts +33 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/profile.d.ts +30 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/response.d.ts +40 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/retry.d.ts +133 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema-deprecated.d.ts +142 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +245 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/schema/sentinels.d.ts +65 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/schema/static-schemas.d.ts +101 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/schema/traits.d.ts +46 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/serde.d.ts +114 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/shapes.d.ts +82 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/signature.d.ts +155 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/stream.d.ts +22 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-common-types.d.ts +32 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-input-types.d.ts +60 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-output-types.d.ts +51 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/transfer.d.ts +41 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-method-transforms.d.ts +26 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-payload-blob-type-narrow.d.ts +81 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/transform/exact.d.ts +14 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/transform/mutable.d.ts +6 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/transform/no-undefined.d.ts +88 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/transform/type-transform.d.ts +41 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/uri.d.ts +17 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/util.d.ts +192 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/waiter.d.ts +35 -0
- package/node_modules/@smithy/types/dist-types/uri.d.ts +17 -0
- package/node_modules/@smithy/types/dist-types/util.d.ts +176 -0
- package/node_modules/@smithy/types/dist-types/waiter.d.ts +35 -0
- package/node_modules/@smithy/types/package.json +61 -0
- package/node_modules/marked/LICENSE.md +44 -0
- package/node_modules/marked/README.md +106 -0
- package/node_modules/marked/bin/main.js +282 -0
- package/node_modules/marked/bin/marked.js +15 -0
- package/node_modules/marked/lib/marked.cjs +2211 -0
- package/node_modules/marked/lib/marked.cjs.map +7 -0
- package/node_modules/marked/lib/marked.d.cts +728 -0
- package/node_modules/marked/lib/marked.d.ts +728 -0
- package/node_modules/marked/lib/marked.esm.js +2189 -0
- package/node_modules/marked/lib/marked.esm.js.map +7 -0
- package/node_modules/marked/lib/marked.umd.js +2213 -0
- package/node_modules/marked/lib/marked.umd.js.map +7 -0
- package/node_modules/marked/man/marked.1 +111 -0
- package/node_modules/marked/man/marked.1.md +92 -0
- package/node_modules/marked/marked.min.js +69 -0
- package/node_modules/marked/package.json +111 -0
- package/npm-shrinkwrap.json +1841 -0
- package/package.json +49 -31
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
function shouldEmitRawToolCallTextOnError(options) {
|
|
2
|
+
return options?.emitRawToolCallTextOnError === true;
|
|
3
|
+
}
|
|
4
|
+
const JSON_WHITESPACE_REGEX = /\s/;
|
|
5
|
+
function escapeRegExp(text) {
|
|
6
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7
|
+
}
|
|
8
|
+
function isRecord(value) {
|
|
9
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10
|
+
}
|
|
11
|
+
function normalizeToolNames(tools) {
|
|
12
|
+
return new Set(tools.map((tool) => tool.name));
|
|
13
|
+
}
|
|
14
|
+
function removeTrailingCommas(text) {
|
|
15
|
+
let result = "";
|
|
16
|
+
let inString = false;
|
|
17
|
+
let isEscaping = false;
|
|
18
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
19
|
+
const character = text[index];
|
|
20
|
+
if (inString) {
|
|
21
|
+
result += character;
|
|
22
|
+
if (isEscaping) {
|
|
23
|
+
isEscaping = false;
|
|
24
|
+
}
|
|
25
|
+
else if (character === "\\") {
|
|
26
|
+
isEscaping = true;
|
|
27
|
+
}
|
|
28
|
+
else if (character === '"') {
|
|
29
|
+
inString = false;
|
|
30
|
+
}
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (character === '"') {
|
|
34
|
+
inString = true;
|
|
35
|
+
result += character;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (character === ",") {
|
|
39
|
+
let lookAheadIndex = index + 1;
|
|
40
|
+
while (lookAheadIndex < text.length && JSON_WHITESPACE_REGEX.test(text[lookAheadIndex] ?? "")) {
|
|
41
|
+
lookAheadIndex += 1;
|
|
42
|
+
}
|
|
43
|
+
const nextCharacter = text[lookAheadIndex];
|
|
44
|
+
if (nextCharacter === "}" || nextCharacter === "]") {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
result += character;
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
function normalizeMalformedObjectKeys(text) {
|
|
53
|
+
return text.replace(/"([A-Za-z0-9_.$-]+)'(?=\s*:)/g, '"$1"');
|
|
54
|
+
}
|
|
55
|
+
function ensureObjectDelimiters(text) {
|
|
56
|
+
const trimmed = text.trim();
|
|
57
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
58
|
+
return trimmed;
|
|
59
|
+
}
|
|
60
|
+
if (trimmed.includes(":")) {
|
|
61
|
+
return `{${trimmed}}`;
|
|
62
|
+
}
|
|
63
|
+
return trimmed;
|
|
64
|
+
}
|
|
65
|
+
function trimExcessTrailingClosers(text) {
|
|
66
|
+
let openBraces = 0;
|
|
67
|
+
let closeBraces = 0;
|
|
68
|
+
for (const character of text) {
|
|
69
|
+
if (character === "{") {
|
|
70
|
+
openBraces += 1;
|
|
71
|
+
}
|
|
72
|
+
else if (character === "}") {
|
|
73
|
+
closeBraces += 1;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
let excessClosers = closeBraces - openBraces;
|
|
77
|
+
if (excessClosers <= 0) {
|
|
78
|
+
return text;
|
|
79
|
+
}
|
|
80
|
+
let result = text;
|
|
81
|
+
while (excessClosers > 0 && result.endsWith("}")) {
|
|
82
|
+
result = result.slice(0, -1);
|
|
83
|
+
excessClosers -= 1;
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
function parseRelaxedJson(text) {
|
|
88
|
+
const attempts = [
|
|
89
|
+
text,
|
|
90
|
+
removeTrailingCommas(text),
|
|
91
|
+
normalizeMalformedObjectKeys(removeTrailingCommas(text)),
|
|
92
|
+
ensureObjectDelimiters(normalizeMalformedObjectKeys(removeTrailingCommas(text))),
|
|
93
|
+
trimExcessTrailingClosers(ensureObjectDelimiters(normalizeMalformedObjectKeys(removeTrailingCommas(text)))),
|
|
94
|
+
];
|
|
95
|
+
let lastError;
|
|
96
|
+
for (const candidate of attempts) {
|
|
97
|
+
try {
|
|
98
|
+
return JSON.parse(candidate);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
lastError = error;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
throw lastError instanceof Error ? lastError : new Error("Failed to parse relaxed JSON");
|
|
105
|
+
}
|
|
106
|
+
function parseToolCallJson(text, tools) {
|
|
107
|
+
try {
|
|
108
|
+
const parsedValue = parseRelaxedJson(text);
|
|
109
|
+
if (!isRecord(parsedValue)) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
if (typeof parsedValue.name !== "string") {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
if (!normalizeToolNames(tools).has(parsedValue.name)) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
if (!isRecord(parsedValue.arguments)) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
name: parsedValue.name,
|
|
123
|
+
arguments: parsedValue.arguments,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function skipJsonWhitespace(text, fromIndex) {
|
|
131
|
+
let index = fromIndex;
|
|
132
|
+
while (index < text.length && JSON_WHITESPACE_REGEX.test(text[index] ?? "")) {
|
|
133
|
+
index += 1;
|
|
134
|
+
}
|
|
135
|
+
return index;
|
|
136
|
+
}
|
|
137
|
+
function findTopLevelPropertyValueStart(text, property) {
|
|
138
|
+
const objectStart = skipJsonWhitespace(text, 0);
|
|
139
|
+
if (objectStart >= text.length || text.charAt(objectStart) !== "{") {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
let depth = 0;
|
|
143
|
+
let inString = false;
|
|
144
|
+
let isEscaping = false;
|
|
145
|
+
for (let index = objectStart; index < text.length; index += 1) {
|
|
146
|
+
const character = text.charAt(index);
|
|
147
|
+
if (inString) {
|
|
148
|
+
if (isEscaping) {
|
|
149
|
+
isEscaping = false;
|
|
150
|
+
}
|
|
151
|
+
else if (character === "\\") {
|
|
152
|
+
isEscaping = true;
|
|
153
|
+
}
|
|
154
|
+
else if (character === '"') {
|
|
155
|
+
inString = false;
|
|
156
|
+
}
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (character === "{") {
|
|
160
|
+
depth += 1;
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (character === "}") {
|
|
164
|
+
depth = Math.max(0, depth - 1);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if (character !== '"') {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (depth !== 1) {
|
|
171
|
+
inString = true;
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
const keyStart = index + 1;
|
|
175
|
+
let keyEnd = keyStart;
|
|
176
|
+
let keyEscaping = false;
|
|
177
|
+
while (keyEnd < text.length) {
|
|
178
|
+
const keyCharacter = text.charAt(keyEnd);
|
|
179
|
+
if (keyEscaping) {
|
|
180
|
+
keyEscaping = false;
|
|
181
|
+
}
|
|
182
|
+
else if (keyCharacter === "\\") {
|
|
183
|
+
keyEscaping = true;
|
|
184
|
+
}
|
|
185
|
+
else if (keyCharacter === '"') {
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
keyEnd += 1;
|
|
189
|
+
}
|
|
190
|
+
if (keyEnd >= text.length || text.charAt(keyEnd) !== '"') {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const key = text.slice(keyStart, keyEnd);
|
|
194
|
+
let valueCursor = skipJsonWhitespace(text, keyEnd + 1);
|
|
195
|
+
if (valueCursor >= text.length || text.charAt(valueCursor) !== ":") {
|
|
196
|
+
index = keyEnd;
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
valueCursor = skipJsonWhitespace(text, valueCursor + 1);
|
|
200
|
+
if (key === property) {
|
|
201
|
+
return valueCursor < text.length ? valueCursor : null;
|
|
202
|
+
}
|
|
203
|
+
index = valueCursor - 1;
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
function extractTopLevelStringProperty(text, property) {
|
|
208
|
+
const valueStart = findTopLevelPropertyValueStart(text, property);
|
|
209
|
+
if (valueStart == null || valueStart >= text.length) {
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
if (text.charAt(valueStart) !== '"') {
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
let valueEnd = valueStart + 1;
|
|
216
|
+
let isEscaping = false;
|
|
217
|
+
while (valueEnd < text.length) {
|
|
218
|
+
const character = text.charAt(valueEnd);
|
|
219
|
+
if (isEscaping) {
|
|
220
|
+
isEscaping = false;
|
|
221
|
+
}
|
|
222
|
+
else if (character === "\\") {
|
|
223
|
+
isEscaping = true;
|
|
224
|
+
}
|
|
225
|
+
else if (character === '"') {
|
|
226
|
+
return text.slice(valueStart + 1, valueEnd);
|
|
227
|
+
}
|
|
228
|
+
valueEnd += 1;
|
|
229
|
+
}
|
|
230
|
+
return undefined;
|
|
231
|
+
}
|
|
232
|
+
function extractJsonValueSlice(text, valueStart) {
|
|
233
|
+
if (valueStart >= text.length) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
const firstCharacter = text.charAt(valueStart);
|
|
237
|
+
if (firstCharacter === "{" || firstCharacter === "[") {
|
|
238
|
+
const stack = [firstCharacter];
|
|
239
|
+
let inString = false;
|
|
240
|
+
let isEscaping = false;
|
|
241
|
+
for (let index = valueStart + 1; index < text.length; index += 1) {
|
|
242
|
+
const character = text.charAt(index);
|
|
243
|
+
if (inString) {
|
|
244
|
+
if (isEscaping) {
|
|
245
|
+
isEscaping = false;
|
|
246
|
+
}
|
|
247
|
+
else if (character === "\\") {
|
|
248
|
+
isEscaping = true;
|
|
249
|
+
}
|
|
250
|
+
else if (character === '"') {
|
|
251
|
+
inString = false;
|
|
252
|
+
}
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
if (character === '"') {
|
|
256
|
+
inString = true;
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (character === "{" || character === "[") {
|
|
260
|
+
stack.push(character);
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
if (character === "}" || character === "]") {
|
|
264
|
+
const openCharacter = stack[stack.length - 1];
|
|
265
|
+
if ((openCharacter === "{" && character === "}") || (openCharacter === "[" && character === "]")) {
|
|
266
|
+
stack.pop();
|
|
267
|
+
if (stack.length === 0) {
|
|
268
|
+
return {
|
|
269
|
+
text: text.slice(valueStart, index + 1),
|
|
270
|
+
complete: true,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
text: text.slice(valueStart),
|
|
278
|
+
complete: false,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
if (firstCharacter === '"') {
|
|
282
|
+
let isEscaping = false;
|
|
283
|
+
for (let index = valueStart + 1; index < text.length; index += 1) {
|
|
284
|
+
const character = text.charAt(index);
|
|
285
|
+
if (isEscaping) {
|
|
286
|
+
isEscaping = false;
|
|
287
|
+
}
|
|
288
|
+
else if (character === "\\") {
|
|
289
|
+
isEscaping = true;
|
|
290
|
+
}
|
|
291
|
+
else if (character === '"') {
|
|
292
|
+
return {
|
|
293
|
+
text: text.slice(valueStart, index + 1),
|
|
294
|
+
complete: true,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
text: text.slice(valueStart),
|
|
300
|
+
complete: false,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
let index = valueStart;
|
|
304
|
+
while (index < text.length) {
|
|
305
|
+
const character = text.charAt(index);
|
|
306
|
+
if (character === "," || character === "}" || JSON_WHITESPACE_REGEX.test(character)) {
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
index += 1;
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
text: text.slice(valueStart, index),
|
|
313
|
+
complete: index < text.length,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
function getPotentialStartIndex(text, searchedText) {
|
|
317
|
+
if (searchedText.length === 0) {
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
const directIndex = text.indexOf(searchedText);
|
|
321
|
+
if (directIndex !== -1) {
|
|
322
|
+
return directIndex;
|
|
323
|
+
}
|
|
324
|
+
const startAt = Math.max(0, text.length - searchedText.length + 1);
|
|
325
|
+
for (let index = startAt; index < text.length; index += 1) {
|
|
326
|
+
let isMatch = true;
|
|
327
|
+
const suffixLength = text.length - index;
|
|
328
|
+
for (let suffixIndex = 0; suffixIndex < suffixLength; suffixIndex += 1) {
|
|
329
|
+
if (text[index + suffixIndex] !== searchedText[suffixIndex]) {
|
|
330
|
+
isMatch = false;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (isMatch) {
|
|
335
|
+
return index;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
function extractArgumentsProgress(toolCallJson) {
|
|
341
|
+
const toolName = extractTopLevelStringProperty(toolCallJson, "name");
|
|
342
|
+
const argumentsStart = findTopLevelPropertyValueStart(toolCallJson, "arguments");
|
|
343
|
+
if (argumentsStart == null) {
|
|
344
|
+
return {
|
|
345
|
+
toolName,
|
|
346
|
+
argumentsText: undefined,
|
|
347
|
+
argumentsComplete: false,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
const argumentsSlice = extractJsonValueSlice(toolCallJson, argumentsStart);
|
|
351
|
+
return {
|
|
352
|
+
toolName,
|
|
353
|
+
argumentsText: argumentsSlice?.text,
|
|
354
|
+
argumentsComplete: argumentsSlice?.complete ?? false,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function emitText(events, text) {
|
|
358
|
+
if (text.length === 0) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
events.push({ type: "text", text });
|
|
362
|
+
}
|
|
363
|
+
function emitToolCallProgress(state, events, tools, options) {
|
|
364
|
+
if (!state.isInsideToolCall || state.currentToolCallJson.length === 0) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
const progress = extractArgumentsProgress(state.currentToolCallJson);
|
|
368
|
+
if (!progress.toolName ||
|
|
369
|
+
!normalizeToolNames(tools).has(progress.toolName) ||
|
|
370
|
+
!progress.argumentsText ||
|
|
371
|
+
!progress.argumentsComplete) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
try {
|
|
375
|
+
const parsedArguments = parseRelaxedJson(progress.argumentsText);
|
|
376
|
+
if (!isRecord(parsedArguments)) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
if (!state.activeToolCall) {
|
|
380
|
+
state.activeToolCall = {
|
|
381
|
+
index: state.toolCallCount,
|
|
382
|
+
id: options.createToolCallId(state.toolCallCount),
|
|
383
|
+
name: progress.toolName,
|
|
384
|
+
emittedArguments: "",
|
|
385
|
+
};
|
|
386
|
+
state.toolCallCount += 1;
|
|
387
|
+
events.push({
|
|
388
|
+
type: "toolcall_start",
|
|
389
|
+
index: state.activeToolCall.index,
|
|
390
|
+
name: state.activeToolCall.name,
|
|
391
|
+
id: state.activeToolCall.id,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
const canonicalArguments = JSON.stringify(parsedArguments);
|
|
395
|
+
if (!canonicalArguments.startsWith(state.activeToolCall.emittedArguments)) {
|
|
396
|
+
state.activeToolCall.emittedArguments = "";
|
|
397
|
+
}
|
|
398
|
+
const argumentsDelta = canonicalArguments.slice(state.activeToolCall.emittedArguments.length);
|
|
399
|
+
if (argumentsDelta.length === 0) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
state.activeToolCall.emittedArguments = canonicalArguments;
|
|
403
|
+
events.push({
|
|
404
|
+
type: "toolcall_delta",
|
|
405
|
+
index: state.activeToolCall.index,
|
|
406
|
+
argumentsDelta,
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
catch { }
|
|
410
|
+
}
|
|
411
|
+
function finalizeToolCall(state, events, tools, options, parserOptions) {
|
|
412
|
+
const fullSegment = `${options.toolCallStart}${state.currentToolCallJson}${options.toolCallEnd}`;
|
|
413
|
+
const parsedToolCall = parseToolCallJson(state.currentToolCallJson, tools);
|
|
414
|
+
if (!parsedToolCall) {
|
|
415
|
+
parserOptions?.onError?.("Could not process JSON tool call, keeping original text.", {
|
|
416
|
+
toolCall: fullSegment,
|
|
417
|
+
});
|
|
418
|
+
if (shouldEmitRawToolCallTextOnError(parserOptions)) {
|
|
419
|
+
emitText(events, fullSegment);
|
|
420
|
+
}
|
|
421
|
+
state.activeToolCall = null;
|
|
422
|
+
state.currentToolCallJson = "";
|
|
423
|
+
state.isInsideToolCall = false;
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (!state.activeToolCall) {
|
|
427
|
+
state.activeToolCall = {
|
|
428
|
+
index: state.toolCallCount,
|
|
429
|
+
id: options.createToolCallId(state.toolCallCount),
|
|
430
|
+
name: parsedToolCall.name,
|
|
431
|
+
emittedArguments: "",
|
|
432
|
+
};
|
|
433
|
+
state.toolCallCount += 1;
|
|
434
|
+
events.push({
|
|
435
|
+
type: "toolcall_start",
|
|
436
|
+
index: state.activeToolCall.index,
|
|
437
|
+
name: state.activeToolCall.name,
|
|
438
|
+
id: state.activeToolCall.id,
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
const canonicalArguments = JSON.stringify(parsedToolCall.arguments);
|
|
442
|
+
if (canonicalArguments !== state.activeToolCall.emittedArguments) {
|
|
443
|
+
const argumentsDelta = canonicalArguments.slice(state.activeToolCall.emittedArguments.length);
|
|
444
|
+
if (argumentsDelta.length > 0) {
|
|
445
|
+
events.push({
|
|
446
|
+
type: "toolcall_delta",
|
|
447
|
+
index: state.activeToolCall.index,
|
|
448
|
+
argumentsDelta,
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
events.push({
|
|
453
|
+
type: "toolcall_end",
|
|
454
|
+
index: state.activeToolCall.index,
|
|
455
|
+
name: parsedToolCall.name,
|
|
456
|
+
id: state.activeToolCall.id,
|
|
457
|
+
arguments: parsedToolCall.arguments,
|
|
458
|
+
});
|
|
459
|
+
state.activeToolCall = null;
|
|
460
|
+
state.currentToolCallJson = "";
|
|
461
|
+
state.isInsideToolCall = false;
|
|
462
|
+
}
|
|
463
|
+
function flushInsideToolCallBuffer(state, events, tools, options) {
|
|
464
|
+
const potentialEndIndex = getPotentialStartIndex(state.buffer, options.toolCallEnd);
|
|
465
|
+
if (potentialEndIndex != null && potentialEndIndex + options.toolCallEnd.length > state.buffer.length) {
|
|
466
|
+
state.currentToolCallJson += state.buffer.slice(0, potentialEndIndex);
|
|
467
|
+
state.buffer = state.buffer.slice(potentialEndIndex);
|
|
468
|
+
emitToolCallProgress(state, events, tools, options);
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
state.currentToolCallJson += state.buffer;
|
|
472
|
+
state.buffer = "";
|
|
473
|
+
emitToolCallProgress(state, events, tools, options);
|
|
474
|
+
}
|
|
475
|
+
function flushOutsideToolCallBuffer(state, events, options) {
|
|
476
|
+
const potentialStartIndex = getPotentialStartIndex(state.buffer, options.toolCallStart);
|
|
477
|
+
if (potentialStartIndex != null && potentialStartIndex + options.toolCallStart.length > state.buffer.length) {
|
|
478
|
+
emitText(events, state.buffer.slice(0, potentialStartIndex));
|
|
479
|
+
state.buffer = state.buffer.slice(potentialStartIndex);
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
emitText(events, state.buffer);
|
|
483
|
+
state.buffer = "";
|
|
484
|
+
}
|
|
485
|
+
export function formatJsonMixToolCall(name, args, options) {
|
|
486
|
+
return `${options.toolCallStart}\n${JSON.stringify({ name, arguments: args })}\n${options.toolCallEnd}`;
|
|
487
|
+
}
|
|
488
|
+
export function parseJsonMixGeneratedText(text, tools, options, parserOptions) {
|
|
489
|
+
const parsedToolCalls = [];
|
|
490
|
+
const toolCallRegex = new RegExp(`${escapeRegExp(options.toolCallStart)}([\\s\\S]*?)${escapeRegExp(options.toolCallEnd)}`, "g");
|
|
491
|
+
let match = toolCallRegex.exec(text);
|
|
492
|
+
while (match !== null) {
|
|
493
|
+
const toolCallJson = match[1] ?? "";
|
|
494
|
+
const parsedToolCall = parseToolCallJson(toolCallJson, tools);
|
|
495
|
+
if (parsedToolCall) {
|
|
496
|
+
parsedToolCalls.push(parsedToolCall);
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
parserOptions?.onError?.("Could not process JSON tool call, keeping original text.", {
|
|
500
|
+
toolCall: match[0],
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
match = toolCallRegex.exec(text);
|
|
504
|
+
}
|
|
505
|
+
return parsedToolCalls;
|
|
506
|
+
}
|
|
507
|
+
export function createJsonMixStreamParser(tools, options, parserOptions) {
|
|
508
|
+
const state = {
|
|
509
|
+
activeToolCall: null,
|
|
510
|
+
buffer: "",
|
|
511
|
+
currentToolCallJson: "",
|
|
512
|
+
isInsideToolCall: false,
|
|
513
|
+
toolCallCount: 0,
|
|
514
|
+
};
|
|
515
|
+
return {
|
|
516
|
+
feed(textDelta) {
|
|
517
|
+
const events = [];
|
|
518
|
+
state.buffer += textDelta;
|
|
519
|
+
let nextTagIndex = getPotentialStartIndex(state.buffer, state.isInsideToolCall ? options.toolCallEnd : options.toolCallStart);
|
|
520
|
+
while (nextTagIndex != null) {
|
|
521
|
+
const currentTag = state.isInsideToolCall ? options.toolCallEnd : options.toolCallStart;
|
|
522
|
+
if (nextTagIndex + currentTag.length > state.buffer.length) {
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
if (state.isInsideToolCall) {
|
|
526
|
+
state.currentToolCallJson += state.buffer.slice(0, nextTagIndex);
|
|
527
|
+
state.buffer = state.buffer.slice(nextTagIndex + currentTag.length);
|
|
528
|
+
emitToolCallProgress(state, events, tools, options);
|
|
529
|
+
finalizeToolCall(state, events, tools, options, parserOptions);
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
emitText(events, state.buffer.slice(0, nextTagIndex));
|
|
533
|
+
state.buffer = state.buffer.slice(nextTagIndex + currentTag.length);
|
|
534
|
+
state.isInsideToolCall = true;
|
|
535
|
+
state.currentToolCallJson = "";
|
|
536
|
+
state.activeToolCall = null;
|
|
537
|
+
}
|
|
538
|
+
nextTagIndex = getPotentialStartIndex(state.buffer, state.isInsideToolCall ? options.toolCallEnd : options.toolCallStart);
|
|
539
|
+
}
|
|
540
|
+
if (state.isInsideToolCall) {
|
|
541
|
+
flushInsideToolCallBuffer(state, events, tools, options);
|
|
542
|
+
}
|
|
543
|
+
else {
|
|
544
|
+
flushOutsideToolCallBuffer(state, events, options);
|
|
545
|
+
}
|
|
546
|
+
return events;
|
|
547
|
+
},
|
|
548
|
+
finish() {
|
|
549
|
+
const events = [];
|
|
550
|
+
if (state.isInsideToolCall) {
|
|
551
|
+
const unfinishedToolCall = `${options.toolCallStart}${state.currentToolCallJson}${state.buffer}`;
|
|
552
|
+
parserOptions?.onError?.("Could not complete streaming JSON tool call at finish.", {
|
|
553
|
+
toolCall: unfinishedToolCall,
|
|
554
|
+
});
|
|
555
|
+
if (shouldEmitRawToolCallTextOnError(parserOptions)) {
|
|
556
|
+
emitText(events, unfinishedToolCall);
|
|
557
|
+
}
|
|
558
|
+
state.activeToolCall = null;
|
|
559
|
+
state.currentToolCallJson = "";
|
|
560
|
+
state.isInsideToolCall = false;
|
|
561
|
+
state.buffer = "";
|
|
562
|
+
return events;
|
|
563
|
+
}
|
|
564
|
+
emitText(events, state.buffer);
|
|
565
|
+
state.buffer = "";
|
|
566
|
+
return events;
|
|
567
|
+
},
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
//# sourceMappingURL=json-mix.js.map
|
package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-mix.js","sourceRoot":"","sources":["../../../src/tool-call-middleware/protocols/json-mix.ts"],"names":[],"mappings":"AASA,SAAS,gCAAgC,CAAC,OAAuB,EAAW;IAC3E,OAAO,OAAO,EAAE,0BAA0B,KAAK,IAAI,CAAC;AAAA,CACpD;AAED,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,SAAS,YAAY,CAAC,IAAY,EAAU;IAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAAA,CACnD;AAED,SAAS,QAAQ,CAAC,KAAc,EAAoC;IACnE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAAA,CAC5E;AAED,SAAS,kBAAkB,CAAC,KAAa,EAAe;IACvD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAAA,CAC/C;AAED,SAAS,oBAAoB,CAAC,IAAY,EAAU;IACnD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,UAAU,GAAG,KAAK,CAAC;IAEvB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QAE9B,IAAI,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,SAAS,CAAC;YACpB,IAAI,UAAU,EAAE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,CAAC;gBAC5B,KAAK,CAAC,mBAAmB,GAAG,EAAE,CAAC;gBAC/B,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC;gBAC/B,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC;gBAClB,OAAO,MAAM,CAAC;YACf,CAAC;YAED,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YAC/B,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC;YAClB,OAAO,MAAM,CAAC;QAAA,CACd;KACD,CAAC;AAAA,CACF","sourcesContent":["import type { Tool } from \"../../types.ts\";\nimport type { ParsedToolCall, ParserOptions, StreamParser, StreamParserEvent } from \"../types.ts\";\n\ntype JsonMixOptions = {\n\ttoolCallStart: string;\n\ttoolCallEnd: string;\n\tcreateToolCallId: (index: number) => string;\n};\n\nfunction shouldEmitRawToolCallTextOnError(options?: ParserOptions): boolean {\n\treturn options?.emitRawToolCallTextOnError === true;\n}\n\nconst JSON_WHITESPACE_REGEX = /\\s/;\n\nfunction escapeRegExp(text: string): string {\n\treturn text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction normalizeToolNames(tools: Tool[]): Set<string> {\n\treturn new Set(tools.map((tool) => tool.name));\n}\n\nfunction removeTrailingCommas(text: string): string {\n\tlet result = \"\";\n\tlet inString = false;\n\tlet isEscaping = false;\n\n\tfor (let index = 0; index < text.length; index += 1) {\n\t\tconst character = text[index];\n\n\t\tif (inString) {\n\t\t\tresult += character;\n\t\t\tif (isEscaping) {\n\t\t\t\tisEscaping = false;\n\t\t\t} else if (character === \"\\\\\") {\n\t\t\t\tisEscaping = true;\n\t\t\t} else if (character === '\"') {\n\t\t\t\tinString = false;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (character === '\"') {\n\t\t\tinString = true;\n\t\t\tresult += character;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (character === \",\") {\n\t\t\tlet lookAheadIndex = index + 1;\n\t\t\twhile (lookAheadIndex < text.length && JSON_WHITESPACE_REGEX.test(text[lookAheadIndex] ?? \"\")) {\n\t\t\t\tlookAheadIndex += 1;\n\t\t\t}\n\n\t\t\tconst nextCharacter = text[lookAheadIndex];\n\t\t\tif (nextCharacter === \"}\" || nextCharacter === \"]\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tresult += character;\n\t}\n\n\treturn result;\n}\n\nfunction normalizeMalformedObjectKeys(text: string): string {\n\treturn text.replace(/\"([A-Za-z0-9_.$-]+)'(?=\\s*:)/g, '\"$1\"');\n}\n\nfunction ensureObjectDelimiters(text: string): string {\n\tconst trimmed = text.trim();\n\tif (trimmed.startsWith(\"{\") || trimmed.startsWith(\"[\")) {\n\t\treturn trimmed;\n\t}\n\n\tif (trimmed.includes(\":\")) {\n\t\treturn `{${trimmed}}`;\n\t}\n\n\treturn trimmed;\n}\n\nfunction trimExcessTrailingClosers(text: string): string {\n\tlet openBraces = 0;\n\tlet closeBraces = 0;\n\tfor (const character of text) {\n\t\tif (character === \"{\") {\n\t\t\topenBraces += 1;\n\t\t} else if (character === \"}\") {\n\t\t\tcloseBraces += 1;\n\t\t}\n\t}\n\n\tlet excessClosers = closeBraces - openBraces;\n\tif (excessClosers <= 0) {\n\t\treturn text;\n\t}\n\n\tlet result = text;\n\twhile (excessClosers > 0 && result.endsWith(\"}\")) {\n\t\tresult = result.slice(0, -1);\n\t\texcessClosers -= 1;\n\t}\n\treturn result;\n}\n\nfunction parseRelaxedJson(text: string): unknown {\n\tconst attempts = [\n\t\ttext,\n\t\tremoveTrailingCommas(text),\n\t\tnormalizeMalformedObjectKeys(removeTrailingCommas(text)),\n\t\tensureObjectDelimiters(normalizeMalformedObjectKeys(removeTrailingCommas(text))),\n\t\ttrimExcessTrailingClosers(ensureObjectDelimiters(normalizeMalformedObjectKeys(removeTrailingCommas(text)))),\n\t];\n\n\tlet lastError: unknown;\n\tfor (const candidate of attempts) {\n\t\ttry {\n\t\t\treturn JSON.parse(candidate);\n\t\t} catch (error) {\n\t\t\tlastError = error;\n\t\t}\n\t}\n\n\tthrow lastError instanceof Error ? lastError : new Error(\"Failed to parse relaxed JSON\");\n}\n\nfunction parseToolCallJson(text: string, tools: Tool[]): ParsedToolCall | null {\n\ttry {\n\t\tconst parsedValue = parseRelaxedJson(text);\n\t\tif (!isRecord(parsedValue)) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (typeof parsedValue.name !== \"string\") {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (!normalizeToolNames(tools).has(parsedValue.name)) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (!isRecord(parsedValue.arguments)) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn {\n\t\t\tname: parsedValue.name,\n\t\t\targuments: parsedValue.arguments,\n\t\t};\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction skipJsonWhitespace(text: string, fromIndex: number): number {\n\tlet index = fromIndex;\n\twhile (index < text.length && JSON_WHITESPACE_REGEX.test(text[index] ?? \"\")) {\n\t\tindex += 1;\n\t}\n\treturn index;\n}\n\nfunction findTopLevelPropertyValueStart(text: string, property: string): number | null {\n\tconst objectStart = skipJsonWhitespace(text, 0);\n\tif (objectStart >= text.length || text.charAt(objectStart) !== \"{\") {\n\t\treturn null;\n\t}\n\n\tlet depth = 0;\n\tlet inString = false;\n\tlet isEscaping = false;\n\n\tfor (let index = objectStart; index < text.length; index += 1) {\n\t\tconst character = text.charAt(index);\n\n\t\tif (inString) {\n\t\t\tif (isEscaping) {\n\t\t\t\tisEscaping = false;\n\t\t\t} else if (character === \"\\\\\") {\n\t\t\t\tisEscaping = true;\n\t\t\t} else if (character === '\"') {\n\t\t\t\tinString = false;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (character === \"{\") {\n\t\t\tdepth += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (character === \"}\") {\n\t\t\tdepth = Math.max(0, depth - 1);\n\t\t\tcontinue;\n\t\t}\n\t\tif (character !== '\"') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (depth !== 1) {\n\t\t\tinString = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst keyStart = index + 1;\n\t\tlet keyEnd = keyStart;\n\t\tlet keyEscaping = false;\n\t\twhile (keyEnd < text.length) {\n\t\t\tconst keyCharacter = text.charAt(keyEnd);\n\t\t\tif (keyEscaping) {\n\t\t\t\tkeyEscaping = false;\n\t\t\t} else if (keyCharacter === \"\\\\\") {\n\t\t\t\tkeyEscaping = true;\n\t\t\t} else if (keyCharacter === '\"') {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tkeyEnd += 1;\n\t\t}\n\n\t\tif (keyEnd >= text.length || text.charAt(keyEnd) !== '\"') {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst key = text.slice(keyStart, keyEnd);\n\t\tlet valueCursor = skipJsonWhitespace(text, keyEnd + 1);\n\t\tif (valueCursor >= text.length || text.charAt(valueCursor) !== \":\") {\n\t\t\tindex = keyEnd;\n\t\t\tcontinue;\n\t\t}\n\n\t\tvalueCursor = skipJsonWhitespace(text, valueCursor + 1);\n\t\tif (key === property) {\n\t\t\treturn valueCursor < text.length ? valueCursor : null;\n\t\t}\n\n\t\tindex = valueCursor - 1;\n\t}\n\n\treturn null;\n}\n\nfunction extractTopLevelStringProperty(text: string, property: string): string | undefined {\n\tconst valueStart = findTopLevelPropertyValueStart(text, property);\n\tif (valueStart == null || valueStart >= text.length) {\n\t\treturn undefined;\n\t}\n\n\tif (text.charAt(valueStart) !== '\"') {\n\t\treturn undefined;\n\t}\n\n\tlet valueEnd = valueStart + 1;\n\tlet isEscaping = false;\n\twhile (valueEnd < text.length) {\n\t\tconst character = text.charAt(valueEnd);\n\t\tif (isEscaping) {\n\t\t\tisEscaping = false;\n\t\t} else if (character === \"\\\\\") {\n\t\t\tisEscaping = true;\n\t\t} else if (character === '\"') {\n\t\t\treturn text.slice(valueStart + 1, valueEnd);\n\t\t}\n\t\tvalueEnd += 1;\n\t}\n\n\treturn undefined;\n}\n\nfunction extractJsonValueSlice(text: string, valueStart: number): { text: string; complete: boolean } | null {\n\tif (valueStart >= text.length) {\n\t\treturn null;\n\t}\n\n\tconst firstCharacter = text.charAt(valueStart);\n\tif (firstCharacter === \"{\" || firstCharacter === \"[\") {\n\t\tconst stack: string[] = [firstCharacter];\n\t\tlet inString = false;\n\t\tlet isEscaping = false;\n\n\t\tfor (let index = valueStart + 1; index < text.length; index += 1) {\n\t\t\tconst character = text.charAt(index);\n\t\t\tif (inString) {\n\t\t\t\tif (isEscaping) {\n\t\t\t\t\tisEscaping = false;\n\t\t\t\t} else if (character === \"\\\\\") {\n\t\t\t\t\tisEscaping = true;\n\t\t\t\t} else if (character === '\"') {\n\t\t\t\t\tinString = false;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (character === '\"') {\n\t\t\t\tinString = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (character === \"{\" || character === \"[\") {\n\t\t\t\tstack.push(character);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (character === \"}\" || character === \"]\") {\n\t\t\t\tconst openCharacter = stack[stack.length - 1];\n\t\t\t\tif ((openCharacter === \"{\" && character === \"}\") || (openCharacter === \"[\" && character === \"]\")) {\n\t\t\t\t\tstack.pop();\n\t\t\t\t\tif (stack.length === 0) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttext: text.slice(valueStart, index + 1),\n\t\t\t\t\t\t\tcomplete: true,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\ttext: text.slice(valueStart),\n\t\t\tcomplete: false,\n\t\t};\n\t}\n\n\tif (firstCharacter === '\"') {\n\t\tlet isEscaping = false;\n\t\tfor (let index = valueStart + 1; index < text.length; index += 1) {\n\t\t\tconst character = text.charAt(index);\n\t\t\tif (isEscaping) {\n\t\t\t\tisEscaping = false;\n\t\t\t} else if (character === \"\\\\\") {\n\t\t\t\tisEscaping = true;\n\t\t\t} else if (character === '\"') {\n\t\t\t\treturn {\n\t\t\t\t\ttext: text.slice(valueStart, index + 1),\n\t\t\t\t\tcomplete: true,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\ttext: text.slice(valueStart),\n\t\t\tcomplete: false,\n\t\t};\n\t}\n\n\tlet index = valueStart;\n\twhile (index < text.length) {\n\t\tconst character = text.charAt(index);\n\t\tif (character === \",\" || character === \"}\" || JSON_WHITESPACE_REGEX.test(character)) {\n\t\t\tbreak;\n\t\t}\n\t\tindex += 1;\n\t}\n\n\treturn {\n\t\ttext: text.slice(valueStart, index),\n\t\tcomplete: index < text.length,\n\t};\n}\n\nfunction getPotentialStartIndex(text: string, searchedText: string): number | null {\n\tif (searchedText.length === 0) {\n\t\treturn null;\n\t}\n\n\tconst directIndex = text.indexOf(searchedText);\n\tif (directIndex !== -1) {\n\t\treturn directIndex;\n\t}\n\n\tconst startAt = Math.max(0, text.length - searchedText.length + 1);\n\tfor (let index = startAt; index < text.length; index += 1) {\n\t\tlet isMatch = true;\n\t\tconst suffixLength = text.length - index;\n\n\t\tfor (let suffixIndex = 0; suffixIndex < suffixLength; suffixIndex += 1) {\n\t\t\tif (text[index + suffixIndex] !== searchedText[suffixIndex]) {\n\t\t\t\tisMatch = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (isMatch) {\n\t\t\treturn index;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction extractArgumentsProgress(toolCallJson: string): {\n\ttoolName: string | undefined;\n\targumentsText: string | undefined;\n\targumentsComplete: boolean;\n} {\n\tconst toolName = extractTopLevelStringProperty(toolCallJson, \"name\");\n\tconst argumentsStart = findTopLevelPropertyValueStart(toolCallJson, \"arguments\");\n\tif (argumentsStart == null) {\n\t\treturn {\n\t\t\ttoolName,\n\t\t\targumentsText: undefined,\n\t\t\targumentsComplete: false,\n\t\t};\n\t}\n\n\tconst argumentsSlice = extractJsonValueSlice(toolCallJson, argumentsStart);\n\treturn {\n\t\ttoolName,\n\t\targumentsText: argumentsSlice?.text,\n\t\targumentsComplete: argumentsSlice?.complete ?? false,\n\t};\n}\n\ntype JsonMixStreamState = {\n\tactiveToolCall: {\n\t\tindex: number;\n\t\tid: string;\n\t\tname: string;\n\t\temittedArguments: string;\n\t} | null;\n\tbuffer: string;\n\tcurrentToolCallJson: string;\n\tisInsideToolCall: boolean;\n\ttoolCallCount: number;\n};\n\nfunction emitText(events: StreamParserEvent[], text: string): void {\n\tif (text.length === 0) {\n\t\treturn;\n\t}\n\n\tevents.push({ type: \"text\", text });\n}\n\nfunction emitToolCallProgress(\n\tstate: JsonMixStreamState,\n\tevents: StreamParserEvent[],\n\ttools: Tool[],\n\toptions: JsonMixOptions,\n): void {\n\tif (!state.isInsideToolCall || state.currentToolCallJson.length === 0) {\n\t\treturn;\n\t}\n\n\tconst progress = extractArgumentsProgress(state.currentToolCallJson);\n\tif (\n\t\t!progress.toolName ||\n\t\t!normalizeToolNames(tools).has(progress.toolName) ||\n\t\t!progress.argumentsText ||\n\t\t!progress.argumentsComplete\n\t) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst parsedArguments = parseRelaxedJson(progress.argumentsText);\n\t\tif (!isRecord(parsedArguments)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!state.activeToolCall) {\n\t\t\tstate.activeToolCall = {\n\t\t\t\tindex: state.toolCallCount,\n\t\t\t\tid: options.createToolCallId(state.toolCallCount),\n\t\t\t\tname: progress.toolName,\n\t\t\t\temittedArguments: \"\",\n\t\t\t};\n\t\t\tstate.toolCallCount += 1;\n\t\t\tevents.push({\n\t\t\t\ttype: \"toolcall_start\",\n\t\t\t\tindex: state.activeToolCall.index,\n\t\t\t\tname: state.activeToolCall.name,\n\t\t\t\tid: state.activeToolCall.id,\n\t\t\t});\n\t\t}\n\n\t\tconst canonicalArguments = JSON.stringify(parsedArguments);\n\t\tif (!canonicalArguments.startsWith(state.activeToolCall.emittedArguments)) {\n\t\t\tstate.activeToolCall.emittedArguments = \"\";\n\t\t}\n\n\t\tconst argumentsDelta = canonicalArguments.slice(state.activeToolCall.emittedArguments.length);\n\t\tif (argumentsDelta.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tstate.activeToolCall.emittedArguments = canonicalArguments;\n\t\tevents.push({\n\t\t\ttype: \"toolcall_delta\",\n\t\t\tindex: state.activeToolCall.index,\n\t\t\targumentsDelta,\n\t\t});\n\t} catch {}\n}\n\nfunction finalizeToolCall(\n\tstate: JsonMixStreamState,\n\tevents: StreamParserEvent[],\n\ttools: Tool[],\n\toptions: JsonMixOptions,\n\tparserOptions?: ParserOptions,\n): void {\n\tconst fullSegment = `${options.toolCallStart}${state.currentToolCallJson}${options.toolCallEnd}`;\n\tconst parsedToolCall = parseToolCallJson(state.currentToolCallJson, tools);\n\tif (!parsedToolCall) {\n\t\tparserOptions?.onError?.(\"Could not process JSON tool call, keeping original text.\", {\n\t\t\ttoolCall: fullSegment,\n\t\t});\n\t\tif (shouldEmitRawToolCallTextOnError(parserOptions)) {\n\t\t\temitText(events, fullSegment);\n\t\t}\n\t\tstate.activeToolCall = null;\n\t\tstate.currentToolCallJson = \"\";\n\t\tstate.isInsideToolCall = false;\n\t\treturn;\n\t}\n\n\tif (!state.activeToolCall) {\n\t\tstate.activeToolCall = {\n\t\t\tindex: state.toolCallCount,\n\t\t\tid: options.createToolCallId(state.toolCallCount),\n\t\t\tname: parsedToolCall.name,\n\t\t\temittedArguments: \"\",\n\t\t};\n\t\tstate.toolCallCount += 1;\n\t\tevents.push({\n\t\t\ttype: \"toolcall_start\",\n\t\t\tindex: state.activeToolCall.index,\n\t\t\tname: state.activeToolCall.name,\n\t\t\tid: state.activeToolCall.id,\n\t\t});\n\t}\n\n\tconst canonicalArguments = JSON.stringify(parsedToolCall.arguments);\n\tif (canonicalArguments !== state.activeToolCall.emittedArguments) {\n\t\tconst argumentsDelta = canonicalArguments.slice(state.activeToolCall.emittedArguments.length);\n\t\tif (argumentsDelta.length > 0) {\n\t\t\tevents.push({\n\t\t\t\ttype: \"toolcall_delta\",\n\t\t\t\tindex: state.activeToolCall.index,\n\t\t\t\targumentsDelta,\n\t\t\t});\n\t\t}\n\t}\n\n\tevents.push({\n\t\ttype: \"toolcall_end\",\n\t\tindex: state.activeToolCall.index,\n\t\tname: parsedToolCall.name,\n\t\tid: state.activeToolCall.id,\n\t\targuments: parsedToolCall.arguments,\n\t});\n\n\tstate.activeToolCall = null;\n\tstate.currentToolCallJson = \"\";\n\tstate.isInsideToolCall = false;\n}\n\nfunction flushInsideToolCallBuffer(\n\tstate: JsonMixStreamState,\n\tevents: StreamParserEvent[],\n\ttools: Tool[],\n\toptions: JsonMixOptions,\n): void {\n\tconst potentialEndIndex = getPotentialStartIndex(state.buffer, options.toolCallEnd);\n\tif (potentialEndIndex != null && potentialEndIndex + options.toolCallEnd.length > state.buffer.length) {\n\t\tstate.currentToolCallJson += state.buffer.slice(0, potentialEndIndex);\n\t\tstate.buffer = state.buffer.slice(potentialEndIndex);\n\t\temitToolCallProgress(state, events, tools, options);\n\t\treturn;\n\t}\n\n\tstate.currentToolCallJson += state.buffer;\n\tstate.buffer = \"\";\n\temitToolCallProgress(state, events, tools, options);\n}\n\nfunction flushOutsideToolCallBuffer(\n\tstate: JsonMixStreamState,\n\tevents: StreamParserEvent[],\n\toptions: JsonMixOptions,\n): void {\n\tconst potentialStartIndex = getPotentialStartIndex(state.buffer, options.toolCallStart);\n\tif (potentialStartIndex != null && potentialStartIndex + options.toolCallStart.length > state.buffer.length) {\n\t\temitText(events, state.buffer.slice(0, potentialStartIndex));\n\t\tstate.buffer = state.buffer.slice(potentialStartIndex);\n\t\treturn;\n\t}\n\n\temitText(events, state.buffer);\n\tstate.buffer = \"\";\n}\n\nexport function formatJsonMixToolCall(\n\tname: string,\n\targs: Record<string, unknown>,\n\toptions: Pick<JsonMixOptions, \"toolCallStart\" | \"toolCallEnd\">,\n): string {\n\treturn `${options.toolCallStart}\\n${JSON.stringify({ name, arguments: args })}\\n${options.toolCallEnd}`;\n}\n\nexport function parseJsonMixGeneratedText(\n\ttext: string,\n\ttools: Tool[],\n\toptions: Pick<JsonMixOptions, \"toolCallStart\" | \"toolCallEnd\">,\n\tparserOptions?: ParserOptions,\n): ParsedToolCall[] {\n\tconst parsedToolCalls: ParsedToolCall[] = [];\n\tconst toolCallRegex = new RegExp(\n\t\t`${escapeRegExp(options.toolCallStart)}([\\\\s\\\\S]*?)${escapeRegExp(options.toolCallEnd)}`,\n\t\t\"g\",\n\t);\n\n\tlet match = toolCallRegex.exec(text);\n\twhile (match !== null) {\n\t\tconst toolCallJson = match[1] ?? \"\";\n\t\tconst parsedToolCall = parseToolCallJson(toolCallJson, tools);\n\t\tif (parsedToolCall) {\n\t\t\tparsedToolCalls.push(parsedToolCall);\n\t\t} else {\n\t\t\tparserOptions?.onError?.(\"Could not process JSON tool call, keeping original text.\", {\n\t\t\t\ttoolCall: match[0],\n\t\t\t});\n\t\t}\n\t\tmatch = toolCallRegex.exec(text);\n\t}\n\n\treturn parsedToolCalls;\n}\n\nexport function createJsonMixStreamParser(\n\ttools: Tool[],\n\toptions: JsonMixOptions,\n\tparserOptions?: ParserOptions,\n): StreamParser {\n\tconst state: JsonMixStreamState = {\n\t\tactiveToolCall: null,\n\t\tbuffer: \"\",\n\t\tcurrentToolCallJson: \"\",\n\t\tisInsideToolCall: false,\n\t\ttoolCallCount: 0,\n\t};\n\n\treturn {\n\t\tfeed(textDelta: string): StreamParserEvent[] {\n\t\t\tconst events: StreamParserEvent[] = [];\n\t\t\tstate.buffer += textDelta;\n\n\t\t\tlet nextTagIndex = getPotentialStartIndex(\n\t\t\t\tstate.buffer,\n\t\t\t\tstate.isInsideToolCall ? options.toolCallEnd : options.toolCallStart,\n\t\t\t);\n\n\t\t\twhile (nextTagIndex != null) {\n\t\t\t\tconst currentTag = state.isInsideToolCall ? options.toolCallEnd : options.toolCallStart;\n\t\t\t\tif (nextTagIndex + currentTag.length > state.buffer.length) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (state.isInsideToolCall) {\n\t\t\t\t\tstate.currentToolCallJson += state.buffer.slice(0, nextTagIndex);\n\t\t\t\t\tstate.buffer = state.buffer.slice(nextTagIndex + currentTag.length);\n\t\t\t\t\temitToolCallProgress(state, events, tools, options);\n\t\t\t\t\tfinalizeToolCall(state, events, tools, options, parserOptions);\n\t\t\t\t} else {\n\t\t\t\t\temitText(events, state.buffer.slice(0, nextTagIndex));\n\t\t\t\t\tstate.buffer = state.buffer.slice(nextTagIndex + currentTag.length);\n\t\t\t\t\tstate.isInsideToolCall = true;\n\t\t\t\t\tstate.currentToolCallJson = \"\";\n\t\t\t\t\tstate.activeToolCall = null;\n\t\t\t\t}\n\n\t\t\t\tnextTagIndex = getPotentialStartIndex(\n\t\t\t\t\tstate.buffer,\n\t\t\t\t\tstate.isInsideToolCall ? options.toolCallEnd : options.toolCallStart,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (state.isInsideToolCall) {\n\t\t\t\tflushInsideToolCallBuffer(state, events, tools, options);\n\t\t\t} else {\n\t\t\t\tflushOutsideToolCallBuffer(state, events, options);\n\t\t\t}\n\n\t\t\treturn events;\n\t\t},\n\t\tfinish(): StreamParserEvent[] {\n\t\t\tconst events: StreamParserEvent[] = [];\n\n\t\t\tif (state.isInsideToolCall) {\n\t\t\t\tconst unfinishedToolCall = `${options.toolCallStart}${state.currentToolCallJson}${state.buffer}`;\n\t\t\t\tparserOptions?.onError?.(\"Could not complete streaming JSON tool call at finish.\", {\n\t\t\t\t\ttoolCall: unfinishedToolCall,\n\t\t\t\t});\n\t\t\t\tif (shouldEmitRawToolCallTextOnError(parserOptions)) {\n\t\t\t\t\temitText(events, unfinishedToolCall);\n\t\t\t\t}\n\t\t\t\tstate.activeToolCall = null;\n\t\t\t\tstate.currentToolCallJson = \"\";\n\t\t\t\tstate.isInsideToolCall = false;\n\t\t\t\tstate.buffer = \"\";\n\t\t\t\treturn events;\n\t\t\t}\n\n\t\t\temitText(events, state.buffer);\n\t\t\tstate.buffer = \"\";\n\t\t\treturn events;\n\t\t},\n\t};\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TextContent, Tool } from "../../types.ts";
|
|
2
|
+
import type { ParsedToolCall, ParserOptions, StreamParser } from "../types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Formats tools as an XML-style system prompt for MorphXml protocol.
|
|
5
|
+
* Ported from ai-sdk-tool-call-middleware morph-xml-prompt.ts
|
|
6
|
+
*/
|
|
7
|
+
export declare function morphXmlFormatToolsSystemPrompt(tools: Tool[]): string;
|
|
8
|
+
export declare function morphXmlFormatToolResponse(toolName: string, _toolCallId: string, content: TextContent[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Formats a tool call as XML for MorphXml protocol.
|
|
11
|
+
*/
|
|
12
|
+
export declare function morphXmlFormatToolCall(name: string, args: Record<string, unknown>): string;
|
|
13
|
+
export declare function parseMorphXmlGeneratedText(text: string, tools: Tool[], options?: ParserOptions): ParsedToolCall[];
|
|
14
|
+
export declare function createMorphXmlStreamParser(tools: Tool[], options?: ParserOptions): StreamParser;
|
|
15
|
+
//# sourceMappingURL=morph-xml.d.ts.map
|