@xopcai/xopc 0.0.163 → 0.0.165

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 (216) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{activity-store-Xj95LzTv.js → activity-store-DkALQFJT.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-C-QeUFwU.js → agent-avatar-dicebear-CKVX2TyD.js} +1 -1
  6. package/dist/gateway/static/root/assets/agents-F8749KZ_.js +2 -0
  7. package/dist/gateway/static/root/assets/{api-BTLmAm1_.js → api-DPIXEcIq.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-zc6Gf-S5.js → app-management-settings-panel-ClToHdDF.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-0fMLnOWn.js → appearance-settings-Ci2jWAkQ.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-DCow0nte.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-DOiR_E21.js → archive-plugin-CKv5A1_M.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-BxmYl1D1.js → attachment-load-LgoN-Vwo.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automation-suggestion-card-BhZOirad.js → automation-suggestion-card-BwnZqDQE.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-page-DWWHMqCZ.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-DTTKsvgk.js → binary-plugins-WwMRnBdP.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-C7se7iqg.js → block-editor-CThEfJSn.js} +47 -47
  17. package/dist/gateway/static/root/assets/browser-settings-page-7x8rKLOl.js +8 -0
  18. package/dist/gateway/static/root/assets/{browser-workflow-inputs-kxmStCcv.js → browser-workflow-inputs-DCj9DG0A.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-workflows-page-CwYf9OM_.js → browser-workflows-page-C1k2vHLV.js} +2 -2
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-DIwGIpuS.js +2 -0
  21. package/dist/gateway/static/root/assets/{capability-presets-api-BZKh2cWX.js → capability-presets-api-C_NVbV7o.js} +1 -1
  22. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DBdvIcV0.js +2 -0
  23. package/dist/gateway/static/root/assets/{channel-recipient-api-r7tdbnJE.js → channel-recipient-api-B5rLegwk.js} +1 -1
  24. package/dist/gateway/static/root/assets/channels-settings-DU93p9RZ.js +1 -0
  25. package/dist/gateway/static/root/assets/channels-status-swr-DZZq0upi.js +1 -0
  26. package/dist/gateway/static/root/assets/{connector-logo-BpnQYAxA.js → connector-logo-au5xzRMl.js} +1 -1
  27. package/dist/gateway/static/root/assets/connectors-page-B9sD56hT.js +2 -0
  28. package/dist/gateway/static/root/assets/desktop-pet-CaTO9bAV.js +1 -0
  29. package/dist/gateway/static/root/assets/{desktop-pet-settings-uv8Grtgk.js → desktop-pet-settings-CORq2BIE.js} +1 -1
  30. package/dist/gateway/static/root/assets/{directory-picker-path-field-C4TTvf7p.js → directory-picker-path-field-Daf0tqrN.js} +1 -1
  31. package/dist/gateway/static/root/assets/{dreaming-settings-CzJAUPvM.js → dreaming-settings-CJqJpvgc.js} +3 -3
  32. package/dist/gateway/static/root/assets/{extension-debug-page-Ci2mOYUt.js → extension-debug-page-0XmiUqsm.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-DeXdmhXQ.js → extension-page-C_9HSvyu.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-settings-page-C93vaOsU.js → extension-settings-page-DcmUCmOu.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-config-api-C31Hlblp.js → gateway-config-api-CZqfsxJf.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-settings-D3zS6RZh.js → gateway-settings-CzX8TVmO.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-startup-retry-CSRvCqxh.js → gateway-startup-retry-ulwTJovP.js} +1 -1
  38. package/dist/gateway/static/root/assets/goal-create-dialog-Dbj_sgV-.js +1 -0
  39. package/dist/gateway/static/root/assets/goal-detail-page-BdkiZwW-.js +4 -0
  40. package/dist/gateway/static/root/assets/{goals-config-api-D4wYNRrf.js → goals-config-api-Cvlq3jyf.js} +1 -1
  41. package/dist/gateway/static/root/assets/goals-page-BD9ztXNA.js +2 -0
  42. package/dist/gateway/static/root/assets/{goals-settings-Bx2jVvhQ.js → goals-settings-CSGvHJDi.js} +1 -1
  43. package/dist/gateway/static/root/assets/{heartbeat-settings-BEIF1eXy.js → heartbeat-settings-BvXA7oNN.js} +1 -1
  44. package/dist/gateway/static/root/assets/{index-HZdBKfk_.js → index-CfOzvGDb.js} +70 -70
  45. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DOEDpvTM.js → keyboard-shortcuts-settings-xb6mna1C.js} +1 -1
  46. package/dist/gateway/static/root/assets/local-app-workbench-page-DH4nglP_.js +2 -0
  47. package/dist/gateway/static/root/assets/{local-apps-page-B0OpGpxv.js → local-apps-page-BScdXqMo.js} +1 -1
  48. package/dist/gateway/static/root/assets/{locale-store-Ys6RP7Be.js → locale-store-C_ax27uc.js} +1 -1
  49. package/dist/gateway/static/root/assets/logs-page-BBpAWjyF.js +7 -0
  50. package/dist/gateway/static/root/assets/{markdown-split-CEZwysCH.js → markdown-split-8hnAS25m.js} +1 -1
  51. package/dist/gateway/static/root/assets/{media-plugins-CpGKE7B0.js → media-plugins-DzlHseMD.js} +1 -1
  52. package/dist/gateway/static/root/assets/{messages-BzI9Wx30.js → messages-C96Zjb0V.js} +2 -2
  53. package/dist/gateway/static/root/assets/{notes-page-CdiuDZ5a.js → notes-page-DbDHFPiI.js} +1 -1
  54. package/dist/gateway/static/root/assets/notes-workbench-B-A9whbg.js +4 -0
  55. package/dist/gateway/static/root/assets/{page-tabs-BkH5AVV2.js → page-tabs-CXJiygUJ.js} +1 -1
  56. package/dist/gateway/static/root/assets/{preview-open-alternatives-CQai8f9D.js → preview-open-alternatives-Cq6aue5a.js} +1 -1
  57. package/dist/gateway/static/root/assets/{product-open-page-B2kSdB2b.js → product-open-page-nP8vuNlJ.js} +1 -1
  58. package/dist/gateway/static/root/assets/project-detail-page-BXrscUbq.js +1 -0
  59. package/dist/gateway/static/root/assets/projects-page-m0EKUeaY.js +1 -0
  60. package/dist/gateway/static/root/assets/remote-access-hub-B16uQSY5.js +1 -0
  61. package/dist/gateway/static/root/assets/{save-bar-controls-NGYnO7n7.js → save-bar-controls-BPgnLY1p.js} +1 -1
  62. package/dist/gateway/static/root/assets/{schedule-field-nLOphnv3.js → schedule-field-rHWpueWl.js} +1 -1
  63. package/dist/gateway/static/root/assets/{schema-form-D0e90ndE.js → schema-form-CHKIUrzk.js} +1 -1
  64. package/dist/gateway/static/root/assets/sessions-page-C5_qtznc.js +1 -0
  65. package/dist/gateway/static/root/assets/settings-advanced-gate-DQlbm1mA.js +1 -0
  66. package/dist/gateway/static/root/assets/{settings-form-section-X2Sl-EAk.js → settings-form-section-CR4J0N4X.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DOnUabm7.js → settings-loading-skeleton-B8v-lHKT.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-page-C4UUNi1n.js → settings-page-BcLf8Rd5.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-page-layout-C1yYqbT6.js → settings-page-layout-Co31Becn.js} +1 -1
  70. package/dist/gateway/static/root/assets/setup-status-panel-BFLA1Fsj.js +1 -0
  71. package/dist/gateway/static/root/assets/{share-preview-page-Cfy_pH7V.js → share-preview-page-B5vMe8DY.js} +1 -1
  72. package/dist/gateway/static/root/assets/shares-settings-DL2tKPq6.js +1 -0
  73. package/dist/gateway/static/root/assets/skill-reload-api-C8jkuLob.js +1 -0
  74. package/dist/gateway/static/root/assets/skills-page-DAOZXlp5.js +2 -0
  75. package/dist/gateway/static/root/assets/{system-settings-panel-Da81RJ6G.js → system-settings-panel-CHt3FXI8.js} +1 -1
  76. package/dist/gateway/static/root/assets/{theme-store-DflSp9o4.js → theme-store-D37XLD_C.js} +1 -1
  77. package/dist/gateway/static/root/assets/{time-picker-BIkOW-2L.js → time-picker-C9Rr1IUV.js} +1 -1
  78. package/dist/gateway/static/root/assets/{typed-models-lib--HptwFcD.js → typed-models-lib-QMF30Yvh.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-channel-catalog-CMHY4ZfW.js → use-channel-catalog-DBh0dOC9.js} +1 -1
  80. package/dist/gateway/static/root/assets/user-context-page-D6EEhj-e.js +1 -0
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-nvIZerol.js → voice-api-key-field-Gjjs3qih.js} +1 -1
  82. package/dist/gateway/static/root/assets/work-discovery-page-CDnL9daG.js +1 -0
  83. package/dist/gateway/static/root/assets/work-item-detail-page-BCoT4p1E.js +1 -0
  84. package/dist/gateway/static/root/assets/work-page-l8h2Y50w.js +1 -0
  85. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D96MHABy.js → workflow-run-setup-panel-DnOfronD.js} +2 -2
  86. package/dist/gateway/static/root/assets/workflows-page-IVbQ83CW.js +11 -0
  87. package/dist/gateway/static/root/index.html +6 -6
  88. package/dist/package.js +1 -1
  89. package/dist/src/agent/agent-manager.js +3 -3
  90. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  91. package/dist/src/agent/embedded/model-runtime.d.ts +4 -0
  92. package/dist/src/agent/embedded/model-runtime.js +49 -0
  93. package/dist/src/agent/embedded/run-turn.js +9 -2
  94. package/dist/src/agent/embedded/session-runner.js +3 -3
  95. package/dist/src/agent/goals/post-turn.js +1 -1
  96. package/dist/src/agent/image/tool-model-config.js +1 -1
  97. package/dist/src/agent/index.js +1 -1
  98. package/dist/src/agent/ipc/inbox.js +1 -1
  99. package/dist/src/agent/memory/dreaming/config.js +1 -1
  100. package/dist/src/agent/service.js +2 -2
  101. package/dist/src/agent/skills/hub-lock.js +1 -1
  102. package/dist/src/agent-runtime/index.js +1 -1
  103. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  104. package/dist/src/auth/credentials.js +46 -3
  105. package/dist/src/auth/index.js +2 -1
  106. package/dist/src/auth/oauth/anthropic.js +27 -24
  107. package/dist/src/auth/oauth/github-copilot.js +20 -15
  108. package/dist/src/auth/oauth/google-antigravity.js +9 -2
  109. package/dist/src/auth/oauth/google-gemini-cli.js +9 -2
  110. package/dist/src/auth/oauth/google-oauth/google-antigravity.js +47 -40
  111. package/dist/src/auth/oauth/google-oauth/google-gemini-cli.js +48 -41
  112. package/dist/src/auth/oauth/google-oauth/oauth-page.js +7 -2
  113. package/dist/src/auth/oauth/google-oauth/pkce.js +4 -1
  114. package/dist/src/auth/oauth/index.d.ts +2 -0
  115. package/dist/src/auth/oauth/index.js +24 -10
  116. package/dist/src/auth/oauth/kimi-coding.js +76 -71
  117. package/dist/src/auth/oauth/minimax-cn.js +78 -73
  118. package/dist/src/auth/oauth/minimax.js +78 -73
  119. package/dist/src/auth/oauth/openai-codex.js +31 -25
  120. package/dist/src/auth/oauth/pkce.js +4 -1
  121. package/dist/src/auth/oauth/registry.d.ts +13 -0
  122. package/dist/src/auth/oauth/registry.js +65 -0
  123. package/dist/src/auth/oauth/xopc-cloud.d.ts +2 -0
  124. package/dist/src/auth/oauth/xopc-cloud.js +101 -0
  125. package/dist/src/auth/profiles/store.js +1 -1
  126. package/dist/src/auth/sync-provider-auth.js +6 -1
  127. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  128. package/dist/src/cli/commands/channels.js +1 -1
  129. package/dist/src/cli/commands/connectors.js +2 -2
  130. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  131. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  132. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  133. package/dist/src/cli/commands/models.js +2 -2
  134. package/dist/src/cli/commands/onboard.js +1 -1
  135. package/dist/src/cli/commands/update.js +1 -1
  136. package/dist/src/cli/utils/oauth-providers.d.ts +3 -26
  137. package/dist/src/cli/utils/oauth-providers.js +6 -80
  138. package/dist/src/config/agent-profile.js +1 -1
  139. package/dist/src/config/index.js +4 -4
  140. package/dist/src/config/loader.js +1 -1
  141. package/dist/src/config/models-json.js +9 -1
  142. package/dist/src/connectors/connector-memory-sync.js +1 -1
  143. package/dist/src/connectors/health.js +1 -1
  144. package/dist/src/extensions/lockfile.js +1 -1
  145. package/dist/src/extensions/sdk/index.js +1 -1
  146. package/dist/src/gateway/agents-admin.js +2 -2
  147. package/dist/src/gateway/file-path-classifier.js +1 -1
  148. package/dist/src/gateway/heartbeat/service.js +1 -1
  149. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  150. package/dist/src/gateway/hono/oauth-async.js +3 -19
  151. package/dist/src/gateway/hono/oauth.js +3 -19
  152. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  153. package/dist/src/gateway/hono/routes/models.js +2 -56
  154. package/dist/src/gateway/hono/routes/update.js +2 -2
  155. package/dist/src/gateway/index.js +1 -1
  156. package/dist/src/gateway/run-loop.js +1 -1
  157. package/dist/src/gateway/service/config-coordinator.js +1 -1
  158. package/dist/src/gateway/service.js +6 -6
  159. package/dist/src/goals/goal-workflow-judge.js +1 -1
  160. package/dist/src/heartbeat/index.js +1 -1
  161. package/dist/src/infra/gateway-processes.js +1 -1
  162. package/dist/src/infra/update-restart.js +1 -1
  163. package/dist/src/infra/update-runner.js +2 -2
  164. package/dist/src/infra/update-startup.js +1 -1
  165. package/dist/src/mcp/channel-bridge.js +1 -1
  166. package/dist/src/notes/service.js +1 -1
  167. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  168. package/dist/src/providers/domestic-presets.d.ts +0 -20
  169. package/dist/src/providers/domestic-presets.js +0 -25
  170. package/dist/src/providers/index.js +10 -1
  171. package/dist/src/providers/model-catalog-store.d.ts +20 -58
  172. package/dist/src/providers/model-catalog-store.js +18 -57
  173. package/dist/src/providers/model-catalog-sync-service.d.ts +3 -4
  174. package/dist/src/providers/model-catalog-sync-service.js +3 -13
  175. package/dist/src/providers/model-registry.js +1 -3
  176. package/dist/src/providers/xopc-cloud-model-source.d.ts +30 -0
  177. package/dist/src/providers/xopc-cloud-model-source.js +68 -0
  178. package/dist/src/tui/tui-startup-resources.js +2 -2
  179. package/dist/src/tui/tui.js +1 -1
  180. package/dist/src/work-discovery/analyzer.js +27 -14
  181. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  182. package/package.json +1 -1
  183. package/dist/gateway/static/root/assets/agents-DVKlWKJE.js +0 -2
  184. package/dist/gateway/static/root/assets/apps-page-BZXEJDIV.js +0 -1
  185. package/dist/gateway/static/root/assets/automations-page-B8CnkoXv.js +0 -6
  186. package/dist/gateway/static/root/assets/browser-settings-page-BCPWKI9V.js +0 -8
  187. package/dist/gateway/static/root/assets/capabilities-settings-panel-C7lr_mX2.js +0 -2
  188. package/dist/gateway/static/root/assets/capability-presets-settings-panel-Ble9kHRu.js +0 -2
  189. package/dist/gateway/static/root/assets/channels-settings-CtQQQHrv.js +0 -1
  190. package/dist/gateway/static/root/assets/channels-status-swr-_VirfMKW.js +0 -1
  191. package/dist/gateway/static/root/assets/connectors-page-BXWJSJeY.js +0 -2
  192. package/dist/gateway/static/root/assets/desktop-pet-B86W4a5c.js +0 -1
  193. package/dist/gateway/static/root/assets/goal-create-dialog-CWp2b7__.js +0 -1
  194. package/dist/gateway/static/root/assets/goal-detail-page-Dtm29FxD.js +0 -4
  195. package/dist/gateway/static/root/assets/goals-page-jMzBJs6e.js +0 -2
  196. package/dist/gateway/static/root/assets/local-app-workbench-page-CseW9jD3.js +0 -2
  197. package/dist/gateway/static/root/assets/logs-page-DVqPbth5.js +0 -7
  198. package/dist/gateway/static/root/assets/notes-workbench-mrc3xtpn.js +0 -4
  199. package/dist/gateway/static/root/assets/project-detail-page-CfhPJLkH.js +0 -1
  200. package/dist/gateway/static/root/assets/projects-page-BfMoKjdm.js +0 -1
  201. package/dist/gateway/static/root/assets/remote-access-hub-CrDtcsZ9.js +0 -1
  202. package/dist/gateway/static/root/assets/sessions-page-D3DbF3dV.js +0 -1
  203. package/dist/gateway/static/root/assets/settings-advanced-gate-BZp0O2dH.js +0 -1
  204. package/dist/gateway/static/root/assets/setup-status-panel-84iao4DZ.js +0 -1
  205. package/dist/gateway/static/root/assets/shares-settings-DtcwQvRG.js +0 -1
  206. package/dist/gateway/static/root/assets/skill-reload-api-L7j5Gc8Z.js +0 -1
  207. package/dist/gateway/static/root/assets/skills-page-1Ps8PjsP.js +0 -2
  208. package/dist/gateway/static/root/assets/user-context-page-BYAAs2iW.js +0 -1
  209. package/dist/gateway/static/root/assets/work-discovery-page-J35JkJ7_.js +0 -1
  210. package/dist/gateway/static/root/assets/work-item-detail-page-C4wYDYqV.js +0 -1
  211. package/dist/gateway/static/root/assets/work-page-DMvitV6c.js +0 -1
  212. package/dist/gateway/static/root/assets/workflows-page-JMN0nMbM.js +0 -11
  213. package/dist/src/agent/embedded/xopc-auth-storage.d.ts +0 -19
  214. package/dist/src/agent/embedded/xopc-auth-storage.js +0 -40
  215. package/dist/src/providers/xopc-cloud-connection.d.ts +0 -51
  216. package/dist/src/providers/xopc-cloud-connection.js +0 -196
@@ -11,7 +11,7 @@
11
11
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260713-1" />
12
12
  <link rel="manifest" href="/site.webmanifest?v=20260713-1" />
13
13
  <title>xopc</title>
14
- <script type="module" crossorigin src="/assets/index-HZdBKfk_.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-CfOzvGDb.js"></script>
15
15
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-zJ_50EbN.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
@@ -24,16 +24,16 @@
24
24
  <link rel="modulepreload" crossorigin href="/assets/check-DUBLcKHA.js">
25
25
  <link rel="modulepreload" crossorigin href="/assets/circle-alert-BEjgurr2.js">
26
26
  <link rel="modulepreload" crossorigin href="/assets/middleware-Pd0e8Igk.js">
27
- <link rel="modulepreload" crossorigin href="/assets/messages-BzI9Wx30.js">
28
- <link rel="modulepreload" crossorigin href="/assets/locale-store-Ys6RP7Be.js">
27
+ <link rel="modulepreload" crossorigin href="/assets/messages-C96Zjb0V.js">
28
+ <link rel="modulepreload" crossorigin href="/assets/locale-store-C_ax27uc.js">
29
29
  <link rel="modulepreload" crossorigin href="/assets/cn-JdwAhgNB.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/schemas-DgQq6Z5S.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/product-delivery-BTRT9kCS.js">
32
32
  <link rel="modulepreload" crossorigin href="/assets/config-reload-event-Bjh2zoKp.js">
33
33
  <link rel="modulepreload" crossorigin href="/assets/copy-to-clipboard-HOJ79TWv.js">
34
- <link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-CSRvCqxh.js">
35
- <link rel="modulepreload" crossorigin href="/assets/activity-store-Xj95LzTv.js">
36
- <link rel="modulepreload" crossorigin href="/assets/theme-store-DflSp9o4.js">
34
+ <link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-ulwTJovP.js">
35
+ <link rel="modulepreload" crossorigin href="/assets/activity-store-DkALQFJT.js">
36
+ <link rel="modulepreload" crossorigin href="/assets/theme-store-D37XLD_C.js">
37
37
  <link rel="stylesheet" crossorigin href="/assets/index-BXtJvaQl.css">
38
38
  </head>
39
39
  <body>
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.0.163";
2
+ var version = "0.0.165";
3
3
  //#endregion
4
4
  export { version };
@@ -2,15 +2,15 @@ import { resolveStateDir } from "../config/paths-state.js";
2
2
  import { createLogger } from "../utils/logger/index.js";
3
3
  import { init_logger } from "../utils/logger.js";
4
4
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
5
- import { applyConfigOverrides } from "../config/runtime-overrides.js";
6
5
  import { expandWorkspacePathString, init_workspace_path } from "../config/workspace-path.js";
7
6
  import { init_agent_scope, resolveAgentProfileDir } from "./agent-scope.js";
8
- import { resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
9
7
  import { init_paths, resolveBundledSkillsDir, resolveUserProfilePath } from "../config/paths.js";
10
- import { init_sync_provider_auth, resolveProviderApiKeySync } from "../auth/sync-provider-auth.js";
11
8
  import { CredentialResolver, init_credentials } from "../auth/credentials.js";
9
+ import { init_sync_provider_auth, resolveProviderApiKeySync } from "../auth/sync-provider-auth.js";
12
10
  import { getApiKeySync, getDefaultModelSync, init_providers, resolveModel } from "../providers/index.js";
13
11
  import { createExtensionAwareStreamFn } from "../providers/extension-stream-bridge.js";
12
+ import { applyConfigOverrides } from "../config/runtime-overrides.js";
13
+ import { resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
14
14
  import { extractTextContent } from "./context/workspace.js";
15
15
  import { buildActiveProjectContextForPrompt } from "./context/project-context.js";
16
16
  import { clearBootstrapSnapshot } from "./bootstrap/bootstrap-cache.js";
@@ -1,6 +1,6 @@
1
1
  import { isCronSessionKey, isSubagentSessionKey } from "../../routing/session-key-utils.js";
2
- import { init_session_key } from "../../routing/session-key.js";
3
2
  import { USER_PROFILE_FILENAME, init_paths } from "../../config/paths.js";
3
+ import { init_session_key } from "../../routing/session-key.js";
4
4
  import { DEFAULT_AGENTS_FILENAME, DEFAULT_IDENTITY_FILENAME, DEFAULT_SOUL_FILENAME, DEFAULT_TOOLS_FILENAME } from "../context/workspace.js";
5
5
  //#region src/agent/bootstrap/filter-bootstrap-files.ts
6
6
  init_paths();
@@ -0,0 +1,4 @@
1
+ import { ModelRuntime } from '@earendil-works/pi-coding-agent';
2
+ export declare function resolveEmbeddedProviderApiKeySync(providerId: string): string | undefined;
3
+ export declare function createEmbeddedModelRuntime(): Promise<ModelRuntime>;
4
+ export declare function applyEmbeddedProviderCredential(modelRuntime: Pick<ModelRuntime, 'setRuntimeApiKey'>, providerId: string): Promise<void>;
@@ -0,0 +1,49 @@
1
+ import { init_paths, resolveModelsJsonPath } from "../../config/paths.js";
2
+ import { getModelCatalogStore, init_model_catalog_store } from "../../providers/model-catalog-store.js";
3
+ import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
4
+ import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
5
+ import { getApiKeySync, init_providers } from "../../providers/index.js";
6
+ import { ModelRuntime } from "@earendil-works/pi-coding-agent";
7
+ import { InMemoryCredentialStore, InMemoryModelsStore } from "@earendil-works/pi-ai";
8
+ //#region src/agent/embedded/model-runtime.ts
9
+ init_credentials();
10
+ init_sync_provider_auth();
11
+ init_paths();
12
+ init_providers();
13
+ init_model_catalog_store();
14
+ function resolveEmbeddedProviderApiKeySync(providerId) {
15
+ return resolveProviderApiKeySync(providerId) ?? getApiKeySync(providerId);
16
+ }
17
+ async function createEmbeddedModelRuntime() {
18
+ const modelRuntime = await ModelRuntime.create({
19
+ credentials: new InMemoryCredentialStore(),
20
+ modelsPath: resolveModelsJsonPath(),
21
+ modelsStore: new InMemoryModelsStore()
22
+ });
23
+ for (const source of Object.values(getModelCatalogStore().load().sources)) modelRuntime.registerProvider(source.providerId, {
24
+ name: source.providerId,
25
+ baseUrl: source.baseUrl,
26
+ api: source.api,
27
+ models: source.models.filter((model) => model.availability === "available").map((model) => ({
28
+ id: model.id,
29
+ name: model.name,
30
+ reasoning: false,
31
+ input: ["text"],
32
+ cost: {
33
+ input: 0,
34
+ output: 0,
35
+ cacheRead: 0,
36
+ cacheWrite: 0
37
+ },
38
+ contextWindow: 128e3,
39
+ maxTokens: model.maxOutputTokens ?? 16384
40
+ }))
41
+ });
42
+ return modelRuntime;
43
+ }
44
+ async function applyEmbeddedProviderCredential(modelRuntime, providerId) {
45
+ const key = await new CredentialResolver().resolveApiKey(providerId) ?? getApiKeySync(providerId);
46
+ if (key && key !== "extension-managed") await modelRuntime.setRuntimeApiKey(providerId, key, { allowNetwork: false });
47
+ }
48
+ //#endregion
49
+ export { applyEmbeddedProviderCredential, createEmbeddedModelRuntime, resolveEmbeddedProviderApiKeySync };
@@ -7,6 +7,7 @@ import { getAssistantTurnErrorMessage, isAssistantTurnAborted, isAssistantTurnFa
7
7
  import { abortEmbeddedRun, queueEmbeddedSteer, registerEmbeddedRun, unregisterEmbeddedRun } from "./runs.js";
8
8
  import { lastAssistantPlainText, subscribeEmbeddedSessionEvents } from "./subscribe-session.js";
9
9
  import { detectToolLoops } from "../orchestration/loop-guard.js";
10
+ import { tryApplySessionTranscriptHygiene } from "../transcript/transcript-hygiene.js";
10
11
  //#region src/agent/embedded/run-turn.ts
11
12
  init_logger();
12
13
  const log = createLogger("EmbeddedRun");
@@ -76,8 +77,13 @@ async function runXopcEmbeddedTurn(params) {
76
77
  const { session, reused } = runner;
77
78
  const streamFnWithXopcExtensions = wrapStreamFnForXopcExtensions(session.agent.streamFunction);
78
79
  const loggingStreamFn = (streamModel, context, options) => {
79
- const loopGuard = detectToolLoops(extractRecentToolCalls(context.messages));
80
- let effectiveContext = context;
80
+ const sourceMessages = [...context.messages];
81
+ const hygienicMessages = tryApplySessionTranscriptHygiene(sourceMessages, streamModel);
82
+ const loopGuard = detectToolLoops(extractRecentToolCalls(hygienicMessages));
83
+ let effectiveContext = {
84
+ ...context,
85
+ messages: hygienicMessages
86
+ };
81
87
  if (loopGuard.injection || loopGuard.hiddenTools.size > 0) {
82
88
  const messages = loopGuard.injection ? [...context.messages, {
83
89
  role: "user",
@@ -98,6 +104,7 @@ async function runXopcEmbeddedTurn(params) {
98
104
  modelRef: `${streamModel.provider}/${streamModel.id}`,
99
105
  systemPromptLength: effectiveContext.systemPrompt?.length ?? 0,
100
106
  messageCount: effectiveContext.messages.length,
107
+ transcriptRepaired: hygienicMessages !== sourceMessages,
101
108
  toolCount: effectiveContext.tools?.length ?? 0,
102
109
  lastUserMessagePreview: getLastUserMessagePreview(effectiveContext.messages),
103
110
  loopWarningInjected: !!loopGuard.injection,
@@ -3,7 +3,7 @@ import { init_logger } from "../../utils/logger.js";
3
3
  import { guardSessionManager } from "./session-tool-result-guard.js";
4
4
  import { transformUserMessageForPersistence } from "../inbound/attachment-pipeline.js";
5
5
  import { openSqliteHydratingSessionManager } from "./sqlite-hydrating-session-manager.js";
6
- import { applyXopcProviderApiKey, createEmbeddedModelRuntime, resolveXopcProviderApiKey } from "./xopc-auth-storage.js";
6
+ import { applyEmbeddedProviderCredential, createEmbeddedModelRuntime, resolveEmbeddedProviderApiKeySync } from "./model-runtime.js";
7
7
  import { wrapStreamFnForXopcExtensions } from "./xopc-stream-bridge.js";
8
8
  import { xopcToolsToDefinitions } from "./xopc-tools-bridge.js";
9
9
  import { applySystemPromptOverrideToSession } from "./system-prompt-override.js";
@@ -14,7 +14,7 @@ init_logger();
14
14
  const log = createLogger("EmbeddedSessionRunner");
15
15
  const DEFAULT_IDLE_TTL_MS = 5 * 6e4;
16
16
  function providerCredentialRevision(providerId) {
17
- const apiKey = resolveXopcProviderApiKey(providerId);
17
+ const apiKey = resolveEmbeddedProviderApiKeySync(providerId);
18
18
  return apiKey ? createHash("sha256").update(apiKey).digest("base64url") : "none";
19
19
  }
20
20
  function buildEmbeddedRunnerFingerprint(input) {
@@ -175,7 +175,7 @@ var EmbeddedSessionRunnerPool = class {
175
175
  const toolDefs = xopcToolsToDefinitions(tools);
176
176
  const toolNames = tools.map((t) => t.name);
177
177
  const modelRuntime = await createEmbeddedModelRuntime();
178
- await applyXopcProviderApiKey(modelRuntime, model.provider);
178
+ await applyEmbeddedProviderCredential(modelRuntime, model.provider);
179
179
  const resourceLoader = new DefaultResourceLoader({
180
180
  cwd: workspaceDir,
181
181
  agentDir: getAgentDir(),
@@ -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 { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
4
+ import { resolveGoalUiLocale } from "./goal-locale.js";
4
5
  import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
5
6
  import { GoalService } from "../../goals/goal-service.js";
6
- import { resolveGoalUiLocale } from "./goal-locale.js";
7
7
  import { evaluateAfterTurnHermesLike } from "./evaluate-turn.js";
8
8
  import "../../goals/index.js";
9
9
  //#region src/agent/goals/post-turn.ts
@@ -1,7 +1,7 @@
1
1
  import { getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "../../config/schema.js";
2
2
  import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
3
- import { resolveEffectiveAgentManifestForAgent } from "../../config/agent-profile.js";
4
3
  import { getDefaultModelSync, getModelsByProvider, init_providers, isProviderConfiguredSync, resolveModel } from "../../providers/index.js";
4
+ import { resolveEffectiveAgentManifestForAgent } from "../../config/agent-profile.js";
5
5
  import { resolveAgentModelFallbackValues, resolveAgentModelPrimaryValue } from "../../config/model-input.js";
6
6
  //#region src/agent/image/tool-model-config.ts
7
7
  init_schema();
@@ -5,10 +5,10 @@ import { AgentInbox } from "./ipc/inbox.js";
5
5
  import { AgentBus } from "./ipc/bus.js";
6
6
  import { AgentSocketClient, AgentSocketServer, isSocketAvailable } from "./ipc/socket.js";
7
7
  import "./ipc/index.js";
8
- import { AgentService } from "./service.js";
9
8
  import { resolveTranscriptPolicy } from "./transcript/transcript-policy.js";
10
9
  import { dropThinkingBlocks } from "./transcript/thinking.js";
11
10
  import { applySessionTranscriptHygiene, applySessionTranscriptHygieneForPersistence, applySessionTranscriptHygieneWithPolicy, resolvePolicyForModel, tryApplySessionTranscriptHygiene, tryApplySessionTranscriptHygieneForPersistence } from "./transcript/transcript-hygiene.js";
11
+ import { AgentService } from "./service.js";
12
12
  import { stripToolMessages } from "./transcript/strip-tool-messages.js";
13
13
  import "./transcript/index.js";
14
14
  export { AgentBus, AgentInbox, AgentService, AgentSocketClient, AgentSocketServer, applySessionTranscriptHygiene, applySessionTranscriptHygieneForPersistence, applySessionTranscriptHygieneWithPolicy, createResponseMessage, createSignalMessage, createTaskMessage, dropThinkingBlocks, extractToolCallsFromAssistant, extractToolResultId, isSocketAvailable, isValidIPCMessage, makeMissingToolResult, repairToolUseResultPairing, resolvePolicyForModel, resolveTranscriptPolicy, sanitizeToolCallId, sanitizeToolCallIdsForCloudCodeAssist, sanitizeToolCallInputs, sanitizeToolUseResultPairing, stripToolMessages, stripToolResultDetails, tryApplySessionTranscriptHygiene, tryApplySessionTranscriptHygieneForPersistence };
@@ -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, resolveAgentDir } from "../../config/paths.js";
4
3
  import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
4
+ import { init_paths, resolveAgentDir } from "../../config/paths.js";
5
5
  import { join } from "path";
6
6
  import { existsSync, watch } from "fs";
7
7
  import { mkdir, readFile, readdir, rename } from "fs/promises";
@@ -1,5 +1,5 @@
1
- import { DEFAULT_DEEP_CRON, DEFAULT_LIGHT_CRON, DEFAULT_REM_CRON } from "./constants.js";
2
1
  import { buildMemoryRuntime } from "../../../agent-runtime/memory-runtime.js";
2
+ import { DEFAULT_DEEP_CRON, DEFAULT_LIGHT_CRON, DEFAULT_REM_CRON } from "./constants.js";
3
3
  //#region src/agent/memory/dreaming/config.ts
4
4
  function clampScore(value, fallback) {
5
5
  if (!Number.isFinite(value)) return fallback;
@@ -2,10 +2,10 @@ import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
3
  import { parseNoteAttachmentTarget } from "../notes/attachment-ref.js";
4
4
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
5
- import { applyConfigOverrides } from "../config/runtime-overrides.js";
6
5
  import { init_agent_scope, resolveAgentHomeDir, resolveDefaultAgentId } from "./agent-scope.js";
7
- import { extractProfileAgentId } from "../config/agent-profile.js";
8
6
  import { init_paths, resolveUserProfilePath } from "../config/paths.js";
7
+ import { applyConfigOverrides } from "../config/runtime-overrides.js";
8
+ import { extractProfileAgentId } from "../config/agent-profile.js";
9
9
  import { extractTextContent } from "./context/workspace.js";
10
10
  import { effectiveWorkspacePathForSession } from "../session/session-workspace.js";
11
11
  import { getProjectForSession } from "../projects/workspace.js";
@@ -1,5 +1,5 @@
1
- import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
2
1
  import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
2
+ import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  //#region src/agent/skills/hub-lock.ts
5
5
  /**
@@ -1,7 +1,7 @@
1
- import { buildMemoryRuntime } from "./memory-runtime.js";
2
1
  import { checkBoundary } from "./boundary-guard.js";
3
2
  import { resolveModelRole } from "./model-router.js";
4
3
  import { buildRuntimeToolRegistry } from "./tool-registry.js";
4
+ import { buildMemoryRuntime } from "./memory-runtime.js";
5
5
  import { resolveWorkflow, validateWorkflowForRuntime } from "./workflow-runtime.js";
6
6
  import { buildAgentRuntimeProfile } from "./runtime-profile.js";
7
7
  import { appendAgentRunEvent, createAgentRunTrace, finishAgentRunTrace, hashEffectiveManifest } from "./run-trace.js";
@@ -1,9 +1,9 @@
1
1
  import { buildAgentManifestPromptSection } from "../agent-manifest/prompt.js";
2
2
  import "../agent-manifest/index.js";
3
- import { buildMemoryRuntime } from "./memory-runtime.js";
4
3
  import { checkBoundary } from "./boundary-guard.js";
5
4
  import { resolveModelRole } from "./model-router.js";
6
5
  import { buildRuntimeToolRegistry } from "./tool-registry.js";
6
+ import { buildMemoryRuntime } from "./memory-runtime.js";
7
7
  import { resolveWorkflow, validateWorkflowForRuntime } from "./workflow-runtime.js";
8
8
  //#region src/agent-runtime/runtime-profile.ts
9
9
  function buildAgentRuntimeProfile(params) {
@@ -1,9 +1,10 @@
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 { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
5
4
  import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
5
+ import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
6
6
  import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
7
+ import { getOAuthProviderDefinition, init_registry } from "./oauth/registry.js";
7
8
  import { dirname, join } from "path";
8
9
  import { mkdir, readFile, readdir, rm } from "fs/promises";
9
10
  //#region src/auth/credentials.ts
@@ -18,14 +19,16 @@ async function resolveApiKey(provider, options) {
18
19
  async function hasCredentials(provider, options) {
19
20
  return getCredentialResolver(options).hasCredentials(provider);
20
21
  }
21
- var log, warnedExpiredOAuthTokens, CredentialResolver, defaultResolver;
22
+ var log, warnedExpiredOAuthTokens, oauthRefreshes, CredentialResolver, defaultResolver;
22
23
  var init_credentials = __esmMin((() => {
23
24
  init_write_file_atomic();
24
25
  init_logger();
25
26
  init_env_keys();
26
27
  init_paths();
28
+ init_registry();
27
29
  log = createLogger("Credentials");
28
30
  warnedExpiredOAuthTokens = /* @__PURE__ */ new Set();
31
+ oauthRefreshes = /* @__PURE__ */ new Map();
29
32
  CredentialResolver = class {
30
33
  credentialsDir;
31
34
  agentId;
@@ -42,6 +45,7 @@ var init_credentials = __esmMin((() => {
42
45
  */
43
46
  async resolveApiKey(provider) {
44
47
  const normalizedProvider = provider.toLowerCase();
48
+ if (getOAuthProviderDefinition(normalizedProvider)?.oauthOnly) return (await this.loadOAuthToken(normalizedProvider))?.access ?? null;
45
49
  if (this.agentId) {
46
50
  const agentKey = await this.loadFromAgentCredentials(normalizedProvider);
47
51
  if (agentKey) {
@@ -89,6 +93,7 @@ var init_credentials = __esmMin((() => {
89
93
  */
90
94
  async resolveApiKeySource(provider) {
91
95
  const normalizedProvider = provider.toLowerCase();
96
+ if (getOAuthProviderDefinition(normalizedProvider)?.oauthOnly) return await this.loadOAuthToken(normalizedProvider) ? "oauth" : null;
92
97
  if (this.agentId) {
93
98
  if (await this.loadFromAgentCredentials(normalizedProvider)) return "agent";
94
99
  }
@@ -132,6 +137,7 @@ var init_credentials = __esmMin((() => {
132
137
  */
133
138
  async saveApiKey(provider, key, options = {}) {
134
139
  const normalizedProvider = provider.toLowerCase();
140
+ if (getOAuthProviderDefinition(normalizedProvider)?.oauthOnly) throw new Error(`${normalizedProvider} only supports OAuth credentials`);
135
141
  const profileId = options.profileName ? `${normalizedProvider}:${options.profileName}` : `${normalizedProvider}:default`;
136
142
  const profile = {
137
143
  type: "api_key",
@@ -165,7 +171,44 @@ var init_credentials = __esmMin((() => {
165
171
  async loadOAuthToken(provider) {
166
172
  const token = await this.loadOAuthTokenRecord(provider);
167
173
  if (!token) return null;
168
- if (token.expiresAt && token.expiresAt < Date.now()) {
174
+ const expiresAt = token.expiresAt ?? Number.POSITIVE_INFINITY;
175
+ if (expiresAt <= Date.now() + 6e4 && token.refresh) {
176
+ const definition = getOAuthProviderDefinition(provider);
177
+ if (definition) {
178
+ let pending = oauthRefreshes.get(provider);
179
+ if (!pending) {
180
+ pending = definition.provider.refreshToken({
181
+ access: token.access,
182
+ refresh: token.refresh,
183
+ expires: expiresAt
184
+ }).then(async (refreshed) => {
185
+ const updated = {
186
+ ...token,
187
+ access: definition.provider.getApiKey(refreshed),
188
+ refresh: refreshed.refresh,
189
+ expiresAt: refreshed.expires,
190
+ scope: Array.isArray(refreshed.scope) ? refreshed.scope.filter((value) => typeof value === "string") : token.scope,
191
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
192
+ };
193
+ await this.saveOAuthToken(provider, updated);
194
+ return updated;
195
+ }).finally(() => oauthRefreshes.delete(provider));
196
+ oauthRefreshes.set(provider, pending);
197
+ }
198
+ try {
199
+ return await pending;
200
+ } catch (err) {
201
+ if (expiresAt > Date.now()) {
202
+ log.warn({
203
+ err,
204
+ provider
205
+ }, "OAuth refresh failed; using the current access token");
206
+ return token;
207
+ }
208
+ }
209
+ }
210
+ }
211
+ if (expiresAt <= Date.now()) {
169
212
  const warnKey = `${provider}:${token.expiresAt}`;
170
213
  if (!warnedExpiredOAuthTokens.has(warnKey)) {
171
214
  warnedExpiredOAuthTokens.add(warnKey);
@@ -1,6 +1,7 @@
1
+ import { anthropicOAuthProvider, init_anthropic } from "./oauth/anthropic.js";
1
2
  import { CredentialResolver, getCredentialResolver, hasCredentials, init_credentials, resolveApiKey } from "./credentials.js";
2
- import { anthropicOAuthProvider } from "./oauth/anthropic.js";
3
3
  //#region src/auth/index.ts
4
4
  init_credentials();
5
+ init_anthropic();
5
6
  //#endregion
6
7
  export { CredentialResolver, anthropicOAuthProvider, getCredentialResolver, hasCredentials, resolveApiKey };
@@ -1,14 +1,6 @@
1
- import { generatePKCE } from "./pkce.js";
1
+ import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
2
+ import { generatePKCE, init_pkce } from "./pkce.js";
2
3
  //#region src/auth/oauth/anthropic.ts
3
- /**
4
- * Anthropic OAuth flow (Claude Pro/Max)
5
- */
6
- const decode = (s) => atob(s);
7
- const CLIENT_ID = decode("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl");
8
- const AUTHORIZE_URL = "https://claude.ai/oauth/authorize";
9
- const TOKEN_URL = "https://console.anthropic.com/v1/oauth/token";
10
- const REDIRECT_URI = "https://console.anthropic.com/oauth/code/callback";
11
- const SCOPES = "org:create_api_key user:profile user:inference";
12
4
  async function loginAnthropic(onAuthUrl, onPromptCode) {
13
5
  const { verifier, challenge } = await generatePKCE();
14
6
  onAuthUrl(`${AUTHORIZE_URL}?${new URLSearchParams({
@@ -69,18 +61,29 @@ async function refreshAnthropicToken(refreshToken) {
69
61
  expires: Date.now() + data.expires_in * 1e3 - 300 * 1e3
70
62
  };
71
63
  }
72
- const anthropicOAuthProvider = {
73
- id: "anthropic",
74
- name: "Anthropic (Claude Pro/Max)",
75
- async login(callbacks) {
76
- return loginAnthropic((url) => callbacks.onAuth({ url }), () => callbacks.onPrompt({ message: "Paste the authorization code:" }));
77
- },
78
- async refreshToken(credentials) {
79
- return refreshAnthropicToken(credentials.refresh);
80
- },
81
- getApiKey(credentials) {
82
- return credentials.access;
83
- }
84
- };
64
+ var decode, CLIENT_ID, AUTHORIZE_URL, TOKEN_URL, REDIRECT_URI, SCOPES, anthropicOAuthProvider;
65
+ var init_anthropic = __esmMin((() => {
66
+ init_pkce();
67
+ decode = (s) => atob(s);
68
+ CLIENT_ID = decode("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl");
69
+ AUTHORIZE_URL = "https://claude.ai/oauth/authorize";
70
+ TOKEN_URL = "https://console.anthropic.com/v1/oauth/token";
71
+ REDIRECT_URI = "https://console.anthropic.com/oauth/code/callback";
72
+ SCOPES = "org:create_api_key user:profile user:inference";
73
+ anthropicOAuthProvider = {
74
+ id: "anthropic",
75
+ name: "Anthropic (Claude Pro/Max)",
76
+ async login(callbacks) {
77
+ return loginAnthropic((url) => callbacks.onAuth({ url }), () => callbacks.onPrompt({ message: "Paste the authorization code:" }));
78
+ },
79
+ async refreshToken(credentials) {
80
+ return refreshAnthropicToken(credentials.refresh);
81
+ },
82
+ getApiKey(credentials) {
83
+ return credentials.access;
84
+ }
85
+ };
86
+ }));
85
87
  //#endregion
86
- export { anthropicOAuthProvider, loginAnthropic, refreshAnthropicToken };
88
+ init_anthropic();
89
+ export { anthropicOAuthProvider, init_anthropic, loginAnthropic, refreshAnthropicToken };
@@ -1,3 +1,4 @@
1
+ import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
1
2
  import { githubCopilotProvider } from "@earendil-works/pi-ai/providers/github-copilot";
2
3
  //#region src/auth/oauth/github-copilot.ts
3
4
  /** GitHub Copilot OAuth adapter for pi-ai's provider-auth API. */
@@ -46,19 +47,23 @@ function toAuthInteraction(callbacks) {
46
47
  }
47
48
  };
48
49
  }
49
- const githubCopilotOAuthProvider = {
50
- id: "github-copilot",
51
- name: "GitHub Copilot",
52
- usesCallbackServer: false,
53
- async login(callbacks) {
54
- return fromPiCredential(await getCopilotOAuth().login(toAuthInteraction(callbacks)));
55
- },
56
- async refreshToken(credentials) {
57
- return fromPiCredential(await getCopilotOAuth().refresh(toPiCredential(credentials)));
58
- },
59
- getApiKey(credentials) {
60
- return credentials.access;
61
- }
62
- };
50
+ var githubCopilotOAuthProvider;
51
+ var init_github_copilot = __esmMin((() => {
52
+ githubCopilotOAuthProvider = {
53
+ id: "github-copilot",
54
+ name: "GitHub Copilot",
55
+ usesCallbackServer: false,
56
+ async login(callbacks) {
57
+ return fromPiCredential(await getCopilotOAuth().login(toAuthInteraction(callbacks)));
58
+ },
59
+ async refreshToken(credentials) {
60
+ return fromPiCredential(await getCopilotOAuth().refresh(toPiCredential(credentials)));
61
+ },
62
+ getApiKey(credentials) {
63
+ return credentials.access;
64
+ }
65
+ };
66
+ }));
63
67
  //#endregion
64
- export { githubCopilotOAuthProvider };
68
+ init_github_copilot();
69
+ export { githubCopilotOAuthProvider, init_github_copilot };
@@ -1,2 +1,9 @@
1
- import { antigravityOAuthProvider, loginAntigravity, refreshAntigravityToken } from "./google-oauth/google-antigravity.js";
2
- export { antigravityOAuthProvider as googleAntigravityOAuthProvider, loginAntigravity, refreshAntigravityToken };
1
+ import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
2
+ import { antigravityOAuthProvider, init_google_antigravity as init_google_antigravity$1, loginAntigravity, refreshAntigravityToken } from "./google-oauth/google-antigravity.js";
3
+ //#region src/auth/oauth/google-antigravity.ts
4
+ var init_google_antigravity = __esmMin((() => {
5
+ init_google_antigravity$1();
6
+ }));
7
+ //#endregion
8
+ init_google_antigravity();
9
+ export { antigravityOAuthProvider as googleAntigravityOAuthProvider, init_google_antigravity, loginAntigravity, refreshAntigravityToken };
@@ -1,2 +1,9 @@
1
- import { geminiCliOAuthProvider, loginGeminiCli, refreshGoogleCloudToken } from "./google-oauth/google-gemini-cli.js";
2
- export { geminiCliOAuthProvider as googleGeminiCliOAuthProvider, loginGeminiCli, refreshGoogleCloudToken };
1
+ import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
2
+ import { geminiCliOAuthProvider, init_google_gemini_cli as init_google_gemini_cli$1, loginGeminiCli, refreshGoogleCloudToken } from "./google-oauth/google-gemini-cli.js";
3
+ //#region src/auth/oauth/google-gemini-cli.ts
4
+ var init_google_gemini_cli = __esmMin((() => {
5
+ init_google_gemini_cli$1();
6
+ }));
7
+ //#endregion
8
+ init_google_gemini_cli();
9
+ export { geminiCliOAuthProvider as googleGeminiCliOAuthProvider, init_google_gemini_cli, loginGeminiCli, refreshGoogleCloudToken };
@@ -1,13 +1,7 @@
1
- import { oauthErrorHtml, oauthSuccessHtml } from "./oauth-page.js";
2
- import { generatePKCE } from "./pkce.js";
1
+ import { __esmMin } from "../../../../_virtual/_rolldown/runtime.js";
2
+ import { init_oauth_page, oauthErrorHtml, oauthSuccessHtml } from "./oauth-page.js";
3
+ import { generatePKCE, init_pkce } from "./pkce.js";
3
4
  //#region src/auth/oauth/google-oauth/google-antigravity.ts
4
- let _createServer = null;
5
- let _httpImportPromise = null;
6
- if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) _httpImportPromise = import("node:http").then((m) => {
7
- _createServer = m.createServer;
8
- });
9
- const ANTIGRAVITY_CLIENT_ID_ENV = "XOPC_GOOGLE_ANTIGRAVITY_OAUTH_CLIENT_ID";
10
- const ANTIGRAVITY_CLIENT_SECRET_ENV = "XOPC_GOOGLE_ANTIGRAVITY_OAUTH_CLIENT_SECRET";
11
5
  /** Desktop OAuth client for this flow — must be set locally (not committed; avoids GitHub push protection). */
12
6
  function getAntigravityOAuthClient() {
13
7
  const clientId = process.env[ANTIGRAVITY_CLIENT_ID_ENV]?.trim();
@@ -18,16 +12,6 @@ function getAntigravityOAuthClient() {
18
12
  clientSecret
19
13
  };
20
14
  }
21
- const REDIRECT_URI = "http://localhost:51121/oauth-callback";
22
- const SCOPES = [
23
- "https://www.googleapis.com/auth/cloud-platform",
24
- "https://www.googleapis.com/auth/userinfo.email",
25
- "https://www.googleapis.com/auth/userinfo.profile",
26
- "https://www.googleapis.com/auth/cclog",
27
- "https://www.googleapis.com/auth/experimentsandconfigs"
28
- ];
29
- const AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
30
- const TOKEN_URL = "https://oauth2.googleapis.com/token";
31
15
  /**
32
16
  * Start a local HTTP server to receive the OAuth callback
33
17
  */
@@ -278,25 +262,48 @@ async function loginAntigravity(onAuth, onProgress, onManualCodeInput) {
278
262
  server.server.close();
279
263
  }
280
264
  }
281
- const antigravityOAuthProvider = {
282
- id: "google-antigravity",
283
- name: "Antigravity (Gemini 3, Claude, GPT-OSS)",
284
- usesCallbackServer: true,
285
- async login(callbacks) {
286
- return loginAntigravity(callbacks.onAuth, callbacks.onProgress, callbacks.onManualCodeInput);
287
- },
288
- async refreshToken(credentials) {
289
- const creds = credentials;
290
- if (!creds.projectId) throw new Error("Antigravity credentials missing projectId");
291
- return refreshAntigravityToken(creds.refresh, creds.projectId);
292
- },
293
- getApiKey(credentials) {
294
- const creds = credentials;
295
- return JSON.stringify({
296
- token: creds.access,
297
- projectId: creds.projectId
298
- });
299
- }
300
- };
265
+ var _createServer, _httpImportPromise, ANTIGRAVITY_CLIENT_ID_ENV, ANTIGRAVITY_CLIENT_SECRET_ENV, REDIRECT_URI, SCOPES, AUTH_URL, TOKEN_URL, antigravityOAuthProvider;
266
+ var init_google_antigravity = __esmMin((() => {
267
+ init_oauth_page();
268
+ init_pkce();
269
+ _createServer = null;
270
+ _httpImportPromise = null;
271
+ if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) _httpImportPromise = import("node:http").then((m) => {
272
+ _createServer = m.createServer;
273
+ });
274
+ ANTIGRAVITY_CLIENT_ID_ENV = "XOPC_GOOGLE_ANTIGRAVITY_OAUTH_CLIENT_ID";
275
+ ANTIGRAVITY_CLIENT_SECRET_ENV = "XOPC_GOOGLE_ANTIGRAVITY_OAUTH_CLIENT_SECRET";
276
+ REDIRECT_URI = "http://localhost:51121/oauth-callback";
277
+ SCOPES = [
278
+ "https://www.googleapis.com/auth/cloud-platform",
279
+ "https://www.googleapis.com/auth/userinfo.email",
280
+ "https://www.googleapis.com/auth/userinfo.profile",
281
+ "https://www.googleapis.com/auth/cclog",
282
+ "https://www.googleapis.com/auth/experimentsandconfigs"
283
+ ];
284
+ AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
285
+ TOKEN_URL = "https://oauth2.googleapis.com/token";
286
+ antigravityOAuthProvider = {
287
+ id: "google-antigravity",
288
+ name: "Antigravity (Gemini 3, Claude, GPT-OSS)",
289
+ usesCallbackServer: true,
290
+ async login(callbacks) {
291
+ return loginAntigravity(callbacks.onAuth, callbacks.onProgress, callbacks.onManualCodeInput);
292
+ },
293
+ async refreshToken(credentials) {
294
+ const creds = credentials;
295
+ if (!creds.projectId) throw new Error("Antigravity credentials missing projectId");
296
+ return refreshAntigravityToken(creds.refresh, creds.projectId);
297
+ },
298
+ getApiKey(credentials) {
299
+ const creds = credentials;
300
+ return JSON.stringify({
301
+ token: creds.access,
302
+ projectId: creds.projectId
303
+ });
304
+ }
305
+ };
306
+ }));
301
307
  //#endregion
302
- export { antigravityOAuthProvider, loginAntigravity, refreshAntigravityToken };
308
+ init_google_antigravity();
309
+ export { antigravityOAuthProvider, init_google_antigravity, loginAntigravity, refreshAntigravityToken };