@humain/humain-code 0.4.12 → 0.4.13
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 +15 -1
- package/dist/bun/sandbox-env-setup.js +1 -1
- package/dist/bun/sandbox-env-setup.js.map +1 -1
- package/dist/bundle/agent-monitor.js +1 -1
- package/dist/bundle/chunks/anthropic-messages-YSAHA7QM.js +67 -0
- package/dist/bundle/chunks/azure-openai-responses-Z5XYDPHS.js +15 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +393 -314
- package/dist/bundle/chunks/{chunk-EDKZRYWJ.js → chunk-2TTB6GIB.js} +2 -2
- package/dist/bundle/chunks/{chunk-HSDTSUZE.js → chunk-36Q5UVQL.js} +47 -89
- package/dist/bundle/chunks/chunk-4DXXZHY2.js +540 -0
- package/dist/bundle/chunks/{chunk-BKJU56SM.js → chunk-A7QKOI62.js} +142 -126
- package/dist/bundle/chunks/{chunk-UW4GMZL3.js → chunk-AIXI6RIE.js} +264 -248
- package/dist/bundle/chunks/{chunk-V5ZF7Q7L.js → chunk-BVHXWQLD.js} +52 -47
- package/dist/bundle/chunks/{chunk-I2ZWZAIV.js → chunk-COF5P635.js} +222 -148
- package/dist/bundle/chunks/{chunk-SCIGZFN5.js → chunk-DNGJMRJW.js} +11 -11
- package/dist/bundle/chunks/{chunk-XGO43DKL.js → chunk-DUSJT2W4.js} +21 -25
- package/dist/bundle/chunks/chunk-EYIYBQAR.js +7 -0
- package/dist/bundle/chunks/chunk-FRUFMISJ.js +505 -0
- package/dist/bundle/chunks/{chunk-R5VIAWGA.js → chunk-H2FY3PEV.js} +9 -8
- package/dist/bundle/chunks/{chunk-KGI4EX6R.js → chunk-JNHXXVLA.js} +126 -125
- package/dist/bundle/chunks/{chunk-45ZBHMQG.js → chunk-JQCWRL5K.js} +4 -4
- package/dist/bundle/chunks/{chunk-AS2Y2MO6.js → chunk-KK3KUUMM.js} +643 -624
- package/dist/bundle/chunks/{chunk-6KAMTNN3.js → chunk-L3J4P5JR.js} +1 -1
- package/dist/bundle/chunks/chunk-L6Z6JKKC.js +3 -0
- package/dist/bundle/chunks/{chunk-DZ5C66IU.js → chunk-LUL775V7.js} +33 -33
- package/dist/bundle/chunks/{chunk-BRXQUQSC.js → chunk-MF2NEHP4.js} +778 -775
- package/dist/bundle/chunks/chunk-MG5PX4KU.js +31 -0
- package/dist/bundle/chunks/{chunk-LCOHFEZZ.js → chunk-NNKA2PAP.js} +1 -1
- package/dist/bundle/chunks/{chunk-HMWAH7ZY.js → chunk-OX2IBCCA.js} +53 -49
- package/dist/bundle/chunks/{chunk-WBJN6PEI.js → chunk-QYCOHSI7.js} +1 -1
- package/dist/bundle/chunks/{chunk-NLTW6A7G.js → chunk-TC7EANW4.js} +3730 -3353
- package/dist/bundle/chunks/{chunk-77EWF2NW.js → chunk-TJG52LZB.js} +1 -1
- package/dist/bundle/chunks/{chunk-5XD3DHYL.js → chunk-UDVC7A5S.js} +1 -1
- package/dist/bundle/chunks/chunk-UGXYG7HN.js +22 -0
- package/dist/bundle/chunks/{chunk-VYIIPF57.js → chunk-UHLW4KJ7.js} +419 -413
- package/dist/bundle/chunks/{chunk-FF26YENK.js → chunk-W2QRCQBX.js} +4 -3
- package/dist/bundle/chunks/chunk-XQRYOCHA.js +26 -0
- package/dist/bundle/chunks/{chunk-7Z5MWPYE.js → chunk-Y3RFGBG2.js} +1 -1
- package/dist/bundle/chunks/chunk-YJ3NQWES.js +9 -0
- package/dist/bundle/chunks/{chunk-YJBE3IGR.js → chunk-YRCLNWFV.js} +20 -20
- package/dist/bundle/chunks/chunk-YZMQXAJM.js +8 -0
- package/dist/bundle/chunks/{chunk-BHM75BJJ.js → chunk-Z74ZYQPX.js} +207 -79
- package/dist/bundle/chunks/{cli-5ACW3WND.js → cli-SRI4UOSL.js} +6 -6
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-FZ3UQCZ7.js → cloudflare-workers-ai-system-one-JGN7NZCV.js} +1 -1
- package/dist/bundle/chunks/codemode-worker.js +27 -14
- package/dist/bundle/chunks/{compat-KXWWOFHQ.js → compat-PCHMBE76.js} +6 -6
- package/dist/bundle/chunks/dist-MNSGVI4C.js +7 -0
- package/dist/bundle/chunks/{dist-6SWVHFCS.js → dist-UWE5M6HK.js} +211 -8
- package/dist/bundle/chunks/{dist-cjs-RL2OCAP2.js → dist-cjs-4BMVQ74V.js} +1 -1
- package/dist/bundle/chunks/{easter-egg-3d-3L3IKAT6.js → easter-egg-3d-ZJ2JUFOA.js} +1 -1
- package/dist/bundle/chunks/es-YEFEOGR3.js +1905 -0
- package/dist/bundle/chunks/{esm-763X2IA7.js → esm-NCUV2DF7.js} +1 -1
- package/dist/bundle/chunks/{event-streams-R5OECII4.js → event-streams-NXFTZDSF.js} +1 -1
- package/dist/bundle/chunks/execute-LRTXH4YJ.js +553 -0
- package/dist/bundle/chunks/{extract-DLZ425VI.js → extract-OZW5JHG6.js} +140 -120
- package/dist/bundle/chunks/{google-generative-ai-JD2FVOIX.js → google-generative-ai-YXXFSTX7.js} +2 -2
- package/dist/bundle/chunks/{google-vertex-PFBMDCBW.js → google-vertex-3IVWLYJ5.js} +2 -2
- package/dist/bundle/chunks/host-2RMBOGA7.js +2 -0
- package/dist/bundle/chunks/{mistral-conversations-D74NZ65O.js → mistral-conversations-Y7GWO3QB.js} +14 -13
- package/dist/bundle/chunks/{node-W47VUEGE.js → node-ELWNZC34.js} +328 -337
- package/dist/bundle/chunks/{node-4GGYDW5Q.js → node-SPBTZUUS.js} +26 -25
- package/dist/bundle/chunks/{openai-codex-responses-JAAA7MSS.js → openai-codex-responses-NSXWHIDT.js} +3 -4
- package/dist/bundle/chunks/{openai-completions-PGPMGQPU.js → openai-completions-WGBQHTYA.js} +9 -8
- package/dist/bundle/chunks/{openai-decisions-QQ4MEABI.js → openai-decisions-QWEISDVO.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-FG2R2M4L.js → openai-responses-OKGCSIEY.js} +6 -6
- package/dist/bundle/chunks/{openrouter-images-NTBP3UUE.js → openrouter-images-BMVMAROU.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-JD4O7KIP.js → pi-messages-XNEG23NU.js} +1 -1
- package/dist/bundle/chunks/runtime-VGSK3QCM.js +2 -0
- package/dist/bundle/chunks/{typesafe-system-one-TTC7YCO3.js → typesafe-system-one-62YHYXZV.js} +1 -1
- package/dist/bundle/chunks/{undici-EEOUTE5F.js → undici-7EW63V4X.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-JSGQ72M6.js +5 -0
- package/dist/bundle/cli-runtime.js +3 -3
- package/dist/bundle/flow/package.json +5 -6
- package/dist/bundle/index.js +6 -6
- package/dist/bundle/rpc-entry.js +2 -2
- package/dist/coordination/adapter/delivery.d.ts.map +1 -1
- package/dist/coordination/adapter/delivery.js +1 -0
- package/dist/coordination/adapter/delivery.js.map +1 -1
- package/dist/coordination/adapter/index.d.ts.map +1 -1
- package/dist/coordination/adapter/index.js +3 -1
- package/dist/coordination/adapter/index.js.map +1 -1
- package/dist/coordination/adapter/receipts.d.ts +2 -1
- package/dist/coordination/adapter/receipts.d.ts.map +1 -1
- package/dist/coordination/adapter/receipts.js +7 -4
- package/dist/coordination/adapter/receipts.js.map +1 -1
- package/dist/coordination/adapter/supervisor.d.ts.map +1 -1
- package/dist/coordination/adapter/supervisor.js +8 -0
- package/dist/coordination/adapter/supervisor.js.map +1 -1
- package/dist/coordination/broker/broker.d.ts +11 -0
- package/dist/coordination/broker/broker.d.ts.map +1 -1
- package/dist/coordination/broker/broker.js +195 -18
- package/dist/coordination/broker/broker.js.map +1 -1
- package/dist/coordination/client/client.d.ts +5 -0
- package/dist/coordination/client/client.d.ts.map +1 -1
- package/dist/coordination/client/client.js +23 -9
- package/dist/coordination/client/client.js.map +1 -1
- package/dist/coordination/transport/protocol.d.ts.map +1 -1
- package/dist/coordination/transport/protocol.js +8 -1
- package/dist/coordination/transport/protocol.js.map +1 -1
- package/dist/coordination/transport/types.d.ts +6 -0
- package/dist/coordination/transport/types.d.ts.map +1 -1
- package/dist/coordination/transport/types.js +2 -1
- package/dist/coordination/transport/types.js.map +1 -1
- package/dist/core/agent-session.d.ts +44 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +305 -124
- 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 +20 -13
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/auto-effort.d.ts +16 -0
- package/dist/core/auto-effort.d.ts.map +1 -0
- package/dist/core/auto-effort.js +69 -0
- package/dist/core/auto-effort.js.map +1 -0
- package/dist/core/auto-session-namer.d.ts.map +1 -1
- package/dist/core/auto-session-namer.js +2 -12
- package/dist/core/auto-session-namer.js.map +1 -1
- package/dist/core/bug-report.d.ts +11 -1
- package/dist/core/bug-report.d.ts.map +1 -1
- package/dist/core/bug-report.js +2 -2
- package/dist/core/bug-report.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +3 -2
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +13 -4
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +94 -5
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +6 -0
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +7 -8
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +4 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +6 -3
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +33 -7
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/key-id-schema.d.ts +6 -0
- package/dist/core/key-id-schema.d.ts.map +1 -0
- package/dist/core/key-id-schema.js +16 -0
- package/dist/core/key-id-schema.js.map +1 -0
- package/dist/core/keybindings-schema.d.ts +4 -0
- package/dist/core/keybindings-schema.d.ts.map +1 -0
- package/dist/core/keybindings-schema.js +16 -0
- package/dist/core/keybindings-schema.js.map +1 -0
- package/dist/core/keybindings.d.ts +198 -63
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +26 -23
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-config.d.ts +695 -74
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +16 -166
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +39 -4
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +3 -3
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +2 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +13 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +110 -27
- 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 +5 -1
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/session-export.d.ts.map +1 -1
- package/dist/core/session-export.js +2 -2
- package/dist/core/session-export.js.map +1 -1
- package/dist/core/session-manager.d.ts +36 -5
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +164 -40
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +65 -0
- package/dist/core/settings-defaults.d.ts.map +1 -0
- package/dist/core/settings-defaults.js +66 -0
- package/dist/core/settings-defaults.js.map +1 -0
- package/dist/core/settings-manager.d.ts +10 -175
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +64 -44
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +257 -0
- package/dist/core/settings-schema.d.ts.map +1 -0
- package/dist/core/settings-schema.js +311 -0
- package/dist/core/settings-schema.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +4 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +480 -29
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +18 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +46 -0
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +17 -46
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/core/tools/renderers/edit.d.ts +19 -1
- package/dist/core/tools/renderers/edit.d.ts.map +1 -1
- package/dist/core/tools/renderers/edit.js +38 -7
- package/dist/core/tools/renderers/edit.js.map +1 -1
- package/dist/core/tools/renderers/find.d.ts.map +1 -1
- package/dist/core/tools/renderers/find.js +3 -0
- package/dist/core/tools/renderers/find.js.map +1 -1
- package/dist/core/tools/renderers/grep.d.ts.map +1 -1
- package/dist/core/tools/renderers/grep.js +3 -0
- package/dist/core/tools/renderers/grep.js.map +1 -1
- package/dist/core/tools/renderers/highlighting.d.ts +13 -0
- package/dist/core/tools/renderers/highlighting.d.ts.map +1 -0
- package/dist/core/tools/renderers/highlighting.js +42 -0
- package/dist/core/tools/renderers/highlighting.js.map +1 -0
- package/dist/core/tools/renderers/ls.d.ts.map +1 -1
- package/dist/core/tools/renderers/ls.js +3 -0
- package/dist/core/tools/renderers/ls.js.map +1 -1
- package/dist/core/tools/renderers/read.d.ts.map +1 -1
- package/dist/core/tools/renderers/read.js +3 -0
- package/dist/core/tools/renderers/read.js.map +1 -1
- package/dist/core/tools/renderers/write.d.ts.map +1 -1
- package/dist/core/tools/renderers/write.js +3 -1
- package/dist/core/tools/renderers/write.js.map +1 -1
- package/dist/core/tools/subagent.d.ts +4 -0
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +85 -8
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +92 -44
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/usage-totals.d.ts +8 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +106 -10
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +64 -45
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/index.d.ts.map +1 -1
- package/dist/extensions/codemode/index.js +2 -1
- package/dist/extensions/codemode/index.js.map +1 -1
- package/dist/extensions/codemode/renderer.d.ts +2 -2
- package/dist/extensions/codemode/renderer.d.ts.map +1 -1
- package/dist/extensions/codemode/renderer.js +9 -3
- package/dist/extensions/codemode/renderer.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +6 -12
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +44 -32
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/mcp/cli.js +5 -8
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +26 -23
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/resources.d.ts +0 -6
- package/dist/extensions/mcp/resources.d.ts.map +1 -1
- package/dist/extensions/mcp/resources.js +1 -1
- package/dist/extensions/mcp/resources.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts +3 -6
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +4 -39
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/mcp/tools.d.ts +2 -3
- package/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/dist/extensions/mcp/tools.js +62 -6
- package/dist/extensions/mcp/tools.js.map +1 -1
- package/dist/extensions/tool-search/tool.d.ts +0 -2
- package/dist/extensions/tool-search/tool.d.ts.map +1 -1
- package/dist/extensions/tool-search/tool.js +2 -4
- package/dist/extensions/tool-search/tool.js.map +1 -1
- package/dist/humain/adhd/index.d.ts +3 -2
- package/dist/humain/adhd/index.d.ts.map +1 -1
- package/dist/humain/adhd/index.js +22 -10
- package/dist/humain/adhd/index.js.map +1 -1
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +306 -20
- package/dist/humain/caveman/index.d.ts +4 -2
- package/dist/humain/caveman/index.d.ts.map +1 -1
- package/dist/humain/caveman/index.js +51 -16
- package/dist/humain/caveman/index.js.map +1 -1
- package/dist/humain/ponytail/index.d.ts +2 -0
- package/dist/humain/ponytail/index.d.ts.map +1 -1
- package/dist/humain/ponytail/index.js +2 -0
- package/dist/humain/ponytail/index.js.map +1 -1
- package/dist/humain/ponytail/vendor/hooks/ponytail-config.d.ts.map +1 -1
- package/dist/humain/ponytail/vendor/hooks/ponytail-config.js +39 -9
- package/dist/humain/ponytail/vendor/hooks/ponytail-config.js.map +1 -1
- package/dist/humain/ponytail/vendor/hooks/ponytail-instructions.js +1 -1
- package/dist/humain/ponytail/vendor/hooks/ponytail-instructions.js.map +1 -1
- package/dist/humain/ponytail/vendor/pi-extension/index.d.ts +4 -0
- package/dist/humain/ponytail/vendor/pi-extension/index.d.ts.map +1 -1
- package/dist/humain/ponytail/vendor/pi-extension/index.js +8 -0
- package/dist/humain/ponytail/vendor/pi-extension/index.js.map +1 -1
- package/dist/humain/web-access/vendor/baizhi.js.map +1 -1
- package/dist/humain/web-access/vendor/brave.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/brave.js +19 -2
- package/dist/humain/web-access/vendor/brave.js.map +1 -1
- package/dist/humain/web-access/vendor/ceramic.d.ts +4 -0
- package/dist/humain/web-access/vendor/ceramic.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/ceramic.js +212 -0
- package/dist/humain/web-access/vendor/ceramic.js.map +1 -0
- package/dist/humain/web-access/vendor/content-find.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/content-find.js +2 -1
- package/dist/humain/web-access/vendor/content-find.js.map +1 -1
- 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.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.js +2 -0
- package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo.js +5 -1
- package/dist/humain/web-access/vendor/duckduckgo.js.map +1 -1
- package/dist/humain/web-access/vendor/endpoint-pdf-extract.d.ts +23 -0
- package/dist/humain/web-access/vendor/endpoint-pdf-extract.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/endpoint-pdf-extract.js +193 -0
- package/dist/humain/web-access/vendor/endpoint-pdf-extract.js.map +1 -0
- package/dist/humain/web-access/vendor/extract.d.ts +5 -1
- package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/extract.js +49 -12
- 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 +9 -0
- package/dist/humain/web-access/vendor/fetch-params.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-api.d.ts +5 -0
- package/dist/humain/web-access/vendor/gemini-api.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-api.js +16 -0
- package/dist/humain/web-access/vendor/gemini-api.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.d.ts +3 -3
- package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.js +48 -172
- package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
- package/dist/humain/web-access/vendor/github-extract.d.ts +7 -0
- package/dist/humain/web-access/vendor/github-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/github-extract.js +31 -2
- package/dist/humain/web-access/vendor/github-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/github-issue-pr.d.ts +2 -0
- package/dist/humain/web-access/vendor/github-issue-pr.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/github-issue-pr.js +86 -74
- package/dist/humain/web-access/vendor/github-issue-pr.js.map +1 -1
- package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/index.js +68 -27
- package/dist/humain/web-access/vendor/index.js.map +1 -1
- package/dist/humain/web-access/vendor/openai-search.js +3 -3
- 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 +6 -9
- package/dist/humain/web-access/vendor/page-query.js.map +1 -1
- package/dist/humain/web-access/vendor/parallel-mcp.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/parallel-mcp.js +2 -0
- package/dist/humain/web-access/vendor/parallel-mcp.js.map +1 -1
- package/dist/humain/web-access/vendor/pdf-extract.d.ts +1 -1
- package/dist/humain/web-access/vendor/pdf-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/pdf-extract.js +31 -1
- package/dist/humain/web-access/vendor/pdf-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/perplexity.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/perplexity.js +21 -2
- package/dist/humain/web-access/vendor/perplexity.js.map +1 -1
- package/dist/humain/web-access/vendor/query-rewrite.js +1 -1
- package/dist/humain/web-access/vendor/query-rewrite.js.map +1 -1
- package/dist/humain/web-access/vendor/ssrf-protection.d.ts +4 -0
- package/dist/humain/web-access/vendor/ssrf-protection.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/ssrf-protection.js +19 -4
- package/dist/humain/web-access/vendor/ssrf-protection.js.map +1 -1
- package/dist/humain/web-access/vendor/storage.d.ts +14 -0
- package/dist/humain/web-access/vendor/storage.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/storage.js +48 -0
- package/dist/humain/web-access/vendor/storage.js.map +1 -1
- package/dist/humain/web-access/vendor/summary-review.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/summary-review.js +18 -6
- package/dist/humain/web-access/vendor/summary-review.js.map +1 -1
- package/dist/humain/web-access/vendor/tool-arguments.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/tool-arguments.js +5 -2
- package/dist/humain/web-access/vendor/tool-arguments.js.map +1 -1
- package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/utils.js +21 -6
- package/dist/humain/web-access/vendor/utils.js.map +1 -1
- package/dist/humain/web-access/vendor/video-extract.js +6 -2
- package/dist/humain/web-access/vendor/video-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/web-tool-core.d.ts +2 -1
- package/dist/humain/web-access/vendor/web-tool-core.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/web-tool-core.js +56 -13
- package/dist/humain/web-access/vendor/web-tool-core.js.map +1 -1
- package/dist/humain/web-access/vendor/zai.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.js +3 -3
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +21 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +79 -10
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +8 -3
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +156 -133
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +1 -1
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +10 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +83 -7
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +2 -2
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/themed-text.d.ts.map +1 -1
- package/dist/modes/interactive/components/themed-text.js +3 -1
- package/dist/modes/interactive/components/themed-text.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +7 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +36 -19
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/transcript-container.d.ts +12 -0
- package/dist/modes/interactive/components/transcript-container.d.ts.map +1 -0
- package/dist/modes/interactive/components/transcript-container.js +31 -0
- package/dist/modes/interactive/components/transcript-container.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +6 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +20 -5
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +20 -5
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js +42 -3
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +2 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +125 -19
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.js +105 -0
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.js +94 -0
- package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +15 -16
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +26 -29
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +4 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/utils/child-process.d.ts +0 -7
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +12 -3
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +6 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/image-convert.d.ts +7 -0
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js +35 -3
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +2 -2
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +7 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +54 -3
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/windows-path.js +1 -1
- package/dist/utils/windows-path.js.map +1 -1
- package/dist/utils/zip.d.ts.map +1 -1
- package/dist/utils/zip.js +3 -1
- package/dist/utils/zip.js.map +1 -1
- package/docs/auto-session-namer.md +4 -0
- package/docs/cli-integration.md +1 -1
- package/docs/cli.md +1 -1
- package/docs/codemode.md +1 -1
- package/docs/compaction.md +9 -5
- package/docs/coordination.md +7 -0
- package/docs/environment-variables.md +1 -0
- package/docs/extensions.md +7 -4
- package/docs/keybindings.md +1 -0
- package/docs/mcp.md +1 -1
- package/docs/models.md +1 -0
- package/docs/providers.md +20 -0
- package/docs/session-format.md +16 -2
- package/docs/settings.md +16 -1
- package/docs/themes.md +4 -2
- package/docs/tui.md +1 -1
- package/docs/usage.md +6 -2
- package/examples/extensions/custom-provider-anthropic/package-lock.json +6 -6
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +20 -20
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/overlay-test.ts +2 -2
- package/examples/extensions/plan-mode/index.ts +6 -2
- package/examples/extensions/sandbox/package-lock.json +8 -8
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/plugins/pi-example-plugin/package.json +2 -2
- package/examples/plugins/pi-example-plugin/src/contract.ts +1 -1
- package/examples/plugins/pi-example-plugin/src/session.ts +1 -1
- package/examples/plugins/pi-example-plugin/src/tui.ts +1 -1
- package/npm-shrinkwrap.json +174 -190
- package/package.json +24 -23
- package/schemas/keybindings.schema.json +397 -0
- package/schemas/models.schema.json +1157 -0
- package/schemas/settings.schema.json +875 -0
- package/schemas/theme.schema.json +365 -0
- package/src/coordination/UPSTREAM.md +36 -3
- package/src/coordination/upstream.json +3 -2
- package/src/humain/adhd/UPSTREAM.md +21 -3
- package/src/humain/adhd/upstream.json +1 -1
- package/src/humain/caveman/UPSTREAM.md +24 -3
- package/src/humain/ponytail/UPSTREAM.md +51 -4
- package/src/humain/ponytail/upstream.json +12 -12
- package/src/humain/ponytail/vendor/skills/ponytail/SKILL.md +1 -1
- package/src/humain/ponytail/vendor/skills/ponytail-audit/SKILL.md +1 -1
- package/src/humain/ponytail/vendor/skills/ponytail-debt/SKILL.md +13 -10
- package/src/humain/ponytail/vendor/skills/ponytail-help/SKILL.md +1 -1
- package/src/humain/ponytail/vendor/skills/ponytail-review/SKILL.md +1 -1
- package/src/humain/web-access/UPSTREAM.md +55 -1
- package/src/humain/web-access/upstream.json +4 -4
- package/dist/bundle/chunks/anthropic-messages-UNHXXOD4.js +0 -70
- package/dist/bundle/chunks/azure-openai-responses-4QRYJCC2.js +0 -14
- package/dist/bundle/chunks/chunk-GVVRXZHN.js +0 -17
- package/dist/bundle/chunks/chunk-QMUIATLD.js +0 -209
- package/dist/bundle/chunks/chunk-QSPDLT2R.js +0 -160
- package/dist/bundle/chunks/chunk-SZRZXVVZ.js +0 -125
- package/dist/bundle/chunks/chunk-XMHLSV3I.js +0 -48
- package/dist/bundle/chunks/chunk-YKZGL4MB.js +0 -86
- package/dist/bundle/chunks/dist-VNSMKBZ6.js +0 -7
- package/dist/bundle/chunks/es-N6YFJOD7.js +0 -1901
- package/dist/bundle/chunks/execute-4X6G65NZ.js +0 -536
- package/dist/bundle/chunks/host-4J7H7KDS.js +0 -2
- package/dist/bundle/chunks/runtime-SI76JZNE.js +0 -2
- package/dist/bundle/chunks/virtual-modules-GZY3Y4GX.js +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-pdf-extract.js","sourceRoot":"","sources":["../../../../src/humain/web-access/vendor/endpoint-pdf-extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAe,MAAM,sBAAsB,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AI,CAAC,EAAE,CAC5E,CAAC;QACH,CAAC;QACD,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;QAC9D,IAAI,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/C,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,sBAAsB,CAAC;YACvE,MAAM,IAAI,KAAK,CAAC,mCAAmC,KAAK,EAAE,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACvB,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC5B,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAChC,MAAM,GAAG,GAAG,MAAM,CAAC;gBACnB,IAAI,CAAC;oBACJ,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC1B,CAAC;gBAAC,MAAM,CAAC;oBACR,mEAAmE;oBACnE,6CAA6C;oBAC7C,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;gBACjD,CAAC;YACF,CAAC;YACD,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;gBAAE,OAAO,cAAc,CAAC,MAAiC,CAAC,CAAC;YACnG,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { setTimeout as sleep } from \"node:timers/promises\";\nimport { fetchRemoteUrl, loadSsrfConfig, type Lookup } from \"./ssrf-protection.ts\";\nimport { getWebSearchConfigPath, isLoopbackHostname } from \"./utils.ts\";\n\nconst DEFAULT_TIMEOUT_MS = 120_000;\nconst MAX_POLL_INTERVAL_MS = 3_000;\nconst MAX_RESPONSE_BYTES = 4 * 1024 * 1024;\nconst MAX_ERROR_BODY_BYTES = 300;\nconst CONFIG_PATH = getWebSearchConfigPath();\n\nexport interface EndpointPDFExtractOptions {\n\tmaxPages: number;\n\tsignal?: AbortSignal;\n\ttimeoutMs?: number;\n\tlookup?: Lookup;\n}\n\nexport interface EndpointPDFExtractResult {\n\tmarkdown: string;\n\tpages?: number;\n}\n\nfunction pdfSection(): Record<string, unknown> {\n\tif (!existsSync(CONFIG_PATH)) return {};\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(readFileSync(CONFIG_PATH, \"utf-8\"));\n\t} catch (err) {\n\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\tthrow new Error(`Failed to parse ${CONFIG_PATH}: ${message}`);\n\t}\n\tconst pdf = (parsed as { pdf?: unknown } | null)?.pdf;\n\treturn pdf && typeof pdf === \"object\" ? (pdf as Record<string, unknown>) : {};\n}\n\nfunction normalizeString(value: unknown): string | null {\n\tif (typeof value !== \"string\") return null;\n\tconst normalized = value.trim();\n\treturn normalized.length > 0 ? normalized : null;\n}\n\n/**\n * Null means the provider is not configured. Trailing slashes are stripped so the\n * relative `jobs/<id>` poll URL resolves beside the parse path.\n */\nexport function getEndpointUrl(): string | null {\n\tconst configured =\n\t\tnormalizeString(process.env.PDF_ENDPOINT_URL) ??\n\t\tnormalizeString(pdfSection().endpointUrl);\n\tif (!configured) return null;\n\tconst protocol = URL.parse(configured)?.protocol;\n\tif (protocol !== \"http:\" && protocol !== \"https:\") {\n\t\tthrow new Error(\n\t\t\t`Failed to parse pdf.endpointUrl: expected an absolute http(s) URL, got \"${configured}\"`,\n\t\t);\n\t}\n\treturn configured.replace(/\\/+$/, \"\");\n}\n\nfunction getEndpointTimeoutMs(): number {\n\tconst configured = pdfSection().endpointTimeoutMs;\n\tif (typeof configured === \"number\" && Number.isFinite(configured) && configured > 0) {\n\t\treturn Math.min(configured, 300_000);\n\t}\n\treturn DEFAULT_TIMEOUT_MS;\n}\n\nexport function isEndpointApiAvailable(): boolean {\n\ttry {\n\t\treturn getEndpointUrl() !== null;\n\t} catch {\n\t\t// A malformed URL is surfaced as a fatal config error by the extract\n\t\t// call itself; availability only reports whether it is configured.\n\t\treturn true;\n\t}\n}\n\n/**\n * Read at most `maxBytes`, cancelling the stream at the cap. Error previews\n * keep the prefix; JSON bodies past the cap are an error.\n */\nasync function readCapped(response: Response, maxBytes: number, overflowThrows: boolean): Promise<string> {\n\tconst reader = response.body?.getReader();\n\tif (!reader) return \"\";\n\tconst decoder = new TextDecoder();\n\tlet text = \"\";\n\tlet received = 0;\n\tfor (;;) {\n\t\tconst { done, value } = await reader.read();\n\t\tif (done) return text + decoder.decode();\n\t\tconst room = maxBytes - received;\n\t\treceived += value.byteLength;\n\t\t// Stop at exactly the cap too: a full preview must not wait on a parser that stalls after it.\n\t\tif (received >= maxBytes) {\n\t\t\tawait reader.cancel();\n\t\t\tif (overflowThrows && received > maxBytes) {\n\t\t\t\tthrow new Error(\"PDF parser endpoint returned an oversized response\");\n\t\t\t}\n\t\t\treturn text + decoder.decode(value.subarray(0, room));\n\t\t}\n\t\ttext += decoder.decode(value, { stream: true });\n\t}\n}\n\nasync function readJson(response: Response): Promise<Record<string, unknown>> {\n\tconst text = await readCapped(response, MAX_RESPONSE_BYTES, true);\n\ttry {\n\t\tconst parsed = JSON.parse(text) as unknown;\n\t\tif (parsed && typeof parsed === \"object\") return parsed as Record<string, unknown>;\n\t} catch {\n\t\t// fall through to the shared error below\n\t}\n\tthrow new Error(\"PDF parser endpoint returned a non-JSON response\");\n}\n\nasync function errorBody(response: Response): Promise<string> {\n\ttry {\n\t\tconst text = await readCapped(response, MAX_ERROR_BODY_BYTES, false);\n\t\treturn text ? `: ${text}` : \"\";\n\t} catch {\n\t\treturn \"\";\n\t}\n}\n\nfunction markdownResult(payload: Record<string, unknown>): EndpointPDFExtractResult {\n\t// Strip NULs (leaked by PDF text layers with broken encodings) before the emptiness\n\t// check: NUL-only output is an empty conversion and must fail so the chain falls back.\n\tconst markdown = typeof payload.markdown === \"string\" ? payload.markdown.replaceAll(\"\\x00\", \"\") : \"\";\n\tif (markdown.trim().length === 0) {\n\t\tconst error = normalizeString(payload.error);\n\t\tthrow new Error(\n\t\t\terror ? `PDF parser endpoint failed: ${error}` : \"PDF parser endpoint returned no markdown\",\n\t\t);\n\t}\n\treturn { markdown, pages: typeof payload.pages === \"number\" ? payload.pages : undefined };\n}\n\n/**\n * POST the PDF as multipart `file`. A `{ markdown }` answer completes at once; a\n * `{ job_id }` answer is polled at `jobs/{id}` until `done`, `error`, or the deadline.\n */\nexport async function extractPDFViaEndpoint(\n\tbuffer: ArrayBuffer,\n\toptions: EndpointPDFExtractOptions,\n): Promise<EndpointPDFExtractResult> {\n\toptions.signal?.throwIfAborted();\n\tconst endpointUrl = getEndpointUrl();\n\tif (!endpointUrl) {\n\t\tthrow new Error(\"PDF endpoint extraction requires a configured pdf.endpointUrl\");\n\t}\n\n\tconst ssrf = loadSsrfConfig();\n\t// The parser URL is user-configured, like firecrawlBaseUrl, so loopback is allowed;\n\t// LAN ranges still need ssrf.allowRanges, and every redirect hop is re-validated.\n\tconst guard = {\n\t\tallowRanges: ssrf.allowRanges,\n\t\ttrustEnvProxy: ssrf.trustEnvProxy,\n\t\tallowLoopback: isLoopbackHostname(new URL(endpointUrl).hostname),\n\t\t...(options.lookup ? { lookup: options.lookup } : {}),\n\t};\n\n\tconst engine = normalizeString(pdfSection().endpointEngine);\n\tconst form = new FormData();\n\tform.append(\"file\", new Blob([buffer], { type: \"application/pdf\" }), \"document.pdf\");\n\tif (engine) form.append(\"engine\", engine);\n\tform.append(\"max_pages\", String(options.maxPages));\n\n\tconst timeoutMs = options.timeoutMs ?? getEndpointTimeoutMs();\n\tconst deadline = Date.now() + timeoutMs;\n\tconst signal = options.signal;\n\tconst timeout = AbortSignal.timeout(timeoutMs);\n\tconst combined = signal ? AbortSignal.any([signal, timeout]) : timeout;\n\n\tconst response = await fetchRemoteUrl(\n\t\tendpointUrl,\n\t\t{ method: \"POST\", body: form, signal: combined },\n\t\tguard,\n\t);\n\tif (!response.ok) {\n\t\tthrow new Error(\n\t\t\t`PDF parser endpoint returned HTTP ${response.status}${await errorBody(response)}`,\n\t\t);\n\t}\n\n\tlet payload = await readJson(response);\n\tconst jobId = normalizeString(payload.job_id);\n\tif (typeof payload.markdown === \"string\" || !jobId) {\n\t\treturn markdownResult(payload);\n\t}\n\n\tconst jobsUrl = new URL(`jobs/${encodeURIComponent(jobId)}`, endpointUrl).toString();\n\tfor (let interval = 1_000; Date.now() < deadline; interval = Math.min(interval * 2, MAX_POLL_INTERVAL_MS)) {\n\t\tawait sleep(Math.min(interval, deadline - Date.now()), undefined, { signal });\n\n\t\tconst poll = await fetchRemoteUrl(jobsUrl, { signal: combined }, guard);\n\t\tif (!poll.ok) {\n\t\t\tthrow new Error(\n\t\t\t\t`PDF parser job status returned HTTP ${poll.status}${await errorBody(poll)}`,\n\t\t\t);\n\t\t}\n\t\tpayload = await readJson(poll);\n\t\tconst status = normalizeString(payload.status)?.toLowerCase();\n\t\tif (status === \"error\" || status === \"failed\") {\n\t\t\tconst error = normalizeString(payload.error) ?? \"unknown parser error\";\n\t\t\tthrow new Error(`PDF parser endpoint job failed: ${error}`);\n\t\t}\n\t\tif (status === \"done\") {\n\t\t\tlet result = payload.result;\n\t\t\tif (typeof result === \"string\") {\n\t\t\t\tconst raw = result;\n\t\t\t\ttry {\n\t\t\t\t\tresult = JSON.parse(raw);\n\t\t\t\t} catch {\n\t\t\t\t\t// Only a genuinely non-JSON body is raw markdown; a malformed JSON\n\t\t\t\t\t// payload must fail so the chain falls back.\n\t\t\t\t\treturn { markdown: raw.replaceAll(\"\\x00\", \"\") };\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result && typeof result === \"object\") return markdownResult(result as Record<string, unknown>);\n\t\t\tthrow new Error(\"PDF parser endpoint job completed without a result\");\n\t\t}\n\t}\n\tthrow new Error(\"PDF parser endpoint job timed out\");\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Lookup } from "./ssrf-protection.ts";
|
|
1
|
+
import { type Lookup, type RedirectPolicy } from "./ssrf-protection.ts";
|
|
2
2
|
import { type AuthFetchProfile } from "./auth-fetch.ts";
|
|
3
3
|
export { loadSsrfConfig } from "./ssrf-protection.ts";
|
|
4
4
|
export declare function loadSsrfAllowRanges(): string[];
|
|
@@ -7,6 +7,7 @@ export declare function loadSsrfAllowRanges(): string[];
|
|
|
7
7
|
export interface RegisteredToolNames {
|
|
8
8
|
webSearch?: string;
|
|
9
9
|
fetchContent?: string;
|
|
10
|
+
getSearchContent?: string;
|
|
10
11
|
}
|
|
11
12
|
export interface VideoFrame {
|
|
12
13
|
data: string;
|
|
@@ -52,6 +53,9 @@ export interface ExtractOptions {
|
|
|
52
53
|
rejectDirectImages?: string;
|
|
53
54
|
/** Custom DNS resolver used for SSRF validation. Primarily a test seam. */
|
|
54
55
|
lookup?: Lookup;
|
|
56
|
+
/** "same-origin" refuses cross-origin redirects and extraction paths whose redirect
|
|
57
|
+
* chain cannot be observed. fetchContent.redirects in config is a floor. */
|
|
58
|
+
redirects?: RedirectPolicy;
|
|
55
59
|
}
|
|
56
60
|
/** Resolve the direct HTTP/Jina fetch budget, with a per-call override taking precedence. */
|
|
57
61
|
export declare function resolveFetchTimeoutMs(options?: Pick<ExtractOptions, "timeoutMs">): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../src/humain/web-access/vendor/extract.ts"],"names":[],"mappings":"AAuBA,OAAO,
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../src/humain/web-access/vendor/extract.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAsI,KAAK,MAAM,EAAE,KAAK,cAAc,EAAmB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M,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,UAAU,GAAG,KAAK,GAAG,QAAQ,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;+EAC2E;IAC3E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;gFAC4E;IAC5E,SAAS,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,6FAA6F;AAC7F,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,GAAG,MAAM,CAEzF;AA0JD,wBAAsB,cAAc,CACnC,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAojB3B;AAgCD,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAGvG;AAmZD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK/D;AAMD,wBAAsB,eAAe,CACpC,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAW7B"}
|
|
@@ -3,8 +3,8 @@ import pLimit from "p-limit";
|
|
|
3
3
|
import { activityMonitor } from "./activity.js";
|
|
4
4
|
import { extractRSCContent } from "./rsc-extract.js";
|
|
5
5
|
import { extractPDFToMarkdown, isPDF, loadPDFConfig } from "./pdf-extract.js";
|
|
6
|
-
import { extractGitHub } from "./github-extract.js";
|
|
7
|
-
import { extractGitHubIssuePr } from "./github-issue-pr.js";
|
|
6
|
+
import { extractGitHub, parseGitHubUrl } from "./github-extract.js";
|
|
7
|
+
import { extractGitHubIssuePr, parseGitHubIssuePrUrl } from "./github-issue-pr.js";
|
|
8
8
|
import { isYouTubeURL, isYouTubeEnabled, extractYouTube, extractYouTubeFrame, extractYouTubeFrames, getYouTubeStreamInfo } from "./youtube-extract.js";
|
|
9
9
|
import { CredentialResolutionError } from "./credential-source.js";
|
|
10
10
|
import { extractWithUrlContext, extractWithGeminiWeb } from "./gemini-url-context.js";
|
|
@@ -20,7 +20,7 @@ import { extractWithCrawl4ai, isCrawl4aiAvailable } from "./crawl4ai.js";
|
|
|
20
20
|
import { extractWithBrightDataUnlocker, isBrightDataUnlockerAvailable } from "./brightdata-unlocker.js";
|
|
21
21
|
import { isVideoFile, extractVideo, extractVideoFrame, getLocalVideoDuration } from "./video-extract.js";
|
|
22
22
|
import { appendDeclaredWebLinks, discoverDeclaredWebLinks } from "./declared-web-links.js";
|
|
23
|
-
import { fetchRemoteUrl, loadFetchContentDomainPolicy, loadSsrfConfig, validateRemoteUrl } from "./ssrf-protection.js";
|
|
23
|
+
import { fetchRemoteUrl, loadFetchContentDomainPolicy, loadFetchContentRedirectPolicy, loadSsrfConfig, validateRemoteUrl } from "./ssrf-protection.js";
|
|
24
24
|
import { formatSeconds, getWebSearchConfigPath } from "./utils.js";
|
|
25
25
|
import { isImageEnabled } from "./feature-config.js";
|
|
26
26
|
import { assertAuthFetchUrl, authFetchRedirectGuard } from "./auth-fetch.js";
|
|
@@ -125,6 +125,7 @@ function isAbortException(err) {
|
|
|
125
125
|
}
|
|
126
126
|
function isRedirectPolicyError(message) {
|
|
127
127
|
return message.startsWith("Authenticated fetch refused cross-origin redirect") ||
|
|
128
|
+
message.startsWith("Refused cross-origin redirect by fetch_content redirect policy") ||
|
|
128
129
|
message.startsWith("Blocked internal ") ||
|
|
129
130
|
message.startsWith("Blocked hostname by fetch_content domain policy") ||
|
|
130
131
|
message.startsWith("Hostname not allowed by fetch_content domain policy") ||
|
|
@@ -146,6 +147,9 @@ function imageGateError() {
|
|
|
146
147
|
return errorMessage(err);
|
|
147
148
|
}
|
|
148
149
|
}
|
|
150
|
+
function redirectPolicyRouteRefusal(url, path) {
|
|
151
|
+
return { url, title: "", content: "", error: `Extraction path ${path} is disabled by the fetch_content same-origin redirect policy because its redirect chain cannot be observed` };
|
|
152
|
+
}
|
|
149
153
|
async function resolveAuthCookieHeader(url, profile) {
|
|
150
154
|
const parsed = assertAuthFetchUrl(profile, url.toString());
|
|
151
155
|
const result = await getBrowserCookiesForHosts({ hosts: [parsed.hostname], profile: profile.chromeProfile, requestUrl: parsed });
|
|
@@ -166,6 +170,7 @@ async function fetchAuthenticatedRemoteUrl(url, init, validationOptions, profile
|
|
|
166
170
|
proxy: validationOptions.proxy,
|
|
167
171
|
...(validationOptions.lookup ? { lookup: validationOptions.lookup } : {}),
|
|
168
172
|
});
|
|
173
|
+
const originalOrigin = current.origin;
|
|
169
174
|
let requestInit = init;
|
|
170
175
|
for (let redirects = 0; redirects <= 5; redirects++) {
|
|
171
176
|
const cookieHeader = await resolveAuthCookieHeader(current, profile);
|
|
@@ -179,7 +184,11 @@ async function fetchAuthenticatedRemoteUrl(url, init, validationOptions, profile
|
|
|
179
184
|
if (redirects === 5)
|
|
180
185
|
throw new Error(`Too many redirects fetching ${current.toString()}`);
|
|
181
186
|
const from = current;
|
|
182
|
-
|
|
187
|
+
const next = new URL(location, current);
|
|
188
|
+
if (validationOptions.redirects === "same-origin" && next.origin !== originalOrigin) {
|
|
189
|
+
throw new Error(`Refused cross-origin redirect by fetch_content redirect policy: ${originalOrigin} -> ${next.origin}`);
|
|
190
|
+
}
|
|
191
|
+
current = await validateRemoteUrl(next, {
|
|
183
192
|
allowRanges: validationOptions.ssrf.allowRanges,
|
|
184
193
|
trustEnvProxy: validationOptions.ssrf.trustEnvProxy,
|
|
185
194
|
domainPolicy: validationOptions.domainPolicy,
|
|
@@ -430,6 +439,13 @@ export async function extractContent(url, signal, options) {
|
|
|
430
439
|
if (signal?.aborted) {
|
|
431
440
|
return { url, title: "", content: "", error: "Aborted" };
|
|
432
441
|
}
|
|
442
|
+
let redirectPolicy;
|
|
443
|
+
try {
|
|
444
|
+
redirectPolicy = options?.redirects ?? loadFetchContentRedirectPolicy();
|
|
445
|
+
}
|
|
446
|
+
catch (err) {
|
|
447
|
+
return { url, title: "", content: "", error: errorMessage(err) };
|
|
448
|
+
}
|
|
433
449
|
let remoteUrl = null;
|
|
434
450
|
try {
|
|
435
451
|
const parsed = new URL(url);
|
|
@@ -462,6 +478,14 @@ export async function extractContent(url, signal, options) {
|
|
|
462
478
|
return { url, title: "", content: "", error: errorMessage(err) };
|
|
463
479
|
}
|
|
464
480
|
}
|
|
481
|
+
if (redirectPolicy) {
|
|
482
|
+
if (parseGitHubIssuePrUrl(url))
|
|
483
|
+
return redirectPolicyRouteRefusal(url, "GitHub issue/PR");
|
|
484
|
+
if (parseGitHubUrl(url))
|
|
485
|
+
return redirectPolicyRouteRefusal(url, "GitHub repository");
|
|
486
|
+
if (isYouTubeURL(url).isYouTube)
|
|
487
|
+
return redirectPolicyRouteRefusal(url, "YouTube");
|
|
488
|
+
}
|
|
465
489
|
if (options?.frames || options?.timestamp) {
|
|
466
490
|
const disabled = imageGateError();
|
|
467
491
|
if (disabled)
|
|
@@ -559,7 +583,9 @@ export async function extractContent(url, signal, options) {
|
|
|
559
583
|
if ("error" in frame) {
|
|
560
584
|
return { url, title: `Frame at ${options.timestamp}`, content: frame.error, error: frame.error };
|
|
561
585
|
}
|
|
562
|
-
|
|
586
|
+
// mimeType marks the image as the payload (like direct-image fetches); a
|
|
587
|
+
// text result with a bonus thumbnail stays without one.
|
|
588
|
+
return { url, title: `Frame at ${options.timestamp}`, content: `Video frame at ${options.timestamp}`, error: null, thumbnail: frame, mimeType: frame.mimeType };
|
|
563
589
|
}
|
|
564
590
|
const localVideo = safeVideoInfo(url);
|
|
565
591
|
if (localVideo.status === "invalid") {
|
|
@@ -585,7 +611,7 @@ export async function extractContent(url, signal, options) {
|
|
|
585
611
|
if ("error" in frame) {
|
|
586
612
|
return { url, title: `Frame at ${options.timestamp}`, content: frame.error, error: frame.error };
|
|
587
613
|
}
|
|
588
|
-
return { url, title: `Frame at ${options.timestamp}`, content: `Video frame at ${options.timestamp}`, error: null, thumbnail: frame };
|
|
614
|
+
return { url, title: `Frame at ${options.timestamp}`, content: `Video frame at ${options.timestamp}`, error: null, thumbnail: frame, mimeType: frame.mimeType };
|
|
589
615
|
}
|
|
590
616
|
return { url, title: "", content: "", error: "Timestamp extraction only works with YouTube and local video files" };
|
|
591
617
|
}
|
|
@@ -688,9 +714,14 @@ export async function extractContent(url, signal, options) {
|
|
|
688
714
|
catch (err) {
|
|
689
715
|
return { url, title: "", content: "", error: errorMessage(err) };
|
|
690
716
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
717
|
+
if (redirectPolicy && !fetchRouting.providers.includes("http")) {
|
|
718
|
+
return redirectPolicyRouteRefusal(url, fetchRouting.providers[0]);
|
|
719
|
+
}
|
|
720
|
+
const providerOrder = redirectPolicy
|
|
721
|
+
? ["http"]
|
|
722
|
+
: remoteUrl && !fetchRouting.allowRemoteHostedProviders
|
|
723
|
+
? fetchRouting.providers.filter(provider => !REMOTE_HOSTED_FETCH_PROVIDERS.has(provider))
|
|
724
|
+
: fetchRouting.providers;
|
|
694
725
|
if (providerOrder.length === 0) {
|
|
695
726
|
return {
|
|
696
727
|
url,
|
|
@@ -972,6 +1003,9 @@ export async function extractContent(url, signal, options) {
|
|
|
972
1003
|
if (finalHttpResult?.status === 404 || finalHttpResult?.status === 410) {
|
|
973
1004
|
return { ...finalHttpResult, error: notFoundGuidance(finalHttpResult, options?.toolNames) };
|
|
974
1005
|
}
|
|
1006
|
+
// Under the redirect policy no other provider may run, so provider setup hints do not apply.
|
|
1007
|
+
if (redirectPolicy && finalHttpResult)
|
|
1008
|
+
return finalHttpResult;
|
|
975
1009
|
const searchToolName = options?.toolNames?.webSearch;
|
|
976
1010
|
const jinaHint = jinaReaderGuidance(fetchRouting, providerOrder, Boolean(remoteUrl) && !fetchRouting.allowRemoteHostedProviders);
|
|
977
1011
|
const guidance = [
|
|
@@ -1115,6 +1149,7 @@ async function extractViaHttp(url, timeoutMs, signal, options, preferMarkdown =
|
|
|
1115
1149
|
try {
|
|
1116
1150
|
const ssrf = loadSsrfConfig();
|
|
1117
1151
|
const domainPolicy = loadFetchContentDomainPolicy();
|
|
1152
|
+
const redirects = options?.redirects ?? loadFetchContentRedirectPolicy();
|
|
1118
1153
|
const authProfile = options?.authFetchProfile;
|
|
1119
1154
|
const requestInit = {
|
|
1120
1155
|
signal: controller.signal,
|
|
@@ -1132,11 +1167,12 @@ async function extractViaHttp(url, timeoutMs, signal, options, preferMarkdown =
|
|
|
1132
1167
|
},
|
|
1133
1168
|
};
|
|
1134
1169
|
const response = authProfile
|
|
1135
|
-
? await fetchAuthenticatedRemoteUrl(url, requestInit, { ssrf, domainPolicy, proxy: options?.proxy, ...(options?.lookup ? { lookup: options.lookup } : {}) }, authProfile)
|
|
1170
|
+
? await fetchAuthenticatedRemoteUrl(url, requestInit, { ssrf, domainPolicy, redirects, proxy: options?.proxy, ...(options?.lookup ? { lookup: options.lookup } : {}) }, authProfile)
|
|
1136
1171
|
: await fetchRemoteUrl(url, requestInit, {
|
|
1137
1172
|
allowRanges: ssrf.allowRanges,
|
|
1138
1173
|
trustEnvProxy: ssrf.trustEnvProxy,
|
|
1139
1174
|
domainPolicy,
|
|
1175
|
+
redirects,
|
|
1140
1176
|
proxy: options?.proxy,
|
|
1141
1177
|
...(options?.lookup ? { lookup: options.lookup } : {}),
|
|
1142
1178
|
});
|
|
@@ -1177,7 +1213,8 @@ async function extractViaHttp(url, timeoutMs, signal, options, preferMarkdown =
|
|
|
1177
1213
|
if (options?.mode === "raw") {
|
|
1178
1214
|
if (!isTextContentType(contentType)) {
|
|
1179
1215
|
activityMonitor.logComplete(activityId, response.status);
|
|
1180
|
-
|
|
1216
|
+
const hint = isPDFContent ? "; retry without mode for Markdown, or with mode \"answer\" and a prompt" : "";
|
|
1217
|
+
return { url, title: "", content: "", error: `Unsupported content type in raw mode: ${mimeType || "missing"}${hint}`, mimeType, status: response.status };
|
|
1181
1218
|
}
|
|
1182
1219
|
const text = await readTextResponseWithLimit(response, maxResponseSize);
|
|
1183
1220
|
activityMonitor.logComplete(activityId, response.status);
|
|
@@ -1229,7 +1266,7 @@ async function extractViaHttp(url, timeoutMs, signal, options, preferMarkdown =
|
|
|
1229
1266
|
title: result.title,
|
|
1230
1267
|
content: options?.mode === "answer"
|
|
1231
1268
|
? result.content
|
|
1232
|
-
: `PDF extracted and saved to: ${result.outputPath}\n\
|
|
1269
|
+
: `PDF extracted and saved to: ${result.outputPath}\n\n${result.pages > 0 ? `Pages: ${result.pages}\n` : ""}Characters: ${result.chars}`,
|
|
1233
1270
|
error: null,
|
|
1234
1271
|
};
|
|
1235
1272
|
}
|