@xiaoso/dsh-tool-plus 0.1.6 → 0.1.7-beta.1
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/THIRD_PARTY_NOTICES.md +9 -3
- package/lib/{abort-Cwwm4Err.mjs → abort-Caqff3M6.mjs} +2 -2
- package/lib/alibaba-coding-plan-DTupMiAi.mjs +73 -0
- package/lib/alibaba-token-plan-CHGyWOfX.mjs +46 -0
- package/lib/alibaba-token-plan-Dj3OZhEE.mjs +82 -0
- package/lib/{amazon-bedrock-TVMpUTRG.mjs → amazon-bedrock-DbFSYXfJ.mjs} +117 -38
- package/lib/{anthropic-BL6LFDQS.mjs → anthropic-CTJ3IQVa.mjs} +675 -166
- package/lib/anthropic-CXfWlp-x.mjs +105 -0
- package/lib/{aws-credentials-B20dliS7.mjs → anthropic-wire-CKuhDwZ1.mjs} +74 -14
- package/lib/{api-key-login-CIDnXeYd.mjs → api-key-validation-CGCJFbFr.mjs} +27 -68
- package/lib/{azure-openai-responses-BkhsLmN3.mjs → azure-openai-responses-ChFbWaGj.mjs} +27 -16
- package/lib/{browser-render-CmgvSNte.mjs → browser-render-9o0Rknop.mjs} +4 -4
- package/lib/bun-shim.mjs +71 -2
- package/lib/{bundled-references-ChZSPDFw.mjs → bundled-references-DY3EJxZV.mjs} +6 -5
- package/lib/cline-pass-Bwg3esu9.mjs +44 -0
- package/lib/cloudflare-ai-gateway-BupNXyKK.mjs +35 -0
- package/lib/cloudflare-ai-gateway-EWo0VkP5.mjs +44 -0
- package/lib/collapse-DOR8sOGf.mjs +2304 -0
- package/lib/coreweave-C82HrLpb.mjs +31 -0
- package/lib/coreweave-Ct8cF-da.mjs +14 -0
- package/lib/{cursor-B6HcmplF.mjs → cursor-B95LzVWV.mjs} +11 -3
- package/lib/{cursor-CRpLpaZ3.mjs → cursor-DJV_dcgB.mjs} +887 -1784
- package/lib/{cursor-B8m6SqAH.mjs → cursor-LKGjucn2.mjs} +48 -38
- package/lib/cursor-proto-B8Wj8bv9.mjs +10513 -0
- package/lib/{deterministic-id-D-yIV_eI.mjs → deterministic-id-CUEIMSqR.mjs} +1 -1
- package/lib/devin-BMTdx_hx.mjs +316 -0
- package/lib/{devin-DUAfvBsW.mjs → devin-DSp0Rw_E.mjs} +172 -86
- package/lib/devin-ExGIghmx.mjs +69 -0
- package/lib/devin-proto-Br8fdyNl.mjs +2888 -0
- package/lib/{dom-CawWi8fa.mjs → dom-DG3sPESc.mjs} +8 -8
- package/lib/effort-BdtQMN-_.mjs +23 -0
- package/lib/{error-C-f_Wnw4.mjs → error-CORgGg5a.mjs} +275 -154
- package/lib/{event-stream-Dh2guZxS.mjs → event-stream-ulcDenZD.mjs} +20 -4
- package/lib/{gemini-headers-DKUShltF.mjs → gemini-headers-Co9cVvex.mjs} +2 -2
- package/lib/{github-copilot-suDymKrx.mjs → github-copilot-Dstq1D3s.mjs} +69 -29
- package/lib/github-copilot-headers-DOh1gt_w.mjs +312 -0
- package/lib/gitlab-duo-DSCMrU0m.mjs +11 -0
- package/lib/google-CtsKkOQK.mjs +38 -0
- package/lib/google-antigravity-z-5KsEci.mjs +252 -0
- package/lib/{google-auth-DYJLM792.mjs → google-auth-ieLBaneO.mjs} +4 -4
- package/lib/{google-gemini-cli-8BT513Ul.mjs → google-gemini-cli-C6NE5mWz.mjs} +28 -54
- package/lib/{google-gemini-cli-D6cSmfvB.mjs → google-gemini-cli-CAIPSl7e.mjs} +23 -29
- package/lib/google-oauth-shared-DhMllAkt.mjs +53 -0
- package/lib/{google-shared-CVbHK5vZ.mjs → google-shared-B0aNCYEH.mjs} +140 -44
- package/lib/{google-validation-Cgbn3tWJ.mjs → google-validation-BEkNs-Bx.mjs} +1 -1
- package/lib/{google-vertex-Bui-ypAe.mjs → google-vertex-Bbd1tYNc.mjs} +8 -8
- package/lib/hosts-00rjRzUD.mjs +203 -0
- package/lib/id-AL5obQzR.mjs +71 -0
- package/lib/{idle-iterator-CYAxUkSD.mjs → idle-iterator-DlUkEfzW.mjs} +3 -3
- package/lib/index.mjs +598 -5275
- package/lib/kilo-ChJL54wq.mjs +81 -0
- package/lib/kimi-C2c_Zq8A.mjs +67 -0
- package/lib/{launch-BmgEUycu.mjs → launch-DKDH71En.mjs} +1 -1
- package/lib/markit-CmRfm4E2.mjs +9885 -0
- package/lib/models-DnXMYGcJ.mjs +381604 -0
- package/lib/muse-code-Di1VZmB1.mjs +143 -0
- package/lib/{ollama-Df9ce-Cp.mjs → ollama-B8ic3sEp.mjs} +15 -30
- package/lib/{openai-codex-CAVI3Me-.mjs → openai-codex-DuJNC99x.mjs} +29 -99
- package/lib/{openai-codex-responses-BcnOotRB.mjs → openai-codex-responses-BL29nh9K.mjs} +204 -116
- package/lib/{openai-completions-Bq4WT47M.mjs → openai-completions-BK2f2dBv.mjs} +152 -82
- package/lib/openai-configuration-update-xMYUjaK_.mjs +150 -0
- package/lib/{openai-reasoning-fallback-DXsfiSXO.mjs → openai-reasoning-fallback-BdB3RCbj.mjs} +106 -12
- package/lib/{openai-responses-Mq_-PjvE.mjs → openai-responses-CGQPlIIy.mjs} +76 -82
- package/lib/{perplexity-XgLF73E7.mjs → perplexity-TBjz3VMB.mjs} +52 -9
- package/lib/{pkce-BlQikGPu.mjs → pkce-BYjmugmw.mjs} +1 -1
- package/lib/protobuf-aab1UGVn.mjs +717 -0
- package/lib/{provider-response-C6vcbQyO.mjs → provider-response-SqKSkkUc.mjs} +1 -1
- package/lib/{proxy-D9lm7ONA.mjs → proxy-5nWqRL1f.mjs} +45 -5
- package/lib/{readability-Cpm-ocau.mjs → readability-uGhqb4GC.mjs} +2 -2
- package/lib/reference-CtvM4zLU.mjs +114 -0
- package/lib/{request-debug-HJMoJncL.mjs → request-debug-NQN0BjHH.mjs} +1 -1
- package/lib/{sanitize-text-CfcXzw5X.mjs → sanitize-text-BCf5KmCf.mjs} +1 -1
- package/lib/{scrapers-Cg5w77td.mjs → scrapers-BpqEnqNM.mjs} +12 -12
- package/lib/{src-BcD0_rQR.mjs → src-BwW51vA5.mjs} +979 -388
- package/lib/{sse-debug-CYdjOC96.mjs → sse-debug-B-tkLCPW.mjs} +1 -1
- package/lib/{stream-Bjq8wjfr.mjs → stream-B_7qN-bA.mjs} +3802 -2623
- package/lib/stream-markup-healing-DKT1lnkW.mjs +267 -0
- package/lib/{strict-tool-validation-imVLUcbI.mjs → strict-tool-validation-CBTz1dAA.mjs} +2 -2
- package/lib/taxonomy-DSIM99rS.mjs +15392 -0
- package/lib/{stream-markup-healing-DZ6bVDxH.mjs → thinking-CiLa2LFB.mjs} +31 -186
- package/lib/{turndown-DN7ByzEI.mjs → turndown-DrX1M4WG.mjs} +4 -4
- package/lib/{type-guards-B9VVjRDK.mjs → type-guards-CttAANEx.mjs} +1 -1
- package/lib/types/client/BashPlusCard.d.ts +53 -0
- package/lib/types/client/ToolPlusSection.d.ts +36 -0
- package/lib/types/client/forms.d.ts +42 -0
- package/lib/types/client/index.d.ts +29 -0
- package/lib/types/client/locales.d.ts +19 -0
- package/lib/types/client/rm-safe-status-text.d.ts +15 -0
- package/lib/types/client/rows.d.ts +107 -0
- package/lib/types/client/web-connection-rpc.d.ts +22 -0
- package/lib/types/config/fields.d.ts +85 -0
- package/lib/types/config/omp-settings.d.ts +21 -0
- package/lib/types/config/settings.d.ts +212 -0
- package/lib/types/config/truncate.d.ts +27 -0
- package/lib/types/host/browser-probe-rpc.d.ts +29 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/tools/ast-edit/adapter/index.d.ts +26 -0
- package/lib/types/tools/ast-edit/adapter/sdk.d.ts +49 -0
- package/lib/types/tools/ast-grep/adapter/index.d.ts +31 -0
- package/lib/types/tools/ast-grep/adapter/sdk.d.ts +44 -0
- package/lib/types/tools/bash/adapter/spill.d.ts +34 -0
- package/lib/types/tools/bash/background.d.ts +40 -0
- package/lib/types/tools/bash/bash-executor.d.ts +102 -0
- package/lib/types/tools/bash/bash-interceptor.d.ts +33 -0
- package/lib/types/tools/bash/cd-workdir.d.ts +35 -0
- package/lib/types/tools/bash/logger.d.ts +18 -0
- package/lib/types/tools/bash/non-interactive-env.d.ts +5 -0
- package/lib/types/tools/bash/render.d.ts +46 -0
- package/lib/types/tools/bash/rm-safe-status.d.ts +62 -0
- package/lib/types/tools/bash/rm-safe.d.ts +18 -0
- package/lib/types/tools/bash/sanitize-text.d.ts +34 -0
- package/lib/types/tools/bash/shell-snapshot.d.ts +31 -0
- package/lib/types/tools/bash/shell-tokenize.d.ts +60 -0
- package/lib/types/tools/bash/streaming-output.d.ts +32 -0
- package/lib/types/tools/bash/trash-cli-main.d.ts +1 -0
- package/lib/types/tools/bash/trash-cli.d.ts +77 -0
- package/lib/types/tools/bash/types.d.ts +107 -0
- package/lib/types/tools/bash/which.d.ts +20 -0
- package/lib/types/tools/bash/windows-shell.d.ts +31 -0
- package/lib/types/tools/bash/yield.d.ts +71 -0
- package/lib/types/tools/edit/adapter/index.d.ts +57 -0
- package/lib/types/tools/edit/adapter/tools/auto-generated-guard.d.ts +10 -0
- package/lib/types/tools/edit/adapter/tools/output-meta.d.ts +34 -0
- package/lib/types/tools/edit/adapter/tools/plan-mode-guard.d.ts +21 -0
- package/lib/types/tools/glob/adapter/index.d.ts +52 -0
- package/lib/types/tools/grep/adapter/index.d.ts +53 -0
- package/lib/types/tools/grep/adapter/match-path.d.ts +1 -0
- package/lib/types/tools/hashline/native/diff-preview.d.ts +37 -0
- package/lib/types/tools/hashline/native/index.d.ts +109 -0
- package/lib/types/tools/hashline/native/normalize.d.ts +29 -0
- package/lib/types/tools/hashline/native/policy.d.ts +98 -0
- package/lib/types/tools/hashline/native/writer.d.ts +42 -0
- package/lib/types/tools/omp/browser/launch.d.ts +28 -0
- package/lib/types/tools/omp/browser/readable.d.ts +17 -0
- package/lib/types/tools/omp/config/settings-schema.d.ts +12 -0
- package/lib/types/tools/omp/config/settings.d.ts +59 -0
- package/lib/types/tools/omp/edit/apply-patch/parser.d.ts +34 -0
- package/lib/types/tools/omp/edit/details.d.ts +54 -0
- package/lib/types/tools/omp/edit/diff.d.ts +60 -0
- package/lib/types/tools/omp/edit/dispatch.d.ts +43 -0
- package/lib/types/tools/omp/edit/file-snapshot-store.d.ts +81 -0
- package/lib/types/tools/omp/edit/hashline/execute.d.ts +40 -0
- package/lib/types/tools/omp/edit/hashline/params.d.ts +6 -0
- package/lib/types/tools/omp/edit/modes/apply-patch.d.ts +25 -0
- package/lib/types/tools/omp/edit/modes/patch.d.ts +109 -0
- package/lib/types/tools/omp/edit/modes/replace.d.ts +151 -0
- package/lib/types/tools/omp/edit/normalize.d.ts +31 -0
- package/lib/types/tools/omp/edit/notebook.d.ts +50 -0
- package/lib/types/tools/omp/edit/read-file.d.ts +2 -0
- package/lib/types/tools/omp/edit/snapshot-details.d.ts +33 -0
- package/lib/types/tools/omp/extensibility/skills.d.ts +22 -0
- package/lib/types/tools/omp/internal-urls/index.d.ts +100 -0
- package/lib/types/tools/omp/internal-urls/local-protocol.d.ts +12 -0
- package/lib/types/tools/omp/internal-urls/parse.d.ts +31 -0
- package/lib/types/tools/omp/internal-urls/types.d.ts +189 -0
- package/lib/types/tools/omp/internal-urls/xd-protocol.d.ts +19 -0
- package/lib/types/tools/omp/markit/converters/docx.d.ts +6 -0
- package/lib/types/tools/omp/markit/converters/epub.d.ts +15 -0
- package/lib/types/tools/omp/markit/converters/pdf/index.d.ts +7 -0
- package/lib/types/tools/omp/markit/converters/pptx.d.ts +57 -0
- package/lib/types/tools/omp/markit/converters/xlsx.d.ts +25 -0
- package/lib/types/tools/omp/markit/index.d.ts +2 -0
- package/lib/types/tools/omp/markit/registry.d.ts +16 -0
- package/lib/types/tools/omp/markit/types.d.ts +30 -0
- package/lib/types/tools/omp/sdk.d.ts +103 -0
- package/lib/types/tools/omp/session/agent-storage.d.ts +154 -0
- package/lib/types/tools/omp/session/streaming-output.d.ts +244 -0
- package/lib/types/tools/omp/task/spawn-policy.d.ts +22 -0
- package/lib/types/tools/omp/tools/approval.d.ts +62 -0
- package/lib/types/tools/omp/tools/ast-edit.d.ts +73 -0
- package/lib/types/tools/omp/tools/ast-grep.d.ts +61 -0
- package/lib/types/tools/omp/tools/auto-generated-guard.d.ts +20 -0
- package/lib/types/tools/omp/tools/conflict-detect.d.ts +237 -0
- package/lib/types/tools/omp/tools/fetch.d.ts +103 -0
- package/lib/types/tools/omp/tools/file-recorder.d.ts +13 -0
- package/lib/types/tools/omp/tools/fs-cache-invalidation.d.ts +15 -0
- package/lib/types/tools/omp/tools/glob.d.ts +86 -0
- package/lib/types/tools/omp/tools/grep.d.ts +102 -0
- package/lib/types/tools/omp/tools/grouped-file-output.d.ts +70 -0
- package/lib/types/tools/omp/tools/index.d.ts +23 -0
- package/lib/types/tools/omp/tools/list-limit.d.ts +12 -0
- package/lib/types/tools/omp/tools/match-line-format.d.ts +11 -0
- package/lib/types/tools/omp/tools/output-meta.d.ts +160 -0
- package/lib/types/tools/omp/tools/path-utils.d.ts +326 -0
- package/lib/types/tools/omp/tools/plan-mode-guard.d.ts +33 -0
- package/lib/types/tools/omp/tools/read-archive.d.ts +16 -0
- package/lib/types/tools/omp/tools/read-format.d.ts +104 -0
- package/lib/types/tools/omp/tools/read-path-resolution.d.ts +19 -0
- package/lib/types/tools/omp/tools/read-selector.d.ts +27 -0
- package/lib/types/tools/omp/tools/read-sqlite.d.ts +16 -0
- package/lib/types/tools/omp/tools/read-summary.d.ts +15 -0
- package/lib/types/tools/omp/tools/read.d.ts +70 -0
- package/lib/types/tools/omp/tools/render-utils.d.ts +28 -0
- package/lib/types/tools/omp/tools/report-tool-issue.d.ts +149 -0
- package/lib/types/tools/omp/tools/resolve.d.ts +127 -0
- package/lib/types/tools/omp/tools/sqlite-reader.d.ts +114 -0
- package/lib/types/tools/omp/tools/tool-errors.d.ts +33 -0
- package/lib/types/tools/omp/tools/tool-result.d.ts +33 -0
- package/lib/types/tools/omp/tools/tool-timeouts.d.ts +57 -0
- package/lib/types/tools/omp/tools/write.d.ts +53 -0
- package/lib/types/tools/omp/tools/writethrough.d.ts +24 -0
- package/lib/types/tools/omp/utils/block-context.d.ts +35 -0
- package/lib/types/tools/omp/utils/cpuprofile.d.ts +51 -0
- package/lib/types/tools/omp/utils/edit-mode.d.ts +13 -0
- package/lib/types/tools/omp/utils/file-display-mode.d.ts +27 -0
- package/lib/types/tools/omp/utils/image-loading.d.ts +51 -0
- package/lib/types/tools/omp/utils/image-resize.d.ts +42 -0
- package/lib/types/tools/omp/utils/lang-from-path.d.ts +9 -0
- package/lib/types/tools/omp/utils/markit-cache.d.ts +23 -0
- package/lib/types/tools/omp/utils/markit.d.ts +30 -0
- package/lib/types/tools/omp/utils/profile-tree.d.ts +47 -0
- package/lib/types/tools/omp/utils/sample-profile.d.ts +67 -0
- package/lib/types/tools/omp/utils/sixel.d.ts +21 -0
- package/lib/types/tools/omp/utils/tools-manager.d.ts +11 -0
- package/lib/types/tools/omp/utils/turndown.d.ts +15 -0
- package/lib/types/tools/omp/utils/zip.d.ts +129 -0
- package/lib/types/tools/omp/web/browser-render.d.ts +50 -0
- package/lib/types/tools/omp/web/parallel.d.ts +68 -0
- package/lib/types/tools/omp/web/scrapers/artifacthub.d.ts +6 -0
- package/lib/types/tools/omp/web/scrapers/arxiv.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/aur.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/biorxiv.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/bluesky.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/brew.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/cheatsh.d.ts +8 -0
- package/lib/types/tools/omp/web/scrapers/chocolatey.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/choosealicense.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/cisa-kev.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/clojars.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/coingecko.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/crates-io.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/crossref.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/devto.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/discogs.d.ts +8 -0
- package/lib/types/tools/omp/web/scrapers/discourse.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/dockerhub.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/docs-rs.d.ts +9 -0
- package/lib/types/tools/omp/web/scrapers/fdroid.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/firefox-addons.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/flathub.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/github-gist.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/github.d.ts +34 -0
- package/lib/types/tools/omp/web/scrapers/gitlab.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/go-pkg.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/hackage.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/hackernews.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/hex.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/huggingface.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/iacr.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/index.d.ts +84 -0
- package/lib/types/tools/omp/web/scrapers/jetbrains-marketplace.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/lemmy.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/lobsters.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/mastodon.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/maven.d.ts +6 -0
- package/lib/types/tools/omp/web/scrapers/mdn.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/metacpan.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/musicbrainz.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/npm.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/nuget.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/nvd.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/ollama.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/open-vsx.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/opencorporates.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/openlibrary.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/orcid.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/osv.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/packagist.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/pub-dev.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/pubmed.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/pypi.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/rawg.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/readthedocs.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/reddit.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/repology.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/rfc.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/rubygems.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/searchcode.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/sec-edgar.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/semantic-scholar.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/snapcraft.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/sourcegraph.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/spdx.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/spotify.d.ts +8 -0
- package/lib/types/tools/omp/web/scrapers/stackoverflow.d.ts +6 -0
- package/lib/types/tools/omp/web/scrapers/terraform.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/tldr.d.ts +7 -0
- package/lib/types/tools/omp/web/scrapers/twitter.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/types.d.ts +90 -0
- package/lib/types/tools/omp/web/scrapers/utils.d.ts +26 -0
- package/lib/types/tools/omp/web/scrapers/vimeo.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/vscode-marketplace.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/w3c.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/wikidata.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/wikipedia.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/youtube.d.ts +5 -0
- package/lib/types/tools/omp/web/search/providers/utils.d.ts +49 -0
- package/lib/types/tools/omp/web/search/types.d.ts +501 -0
- package/lib/types/tools/omp/web/search/utils.d.ts +4 -0
- package/lib/types/tools/omp/workspace-tree.d.ts +42 -0
- package/lib/types/tools/read/adapter/index.d.ts +49 -0
- package/lib/types/tools/read/adapter/internal-urls/artifact-protocol.d.ts +15 -0
- package/lib/types/tools/read/adapter/internal-urls/registry-helpers.d.ts +44 -0
- package/lib/types/tools/read/adapter/registry/agent-registry.d.ts +29 -0
- package/lib/types/tools/shared/auto-generated-guard.dsh.d.ts +16 -0
- package/lib/types/tools/shared/browser-detect.d.ts +54 -0
- package/lib/types/tools/shared/browser-rpc-channel.d.ts +40 -0
- package/lib/types/tools/shared/bun-ffi-shim.d.ts +13 -0
- package/lib/types/tools/shared/bun-named-shim.d.ts +42 -0
- package/lib/types/tools/shared/bun-shim.d.ts +138 -0
- package/lib/types/tools/shared/bun-sqlite-shim.d.ts +49 -0
- package/lib/types/tools/shared/fs-promises-shim.d.ts +15 -0
- package/lib/types/tools/shared/image-bridge.d.ts +98 -0
- package/lib/types/tools/shared/omp-prompt.d.ts +47 -0
- package/lib/types/tools/shared/sandbox-policy.d.ts +38 -0
- package/lib/types/tools/shared/session-state.d.ts +51 -0
- package/lib/types/tools/shared/tool-errors.d.ts +33 -0
- package/lib/types/tools/shared/win-path-fixes.d.ts +16 -0
- package/lib/types/tools/write/adapter/index.d.ts +31 -0
- package/lib/{types-DX_bvuus.mjs → types-PVueGi9S.mjs} +2 -2
- package/lib/{utils-C-dSORPa.mjs → utils-B7A3Eu4L.mjs} +2364 -2676
- package/lib/{utils-Cp2Mxf_U.mjs → utils-CUPhpw9A.mjs} +413 -134
- package/lib/{utils-CQHPEQ3W.mjs → utils-DeWqNWV8.mjs} +2 -2
- package/lib/{vision-guard-mBmtAHx0.mjs → vision-guard-_XwsL1DF.mjs} +14 -29
- package/lib/xai-oauth-CXhnz0gO.mjs +210 -0
- package/lib/{xiaomi-7mE345KX.mjs → xiaomi-psoUItal.mjs} +8 -37
- package/lib/{zai-CeNpMV3W.mjs → zai-ApJ8HBgT.mjs} +8 -71
- package/lib/{zip-BK7UHCwX.mjs → zip-Kd602XNe.mjs} +1 -1
- package/package.json +12 -12
- package/presets/package.json +1 -1
- package/presets/tool-plus-ptc/agent.cordis.yml +1 -1
- package/presets/tool-plus-standard/agent.cordis.yml +1 -1
- package/scripts/patch-pi-natives.mjs +108 -108
- package/lib/agent_pb-Rizyt9Zg.mjs +0 -805
- package/lib/anthropic-CDmj476p.mjs +0 -262
- package/lib/api_server_pb-CDZgLMta.mjs +0 -252
- package/lib/callback-server-CFJK-jvK.mjs +0 -398
- package/lib/codex-P1dGpX7G.mjs +0 -54
- package/lib/device-code-CuXTWYwY.mjs +0 -51
- package/lib/devin-BcQwht1W.mjs +0 -114
- package/lib/devin-BvMfGevz.mjs +0 -95
- package/lib/github-copilot-B3kQl0g0.mjs +0 -104
- package/lib/gitlab-duo-BriUTP8k.mjs +0 -155
- package/lib/gitlab-duo-workflow-wK5Ljzmc.mjs +0 -91
- package/lib/google-CE5tFDod.mjs +0 -30
- package/lib/google-antigravity-C1jgNljz.mjs +0 -198
- package/lib/google-oauth-shared-BLVTvokk.mjs +0 -147
- package/lib/grammar-D-NqNUxQ.mjs +0 -49
- package/lib/identity-HNO1Oe9B.mjs +0 -219
- package/lib/kimi-DgcUpPtK.mjs +0 -236
- package/lib/markit-DtGoRE6M.mjs +0 -1417
- package/lib/minimax-code-Y3h5li9N.mjs +0 -53
- package/lib/models-DRA2c_8U.mjs +0 -104660
- package/lib/opencode-BsVw9rCD.mjs +0 -38
- package/lib/to-binary-B1BEBIPC.mjs +0 -6002
- package/lib/wafer-BlhWLweO.mjs +0 -17
- package/lib/xai-oauth-5pORHUrg.mjs +0 -446
package/lib/{openai-reasoning-fallback-DXsfiSXO.mjs → openai-reasoning-fallback-BdB3RCbj.mjs}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import { o as readSseJson } from "./src-
|
|
4
|
-
import { B as OpenAIHttpError, G as fetchWithRetry, W as extractHttpStatusFromError, s as ProviderResponseError } from "./error-
|
|
5
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
3
|
+
import { o as readSseJson } from "./src-BwW51vA5.mjs";
|
|
4
|
+
import { B as OpenAIHttpError, G as fetchWithRetry, W as extractHttpStatusFromError, s as ProviderResponseError } from "./error-CORgGg5a.mjs";
|
|
5
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/utils/openai-http.ts
|
|
6
6
|
/**
|
|
7
7
|
* JSON-POST → SSE transport for OpenAI-wire streaming endpoints (chat
|
|
8
8
|
* completions, responses, azure responses). Replaces the `openai` SDK client:
|
|
@@ -30,6 +30,26 @@ const DEFAULT_MAX_ATTEMPTS = 6;
|
|
|
30
30
|
/** Bound the `Error.message` allocation for proxy HTML error pages and the like. */
|
|
31
31
|
const MAX_DETAIL_CHARS = 4096;
|
|
32
32
|
/**
|
|
33
|
+
* LiteLLM (and compatible proxies) shed over-concurrency requests *before* the
|
|
34
|
+
* upstream call with an immediate HTTP 429 marked `rate_limit_type:
|
|
35
|
+
* max_parallel_requests` — as a response header and/or a structured body field.
|
|
36
|
+
* This is an admission failure, not an upstream rate/quota limit: the request
|
|
37
|
+
* never reached a model. Retrying it inside the transport (honoring the proxy's
|
|
38
|
+
* `Retry-After`, up to {@link DEFAULT_MAX_ATTEMPTS} times) duplicates — worse,
|
|
39
|
+
* at 60s per sleep instead of 5s — the concurrency backoff and model fallback
|
|
40
|
+
* that `TurnRecovery` already owns, stalling one turn for up to ~300s
|
|
41
|
+
* (issue #8854). {@link isConcurrencyAdmissionRejection} lets the transport
|
|
42
|
+
* surface it on the first attempt so session recovery runs promptly. Genuine
|
|
43
|
+
* RPM/quota 429s carry no such marker and keep honoring `Retry-After`.
|
|
44
|
+
*/
|
|
45
|
+
const CONCURRENCY_ADMISSION_LIMITER = "max_parallel_requests";
|
|
46
|
+
/** Body form of the marker: `"rate_limit_type": "max_parallel_requests"` (top level or under `error`). */
|
|
47
|
+
const CONCURRENCY_ADMISSION_BODY_PATTERN = /"rate_limit_type"\s*:\s*"max_parallel_requests"/;
|
|
48
|
+
/** `true` for a proxy concurrency-admission 429 that must bypass transport-level retry. */
|
|
49
|
+
function isConcurrencyAdmissionRejection(response, bodyText) {
|
|
50
|
+
return response.headers.get("rate_limit_type")?.trim() === CONCURRENCY_ADMISSION_LIMITER || CONCURRENCY_ADMISSION_BODY_PATTERN.test(bodyText);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
33
53
|
* POST a JSON body and stream back decoded SSE events.
|
|
34
54
|
*
|
|
35
55
|
* Throws {@link OpenAIHttpError} on a non-2xx terminal response. Aborts on
|
|
@@ -48,6 +68,7 @@ async function postOpenAIStream(init) {
|
|
|
48
68
|
signal: init.signal,
|
|
49
69
|
fetch: init.fetch,
|
|
50
70
|
maxAttempts: DEFAULT_MAX_ATTEMPTS,
|
|
71
|
+
shouldRetryResponse: (response, bodyText) => !isConcurrencyAdmissionRejection(response, bodyText),
|
|
51
72
|
timeout: false
|
|
52
73
|
});
|
|
53
74
|
if (!response.ok) throw await captureOpenAIHttpError(response);
|
|
@@ -80,7 +101,15 @@ async function captureOpenAIHttpError(response) {
|
|
|
80
101
|
return new OpenAIHttpError(message, captured, code);
|
|
81
102
|
}
|
|
82
103
|
//#endregion
|
|
83
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
104
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/providers/openai-reasoning-fallback.ts
|
|
105
|
+
/**
|
|
106
|
+
* Fallback marker: the server rejected the `chat_template_kwargs.reasoning_effort`
|
|
107
|
+
* spelling itself (strict kwargs whitelists — Ninfer-style servers), not the
|
|
108
|
+
* effort value. Apply strips the kwarg and hoists the value onto the top-level
|
|
109
|
+
* `reasoning_effort` field when that spelling is absent.
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
const STRIP_TEMPLATE_KWARG_REASONING_EFFORT = Symbol("strip-template-kwarg-reasoning-effort");
|
|
84
113
|
const ENABLED_REASONING_VALUES = [
|
|
85
114
|
"minimal",
|
|
86
115
|
"low",
|
|
@@ -134,7 +163,18 @@ function readOpenAIReasoningEffort(params) {
|
|
|
134
163
|
if (!isRecord(params)) return void 0;
|
|
135
164
|
if (typeof params.reasoning_effort === "string") return params.reasoning_effort;
|
|
136
165
|
const reasoning = params.reasoning;
|
|
137
|
-
|
|
166
|
+
if (isRecord(reasoning) && typeof reasoning.effort === "string") return reasoning.effort;
|
|
167
|
+
return readTemplateKwargReasoningEffort(params);
|
|
168
|
+
}
|
|
169
|
+
function readTemplateKwargReasoningEffort(params) {
|
|
170
|
+
const kwargs = params.chat_template_kwargs;
|
|
171
|
+
return isRecord(kwargs) && typeof kwargs.reasoning_effort === "string" ? kwargs.reasoning_effort : void 0;
|
|
172
|
+
}
|
|
173
|
+
/** Remove `chat_template_kwargs.reasoning_effort`, dropping the kwargs object when it becomes empty. */
|
|
174
|
+
function deleteTemplateKwargReasoningEffort(kwargs, parent) {
|
|
175
|
+
delete kwargs.reasoning_effort;
|
|
176
|
+
for (const key in kwargs) return;
|
|
177
|
+
delete parent.chat_template_kwargs;
|
|
138
178
|
}
|
|
139
179
|
function deleteReasoningEffort(reasoning, parent) {
|
|
140
180
|
if (typeof reasoning.effort !== "string") return false;
|
|
@@ -146,6 +186,14 @@ function deleteReasoningEffort(reasoning, parent) {
|
|
|
146
186
|
/** @internal */
|
|
147
187
|
function applyOpenAIReasoningEffortFallback(params, fallback) {
|
|
148
188
|
if (!isRecord(params)) return false;
|
|
189
|
+
if (fallback === STRIP_TEMPLATE_KWARG_REASONING_EFFORT) {
|
|
190
|
+
const kwargs = params.chat_template_kwargs;
|
|
191
|
+
if (!isRecord(kwargs) || typeof kwargs.reasoning_effort !== "string") return false;
|
|
192
|
+
const effort = kwargs.reasoning_effort;
|
|
193
|
+
deleteTemplateKwargReasoningEffort(kwargs, params);
|
|
194
|
+
if (typeof params.reasoning_effort !== "string") params.reasoning_effort = effort;
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
149
197
|
let changed = false;
|
|
150
198
|
if (typeof params.reasoning_effort === "string") {
|
|
151
199
|
if (fallback === null) delete params.reasoning_effort;
|
|
@@ -160,6 +208,12 @@ function applyOpenAIReasoningEffortFallback(params, fallback) {
|
|
|
160
208
|
changed = true;
|
|
161
209
|
}
|
|
162
210
|
}
|
|
211
|
+
const kwargs = params.chat_template_kwargs;
|
|
212
|
+
if (isRecord(kwargs) && typeof kwargs.reasoning_effort === "string") {
|
|
213
|
+
if (fallback === null) deleteTemplateKwargReasoningEffort(kwargs, params);
|
|
214
|
+
else kwargs.reasoning_effort = fallback;
|
|
215
|
+
changed = true;
|
|
216
|
+
}
|
|
163
217
|
return changed;
|
|
164
218
|
}
|
|
165
219
|
function capturedStringField(captured, field) {
|
|
@@ -182,9 +236,10 @@ function collectMessageParts(error, captured) {
|
|
|
182
236
|
* Text that identifies a 400 as being about the reasoning-effort field.
|
|
183
237
|
* OpenAI-compatible gateways (cliproxy, …) never name the field — they reject
|
|
184
238
|
* the value alone with `level "none" not supported, valid levels: low, …` — so
|
|
185
|
-
* the allowed-level phrasing counts as a mention too.
|
|
239
|
+
* the allowed-level phrasing counts as a mention too. GitHub Copilot phrases
|
|
240
|
+
* the same rejection with `Supported values are: …`, so value lists count too.
|
|
186
241
|
*/
|
|
187
|
-
const REASONING_EFFORT_FIELD_PATTERN = /reasoning[_. ]effort|reasoning value|(?:valid|supported|allowed) levels
|
|
242
|
+
const REASONING_EFFORT_FIELD_PATTERN = /reasoning[_. ]effort|reasoning value|(?:valid|supported|allowed) (?:levels?|values?)/i;
|
|
188
243
|
function mentionsReasoningEffort(error, captured) {
|
|
189
244
|
const param = capturedStringField(captured, "param");
|
|
190
245
|
const code = capturedStringField(captured, "code");
|
|
@@ -192,17 +247,35 @@ function mentionsReasoningEffort(error, captured) {
|
|
|
192
247
|
const message = collectMessageParts(error, captured);
|
|
193
248
|
return REASONING_EFFORT_FIELD_PATTERN.test(param ?? "") || REASONING_EFFORT_FIELD_PATTERN.test(code ?? "") || REASONING_EFFORT_FIELD_PATTERN.test(type ?? "") || REASONING_EFFORT_FIELD_PATTERN.test(message);
|
|
194
249
|
}
|
|
250
|
+
const EFFORT_FIELD_PATTERN = /reasoning[_. ]effort|reasoning value/i;
|
|
251
|
+
const ALLOWED_LEVELS_PATTERN = /(?:valid|supported|allowed) levels?/i;
|
|
252
|
+
/** Fielded rejection verdicts in any word order: verdict-first, field-first, or bare mention plus verdict. */
|
|
253
|
+
function messageCarriesEffortVerdict(message) {
|
|
254
|
+
return /invalid[^\n]*(?:reasoning[_. ]effort|reasoning value)/i.test(message) || /(?:reasoning[_. ]effort|reasoning value)[^\n]*(?:invalid|unsupported|not supported|not permitted|must be|expected|unknown|unexpected|unrecognized)/i.test(message) || /(?:unsupported|not supported|not permitted|unknown|unexpected|unrecognized|extra)[^\n]*(?:reasoning[_. ]effort|reasoning value)/i.test(message);
|
|
255
|
+
}
|
|
256
|
+
function parseEffortRejectionSignal(message, captured, currentEffort) {
|
|
257
|
+
const namesFieldInMessage = EFFORT_FIELD_PATTERN.test(message);
|
|
258
|
+
const param = capturedStringField(captured, "param") ?? "";
|
|
259
|
+
const quoted = `["'\`]${escapeRegExp(currentEffort)}["'\`]`;
|
|
260
|
+
return {
|
|
261
|
+
field: namesFieldInMessage || EFFORT_FIELD_PATTERN.test(param) ? "reasoning-effort" : param.trim() !== "" ? "other" : "unknown",
|
|
262
|
+
namesFieldInMessage,
|
|
263
|
+
messageVerdict: messageCarriesEffortVerdict(message),
|
|
264
|
+
listsLevels: ALLOWED_LEVELS_PATTERN.test(message),
|
|
265
|
+
rejectedMatches: new RegExp(`(?:invalid|unsupported|not supported)[^\\n]*${quoted}`, "i").test(message) || new RegExp(`${quoted}[^\\n]*(?:invalid|unsupported|not supported)`, "i").test(message)
|
|
266
|
+
};
|
|
267
|
+
}
|
|
195
268
|
function isInvalidReasoningEffortError(error, captured, currentEffort) {
|
|
196
269
|
const status = extractHttpStatusFromError(error) ?? captured?.status;
|
|
197
270
|
if (status !== 400 && status !== 422) return false;
|
|
198
271
|
if (!mentionsReasoningEffort(error, captured)) return false;
|
|
199
272
|
const message = collectMessageParts(error, captured);
|
|
200
273
|
if (/reasoning[_ ]content/i.test(message) && !REASONING_EFFORT_FIELD_PATTERN.test(message)) return false;
|
|
201
|
-
|
|
202
|
-
if (
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
return
|
|
274
|
+
const signal = parseEffortRejectionSignal(message, captured, currentEffort);
|
|
275
|
+
if (signal.field === "other" && !signal.namesFieldInMessage) return false;
|
|
276
|
+
if (signal.messageVerdict) return true;
|
|
277
|
+
if (currentEffort.toLowerCase() !== "none" && !signal.namesFieldInMessage && !signal.listsLevels) return false;
|
|
278
|
+
return signal.rejectedMatches;
|
|
206
279
|
}
|
|
207
280
|
function escapeRegExp(value) {
|
|
208
281
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -266,8 +339,29 @@ function nearestEnabledReasoningFallback(currentEffort, allowed) {
|
|
|
266
339
|
}
|
|
267
340
|
return best;
|
|
268
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Text that identifies a rejection of the kwargs spelling itself: the server
|
|
344
|
+
* names `chat_template_kwargs` together with `reasoning_effort` (Ninfer-style
|
|
345
|
+
* strict kwargs whitelists: `chat_template_kwargs.reasoning_effort is not
|
|
346
|
+
* supported`).
|
|
347
|
+
*/
|
|
348
|
+
const TEMPLATE_KWARG_EFFORT_PATTERN = /chat_template_kwargs[^\n]{0,120}reasoning[_. ]effort|reasoning[_. ]effort[^\n]{0,120}chat_template_kwargs/i;
|
|
349
|
+
const FIELD_REJECTION_PATTERN = /invalid|unsupported|not supported|not permitted|unknown|unexpected|unrecognized|rejected|extra input/i;
|
|
350
|
+
function resolveStripTemplateKwargFallback(error, captured, params) {
|
|
351
|
+
if (!isRecord(params)) return void 0;
|
|
352
|
+
const effort = readTemplateKwargReasoningEffort(params);
|
|
353
|
+
if (effort === void 0) return void 0;
|
|
354
|
+
const status = extractHttpStatusFromError(error) ?? captured?.status;
|
|
355
|
+
if (status !== 400 && status !== 422) return void 0;
|
|
356
|
+
const message = collectMessageParts(error, captured);
|
|
357
|
+
if (!TEMPLATE_KWARG_EFFORT_PATTERN.test(message) || !FIELD_REJECTION_PATTERN.test(message)) return void 0;
|
|
358
|
+
if (parseAllowedReasoningValues(message, effort) !== void 0) return void 0;
|
|
359
|
+
return STRIP_TEMPLATE_KWARG_REASONING_EFFORT;
|
|
360
|
+
}
|
|
269
361
|
/** @internal */
|
|
270
362
|
function resolveOpenAIReasoningEffortFallback(error, captured, params, options) {
|
|
363
|
+
const strip = resolveStripTemplateKwargFallback(error, captured, params);
|
|
364
|
+
if (strip !== void 0) return strip;
|
|
271
365
|
const currentEffort = readOpenAIReasoningEffort(params);
|
|
272
366
|
if (!currentEffort || !KNOWN_REASONING_VALUE[currentEffort.toLowerCase()]) return void 0;
|
|
273
367
|
if (!isInvalidReasoningEffortError(error, captured, currentEffort)) return void 0;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
3
|
import { r as __exportAll } from "./fs-promises-shim-Bx0fpxuk.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { A as isTransientStreamParseError, B as OpenAIHttpError,
|
|
6
|
-
import { A as
|
|
7
|
-
import { $ as
|
|
8
|
-
import { t as createAbortSourceTracker } from "./abort-
|
|
9
|
-
import {
|
|
10
|
-
import "./
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as
|
|
16
|
-
import { a as getOpenAIReasoningEffortFallback, c as postOpenAIStream, i as createOpenAIReasoningEffortFallbackState, n as clearOpenAIReasoningEffortFallbackState, o as rememberOpenAIReasoningEffortFallback, r as createOpenAIReasoningEffortFallbackKey, s as resolveOpenAIReasoningEffortFallback, t as applyOpenAIReasoningEffortFallback } from "./openai-reasoning-fallback-DXsfiSXO.mjs";
|
|
4
|
+
import { C as warn, F as $flag, b as debug, t as structuredCloneJSON } from "./src-BwW51vA5.mjs";
|
|
5
|
+
import { A as isTransientStreamParseError, B as OpenAIHttpError, _ as AbortError, c as finalize, i as isProviderRetryableError, n as StreamTimeoutError, s as ProviderResponseError, t as ConfigurationError } from "./error-CORgGg5a.mjs";
|
|
6
|
+
import { A as toolWireSchema, F as normalizeSchemaForMoonshot, M as adaptSchemaForStrict, c as resolveCacheRetention, j as NO_STRICT, k as flattenExclusiveRequiredRootUnion, o as normalizeSystemPrompts, t as createOpenAIResponsesHistoryPayload, u as sanitizeOpenAIResponsesAssistantHistoryItemsForReplay, z as sanitizeSchemaForOpenAIResponses } from "./utils-CUPhpw9A.mjs";
|
|
7
|
+
import { $ as getJuiceValue, A as applyResponsesCompatPolicy, At as withReplaySafeStreamRetry, E as applyOpenAIGatewayRouting, Et as mapToOpenAIResponsesToolChoice, F as buildResponsesInput, H as createOpenAIStrictToolsState, L as clearOpenAIStrictToolsState, M as applyVercelResponsesCacheControls, N as applyWireModelIdTransform, P as buildResponsesDeltaInput, St as shouldRetryWithoutStrictTools, T as applyOpenAIExtraBody, V as createInitialResponsesAssistantMessage, W as disableStrictToolsForScope, _t as resolveOpenAIOutputTokenParam, at as isCompiledGrammarTooLargeStrictError, bt as resolveReasoningSummaryOption, et as getOpenAIPromptCacheKey, ht as resolveOpenAICompatPolicy, n as getEnvApiKey, nt as getOpenAIStrictToolsScope, ot as isOpenAIResponsesProgressEvent, pt as processResponsesStream, rt as getOpenRouterResponsesSessionId, st as isStrictToolsDisabledForScope, tt as getOpenAIResponsesRoutingSessionId, vt as resolveOpenAIRequestSetup, w as applyCommonResponsesSamplingParams, wt as isForcedToolChoice, xt as shouldDropAutoToolChoiceForReasoning, yt as resolveOpenAIResponsesOutputClamp } from "./stream-B_7qN-bA.mjs";
|
|
8
|
+
import { t as createAbortSourceTracker } from "./abort-Caqff3M6.mjs";
|
|
9
|
+
import { i as resolveCopilotRequestIdentity, o as wrapFetchForCopilotFallback } from "./github-copilot-headers-DOh1gt_w.mjs";
|
|
10
|
+
import { t as findStrictToolSchemaViolation } from "./strict-tool-validation-CBTz1dAA.mjs";
|
|
11
|
+
import { t as AssistantMessageEventStream } from "./event-stream-ulcDenZD.mjs";
|
|
12
|
+
import { n as getOpenAIStreamFirstEventTimeoutMs, o as iterateWithIdleTimeout, r as getOpenAIStreamIdleTimeoutMs } from "./idle-iterator-DlUkEfzW.mjs";
|
|
13
|
+
import { t as notifyProviderResponse } from "./provider-response-SqKSkkUc.mjs";
|
|
14
|
+
import { n as planStableOpenAIEffort, r as compactGrammarDefinition, t as getOpenAIEffortControlState } from "./openai-configuration-update-xMYUjaK_.mjs";
|
|
15
|
+
import { a as getOpenAIReasoningEffortFallback, c as postOpenAIStream, i as createOpenAIReasoningEffortFallbackState, n as clearOpenAIReasoningEffortFallbackState, o as rememberOpenAIReasoningEffortFallback, r as createOpenAIReasoningEffortFallbackKey, s as resolveOpenAIReasoningEffortFallback, t as applyOpenAIReasoningEffortFallback } from "./openai-reasoning-fallback-BdB3RCbj.mjs";
|
|
17
16
|
import { scheduler } from "node:timers/promises";
|
|
18
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
17
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/providers/openai-responses.ts
|
|
19
18
|
var openai_responses_exports = /* @__PURE__ */ __exportAll({
|
|
20
19
|
buildParams: () => buildParams,
|
|
21
20
|
convertTools: () => convertTools,
|
|
@@ -43,7 +42,7 @@ function isOpenAIResponsesReplayUnsafeEvent(event) {
|
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
function isRetryableOpenAIResponsesStreamFailure(error) {
|
|
46
|
-
return isTransientStreamParseError(error) || error instanceof ProviderResponseError && error.kind === "incomplete-stream";
|
|
45
|
+
return isTransientStreamParseError(error) || error instanceof ProviderResponseError && error.kind === "incomplete-stream" || isProviderRetryableError(error);
|
|
47
46
|
}
|
|
48
47
|
function createOpenAIResponsesProviderSessionState() {
|
|
49
48
|
const strictToolsState = createOpenAIStrictToolsState();
|
|
@@ -53,9 +52,11 @@ function createOpenAIResponsesProviderSessionState() {
|
|
|
53
52
|
...reasoningEffortFallbackState,
|
|
54
53
|
nativeHistoryReplayWarmed: false,
|
|
55
54
|
chains: /* @__PURE__ */ new Map(),
|
|
55
|
+
effortControls: /* @__PURE__ */ new Map(),
|
|
56
56
|
close: () => {
|
|
57
57
|
state.nativeHistoryReplayWarmed = false;
|
|
58
58
|
state.chains.clear();
|
|
59
|
+
state.effortControls.clear();
|
|
59
60
|
clearOpenAIStrictToolsState(state);
|
|
60
61
|
clearOpenAIReasoningEffortFallbackState(state);
|
|
61
62
|
}
|
|
@@ -71,10 +72,10 @@ function getOpenAIResponsesProviderSessionState(model, providerSessionState) {
|
|
|
71
72
|
providerSessionState.set(key, created);
|
|
72
73
|
return created;
|
|
73
74
|
}
|
|
74
|
-
function isOpenAIResponsesStatefulEnabled(options,
|
|
75
|
+
function isOpenAIResponsesStatefulEnabled(options, model) {
|
|
75
76
|
if (options?.statefulResponses === false) return false;
|
|
76
77
|
if (options?.statefulResponses === true) return true;
|
|
77
|
-
return $flag("PI_OPENAI_STATEFUL",
|
|
78
|
+
return $flag("PI_OPENAI_STATEFUL", model.compat.officialEndpoint);
|
|
78
79
|
}
|
|
79
80
|
function getOpenAIResponsesChainState(providerSessionState, model, resolvedBaseUrl, sessionId) {
|
|
80
81
|
const key = `${resolvedBaseUrl ?? model.baseUrl ?? ""}\u0000${model.id}\u0000${sessionId}`;
|
|
@@ -149,7 +150,7 @@ function markOpenAIResponsesChainZeroDataRetention(chain, error) {
|
|
|
149
150
|
debug("OpenAI responses chaining disabled (Zero Data Retention)", { error: error instanceof Error ? error.message : String(error) });
|
|
150
151
|
}
|
|
151
152
|
function maybeAddOpenRouterAnthropicCacheControl(params, model, cacheRetention) {
|
|
152
|
-
if (cacheRetention === "none" ||
|
|
153
|
+
if (cacheRetention === "none" || model.compat.cacheControlFormat !== "anthropic") return;
|
|
153
154
|
if (params.cache_control != null) return;
|
|
154
155
|
params.cache_control = cacheRetention === "long" ? {
|
|
155
156
|
type: "ephemeral",
|
|
@@ -192,14 +193,14 @@ const streamOpenAIResponsesOnce = (model, context, options) => {
|
|
|
192
193
|
extraHeaders: options?.headers,
|
|
193
194
|
initiatorOverride: options?.initiatorOverride,
|
|
194
195
|
messages: context.messages,
|
|
195
|
-
|
|
196
|
+
sessionId: options?.sessionId ?? routingSessionId,
|
|
196
197
|
promptCacheSessionId
|
|
197
198
|
});
|
|
198
199
|
const premiumRequestsTotal = copilotPremiumRequests;
|
|
199
200
|
const providerSessionState = getOpenAIResponsesProviderSessionState(model, options?.providerSessionState);
|
|
200
201
|
const strictToolsScope = getOpenAIStrictToolsScope(model, baseUrl);
|
|
201
202
|
const promptCacheBreakpointPolicy = resolveCacheRetention(options?.cacheRetention) !== "none" && options?.promptCache?.mode === "explicit" ? options.promptCache.breakpoint ?? "latest-stable-message" : void 0;
|
|
202
|
-
if (isOpenAIResponsesStatefulEnabled(options,
|
|
203
|
+
if (isOpenAIResponsesStatefulEnabled(options, model) && routingSessionId && providerSessionState) {
|
|
203
204
|
chainState = getOpenAIResponsesChainState(providerSessionState, model, baseUrl, routingSessionId);
|
|
204
205
|
if (chainState.canAppend && chainState.lastPromptCacheBreakpointPolicy !== promptCacheBreakpointPolicy) resetOpenAIResponsesChainState(chainState);
|
|
205
206
|
}
|
|
@@ -246,36 +247,28 @@ const streamOpenAIResponsesOnce = (model, context, options) => {
|
|
|
246
247
|
body: chained.params
|
|
247
248
|
};
|
|
248
249
|
rawRequestDump = activeRawRequestDump;
|
|
249
|
-
const openResponsesStream = (requestParams) => {
|
|
250
|
+
const openResponsesStream = async (requestParams) => {
|
|
250
251
|
activeReasoningEffortFallbackKey = createOpenAIReasoningEffortFallbackKey("responses", resolvedBaseUrl, typeof requestParams.model === "string" ? requestParams.model : model.id);
|
|
251
252
|
activeRequestParams = requestParams;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
return events;
|
|
272
|
-
} finally {
|
|
273
|
-
if (requestTimeout !== void 0) clearTimeout(requestTimeout);
|
|
274
|
-
}
|
|
275
|
-
}, {
|
|
276
|
-
provider: model.provider,
|
|
277
|
-
signal: requestSignal
|
|
278
|
-
});
|
|
253
|
+
let requestTimeout;
|
|
254
|
+
if (requestTimeoutMs !== void 0) requestTimeout = setTimeout(() => abortTracker.abortLocally(firstEventTimeoutAbortError), requestTimeoutMs);
|
|
255
|
+
try {
|
|
256
|
+
const headersWithTimeout = { ...headers };
|
|
257
|
+
if (requestTimeoutMs !== void 0) headersWithTimeout["X-Stainless-Timeout"] = Math.floor(requestTimeoutMs / 1e3).toString();
|
|
258
|
+
const { events, response, requestId } = await postOpenAIStream({
|
|
259
|
+
url: requestUrl,
|
|
260
|
+
headers: headersWithTimeout,
|
|
261
|
+
body: requestParams,
|
|
262
|
+
signal: requestSignal,
|
|
263
|
+
fetch: wrapFetchForCopilotFallback(options?.fetch, model.provider === "github-copilot", resolveCopilotRequestIdentity(options?.headers)),
|
|
264
|
+
onSseEvent: rawSseObserver
|
|
265
|
+
});
|
|
266
|
+
clearTimeout(requestTimeout);
|
|
267
|
+
await notifyProviderResponse(options, response, model, requestId);
|
|
268
|
+
return events;
|
|
269
|
+
} finally {
|
|
270
|
+
clearTimeout(requestTimeout);
|
|
271
|
+
}
|
|
279
272
|
};
|
|
280
273
|
let strictRetryAvailable = true;
|
|
281
274
|
let activeStrictToolsApplied = builtParams.strictToolsApplied;
|
|
@@ -285,13 +278,13 @@ const streamOpenAIResponsesOnce = (model, context, options) => {
|
|
|
285
278
|
while (true) try {
|
|
286
279
|
openaiStream = await openResponsesStream(chained.params);
|
|
287
280
|
if (pendingReasoningEffortFallback) {
|
|
288
|
-
rememberOpenAIReasoningEffortFallback(providerSessionState, pendingReasoningEffortFallback.key, pendingReasoningEffortFallback.fallback);
|
|
281
|
+
if (!(options?.forceReasoningOff === true || options?.disableReasoning === true)) rememberOpenAIReasoningEffortFallback(providerSessionState, pendingReasoningEffortFallback.key, pendingReasoningEffortFallback.fallback);
|
|
289
282
|
pendingReasoningEffortFallback = void 0;
|
|
290
283
|
}
|
|
291
284
|
break;
|
|
292
285
|
} catch (error) {
|
|
293
286
|
const capturedErrorResponse = error instanceof OpenAIHttpError ? error.captured : void 0;
|
|
294
|
-
const reasoningEffortFallback = activeReasoningEffortFallbackKey && activeRequestParams && !requestSignal.aborted ? resolveOpenAIReasoningEffortFallback(error, capturedErrorResponse, activeRequestParams, { explicitDisable: options?.forceReasoningOff === true || options?.disableReasoning === true
|
|
287
|
+
const reasoningEffortFallback = activeReasoningEffortFallbackKey && activeRequestParams && !requestSignal.aborted ? resolveOpenAIReasoningEffortFallback(error, capturedErrorResponse, activeRequestParams, { explicitDisable: options?.forceReasoningOff === true || options?.disableReasoning === true }) : void 0;
|
|
295
288
|
if (reasoningEffortFallback !== void 0 && activeReasoningEffortFallbackKey) {
|
|
296
289
|
const retryMarker = `${activeReasoningEffortFallbackKey}:${String(reasoningEffortFallback)}`;
|
|
297
290
|
if (attemptedReasoningEffortFallbacks.has(retryMarker)) throw error;
|
|
@@ -306,7 +299,7 @@ const streamOpenAIResponsesOnce = (model, context, options) => {
|
|
|
306
299
|
};
|
|
307
300
|
continue;
|
|
308
301
|
}
|
|
309
|
-
const compiledGrammarTooLarge =
|
|
302
|
+
const compiledGrammarTooLarge = model.compat.retryWithoutStrictOnGrammarError && isCompiledGrammarTooLargeStrictError(error, capturedErrorResponse);
|
|
310
303
|
if (strictRetryAvailable && !requestSignal.aborted && (compiledGrammarTooLarge || shouldRetryWithoutStrictTools(error, capturedErrorResponse, {
|
|
311
304
|
model,
|
|
312
305
|
strictToolsApplied: activeStrictToolsApplied,
|
|
@@ -515,31 +508,11 @@ const streamOpenAIResponsesOnce = (model, context, options) => {
|
|
|
515
508
|
return stream;
|
|
516
509
|
};
|
|
517
510
|
/**
|
|
518
|
-
* Public entry:
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
* Anthropic providers via `withEmptyCompletionRetry`.
|
|
511
|
+
* Public entry: retry benign empty completions before they reach the agent
|
|
512
|
+
* loop. Transient stream failures are retried inside the attempt so stateful
|
|
513
|
+
* Responses request metadata remains stable.
|
|
522
514
|
*/
|
|
523
|
-
const streamOpenAIResponses = (model, context, options) =>
|
|
524
|
-
function isOfficialOpenAIResponsesEndpoint(model) {
|
|
525
|
-
if (model.provider !== "openai") return false;
|
|
526
|
-
if (!model.baseUrl) return true;
|
|
527
|
-
try {
|
|
528
|
-
return new URL(model.baseUrl).hostname === "api.openai.com";
|
|
529
|
-
} catch {
|
|
530
|
-
return false;
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
/**
|
|
534
|
-
* GPT-5.6+ family check for Responses routes. The model id classifies the
|
|
535
|
-
* reasoning family regardless of the provider/host serving it — a cliproxy or
|
|
536
|
-
* other OpenAI-compatible gateway carrying `gpt-5.6-sol` gets the same
|
|
537
|
-
* scaffolding as the official endpoint.
|
|
538
|
-
*/
|
|
539
|
-
function isGpt56PlusResponsesModel(model) {
|
|
540
|
-
const parsed = parseOpenAIModel(bareModelId(model.requestModelId ?? model.id));
|
|
541
|
-
return parsed !== null && semverGte(parsed.version, "5.6");
|
|
542
|
-
}
|
|
515
|
+
const streamOpenAIResponses = (model, context, options) => withReplaySafeStreamRetry(model, context, options, streamOpenAIResponsesOnce, { retryEmptyCompletion: true });
|
|
543
516
|
function isResponsesPromptCacheableContentBlock(block) {
|
|
544
517
|
if (typeof block !== "object" || block === null || !("type" in block)) return false;
|
|
545
518
|
return block.type === "input_text" || block.type === "input_image" || block.type === "input_file";
|
|
@@ -717,7 +690,7 @@ function buildParams(model, context, options, providerSessionState, strictToolsS
|
|
|
717
690
|
...options,
|
|
718
691
|
maxTokens: outputToken?.value
|
|
719
692
|
}, model);
|
|
720
|
-
if (options?.textVerbosity &&
|
|
693
|
+
if (options?.textVerbosity && model.compat.officialEndpoint) params.text = {
|
|
721
694
|
...params.text,
|
|
722
695
|
verbosity: options.textVerbosity
|
|
723
696
|
};
|
|
@@ -739,6 +712,7 @@ function buildParams(model, context, options, providerSessionState, strictToolsS
|
|
|
739
712
|
}
|
|
740
713
|
}
|
|
741
714
|
}
|
|
715
|
+
if (shouldDropAutoToolChoiceForReasoning(model, model.compat, params.tool_choice, options)) delete params.tool_choice;
|
|
742
716
|
const reasoningPolicy = resolveOpenAICompatPolicy(model, {
|
|
743
717
|
endpoint: "responses",
|
|
744
718
|
reasoning: options?.reasoning,
|
|
@@ -749,9 +723,8 @@ function buildParams(model, context, options, providerSessionState, strictToolsS
|
|
|
749
723
|
filterReasoningHistory: options?.filterReasoningHistory,
|
|
750
724
|
omitReasoningEffort: options?.omitReasoningEffort
|
|
751
725
|
});
|
|
752
|
-
const reasoningSummary = model.compat.supportsReasoningSummary ? options?.reasoningSummary : options?.reasoning === void 0 ? void 0 : null;
|
|
753
726
|
applyResponsesCompatPolicy(params, reasoningPolicy, {
|
|
754
|
-
reasoningSummary,
|
|
727
|
+
reasoningSummary: resolveReasoningSummaryOption(model, options),
|
|
755
728
|
forceReasoningOff: options?.forceReasoningOff,
|
|
756
729
|
mapEffort: (effort) => model.compat.reasoningEffortMap?.[effort] ?? model.thinking?.effortMap?.[effort] ?? effort
|
|
757
730
|
});
|
|
@@ -759,12 +732,13 @@ function buildParams(model, context, options, providerSessionState, strictToolsS
|
|
|
759
732
|
...params.reasoning,
|
|
760
733
|
mode: model.reasoningMode
|
|
761
734
|
};
|
|
735
|
+
applyResponsesStableEffort(model, params, messages, options, providerSessionState);
|
|
762
736
|
if (model.compat.isVercelGatewayHost) applyVercelResponsesCacheControls(params, model.compat, cacheRetention);
|
|
763
737
|
else applyOpenAIGatewayRouting(params, model.compat);
|
|
764
738
|
applyOpenAIExtraBody(params, options?.extraBody);
|
|
765
739
|
applyOpenAIResponsesPromptCachePolicy(params, model, options, statefulCacheBaseline);
|
|
766
740
|
let trailingScaffoldingItems = 0;
|
|
767
|
-
if (options?.forceReasoningOff &&
|
|
741
|
+
if (options?.forceReasoningOff && model.compat.requiresReasoningOffJuiceInstruction) {
|
|
768
742
|
const effort = options.reasoning ?? "medium";
|
|
769
743
|
const juice = getJuiceValue(effort);
|
|
770
744
|
messages.push({
|
|
@@ -783,6 +757,26 @@ function buildParams(model, context, options, providerSessionState, strictToolsS
|
|
|
783
757
|
};
|
|
784
758
|
}
|
|
785
759
|
/**
|
|
760
|
+
* Keep the request-level effort byte-stable across a conversation and carry
|
|
761
|
+
* later changes as `configuration_update` items (GPT-6 Astra). Requires a
|
|
762
|
+
* routing session id and provider session state to remember the baseline;
|
|
763
|
+
* without them every request stands alone and sends its own effort.
|
|
764
|
+
*/
|
|
765
|
+
function applyResponsesStableEffort(model, params, input, options, providerSessionState) {
|
|
766
|
+
if (!model.compat.supportsConfigurationUpdate || !providerSessionState) return;
|
|
767
|
+
const reasoning = params.reasoning;
|
|
768
|
+
if (!reasoning || !("effort" in reasoning)) return;
|
|
769
|
+
const effort = reasoning.effort;
|
|
770
|
+
if (effort === void 0 || effort === null || effort === "none") return;
|
|
771
|
+
const sessionId = getOpenAIResponsesRoutingSessionId(options);
|
|
772
|
+
if (!sessionId) return;
|
|
773
|
+
const state = getOpenAIEffortControlState(providerSessionState.effortControls, `${model.baseUrl ?? ""}\u0000${model.id}\u0000${sessionId}`);
|
|
774
|
+
params.reasoning = {
|
|
775
|
+
...reasoning,
|
|
776
|
+
effort: planStableOpenAIEffort(state, input, effort)
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
786
780
|
* Whether this model should get the OpenAI custom-tool grammar variant
|
|
787
781
|
* for `apply_patch`. The generated model catalog sets
|
|
788
782
|
* `model.applyPatchToolType` for first-party GPT-5 Responses models; this
|
|
@@ -822,7 +816,7 @@ function mapOpenAIResponsesToolChoiceForTools(choice, tools, model) {
|
|
|
822
816
|
/** @internal Exported for tests. */
|
|
823
817
|
function convertTools(tools, strictMode, model, onQuarantine = (toolName, schemaPath) => warn(`Tool "${toolName}" omitted from the openai-responses request: its parameter schema is invalid for this provider at ${schemaPath} (an enum/const value cannot match its declared type). Other tools are unaffected.`)) {
|
|
824
818
|
const allowFreeform = supportsFreeformApplyPatch(model);
|
|
825
|
-
const
|
|
819
|
+
const rejectRootObjectUnion = model.compat.rejectRootObjectUnion;
|
|
826
820
|
const out = [];
|
|
827
821
|
for (const tool of tools) {
|
|
828
822
|
if (tool.native?.type === "computer" && model.supportsComputerUse === true) {
|
|
@@ -845,10 +839,10 @@ function convertTools(tools, strictMode, model, onQuarantine = (toolName, schema
|
|
|
845
839
|
const strict = !NO_STRICT && strictMode && tool.strict !== false;
|
|
846
840
|
const baseParameters = toolWireSchema(tool);
|
|
847
841
|
const sanitized = sanitizeSchemaForOpenAIResponses(baseParameters);
|
|
848
|
-
const providerParameters =
|
|
842
|
+
const providerParameters = rejectRootObjectUnion ? flattenExclusiveRequiredRootUnion(sanitized) : sanitized;
|
|
849
843
|
const responseParameters = model.compat.toolSchemaFlavor === "moonshot-mfjs" ? normalizeSchemaForMoonshot(providerParameters) : providerParameters;
|
|
850
844
|
const { schema: parameters, strict: effectiveStrict } = adaptSchemaForStrict(responseParameters, strict);
|
|
851
|
-
const violation = findStrictToolSchemaViolation(parameters, "#", {
|
|
845
|
+
const violation = findStrictToolSchemaViolation(parameters, "#", { rejectRootObjectUnion });
|
|
852
846
|
if (violation) {
|
|
853
847
|
onQuarantine(tool.name, violation);
|
|
854
848
|
continue;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import {
|
|
4
|
-
import { V as ProviderHttpError,
|
|
3
|
+
import { E as CookieMap, N as $env, T as Cookie, w as $ } from "./src-BwW51vA5.mjs";
|
|
4
|
+
import { V as ProviderHttpError, f as OAuthError, g as OnPromptRequiredError, m as LoginCancelledError } from "./error-CORgGg5a.mjs";
|
|
5
5
|
import * as os from "node:os";
|
|
6
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
6
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/perplexity.ts
|
|
7
7
|
/**
|
|
8
8
|
* Perplexity login and token refresh.
|
|
9
9
|
*
|
|
@@ -156,7 +156,7 @@ async function httpEmailLogin(ctrl) {
|
|
|
156
156
|
}),
|
|
157
157
|
signal: ctrl.signal
|
|
158
158
|
});
|
|
159
|
-
|
|
159
|
+
let verifyData = await verifyResponse.json();
|
|
160
160
|
if (!verifyResponse.ok) {
|
|
161
161
|
const reason = verifyData.text ?? verifyData.error_code ?? verifyData.status ?? "OTP verification failed";
|
|
162
162
|
throw new OAuthError(`Perplexity OTP verification failed: ${reason}`, {
|
|
@@ -165,11 +165,54 @@ async function httpEmailLogin(ctrl) {
|
|
|
165
165
|
status: verifyResponse.status
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
if (verifyData.status === "totp_challenge_required" && verifyData.challenge_token) {
|
|
169
|
+
const totp = await ctrl.onPrompt({
|
|
170
|
+
message: "Enter the code from your authenticator app",
|
|
171
|
+
placeholder: "123456"
|
|
172
|
+
});
|
|
173
|
+
if (ctrl.signal?.aborted) throw new LoginCancelledError();
|
|
174
|
+
const trimmedTotp = totp.trim();
|
|
175
|
+
if (!trimmedTotp) throw new OAuthError("Authenticator code is required", {
|
|
176
|
+
kind: "validation",
|
|
177
|
+
provider: "perplexity"
|
|
178
|
+
});
|
|
179
|
+
ctrl.onProgress?.("Verifying authenticator code...");
|
|
180
|
+
const totpResponse = await request("https://www.perplexity.ai/api/auth/totp/challenge-verify", {
|
|
181
|
+
method: "POST",
|
|
182
|
+
headers: {
|
|
183
|
+
"Content-Type": "application/json",
|
|
184
|
+
"User-Agent": APP_USER_AGENT,
|
|
185
|
+
"X-App-ApiVersion": API_VERSION
|
|
186
|
+
},
|
|
187
|
+
body: JSON.stringify({
|
|
188
|
+
token: verifyData.challenge_token,
|
|
189
|
+
code: trimmedTotp
|
|
190
|
+
}),
|
|
191
|
+
signal: ctrl.signal
|
|
192
|
+
});
|
|
193
|
+
verifyData = await totpResponse.json();
|
|
194
|
+
if (!totpResponse.ok) {
|
|
195
|
+
const reason = verifyData.text ?? verifyData.error_code ?? verifyData.status ?? "TOTP verification failed";
|
|
196
|
+
throw new OAuthError(`Perplexity authenticator verification failed: ${reason}`, {
|
|
197
|
+
kind: "validation",
|
|
198
|
+
provider: "perplexity",
|
|
199
|
+
status: totpResponse.status
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (!verifyData.token) verifyData = {
|
|
203
|
+
token: cookies.get("__Secure-next-auth.session-token") ?? cookies.get("next-auth.session-token") ?? void 0,
|
|
204
|
+
status: "success"
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
const token = verifyData.token ?? verifyData.challenge_token;
|
|
208
|
+
if (!token || verifyData.error_code || verifyData.status && verifyData.status !== "success") {
|
|
209
|
+
const reason = verifyData.text ?? verifyData.error_code ?? verifyData.status ?? "missing token";
|
|
210
|
+
throw new OAuthError(`Perplexity OTP verification response rejected: ${reason}`, {
|
|
211
|
+
kind: "validation",
|
|
212
|
+
provider: "perplexity"
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
return jwtToCredentials(token, trimmedEmail);
|
|
173
216
|
}
|
|
174
217
|
/**
|
|
175
218
|
* Login to Perplexity.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
3
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/pkce.ts
|
|
4
4
|
/**
|
|
5
5
|
* Generate PKCE code verifier and challenge.
|
|
6
6
|
* Uses Web Crypto API for cross-platform compatibility.
|