@xopcai/xopc 0.0.161 → 0.0.163

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.
Files changed (334) hide show
  1. package/README.md +4 -2
  2. package/README.zh-CN.md +4 -2
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{activity-store-o7GRljfD.js → activity-store-Xj95LzTv.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-9R3szLMc.js → agent-avatar-dicebear-C-QeUFwU.js} +1 -1
  7. package/dist/gateway/static/root/assets/agents-DVKlWKJE.js +2 -0
  8. package/dist/gateway/static/root/assets/{api-jSTqFMq9.js → api-BTLmAm1_.js} +1 -1
  9. package/dist/gateway/static/root/assets/{app-management-settings-panel-D81cyE76.js → app-management-settings-panel-zc6Gf-S5.js} +1 -1
  10. package/dist/gateway/static/root/assets/{appearance-settings-Ct6bZQCV.js → appearance-settings-0fMLnOWn.js} +1 -1
  11. package/dist/gateway/static/root/assets/apps-page-BZXEJDIV.js +1 -0
  12. package/dist/gateway/static/root/assets/{archive-plugin-CfD7AZKn.js → archive-plugin-DOiR_E21.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-load-CP_Gaxt3.js → attachment-load-BxmYl1D1.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automation-suggestion-card-BGKM_NDZ.js → automation-suggestion-card-BhZOirad.js} +1 -1
  15. package/dist/gateway/static/root/assets/automations-page-B8CnkoXv.js +6 -0
  16. package/dist/gateway/static/root/assets/{binary-plugins-IPr2EVnS.js → binary-plugins-DTTKsvgk.js} +1 -1
  17. package/dist/gateway/static/root/assets/{block-editor-B6aHEGA6.js → block-editor-C7se7iqg.js} +46 -46
  18. package/dist/gateway/static/root/assets/browser-settings-page-BCPWKI9V.js +8 -0
  19. package/dist/gateway/static/root/assets/browser-workflow-inputs-kxmStCcv.js +1 -0
  20. package/dist/gateway/static/root/assets/browser-workflows-page-CwYf9OM_.js +3 -0
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-C7lr_mX2.js +2 -0
  22. package/dist/gateway/static/root/assets/{capability-presets-api-CCX9-LjU.js → capability-presets-api-BZKh2cWX.js} +1 -1
  23. package/dist/gateway/static/root/assets/capability-presets-settings-panel-Ble9kHRu.js +2 -0
  24. package/dist/gateway/static/root/assets/{channel-recipient-api-MmLMLDWf.js → channel-recipient-api-r7tdbnJE.js} +1 -1
  25. package/dist/gateway/static/root/assets/channels-settings-CtQQQHrv.js +1 -0
  26. package/dist/gateway/static/root/assets/channels-status-swr-_VirfMKW.js +1 -0
  27. package/dist/gateway/static/root/assets/{connector-logo-BbjzIs87.js → connector-logo-BpnQYAxA.js} +1 -1
  28. package/dist/gateway/static/root/assets/connectors-page-BXWJSJeY.js +2 -0
  29. package/dist/gateway/static/root/assets/{desktop-pet-CYH5ZSXy.js → desktop-pet-B86W4a5c.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-DQLqGLc0.js → desktop-pet-settings-uv8Grtgk.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-ClsiXhmz.js → directory-picker-path-field-C4TTvf7p.js} +1 -1
  32. package/dist/gateway/static/root/assets/{dreaming-settings-CjMPPdzg.js → dreaming-settings-CzJAUPvM.js} +3 -3
  33. package/dist/gateway/static/root/assets/{extension-debug-page-57eizjhB.js → extension-debug-page-Ci2mOYUt.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-CsbSb3u1.js → extension-page-DeXdmhXQ.js} +1 -1
  35. package/dist/gateway/static/root/assets/extension-settings-page-C93vaOsU.js +1 -0
  36. package/dist/gateway/static/root/assets/{gateway-config-api-DIPJuzBZ.js → gateway-config-api-C31Hlblp.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-settings-CDLqAQY7.js → gateway-settings-D3zS6RZh.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-startup-retry-DrfSJtvT.js → gateway-startup-retry-CSRvCqxh.js} +1 -1
  39. package/dist/gateway/static/root/assets/goal-create-dialog-CWp2b7__.js +1 -0
  40. package/dist/gateway/static/root/assets/goal-detail-page-Dtm29FxD.js +4 -0
  41. package/dist/gateway/static/root/assets/{goals-config-api-lGC10UkU.js → goals-config-api-D4wYNRrf.js} +1 -1
  42. package/dist/gateway/static/root/assets/goals-page-jMzBJs6e.js +2 -0
  43. package/dist/gateway/static/root/assets/{goals-settings-BWq0pdrA.js → goals-settings-Bx2jVvhQ.js} +1 -1
  44. package/dist/gateway/static/root/assets/{heartbeat-settings-D4o8BJVv.js → heartbeat-settings-BEIF1eXy.js} +1 -1
  45. package/dist/gateway/static/root/assets/index-BXtJvaQl.css +1 -0
  46. package/dist/gateway/static/root/assets/index-HZdBKfk_.js +199 -0
  47. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-6T2QYehS.js → keyboard-shortcuts-settings-DOEDpvTM.js} +1 -1
  48. package/dist/gateway/static/root/assets/local-app-workbench-page-CseW9jD3.js +2 -0
  49. package/dist/gateway/static/root/assets/{local-apps-page-DCjg2K9f.js → local-apps-page-B0OpGpxv.js} +1 -1
  50. package/dist/gateway/static/root/assets/{locale-store-Dar-xqQr.js → locale-store-Ys6RP7Be.js} +1 -1
  51. package/dist/gateway/static/root/assets/logs-page-DVqPbth5.js +7 -0
  52. package/dist/gateway/static/root/assets/{markdown-split-rt1XO43g.js → markdown-split-CEZwysCH.js} +1 -1
  53. package/dist/gateway/static/root/assets/{media-plugins-Bwo8CJuh.js → media-plugins-CpGKE7B0.js} +1 -1
  54. package/dist/gateway/static/root/assets/messages-BzI9Wx30.js +5 -0
  55. package/dist/gateway/static/root/assets/{notes-page-Dp-pkX7d.js → notes-page-CdiuDZ5a.js} +1 -1
  56. package/dist/gateway/static/root/assets/notes-workbench-mrc3xtpn.js +4 -0
  57. package/dist/gateway/static/root/assets/{page-tabs-CzZ4iKOb.js → page-tabs-BkH5AVV2.js} +1 -1
  58. package/dist/gateway/static/root/assets/{preview-open-alternatives-3E_Qa-58.js → preview-open-alternatives-CQai8f9D.js} +1 -1
  59. package/dist/gateway/static/root/assets/{product-open-page-B2T48Sbt.js → product-open-page-B2kSdB2b.js} +1 -1
  60. package/dist/gateway/static/root/assets/project-detail-page-CfhPJLkH.js +1 -0
  61. package/dist/gateway/static/root/assets/projects-page-BfMoKjdm.js +1 -0
  62. package/dist/gateway/static/root/assets/remote-access-hub-CrDtcsZ9.js +1 -0
  63. package/dist/gateway/static/root/assets/save-bar-controls-NGYnO7n7.js +1 -0
  64. package/dist/gateway/static/root/assets/schedule-field-nLOphnv3.js +1 -0
  65. package/dist/gateway/static/root/assets/{schema-form-DC-iU5IG.js → schema-form-D0e90ndE.js} +1 -1
  66. package/dist/gateway/static/root/assets/sessions-page-D3DbF3dV.js +1 -0
  67. package/dist/gateway/static/root/assets/settings-advanced-gate-BZp0O2dH.js +1 -0
  68. package/dist/gateway/static/root/assets/{settings-form-section-CNqF6IwY.js → settings-form-section-X2Sl-EAk.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DkvwitK_.js → settings-loading-skeleton-DOnUabm7.js} +1 -1
  70. package/dist/gateway/static/root/assets/settings-page-C4UUNi1n.js +1 -0
  71. package/dist/gateway/static/root/assets/{settings-page-layout-DWvNgISx.js → settings-page-layout-C1yYqbT6.js} +1 -1
  72. package/dist/gateway/static/root/assets/setup-status-panel-84iao4DZ.js +1 -0
  73. package/dist/gateway/static/root/assets/{share-preview-page-DGpSPW-n.js → share-preview-page-Cfy_pH7V.js} +1 -1
  74. package/dist/gateway/static/root/assets/shares-settings-DtcwQvRG.js +1 -0
  75. package/dist/gateway/static/root/assets/skill-reload-api-L7j5Gc8Z.js +1 -0
  76. package/dist/gateway/static/root/assets/skills-page-1Ps8PjsP.js +2 -0
  77. package/dist/gateway/static/root/assets/{system-settings-panel-8TxxSbUw.js → system-settings-panel-Da81RJ6G.js} +1 -1
  78. package/dist/gateway/static/root/assets/{theme-store-B5FzMWOx.js → theme-store-DflSp9o4.js} +1 -1
  79. package/dist/gateway/static/root/assets/time-picker-BIkOW-2L.js +1 -0
  80. package/dist/gateway/static/root/assets/{typed-models-lib-DEGtSA5h.js → typed-models-lib--HptwFcD.js} +1 -1
  81. package/dist/gateway/static/root/assets/{use-channel-catalog-BDU6FneG.js → use-channel-catalog-CMHY4ZfW.js} +1 -1
  82. package/dist/gateway/static/root/assets/user-context-page-BYAAs2iW.js +1 -0
  83. package/dist/gateway/static/root/assets/voice-api-key-field-nvIZerol.js +1 -0
  84. package/dist/gateway/static/root/assets/work-discovery-page-J35JkJ7_.js +1 -0
  85. package/dist/gateway/static/root/assets/work-item-detail-page-C4wYDYqV.js +1 -0
  86. package/dist/gateway/static/root/assets/work-page-DMvitV6c.js +1 -0
  87. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cwi8Pz7n.js → workflow-run-setup-panel-D96MHABy.js} +2 -2
  88. package/dist/gateway/static/root/assets/workflows-page-JMN0nMbM.js +11 -0
  89. package/dist/gateway/static/root/index.html +7 -7
  90. package/dist/package.js +1 -1
  91. package/dist/src/agent/agent-manager.d.ts +1 -0
  92. package/dist/src/agent/agent-manager.js +1 -0
  93. package/dist/src/agent/client-error-format.d.ts +1 -1
  94. package/dist/src/agent/client-error-format.js +9 -5
  95. package/dist/src/agent/embedded/run-for-session.js +38 -31
  96. package/dist/src/agent/embedded/session-runner.d.ts +1 -0
  97. package/dist/src/agent/embedded/session-runner.js +12 -4
  98. package/dist/src/agent/failover-error.d.ts +1 -1
  99. package/dist/src/agent/image/generation/openai-compatible-image-provider.d.ts +2 -6
  100. package/dist/src/agent/image/generation/openai-compatible-image-provider.js +1 -3
  101. package/dist/src/agent/image/generation/provider-registry.d.ts +5 -46
  102. package/dist/src/agent/image/generation/provider-registry.js +24 -73
  103. package/dist/{extensions/dashscope/src/image-generation-provider.d.ts → src/agent/image/generation/providers/dashscope.d.ts} +3 -6
  104. package/dist/{extensions/dashscope/src/image-generation-provider.js → src/agent/image/generation/providers/dashscope.js} +36 -59
  105. package/dist/{extensions/fal/src/image-generation-provider.d.ts → src/agent/image/generation/providers/fal.d.ts} +1 -1
  106. package/dist/{extensions/fal/src/image-generation-provider.js → src/agent/image/generation/providers/fal.js} +19 -29
  107. package/dist/{extensions/google/src/image-generation-provider.d.ts → src/agent/image/generation/providers/google.d.ts} +2 -2
  108. package/dist/{extensions/google/src/image-generation-provider.js → src/agent/image/generation/providers/google.js} +23 -30
  109. package/dist/{extensions/minimax/src/image-generation-provider.d.ts → src/agent/image/generation/providers/minimax.d.ts} +2 -5
  110. package/dist/{extensions/minimax/src/image-generation-provider.js → src/agent/image/generation/providers/minimax.js} +35 -51
  111. package/dist/{extensions/openai/src/image-generation-provider.d.ts → src/agent/image/generation/providers/openai.d.ts} +2 -2
  112. package/dist/{extensions/openai/src/image-generation-provider.js → src/agent/image/generation/providers/openai.js} +13 -38
  113. package/dist/src/agent/image/generation/runtime-types.d.ts +1 -0
  114. package/dist/src/agent/image/generation/runtime.d.ts +1 -3
  115. package/dist/src/agent/image/generation/runtime.js +6 -6
  116. package/dist/src/agent/image/generation/types.d.ts +23 -3
  117. package/dist/src/agent/image/index.d.ts +1 -1
  118. package/dist/src/agent/image/index.js +2 -2
  119. package/dist/src/agent/media-generation/runtime-shared.d.ts +2 -0
  120. package/dist/src/agent/media-generation/runtime-shared.js +1 -0
  121. package/dist/src/agent/outcomes/task-evaluation.d.ts +20 -0
  122. package/dist/src/agent/outcomes/task-evaluation.js +48 -0
  123. package/dist/src/agent/outcomes/task-verifier.d.ts +29 -0
  124. package/dist/src/agent/outcomes/task-verifier.js +71 -0
  125. package/dist/src/agent/prompt/memory/index.js +1 -1
  126. package/dist/src/agent/prompt/service-prompt-builder.js +32 -1
  127. package/dist/src/agent/service.js +1 -0
  128. package/dist/src/agent/service.types.d.ts +1 -0
  129. package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +1 -7
  130. package/dist/src/agent/tools/browser/tool/browser-use-tool.js +2 -73
  131. package/dist/src/agent/tools/browser/tool/schemas.d.ts +1 -13
  132. package/dist/src/agent/tools/browser/tool/schemas.js +1 -9
  133. package/dist/src/agent/tools/browser-recipe-tool.d.ts +12 -0
  134. package/dist/src/agent/tools/browser-recipe-tool.js +113 -0
  135. package/dist/src/agent/tools/factory.d.ts +2 -0
  136. package/dist/src/agent/tools/factory.js +6 -1
  137. package/dist/src/agent/tools/image-generate-tool.d.ts +2 -0
  138. package/dist/src/agent/tools/image-generate-tool.js +14 -7
  139. package/dist/src/agent/tools/index.d.ts +1 -0
  140. package/dist/src/agent/tools/index.js +2 -1
  141. package/dist/src/auth/sync-provider-auth.d.ts +3 -0
  142. package/dist/src/auth/sync-provider-auth.js +12 -1
  143. package/dist/src/automations/domain/types.d.ts +13 -0
  144. package/dist/src/automations/domain/validation.d.ts +44 -24
  145. package/dist/src/automations/domain/validation.js +27 -18
  146. package/dist/src/automations/draft/automation-draft-validator.d.ts +6 -1
  147. package/dist/src/automations/draft/automation-draft-validator.js +1 -0
  148. package/dist/src/automations/service/action-executor.d.ts +1 -0
  149. package/dist/src/automations/service/action-executor.js +22 -0
  150. package/dist/src/browser/index.d.ts +0 -1
  151. package/dist/src/browser/index.js +1 -2
  152. package/dist/src/browser/pipeline/runner.d.ts +9 -2
  153. package/dist/src/browser/pipeline/runner.js +151 -105
  154. package/dist/src/browser/pipeline/schema.d.ts +21 -15
  155. package/dist/src/browser/pipeline/schema.js +93 -99
  156. package/dist/src/browser/recipes/index.d.ts +3 -0
  157. package/dist/src/browser/recipes/index.js +3 -0
  158. package/dist/src/browser/recipes/repository.d.ts +13 -0
  159. package/dist/src/browser/recipes/repository.js +81 -0
  160. package/dist/src/browser/recipes/runtime-service.d.ts +6 -0
  161. package/dist/src/browser/recipes/runtime-service.js +30 -0
  162. package/dist/src/browser/recipes/service.d.ts +36 -0
  163. package/dist/src/browser/recipes/service.js +186 -0
  164. package/dist/src/browser/recipes/types.d.ts +36 -0
  165. package/dist/src/cli/commands/browser-cli-helpers.js +6 -12
  166. package/dist/src/cli/commands/browser.js +4 -3
  167. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  168. package/dist/src/cli/commands/models.js +2 -5
  169. package/dist/src/cli/commands/onboard/model.js +3 -2
  170. package/dist/src/cli/commands/setup-shared/types.d.ts +1 -1
  171. package/dist/src/config/agent-profile.js +1 -1
  172. package/dist/src/config/index.js +2 -2
  173. package/dist/src/config/models-json.d.ts +6 -0
  174. package/dist/src/config/models-json.js +2 -6
  175. package/dist/src/config/schema.d.ts +29 -18
  176. package/dist/src/config/schema.js +44 -33
  177. package/dist/src/gateway/agents-admin.js +1 -1
  178. package/dist/src/gateway/hono/app.js +12 -6
  179. package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
  180. package/dist/src/gateway/hono/lib/safe-providers-config.d.ts +0 -3
  181. package/dist/src/gateway/hono/lib/safe-providers-config.js +1 -3
  182. package/dist/src/gateway/hono/middleware/strict-rate-limit.d.ts +4 -0
  183. package/dist/src/gateway/hono/middleware/strict-rate-limit.js +8 -1
  184. package/dist/src/gateway/hono/routes/browser-workflows.d.ts +3 -0
  185. package/dist/src/gateway/hono/routes/browser-workflows.js +78 -0
  186. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -11
  187. package/dist/src/gateway/hono/routes/deps.d.ts +1 -0
  188. package/dist/src/gateway/hono/routes/home.js +1 -0
  189. package/dist/src/gateway/hono/routes/index.js +4 -0
  190. package/dist/src/gateway/hono/routes/interaction-state.d.ts +3 -0
  191. package/dist/src/gateway/hono/routes/interaction-state.js +45 -0
  192. package/dist/src/gateway/hono/routes/lazy-bundles.js +17 -2
  193. package/dist/src/gateway/hono/routes/memory.js +33 -4
  194. package/dist/src/gateway/hono/routes/models.js +151 -129
  195. package/dist/src/gateway/hono/routes/task-outcomes.d.ts +3 -0
  196. package/dist/src/gateway/hono/routes/task-outcomes.js +109 -0
  197. package/dist/src/gateway/hono/routes/you.d.ts +10 -2
  198. package/dist/src/gateway/hono/routes/you.js +184 -28
  199. package/dist/src/gateway/image-generation-setup.d.ts +40 -0
  200. package/dist/src/gateway/image-generation-setup.js +130 -0
  201. package/dist/src/gateway/rate-limit/buckets.d.ts +3 -0
  202. package/dist/src/gateway/rate-limit/buckets.js +12 -0
  203. package/dist/src/gateway/service/run-gateway-agent.js +84 -0
  204. package/dist/src/gateway/service.d.ts +6 -0
  205. package/dist/src/gateway/service.js +24 -0
  206. package/dist/src/media-shared/http/private-network.d.ts +1 -1
  207. package/dist/src/media-shared/http/private-network.js +1 -1
  208. package/dist/src/proactive/insight-repository.d.ts +2 -0
  209. package/dist/src/proactive/insight-repository.js +5 -2
  210. package/dist/src/proactive/run-processor.js +22 -1
  211. package/dist/src/proactive/types.d.ts +2 -0
  212. package/dist/src/proactive/value-score.d.ts +13 -0
  213. package/dist/src/proactive/value-score.js +30 -0
  214. package/dist/src/providers/auth-runtime/resolve-api-key.d.ts +2 -4
  215. package/dist/src/providers/auth-runtime/resolve-api-key.js +2 -4
  216. package/dist/src/providers/auth-runtime/resolve-auth.d.ts +3 -4
  217. package/dist/src/providers/auth-runtime/resolve-auth.js +18 -18
  218. package/dist/src/providers/domestic-presets.d.ts +22 -0
  219. package/dist/src/providers/domestic-presets.js +25 -0
  220. package/dist/src/providers/model-catalog-store.d.ts +71 -0
  221. package/dist/src/providers/model-catalog-store.js +102 -0
  222. package/dist/src/providers/model-catalog-sync-service.d.ts +41 -0
  223. package/dist/src/providers/model-catalog-sync-service.js +142 -0
  224. package/dist/src/providers/model-reference-auditor.d.ts +14 -0
  225. package/dist/src/providers/model-reference-auditor.js +71 -0
  226. package/dist/src/providers/model-registry.d.ts +4 -1
  227. package/dist/src/providers/model-registry.js +35 -2
  228. package/dist/src/providers/presentation.js +2 -0
  229. package/dist/src/providers/xopc-cloud-connection.d.ts +51 -0
  230. package/dist/src/providers/xopc-cloud-connection.js +196 -0
  231. package/dist/src/session/index.d.ts +1 -1
  232. package/dist/src/session/index.js +2 -2
  233. package/dist/src/session/session-title.d.ts +2 -0
  234. package/dist/src/session/session-title.js +24 -3
  235. package/dist/src/share/share-types.js +5 -5
  236. package/dist/src/share/site-share-types.d.ts +1 -1
  237. package/dist/src/share/site-share-types.js +5 -5
  238. package/dist/src/storage/sqlite/index.d.ts +3 -0
  239. package/dist/src/storage/sqlite/index.js +4 -1
  240. package/dist/src/storage/sqlite/interaction-state-repository.d.ts +17 -0
  241. package/dist/src/storage/sqlite/interaction-state-repository.js +60 -0
  242. package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
  243. package/dist/src/storage/sqlite/migrations/053_browser_recipes.sql +45 -0
  244. package/dist/src/storage/sqlite/migrations/054_task_outcomes.sql +24 -0
  245. package/dist/src/storage/sqlite/migrations/055_relationship_settings.sql +14 -0
  246. package/dist/src/storage/sqlite/migrations/056_task_verification.sql +6 -0
  247. package/dist/src/storage/sqlite/migrations/057_interaction_states.sql +11 -0
  248. package/dist/src/storage/sqlite/migrations/058_proactive_value.sql +3 -0
  249. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  250. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  251. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  252. package/dist/src/storage/sqlite/relationship-settings-repository.d.ts +17 -0
  253. package/dist/src/storage/sqlite/relationship-settings-repository.js +64 -0
  254. package/dist/src/storage/sqlite/schema.js +1 -1
  255. package/dist/src/storage/sqlite/schema.sql +46 -0
  256. package/dist/src/storage/sqlite/task-outcome-repository.d.ts +90 -0
  257. package/dist/src/storage/sqlite/task-outcome-repository.js +138 -0
  258. package/dist/src/user-context/interaction-state.d.ts +13 -0
  259. package/dist/src/user-context/interaction-state.js +69 -0
  260. package/dist/src/user-context/memory-use-audit.d.ts +10 -0
  261. package/dist/src/user-context/memory-use-audit.js +25 -0
  262. package/dist/src/user-context/personal-playbook.d.ts +11 -0
  263. package/dist/src/user-context/personal-playbook.js +41 -0
  264. package/dist/src/user-context/projection.d.ts +4 -0
  265. package/dist/src/user-context/projection.js +5 -1
  266. package/dist/src/user-context/relationship-continuity.d.ts +14 -0
  267. package/dist/src/user-context/relationship-continuity.js +51 -0
  268. package/package.json +5 -7
  269. package/dist/extensions/dashscope/src/index.d.ts +0 -4
  270. package/dist/extensions/dashscope/src/index.js +0 -2
  271. package/dist/extensions/dashscope/xopc.extension.json +0 -15
  272. package/dist/extensions/fal/src/index.d.ts +0 -4
  273. package/dist/extensions/fal/src/index.js +0 -2
  274. package/dist/extensions/fal/xopc.extension.json +0 -14
  275. package/dist/extensions/google/src/index.d.ts +0 -4
  276. package/dist/extensions/google/src/index.js +0 -2
  277. package/dist/extensions/google/xopc.extension.json +0 -14
  278. package/dist/extensions/minimax/src/index.d.ts +0 -4
  279. package/dist/extensions/minimax/src/index.js +0 -2
  280. package/dist/extensions/minimax/xopc.extension.json +0 -15
  281. package/dist/extensions/openai/src/index.d.ts +0 -4
  282. package/dist/extensions/openai/src/index.js +0 -2
  283. package/dist/extensions/openai/xopc.extension.json +0 -14
  284. package/dist/gateway/static/root/assets/action-boundary-settings-panel-BIVBUiNT.js +0 -1
  285. package/dist/gateway/static/root/assets/agents-_qbUaYbs.js +0 -2
  286. package/dist/gateway/static/root/assets/apps-page-0sPqD0FK.js +0 -1
  287. package/dist/gateway/static/root/assets/automations-page-BxWBuBsE.js +0 -6
  288. package/dist/gateway/static/root/assets/browser-settings-page-C499b9AH.js +0 -8
  289. package/dist/gateway/static/root/assets/capability-presets-settings-panel-Dva9SiPK.js +0 -2
  290. package/dist/gateway/static/root/assets/channels-settings-DNAU7u9o.js +0 -1
  291. package/dist/gateway/static/root/assets/channels-status-swr-CIOH7tgn.js +0 -1
  292. package/dist/gateway/static/root/assets/connectors-page-TwiBp8vY.js +0 -2
  293. package/dist/gateway/static/root/assets/extension-settings-page-DKA9-lyP.js +0 -1
  294. package/dist/gateway/static/root/assets/goal-create-dialog-Q3B0E-0s.js +0 -1
  295. package/dist/gateway/static/root/assets/goal-detail-page-C5VAK04G.js +0 -4
  296. package/dist/gateway/static/root/assets/goals-page-BJb-5IYw.js +0 -2
  297. package/dist/gateway/static/root/assets/index-CkUHH170.css +0 -1
  298. package/dist/gateway/static/root/assets/index-vq_cJZJC.js +0 -199
  299. package/dist/gateway/static/root/assets/local-app-workbench-page-euH17Kvb.js +0 -2
  300. package/dist/gateway/static/root/assets/logs-page-CyYCBqym.js +0 -7
  301. package/dist/gateway/static/root/assets/messages-CxySDn9d.js +0 -5
  302. package/dist/gateway/static/root/assets/models-hub-panel-DObxxjc9.js +0 -2
  303. package/dist/gateway/static/root/assets/notes-workbench-CCb4RXcZ.js +0 -4
  304. package/dist/gateway/static/root/assets/project-detail-page-BvEcriRC.js +0 -1
  305. package/dist/gateway/static/root/assets/projects-page-B_e79MRJ.js +0 -1
  306. package/dist/gateway/static/root/assets/remote-access-hub-DGcqnYfR.js +0 -1
  307. package/dist/gateway/static/root/assets/save-bar-controls-CkeKasGm.js +0 -1
  308. package/dist/gateway/static/root/assets/schedule-field-TkqUL3wm.js +0 -1
  309. package/dist/gateway/static/root/assets/sessions-page-DQZhrDJ8.js +0 -1
  310. package/dist/gateway/static/root/assets/settings-advanced-gate-BkdeN99Y.js +0 -1
  311. package/dist/gateway/static/root/assets/settings-collapsible-section-Dpqth3oA.js +0 -1
  312. package/dist/gateway/static/root/assets/settings-page-qPG7I2zd.js +0 -1
  313. package/dist/gateway/static/root/assets/setup-status-panel-lwRAh9aw.js +0 -1
  314. package/dist/gateway/static/root/assets/shares-settings-BGj9IVUr.js +0 -1
  315. package/dist/gateway/static/root/assets/skill-reload-api-B2UBAs5U.js +0 -1
  316. package/dist/gateway/static/root/assets/skills-page-DdjzFZ8I.js +0 -2
  317. package/dist/gateway/static/root/assets/user-context-page-BTTZpAGV.js +0 -1
  318. package/dist/gateway/static/root/assets/voice-api-key-field-DuDQd-WU.js +0 -1
  319. package/dist/gateway/static/root/assets/work-discovery-page-BUVkVCsW.js +0 -1
  320. package/dist/gateway/static/root/assets/work-item-detail-page-DeEPPu4n.js +0 -1
  321. package/dist/gateway/static/root/assets/work-page-DQNUyTUq.js +0 -1
  322. package/dist/gateway/static/root/assets/workflows-page-BIy4wrzO.js +0 -11
  323. package/dist/src/agent/image/generation/bundled-registry.d.ts +0 -18
  324. package/dist/src/agent/image/generation/bundled-registry.js +0 -35
  325. package/dist/src/agent/image/generation/bundled.d.ts +0 -10
  326. package/dist/src/agent/image/generation/bundled.js +0 -15
  327. package/dist/src/agent/image/generation/image-provider-ui.d.ts +0 -20
  328. package/dist/src/browser/pipeline/source.d.ts +0 -9
  329. package/dist/src/browser/pipeline/source.js +0 -77
  330. package/dist/src/gateway/image-capabilities.d.ts +0 -28
  331. package/dist/src/gateway/image-capabilities.js +0 -78
  332. package/dist/src/generated/bundled-image-generation-providers.d.ts +0 -14
  333. package/dist/src/generated/bundled-image-generation-providers.js +0 -17
  334. /package/dist/src/{agent/image/generation/image-provider-ui.js → browser/recipes/types.js} +0 -0
@@ -0,0 +1,71 @@
1
+ import { z } from 'zod';
2
+ declare const CatalogModelSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ availability: z.ZodEnum<{
6
+ available: "available";
7
+ unavailable: "unavailable";
8
+ }>;
9
+ maxOutputTokens: z.ZodNullable<z.ZodNumber>;
10
+ }, z.core.$strip>;
11
+ declare const CatalogSourceSchema: z.ZodObject<{
12
+ providerId: z.ZodString;
13
+ baseUrl: z.ZodString;
14
+ api: z.ZodEnum<{
15
+ "openai-completions": "openai-completions";
16
+ "openai-responses": "openai-responses";
17
+ }>;
18
+ etag: z.ZodNullable<z.ZodString>;
19
+ recommendedModel: z.ZodNullable<z.ZodString>;
20
+ lastSuccessAt: z.ZodNumber;
21
+ models: z.ZodArray<z.ZodObject<{
22
+ id: z.ZodString;
23
+ name: z.ZodString;
24
+ availability: z.ZodEnum<{
25
+ available: "available";
26
+ unavailable: "unavailable";
27
+ }>;
28
+ maxOutputTokens: z.ZodNullable<z.ZodNumber>;
29
+ }, z.core.$strip>>;
30
+ }, z.core.$strip>;
31
+ declare const ModelCatalogSchema: z.ZodObject<{
32
+ sources: z.ZodRecord<z.ZodString, z.ZodObject<{
33
+ providerId: z.ZodString;
34
+ baseUrl: z.ZodString;
35
+ api: z.ZodEnum<{
36
+ "openai-completions": "openai-completions";
37
+ "openai-responses": "openai-responses";
38
+ }>;
39
+ etag: z.ZodNullable<z.ZodString>;
40
+ recommendedModel: z.ZodNullable<z.ZodString>;
41
+ lastSuccessAt: z.ZodNumber;
42
+ models: z.ZodArray<z.ZodObject<{
43
+ id: z.ZodString;
44
+ name: z.ZodString;
45
+ availability: z.ZodEnum<{
46
+ available: "available";
47
+ unavailable: "unavailable";
48
+ }>;
49
+ maxOutputTokens: z.ZodNullable<z.ZodNumber>;
50
+ }, z.core.$strip>>;
51
+ }, z.core.$strip>>;
52
+ }, z.core.$strip>;
53
+ export type CatalogModel = z.infer<typeof CatalogModelSchema>;
54
+ export type CatalogSource = z.infer<typeof CatalogSourceSchema>;
55
+ export type ModelCatalogSnapshot = z.infer<typeof ModelCatalogSchema>;
56
+ export type AvailableCatalogModel = Omit<CatalogModel, 'availability'>;
57
+ export declare class ModelCatalogStore {
58
+ private readonly path;
59
+ constructor(path?: string);
60
+ load(): ModelCatalogSnapshot;
61
+ getSource(sourceId: string): CatalogSource | undefined;
62
+ saveSource(sourceId: string, source: CatalogSource): void;
63
+ removeSource(sourceId: string): boolean;
64
+ replaceSourceModels(sourceId: string, source: Omit<CatalogSource, 'models'>, models: AvailableCatalogModel[]): {
65
+ addedCount: number;
66
+ unavailableCount: number;
67
+ };
68
+ }
69
+ export declare function getModelCatalogStore(): ModelCatalogStore;
70
+ export declare function resetModelCatalogStore(): void;
71
+ export {};
@@ -0,0 +1,102 @@
1
+ import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
+ import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
3
+ import { createLogger } from "../utils/logger/index.js";
4
+ import { init_logger } from "../utils/logger.js";
5
+ import { init_write_file_atomic, writeTextAtomicSync } from "../infra/write-file-atomic.js";
6
+ import { join } from "node:path";
7
+ import { existsSync, readFileSync } from "node:fs";
8
+ import { z } from "zod";
9
+ //#region src/providers/model-catalog-store.ts
10
+ function getModelCatalogStore() {
11
+ globalModelCatalogStore ??= new ModelCatalogStore();
12
+ return globalModelCatalogStore;
13
+ }
14
+ function resetModelCatalogStore() {
15
+ globalModelCatalogStore = void 0;
16
+ }
17
+ var log, CatalogModelSchema, CatalogSourceSchema, ModelCatalogSchema, ModelCatalogStore, globalModelCatalogStore;
18
+ var init_model_catalog_store = __esmMin((() => {
19
+ init_paths_state();
20
+ init_write_file_atomic();
21
+ init_logger();
22
+ log = createLogger("ModelCatalogStore");
23
+ CatalogModelSchema = z.object({
24
+ id: z.string().min(1),
25
+ name: z.string().min(1),
26
+ availability: z.enum(["available", "unavailable"]),
27
+ maxOutputTokens: z.number().positive().nullable()
28
+ });
29
+ CatalogSourceSchema = z.object({
30
+ providerId: z.string().min(1),
31
+ baseUrl: z.string().url(),
32
+ api: z.enum(["openai-completions", "openai-responses"]),
33
+ etag: z.string().nullable(),
34
+ recommendedModel: z.string().nullable(),
35
+ lastSuccessAt: z.number().int().nonnegative(),
36
+ models: z.array(CatalogModelSchema)
37
+ });
38
+ ModelCatalogSchema = z.object({ sources: z.record(z.string(), CatalogSourceSchema) });
39
+ ModelCatalogStore = class {
40
+ constructor(path = join(resolveStateDir(), "model-catalog.json")) {
41
+ this.path = path;
42
+ }
43
+ load() {
44
+ if (!existsSync(this.path)) return { sources: {} };
45
+ try {
46
+ const parsed = ModelCatalogSchema.safeParse(JSON.parse(readFileSync(this.path, "utf8")));
47
+ if (parsed.success) return parsed.data;
48
+ log.warn({
49
+ path: this.path,
50
+ errorMessage: parsed.error.message
51
+ }, "Ignoring invalid model catalog snapshot");
52
+ } catch (err) {
53
+ log.warn({
54
+ err,
55
+ path: this.path
56
+ }, "Ignoring unreadable model catalog snapshot");
57
+ }
58
+ return { sources: {} };
59
+ }
60
+ getSource(sourceId) {
61
+ return this.load().sources[sourceId];
62
+ }
63
+ saveSource(sourceId, source) {
64
+ const current = this.load();
65
+ const next = ModelCatalogSchema.parse({ sources: {
66
+ ...current.sources,
67
+ [sourceId]: source
68
+ } });
69
+ writeTextAtomicSync(this.path, `${JSON.stringify(next, null, 2)}\n`, { mode: 384 });
70
+ }
71
+ removeSource(sourceId) {
72
+ const current = this.load();
73
+ if (!current.sources[sourceId]) return false;
74
+ const { [sourceId]: _removed, ...sources } = current.sources;
75
+ writeTextAtomicSync(this.path, `${JSON.stringify({ sources }, null, 2)}\n`, { mode: 384 });
76
+ return true;
77
+ }
78
+ replaceSourceModels(sourceId, source, models) {
79
+ const previous = this.getSource(sourceId);
80
+ const nextIds = new Set(models.map((model) => model.id));
81
+ const previousAvailableIds = new Set((previous?.models ?? []).filter((model) => model.availability === "available").map((model) => model.id));
82
+ const unavailable = (previous?.models ?? []).filter((model) => !nextIds.has(model.id)).map((model) => ({
83
+ ...model,
84
+ availability: "unavailable"
85
+ }));
86
+ this.saveSource(sourceId, {
87
+ ...source,
88
+ models: [...models.map((model) => ({
89
+ ...model,
90
+ availability: "available"
91
+ })), ...unavailable]
92
+ });
93
+ return {
94
+ addedCount: models.filter((model) => !previousAvailableIds.has(model.id)).length,
95
+ unavailableCount: unavailable.length
96
+ };
97
+ }
98
+ };
99
+ }));
100
+ //#endregion
101
+ init_model_catalog_store();
102
+ export { ModelCatalogStore, getModelCatalogStore, init_model_catalog_store, resetModelCatalogStore };
@@ -0,0 +1,41 @@
1
+ import type { Config } from '../config/schema.js';
2
+ import { type ModelsJsonConfig } from '../config/models-json.js';
3
+ import { type ModelCatalogStore } from './model-catalog-store.js';
4
+ import { discoverProviderModels } from './model-discovery.js';
5
+ import { XopcCloudConnectionService } from './xopc-cloud-connection.js';
6
+ export interface ModelCatalogSyncStatus {
7
+ running: boolean;
8
+ refreshing: boolean;
9
+ lastAttemptAt?: number;
10
+ lastSuccessAt?: number;
11
+ lastError?: string;
12
+ sourceErrors?: Record<string, string>;
13
+ }
14
+ export declare class ModelCatalogSyncService {
15
+ private readonly options;
16
+ private readonly xopcCloud;
17
+ private timer;
18
+ private refreshPromise;
19
+ private refreshAllPromise;
20
+ private status;
21
+ constructor(options?: {
22
+ intervalMs?: number;
23
+ onUpdated?: (modelCount: number) => void;
24
+ xopcCloud?: XopcCloudConnectionService;
25
+ getConfig?: () => Config;
26
+ catalogStore?: ModelCatalogStore;
27
+ loadProviders?: () => ModelsJsonConfig['providers'];
28
+ discoverModels?: typeof discoverProviderModels;
29
+ refreshModels?: () => void;
30
+ getModelCount?: () => number;
31
+ });
32
+ start(): void;
33
+ stop(): void;
34
+ getStatus(): ModelCatalogSyncStatus;
35
+ getXopcCloudConnection(): XopcCloudConnectionService;
36
+ refreshNow(): Promise<Awaited<ReturnType<XopcCloudConnectionService['refreshCatalog']>>>;
37
+ refreshAll(): Promise<{
38
+ updatedSources: string[];
39
+ }>;
40
+ private refreshAllSources;
41
+ }
@@ -0,0 +1,142 @@
1
+ import { createLogger } from "../utils/logger/index.js";
2
+ import { init_logger } from "../utils/logger.js";
3
+ import { init_models_json, loadModelsJson } from "../config/models-json.js";
4
+ import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
5
+ import { getModelRegistry, init_model_registry } from "./model-registry.js";
6
+ import { discoverProviderModels, isProviderApiDiscoverable } from "./model-discovery.js";
7
+ import { XopcCloudConnectionService } from "./xopc-cloud-connection.js";
8
+ //#region src/providers/model-catalog-sync-service.ts
9
+ init_logger();
10
+ init_models_json();
11
+ init_model_catalog_store();
12
+ init_model_registry();
13
+ const log = createLogger("ModelCatalogSync");
14
+ const DEFAULT_INTERVAL_MS = 360 * 6e4;
15
+ var ModelCatalogSyncService = class {
16
+ xopcCloud;
17
+ timer = null;
18
+ refreshPromise = null;
19
+ refreshAllPromise = null;
20
+ status = {
21
+ running: false,
22
+ refreshing: false
23
+ };
24
+ constructor(options = {}) {
25
+ this.options = options;
26
+ this.xopcCloud = options.xopcCloud ?? new XopcCloudConnectionService();
27
+ try {
28
+ const lastSuccessAt = getModelCatalogStore().getSource("xopc-cloud")?.lastSuccessAt;
29
+ if (lastSuccessAt !== void 0) this.status.lastSuccessAt = lastSuccessAt;
30
+ } catch {}
31
+ }
32
+ start() {
33
+ if (this.status.running) return;
34
+ const settings = this.options.getConfig?.().modelCatalog;
35
+ if (settings?.enabled === false) return;
36
+ this.status.running = true;
37
+ if (settings?.refreshOnStartup !== false) queueMicrotask(() => void this.refreshAll().catch(() => {}));
38
+ const intervalMs = this.options.intervalMs ?? (settings?.intervalHours ?? 6) * 60 * 6e4;
39
+ this.timer = setInterval(() => void this.refreshAll().catch(() => {}), intervalMs || DEFAULT_INTERVAL_MS);
40
+ this.timer.unref();
41
+ }
42
+ stop() {
43
+ if (this.timer) clearInterval(this.timer);
44
+ this.timer = null;
45
+ this.status.running = false;
46
+ }
47
+ getStatus() {
48
+ return { ...this.status };
49
+ }
50
+ getXopcCloudConnection() {
51
+ return this.xopcCloud;
52
+ }
53
+ refreshNow() {
54
+ if (this.refreshPromise) return this.refreshPromise;
55
+ this.status.refreshing = true;
56
+ this.status.lastAttemptAt = Date.now();
57
+ this.refreshPromise = this.xopcCloud.refreshCatalog().then((result) => {
58
+ if (result.status === "updated") {
59
+ this.status.lastSuccessAt = Date.now();
60
+ this.status.lastError = void 0;
61
+ this.options.onUpdated?.(result.modelCount ?? 0);
62
+ } else if (result.status === "unchanged") {
63
+ this.status.lastSuccessAt = Date.now();
64
+ this.status.lastError = void 0;
65
+ }
66
+ return result;
67
+ }).catch((err) => {
68
+ const errorMessage = err instanceof Error ? err.message : String(err);
69
+ this.status.lastError = errorMessage;
70
+ log.warn({
71
+ err,
72
+ errorMessage
73
+ }, `Model catalog refresh failed: ${errorMessage}`);
74
+ throw err;
75
+ }).finally(() => {
76
+ this.status.refreshing = false;
77
+ this.refreshPromise = null;
78
+ });
79
+ return this.refreshPromise;
80
+ }
81
+ refreshAll() {
82
+ if (this.refreshAllPromise) return this.refreshAllPromise;
83
+ this.status.refreshing = true;
84
+ this.refreshAllPromise = this.refreshAllSources().finally(() => {
85
+ this.status.refreshing = false;
86
+ this.refreshAllPromise = null;
87
+ });
88
+ return this.refreshAllPromise;
89
+ }
90
+ async refreshAllSources() {
91
+ const updatedSources = [];
92
+ const sourceErrors = {};
93
+ try {
94
+ if ((await this.refreshNow()).status === "updated") updatedSources.push("xopc-cloud");
95
+ } catch (err) {
96
+ sourceErrors["xopc-cloud"] = err instanceof Error ? err.message : String(err);
97
+ }
98
+ this.status.refreshing = true;
99
+ const providers = this.options.loadProviders?.() ?? loadModelsJson().config.providers;
100
+ const discoverable = Object.entries(providers).filter(([, provider]) => provider.modelDiscovery?.enabled === true && typeof provider.baseUrl === "string" && isProviderApiDiscoverable(provider.api));
101
+ const catalogStore = this.options.catalogStore ?? getModelCatalogStore();
102
+ const enabledSourceIds = new Set(discoverable.map(([providerId]) => `provider:${providerId}`));
103
+ const removedSource = Object.keys(catalogStore.load().sources).filter((sourceId) => sourceId.startsWith("provider:") && !enabledSourceIds.has(sourceId)).map((sourceId) => catalogStore.removeSource(sourceId)).some(Boolean);
104
+ const results = await Promise.all(discoverable.map(async ([providerId, provider]) => {
105
+ try {
106
+ const models = await (this.options.discoverModels ?? discoverProviderModels)({
107
+ providerId,
108
+ baseUrl: provider.baseUrl,
109
+ apiKey: provider.apiKey,
110
+ api: provider.api,
111
+ headers: provider.headers
112
+ });
113
+ catalogStore.replaceSourceModels(`provider:${providerId}`, {
114
+ providerId,
115
+ baseUrl: provider.baseUrl,
116
+ api: provider.api === "openai-responses" ? "openai-responses" : "openai-completions",
117
+ etag: null,
118
+ recommendedModel: null,
119
+ lastSuccessAt: Date.now()
120
+ }, models.map((model) => ({
121
+ id: model.id,
122
+ name: model.name ?? model.id,
123
+ maxOutputTokens: null
124
+ })));
125
+ return providerId;
126
+ } catch (err) {
127
+ sourceErrors[providerId] = err instanceof Error ? err.message : String(err);
128
+ return null;
129
+ }
130
+ }));
131
+ for (const providerId of results) if (providerId) updatedSources.push(providerId);
132
+ if (results.some(Boolean) || removedSource) {
133
+ (this.options.refreshModels ?? (() => getModelRegistry().refresh()))();
134
+ this.status.lastSuccessAt = Date.now();
135
+ this.options.onUpdated?.(this.options.getModelCount?.() ?? getModelRegistry().getAll().length);
136
+ }
137
+ this.status.sourceErrors = Object.keys(sourceErrors).length > 0 ? sourceErrors : void 0;
138
+ return { updatedSources };
139
+ }
140
+ };
141
+ //#endregion
142
+ export { ModelCatalogSyncService };
@@ -0,0 +1,14 @@
1
+ import type { Config } from '../config/schema.js';
2
+ import type { SessionAgentConfig } from '../session/config-types.js';
3
+ import { type ModelCatalogSnapshot } from './model-catalog-store.js';
4
+ import { type ModelRegistry } from './model-registry.js';
5
+ export interface ModelReferenceHealth {
6
+ ref: string;
7
+ availability: 'available' | 'unavailable';
8
+ locations: string[];
9
+ suggestedRef?: string;
10
+ }
11
+ export declare function auditModelReferences(config: Config, sessionConfigs?: ReadonlyMap<string, SessionAgentConfig>, deps?: {
12
+ registry?: ModelRegistry;
13
+ catalog?: ModelCatalogSnapshot;
14
+ }): ModelReferenceHealth[];
@@ -0,0 +1,71 @@
1
+ import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
2
+ import { getModelRegistry, init_model_registry } from "./model-registry.js";
3
+ //#region src/providers/model-reference-auditor.ts
4
+ init_model_catalog_store();
5
+ init_model_registry();
6
+ function asRecord(value) {
7
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
8
+ }
9
+ function addRef(out, value, location) {
10
+ if (typeof value === "string" && value.trim()) out.push({
11
+ ref: value.trim(),
12
+ location
13
+ });
14
+ }
15
+ function collectToolModel(out, value, location) {
16
+ const model = asRecord(value);
17
+ if (!model) return;
18
+ addRef(out, model.primary, `${location}.primary`);
19
+ if (Array.isArray(model.fallbacks)) model.fallbacks.forEach((ref, index) => addRef(out, ref, `${location}.fallbacks[${index}]`));
20
+ }
21
+ function collectModelPolicy(out, value, location) {
22
+ const policy = asRecord(value);
23
+ if (!policy) return;
24
+ const roles = asRecord(policy.roles);
25
+ for (const [roleId, roleValue] of Object.entries(roles ?? {})) {
26
+ const role = asRecord(roleValue);
27
+ if (!role) continue;
28
+ addRef(out, role.model, `${location}.roles.${roleId}.model`);
29
+ if (Array.isArray(role.fallbacks)) role.fallbacks.forEach((ref, index) => addRef(out, ref, `${location}.roles.${roleId}.fallbacks[${index}]`));
30
+ }
31
+ collectToolModel(out, policy.imageModel, `${location}.imageModel`);
32
+ collectToolModel(out, policy.imageGenerationModel, `${location}.imageGenerationModel`);
33
+ }
34
+ function collectReferences(config, sessionConfigs) {
35
+ const out = [];
36
+ for (const [presetId, preset] of Object.entries(config.agents.capabilityPresets)) collectModelPolicy(out, preset.models, `agents.capabilityPresets.${presetId}.models`);
37
+ for (const agent of config.agents.list) collectModelPolicy(out, agent.models, `agents.list.${agent.id}.models`);
38
+ for (const [sessionKey, sessionConfig] of sessionConfigs) addRef(out, sessionConfig.modelOverride, `sessions.${sessionKey}.modelOverride`);
39
+ return out;
40
+ }
41
+ function suggestedRef(ref, catalog) {
42
+ const providerId = ref.split("/")[0];
43
+ const source = Object.values(catalog.sources).find((entry) => entry.providerId === providerId);
44
+ if (!source) return void 0;
45
+ const available = new Set(source.models.filter((model) => model.availability === "available").map((model) => model.id));
46
+ if (source.recommendedModel && available.has(source.recommendedModel)) return `${providerId}/${source.recommendedModel}`;
47
+ const first = source.models.find((model) => model.availability === "available");
48
+ return first ? `${providerId}/${first.id}` : void 0;
49
+ }
50
+ function auditModelReferences(config, sessionConfigs = /* @__PURE__ */ new Map(), deps = {}) {
51
+ const registry = deps.registry ?? getModelRegistry();
52
+ const catalog = deps.catalog ?? getModelCatalogStore().load();
53
+ const grouped = /* @__PURE__ */ new Map();
54
+ for (const reference of collectReferences(config, sessionConfigs)) {
55
+ const locations = grouped.get(reference.ref) ?? [];
56
+ locations.push(reference.location);
57
+ grouped.set(reference.ref, locations);
58
+ }
59
+ return [...grouped.entries()].map(([ref, locations]) => {
60
+ const availability = registry.resolve(ref) ? "available" : "unavailable";
61
+ const suggestion = availability === "unavailable" ? suggestedRef(ref, catalog) : void 0;
62
+ return {
63
+ ref,
64
+ availability,
65
+ locations,
66
+ ...suggestion ? { suggestedRef: suggestion } : {}
67
+ };
68
+ }).sort((a, b) => a.ref.localeCompare(b.ref));
69
+ }
70
+ //#endregion
71
+ export { auditModelReferences };
@@ -10,11 +10,13 @@
10
10
  * - Hot reload support
11
11
  */
12
12
  import { type Api, type Model } from '@earendil-works/pi-ai/compat';
13
+ import { type ModelCatalogStore } from './model-catalog-store.js';
13
14
  /**
14
15
  * Model Registry - manages all models (built-in + custom)
15
16
  */
16
17
  export declare class ModelRegistry {
17
18
  private modelsJsonPath;
19
+ private catalogStore;
18
20
  private models;
19
21
  private customProviderApiKeys;
20
22
  private loadError;
@@ -22,7 +24,7 @@ export declare class ModelRegistry {
22
24
  private prewarmPromise;
23
25
  private _availableModelsCache;
24
26
  private _authStatusCache;
25
- constructor(modelsJsonPath?: string);
27
+ constructor(modelsJsonPath?: string, catalogStore?: ModelCatalogStore);
26
28
  isLoaded(): boolean;
27
29
  /** Synchronously materialize the catalog (idempotent). */
28
30
  ensureLoaded(): void;
@@ -69,6 +71,7 @@ export declare class ModelRegistry {
69
71
  * Clears caches to ensure fresh data
70
72
  */
71
73
  private loadModels;
74
+ private loadRemoteModels;
72
75
  /**
73
76
  * Load built-in models and apply provider/model overrides
74
77
  */
@@ -5,6 +5,7 @@ import { resolveModelsJsonPath } from "../config/paths.js";
5
5
  import { init_resolve_config_value, resolveConfigValue, resolveHeaders } from "../config/resolve-config-value.js";
6
6
  import { getDefaultModelValues, init_models_json, validateModelsConfig } from "../config/models-json.js";
7
7
  import { getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
8
+ import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
8
9
  import { existsSync, readFileSync } from "fs";
9
10
  import { getModels, getProviders } from "@earendil-works/pi-ai/compat";
10
11
  //#region src/providers/model-registry.ts
@@ -94,6 +95,7 @@ var init_model_registry = __esmMin((() => {
94
95
  init_models_json();
95
96
  init_logger();
96
97
  init_env_keys();
98
+ init_model_catalog_store();
97
99
  log = createLogger("ModelRegistry");
98
100
  ModelRegistry = class {
99
101
  models = [];
@@ -103,8 +105,9 @@ var init_model_registry = __esmMin((() => {
103
105
  prewarmPromise = null;
104
106
  _availableModelsCache;
105
107
  _authStatusCache = /* @__PURE__ */ new Map();
106
- constructor(modelsJsonPath = resolveModelsJsonPath()) {
108
+ constructor(modelsJsonPath = resolveModelsJsonPath(), catalogStore = getModelCatalogStore()) {
107
109
  this.modelsJsonPath = modelsJsonPath;
110
+ this.catalogStore = catalogStore;
108
111
  }
109
112
  isLoaded() {
110
113
  return this.loaded;
@@ -213,13 +216,41 @@ var init_model_registry = __esmMin((() => {
213
216
  }
214
217
  this.customProviderApiKeys = apiKeyConfigs;
215
218
  const builtInModels = this.loadBuiltInModels(overrides, modelOverrides);
216
- this.models = this.mergeCustomModels(builtInModels, customModels);
219
+ const remoteModels = this.loadRemoteModels();
220
+ this.models = this.mergeCustomModels(this.mergeCustomModels(builtInModels, remoteModels), customModels);
217
221
  log.debug({
218
222
  builtIn: builtInModels.length,
223
+ remote: remoteModels.length,
219
224
  custom: customModels.length,
220
225
  total: this.models.length
221
226
  }, "Models loaded");
222
227
  }
228
+ loadRemoteModels() {
229
+ let sources;
230
+ try {
231
+ sources = this.catalogStore.load().sources;
232
+ } catch (err) {
233
+ log.warn({ err }, "Failed to load remote model catalog");
234
+ return [];
235
+ }
236
+ return Object.values(sources).flatMap((source) => source.models.filter((model) => model.availability === "available").map((model) => ({
237
+ id: model.id,
238
+ name: model.name,
239
+ api: source.api,
240
+ provider: source.providerId,
241
+ baseUrl: source.baseUrl,
242
+ reasoning: false,
243
+ input: ["text"],
244
+ cost: {
245
+ input: 0,
246
+ output: 0,
247
+ cacheRead: 0,
248
+ cacheWrite: 0
249
+ },
250
+ contextWindow: 128e3,
251
+ maxTokens: model.maxOutputTokens ?? 16384
252
+ })));
253
+ }
223
254
  /**
224
255
  * Load built-in models and apply provider/model overrides
225
256
  */
@@ -282,6 +313,7 @@ var init_model_registry = __esmMin((() => {
282
313
  const modelOverrides = /* @__PURE__ */ new Map();
283
314
  const apiKeyConfigs = /* @__PURE__ */ new Map();
284
315
  for (const [providerName, providerConfig] of Object.entries(config.providers)) {
316
+ if (providerName === "xopc-cloud") continue;
285
317
  if (providerConfig.baseUrl || providerConfig.headers || providerConfig.apiKey) overrides.set(providerName, {
286
318
  baseUrl: providerConfig.baseUrl,
287
319
  headers: providerConfig.headers,
@@ -309,6 +341,7 @@ var init_model_registry = __esmMin((() => {
309
341
  const models = [];
310
342
  const defaults = getDefaultModelValues();
311
343
  for (const [providerName, providerConfig] of Object.entries(config.providers)) {
344
+ if (providerName === "xopc-cloud") continue;
312
345
  const modelDefs = providerConfig.models ?? [];
313
346
  if (modelDefs.length === 0) continue;
314
347
  for (const modelDef of modelDefs) {
@@ -5,6 +5,7 @@ import { getDomesticProviderPreset, getDomesticProviderPresetIds } from "./domes
5
5
  init_providers();
6
6
  init_plugin_registry();
7
7
  const FEATURED_PROVIDER_ORDER = [
8
+ "xopc-cloud",
8
9
  "deepseek",
9
10
  "openai",
10
11
  "anthropic",
@@ -34,6 +35,7 @@ const FEATURED_PROVIDER_ORDER = [
34
35
  "minimax-cn"
35
36
  ];
36
37
  const PROVIDER_HINTS = {
38
+ "xopc-cloud": "Official XOPC model service with models discovered from your account.",
37
39
  openai: "Frontier OpenAI models from the official API.",
38
40
  anthropic: "Claude models for coding, long context, and reasoning.",
39
41
  xai: "Grok models from xAI.",
@@ -0,0 +1,51 @@
1
+ import { type CredentialResolver } from '../auth/credentials.js';
2
+ import { type ModelCatalogStore } from './model-catalog-store.js';
3
+ export interface XopcCloudConnectionOptions {
4
+ fetchImpl?: typeof fetch;
5
+ consoleUrl?: string;
6
+ routerUrl?: string;
7
+ deviceIdPath?: string;
8
+ catalogStore?: ModelCatalogStore;
9
+ credentials?: Pick<CredentialResolver, 'saveApiKey' | 'revealGatewayStoredApiKey' | 'deleteProfile'>;
10
+ refreshModels?: () => void;
11
+ now?: () => number;
12
+ }
13
+ export type XopcCloudPollResult = {
14
+ status: 'pending';
15
+ } | {
16
+ status: 'connected';
17
+ modelCount: number;
18
+ models: string[];
19
+ recommendedModel: string | null;
20
+ };
21
+ export declare class XopcCloudHttpError extends Error {
22
+ readonly status: number;
23
+ readonly code?: string;
24
+ constructor(message: string, status: number, code?: string);
25
+ }
26
+ export declare class XopcCloudConnectionService {
27
+ private readonly pending;
28
+ private readonly fetchImpl;
29
+ private readonly consoleUrl;
30
+ private readonly routerUrl;
31
+ private readonly deviceIdPath;
32
+ private readonly catalogStore;
33
+ private readonly credentials;
34
+ private readonly refreshModels;
35
+ private readonly now;
36
+ constructor(options?: XopcCloudConnectionOptions);
37
+ start(clientType: 'electron' | 'web' | 'cli'): Promise<{
38
+ requestId: string;
39
+ authorizationUrl: string;
40
+ expiresIn: number;
41
+ pollInterval: number;
42
+ }>;
43
+ poll(requestId: string): Promise<XopcCloudPollResult>;
44
+ refreshCatalog(): Promise<{
45
+ status: 'disconnected' | 'unchanged' | 'updated';
46
+ modelCount?: number;
47
+ }>;
48
+ private getOrCreateDeviceId;
49
+ private fetchCatalog;
50
+ private install;
51
+ }