@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/wafer-BlhWLweO.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
-
__installBunShim();
|
|
3
|
-
import { t as createApiKeyLogin } from "./api-key-login-CIDnXeYd.mjs";
|
|
4
|
-
const loginWaferServerless = createApiKeyLogin({
|
|
5
|
-
providerLabel: "Wafer Serverless",
|
|
6
|
-
authUrl: "https://app.wafer.ai/usage",
|
|
7
|
-
instructions: "Create or copy your Wafer Serverless API key from the Wafer dashboard",
|
|
8
|
-
promptMessage: "Paste your Wafer Serverless API key",
|
|
9
|
-
placeholder: "wfr_...",
|
|
10
|
-
validation: {
|
|
11
|
-
kind: "models-endpoint",
|
|
12
|
-
provider: "Wafer Serverless",
|
|
13
|
-
modelsUrl: "https://pass.wafer.ai/v1/models"
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
//#endregion
|
|
17
|
-
export { loginWaferServerless };
|
|
@@ -1,446 +0,0 @@
|
|
|
1
|
-
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
-
__installBunShim();
|
|
3
|
-
import { r as __exportAll } from "./fs-promises-shim-Bx0fpxuk.mjs";
|
|
4
|
-
import { c as OAuthError, h as LoginCancelledError } from "./error-C-f_Wnw4.mjs";
|
|
5
|
-
import { t as pollOAuthDeviceCodeFlow } from "./device-code-CuXTWYwY.mjs";
|
|
6
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/xai-oauth.ts
|
|
7
|
-
/**
|
|
8
|
-
* xAI Grok OAuth device authorization flow.
|
|
9
|
-
*
|
|
10
|
-
* Requests an RFC 8628 device code, opens xAI's verification page, and polls
|
|
11
|
-
* the discovered token endpoint until the user approves the login.
|
|
12
|
-
*/
|
|
13
|
-
var xai_oauth_exports = /* @__PURE__ */ __exportAll({
|
|
14
|
-
buildXAICliBillingUrl: () => buildXAICliBillingUrl,
|
|
15
|
-
extractXAIAccessTokenSubject: () => extractXAIAccessTokenSubject,
|
|
16
|
-
fetchXAIOAuthIdentity: () => fetchXAIOAuthIdentity,
|
|
17
|
-
getXAICliBillingHeaders: () => getXAICliBillingHeaders,
|
|
18
|
-
loginXAIOAuth: () => loginXAIOAuth,
|
|
19
|
-
parseXAIAccessTokenPayload: () => parseXAIAccessTokenPayload,
|
|
20
|
-
refreshXAIOAuthToken: () => refreshXAIOAuthToken,
|
|
21
|
-
validateXAIBillingEndpoint: () => validateXAIBillingEndpoint,
|
|
22
|
-
validateXAIEndpoint: () => validateXAIEndpoint
|
|
23
|
-
});
|
|
24
|
-
const XAI_OAUTH_ISSUER = "https://auth.x.ai";
|
|
25
|
-
const XAI_OAUTH_DISCOVERY_URL = `${XAI_OAUTH_ISSUER}/.well-known/openid-configuration`;
|
|
26
|
-
const XAI_OAUTH_DEVICE_CODE_URL = `${XAI_OAUTH_ISSUER}/oauth2/device/code`;
|
|
27
|
-
const XAI_OAUTH_USERINFO_URL = `${XAI_OAUTH_ISSUER}/oauth2/userinfo`;
|
|
28
|
-
const XAI_OAUTH_CLIENT_ID = "b1a00492-073a-47ea-816f-4c329264a828";
|
|
29
|
-
const XAI_OAUTH_SCOPE = "openid profile email offline_access grok-cli:access api:access";
|
|
30
|
-
const XAI_CLI_BILLING_BASE_URL = "https://cli-chat-proxy.grok.com";
|
|
31
|
-
const XAI_CLI_BILLING_PATH = "/v1/billing";
|
|
32
|
-
const XAI_CLI_BILLING_FORMAT = "credits";
|
|
33
|
-
const ACCESS_TOKEN_CLIENT_SKEW_MS = 3e5;
|
|
34
|
-
const DISCOVERY_TIMEOUT_MS = 15e3;
|
|
35
|
-
const TOKEN_REQUEST_TIMEOUT_MS = 2e4;
|
|
36
|
-
function isRecord(value) {
|
|
37
|
-
return typeof value === "object" && value !== null;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Validate an xAI OIDC endpoint against its scheme and host.
|
|
41
|
-
*
|
|
42
|
-
* The discovery response is long-lived and its token endpoint receives every
|
|
43
|
-
* future refresh token. Rejecting non-HTTPS or non-`x.ai` / `*.x.ai` hosts
|
|
44
|
-
* pins that endpoint to the xAI auth origin.
|
|
45
|
-
*
|
|
46
|
-
* @throws Error with message `Invalid xAI <field>: <url>` when the URL fails
|
|
47
|
-
* either scheme or host validation.
|
|
48
|
-
*/
|
|
49
|
-
function isXaiAuthHostname(host) {
|
|
50
|
-
return host === "x.ai" || host.endsWith(".x.ai");
|
|
51
|
-
}
|
|
52
|
-
/** SuperGrok CLI billing proxy host (`cli-chat-proxy.grok.com`), not the OIDC issuer. */
|
|
53
|
-
function isXaiBillingHostname(host) {
|
|
54
|
-
return host === "grok.com" || host.endsWith(".grok.com");
|
|
55
|
-
}
|
|
56
|
-
function validateXAIEndpoint(url, field) {
|
|
57
|
-
let parsed;
|
|
58
|
-
try {
|
|
59
|
-
parsed = new URL(url);
|
|
60
|
-
} catch {
|
|
61
|
-
throw new OAuthError(`Invalid xAI ${field}: ${url}`, {
|
|
62
|
-
kind: "validation",
|
|
63
|
-
provider: "xai"
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (parsed.protocol !== "https:") throw new OAuthError(`Invalid xAI ${field}: ${url}`, {
|
|
67
|
-
kind: "validation",
|
|
68
|
-
provider: "xai"
|
|
69
|
-
});
|
|
70
|
-
const host = parsed.hostname.toLowerCase();
|
|
71
|
-
if (!host || !isXaiAuthHostname(host)) throw new OAuthError(`Invalid xAI ${field}: ${url}`, {
|
|
72
|
-
kind: "validation",
|
|
73
|
-
provider: "xai"
|
|
74
|
-
});
|
|
75
|
-
return url;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Pin SuperGrok billing URLs to HTTPS `grok.com` / `*.grok.com`.
|
|
79
|
-
* The CLI billing proxy is intentionally not on `*.x.ai`.
|
|
80
|
-
*/
|
|
81
|
-
function validateXAIBillingEndpoint(url, field = "billing_url") {
|
|
82
|
-
let parsed;
|
|
83
|
-
try {
|
|
84
|
-
parsed = new URL(url);
|
|
85
|
-
} catch {
|
|
86
|
-
throw new OAuthError(`Invalid xAI ${field}: ${url}`, {
|
|
87
|
-
kind: "validation",
|
|
88
|
-
provider: "xai"
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
if (parsed.protocol !== "https:") throw new OAuthError(`Invalid xAI ${field}: ${url}`, {
|
|
92
|
-
kind: "validation",
|
|
93
|
-
provider: "xai"
|
|
94
|
-
});
|
|
95
|
-
const host = parsed.hostname.toLowerCase();
|
|
96
|
-
if (!host || !isXaiBillingHostname(host)) throw new OAuthError(`Invalid xAI ${field}: ${url}`, {
|
|
97
|
-
kind: "validation",
|
|
98
|
-
provider: "xai"
|
|
99
|
-
});
|
|
100
|
-
return url;
|
|
101
|
-
}
|
|
102
|
-
/** Fetch xAI's OIDC discovery document and validate the token endpoint. */
|
|
103
|
-
async function xaiOAuthDiscovery(timeoutMs = DISCOVERY_TIMEOUT_MS, fetchOverride) {
|
|
104
|
-
const fetchImpl = fetchOverride ?? fetch;
|
|
105
|
-
let response;
|
|
106
|
-
try {
|
|
107
|
-
response = await fetchImpl(XAI_OAUTH_DISCOVERY_URL, {
|
|
108
|
-
method: "GET",
|
|
109
|
-
headers: { Accept: "application/json" },
|
|
110
|
-
signal: AbortSignal.timeout(timeoutMs)
|
|
111
|
-
});
|
|
112
|
-
} catch (error) {
|
|
113
|
-
throw new OAuthError(`xAI OIDC discovery failed: ${error instanceof Error ? error.message : String(error)}`, {
|
|
114
|
-
kind: "discovery",
|
|
115
|
-
provider: "xai",
|
|
116
|
-
cause: error
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
if (response.status !== 200) throw new OAuthError(`xAI OIDC discovery returned status ${response.status}.`, {
|
|
120
|
-
kind: "discovery",
|
|
121
|
-
provider: "xai",
|
|
122
|
-
status: response.status
|
|
123
|
-
});
|
|
124
|
-
let payload;
|
|
125
|
-
try {
|
|
126
|
-
payload = await response.json();
|
|
127
|
-
} catch (error) {
|
|
128
|
-
throw new OAuthError(`xAI OIDC discovery returned invalid JSON: ${error instanceof Error ? error.message : String(error)}`, {
|
|
129
|
-
kind: "validation",
|
|
130
|
-
provider: "xai",
|
|
131
|
-
cause: error
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
if (!isRecord(payload)) throw new OAuthError("xAI OIDC discovery response was not a JSON object.", {
|
|
135
|
-
kind: "validation",
|
|
136
|
-
provider: "xai"
|
|
137
|
-
});
|
|
138
|
-
const tokenEndpoint = typeof payload.token_endpoint === "string" ? payload.token_endpoint.trim() : "";
|
|
139
|
-
if (!tokenEndpoint) throw new OAuthError("xAI OIDC discovery response was missing token_endpoint.", {
|
|
140
|
-
kind: "validation",
|
|
141
|
-
provider: "xai"
|
|
142
|
-
});
|
|
143
|
-
validateXAIEndpoint(tokenEndpoint, "token_endpoint");
|
|
144
|
-
return { token_endpoint: tokenEndpoint };
|
|
145
|
-
}
|
|
146
|
-
/** Decode an xAI access-token JWT payload without verifying its signature. */
|
|
147
|
-
function parseXAIAccessTokenPayload(jwt) {
|
|
148
|
-
try {
|
|
149
|
-
if (typeof jwt !== "string" || !jwt.includes(".")) return null;
|
|
150
|
-
const parts = jwt.split(".");
|
|
151
|
-
if (parts.length < 2) return null;
|
|
152
|
-
const payloadPart = parts[1];
|
|
153
|
-
if (!payloadPart) return null;
|
|
154
|
-
const decoded = Buffer.from(payloadPart, "base64url").toString("utf8");
|
|
155
|
-
const payload = JSON.parse(decoded);
|
|
156
|
-
return isRecord(payload) && !Array.isArray(payload) ? payload : null;
|
|
157
|
-
} catch {
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
/** Extract the stable xAI subject UUID from an access token. */
|
|
162
|
-
function extractXAIAccessTokenSubject(jwt) {
|
|
163
|
-
const sub = parseXAIAccessTokenPayload(jwt)?.sub;
|
|
164
|
-
return typeof sub === "string" && sub.trim() ? sub.trim() : void 0;
|
|
165
|
-
}
|
|
166
|
-
/** Fetch optional OIDC userinfo for a valid xAI access token. */
|
|
167
|
-
async function fetchXAIOAuthIdentity(accessToken, fetchOverride, signal) {
|
|
168
|
-
const token = accessToken.trim();
|
|
169
|
-
if (!token) return null;
|
|
170
|
-
const fetchImpl = fetchOverride ?? fetch;
|
|
171
|
-
try {
|
|
172
|
-
const response = await fetchImpl(XAI_OAUTH_USERINFO_URL, {
|
|
173
|
-
method: "GET",
|
|
174
|
-
headers: {
|
|
175
|
-
Authorization: `Bearer ${token}`,
|
|
176
|
-
Accept: "application/json"
|
|
177
|
-
},
|
|
178
|
-
redirect: "error",
|
|
179
|
-
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(DISCOVERY_TIMEOUT_MS)]) : AbortSignal.timeout(DISCOVERY_TIMEOUT_MS)
|
|
180
|
-
});
|
|
181
|
-
if (!response.ok) return null;
|
|
182
|
-
const payload = await response.json();
|
|
183
|
-
if (!isRecord(payload) || Array.isArray(payload)) return null;
|
|
184
|
-
const sub = typeof payload.sub === "string" && payload.sub.trim() ? payload.sub.trim() : void 0;
|
|
185
|
-
const email = typeof payload.email === "string" && payload.email.trim() ? payload.email.trim() : void 0;
|
|
186
|
-
const name = typeof payload.name === "string" && payload.name.trim() ? payload.name.trim() : void 0;
|
|
187
|
-
if (!sub && !email && !name) return null;
|
|
188
|
-
return {
|
|
189
|
-
...sub ? { accountId: sub } : {},
|
|
190
|
-
...email ? { email: email.toLowerCase() } : {},
|
|
191
|
-
...name ? { name } : {}
|
|
192
|
-
};
|
|
193
|
-
} catch {
|
|
194
|
-
return null;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
async function withXAIOAuthIdentity(credentials, fetchOverride, signal) {
|
|
198
|
-
const identity = await fetchXAIOAuthIdentity(credentials.access, fetchOverride, signal);
|
|
199
|
-
const accountId = identity?.accountId ?? credentials.accountId ?? extractXAIAccessTokenSubject(credentials.access);
|
|
200
|
-
const email = identity?.email ?? credentials.email;
|
|
201
|
-
return {
|
|
202
|
-
...credentials,
|
|
203
|
-
...accountId ? { accountId } : {},
|
|
204
|
-
...email ? { email } : {}
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
/** Build the SuperGrok CLI billing URL. Pass `""` to omit `format` (unified monthly payload). */
|
|
208
|
-
function buildXAICliBillingUrl(format = XAI_CLI_BILLING_FORMAT) {
|
|
209
|
-
const url = new URL(XAI_CLI_BILLING_PATH, XAI_CLI_BILLING_BASE_URL);
|
|
210
|
-
if (format) url.searchParams.set("format", format);
|
|
211
|
-
return validateXAIBillingEndpoint(url.toString());
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Headers for SuperGrok CLI billing (`cli-chat-proxy.grok.com`).
|
|
215
|
-
* Official Grok CLI also sends `X-XAI-Token-Auth: xai-grok-cli` on this host;
|
|
216
|
-
* include it so billing stays on the same product gate as chat inference.
|
|
217
|
-
*/
|
|
218
|
-
function getXAICliBillingHeaders(options) {
|
|
219
|
-
return {
|
|
220
|
-
Authorization: `Bearer ${options.accessToken}`,
|
|
221
|
-
Accept: "application/json",
|
|
222
|
-
"X-XAI-Token-Auth": "xai-grok-cli"
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
function parseXAIDeviceAuthorization(payload) {
|
|
226
|
-
if (!isRecord(payload)) throw new OAuthError("xAI device-code response was not a JSON object.", {
|
|
227
|
-
kind: "validation",
|
|
228
|
-
provider: "xai"
|
|
229
|
-
});
|
|
230
|
-
const deviceCode = typeof payload.device_code === "string" ? payload.device_code.trim() : "";
|
|
231
|
-
const userCode = typeof payload.user_code === "string" ? payload.user_code.trim() : "";
|
|
232
|
-
const verificationUri = typeof payload.verification_uri === "string" ? payload.verification_uri.trim() : "";
|
|
233
|
-
const verificationUriComplete = typeof payload.verification_uri_complete === "string" ? payload.verification_uri_complete.trim() : "";
|
|
234
|
-
const expiresInSeconds = payload.expires_in;
|
|
235
|
-
const intervalSeconds = payload.interval;
|
|
236
|
-
if (!deviceCode || !userCode || !verificationUri || !verificationUriComplete || typeof expiresInSeconds !== "number" || !Number.isFinite(expiresInSeconds) || expiresInSeconds <= 0 || typeof intervalSeconds !== "number" || !Number.isFinite(intervalSeconds) || intervalSeconds <= 0) throw new OAuthError("xAI device-code response missing or invalid required fields.", {
|
|
237
|
-
kind: "validation",
|
|
238
|
-
provider: "xai"
|
|
239
|
-
});
|
|
240
|
-
validateXAIEndpoint(verificationUri, "verification_uri");
|
|
241
|
-
validateXAIEndpoint(verificationUriComplete, "verification_uri_complete");
|
|
242
|
-
return {
|
|
243
|
-
deviceCode,
|
|
244
|
-
userCode,
|
|
245
|
-
verificationUriComplete,
|
|
246
|
-
expiresInSeconds,
|
|
247
|
-
intervalSeconds
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
function parseXAITokenResponse(payload, label, refreshTokenFallback) {
|
|
251
|
-
if (!isRecord(payload)) throw new OAuthError(`${label} was not a JSON object`, {
|
|
252
|
-
kind: "validation",
|
|
253
|
-
provider: "xai"
|
|
254
|
-
});
|
|
255
|
-
const accessToken = typeof payload.access_token === "string" ? payload.access_token : "";
|
|
256
|
-
const refreshToken = (typeof payload.refresh_token === "string" ? payload.refresh_token : "") || refreshTokenFallback || "";
|
|
257
|
-
const expiresInSeconds = payload.expires_in;
|
|
258
|
-
if (!accessToken) throw new OAuthError(`${label} missing access_token`, {
|
|
259
|
-
kind: "validation",
|
|
260
|
-
provider: "xai"
|
|
261
|
-
});
|
|
262
|
-
if (!refreshToken) throw new OAuthError(`${label} missing refresh_token`, {
|
|
263
|
-
kind: "validation",
|
|
264
|
-
provider: "xai"
|
|
265
|
-
});
|
|
266
|
-
if (typeof expiresInSeconds !== "number" || !Number.isFinite(expiresInSeconds)) throw new OAuthError(`${label} missing expires_in`, {
|
|
267
|
-
kind: "validation",
|
|
268
|
-
provider: "xai"
|
|
269
|
-
});
|
|
270
|
-
return {
|
|
271
|
-
access: accessToken,
|
|
272
|
-
refresh: refreshToken,
|
|
273
|
-
expires: Date.now() + expiresInSeconds * 1e3 - ACCESS_TOKEN_CLIENT_SKEW_MS
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
async function requestXAIDeviceAuthorization(fetchImpl, signal) {
|
|
277
|
-
let response;
|
|
278
|
-
try {
|
|
279
|
-
const timeoutSignal = AbortSignal.timeout(TOKEN_REQUEST_TIMEOUT_MS);
|
|
280
|
-
response = await fetchImpl(XAI_OAUTH_DEVICE_CODE_URL, {
|
|
281
|
-
method: "POST",
|
|
282
|
-
headers: {
|
|
283
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
284
|
-
Accept: "application/json"
|
|
285
|
-
},
|
|
286
|
-
body: new URLSearchParams({
|
|
287
|
-
client_id: XAI_OAUTH_CLIENT_ID,
|
|
288
|
-
scope: XAI_OAUTH_SCOPE
|
|
289
|
-
}),
|
|
290
|
-
signal: signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal
|
|
291
|
-
});
|
|
292
|
-
} catch (error) {
|
|
293
|
-
if (signal?.aborted) throw new LoginCancelledError();
|
|
294
|
-
throw new OAuthError(`xAI device-code request failed: ${error instanceof Error ? error.message : String(error)}`, {
|
|
295
|
-
kind: "device-auth",
|
|
296
|
-
provider: "xai",
|
|
297
|
-
cause: error
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
if (!response.ok) {
|
|
301
|
-
let detail = "";
|
|
302
|
-
try {
|
|
303
|
-
detail = (await response.text()).trim();
|
|
304
|
-
} catch {}
|
|
305
|
-
throw new OAuthError(`xAI device-code request failed: ${response.status}${detail ? ` ${detail}` : ""}`, {
|
|
306
|
-
kind: "device-auth",
|
|
307
|
-
provider: "xai",
|
|
308
|
-
status: response.status
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
let payload;
|
|
312
|
-
try {
|
|
313
|
-
payload = await response.json();
|
|
314
|
-
} catch (error) {
|
|
315
|
-
throw new OAuthError(`xAI device-code response returned invalid JSON: ${error instanceof Error ? error.message : String(error)}`, {
|
|
316
|
-
kind: "validation",
|
|
317
|
-
provider: "xai",
|
|
318
|
-
cause: error
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
return parseXAIDeviceAuthorization(payload);
|
|
322
|
-
}
|
|
323
|
-
async function pollXAIDeviceToken(tokenEndpoint, deviceCode, fetchImpl, signal) {
|
|
324
|
-
let response;
|
|
325
|
-
try {
|
|
326
|
-
const timeoutSignal = AbortSignal.timeout(TOKEN_REQUEST_TIMEOUT_MS);
|
|
327
|
-
response = await fetchImpl(tokenEndpoint, {
|
|
328
|
-
method: "POST",
|
|
329
|
-
headers: {
|
|
330
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
331
|
-
Accept: "application/json"
|
|
332
|
-
},
|
|
333
|
-
body: new URLSearchParams({
|
|
334
|
-
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
335
|
-
client_id: XAI_OAUTH_CLIENT_ID,
|
|
336
|
-
device_code: deviceCode
|
|
337
|
-
}),
|
|
338
|
-
redirect: "error",
|
|
339
|
-
signal: signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal
|
|
340
|
-
});
|
|
341
|
-
} catch (error) {
|
|
342
|
-
if (signal?.aborted) throw new LoginCancelledError();
|
|
343
|
-
throw new OAuthError(`xAI device-code token polling failed: ${error instanceof Error ? error.message : String(error)}`, {
|
|
344
|
-
kind: "polling",
|
|
345
|
-
provider: "xai",
|
|
346
|
-
cause: error
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
let payload;
|
|
350
|
-
try {
|
|
351
|
-
payload = await response.json();
|
|
352
|
-
} catch (error) {
|
|
353
|
-
throw new OAuthError(`xAI device-code token polling returned invalid JSON: ${error instanceof Error ? error.message : String(error)}`, {
|
|
354
|
-
kind: "polling",
|
|
355
|
-
provider: "xai",
|
|
356
|
-
status: response.status,
|
|
357
|
-
cause: error
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
if (response.ok) return {
|
|
361
|
-
status: "complete",
|
|
362
|
-
value: parseXAITokenResponse(payload, "xAI device-code token response")
|
|
363
|
-
};
|
|
364
|
-
if (!isRecord(payload)) throw new OAuthError(`xAI device-code token polling failed: ${response.status}`, {
|
|
365
|
-
kind: "polling",
|
|
366
|
-
provider: "xai",
|
|
367
|
-
status: response.status
|
|
368
|
-
});
|
|
369
|
-
const errorCode = typeof payload.error === "string" ? payload.error : "";
|
|
370
|
-
if (errorCode === "authorization_pending") return { status: "pending" };
|
|
371
|
-
if (errorCode === "slow_down") return { status: "slow_down" };
|
|
372
|
-
const detail = (typeof payload.error_description === "string" ? payload.error_description : "") || errorCode || String(response.status);
|
|
373
|
-
throw new OAuthError(`xAI device-code token polling failed: ${detail}`, {
|
|
374
|
-
kind: "polling",
|
|
375
|
-
provider: "xai",
|
|
376
|
-
status: response.status
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
/** Log in to xAI Grok with the RFC 8628 device authorization grant. */
|
|
380
|
-
async function loginXAIOAuth(ctrl) {
|
|
381
|
-
const fetchImpl = ctrl.fetch ?? fetch;
|
|
382
|
-
const discovery = await xaiOAuthDiscovery(DISCOVERY_TIMEOUT_MS, fetchImpl);
|
|
383
|
-
const device = await requestXAIDeviceAuthorization(fetchImpl, ctrl.signal);
|
|
384
|
-
ctrl.onAuth?.({
|
|
385
|
-
url: device.verificationUriComplete,
|
|
386
|
-
instructions: `Enter code: ${device.userCode}`
|
|
387
|
-
});
|
|
388
|
-
ctrl.onProgress?.("Waiting for xAI device authorization...");
|
|
389
|
-
return withXAIOAuthIdentity(await pollOAuthDeviceCodeFlow({
|
|
390
|
-
poll: () => pollXAIDeviceToken(discovery.token_endpoint, device.deviceCode, fetchImpl, ctrl.signal),
|
|
391
|
-
intervalSeconds: device.intervalSeconds,
|
|
392
|
-
expiresInSeconds: device.expiresInSeconds,
|
|
393
|
-
signal: ctrl.signal
|
|
394
|
-
}), fetchImpl, ctrl.signal);
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Refresh an xAI OAuth access token using a stored refresh_token.
|
|
398
|
-
*
|
|
399
|
-
* Re-runs OIDC discovery and re-validates the token endpoint before sending
|
|
400
|
-
* the stored refresh token.
|
|
401
|
-
*/
|
|
402
|
-
async function refreshXAIOAuthToken(refreshToken, fetchOverride) {
|
|
403
|
-
const fetchImpl = fetchOverride ?? fetch;
|
|
404
|
-
if (typeof refreshToken !== "string" || !refreshToken.trim()) throw new OAuthError("missing refresh_token", {
|
|
405
|
-
kind: "validation",
|
|
406
|
-
provider: "xai"
|
|
407
|
-
});
|
|
408
|
-
const response = await fetchImpl(validateXAIEndpoint((await xaiOAuthDiscovery(DISCOVERY_TIMEOUT_MS, fetchImpl)).token_endpoint, "token_endpoint"), {
|
|
409
|
-
method: "POST",
|
|
410
|
-
headers: {
|
|
411
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
412
|
-
Accept: "application/json"
|
|
413
|
-
},
|
|
414
|
-
body: new URLSearchParams({
|
|
415
|
-
grant_type: "refresh_token",
|
|
416
|
-
client_id: XAI_OAUTH_CLIENT_ID,
|
|
417
|
-
refresh_token: refreshToken
|
|
418
|
-
}),
|
|
419
|
-
redirect: "error",
|
|
420
|
-
signal: AbortSignal.timeout(TOKEN_REQUEST_TIMEOUT_MS)
|
|
421
|
-
});
|
|
422
|
-
if (!response.ok) {
|
|
423
|
-
let detail = "";
|
|
424
|
-
try {
|
|
425
|
-
detail = (await response.text()).trim();
|
|
426
|
-
} catch {}
|
|
427
|
-
throw new OAuthError(`xAI token refresh failed: ${response.status}${detail ? ` ${detail}` : ""}`, {
|
|
428
|
-
kind: "token-refresh",
|
|
429
|
-
provider: "xai",
|
|
430
|
-
status: response.status
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
let payload;
|
|
434
|
-
try {
|
|
435
|
-
payload = await response.json();
|
|
436
|
-
} catch (error) {
|
|
437
|
-
throw new OAuthError(`xAI token refresh returned invalid JSON: ${error instanceof Error ? error.message : String(error)}`, {
|
|
438
|
-
kind: "validation",
|
|
439
|
-
provider: "xai",
|
|
440
|
-
cause: error
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
return withXAIOAuthIdentity(parseXAITokenResponse(payload, "xAI token refresh response", refreshToken), fetchImpl);
|
|
444
|
-
}
|
|
445
|
-
//#endregion
|
|
446
|
-
export { xai_oauth_exports as a, getXAICliBillingHeaders as i, extractXAIAccessTokenSubject as n, fetchXAIOAuthIdentity as r, buildXAICliBillingUrl as t };
|