@skaile/workspaces 6.8.1 → 6.9.0

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 (318) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/ai-sdk.js +5 -5
  3. package/dist/{asset-feeds-R75MH2WW.js → asset-feeds-JWRIWLVX.js} +19 -19
  4. package/dist/{asset-feeds-R75MH2WW.js.map → asset-feeds-JWRIWLVX.js.map} +1 -1
  5. package/dist/asset-manager/catalog-deployer.js +4 -4
  6. package/dist/asset-manager/history.js +19 -1
  7. package/dist/asset-manager/index.js +11 -11
  8. package/dist/asset-manager/installer.js +7 -7
  9. package/dist/asset-manager/renderers.js +6 -6
  10. package/dist/asset-manager/src/history.d.ts.map +1 -1
  11. package/dist/asset-manager/src/index.d.ts +65 -3
  12. package/dist/asset-manager/src/index.d.ts.map +1 -1
  13. package/dist/bridge/harnesses/claude-sdk.js +9 -9
  14. package/dist/bridge/harnesses/codex.js +29 -12
  15. package/dist/bridge/harnesses/codex.js.map +1 -1
  16. package/dist/bridge/harnesses/continue.js +8 -8
  17. package/dist/bridge/harnesses/echo.js +3 -3
  18. package/dist/bridge/harnesses/gemini.js +8 -8
  19. package/dist/bridge/harnesses/goose.js +8 -8
  20. package/dist/bridge/harnesses/omp.js +156 -24
  21. package/dist/bridge/harnesses/omp.js.map +1 -1
  22. package/dist/bridge/harnesses/opencode.js +8 -8
  23. package/dist/bridge/harnesses/qwen.js +8 -8
  24. package/dist/bridge/index.js +14 -14
  25. package/dist/bridge/src/codex/friendly-error.d.ts +7 -1
  26. package/dist/bridge/src/codex/friendly-error.d.ts.map +1 -1
  27. package/dist/bridge/src/codex/login-fallback.d.ts +5 -0
  28. package/dist/bridge/src/codex/login-fallback.d.ts.map +1 -1
  29. package/dist/bridge/src/harnesses/codex.d.ts +2 -0
  30. package/dist/bridge/src/harnesses/codex.d.ts.map +1 -1
  31. package/dist/bridge/src/harnesses/omp.d.ts +17 -0
  32. package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
  33. package/dist/{chunk-56PIAGD6.js → chunk-23Q5LT4U.js} +331 -59
  34. package/dist/chunk-23Q5LT4U.js.map +1 -0
  35. package/dist/{chunk-SBNUXJ6E.js → chunk-3AIEJSQR.js} +3 -3
  36. package/dist/{chunk-SBNUXJ6E.js.map → chunk-3AIEJSQR.js.map} +1 -1
  37. package/dist/{chunk-7RBFYW24.js → chunk-3EPRTMXY.js} +5 -5
  38. package/dist/{chunk-7RBFYW24.js.map → chunk-3EPRTMXY.js.map} +1 -1
  39. package/dist/{chunk-TMJBEGS4.js → chunk-4KPQ6ILH.js} +5 -34
  40. package/dist/chunk-4KPQ6ILH.js.map +1 -0
  41. package/dist/{chunk-G7NMF5WQ.js → chunk-4ROXSQEG.js} +3 -3
  42. package/dist/{chunk-G7NMF5WQ.js.map → chunk-4ROXSQEG.js.map} +1 -1
  43. package/dist/{chunk-I6XH46Q6.js → chunk-4WB4KSSQ.js} +3 -3
  44. package/dist/{chunk-I6XH46Q6.js.map → chunk-4WB4KSSQ.js.map} +1 -1
  45. package/dist/{chunk-NW7Y5SNK.js → chunk-5AQLCRR7.js} +4 -4
  46. package/dist/{chunk-NW7Y5SNK.js.map → chunk-5AQLCRR7.js.map} +1 -1
  47. package/dist/{chunk-WFK4MUBL.js → chunk-5J6JWGY4.js} +3 -3
  48. package/dist/{chunk-WFK4MUBL.js.map → chunk-5J6JWGY4.js.map} +1 -1
  49. package/dist/{chunk-O5Y7VMVQ.js → chunk-5KWQMCH7.js} +3 -3
  50. package/dist/{chunk-O5Y7VMVQ.js.map → chunk-5KWQMCH7.js.map} +1 -1
  51. package/dist/{chunk-YMO4ZDLC.js → chunk-5NTB64PW.js} +45 -13
  52. package/dist/chunk-5NTB64PW.js.map +1 -0
  53. package/dist/{chunk-QGA2OBUJ.js → chunk-72BDCGBB.js} +3 -3
  54. package/dist/{chunk-QGA2OBUJ.js.map → chunk-72BDCGBB.js.map} +1 -1
  55. package/dist/{chunk-KTBKW2FI.js → chunk-7QYBKUAS.js} +4 -3
  56. package/dist/chunk-7QYBKUAS.js.map +1 -0
  57. package/dist/{chunk-BGATDUYX.js → chunk-AERQFD6T.js} +4 -4
  58. package/dist/{chunk-BGATDUYX.js.map → chunk-AERQFD6T.js.map} +1 -1
  59. package/dist/{chunk-XIIIGLSL.js → chunk-AVRTZAH2.js} +9 -9
  60. package/dist/{chunk-XIIIGLSL.js.map → chunk-AVRTZAH2.js.map} +1 -1
  61. package/dist/{chunk-I4DI5DAX.js → chunk-B2DGCYVC.js} +18 -18
  62. package/dist/chunk-B2DGCYVC.js.map +1 -0
  63. package/dist/{chunk-VQFA5DR7.js → chunk-C7L5MFUL.js} +3 -3
  64. package/dist/{chunk-VQFA5DR7.js.map → chunk-C7L5MFUL.js.map} +1 -1
  65. package/dist/{chunk-ORXV3UB6.js → chunk-CFTTXUM2.js} +3 -3
  66. package/dist/{chunk-ORXV3UB6.js.map → chunk-CFTTXUM2.js.map} +1 -1
  67. package/dist/{chunk-N65H7YYI.js → chunk-DZRN3SNG.js} +5 -5
  68. package/dist/{chunk-N65H7YYI.js.map → chunk-DZRN3SNG.js.map} +1 -1
  69. package/dist/{chunk-QCR5AE5E.js → chunk-E675QKFG.js} +5 -5
  70. package/dist/{chunk-QCR5AE5E.js.map → chunk-E675QKFG.js.map} +1 -1
  71. package/dist/{chunk-O7ADRMCR.js → chunk-FZO64PLQ.js} +45 -16
  72. package/dist/chunk-FZO64PLQ.js.map +1 -0
  73. package/dist/{chunk-Y6LC5PEZ.js → chunk-GYBDWW6K.js} +14 -5
  74. package/dist/chunk-GYBDWW6K.js.map +1 -0
  75. package/dist/{chunk-CMXDFTA2.js → chunk-GYPPVANR.js} +3 -3
  76. package/dist/{chunk-CMXDFTA2.js.map → chunk-GYPPVANR.js.map} +1 -1
  77. package/dist/{chunk-G44FFUMA.js → chunk-GZL6RN4Z.js} +92 -14
  78. package/dist/chunk-GZL6RN4Z.js.map +1 -0
  79. package/dist/{chunk-DFP476EU.js → chunk-JY2JXCL6.js} +89 -4
  80. package/dist/chunk-JY2JXCL6.js.map +1 -0
  81. package/dist/{chunk-SAL72A7T.js → chunk-LMADWO4Q.js} +9 -6
  82. package/dist/chunk-LMADWO4Q.js.map +1 -0
  83. package/dist/{chunk-3HSLJAMJ.js → chunk-LYVLDGML.js} +3 -3
  84. package/dist/{chunk-3HSLJAMJ.js.map → chunk-LYVLDGML.js.map} +1 -1
  85. package/dist/{chunk-62NNP7LU.js → chunk-M4G2SVXI.js} +3 -3
  86. package/dist/{chunk-62NNP7LU.js.map → chunk-M4G2SVXI.js.map} +1 -1
  87. package/dist/{chunk-SGI5MRKP.js → chunk-MDCI4RSG.js} +40 -5
  88. package/dist/chunk-MDCI4RSG.js.map +1 -0
  89. package/dist/{chunk-NAEXYRHR.js → chunk-MPRWVZXF.js} +10 -10
  90. package/dist/{chunk-NAEXYRHR.js.map → chunk-MPRWVZXF.js.map} +1 -1
  91. package/dist/{chunk-KO3VSZQP.js → chunk-NDBHEOIA.js} +6 -6
  92. package/dist/{chunk-KO3VSZQP.js.map → chunk-NDBHEOIA.js.map} +1 -1
  93. package/dist/{chunk-SVMIUCTT.js → chunk-NJVHGS7X.js} +4 -4
  94. package/dist/{chunk-SVMIUCTT.js.map → chunk-NJVHGS7X.js.map} +1 -1
  95. package/dist/{chunk-Z5EPCIB6.js → chunk-O3FYOS64.js} +93 -14
  96. package/dist/chunk-O3FYOS64.js.map +1 -0
  97. package/dist/{chunk-PKC2AHOB.js → chunk-PTJZCOBH.js} +2 -2
  98. package/dist/{chunk-PKC2AHOB.js.map → chunk-PTJZCOBH.js.map} +1 -1
  99. package/dist/{chunk-4CD2R4MJ.js → chunk-QBUJTVMY.js} +4 -4
  100. package/dist/{chunk-4CD2R4MJ.js.map → chunk-QBUJTVMY.js.map} +1 -1
  101. package/dist/{chunk-LL5GMUQG.js → chunk-SE6OL7Y5.js} +7 -7
  102. package/dist/{chunk-LL5GMUQG.js.map → chunk-SE6OL7Y5.js.map} +1 -1
  103. package/dist/{chunk-SILFO5RY.js → chunk-SQMDFM4N.js} +2 -2
  104. package/dist/{chunk-SILFO5RY.js.map → chunk-SQMDFM4N.js.map} +1 -1
  105. package/dist/{chunk-REAF7ZFA.js → chunk-T5EIWWEJ.js} +398 -36
  106. package/dist/chunk-T5EIWWEJ.js.map +1 -0
  107. package/dist/{chunk-QW5B3TEO.js → chunk-TMQFOJ6F.js} +3 -3
  108. package/dist/{chunk-QW5B3TEO.js.map → chunk-TMQFOJ6F.js.map} +1 -1
  109. package/dist/{chunk-BB5EJLKZ.js → chunk-TUOHA6BM.js} +2 -2
  110. package/dist/{chunk-BB5EJLKZ.js.map → chunk-TUOHA6BM.js.map} +1 -1
  111. package/dist/{chunk-HLAEYFUN.js → chunk-U3FI4DVT.js} +3 -3
  112. package/dist/{chunk-HLAEYFUN.js.map → chunk-U3FI4DVT.js.map} +1 -1
  113. package/dist/{chunk-237BMOZW.js → chunk-UWD7YBDR.js} +4 -4
  114. package/dist/{chunk-237BMOZW.js.map → chunk-UWD7YBDR.js.map} +1 -1
  115. package/dist/{chunk-6ZM5X2XW.js → chunk-V2CONXKD.js} +3 -3
  116. package/dist/{chunk-6ZM5X2XW.js.map → chunk-V2CONXKD.js.map} +1 -1
  117. package/dist/{chunk-DXBHGNSI.js → chunk-V3EJYOP2.js} +6 -6
  118. package/dist/{chunk-DXBHGNSI.js.map → chunk-V3EJYOP2.js.map} +1 -1
  119. package/dist/{chunk-OLZE4IHX.js → chunk-WPLZGT5Z.js} +4088 -3889
  120. package/dist/chunk-WPLZGT5Z.js.map +1 -0
  121. package/dist/{chunk-VT6G5AJV.js → chunk-WS3BOCAT.js} +4 -3
  122. package/dist/chunk-WS3BOCAT.js.map +1 -0
  123. package/dist/{chunk-LZ3E6TML.js → chunk-X2B5GMJO.js} +18 -9
  124. package/dist/chunk-X2B5GMJO.js.map +1 -0
  125. package/dist/{chunk-EDKTS44C.js → chunk-XPKUFOS3.js} +6 -6
  126. package/dist/{chunk-EDKTS44C.js.map → chunk-XPKUFOS3.js.map} +1 -1
  127. package/dist/{chunk-JAGBPHXB.js → chunk-Y242OE4B.js} +3 -3
  128. package/dist/{chunk-JAGBPHXB.js.map → chunk-Y242OE4B.js.map} +1 -1
  129. package/dist/{chunk-7O2CR5SZ.js → chunk-Y2BQWZXT.js} +41 -35
  130. package/dist/chunk-Y2BQWZXT.js.map +1 -0
  131. package/dist/{chunk-N2W7OJC6.js → chunk-YGT3CGPD.js} +3 -3
  132. package/dist/{chunk-N2W7OJC6.js.map → chunk-YGT3CGPD.js.map} +1 -1
  133. package/dist/{claude-code-DS26HI3K.js → claude-code-YRJIGXTL.js} +5 -5
  134. package/dist/{claude-code-DS26HI3K.js.map → claude-code-YRJIGXTL.js.map} +1 -1
  135. package/dist/cli/index.js +277 -143
  136. package/dist/cli/index.js.map +1 -1
  137. package/dist/cli/src/agent-pins.d.ts +8 -0
  138. package/dist/cli/src/agent-pins.d.ts.map +1 -1
  139. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  140. package/dist/cli/src/commands/catalog.d.ts +4 -4
  141. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  142. package/dist/cli/src/commands/connector.d.ts.map +1 -1
  143. package/dist/cli/src/commands/deploy.d.ts.map +1 -1
  144. package/dist/cli/src/commands/flow.d.ts.map +1 -1
  145. package/dist/cli/src/commands/harness.d.ts.map +1 -1
  146. package/dist/cli/src/commands/integration.d.ts.map +1 -1
  147. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  148. package/dist/cli/src/commands/library-index.d.ts +42 -0
  149. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  150. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  151. package/dist/cli/src/commands/npx.d.ts.map +1 -1
  152. package/dist/cli/src/commands/patch.d.ts.map +1 -1
  153. package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
  154. package/dist/cli/src/commands/project.d.ts.map +1 -1
  155. package/dist/cli/src/commands/run.d.ts.map +1 -1
  156. package/dist/cli/src/commands/serve-preflight.d.ts +10 -0
  157. package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
  158. package/dist/cli/src/commands/serve.d.ts +5 -3
  159. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  160. package/dist/cli/src/commands/session.d.ts.map +1 -1
  161. package/dist/cli/src/commands/source.d.ts.map +1 -1
  162. package/dist/cli/src/commands/store.d.ts.map +1 -1
  163. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  164. package/dist/cli/src/config-checks.d.ts +13 -0
  165. package/dist/cli/src/config-checks.d.ts.map +1 -1
  166. package/dist/cli/src/group-help.d.ts +11 -0
  167. package/dist/cli/src/group-help.d.ts.map +1 -0
  168. package/dist/connectors/config.js +2 -2
  169. package/dist/connectors/index.js +17 -17
  170. package/dist/connectors/src/config.d.ts.map +1 -1
  171. package/dist/{connectors-3ST6PGWP.js → connectors-JKT32HZT.js} +20 -20
  172. package/dist/{connectors-3ST6PGWP.js.map → connectors-JKT32HZT.js.map} +1 -1
  173. package/dist/core/index.js +4 -4
  174. package/dist/core/logging.js +1 -1
  175. package/dist/core/runtime-assets.js +2 -2
  176. package/dist/core/src/index.d.ts +1 -1
  177. package/dist/core/src/index.d.ts.map +1 -1
  178. package/dist/core/src/logging/config.d.ts.map +1 -1
  179. package/dist/core/src/repo-manager.d.ts +6 -0
  180. package/dist/core/src/repo-manager.d.ts.map +1 -1
  181. package/dist/core/src/run-state-ignore.d.ts +6 -4
  182. package/dist/core/src/run-state-ignore.d.ts.map +1 -1
  183. package/dist/core/src/walker.d.ts.map +1 -1
  184. package/dist/core/src/workspace-config.d.ts +6 -0
  185. package/dist/core/src/workspace-config.d.ts.map +1 -1
  186. package/dist/core/workspace-config.js +1 -1
  187. package/dist/deploy/index.js +4 -4
  188. package/dist/discovery/index.js +2 -2
  189. package/dist/{ensure-sources-VELKRM6X.js → ensure-sources-GUJODKY5.js} +23 -23
  190. package/dist/{ensure-sources-VELKRM6X.js.map → ensure-sources-GUJODKY5.js.map} +1 -1
  191. package/dist/factory-assets/connectors/box.js +17 -17
  192. package/dist/factory-assets/connectors/deploy.js +17 -17
  193. package/dist/factory-assets/connectors/devserver.js +17 -17
  194. package/dist/factory-assets/connectors/flow/adapter.js +17 -17
  195. package/dist/factory-assets/connectors/flow/engine.js +5 -5
  196. package/dist/factory-assets/connectors/flow/run-flow.js +18 -18
  197. package/dist/factory-assets/connectors/flow.js +17 -17
  198. package/dist/factory-assets/connectors/git.js +17 -17
  199. package/dist/factory-assets/connectors/gmail.js +17 -17
  200. package/dist/factory-assets/connectors/googledrive.js +17 -17
  201. package/dist/factory-assets/connectors/local.js +17 -17
  202. package/dist/factory-assets/connectors/mattermost.js +17 -17
  203. package/dist/factory-assets/connectors/memory.js +17 -17
  204. package/dist/factory-assets/connectors/minio.js +17 -17
  205. package/dist/factory-assets/connectors/postgres.js +17 -17
  206. package/dist/factory-assets/connectors/s3.js +17 -17
  207. package/dist/factory-assets/connectors/sharepoint.js +17 -17
  208. package/dist/factory-assets/connectors/sqlite.js +17 -17
  209. package/dist/factory-assets/connectors/static-server.js +17 -17
  210. package/dist/factory-assets/connectors/tunnel.js +17 -17
  211. package/dist/factory-assets/connectors/webdav.js +17 -17
  212. package/dist/factory-assets/connectors/xstate-store.js +17 -17
  213. package/dist/factory-assets/connectors/xstate.js +17 -17
  214. package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +4 -4
  215. package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +10 -10
  216. package/dist/factory-assets/skills/authoring-skaile-manifests/references/dependency-standard.md +15 -15
  217. package/dist/factory-assets/skills/manifest-compliance/SKILL.md +1 -1
  218. package/dist/{flows-I6ODIPZZ.js → flows-UCP6ZUYS.js} +7 -7
  219. package/dist/{flows-I6ODIPZZ.js.map → flows-UCP6ZUYS.js.map} +1 -1
  220. package/dist/{helpers-LWNKX56Y.js → helpers-SO53MRHF.js} +23 -23
  221. package/dist/{helpers-LWNKX56Y.js.map → helpers-SO53MRHF.js.map} +1 -1
  222. package/dist/library/index.js +7 -7
  223. package/dist/library/src/index.d.ts +1 -1
  224. package/dist/library/src/index.d.ts.map +1 -1
  225. package/dist/library/src/remote/index.d.ts +1 -1
  226. package/dist/library/src/remote/index.d.ts.map +1 -1
  227. package/dist/library/src/remote/remote-catalog-source.d.ts +33 -2
  228. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  229. package/dist/{library-publish-WJVCT2IK.js → library-publish-Z5E3YZCZ.js} +61 -47
  230. package/dist/library-publish-Z5E3YZCZ.js.map +1 -0
  231. package/dist/model-endpoint/index.js +7 -7
  232. package/dist/model-endpoint/src/index.d.ts +1 -1
  233. package/dist/model-endpoint/src/index.d.ts.map +1 -1
  234. package/dist/model-endpoint/src/openai-agent.d.ts +60 -0
  235. package/dist/model-endpoint/src/openai-agent.d.ts.map +1 -0
  236. package/dist/model-endpoint/src/resolve.d.ts +12 -3
  237. package/dist/model-endpoint/src/resolve.d.ts.map +1 -1
  238. package/dist/model-endpoint/src/server.d.ts.map +1 -1
  239. package/dist/model-endpoint/src/types.d.ts +33 -0
  240. package/dist/model-endpoint/src/types.d.ts.map +1 -1
  241. package/dist/model-endpoint/src/upstream-models.d.ts +20 -0
  242. package/dist/model-endpoint/src/upstream-models.d.ts.map +1 -0
  243. package/dist/{open-library-Q7QZJY5D.js → open-library-A5OB72FD.js} +26 -26
  244. package/dist/{open-library-Q7QZJY5D.js.map → open-library-A5OB72FD.js.map} +1 -1
  245. package/dist/{open-registry-RZW2AFD6.js → open-registry-BHBHQMBA.js} +11 -11
  246. package/dist/{open-registry-RZW2AFD6.js.map → open-registry-BHBHQMBA.js.map} +1 -1
  247. package/dist/{paths-RPK5PNZQ.js → paths-77PXOXZY.js} +7 -7
  248. package/dist/{paths-RPK5PNZQ.js.map → paths-77PXOXZY.js.map} +1 -1
  249. package/dist/{plugin-store-OJTERUEZ.js → plugin-store-XQP2CRYH.js} +7 -7
  250. package/dist/{plugin-store-OJTERUEZ.js.map → plugin-store-XQP2CRYH.js.map} +1 -1
  251. package/dist/{project-WVPRL7CP.js → project-KTEUN7KR.js} +39 -40
  252. package/dist/{project-WVPRL7CP.js.map → project-KTEUN7KR.js.map} +1 -1
  253. package/dist/resolver/index.js +4 -4
  254. package/dist/runner/index.js +28 -28
  255. package/dist/runner/src/agent-loop.d.ts +42 -0
  256. package/dist/runner/src/agent-loop.d.ts.map +1 -0
  257. package/dist/runner/src/agents/in-process-host.d.ts +9 -6
  258. package/dist/runner/src/agents/in-process-host.d.ts.map +1 -1
  259. package/dist/runner/src/model-endpoint-discovery.d.ts +3 -0
  260. package/dist/runner/src/model-endpoint-discovery.d.ts.map +1 -1
  261. package/dist/runner/src/serve.d.ts.map +1 -1
  262. package/dist/runner/src/session-builder.d.ts +6 -4
  263. package/dist/runner/src/session-builder.d.ts.map +1 -1
  264. package/dist/runner/src/turn-scheduler.d.ts +29 -2
  265. package/dist/runner/src/turn-scheduler.d.ts.map +1 -1
  266. package/dist/sdk/asset-manager.js +11 -11
  267. package/dist/sdk/bridge.js +14 -14
  268. package/dist/sdk/core.js +4 -4
  269. package/dist/sdk/flow.js +5 -5
  270. package/dist/sdk/index.js +28 -28
  271. package/dist/sdk/resolver.js +4 -4
  272. package/dist/sdk/runner.js +28 -28
  273. package/dist/sdk/transport/ws/server.js +5 -5
  274. package/dist/sdk/transport/ws.js +5 -5
  275. package/dist/sdk/transport.js +5 -5
  276. package/dist/{serve-preflight-24YWWYUG.js → serve-preflight-ODQGVUFL.js} +27 -26
  277. package/dist/{serve-preflight-24YWWYUG.js.map → serve-preflight-ODQGVUFL.js.map} +1 -1
  278. package/dist/{setup-F5JX64UP.js → setup-QJDI5YAW.js} +24 -24
  279. package/dist/{setup-F5JX64UP.js.map → setup-QJDI5YAW.js.map} +1 -1
  280. package/dist/{skills-KHHW3RZ3.js → skills-DE2BDQ6G.js} +6 -6
  281. package/dist/{skills-KHHW3RZ3.js.map → skills-DE2BDQ6G.js.map} +1 -1
  282. package/dist/{source-DG5IAAGZ.js → source-FKOUYMEM.js} +39 -39
  283. package/dist/{source-DG5IAAGZ.js.map → source-FKOUYMEM.js.map} +1 -1
  284. package/dist/{source-manifest-publish-76S2JD3O.js → source-manifest-publish-JA4TY4Z6.js} +41 -41
  285. package/dist/{source-manifest-publish-76S2JD3O.js.map → source-manifest-publish-JA4TY4Z6.js.map} +1 -1
  286. package/dist/transport/index.js +5 -5
  287. package/dist/transport/ws/server.js +5 -5
  288. package/dist/transport/ws.js +5 -5
  289. package/dist/tui/index.js +29 -29
  290. package/dist/tui/index.js.map +1 -1
  291. package/dist/tui/src/repl.d.ts.map +1 -1
  292. package/dist/types/manifests.js +1 -1
  293. package/dist/types/src/manifests/scaffold-body.d.ts +1 -1
  294. package/dist/types/src/manifests/scaffold-body.d.ts.map +1 -1
  295. package/dist/workspace-plugin/adapters/mcp.js +20 -20
  296. package/dist/workspace-plugin/adapters/omp.js +14 -14
  297. package/dist/workspace-plugin/index.js +2 -2
  298. package/package.json +1 -1
  299. package/dist/chunk-56PIAGD6.js.map +0 -1
  300. package/dist/chunk-7O2CR5SZ.js.map +0 -1
  301. package/dist/chunk-DFP476EU.js.map +0 -1
  302. package/dist/chunk-E5AZA2FL.js +0 -83
  303. package/dist/chunk-E5AZA2FL.js.map +0 -1
  304. package/dist/chunk-G44FFUMA.js.map +0 -1
  305. package/dist/chunk-I4DI5DAX.js.map +0 -1
  306. package/dist/chunk-KTBKW2FI.js.map +0 -1
  307. package/dist/chunk-LZ3E6TML.js.map +0 -1
  308. package/dist/chunk-O7ADRMCR.js.map +0 -1
  309. package/dist/chunk-OLZE4IHX.js.map +0 -1
  310. package/dist/chunk-REAF7ZFA.js.map +0 -1
  311. package/dist/chunk-SAL72A7T.js.map +0 -1
  312. package/dist/chunk-SGI5MRKP.js.map +0 -1
  313. package/dist/chunk-TMJBEGS4.js.map +0 -1
  314. package/dist/chunk-VT6G5AJV.js.map +0 -1
  315. package/dist/chunk-Y6LC5PEZ.js.map +0 -1
  316. package/dist/chunk-YMO4ZDLC.js.map +0 -1
  317. package/dist/chunk-Z5EPCIB6.js.map +0 -1
  318. package/dist/library-publish-WJVCT2IK.js.map +0 -1
@@ -1,11 +1,13 @@
1
- import { selectableEntries, entryModelIds, entrySurface, entryBaseUrl } from './chunk-I6XH46Q6.js';
2
- import { entryCredentialValue } from './chunk-SILFO5RY.js';
3
- import { listenWithProbe, loadHarnessSdkSubpath, loadHarnessSdk } from './chunk-TMJBEGS4.js';
1
+ import { selectableEntries, entryModelIds, entrySurface, entryBaseUrl } from './chunk-4WB4KSSQ.js';
2
+ import { entryCredentialValue } from './chunk-SQMDFM4N.js';
3
+ import { buildCredentialHeaders } from './chunk-6UP2EDFN.js';
4
+ import { listenWithProbe, loadHarnessSdkSubpath, loadHarnessSdk } from './chunk-4KPQ6ILH.js';
4
5
  import { parseModelRef } from './chunk-RXGPFAMN.js';
5
6
  import { createHash, timingSafeEqual, randomUUID } from 'crypto';
6
7
  import { createServer } from 'http';
7
8
 
8
9
  // model-endpoint/src/types.ts
10
+ var AGENT_MODEL_ID = "skaile-agent";
9
11
  var ModelEndpointError = class extends Error {
10
12
  status;
11
13
  type;
@@ -35,16 +37,17 @@ function piBaseUrl(_surface, registryBaseUrl) {
35
37
  }
36
38
  function resolveModel(selector, deps) {
37
39
  assertKnownProviderPrefix(selector, deps);
38
- const ref = parseModelRef(selector, deps.registry, deps.roles);
39
- if (!ref || ref.modelId === void 0) {
40
+ const parsed = parseModelRef(selector, deps.registry, deps.roles);
41
+ if (!parsed || parsed.modelId === void 0) {
40
42
  throw new ModelEndpointError(404, `model '${selector}' not found`, "model_not_found");
41
43
  }
44
+ const logicalId = parsed.modelId;
45
+ const ref = parsed.fallback ? placeUndeclaredBareId(selector, logicalId, parsed, deps) : parsed;
42
46
  const found = selectableEntries(deps.registry).find(([id]) => id === ref.providerId);
43
47
  if (!found) {
44
48
  throw new ModelEndpointError(404, `model '${selector}' not found`, "model_not_found");
45
49
  }
46
50
  const [providerId, entry] = found;
47
- const logicalId = ref.modelId;
48
51
  const declared = entryModelIds(entry);
49
52
  if (declared.length > 0 && !declared.some(([id]) => id === logicalId)) {
50
53
  throw new ModelEndpointError(
@@ -86,6 +89,24 @@ function resolveModel(selector, deps) {
86
89
  ...entry.headers ? { headers: entry.headers } : {}
87
90
  };
88
91
  }
92
+ function needsUpstreamModels(selector, deps) {
93
+ const ref = parseModelRef(selector, deps.registry, deps.roles);
94
+ return ref?.modelId !== void 0 && ref.fallback === true;
95
+ }
96
+ function placeUndeclaredBareId(selector, modelId, ref, deps) {
97
+ const owner = selectableEntries(deps.registry).find(
98
+ ([id, entry]) => entryModelIds(entry).length === 0 && deps.upstreamModels?.[id]?.has(modelId)
99
+ );
100
+ if (owner) {
101
+ return { ...ref, providerId: owner[0], providerModelId: modelId, fallback: void 0 };
102
+ }
103
+ const providers = selectableEntries(deps.registry).map(([id]) => id);
104
+ throw new ModelEndpointError(
105
+ 404,
106
+ `model '${selector}' not found: no provider of this endpoint declares or lists '${modelId}'; name it '<provider>/<model>' (providers: ${providers.join(", ")}) or add it to a model_map`,
107
+ "model_not_found"
108
+ );
109
+ }
89
110
  function assertKnownProviderPrefix(selector, deps) {
90
111
  let target = selector.trim();
91
112
  if (target.startsWith("@")) target = deps.roles?.[target.slice(1)]?.trim() ?? "";
@@ -111,14 +132,195 @@ function isKeyless(entry) {
111
132
  function listPassThroughProviders(registry) {
112
133
  return selectableEntries(registry).filter(([, entry]) => entryModelIds(entry).length === 0).map(([providerId]) => providerId);
113
134
  }
114
- function listModels(registry) {
115
- return selectableEntries(registry).flatMap(
116
- ([providerId, entry]) => entryModelIds(entry).map(([logicalId]) => ({
117
- id: `${providerId}/${logicalId}`,
118
- owned_by: providerId
119
- }))
135
+ function listModels(registry, upstreamModels = {}) {
136
+ return selectableEntries(registry).flatMap(([providerId, entry]) => {
137
+ const ids = entryModelIds(entry).map(([logicalId]) => logicalId);
138
+ if (ids.length === 0) ids.push(...upstreamModels[providerId] ?? []);
139
+ return ids.map((logicalId) => ({ id: `${providerId}/${logicalId}`, owned_by: providerId }));
140
+ });
141
+ }
142
+
143
+ // model-endpoint/src/openai-agent.ts
144
+ var MAX_INPUT_CHARS = 200;
145
+ function agentPromptText(request) {
146
+ const messages = request.context.messages;
147
+ for (let i = messages.length - 1; i >= 0; i--) {
148
+ const message = messages[i];
149
+ if (message?.role !== "user") continue;
150
+ if (typeof message.content === "string") return message.content;
151
+ let text = "";
152
+ for (const part of message.content) {
153
+ if (part.type === "image") {
154
+ throw new ModelEndpointError(400, "skaile-agent takes text only", "unsupported_content");
155
+ }
156
+ text += part.text;
157
+ }
158
+ return text;
159
+ }
160
+ throw new ModelEndpointError(
161
+ 400,
162
+ "messages must contain a message with role 'user'",
163
+ "missing_user_message"
120
164
  );
121
165
  }
166
+ function truncated(text) {
167
+ return text.length > MAX_INPUT_CHARS ? `${text.slice(0, MAX_INPUT_CHARS)}\u2026` : text;
168
+ }
169
+ function activityLine(event) {
170
+ switch (event.type) {
171
+ case "tool_call": {
172
+ const input = JSON.stringify(event.input);
173
+ return `\u2192 ${event.tool}${input === void 0 ? "" : ` ${truncated(input)}`}
174
+ `;
175
+ }
176
+ case "tool_result":
177
+ return `\u2190 ${event.tool}
178
+ `;
179
+ case "error":
180
+ return event.fatal ? void 0 : `! ${event.message}
181
+ `;
182
+ default:
183
+ return void 0;
184
+ }
185
+ }
186
+ function questionText(event) {
187
+ const options = event.options ?? [];
188
+ if (options.length === 0) return event.question;
189
+ return `${event.question}
190
+ ${options.map((option, i) => `${i + 1}. ${option}`).join("\n")}`;
191
+ }
192
+ function endsAgentTurn(event) {
193
+ return event.type === "finished" || event.type === "question";
194
+ }
195
+ function toAgentUsage(finished) {
196
+ const tokens = finished?.tokens;
197
+ const prompt = tokens?.inputTokens ?? 0;
198
+ const completion = tokens?.outputTokens ?? 0;
199
+ const usage = {
200
+ prompt_tokens: prompt,
201
+ completion_tokens: completion,
202
+ total_tokens: tokens?.totalTokens ?? prompt + completion,
203
+ prompt_tokens_details: { cached_tokens: tokens?.cacheReadTokens ?? 0 }
204
+ };
205
+ if (tokens?.reasoningTokens !== void 0) {
206
+ usage.completion_tokens_details = { reasoning_tokens: tokens.reasoningTokens };
207
+ }
208
+ if (finished !== void 0 && finished.costUsd > 0) usage.cost = finished.costUsd;
209
+ return usage;
210
+ }
211
+ async function toAgentCompletion(events, meta) {
212
+ let content = "";
213
+ let reasoning = "";
214
+ let failure;
215
+ let finished;
216
+ for await (const event of events) {
217
+ if (event.type === "text") {
218
+ content += event.content;
219
+ } else if (event.type === "text_retract") {
220
+ if (event.content.length > 0 && content.endsWith(event.content)) {
221
+ content = content.slice(0, -event.content.length);
222
+ }
223
+ } else if (event.type === "error" && event.fatal) {
224
+ failure ??= event.message;
225
+ } else if (event.type === "question") {
226
+ content += content.length > 0 ? `
227
+ ${questionText(event)}` : questionText(event);
228
+ } else if (event.type === "finished") {
229
+ finished = event;
230
+ } else {
231
+ reasoning += activityLine(event) ?? "";
232
+ }
233
+ if (endsAgentTurn(event)) break;
234
+ }
235
+ if (failure !== void 0) {
236
+ throw new ModelEndpointError(502, failure, "turn_failed", "upstream_error");
237
+ }
238
+ return {
239
+ id: meta.id,
240
+ object: "chat.completion",
241
+ created: meta.created,
242
+ model: meta.model,
243
+ choices: [
244
+ {
245
+ index: 0,
246
+ message: {
247
+ role: "assistant",
248
+ content: content.length > 0 ? content : null,
249
+ ...reasoning.length > 0 ? { reasoning_content: reasoning } : {}
250
+ },
251
+ finish_reason: "stop"
252
+ }
253
+ ],
254
+ usage: toAgentUsage(finished)
255
+ };
256
+ }
257
+ function createAgentStreamState(init) {
258
+ return { ...init, started: false, closed: false, hasContent: false };
259
+ }
260
+ function chunk(state, delta, finish = null) {
261
+ return {
262
+ id: state.id,
263
+ object: "chat.completion.chunk",
264
+ created: state.created,
265
+ model: state.model,
266
+ choices: [{ index: 0, delta, finish_reason: finish }]
267
+ };
268
+ }
269
+ function closingChunks(state, finished) {
270
+ state.closed = true;
271
+ const chunks = [chunk(state, {}, "stop")];
272
+ if (state.includeUsage) {
273
+ chunks.push({
274
+ id: state.id,
275
+ object: "chat.completion.chunk",
276
+ created: state.created,
277
+ model: state.model,
278
+ choices: [],
279
+ usage: toAgentUsage(finished)
280
+ });
281
+ }
282
+ return chunks;
283
+ }
284
+ function agentDeltas(event, state) {
285
+ switch (event.type) {
286
+ case "text":
287
+ if (event.content.length === 0) return [];
288
+ state.hasContent = true;
289
+ return [chunk(state, { content: event.content })];
290
+ case "text_retract":
291
+ return [chunk(state, { reasoning_content: `~ retracted ${event.content.length} chars
292
+ ` })];
293
+ case "question": {
294
+ const text = questionText(event);
295
+ const content = state.hasContent ? `
296
+ ${text}` : text;
297
+ return [chunk(state, { content }), ...closingChunks(state, void 0)];
298
+ }
299
+ case "finished":
300
+ return closingChunks(state, event);
301
+ default: {
302
+ if (event.type === "error" && event.fatal) {
303
+ state.error ??= event.message;
304
+ return [];
305
+ }
306
+ const line = activityLine(event);
307
+ return line === void 0 ? [] : [chunk(state, { reasoning_content: line })];
308
+ }
309
+ }
310
+ }
311
+ function agentCompletionChunks(event, state) {
312
+ const chunks = agentDeltas(event, state);
313
+ if (chunks.length === 0 || state.started) return chunks;
314
+ state.started = true;
315
+ return [chunk(state, { role: "assistant", content: "" }), ...chunks];
316
+ }
317
+ function agentCompletionEnd(state) {
318
+ if (state.closed) return [];
319
+ const chunks = closingChunks(state, void 0);
320
+ if (state.started) return chunks;
321
+ state.started = true;
322
+ return [chunk(state, { role: "assistant", content: "" }), ...chunks];
323
+ }
122
324
 
123
325
  // model-endpoint/src/openai-shared.ts
124
326
  var THINKING_LEVELS = [
@@ -528,7 +730,7 @@ function toChatCompletion(message, meta, cost) {
528
730
  function createChatStreamState(init) {
529
731
  return { ...init, nextToolIndex: 0, toolIndexByContent: /* @__PURE__ */ new Map() };
530
732
  }
531
- function chunk(state, delta, finish = null) {
733
+ function chunk2(state, delta, finish = null) {
532
734
  return {
533
735
  id: state.id,
534
736
  object: "chat.completion.chunk",
@@ -540,11 +742,11 @@ function chunk(state, delta, finish = null) {
540
742
  function chatCompletionChunks(event, state) {
541
743
  switch (event.type) {
542
744
  case "start":
543
- return [chunk(state, { role: "assistant", content: "" })];
745
+ return [chunk2(state, { role: "assistant", content: "" })];
544
746
  case "text_delta":
545
- return event.delta.length > 0 ? [chunk(state, { content: event.delta })] : [];
747
+ return event.delta.length > 0 ? [chunk2(state, { content: event.delta })] : [];
546
748
  case "thinking_delta":
547
- return event.delta.length > 0 ? [chunk(state, { reasoning_content: event.delta })] : [];
749
+ return event.delta.length > 0 ? [chunk2(state, { reasoning_content: event.delta })] : [];
548
750
  case "toolcall_start":
549
751
  state.toolIndexByContent.set(event.contentIndex, state.nextToolIndex++);
550
752
  return [];
@@ -555,7 +757,7 @@ function chatCompletionChunks(event, state) {
555
757
  state.toolIndexByContent.set(event.contentIndex, index);
556
758
  }
557
759
  return [
558
- chunk(state, {
760
+ chunk2(state, {
559
761
  tool_calls: [
560
762
  {
561
763
  index,
@@ -571,7 +773,7 @@ function chatCompletionChunks(event, state) {
571
773
  ];
572
774
  }
573
775
  case "done": {
574
- const chunks = [chunk(state, {}, finishReason(event.reason, void 0))];
776
+ const chunks = [chunk2(state, {}, finishReason(event.reason, void 0))];
575
777
  if (state.includeUsage) {
576
778
  chunks.push({
577
779
  id: state.id,
@@ -1025,6 +1227,73 @@ function responsesEvents(event, state) {
1025
1227
  }
1026
1228
  }
1027
1229
 
1230
+ // model-endpoint/src/upstream-models.ts
1231
+ var LIST_TIMEOUT_MS = 5e3;
1232
+ var CACHE_TTL_MS = 6e4;
1233
+ var ANTHROPIC_VERSION = "2023-06-01";
1234
+ var UpstreamModelCache = class {
1235
+ cache = /* @__PURE__ */ new Map();
1236
+ async list(registry, lookupEnv, fetchFn) {
1237
+ const open = selectableEntries(registry).filter(
1238
+ ([, entry]) => entryModelIds(entry).length === 0
1239
+ );
1240
+ const lists = await Promise.all(
1241
+ open.map(async ([providerId, entry]) => {
1242
+ const surface = entrySurface(entry);
1243
+ const baseUrl = entryBaseUrl(entry);
1244
+ if (!surface || !baseUrl) return [providerId, /* @__PURE__ */ new Set()];
1245
+ const key = `${providerId}
1246
+ ${baseUrl}`;
1247
+ const hit = this.cache.get(key);
1248
+ if (hit && Date.now() - hit.at < CACHE_TTL_MS) return [providerId, hit.ids];
1249
+ const apiKey = entryCredentialValue(providerId, entry, {
1250
+ env: lookupEnv,
1251
+ allowCommand: false
1252
+ });
1253
+ const ids = await fetchIds(
1254
+ surface,
1255
+ baseUrl,
1256
+ buildCredentialHeaders(entry, apiKey),
1257
+ entry.headers,
1258
+ fetchFn
1259
+ );
1260
+ if (!ids) return [providerId, /* @__PURE__ */ new Set()];
1261
+ this.cache.set(key, { at: Date.now(), ids });
1262
+ return [providerId, ids];
1263
+ })
1264
+ );
1265
+ return Object.fromEntries(lists);
1266
+ }
1267
+ };
1268
+ async function fetchIds(surface, baseUrl, credentialHeaders, entryHeaders, fetchFn) {
1269
+ const anthropic = surface === "anthropic-messages";
1270
+ if (!anthropic && surface !== "openai-completions" && surface !== "openai-responses") {
1271
+ return void 0;
1272
+ }
1273
+ const url = anthropic ? `${baseUrl}/v1/models?limit=1000` : `${baseUrl}/models`;
1274
+ const headers = {
1275
+ accept: "application/json",
1276
+ ...entryHeaders,
1277
+ ...credentialHeaders
1278
+ };
1279
+ if (anthropic) headers["anthropic-version"] = ANTHROPIC_VERSION;
1280
+ try {
1281
+ const res = await fetchFn(url, { headers, signal: AbortSignal.timeout(LIST_TIMEOUT_MS) });
1282
+ if (!res.ok) return void 0;
1283
+ const body = await res.json();
1284
+ const data = body?.data;
1285
+ if (!Array.isArray(data)) return void 0;
1286
+ return new Set(
1287
+ data.flatMap((item) => {
1288
+ const id = item?.id;
1289
+ return typeof id === "string" && id !== "" ? [id] : [];
1290
+ })
1291
+ );
1292
+ } catch {
1293
+ return void 0;
1294
+ }
1295
+ }
1296
+
1028
1297
  // model-endpoint/src/usage-cost.ts
1029
1298
  function costOf(payload) {
1030
1299
  if (typeof payload !== "object" || payload === null || !("usage" in payload)) return void 0;
@@ -1098,11 +1367,32 @@ async function startModelEndpoint(options) {
1098
1367
  const projectDir = options.projectDir ?? process.cwd();
1099
1368
  const loadApi = options.loadApi ?? ((surface) => defaultLoadApi(surface, projectDir));
1100
1369
  const tokenDigest = digest(options.token);
1370
+ const upstreamModels = new UpstreamModelCache();
1371
+ async function resolveWithUpstream(selector) {
1372
+ const current = deps();
1373
+ if (needsUpstreamModels(selector, current)) {
1374
+ current.upstreamModels = await upstreamModels.list(
1375
+ current.registry,
1376
+ current.lookupEnv,
1377
+ options.fetch ?? globalThis.fetch
1378
+ );
1379
+ }
1380
+ return resolveModel(selector, current);
1381
+ }
1101
1382
  const deps = () => ({
1102
1383
  registry: options.getRegistry(),
1103
1384
  lookupEnv: options.getLookupEnv(),
1104
1385
  roles: options.getRoles?.()
1105
1386
  });
1387
+ function rejectAgentSurface(model) {
1388
+ if (model === AGENT_MODEL_ID && options.getAgentLoop?.()) {
1389
+ throw new ModelEndpointError(
1390
+ 400,
1391
+ `${AGENT_MODEL_ID} is served on /v1/chat/completions only`,
1392
+ "agent_model_unsupported_surface"
1393
+ );
1394
+ }
1395
+ }
1106
1396
  function authenticate(req) {
1107
1397
  const match = /^Bearer\s+(.+)$/i.exec(req.headers.authorization ?? "");
1108
1398
  if (!match || !timingSafeEqual(digest(match[1] ?? ""), tokenDigest)) {
@@ -1151,7 +1441,9 @@ async function startModelEndpoint(options) {
1151
1441
  }
1152
1442
  async function handleChat(req, res, signal, trace) {
1153
1443
  const request = parseChatCompletionRequest(await readJson(req));
1154
- const resolved = resolveModel(request.model, deps());
1444
+ const agentLoop = request.model === AGENT_MODEL_ID ? options.getAgentLoop?.() : void 0;
1445
+ if (agentLoop) return handleAgentChat(res, request, agentLoop, signal, trace);
1446
+ const resolved = await resolveWithUpstream(request.model);
1155
1447
  trace.target = `${resolved.providerId}/${resolved.logicalId}`;
1156
1448
  const { events, cost } = await startUpstream(request, resolved, signal, true);
1157
1449
  const id = `chatcmpl-${randomUUID().replaceAll("-", "")}`;
@@ -1176,13 +1468,46 @@ async function startModelEndpoint(options) {
1176
1468
  if (event.type === "done" && state.includeUsage) state.cost = await cost();
1177
1469
  return chatCompletionChunks(event, state);
1178
1470
  },
1179
- errorFrame: (message) => ({ error: { message, type: "upstream_error" } }),
1471
+ errorFrame: upstreamErrorFrame,
1180
1472
  terminator: "[DONE]"
1181
1473
  });
1182
1474
  }
1475
+ async function handleAgentChat(res, request, loop, signal, trace) {
1476
+ trace.target = AGENT_MODEL_ID;
1477
+ const text = agentPromptText(request);
1478
+ const run = await loop.prompt({ text, requestId: randomUUID() });
1479
+ const abort = () => {
1480
+ run.abort().catch((cause) => log(`agent abort failed: ${errorText(cause)}`));
1481
+ };
1482
+ if (signal.aborted) abort();
1483
+ else signal.addEventListener("abort", abort, { once: true });
1484
+ try {
1485
+ const id = `chatcmpl-${randomUUID().replaceAll("-", "")}`;
1486
+ const created = Math.floor(Date.now() / 1e3);
1487
+ if (!request.stream) {
1488
+ const completion = await toAgentCompletion(run.events, {
1489
+ id,
1490
+ created,
1491
+ model: AGENT_MODEL_ID
1492
+ });
1493
+ sendJson(res, 200, completion);
1494
+ return;
1495
+ }
1496
+ const state = createAgentStreamState({
1497
+ id,
1498
+ created,
1499
+ model: AGENT_MODEL_ID,
1500
+ includeUsage: request.includeUsage
1501
+ });
1502
+ await pipeAgentSse(res, run.events, state);
1503
+ } finally {
1504
+ signal.removeEventListener("abort", abort);
1505
+ }
1506
+ }
1183
1507
  async function handleResponses(req, res, signal, trace) {
1184
1508
  const request = parseResponsesRequest(await readJson(req));
1185
- const resolved = resolveModel(request.model, deps());
1509
+ rejectAgentSurface(request.model);
1510
+ const resolved = await resolveWithUpstream(request.model);
1186
1511
  trace.target = `${resolved.providerId}/${resolved.logicalId}`;
1187
1512
  const { events } = await startUpstream(request, resolved, signal);
1188
1513
  const id = `resp_${randomUUID().replaceAll("-", "")}`;
@@ -1204,7 +1529,8 @@ async function startModelEndpoint(options) {
1204
1529
  if (!isRecord2(body) || typeof body.model !== "string" || body.model === "") {
1205
1530
  throw new ModelEndpointError(400, "`model` is required", "missing_model");
1206
1531
  }
1207
- const resolved = resolveModel(body.model, deps());
1532
+ rejectAgentSurface(body.model);
1533
+ const resolved = await resolveWithUpstream(body.model);
1208
1534
  trace.target = `${resolved.providerId}/${resolved.logicalId}`;
1209
1535
  if (!EMBEDDING_SURFACES.has(resolved.model.api)) {
1210
1536
  throw new ModelEndpointError(
@@ -1245,19 +1571,30 @@ async function startModelEndpoint(options) {
1245
1571
  if (!path.startsWith("/v1/")) throw notFound(path);
1246
1572
  authenticate(req);
1247
1573
  switch (`${req.method} ${path}`) {
1248
- case "GET /v1/models":
1574
+ case "GET /v1/models": {
1575
+ const registry = options.getRegistry();
1576
+ const upstream = await upstreamModels.list(
1577
+ registry,
1578
+ options.getLookupEnv(),
1579
+ options.fetch ?? globalThis.fetch
1580
+ );
1249
1581
  sendJson(res, 200, {
1250
1582
  object: "list",
1251
- data: listModels(options.getRegistry()).map((m) => ({
1252
- id: m.id,
1253
- object: "model",
1254
- created: 0,
1255
- owned_by: m.owned_by
1256
- })),
1257
- // Entries that declare no models forward any `<id>/<model>`: nothing to list.
1258
- pass_through_providers: listPassThroughProviders(options.getRegistry())
1583
+ data: [
1584
+ ...listModels(registry, upstream).map((m) => ({
1585
+ id: m.id,
1586
+ object: "model",
1587
+ created: 0,
1588
+ owned_by: m.owned_by
1589
+ })),
1590
+ ...options.getAgentLoop?.() ? [{ id: AGENT_MODEL_ID, object: "model", created: 0, owned_by: "skaile" }] : []
1591
+ ],
1592
+ // Entries that declare no models forward any `<id>/<model>`, also one their upstream
1593
+ // does not list.
1594
+ pass_through_providers: listPassThroughProviders(registry)
1259
1595
  });
1260
1596
  return;
1597
+ }
1261
1598
  case "POST /v1/chat/completions":
1262
1599
  return handleChat(req, res, signal, trace);
1263
1600
  case "POST /v1/responses":
@@ -1404,6 +1741,31 @@ async function pipeSse(res, events, pipe) {
1404
1741
  if (pipe.terminator) await sse.raw(pipe.terminator);
1405
1742
  res.end();
1406
1743
  }
1744
+ async function pipeAgentSse(res, events, state) {
1745
+ let sse;
1746
+ const sendAll = async (frames) => {
1747
+ for (const frame of frames) {
1748
+ sse ??= openSse(res);
1749
+ await sse.send(frame);
1750
+ }
1751
+ };
1752
+ try {
1753
+ for await (const event of events) {
1754
+ await sendAll(agentCompletionChunks(event, state));
1755
+ if (endsAgentTurn(event)) break;
1756
+ }
1757
+ await sendAll(agentCompletionEnd(state));
1758
+ } catch (err) {
1759
+ if (!sse) throw err;
1760
+ state.error ??= errorText(err);
1761
+ }
1762
+ if (state.error !== void 0) await sendAll([upstreamErrorFrame(state.error)]);
1763
+ await sse?.raw("[DONE]");
1764
+ res.end();
1765
+ }
1766
+ function upstreamErrorFrame(message) {
1767
+ return { error: { message, type: "upstream_error" } };
1768
+ }
1407
1769
  function openSse(res) {
1408
1770
  res.writeHead(200, {
1409
1771
  "content-type": "text/event-stream",
@@ -1474,8 +1836,8 @@ async function readJson(req) {
1474
1836
  if (Number(req.headers["content-length"]) > MAX_BODY_BYTES) throw tooLarge();
1475
1837
  const chunks = [];
1476
1838
  let size = 0;
1477
- for await (const chunk2 of req) {
1478
- const buffer = chunk2;
1839
+ for await (const chunk3 of req) {
1840
+ const buffer = chunk3;
1479
1841
  size += buffer.length;
1480
1842
  if (size > MAX_BODY_BYTES) throw tooLarge();
1481
1843
  chunks.push(buffer);
@@ -1498,6 +1860,6 @@ function errorText(err) {
1498
1860
  return err instanceof Error ? err.message : String(err);
1499
1861
  }
1500
1862
 
1501
- export { ModelEndpointError, checkPiAiInstalled, listModels, resolveModel, startModelEndpoint };
1502
- //# sourceMappingURL=chunk-REAF7ZFA.js.map
1503
- //# sourceMappingURL=chunk-REAF7ZFA.js.map
1863
+ export { AGENT_MODEL_ID, ModelEndpointError, checkPiAiInstalled, listModels, resolveModel, startModelEndpoint };
1864
+ //# sourceMappingURL=chunk-T5EIWWEJ.js.map
1865
+ //# sourceMappingURL=chunk-T5EIWWEJ.js.map