@xopcai/xopc 0.0.162 → 0.0.164
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/README.md +4 -2
- package/README.zh-CN.md +4 -2
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-hpcNv9MZ.js → activity-store-DkALQFJT.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Zf9UQEmQ.js → agent-avatar-dicebear-RpxkQtQ3.js} +1 -1
- package/dist/gateway/static/root/assets/agents-CxpwxMPE.js +2 -0
- package/dist/gateway/static/root/assets/{api-Dnatri09.js → api-DPIXEcIq.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BBTR9wJP.js → app-management-settings-panel-DLdjfMXB.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C2zpLCHD.js → appearance-settings-C89-uxkq.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-k-tZbaRB.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-9eR_ODY1.js → archive-plugin-CqbH5geE.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DPuWYUeX.js → attachment-load-CeU4Qiot.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-Dw49OJRl.js → automation-suggestion-card-WiOuqXq9.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-Bdn3dgC_.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BdkJpDFm.js → binary-plugins-C5TdzrhJ.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CAi7SXYU.js → block-editor-BjvWhphG.js} +39 -39
- package/dist/gateway/static/root/assets/browser-settings-page-GsVTGfGs.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-Dx6wkGz1.js → browser-workflow-inputs-DXmzQ3nk.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-Skertc-A.js → browser-workflows-page-C1-ptRe4.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-6d4kVjzl.js +2 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-CNFl7dM3.js → capability-presets-api-C0pVlUyc.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DCxy5Ls_.js +2 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-DYQyGDw4.js → channel-recipient-api-B5rLegwk.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Bg3P8k0f.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-DZZq0upi.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-Bng6kxYF.js → connector-logo-CuI5w4qM.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-6UR7yhIZ.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-Bpf6oegd.js → desktop-pet-BvG8vDXZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BVUyefSd.js → desktop-pet-settings-CR__kZ8C.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DjSZAPz_.js → directory-picker-path-field-BblWMz3e.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-CAZk2AM4.js → dreaming-settings-DHMPugDE.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-C2F6vTTd.js → extension-debug-page-ByVY1gZg.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-AnIt4bn4.js → extension-page-DLCKKtbK.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-M-rhlFBC.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-DLFyZv33.js → gateway-config-api-DZHqhbXH.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DnQAA-qq.js → gateway-settings-CZswIehx.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DbzLyJ3R.js → gateway-startup-retry-ulwTJovP.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-TbyRfDas.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-B-QBVOf2.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-REmr3QCr.js → goals-config-api-DMxG6f0N.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BGxki8BR.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-Dz0F3uRO.js → goals-settings-G-w1gCYD.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CQFY5gYs.js → heartbeat-settings-Csb90R59.js} +1 -1
- package/dist/gateway/static/root/assets/index-BXtJvaQl.css +1 -0
- package/dist/gateway/static/root/assets/{index-C8JkTS6d.js → index-CGwuxvzr.js} +70 -70
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BnOQXU5k.js → keyboard-shortcuts-settings-C_Bl3YOr.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BR2tBhO3.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-KsOtWOyM.js → local-apps-page-_8Rv-tSk.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-0lpYdNDr.js → locale-store-C_ax27uc.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CwF0C_Z2.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-D5GRg10r.js → markdown-split-CZnZS6gq.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C1ryULGs.js → media-plugins-C2XLYC6G.js} +1 -1
- package/dist/gateway/static/root/assets/messages-C96Zjb0V.js +5 -0
- package/dist/gateway/static/root/assets/{notes-page-CIeZ1_DT.js → notes-page-BkuZxTFo.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-CD4FADi7.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-Caj1-E_X.js → page-tabs-DR2FGC4E.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DKwEce-9.js → preview-open-alternatives-B65O8wBL.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-B90ZskkN.js → product-open-page-Cag-utLH.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-COKtUblD.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-QYmqanBN.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BU_gBU0f.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BDYt53uQ.js → save-bar-controls-DCWpFnPc.js} +1 -1
- package/dist/gateway/static/root/assets/schedule-field-ClacZdvE.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-D7oCARF7.js → schema-form-BVlbEipU.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-u-Pjbzfm.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-1Yck1PKq.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-CARTHCxH.js → settings-form-section-GSNlQWSW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DEwYqESe.js → settings-loading-skeleton-08Ae5sB_.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B6vVdHeQ.js → settings-page-BseJD4I-.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-D3srt5Bi.js → settings-page-layout-bSliH-Y3.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CGRhJVlt.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-Ck9SxiXw.js → share-preview-page-C114OpTx.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BRFpWFgI.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-cVjU2GnN.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CoMTjtRT.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DLBUQSk2.js → system-settings-panel-El8cDcTY.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-C1oaqeD2.js → theme-store-D37XLD_C.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-CU7hhD8T.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-Divbg_C4.js → typed-models-lib-kToxD7Rc.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CP9a_rAf.js → use-channel-catalog-DBh0dOC9.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-C0xYCSXB.js +1 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-DzEpwYaU.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-DakZqR85.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-CswqPbTT.js +1 -0
- package/dist/gateway/static/root/assets/work-page-DYRXEk8m.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DbDPYQwB.js → workflow-run-setup-panel-BwSxyVMM.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CiLSYGuN.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/client-error-format.d.ts +1 -1
- package/dist/src/agent/client-error-format.js +6 -2
- package/dist/src/agent/embedded/model-runtime.d.ts +4 -0
- package/dist/src/agent/embedded/model-runtime.js +49 -0
- package/dist/src/agent/embedded/run-for-session.js +38 -31
- package/dist/src/agent/embedded/session-runner.d.ts +1 -0
- package/dist/src/agent/embedded/session-runner.js +13 -5
- package/dist/src/agent/failover-error.d.ts +1 -1
- package/dist/src/agent/image/generation/openai-compatible-image-provider.d.ts +2 -6
- package/dist/src/agent/image/generation/openai-compatible-image-provider.js +1 -3
- package/dist/src/agent/image/generation/provider-registry.d.ts +5 -46
- package/dist/src/agent/image/generation/provider-registry.js +24 -73
- package/dist/{extensions/dashscope/src/image-generation-provider.d.ts → src/agent/image/generation/providers/dashscope.d.ts} +3 -6
- package/dist/{extensions/dashscope/src/image-generation-provider.js → src/agent/image/generation/providers/dashscope.js} +36 -59
- package/dist/{extensions/fal/src/image-generation-provider.d.ts → src/agent/image/generation/providers/fal.d.ts} +1 -1
- package/dist/{extensions/fal/src/image-generation-provider.js → src/agent/image/generation/providers/fal.js} +19 -29
- package/dist/{extensions/google/src/image-generation-provider.d.ts → src/agent/image/generation/providers/google.d.ts} +2 -2
- package/dist/{extensions/google/src/image-generation-provider.js → src/agent/image/generation/providers/google.js} +23 -30
- package/dist/{extensions/minimax/src/image-generation-provider.d.ts → src/agent/image/generation/providers/minimax.d.ts} +2 -5
- package/dist/{extensions/minimax/src/image-generation-provider.js → src/agent/image/generation/providers/minimax.js} +35 -51
- package/dist/{extensions/openai/src/image-generation-provider.d.ts → src/agent/image/generation/providers/openai.d.ts} +2 -2
- package/dist/{extensions/openai/src/image-generation-provider.js → src/agent/image/generation/providers/openai.js} +13 -38
- package/dist/src/agent/image/generation/runtime-types.d.ts +1 -0
- package/dist/src/agent/image/generation/runtime.d.ts +1 -3
- package/dist/src/agent/image/generation/runtime.js +6 -6
- package/dist/src/agent/image/generation/types.d.ts +23 -3
- package/dist/src/agent/image/index.d.ts +1 -1
- package/dist/src/agent/image/index.js +2 -2
- package/dist/src/agent/media-generation/runtime-shared.d.ts +2 -0
- package/dist/src/agent/media-generation/runtime-shared.js +1 -0
- package/dist/src/agent/tools/factory.js +4 -1
- package/dist/src/agent/tools/image-generate-tool.d.ts +2 -0
- package/dist/src/agent/tools/image-generate-tool.js +14 -7
- package/dist/src/auth/credentials.js +45 -2
- package/dist/src/auth/index.js +2 -1
- package/dist/src/auth/oauth/anthropic.js +27 -24
- package/dist/src/auth/oauth/github-copilot.js +20 -15
- package/dist/src/auth/oauth/google-antigravity.js +9 -2
- package/dist/src/auth/oauth/google-gemini-cli.js +9 -2
- package/dist/src/auth/oauth/google-oauth/google-antigravity.js +47 -40
- package/dist/src/auth/oauth/google-oauth/google-gemini-cli.js +48 -41
- package/dist/src/auth/oauth/google-oauth/oauth-page.js +7 -2
- package/dist/src/auth/oauth/google-oauth/pkce.js +4 -1
- package/dist/src/auth/oauth/index.d.ts +2 -0
- package/dist/src/auth/oauth/index.js +24 -10
- package/dist/src/auth/oauth/kimi-coding.js +76 -71
- package/dist/src/auth/oauth/minimax-cn.js +78 -73
- package/dist/src/auth/oauth/minimax.js +78 -73
- package/dist/src/auth/oauth/openai-codex.js +31 -25
- package/dist/src/auth/oauth/pkce.js +4 -1
- package/dist/src/auth/oauth/registry.d.ts +13 -0
- package/dist/src/auth/oauth/registry.js +65 -0
- package/dist/src/auth/oauth/xopc-cloud.d.ts +2 -0
- package/dist/src/auth/oauth/xopc-cloud.js +101 -0
- package/dist/src/auth/sync-provider-auth.d.ts +3 -0
- package/dist/src/auth/sync-provider-auth.js +17 -1
- package/dist/src/cli/commands/models.js +2 -5
- package/dist/src/cli/commands/onboard/model.js +3 -2
- package/dist/src/cli/commands/setup-shared/types.d.ts +1 -1
- package/dist/src/cli/utils/oauth-providers.d.ts +3 -26
- package/dist/src/cli/utils/oauth-providers.js +6 -80
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/models-json.d.ts +6 -0
- package/dist/src/config/models-json.js +10 -6
- package/dist/src/config/schema.d.ts +26 -15
- package/dist/src/config/schema.js +23 -12
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +12 -6
- package/dist/src/gateway/hono/lib/safe-providers-config.d.ts +0 -3
- package/dist/src/gateway/hono/lib/safe-providers-config.js +1 -3
- package/dist/src/gateway/hono/middleware/strict-rate-limit.d.ts +4 -0
- package/dist/src/gateway/hono/middleware/strict-rate-limit.js +8 -1
- package/dist/src/gateway/hono/oauth-async.js +3 -19
- package/dist/src/gateway/hono/oauth.js +3 -19
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -11
- package/dist/src/gateway/hono/routes/deps.d.ts +1 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +9 -2
- package/dist/src/gateway/hono/routes/models.js +96 -128
- package/dist/src/gateway/image-generation-setup.d.ts +40 -0
- package/dist/src/gateway/image-generation-setup.js +130 -0
- package/dist/src/gateway/rate-limit/buckets.d.ts +3 -0
- package/dist/src/gateway/rate-limit/buckets.js +12 -0
- package/dist/src/gateway/service.d.ts +3 -0
- package/dist/src/gateway/service.js +10 -0
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/media-shared/http/private-network.d.ts +1 -1
- package/dist/src/media-shared/http/private-network.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-api-key.d.ts +2 -4
- package/dist/src/providers/auth-runtime/resolve-api-key.js +2 -4
- package/dist/src/providers/auth-runtime/resolve-auth.d.ts +3 -4
- package/dist/src/providers/auth-runtime/resolve-auth.js +18 -18
- package/dist/src/providers/domestic-presets.d.ts +2 -0
- package/dist/src/providers/index.js +9 -0
- package/dist/src/providers/model-catalog-store.d.ts +33 -0
- package/dist/src/providers/model-catalog-store.js +63 -0
- package/dist/src/providers/model-catalog-sync-service.d.ts +40 -0
- package/dist/src/providers/model-catalog-sync-service.js +132 -0
- package/dist/src/providers/model-reference-auditor.d.ts +14 -0
- package/dist/src/providers/model-reference-auditor.js +71 -0
- package/dist/src/providers/model-registry.d.ts +4 -1
- package/dist/src/providers/model-registry.js +33 -2
- package/dist/src/providers/presentation.js +2 -0
- package/dist/src/providers/xopc-cloud-model-source.d.ts +30 -0
- package/dist/src/providers/xopc-cloud-model-source.js +68 -0
- package/dist/src/session/index.d.ts +1 -1
- package/dist/src/session/index.js +2 -2
- package/dist/src/session/session-title.d.ts +2 -0
- package/dist/src/session/session-title.js +24 -3
- package/dist/src/work-discovery/analyzer.js +27 -14
- package/package.json +5 -7
- package/dist/extensions/dashscope/src/index.d.ts +0 -4
- package/dist/extensions/dashscope/src/index.js +0 -2
- package/dist/extensions/dashscope/xopc.extension.json +0 -15
- package/dist/extensions/fal/src/index.d.ts +0 -4
- package/dist/extensions/fal/src/index.js +0 -2
- package/dist/extensions/fal/xopc.extension.json +0 -14
- package/dist/extensions/google/src/index.d.ts +0 -4
- package/dist/extensions/google/src/index.js +0 -2
- package/dist/extensions/google/xopc.extension.json +0 -14
- package/dist/extensions/minimax/src/index.d.ts +0 -4
- package/dist/extensions/minimax/src/index.js +0 -2
- package/dist/extensions/minimax/xopc.extension.json +0 -15
- package/dist/extensions/openai/src/index.d.ts +0 -4
- package/dist/extensions/openai/src/index.js +0 -2
- package/dist/extensions/openai/xopc.extension.json +0 -14
- package/dist/gateway/static/root/assets/agents-DfVkZlHc.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-BMtAa4Ra.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-BiSAMYTr.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DHmaEJS2.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B5wSgf4f.js +0 -2
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DyvFZwBj.js +0 -2
- package/dist/gateway/static/root/assets/channels-settings-BBKEqDZn.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-Drk110ve.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-HpgaUDQ1.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-CLSc6682.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-DrnKFC6M.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-Cw1hpJkZ.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-BDGkTVma.js +0 -2
- package/dist/gateway/static/root/assets/index-hmrG55qg.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Bdef1b7F.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CwLPgrWh.js +0 -7
- package/dist/gateway/static/root/assets/messages-BwQ3WssU.js +0 -5
- package/dist/gateway/static/root/assets/notes-workbench-Cf06q19x.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-SHTurM4t.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BcC2qUAw.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-6vGefBHv.js +0 -1
- package/dist/gateway/static/root/assets/schedule-field-Bcdni4Pj.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-C5014a53.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDY3ZI1K.js +0 -1
- package/dist/gateway/static/root/assets/settings-collapsible-section-6eNF8Jey.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-z-rF0Hdg.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CHZFXE_d.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B7p2QNXt.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-ncw3tX9P.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-iYfeSLKI.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-CrwkicvT.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BQWxyPg8.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-50ZzGay5.js +0 -1
- package/dist/gateway/static/root/assets/work-page-DPqEahx7.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-C3eIC5HZ.js +0 -11
- package/dist/src/agent/embedded/xopc-auth-storage.d.ts +0 -19
- package/dist/src/agent/embedded/xopc-auth-storage.js +0 -40
- package/dist/src/agent/image/generation/bundled-registry.d.ts +0 -18
- package/dist/src/agent/image/generation/bundled-registry.js +0 -35
- package/dist/src/agent/image/generation/bundled.d.ts +0 -10
- package/dist/src/agent/image/generation/bundled.js +0 -15
- package/dist/src/agent/image/generation/image-provider-ui.d.ts +0 -20
- package/dist/src/agent/image/generation/image-provider-ui.js +0 -1
- package/dist/src/gateway/image-capabilities.d.ts +0 -28
- package/dist/src/gateway/image-capabilities.js +0 -78
- package/dist/src/generated/bundled-image-generation-providers.d.ts +0 -14
- package/dist/src/generated/bundled-image-generation-providers.js +0 -17
|
@@ -7,7 +7,6 @@ import "../../media-generation/index.js";
|
|
|
7
7
|
import { parseImageGenerationModelRef } from "./model-ref.js";
|
|
8
8
|
import { resolveImageGenerationOverrides } from "./normalization.js";
|
|
9
9
|
import { getImageGenerationProvider, listImageGenerationProviders, listImageGenerationProvidersSummary as listImageGenerationProvidersSummary$1 } from "./provider-registry.js";
|
|
10
|
-
import "./bundled.js";
|
|
11
10
|
//#region src/agent/image/generation/runtime.ts
|
|
12
11
|
init_env_keys();
|
|
13
12
|
init_logger();
|
|
@@ -24,6 +23,7 @@ async function generateImage(params, deps = {}) {
|
|
|
24
23
|
modelConfig: params.modelConfig,
|
|
25
24
|
modelOverride: params.modelOverride,
|
|
26
25
|
parseModelRef: parseImageGenerationModelRef,
|
|
26
|
+
agentId: params.agentId,
|
|
27
27
|
agentDir: params.agentDir,
|
|
28
28
|
listProviders: (cfg) => listProviders(cfg).map(toCapabilityCandidate),
|
|
29
29
|
autoProviderFallback: params.autoProviderFallback
|
|
@@ -119,8 +119,8 @@ async function generateImage(params, deps = {}) {
|
|
|
119
119
|
lastError
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
function listImageGenerationProvidersSummary(
|
|
123
|
-
return listImageGenerationProvidersSummary$1(
|
|
122
|
+
function listImageGenerationProvidersSummary() {
|
|
123
|
+
return listImageGenerationProvidersSummary$1();
|
|
124
124
|
}
|
|
125
125
|
function buildProviderRequest(input) {
|
|
126
126
|
const { provider, candidate, params, sanitized } = input;
|
|
@@ -130,6 +130,7 @@ function buildProviderRequest(input) {
|
|
|
130
130
|
model: candidate.model,
|
|
131
131
|
prompt: params.prompt,
|
|
132
132
|
...params.cfg ? { cfg: params.cfg } : {},
|
|
133
|
+
...params.agentId ? { agentId: params.agentId } : {},
|
|
133
134
|
...params.agentDir ? { agentDir: params.agentDir } : {},
|
|
134
135
|
...params.authStore ? { authStore: params.authStore } : {},
|
|
135
136
|
...typeof params.timeoutMs === "number" ? { timeoutMs: params.timeoutMs } : {},
|
|
@@ -156,9 +157,8 @@ function cloneInputImages(images) {
|
|
|
156
157
|
function toCapabilityCandidate(provider) {
|
|
157
158
|
return {
|
|
158
159
|
id: provider.id,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
models: provider.models ?? [],
|
|
160
|
+
defaultModel: provider.defaultModel,
|
|
161
|
+
models: provider.models,
|
|
162
162
|
isConfigured: provider.isConfigured
|
|
163
163
|
};
|
|
164
164
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Config } from '../../../config/schema.js';
|
|
2
2
|
import type { AuthProfileStore } from '../../../providers/auth-runtime/index.js';
|
|
3
3
|
import type { MediaNormalizationEntry } from '../../media-generation/normalization.types.js';
|
|
4
|
-
export type { ImageGenerationProvider, ImageGenerationProviderConfiguredContext, ImageGenerationProviderSummary, } from './provider-registry.js';
|
|
5
|
-
export type { ImageProviderUiBaseUrlPreset, ImageProviderUiMetadata, ImageProviderUiPresetKind, ImageProviderUiRegionOption, } from './image-provider-ui.js';
|
|
6
4
|
export type ImageGenerationResolution = '1K' | '2K' | '4K';
|
|
7
5
|
export type ImageGenerationQuality = 'low' | 'medium' | 'high' | 'auto';
|
|
8
6
|
export type ImageGenerationOutputFormat = 'png' | 'jpeg' | 'webp';
|
|
@@ -45,6 +43,27 @@ export interface ImageGenerationProviderCapabilities {
|
|
|
45
43
|
geometry?: ImageGenerationGeometryCapability;
|
|
46
44
|
output?: ImageGenerationOutputCapability;
|
|
47
45
|
}
|
|
46
|
+
export interface ImageGenerationProviderConfiguredContext {
|
|
47
|
+
cfg?: Config;
|
|
48
|
+
agentId?: string;
|
|
49
|
+
agentDir?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ImageGenerationProvider {
|
|
52
|
+
id: string;
|
|
53
|
+
label: string;
|
|
54
|
+
defaultModel: string;
|
|
55
|
+
models: string[];
|
|
56
|
+
capabilities: ImageGenerationProviderCapabilities;
|
|
57
|
+
isConfigured(ctx: ImageGenerationProviderConfiguredContext): boolean;
|
|
58
|
+
generateImage(req: ImageGenerationRequest): Promise<ImageGenerationResult>;
|
|
59
|
+
}
|
|
60
|
+
export interface ImageGenerationProviderSummary {
|
|
61
|
+
id: string;
|
|
62
|
+
label: string;
|
|
63
|
+
defaultModel: string;
|
|
64
|
+
models: string[];
|
|
65
|
+
capabilities: ImageGenerationProviderCapabilities;
|
|
66
|
+
}
|
|
48
67
|
export interface ImageGenerationOpenAIOptions {
|
|
49
68
|
background?: ImageGenerationBackground;
|
|
50
69
|
moderation?: 'low' | 'auto';
|
|
@@ -58,7 +77,7 @@ export interface GeneratedImageAsset {
|
|
|
58
77
|
buffer: Buffer;
|
|
59
78
|
mimeType: string;
|
|
60
79
|
fileName?: string;
|
|
61
|
-
/** Provider-side prompt rewrite
|
|
80
|
+
/** Provider-side prompt rewrite. */
|
|
62
81
|
revisedPrompt?: string;
|
|
63
82
|
/** Vendor-private metadata. Not surfaced to the LLM context directly. */
|
|
64
83
|
metadata?: Record<string, unknown>;
|
|
@@ -84,6 +103,7 @@ export interface ImageGenerationRequest {
|
|
|
84
103
|
model: string;
|
|
85
104
|
prompt: string;
|
|
86
105
|
cfg?: Config;
|
|
106
|
+
agentId?: string;
|
|
87
107
|
agentDir?: string;
|
|
88
108
|
authStore?: AuthProfileStore;
|
|
89
109
|
timeoutMs?: number;
|
|
@@ -12,6 +12,6 @@ export type { ImageAttempt } from './image-model-fallback.js';
|
|
|
12
12
|
export type { ToolModelConfig } from './tool-model-config.js';
|
|
13
13
|
export { resolveImageModelConfigForTool } from './tool-model-config.js';
|
|
14
14
|
export { generateImage, listImageGenerationProvidersSummary, type GenerateImageParams, type GenerateImageRuntimeResult, } from './generation/runtime.js';
|
|
15
|
-
export {
|
|
15
|
+
export { getImageGenerationProvider, listImageGenerationProviders, type ImageGenerationProvider, } from './generation/provider-registry.js';
|
|
16
16
|
export type { ImageGenerationSourceImage, ImageGenerationProviderCapabilities, } from './generation/types.js';
|
|
17
17
|
export { modelSupportsVision, resolveImageHandlingStrategy, type ImageHandlingStrategy, } from './vision-detection.js';
|
|
@@ -3,7 +3,7 @@ import { resolveImageModelConfigForTool } from "./tool-model-config.js";
|
|
|
3
3
|
import { describeImages, describeImagesWithFallback } from "./understanding/runtime.js";
|
|
4
4
|
import { runWithImageModelFallback } from "./image-model-fallback.js";
|
|
5
5
|
import { loadImageForToolInput } from "./load-image-media.js";
|
|
6
|
-
import { getImageGenerationProvider, listImageGenerationProviders
|
|
6
|
+
import { getImageGenerationProvider, listImageGenerationProviders } from "./generation/provider-registry.js";
|
|
7
7
|
import { generateImage, listImageGenerationProvidersSummary } from "./generation/runtime.js";
|
|
8
8
|
import { modelSupportsVision, resolveImageHandlingStrategy } from "./vision-detection.js";
|
|
9
|
-
export { describeImages, describeImagesWithFallback, generateImage, getImageGenerationProvider, getImageUnderstandingProvider, listImageGenerationProviders, listImageGenerationProvidersSummary, listImageUnderstandingProviders, loadImageForToolInput, modelSupportsVision,
|
|
9
|
+
export { describeImages, describeImagesWithFallback, generateImage, getImageGenerationProvider, getImageUnderstandingProvider, listImageGenerationProviders, listImageGenerationProvidersSummary, listImageUnderstandingProviders, loadImageForToolInput, modelSupportsVision, registerImageUnderstandingProvider, resolveImageHandlingStrategy, resolveImageModelConfigForTool, runWithImageModelFallback };
|
|
@@ -18,6 +18,7 @@ export interface CapabilityProviderCandidate {
|
|
|
18
18
|
models?: readonly string[];
|
|
19
19
|
isConfigured?: (ctx: {
|
|
20
20
|
cfg?: Config;
|
|
21
|
+
agentId?: string;
|
|
21
22
|
agentDir?: string;
|
|
22
23
|
}) => boolean;
|
|
23
24
|
}
|
|
@@ -32,6 +33,7 @@ export interface ResolveCapabilityModelCandidatesParams {
|
|
|
32
33
|
modelOverride?: string;
|
|
33
34
|
/** Optional ref parser; defaults to {@link parseCapabilityModelRef}. */
|
|
34
35
|
parseModelRef?: (raw: string | undefined) => ParsedCapabilityModelRef | null;
|
|
36
|
+
agentId?: string;
|
|
35
37
|
agentDir?: string;
|
|
36
38
|
/** Snapshot of registered providers used to enumerate fallbacks. */
|
|
37
39
|
listProviders: (cfg?: Config) => CapabilityProviderCandidate[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
|
|
3
4
|
import { createReadFileTool } from "./read.js";
|
|
4
5
|
import { createWriteFileTool } from "./write.js";
|
|
5
6
|
import { createListDirTool } from "./list-dir.js";
|
|
@@ -56,6 +57,7 @@ import { getAgentCapabilityToolNames } from "../capabilities/registry.js";
|
|
|
56
57
|
import "../capabilities/index.js";
|
|
57
58
|
import { isCodeIntelligenceEnabledForAgent } from "../code-intelligence/tool-gating.js";
|
|
58
59
|
//#region src/agent/tools/factory.ts
|
|
60
|
+
init_agent_scope();
|
|
59
61
|
init_logger();
|
|
60
62
|
const log = createLogger("AgentToolsFactory");
|
|
61
63
|
/** Channels where `clarify` can block for a user answer (web UI, Telegram, CLI readline). */
|
|
@@ -173,7 +175,8 @@ var AgentToolsFactory = class {
|
|
|
173
175
|
});
|
|
174
176
|
const imageGenerateTool = createImageGenerateTool({
|
|
175
177
|
config: cfg,
|
|
176
|
-
workspace
|
|
178
|
+
workspace,
|
|
179
|
+
agentId: options?.agentId ?? (cfg ? resolveDefaultAgentId(cfg) : "main")
|
|
177
180
|
});
|
|
178
181
|
const codeIntelligenceConfig = cfg?.codeIntelligence;
|
|
179
182
|
const agentId = options?.agentId;
|
|
@@ -5,8 +5,10 @@ import type { ToolModelConfig } from '../image/tool-model-config.js';
|
|
|
5
5
|
export { parseImageDataUrl };
|
|
6
6
|
export declare function resolveImageGenerationModelConfigForTool(params: {
|
|
7
7
|
cfg?: Config;
|
|
8
|
+
agentId: string;
|
|
8
9
|
}): ToolModelConfig | null;
|
|
9
10
|
export declare function createImageGenerateTool(options: {
|
|
10
11
|
config?: Config;
|
|
11
12
|
workspace: string;
|
|
13
|
+
agentId: string;
|
|
12
14
|
}): AgentTool<any, Record<string, unknown>> | null;
|
|
@@ -37,7 +37,7 @@ const ALLOWED_RESOLUTIONS = [
|
|
|
37
37
|
const ImageGenerateToolSchema = Type.Object({
|
|
38
38
|
action: Type.Optional(Type.String({ description: "Optional: \"generate\" (default) or \"list\" available image-generation providers." })),
|
|
39
39
|
prompt: Type.Optional(Type.String({ description: "Image generation prompt." })),
|
|
40
|
-
model: Type.Optional(Type.String({ description: "Optional provider/model override, e.g. openai/gpt-image-
|
|
40
|
+
model: Type.Optional(Type.String({ description: "Optional provider/model override, e.g. openai/gpt-image-2 / dashscope/wan2.7-image-pro / minimax/image-01." })),
|
|
41
41
|
filename: Type.Optional(Type.String({ description: "Optional basename hint for saved files." })),
|
|
42
42
|
size: Type.Optional(Type.String({ description: "Optional pixel size, e.g. 1024x1024." })),
|
|
43
43
|
aspectRatio: Type.Optional(Type.String({ description: "Optional aspect ratio, e.g. 16:9 / 9:16 / 1:1." })),
|
|
@@ -126,20 +126,23 @@ async function loadInputImages(params) {
|
|
|
126
126
|
return out;
|
|
127
127
|
}
|
|
128
128
|
function resolveImageGenerationModelConfigForTool(params) {
|
|
129
|
-
const explicit = params.cfg ? getAgentDefaultImageGenerationModelConfig(params.cfg) : void 0;
|
|
129
|
+
const explicit = params.cfg ? getAgentDefaultImageGenerationModelConfig(params.cfg, params.agentId) : void 0;
|
|
130
130
|
if (explicit?.primary?.trim()) return {
|
|
131
131
|
primary: explicit.primary.trim(),
|
|
132
132
|
...explicit.fallbacks?.length ? { fallbacks: explicit.fallbacks } : {},
|
|
133
133
|
...explicit.timeoutMs ? { timeoutMs: explicit.timeoutMs } : {},
|
|
134
134
|
...explicit.autoProviderFallback ? { autoProviderFallback: true } : {}
|
|
135
135
|
};
|
|
136
|
-
const providers = listImageGenerationProvidersSummary(
|
|
136
|
+
const providers = listImageGenerationProvidersSummary();
|
|
137
137
|
const candidates = [];
|
|
138
138
|
for (const providerSummary of providers) {
|
|
139
|
-
const provider = getImageGenerationProvider(providerSummary.id
|
|
139
|
+
const provider = getImageGenerationProvider(providerSummary.id);
|
|
140
140
|
let configured = false;
|
|
141
141
|
try {
|
|
142
|
-
configured = provider?.isConfigured?.({
|
|
142
|
+
configured = provider?.isConfigured?.({
|
|
143
|
+
cfg: params.cfg,
|
|
144
|
+
agentId: params.agentId
|
|
145
|
+
}) ?? false;
|
|
143
146
|
} catch {
|
|
144
147
|
configured = false;
|
|
145
148
|
}
|
|
@@ -169,7 +172,10 @@ async function saveGeneratedImages(params) {
|
|
|
169
172
|
return out;
|
|
170
173
|
}
|
|
171
174
|
function createImageGenerateTool(options) {
|
|
172
|
-
const imageGenerationModelConfig = resolveImageGenerationModelConfigForTool({
|
|
175
|
+
const imageGenerationModelConfig = resolveImageGenerationModelConfigForTool({
|
|
176
|
+
cfg: options.config,
|
|
177
|
+
agentId: options.agentId
|
|
178
|
+
});
|
|
173
179
|
if (!imageGenerationModelConfig) return null;
|
|
174
180
|
const effectiveCfg = applyImageGenerationModelConfigDefaults(options.config, imageGenerationModelConfig) ?? options.config;
|
|
175
181
|
return {
|
|
@@ -181,7 +187,7 @@ function createImageGenerateTool(options) {
|
|
|
181
187
|
const params = args;
|
|
182
188
|
const action = (readStringParam(params, "action") || "generate").toLowerCase();
|
|
183
189
|
if (action === "list") {
|
|
184
|
-
const providers = listImageGenerationProvidersSummary(
|
|
190
|
+
const providers = listImageGenerationProvidersSummary();
|
|
185
191
|
return {
|
|
186
192
|
content: [{
|
|
187
193
|
type: "text",
|
|
@@ -234,6 +240,7 @@ function createImageGenerateTool(options) {
|
|
|
234
240
|
try {
|
|
235
241
|
const result = await generateImage({
|
|
236
242
|
cfg: effectiveCfg,
|
|
243
|
+
agentId: options.agentId,
|
|
237
244
|
modelConfig: imageGenerationModelConfig,
|
|
238
245
|
prompt,
|
|
239
246
|
...modelOverride ? { modelOverride } : {},
|
|
@@ -3,6 +3,7 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
4
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
|
|
5
5
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
6
|
+
import { getOAuthProviderDefinition, init_registry } from "./oauth/registry.js";
|
|
6
7
|
import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
|
|
7
8
|
import { dirname, join } from "path";
|
|
8
9
|
import { mkdir, readFile, readdir, rm } from "fs/promises";
|
|
@@ -18,14 +19,16 @@ async function resolveApiKey(provider, options) {
|
|
|
18
19
|
async function hasCredentials(provider, options) {
|
|
19
20
|
return getCredentialResolver(options).hasCredentials(provider);
|
|
20
21
|
}
|
|
21
|
-
var log, warnedExpiredOAuthTokens, CredentialResolver, defaultResolver;
|
|
22
|
+
var log, warnedExpiredOAuthTokens, oauthRefreshes, CredentialResolver, defaultResolver;
|
|
22
23
|
var init_credentials = __esmMin((() => {
|
|
23
24
|
init_write_file_atomic();
|
|
24
25
|
init_logger();
|
|
25
26
|
init_env_keys();
|
|
26
27
|
init_paths();
|
|
28
|
+
init_registry();
|
|
27
29
|
log = createLogger("Credentials");
|
|
28
30
|
warnedExpiredOAuthTokens = /* @__PURE__ */ new Set();
|
|
31
|
+
oauthRefreshes = /* @__PURE__ */ new Map();
|
|
29
32
|
CredentialResolver = class {
|
|
30
33
|
credentialsDir;
|
|
31
34
|
agentId;
|
|
@@ -42,6 +45,7 @@ var init_credentials = __esmMin((() => {
|
|
|
42
45
|
*/
|
|
43
46
|
async resolveApiKey(provider) {
|
|
44
47
|
const normalizedProvider = provider.toLowerCase();
|
|
48
|
+
if (getOAuthProviderDefinition(normalizedProvider)?.oauthOnly) return (await this.loadOAuthToken(normalizedProvider))?.access ?? null;
|
|
45
49
|
if (this.agentId) {
|
|
46
50
|
const agentKey = await this.loadFromAgentCredentials(normalizedProvider);
|
|
47
51
|
if (agentKey) {
|
|
@@ -89,6 +93,7 @@ var init_credentials = __esmMin((() => {
|
|
|
89
93
|
*/
|
|
90
94
|
async resolveApiKeySource(provider) {
|
|
91
95
|
const normalizedProvider = provider.toLowerCase();
|
|
96
|
+
if (getOAuthProviderDefinition(normalizedProvider)?.oauthOnly) return await this.loadOAuthToken(normalizedProvider) ? "oauth" : null;
|
|
92
97
|
if (this.agentId) {
|
|
93
98
|
if (await this.loadFromAgentCredentials(normalizedProvider)) return "agent";
|
|
94
99
|
}
|
|
@@ -132,6 +137,7 @@ var init_credentials = __esmMin((() => {
|
|
|
132
137
|
*/
|
|
133
138
|
async saveApiKey(provider, key, options = {}) {
|
|
134
139
|
const normalizedProvider = provider.toLowerCase();
|
|
140
|
+
if (getOAuthProviderDefinition(normalizedProvider)?.oauthOnly) throw new Error(`${normalizedProvider} only supports OAuth credentials`);
|
|
135
141
|
const profileId = options.profileName ? `${normalizedProvider}:${options.profileName}` : `${normalizedProvider}:default`;
|
|
136
142
|
const profile = {
|
|
137
143
|
type: "api_key",
|
|
@@ -165,7 +171,44 @@ var init_credentials = __esmMin((() => {
|
|
|
165
171
|
async loadOAuthToken(provider) {
|
|
166
172
|
const token = await this.loadOAuthTokenRecord(provider);
|
|
167
173
|
if (!token) return null;
|
|
168
|
-
|
|
174
|
+
const expiresAt = token.expiresAt ?? Number.POSITIVE_INFINITY;
|
|
175
|
+
if (expiresAt <= Date.now() + 6e4 && token.refresh) {
|
|
176
|
+
const definition = getOAuthProviderDefinition(provider);
|
|
177
|
+
if (definition) {
|
|
178
|
+
let pending = oauthRefreshes.get(provider);
|
|
179
|
+
if (!pending) {
|
|
180
|
+
pending = definition.provider.refreshToken({
|
|
181
|
+
access: token.access,
|
|
182
|
+
refresh: token.refresh,
|
|
183
|
+
expires: expiresAt
|
|
184
|
+
}).then(async (refreshed) => {
|
|
185
|
+
const updated = {
|
|
186
|
+
...token,
|
|
187
|
+
access: definition.provider.getApiKey(refreshed),
|
|
188
|
+
refresh: refreshed.refresh,
|
|
189
|
+
expiresAt: refreshed.expires,
|
|
190
|
+
scope: Array.isArray(refreshed.scope) ? refreshed.scope.filter((value) => typeof value === "string") : token.scope,
|
|
191
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
192
|
+
};
|
|
193
|
+
await this.saveOAuthToken(provider, updated);
|
|
194
|
+
return updated;
|
|
195
|
+
}).finally(() => oauthRefreshes.delete(provider));
|
|
196
|
+
oauthRefreshes.set(provider, pending);
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
return await pending;
|
|
200
|
+
} catch (err) {
|
|
201
|
+
if (expiresAt > Date.now()) {
|
|
202
|
+
log.warn({
|
|
203
|
+
err,
|
|
204
|
+
provider
|
|
205
|
+
}, "OAuth refresh failed; using the current access token");
|
|
206
|
+
return token;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (expiresAt <= Date.now()) {
|
|
169
212
|
const warnKey = `${provider}:${token.expiresAt}`;
|
|
170
213
|
if (!warnedExpiredOAuthTokens.has(warnKey)) {
|
|
171
214
|
warnedExpiredOAuthTokens.add(warnKey);
|
package/dist/src/auth/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { anthropicOAuthProvider, init_anthropic } from "./oauth/anthropic.js";
|
|
1
2
|
import { CredentialResolver, getCredentialResolver, hasCredentials, init_credentials, resolveApiKey } from "./credentials.js";
|
|
2
|
-
import { anthropicOAuthProvider } from "./oauth/anthropic.js";
|
|
3
3
|
//#region src/auth/index.ts
|
|
4
4
|
init_credentials();
|
|
5
|
+
init_anthropic();
|
|
5
6
|
//#endregion
|
|
6
7
|
export { CredentialResolver, anthropicOAuthProvider, getCredentialResolver, hasCredentials, resolveApiKey };
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { generatePKCE, init_pkce } from "./pkce.js";
|
|
2
3
|
//#region src/auth/oauth/anthropic.ts
|
|
3
|
-
/**
|
|
4
|
-
* Anthropic OAuth flow (Claude Pro/Max)
|
|
5
|
-
*/
|
|
6
|
-
const decode = (s) => atob(s);
|
|
7
|
-
const CLIENT_ID = decode("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl");
|
|
8
|
-
const AUTHORIZE_URL = "https://claude.ai/oauth/authorize";
|
|
9
|
-
const TOKEN_URL = "https://console.anthropic.com/v1/oauth/token";
|
|
10
|
-
const REDIRECT_URI = "https://console.anthropic.com/oauth/code/callback";
|
|
11
|
-
const SCOPES = "org:create_api_key user:profile user:inference";
|
|
12
4
|
async function loginAnthropic(onAuthUrl, onPromptCode) {
|
|
13
5
|
const { verifier, challenge } = await generatePKCE();
|
|
14
6
|
onAuthUrl(`${AUTHORIZE_URL}?${new URLSearchParams({
|
|
@@ -69,18 +61,29 @@ async function refreshAnthropicToken(refreshToken) {
|
|
|
69
61
|
expires: Date.now() + data.expires_in * 1e3 - 300 * 1e3
|
|
70
62
|
};
|
|
71
63
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
64
|
+
var decode, CLIENT_ID, AUTHORIZE_URL, TOKEN_URL, REDIRECT_URI, SCOPES, anthropicOAuthProvider;
|
|
65
|
+
var init_anthropic = __esmMin((() => {
|
|
66
|
+
init_pkce();
|
|
67
|
+
decode = (s) => atob(s);
|
|
68
|
+
CLIENT_ID = decode("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl");
|
|
69
|
+
AUTHORIZE_URL = "https://claude.ai/oauth/authorize";
|
|
70
|
+
TOKEN_URL = "https://console.anthropic.com/v1/oauth/token";
|
|
71
|
+
REDIRECT_URI = "https://console.anthropic.com/oauth/code/callback";
|
|
72
|
+
SCOPES = "org:create_api_key user:profile user:inference";
|
|
73
|
+
anthropicOAuthProvider = {
|
|
74
|
+
id: "anthropic",
|
|
75
|
+
name: "Anthropic (Claude Pro/Max)",
|
|
76
|
+
async login(callbacks) {
|
|
77
|
+
return loginAnthropic((url) => callbacks.onAuth({ url }), () => callbacks.onPrompt({ message: "Paste the authorization code:" }));
|
|
78
|
+
},
|
|
79
|
+
async refreshToken(credentials) {
|
|
80
|
+
return refreshAnthropicToken(credentials.refresh);
|
|
81
|
+
},
|
|
82
|
+
getApiKey(credentials) {
|
|
83
|
+
return credentials.access;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}));
|
|
85
87
|
//#endregion
|
|
86
|
-
|
|
88
|
+
init_anthropic();
|
|
89
|
+
export { anthropicOAuthProvider, init_anthropic, loginAnthropic, refreshAnthropicToken };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
1
2
|
import { githubCopilotProvider } from "@earendil-works/pi-ai/providers/github-copilot";
|
|
2
3
|
//#region src/auth/oauth/github-copilot.ts
|
|
3
4
|
/** GitHub Copilot OAuth adapter for pi-ai's provider-auth API. */
|
|
@@ -46,19 +47,23 @@ function toAuthInteraction(callbacks) {
|
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
50
|
+
var githubCopilotOAuthProvider;
|
|
51
|
+
var init_github_copilot = __esmMin((() => {
|
|
52
|
+
githubCopilotOAuthProvider = {
|
|
53
|
+
id: "github-copilot",
|
|
54
|
+
name: "GitHub Copilot",
|
|
55
|
+
usesCallbackServer: false,
|
|
56
|
+
async login(callbacks) {
|
|
57
|
+
return fromPiCredential(await getCopilotOAuth().login(toAuthInteraction(callbacks)));
|
|
58
|
+
},
|
|
59
|
+
async refreshToken(credentials) {
|
|
60
|
+
return fromPiCredential(await getCopilotOAuth().refresh(toPiCredential(credentials)));
|
|
61
|
+
},
|
|
62
|
+
getApiKey(credentials) {
|
|
63
|
+
return credentials.access;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}));
|
|
63
67
|
//#endregion
|
|
64
|
-
|
|
68
|
+
init_github_copilot();
|
|
69
|
+
export { githubCopilotOAuthProvider, init_github_copilot };
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { antigravityOAuthProvider, init_google_antigravity as init_google_antigravity$1, loginAntigravity, refreshAntigravityToken } from "./google-oauth/google-antigravity.js";
|
|
3
|
+
//#region src/auth/oauth/google-antigravity.ts
|
|
4
|
+
var init_google_antigravity = __esmMin((() => {
|
|
5
|
+
init_google_antigravity$1();
|
|
6
|
+
}));
|
|
7
|
+
//#endregion
|
|
8
|
+
init_google_antigravity();
|
|
9
|
+
export { antigravityOAuthProvider as googleAntigravityOAuthProvider, init_google_antigravity, loginAntigravity, refreshAntigravityToken };
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { geminiCliOAuthProvider, init_google_gemini_cli as init_google_gemini_cli$1, loginGeminiCli, refreshGoogleCloudToken } from "./google-oauth/google-gemini-cli.js";
|
|
3
|
+
//#region src/auth/oauth/google-gemini-cli.ts
|
|
4
|
+
var init_google_gemini_cli = __esmMin((() => {
|
|
5
|
+
init_google_gemini_cli$1();
|
|
6
|
+
}));
|
|
7
|
+
//#endregion
|
|
8
|
+
init_google_gemini_cli();
|
|
9
|
+
export { geminiCliOAuthProvider as googleGeminiCliOAuthProvider, init_google_gemini_cli, loginGeminiCli, refreshGoogleCloudToken };
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { __esmMin } from "../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { init_oauth_page, oauthErrorHtml, oauthSuccessHtml } from "./oauth-page.js";
|
|
3
|
+
import { generatePKCE, init_pkce } from "./pkce.js";
|
|
3
4
|
//#region src/auth/oauth/google-oauth/google-antigravity.ts
|
|
4
|
-
let _createServer = null;
|
|
5
|
-
let _httpImportPromise = null;
|
|
6
|
-
if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) _httpImportPromise = import("node:http").then((m) => {
|
|
7
|
-
_createServer = m.createServer;
|
|
8
|
-
});
|
|
9
|
-
const ANTIGRAVITY_CLIENT_ID_ENV = "XOPC_GOOGLE_ANTIGRAVITY_OAUTH_CLIENT_ID";
|
|
10
|
-
const ANTIGRAVITY_CLIENT_SECRET_ENV = "XOPC_GOOGLE_ANTIGRAVITY_OAUTH_CLIENT_SECRET";
|
|
11
5
|
/** Desktop OAuth client for this flow — must be set locally (not committed; avoids GitHub push protection). */
|
|
12
6
|
function getAntigravityOAuthClient() {
|
|
13
7
|
const clientId = process.env[ANTIGRAVITY_CLIENT_ID_ENV]?.trim();
|
|
@@ -18,16 +12,6 @@ function getAntigravityOAuthClient() {
|
|
|
18
12
|
clientSecret
|
|
19
13
|
};
|
|
20
14
|
}
|
|
21
|
-
const REDIRECT_URI = "http://localhost:51121/oauth-callback";
|
|
22
|
-
const SCOPES = [
|
|
23
|
-
"https://www.googleapis.com/auth/cloud-platform",
|
|
24
|
-
"https://www.googleapis.com/auth/userinfo.email",
|
|
25
|
-
"https://www.googleapis.com/auth/userinfo.profile",
|
|
26
|
-
"https://www.googleapis.com/auth/cclog",
|
|
27
|
-
"https://www.googleapis.com/auth/experimentsandconfigs"
|
|
28
|
-
];
|
|
29
|
-
const AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
30
|
-
const TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
31
15
|
/**
|
|
32
16
|
* Start a local HTTP server to receive the OAuth callback
|
|
33
17
|
*/
|
|
@@ -278,25 +262,48 @@ async function loginAntigravity(onAuth, onProgress, onManualCodeInput) {
|
|
|
278
262
|
server.server.close();
|
|
279
263
|
}
|
|
280
264
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
265
|
+
var _createServer, _httpImportPromise, ANTIGRAVITY_CLIENT_ID_ENV, ANTIGRAVITY_CLIENT_SECRET_ENV, REDIRECT_URI, SCOPES, AUTH_URL, TOKEN_URL, antigravityOAuthProvider;
|
|
266
|
+
var init_google_antigravity = __esmMin((() => {
|
|
267
|
+
init_oauth_page();
|
|
268
|
+
init_pkce();
|
|
269
|
+
_createServer = null;
|
|
270
|
+
_httpImportPromise = null;
|
|
271
|
+
if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) _httpImportPromise = import("node:http").then((m) => {
|
|
272
|
+
_createServer = m.createServer;
|
|
273
|
+
});
|
|
274
|
+
ANTIGRAVITY_CLIENT_ID_ENV = "XOPC_GOOGLE_ANTIGRAVITY_OAUTH_CLIENT_ID";
|
|
275
|
+
ANTIGRAVITY_CLIENT_SECRET_ENV = "XOPC_GOOGLE_ANTIGRAVITY_OAUTH_CLIENT_SECRET";
|
|
276
|
+
REDIRECT_URI = "http://localhost:51121/oauth-callback";
|
|
277
|
+
SCOPES = [
|
|
278
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
|
279
|
+
"https://www.googleapis.com/auth/userinfo.email",
|
|
280
|
+
"https://www.googleapis.com/auth/userinfo.profile",
|
|
281
|
+
"https://www.googleapis.com/auth/cclog",
|
|
282
|
+
"https://www.googleapis.com/auth/experimentsandconfigs"
|
|
283
|
+
];
|
|
284
|
+
AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
285
|
+
TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
286
|
+
antigravityOAuthProvider = {
|
|
287
|
+
id: "google-antigravity",
|
|
288
|
+
name: "Antigravity (Gemini 3, Claude, GPT-OSS)",
|
|
289
|
+
usesCallbackServer: true,
|
|
290
|
+
async login(callbacks) {
|
|
291
|
+
return loginAntigravity(callbacks.onAuth, callbacks.onProgress, callbacks.onManualCodeInput);
|
|
292
|
+
},
|
|
293
|
+
async refreshToken(credentials) {
|
|
294
|
+
const creds = credentials;
|
|
295
|
+
if (!creds.projectId) throw new Error("Antigravity credentials missing projectId");
|
|
296
|
+
return refreshAntigravityToken(creds.refresh, creds.projectId);
|
|
297
|
+
},
|
|
298
|
+
getApiKey(credentials) {
|
|
299
|
+
const creds = credentials;
|
|
300
|
+
return JSON.stringify({
|
|
301
|
+
token: creds.access,
|
|
302
|
+
projectId: creds.projectId
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
}));
|
|
301
307
|
//#endregion
|
|
302
|
-
|
|
308
|
+
init_google_antigravity();
|
|
309
|
+
export { antigravityOAuthProvider, init_google_antigravity, loginAntigravity, refreshAntigravityToken };
|