@humain/terminal 0.0.17 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/dist/bun/cli.d.ts +3 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +3 -8
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/runtime-setup.d.ts +2 -0
- package/dist/bun/runtime-setup.d.ts.map +1 -0
- package/dist/bun/runtime-setup.js +9 -0
- package/dist/bun/runtime-setup.js.map +1 -0
- package/dist/bun/sandbox-env-setup.d.ts +2 -0
- package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
- package/dist/bun/sandbox-env-setup.js +4 -0
- package/dist/bun/sandbox-env-setup.js.map +1 -0
- package/dist/bundle/chunks/anthropic-messages-XULXUBIG.js +6 -0
- package/dist/bundle/chunks/{azure-openai-responses-ZN52D6YC.js → azure-openai-responses-JEG2XOYC.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +6 -6
- package/dist/bundle/chunks/{chunk-ARF4OE6X.js → chunk-2LC3S3VV.js} +8 -8
- package/dist/bundle/chunks/chunk-43O5DDAH.js +31 -0
- package/dist/bundle/chunks/{chunk-H2O6VOXT.js → chunk-46DC2JD6.js} +2 -2
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
- package/dist/bundle/chunks/{chunk-WJZ4KLGL.js → chunk-E6KP6V7F.js} +1 -1
- package/dist/bundle/chunks/{chunk-PSKDLDLZ.js → chunk-HPPQHK3J.js} +3 -3
- package/dist/bundle/chunks/chunk-JUPSJTFQ.js +42 -0
- package/dist/bundle/chunks/chunk-PL7O7J4J.js +133 -0
- package/dist/bundle/chunks/{chunk-PFVS5ZYL.js → chunk-RM336IEI.js} +378 -369
- package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
- package/dist/bundle/chunks/{extract-2L7ZVN7F.js → extract-TRW5FBY6.js} +2 -2
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{google-generative-ai-FF7M7XHT.js → google-generative-ai-OX6VSCA6.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-YMUBFRBA.js → google-vertex-GW76GSS2.js} +1 -1
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/{mistral-conversations-O4M7IQML.js → mistral-conversations-WXGXZOFJ.js} +1 -1
- package/dist/bundle/chunks/node-AUOGOBCN.js +2 -0
- package/dist/bundle/chunks/node-KOIP55YZ.js +16 -0
- package/dist/bundle/chunks/openai-codex-responses-NPLWP6ZC.js +10 -0
- package/dist/bundle/chunks/{openai-completions-L4AHDQ5D.js → openai-completions-OT2GTJKC.js} +3 -3
- package/dist/bundle/chunks/openai-responses-5A6CR7GI.js +2 -0
- package/dist/bundle/chunks/{openrouter-images-Y2PCWAQH.js → openrouter-images-YLQ4RJ2F.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-57K43J6J.js → pi-messages-OJF77SY3.js} +1 -1
- package/dist/bundle/chunks/{undici-D6ABF53Q.js → undici-KA2LJNVT.js} +1 -1
- package/dist/bundle/chunks/webapi-RFAXLI2D.js +5 -0
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +2 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/setup.d.ts +2 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +13 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli.js +2 -14
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- 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 +15 -7
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -6
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +14 -6
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +2 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +1 -2
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +8 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +2 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/keybindings.d.ts +5 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +4 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts +15 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +3 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-runtime.d.ts +1 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +5 -2
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +8 -2
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/session-manager.d.ts +3 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +40 -13
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +4 -2
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +8 -9
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +3 -120
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +1 -12
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +5 -163
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +4 -55
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +4 -60
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +4 -49
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +4 -120
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts +12 -0
- package/dist/core/tools/renderers/bash.d.ts.map +1 -0
- package/dist/core/tools/renderers/bash.js +133 -0
- package/dist/core/tools/renderers/bash.js.map +1 -0
- package/dist/core/tools/renderers/edit.d.ts +23 -0
- package/dist/core/tools/renderers/edit.d.ts.map +1 -0
- package/dist/core/tools/renderers/edit.js +167 -0
- package/dist/core/tools/renderers/edit.js.map +1 -0
- package/dist/core/tools/renderers/find.d.ts +10 -0
- package/dist/core/tools/renderers/find.d.ts.map +1 -0
- package/dist/core/tools/renderers/find.js +64 -0
- package/dist/core/tools/renderers/find.js.map +1 -0
- package/dist/core/tools/renderers/grep.d.ts +10 -0
- package/dist/core/tools/renderers/grep.d.ts.map +1 -0
- package/dist/core/tools/renderers/grep.js +69 -0
- package/dist/core/tools/renderers/grep.js.map +1 -0
- package/dist/core/tools/renderers/index.d.ts +22 -0
- package/dist/core/tools/renderers/index.d.ts.map +1 -0
- package/dist/core/tools/renderers/index.js +48 -0
- package/dist/core/tools/renderers/index.js.map +1 -0
- package/dist/core/tools/renderers/ls.d.ts +10 -0
- package/dist/core/tools/renderers/ls.d.ts.map +1 -0
- package/dist/core/tools/renderers/ls.js +58 -0
- package/dist/core/tools/renderers/ls.js.map +1 -0
- package/dist/core/tools/renderers/read.d.ts +11 -0
- package/dist/core/tools/renderers/read.d.ts.map +1 -0
- package/dist/core/tools/renderers/read.js +129 -0
- package/dist/core/tools/renderers/read.js.map +1 -0
- package/dist/core/tools/renderers/write.d.ts +10 -0
- package/dist/core/tools/renderers/write.d.ts.map +1 -0
- package/dist/core/tools/renderers/write.js +152 -0
- package/dist/core/tools/renderers/write.js.map +1 -0
- package/dist/core/tools/subagent-worktree.d.ts +1 -0
- package/dist/core/tools/subagent-worktree.d.ts.map +1 -1
- package/dist/core/tools/subagent-worktree.js +25 -1
- package/dist/core/tools/subagent-worktree.js.map +1 -1
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +5 -2
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +5 -145
- package/dist/core/tools/write.js.map +1 -1
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +51 -12
- package/dist/humain/mcp-adapter/vendor/package.json +2 -2
- package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.js +3 -1
- package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.d.ts +2 -0
- package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.js +4 -2
- package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.d.ts +2 -2
- package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.js +11 -4
- package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
- package/dist/humain/web-access/vendor/github-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/github-extract.js +238 -1
- package/dist/humain/web-access/vendor/github-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/index.js +118 -64
- package/dist/humain/web-access/vendor/index.js.map +1 -1
- package/dist/humain/web-access/vendor/mistral-search.d.ts +4 -0
- package/dist/humain/web-access/vendor/mistral-search.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/mistral-search.js +274 -0
- package/dist/humain/web-access/vendor/mistral-search.js.map +1 -0
- package/dist/humain/web-access/vendor/perplexity.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/perplexity.js +12 -1
- package/dist/humain/web-access/vendor/perplexity.js.map +1 -1
- package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/utils.js +1 -2
- package/dist/humain/web-access/vendor/utils.js.map +1 -1
- package/dist/humain/web-access/vendor/xai-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/xai-search.js +92 -35
- package/dist/humain/web-access/vendor/xai-search.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/chat-viewport.d.ts +20 -0
- package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
- package/dist/modes/interactive/chat-viewport.js +28 -0
- package/dist/modes/interactive/chat-viewport.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +18 -10
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +10 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +37 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +8 -17
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +21 -23
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +14 -10
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +3 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +10 -3
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +4 -4
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +21 -4
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +34 -32
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +2 -2
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +8 -15
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +96 -81
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-share.d.ts.map +1 -1
- package/dist/modes/interactive/session-share.js +8 -12
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +2 -1
- package/dist/modes/interactive/theme/light.json +2 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +5 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +84 -0
- package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-json.js +130 -0
- package/dist/modes/interactive/theme/theme-json.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +6 -2
- package/dist/modes/interactive/theme/theme.d.ts +14 -5
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +18 -119
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/tui-renderer.d.ts +21 -0
- package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
- package/dist/modes/interactive/tui-renderer.js +66 -0
- package/dist/modes/interactive/tui-renderer.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js +2 -3
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +41 -19
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/containerization.md +45 -0
- package/docs/development.md +19 -0
- package/docs/environment-variables.md +2 -0
- package/docs/extensions.md +5 -2
- package/docs/keybindings.md +5 -2
- package/docs/models.md +4 -1
- package/docs/rpc.md +1 -1
- package/docs/sdk.md +5 -0
- package/docs/settings.md +3 -3
- package/docs/skills.md +1 -1
- package/docs/terminal-setup.md +15 -0
- package/docs/themes.md +8 -6
- package/docs/tui.md +19 -0
- package/examples/README.md +3 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +84 -84
- package/examples/extensions/custom-provider-anthropic/package.json +17 -17
- package/examples/extensions/custom-provider-gitlab-duo/package.json +14 -14
- package/examples/extensions/dynamic-resources/dynamic.json +2 -0
- package/examples/extensions/gondolin/package-lock.json +8 -8
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +6 -6
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/with-deps/package-lock.json +29 -29
- package/examples/extensions/with-deps/package.json +20 -20
- package/examples/plugins/pi-example-plugin/README.md +38 -0
- package/examples/plugins/pi-example-plugin/package.json +10 -0
- package/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
- package/examples/plugins/pi-example-plugin/src/session.ts +23 -0
- package/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
- package/npm-shrinkwrap.json +772 -205
- package/package.json +31 -24
- package/src/humain/web-access/UPSTREAM.md +12 -1
- package/src/humain/web-access/upstream.json +4 -4
- package/dist/bundle/chunks/anthropic-messages-M4LCS3KH.js +0 -6
- package/dist/bundle/chunks/chunk-3VI4HD7D.js +0 -31
- package/dist/bundle/chunks/chunk-BOW22LW6.js +0 -42
- package/dist/bundle/chunks/chunk-CBHC6EL7.js +0 -133
- package/dist/bundle/chunks/chunk-JUUC5AZY.js +0 -2
- package/dist/bundle/chunks/node-ZHY4LHC7.js +0 -15
- package/dist/bundle/chunks/openai-codex-responses-HRVCDY54.js +0 -8
- package/dist/bundle/chunks/openai-responses-4MWLJHIK.js +0 -2
- package/dist/bundle/chunks/webapi-AFS5FDJJ.js +0 -5
- package/dist/bundle/client.js +0 -2
- package/dist/cli/experimental/auth.d.ts +0 -16
- package/dist/cli/experimental/auth.d.ts.map +0 -1
- package/dist/cli/experimental/auth.js +0 -13
- package/dist/cli/experimental/auth.js.map +0 -1
- package/dist/cli/experimental/cli.d.ts +0 -6
- package/dist/cli/experimental/cli.d.ts.map +0 -1
- package/dist/cli/experimental/cli.js +0 -5
- package/dist/cli/experimental/cli.js.map +0 -1
- package/dist/cli/experimental/command-options.d.ts +0 -17
- package/dist/cli/experimental/command-options.d.ts.map +0 -1
- package/dist/cli/experimental/command-options.js +0 -35
- package/dist/cli/experimental/command-options.js.map +0 -1
- package/dist/cli/experimental/command.d.ts +0 -63
- package/dist/cli/experimental/command.d.ts.map +0 -1
- package/dist/cli/experimental/command.js +0 -127
- package/dist/cli/experimental/command.js.map +0 -1
- package/dist/cli/experimental/commands/client.d.ts +0 -13
- package/dist/cli/experimental/commands/client.d.ts.map +0 -1
- package/dist/cli/experimental/commands/client.js +0 -25
- package/dist/cli/experimental/commands/client.js.map +0 -1
- package/dist/cli/experimental/commands/pi.d.ts +0 -15
- package/dist/cli/experimental/commands/pi.d.ts.map +0 -1
- package/dist/cli/experimental/commands/pi.js +0 -28
- package/dist/cli/experimental/commands/pi.js.map +0 -1
- package/dist/cli/experimental/commands/server.d.ts +0 -13
- package/dist/cli/experimental/commands/server.d.ts.map +0 -1
- package/dist/cli/experimental/commands/server.js +0 -25
- package/dist/cli/experimental/commands/server.js.map +0 -1
- package/dist/cli/experimental/transport-address.d.ts +0 -10
- package/dist/cli/experimental/transport-address.d.ts.map +0 -1
- package/dist/cli/experimental/transport-address.js +0 -38
- package/dist/cli/experimental/transport-address.js.map +0 -1
- package/dist/client/index.d.ts +0 -3
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -3
- package/dist/client/index.js.map +0 -1
- package/dist/client/remote-session.d.ts +0 -53
- package/dist/client/remote-session.d.ts.map +0 -1
- package/dist/client/remote-session.js +0 -340
- package/dist/client/remote-session.js.map +0 -1
- package/dist/client/transcript.d.ts +0 -12
- package/dist/client/transcript.d.ts.map +0 -1
- package/dist/client/transcript.js +0 -98
- package/dist/client/transcript.js.map +0 -1
- package/dist/server/create-harness.d.ts +0 -26
- package/dist/server/create-harness.d.ts.map +0 -1
- package/dist/server/create-harness.js +0 -106
- package/dist/server/create-harness.js.map +0 -1
|
@@ -8,6 +8,7 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
8
8
|
};
|
|
9
9
|
import { Box, Text, truncateToWidth } from "@earendil-works/pi-tui";
|
|
10
10
|
import { Type } from "typebox";
|
|
11
|
+
import pLimit from "p-limit";
|
|
11
12
|
import { StringEnum } from "@earendil-works/pi-ai/compat";
|
|
12
13
|
import { normalizeFetchContentParams } from "./fetch-params.js";
|
|
13
14
|
import { resolveAuthFetchProfile } from "./auth-fetch.js";
|
|
@@ -51,6 +52,7 @@ import { isSearXNGAvailable } from "./searxng.js";
|
|
|
51
52
|
import { isDuckDuckGoAvailable } from "./duckduckgo.js";
|
|
52
53
|
import { isAnySearchAvailable } from "./anysearch.js";
|
|
53
54
|
import { isXaiSearchAvailable } from "./xai-search.js";
|
|
55
|
+
import { isMistralAvailable } from "./mistral-search.js";
|
|
54
56
|
import { isKimiSearchAvailable } from "./kimi-search.js";
|
|
55
57
|
import { isBrightDataAvailable } from "./brightdata.js";
|
|
56
58
|
import { isSerpBaseAvailable } from "./serpbase.js";
|
|
@@ -135,6 +137,20 @@ const DEFAULT_CURATOR_TIMEOUT_SECONDS = 20;
|
|
|
135
137
|
const DEFAULT_REMOTE_CURATOR_TIMEOUT_SECONDS = 60;
|
|
136
138
|
const MAX_CURATOR_TIMEOUT_SECONDS = 600;
|
|
137
139
|
const MAX_SUMMARY_GENERATION_DEADLINE_MS = 600_000;
|
|
140
|
+
const SEARCH_QUERY_CONCURRENCY = 3;
|
|
141
|
+
// Limit each batch independently so separate Pi tool calls can still run in parallel.
|
|
142
|
+
function runSearchQueries(queries, run) {
|
|
143
|
+
const limit = pLimit(SEARCH_QUERY_CONCURRENCY);
|
|
144
|
+
return Promise.all(queries.map((query, index) => limit(() => run(query, index))));
|
|
145
|
+
}
|
|
146
|
+
// Keep primary query indexes stable for curator slots, then interleave additional
|
|
147
|
+
// provider entries deterministically instead of assigning by completion order.
|
|
148
|
+
function curatorResultIndex(queryIndex, entryIndex, queryCount) {
|
|
149
|
+
return entryIndex * queryCount + queryIndex;
|
|
150
|
+
}
|
|
151
|
+
function curatorResultIndexCapacity(queryCount) {
|
|
152
|
+
return queryCount * RESOLVED_SEARCH_PROVIDERS.length;
|
|
153
|
+
}
|
|
138
154
|
function searchProviderSchema(description) {
|
|
139
155
|
return Type.Union([
|
|
140
156
|
StringEnum([...SEARCH_PROVIDERS]),
|
|
@@ -335,6 +351,7 @@ async function getProviderAvailability(ctx) {
|
|
|
335
351
|
anysearch: isAnySearchAvailable(),
|
|
336
352
|
xcrawl: isXcrawlAvailable(),
|
|
337
353
|
xai: await isXaiSearchAvailable(ctx),
|
|
354
|
+
mistral: isMistralAvailable(),
|
|
338
355
|
brightdata: isBrightDataAvailable(),
|
|
339
356
|
serpbase: isSerpBaseAvailable(),
|
|
340
357
|
serper: isSerperAvailable(),
|
|
@@ -918,7 +935,8 @@ export default function (pi) {
|
|
|
918
935
|
const fetchId = generateId();
|
|
919
936
|
const controller = new AbortController();
|
|
920
937
|
pendingFetches.set(fetchId, controller);
|
|
921
|
-
|
|
938
|
+
Promise.resolve()
|
|
939
|
+
.then(() => runWithProxy(proxy, () => fetchAllContent(urls, controller.signal, withRegisteredFetchOptions(undefined, registeredToolNames, proxy))))
|
|
922
940
|
.then((fetched) => {
|
|
923
941
|
if (!sessionActive || !pendingFetches.has(fetchId))
|
|
924
942
|
return;
|
|
@@ -1134,7 +1152,7 @@ export default function (pi) {
|
|
|
1134
1152
|
};
|
|
1135
1153
|
}
|
|
1136
1154
|
const selected = filterByQueryIndices(payload.selectedQueryIndices, resultsByIndex).results;
|
|
1137
|
-
const fallbackResults = selected.length > 0 ? selected :
|
|
1155
|
+
const fallbackResults = selected.length > 0 ? selected : orderedSearchResults(resultsByIndex);
|
|
1138
1156
|
const deterministic = buildDeterministicSummary(fallbackResults);
|
|
1139
1157
|
return {
|
|
1140
1158
|
approvedSummary: deterministic.summary,
|
|
@@ -1189,6 +1207,11 @@ export default function (pi) {
|
|
|
1189
1207
|
}
|
|
1190
1208
|
const searchId = storeAndPublishSearch(opts.results);
|
|
1191
1209
|
const isBackgroundFetch = fetchId !== null && !hasInlineReady;
|
|
1210
|
+
// The model only sees `content`, not `details`: surface the id it needs to
|
|
1211
|
+
// call get_search_content, the same way fetch_content does.
|
|
1212
|
+
if (getSearchContentEnabled && !hasApprovedSummary) {
|
|
1213
|
+
output += `\n---\nResults stored as responseId "${searchId}". Use ${toolNames.getSearchContent}({ responseId: "${searchId}", queryIndex: 0 }) to retrieve them.`;
|
|
1214
|
+
}
|
|
1192
1215
|
return {
|
|
1193
1216
|
content: [{ type: "text", text: output.trim() }],
|
|
1194
1217
|
details: {
|
|
@@ -1244,8 +1267,13 @@ export default function (pi) {
|
|
|
1244
1267
|
}
|
|
1245
1268
|
return { results: filteredResults, urls: filteredUrls };
|
|
1246
1269
|
}
|
|
1270
|
+
function orderedSearchResults(resultsByIndex) {
|
|
1271
|
+
return [...resultsByIndex.entries()]
|
|
1272
|
+
.sort(([leftIndex], [rightIndex]) => leftIndex - rightIndex)
|
|
1273
|
+
.map(([, result]) => result);
|
|
1274
|
+
}
|
|
1247
1275
|
function collectAllResultsAndUrls(resultsByIndex) {
|
|
1248
|
-
const results =
|
|
1276
|
+
const results = orderedSearchResults(resultsByIndex);
|
|
1249
1277
|
const urls = [];
|
|
1250
1278
|
for (const result of results) {
|
|
1251
1279
|
for (const source of result.results) {
|
|
@@ -1283,6 +1311,7 @@ export default function (pi) {
|
|
|
1283
1311
|
const sessionToken = randomUUID();
|
|
1284
1312
|
handle = await startCuratorServer({
|
|
1285
1313
|
queries: pc.queryList,
|
|
1314
|
+
initialResultIndexCapacity: curatorResultIndexCapacity(pc.queryList.length),
|
|
1286
1315
|
sessionToken,
|
|
1287
1316
|
timeout: pc.timeoutSeconds,
|
|
1288
1317
|
availableProviders: pc.availableProviders,
|
|
@@ -1361,7 +1390,7 @@ export default function (pi) {
|
|
|
1361
1390
|
else {
|
|
1362
1391
|
const conn = activeCurators.get(callId)?.getConnectionState();
|
|
1363
1392
|
pc.finish(buildCurationCancelledReturn(reason, {
|
|
1364
|
-
queries:
|
|
1393
|
+
queries: orderedSearchResults(pc.searchResults),
|
|
1365
1394
|
queryCount: pc.queryList.length,
|
|
1366
1395
|
browserConnected: conn?.browserConnected,
|
|
1367
1396
|
lastHeartbeatAgeMs: conn?.lastHeartbeatAgeMs,
|
|
@@ -1540,16 +1569,16 @@ export default function (pi) {
|
|
|
1540
1569
|
pi.registerTool({
|
|
1541
1570
|
name: toolNames.webSearch,
|
|
1542
1571
|
label: "Web Search",
|
|
1543
|
-
description: `Search the web using OpenAI, Brave, Parallel, Parallel MCP, TinyFish, Search1API, Searchinfinity, Querit, Tavily, Firecrawl, Jina, SERPdive, Kagi, Bocha, Ollama, SearXNG, DuckDuckGo, Exa, Perplexity, Gemini, Kimi, AnySearch, XCrawl, Valyu, xAI, Bright Data, SerpBase, or Serper. Pass a provider array to search only those providers simultaneously, or use provider "all" to search every eligible provider except Parallel MCP, DuckDuckGo, Kimi, AnySearch, XCrawl, Valyu, xAI, Bright Data, SerpBase, and Serper. Returns an AI-synthesized answer with source citations. OpenAI search uses a Codex subscription or OpenAI API key; Kimi search uses a Kimi Code Plan authenticated through /login kimi-coding; xAI search uses a SuperGrok/X Premium subscription or xAI API key. Parallel MCP, DuckDuckGo, Kimi, AnySearch, XCrawl, Valyu, xAI, Bright Data, SerpBase, and Serper are available only when explicitly selected. For comprehensive research, prefer queries (plural) with 2-4 varied angles over a single query — each query gets its own synthesized answer, so varying phrasing and scope gives much broader coverage. When includeContent is true, full page content is fetched in the background. Searches auto-open the interactive browser curator and stream results live; set workflow to "none" to skip curation or "auto-summary" for a model-generated summary without the browser curator. The configured provider is used when provider is omitted or set to auto; omit provider unless explicitly overriding it. Without a configured provider, SearXNG is preferred first for local/private search. When the active Pi model is openai-codex, Codex-backed OpenAI search is preferred next. Otherwise Exa is preferred before OpenAI, then Brave, Parallel, TinyFish, Search1API, Searchinfinity, Querit, Tavily, Firecrawl, Jina, SERPdive, Kagi, Bocha, Ollama, Perplexity, Gemini API, or Gemini Web.`,
|
|
1572
|
+
description: `Search the web using OpenAI, Brave, Parallel, Parallel MCP, TinyFish, Search1API, Searchinfinity, Querit, Tavily, Firecrawl, Jina, SERPdive, Kagi, Bocha, Ollama, SearXNG, DuckDuckGo, Exa, Perplexity, Gemini, Kimi, AnySearch, XCrawl, Valyu, xAI, Mistral, Bright Data, SerpBase, or Serper. Pass a provider array to search only those providers simultaneously, or use provider "all" to search every eligible provider except Parallel MCP, DuckDuckGo, Kimi, AnySearch, XCrawl, Valyu, xAI, Mistral, Bright Data, SerpBase, and Serper. Returns an AI-synthesized answer with source citations. OpenAI search uses a Codex subscription or OpenAI API key; Kimi search uses a Kimi Code Plan authenticated through /login kimi-coding; xAI search uses a SuperGrok/X Premium subscription or xAI API key; Mistral search uses a Mistral API key. Parallel MCP, DuckDuckGo, Kimi, AnySearch, XCrawl, Valyu, xAI, Mistral, Bright Data, SerpBase, and Serper are available only when explicitly selected. For comprehensive research, prefer queries (plural) with 2-4 varied angles over a single query — each query gets its own synthesized answer, so varying phrasing and scope gives much broader coverage. When includeContent is true, full page content is fetched in the background. Searches auto-open the interactive browser curator and stream results live; set workflow to "none" to skip curation or "auto-summary" for a model-generated summary without the browser curator. The configured provider is used when provider is omitted or set to auto; omit provider unless explicitly overriding it. Without a configured provider, SearXNG is preferred first for local/private search. When the active Pi model is openai-codex, Codex-backed OpenAI search is preferred next. Otherwise Exa is preferred before OpenAI, then Brave, Parallel, TinyFish, Search1API, Searchinfinity, Querit, Tavily, Firecrawl, Jina, SERPdive, Kagi, Bocha, Ollama, Perplexity, Gemini API, or Gemini Web.`,
|
|
1544
1573
|
promptSnippet: "Use for web research questions. Prefer {queries:[...]} with 2-4 varied angles over a single query for broader coverage. Omit provider unless explicitly overriding the configured default.",
|
|
1545
1574
|
parameters: Type.Object({
|
|
1546
1575
|
query: Type.Optional(Type.String({ description: "Single search query. For research tasks, prefer 'queries' with multiple varied angles instead." })),
|
|
1547
|
-
queries: Type.Optional(Type.Array(Type.String(), { description: "Multiple queries searched
|
|
1576
|
+
queries: Type.Optional(Type.Array(Type.String(), { description: "Multiple queries searched concurrently (up to three at a time), each returning its own synthesized answer. Prefer this for research — vary phrasing, scope, and angle across 2-4 queries to maximize coverage. Good: ['React vs Vue performance benchmarks 2026', 'React vs Vue developer experience comparison', 'React ecosystem size vs Vue ecosystem']. Bad: ['React vs Vue', 'React vs Vue comparison', 'React vs Vue review'] (too similar, redundant results)." })),
|
|
1548
1577
|
numResults: Type.Optional(Type.Integer({ minimum: 1, maximum: 20, description: "Results per query (default: 5, max: 20)" })),
|
|
1549
1578
|
includeContent: Type.Optional(Type.Boolean({ description: "Fetch full page content (async)" })),
|
|
1550
1579
|
recencyFilter: Type.Optional(StringEnum(["day", "week", "month", "year"], { description: "Filter by recency" })),
|
|
1551
1580
|
domainFilter: Type.Optional(Type.Array(Type.String(), { description: "Limit to domains (prefix with - to exclude)" })),
|
|
1552
|
-
provider: Type.Optional(searchProviderSchema("Search provider or non-empty list of providers to search simultaneously; use all to search every eligible provider except Parallel MCP, DuckDuckGo, Kimi, AnySearch, XCrawl, Valyu, xAI, Bright Data, SerpBase, and Serper, omit this field to use the configured provider, or use auto when none is configured")),
|
|
1581
|
+
provider: Type.Optional(searchProviderSchema("Search provider or non-empty list of providers to search simultaneously; use all to search every eligible provider except Parallel MCP, DuckDuckGo, Kimi, AnySearch, XCrawl, Valyu, xAI, Mistral, Bright Data, SerpBase, and Serper, omit this field to use the configured provider, or use auto when none is configured")),
|
|
1553
1582
|
workflow: Type.Optional(StringEnum(["none", "summary-review", "auto-summary"], {
|
|
1554
1583
|
description: "Search workflow mode: none = no curator, summary-review = open curator with auto summary draft (default), auto-summary = generate summary without opening curator",
|
|
1555
1584
|
})),
|
|
@@ -1589,7 +1618,6 @@ export default function (pi) {
|
|
|
1589
1618
|
const searchResults = new Map();
|
|
1590
1619
|
const resultSlots = new Map();
|
|
1591
1620
|
const allInlineContent = [];
|
|
1592
|
-
let nextResultIndex = queryList.length;
|
|
1593
1621
|
const searchAbort = new AbortController();
|
|
1594
1622
|
const searchSignal = signal
|
|
1595
1623
|
? AbortSignal.any([signal, searchAbort.signal])
|
|
@@ -1654,7 +1682,7 @@ export default function (pi) {
|
|
|
1654
1682
|
return;
|
|
1655
1683
|
const conn = activeCurators.get(callId)?.getConnectionState();
|
|
1656
1684
|
finish(buildCurationCancelledReturn(reason, {
|
|
1657
|
-
queries:
|
|
1685
|
+
queries: orderedSearchResults(searchResults),
|
|
1658
1686
|
queryCount: queryList.length,
|
|
1659
1687
|
browserConnected: conn?.browserConnected,
|
|
1660
1688
|
lastHeartbeatAgeMs: conn?.lastHeartbeatAgeMs,
|
|
@@ -1668,16 +1696,17 @@ export default function (pi) {
|
|
|
1668
1696
|
pendingCurates.set(callId, pc);
|
|
1669
1697
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1670
1698
|
pc.browserPromise = openCuratorBrowser(callId, pc, ctx, false);
|
|
1671
|
-
|
|
1699
|
+
let completedSearches = 0;
|
|
1700
|
+
await runSearchQueries(queryList, async (query, qi) => {
|
|
1672
1701
|
if (signal?.aborted || cancelled || searchAbort.signal.aborted)
|
|
1673
|
-
|
|
1702
|
+
return;
|
|
1674
1703
|
onUpdate?.({
|
|
1675
|
-
content: [{ type: "text", text: `Searching ${
|
|
1676
|
-
details: { phase: "searching", progress:
|
|
1704
|
+
content: [{ type: "text", text: `Searching "${query}" (${completedSearches}/${queryList.length} complete)...` }],
|
|
1705
|
+
details: { phase: "searching", progress: completedSearches / queryList.length, currentQuery: query },
|
|
1677
1706
|
});
|
|
1678
1707
|
const requestedProvider = pc.searchProvider;
|
|
1679
1708
|
try {
|
|
1680
|
-
const response = await search(
|
|
1709
|
+
const response = await search(query, {
|
|
1681
1710
|
provider: requestedProvider,
|
|
1682
1711
|
numResults: params.numResults,
|
|
1683
1712
|
recencyFilter,
|
|
@@ -1687,44 +1716,53 @@ export default function (pi) {
|
|
|
1687
1716
|
extensionContext: ctx,
|
|
1688
1717
|
});
|
|
1689
1718
|
if (signal?.aborted || cancelled || searchAbort.signal.aborted)
|
|
1690
|
-
|
|
1719
|
+
return;
|
|
1691
1720
|
if (response.inlineContent)
|
|
1692
1721
|
allInlineContent.push(...response.inlineContent);
|
|
1693
1722
|
const entries = toCuratorSearchEntries(response);
|
|
1694
1723
|
const curator = activeCurators.get(callId);
|
|
1695
1724
|
for (let entryIndex = 0; entryIndex < entries.length; entryIndex++) {
|
|
1696
1725
|
const entry = entries[entryIndex];
|
|
1697
|
-
const resultIndex =
|
|
1726
|
+
const resultIndex = curatorResultIndex(qi, entryIndex, queryList.length);
|
|
1698
1727
|
const indexedEntry = {
|
|
1699
1728
|
...entry,
|
|
1700
1729
|
queryIndex: resultIndex,
|
|
1701
|
-
query
|
|
1730
|
+
query,
|
|
1702
1731
|
};
|
|
1703
1732
|
searchResults.set(resultIndex, indexedCuratorEntryToQueryResult(indexedEntry));
|
|
1704
1733
|
resultSlots.set(resultIndex, qi);
|
|
1705
1734
|
if (curator) {
|
|
1706
1735
|
if (entry.error) {
|
|
1707
|
-
curator.pushError(resultIndex, entry.error, entry.provider, { query
|
|
1736
|
+
curator.pushError(resultIndex, entry.error, entry.provider, { query, slotIndex: qi });
|
|
1708
1737
|
}
|
|
1709
1738
|
else {
|
|
1710
|
-
curator.pushResult(resultIndex, { ...entry, query
|
|
1739
|
+
curator.pushResult(resultIndex, { ...entry, query, slotIndex: qi });
|
|
1711
1740
|
}
|
|
1712
1741
|
}
|
|
1713
1742
|
}
|
|
1714
1743
|
}
|
|
1715
1744
|
catch (err) {
|
|
1716
1745
|
if (signal?.aborted || cancelled || searchAbort.signal.aborted)
|
|
1717
|
-
|
|
1746
|
+
return;
|
|
1718
1747
|
const message = err instanceof Error ? err.message : String(err);
|
|
1719
1748
|
const failedProvider = toCuratorProvider(requestedProvider);
|
|
1720
|
-
searchResults.set(qi, { query
|
|
1749
|
+
searchResults.set(qi, { query, answer: "", results: [], error: message, provider: failedProvider });
|
|
1721
1750
|
resultSlots.set(qi, qi);
|
|
1722
1751
|
const curator = activeCurators.get(callId);
|
|
1723
1752
|
if (curator) {
|
|
1724
|
-
curator.pushError(qi, message, failedProvider, { query
|
|
1753
|
+
curator.pushError(qi, message, failedProvider, { query, slotIndex: qi });
|
|
1725
1754
|
}
|
|
1726
1755
|
}
|
|
1727
|
-
|
|
1756
|
+
finally {
|
|
1757
|
+
completedSearches++;
|
|
1758
|
+
if (!signal?.aborted && !cancelled && !searchAbort.signal.aborted) {
|
|
1759
|
+
onUpdate?.({
|
|
1760
|
+
content: [{ type: "text", text: `Completed ${completedSearches}/${queryList.length} searches.` }],
|
|
1761
|
+
details: { phase: "searching", progress: completedSearches / queryList.length, currentQuery: query },
|
|
1762
|
+
});
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
});
|
|
1728
1766
|
if (signal?.aborted || cancelled || searchAbort.signal.aborted) {
|
|
1729
1767
|
cancel();
|
|
1730
1768
|
return promise;
|
|
@@ -1761,15 +1799,15 @@ export default function (pi) {
|
|
|
1761
1799
|
}
|
|
1762
1800
|
return promise;
|
|
1763
1801
|
}
|
|
1764
|
-
|
|
1802
|
+
let completedSearches = 0;
|
|
1765
1803
|
const allUrls = [];
|
|
1766
1804
|
const allInlineContent = [];
|
|
1767
1805
|
const resolvedProvider = resolveRequestedProvider(params.provider);
|
|
1768
|
-
|
|
1769
|
-
|
|
1806
|
+
const queryResponses = await runSearchQueries(queryList, async (query) => {
|
|
1807
|
+
signal?.throwIfAborted();
|
|
1770
1808
|
onUpdate?.({
|
|
1771
|
-
content: [{ type: "text", text: `Searching ${
|
|
1772
|
-
details: { phase: "search", progress:
|
|
1809
|
+
content: [{ type: "text", text: `Searching "${query}" (${completedSearches}/${queryList.length} complete)...` }],
|
|
1810
|
+
details: { phase: "search", progress: completedSearches / queryList.length, currentQuery: query },
|
|
1773
1811
|
});
|
|
1774
1812
|
try {
|
|
1775
1813
|
const { answer, results, inlineContent, provider } = await search(query, {
|
|
@@ -1781,22 +1819,36 @@ export default function (pi) {
|
|
|
1781
1819
|
signal,
|
|
1782
1820
|
extensionContext: ctx,
|
|
1783
1821
|
});
|
|
1784
|
-
|
|
1785
|
-
for (const r of results) {
|
|
1786
|
-
if (!allUrls.includes(r.url)) {
|
|
1787
|
-
allUrls.push(r.url);
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
if (inlineContent)
|
|
1791
|
-
allInlineContent.push(...inlineContent);
|
|
1822
|
+
return { result: { query, answer, results, error: null, provider }, inlineContent };
|
|
1792
1823
|
}
|
|
1793
1824
|
catch (err) {
|
|
1794
1825
|
if (signal?.aborted || isAbortError(err))
|
|
1795
1826
|
throw err;
|
|
1796
1827
|
const message = err instanceof Error ? err.message : String(err);
|
|
1797
1828
|
const requestedProvider = toCuratorProvider(resolvedProvider);
|
|
1798
|
-
|
|
1829
|
+
return {
|
|
1830
|
+
result: { query, answer: "", results: [], error: message, provider: requestedProvider },
|
|
1831
|
+
inlineContent: undefined,
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
finally {
|
|
1835
|
+
completedSearches++;
|
|
1836
|
+
if (!signal?.aborted) {
|
|
1837
|
+
onUpdate?.({
|
|
1838
|
+
content: [{ type: "text", text: `Completed ${completedSearches}/${queryList.length} searches.` }],
|
|
1839
|
+
details: { phase: "search", progress: completedSearches / queryList.length, currentQuery: query },
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1799
1842
|
}
|
|
1843
|
+
});
|
|
1844
|
+
const searchResults = queryResponses.map(response => response.result);
|
|
1845
|
+
for (const response of queryResponses) {
|
|
1846
|
+
for (const result of response.result.results) {
|
|
1847
|
+
if (!allUrls.includes(result.url))
|
|
1848
|
+
allUrls.push(result.url);
|
|
1849
|
+
}
|
|
1850
|
+
if (response.inlineContent)
|
|
1851
|
+
allInlineContent.push(...response.inlineContent);
|
|
1800
1852
|
}
|
|
1801
1853
|
let approvedSummary;
|
|
1802
1854
|
let summaryMeta;
|
|
@@ -2059,7 +2111,7 @@ export default function (pi) {
|
|
|
2059
2111
|
fetchContent: Type.Optional(Type.Boolean({ description: "Fetch up to 5 result pages for exact passage extraction." })),
|
|
2060
2112
|
recencyFilter: Type.Optional(StringEnum(["day", "week", "month", "year"], { description: "Filter by recency." })),
|
|
2061
2113
|
domainFilter: Type.Optional(Type.Array(Type.String(), { description: "Limit to domains; prefix with - to exclude." })),
|
|
2062
|
-
provider: Type.Optional(searchProviderSchema("Search provider or non-empty list of providers to search simultaneously; all searches every eligible provider except Parallel MCP, DuckDuckGo, Kimi, AnySearch, XCrawl, Valyu, xAI, Bright Data, SerpBase, and Serper")),
|
|
2114
|
+
provider: Type.Optional(searchProviderSchema("Search provider or non-empty list of providers to search simultaneously; all searches every eligible provider except Parallel MCP, DuckDuckGo, Kimi, AnySearch, XCrawl, Valyu, xAI, Mistral, Bright Data, SerpBase, and Serper")),
|
|
2063
2115
|
proxy: Type.Optional(Type.String({
|
|
2064
2116
|
description: "http(s) proxy URL (e.g. http://host:port) used for every outbound request in this call (search APIs and result-page fetches). Empty string forces direct access.",
|
|
2065
2117
|
})),
|
|
@@ -2834,6 +2886,7 @@ export default function (pi) {
|
|
|
2834
2886
|
try {
|
|
2835
2887
|
const handle = await startCuratorServer({
|
|
2836
2888
|
queries,
|
|
2889
|
+
initialResultIndexCapacity: curatorResultIndexCapacity(queries.length),
|
|
2837
2890
|
sessionToken,
|
|
2838
2891
|
timeout: curatorTimeoutSeconds,
|
|
2839
2892
|
availableProviders,
|
|
@@ -2912,19 +2965,21 @@ export default function (pi) {
|
|
|
2912
2965
|
}
|
|
2913
2966
|
},
|
|
2914
2967
|
async onAddSearch(query, provider) {
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2968
|
+
return runWithProxy(undefined, async () => {
|
|
2969
|
+
if (commandHandle && !isCommandActive()) {
|
|
2970
|
+
throw new Error("Curator session is no longer active.");
|
|
2971
|
+
}
|
|
2972
|
+
const requestedProvider = resolveCuratorSearchProvider(provider, currentSearchProvider);
|
|
2973
|
+
const response = await search(query, {
|
|
2974
|
+
provider: requestedProvider,
|
|
2975
|
+
signal: searchAbort.signal,
|
|
2976
|
+
extensionContext: ctx,
|
|
2977
|
+
});
|
|
2978
|
+
if (commandHandle && !isCommandActive()) {
|
|
2979
|
+
throw new Error("Curator session is no longer active.");
|
|
2980
|
+
}
|
|
2981
|
+
return toCuratorSearchEntries(response);
|
|
2923
2982
|
});
|
|
2924
|
-
if (commandHandle && !isCommandActive()) {
|
|
2925
|
-
throw new Error("Curator session is no longer active.");
|
|
2926
|
-
}
|
|
2927
|
-
return toCuratorSearchEntries(response);
|
|
2928
2983
|
},
|
|
2929
2984
|
onAddSearchResults(entries) {
|
|
2930
2985
|
if (commandHandle && !isCommandActive())
|
|
@@ -2986,46 +3041,45 @@ export default function (pi) {
|
|
|
2986
3041
|
}
|
|
2987
3042
|
if (queries.length > 0) {
|
|
2988
3043
|
(async () => {
|
|
2989
|
-
|
|
2990
|
-
for (let qi = 0; qi < queries.length; qi++) {
|
|
3044
|
+
await runSearchQueries(queries, async (query, qi) => {
|
|
2991
3045
|
if (aborted || !isCommandActive())
|
|
2992
|
-
|
|
3046
|
+
return;
|
|
2993
3047
|
const requestedProvider = currentSearchProvider;
|
|
2994
3048
|
try {
|
|
2995
|
-
const response = await search(
|
|
3049
|
+
const response = await runWithProxy(undefined, () => search(query, {
|
|
2996
3050
|
provider: requestedProvider,
|
|
2997
3051
|
signal: searchAbort.signal,
|
|
2998
3052
|
extensionContext: ctx,
|
|
2999
|
-
});
|
|
3053
|
+
}));
|
|
3000
3054
|
if (aborted || !isCommandActive())
|
|
3001
|
-
|
|
3055
|
+
return;
|
|
3002
3056
|
const entries = toCuratorSearchEntries(response);
|
|
3003
3057
|
for (let entryIndex = 0; entryIndex < entries.length; entryIndex++) {
|
|
3004
3058
|
const entry = entries[entryIndex];
|
|
3005
|
-
const resultIndex =
|
|
3059
|
+
const resultIndex = curatorResultIndex(qi, entryIndex, queries.length);
|
|
3006
3060
|
const indexedEntry = {
|
|
3007
3061
|
...entry,
|
|
3008
3062
|
queryIndex: resultIndex,
|
|
3009
|
-
query
|
|
3063
|
+
query,
|
|
3010
3064
|
};
|
|
3011
3065
|
collected.set(resultIndex, indexedCuratorEntryToQueryResult(indexedEntry));
|
|
3012
3066
|
if (entry.error) {
|
|
3013
|
-
handle.pushError(resultIndex, entry.error, entry.provider, { query
|
|
3067
|
+
handle.pushError(resultIndex, entry.error, entry.provider, { query, slotIndex: qi });
|
|
3014
3068
|
}
|
|
3015
3069
|
else {
|
|
3016
|
-
handle.pushResult(resultIndex, { ...entry, query
|
|
3070
|
+
handle.pushResult(resultIndex, { ...entry, query, slotIndex: qi });
|
|
3017
3071
|
}
|
|
3018
3072
|
}
|
|
3019
3073
|
}
|
|
3020
3074
|
catch (err) {
|
|
3021
3075
|
if (aborted || !isCommandActive())
|
|
3022
|
-
|
|
3076
|
+
return;
|
|
3023
3077
|
const message = err instanceof Error ? err.message : String(err);
|
|
3024
3078
|
const failedProvider = toCuratorProvider(requestedProvider);
|
|
3025
|
-
handle.pushError(qi, message, failedProvider, { query
|
|
3026
|
-
collected.set(qi, { query
|
|
3079
|
+
handle.pushError(qi, message, failedProvider, { query, slotIndex: qi });
|
|
3080
|
+
collected.set(qi, { query, answer: "", results: [], error: message, provider: failedProvider });
|
|
3027
3081
|
}
|
|
3028
|
-
}
|
|
3082
|
+
});
|
|
3029
3083
|
if (!aborted && isCommandActive())
|
|
3030
3084
|
handle.searchesDone();
|
|
3031
3085
|
})();
|