@xopcai/xopc 0.0.372 → 0.0.373
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/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-BQ3PMp2q.js → activity-store-BeYLqqr8.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D4iAZErG.js → agent-avatar-dicebear--kDkSTqC.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-z4_2-Kn2.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BYB0G2aF.js → agent-plugin-dialog-BYndK83K.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-D0JBkZPV.js → agents-CVo96cx1.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-HBZvVyzF.js → agents-admin-api-B4tgTbWG.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C1tQxHaP.js → app-management-settings-panel-D9oOJKiH.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BfavIBbb.js → appearance-settings-B0-8Cdyv.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-CUS5S1qa.js → apps-page-DasVc6i4.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BO3I9zRP.js → archive-plugin-bI9OLnXj.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-iY0KMPSa.js → automations-page-BlCNqy2i.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-LQsa5ohY.js → automations-workspace-C8ipDP05.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-gFD7vH9R.js → binary-plugins-dOwLzjeH.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Cft0fd_O.js → block-editor-Cktlez6g.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-DxRoKFun.js → browser-automation-inputs-i7h1Svpf.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-C6EWx_Y4.js → browser-automations-page-KRfDl8ej.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CKlt_8IS.js → browser-settings-page-BraQ4wnh.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-CY4SiHcP.js → capabilities-CquUV0DP.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-gjQtMhKu.js → capabilities-D4KFLtqM.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-UrQ8EY_o.js → capabilities-page-B3m8xGzd.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-C9HIr2CZ.js → capabilities-settings-panel-VQ4fHuBV.js} +6 -6
- package/dist/gateway/static/root/assets/{capability-header-actions-uxIiW_2_.js → capability-header-actions-f5Ido4Eg.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-By3dmQ4Y.js → channels-N4Vc2nEG.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DeDTSl64.js → chat-terminal-dock-BwvTKwsn.js} +1 -1
- package/dist/gateway/static/root/assets/cloud-credits-BMYMiiNn.js +1 -0
- package/dist/gateway/static/root/assets/{computer-settings-page-Cw1Z1epy.js → computer-settings-page-CAwUsKpw.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-D664WEhj.js → connector-service-page-C0HuAMuH.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-sjyjY7Fl.js → connectors-page-BcBmW8JT.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-BVmFrPfX.js → date-picker-DiQxRpe-.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-YIoP-e5-.js → dependency-picker-Ds0_BJbN.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CzS468vR.js → desktop-pet-ZMEOYwrR.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BPcgZUcK.js → desktop-pet-settings-DkyTqD07.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-Cgba-4m9.js → device-pairing-wizard-CvaI5ZJZ.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-_nHmZtnY.js → directory-picker-path-field-Bfv93eK1.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-IIky9Iqr.js → extension-debug-page-CbgEonkK.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C-7ngTTj.js → extension-page-JXKGtIdM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-VFWspV08.js → extension-provider-DxlAZ2iy.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-_hovFCWi.js → extension-settings-page-lsQ2xvbr.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-CUHrPpGV.js → fallback-models-7bG0AND1.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-7RKqgU_U.js → gateway-config-swr-BoRkBnsw.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-BwX_fHUS.js → gateway-realtime-C3WQQY10.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-cLCDEe4D.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-sbaOzlEH.js → gateway-settings-BpbcoPx9.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-jiV5sbEX.js → gateway-startup-retry-TYSQEQcG.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-DjquRIFR.js → home-page-BxctC0aJ.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-DO4mXb6I.js → image-generation-api-_pKiNfSq.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-xWWIeT_t.js → imports-page-Bq8CazCb.js} +1 -1
- package/dist/gateway/static/root/assets/{index-BWDK2eIj.js → index-B40-KDN8.js} +7 -7
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DWazrDgz.js → keyboard-shortcuts-settings-kkAevkl2.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CkxDdlYU.js → local-app-workbench-page-abLaf1hW.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BISZ4bi5.js → local-apps-page-nwsnwYjK.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-pox8evDV.js → local-session-drafts-Cg9RdsNN.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-COVscAqC.js → locale-store-rWFLl-p4.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-GiCulc9k.js → logs-page-BEgYS-Xg.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-GUpOcTqa.js → management-settings-D_JQ6_X0.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-B_qnAcW2.js → markdown-view-BHFFusQs.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C0Pc-wSY.js → media-plugins-BVPTMWJI.js} +1 -1
- package/dist/gateway/static/root/assets/messages-C1SUo4gG.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-cache-Jj8dvYcv.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-CqealmSc.js → note-detail-panel-CCnfurBR.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-api-sBgBcyLW.js → notes-api-CSLVCZBn.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BtTU5mnS.js → notes-page-D9u_znxM.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-Yt-BpPRh.js → page-context-capture-button-BO3FoRej.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-C8SEQpEu.js → personal-page-BJn6UHAF.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-etM6Ijfe.js → product-open-page-Dso2_hyl.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-C6aeRrWe.js → product-preview-content-CkvVb3EA.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-K4ASOTki.js → project-detail-page-UjrrzE3H.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-BssImjwl.js → projects-page-C1h63P2M.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-Bh9UBb-f.js → registry-api-CoMBYjHD.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BznC_5H0.js → remote-access-hub-BJifH8AB.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BJAzqQik.js → runtime-tools-settings-panel-vG1wqcEb.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-uZUXm03X.js → scenes-page-CwoAoYMX.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-SA3Ld7zf.js → schema-form-BIsHdyz7.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-Di3Q846r.js → send-session-input-CLhR1uEp.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-yjpEz4pP.js → session-api-u_4_kFQt.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-CWjhJxJs.js → session-manager-B06ZCie_.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-DdL8zVrF.js → sessions-page-BcCLp3yU.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D114UdRI.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-CUJQMNF7.js → settings-page-z9Jlk0BL.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BGBWC0Bc.js → setup-status-panel-CrpXECqe.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-HCHM8qnf.js → share-link-dialog-XhiuPKF4.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DJmyACyp.js → share-preview-page-Vc0TQuZ8.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-c0dfWz6h.js → shares-api-BVSb1vh4.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BzqcGh7W.js → shares-settings-D9XpTJXP.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-9XSn7R8L.js → skill-api-DtPOf1aW.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-Ge5XymHa.js → skill-reload-api-BsLx_FXd.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DwyDfh9g.js → skills-page-Bq9-2b9U.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-B6axBPLO.js → system-settings-panel-P7T729uD.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-ftCTqBDB.js → task-detail-page-CsB9AFx6.js} +1 -1
- package/dist/gateway/static/root/assets/{task-expandable-content-hYcgCEE3.js → task-expandable-content-DxeBTJvh.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BOfCKgl6.js → theme-store-KcQhCg1-.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-DDWFXcST.js → tracing-settings-page-DJRAP3nb.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-BYU2v0im.js → tunnel-api-CuowqIZ7.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-avX3msoZ.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-CSckcjFx.js → use-autosave-C-IWxbzm.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-OFlldkKg.js → use-composer-attachments-Dxphaxk-.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-BF1TeNXP.js → use-file-preview-expanded-Du37Gofn.js} +2 -2
- package/dist/gateway/static/root/assets/{user-model-page-CqnGITYf.js → user-model-page-DGDBWw7P.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-GEw5x2fU.js → voice-api-key-field-7BImy8Jc.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-3yyVwXln.js → voice-config-api-6MINytQl.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BDM7BEKH.js → work-discovery-overlay-BgJNz2tH.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BBwx-tUb.js → workflow-run-setup-panel-1I2q2J_U.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-BHigZn6E.js → workflows-page-DhJl9pnO.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-CTm8s6Jr.js → workspace-api-CXiyhTwv.js} +2 -2
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-CnPBP1V_.js +1 -0
- package/dist/gateway/static/root/index.html +26 -26
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/cloud-credits.js +80 -0
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/client-error-format.d.ts +1 -1
- package/dist/src/agent/client-error-format.js +7 -0
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +2 -2
- package/dist/src/agent/embedded/run-turn.js +40 -4
- package/dist/src/agent/embedded/xopc-stream-bridge.js +18 -0
- package/dist/src/agent/image/generation/openai-images-provider.d.ts +2 -1
- package/dist/src/agent/image/generation/openai-images-provider.js +13 -7
- package/dist/src/agent/image/generation/providers/xopc-cloud.js +14 -2
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/service.js +3 -3
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent-config/schema.d.ts +4 -0
- package/dist/src/agent-config/schema.js +1 -0
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/model-credential-store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/image-providers.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +42 -1
- package/dist/src/cli/commands/onboard/model.js +3 -3
- package/dist/src/computer/runtime.js +4 -1
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +2 -2
- package/dist/src/extensions/activation-context.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -0
- package/dist/src/gateway/hono/lib/config-payload.js +2 -2
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +4 -4
- package/dist/src/gateway/hono/routes/observability.js +1 -1
- package/dist/src/gateway/hono/routes/usage.js +15 -5
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/session-command-service.js +1 -1
- package/dist/src/gateway/service.js +4 -4
- package/dist/src/home-intelligence/generator.js +1 -1
- package/dist/src/notes/service.js +1 -1
- package/dist/src/observability/runtime.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +2 -2
- package/dist/src/personal-agent/reply-composer.js +2 -2
- package/dist/src/platform/client.d.ts +1 -1
- package/dist/src/platform/contracts.d.ts +1 -1
- package/dist/src/platform/index.js +1 -1
- package/dist/src/providers/index.js +4 -4
- package/dist/src/providers/model-call.js +15 -1
- package/dist/src/providers/model-registry.js +2 -2
- package/dist/src/providers/provider-auth-service.js +1 -1
- package/dist/src/providers/provider-disconnect-core.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/providers/xopc-cloud-account-service.d.ts +7 -23
- package/dist/src/providers/xopc-cloud-account-service.js +49 -29
- package/dist/src/providers/xopc-cloud-catalog-coordinator.js +1 -1
- package/dist/src/providers/xopc-cloud-credit-budget.d.ts +14 -0
- package/dist/src/providers/xopc-cloud-credit-budget.js +61 -0
- package/dist/src/storage/sqlite/ai-usage-repository.d.ts +9 -0
- package/dist/src/storage/sqlite/ai-usage-repository.js +94 -5
- package/dist/src/storage/sqlite/migrations/242_cloud_usage_receipts.sql +5 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tasks/task-main-update-decision-service.js +2 -2
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/usage/cloud-capability.d.ts +2 -0
- package/dist/src/usage/cloud-capability.js +34 -0
- package/dist/src/usage/cloud-receipts.d.ts +10 -0
- package/dist/src/usage/cloud-receipts.js +55 -0
- package/dist/src/usage/cost.js +1 -0
- package/dist/src/usage/recorder.js +3 -1
- package/dist/src/usage/scenario-registry.js +15 -0
- package/dist/src/voice/realtime/runtime.js +27 -22
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +28 -14
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +39 -29
- package/dist/src/voice/tts/speech-provider-types.d.ts +1 -0
- package/dist/src/work-discovery/service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BdxzGSiO.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BheKaO6d.js +0 -1
- package/dist/gateway/static/root/assets/messages-Bb2GK-Nj.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-DyPPksMP.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DmawLOHR.js +0 -1
- package/dist/gateway/static/root/assets/usage-page-BvPcpxTQ.js +0 -1
|
@@ -2,11 +2,11 @@ import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
4
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
5
|
-
import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
|
|
6
5
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
|
|
6
|
+
import { assertCurrentModelProvider, init_provider_policy } from "../providers/provider-policy.js";
|
|
7
|
+
import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
|
|
7
8
|
import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
|
|
8
9
|
import { getOAuthProviderDefinition, init_registry } from "./oauth/registry.js";
|
|
9
|
-
import { assertCurrentModelProvider, init_provider_policy } from "../providers/provider-policy.js";
|
|
10
10
|
import { dirname, join } from "path";
|
|
11
11
|
import { mkdir, readFile, readdir, rm } from "fs/promises";
|
|
12
12
|
//#region src/auth/credentials.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
|
|
3
2
|
import { assertCurrentModelProvider, init_provider_policy, isRetiredModelProvider } from "../providers/provider-policy.js";
|
|
3
|
+
import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
|
|
4
4
|
import { CredentialResolver, init_credentials } from "./credentials.js";
|
|
5
5
|
//#region src/auth/model-credential-store.ts
|
|
6
6
|
function normalizeProviderId(providerId) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveOAuthPath } from "../config/paths.js";
|
|
3
|
-
import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
|
|
4
3
|
import { assertCurrentModelProvider, init_provider_policy } from "../providers/provider-policy.js";
|
|
4
|
+
import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
|
|
5
5
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
6
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
7
7
|
//#region src/auth/sync-provider-auth.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { init_paths, resolveConfigPath } from "../../config/paths.js";
|
|
4
3
|
import { ConfigSchema, init_schema } from "../../config/schema.js";
|
|
4
|
+
import { init_paths, resolveConfigPath } from "../../config/paths.js";
|
|
5
5
|
import { commandRegistry } from "../registry.js";
|
|
6
6
|
import { parseConfigValue } from "../config-value.js";
|
|
7
7
|
import { getConfigValueAtPath, parseConfigPath, setConfigValueAtPath, unsetConfigValueAtPath } from "../config-paths.js";
|
|
@@ -53,7 +53,7 @@ async function checkDatabaseSchema(ctx) {
|
|
|
53
53
|
id: "database-schema",
|
|
54
54
|
label: "Database schema",
|
|
55
55
|
status: "pass",
|
|
56
|
-
message: `SQLite schema v${status.dbVersion} (current release
|
|
56
|
+
message: `SQLite schema v${status.dbVersion} (current release v242).`,
|
|
57
57
|
hints: []
|
|
58
58
|
};
|
|
59
59
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveModelsJsonPath } from "../../../../config/paths.js";
|
|
2
|
-
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
3
2
|
import { init_models_json, loadModelsJson } from "../../../../config/models-json.js";
|
|
3
|
+
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
4
4
|
import { classifyHost } from "../../../../media-shared/http/private-network.js";
|
|
5
5
|
import "../../../../media-shared/http/index.js";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentCatalogRepository, init_repository } from "../../../../agent-catalog/repository.js";
|
|
2
|
+
import { getAgentDefaultModelRef, init_schema, parseModelRef } from "../../../../config/schema.js";
|
|
2
3
|
import { PROVIDER_ENV_MAP, init_env_keys } from "../../../../providers/env-keys.js";
|
|
3
4
|
import { getModelOAuthProviderIds, init_registry } from "../../../../auth/oauth/registry.js";
|
|
4
5
|
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
5
|
-
import { getAgentDefaultModelRef, init_schema, parseModelRef } from "../../../../config/schema.js";
|
|
6
6
|
import { getDefaultAgentId, init_resolve_route } from "../../../../routing/resolve-route.js";
|
|
7
7
|
import { loadConfig } from "../../../../config/loader.js";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { creditDecimal } from "../../../packages/gateway-contract/src/cloud-credits.js";
|
|
2
|
+
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
1
3
|
import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
|
|
2
4
|
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
3
|
-
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
4
5
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
6
|
+
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
5
7
|
import { getAllModels, getAvailableModels, getConfiguredProviders, getProviderAuthState, getProviderDisplayName, init_providers, isProviderConfigured, providerSupportsApiKey, providerSupportsOAuth, resolveModel } from "../../providers/index.js";
|
|
8
|
+
import { XopcCloudAccountService } from "../../providers/xopc-cloud-account-service.js";
|
|
6
9
|
import { listImageProviderSpecs } from "../../../packages/image-providers/src/catalog.js";
|
|
7
10
|
import "../../../packages/image-providers/src/index.js";
|
|
8
11
|
import { loadConfig } from "../../config/loader.js";
|
|
@@ -20,6 +23,7 @@ init_credentials();
|
|
|
20
23
|
init_schema();
|
|
21
24
|
init_repository();
|
|
22
25
|
init_providers();
|
|
26
|
+
init_src();
|
|
23
27
|
const IMAGE_GENERATION_IDS = new Set(listImageProviderSpecs().flatMap((provider) => provider.models.map((model) => model.id)));
|
|
24
28
|
const VISION_IDS = new Set([
|
|
25
29
|
"gpt-6-sol",
|
|
@@ -222,6 +226,43 @@ function createModelsCommand(_ctx) {
|
|
|
222
226
|
cmd.command("set <model>").description("Set the default model").action(async (model) => {
|
|
223
227
|
await runModelsSet(model);
|
|
224
228
|
});
|
|
229
|
+
const cloud = cmd.command("cloud").description("Inspect XOPC Cloud Credit usage");
|
|
230
|
+
cloud.command("balance").option("--json", "Output the versioned Credit summary").action(async (options) => {
|
|
231
|
+
const summary = await new XopcCloudAccountService().getSummary();
|
|
232
|
+
if (!summary) throw new Error("XOPC Cloud is not configured");
|
|
233
|
+
if (options.json) {
|
|
234
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
console.log(`Available: ${creditDecimal(summary.balance.availableCreditMicro)} Credits`);
|
|
238
|
+
console.log(`Reserved: ${creditDecimal(summary.balance.usageReservedCreditMicro)} Credits`);
|
|
239
|
+
console.log(`Last 7 days: ${creditDecimal(summary.usage.chargedCreditMicro)} Credits`);
|
|
240
|
+
console.log(`Details: ${summary.links.details}`);
|
|
241
|
+
});
|
|
242
|
+
cloud.command("receipt <requestId>").option("--json", "Output the billing receipt").action(async (requestId, options) => {
|
|
243
|
+
const receipt = await new XopcCloudAccountService().getReceipt(requestId);
|
|
244
|
+
if (!receipt) throw new Error("XOPC Cloud is not configured");
|
|
245
|
+
if (options.json) {
|
|
246
|
+
console.log(JSON.stringify(receipt, null, 2));
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
console.log(`State: ${receipt.state}`);
|
|
250
|
+
console.log(`Charged: ${receipt.chargedCreditMicro === null ? "pending" : `${creditDecimal(receipt.chargedCreditMicro)} Credits`}`);
|
|
251
|
+
console.log(`Reserved: ${creditDecimal(receipt.reservedCreditMicro)} Credits`);
|
|
252
|
+
console.log(`Released: ${creditDecimal(receipt.releasedCreditMicro)} Credits`);
|
|
253
|
+
});
|
|
254
|
+
cloud.command("budget <id>").option("--json", "Output the budget contract").action(async (id, options) => {
|
|
255
|
+
const budget = await new XopcCloudAccountService().getBudget(id);
|
|
256
|
+
if (!budget) throw new Error("XOPC Cloud is not configured");
|
|
257
|
+
if (options.json) {
|
|
258
|
+
console.log(JSON.stringify(budget, null, 2));
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
console.log(`Limit: ${creditDecimal(budget.limitCreditMicro)} Credits`);
|
|
262
|
+
console.log(`Charged: ${creditDecimal(budget.chargedCreditMicro)} Credits`);
|
|
263
|
+
console.log(`Reserved: ${creditDecimal(budget.reservedCreditMicro)} Credits`);
|
|
264
|
+
console.log(`Remaining: ${creditDecimal(budget.remainingCreditMicro)} Credits`);
|
|
265
|
+
});
|
|
225
266
|
const auth = cmd.command("auth").description("Manage model provider auth");
|
|
226
267
|
auth.command("list").description("List model auth credentials").option("--provider <id>", "Filter by provider id").option("--json", "Output as JSON", false).action(async (options) => {
|
|
227
268
|
await runAuthList(options);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AgentCatalogRepository, init_repository } from "../../../agent-catalog/repository.js";
|
|
2
2
|
import { AgentCatalogService } from "../../../agent-catalog/service.js";
|
|
3
|
-
import { getApiKeyFromEnv } from "../../../providers/env-keys.js";
|
|
4
|
-
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
5
|
-
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
6
3
|
import { getAgentDefaultModelRef, init_schema } from "../../../config/schema.js";
|
|
4
|
+
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
7
5
|
import { init_models_json, loadModelsJson, saveModelsJson } from "../../../config/models-json.js";
|
|
6
|
+
import { getApiKeyFromEnv } from "../../../providers/env-keys.js";
|
|
8
7
|
import { getModelRegistry } from "../../../providers/model-registry.js";
|
|
8
|
+
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
9
9
|
import { getAllProviders, getModelsByProvider, getProviderDisplayName, init_providers, providerSupportsApiKey, providerSupportsOAuth } from "../../../providers/index.js";
|
|
10
10
|
import { prepareUpdateGlobalDefaults } from "../../../gateway/global-defaults-admin.js";
|
|
11
11
|
import { discoverProviderModels, isProviderApiDiscoverable } from "../../../providers/model-discovery.js";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { resolveEffectiveAgentConfigForSession } from "../config/agent-profile.js";
|
|
4
3
|
import { COMPUTER_CONTROL_TOOL, ComputerAppSchema, ComputerObservationSchema, ComputerWindowSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
5
4
|
import { ComputerServiceLimitsSchema, computerModelProfile, init_model_policy } from "./model-policy.js";
|
|
6
5
|
import { getApiKey, init_providers, resolveModel } from "../providers/index.js";
|
|
6
|
+
import { rejectUnbudgetedCloudTransport } from "../providers/xopc-cloud-credit-budget.js";
|
|
7
|
+
import { resolveEffectiveAgentConfigForSession } from "../config/agent-profile.js";
|
|
7
8
|
import { enterComputerControl, leaveComputerControl } from "./control-guard.js";
|
|
8
9
|
import { ComputerDiagnosticSchema, ComputerOperationError, computerDiagnostic, computerRecovery } from "./errors.js";
|
|
9
10
|
import { createComputerModelAdapter, predictComputerStep, readComputerJson } from "./model-adapter.js";
|
|
@@ -130,6 +131,7 @@ var ComputerRuntime = class {
|
|
|
130
131
|
throw new Error("COMPUTER_DISABLED");
|
|
131
132
|
}
|
|
132
133
|
let s = this.sessions.get(owner);
|
|
134
|
+
if (s?.binding.modelRef.startsWith("xopc-cloud/")) rejectUnbudgetedCloudTransport("computer use");
|
|
133
135
|
if (input.op === "discover") {
|
|
134
136
|
const endpoint = this.resolveEndpoint(owner);
|
|
135
137
|
const id = randomUUID();
|
|
@@ -161,6 +163,7 @@ var ComputerRuntime = class {
|
|
|
161
163
|
let deployment;
|
|
162
164
|
let serviceLimits;
|
|
163
165
|
if (model.provider === "xopc-cloud") {
|
|
166
|
+
rejectUnbudgetedCloudTransport("computer use");
|
|
164
167
|
const response = await fetch(`${model.baseUrl.replace(/\/$/, "")}/models`, {
|
|
165
168
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
166
169
|
redirect: "error",
|
package/dist/src/config/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import { ENV_VARS, XOPC_DB_FILENAME, resolveHomeDir, resolveStateDir, resolveXop
|
|
|
2
2
|
import { expandWorkspacePathString, init_workspace_path, normalizeWorkspaceDir, resolveWorkspaceRoot } from "./workspace-path.js";
|
|
3
3
|
import { resolveDefaultAgentWorkspaceDir } from "./workspace-defaults.js";
|
|
4
4
|
import { resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
5
|
-
import { FILENAMES, WORKSPACE_FILES, existsSync, hasBundledExtensionManifest, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
|
|
6
5
|
import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema } from "../../extensions/telegram/src/config-schema.js";
|
|
7
6
|
import { WeixinAccountConfigSchema, WeixinConfigSchema } from "../../extensions/weixin/src/config-schema.js";
|
|
8
7
|
import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewayScenesConfigSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
|
|
9
|
-
import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
|
|
10
|
-
import { extractProfileAgentId, resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
|
|
11
8
|
import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
|
|
9
|
+
import { FILENAMES, WORKSPACE_FILES, existsSync, hasBundledExtensionManifest, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
|
|
12
10
|
import { CustomModelSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, ModelOverrideSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProviderConfigSchema, VercelGatewayRoutingSchema, getDefaultModelValues, init_models_json, loadModelsJson, modelsJsonExists, saveModelsJson, validateModelsConfig } from "./models-json.js";
|
|
11
|
+
import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
|
|
12
|
+
import { extractProfileAgentId, resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
|
|
13
13
|
import { canonicalizeConfiguredMcpServer, normalizeConfiguredMcpServers } from "./mcp-config-normalize.js";
|
|
14
14
|
import { formatThinkingLevels, listThinkingLevels, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, thinkLevelToNumber } from "../agent/transcript/thinking-types.js";
|
|
15
15
|
import { assertConfigRewriteSafeForRunningGateway, loadConfig, saveConfig } from "./loader.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
4
|
+
import { ConfigSchema, init_schema } from "./schema.js";
|
|
4
5
|
import { init_paths, resolveConfigPath } from "./paths.js";
|
|
5
6
|
import { init_resolution, setActivePlatformDiscovery } from "../platform/resolution.js";
|
|
6
|
-
import { ConfigSchema, init_schema } from "./schema.js";
|
|
7
7
|
import { assertChannelPluginConfigs } from "./validate-channel-configs.js";
|
|
8
8
|
import { isGatewayConfigLockedByAnotherProcessSync } from "../gateway/lock.js";
|
|
9
9
|
import { dirname } from "path";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { init_write_file_atomic, writeTextAtomicSync } from "../infra/write-file-atomic.js";
|
|
3
|
-
import { init_paths, resolveModelsJsonPath } from "./paths.js";
|
|
4
|
-
import { assertCurrentModelProvider, init_provider_policy } from "../providers/provider-policy.js";
|
|
5
3
|
import { ComputerProfileSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
4
|
+
import { init_paths, resolveModelsJsonPath } from "./paths.js";
|
|
6
5
|
import { init_model_policy, isComputerModel } from "../computer/model-policy.js";
|
|
6
|
+
import { assertCurrentModelProvider, init_provider_policy } from "../providers/provider-policy.js";
|
|
7
7
|
import { existsSync, readFileSync } from "fs";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
//#region src/config/models-json.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PROVIDER_ENV_MAP, init_env_keys } from "../providers/env-keys.js";
|
|
2
1
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
2
|
+
import { PROVIDER_ENV_MAP, init_env_keys } from "../providers/env-keys.js";
|
|
3
3
|
import { init_providers, isProviderConfiguredSync } from "../providers/index.js";
|
|
4
4
|
import { collectSttProviderConfigEntries } from "../voice/stt/config-slice.js";
|
|
5
5
|
import { mergeSttConfigFromAppConfig } from "../voice/stt/config.js";
|
|
@@ -124,6 +124,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
124
124
|
network: boolean;
|
|
125
125
|
workspaceAccess: "read-only" | "read-write";
|
|
126
126
|
};
|
|
127
|
+
cloudCreditLimitPerRunMicro?: string;
|
|
127
128
|
maxTurns?: number;
|
|
128
129
|
timeoutMs?: number;
|
|
129
130
|
maxToolFailuresPerTurn?: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { normalizeAgentId } from "../../../agent-catalog/id.js";
|
|
2
2
|
import { AgentCatalogRepository, init_repository } from "../../../agent-catalog/repository.js";
|
|
3
3
|
import { init_agent_scope, listAgentEntries, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
4
|
-
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
5
|
-
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
6
4
|
import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, init_config } from "../../../user-context/config.js";
|
|
5
|
+
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
7
6
|
import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
|
|
7
|
+
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
8
8
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
9
9
|
import { getAllProviders, init_providers, isProviderConfigured } from "../../../providers/index.js";
|
|
10
10
|
import { resolveShareConfig } from "../../../share/share-config.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BindingsSchema, init_binding_schema } from "../../../../routing/binding-schema.js";
|
|
2
2
|
import { AgentCatalogService } from "../../../../agent-catalog/service.js";
|
|
3
|
-
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
4
3
|
import { ComputerConfigSchema, init_config } from "../../../../computer/config.js";
|
|
5
4
|
import { ContextPlanningConfigSchema, HomeIntelligenceConfigSchema, KnowledgeMemoryConfigSchema, UserContextConfigSchema, UserModelConfigSchema, init_config as init_config$1 } from "../../../../user-context/config.js";
|
|
6
5
|
import { BrowserConfigSchema, McpConfigSchema, VoiceConfigSchema, init_schema } from "../../../../config/schema.js";
|
|
6
|
+
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
7
7
|
import { canonicalizeConfiguredMcpServer } from "../../../../config/mcp-config-normalize.js";
|
|
8
8
|
import { mergeGatewaySkillsMarketplacePatch, mergeSessionConfigPatch, mergeUpdateConfigPatch } from "../../../../config/web-patch.js";
|
|
9
9
|
import { assertGatewayAuthConfigured, resolveGatewayAuth } from "../../../auth.js";
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
2
|
-
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
3
|
-
import { resolveEffectiveAgentConfigForAgent } from "../../../config/agent-profile.js";
|
|
4
1
|
import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.js";
|
|
2
|
+
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
5
3
|
import { computerModelProfile, init_model_policy, isDedicatedComputerModel } from "../../../computer/model-policy.js";
|
|
6
4
|
import { init_models_json, loadModelsJson, saveModelsJson, validateModelsConfig } from "../../../config/models-json.js";
|
|
7
5
|
import { getModelCatalogStore, init_model_catalog_store } from "../../../providers/model-catalog-store.js";
|
|
8
6
|
import { getModelRegistry } from "../../../providers/model-registry.js";
|
|
7
|
+
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
9
8
|
import "../../../providers/constants.js";
|
|
10
9
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
11
10
|
import { PROVIDER_META, getAllModels, getAllProviders, getAvailableModels, getProviderAuthState, init_providers, isProviderConfigured, isProviderConfiguredSync } from "../../../providers/index.js";
|
|
11
|
+
import { XopcCloudAccountError, XopcCloudAccountService } from "../../../providers/xopc-cloud-account-service.js";
|
|
12
|
+
import { resolveEffectiveAgentConfigForAgent } from "../../../config/agent-profile.js";
|
|
12
13
|
import { buildCapabilityPlansForConfig } from "../../../capabilities/readiness/from-config.js";
|
|
13
14
|
import "../../../capabilities/readiness/index.js";
|
|
14
15
|
import { getModelThinking } from "../../../providers/model-thinking.js";
|
|
@@ -23,7 +24,6 @@ import { dismissXopcCloudOnboarding, getXopcCloudOnboardingStatus } from "../../
|
|
|
23
24
|
import { getDomesticProviderPreset, getDomesticProviderPresetIds } from "../../../providers/domestic-presets.js";
|
|
24
25
|
import { auditModelReferences } from "../../../providers/model-reference-auditor.js";
|
|
25
26
|
import { getOnboardingFeaturedProviders, getProviderHint, getRecommendedModelsForProvider, isRecommendedModel, sortModelsForPicker, sortProvidersForPicker } from "../../../providers/presentation.js";
|
|
26
|
-
import { XopcCloudAccountError, XopcCloudAccountService } from "../../../providers/xopc-cloud-account-service.js";
|
|
27
27
|
//#region src/gateway/hono/routes/models.ts
|
|
28
28
|
init_model_policy();
|
|
29
29
|
init_models_json();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
2
1
|
import { TracingConfigSchema, init_config } from "../../../observability/config.js";
|
|
2
|
+
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
3
3
|
import { configureTracing, localStore, testLangfuse, tracingConfig, tracingStatus } from "../../../observability/runtime.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { Hono } from "hono";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { getAiUsageEventView, listAiUsageEvents, listAiUsageTrace, summarizeAiUsage } from "../../../storage/sqlite/ai-usage-repository.js";
|
|
1
|
+
import { getAiUsageEventView, listAiUsageEvents, listAiUsageTrace, pendingAiUsageCloudReceiptIds, summarizeAiUsage } from "../../../storage/sqlite/ai-usage-repository.js";
|
|
2
|
+
import { reconcileCloudUsageReceipt } from "../../../usage/cloud-receipts.js";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
import { Hono } from "hono";
|
|
4
5
|
//#region src/gateway/hono/routes/usage.ts
|
|
@@ -41,14 +42,23 @@ function registerUsageRoutes(authenticated, _deps) {
|
|
|
41
42
|
if (error instanceof z.ZodError || error.message.startsWith("invalid_usage_")) return c.json({ error: "invalid_usage_query" }, 400);
|
|
42
43
|
throw error;
|
|
43
44
|
});
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
const refreshReceipts = async (query) => {
|
|
46
|
+
await Promise.all(pendingAiUsageCloudReceiptIds(query).map(reconcileCloudUsageReceipt));
|
|
47
|
+
};
|
|
48
|
+
app.get("/summary", async (c) => {
|
|
49
|
+
const query = parseFilters(c.req.query());
|
|
50
|
+
await refreshReceipts(query);
|
|
51
|
+
return c.json(summarizeAiUsage(query));
|
|
52
|
+
});
|
|
53
|
+
app.get("/events", async (c) => {
|
|
46
54
|
const limit = z.coerce.number().int().min(1).max(200).optional().parse(c.req.query("limit"));
|
|
47
|
-
|
|
55
|
+
const query = {
|
|
48
56
|
...parseFilters(c.req.query()),
|
|
49
57
|
limit,
|
|
50
58
|
before: parseCursor(c.req.query("cursor"))
|
|
51
|
-
}
|
|
59
|
+
};
|
|
60
|
+
await refreshReceipts(query);
|
|
61
|
+
return c.json(listAiUsageEvents(query));
|
|
52
62
|
});
|
|
53
63
|
app.get("/events/:id", (c) => {
|
|
54
64
|
const event = getAiUsageEventView(c.req.param("id"));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { voiceSelectionSchema } from "../../../../packages/realtime-protocol/src/voice-catalog.js";
|
|
2
2
|
import { VOICE_TIMING_METRICS, createVoiceSessionRequestSchema, init_voice } from "../../../../packages/realtime-protocol/src/voice.js";
|
|
3
3
|
import { getDefaultModelSync, init_providers, resolveModel } from "../../../providers/index.js";
|
|
4
|
-
import { isPersonalConversation } from "../../../personal-agent/repository.js";
|
|
5
4
|
import { completeWithResolvedCredentials } from "../../../providers/model-call.js";
|
|
5
|
+
import { isPersonalConversation } from "../../../personal-agent/repository.js";
|
|
6
6
|
import { resolveSttProviderConfigSlice } from "../../../voice/stt/config-slice.js";
|
|
7
7
|
import { STTTranscriptionError, transcribe } from "../../../voice/stt/transcribe-core.js";
|
|
8
8
|
import { isSTTAvailable } from "../../../voice/stt/availability.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { configureTracing } from "../../observability/runtime.js";
|
|
4
3
|
import { getModelRegistry } from "../../providers/model-registry.js";
|
|
5
4
|
import { init_providers } from "../../providers/index.js";
|
|
5
|
+
import { configureTracing } from "../../observability/runtime.js";
|
|
6
6
|
import { evictAllEmbeddedSessionRunners } from "../../agent/embedded/session-runner.js";
|
|
7
7
|
import { reloadImageGenerationProviders } from "../../agent/image/generation/provider-registry.js";
|
|
8
8
|
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
2
2
|
import { init_session_repository } from "../../storage/sqlite/session-repository.js";
|
|
3
|
-
import { resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
|
|
4
3
|
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
4
|
+
import { resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
|
|
5
5
|
import { getPersonalAgentByConversation } from "../../personal-agent/repository.js";
|
|
6
6
|
import { resolveProjectAgentId } from "../../projects/project-agent.js";
|
|
7
7
|
import "../../projects/index.js";
|
|
@@ -18,17 +18,17 @@ import { getSessionConfig, init_config_repository } from "../storage/sqlite/conf
|
|
|
18
18
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
19
19
|
import { normalizeAgentId } from "../agent-catalog/id.js";
|
|
20
20
|
import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
21
|
-
import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
22
|
-
import { flushTracing } from "../observability/runtime.js";
|
|
23
21
|
import { init_config, resolveKnowledgeReadPolicy } from "../user-context/config.js";
|
|
24
22
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
23
|
+
import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
24
|
+
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
25
25
|
import { init_agent_session_key, resolveAgentMainConversationId } from "../routing/agent-session-key.js";
|
|
26
26
|
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
27
27
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
28
|
-
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
29
|
-
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
30
28
|
import { init_providers, providers_exports } from "../providers/index.js";
|
|
29
|
+
import { flushTracing } from "../observability/runtime.js";
|
|
31
30
|
import { AI_USAGE_RETENTION_MS, markStaleAiUsageEventsUnknown, pruneAiUsageEvents } from "../storage/sqlite/ai-usage-repository.js";
|
|
31
|
+
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
32
32
|
import { listKnowledgeItems } from "../knowledge-memory/repository.js";
|
|
33
33
|
import "../knowledge-memory/index.js";
|
|
34
34
|
import { getPersonalAgentByConversation } from "../personal-agent/repository.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { init_agent_scope, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
2
|
+
import { extractAssistantText, getAssistantMessageErrorReason } from "../providers/model-response.js";
|
|
2
3
|
import { init_providers, resolveModel } from "../providers/index.js";
|
|
3
4
|
import { completeWithResolvedCredentials, isLocalModelBaseUrl } from "../providers/model-call.js";
|
|
4
|
-
import { extractAssistantText, getAssistantMessageErrorReason } from "../providers/model-response.js";
|
|
5
5
|
import { resolveModelSelector } from "../config/agent-model-intents.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/home-intelligence/generator.ts
|
|
@@ -7,8 +7,8 @@ import { init_note_markdown, parseNoteMarkdown } from "./note-markdown.js";
|
|
|
7
7
|
import { init_notes_repository, listNoteProjectSummaries } from "../storage/sqlite/notes-repository.js";
|
|
8
8
|
import { changedFieldsFromPatch, emitActivity, previewText, systemActivityActor, systemActivitySource } from "../activity/emitter.js";
|
|
9
9
|
import { getDefaultModelSync, init_providers, resolveModel } from "../providers/index.js";
|
|
10
|
-
import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
11
10
|
import { completeWithResolvedCredentials } from "../providers/model-call.js";
|
|
11
|
+
import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
12
12
|
import { partitionAttachmentsByReference } from "./note-attachment-sync.js";
|
|
13
13
|
import { buildNoteAgentContextArtifact, getCachedNoteAgentContextArtifact } from "./agent-context.js";
|
|
14
14
|
import { revokeNoteShareRecords } from "../share/note-share-revocation.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { init_context, runWithLogContext } from "../utils/logger/context.js";
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
|
-
import { CredentialResolver, init_credentials } from "../auth/credentials.js";
|
|
5
4
|
import { TracingConfigSchema, defaultTracingConfig, init_config } from "./config.js";
|
|
5
|
+
import { CredentialResolver, init_credentials } from "../auth/credentials.js";
|
|
6
6
|
import { LangfuseTarget } from "./langfuse.js";
|
|
7
7
|
import { boundedJson, redactString } from "./sanitize.js";
|
|
8
8
|
import { LocalTraceStore } from "./store.js";
|
|
@@ -6,13 +6,13 @@ import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
|
6
6
|
import { init_session_instance_repository, readCurrentTranscriptId } from "../../storage/sqlite/session-instance-repository.js";
|
|
7
7
|
import { appendTranscriptEntry, init_transcript_repository } from "../../storage/sqlite/transcript-repository.js";
|
|
8
8
|
import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
|
|
9
|
+
import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../../providers/model-response.js";
|
|
9
10
|
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
11
|
+
import { completeWithResolvedCredentials } from "../../providers/model-call.js";
|
|
10
12
|
import { resolveUserContextSessionAccess } from "../../user-context/access-policy.js";
|
|
11
13
|
import { getPersonalAgent } from "../repository.js";
|
|
12
14
|
import { DurableState } from "../../storage/sqlite/durable-state.js";
|
|
13
15
|
import { enqueueDue, enqueueWakeup, getAttention, getAttentionSources, getProactivitySettings, isQuiet, listAttention, localDay, preparationStrategy, recordFeedback, reserveModelCall, saveAttention, sourceFingerprint, userText } from "./repository.js";
|
|
14
|
-
import { completeWithResolvedCredentials } from "../../providers/model-call.js";
|
|
15
|
-
import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../../providers/model-response.js";
|
|
16
16
|
import { emitSessionTranscriptUpdate } from "../../session/transcript-events.js";
|
|
17
17
|
import { PERSONAL_PERSONA_GUIDANCE } from "../persona.js";
|
|
18
18
|
import { personalConversationState } from "../conversation-state.js";
|
|
@@ -9,12 +9,12 @@ import { appendTranscriptEntry, init_transcript_repository, loadLlmMessagesForSe
|
|
|
9
9
|
import { getSessionConfig, init_config_repository } from "../storage/sqlite/config-repository.js";
|
|
10
10
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
11
11
|
import { init_agent_scope, resolveAgentProfileDir } from "../agent/agent-scope.js";
|
|
12
|
+
import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../providers/model-response.js";
|
|
12
13
|
import { init_providers, resolveModel } from "../providers/index.js";
|
|
14
|
+
import { completeWithResolvedCredentials } from "../providers/model-call.js";
|
|
13
15
|
import { getPersonalAgentByConversation } from "./repository.js";
|
|
14
16
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
15
17
|
import { loadProfileBootstrapFiles } from "../agent/bootstrap/load-bootstrap-files.js";
|
|
16
|
-
import { completeWithResolvedCredentials } from "../providers/model-call.js";
|
|
17
|
-
import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../providers/model-response.js";
|
|
18
18
|
import { emitSessionTranscriptUpdate } from "../session/transcript-events.js";
|
|
19
19
|
import { PERSONAL_PERSONA_GUIDANCE } from "./persona.js";
|
|
20
20
|
import { PERSONAL_REPLY_EXAMPLES, PERSONAL_REPLY_STYLE_RULES } from "./reply-style.js";
|
|
@@ -66,9 +66,9 @@ export declare const RuntimeCommandSchema: z.ZodObject<{
|
|
|
66
66
|
read: "read";
|
|
67
67
|
write: "write";
|
|
68
68
|
execute: "execute";
|
|
69
|
+
purchase: "purchase";
|
|
69
70
|
admin: "admin";
|
|
70
71
|
send: "send";
|
|
71
|
-
purchase: "purchase";
|
|
72
72
|
publish: "publish";
|
|
73
73
|
}>>;
|
|
74
74
|
}, z.core.$strict>;
|
|
@@ -152,9 +152,9 @@ export declare const AgentManifestSchema: z.ZodObject<{
|
|
|
152
152
|
read: "read";
|
|
153
153
|
write: "write";
|
|
154
154
|
execute: "execute";
|
|
155
|
+
purchase: "purchase";
|
|
155
156
|
admin: "admin";
|
|
156
157
|
send: "send";
|
|
157
|
-
purchase: "purchase";
|
|
158
158
|
publish: "publish";
|
|
159
159
|
}>>;
|
|
160
160
|
}, z.core.$strict>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_resolution, resolveConnectedPlatformDiscovery, resolveConnectedPlatformEndpoint, setActivePlatformDiscovery } from "./resolution.js";
|
|
2
1
|
import { AgentManifestSchema, PlatformCapabilitySchema, PlatformConfigSchema, PlatformDiscoverySchema, PlatformEventSchema, init_contracts } from "./contracts.js";
|
|
2
|
+
import { init_resolution, resolveConnectedPlatformDiscovery, resolveConnectedPlatformEndpoint, setActivePlatformDiscovery } from "./resolution.js";
|
|
3
3
|
import { PLATFORM_RUNTIME_PROFILE, PLATFORM_RUNTIME_PROVIDER, PlatformRuntimeClient, RuntimeCommandSchema, discoverPlatform } from "./client.js";
|
|
4
4
|
import { processRuntimeCommand } from "./worker.js";
|
|
5
5
|
//#region src/platform/index.ts
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { __esmMin, __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
3
|
+
import { assertCurrentModelProvider, init_provider_policy, isRetiredModelProvider } from "./provider-policy.js";
|
|
2
4
|
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
5
|
+
import { init_model_ref, splitProviderModelRef } from "./model-ref.js";
|
|
6
|
+
import { ModelRegistry, getModelRegistry, init_model_registry, prewarmModelRegistry, resetModelRegistry } from "./model-registry.js";
|
|
3
7
|
import { getModelOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
|
|
4
|
-
import { assertCurrentModelProvider, init_provider_policy, isRetiredModelProvider } from "./provider-policy.js";
|
|
5
8
|
import { CredentialResolver, hasCredentials, init_credentials } from "../auth/credentials.js";
|
|
6
|
-
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
7
9
|
import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
|
|
8
|
-
import { init_model_ref, splitProviderModelRef } from "./model-ref.js";
|
|
9
|
-
import { ModelRegistry, getModelRegistry, init_model_registry, prewarmModelRegistry, resetModelRegistry } from "./model-registry.js";
|
|
10
10
|
import { EXTENSION_PROVIDER_BASE_URL, init_constants } from "./constants.js";
|
|
11
11
|
import { applyOfficialModelMetadataCorrections, getSupplementalModels, init_model_supplements } from "./model-supplements.js";
|
|
12
12
|
import { getProviderRegistry, init_plugin_registry } from "./plugin-registry.js";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { init_constants } from "./constants.js";
|
|
2
2
|
import { getApiKey, init_providers } from "./index.js";
|
|
3
3
|
import { createExtensionAwareStreamFn } from "./extension-stream-bridge.js";
|
|
4
|
+
import { withCloudUsageResponse } from "../usage/cloud-receipts.js";
|
|
4
5
|
import { finishAiUsageFromMessage, observeAiUsageStream, startAiUsageCall } from "../usage/recorder.js";
|
|
6
|
+
import { assertCloudCreditBudgetActive, cloudCreditBudgetHeaders, reportCloudCreditError } from "./xopc-cloud-credit-budget.js";
|
|
5
7
|
import { completeSimple, normalizeContext } from "@earendil-works/pi-ai/compat";
|
|
6
8
|
//#region src/providers/model-call.ts
|
|
7
9
|
init_constants();
|
|
@@ -25,12 +27,18 @@ async function resolveModelCallApiKey(model, credentialOptions) {
|
|
|
25
27
|
return isLocalModelBaseUrl(model.baseUrl) ? "xopc-local" : void 0;
|
|
26
28
|
}
|
|
27
29
|
async function resolveModelCallOptions(model, options = {}, credentialOptions) {
|
|
30
|
+
assertCloudCreditBudgetActive();
|
|
31
|
+
if (model.provider === "xopc-cloud") options = withCloudUsageResponse(options);
|
|
28
32
|
const apiKey = options.apiKey ?? await resolveModelCallApiKey(model, credentialOptions);
|
|
29
33
|
if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
|
|
30
34
|
const { temperature, ...rest } = options;
|
|
31
35
|
return {
|
|
32
36
|
...rest,
|
|
33
37
|
apiKey,
|
|
38
|
+
...model.provider === "xopc-cloud" ? { headers: {
|
|
39
|
+
...options.headers,
|
|
40
|
+
...await cloudCreditBudgetHeaders()
|
|
41
|
+
} } : {},
|
|
34
42
|
...temperature !== void 0 ? { temperature } : {}
|
|
35
43
|
};
|
|
36
44
|
}
|
|
@@ -54,9 +62,11 @@ async function completeWithResolvedCredentials(model, context, options, credenti
|
|
|
54
62
|
return result;
|
|
55
63
|
}
|
|
56
64
|
const result = await usageCall.run(() => completeSimple(model, context, resolvedOptions));
|
|
65
|
+
if (result.errorMessage) reportCloudCreditError(result.errorMessage);
|
|
57
66
|
finishAiUsageFromMessage(usageCall, result);
|
|
58
67
|
return result;
|
|
59
68
|
} catch (error) {
|
|
69
|
+
reportCloudCreditError(error instanceof Error ? error.message : String(error));
|
|
60
70
|
usageCall?.finish({
|
|
61
71
|
status: "failed",
|
|
62
72
|
errorSummary: error instanceof Error ? error.message : String(error)
|
|
@@ -80,7 +90,11 @@ async function createResolvedModelStream(model, context, options, credentialOpti
|
|
|
80
90
|
}
|
|
81
91
|
});
|
|
82
92
|
try {
|
|
83
|
-
|
|
93
|
+
const stream = await usageCall.run(() => createExtensionAwareStreamFn()(model, normalizeContext(context), resolvedOptions));
|
|
94
|
+
stream.result().then((message) => {
|
|
95
|
+
if (message.errorMessage) reportCloudCreditError(message.errorMessage);
|
|
96
|
+
}).catch(() => {});
|
|
97
|
+
return observeAiUsageStream(stream, usageCall);
|
|
84
98
|
} catch (error) {
|
|
85
99
|
usageCall?.finish({
|
|
86
100
|
status: "failed",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
|
-
import {
|
|
4
|
+
import { init_resolve_config_value, resolveConfigValue, resolveHeaders } from "../config/resolve-config-value.js";
|
|
5
5
|
import { resolveModelsJsonPath } from "../config/paths.js";
|
|
6
6
|
import { init_provider_policy, isRetiredModelProvider } from "./provider-policy.js";
|
|
7
|
-
import { init_resolve_config_value, resolveConfigValue, resolveHeaders } from "../config/resolve-config-value.js";
|
|
8
7
|
import { getDefaultModelValues, init_models_json, validateModelsConfig } from "../config/models-json.js";
|
|
8
|
+
import { getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
9
9
|
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
10
10
|
import { init_model_ref, splitProviderModelRef } from "./model-ref.js";
|
|
11
11
|
import { existsSync, readFileSync } from "fs";
|