@humain/terminal 0.0.6 → 0.0.8
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 +62 -0
- package/README.md +17 -10
- package/dist/bundle/chunks/anthropic-messages-GDMGYAZB.js +6 -0
- package/dist/bundle/chunks/anthropic.js +75 -0
- package/dist/bundle/chunks/azure-openai-responses-ZN52D6YC.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +77 -0
- package/dist/bundle/chunks/chunk-3VI4HD7D.js +31 -0
- package/dist/bundle/chunks/chunk-6R7UI4IY.js +2 -0
- package/dist/bundle/chunks/chunk-72KO4OMP.js +2 -0
- package/dist/bundle/chunks/chunk-74NVHVNZ.js +16 -0
- package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
- package/dist/bundle/chunks/chunk-ARF4OE6X.js +105 -0
- package/dist/bundle/chunks/chunk-BOW22LW6.js +42 -0
- package/dist/bundle/chunks/chunk-BZQ53VGE.js +70 -0
- package/dist/bundle/chunks/chunk-CBHC6EL7.js +133 -0
- package/dist/bundle/chunks/chunk-D7XAASZM.js +4 -0
- package/dist/bundle/chunks/chunk-ECWELYBH.js +17 -0
- package/dist/bundle/chunks/chunk-GMWCTUPB.js +2 -0
- package/dist/bundle/chunks/chunk-H2O6VOXT.js +11 -0
- package/dist/bundle/chunks/chunk-JUUC5AZY.js +2 -0
- package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
- package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
- package/dist/bundle/chunks/chunk-MA4UUCYX.js +18 -0
- package/dist/bundle/chunks/chunk-MMFBCF6F.js +5986 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
- package/dist/bundle/chunks/chunk-PSKDLDLZ.js +44 -0
- package/dist/bundle/chunks/chunk-SGTGQNNP.js +4 -0
- package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
- package/dist/bundle/chunks/chunk-TXBQIIIO.js +2 -0
- package/dist/bundle/chunks/chunk-WJZ4KLGL.js +2 -0
- package/dist/bundle/chunks/chunk-XNGRGP62.js +2 -0
- package/dist/bundle/chunks/dist-BXEVYJIO.js +7 -0
- package/dist/bundle/chunks/es-P2KNSZYR.js +9 -0
- package/dist/bundle/chunks/es5-FGTJ7ZFW.js +2 -0
- package/dist/bundle/chunks/event-streams-JOSQQSII.js +2 -0
- package/dist/bundle/chunks/extract-2L7ZVN7F.js +106 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-generative-ai-FF7M7XHT.js +2 -0
- package/dist/bundle/chunks/google-vertex-YMUBFRBA.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-562J2I52.js +2 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-O4M7IQML.js +5 -0
- package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
- package/dist/bundle/chunks/node-XY3CBY3C.js +294 -0
- package/dist/bundle/chunks/node-ZHY4LHC7.js +15 -0
- package/dist/bundle/chunks/openai-codex-responses-HRVCDY54.js +8 -0
- package/dist/bundle/chunks/openai-codex.js +75 -0
- package/dist/bundle/chunks/openai-completions-L4AHDQ5D.js +7 -0
- package/dist/bundle/chunks/openai-responses-4MWLJHIK.js +2 -0
- package/dist/bundle/chunks/openrouter-images-Y2PCWAQH.js +2 -0
- package/dist/bundle/chunks/openrouter.js +75 -0
- package/dist/bundle/chunks/pdfjs-UKQT3OWY.js +107 -0
- package/dist/bundle/chunks/pi-messages-57K43J6J.js +8 -0
- package/dist/bundle/chunks/promise-J5TGSM32.js +2 -0
- package/dist/bundle/chunks/radius.js +75 -0
- package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
- package/dist/bundle/chunks/undici-D6ABF53Q.js +2 -0
- package/dist/bundle/chunks/webapi-AFS5FDJJ.js +5 -0
- package/dist/bundle/chunks/xai.js +2 -0
- package/dist/bundle/cli.js +3 -0
- package/dist/bundle/client.js +2 -0
- package/dist/bundle/index.js +2 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +29 -9
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +2 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +2 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +19 -11
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +62 -15
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +240 -104
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +6 -7
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +7 -3
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +9 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +59 -36
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/defaults.d.ts +1 -0
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/defaults.js +9 -0
- package/dist/core/defaults.js.map +1 -1
- package/dist/core/extensions/index.d.ts +2 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +115 -48
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +5 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +44 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +56 -10
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +3 -0
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +1 -1
- package/dist/core/footer-data-provider.js +1 -1
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/keybindings.d.ts +20 -19
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +26 -5
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-config.d.ts +5 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +3 -1
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.d.ts +1 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +14 -8
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js +2 -1
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +22 -14
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-manifest.d.ts.map +1 -1
- package/dist/core/pi-manifest.js +2 -1
- package/dist/core/pi-manifest.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +2 -1
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +3 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +2 -2
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +10 -3
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-export.d.ts +4 -0
- package/dist/core/session-export.d.ts.map +1 -0
- package/dist/core/session-export.js +32 -0
- package/dist/core/session-export.js.map +1 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +6 -3
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-diagnostics.d.ts +9 -0
- package/dist/core/settings-diagnostics.d.ts.map +1 -0
- package/dist/core/settings-diagnostics.js +21 -0
- package/dist/core/settings-diagnostics.js.map +1 -0
- package/dist/core/settings-manager.d.ts +17 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +68 -10
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +51 -33
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +2 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +11 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +16 -3
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +62 -29
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +0 -5
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +2 -5
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +20 -4
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/index.d.ts +4 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +19 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/powershell.d.ts +16 -0
- package/dist/core/tools/powershell.d.ts.map +1 -0
- package/dist/core/tools/powershell.js +39 -0
- package/dist/core/tools/powershell.js.map +1 -0
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +4 -1
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +2 -1
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/extensions/llama/client.d.ts +6 -0
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +7 -0
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +2 -0
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +3 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +29 -4
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/humain/agent-execution-protocol.d.ts +1 -217
- package/dist/humain/agent-execution-protocol.d.ts.map +1 -1
- package/dist/humain/agent-execution-protocol.js +1 -203
- package/dist/humain/agent-execution-protocol.js.map +1 -1
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +107 -16
- package/dist/humain/mcp-adapter/vendor/CHANGELOG.md +82 -0
- package/dist/humain/mcp-adapter/vendor/README.md +47 -15
- package/dist/humain/mcp-adapter/vendor/cli.js +4 -4
- package/dist/humain/mcp-adapter/vendor/commands.ts +5 -3
- package/dist/humain/mcp-adapter/vendor/config.ts +46 -5
- package/dist/humain/mcp-adapter/vendor/direct-tools.ts +103 -92
- package/dist/humain/mcp-adapter/vendor/dist/agent-dir.d.ts +10 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-dir.js +63 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-dir.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.d.ts +8 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.js +356 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/config.d.ts +123 -0
- package/dist/humain/mcp-adapter/vendor/dist/config.js +1088 -0
- package/dist/humain/mcp-adapter/vendor/dist/config.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.d.ts +24 -0
- package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.js +336 -0
- package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.d.ts +19 -0
- package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.js +319 -0
- package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.d.ts +2 -0
- package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.js +156 -0
- package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/resource-tools.d.ts +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/resource-tools.js +15 -0
- package/dist/humain/mcp-adapter/vendor/dist/resource-tools.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/types.d.ts +566 -0
- package/dist/humain/mcp-adapter/vendor/dist/types.js +287 -0
- package/dist/humain/mcp-adapter/vendor/dist/types.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.d.ts +6 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.js +37 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.d.ts +104 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.js +59 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.d.ts +4 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.js +27 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/utils.d.ts +32 -0
- package/dist/humain/mcp-adapter/vendor/dist/utils.js +338 -0
- package/dist/humain/mcp-adapter/vendor/dist/utils.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/failure-backoff.ts +23 -0
- package/dist/humain/mcp-adapter/vendor/index.bundle.mjs +4870 -3878
- package/dist/humain/mcp-adapter/vendor/index.ts +294 -88
- package/dist/humain/mcp-adapter/vendor/init.ts +41 -30
- package/dist/humain/mcp-adapter/vendor/lifecycle.ts +16 -8
- package/dist/humain/mcp-adapter/vendor/mcp-auth-flow.ts +124 -32
- package/dist/humain/mcp-adapter/vendor/mcp-bearer-store.ts +0 -2
- package/dist/humain/mcp-adapter/vendor/mcp-code.ts +2 -0
- package/dist/humain/mcp-adapter/vendor/mcp-oauth-provider.ts +155 -16
- package/dist/humain/mcp-adapter/vendor/mcp-output-guard.ts +95 -7
- package/dist/humain/mcp-adapter/vendor/mcp-probe.ts +18 -4
- package/dist/humain/mcp-adapter/vendor/mcp-references.ts +376 -0
- package/dist/humain/mcp-adapter/vendor/mcp-status.ts +8 -19
- package/dist/humain/mcp-adapter/vendor/metadata-cache.ts +20 -12
- package/dist/humain/mcp-adapter/vendor/namespace-tools.ts +276 -0
- package/dist/humain/mcp-adapter/vendor/package.json +26 -8
- package/dist/humain/mcp-adapter/vendor/proxy-modes.ts +128 -32
- package/dist/humain/mcp-adapter/vendor/request-headers-command.ts +1 -1
- package/dist/humain/mcp-adapter/vendor/search-ranking.ts +2 -0
- package/dist/humain/mcp-adapter/vendor/server-manager.ts +69 -12
- package/dist/humain/mcp-adapter/vendor/state.ts +1 -3
- package/dist/humain/mcp-adapter/vendor/tool-result-renderer.ts +16 -2
- package/dist/humain/mcp-adapter/vendor/types.ts +51 -2
- package/dist/humain/mcp-adapter/vendor/ui-server.ts +3 -19
- package/dist/humain/mcp-adapter/vendor/ui-session.ts +2 -1
- package/dist/humain/mcp-adapter/vendor/utils.ts +21 -19
- package/dist/humain/mcp-adapter.d.ts.map +1 -1
- package/dist/humain/mcp-adapter.js +4 -0
- package/dist/humain/mcp-adapter.js.map +1 -1
- package/dist/humain/web-access/vendor/chrome-cookies.d.ts +14 -0
- package/dist/humain/web-access/vendor/chrome-cookies.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/chrome-cookies.js +85 -33
- package/dist/humain/web-access/vendor/chrome-cookies.js.map +1 -1
- package/dist/humain/web-access/vendor/credential-source.d.ts +1 -1
- package/dist/humain/web-access/vendor/credential-source.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/credential-source.js +3 -1
- package/dist/humain/web-access/vendor/credential-source.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.d.ts +2 -29
- package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.js +10 -1
- package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.d.ts +2 -29
- package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.js +4 -0
- package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
- package/dist/humain/web-access/vendor/extract.d.ts +11 -0
- package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/extract.js +163 -20
- package/dist/humain/web-access/vendor/extract.js.map +1 -1
- package/dist/humain/web-access/vendor/fetch-params.d.ts +2 -0
- package/dist/humain/web-access/vendor/fetch-params.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/fetch-params.js +11 -0
- package/dist/humain/web-access/vendor/fetch-params.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-adc.d.ts +10 -0
- package/dist/humain/web-access/vendor/gemini-adc.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/gemini-adc.js +268 -0
- package/dist/humain/web-access/vendor/gemini-adc.js.map +1 -0
- package/dist/humain/web-access/vendor/gemini-api.d.ts +7 -1
- package/dist/humain/web-access/vendor/gemini-api.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-api.js +51 -15
- package/dist/humain/web-access/vendor/gemini-api.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.d.ts +9 -4
- package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.js +63 -21
- package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-url-context.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-url-context.js +3 -2
- package/dist/humain/web-access/vendor/gemini-url-context.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web-config.d.ts +8 -1
- package/dist/humain/web-access/vendor/gemini-web-config.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web-config.js +49 -4
- package/dist/humain/web-access/vendor/gemini-web-config.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web.d.ts +2 -1
- package/dist/humain/web-access/vendor/gemini-web.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web.js +8 -3
- package/dist/humain/web-access/vendor/gemini-web.js.map +1 -1
- package/dist/humain/web-access/vendor/github-api.d.ts +1 -1
- package/dist/humain/web-access/vendor/github-api.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/github-api.js +6 -4
- package/dist/humain/web-access/vendor/github-api.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 +50 -3
- package/dist/humain/web-access/vendor/github-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/github-issue-pr.d.ts +27 -0
- package/dist/humain/web-access/vendor/github-issue-pr.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/github-issue-pr.js +701 -0
- package/dist/humain/web-access/vendor/github-issue-pr.js.map +1 -0
- package/dist/humain/web-access/vendor/index.d.ts +3 -31
- package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/index.js +643 -530
- package/dist/humain/web-access/vendor/index.js.map +1 -1
- package/dist/humain/web-access/vendor/kimi-search.d.ts +5 -0
- package/dist/humain/web-access/vendor/kimi-search.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/kimi-search.js +228 -0
- package/dist/humain/web-access/vendor/kimi-search.js.map +1 -0
- package/dist/humain/web-access/vendor/openai-search.d.ts +3 -0
- package/dist/humain/web-access/vendor/openai-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/openai-search.js +89 -16
- package/dist/humain/web-access/vendor/openai-search.js.map +1 -1
- package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/page-query.js +56 -8
- package/dist/humain/web-access/vendor/page-query.js.map +1 -1
- package/dist/humain/web-access/vendor/ssrf-protection.js +6 -1
- package/dist/humain/web-access/vendor/ssrf-protection.js.map +1 -1
- package/dist/humain/web-access/vendor/utils.d.ts +12 -0
- package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/utils.js +343 -1
- package/dist/humain/web-access/vendor/utils.js.map +1 -1
- package/dist/humain/web-access/vendor/xcrawl.d.ts +4 -0
- package/dist/humain/web-access/vendor/xcrawl.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/xcrawl.js +251 -0
- package/dist/humain/web-access/vendor/xcrawl.js.map +1 -0
- package/dist/humain/web-access/vendor/youtube-extract.js +2 -2
- package/dist/humain/web-access/vendor/youtube-extract.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +19 -14
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +4 -3
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +9 -3
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +53 -10
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +9 -2
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +128 -55
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-submenu.js +151 -0
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +68 -17
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +2 -1
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +15 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +224 -130
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-share.d.ts +16 -0
- package/dist/modes/interactive/session-share.d.ts.map +1 -0
- package/dist/modes/interactive/session-share.js +188 -0
- package/dist/modes/interactive/session-share.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +6 -5
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts +16 -13
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js +20 -6
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +7 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +10 -2
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +3 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +14 -7
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +189 -3
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/changelog.d.ts +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +12 -2
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +2 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/management-http.d.ts +5 -3
- package/dist/utils/management-http.d.ts.map +1 -1
- package/dist/utils/management-http.js +14 -10
- package/dist/utils/management-http.js.map +1 -1
- package/dist/utils/shell.d.ts +3 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +23 -9
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +64 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/text.d.ts +8 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +9 -0
- package/dist/utils/text.js.map +1 -0
- package/dist/utils/version-check.js +4 -4
- package/dist/utils/version-check.js.map +1 -1
- package/docs/compaction.md +17 -0
- package/docs/custom-provider.md +12 -9
- package/docs/environment-variables.md +11 -8
- package/docs/extensions.md +35 -7
- package/docs/json.md +7 -2
- package/docs/keybindings.md +9 -9
- package/docs/llama-cpp.md +2 -0
- package/docs/models.md +8 -2
- package/docs/packages.md +2 -2
- package/docs/quickstart.md +1 -1
- package/docs/rpc.md +32 -3
- package/docs/sdk.md +7 -2
- package/docs/settings.md +23 -7
- package/docs/skills.md +3 -2
- package/docs/terminal-setup.md +20 -0
- package/docs/usage.md +14 -10
- package/docs/windows.md +15 -1
- package/examples/extensions/border-status-editor.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +70 -8
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/git-checkpoint.ts +2 -2
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/notify.ts +3 -1
- package/examples/extensions/sandbox/package-lock.json +14 -40
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/extensions/with-deps/package-lock.json +4 -4
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/rpc-extension-ui.ts +1 -1
- package/examples/sdk/06-extensions.ts +1 -1
- package/examples/sdk/README.md +1 -1
- package/npm-shrinkwrap.json +293 -221
- package/package.json +21 -18
- package/src/humain/mcp-adapter/UPSTREAM.md +15 -5
- package/src/humain/mcp-adapter/upstream.json +4 -3
- package/src/humain/mcp-adapter/vendor/CHANGELOG.md +82 -0
- package/src/humain/web-access/UPSTREAM.md +1 -1
- package/src/humain/web-access/upstream.json +6 -4
|
@@ -8,6 +8,7 @@ import { activityMonitor } from "./activity.js";
|
|
|
8
8
|
import { extractRSCContent } from "./rsc-extract.js";
|
|
9
9
|
import { extractPDFToMarkdown, isPDF, loadPDFConfig } from "./pdf-extract.js";
|
|
10
10
|
import { extractGitHub } from "./github-extract.js";
|
|
11
|
+
import { extractGitHubIssuePr } from "./github-issue-pr.js";
|
|
11
12
|
import { isYouTubeURL, isYouTubeEnabled, extractYouTube, extractYouTubeFrame, extractYouTubeFrames, getYouTubeStreamInfo } from "./youtube-extract.js";
|
|
12
13
|
import { CredentialResolutionError } from "./credential-source.js";
|
|
13
14
|
import { extractWithUrlContext, extractWithGeminiWeb } from "./gemini-url-context.js";
|
|
@@ -29,14 +30,85 @@ import { assertAuthFetchUrl, authFetchRedirectGuard } from "./auth-fetch.js";
|
|
|
29
30
|
import { getBrowserCookiesForHosts, getLastBrowserCookieDiagnostic } from "./chrome-cookies.js";
|
|
30
31
|
import { sanitizeInlineDataUris } from "./data-uri-sanitize.js";
|
|
31
32
|
const DEFAULT_TIMEOUT_MS = 30000;
|
|
33
|
+
const MAX_CONFIGURED_TIMEOUT_MS = 2_147_483_647;
|
|
32
34
|
const CONCURRENT_LIMIT = 3;
|
|
35
|
+
const WEB_SEARCH_CONFIG_PATH = getWebSearchConfigPath();
|
|
36
|
+
function loadFetchTimeoutMs() {
|
|
37
|
+
if (!existsSync(WEB_SEARCH_CONFIG_PATH))
|
|
38
|
+
return DEFAULT_TIMEOUT_MS;
|
|
39
|
+
let raw;
|
|
40
|
+
try {
|
|
41
|
+
raw = JSON.parse(readFileSync(WEB_SEARCH_CONFIG_PATH, "utf-8"));
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
45
|
+
throw new Error(`Failed to parse ${WEB_SEARCH_CONFIG_PATH}: ${message}`);
|
|
46
|
+
}
|
|
47
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
48
|
+
throw new Error(`Invalid config in ${WEB_SEARCH_CONFIG_PATH}: expected a JSON object`);
|
|
49
|
+
}
|
|
50
|
+
const fetchConfig = raw.fetch;
|
|
51
|
+
if (fetchConfig === undefined)
|
|
52
|
+
return DEFAULT_TIMEOUT_MS;
|
|
53
|
+
if (!fetchConfig || typeof fetchConfig !== "object" || Array.isArray(fetchConfig)) {
|
|
54
|
+
throw new Error(`fetch in ${WEB_SEARCH_CONFIG_PATH} must be an object`);
|
|
55
|
+
}
|
|
56
|
+
const value = fetchConfig.timeout;
|
|
57
|
+
if (value === undefined)
|
|
58
|
+
return DEFAULT_TIMEOUT_MS;
|
|
59
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
60
|
+
throw new Error(`Invalid fetch.timeout in ${WEB_SEARCH_CONFIG_PATH}: expected a positive finite number of seconds, got ${JSON.stringify(value)}`);
|
|
61
|
+
}
|
|
62
|
+
const timeoutMs = Math.ceil(value * 1000);
|
|
63
|
+
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > MAX_CONFIGURED_TIMEOUT_MS) {
|
|
64
|
+
throw new Error(`Invalid fetch.timeout in ${WEB_SEARCH_CONFIG_PATH}: converted timeout must be a finite safe integer from 1 through ${MAX_CONFIGURED_TIMEOUT_MS} milliseconds`);
|
|
65
|
+
}
|
|
66
|
+
return Math.max(1, timeoutMs);
|
|
67
|
+
}
|
|
33
68
|
const NON_RECOVERABLE_ERRORS = ["Unsupported content type", "Response too large", "PDF extraction is disabled", "Image fetching is disabled"];
|
|
34
69
|
const MIN_USEFUL_CONTENT = 500;
|
|
35
70
|
const SUPPORTED_IMAGE_TYPES = new Set(["image/png", "image/jpeg", "image/webp", "image/gif"]);
|
|
36
|
-
const WEB_SEARCH_CONFIG_PATH = getWebSearchConfigPath();
|
|
37
71
|
const FETCH_PROVIDERS = ["http", "firecrawl", "jina", "tinyfish", "search1api", "querit", "kagi", "ollama", "parallel", "parallel-mcp", "brightdata", "gemini"];
|
|
38
72
|
const DEFAULT_FETCH_PROVIDER_ORDER = ["http", "firecrawl", "jina", "tinyfish", "search1api", "querit", "kagi", "ollama", "parallel", "brightdata", "gemini"];
|
|
39
73
|
const REMOTE_HOSTED_FETCH_PROVIDERS = new Set(["jina", "tinyfish", "search1api", "querit", "kagi", "ollama", "parallel", "parallel-mcp", "brightdata", "gemini"]);
|
|
74
|
+
function isDefuddleConsoleError(args) {
|
|
75
|
+
const prefix = args[0];
|
|
76
|
+
return prefix === "Defuddle" || (typeof prefix === "string" && /^Defuddle(?:\s|:)/.test(prefix));
|
|
77
|
+
}
|
|
78
|
+
async function extractWithDefuddle(text, url) {
|
|
79
|
+
const { Defuddle } = await import("defuddle/node");
|
|
80
|
+
const { document } = parseHTML(text);
|
|
81
|
+
Object.defineProperty(document, "location", {
|
|
82
|
+
value: new URL(url),
|
|
83
|
+
configurable: true,
|
|
84
|
+
});
|
|
85
|
+
let processingError;
|
|
86
|
+
const originalConsoleError = console.error;
|
|
87
|
+
console.error = (...args) => {
|
|
88
|
+
if (isDefuddleConsoleError(args)) {
|
|
89
|
+
if (args[0] === "Defuddle" && args[1] === "Error processing document:") {
|
|
90
|
+
processingError = args[2];
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
originalConsoleError(...args);
|
|
95
|
+
};
|
|
96
|
+
let resultPromise;
|
|
97
|
+
try {
|
|
98
|
+
// With useAsync:false, Defuddle parses synchronously before returning its promise.
|
|
99
|
+
// Keep the console interception limited to that call so unrelated Pi output is
|
|
100
|
+
// never routed through this fallback's handler.
|
|
101
|
+
resultPromise = Defuddle(document, url, { markdown: true, useAsync: false });
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
console.error = originalConsoleError;
|
|
105
|
+
}
|
|
106
|
+
const result = await resultPromise;
|
|
107
|
+
if (processingError !== undefined) {
|
|
108
|
+
throw new Error(`Defuddle failed to process document: ${errorMessage(processingError)}`);
|
|
109
|
+
}
|
|
110
|
+
return typeof result.content === "string" ? { title: result.title, content: result.content } : null;
|
|
111
|
+
}
|
|
40
112
|
export { loadSsrfConfig } from "./ssrf-protection.js";
|
|
41
113
|
export function loadSsrfAllowRanges() {
|
|
42
114
|
return loadSsrfConfig().allowRanges;
|
|
@@ -162,6 +234,26 @@ function loadFetchRouting() {
|
|
|
162
234
|
}
|
|
163
235
|
return { providers, allowRemoteHostedProviders: allowRemoteHostedProvidersValue === true };
|
|
164
236
|
}
|
|
237
|
+
/** Guidance for definitive origin 404/410 responses: no extraction provider
|
|
238
|
+
* can retrieve a page the origin says is gone, so point at the registered
|
|
239
|
+
* search/fetch tools (when the caller knows them) instead of provider config. */
|
|
240
|
+
function notFoundGuidance(result, toolNames) {
|
|
241
|
+
const lines = [
|
|
242
|
+
result.error ?? `HTTP ${result.status}`,
|
|
243
|
+
"",
|
|
244
|
+
`The origin server says this page does not exist (HTTP ${result.status}), so extraction providers cannot retrieve it.`,
|
|
245
|
+
];
|
|
246
|
+
if (toolNames?.webSearch && toolNames.fetchContent) {
|
|
247
|
+
lines.push(`The page may have moved or been renamed. Use ${toolNames.webSearch} to find the current URL, then retry ${toolNames.fetchContent} with it.`);
|
|
248
|
+
}
|
|
249
|
+
else if (toolNames?.webSearch) {
|
|
250
|
+
lines.push(`The page may have moved or been renamed. Use ${toolNames.webSearch} to find the current URL.`);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
lines.push("The page may have moved or been renamed. Find the current URL, then retry the fetch with it.");
|
|
254
|
+
}
|
|
255
|
+
return lines.join("\n");
|
|
256
|
+
}
|
|
165
257
|
function abortedResult(url) {
|
|
166
258
|
return { url, title: "", content: "", error: "Aborted" };
|
|
167
259
|
}
|
|
@@ -170,9 +262,12 @@ const turndown = new TurndownService({
|
|
|
170
262
|
codeBlockStyle: "fenced",
|
|
171
263
|
});
|
|
172
264
|
const fetchLimit = pLimit(CONCURRENT_LIMIT);
|
|
265
|
+
/** Resolve the direct HTTP/Jina fetch budget, with a per-call override taking precedence. */
|
|
266
|
+
export function resolveFetchTimeoutMs(options) {
|
|
267
|
+
return options?.timeoutMs ?? loadFetchTimeoutMs();
|
|
268
|
+
}
|
|
173
269
|
const JINA_READER_BASE = "https://r.jina.ai/";
|
|
174
|
-
|
|
175
|
-
async function extractWithJinaReader(url, signal, lookup) {
|
|
270
|
+
async function extractWithJinaReader(url, timeoutMs, signal, lookup) {
|
|
176
271
|
const jinaUrl = JINA_READER_BASE + url;
|
|
177
272
|
const activityId = activityMonitor.logStart({ type: "api", query: `jina: ${url}` });
|
|
178
273
|
try {
|
|
@@ -190,7 +285,7 @@ async function extractWithJinaReader(url, signal, lookup) {
|
|
|
190
285
|
"X-No-Cache": "true",
|
|
191
286
|
},
|
|
192
287
|
signal: AbortSignal.any([
|
|
193
|
-
AbortSignal.timeout(
|
|
288
|
+
AbortSignal.timeout(timeoutMs),
|
|
194
289
|
...(signal ? [signal] : []),
|
|
195
290
|
]),
|
|
196
291
|
});
|
|
@@ -326,17 +421,14 @@ export async function extractContent(url, signal, options) {
|
|
|
326
421
|
return { url, title: "", content: "", error: errorMessage(err) };
|
|
327
422
|
}
|
|
328
423
|
}
|
|
329
|
-
if (options?.authFetchProfile) {
|
|
424
|
+
if (options?.authFetchProfile || options?.mode === "raw") {
|
|
330
425
|
try {
|
|
331
|
-
return await extractViaHttp(url, signal, options);
|
|
426
|
+
return await extractViaHttp(url, resolveFetchTimeoutMs(options), signal, options);
|
|
332
427
|
}
|
|
333
428
|
catch (err) {
|
|
334
429
|
return { url, title: "", content: "", error: errorMessage(err) };
|
|
335
430
|
}
|
|
336
431
|
}
|
|
337
|
-
if (options?.mode === "raw") {
|
|
338
|
-
return extractViaHttp(url, signal, options);
|
|
339
|
-
}
|
|
340
432
|
if (options?.frames || options?.timestamp) {
|
|
341
433
|
const disabled = imageGateError();
|
|
342
434
|
if (disabled)
|
|
@@ -488,6 +580,21 @@ export async function extractContent(url, signal, options) {
|
|
|
488
580
|
catch (err) {
|
|
489
581
|
return { url, title: "", content: "", error: errorMessage(err) };
|
|
490
582
|
}
|
|
583
|
+
try {
|
|
584
|
+
const ghIssuePrResult = await extractGitHubIssuePr(url, signal, options);
|
|
585
|
+
if (ghIssuePrResult)
|
|
586
|
+
return ghIssuePrResult;
|
|
587
|
+
if (signal?.aborted)
|
|
588
|
+
return abortedResult(url);
|
|
589
|
+
}
|
|
590
|
+
catch (err) {
|
|
591
|
+
const message = errorMessage(err);
|
|
592
|
+
if (isAbortError(err))
|
|
593
|
+
return abortedResult(url);
|
|
594
|
+
if (isConfigParseError(err)) {
|
|
595
|
+
return { url, title: "", content: "", error: message };
|
|
596
|
+
}
|
|
597
|
+
}
|
|
491
598
|
try {
|
|
492
599
|
const ghResult = await extractGitHub(url, signal, options?.forceClone);
|
|
493
600
|
if (ghResult)
|
|
@@ -534,6 +641,13 @@ export async function extractContent(url, signal, options) {
|
|
|
534
641
|
}
|
|
535
642
|
if (signal?.aborted)
|
|
536
643
|
return abortedResult(url);
|
|
644
|
+
let fetchTimeoutMs;
|
|
645
|
+
try {
|
|
646
|
+
fetchTimeoutMs = resolveFetchTimeoutMs(options);
|
|
647
|
+
}
|
|
648
|
+
catch (err) {
|
|
649
|
+
return { url, title: "", content: "", error: errorMessage(err) };
|
|
650
|
+
}
|
|
537
651
|
let fetchRouting;
|
|
538
652
|
try {
|
|
539
653
|
fetchRouting = loadFetchRouting();
|
|
@@ -562,7 +676,7 @@ export async function extractContent(url, signal, options) {
|
|
|
562
676
|
? { ...httpResult, error: message }
|
|
563
677
|
: { url, title: "", content: "", error: message };
|
|
564
678
|
const runHttpProvider = async () => {
|
|
565
|
-
const { declaredLinks: discoveredLinks = [], ...result } = await extractViaHttp(url, signal, options);
|
|
679
|
+
const { declaredLinks: discoveredLinks = [], ...result } = await extractViaHttp(url, fetchTimeoutMs, signal, options);
|
|
566
680
|
httpResult = result;
|
|
567
681
|
declaredLinks = discoveredLinks;
|
|
568
682
|
if (signal?.aborted)
|
|
@@ -620,7 +734,7 @@ export async function extractContent(url, signal, options) {
|
|
|
620
734
|
continue;
|
|
621
735
|
}
|
|
622
736
|
if (provider === "jina") {
|
|
623
|
-
const jinaResult = await extractWithJinaReader(url, signal, options?.lookup);
|
|
737
|
+
const jinaResult = await extractWithJinaReader(url, fetchTimeoutMs, signal, options?.lookup);
|
|
624
738
|
if (jinaResult)
|
|
625
739
|
return withDeclaredLinks(jinaResult);
|
|
626
740
|
continue;
|
|
@@ -796,6 +910,13 @@ export async function extractContent(url, signal, options) {
|
|
|
796
910
|
const finalHttpResult = httpResult;
|
|
797
911
|
if (finalHttpResult && declaredLinks.length > 0)
|
|
798
912
|
return { ...finalHttpResult, error: null };
|
|
913
|
+
// A definitive 404/410 from the origin means no extraction provider can
|
|
914
|
+
// retrieve the page, so the provider-configuration checklist below would
|
|
915
|
+
// send users down the wrong path. Point at search instead.
|
|
916
|
+
if (finalHttpResult?.status === 404 || finalHttpResult?.status === 410) {
|
|
917
|
+
return { ...finalHttpResult, error: notFoundGuidance(finalHttpResult, options?.toolNames) };
|
|
918
|
+
}
|
|
919
|
+
const searchToolName = options?.toolNames?.webSearch;
|
|
799
920
|
const guidance = [
|
|
800
921
|
finalHttpResult?.error ?? "No fetch_content provider returned content",
|
|
801
922
|
...(firecrawlError ? [`Firecrawl fallback failed: ${firecrawlError}`] : []),
|
|
@@ -819,26 +940,22 @@ export async function extractContent(url, signal, options) {
|
|
|
819
940
|
` • Set brightdataApiKey and brightdataUnlockerZone in ${WEB_SEARCH_CONFIG_PATH} or BRIGHTDATA_API_KEY and BRIGHTDATA_UNLOCKER_ZONE`,
|
|
820
941
|
` • Set GEMINI_API_KEY in ${WEB_SEARCH_CONFIG_PATH}`,
|
|
821
942
|
" • Sign into gemini.google.com in Chrome",
|
|
822
|
-
|
|
943
|
+
...(searchToolName ? [` • Use ${searchToolName} to find content about this topic`] : []),
|
|
823
944
|
].join("\n");
|
|
824
945
|
return { ...(finalHttpResult ?? { url, title: "", content: "", error: null }), error: guidance };
|
|
825
946
|
}
|
|
826
947
|
function isLikelyJSRendered(html) {
|
|
827
|
-
// Extract body content
|
|
828
948
|
const bodyMatch = html.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
|
|
829
949
|
if (!bodyMatch)
|
|
830
950
|
return false;
|
|
831
951
|
const bodyHtml = bodyMatch[1];
|
|
832
|
-
// Strip tags to get text content
|
|
833
952
|
const textContent = bodyHtml
|
|
834
953
|
.replace(/<script[\s\S]*?<\/script>/gi, "")
|
|
835
954
|
.replace(/<style[\s\S]*?<\/style>/gi, "")
|
|
836
955
|
.replace(/<[^>]+>/g, "")
|
|
837
956
|
.replace(/\s+/g, " ")
|
|
838
957
|
.trim();
|
|
839
|
-
// Count scripts
|
|
840
958
|
const scriptCount = (html.match(/<script/gi) || []).length;
|
|
841
|
-
// Heuristic: little text content but many scripts suggests JS rendering
|
|
842
959
|
return textContent.length < 500 && scriptCount > 3;
|
|
843
960
|
}
|
|
844
961
|
export async function readPDFResponseBuffer(response, maxSizeMB) {
|
|
@@ -909,8 +1026,7 @@ function pdfSizeLimitError(maxSizeMB) {
|
|
|
909
1026
|
function responseSizeLimitError(maxBytes) {
|
|
910
1027
|
return new Error(`Response too large (${Math.round(maxBytes / 1024 / 1024)}MB)`);
|
|
911
1028
|
}
|
|
912
|
-
async function extractViaHttp(url, signal, options) {
|
|
913
|
-
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1029
|
+
async function extractViaHttp(url, timeoutMs, signal, options) {
|
|
914
1030
|
const activityId = activityMonitor.logStart({ type: "fetch", url });
|
|
915
1031
|
const controller = new AbortController();
|
|
916
1032
|
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
@@ -920,8 +1036,10 @@ async function extractViaHttp(url, signal, options) {
|
|
|
920
1036
|
const ssrf = loadSsrfConfig();
|
|
921
1037
|
const domainPolicy = loadFetchContentDomainPolicy();
|
|
922
1038
|
const authProfile = options?.authFetchProfile;
|
|
1039
|
+
const trustEnvProxy = options?.proxy === undefined && ssrf.trustEnvProxy;
|
|
923
1040
|
const requestInit = {
|
|
924
1041
|
signal: controller.signal,
|
|
1042
|
+
__proxy: options?.proxy,
|
|
925
1043
|
headers: {
|
|
926
1044
|
"User-Agent": "OpenAI File Downloader, XaiImageApiFetch/1.0",
|
|
927
1045
|
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
|
|
@@ -935,10 +1053,10 @@ async function extractViaHttp(url, signal, options) {
|
|
|
935
1053
|
},
|
|
936
1054
|
};
|
|
937
1055
|
const response = authProfile
|
|
938
|
-
? await fetchAuthenticatedRemoteUrl(url, requestInit, { ssrf, domainPolicy, ...(options?.lookup ? { lookup: options.lookup } : {}) }, authProfile)
|
|
1056
|
+
? await fetchAuthenticatedRemoteUrl(url, requestInit, { ssrf: { ...ssrf, trustEnvProxy }, domainPolicy, ...(options?.lookup ? { lookup: options.lookup } : {}) }, authProfile)
|
|
939
1057
|
: await fetchRemoteUrl(url, requestInit, {
|
|
940
1058
|
allowRanges: ssrf.allowRanges,
|
|
941
|
-
trustEnvProxy
|
|
1059
|
+
trustEnvProxy,
|
|
942
1060
|
domainPolicy,
|
|
943
1061
|
...(options?.lookup ? { lookup: options.lookup } : {}),
|
|
944
1062
|
});
|
|
@@ -1077,6 +1195,19 @@ async function extractViaHttp(url, signal, options) {
|
|
|
1077
1195
|
declaredLinks,
|
|
1078
1196
|
};
|
|
1079
1197
|
}
|
|
1198
|
+
controller.signal.throwIfAborted();
|
|
1199
|
+
const defuddleResult = await extractWithDefuddle(text, response.url || url);
|
|
1200
|
+
controller.signal.throwIfAborted();
|
|
1201
|
+
if (defuddleResult && defuddleResult.content.length >= MIN_USEFUL_CONTENT) {
|
|
1202
|
+
activityMonitor.logComplete(activityId, response.status);
|
|
1203
|
+
return {
|
|
1204
|
+
url,
|
|
1205
|
+
title: documentTitle || defuddleResult.title,
|
|
1206
|
+
content: appendDeclaredWebLinks(defuddleResult.content, declaredLinks),
|
|
1207
|
+
error: null,
|
|
1208
|
+
declaredLinks,
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1080
1211
|
activityMonitor.logComplete(activityId, response.status);
|
|
1081
1212
|
const jsRendered = isLikelyJSRendered(text);
|
|
1082
1213
|
const errorMsg = jsRendered
|
|
@@ -1106,6 +1237,18 @@ async function extractViaHttp(url, signal, options) {
|
|
|
1106
1237
|
declaredLinks,
|
|
1107
1238
|
};
|
|
1108
1239
|
}
|
|
1240
|
+
controller.signal.throwIfAborted();
|
|
1241
|
+
const defuddleResult = await extractWithDefuddle(text, response.url || url);
|
|
1242
|
+
controller.signal.throwIfAborted();
|
|
1243
|
+
if (defuddleResult && defuddleResult.content.length >= MIN_USEFUL_CONTENT) {
|
|
1244
|
+
return {
|
|
1245
|
+
url,
|
|
1246
|
+
title: article.title || documentTitle || defuddleResult.title,
|
|
1247
|
+
content: appendDeclaredWebLinks(defuddleResult.content, declaredLinks),
|
|
1248
|
+
error: null,
|
|
1249
|
+
declaredLinks,
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1109
1252
|
return {
|
|
1110
1253
|
url,
|
|
1111
1254
|
title: article.title || documentTitle,
|