@makaio/framework 1.0.0-dev-1783705652236 → 1.0.0-dev-1783940945655

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 (449) hide show
  1. package/dist/.makaio-build.json +2 -2
  2. package/dist/account-identity-BYfeWLe-.mjs +1 -0
  3. package/dist/adapter-auth-runtime-a4O7cSNP.mjs +1 -0
  4. package/dist/adapter-binding-DDUyv1JK.d.mts +254 -0
  5. package/dist/{adapter-CA8rPIUz.mjs → adapter-nl_xz9dz.mjs} +1 -1
  6. package/dist/adapter-subsystem/index.d.mts +110 -5
  7. package/dist/adapter-subsystem/index.mjs +1 -1
  8. package/dist/adapters/acp-client/index.d.mts +10 -0
  9. package/dist/adapters/acp-client/index.mjs +2 -2
  10. package/dist/adapters/config/index.d.mts +176 -153
  11. package/dist/adapters/config/index.mjs +1 -1
  12. package/dist/adapters/index.d.mts +1021 -1005
  13. package/dist/adapters/index.mjs +6 -6
  14. package/dist/adapters/node.d.mts +1 -1
  15. package/dist/adapters/node.mjs +1 -1
  16. package/dist/adapters/stream-session/index.d.mts +7 -5
  17. package/dist/adapters/stream-session/index.mjs +1 -1
  18. package/dist/auth-C3NOWqTU.mjs +1 -0
  19. package/dist/{base-orchestrator-J1WKAUkF.d.mts → base-orchestrator-BiShpVKL.d.mts} +6 -0
  20. package/dist/bus/index.d.mts +21 -21
  21. package/dist/bus/index.mjs +1 -1
  22. package/dist/{canonical-model-DV-Z8gsb.mjs → canonical-model-CVRCW9h7.mjs} +1 -1
  23. package/dist/client-BkpLM8Fx.mjs +1 -0
  24. package/dist/client-binary-version-verifier-BK_vIjIo.mjs +2 -0
  25. package/dist/client-binary-version-verifier-BwrMTAh2.d.mts +179 -0
  26. package/dist/clients/index.d.mts +74 -90
  27. package/dist/clients/index.mjs +1 -2
  28. package/dist/clients/managed-install.d.mts +2 -0
  29. package/dist/clients/managed-install.mjs +1 -0
  30. package/dist/{clients-namespace-Bt_VTkEU.d.mts → clients-namespace-B96QIJOs.d.mts} +224 -21
  31. package/dist/compression-CZ_6fYq8.mjs +1 -0
  32. package/dist/config-namespace-DTA6EQL8.mjs +1 -0
  33. package/dist/{config-namespace-DqdFE6zk.d.mts → config-namespace-x0fuhEXe.d.mts} +73 -1
  34. package/dist/contracts/adapter/index.d.mts +3 -3
  35. package/dist/contracts/adapter/index.mjs +1 -1
  36. package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
  37. package/dist/contracts/artifact/index.d.mts +1 -1
  38. package/dist/contracts/auth/index.d.mts +3 -0
  39. package/dist/contracts/auth/index.mjs +1 -0
  40. package/dist/contracts/canonical-model/index.d.mts +1 -1
  41. package/dist/contracts/canonical-model/index.mjs +1 -1
  42. package/dist/contracts/client/index.d.mts +3 -3
  43. package/dist/contracts/client/index.mjs +1 -1
  44. package/dist/contracts/common/index.d.mts +1 -1
  45. package/dist/contracts/config/index.d.mts +20 -93
  46. package/dist/contracts/config/index.mjs +1 -1
  47. package/dist/contracts/extension/index.d.mts +3 -3
  48. package/dist/contracts/extension/index.mjs +1 -1
  49. package/dist/contracts/facet/index.d.mts +1 -1
  50. package/dist/contracts/facet/index.mjs +1 -1
  51. package/dist/contracts/harness/index.d.mts +1 -1
  52. package/dist/contracts/harness/index.mjs +1 -1
  53. package/dist/contracts/host/index.d.mts +1 -1
  54. package/dist/contracts/host/index.mjs +1 -1
  55. package/dist/contracts/index.d.mts +1214 -261
  56. package/dist/contracts/index.mjs +1 -1
  57. package/dist/contracts/materialization/index.d.mts +3 -3
  58. package/dist/contracts/materialization/index.mjs +1 -1
  59. package/dist/contracts/model-registry/index.d.mts +1 -1
  60. package/dist/contracts/model-registry/index.mjs +1 -1
  61. package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
  62. package/dist/contracts/native-session-supervisor/index.mjs +1 -1
  63. package/dist/contracts/platform/index.d.mts +1 -1
  64. package/dist/contracts/platform/index.mjs +1 -1
  65. package/dist/contracts/provider/index.d.mts +2 -2
  66. package/dist/contracts/provider/index.mjs +1 -1
  67. package/dist/contracts/session/index.d.mts +2 -2
  68. package/dist/contracts/session/index.mjs +1 -1
  69. package/dist/contracts/shared/index.d.mts +2 -2
  70. package/dist/contracts/shared/index.mjs +1 -1
  71. package/dist/contracts/skill/index.d.mts +1 -1
  72. package/dist/contracts/skill/index.mjs +1 -1
  73. package/dist/contracts/telemetry/index.d.mts +1 -1
  74. package/dist/contracts/telemetry/index.mjs +1 -1
  75. package/dist/contracts/timeout/index.d.mts +1 -1
  76. package/dist/contracts/timeout/index.mjs +1 -1
  77. package/dist/contracts/toast/index.mjs +1 -1
  78. package/dist/contracts/variant/index.d.mts +1 -1
  79. package/dist/contracts/variant/index.mjs +1 -1
  80. package/dist/contracts/workflow/index.d.mts +2 -2
  81. package/dist/contracts/workflow/index.mjs +1 -1
  82. package/dist/{definition-s9PIua2B.d.mts → definition-Bj9Vr16H.d.mts} +1 -1
  83. package/dist/{definition-Cllhr9mi.d.mts → definition-BsTlOz99.d.mts} +36 -4
  84. package/dist/{definition-CuJvtYeG.d.mts → definition-Cbl0k6Fc.d.mts} +31 -1
  85. package/dist/definition-K3m51lgO.mjs +1 -0
  86. package/dist/definitions-C1pgx0Nq.mjs +1 -0
  87. package/dist/{detached-extension-handle-Cx6-0eqg.mjs → detached-extension-handle-CTaQoolf.mjs} +1 -1
  88. package/dist/execution-target-Bg2wpfML.mjs +1 -0
  89. package/dist/{extension-CJClssfp.mjs → extension-CjTu6mzW.mjs} +1 -1
  90. package/dist/extension-D4iKUUMG.mjs +1 -0
  91. package/dist/{filesystem-service-Bmyqo6po.mjs → filesystem-service-maY_P3yA.mjs} +1 -1
  92. package/dist/git/index.mjs +1 -1
  93. package/dist/{globby-D4SANVoq.mjs → globby-CisClzat.mjs} +1 -1
  94. package/dist/handlers-RGs3eC9X.mjs +57 -0
  95. package/dist/{harness-DkUpbsuY.mjs → harness-DflvHAGV.mjs} +1 -1
  96. package/dist/{index-C23g_M_J2.d.mts → index-5s_dN3cg2.d.mts} +18 -1
  97. package/dist/index-9dISOTLT.d.mts +174 -0
  98. package/dist/{index-B9d_8_V2.d.mts → index-9g0agW_p.d.mts} +55 -55
  99. package/dist/{index-DoEF9LAc.d.mts → index-BcejR1Jc.d.mts} +3 -3
  100. package/dist/index-BsEvzFey.d.mts +1175 -0
  101. package/dist/{index-ntS1EXlf.d.mts → index-BtL7ONuM.d.mts} +1 -1
  102. package/dist/index-BxuiHVFi.d.mts +284 -0
  103. package/dist/{index-PIlYSC73.d.mts → index-C9Q1E8Y-.d.mts} +66 -53
  104. package/dist/{index-CaerrEDH.d.mts → index-CB2XTzvd.d.mts} +3 -3
  105. package/dist/{index-Cx1Bm6WD.d.mts → index-CVs0Qxks.d.mts} +8 -8
  106. package/dist/{index-WHUV7neB.d.mts → index-CW6-0k3Z.d.mts} +105 -105
  107. package/dist/index-CagRgpXI2.d.mts +84 -0
  108. package/dist/{index-DZPNuWMc.d.mts → index-Cw3cjGAT.d.mts} +7 -7
  109. package/dist/{index-DnnKUwHm.d.mts → index-D5IEq4_E.d.mts} +36 -32
  110. package/dist/{index-h5go5Dtd.d.mts → index-D75FnT0B.d.mts} +1 -1
  111. package/dist/{index-O08Q2ikz.d.mts → index-DNc1yLQs.d.mts} +8 -8
  112. package/dist/{index-FFVwQMad.d.mts → index-DlUPWOh4.d.mts} +737 -97
  113. package/dist/{index-DScUb-hF.d.mts → index-Do7Wgio_2.d.mts} +35 -12
  114. package/dist/{index-C9FCWOhp.d.mts → index-DxatNFz7.d.mts} +124 -22
  115. package/dist/{index-BvTd61i5.d.mts → index-T96ydgVk.d.mts} +260 -160
  116. package/dist/{index-DLNRgZPo2.d.mts → index-j2YlW_Fc.d.mts} +1 -1
  117. package/dist/{index-BcvG3wPv.d.mts → index-p6dWV52m.d.mts} +513 -373
  118. package/dist/{index-B2DjrVb8.d.mts → index-sCOlgPyj.d.mts} +1589 -482
  119. package/dist/kernel/cli/index.d.mts +2 -2
  120. package/dist/kernel/cli/index.mjs +1 -1
  121. package/dist/kernel/cli/register.d.mts +1 -1
  122. package/dist/kernel/cli/register.mjs +1 -1
  123. package/dist/kernel/cli/schemas.mjs +1 -1
  124. package/dist/kernel/extension/index.d.mts +1 -1
  125. package/dist/kernel/extension/index.mjs +1 -1
  126. package/dist/kernel/index.d.mts +5 -5
  127. package/dist/kernel/index.mjs +1 -1
  128. package/dist/kernel/namespace/index.d.mts +1 -1
  129. package/dist/kernel/namespace/index.mjs +1 -1
  130. package/dist/kernel/observability/index.d.mts +1 -1
  131. package/dist/kernel/observability/index.mjs +1 -1
  132. package/dist/kernel/providers/index.d.mts +1 -1
  133. package/dist/kernel/providers/index.mjs +1 -1
  134. package/dist/kernel/window/index.d.mts +1 -1
  135. package/dist/kernel/window/index.mjs +1 -1
  136. package/dist/{lib-BOmKyjWD.mjs → lib-DIVnpS8e.mjs} +1 -1
  137. package/dist/{lib-DLZYp5z3.mjs → lib-DymjnkAP.mjs} +1 -1
  138. package/dist/{load-extensions-Cze1RHcG.mjs → load-extensions-BtUrq2_t.mjs} +1 -1
  139. package/dist/{load-extensions-DNRIy4zC.d.mts → load-extensions-_EnedkUp.d.mts} +1 -1
  140. package/dist/{loop-gate-handlers-o2B5FPdF.mjs → loop-gate-handlers-0a3dIY8O.mjs} +1 -1
  141. package/dist/mcp-http-server/index.mjs +1 -1
  142. package/dist/model-uE5IyUFJ.mjs +1 -0
  143. package/dist/namespace-C05pkLbN.mjs +1 -0
  144. package/dist/{namespace-D8P8Sxce2.d.mts → namespace-CGgOLxiW2.d.mts} +2 -2
  145. package/dist/{namespace-BGIeqwfU.d.mts → namespace-CQBSXm1U.d.mts} +20 -20
  146. package/dist/{namespace-CfvtDD_U.d.mts → namespace-CfgtqUWS.d.mts} +156 -156
  147. package/dist/{namespace-D9PLFmPQ.d.mts → namespace-CpyL93kW.d.mts} +27 -27
  148. package/dist/{namespace-CZK2ff3B.d.mts → namespace-D3SQQgxa2.d.mts} +1 -1
  149. package/dist/namespace-D7pE2QWv.mjs +1 -0
  150. package/dist/{namespace-dFBD2ZmS.mjs → namespace-DwQtzlY-.mjs} +1 -1
  151. package/dist/namespace-HsI0Jbbr.mjs +1 -0
  152. package/dist/namespace-VmsT_tLJ.d.mts +3729 -0
  153. package/dist/namespace-Xp9-g_r-.mjs +1 -0
  154. package/dist/{native-session-supervisor-7ElwM6Is.mjs → native-session-supervisor-CdtVGWA9.mjs} +1 -1
  155. package/dist/node/bus-server/index.d.mts +1 -1
  156. package/dist/node/bus-server/index.mjs +1 -1
  157. package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
  158. package/dist/node/bus-server/server-lifecycle.mjs +1 -1
  159. package/dist/node/transports/index.d.mts +36 -1
  160. package/dist/node/transports/index.mjs +2 -2
  161. package/dist/{orchestrator-shared-ChygCvR1.mjs → orchestrator-shared-DAkGOu9H.mjs} +1 -1
  162. package/dist/{orchestrator-shared-DFLb1otg.d.mts → orchestrator-shared-pxtyNu3W.d.mts} +13 -6
  163. package/dist/{package-Co_GO3UD.mjs → package-0gVhAVkO.mjs} +1 -1
  164. package/dist/package-BwvGaKwn.mjs +1 -0
  165. package/dist/package.json +1 -1
  166. package/dist/{profile-BMBXUqqh.mjs → profile-D2m94ZYD.mjs} +1 -1
  167. package/dist/provider-context-BYkMl--1.mjs +1 -0
  168. package/dist/provider-context-DOsjOjiR.mjs +1 -0
  169. package/dist/{providers-namespace-5GoTlHXz.d.mts → providers-namespace-O4de1tgO.d.mts} +161 -14
  170. package/dist/resolved-O2XXjTeu.mjs +1 -0
  171. package/dist/rules/index.d.mts +1 -1
  172. package/dist/rules/index.mjs +1 -1
  173. package/dist/rules/schemas.d.mts +1 -1
  174. package/dist/runtime-bun/index.mjs +1 -1
  175. package/dist/runtime-node/client-binary-strategy-dependencies.d.mts +34 -0
  176. package/dist/runtime-node/client-binary-strategy-dependencies.mjs +1 -0
  177. package/dist/runtime-node/extension-discovery.d.mts +1 -1
  178. package/dist/runtime-node/extension-validation.d.mts +1 -1
  179. package/dist/runtime-node/extension-validation.mjs +1 -1
  180. package/dist/runtime-node/index.d.mts +32 -6
  181. package/dist/runtime-node/index.mjs +24 -24
  182. package/dist/runtime-node/makaio-config.d.mts +1 -1
  183. package/dist/runtime-node/makaio-config.mjs +1 -1
  184. package/dist/runtime-node/workflow-worker/index.d.mts +1 -1
  185. package/dist/runtime-node/workflow-worker/index.mjs +1 -1
  186. package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -1
  187. package/dist/{schema-7aKBGB7S.mjs → schema-BI0aCHvV.mjs} +1 -1
  188. package/dist/{schema-B5vHi7Uu.d.mts → schema-BnTOFCdU.d.mts} +1 -1
  189. package/dist/{schemas-Br-rSxPE2.d.mts → schemas--uwN5dfK2.d.mts} +11 -11
  190. package/dist/schemas-C-J4W1ID.mjs +1 -0
  191. package/dist/{schemas-CoFCV42v.d.mts → schemas-C17AifUQ.d.mts} +156 -156
  192. package/dist/schemas-D6lj9NMg.mjs +1 -0
  193. package/dist/schemas-K3Td_WdR.d.mts +3175 -0
  194. package/dist/schemas-n9Ff6_RX.mjs +1 -0
  195. package/dist/selection-YRuVSdck.mjs +1 -0
  196. package/dist/services/adapter-runtime/index.d.mts +3 -3
  197. package/dist/services/adapter-runtime/index.mjs +1 -1
  198. package/dist/services/adapter-runtime/namespace.d.mts +1 -1
  199. package/dist/services/adapter-runtime/schemas.d.mts +1 -1
  200. package/dist/services/adapter-subsystem/index.d.mts +4 -3
  201. package/dist/services/adapter-subsystem/index.mjs +1 -1
  202. package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
  203. package/dist/services/adapter-subsystem/namespace.mjs +1 -1
  204. package/dist/services/agent-runtime/index.d.mts +2 -2
  205. package/dist/services/agent-runtime/namespace.d.mts +1 -1
  206. package/dist/services/agent-runtime/schemas.d.mts +1 -1
  207. package/dist/services/capability/index.d.mts +1 -1
  208. package/dist/services/capability/index.mjs +1 -1
  209. package/dist/services/codebase/index.d.mts +2 -2
  210. package/dist/services/codebase/namespace.d.mts +1 -1
  211. package/dist/services/codebase/schemas.d.mts +1 -1
  212. package/dist/services/compression/index.d.mts +2 -2
  213. package/dist/services/compression/namespace.d.mts +1 -1
  214. package/dist/services/compression/schemas.d.mts +1 -1
  215. package/dist/services/context-rules/index.d.mts +1 -1
  216. package/dist/services/context-rules/index.mjs +1 -1
  217. package/dist/services/definition/namespace.d.mts +1 -19
  218. package/dist/services/definition/schemas.d.mts +0 -9
  219. package/dist/services/definition/schemas.mjs +1 -1
  220. package/dist/services/execution-target/index.d.mts +4 -4
  221. package/dist/services/execution-target/index.mjs +1 -1
  222. package/dist/services/execution-target/namespace.d.mts +1 -1
  223. package/dist/services/execution-target/namespace.mjs +1 -1
  224. package/dist/services/execution-target/schemas.d.mts +1 -1
  225. package/dist/services/execution-target/schemas.mjs +1 -1
  226. package/dist/services/filesystem/index.d.mts +1 -1
  227. package/dist/services/filesystem/index.mjs +1 -1
  228. package/dist/services/filesystem/namespace.d.mts +6 -6
  229. package/dist/services/filesystem/schemas.d.mts +3 -3
  230. package/dist/services/git/namespace.mjs +1 -1
  231. package/dist/services/git/schemas.mjs +1 -1
  232. package/dist/services/harness/index.d.mts +6 -6
  233. package/dist/services/harness/index.mjs +1 -1
  234. package/dist/services/index.d.mts +1671 -253
  235. package/dist/services/index.mjs +1 -1
  236. package/dist/services/log-import/browser.d.mts +2 -2
  237. package/dist/services/log-import/index.d.mts +2 -2
  238. package/dist/services/log-import/log-import.d.mts +1 -1
  239. package/dist/services/log-import/log-import.mjs +1 -1
  240. package/dist/services/log-import/namespace.mjs +1 -1
  241. package/dist/services/log-import/schemas.mjs +1 -1
  242. package/dist/services/model-registry/index.d.mts +1 -1
  243. package/dist/services/model-registry/index.mjs +1 -1
  244. package/dist/services/preferences/index.d.mts +2 -2
  245. package/dist/services/preferences/schemas.d.mts +1 -1
  246. package/dist/services/preferences/storage-namespace.d.mts +2 -2
  247. package/dist/services/provider-context/index.d.mts +2 -2
  248. package/dist/services/provider-context/index.mjs +1 -1
  249. package/dist/services/provider-runtime/index.d.mts +18 -0
  250. package/dist/services/provider-runtime/index.mjs +1 -1
  251. package/dist/services/session/handlers/index.d.mts +1 -1
  252. package/dist/services/session/handlers/index.mjs +1 -1
  253. package/dist/services/session/index.d.mts +10 -10
  254. package/dist/services/session/index.mjs +1 -1
  255. package/dist/services/session/messages/namespace.d.mts +1 -1
  256. package/dist/services/session/messages/namespace.mjs +1 -1
  257. package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
  258. package/dist/services/session/orchestrator-testing/index.mjs +1 -1
  259. package/dist/services/session/session-events/namespace.d.mts +1 -1
  260. package/dist/services/session/session-events/namespace.mjs +1 -1
  261. package/dist/services/session/storage/namespace.d.mts +1 -1
  262. package/dist/services/session/storage/schema.d.mts +1 -1
  263. package/dist/services/session/testing/index.d.mts +2 -2
  264. package/dist/services/session/testing/index.mjs +10 -10
  265. package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
  266. package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
  267. package/dist/services/session/turns/namespace.d.mts +1 -1
  268. package/dist/services/session/turns/namespace.mjs +1 -1
  269. package/dist/services/session-editor/index.d.mts +1 -1
  270. package/dist/services/session-editor/index.mjs +1 -1
  271. package/dist/services/settings/index.d.mts +3 -3
  272. package/dist/services/settings/index.mjs +1 -1
  273. package/dist/services/settings/namespace.d.mts +18 -25
  274. package/dist/services/settings/namespace.mjs +1 -1
  275. package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
  276. package/dist/services/settings/storage/clients-namespace.mjs +1 -1
  277. package/dist/services/settings/storage/index.d.mts +3 -3
  278. package/dist/services/settings/storage/index.mjs +1 -1
  279. package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
  280. package/dist/services/settings/storage/providers-namespace.mjs +1 -1
  281. package/dist/services/subagent/index.d.mts +2 -2
  282. package/dist/services/subagent/index.mjs +1 -1
  283. package/dist/services/subagent-template/index.d.mts +2 -2
  284. package/dist/services/subagent-template/namespace.d.mts +1 -1
  285. package/dist/services/subagent-template/schemas.d.mts +1 -1
  286. package/dist/services/tool-approval/index.d.mts +1 -1
  287. package/dist/services/tool-approval/index.mjs +1 -1
  288. package/dist/services/tools/index.d.mts +1 -1
  289. package/dist/services/tools/index.mjs +1 -1
  290. package/dist/services/tray-menu/index.d.mts +3 -3
  291. package/dist/services/tray-menu/index.mjs +1 -1
  292. package/dist/services/tray-menu/namespace.d.mts +1 -1
  293. package/dist/services/tray-menu/schemas.d.mts +1 -1
  294. package/dist/services/turn/index.d.mts +1 -1
  295. package/dist/services/turn/namespace.d.mts +1 -1
  296. package/dist/session-CAjudDuJ.mjs +76 -0
  297. package/dist/{session-DBfQkgdy.mjs → session-lRd8HZNZ.mjs} +1 -1
  298. package/dist/{session-lineage-C1M7-O3C.d.mts → session-lineage-BLw8iWAj.d.mts} +1 -1
  299. package/dist/{shared-BVW-3Dhy.mjs → shared-RP_KARKF.mjs} +1 -1
  300. package/dist/{skill-N-ttlp1i.mjs → skill-CpNjWFuE.mjs} +1 -1
  301. package/dist/{src-Ck2sbaDa.mjs → src-Bo2eA51B.mjs} +1 -1
  302. package/dist/storage/drizzle/client.d.mts +1 -1
  303. package/dist/storage/drizzle/client.mjs +1 -1
  304. package/dist/storage/drizzle/index.d.mts +1 -1
  305. package/dist/storage/drizzle/index.mjs +1 -1
  306. package/dist/storage/handlers/drizzle/index.d.mts +1 -1
  307. package/dist/storage/handlers/drizzle/index.mjs +1 -1
  308. package/dist/storage/handlers/index.d.mts +1 -1
  309. package/dist/storage/handlers/index.mjs +1 -1
  310. package/dist/{tool-approval-service-DEiMKTv9.mjs → tool-approval-service-Dh0XI21f.mjs} +1 -1
  311. package/dist/tools-C8vqn1KY.mjs +1 -0
  312. package/dist/{transition-OzGXyy3p.d.mts → transition-Bfe8VVc1.d.mts} +2 -2
  313. package/dist/{types-BWduCvRU.d.mts → types-B-xY9WW2.d.mts} +1 -1
  314. package/dist/{types-BrUOVfwe.d.mts → types-DvKaEOOn.d.mts} +252 -19
  315. package/dist/{types-CBLPaQXe.d.mts → types-q95p55BF.d.mts} +437 -287
  316. package/dist/ui-hooks/index.d.mts +103 -14
  317. package/dist/ui-hooks/index.mjs +1 -1
  318. package/dist/ui-kernel/index.d.mts +3 -3
  319. package/dist/ui-kernel/pages/schemas.d.mts +1 -1
  320. package/dist/utils/keychain.mjs +1 -1
  321. package/dist/{version-DoV_pSzT.mjs → version-C1-VD-XL.mjs} +1 -1
  322. package/dist/workflow-CvVAZ89A.mjs +1 -0
  323. package/dist/workflow-engine/index.d.mts +33 -33
  324. package/dist/workflow-engine/index.mjs +1 -1
  325. package/dist/workflow-engine/package.d.mts +1 -1
  326. package/dist/workflow-engine/package.mjs +1 -1
  327. package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
  328. package/dist/{workflow-worker-dH70EbjE.mjs → workflow-worker-CudfEstp.mjs} +1 -1
  329. package/package.json +5 -1
  330. package/dist/account-identity-C7Kx_ieU.mjs +0 -1
  331. package/dist/cleanEnvForAdapter-BooAgM2R.mjs +0 -1
  332. package/dist/client-DaR4mzqn.mjs +0 -1
  333. package/dist/compression-C5JAWdgZ.mjs +0 -1
  334. package/dist/config-namespace-CY9leBnE.mjs +0 -1
  335. package/dist/credential-ref-YWQQENEo.mjs +0 -1
  336. package/dist/definition-C-GVz7uw.mjs +0 -1
  337. package/dist/execution-target-BR8bLkCR.mjs +0 -1
  338. package/dist/extension-BS_4BOeO.mjs +0 -1
  339. package/dist/handlers-B74FvKlA.mjs +0 -57
  340. package/dist/index-BcwOnvUh.d.mts +0 -749
  341. package/dist/index-D6aAzr32.d.mts +0 -997
  342. package/dist/index-DtwGhFFQ.d.mts +0 -40
  343. package/dist/namespace-B4cV_pk3.d.mts +0 -1317
  344. package/dist/namespace-BO3tODGC.mjs +0 -1
  345. package/dist/namespace-CVMZVqB5.mjs +0 -1
  346. package/dist/namespace-DBHwyhME.mjs +0 -1
  347. package/dist/namespace-DibbhCPP.mjs +0 -1
  348. package/dist/package-CF_Zm2v4.mjs +0 -1
  349. package/dist/provider-context-CqMgPOWF.mjs +0 -1
  350. package/dist/provider-context-DC_eq7es.mjs +0 -1
  351. package/dist/schemas-CVo8qAK-.mjs +0 -1
  352. package/dist/schemas-CuG17U3L.mjs +0 -1
  353. package/dist/session-CX6QDhi2.mjs +0 -76
  354. package/dist/tools-CGFZkB7F.mjs +0 -1
  355. package/dist/workflow-C3dgVwTY.mjs +0 -1
  356. /package/dist/{ajv-B5dPIck0.mjs → ajv-DfHhgdS5.mjs} +0 -0
  357. /package/dist/{await-trigger-DwVldnMt.mjs → await-trigger-D623tvig.mjs} +0 -0
  358. /package/dist/{capability-service-XlymTzz1.mjs → capability-service-Dg2bU8qc.mjs} +0 -0
  359. /package/dist/{client-CebV_fZc.d.mts → client-DmJwprw1.d.mts} +0 -0
  360. /package/dist/{create-static-mount-DkK28kKW.mjs → create-static-mount-CBTXRtbN.mjs} +0 -0
  361. /package/dist/{cross-spawn-CDXy3BjE.mjs → cross-spawn-D9WWFl2a.mjs} +0 -0
  362. /package/dist/{cursor-storage-luQAg7E_.mjs → cursor-storage-Bw-7ROzx.mjs} +0 -0
  363. /package/dist/{descriptor-to-package-DdpjpT7n.mjs → descriptor-to-package-D5SWf6TL.mjs} +0 -0
  364. /package/dist/{drizzle-DVTAl7Us.mjs → drizzle-DYfaDzlO.mjs} +0 -0
  365. /package/dist/{esm-CQG9Pc7n.mjs → esm-oHhRYTEn.mjs} +0 -0
  366. /package/dist/{event-DguYjV6D.mjs → event-DTM0-qWP.mjs} +0 -0
  367. /package/dist/{extension-discovery-CIZn5bkq.d.mts → extension-discovery-APMf1Tes.d.mts} +0 -0
  368. /package/dist/{extension-namespace-v3K0qVry.mjs → extension-namespace-vrh4ERXR.mjs} +0 -0
  369. /package/dist/{facet-BM4y4aQP.mjs → facet-DqPBpqkl.mjs} +0 -0
  370. /package/dist/{filesystem-service-Cwp0sWNc.d.mts → filesystem-service-Bx0bR2Lb.d.mts} +0 -0
  371. /package/dist/{handler-BFNvtv5t.mjs → handler-4pKQi3eo.mjs} +0 -0
  372. /package/dist/{host-vY07gek-.mjs → host-BfgdjlII.mjs} +0 -0
  373. /package/dist/{identity-DC3Pk0ps.mjs → identity-2qUT1NME.mjs} +0 -0
  374. /package/dist/{index-COI1tjAf.d.mts → index-BZ_DSGnE.d.mts} +0 -0
  375. /package/dist/{index-D7rWAEY0.d.mts → index-Bd52mmj9.d.mts} +0 -0
  376. /package/dist/{index-Dfi8Rorw.d.mts → index-BkAKfh4d.d.mts} +0 -0
  377. /package/dist/{index-CuHqL95P.d.mts → index-Bv9lm0Kf.d.mts} +0 -0
  378. /package/dist/{index-C4nStEdA.d.mts → index-C18Pn3zP.d.mts} +0 -0
  379. /package/dist/{index-Cr9lh21j.d.mts → index-CarbJsC92.d.mts} +0 -0
  380. /package/dist/{index-BjoOSg95.d.mts → index-Ctw617Tj.d.mts} +0 -0
  381. /package/dist/{index-DUD7wikz2.d.mts → index-D0eUQjTU2.d.mts} +0 -0
  382. /package/dist/{index-DEzdNQum.d.mts → index-DfVSWBBp.d.mts} +0 -0
  383. /package/dist/{index-D3ahzHwb.d.mts → index-DnWZdG6C.d.mts} +0 -0
  384. /package/dist/{index-CpKikwK4.d.mts → index-DoLdETfR.d.mts} +0 -0
  385. /package/dist/{index-B92mToDo2.d.mts → index-DvaPrL6C.d.mts} +0 -0
  386. /package/dist/{index-D7Hkmrr3.d.mts → index-DwDBa2mb.d.mts} +0 -0
  387. /package/dist/{index-Y8rMeYYX.d.mts → index-FDyqQIt5.d.mts} +0 -0
  388. /package/dist/{index-BWIkf5oJ.d.mts → index-Lp0T_V1W.d.mts} +0 -0
  389. /package/dist/{index-OGIC4puQ.d.mts → index-Rhcr4YNA.d.mts} +0 -0
  390. /package/dist/{index-BvLXySoB2.d.mts → index-S-mAqWwq.d.mts} +0 -0
  391. /package/dist/{index-DOOrKin9.d.mts → index-_zsihEmk.d.mts} +0 -0
  392. /package/dist/{index-wq7XeqyG.d.mts → index-iJP-l15K.d.mts} +0 -0
  393. /package/dist/{json-value-DtIkQN7g.d.mts → json-value-C8duSh9X.d.mts} +0 -0
  394. /package/dist/{jsonl-transport-CGPgD8iU.mjs → jsonl-transport-l5NPcQ_2.mjs} +0 -0
  395. /package/dist/{lib-ZKtnbCqH.mjs → lib-ClRTNIuz.mjs} +0 -0
  396. /package/dist/{materialization-CUYxZCfk.mjs → materialization-BwTORtBr.mjs} +0 -0
  397. /package/dist/{model-registry-C2VXobZj.mjs → model-registry-BneK5SGo.mjs} +0 -0
  398. /package/dist/{model-registry-rYICIwyR.mjs → model-registry-C8MInDtX.mjs} +0 -0
  399. /package/dist/{namespace-65uwTpbg.d.mts → namespace-3YVLQ_bM.d.mts} +0 -0
  400. /package/dist/{namespace-CQ8uza7o.d.mts → namespace-BcDHt-ww.d.mts} +0 -0
  401. /package/dist/{namespace-BigVYQyx.d.mts → namespace-BhVlHfoO.d.mts} +0 -0
  402. /package/dist/{namespace-j7vFsmYL.d.mts → namespace-Bl1UhLnK.d.mts} +0 -0
  403. /package/dist/{namespace-Dk4OslmY.d.mts → namespace-BsEoWXV_.d.mts} +0 -0
  404. /package/dist/{namespace-DYSFDC2G.mjs → namespace-C238RqwB.mjs} +0 -0
  405. /package/dist/{namespace-BdO4e1Fm.mjs → namespace-CDO4rY11.mjs} +0 -0
  406. /package/dist/{namespace-wke7juzy.mjs → namespace-DDx4NVJm.mjs} +0 -0
  407. /package/dist/{namespace-D1_9WVCo.d.mts → namespace-Dar3O6iT.d.mts} +0 -0
  408. /package/dist/{namespace-DAj_riOn.d.mts → namespace-DoNigVgx.d.mts} +0 -0
  409. /package/dist/{namespace-D2s-4pyg.d.mts → namespace-Dvi66QS6.d.mts} +0 -0
  410. /package/dist/{out-BoEZjBNz.mjs → out-BB6Kb4Xu.mjs} +0 -0
  411. /package/dist/{package-DmVZxufT.d.mts → package-CdBiknf3.d.mts} +0 -0
  412. /package/dist/{platform-DnbSvm2u.mjs → platform-CWhGFQFX.mjs} +0 -0
  413. /package/dist/{providers-Bd7BOZs0.mjs → providers-CUnrif24.mjs} +0 -0
  414. /package/dist/{quick-lru-6e7I1Bgf.mjs → quick-lru-BLaSzINB.mjs} +0 -0
  415. /package/dist/{registry-U_3aYSin.mjs → registry-TJjQgTgp.mjs} +0 -0
  416. /package/dist/{schema-CHp6I33k.mjs → schema-cus0dJ81.mjs} +0 -0
  417. /package/dist/{schema-introspection-B7xODt4I.mjs → schema-introspection-BsWLmoFp.mjs} +0 -0
  418. /package/dist/{schemas-KlH1hB7u.d.mts → schemas-9QJf1FtS.d.mts} +0 -0
  419. /package/dist/{schemas-CJ2JvA7d.d.mts → schemas-BolSW7pQ.d.mts} +0 -0
  420. /package/dist/{schemas-D4zaFE2p.d.mts → schemas-CLsbsX1W.d.mts} +0 -0
  421. /package/dist/{schemas-XeIBqwvE.mjs → schemas-CMyv7l7-.mjs} +0 -0
  422. /package/dist/{schemas-CPI00yvh.mjs → schemas-CWxf_Yut.mjs} +0 -0
  423. /package/dist/{schemas-BemsLc_V.d.mts → schemas-D_9X_CRo.d.mts} +0 -0
  424. /package/dist/{schemas-DZGnr9Tl.mjs → schemas-DwfTUQIa.mjs} +0 -0
  425. /package/dist/{schemas-B6tEKf9T.d.mts → schemas-XRhqOgVE.d.mts} +0 -0
  426. /package/dist/{schemas-DKncXGnb.d.mts → schemas-fRLDhefF.d.mts} +0 -0
  427. /package/dist/{schemas-DWfo0wp4.d.mts → schemas-jDRSOXJL.d.mts} +0 -0
  428. /package/dist/{schemas-lnE9YoG7.d.mts → schemas-qpo1Goit.d.mts} +0 -0
  429. /package/dist/{schemas-t6h9oSct.d.mts → schemas-qt5QTjVc.d.mts} +0 -0
  430. /package/dist/{semver-CIhHqMkw.mjs → semver-BccS1s9R.mjs} +0 -0
  431. /package/dist/{server-lifecycle-C5Z5PSMD.mjs → server-lifecycle-D-jxVr_0.mjs} +0 -0
  432. /package/dist/{server-lifecycle-_AA6EfzL.d.mts → server-lifecycle-r5Tkk8bU.d.mts} +0 -0
  433. /package/dist/{shared-schemas-BEVG96xW.mjs → shared-schemas-BNCPgGYP.mjs} +0 -0
  434. /package/dist/{src-_VODAJnf.mjs → src-Ci_WY9uw.mjs} +0 -0
  435. /package/dist/{storage-namespace-D5q9CrBp.mjs → storage-namespace-BzE2M4Hq.mjs} +0 -0
  436. /package/dist/{storage-namespace-Di1A3DMm.d.mts → storage-namespace-DWKFqEW-.d.mts} +0 -0
  437. /package/dist/{storage-namespace-definition-CzXPW45M.mjs → storage-namespace-definition-4UYuij1r.mjs} +0 -0
  438. /package/dist/{storage-namespace-definition-BffdI5Bz.d.mts → storage-namespace-definition-BZJGSaX3.d.mts} +0 -0
  439. /package/dist/{supports-color-DcXkvGDF.mjs → supports-color-Dzp6WuF5.mjs} +0 -0
  440. /package/dist/{telemetry-Cvi4rxiE.mjs → telemetry-B42EMbZt.mjs} +0 -0
  441. /package/dist/{timeout-XsYIOKrc.mjs → timeout-CvONPl0l.mjs} +0 -0
  442. /package/dist/{tray-menu-service-B2AxiQqL.mjs → tray-menu-service-Bonl2KXf.mjs} +0 -0
  443. /package/dist/{types-Bo78h9e3.d.mts → types-BCW9kr4L.d.mts} +0 -0
  444. /package/dist/{types-DCvp_swt.d.mts → types-CrJ7KEZ0.d.mts} +0 -0
  445. /package/dist/{types-BNW5n6qm.d.mts → types-DWNoZ3Sd.d.mts} +0 -0
  446. /package/dist/{ui-config-9bDRwFZr.mjs → ui-config-B2L3Xgqo.mjs} +0 -0
  447. /package/dist/{variant-5huHjUTm.mjs → variant-ByI-RZua.mjs} +0 -0
  448. /package/dist/{window-registry-PkrFIwX2.mjs → window-registry-DsWnCc8z.mjs} +0 -0
  449. /package/dist/{window-registry-ofIUQnfo.d.mts → window-registry-WsWu-rcK.d.mts} +0 -0
@@ -1,12 +1,12 @@
1
- import { _ as BaseAgentConnectorConfig } from "../../types-BrUOVfwe.mjs";
1
+ import { A as PreparedAdapterAuthRuntime, B as ResolvedAdapterAuth, D as AdapterAuthLeaseHandle, F as AdapterAuthError, G as resolveBoundProviderAuth, H as ResolvedConnectorAuthDelivery, I as AdapterAuthErrorReason, L as BindProviderAuthOptions, M as SuppliedAdapterAuthRuntime, N as applySuppliedAdapterAuthRuntime, O as AdapterAuthRuntimePreparer, P as prepareAdapterAuthRuntime, R as BoundProviderAuthContext, U as bindProviderAuth, V as ResolvedAuthCredentialValues, W as getOptionalAuthCredentialFields, _ as BaseAgentConnectorConfig, j as ResolvedAdapterRuntimeConfig, k as BoundAdapterRuntimeConfig, z as ResolveAuthCredentialRefs } from "../../types-DvKaEOOn.mjs";
2
2
  import { z } from "zod";
3
3
  import { IMakaioBus, MakaioBusContext } from "@makaio/framework/bus";
4
- import { AIModelSchema, ProtocolId, ProviderContext } from "@makaio/framework/contracts";
4
+ import { AIModelSchema, AdapterProviderAuth, ProtocolId, ProviderContext, ResolvedProviderAuth } from "@makaio/framework/contracts";
5
5
  import { BaseAdapterConfigSchema, CredentialRef, ProviderConfigSchema, ProviderDefaultsSchema } from "@makaio/framework/contracts/config";
6
6
  import { ClientExecutionContext } from "@makaio/framework/contracts/client";
7
7
  import { ProviderRecord } from "@makaio/framework/services/settings/storage";
8
8
  import { TimeoutConfig, TrackedTimeoutConfig } from "@makaio/framework/utils";
9
- import { ProviderConfigFileRecord } from "@makaio/framework/services/adapter-subsystem";
9
+ import { AdapterRuntimeSnapshot, AdapterRuntimeSnapshotErrorCode, AdapterRuntimeSnapshotErrorCode as AdapterRuntimeSnapshotErrorCode$1, ProviderConfigFileRecord } from "@makaio/framework/services/adapter-subsystem";
10
10
  import { Simplify } from "type-fest";
11
11
 
12
12
  //#region adapters/core/src/config/resolve-credential-ref.d.ts
@@ -121,8 +121,6 @@ interface CreateAdapterConfigFactoryOptions<TConfig extends BaseAgentConnectorCo
121
121
  adapterDefinition: {
122
122
  defaultTimeouts?: TimeoutConfig;
123
123
  };
124
- /** Wire protocol used to select the correct provider endpoint URL from endpointOverrides. */
125
- protocol: ProtocolId;
126
124
  }
127
125
  /**
128
126
  * Minimal input shape required by the factory.
@@ -133,11 +131,18 @@ interface AdapterConfigFactoryInput<TConfig extends BaseAgentConnectorConfig> {
133
131
  agentId: string;
134
132
  adapterName: string;
135
133
  adapterId: string;
136
- /**
137
- * Unresolved provider context (credential refs, not plaintext).
138
- * Connectors resolve credentials locally via `resolveConnectorCredentials()`.
139
- */
134
+ /** Resolved refs-only provider context or the closed provider-less state. */
140
135
  providerContext: ProviderContext;
136
+ /** Exact protocol declared by the selected adapter/provider reference. */
137
+ providerProtocol?: ProtocolId;
138
+ /** Adapter/provider auth metadata selected by `providerContext.definitionId`. */
139
+ adapterProviderAuth?: AdapterProviderAuth;
140
+ /** Other adapter/provider auth declarations contributing to the scrub union. */
141
+ compatibleProviderAuths?: readonly AdapterProviderAuth[];
142
+ /** Whether this adapter rejects the unresolved provider state. */
143
+ providerContextRequired?: boolean;
144
+ /** Runtime client identity used to validate client-owned auth methods. */
145
+ clientId?: string;
141
146
  model?: string;
142
147
  cwd?: string;
143
148
  env?: Record<string, string>;
@@ -153,12 +158,14 @@ interface FactoryGuaranteedFields<TProviderConfig> {
153
158
  cwd: string;
154
159
  timeouts: TrackedTimeoutConfig;
155
160
  providerConfig: TProviderConfig;
161
+ /** Exact refs-only auth binding consumed once by the central runtime. */
162
+ boundProviderAuth?: BoundProviderAuthContext;
156
163
  }
157
164
  /**
158
165
  * Result type: input + adapter defaults + guaranteed fields.
159
166
  * Simplify flattens the intersection for better type display.
160
167
  */
161
- type ConfigFactoryResult<TInput extends AdapterConfigFactoryInput<TConfig>, TConfig extends BaseAgentConnectorConfig, TProviderConfig = TConfig['providerConfig']> = Simplify<AdapterDefaults<TConfig> & Omit<TInput, 'providerConfig'> & FactoryGuaranteedFields<TProviderConfig>>;
168
+ type ConfigFactoryResult<TInput extends AdapterConfigFactoryInput<TConfig>, TConfig extends BaseAgentConnectorConfig, TProviderConfig = TConfig['providerConfig']> = Simplify<AdapterDefaults<TConfig> & Omit<TInput, 'providerConfig' | 'adapterProviderAuth' | 'compatibleProviderAuths' | 'providerContextRequired'> & FactoryGuaranteedFields<TProviderConfig>>;
162
169
  type AdapterConfigFactory<TConfig extends BaseAgentConnectorConfig, TProviderConfig> = {
163
170
  getConfig: <TInput extends AdapterConfigFactoryInput<TConfig>>(input: TInput) => Promise<ConfigFactoryResult<TInput, TConfig, TProviderConfig>>; /** Lazily evaluate the thunk and return adapter defaults (model, fastModel, etc.) */
164
171
  getDefaults: () => AdapterDefaults<TConfig>;
@@ -167,12 +174,12 @@ type AdapterConfigFactory<TConfig extends BaseAgentConnectorConfig, TProviderCon
167
174
  * Create a standardized adapter config factory.
168
175
  *
169
176
  * Eliminates ceremony by encapsulating the common pattern:
170
- * 1. Read unresolved providerContext (credential refs only no plaintext on the bus)
177
+ * 1. Bind the refs-only provider auth selection to one exact adapter declaration
171
178
  * 2. resolveTimeouts with adapter + runtime layers
172
- * 3. Merge providerConfigDefaults with runtime providerConfig (credentials resolved by connector)
179
+ * 3. Merge providerConfigDefaults with runtime providerConfig
173
180
  *
174
- * The factory is pure: it does not dispatch any bus requests and does not
175
- * resolve credentials. Connectors call `resolveConnectorCredentials()` locally.
181
+ * The factory is pure: it does not dispatch any bus requests or resolve
182
+ * credential refs. The central connector runtime consumes the bound result.
176
183
  *
177
184
  * Options are provided via thunk to enable lazy evaluation, avoiding circular
178
185
  * dependency issues when config.ts imports from index.ts (for adapterDefinition)
@@ -186,13 +193,23 @@ type AdapterConfigFactory<TConfig extends BaseAgentConnectorConfig, TProviderCon
186
193
  * adapterDefaults: { model: 'gemini-2.5-pro' },
187
194
  * schema: null,
188
195
  * adapterDefinition: { defaultTimeouts: DEFAULT_TIMEOUTS },
189
- * protocol: 'openai',
190
196
  * }));
191
197
  * ```
192
198
  */
193
199
  declare function createAdapterConfigFactory<TConfig extends BaseAgentConnectorConfig, TProviderConfig = TConfig['providerConfig']>(optionsThunk: () => CreateAdapterConfigFactoryOptions<TConfig>): AdapterConfigFactory<TConfig, TProviderConfig>;
194
200
  //#endregion
195
201
  //#region adapters/core/src/config/resolve-provider-endpoint.d.ts
202
+ /** Stable authenticated endpoint-resolution failure categories. */
203
+ type ProviderEndpointAuthErrorCode = 'fetch-auth-unsupported' | 'fetch-auth-missing' | 'fetch-auth-resolution-failed';
204
+ /** Typed, credential-free failure for authenticated direct provider fetches. */
205
+ declare class ProviderEndpointAuthError extends Error {
206
+ readonly code: ProviderEndpointAuthErrorCode;
207
+ /**
208
+ * Create an authenticated endpoint-resolution failure.
209
+ * @param code - Stable failure category
210
+ */
211
+ constructor(code: ProviderEndpointAuthErrorCode);
212
+ }
196
213
  /**
197
214
  * Resolved HTTP endpoint credentials for a provider.
198
215
  * Returned by {@link resolveProviderEndpoint} for use by infrastructure-layer
@@ -208,6 +225,13 @@ interface ProviderEndpoint {
208
225
  */
209
226
  apiKey: string;
210
227
  }
228
+ /** Explicit credential-field requirement for the API-key endpoint consumer. */
229
+ interface ProviderEndpointAuthRequirement {
230
+ /** This endpoint helper currently supports API-key authorization only. */
231
+ readonly kind: 'api-key';
232
+ /** Selected auth-method field whose value the HTTP client accepts as its API key. */
233
+ readonly credentialFieldId: string;
234
+ }
211
235
  /**
212
236
  * Resolve `{ baseUrl, apiKey }` for a given provider config and wire protocol
213
237
  * without requiring an agent context.
@@ -216,69 +240,66 @@ interface ProviderEndpoint {
216
240
  * STT/TTS providers) that need to make HTTP calls to cloud providers but are not
217
241
  * part of an agent turn.
218
242
  *
219
- * Delegates the common lookup chain (configdefinition endpoint → credentials)
220
- * to {@link resolveProviderResolution} and applies strict validation on the result:
221
- * both `baseUrl` and `apiKey` must be present or an error is thrown.
243
+ * Delegates the atomic config/definition/auth read to
244
+ * {@link resolveProviderResolution}, then resolves only the explicitly selected
245
+ * `apiKey` ref through the trusted local credential channel. Inferred and
246
+ * unauthenticated selections remain valid for refs-only endpoint resolution,
247
+ * but cannot authorize this API-key-specific fetch seam.
222
248
  *
223
249
  * Resolution order for the endpoint URL:
224
250
  * 1. `ProviderConfig.endpointOverrides[protocol]` (user-customised URL)
225
251
  * 2. `ProviderDefinition.endpoints[protocol]` (default from provider package)
226
252
  *
227
- * Credentials are resolved from the config's stored credential refs via the bus.
253
+ * Credentials are resolved from the normalized explicit auth selection. No
254
+ * environment or SDK ambient fallback is consulted.
228
255
  * @param bus - Makaio bus instance used to query storage and resolve credential refs
229
256
  * @param providerConfigId - UUID of the ProviderConfig entity to resolve
230
257
  * @param protocol - Wire protocol to select the correct endpoint URL
258
+ * @param authRequirement - Explicit API-key field required by the direct HTTP consumer
231
259
  * @returns Resolved `{ baseUrl, apiKey }` for the provider
232
260
  * @throws Error when the ProviderConfig or its ProviderDefinition is not found, or
233
261
  * when `baseUrl` or `apiKey` cannot be resolved from any source
234
262
  */
235
- declare function resolveProviderEndpoint(bus: IMakaioBus, providerConfigId: string, protocol: ProtocolId): Promise<ProviderEndpoint>;
263
+ declare function resolveProviderEndpoint(bus: IMakaioBus, providerConfigId: string, protocol: ProtocolId, authRequirement: ProviderEndpointAuthRequirement): Promise<ProviderEndpoint>;
236
264
  //#endregion
237
265
  //#region adapters/core/src/config/resolve-provider-resolution.d.ts
266
+ /** Stable provider-resolution failure categories. */
267
+ type ProviderResolutionErrorCode = 'provider-config-not-found';
268
+ /** Typed refs-only provider-resolution failure. */
269
+ declare class ProviderResolutionError extends Error {
270
+ readonly code: ProviderResolutionErrorCode;
271
+ /**
272
+ * Create a provider-resolution failure.
273
+ * @param code - Stable failure category.
274
+ * @param message - Credential-free diagnostic.
275
+ */
276
+ constructor(code: ProviderResolutionErrorCode, message: string);
277
+ }
238
278
  /**
239
- * Fully resolved provider data returned by {@link resolveProviderResolution}.
240
- *
241
- * Callers use this to build protocol-specific outputs (e.g. adapter config,
242
- * HTTP endpoint) without duplicating the lookup chain.
279
+ * Definition-backed provider data plus the selected normalized auth snapshot.
280
+ * Credential values remain refs and are resolved only by a trusted auth
281
+ * consumer after adapter delivery has been selected.
243
282
  */
244
283
  interface ProviderResolution {
245
- /** Bus-safe provider config read model from the adapter subsystem. */
246
- config: ProviderConfigFileRecord;
247
- /** The ProviderDefinition record referenced by the config. */
248
- definition: ProviderRecord;
249
- /**
250
- * Resolved base URL for the requested protocol.
251
- * `null` when neither the config override nor the definition declares an
252
- * endpoint for the requested protocol.
253
- */
254
- baseUrl: string | null;
255
- /**
256
- * Plaintext credentials resolved from the config's credential refs.
257
- * Empty object when no credentials are configured or none resolve.
258
- */
259
- credentials: Record<string, string>;
284
+ /** Bus-safe provider config read model. */
285
+ readonly config: ProviderConfigFileRecord;
286
+ /** Provider definition referenced by the config. */
287
+ readonly definition: ProviderRecord;
288
+ /** Effective endpoint for the requested protocol, or null when undeclared. */
289
+ readonly baseUrl: string | null;
290
+ /** Validated normalized auth selection with credential refs, never plaintext. */
291
+ readonly auth: ResolvedProviderAuth;
260
292
  }
261
293
  /**
262
- * Resolve a ProviderConfig to its full runtime data: config record,
263
- * definition record, endpoint URL, and plaintext credentials.
264
- *
265
- * Encapsulates the common lookup chain shared by the adapter config factory
266
- * and the provider endpoint resolver:
267
- * 1. `AdapterSubsystemSubjects.getProviderConfig` for the canonical read model
268
- * 2. `AdapterSubsystemSubjects.buildProviderContext` for runtime credential refs and endpoint overrides
269
- * 3. `ProviderStorageSubjects.get` for provider-definition metadata
270
- * 4. `context.endpointOverrides?.[protocol] ?? definition.endpoints?.[protocol]`
271
- * 5. Opens a DirectChannel via `CredentialSubjects.getChannelToken` and
272
- * resolves each credential ref; the channel is closed after use.
294
+ * Resolve one provider config to definition metadata, endpoint, and refs-only auth.
273
295
  *
274
- * Callers keep only their differing post-resolution logic (e.g., strict
275
- * `baseUrl` / `apiKey` validation for HTTP bridges vs. nullable `baseUrl`
276
- * for adapter factories that allow env-var fallbacks).
277
- * @param bus - Bus instance for storage and credential requests
278
- * @param providerConfigId - UUID of the ProviderConfig to resolve
279
- * @param protocol - Wire protocol used to select the correct endpoint URL
280
- * @returns Fully resolved provider data
281
- * @throws Error when the ProviderConfig or its ProviderDefinition is not found
296
+ * The adapter subsystem is the sole owner of auth-method validation and returns
297
+ * the safe config, refs-only context, and provider definition from one captured
298
+ * snapshot. This helper never opens the credential DirectChannel.
299
+ * @param bus - Bus instance for the atomic adapter-subsystem snapshot request.
300
+ * @param providerConfigId - Explicit provider config ID.
301
+ * @param protocol - Wire protocol used to select the endpoint URL.
302
+ * @returns Definition-backed provider resolution without plaintext credentials.
282
303
  */
283
304
  declare function resolveProviderResolution(bus: IMakaioBus, providerConfigId: string, protocol: ProtocolId): Promise<ProviderResolution>;
284
305
  //#endregion
@@ -287,6 +308,24 @@ declare function resolveProviderResolution(bus: IMakaioBus, providerConfigId: st
287
308
  interface CredentialBusContextProvider {
288
309
  getContext(): MakaioBusContext;
289
310
  }
311
+ /** Stable credential-resolution failure categories. */
312
+ type ConnectorCredentialResolutionErrorCode = 'credential-unavailable' | 'credential-request-failed';
313
+ /** Trusted resolution policy for refs selected by a normalized auth method. */
314
+ interface ConnectorCredentialResolutionOptions {
315
+ /** Selected field names whose unavailable refs are intentionally omitted. */
316
+ readonly optionalFields?: readonly string[];
317
+ }
318
+ /**
319
+ * Typed credential-resolution failure that never retains a ref, secret, or provider error.
320
+ */
321
+ declare class ConnectorCredentialResolutionError extends Error {
322
+ readonly code: ConnectorCredentialResolutionErrorCode;
323
+ /**
324
+ * Create a sanitized connector credential failure.
325
+ * @param code - Stable failure category
326
+ */
327
+ constructor(code: ConnectorCredentialResolutionErrorCode);
328
+ }
290
329
  /**
291
330
  * Resolve credential references to plaintext values at the connector layer.
292
331
  *
@@ -295,135 +334,119 @@ interface CredentialBusContextProvider {
295
334
  * or credential rotation — plaintext never leaves the connector.
296
335
  *
297
336
  * Returns an empty object immediately when `credentialRefs` is empty,
298
- * avoiding an unnecessary channel round-trip. Partial failures are
299
- * tolerated: refs that fail to resolve are omitted and logged. Callers
300
- * must still validate any required credential fields before using the
301
- * returned record to build env or client config.
337
+ * avoiding an unnecessary channel round-trip. Resolution is atomic for
338
+ * required refs: every required ref must produce a value or the whole
339
+ * operation fails with a sanitized typed error. Trusted normalized-auth
340
+ * callers may declare optional selected fields; unavailable optional refs are
341
+ * omitted rather than turning an explicit selection into an ambient fallback.
302
342
  * @param bus - Bus instance with context access for channel token retrieval
303
343
  * @param credentialRefs - Credential refs keyed by field name
344
+ * @param options - Trusted required/optional policy for selected fields
304
345
  * @returns Plaintext credential values keyed by field name
305
346
  */
306
- declare function resolveConnectorCredentials(bus: CredentialBusContextProvider, credentialRefs: Record<string, CredentialRef>): Promise<Record<string, string>>;
307
- //#endregion
308
- //#region adapters/core/src/config/build-credential-env.d.ts
309
- /**
310
- * Build environment variables from resolved credentials.
311
- *
312
- * Maps plaintext credential values to their environment variable names
313
- * using the provider definition's `credentialEnvVars` mapping. Subprocess
314
- * adapters use this to set the correct env vars before spawning.
315
- * @example
316
- * ```typescript
317
- * // { apiKey: 'sk-...' } + { apiKey: 'ANTHROPIC_API_KEY' }
318
- * // → { ANTHROPIC_API_KEY: 'sk-...' }
319
- * ```
320
- * @param credentials - Resolved plaintext credentials keyed by field name
321
- * @param credentialEnvVars - Mapping from credential field names to env var names
322
- * @returns Environment variables ready for process.env / subprocess spawn
323
- */
324
- declare function buildCredentialEnv(credentials: Record<string, string>, credentialEnvVars: Record<string, string> | undefined): Record<string, string>;
347
+ declare function resolveConnectorCredentials(bus: CredentialBusContextProvider, credentialRefs: Record<string, CredentialRef>, options?: ConnectorCredentialResolutionOptions): Promise<Record<string, string>>;
325
348
  //#endregion
326
349
  //#region adapters/core/src/config/resolve-session-environment.d.ts
327
- /** Minimal bus surface needed for session environment resolution. */
328
- interface SessionEnvironmentBus {
329
- getContext(): MakaioBusContext;
330
- }
331
- /**
332
- * Unresolved provider context fields needed for session environment resolution.
333
- *
334
- * Mirrors the relevant subset of {@link ProviderContext} from `@makaio/contracts`
335
- * so callers can pass the full provider context object without importing it here.
336
- */
337
- interface ProviderContextShape {
338
- /** Provider config UUID carried by full provider contexts. */
339
- providerConfigId?: string;
340
- /** Provider definition ID carried by full provider contexts. */
341
- definitionId?: string;
342
- /** Credential references keyed by field name. */
343
- credentialRefs: Record<string, CredentialRef>;
344
- /** Maps credential field names to env var names for subprocess adapters. */
345
- credentialEnvVars?: Record<string, string>;
346
- /** Ambient provider credential env vars to strip before explicit credential injection. */
347
- ambientCredentialEnvVars?: readonly string[];
348
- }
349
350
  /**
350
351
  * Input options for {@link resolveSessionEnvironment}.
351
352
  */
352
353
  interface SessionEnvironmentOptions {
353
- /** Bus instance used to resolve credential references. */
354
- bus: SessionEnvironmentBus;
355
- /**
356
- * Unresolved provider context carrying credential refs and env-var mapping.
357
- * When `undefined`, the credential steps are skipped and `credentials` / `credEnv`
358
- * are returned as empty objects.
359
- */
360
- providerContext: ProviderContextShape | undefined;
354
+ /** Runtime bus that owns client binary resolution. */
355
+ globalBus?: IMakaioBus;
361
356
  /**
362
357
  * Stable client identifier passed to `resolveClientBinary`
363
- * (e.g. `'claude-code'`, `'qwen'`, `'github-copilot'`).
358
+ * (e.g. `'claude-code'`, `'qwen'`, `'github-copilot'`). Omit for
359
+ * connector-only SDK adapters with no managed binary.
364
360
  */
365
- clientId: string;
361
+ clientId?: string;
366
362
  /**
367
- * Base environment variables that are merged into `spawnEnv` before credential
368
- * env and binary env are applied. Typically the connector's own `this.env`.
363
+ * Base environment variables explicitly supplied by the host. This function
364
+ * never falls back to ambient `process.env`.
369
365
  */
370
366
  baseEnv?: Record<string, string>;
367
+ /** Non-auth session environment composed over the base environment. */
368
+ sessionEnv?: Readonly<Record<string, string>>;
369
+ /** Pre-resolved non-auth binary environment supplied by an external host. */
370
+ binaryEnv?: Readonly<Record<string, string>>;
371
+ /** Complete normalized auth source/sink set removed before selected delivery. */
372
+ scrubEnvVars?: readonly string[];
373
+ /** Environment returned by the connector-owned client config lease. */
374
+ leaseEnv?: Readonly<Record<string, string>>;
375
+ /** Selected normalized process-environment delivery, applied last. */
376
+ selectedAuthEnv?: Readonly<Record<string, string>>;
371
377
  }
372
378
  /**
373
379
  * Fully resolved session environment returned by {@link resolveSessionEnvironment}.
374
380
  *
375
- * All three resolution steps are returned individually so callers that need
376
- * non-standard composition (e.g. optional binary env) can do so without
377
- * repeating the resolution calls.
381
+ * Binary resolution is returned alongside process-private and shared-context
382
+ * environment views derived from one authoritative merge.
378
383
  */
379
384
  interface SessionEnvironmentResult {
380
- /**
381
- * Plaintext credentials keyed by field name.
382
- * Empty when `providerContext` is `undefined` or carries no credential refs.
383
- */
384
- credentials: Record<string, string>;
385
- /**
386
- * Environment variables derived from `credentials` via the provider's
387
- * `credentialEnvVars` mapping.
388
- * Empty when `providerContext` is `undefined` or carries no `credentialEnvVars`.
389
- */
390
- credEnv: Record<string, string>;
391
385
  /**
392
386
  * Execution context for the resolved client binary, or `undefined` when
393
387
  * no `client.resolveBinary` handler is registered (framework-only boot).
394
388
  */
395
389
  resolvedBinary: ClientExecutionContext | undefined;
396
390
  /**
397
- * Merged spawn environment for the common case:
398
- * `{ ...cleanBaseEnv, ...credEnv, ...(resolvedBinary?.env ?? {}) }`.
391
+ * Process-private connector environment:
392
+ * `{ ...scrub({ ...baseEnv, ...sessionEnv, ...resolvedBinaryEnv, ...binaryEnv, ...leaseEnv }), ...selectedAuthEnv }`.
393
+ *
394
+ * This view may contain the selected plaintext process delivery and must not
395
+ * be copied into bus payloads, logs, or other shared execution contexts.
396
+ */
397
+ connectorEnv: Record<string, string>;
398
+ /**
399
+ * Shared execution-context environment produced from host/session/binary
400
+ * inputs after the full auth scrub. Connector-private lease variables are
401
+ * excluded even when another source supplied the same variable name.
399
402
  *
400
- * Ambient provider credential env vars are stripped from base env first.
401
- * Credential env then takes precedence so that explicitly resolved secrets are
402
- * restored. Binary env finally wins over credential env to enforce config
403
- * isolation.
403
+ * Connector-owned bus and tool payloads use this view so explicitly shareable
404
+ * variables remain available without exporting process authentication or
405
+ * config-directory capabilities.
404
406
  */
405
- spawnEnv: Record<string, string>;
407
+ contextEnv: Readonly<Record<string, string>>;
406
408
  }
407
409
  /**
408
- * Resolve credentials, build credential environment variables, and locate the
409
- * client binary — the three-step pattern shared by subprocess connectors.
410
+ * Resolve the selected client binary and compose the two environment views.
410
411
  *
411
- * Encapsulates:
412
- * 1. `resolveConnectorCredentials(bus, credentialRefs)` opens an encrypted
413
- * DirectChannel, resolves each ref, and closes the channel.
414
- * 2. `buildCredentialEnv(credentials, credentialEnvVars)` maps credential
415
- * values to subprocess env var names.
416
- * 3. `resolveClientBinary(clientId)` — dispatches `client.resolveBinary` on the
417
- * static bus; returns `undefined` in framework-only boot.
418
- *
419
- * The returned {@link SessionEnvironmentResult} includes every intermediate
420
- * value so callers with non-standard composition strategies (e.g. connectors
421
- * that treat binary env as optional or pass credentials through a different
422
- * channel) can compose the final env themselves.
412
+ * Credential refs are deliberately absent from this contract. The normalized
413
+ * adapter-auth runtime resolves them once and passes only the selected process
414
+ * delivery. Lease keys are connector-private capabilities: the same names are
415
+ * removed from the shared view regardless of which environment source supplied
416
+ * them, while the connector view still receives the scrubbed lease values.
423
417
  * @param options - Session environment resolution options
424
- * @returns Resolved credentials, credential env, binary execution context, and
425
- * merged spawn environment
418
+ * @returns Binary execution context and merged connector/context environments
426
419
  */
427
420
  declare function resolveSessionEnvironment(options: SessionEnvironmentOptions): Promise<SessionEnvironmentResult>;
428
421
  //#endregion
429
- export { type AIModel, AIModelSchema, type AdapterConfigFactoryInput, type AdapterDefaults, type BaseAdapterConfig, BaseAdapterConfigSchema, type BaseProviderConfig, BaseProviderConfigSchema, type ConfigFactoryResult, type CreateAdapterConfigFactoryOptions, type FactoryGuaranteedFields, type ProviderConfig, ProviderConfigSchema, type ProviderDefaults, ProviderDefaultsSchema, type ProviderEndpoint, type ProviderResolution, type ResolveCredentialRefDeps, type SessionEnvironmentOptions, type SessionEnvironmentResult, buildCredentialEnv, createAdapterConfigFactory, getDefinitionOrThrow, resolveConnectorCredentials, resolveCredentialRef, resolveProviderEndpoint, resolveProviderResolution, resolveSessionEnvironment };
422
+ //#region adapters/core/src/config/resolve-adapter-runtime-snapshot.d.ts
423
+ /** Atomic adapter runtime snapshot with its exact refs-only auth binding. */
424
+ interface BoundAdapterRuntimeSnapshot extends AdapterRuntimeSnapshot {
425
+ /** Exact selected adapter delivery compiled without resolving plaintext. */
426
+ readonly boundProviderAuth: BoundProviderAuthContext;
427
+ }
428
+ /** Typed credential-free atomic adapter runtime resolution failure. */
429
+ declare class AdapterRuntimeSnapshotError extends Error {
430
+ readonly code: AdapterRuntimeSnapshotErrorCode$1;
431
+ /**
432
+ * Create an atomic runtime resolution failure.
433
+ * @param code - Stable failure category returned by the subsystem
434
+ */
435
+ constructor(code: AdapterRuntimeSnapshotErrorCode$1);
436
+ }
437
+ /**
438
+ * Resolve and bind one adapter/provider runtime snapshot in a single subsystem read.
439
+ *
440
+ * The response carries refs and runtime-only delivery declarations but never
441
+ * plaintext. Binding remains in Adapter Core so the lower subsystem does not
442
+ * depend on this host-layer package.
443
+ * @param bus - Runtime bus serving the adapter subsystem
444
+ * @param input - Exact adapter name and provider config selection
445
+ * @returns Atomic runtime metadata plus immutable refs-only auth binding
446
+ */
447
+ declare function resolveAdapterRuntimeSnapshot(bus: IMakaioBus, input: {
448
+ readonly adapterName: string;
449
+ readonly providerConfigId: string;
450
+ }): Promise<BoundAdapterRuntimeSnapshot>;
451
+ //#endregion
452
+ export { type AIModel, AIModelSchema, AdapterAuthError, type AdapterAuthErrorReason, type AdapterAuthLeaseHandle, type AdapterAuthRuntimePreparer, type AdapterConfigFactoryInput, type AdapterDefaults, AdapterRuntimeSnapshotError, type AdapterRuntimeSnapshotErrorCode, type BaseAdapterConfig, BaseAdapterConfigSchema, type BaseProviderConfig, BaseProviderConfigSchema, type BindProviderAuthOptions, type BoundAdapterRuntimeConfig, type BoundAdapterRuntimeSnapshot, type BoundProviderAuthContext, type ConfigFactoryResult, ConnectorCredentialResolutionError, type ConnectorCredentialResolutionErrorCode, type CreateAdapterConfigFactoryOptions, type FactoryGuaranteedFields, type PreparedAdapterAuthRuntime, type ProviderConfig, ProviderConfigSchema, type ProviderDefaults, ProviderDefaultsSchema, type ProviderEndpoint, ProviderEndpointAuthError, type ProviderEndpointAuthErrorCode, type ProviderEndpointAuthRequirement, type ProviderResolution, ProviderResolutionError, type ProviderResolutionErrorCode, type ResolveAuthCredentialRefs, type ResolveCredentialRefDeps, type ResolvedAdapterAuth, type ResolvedAdapterRuntimeConfig, type ResolvedAuthCredentialValues, type ResolvedConnectorAuthDelivery, type SessionEnvironmentOptions, type SessionEnvironmentResult, type SuppliedAdapterAuthRuntime, applySuppliedAdapterAuthRuntime, bindProviderAuth, createAdapterConfigFactory, getDefinitionOrThrow, getOptionalAuthCredentialFields, prepareAdapterAuthRuntime, resolveAdapterRuntimeSnapshot, resolveBoundProviderAuth, resolveConnectorCredentials, resolveCredentialRef, resolveProviderEndpoint, resolveProviderResolution, resolveSessionEnvironment };
@@ -1 +1 @@
1
- import{t as e}from"../../cleanEnvForAdapter-BooAgM2R.mjs";import{z as t}from"zod";import n from"node:fs/promises";import{createBusInstance as r,openChannel as i}from"@makaio/framework/bus";import{AIModelSchema as a,CredentialSubjects as o}from"@makaio/framework/contracts";import{BaseAdapterConfigSchema as s,ProviderConfigSchema as c,ProviderDefaultsSchema as l}from"@makaio/framework/contracts/config";import{ProviderStorageSubjects as u}from"@makaio/framework/services/settings/storage";import{resolveTimeouts as d}from"@makaio/framework/utils";import{AdapterSubsystemSubjects as f}from"@makaio/framework/services/adapter-subsystem";import{resolveClientBinary as p}from"@makaio/framework/clients";async function m(e,t={}){if(e.startsWith(`env:`)){let n=e.slice(4);if(!n)throw Error(`Credential reference is missing environment variable name`);return(t.readEnv??(e=>process.env[e]))(n)||null}if(e.startsWith(`file:`)){let r=e.slice(5);if(!r)throw Error(`Credential reference is missing file path`);return(await(t.readFile??(async e=>await n.readFile(e,`utf-8`)))(r)).trim()||null}if(e.startsWith(`keychain:`)){let[n,...r]=e.slice(9).split(`:`);if(!n||r.length===0)throw Error(`Credential reference is missing keychain service or account`);if(!t.resolveKeychain)throw Error(`Keychain credential resolution is not configured`);return t.resolveKeychain(n,r.join(`:`))}return e||null}function h(e,t){let n=e.find(e=>e.id===t);if(!n)throw Error(`Provider definition not found: '${t}'`);if(!g(n))throw Error(`Provider definition '${t}' is missing a defaultModel`);return n}function g(e){return typeof e.defaultModel==`string`&&e.defaultModel.length>0}const _=t.record(t.string(),t.unknown());function v(e){return{getDefaults:()=>e().adapterDefaults,getConfig:async t=>{let{adapterName:n,adapterDefaults:r,adapterDefinition:i,protocol:a}=e(),{providerContext:o}=t,s=o.endpointOverrides?.[a]??null,c=d([{layer:`adapter`,source:n,config:i.defaultTimeouts},{layer:`runtime`,source:`config.ts`,config:t.runtimeTimeouts}]),l={...r.providerConfig,...t.providerConfig,baseUrl:s??t.providerConfig?.baseUrl??r.providerConfig?.baseUrl},u=t.model??r.model;if(!u)throw Error(`No model resolved for adapter "${n}" (agentId: ${t.agentId}). Provide a model explicitly or configure adapterDefaults.model.`);return{...r,...t,adapterName:t.adapterName,model:u,cwd:t.cwd??r.cwd??process.cwd(),timeouts:c,providerConfig:l}}}}async function y(e,t){let n=Object.entries(t);if(n.length===0)return{};let a={},s=e.getContext(),{token:c}=await r({context:s}).request(o.getChannelToken,{}),l=await i(s,`credentials`,{token:c,transports:[]});try{let e=await Promise.allSettled(n.map(([,e])=>l.request(o.resolve,{ref:e})));for(let t=0;t<n.length;t++){let[r,i]=n[t],o=e[t];if(o.status===`fulfilled`)if(o.value.value!==null)a[r]=o.value.value;else if(o.value.error){let e=JSON.stringify(i);console.warn(`[resolveConnectorCredentials] Failed to resolve field '${r}' (ref ${e}):`,o.value.error)}else{let e=JSON.stringify(i);console.info(`[resolveConnectorCredentials] Credential unavailable for field '${r}' (ref ${e}); omitting it from the resolved connector credentials.`)}else{let e=JSON.stringify(i);console.warn(`[resolveConnectorCredentials] Failed to resolve field '${r}' (ref ${e}):`,o.reason)}}}finally{l.close()}return a}async function b(e,t,n){let{config:r}=await e.request(f.getProviderConfig,{id:t});if(!r)throw Error(`ProviderConfig '${t}' not found`);let{context:i}=await e.request(f.buildProviderContext,{providerConfigId:t});if(!i)throw Error(`ProviderConfig '${t}' not found`);if(i.definitionId!==r.definitionId)throw Error(`ProviderConfig '${t}' changed during resolution; retry`);let{provider:a}=await e.request(u.get,{id:i.definitionId});if(!a)throw Error(`ProviderDefinition '${r.definitionId}' not found for config '${t}'`);return{config:r,definition:a,baseUrl:i.endpointOverrides?.[n]??a.endpoints?.[n]??null,credentials:await y(e,i.credentialRefs)}}async function x(e,t,n){let{baseUrl:r,credentials:i}=await b(e,t,n);if(!r)throw Error(`Could not resolve baseUrl for ProviderConfig '${t}' with protocol '${n}'. Ensure the provider definition or config override declares an endpoint for this protocol.`);let a=i.apiKey;if(!a)throw Error(`Could not resolve apiKey for ProviderConfig '${t}'. Store credentials via settings before using this provider.`);return{baseUrl:r,apiKey:a}}function S(e,t){if(!t)return{};let n={};for(let[r,i]of Object.entries(t)){let t=e[r];t!==void 0&&(n[i]=t)}return n}async function C(t){let{bus:n,providerContext:r,clientId:i,baseEnv:a={}}=t,o=await y(n,r?.credentialRefs??{}),s=S(o,r?.credentialEnvVars),c=await p(i);return{credentials:o,credEnv:s,resolvedBinary:c,spawnEnv:{...e(a,{omitEnvVars:r?.ambientCredentialEnvVars}),...s,...c?.env??{}}}}export{a as AIModelSchema,s as BaseAdapterConfigSchema,_ as BaseProviderConfigSchema,c as ProviderConfigSchema,l as ProviderDefaultsSchema,S as buildCredentialEnv,v as createAdapterConfigFactory,h as getDefinitionOrThrow,y as resolveConnectorCredentials,m as resolveCredentialRef,x as resolveProviderEndpoint,b as resolveProviderResolution,C as resolveSessionEnvironment};
1
+ import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"../../adapter-auth-runtime-a4O7cSNP.mjs";import{z as l}from"zod";import u from"node:fs/promises";import{AIModelSchema as d,AuthFieldIdSchema as f}from"@makaio/framework/contracts";import{BaseAdapterConfigSchema as p,ProviderConfigSchema as m,ProviderDefaultsSchema as h}from"@makaio/framework/contracts/config";import{resolveTimeouts as g}from"@makaio/framework/utils";import{AdapterSubsystemSubjects as _}from"@makaio/framework/services/adapter-subsystem";async function v(e,t={}){if(e.startsWith(`env:`)){let n=e.slice(4);if(!n)throw Error(`Credential reference is missing environment variable name`);return(t.readEnv??(e=>process.env[e]))(n)||null}if(e.startsWith(`file:`)){let n=e.slice(5);if(!n)throw Error(`Credential reference is missing file path`);return(await(t.readFile??(async e=>await u.readFile(e,`utf-8`)))(n)).trim()||null}if(e.startsWith(`keychain:`)){let[n,...r]=e.slice(9).split(`:`);if(!n||r.length===0)throw Error(`Credential reference is missing keychain service or account`);if(!t.resolveKeychain)throw Error(`Keychain credential resolution is not configured`);return t.resolveKeychain(n,r.join(`:`))}return e||null}function y(e,t){let n=e.find(e=>e.id===t);if(!n)throw Error(`Provider definition not found: '${t}'`);if(!b(n))throw Error(`Provider definition '${t}' is missing a defaultModel`);return n}function b(e){return typeof e.defaultModel==`string`&&e.defaultModel.length>0}const x=l.record(l.string(),l.unknown());function S(e){return{getDefaults:()=>e().adapterDefaults,getConfig:t=>C(e,t)}}async function C(e,t){let{adapterName:n,adapterDefaults:r,adapterDefinition:i}=e(),a=T(t),o=t.providerContext.state===`resolved`&&t.providerProtocol!==void 0?t.providerContext.endpointOverrides?.[t.providerProtocol]??null:null,s=g([{layer:`adapter`,source:n,config:i.defaultTimeouts},{layer:`runtime`,source:`config.ts`,config:t.runtimeTimeouts}]),c={...r.providerConfig,...t.providerConfig,baseUrl:o??t.providerConfig?.baseUrl??r.providerConfig?.baseUrl},l=w(t.model??r.model,n,t.agentId),{providerConfig:u,adapterProviderAuth:d,compatibleProviderAuths:f,providerContextRequired:p,...m}=t;return{...r,...m,adapterName:t.adapterName,model:l,cwd:t.cwd??r.cwd??process.cwd(),timeouts:s,providerConfig:c,...a!==void 0&&{boundProviderAuth:a}}}function w(e,t,n){if(e!==void 0&&e.length>0)return e;throw Error(`No model resolved for adapter "${t}" (agentId: ${n}). Provide a model explicitly or configure adapterDefaults.model.`)}function T(e){if(e.providerContext.state===`unresolved`){if(e.providerContextRequired===!0)throw new a(`provider-context-unresolved`,`This adapter requires a resolved provider authentication context.`);return}if(e.adapterProviderAuth===void 0)throw new a(`binding-missing`,`The selected provider has no adapter authentication declaration.`);let t=s({auth:e.providerContext.auth,adapterProviderAuth:e.adapterProviderAuth,compatibleProviderAuths:e.compatibleProviderAuths});if(t.auth.method.owner===`client`&&t.auth.method.clientId!==e.clientId)throw new a(`client-mismatch`,`Selected authentication client does not match the adapter runtime client.`);return t}var E=class extends Error{code;constructor(e,t){super(t),this.code=e,this.name=`ProviderResolutionError`}};async function D(e,t,n){let{snapshot:r}=await e.request(_.resolveProviderRuntimeSnapshot,{providerConfigId:t});if(!r)throw new E(`provider-config-not-found`,`ProviderConfig '${t}' not found`);let i=r.context.endpointOverrides?.[n]??r.definition.endpoints?.[n]??null;return{config:r.config,definition:r.definition,baseUrl:i,auth:r.context.auth}}var O=class extends Error{code;constructor(e){super(`Authenticated provider endpoint resolution failed (${e}).`),this.code=e,this.name=`ProviderEndpointAuthError`}};async function k(t,r,i,a){let{baseUrl:o,auth:s}=await D(t,r,i);if(!o)throw Error(`Could not resolve baseUrl for ProviderConfig '${r}' with protocol '${i}'. Ensure the provider definition or config override declares an endpoint for this protocol.`);if(s.mode!==`explicit`)throw new O(`fetch-auth-unsupported`);let c=f.safeParse(a.credentialFieldId);if(a.kind!==`api-key`||!c.success)throw new O(`fetch-auth-unsupported`);let l=s.definition.fields.find(({id:e})=>e===c.data);if(l===void 0)throw new O(`fetch-auth-unsupported`);let u=s.credentialRefs[l.id];if(u===void 0)throw new O(`fetch-auth-missing`);let d;try{d=(await e(t,{apiKey:u})).apiKey}catch(e){throw e instanceof n&&e.code===`credential-unavailable`?new O(`fetch-auth-missing`):new O(`fetch-auth-resolution-failed`)}if(d===void 0||d.trim()===``)throw new O(`fetch-auth-missing`);return{baseUrl:o,apiKey:d}}var A=class extends Error{code;constructor(e){super(`Adapter runtime snapshot resolution failed (${e}).`),this.code=e,this.name=`AdapterRuntimeSnapshotError`}};async function j(e,t){let n=await e.request(_.resolveAdapterRuntimeSnapshot,t);if(n.status===`error`)throw new A(n.code);let r=n.runtime;if(r.adapterName!==t.adapterName||r.snapshot.context.providerConfigId!==t.providerConfigId)throw new A(`snapshot-identity-mismatch`);let i=s({auth:r.snapshot.context.auth,adapterProviderAuth:r.adapterProviderAuth,compatibleProviderAuths:r.compatibleProviderAuths});if(i.auth.method.owner===`client`&&i.auth.method.clientId!==r.adapterClientId)throw new A(`client-incompatible`);return{...r,boundProviderAuth:i}}export{d as AIModelSchema,a as AdapterAuthError,A as AdapterRuntimeSnapshotError,p as BaseAdapterConfigSchema,x as BaseProviderConfigSchema,n as ConnectorCredentialResolutionError,m as ProviderConfigSchema,h as ProviderDefaultsSchema,O as ProviderEndpointAuthError,E as ProviderResolutionError,c as applySuppliedAdapterAuthRuntime,s as bindProviderAuth,S as createAdapterConfigFactory,y as getDefinitionOrThrow,t as getOptionalAuthCredentialFields,i as prepareAdapterAuthRuntime,j as resolveAdapterRuntimeSnapshot,r as resolveBoundProviderAuth,e as resolveConnectorCredentials,v as resolveCredentialRef,k as resolveProviderEndpoint,D as resolveProviderResolution,o as resolveSessionEnvironment};