@harrylabsj/kiwi 0.6.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 (636) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +150 -0
  3. package/contracts/candidate-agent-dto-1.0.README.md +39 -0
  4. package/contracts/candidate-agent-dto-1.0.schema.json +172 -0
  5. package/contracts/interop/kiwi-buyer-message-send.json +43 -0
  6. package/contracts/interop/knp-data-part-examples.json +243 -0
  7. package/contracts/kiwi-catalog/1.0/agent-record.schema.json +78 -0
  8. package/contracts/kiwi-catalog/1.0/listing-record.schema.json +88 -0
  9. package/contracts/kiwi-catalog/1.0/listing-search-result.schema.json +60 -0
  10. package/contracts/negotiation/1.0/schema.json +501 -0
  11. package/contracts/shopping.negotiation/0.1/capabilities.schema.json +47 -0
  12. package/contracts/shopping.negotiation/0.1/decision.schema.json +120 -0
  13. package/contracts/shopping.negotiation/0.1/policy-result.schema.json +52 -0
  14. package/contracts/shopping.negotiation/0.1/snapshot.schema.json +172 -0
  15. package/dist/a2a/client/client.d.ts +33 -0
  16. package/dist/a2a/client/client.js +161 -0
  17. package/dist/a2a/client/client.js.map +1 -0
  18. package/dist/a2a/client/error.d.ts +35 -0
  19. package/dist/a2a/client/error.js +34 -0
  20. package/dist/a2a/client/error.js.map +1 -0
  21. package/dist/a2a/client/index.d.ts +29 -0
  22. package/dist/a2a/client/index.js +26 -0
  23. package/dist/a2a/client/index.js.map +1 -0
  24. package/dist/a2a/client/jsonrpc.d.ts +49 -0
  25. package/dist/a2a/client/jsonrpc.js +85 -0
  26. package/dist/a2a/client/jsonrpc.js.map +1 -0
  27. package/dist/a2a/client/parse.d.ts +18 -0
  28. package/dist/a2a/client/parse.js +134 -0
  29. package/dist/a2a/client/parse.js.map +1 -0
  30. package/dist/a2a/client/types.d.ts +102 -0
  31. package/dist/a2a/client/types.js +26 -0
  32. package/dist/a2a/client/types.js.map +1 -0
  33. package/dist/a2a/client/url-policy.d.ts +44 -0
  34. package/dist/a2a/client/url-policy.js +242 -0
  35. package/dist/a2a/client/url-policy.js.map +1 -0
  36. package/dist/a2a/negotiate.d.ts +68 -0
  37. package/dist/a2a/negotiate.js +288 -0
  38. package/dist/a2a/negotiate.js.map +1 -0
  39. package/dist/a2a/node.d.ts +37 -0
  40. package/dist/a2a/node.js +155 -0
  41. package/dist/a2a/node.js.map +1 -0
  42. package/dist/a2a/server/auth.d.ts +38 -0
  43. package/dist/a2a/server/auth.js +112 -0
  44. package/dist/a2a/server/auth.js.map +1 -0
  45. package/dist/a2a/server/card.d.ts +19 -0
  46. package/dist/a2a/server/card.js +81 -0
  47. package/dist/a2a/server/card.js.map +1 -0
  48. package/dist/a2a/server/errors.d.ts +109 -0
  49. package/dist/a2a/server/errors.js +178 -0
  50. package/dist/a2a/server/errors.js.map +1 -0
  51. package/dist/a2a/server/handler.d.ts +22 -0
  52. package/dist/a2a/server/handler.js +57 -0
  53. package/dist/a2a/server/handler.js.map +1 -0
  54. package/dist/a2a/server/inbound-message.d.ts +37 -0
  55. package/dist/a2a/server/inbound-message.js +104 -0
  56. package/dist/a2a/server/inbound-message.js.map +1 -0
  57. package/dist/a2a/server/index.d.ts +43 -0
  58. package/dist/a2a/server/index.js +42 -0
  59. package/dist/a2a/server/index.js.map +1 -0
  60. package/dist/a2a/server/merchant-handler.d.ts +69 -0
  61. package/dist/a2a/server/merchant-handler.js +316 -0
  62. package/dist/a2a/server/merchant-handler.js.map +1 -0
  63. package/dist/a2a/server/pipeline.d.ts +69 -0
  64. package/dist/a2a/server/pipeline.js +329 -0
  65. package/dist/a2a/server/pipeline.js.map +1 -0
  66. package/dist/a2a/server/server.d.ts +64 -0
  67. package/dist/a2a/server/server.js +420 -0
  68. package/dist/a2a/server/server.js.map +1 -0
  69. package/dist/a2a/server/task-registry.d.ts +31 -0
  70. package/dist/a2a/server/task-registry.js +67 -0
  71. package/dist/a2a/server/task-registry.js.map +1 -0
  72. package/dist/a2a/server/throttle.d.ts +154 -0
  73. package/dist/a2a/server/throttle.js +289 -0
  74. package/dist/a2a/server/throttle.js.map +1 -0
  75. package/dist/a2a/server/types.d.ts +191 -0
  76. package/dist/a2a/server/types.js +17 -0
  77. package/dist/a2a/server/types.js.map +1 -0
  78. package/dist/a2a/server/ucp.d.ts +49 -0
  79. package/dist/a2a/server/ucp.js +85 -0
  80. package/dist/a2a/server/ucp.js.map +1 -0
  81. package/dist/a2a/task/index.d.ts +24 -0
  82. package/dist/a2a/task/index.js +22 -0
  83. package/dist/a2a/task/index.js.map +1 -0
  84. package/dist/a2a/task/ledger.d.ts +48 -0
  85. package/dist/a2a/task/ledger.js +65 -0
  86. package/dist/a2a/task/ledger.js.map +1 -0
  87. package/dist/a2a/task/poller.d.ts +93 -0
  88. package/dist/a2a/task/poller.js +184 -0
  89. package/dist/a2a/task/poller.js.map +1 -0
  90. package/dist/a2a/task/state.d.ts +72 -0
  91. package/dist/a2a/task/state.js +119 -0
  92. package/dist/a2a/task/state.js.map +1 -0
  93. package/dist/a2a/ucp-agent.d.ts +49 -0
  94. package/dist/a2a/ucp-agent.js +78 -0
  95. package/dist/a2a/ucp-agent.js.map +1 -0
  96. package/dist/agent/agent-db.d.ts +31 -0
  97. package/dist/agent/agent-db.js +91 -0
  98. package/dist/agent/agent-db.js.map +1 -0
  99. package/dist/agent/buyer/buyer-tools.d.ts +70 -0
  100. package/dist/agent/buyer/buyer-tools.js +1353 -0
  101. package/dist/agent/buyer/buyer-tools.js.map +1 -0
  102. package/dist/agent/buyer/ranker.d.ts +53 -0
  103. package/dist/agent/buyer/ranker.js +153 -0
  104. package/dist/agent/buyer/ranker.js.map +1 -0
  105. package/dist/agent/buyer/scheduler.d.ts +58 -0
  106. package/dist/agent/buyer/scheduler.js +317 -0
  107. package/dist/agent/buyer/scheduler.js.map +1 -0
  108. package/dist/agent/buyer/search-loop.d.ts +42 -0
  109. package/dist/agent/buyer/search-loop.js +280 -0
  110. package/dist/agent/buyer/search-loop.js.map +1 -0
  111. package/dist/agent/buyer/task-store.d.ts +178 -0
  112. package/dist/agent/buyer/task-store.js +637 -0
  113. package/dist/agent/buyer/task-store.js.map +1 -0
  114. package/dist/agent/buyer/types.d.ts +222 -0
  115. package/dist/agent/buyer/types.js +124 -0
  116. package/dist/agent/buyer/types.js.map +1 -0
  117. package/dist/agent/chat-tools.d.ts +41 -0
  118. package/dist/agent/chat-tools.js +193 -0
  119. package/dist/agent/chat-tools.js.map +1 -0
  120. package/dist/agent/chat-tui.d.ts +49 -0
  121. package/dist/agent/chat-tui.js +314 -0
  122. package/dist/agent/chat-tui.js.map +1 -0
  123. package/dist/agent/connector/fake-connector.d.ts +50 -0
  124. package/dist/agent/connector/fake-connector.js +138 -0
  125. package/dist/agent/connector/fake-connector.js.map +1 -0
  126. package/dist/agent/connector/http-connector.d.ts +49 -0
  127. package/dist/agent/connector/http-connector.js +208 -0
  128. package/dist/agent/connector/http-connector.js.map +1 -0
  129. package/dist/agent/connector/types.d.ts +103 -0
  130. package/dist/agent/connector/types.js +97 -0
  131. package/dist/agent/connector/types.js.map +1 -0
  132. package/dist/agent/fake-chat-model.d.ts +22 -0
  133. package/dist/agent/fake-chat-model.js +134 -0
  134. package/dist/agent/fake-chat-model.js.map +1 -0
  135. package/dist/agent/kernel.d.ts +258 -0
  136. package/dist/agent/kernel.js +1099 -0
  137. package/dist/agent/kernel.js.map +1 -0
  138. package/dist/agent/memory/schema.d.ts +32 -0
  139. package/dist/agent/memory/schema.js +291 -0
  140. package/dist/agent/memory/schema.js.map +1 -0
  141. package/dist/agent/memory/store.d.ts +193 -0
  142. package/dist/agent/memory/store.js +881 -0
  143. package/dist/agent/memory/store.js.map +1 -0
  144. package/dist/agent/memory/types.d.ts +139 -0
  145. package/dist/agent/memory/types.js +119 -0
  146. package/dist/agent/memory/types.js.map +1 -0
  147. package/dist/agent/memory/vault.d.ts +49 -0
  148. package/dist/agent/memory/vault.js +125 -0
  149. package/dist/agent/memory/vault.js.map +1 -0
  150. package/dist/agent/merchant/action-candidate.d.ts +106 -0
  151. package/dist/agent/merchant/action-candidate.js +241 -0
  152. package/dist/agent/merchant/action-candidate.js.map +1 -0
  153. package/dist/agent/merchant/credential-broker.d.ts +67 -0
  154. package/dist/agent/merchant/credential-broker.js +76 -0
  155. package/dist/agent/merchant/credential-broker.js.map +1 -0
  156. package/dist/agent/merchant/fake-merchant-client.d.ts +47 -0
  157. package/dist/agent/merchant/fake-merchant-client.js +143 -0
  158. package/dist/agent/merchant/fake-merchant-client.js.map +1 -0
  159. package/dist/agent/merchant/merchant-client.d.ts +49 -0
  160. package/dist/agent/merchant/merchant-client.js +186 -0
  161. package/dist/agent/merchant/merchant-client.js.map +1 -0
  162. package/dist/agent/merchant/merchant-tools.d.ts +74 -0
  163. package/dist/agent/merchant/merchant-tools.js +582 -0
  164. package/dist/agent/merchant/merchant-tools.js.map +1 -0
  165. package/dist/agent/merchant/types.d.ts +119 -0
  166. package/dist/agent/merchant/types.js +133 -0
  167. package/dist/agent/merchant/types.js.map +1 -0
  168. package/dist/agent/mode.d.ts +32 -0
  169. package/dist/agent/mode.js +34 -0
  170. package/dist/agent/mode.js.map +1 -0
  171. package/dist/agent/negotiation-chat.d.ts +81 -0
  172. package/dist/agent/negotiation-chat.js +330 -0
  173. package/dist/agent/negotiation-chat.js.map +1 -0
  174. package/dist/agent/session.d.ts +22 -0
  175. package/dist/agent/session.js +164 -0
  176. package/dist/agent/session.js.map +1 -0
  177. package/dist/agent/system-prompt.d.ts +26 -0
  178. package/dist/agent/system-prompt.js +77 -0
  179. package/dist/agent/system-prompt.js.map +1 -0
  180. package/dist/agent/write-gate.d.ts +98 -0
  181. package/dist/agent/write-gate.js +76 -0
  182. package/dist/agent/write-gate.js.map +1 -0
  183. package/dist/cli.d.ts +18 -0
  184. package/dist/cli.js +1139 -0
  185. package/dist/cli.js.map +1 -0
  186. package/dist/commerce/data-source.d.ts +88 -0
  187. package/dist/commerce/data-source.js +25 -0
  188. package/dist/commerce/data-source.js.map +1 -0
  189. package/dist/commerce/erp-source.d.ts +51 -0
  190. package/dist/commerce/erp-source.js +184 -0
  191. package/dist/commerce/erp-source.js.map +1 -0
  192. package/dist/commerce/fake-client.d.ts +167 -0
  193. package/dist/commerce/fake-client.js +549 -0
  194. package/dist/commerce/fake-client.js.map +1 -0
  195. package/dist/commerce/http-client.d.ts +73 -0
  196. package/dist/commerce/http-client.js +284 -0
  197. package/dist/commerce/http-client.js.map +1 -0
  198. package/dist/commerce/local-db-source.d.ts +50 -0
  199. package/dist/commerce/local-db-source.js +162 -0
  200. package/dist/commerce/local-db-source.js.map +1 -0
  201. package/dist/commerce/shopping-cli-source.d.ts +57 -0
  202. package/dist/commerce/shopping-cli-source.js +206 -0
  203. package/dist/commerce/shopping-cli-source.js.map +1 -0
  204. package/dist/commerce/types.d.ts +146 -0
  205. package/dist/commerce/types.js +31 -0
  206. package/dist/commerce/types.js.map +1 -0
  207. package/dist/config/profile.d.ts +122 -0
  208. package/dist/config/profile.js +386 -0
  209. package/dist/config/profile.js.map +1 -0
  210. package/dist/contracts/negotiation-schema.d.ts +28 -0
  211. package/dist/contracts/negotiation-schema.js +101 -0
  212. package/dist/contracts/negotiation-schema.js.map +1 -0
  213. package/dist/contracts/schemas.d.ts +31 -0
  214. package/dist/contracts/schemas.js +122 -0
  215. package/dist/contracts/schemas.js.map +1 -0
  216. package/dist/counterparty/a2a-direct/index.d.ts +41 -0
  217. package/dist/counterparty/a2a-direct/index.js +330 -0
  218. package/dist/counterparty/a2a-direct/index.js.map +1 -0
  219. package/dist/counterparty/channel.d.ts +200 -0
  220. package/dist/counterparty/channel.js +61 -0
  221. package/dist/counterparty/channel.js.map +1 -0
  222. package/dist/counterparty/index.d.ts +28 -0
  223. package/dist/counterparty/index.js +24 -0
  224. package/dist/counterparty/index.js.map +1 -0
  225. package/dist/counterparty/platform-api/index.d.ts +41 -0
  226. package/dist/counterparty/platform-api/index.js +65 -0
  227. package/dist/counterparty/platform-api/index.js.map +1 -0
  228. package/dist/counterparty/registry.d.ts +51 -0
  229. package/dist/counterparty/registry.js +71 -0
  230. package/dist/counterparty/registry.js.map +1 -0
  231. package/dist/counterparty/shopping-cli-hosted/index.d.ts +36 -0
  232. package/dist/counterparty/shopping-cli-hosted/index.js +337 -0
  233. package/dist/counterparty/shopping-cli-hosted/index.js.map +1 -0
  234. package/dist/discovery/agent-card/error.d.ts +28 -0
  235. package/dist/discovery/agent-card/error.js +31 -0
  236. package/dist/discovery/agent-card/error.js.map +1 -0
  237. package/dist/discovery/agent-card/extensions.d.ts +20 -0
  238. package/dist/discovery/agent-card/extensions.js +59 -0
  239. package/dist/discovery/agent-card/extensions.js.map +1 -0
  240. package/dist/discovery/agent-card/index.d.ts +29 -0
  241. package/dist/discovery/agent-card/index.js +38 -0
  242. package/dist/discovery/agent-card/index.js.map +1 -0
  243. package/dist/discovery/agent-card/secrets.d.ts +30 -0
  244. package/dist/discovery/agent-card/secrets.js +240 -0
  245. package/dist/discovery/agent-card/secrets.js.map +1 -0
  246. package/dist/discovery/agent-card/types.d.ts +110 -0
  247. package/dist/discovery/agent-card/types.js +37 -0
  248. package/dist/discovery/agent-card/types.js.map +1 -0
  249. package/dist/discovery/agent-card/validate.d.ts +31 -0
  250. package/dist/discovery/agent-card/validate.js +210 -0
  251. package/dist/discovery/agent-card/validate.js.map +1 -0
  252. package/dist/discovery/capability/error.d.ts +23 -0
  253. package/dist/discovery/capability/error.js +28 -0
  254. package/dist/discovery/capability/error.js.map +1 -0
  255. package/dist/discovery/capability/index.d.ts +21 -0
  256. package/dist/discovery/capability/index.js +21 -0
  257. package/dist/discovery/capability/index.js.map +1 -0
  258. package/dist/discovery/capability/intersect.d.ts +56 -0
  259. package/dist/discovery/capability/intersect.js +137 -0
  260. package/dist/discovery/capability/intersect.js.map +1 -0
  261. package/dist/discovery/catalog-source/errors.d.ts +32 -0
  262. package/dist/discovery/catalog-source/errors.js +41 -0
  263. package/dist/discovery/catalog-source/errors.js.map +1 -0
  264. package/dist/discovery/catalog-source/index.d.ts +30 -0
  265. package/dist/discovery/catalog-source/index.js +29 -0
  266. package/dist/discovery/catalog-source/index.js.map +1 -0
  267. package/dist/discovery/catalog-source/kiwi-record.d.ts +183 -0
  268. package/dist/discovery/catalog-source/kiwi-record.js +72 -0
  269. package/dist/discovery/catalog-source/kiwi-record.js.map +1 -0
  270. package/dist/discovery/catalog-source/kiwi-schema.d.ts +33 -0
  271. package/dist/discovery/catalog-source/kiwi-schema.js +106 -0
  272. package/dist/discovery/catalog-source/kiwi-schema.js.map +1 -0
  273. package/dist/discovery/catalog-source/kiwi-source.d.ts +38 -0
  274. package/dist/discovery/catalog-source/kiwi-source.js +318 -0
  275. package/dist/discovery/catalog-source/kiwi-source.js.map +1 -0
  276. package/dist/discovery/catalog-source/register.d.ts +48 -0
  277. package/dist/discovery/catalog-source/register.js +83 -0
  278. package/dist/discovery/catalog-source/register.js.map +1 -0
  279. package/dist/discovery/catalog-source/schema.d.ts +21 -0
  280. package/dist/discovery/catalog-source/schema.js +63 -0
  281. package/dist/discovery/catalog-source/schema.js.map +1 -0
  282. package/dist/discovery/catalog-source/source.d.ts +45 -0
  283. package/dist/discovery/catalog-source/source.js +197 -0
  284. package/dist/discovery/catalog-source/source.js.map +1 -0
  285. package/dist/discovery/catalog-source/types.d.ts +122 -0
  286. package/dist/discovery/catalog-source/types.js +30 -0
  287. package/dist/discovery/catalog-source/types.js.map +1 -0
  288. package/dist/discovery/index.d.ts +25 -0
  289. package/dist/discovery/index.js +25 -0
  290. package/dist/discovery/index.js.map +1 -0
  291. package/dist/discovery/resolve.d.ts +175 -0
  292. package/dist/discovery/resolve.js +367 -0
  293. package/dist/discovery/resolve.js.map +1 -0
  294. package/dist/discovery/ucp/error.d.ts +25 -0
  295. package/dist/discovery/ucp/error.js +27 -0
  296. package/dist/discovery/ucp/error.js.map +1 -0
  297. package/dist/discovery/ucp/index.d.ts +33 -0
  298. package/dist/discovery/ucp/index.js +28 -0
  299. package/dist/discovery/ucp/index.js.map +1 -0
  300. package/dist/discovery/ucp/intersect.d.ts +148 -0
  301. package/dist/discovery/ucp/intersect.js +312 -0
  302. package/dist/discovery/ucp/intersect.js.map +1 -0
  303. package/dist/discovery/ucp/resolver.d.ts +62 -0
  304. package/dist/discovery/ucp/resolver.js +214 -0
  305. package/dist/discovery/ucp/resolver.js.map +1 -0
  306. package/dist/discovery/ucp/types.d.ts +97 -0
  307. package/dist/discovery/ucp/types.js +103 -0
  308. package/dist/discovery/ucp/types.js.map +1 -0
  309. package/dist/discovery/ucp/validate.d.ts +38 -0
  310. package/dist/discovery/ucp/validate.js +232 -0
  311. package/dist/discovery/ucp/validate.js.map +1 -0
  312. package/dist/discovery/ucp/vendor.d.ts +60 -0
  313. package/dist/discovery/ucp/vendor.js +61 -0
  314. package/dist/discovery/ucp/vendor.js.map +1 -0
  315. package/dist/doctor.d.ts +26 -0
  316. package/dist/doctor.js +113 -0
  317. package/dist/doctor.js.map +1 -0
  318. package/dist/exit-codes.d.ts +26 -0
  319. package/dist/exit-codes.js +27 -0
  320. package/dist/exit-codes.js.map +1 -0
  321. package/dist/fanout/disclosure.d.ts +138 -0
  322. package/dist/fanout/disclosure.js +188 -0
  323. package/dist/fanout/disclosure.js.map +1 -0
  324. package/dist/fanout/index.d.ts +32 -0
  325. package/dist/fanout/index.js +30 -0
  326. package/dist/fanout/index.js.map +1 -0
  327. package/dist/fanout/orchestrator.d.ts +153 -0
  328. package/dist/fanout/orchestrator.js +439 -0
  329. package/dist/fanout/orchestrator.js.map +1 -0
  330. package/dist/fanout/policy.d.ts +128 -0
  331. package/dist/fanout/policy.js +130 -0
  332. package/dist/fanout/policy.js.map +1 -0
  333. package/dist/handoff/acp-commerce.d.ts +58 -0
  334. package/dist/handoff/acp-commerce.js +69 -0
  335. package/dist/handoff/acp-commerce.js.map +1 -0
  336. package/dist/handoff/authorization.d.ts +127 -0
  337. package/dist/handoff/authorization.js +107 -0
  338. package/dist/handoff/authorization.js.map +1 -0
  339. package/dist/handoff/candidate.d.ts +94 -0
  340. package/dist/handoff/candidate.js +172 -0
  341. package/dist/handoff/candidate.js.map +1 -0
  342. package/dist/handoff/channel.d.ts +88 -0
  343. package/dist/handoff/channel.js +189 -0
  344. package/dist/handoff/channel.js.map +1 -0
  345. package/dist/handoff/completion.d.ts +44 -0
  346. package/dist/handoff/completion.js +136 -0
  347. package/dist/handoff/completion.js.map +1 -0
  348. package/dist/handoff/delivery.d.ts +59 -0
  349. package/dist/handoff/delivery.js +185 -0
  350. package/dist/handoff/delivery.js.map +1 -0
  351. package/dist/handoff/destination.d.ts +39 -0
  352. package/dist/handoff/destination.js +99 -0
  353. package/dist/handoff/destination.js.map +1 -0
  354. package/dist/handoff/errors.d.ts +34 -0
  355. package/dist/handoff/errors.js +47 -0
  356. package/dist/handoff/errors.js.map +1 -0
  357. package/dist/handoff/idempotency.d.ts +51 -0
  358. package/dist/handoff/idempotency.js +168 -0
  359. package/dist/handoff/idempotency.js.map +1 -0
  360. package/dist/handoff/index.d.ts +46 -0
  361. package/dist/handoff/index.js +48 -0
  362. package/dist/handoff/index.js.map +1 -0
  363. package/dist/handoff/ledger.d.ts +94 -0
  364. package/dist/handoff/ledger.js +195 -0
  365. package/dist/handoff/ledger.js.map +1 -0
  366. package/dist/handoff/lifecycle.d.ts +29 -0
  367. package/dist/handoff/lifecycle.js +102 -0
  368. package/dist/handoff/lifecycle.js.map +1 -0
  369. package/dist/handoff/metrics.d.ts +56 -0
  370. package/dist/handoff/metrics.js +78 -0
  371. package/dist/handoff/metrics.js.map +1 -0
  372. package/dist/handoff/operator-approval.d.ts +143 -0
  373. package/dist/handoff/operator-approval.js +287 -0
  374. package/dist/handoff/operator-approval.js.map +1 -0
  375. package/dist/handoff/order-record.d.ts +104 -0
  376. package/dist/handoff/order-record.js +235 -0
  377. package/dist/handoff/order-record.js.map +1 -0
  378. package/dist/handoff/package.d.ts +102 -0
  379. package/dist/handoff/package.js +132 -0
  380. package/dist/handoff/package.js.map +1 -0
  381. package/dist/handoff/transaction.d.ts +96 -0
  382. package/dist/handoff/transaction.js +263 -0
  383. package/dist/handoff/transaction.js.map +1 -0
  384. package/dist/handoff/ucp-checkout/cart-channel.d.ts +111 -0
  385. package/dist/handoff/ucp-checkout/cart-channel.js +370 -0
  386. package/dist/handoff/ucp-checkout/cart-channel.js.map +1 -0
  387. package/dist/handoff/ucp-checkout/cart-parse.d.ts +22 -0
  388. package/dist/handoff/ucp-checkout/cart-parse.js +102 -0
  389. package/dist/handoff/ucp-checkout/cart-parse.js.map +1 -0
  390. package/dist/handoff/ucp-checkout/cart-types.d.ts +93 -0
  391. package/dist/handoff/ucp-checkout/cart-types.js +38 -0
  392. package/dist/handoff/ucp-checkout/cart-types.js.map +1 -0
  393. package/dist/handoff/ucp-checkout/channel.d.ts +159 -0
  394. package/dist/handoff/ucp-checkout/channel.js +636 -0
  395. package/dist/handoff/ucp-checkout/channel.js.map +1 -0
  396. package/dist/handoff/ucp-checkout/client.d.ts +88 -0
  397. package/dist/handoff/ucp-checkout/client.js +228 -0
  398. package/dist/handoff/ucp-checkout/client.js.map +1 -0
  399. package/dist/handoff/ucp-checkout/endpoint.d.ts +36 -0
  400. package/dist/handoff/ucp-checkout/endpoint.js +145 -0
  401. package/dist/handoff/ucp-checkout/endpoint.js.map +1 -0
  402. package/dist/handoff/ucp-checkout/index.d.ts +35 -0
  403. package/dist/handoff/ucp-checkout/index.js +36 -0
  404. package/dist/handoff/ucp-checkout/index.js.map +1 -0
  405. package/dist/handoff/ucp-checkout/parse.d.ts +71 -0
  406. package/dist/handoff/ucp-checkout/parse.js +349 -0
  407. package/dist/handoff/ucp-checkout/parse.js.map +1 -0
  408. package/dist/handoff/ucp-checkout/totals.d.ts +41 -0
  409. package/dist/handoff/ucp-checkout/totals.js +36 -0
  410. package/dist/handoff/ucp-checkout/totals.js.map +1 -0
  411. package/dist/handoff/ucp-checkout/types.d.ts +149 -0
  412. package/dist/handoff/ucp-checkout/types.js +58 -0
  413. package/dist/handoff/ucp-checkout/types.js.map +1 -0
  414. package/dist/handoff/url-safety.d.ts +44 -0
  415. package/dist/handoff/url-safety.js +121 -0
  416. package/dist/handoff/url-safety.js.map +1 -0
  417. package/dist/i18n.d.ts +24 -0
  418. package/dist/i18n.js +27 -0
  419. package/dist/i18n.js.map +1 -0
  420. package/dist/negotiation/action-candidate.d.ts +97 -0
  421. package/dist/negotiation/action-candidate.js +160 -0
  422. package/dist/negotiation/action-candidate.js.map +1 -0
  423. package/dist/negotiation/condition/evaluator.d.ts +36 -0
  424. package/dist/negotiation/condition/evaluator.js +123 -0
  425. package/dist/negotiation/condition/evaluator.js.map +1 -0
  426. package/dist/negotiation/context-map/index.d.ts +23 -0
  427. package/dist/negotiation/context-map/index.js +22 -0
  428. package/dist/negotiation/context-map/index.js.map +1 -0
  429. package/dist/negotiation/context-map/store.d.ts +51 -0
  430. package/dist/negotiation/context-map/store.js +186 -0
  431. package/dist/negotiation/context-map/store.js.map +1 -0
  432. package/dist/negotiation/context-map/types.d.ts +29 -0
  433. package/dist/negotiation/context-map/types.js +57 -0
  434. package/dist/negotiation/context-map/types.js.map +1 -0
  435. package/dist/negotiation/domain/common.d.ts +95 -0
  436. package/dist/negotiation/domain/common.js +216 -0
  437. package/dist/negotiation/domain/common.js.map +1 -0
  438. package/dist/negotiation/domain/envelope.d.ts +55 -0
  439. package/dist/negotiation/domain/envelope.js +110 -0
  440. package/dist/negotiation/domain/envelope.js.map +1 -0
  441. package/dist/negotiation/domain/identifiers.d.ts +65 -0
  442. package/dist/negotiation/domain/identifiers.js +130 -0
  443. package/dist/negotiation/domain/identifiers.js.map +1 -0
  444. package/dist/negotiation/domain/objects.d.ts +149 -0
  445. package/dist/negotiation/domain/objects.js +335 -0
  446. package/dist/negotiation/domain/objects.js.map +1 -0
  447. package/dist/negotiation/idempotency/index.d.ts +26 -0
  448. package/dist/negotiation/idempotency/index.js +25 -0
  449. package/dist/negotiation/idempotency/index.js.map +1 -0
  450. package/dist/negotiation/idempotency/store.d.ts +52 -0
  451. package/dist/negotiation/idempotency/store.js +189 -0
  452. package/dist/negotiation/idempotency/store.js.map +1 -0
  453. package/dist/negotiation/idempotency/types.d.ts +102 -0
  454. package/dist/negotiation/idempotency/types.js +47 -0
  455. package/dist/negotiation/idempotency/types.js.map +1 -0
  456. package/dist/negotiation/jcs.d.ts +21 -0
  457. package/dist/negotiation/jcs.js +114 -0
  458. package/dist/negotiation/jcs.js.map +1 -0
  459. package/dist/negotiation/ledger/event.d.ts +142 -0
  460. package/dist/negotiation/ledger/event.js +206 -0
  461. package/dist/negotiation/ledger/event.js.map +1 -0
  462. package/dist/negotiation/ledger/index.d.ts +26 -0
  463. package/dist/negotiation/ledger/index.js +25 -0
  464. package/dist/negotiation/ledger/index.js.map +1 -0
  465. package/dist/negotiation/ledger/store.d.ts +97 -0
  466. package/dist/negotiation/ledger/store.js +338 -0
  467. package/dist/negotiation/ledger/store.js.map +1 -0
  468. package/dist/negotiation/prompt.d.ts +34 -0
  469. package/dist/negotiation/prompt.js +113 -0
  470. package/dist/negotiation/prompt.js.map +1 -0
  471. package/dist/negotiation/recovery/index.d.ts +26 -0
  472. package/dist/negotiation/recovery/index.js +24 -0
  473. package/dist/negotiation/recovery/index.js.map +1 -0
  474. package/dist/negotiation/recovery/outbound.d.ts +49 -0
  475. package/dist/negotiation/recovery/outbound.js +34 -0
  476. package/dist/negotiation/recovery/outbound.js.map +1 -0
  477. package/dist/negotiation/recovery/recover.d.ts +59 -0
  478. package/dist/negotiation/recovery/recover.js +486 -0
  479. package/dist/negotiation/recovery/recover.js.map +1 -0
  480. package/dist/negotiation/recovery/types.d.ts +85 -0
  481. package/dist/negotiation/recovery/types.js +17 -0
  482. package/dist/negotiation/recovery/types.js.map +1 -0
  483. package/dist/negotiation/state/phase.d.ts +70 -0
  484. package/dist/negotiation/state/phase.js +200 -0
  485. package/dist/negotiation/state/phase.js.map +1 -0
  486. package/dist/negotiation/types.d.ts +139 -0
  487. package/dist/negotiation/types.js +24 -0
  488. package/dist/negotiation/types.js.map +1 -0
  489. package/dist/net/safe-http.d.ts +54 -0
  490. package/dist/net/safe-http.js +116 -0
  491. package/dist/net/safe-http.js.map +1 -0
  492. package/dist/operator/controller.d.ts +181 -0
  493. package/dist/operator/controller.js +784 -0
  494. package/dist/operator/controller.js.map +1 -0
  495. package/dist/operator/runner.d.ts +128 -0
  496. package/dist/operator/runner.js +248 -0
  497. package/dist/operator/runner.js.map +1 -0
  498. package/dist/operator/store.d.ts +39 -0
  499. package/dist/operator/store.js +169 -0
  500. package/dist/operator/store.js.map +1 -0
  501. package/dist/operator/strategy.d.ts +54 -0
  502. package/dist/operator/strategy.js +249 -0
  503. package/dist/operator/strategy.js.map +1 -0
  504. package/dist/operator/tui.d.ts +27 -0
  505. package/dist/operator/tui.js +395 -0
  506. package/dist/operator/tui.js.map +1 -0
  507. package/dist/operator/types.d.ts +224 -0
  508. package/dist/operator/types.js +17 -0
  509. package/dist/operator/types.js.map +1 -0
  510. package/dist/product-buyer.d.ts +74 -0
  511. package/dist/product-buyer.js +161 -0
  512. package/dist/product-buyer.js.map +1 -0
  513. package/dist/product-cli.d.ts +56 -0
  514. package/dist/product-cli.js +175 -0
  515. package/dist/product-cli.js.map +1 -0
  516. package/dist/product-compat.d.ts +50 -0
  517. package/dist/product-compat.js +63 -0
  518. package/dist/product-compat.js.map +1 -0
  519. package/dist/product-init.d.ts +73 -0
  520. package/dist/product-init.js +203 -0
  521. package/dist/product-init.js.map +1 -0
  522. package/dist/product-publish.d.ts +85 -0
  523. package/dist/product-publish.js +216 -0
  524. package/dist/product-publish.js.map +1 -0
  525. package/dist/protocol/legacy-shopping-negotiation/adapter.d.ts +42 -0
  526. package/dist/protocol/legacy-shopping-negotiation/adapter.js +561 -0
  527. package/dist/protocol/legacy-shopping-negotiation/adapter.js.map +1 -0
  528. package/dist/protocol/legacy-shopping-negotiation/mapping.d.ts +78 -0
  529. package/dist/protocol/legacy-shopping-negotiation/mapping.js +321 -0
  530. package/dist/protocol/legacy-shopping-negotiation/mapping.js.map +1 -0
  531. package/dist/protocol/legacy-shopping-negotiation/money.d.ts +49 -0
  532. package/dist/protocol/legacy-shopping-negotiation/money.js +70 -0
  533. package/dist/protocol/legacy-shopping-negotiation/money.js.map +1 -0
  534. package/dist/protocol/legacy-shopping-negotiation/types.d.ts +107 -0
  535. package/dist/protocol/legacy-shopping-negotiation/types.js +34 -0
  536. package/dist/protocol/legacy-shopping-negotiation/types.js.map +1 -0
  537. package/dist/runtime/buyer-policy.d.ts +58 -0
  538. package/dist/runtime/buyer-policy.js +89 -0
  539. package/dist/runtime/buyer-policy.js.map +1 -0
  540. package/dist/runtime/fake-model.d.ts +77 -0
  541. package/dist/runtime/fake-model.js +307 -0
  542. package/dist/runtime/fake-model.js.map +1 -0
  543. package/dist/runtime/foreground.d.ts +56 -0
  544. package/dist/runtime/foreground.js +97 -0
  545. package/dist/runtime/foreground.js.map +1 -0
  546. package/dist/runtime/heartbeat.d.ts +36 -0
  547. package/dist/runtime/heartbeat.js +49 -0
  548. package/dist/runtime/heartbeat.js.map +1 -0
  549. package/dist/runtime/merchant-turn.d.ts +35 -0
  550. package/dist/runtime/merchant-turn.js +20 -0
  551. package/dist/runtime/merchant-turn.js.map +1 -0
  552. package/dist/runtime/model.d.ts +40 -0
  553. package/dist/runtime/model.js +86 -0
  554. package/dist/runtime/model.js.map +1 -0
  555. package/dist/runtime/negotiation-turn.d.ts +101 -0
  556. package/dist/runtime/negotiation-turn.js +317 -0
  557. package/dist/runtime/negotiation-turn.js.map +1 -0
  558. package/dist/runtime/tools.d.ts +64 -0
  559. package/dist/runtime/tools.js +236 -0
  560. package/dist/runtime/tools.js.map +1 -0
  561. package/dist/supervisor/init.d.ts +31 -0
  562. package/dist/supervisor/init.js +222 -0
  563. package/dist/supervisor/init.js.map +1 -0
  564. package/dist/supervisor/logs.d.ts +28 -0
  565. package/dist/supervisor/logs.js +101 -0
  566. package/dist/supervisor/logs.js.map +1 -0
  567. package/dist/supervisor/manage.d.ts +72 -0
  568. package/dist/supervisor/manage.js +419 -0
  569. package/dist/supervisor/manage.js.map +1 -0
  570. package/dist/supervisor/manifest.d.ts +69 -0
  571. package/dist/supervisor/manifest.js +209 -0
  572. package/dist/supervisor/manifest.js.map +1 -0
  573. package/dist/supervisor/stack-config.d.ts +79 -0
  574. package/dist/supervisor/stack-config.js +262 -0
  575. package/dist/supervisor/stack-config.js.map +1 -0
  576. package/dist/supervisor/wrapper.d.ts +17 -0
  577. package/dist/supervisor/wrapper.js +138 -0
  578. package/dist/supervisor/wrapper.js.map +1 -0
  579. package/dist/trust/identity/auth-verifier.d.ts +96 -0
  580. package/dist/trust/identity/auth-verifier.js +166 -0
  581. package/dist/trust/identity/auth-verifier.js.map +1 -0
  582. package/dist/trust/identity/identity-binding.d.ts +63 -0
  583. package/dist/trust/identity/identity-binding.js +59 -0
  584. package/dist/trust/identity/identity-binding.js.map +1 -0
  585. package/dist/trust/identity/index.d.ts +38 -0
  586. package/dist/trust/identity/index.js +31 -0
  587. package/dist/trust/identity/index.js.map +1 -0
  588. package/dist/trust/identity/jws.d.ts +64 -0
  589. package/dist/trust/identity/jws.js +178 -0
  590. package/dist/trust/identity/jws.js.map +1 -0
  591. package/dist/trust/identity/keys.d.ts +71 -0
  592. package/dist/trust/identity/keys.js +118 -0
  593. package/dist/trust/identity/keys.js.map +1 -0
  594. package/dist/trust/identity/message-signature.d.ts +105 -0
  595. package/dist/trust/identity/message-signature.js +297 -0
  596. package/dist/trust/identity/message-signature.js.map +1 -0
  597. package/dist/trust/identity/nonce.d.ts +45 -0
  598. package/dist/trust/identity/nonce.js +50 -0
  599. package/dist/trust/identity/nonce.js.map +1 -0
  600. package/dist/trust/identity/signature-base.d.ts +84 -0
  601. package/dist/trust/identity/signature-base.js +261 -0
  602. package/dist/trust/identity/signature-base.js.map +1 -0
  603. package/dist/trust/identity/trust-policy.d.ts +92 -0
  604. package/dist/trust/identity/trust-policy.js +95 -0
  605. package/dist/trust/identity/trust-policy.js.map +1 -0
  606. package/dist/trust/index.d.ts +21 -0
  607. package/dist/trust/index.js +22 -0
  608. package/dist/trust/index.js.map +1 -0
  609. package/dist/trust/records/evaluator.d.ts +76 -0
  610. package/dist/trust/records/evaluator.js +122 -0
  611. package/dist/trust/records/evaluator.js.map +1 -0
  612. package/dist/trust/records/index.d.ts +28 -0
  613. package/dist/trust/records/index.js +26 -0
  614. package/dist/trust/records/index.js.map +1 -0
  615. package/dist/trust/records/store.d.ts +75 -0
  616. package/dist/trust/records/store.js +339 -0
  617. package/dist/trust/records/store.js.map +1 -0
  618. package/dist/trust/records/types.d.ts +159 -0
  619. package/dist/trust/records/types.js +40 -0
  620. package/dist/trust/records/types.js.map +1 -0
  621. package/dist/tui/banner.d.ts +46 -0
  622. package/dist/tui/banner.js +99 -0
  623. package/dist/tui/banner.js.map +1 -0
  624. package/dist/tui/styles.d.ts +70 -0
  625. package/dist/tui/styles.js +197 -0
  626. package/dist/tui/styles.js.map +1 -0
  627. package/dist/tui/theme.d.ts +63 -0
  628. package/dist/tui/theme.js +136 -0
  629. package/dist/tui/theme.js.map +1 -0
  630. package/examples/profiles/buyer.deepseek.yaml +34 -0
  631. package/examples/profiles/buyer.fake.yaml +36 -0
  632. package/examples/profiles/buyer.local.yaml +40 -0
  633. package/examples/profiles/merchant.deepseek.yaml +32 -0
  634. package/examples/profiles/merchant.fake.yaml +31 -0
  635. package/examples/profiles/merchant.local.yaml +34 -0
  636. package/package.json +55 -0
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Copyright 2026 harrylabsj
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * AgentDiscovery.resolve —— §33 AgentDiscovery 职责落地。
18
+ *
19
+ * 输入 domain 或 Agent Card URL:
20
+ *
21
+ * domain → 双发现入口(基线 §25 / §33,WP3):
22
+ * 1. 先试 UCP 标准入口 `/.well-known/ucp`;
23
+ * 解析成功且校验后 profile 含 a2a transport → 用其
24
+ * endpoint(Agent Card URL)继续;
25
+ * 2. UCP 失败(解析/校验/无 a2a transport)→ 回退直接试
26
+ * `https://<domain>/.well-known/agent-card.json`。
27
+ * 两个都是标准发现入口,权限等价,因此 UCP → Agent Card
28
+ * 的回退不违反不变量 21 —— 不变量 21 约束的是通道候选的
29
+ * 一次性选择,不是发现入口本身。
30
+ * agentCardUrl → 直接拉取 Agent Card(不走 UCP)。
31
+ *
32
+ * 处理链:
33
+ * fetch → parseAgentCard(结构校验 + secret 扫描,不变量 24)→
34
+ * capability intersection(§3.1 / §33)→ identity bootstrap → channel candidates。
35
+ * UCP 优先路径成功时,UCP capability intersection(§3.2,与 A2A binding
36
+ * intersection 两个维度并存)与解析出的 profile 一并放入 CounterpartyProfile。
37
+ *
38
+ * 通道候选按优先序(§33):A2A 可用 → a2a-direct;否则若配置了 hosted →
39
+ * shopping-cli-hosted;否则若配置了 platform → platform-api;都没有 → fail-closed
40
+ * (抛 DiscoveryError)。候选选择本身是一次性确定性决策(selectChannelCandidate),
41
+ * 后续失败绝不自动降级到权限更宽的通道(不变量 21)。
42
+ *
43
+ * 全部失败路径抛 DiscoveryError(fail-closed,§4.6)。
44
+ *
45
+ * v2.3(设计 §21 / MVP Slice A/B):DiscoveryDeps.catalog 可选配置后启用
46
+ * resolveViaCatalog —— 通过 shopping-cli Commerce Agent Catalog 发现候选并升级为
47
+ * CounterpartyProfile。catalog 候选不是已证明的在线身份(契约 §1),升级路径
48
+ * 必须走 resolve() 做 fresh verification,不直接信任候选元数据。
49
+ */
50
+ import { type AgentInterface } from "./agent-card/index.js";
51
+ import type { UcpResolverOptions } from "./ucp/resolver.js";
52
+ import type { UcpProfile } from "./ucp/types.js";
53
+ import type { CandidateAgent, CatalogSearchQuery, CatalogSource } from "./catalog-source/index.js";
54
+ import type { CounterpartyProfile } from "../counterparty/channel.js";
55
+ export interface DiscoveryInput {
56
+ /** 对端域名(不含 scheme);从 well-known Agent Card 解析。 */
57
+ domain?: string;
58
+ /** 直接给 Agent Card URL。 */
59
+ agentCardUrl?: string;
60
+ }
61
+ /** UCP 优先发现配置(WP3,可选)。 */
62
+ export interface UcpDiscoveryDeps {
63
+ /** 禁用 UCP 优先发现(domain 输入),保持 v0.5 直接 well-known Agent Card。 */
64
+ disabled?: boolean;
65
+ /** Kiwi 平台侧 UCP profile(capability intersection 的 platform 侧)。 */
66
+ localProfile?: UcpProfile;
67
+ /** UcpResolver 构造选项(fetchImpl 缺省复用 discovery.fetchImpl)。 */
68
+ resolver?: UcpResolverOptions;
69
+ }
70
+ /**
71
+ * Commerce Agent Catalog 集成(v2.3 / 设计 §21、MVP Slice A/B)。
72
+ * 提供 catalog source 后,AgentDiscovery 可通过 resolveViaCatalog 把候选升级为
73
+ * CounterpartyProfile。Catalog 返回的是 candidate,不是已证明的在线身份(契约 §1);
74
+ * 升级路径必须走 resolve() 做 fresh verification。
75
+ */
76
+ export interface CatalogDiscoveryDeps {
77
+ /** CatalogSource 接口:ShoppingCliCatalogSource(legacy)或 KiwiCatalogSource(/v1/agents)。 */
78
+ source: CatalogSource;
79
+ /** 缺省搜索查询;resolveViaCatalog 未显式传 query 时使用。 */
80
+ query?: CatalogSearchQuery;
81
+ /**
82
+ * 显式放宽 verification.status 过滤(设计 §8.2:Kiwi SHOULD 按 TrustPolicy
83
+ * 做 fresh verification)。默认过滤 blocked 状态集 {rejected, suspended,
84
+ * unreachable};true 时这些候选也进入 fresh resolve(风险自负,文档注明)。
85
+ */
86
+ includeBlocked?: boolean;
87
+ }
88
+ export interface DiscoveryDeps {
89
+ /** 拉取 card 的 fetch;缺省 globalThis.fetch。 */
90
+ fetchImpl?: typeof fetch;
91
+ /** Kiwi 本地 A2A binding 声明(capability intersection 的 local 侧)。 */
92
+ localInterfaces?: AgentInterface[];
93
+ /** hosted 通道是否已配置(§33:非 direct 时的次选)。 */
94
+ hosted?: {
95
+ configured: boolean;
96
+ config_id?: string;
97
+ };
98
+ /** platform 通道是否已配置(fail-closed:未配置不产生候选)。 */
99
+ platform?: {
100
+ configured: boolean;
101
+ credential_ref?: string;
102
+ };
103
+ /** 拉取超时 ms(默认 15000)。 */
104
+ timeoutMs?: number;
105
+ /** SSRF DNS 复查的解析函数(缺省 node:dns lookup;受控/测试环境注入用)。 */
106
+ resolveIp?: (hostname: string) => Promise<string[]>;
107
+ /** 跳过 SSRF DNS 复查(仅测试/受控环境;生产缺省 false)。 */
108
+ skipDnsCheck?: boolean;
109
+ /**
110
+ * UCP 集成(WP3):domain 输入先试 `/.well-known/ucp`,失败回退
111
+ * `/.well-known/agent-card.json`。缺省启用(不传即用默认 resolver);
112
+ * `disabled: true` 保持 v0.5 行为。
113
+ */
114
+ ucp?: UcpDiscoveryDeps;
115
+ /**
116
+ * Commerce Agent Catalog 集成(v2.3,可选):配置后启用 resolveViaCatalog。
117
+ * 不影响现有 resolve() 语义。
118
+ */
119
+ catalog?: CatalogDiscoveryDeps;
120
+ }
121
+ export type DiscoveryErrorCode = "invalid_input" | "card_fetch_failed" | "card_invalid" | "card_has_secret" | "no_channel_candidate";
122
+ export declare class DiscoveryError extends Error {
123
+ readonly code: DiscoveryErrorCode;
124
+ constructor(code: DiscoveryErrorCode, message: string);
125
+ }
126
+ /**
127
+ * resolveViaCatalog 的产出:catalog 候选 + 经 fresh verification 升级的档案。
128
+ * `candidate` 保留 catalog 元数据(catalog_agent_id / hosting / verification 等),
129
+ * 供调用方追溯来源;`profile` 是可信的 CounterpartyProfile。
130
+ */
131
+ export interface ResolvedCatalogCandidate {
132
+ candidate: CandidateAgent;
133
+ profile: CounterpartyProfile;
134
+ }
135
+ export declare class AgentDiscovery {
136
+ private readonly deps;
137
+ private readonly ucpResolver;
138
+ private readonly ucpLocalProfile;
139
+ constructor(deps?: DiscoveryDeps);
140
+ private cardUrlFor;
141
+ private fetchCard;
142
+ private identityFor;
143
+ private channelCandidates;
144
+ /**
145
+ * 解析对端:domain 或 Agent Card URL → CounterpartyProfile。
146
+ * 无可用通道候选时抛 DiscoveryError(fail-closed,不返回空档案)。
147
+ */
148
+ resolve(input: DiscoveryInput): Promise<CounterpartyProfile>;
149
+ /**
150
+ * 通过 Commerce Agent Catalog 发现并升级对端(v2.3,设计 §21 / MVP Slice A/B)。
151
+ *
152
+ * 流程:searchCandidates → 按 TrustPolicy 过滤 blocked 状态 → 对每个候选按其
153
+ * `discovery.agent_card_url` 或 `merchant.domain` 走现有 resolve() 做 fresh
154
+ * verification → 按候选 hosting.mode 收窄通道候选(不自动降级)→ 返回
155
+ * `{ candidate, profile }`。
156
+ *
157
+ * 关键语义(契约 §1 / 设计 §8.2):catalog 候选**不是**已证明的在线身份。
158
+ * 本方法绝不直接信任候选元数据构造档案,profile 必须来自 resolve() 实时拉取
159
+ * 校验的 Agent Card。没有 agent_card_url / merchant.domain 的候选无法 fresh
160
+ * verify → 跳过(不产出档案)。filtered 后无可用通道候选 → 跳过(不降级)。
161
+ *
162
+ * fail-closed(§4.6):任一候选的 fresh resolve 失败(fetch / 校验 / 无通道)
163
+ * 直接抛错,不静默丢弃;blocked 状态候选默认过滤,includeBlocked: true 显式放宽。
164
+ *
165
+ * @param query 覆盖 DiscoveryDeps.catalog.query 的搜索查询。
166
+ */
167
+ resolveViaCatalog(query?: CatalogSearchQuery): Promise<ResolvedCatalogCandidate[]>;
168
+ /** blocked verification.status 过滤;includeBlocked 显式放宽(文档注明)。 */
169
+ private isCatalogCandidateAllowed;
170
+ /**
171
+ * 候选 → resolve() 输入。优先 agent_card_url,其次 merchant.domain;
172
+ * 两者都缺 → undefined(无法 fresh verify,跳过)。
173
+ */
174
+ private resolveInputForCandidate;
175
+ }
@@ -0,0 +1,367 @@
1
+ /**
2
+ * Copyright 2026 harrylabsj
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * AgentDiscovery.resolve —— §33 AgentDiscovery 职责落地。
18
+ *
19
+ * 输入 domain 或 Agent Card URL:
20
+ *
21
+ * domain → 双发现入口(基线 §25 / §33,WP3):
22
+ * 1. 先试 UCP 标准入口 `/.well-known/ucp`;
23
+ * 解析成功且校验后 profile 含 a2a transport → 用其
24
+ * endpoint(Agent Card URL)继续;
25
+ * 2. UCP 失败(解析/校验/无 a2a transport)→ 回退直接试
26
+ * `https://<domain>/.well-known/agent-card.json`。
27
+ * 两个都是标准发现入口,权限等价,因此 UCP → Agent Card
28
+ * 的回退不违反不变量 21 —— 不变量 21 约束的是通道候选的
29
+ * 一次性选择,不是发现入口本身。
30
+ * agentCardUrl → 直接拉取 Agent Card(不走 UCP)。
31
+ *
32
+ * 处理链:
33
+ * fetch → parseAgentCard(结构校验 + secret 扫描,不变量 24)→
34
+ * capability intersection(§3.1 / §33)→ identity bootstrap → channel candidates。
35
+ * UCP 优先路径成功时,UCP capability intersection(§3.2,与 A2A binding
36
+ * intersection 两个维度并存)与解析出的 profile 一并放入 CounterpartyProfile。
37
+ *
38
+ * 通道候选按优先序(§33):A2A 可用 → a2a-direct;否则若配置了 hosted →
39
+ * shopping-cli-hosted;否则若配置了 platform → platform-api;都没有 → fail-closed
40
+ * (抛 DiscoveryError)。候选选择本身是一次性确定性决策(selectChannelCandidate),
41
+ * 后续失败绝不自动降级到权限更宽的通道(不变量 21)。
42
+ *
43
+ * 全部失败路径抛 DiscoveryError(fail-closed,§4.6)。
44
+ *
45
+ * v2.3(设计 §21 / MVP Slice A/B):DiscoveryDeps.catalog 可选配置后启用
46
+ * resolveViaCatalog —— 通过 shopping-cli Commerce Agent Catalog 发现候选并升级为
47
+ * CounterpartyProfile。catalog 候选不是已证明的在线身份(契约 §1),升级路径
48
+ * 必须走 resolve() 做 fresh verification,不直接信任候选元数据。
49
+ */
50
+ import { AgentCardError, parseAgentCard, } from "./agent-card/index.js";
51
+ import { intersectCapabilities } from "./capability/index.js";
52
+ import { UcpResolver } from "./ucp/resolver.js";
53
+ import { isUcpError } from "./ucp/error.js";
54
+ import { computeCapabilityIntersection, intersectionView } from "./ucp/intersect.js";
55
+ import { normalizeHostingMode } from "./catalog-source/index.js";
56
+ import { assertResolvableTargetUrl, assertSafeTargetUrl, } from "../a2a/client/url-policy.js";
57
+ import { readJsonBody, SafeHttpError } from "../net/safe-http.js";
58
+ export class DiscoveryError extends Error {
59
+ code;
60
+ constructor(code, message) {
61
+ super(message);
62
+ this.name = "DiscoveryError";
63
+ this.code = code;
64
+ }
65
+ }
66
+ /** Kiwi 本地默认 A2A binding:JSONRPC 1.0(基线 §3.1 core binding)。 */
67
+ const DEFAULT_LOCAL_INTERFACES = [
68
+ { url: "https://kiwi.local/a2a", protocolBinding: "JSONRPC", protocolVersion: "1.0" },
69
+ ];
70
+ /**
71
+ * 默认过滤的 verification.status(设计 §8.2 fresh verification / TrustPolicy)。
72
+ * rejected / suspended / unreachable 说明对端身份已被 catalog 判定不可信;
73
+ * includeBlocked: true 可显式放宽。
74
+ */
75
+ const BLOCKED_CATALOG_VERIFICATION_STATUSES = new Set([
76
+ "rejected",
77
+ "suspended",
78
+ "unreachable",
79
+ ]);
80
+ const WELL_KNOWN_AGENT_CARD_PATH = "/.well-known/agent-card.json";
81
+ /**
82
+ * 从校验后的 UCP profile 挑出 a2a transport 服务的 endpoint(Agent Card URL)。
83
+ * validate 已保证 a2a service 必有 https endpoint;这里只需按序遍历取第一个。
84
+ */
85
+ function findA2aTransportEndpoint(profile) {
86
+ const services = profile.ucp.services;
87
+ if (services === undefined)
88
+ return undefined;
89
+ for (const declarations of Object.values(services)) {
90
+ for (const decl of declarations) {
91
+ if (decl.transport === "a2a" && decl.endpoint !== undefined)
92
+ return decl.endpoint;
93
+ }
94
+ }
95
+ return undefined;
96
+ }
97
+ /**
98
+ * 按 catalog hosting.mode(设计 §22)收窄 resolve() 产出的通道候选。
99
+ * 不引入自动降级(不变量 21 / §22 fallback 不能自动扩大权限):
100
+ * - direct_only → 只保留 a2a-direct(无 direct 端点则该候选不可用);
101
+ * - hosted_only → 只保留 shopping-cli-hosted(未配置 hosted 则不可用);
102
+ * - hybrid → 保留 direct + hosted 两个候选,优先序仍由 selectChannelCandidate
103
+ * (direct 优先)决定;
104
+ * - unknown → 只当 resolve() 实际发现 a2a binding 时给 direct 候选。
105
+ * platform-api 不进入 catalog 驱动的档案(catalog 只表达 direct/hosted 两种偏好;
106
+ * 附加 platform 候选属于超出 merchant 声明范围的降级/扩权)。
107
+ */
108
+ function applyHostingMode(candidates, mode) {
109
+ switch (mode) {
110
+ case "direct_only":
111
+ return candidates.filter((c) => c.kind === "a2a-direct");
112
+ case "hosted_only":
113
+ return candidates.filter((c) => c.kind === "shopping-cli-hosted");
114
+ case "hybrid":
115
+ return candidates.filter((c) => c.kind === "a2a-direct" || c.kind === "shopping-cli-hosted");
116
+ case "unknown":
117
+ return candidates.filter((c) => c.kind === "a2a-direct");
118
+ }
119
+ }
120
+ export class AgentDiscovery {
121
+ deps;
122
+ ucpResolver;
123
+ ucpLocalProfile;
124
+ constructor(deps = {}) {
125
+ this.deps = deps;
126
+ const ucpDeps = deps.ucp;
127
+ if (ucpDeps === undefined || ucpDeps.disabled === true) {
128
+ this.ucpResolver = undefined;
129
+ this.ucpLocalProfile = undefined;
130
+ return;
131
+ }
132
+ this.ucpLocalProfile = ucpDeps.localProfile;
133
+ this.ucpResolver = new UcpResolver({
134
+ ...ucpDeps.resolver,
135
+ fetchImpl: ucpDeps.resolver?.fetchImpl ?? deps.fetchImpl,
136
+ timeoutMs: ucpDeps.resolver?.timeoutMs ?? deps.timeoutMs ?? 15_000,
137
+ });
138
+ }
139
+ cardUrlFor(input) {
140
+ if (input.agentCardUrl !== undefined && input.domain !== undefined) {
141
+ throw new DiscoveryError("invalid_input", "DiscoveryInput must provide exactly one of domain or agentCardUrl");
142
+ }
143
+ if (input.agentCardUrl !== undefined)
144
+ return input.agentCardUrl;
145
+ if (input.domain !== undefined) {
146
+ let url;
147
+ try {
148
+ url = new URL(`https://${input.domain}${WELL_KNOWN_AGENT_CARD_PATH}`);
149
+ }
150
+ catch {
151
+ throw new DiscoveryError("invalid_input", `domain is not a valid host: "${input.domain}"`);
152
+ }
153
+ if (url.hostname.length === 0 || url.username !== "" || url.password !== "") {
154
+ throw new DiscoveryError("invalid_input", `domain is not a valid host: "${input.domain}"`);
155
+ }
156
+ return url.href;
157
+ }
158
+ throw new DiscoveryError("invalid_input", "DiscoveryInput must provide domain or agentCardUrl");
159
+ }
160
+ async fetchCard(url) {
161
+ // SSRF 防护(与 UCP resolver 同级,catalog 驱动的 agent_card_url 同样受保护):
162
+ // 1. 静态校验(scheme/userinfo/保留网段/loopback http 例外);
163
+ // 2. 请求前 DNS 复查(主机名解析的每个 IP 过保留网段判定,防 rebinding);
164
+ // 3. 不跟随重定向(redirect:"manual",3xx → 拒绝)。
165
+ let safeUrl;
166
+ try {
167
+ safeUrl = assertSafeTargetUrl(url);
168
+ await assertResolvableTargetUrl(safeUrl, {
169
+ skipDnsCheck: this.deps.skipDnsCheck,
170
+ resolveIp: this.deps.resolveIp,
171
+ });
172
+ }
173
+ catch (err) {
174
+ throw new DiscoveryError("card_fetch_failed", `Agent Card URL rejected by safety policy: ${err instanceof Error ? err.message : String(err)}`);
175
+ }
176
+ const fetchImpl = this.deps.fetchImpl ?? globalThis.fetch;
177
+ const timeoutMs = this.deps.timeoutMs ?? 15_000;
178
+ const controller = new AbortController();
179
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
180
+ let response;
181
+ try {
182
+ response = await fetchImpl(safeUrl.href, {
183
+ redirect: "manual",
184
+ signal: controller.signal,
185
+ headers: { accept: "application/json" },
186
+ });
187
+ }
188
+ catch (err) {
189
+ throw new DiscoveryError("card_fetch_failed", `failed to fetch Agent Card from ${url}: ${err instanceof Error ? err.message : String(err)}`);
190
+ }
191
+ if (response.redirected ||
192
+ response.type === "opaqueredirect" ||
193
+ (response.status >= 300 && response.status < 400)) {
194
+ throw new DiscoveryError("card_fetch_failed", `Agent Card fetch must not follow redirects (HTTP ${response.status} from ${url})`);
195
+ }
196
+ if (!response.ok) {
197
+ throw new DiscoveryError("card_fetch_failed", `Agent Card fetch returned HTTP ${response.status} from ${url}`);
198
+ }
199
+ let raw;
200
+ try {
201
+ // 响应体读取在超时覆盖内 + 大小上限(出站加固:对端停滞 body 或回传
202
+ // 巨量 body 都不能挂起/打爆本进程)。
203
+ raw = await readJsonBody(response, { signal: controller.signal });
204
+ }
205
+ catch (err) {
206
+ if (controller.signal.aborted) {
207
+ throw new DiscoveryError("card_fetch_failed", `Agent Card fetch timed out after ${timeoutMs}ms: ${url}`);
208
+ }
209
+ throw new DiscoveryError("card_fetch_failed", err instanceof SafeHttpError && err.code === "response_too_large"
210
+ ? `Agent Card response from ${url}: ${err.message}`
211
+ : `Agent Card response from ${url} is not valid JSON`);
212
+ }
213
+ finally {
214
+ clearTimeout(timer);
215
+ }
216
+ return raw;
217
+ }
218
+ identityFor(card) {
219
+ const org = card.provider.organization;
220
+ return org.length > 0 ? org : card.name;
221
+ }
222
+ channelCandidates(card) {
223
+ const local = this.deps.localInterfaces ?? DEFAULT_LOCAL_INTERFACES;
224
+ const intersection = intersectCapabilities(local, card);
225
+ const candidates = [];
226
+ if (intersection.selected !== undefined) {
227
+ candidates.push({ kind: "a2a-direct", url: intersection.selected.url });
228
+ }
229
+ if (this.deps.hosted?.configured === true) {
230
+ candidates.push({ kind: "shopping-cli-hosted", config_id: this.deps.hosted.config_id });
231
+ }
232
+ if (this.deps.platform?.configured === true) {
233
+ candidates.push({ kind: "platform-api", credential_ref: this.deps.platform.credential_ref });
234
+ }
235
+ return { intersection, candidates };
236
+ }
237
+ /**
238
+ * 解析对端:domain 或 Agent Card URL → CounterpartyProfile。
239
+ * 无可用通道候选时抛 DiscoveryError(fail-closed,不返回空档案)。
240
+ */
241
+ async resolve(input) {
242
+ const url = this.cardUrlFor(input);
243
+ // WP3 双发现入口(domain 输入):
244
+ // 1. 先试 /.well-known/ucp(UcpResolver 内含 HTTPS-only / SSRF / 重定向 /
245
+ // Cache-Control / 结构校验,全部 fail-closed);
246
+ // 2. 成功且校验后 profile 含 a2a transport → 用其 endpoint(Agent Card URL)
247
+ // 继续拉 Agent Card;任何失败 → 回退 /.well-known/agent-card.json。
248
+ // 回退不违反不变量 21:UCP 与 Agent Card 是权限等价的两个标准发现入口,
249
+ // 不变量 21 约束的是通道候选的一次性选择,不是发现入口。
250
+ let ucpProfile;
251
+ let ucpIntersection;
252
+ let ucpFallbackReason;
253
+ let cardUrl = url;
254
+ if (input.domain !== undefined && this.ucpResolver !== undefined) {
255
+ try {
256
+ const ucpResult = await this.ucpResolver.resolve({ domain: input.domain });
257
+ const endpoint = findA2aTransportEndpoint(ucpResult.profile);
258
+ if (endpoint === undefined) {
259
+ ucpFallbackReason =
260
+ "UCP profile is valid but declares no a2a transport endpoint (fallback to well-known Agent Card)";
261
+ }
262
+ else {
263
+ cardUrl = endpoint;
264
+ ucpProfile = ucpResult.profile;
265
+ if (this.ucpLocalProfile !== undefined) {
266
+ ucpIntersection = intersectionView(computeCapabilityIntersection(ucpResult.profile, this.ucpLocalProfile));
267
+ }
268
+ }
269
+ }
270
+ catch (err) {
271
+ const detail = isUcpError(err)
272
+ ? `ucp:${err.code}`
273
+ : `ucp:unexpected:${err instanceof Error ? err.message : String(err)}`;
274
+ ucpFallbackReason = `${detail} (fallback to well-known Agent Card)`;
275
+ }
276
+ }
277
+ const raw = await this.fetchCard(cardUrl);
278
+ let card;
279
+ try {
280
+ card = parseAgentCard(raw);
281
+ }
282
+ catch (err) {
283
+ if (err instanceof AgentCardError) {
284
+ throw new DiscoveryError(err.code === "secret_found" ? "card_has_secret" : "card_invalid", `Agent Card failed validation: ${err.message}`);
285
+ }
286
+ throw new DiscoveryError("card_invalid", `Agent Card failed validation: ${err instanceof Error ? err.message : String(err)}`);
287
+ }
288
+ const { intersection, candidates } = this.channelCandidates(card);
289
+ if (candidates.length === 0) {
290
+ throw new DiscoveryError("no_channel_candidate", `no usable channel candidate for Agent Card "${card.name}": no compatible A2A binding and no hosted/platform configured (fail-closed)`);
291
+ }
292
+ return {
293
+ identity: this.identityFor(card),
294
+ source: input.agentCardUrl !== undefined
295
+ ? `card:${input.agentCardUrl}`
296
+ : `domain:${input.domain ?? url}`,
297
+ agent_card: card,
298
+ intersection,
299
+ channel_candidates: candidates,
300
+ ...(ucpProfile !== undefined ? { ucp_profile: ucpProfile } : {}),
301
+ ...(ucpIntersection !== undefined ? { ucp_intersection: ucpIntersection } : {}),
302
+ ...(ucpFallbackReason !== undefined ? { ucp_fallback_reason: ucpFallbackReason } : {}),
303
+ };
304
+ }
305
+ /**
306
+ * 通过 Commerce Agent Catalog 发现并升级对端(v2.3,设计 §21 / MVP Slice A/B)。
307
+ *
308
+ * 流程:searchCandidates → 按 TrustPolicy 过滤 blocked 状态 → 对每个候选按其
309
+ * `discovery.agent_card_url` 或 `merchant.domain` 走现有 resolve() 做 fresh
310
+ * verification → 按候选 hosting.mode 收窄通道候选(不自动降级)→ 返回
311
+ * `{ candidate, profile }`。
312
+ *
313
+ * 关键语义(契约 §1 / 设计 §8.2):catalog 候选**不是**已证明的在线身份。
314
+ * 本方法绝不直接信任候选元数据构造档案,profile 必须来自 resolve() 实时拉取
315
+ * 校验的 Agent Card。没有 agent_card_url / merchant.domain 的候选无法 fresh
316
+ * verify → 跳过(不产出档案)。filtered 后无可用通道候选 → 跳过(不降级)。
317
+ *
318
+ * fail-closed(§4.6):任一候选的 fresh resolve 失败(fetch / 校验 / 无通道)
319
+ * 直接抛错,不静默丢弃;blocked 状态候选默认过滤,includeBlocked: true 显式放宽。
320
+ *
321
+ * @param query 覆盖 DiscoveryDeps.catalog.query 的搜索查询。
322
+ */
323
+ async resolveViaCatalog(query) {
324
+ const catalogDeps = this.deps.catalog;
325
+ if (catalogDeps === undefined) {
326
+ throw new DiscoveryError("invalid_input", "resolveViaCatalog requires a catalog source in DiscoveryDeps.catalog");
327
+ }
328
+ const candidates = await catalogDeps.source.searchCandidates(query ?? catalogDeps.query ?? {});
329
+ const results = [];
330
+ for (const candidate of candidates) {
331
+ if (!this.isCatalogCandidateAllowed(candidate))
332
+ continue;
333
+ const input = this.resolveInputForCandidate(candidate);
334
+ if (input === undefined)
335
+ continue;
336
+ // 现有 resolve() 实时拉取校验(fresh verification)。失败 propagate。
337
+ const profile = await this.resolve(input);
338
+ const channelCandidates = applyHostingMode(profile.channel_candidates, normalizeHostingMode(candidate.hosting.mode));
339
+ if (channelCandidates.length === 0)
340
+ continue;
341
+ results.push({ candidate, profile: { ...profile, channel_candidates: channelCandidates } });
342
+ }
343
+ return results;
344
+ }
345
+ /** blocked verification.status 过滤;includeBlocked 显式放宽(文档注明)。 */
346
+ isCatalogCandidateAllowed(candidate) {
347
+ if (this.deps.catalog?.includeBlocked === true)
348
+ return true;
349
+ return !BLOCKED_CATALOG_VERIFICATION_STATUSES.has(candidate.verification.status);
350
+ }
351
+ /**
352
+ * 候选 → resolve() 输入。优先 agent_card_url,其次 merchant.domain;
353
+ * 两者都缺 → undefined(无法 fresh verify,跳过)。
354
+ */
355
+ resolveInputForCandidate(candidate) {
356
+ const agentCardUrl = candidate.discovery?.agent_card_url;
357
+ if (agentCardUrl !== undefined && agentCardUrl.length > 0) {
358
+ return { agentCardUrl };
359
+ }
360
+ const domain = candidate.merchant?.domain;
361
+ if (domain !== undefined && domain.length > 0) {
362
+ return { domain };
363
+ }
364
+ return undefined;
365
+ }
366
+ }
367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.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * UCP resolver / validator 错误。错误码对齐 UCP 错误表(profile_* 系列)。
18
+ * fail-closed(§4.6):任何无法证明合法的 profile 都拒绝。
19
+ */
20
+ export type UcpErrorCode = "invalid_input" | "profile_not_https" | "profile_redirect" | "profile_unreachable" | "profile_bad_status" | "profile_cache_control" | "profile_malformed" | "unsafe_target";
21
+ export declare class UcpError extends Error {
22
+ readonly code: UcpErrorCode;
23
+ constructor(code: UcpErrorCode, message: string);
24
+ }
25
+ export declare function isUcpError(err: unknown): err is UcpError;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright 2026 harrylabsj
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export class UcpError extends Error {
17
+ code;
18
+ constructor(code, message) {
19
+ super(message);
20
+ this.name = "UcpError";
21
+ this.code = code;
22
+ }
23
+ }
24
+ export function isUcpError(err) {
25
+ return err instanceof UcpError;
26
+ }
27
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/discovery/ucp/error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiBH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,IAAI,CAAe;IAC5B,YAAY,IAAkB,EAAE,OAAe;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,MAAM,UAAU,UAAU,CAAC,GAAY;IACrC,OAAO,GAAG,YAAY,QAAQ,CAAC;AACjC,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright 2026 harrylabsj
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * discovery/ucp — UCP Profile(UCP 2026-04-08 spec family,基线 §3.2 / §25 / §43)。
18
+ *
19
+ * WP1:UCP Profile 模型 + resolver。后续 WP3 通过 discovery/resolve.ts 集成
20
+ * (本 WP 不改动 resolve.ts)。
21
+ */
22
+ export { UcpError, isUcpError } from "./error.js";
23
+ export type { UcpErrorCode } from "./error.js";
24
+ export { computeCapabilityIntersection, intersectionView, requireCapabilitiesCompatible, selectRelevantCapabilities, validateRequiresConstraint, } from "./intersect.js";
25
+ export type { ActiveCapability, CapabilityExclusionReason, CapabilityIntersectionResult, ExcludedCapability, RequiresValidationResult, UcpIntersectionView, UcpRequiresConstraint, UcpRequiresVersionBounds, UcpCapabilityWithRequires, } from "./intersect.js";
26
+ export { validateUcpProfile } from "./validate.js";
27
+ export type { UcpRejectedEntry, UcpRejectionCode, UcpValidationResult } from "./validate.js";
28
+ export { UcpResolver, parseCacheControl, WELL_KNOWN_UCP_PATH } from "./resolver.js";
29
+ export type { CacheControlParse, UcpResolveInput, UcpResolveResult, UcpResolverOptions, } from "./resolver.js";
30
+ export { buildKiwiNegotiationCapability, buildKiwiVendorProfile, KIWI_NEGOTIATION_SCHEMA_PATH, KIWI_NEGOTIATION_SPEC_PATH, KIWI_VENDOR_AUTHORITY, KIWI_VENDOR_CAPABILITY_NAME, KIWI_VENDOR_SERVICE_NAME, } from "./vendor.js";
31
+ export type { KiwiVendorBuildOptions, KiwiVendorCapability, KiwiVendorProfileOptions, } from "./vendor.js";
32
+ export { UCP_TRANSPORTS, isDnsLabel, isHttpsUrl, originHostFor, parseCapabilityNamespace, parseServiceNamespace, reverseDomainToAuthority, } from "./types.js";
33
+ export type { UcpCapabilityDeclaration, UcpNamespaceParts, UcpProfile, UcpServiceDeclaration, UcpSigningKey, UcpTransport, } from "./types.js";