@code-yeongyu/senpi 2026.5.20-4 → 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 +12 -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,161 @@
|
|
|
1
|
+
import { gemma4CreateStreamParser, gemma4FormatToolCall, gemma4FormatToolResponse, gemma4FormatToolsSystemPrompt, gemma4ParseGeneratedText, } from "./protocols/gemma4.js";
|
|
2
|
+
import { hermesCreateStreamParser, hermesFormatToolCall, hermesFormatToolResponse, hermesFormatToolsSystemPrompt, hermesParseGeneratedText, } from "./protocols/hermes.js";
|
|
3
|
+
import { createMorphXmlStreamParser, morphXmlFormatToolCall, morphXmlFormatToolResponse, morphXmlFormatToolsSystemPrompt, parseMorphXmlGeneratedText, } from "./protocols/morph-xml.js";
|
|
4
|
+
import { createYamlXmlStreamParser, parseYamlXmlGeneratedText, yamlXmlFormatToolCall, yamlXmlFormatToolResponse, yamlXmlFormatToolsSystemPrompt, } from "./protocols/yaml-xml.js";
|
|
5
|
+
/**
|
|
6
|
+
* Hermes protocol implementation for tool call formatting and parsing.
|
|
7
|
+
*/
|
|
8
|
+
const hermesProtocol = {
|
|
9
|
+
formatToolsSystemPrompt: hermesFormatToolsSystemPrompt,
|
|
10
|
+
formatToolResponse: hermesFormatToolResponse,
|
|
11
|
+
formatToolCall: hermesFormatToolCall,
|
|
12
|
+
parseGeneratedText: hermesParseGeneratedText,
|
|
13
|
+
createStreamParser: hermesCreateStreamParser,
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* MorphXml protocol implementation for tool call formatting and parsing.
|
|
17
|
+
*/
|
|
18
|
+
const morphXmlProtocol = {
|
|
19
|
+
formatToolsSystemPrompt: morphXmlFormatToolsSystemPrompt,
|
|
20
|
+
formatToolResponse: morphXmlFormatToolResponse,
|
|
21
|
+
formatToolCall: morphXmlFormatToolCall,
|
|
22
|
+
parseGeneratedText: parseMorphXmlGeneratedText,
|
|
23
|
+
createStreamParser: createMorphXmlStreamParser,
|
|
24
|
+
};
|
|
25
|
+
const yamlXmlProtocol = {
|
|
26
|
+
formatToolsSystemPrompt: yamlXmlFormatToolsSystemPrompt,
|
|
27
|
+
formatToolResponse: yamlXmlFormatToolResponse,
|
|
28
|
+
formatToolCall: yamlXmlFormatToolCall,
|
|
29
|
+
parseGeneratedText: parseYamlXmlGeneratedText,
|
|
30
|
+
createStreamParser: createYamlXmlStreamParser,
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Gemma 4 protocol implementation for tool call formatting and parsing.
|
|
34
|
+
*/
|
|
35
|
+
const gemma4Protocol = {
|
|
36
|
+
formatToolsSystemPrompt: gemma4FormatToolsSystemPrompt,
|
|
37
|
+
formatToolResponse: gemma4FormatToolResponse,
|
|
38
|
+
formatToolCall: gemma4FormatToolCall,
|
|
39
|
+
parseGeneratedText: gemma4ParseGeneratedText,
|
|
40
|
+
createStreamParser: gemma4CreateStreamParser,
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Protocol registry mapping format strings to protocol implementations.
|
|
44
|
+
*/
|
|
45
|
+
const protocolRegistry = {
|
|
46
|
+
hermes: hermesProtocol,
|
|
47
|
+
xml: morphXmlProtocol,
|
|
48
|
+
"yaml-xml": yamlXmlProtocol,
|
|
49
|
+
"gemma4-delimiter": gemma4Protocol,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Gets the protocol implementation for a given tool call format.
|
|
53
|
+
* @param format - The tool call format
|
|
54
|
+
* @returns The protocol implementation
|
|
55
|
+
* @throws Error if the format is not supported
|
|
56
|
+
*/
|
|
57
|
+
export function getProtocol(format) {
|
|
58
|
+
const protocol = protocolRegistry[format];
|
|
59
|
+
if (!protocol) {
|
|
60
|
+
throw new Error(`Unsupported tool call format: ${format}`);
|
|
61
|
+
}
|
|
62
|
+
return protocol;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Transforms a context for text-based tool calling.
|
|
66
|
+
* - Strips tools from context (provider sees tool-free request)
|
|
67
|
+
* - Injects tool definitions into system prompt
|
|
68
|
+
* - Converts tool call messages in history to text format
|
|
69
|
+
* - Converts tool result messages to user messages with text content
|
|
70
|
+
*
|
|
71
|
+
* @param context - The original context
|
|
72
|
+
* @param protocol - The protocol to use for formatting
|
|
73
|
+
* @returns A new transformed context (original is not mutated)
|
|
74
|
+
*/
|
|
75
|
+
export function transformContext(context, protocol) {
|
|
76
|
+
// Build new context without mutating original
|
|
77
|
+
const transformed = {
|
|
78
|
+
systemPrompt: context.systemPrompt,
|
|
79
|
+
messages: context.messages.map((msg) => transformMessage(msg, protocol)),
|
|
80
|
+
tools: undefined, // Strip tools - provider sees tool-free request
|
|
81
|
+
};
|
|
82
|
+
// Inject tool definitions into system prompt if tools exist
|
|
83
|
+
if (context.tools && context.tools.length > 0) {
|
|
84
|
+
const toolPrompt = protocol.formatToolsSystemPrompt(context.tools);
|
|
85
|
+
if (toolPrompt) {
|
|
86
|
+
transformed.systemPrompt = context.systemPrompt ? `${toolPrompt}\n\n${context.systemPrompt}` : toolPrompt;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return transformed;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Transforms a single message for text-based tool calling.
|
|
93
|
+
* - AssistantMessage with ToolCall blocks: convert to text
|
|
94
|
+
* - ToolResultMessage: convert to UserMessage with text content
|
|
95
|
+
* - Other messages: pass through unchanged
|
|
96
|
+
*/
|
|
97
|
+
function transformMessage(message, protocol) {
|
|
98
|
+
switch (message.role) {
|
|
99
|
+
case "assistant": {
|
|
100
|
+
return transformAssistantMessage(message, protocol);
|
|
101
|
+
}
|
|
102
|
+
case "toolResult": {
|
|
103
|
+
return transformToolResultMessage(message, protocol);
|
|
104
|
+
}
|
|
105
|
+
default: {
|
|
106
|
+
return message;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Transforms an AssistantMessage, converting ToolCall content blocks to text.
|
|
112
|
+
*/
|
|
113
|
+
function transformAssistantMessage(message, protocol) {
|
|
114
|
+
// Check if message has any ToolCall content blocks
|
|
115
|
+
const hasToolCalls = message.content.some((block) => block.type === "toolCall");
|
|
116
|
+
if (!hasToolCalls) {
|
|
117
|
+
// No tool calls - pass through unchanged
|
|
118
|
+
return message;
|
|
119
|
+
}
|
|
120
|
+
// Transform content blocks
|
|
121
|
+
const newContent = [];
|
|
122
|
+
for (const block of message.content) {
|
|
123
|
+
switch (block.type) {
|
|
124
|
+
case "text": {
|
|
125
|
+
newContent.push(block);
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case "thinking": {
|
|
129
|
+
newContent.push(block);
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
case "toolCall": {
|
|
133
|
+
const toolCallText = protocol.formatToolCall(block.name, block.arguments);
|
|
134
|
+
newContent.push({
|
|
135
|
+
type: "text",
|
|
136
|
+
text: toolCallText,
|
|
137
|
+
});
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// Return new AssistantMessage with transformed content
|
|
143
|
+
return {
|
|
144
|
+
...message,
|
|
145
|
+
content: newContent,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Transforms a ToolResultMessage to a UserMessage with text content.
|
|
150
|
+
*/
|
|
151
|
+
function transformToolResultMessage(message, protocol) {
|
|
152
|
+
// Format tool result as text using protocol formatter
|
|
153
|
+
const formattedResponse = protocol.formatToolResponse(message.toolName, message.toolCallId, message.content);
|
|
154
|
+
// Return as UserMessage with text content
|
|
155
|
+
return {
|
|
156
|
+
role: "user",
|
|
157
|
+
content: formattedResponse,
|
|
158
|
+
timestamp: message.timestamp,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=context-transformer.js.map
|
package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-transformer.js","sourceRoot":"","sources":["../../src/tool-call-middleware/context-transformer.ts"],"names":[],"mappings":"AASA,OAAO,EACN,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,6BAA6B,EAC7B,wBAAwB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,6BAA6B,EAC7B,wBAAwB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,0BAA0B,EAC1B,sBAAsB,EACtB,0BAA0B,EAC1B,+BAA+B,EAC/B,0BAA0B,GAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,EACzB,8BAA8B,GAC9B,MAAM,yBAAyB,CAAC;AAGjC;;GAEG;AACH,MAAM,cAAc,GAAqB;IACxC,uBAAuB,EAAE,6BAA6B;IACtD,kBAAkB,EAAE,wBAAwB;IAC5C,cAAc,EAAE,oBAAoB;IACpC,kBAAkB,EAAE,wBAAwB;IAC5C,kBAAkB,EAAE,wBAAwB;CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,gBAAgB,GAAqB;IAC1C,uBAAuB,EAAE,+BAA+B;IACxD,kBAAkB,EAAE,0BAA0B;IAC9C,cAAc,EAAE,sBAAsB;IACtC,kBAAkB,EAAE,0BAA0B;IAC9C,kBAAkB,EAAE,0BAA0B;CAC9C,CAAC;AAEF,MAAM,eAAe,GAAqB;IACzC,uBAAuB,EAAE,8BAA8B;IACvD,kBAAkB,EAAE,yBAAyB;IAC7C,cAAc,EAAE,qBAAqB;IACrC,kBAAkB,EAAE,yBAAyB;IAC7C,kBAAkB,EAAE,yBAAyB;CAC7C,CAAC;AAEF;;GAEG;AACH,MAAM,cAAc,GAAqB;IACxC,uBAAuB,EAAE,6BAA6B;IACtD,kBAAkB,EAAE,wBAAwB;IAC5C,cAAc,EAAE,oBAAoB;IACpC,kBAAkB,EAAE,wBAAwB;IAC5C,kBAAkB,EAAE,wBAAwB;CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,gBAAgB,GAA6C;IAClE,MAAM,EAAE,cAAc;IACtB,GAAG,EAAE,gBAAgB;IACrB,UAAU,EAAE,eAAe;IAC3B,kBAAkB,EAAE,cAAc;CAClC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,MAAsB,EAAoB;IACrE,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iCAAiC,MAAM,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,QAAQ,CAAC;AAAA,CAChB;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB,EAAE,QAA0B,EAAW;IACvF,8CAA8C;IAC9C,MAAM,WAAW,GAAY;QAC5B,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACxE,KAAK,EAAE,SAAS,EAAE,gDAAgD;KAClE,CAAC;IAEF,4DAA4D;IAC5D,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/C,MAAM,UAAU,GAAG,QAAQ,CAAC,uBAAuB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACnE,IAAI,UAAU,EAAE,CAAC;YAChB,WAAW,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,UAAU,OAAO,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;QAC3G,CAAC;IACF,CAAC;IAED,OAAO,WAAW,CAAC;AAAA,CACnB;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,OAAgB,EAAE,QAA0B,EAAW;IAChF,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACtB,KAAK,WAAW,EAAE,CAAC;YAClB,OAAO,yBAAyB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACrD,CAAC;QACD,KAAK,YAAY,EAAE,CAAC;YACnB,OAAO,0BAA0B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACtD,CAAC;QACD,SAAS,CAAC;YACT,OAAO,OAAO,CAAC;QAChB,CAAC;IACF,CAAC;AAAA,CACD;AAED;;GAEG;AACH,SAAS,yBAAyB,CAAC,OAAyB,EAAE,QAA0B,EAAoB;IAC3G,mDAAmD;IACnD,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IAChF,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,yCAAyC;QACzC,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,2BAA2B;IAC3B,MAAM,UAAU,GAAsC,EAAE,CAAC;IAEzD,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACrC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,MAAM,EAAE,CAAC;gBACb,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACvB,MAAM;YACP,CAAC;YACD,KAAK,UAAU,EAAE,CAAC;gBACjB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACvB,MAAM;YACP,CAAC;YACD,KAAK,UAAU,EAAE,CAAC;gBACjB,MAAM,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;gBAC1E,UAAU,CAAC,IAAI,CAAC;oBACf,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,YAAY;iBAClB,CAAC,CAAC;gBACH,MAAM;YACP,CAAC;QACF,CAAC;IACF,CAAC;IAED,uDAAuD;IACvD,OAAO;QACN,GAAG,OAAO;QACV,OAAO,EAAE,UAAU;KACnB,CAAC;AAAA,CACF;AAED;;GAEG;AACH,SAAS,0BAA0B,CAAC,OAA0B,EAAE,QAA0B,EAAe;IACxG,sDAAsD;IACtD,MAAM,iBAAiB,GAAG,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7G,0CAA0C;IAC1C,OAAO;QACN,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,iBAAiB;QAC1B,SAAS,EAAE,OAAO,CAAC,SAAS;KAC5B,CAAC;AAAA,CACF","sourcesContent":["import type {\n\tAssistantMessage,\n\tContext,\n\tMessage,\n\tTextContent,\n\tThinkingContent,\n\tToolResultMessage,\n\tUserMessage,\n} from \"../types.ts\";\nimport {\n\tgemma4CreateStreamParser,\n\tgemma4FormatToolCall,\n\tgemma4FormatToolResponse,\n\tgemma4FormatToolsSystemPrompt,\n\tgemma4ParseGeneratedText,\n} from \"./protocols/gemma4.ts\";\nimport {\n\thermesCreateStreamParser,\n\thermesFormatToolCall,\n\thermesFormatToolResponse,\n\thermesFormatToolsSystemPrompt,\n\thermesParseGeneratedText,\n} from \"./protocols/hermes.ts\";\nimport {\n\tcreateMorphXmlStreamParser,\n\tmorphXmlFormatToolCall,\n\tmorphXmlFormatToolResponse,\n\tmorphXmlFormatToolsSystemPrompt,\n\tparseMorphXmlGeneratedText,\n} from \"./protocols/morph-xml.ts\";\nimport {\n\tcreateYamlXmlStreamParser,\n\tparseYamlXmlGeneratedText,\n\tyamlXmlFormatToolCall,\n\tyamlXmlFormatToolResponse,\n\tyamlXmlFormatToolsSystemPrompt,\n} from \"./protocols/yaml-xml.ts\";\nimport type { ToolCallFormat, ToolCallProtocol } from \"./types.ts\";\n\n/**\n * Hermes protocol implementation for tool call formatting and parsing.\n */\nconst hermesProtocol: ToolCallProtocol = {\n\tformatToolsSystemPrompt: hermesFormatToolsSystemPrompt,\n\tformatToolResponse: hermesFormatToolResponse,\n\tformatToolCall: hermesFormatToolCall,\n\tparseGeneratedText: hermesParseGeneratedText,\n\tcreateStreamParser: hermesCreateStreamParser,\n};\n\n/**\n * MorphXml protocol implementation for tool call formatting and parsing.\n */\nconst morphXmlProtocol: ToolCallProtocol = {\n\tformatToolsSystemPrompt: morphXmlFormatToolsSystemPrompt,\n\tformatToolResponse: morphXmlFormatToolResponse,\n\tformatToolCall: morphXmlFormatToolCall,\n\tparseGeneratedText: parseMorphXmlGeneratedText,\n\tcreateStreamParser: createMorphXmlStreamParser,\n};\n\nconst yamlXmlProtocol: ToolCallProtocol = {\n\tformatToolsSystemPrompt: yamlXmlFormatToolsSystemPrompt,\n\tformatToolResponse: yamlXmlFormatToolResponse,\n\tformatToolCall: yamlXmlFormatToolCall,\n\tparseGeneratedText: parseYamlXmlGeneratedText,\n\tcreateStreamParser: createYamlXmlStreamParser,\n};\n\n/**\n * Gemma 4 protocol implementation for tool call formatting and parsing.\n */\nconst gemma4Protocol: ToolCallProtocol = {\n\tformatToolsSystemPrompt: gemma4FormatToolsSystemPrompt,\n\tformatToolResponse: gemma4FormatToolResponse,\n\tformatToolCall: gemma4FormatToolCall,\n\tparseGeneratedText: gemma4ParseGeneratedText,\n\tcreateStreamParser: gemma4CreateStreamParser,\n};\n\n/**\n * Protocol registry mapping format strings to protocol implementations.\n */\nconst protocolRegistry: Record<ToolCallFormat, ToolCallProtocol> = {\n\thermes: hermesProtocol,\n\txml: morphXmlProtocol,\n\t\"yaml-xml\": yamlXmlProtocol,\n\t\"gemma4-delimiter\": gemma4Protocol,\n};\n\n/**\n * Gets the protocol implementation for a given tool call format.\n * @param format - The tool call format\n * @returns The protocol implementation\n * @throws Error if the format is not supported\n */\nexport function getProtocol(format: ToolCallFormat): ToolCallProtocol {\n\tconst protocol = protocolRegistry[format];\n\tif (!protocol) {\n\t\tthrow new Error(`Unsupported tool call format: ${format}`);\n\t}\n\treturn protocol;\n}\n\n/**\n * Transforms a context for text-based tool calling.\n * - Strips tools from context (provider sees tool-free request)\n * - Injects tool definitions into system prompt\n * - Converts tool call messages in history to text format\n * - Converts tool result messages to user messages with text content\n *\n * @param context - The original context\n * @param protocol - The protocol to use for formatting\n * @returns A new transformed context (original is not mutated)\n */\nexport function transformContext(context: Context, protocol: ToolCallProtocol): Context {\n\t// Build new context without mutating original\n\tconst transformed: Context = {\n\t\tsystemPrompt: context.systemPrompt,\n\t\tmessages: context.messages.map((msg) => transformMessage(msg, protocol)),\n\t\ttools: undefined, // Strip tools - provider sees tool-free request\n\t};\n\n\t// Inject tool definitions into system prompt if tools exist\n\tif (context.tools && context.tools.length > 0) {\n\t\tconst toolPrompt = protocol.formatToolsSystemPrompt(context.tools);\n\t\tif (toolPrompt) {\n\t\t\ttransformed.systemPrompt = context.systemPrompt ? `${toolPrompt}\\n\\n${context.systemPrompt}` : toolPrompt;\n\t\t}\n\t}\n\n\treturn transformed;\n}\n\n/**\n * Transforms a single message for text-based tool calling.\n * - AssistantMessage with ToolCall blocks: convert to text\n * - ToolResultMessage: convert to UserMessage with text content\n * - Other messages: pass through unchanged\n */\nfunction transformMessage(message: Message, protocol: ToolCallProtocol): Message {\n\tswitch (message.role) {\n\t\tcase \"assistant\": {\n\t\t\treturn transformAssistantMessage(message, protocol);\n\t\t}\n\t\tcase \"toolResult\": {\n\t\t\treturn transformToolResultMessage(message, protocol);\n\t\t}\n\t\tdefault: {\n\t\t\treturn message;\n\t\t}\n\t}\n}\n\n/**\n * Transforms an AssistantMessage, converting ToolCall content blocks to text.\n */\nfunction transformAssistantMessage(message: AssistantMessage, protocol: ToolCallProtocol): AssistantMessage {\n\t// Check if message has any ToolCall content blocks\n\tconst hasToolCalls = message.content.some((block) => block.type === \"toolCall\");\n\tif (!hasToolCalls) {\n\t\t// No tool calls - pass through unchanged\n\t\treturn message;\n\t}\n\n\t// Transform content blocks\n\tconst newContent: (TextContent | ThinkingContent)[] = [];\n\n\tfor (const block of message.content) {\n\t\tswitch (block.type) {\n\t\t\tcase \"text\": {\n\t\t\t\tnewContent.push(block);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"thinking\": {\n\t\t\t\tnewContent.push(block);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"toolCall\": {\n\t\t\t\tconst toolCallText = protocol.formatToolCall(block.name, block.arguments);\n\t\t\t\tnewContent.push({\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext: toolCallText,\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return new AssistantMessage with transformed content\n\treturn {\n\t\t...message,\n\t\tcontent: newContent,\n\t};\n}\n\n/**\n * Transforms a ToolResultMessage to a UserMessage with text content.\n */\nfunction transformToolResultMessage(message: ToolResultMessage, protocol: ToolCallProtocol): UserMessage {\n\t// Format tool result as text using protocol formatter\n\tconst formattedResponse = protocol.formatToolResponse(message.toolName, message.toolCallId, message.content);\n\n\t// Return as UserMessage with text content\n\treturn {\n\t\trole: \"user\",\n\t\tcontent: formattedResponse,\n\t\ttimestamp: message.timestamp,\n\t};\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Api, Model } from "../types.ts";
|
|
2
|
+
import type { ToolCallFormat } from "./types.ts";
|
|
3
|
+
export { getProtocol, transformContext } from "./context-transformer.ts";
|
|
4
|
+
export { wrapStreamWithToolCallMiddleware } from "./stream-wrapper.ts";
|
|
5
|
+
export type { ParsedToolCall, StreamParser, StreamParserEvent, ToolCallFormat, ToolCallProtocol, ToolResultContent, } from "./types.ts";
|
|
6
|
+
/**
|
|
7
|
+
* Extracts the tool call format from a model's compatibility settings.
|
|
8
|
+
* Only applies to models using the "openai-completions" API with compat settings.
|
|
9
|
+
* @param model - The model to check
|
|
10
|
+
* @returns The tool call format ("hermes", "xml", "yaml-xml", or "gemma4-delimiter") or undefined if not set
|
|
11
|
+
*/
|
|
12
|
+
export declare function getToolCallFormat<TApi extends Api>(model: Model<TApi>): ToolCallFormat | undefined;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tool-call-middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAA2B,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,YAAY,EACX,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,cAAc,GAAG,SAAS,CAalG","sourcesContent":["import type { Api, Model, OpenAICompletionsCompat } from \"../types.ts\";\nimport type { ToolCallFormat } from \"./types.ts\";\n\nexport { getProtocol, transformContext } from \"./context-transformer.ts\";\nexport { wrapStreamWithToolCallMiddleware } from \"./stream-wrapper.ts\";\nexport type {\n\tParsedToolCall,\n\tStreamParser,\n\tStreamParserEvent,\n\tToolCallFormat,\n\tToolCallProtocol,\n\tToolResultContent,\n} from \"./types.ts\";\n\n/**\n * Extracts the tool call format from a model's compatibility settings.\n * Only applies to models using the \"openai-completions\" API with compat settings.\n * @param model - The model to check\n * @returns The tool call format (\"hermes\", \"xml\", \"yaml-xml\", or \"gemma4-delimiter\") or undefined if not set\n */\nexport function getToolCallFormat<TApi extends Api>(model: Model<TApi>): ToolCallFormat | undefined {\n\tif (model.api !== \"openai-completions\") {\n\t\treturn undefined;\n\t}\n\tconst compat = model.compat as OpenAICompletionsCompat | undefined;\n\tconst format = compat?.toolCallFormat;\n\tif (!format) {\n\t\treturn undefined;\n\t}\n\tif (format === \"hermes\" || format === \"xml\" || format === \"yaml-xml\" || format === \"gemma4-delimiter\") {\n\t\treturn format;\n\t}\n\treturn undefined;\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { getProtocol, transformContext } from "./context-transformer.js";
|
|
2
|
+
export { wrapStreamWithToolCallMiddleware } from "./stream-wrapper.js";
|
|
3
|
+
/**
|
|
4
|
+
* Extracts the tool call format from a model's compatibility settings.
|
|
5
|
+
* Only applies to models using the "openai-completions" API with compat settings.
|
|
6
|
+
* @param model - The model to check
|
|
7
|
+
* @returns The tool call format ("hermes", "xml", "yaml-xml", or "gemma4-delimiter") or undefined if not set
|
|
8
|
+
*/
|
|
9
|
+
export function getToolCallFormat(model) {
|
|
10
|
+
if (model.api !== "openai-completions") {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
const compat = model.compat;
|
|
14
|
+
const format = compat?.toolCallFormat;
|
|
15
|
+
if (!format) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
if (format === "hermes" || format === "xml" || format === "yaml-xml" || format === "gemma4-delimiter") {
|
|
19
|
+
return format;
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tool-call-middleware/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AAUvE;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAmB,KAAkB,EAA8B;IACnG,IAAI,KAAK,CAAC,GAAG,KAAK,oBAAoB,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,MAA6C,CAAC;IACnE,MAAM,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC;IACtC,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,UAAU,IAAI,MAAM,KAAK,kBAAkB,EAAE,CAAC;QACvG,OAAO,MAAM,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AAAA,CACjB","sourcesContent":["import type { Api, Model, OpenAICompletionsCompat } from \"../types.ts\";\nimport type { ToolCallFormat } from \"./types.ts\";\n\nexport { getProtocol, transformContext } from \"./context-transformer.ts\";\nexport { wrapStreamWithToolCallMiddleware } from \"./stream-wrapper.ts\";\nexport type {\n\tParsedToolCall,\n\tStreamParser,\n\tStreamParserEvent,\n\tToolCallFormat,\n\tToolCallProtocol,\n\tToolResultContent,\n} from \"./types.ts\";\n\n/**\n * Extracts the tool call format from a model's compatibility settings.\n * Only applies to models using the \"openai-completions\" API with compat settings.\n * @param model - The model to check\n * @returns The tool call format (\"hermes\", \"xml\", \"yaml-xml\", or \"gemma4-delimiter\") or undefined if not set\n */\nexport function getToolCallFormat<TApi extends Api>(model: Model<TApi>): ToolCallFormat | undefined {\n\tif (model.api !== \"openai-completions\") {\n\t\treturn undefined;\n\t}\n\tconst compat = model.compat as OpenAICompletionsCompat | undefined;\n\tconst format = compat?.toolCallFormat;\n\tif (!format) {\n\t\treturn undefined;\n\t}\n\tif (format === \"hermes\" || format === \"xml\" || format === \"yaml-xml\" || format === \"gemma4-delimiter\") {\n\t\treturn format;\n\t}\n\treturn undefined;\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ImageContent, TextContent, Tool } from "../../types.ts";
|
|
2
|
+
import type { ParsedToolCall, ParserOptions, StreamParser } from "../types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Formats a complete tool call in Gemma 4 format.
|
|
5
|
+
* Format: <|tool_call>call:name{key:<|"|>value<|"|>,...}<tool_call|>
|
|
6
|
+
*/
|
|
7
|
+
export declare function gemma4FormatToolCall(name: string, args: Record<string, unknown>): string;
|
|
8
|
+
/**
|
|
9
|
+
* Formats a tool response for Gemma 4.
|
|
10
|
+
* Format: <|tool_response>content
|
|
11
|
+
*/
|
|
12
|
+
export declare function gemma4FormatToolResponse(_toolName: string, _toolCallId: string, content: (TextContent | ImageContent)[]): string;
|
|
13
|
+
/**
|
|
14
|
+
* Generates a system prompt describing available tools for Gemma 4.
|
|
15
|
+
* Includes tool definitions with JSON schemas and usage instructions.
|
|
16
|
+
*/
|
|
17
|
+
export declare function gemma4FormatToolsSystemPrompt(tools: Tool[]): string;
|
|
18
|
+
export declare function parseGemma4Args(argsString: string, partial?: boolean): Record<string, unknown>;
|
|
19
|
+
export declare function gemma4ParseGeneratedText(text: string, _tools: Tool[], _options?: ParserOptions): ParsedToolCall[];
|
|
20
|
+
export declare function gemma4CreateStreamParser(_tools: Tool[], _options?: ParserOptions): StreamParser;
|
|
21
|
+
//# sourceMappingURL=gemma4.d.ts.map
|
package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemma4.d.ts","sourceRoot":"","sources":["../../../src/tool-call-middleware/protocols/gemma4.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AA0DlG;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAGxF;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACvC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,CAAC,WAAW,GAAG,YAAY,CAAC,EAAE,GACrC,MAAM,CAQR;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CA8BnE;AA0HD,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsI5F;AAqFD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,cAAc,EAAE,CAgBjH;AAsMD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,YAAY,CAE/F","sourcesContent":["import type { ImageContent, TextContent, Tool } from \"../../types.ts\";\nimport type { ParsedToolCall, ParserOptions, StreamParser, StreamParserEvent } from \"../types.ts\";\n\nconst STRING_DELIM = '<|\"|>';\nconst TOOL_CALL_START = \"<|tool_call>\";\nconst TOOL_CALL_END = \"<tool_call|>\";\nconst TURN_END = \"<turn|>\";\nconst TOOL_RESPONSE_START = \"<|tool_response>\";\nconst TOOL_CALL_REGEX = /<\\|tool_call>call:([\\w\\-.]+)\\{(.*?)\\}(?:<tool_call\\|>|<turn\\|>)/gs;\n\n/**\n * Formats a value for Gemma 4's custom serialization format.\n * Strings are wrapped in <|\"|> delimiters.\n * Numbers, booleans, and null are rendered as bare values.\n * Objects and arrays are recursively formatted.\n */\nfunction formatGemma4Value(value: unknown): string {\n\tif (value === null) {\n\t\treturn \"null\";\n\t}\n\n\tif (value === undefined) {\n\t\treturn \"null\";\n\t}\n\n\tif (typeof value === \"string\") {\n\t\treturn STRING_DELIM + value + STRING_DELIM;\n\t}\n\n\tif (typeof value === \"number\" || typeof value === \"boolean\") {\n\t\treturn String(value);\n\t}\n\n\tif (Array.isArray(value)) {\n\t\tconst items = value.map((item) => formatGemma4Value(item));\n\t\treturn `[${items.join(\",\")}]`;\n\t}\n\n\tif (typeof value === \"object\" && value !== null) {\n\t\tconst entries = Object.entries(value).map(([key, val]) => {\n\t\t\treturn `${key}:${formatGemma4Value(val)}`;\n\t\t});\n\t\treturn `{${entries.join(\",\")}}`;\n\t}\n\n\treturn STRING_DELIM + String(value) + STRING_DELIM;\n}\n\n/**\n * Formats tool arguments for Gemma 4's custom format.\n * Returns the content inside the braces: key:<|\"|>value<|\"|>,...\n */\nfunction formatGemma4Args(args: Record<string, unknown>): string {\n\tconst entries = Object.entries(args).map(([key, value]) => {\n\t\treturn `${key}:${formatGemma4Value(value)}`;\n\t});\n\treturn entries.join(\",\");\n}\n\n/**\n * Formats a complete tool call in Gemma 4 format.\n * Format: <|tool_call>call:name{key:<|\"|>value<|\"|>,...}<tool_call|>\n */\nexport function gemma4FormatToolCall(name: string, args: Record<string, unknown>): string {\n\tconst argsStr = formatGemma4Args(args);\n\treturn `${TOOL_CALL_START}call:${name}{${argsStr}}${TOOL_CALL_END}`;\n}\n\n/**\n * Formats a tool response for Gemma 4.\n * Format: <|tool_response>content\n */\nexport function gemma4FormatToolResponse(\n\t_toolName: string,\n\t_toolCallId: string,\n\tcontent: (TextContent | ImageContent)[],\n): string {\n\tconst textParts: string[] = [];\n\tfor (const item of content) {\n\t\tif (item.type === \"text\") {\n\t\t\ttextParts.push(item.text);\n\t\t}\n\t}\n\treturn TOOL_RESPONSE_START + textParts.join(\"\\n\");\n}\n\n/**\n * Generates a system prompt describing available tools for Gemma 4.\n * Includes tool definitions with JSON schemas and usage instructions.\n */\nexport function gemma4FormatToolsSystemPrompt(tools: Tool[]): string {\n\tif (tools.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst toolDescriptions = tools.map((tool) => {\n\t\tconst schema = JSON.stringify(tool.parameters, null, 3);\n\t\treturn `Name: ${tool.name}\nDescription: ${tool.description}\nParameters Schema:\n${schema}`;\n\t});\n\n\treturn `You have access to the following tools. Use them when appropriate.\n\n${toolDescriptions.join(\"\\n\\n\")}\n\nWhen you need to use a tool, format your response exactly like this:\n\n${TOOL_CALL_START}call:name{key:${STRING_DELIM}value${STRING_DELIM}}${TOOL_CALL_END}\n\nImportant formatting rules:\n- String values must be wrapped in ${STRING_DELIM} delimiters\n- Numbers and booleans should be bare values (no delimiters)\n- Multiple arguments are separated by commas\n- Nested objects use {key:value} syntax\n- Arrays use [value1,value2] syntax\n\nExample:\n${TOOL_CALL_START}call:get_weather{location:${STRING_DELIM}London${STRING_DELIM},unit:${STRING_DELIM}celsius${STRING_DELIM}}${TOOL_CALL_END}`;\n}\n\nfunction parseGemma4Value(valueString: string): unknown {\n\tconst trimmedValue = valueString.trim();\n\tif (!trimmedValue) {\n\t\treturn trimmedValue;\n\t}\n\n\tif (trimmedValue === \"true\") {\n\t\treturn true;\n\t}\n\n\tif (trimmedValue === \"false\") {\n\t\treturn false;\n\t}\n\n\tif (trimmedValue.includes(\".\")) {\n\t\tconst parsedFloat = /^-?(?:\\d+\\.\\d*|\\.\\d+)$/.test(trimmedValue) ? Number.parseFloat(trimmedValue) : Number.NaN;\n\t\treturn Number.isNaN(parsedFloat) ? trimmedValue : parsedFloat;\n\t}\n\n\tif (/^-?\\d+$/.test(trimmedValue)) {\n\t\treturn Number.parseInt(trimmedValue, 10);\n\t}\n\n\treturn trimmedValue;\n}\n\nfunction parseGemma4Array(arrayString: string, partial = false): unknown[] {\n\tconst items: unknown[] = [];\n\tlet index = 0;\n\n\twhile (index < arrayString.length) {\n\t\twhile (index < arrayString.length && [\" \", \",\", \"\\n\", \"\\t\"].includes(arrayString[index] ?? \"\")) {\n\t\t\tindex += 1;\n\t\t}\n\n\t\tif (index >= arrayString.length) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (arrayString.startsWith(STRING_DELIM, index)) {\n\t\t\tindex += STRING_DELIM.length;\n\t\t\tconst endIndex = arrayString.indexOf(STRING_DELIM, index);\n\t\t\tif (endIndex === -1) {\n\t\t\t\titems.push(arrayString.slice(index));\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\titems.push(arrayString.slice(index, endIndex));\n\t\t\tindex = endIndex + STRING_DELIM.length;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arrayString[index] === \"{\") {\n\t\t\tlet depth = 1;\n\t\t\tconst objectStart = index + 1;\n\t\t\tindex += 1;\n\n\t\t\twhile (index < arrayString.length && depth > 0) {\n\t\t\t\tif (arrayString.startsWith(STRING_DELIM, index)) {\n\t\t\t\t\tindex += STRING_DELIM.length;\n\t\t\t\t\tconst nextDelimiter = arrayString.indexOf(STRING_DELIM, index);\n\t\t\t\t\tindex = nextDelimiter === -1 ? arrayString.length : nextDelimiter + STRING_DELIM.length;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (arrayString[index] === \"{\") {\n\t\t\t\t\tdepth += 1;\n\t\t\t\t} else if (arrayString[index] === \"}\") {\n\t\t\t\t\tdepth -= 1;\n\t\t\t\t}\n\n\t\t\t\tindex += 1;\n\t\t\t}\n\n\t\t\tif (depth > 0) {\n\t\t\t\titems.push(parseGemma4Args(arrayString.slice(objectStart, index), true));\n\t\t\t} else {\n\t\t\t\titems.push(parseGemma4Args(arrayString.slice(objectStart, index - 1)));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (arrayString[index] === \"[\") {\n\t\t\tlet depth = 1;\n\t\t\tconst subArrayStart = index + 1;\n\t\t\tindex += 1;\n\n\t\t\twhile (index < arrayString.length && depth > 0) {\n\t\t\t\tif (arrayString[index] === \"[\") {\n\t\t\t\t\tdepth += 1;\n\t\t\t\t} else if (arrayString[index] === \"]\") {\n\t\t\t\t\tdepth -= 1;\n\t\t\t\t}\n\n\t\t\t\tindex += 1;\n\t\t\t}\n\n\t\t\tif (depth > 0) {\n\t\t\t\titems.push(parseGemma4Array(arrayString.slice(subArrayStart, index), true));\n\t\t\t} else {\n\t\t\t\titems.push(parseGemma4Array(arrayString.slice(subArrayStart, index - 1)));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst valueStart = index;\n\t\twhile (index < arrayString.length && ![\",\", \"]\"].includes(arrayString[index] ?? \"\")) {\n\t\t\tindex += 1;\n\t\t}\n\n\t\tif (partial && index >= arrayString.length) {\n\t\t\tbreak;\n\t\t}\n\n\t\titems.push(parseGemma4Value(arrayString.slice(valueStart, index)));\n\t}\n\n\treturn items;\n}\n\nexport function parseGemma4Args(argsString: string, partial = false): Record<string, unknown> {\n\tif (!argsString.trim()) {\n\t\treturn {};\n\t}\n\n\tconst result: Record<string, unknown> = {};\n\tlet index = 0;\n\n\twhile (index < argsString.length) {\n\t\twhile (index < argsString.length && [\" \", \",\", \"\\n\", \"\\t\"].includes(argsString[index] ?? \"\")) {\n\t\t\tindex += 1;\n\t\t}\n\n\t\tif (index >= argsString.length) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst keyStart = index;\n\t\twhile (index < argsString.length && argsString[index] !== \":\") {\n\t\t\tindex += 1;\n\t\t}\n\n\t\tif (index >= argsString.length) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst key = argsString.slice(keyStart, index).trim();\n\t\tindex += 1;\n\n\t\tif (index >= argsString.length) {\n\t\t\tif (!partial) {\n\t\t\t\tresult[key] = \"\";\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\twhile (index < argsString.length && [\" \", \"\\n\", \"\\t\"].includes(argsString[index] ?? \"\")) {\n\t\t\tindex += 1;\n\t\t}\n\n\t\tif (index >= argsString.length) {\n\t\t\tif (!partial) {\n\t\t\t\tresult[key] = \"\";\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tif (argsString.startsWith(STRING_DELIM, index)) {\n\t\t\tindex += STRING_DELIM.length;\n\t\t\tconst valueStart = index;\n\t\t\tconst endIndex = argsString.indexOf(STRING_DELIM, index);\n\t\t\tif (endIndex === -1) {\n\t\t\t\tresult[key] = argsString.slice(valueStart);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tresult[key] = argsString.slice(valueStart, endIndex);\n\t\t\tindex = endIndex + STRING_DELIM.length;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argsString[index] === \"{\") {\n\t\t\tlet depth = 1;\n\t\t\tconst objectStart = index + 1;\n\t\t\tindex += 1;\n\n\t\t\twhile (index < argsString.length && depth > 0) {\n\t\t\t\tif (argsString.startsWith(STRING_DELIM, index)) {\n\t\t\t\t\tindex += STRING_DELIM.length;\n\t\t\t\t\tconst nextDelimiter = argsString.indexOf(STRING_DELIM, index);\n\t\t\t\t\tindex = nextDelimiter === -1 ? argsString.length : nextDelimiter + STRING_DELIM.length;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (argsString[index] === \"{\") {\n\t\t\t\t\tdepth += 1;\n\t\t\t\t} else if (argsString[index] === \"}\") {\n\t\t\t\t\tdepth -= 1;\n\t\t\t\t}\n\n\t\t\t\tindex += 1;\n\t\t\t}\n\n\t\t\tif (depth > 0) {\n\t\t\t\tresult[key] = parseGemma4Args(argsString.slice(objectStart, index), true);\n\t\t\t} else {\n\t\t\t\tresult[key] = parseGemma4Args(argsString.slice(objectStart, index - 1));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argsString[index] === \"[\") {\n\t\t\tlet depth = 1;\n\t\t\tconst arrayStart = index + 1;\n\t\t\tindex += 1;\n\n\t\t\twhile (index < argsString.length && depth > 0) {\n\t\t\t\tif (argsString.startsWith(STRING_DELIM, index)) {\n\t\t\t\t\tindex += STRING_DELIM.length;\n\t\t\t\t\tconst nextDelimiter = argsString.indexOf(STRING_DELIM, index);\n\t\t\t\t\tindex = nextDelimiter === -1 ? argsString.length : nextDelimiter + STRING_DELIM.length;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (argsString[index] === \"[\") {\n\t\t\t\t\tdepth += 1;\n\t\t\t\t} else if (argsString[index] === \"]\") {\n\t\t\t\t\tdepth -= 1;\n\t\t\t\t}\n\n\t\t\t\tindex += 1;\n\t\t\t}\n\n\t\t\tif (depth > 0) {\n\t\t\t\tresult[key] = parseGemma4Array(argsString.slice(arrayStart, index), true);\n\t\t\t} else {\n\t\t\t\tresult[key] = parseGemma4Array(argsString.slice(arrayStart, index - 1));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst valueStart = index;\n\t\twhile (index < argsString.length && ![\",\", \"}\", \"]\"].includes(argsString[index] ?? \"\")) {\n\t\t\tindex += 1;\n\t\t}\n\n\t\tif (partial && index >= argsString.length) {\n\t\t\tbreak;\n\t\t}\n\n\t\tresult[key] = parseGemma4Value(argsString.slice(valueStart, index));\n\t}\n\n\treturn result;\n}\n\nfunction findCommonPrefix(left: string, right: string): string {\n\tconst maxLength = Math.min(left.length, right.length);\n\tlet index = 0;\n\n\twhile (index < maxLength && left[index] === right[index]) {\n\t\tindex += 1;\n\t}\n\n\treturn left.slice(0, index);\n}\n\nfunction extractToolCalls(text: string): RegExpExecArray[] {\n\treturn Array.from(text.matchAll(TOOL_CALL_REGEX));\n}\n\nfunction extractPartialToolCall(content: string): {\n\tname: string | null;\n\trawArgs: string;\n} {\n\tif (!content.startsWith(\"call:\")) {\n\t\treturn { name: null, rawArgs: \"\" };\n\t}\n\n\tconst functionPart = content.slice(5);\n\tconst braceIndex = functionPart.indexOf(\"{\");\n\tif (braceIndex === -1) {\n\t\treturn { name: null, rawArgs: \"\" };\n\t}\n\n\tconst name = functionPart.slice(0, braceIndex).trim();\n\tlet rawArgs = functionPart.slice(braceIndex + 1);\n\tif (rawArgs.endsWith(\"}\")) {\n\t\trawArgs = rawArgs.slice(0, -1);\n\t}\n\n\treturn { name, rawArgs };\n}\n\nfunction stripTrailingUnsafeCharacters(argumentsJson: string): string {\n\tlet safePrefix = argumentsJson;\n\n\twhile (safePrefix.length > 0) {\n\t\tconst trailingCharacter = safePrefix[safePrefix.length - 1];\n\t\tif (!trailingCharacter || ![\"}\", '\"', \"]\", \"<\", \"|\", \"\\\\\", \">\"].includes(trailingCharacter)) {\n\t\t\tbreak;\n\t\t}\n\n\t\tsafePrefix = safePrefix.slice(0, -1);\n\t}\n\n\treturn safePrefix;\n}\n\nfunction getPartialTokenSuffix(text: string, tokens: string[]): string {\n\tfor (const token of tokens) {\n\t\tfor (let index = token.length - 1; index > 0; index -= 1) {\n\t\t\tconst prefix = token.slice(0, index);\n\t\t\tif (text.endsWith(prefix)) {\n\t\t\t\treturn prefix;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\";\n}\n\nfunction findEarliestToken(text: string, tokens: string[]): { index: number; token: string } | null {\n\tlet earliestMatch: { index: number; token: string } | null = null;\n\n\tfor (const token of tokens) {\n\t\tconst tokenIndex = text.indexOf(token);\n\t\tif (tokenIndex === -1) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!earliestMatch || tokenIndex < earliestMatch.index) {\n\t\t\tearliestMatch = { index: tokenIndex, token };\n\t\t}\n\t}\n\n\treturn earliestMatch;\n}\n\nexport function gemma4ParseGeneratedText(text: string, _tools: Tool[], _options?: ParserOptions): ParsedToolCall[] {\n\tconst parsedToolCalls: ParsedToolCall[] = [];\n\n\tfor (const match of extractToolCalls(text)) {\n\t\tconst [, name, rawArgs] = match;\n\t\tif (!name || rawArgs === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tparsedToolCalls.push({\n\t\t\tname,\n\t\t\targuments: parseGemma4Args(rawArgs),\n\t\t});\n\t}\n\n\treturn parsedToolCalls;\n}\n\nclass Gemma4StreamParser implements StreamParser {\n\tprivate readonly toolCallIds: string[] = [];\n\n\tprivate plainTextCarry = \"\";\n\tprivate toolCallCarry = \"\";\n\tprivate insideToolCall = false;\n\tprivate toolCallContent = \"\";\n\tprivate currentToolIndex = -1;\n\tprivate currentToolName: string | null = null;\n\tprivate currentArgumentsJson = \"\";\n\n\tfeed(textDelta: string): StreamParserEvent[] {\n\t\tconst events: StreamParserEvent[] = [];\n\t\tlet remaining = textDelta;\n\n\t\twhile (remaining.length > 0) {\n\t\t\tif (!this.insideToolCall) {\n\t\t\t\tconst combinedText = this.plainTextCarry + remaining;\n\t\t\t\tconst startIndex = combinedText.indexOf(TOOL_CALL_START);\n\n\t\t\t\tif (startIndex === -1) {\n\t\t\t\t\tconst partialSuffix = getPartialTokenSuffix(combinedText, [TOOL_CALL_START]);\n\t\t\t\t\tconst flushableText = partialSuffix ? combinedText.slice(0, -partialSuffix.length) : combinedText;\n\n\t\t\t\t\tif (flushableText) {\n\t\t\t\t\t\tevents.push({ type: \"text\", text: flushableText });\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.plainTextCarry = partialSuffix;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tconst textBeforeToolCall = combinedText.slice(0, startIndex);\n\t\t\t\tif (textBeforeToolCall) {\n\t\t\t\t\tevents.push({ type: \"text\", text: textBeforeToolCall });\n\t\t\t\t}\n\n\t\t\t\tconst afterStart = combinedText.slice(startIndex + TOOL_CALL_START.length);\n\t\t\t\tthis.plainTextCarry = \"\";\n\t\t\t\tthis.insideToolCall = true;\n\t\t\t\tthis.toolCallContent = \"\";\n\t\t\t\tthis.toolCallCarry = \"\";\n\t\t\t\tthis.currentToolIndex += 1;\n\t\t\t\tthis.currentToolName = null;\n\t\t\t\tthis.currentArgumentsJson = \"\";\n\t\t\t\tthis.toolCallIds[this.currentToolIndex] = `gemma4-tool-${this.currentToolIndex}`;\n\t\t\t\tremaining = afterStart;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst combinedToolCall = this.toolCallCarry + remaining;\n\t\t\tconst endMatch = findEarliestToken(combinedToolCall, [TOOL_CALL_END, TURN_END]);\n\n\t\t\tif (!endMatch) {\n\t\t\t\tconst partialSuffix = getPartialTokenSuffix(combinedToolCall, [TOOL_CALL_END, TURN_END]);\n\t\t\t\tconst flushableContent = partialSuffix\n\t\t\t\t\t? combinedToolCall.slice(0, -partialSuffix.length)\n\t\t\t\t\t: combinedToolCall;\n\n\t\t\t\tthis.toolCallCarry = partialSuffix;\n\t\t\t\tif (flushableContent) {\n\t\t\t\t\tthis.toolCallContent += flushableContent;\n\t\t\t\t\tthis.emitPartialToolCall(events);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst contentBeforeEnd = combinedToolCall.slice(0, endMatch.index);\n\t\t\tthis.toolCallContent += contentBeforeEnd;\n\t\t\tthis.toolCallCarry = \"\";\n\t\t\tthis.emitPartialToolCall(events);\n\t\t\tthis.emitCompletedToolCall(events);\n\n\t\t\tthis.insideToolCall = false;\n\t\t\tthis.toolCallContent = \"\";\n\t\t\tthis.currentToolName = null;\n\t\t\tthis.currentArgumentsJson = \"\";\n\t\t\tremaining = combinedToolCall.slice(endMatch.index + endMatch.token.length);\n\t\t}\n\n\t\treturn events;\n\t}\n\n\tfinish(): StreamParserEvent[] {\n\t\tconst events: StreamParserEvent[] = [];\n\n\t\tif (!this.insideToolCall && this.plainTextCarry) {\n\t\t\tevents.push({ type: \"text\", text: this.plainTextCarry });\n\t\t}\n\n\t\tif (this.insideToolCall) {\n\t\t\tconst unfinishedToolCall = TOOL_CALL_START + this.toolCallContent + this.toolCallCarry;\n\t\t\tif (unfinishedToolCall) {\n\t\t\t\tevents.push({ type: \"text\", text: unfinishedToolCall });\n\t\t\t}\n\t\t}\n\n\t\tthis.plainTextCarry = \"\";\n\t\tthis.toolCallCarry = \"\";\n\t\tthis.insideToolCall = false;\n\t\tthis.toolCallContent = \"\";\n\t\tthis.currentToolName = null;\n\t\tthis.currentArgumentsJson = \"\";\n\n\t\treturn events;\n\t}\n\n\tprivate emitPartialToolCall(events: StreamParserEvent[]): void {\n\t\tconst { name, rawArgs } = extractPartialToolCall(this.toolCallContent);\n\t\tif (!name) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this.currentToolName) {\n\t\t\tthis.currentToolName = name;\n\t\t\tevents.push({\n\t\t\t\ttype: \"toolcall_start\",\n\t\t\t\tindex: this.currentToolIndex,\n\t\t\t\tname,\n\t\t\t\tid: this.toolCallIds[this.currentToolIndex] ?? `gemma4-tool-${this.currentToolIndex}`,\n\t\t\t});\n\t\t}\n\n\t\tif (!rawArgs) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst parsedArguments = parseGemma4Args(rawArgs, true);\n\t\tif (Object.keys(parsedArguments).length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentArgumentsJson = JSON.stringify(parsedArguments);\n\t\tconst safeArgumentsJson = stripTrailingUnsafeCharacters(currentArgumentsJson);\n\t\tif (!safeArgumentsJson || safeArgumentsJson === this.currentArgumentsJson) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.currentArgumentsJson) {\n\t\t\tconst commonPrefix = findCommonPrefix(this.currentArgumentsJson, safeArgumentsJson);\n\t\t\tif (commonPrefix.length < this.currentArgumentsJson.length) {\n\t\t\t\tthis.currentArgumentsJson = commonPrefix;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tconst argumentsDelta = safeArgumentsJson.slice(this.currentArgumentsJson.length);\n\t\tif (!argumentsDelta) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.currentArgumentsJson = safeArgumentsJson;\n\t\tevents.push({\n\t\t\ttype: \"toolcall_delta\",\n\t\t\tindex: this.currentToolIndex,\n\t\t\targumentsDelta,\n\t\t});\n\t}\n\n\tprivate emitCompletedToolCall(events: StreamParserEvent[]): void {\n\t\tconst { name, rawArgs } = extractPartialToolCall(this.toolCallContent);\n\t\tif (!name) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this.currentToolName) {\n\t\t\tthis.currentToolName = name;\n\t\t\tevents.push({\n\t\t\t\ttype: \"toolcall_start\",\n\t\t\t\tindex: this.currentToolIndex,\n\t\t\t\tname,\n\t\t\t\tid: this.toolCallIds[this.currentToolIndex] ?? `gemma4-tool-${this.currentToolIndex}`,\n\t\t\t});\n\t\t}\n\n\t\tconst argumentsObject = parseGemma4Args(rawArgs);\n\t\tconst argumentsJson = JSON.stringify(argumentsObject);\n\t\tconst finalDelta = argumentsJson.slice(this.currentArgumentsJson.length);\n\t\tif (finalDelta) {\n\t\t\tevents.push({\n\t\t\t\ttype: \"toolcall_delta\",\n\t\t\t\tindex: this.currentToolIndex,\n\t\t\t\targumentsDelta: finalDelta,\n\t\t\t});\n\t\t}\n\n\t\tevents.push({\n\t\t\ttype: \"toolcall_end\",\n\t\t\tindex: this.currentToolIndex,\n\t\t\tname,\n\t\t\tid: this.toolCallIds[this.currentToolIndex] ?? `gemma4-tool-${this.currentToolIndex}`,\n\t\t\targuments: argumentsObject,\n\t\t});\n\t}\n}\n\nexport function gemma4CreateStreamParser(_tools: Tool[], _options?: ParserOptions): StreamParser {\n\treturn new Gemma4StreamParser();\n}\n"]}
|