@harrylabsj/kiwi 0.12.31 → 0.12.33

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 (467) hide show
  1. package/README.md +8 -0
  2. package/dist/a2a/inquiry-nonce-store.d.ts +12 -1
  3. package/dist/a2a/inquiry-nonce-store.js +49 -17
  4. package/dist/a2a/inquiry-nonce-store.js.map +1 -1
  5. package/dist/a2a/negotiate.d.ts +30 -1
  6. package/dist/a2a/negotiate.js +121 -32
  7. package/dist/a2a/negotiate.js.map +1 -1
  8. package/dist/a2a/node.d.ts +4 -0
  9. package/dist/a2a/node.js +182 -4
  10. package/dist/a2a/node.js.map +1 -1
  11. package/dist/a2a/open-inquiry-session.d.ts +1 -0
  12. package/dist/a2a/open-inquiry-session.js +3 -1
  13. package/dist/a2a/open-inquiry-session.js.map +1 -1
  14. package/dist/a2a/open-inquiry-verifier.js +2 -2
  15. package/dist/a2a/open-inquiry-verifier.js.map +1 -1
  16. package/dist/a2a/reception/agent-runtime.d.ts +32 -1
  17. package/dist/a2a/reception/agent-runtime.js +420 -11
  18. package/dist/a2a/reception/agent-runtime.js.map +1 -1
  19. package/dist/a2a/reception/customer-memory-tools.d.ts +73 -0
  20. package/dist/a2a/reception/customer-memory-tools.js +17 -0
  21. package/dist/a2a/reception/customer-memory-tools.js.map +1 -0
  22. package/dist/a2a/reception/engine.d.ts +12 -0
  23. package/dist/a2a/reception/engine.js +42 -1
  24. package/dist/a2a/reception/engine.js.map +1 -1
  25. package/dist/a2a/reception/publish.d.ts +14 -1
  26. package/dist/a2a/reception/publish.js +62 -1
  27. package/dist/a2a/reception/publish.js.map +1 -1
  28. package/dist/a2a/reception/question-spec.d.ts +91 -0
  29. package/dist/a2a/reception/question-spec.js +260 -0
  30. package/dist/a2a/reception/question-spec.js.map +1 -0
  31. package/dist/a2a/reception/reply-outbox.d.ts +6 -0
  32. package/dist/a2a/reception/reply-outbox.js +44 -0
  33. package/dist/a2a/reception/reply-outbox.js.map +1 -1
  34. package/dist/a2a/reception/responder.d.ts +13 -1
  35. package/dist/a2a/reception/responder.js +26 -3
  36. package/dist/a2a/reception/responder.js.map +1 -1
  37. package/dist/a2a/reception/skill-catalog.d.ts +72 -0
  38. package/dist/a2a/reception/skill-catalog.js +85 -0
  39. package/dist/a2a/reception/skill-catalog.js.map +1 -0
  40. package/dist/a2a/reception/skill-contract.d.ts +70 -0
  41. package/dist/a2a/reception/skill-contract.js +183 -0
  42. package/dist/a2a/reception/skill-contract.js.map +1 -0
  43. package/dist/a2a/reception/types.d.ts +12 -0
  44. package/dist/a2a/server/customer-identity-gateway.d.ts +111 -0
  45. package/dist/a2a/server/customer-identity-gateway.js +441 -0
  46. package/dist/a2a/server/customer-identity-gateway.js.map +1 -0
  47. package/dist/a2a/server/errors.d.ts +4 -3
  48. package/dist/a2a/server/errors.js +10 -2
  49. package/dist/a2a/server/errors.js.map +1 -1
  50. package/dist/a2a/server/merchant-handler.d.ts +75 -1
  51. package/dist/a2a/server/merchant-handler.js +676 -86
  52. package/dist/a2a/server/merchant-handler.js.map +1 -1
  53. package/dist/a2a/server/merchant-procurement.d.ts +90 -0
  54. package/dist/a2a/server/merchant-procurement.js +75 -0
  55. package/dist/a2a/server/merchant-procurement.js.map +1 -0
  56. package/dist/a2a/server/merchant-product-facts.d.ts +2 -0
  57. package/dist/a2a/server/merchant-product-facts.js.map +1 -1
  58. package/dist/a2a/server/negotiation-approvals.d.ts +11 -0
  59. package/dist/a2a/server/negotiation-approvals.js +43 -0
  60. package/dist/a2a/server/negotiation-approvals.js.map +1 -1
  61. package/dist/a2a/server/pipeline.js +78 -30
  62. package/dist/a2a/server/pipeline.js.map +1 -1
  63. package/dist/a2a/server/server.js +4 -3
  64. package/dist/a2a/server/server.js.map +1 -1
  65. package/dist/a2a/server/types.d.ts +4 -1
  66. package/dist/a2a/unit-alias.d.ts +3 -3
  67. package/dist/a2a/unit-alias.js +9 -5
  68. package/dist/a2a/unit-alias.js.map +1 -1
  69. package/dist/agent/alipay-native-view.d.ts +27 -0
  70. package/dist/agent/alipay-native-view.js +113 -0
  71. package/dist/agent/alipay-native-view.js.map +1 -0
  72. package/dist/agent/buyer/buyer-tools.d.ts +20 -0
  73. package/dist/agent/buyer/buyer-tools.js +241 -48
  74. package/dist/agent/buyer/buyer-tools.js.map +1 -1
  75. package/dist/agent/buyer/types.d.ts +1 -1
  76. package/dist/agent/buyer/types.js.map +1 -1
  77. package/dist/agent/chat-tui.js +16 -1
  78. package/dist/agent/chat-tui.js.map +1 -1
  79. package/dist/agent/kernel-builder.d.ts +2 -0
  80. package/dist/agent/kernel-builder.js +14 -0
  81. package/dist/agent/kernel-builder.js.map +1 -1
  82. package/dist/agent/kernel.d.ts +8 -0
  83. package/dist/agent/kernel.js +67 -1
  84. package/dist/agent/kernel.js.map +1 -1
  85. package/dist/auth/merchant-sessions.d.ts +3 -0
  86. package/dist/auth/merchant-sessions.js +21 -5
  87. package/dist/auth/merchant-sessions.js.map +1 -1
  88. package/dist/buyer-core/a2a-accept-terms.d.ts +11 -0
  89. package/dist/buyer-core/a2a-accept-terms.js +28 -0
  90. package/dist/buyer-core/a2a-accept-terms.js.map +1 -0
  91. package/dist/buyer-core/a2a-knp.d.ts +7 -2
  92. package/dist/buyer-core/a2a-knp.js +8 -5
  93. package/dist/buyer-core/a2a-knp.js.map +1 -1
  94. package/dist/buyer-core/a2a-negotiator.d.ts +17 -0
  95. package/dist/buyer-core/a2a-negotiator.js +70 -26
  96. package/dist/buyer-core/a2a-negotiator.js.map +1 -1
  97. package/dist/buyer-core/a2a-quote-fetcher.d.ts +25 -15
  98. package/dist/buyer-core/a2a-quote-fetcher.js +92 -19
  99. package/dist/buyer-core/a2a-quote-fetcher.js.map +1 -1
  100. package/dist/buyer-core/a2a-quote-history.d.ts +94 -0
  101. package/dist/buyer-core/a2a-quote-history.js +149 -0
  102. package/dist/buyer-core/a2a-quote-history.js.map +1 -0
  103. package/dist/buyer-core/build-service.d.ts +19 -0
  104. package/dist/buyer-core/build-service.js +30 -1
  105. package/dist/buyer-core/build-service.js.map +1 -1
  106. package/dist/buyer-core/errors.d.ts +1 -1
  107. package/dist/buyer-core/errors.js +1 -0
  108. package/dist/buyer-core/errors.js.map +1 -1
  109. package/dist/buyer-core/merchant-index.d.ts +2 -2
  110. package/dist/buyer-core/merchant-index.js +23 -5
  111. package/dist/buyer-core/merchant-index.js.map +1 -1
  112. package/dist/buyer-core/open-inquiry-signer.d.ts +1 -0
  113. package/dist/buyer-core/open-inquiry-signer.js +5 -2
  114. package/dist/buyer-core/open-inquiry-signer.js.map +1 -1
  115. package/dist/buyer-core/procurement/cases.d.ts +441 -0
  116. package/dist/buyer-core/procurement/cases.js +457 -0
  117. package/dist/buyer-core/procurement/cases.js.map +1 -0
  118. package/dist/buyer-core/procurement/quote-comparison.d.ts +137 -0
  119. package/dist/buyer-core/procurement/quote-comparison.js +106 -0
  120. package/dist/buyer-core/procurement/quote-comparison.js.map +1 -0
  121. package/dist/buyer-core/procurement/quote-normalizer.d.ts +45 -0
  122. package/dist/buyer-core/procurement/quote-normalizer.js +153 -0
  123. package/dist/buyer-core/procurement/quote-normalizer.js.map +1 -0
  124. package/dist/buyer-core/procurement/requirements.d.ts +50 -0
  125. package/dist/buyer-core/procurement/requirements.js +43 -0
  126. package/dist/buyer-core/procurement/requirements.js.map +1 -0
  127. package/dist/buyer-core/procurement/source-observation.d.ts +57 -0
  128. package/dist/buyer-core/procurement/source-observation.js +54 -0
  129. package/dist/buyer-core/procurement/source-observation.js.map +1 -0
  130. package/dist/buyer-core/procurement/store.d.ts +21 -0
  131. package/dist/buyer-core/procurement/store.js +68 -0
  132. package/dist/buyer-core/procurement/store.js.map +1 -0
  133. package/dist/buyer-core/protocol-recovery.d.ts +10 -1
  134. package/dist/buyer-core/protocol-recovery.js +31 -6
  135. package/dist/buyer-core/protocol-recovery.js.map +1 -1
  136. package/dist/buyer-core/quote-quantity.d.ts +5 -0
  137. package/dist/buyer-core/quote-quantity.js +15 -0
  138. package/dist/buyer-core/quote-quantity.js.map +1 -0
  139. package/dist/buyer-core/service.d.ts +128 -8
  140. package/dist/buyer-core/service.js +543 -75
  141. package/dist/buyer-core/service.js.map +1 -1
  142. package/dist/buyer-core/store.d.ts +21 -0
  143. package/dist/buyer-core/store.js +62 -10
  144. package/dist/buyer-core/store.js.map +1 -1
  145. package/dist/cli.js +26 -19
  146. package/dist/cli.js.map +1 -1
  147. package/dist/cloud/alipay-collection-http.d.ts +44 -0
  148. package/dist/cloud/alipay-collection-http.js +111 -0
  149. package/dist/cloud/alipay-collection-http.js.map +1 -0
  150. package/dist/cloud/bootstrap.js +218 -19
  151. package/dist/cloud/bootstrap.js.map +1 -1
  152. package/dist/cloud/http-router.d.ts +2 -0
  153. package/dist/cloud/http-router.js +5 -0
  154. package/dist/cloud/http-router.js.map +1 -1
  155. package/dist/commerce/receipt/dispatcher.d.ts +43 -0
  156. package/dist/commerce/receipt/dispatcher.js +86 -0
  157. package/dist/commerce/receipt/dispatcher.js.map +1 -0
  158. package/dist/commerce/receipt/receipts.d.ts +147 -0
  159. package/dist/commerce/receipt/receipts.js +285 -0
  160. package/dist/commerce/receipt/receipts.js.map +1 -0
  161. package/dist/config/profile.d.ts +2 -2
  162. package/dist/discovery/catalog-source/buyer-follows.d.ts +3 -3
  163. package/dist/discovery/catalog-source/buyer-follows.js +6 -3
  164. package/dist/discovery/catalog-source/buyer-follows.js.map +1 -1
  165. package/dist/discovery/catalog-source/kiwi-record.d.ts +2 -0
  166. package/dist/discovery/catalog-source/kiwi-record.js.map +1 -1
  167. package/dist/discovery/catalog-source/kiwi-source.js +4 -0
  168. package/dist/discovery/catalog-source/kiwi-source.js.map +1 -1
  169. package/dist/handoff/alipay-collection.d.ts +23 -0
  170. package/dist/handoff/alipay-collection.js +70 -0
  171. package/dist/handoff/alipay-collection.js.map +1 -0
  172. package/dist/handoff/order-receipts.d.ts +62 -0
  173. package/dist/handoff/order-receipts.js +72 -0
  174. package/dist/handoff/order-receipts.js.map +1 -0
  175. package/dist/handoff/ucp-checkout/cart-channel.d.ts +2 -1
  176. package/dist/handoff/ucp-checkout/cart-channel.js +1 -0
  177. package/dist/handoff/ucp-checkout/cart-channel.js.map +1 -1
  178. package/dist/handoff/ucp-checkout/channel.d.ts +7 -0
  179. package/dist/handoff/ucp-checkout/channel.js +79 -10
  180. package/dist/handoff/ucp-checkout/channel.js.map +1 -1
  181. package/dist/http/cli.js +6 -0
  182. package/dist/http/cli.js.map +1 -1
  183. package/dist/http/merchant-management/api.d.ts +18 -0
  184. package/dist/http/merchant-management/api.js +752 -3
  185. package/dist/http/merchant-management/api.js.map +1 -1
  186. package/dist/http/merchant-management/draft-store.js +8 -6
  187. package/dist/http/merchant-management/draft-store.js.map +1 -1
  188. package/dist/http/merchant-management/page.d.ts +1 -0
  189. package/dist/http/merchant-management/page.js +335 -5
  190. package/dist/http/merchant-management/page.js.map +1 -1
  191. package/dist/http/server.js +9 -2
  192. package/dist/http/server.js.map +1 -1
  193. package/dist/mcp/cli.d.ts +3 -1
  194. package/dist/mcp/cli.js +18 -2
  195. package/dist/mcp/cli.js.map +1 -1
  196. package/dist/mcp/merchant-runtime-assembly.d.ts +20 -0
  197. package/dist/mcp/merchant-runtime-assembly.js +94 -11
  198. package/dist/mcp/merchant-runtime-assembly.js.map +1 -1
  199. package/dist/mcp/merchant-server.d.ts +5 -0
  200. package/dist/mcp/merchant-server.js +12 -0
  201. package/dist/mcp/merchant-server.js.map +1 -1
  202. package/dist/mcp/procurement-tools.d.ts +10 -0
  203. package/dist/mcp/procurement-tools.js +173 -0
  204. package/dist/mcp/procurement-tools.js.map +1 -0
  205. package/dist/mcp/server.d.ts +4 -0
  206. package/dist/mcp/server.js +63 -9
  207. package/dist/mcp/server.js.map +1 -1
  208. package/dist/mcp/tools.d.ts +4 -1
  209. package/dist/mcp/tools.js +83 -28
  210. package/dist/mcp/tools.js.map +1 -1
  211. package/dist/mcp/types.d.ts +1 -0
  212. package/dist/mcp/types.js.map +1 -1
  213. package/dist/merchant/application/actor.d.ts +3 -1
  214. package/dist/merchant/application/actor.js +21 -0
  215. package/dist/merchant/application/actor.js.map +1 -1
  216. package/dist/merchant/negotiation-ops.d.ts +2 -0
  217. package/dist/merchant/negotiation-ops.js +4 -0
  218. package/dist/merchant/negotiation-ops.js.map +1 -1
  219. package/dist/merchant/weixin-channel.d.ts +68 -0
  220. package/dist/merchant/weixin-channel.js +313 -0
  221. package/dist/merchant/weixin-channel.js.map +1 -0
  222. package/dist/merchant/workbench-server.d.ts +1 -0
  223. package/dist/merchant/workbench-server.js +189 -2
  224. package/dist/merchant/workbench-server.js.map +1 -1
  225. package/dist/merchant-core/budget/background-budget.d.ts +132 -0
  226. package/dist/merchant-core/budget/background-budget.js +308 -0
  227. package/dist/merchant-core/budget/background-budget.js.map +1 -0
  228. package/dist/merchant-core/collection/alipay-store.d.ts +22 -0
  229. package/dist/merchant-core/collection/alipay-store.js +125 -0
  230. package/dist/merchant-core/collection/alipay-store.js.map +1 -0
  231. package/dist/merchant-core/commercial/calculate.js +6 -6
  232. package/dist/merchant-core/commercial/calculate.js.map +1 -1
  233. package/dist/merchant-core/context-governance/actor-context.d.ts +56 -0
  234. package/dist/merchant-core/context-governance/actor-context.js +76 -0
  235. package/dist/merchant-core/context-governance/actor-context.js.map +1 -0
  236. package/dist/merchant-core/context-governance/authority.d.ts +39 -0
  237. package/dist/merchant-core/context-governance/authority.js +28 -0
  238. package/dist/merchant-core/context-governance/authority.js.map +1 -0
  239. package/dist/merchant-core/context-governance/context-guard.d.ts +104 -0
  240. package/dist/merchant-core/context-governance/context-guard.js +194 -0
  241. package/dist/merchant-core/context-governance/context-guard.js.map +1 -0
  242. package/dist/merchant-core/context-governance/data-use-grant.d.ts +91 -0
  243. package/dist/merchant-core/context-governance/data-use-grant.js +211 -0
  244. package/dist/merchant-core/context-governance/data-use-grant.js.map +1 -0
  245. package/dist/merchant-core/context-governance/feature-flags.d.ts +32 -0
  246. package/dist/merchant-core/context-governance/feature-flags.js +83 -0
  247. package/dist/merchant-core/context-governance/feature-flags.js.map +1 -0
  248. package/dist/merchant-core/context-governance/pilot-readiness.d.ts +39 -0
  249. package/dist/merchant-core/context-governance/pilot-readiness.js +141 -0
  250. package/dist/merchant-core/context-governance/pilot-readiness.js.map +1 -0
  251. package/dist/merchant-core/context-governance/source-governance.d.ts +157 -0
  252. package/dist/merchant-core/context-governance/source-governance.js +492 -0
  253. package/dist/merchant-core/context-governance/source-governance.js.map +1 -0
  254. package/dist/merchant-core/context-governance/types.d.ts +62 -0
  255. package/dist/merchant-core/context-governance/types.js +92 -0
  256. package/dist/merchant-core/context-governance/types.js.map +1 -0
  257. package/dist/merchant-core/customer-delivery/binding.d.ts +55 -0
  258. package/dist/merchant-core/customer-delivery/binding.js +121 -0
  259. package/dist/merchant-core/customer-delivery/binding.js.map +1 -0
  260. package/dist/merchant-core/customer-delivery/channel.d.ts +75 -0
  261. package/dist/merchant-core/customer-delivery/channel.js +157 -0
  262. package/dist/merchant-core/customer-delivery/channel.js.map +1 -0
  263. package/dist/merchant-core/customer-delivery/consent-repository.d.ts +50 -0
  264. package/dist/merchant-core/customer-delivery/consent-repository.js +160 -0
  265. package/dist/merchant-core/customer-delivery/consent-repository.js.map +1 -0
  266. package/dist/merchant-core/customer-delivery/dispatcher-loop.d.ts +68 -0
  267. package/dist/merchant-core/customer-delivery/dispatcher-loop.js +132 -0
  268. package/dist/merchant-core/customer-delivery/dispatcher-loop.js.map +1 -0
  269. package/dist/merchant-core/customer-delivery/dispatcher.d.ts +118 -0
  270. package/dist/merchant-core/customer-delivery/dispatcher.js +166 -0
  271. package/dist/merchant-core/customer-delivery/dispatcher.js.map +1 -0
  272. package/dist/merchant-core/customer-delivery/email-adapter.d.ts +31 -0
  273. package/dist/merchant-core/customer-delivery/email-adapter.js +90 -0
  274. package/dist/merchant-core/customer-delivery/email-adapter.js.map +1 -0
  275. package/dist/merchant-core/customer-delivery/gate.d.ts +37 -0
  276. package/dist/merchant-core/customer-delivery/gate.js +196 -0
  277. package/dist/merchant-core/customer-delivery/gate.js.map +1 -0
  278. package/dist/merchant-core/customer-delivery/reconciliation.d.ts +13 -0
  279. package/dist/merchant-core/customer-delivery/reconciliation.js +70 -0
  280. package/dist/merchant-core/customer-delivery/reconciliation.js.map +1 -0
  281. package/dist/merchant-core/customer-delivery/repository.d.ts +55 -0
  282. package/dist/merchant-core/customer-delivery/repository.js +235 -0
  283. package/dist/merchant-core/customer-delivery/repository.js.map +1 -0
  284. package/dist/merchant-core/customer-delivery/smtp-adapter.d.ts +30 -0
  285. package/dist/merchant-core/customer-delivery/smtp-adapter.js +183 -0
  286. package/dist/merchant-core/customer-delivery/smtp-adapter.js.map +1 -0
  287. package/dist/merchant-core/customer-delivery/stream-gate.d.ts +45 -0
  288. package/dist/merchant-core/customer-delivery/stream-gate.js +123 -0
  289. package/dist/merchant-core/customer-delivery/stream-gate.js.map +1 -0
  290. package/dist/merchant-core/customer-delivery/types.d.ts +103 -0
  291. package/dist/merchant-core/customer-delivery/types.js +32 -0
  292. package/dist/merchant-core/customer-delivery/types.js.map +1 -0
  293. package/dist/merchant-core/customer-delivery/weixin-adapter.d.ts +35 -0
  294. package/dist/merchant-core/customer-delivery/weixin-adapter.js +56 -0
  295. package/dist/merchant-core/customer-delivery/weixin-adapter.js.map +1 -0
  296. package/dist/merchant-core/customer-memory/auto-identity.d.ts +43 -0
  297. package/dist/merchant-core/customer-memory/auto-identity.js +163 -0
  298. package/dist/merchant-core/customer-memory/auto-identity.js.map +1 -0
  299. package/dist/merchant-core/customer-memory/grants.d.ts +72 -0
  300. package/dist/merchant-core/customer-memory/grants.js +224 -0
  301. package/dist/merchant-core/customer-memory/grants.js.map +1 -0
  302. package/dist/merchant-core/customer-memory/history.d.ts +51 -0
  303. package/dist/merchant-core/customer-memory/history.js +252 -0
  304. package/dist/merchant-core/customer-memory/history.js.map +1 -0
  305. package/dist/merchant-core/customer-memory/identity.d.ts +66 -0
  306. package/dist/merchant-core/customer-memory/identity.js +249 -0
  307. package/dist/merchant-core/customer-memory/identity.js.map +1 -0
  308. package/dist/merchant-core/customer-memory/maintenance.d.ts +51 -0
  309. package/dist/merchant-core/customer-memory/maintenance.js +67 -0
  310. package/dist/merchant-core/customer-memory/maintenance.js.map +1 -0
  311. package/dist/merchant-core/customer-memory/memory.d.ts +119 -0
  312. package/dist/merchant-core/customer-memory/memory.js +502 -0
  313. package/dist/merchant-core/customer-memory/memory.js.map +1 -0
  314. package/dist/merchant-core/customer-memory/private-transport.d.ts +10 -0
  315. package/dist/merchant-core/customer-memory/private-transport.js +108 -0
  316. package/dist/merchant-core/customer-memory/private-transport.js.map +1 -0
  317. package/dist/merchant-core/customer-memory/quote-history.d.ts +160 -0
  318. package/dist/merchant-core/customer-memory/quote-history.js +392 -0
  319. package/dist/merchant-core/customer-memory/quote-history.js.map +1 -0
  320. package/dist/merchant-core/customer-memory/reception-provider.d.ts +69 -0
  321. package/dist/merchant-core/customer-memory/reception-provider.js +250 -0
  322. package/dist/merchant-core/customer-memory/reception-provider.js.map +1 -0
  323. package/dist/merchant-core/customer-memory/reception-writer.d.ts +19 -0
  324. package/dist/merchant-core/customer-memory/reception-writer.js +32 -0
  325. package/dist/merchant-core/customer-memory/reception-writer.js.map +1 -0
  326. package/dist/merchant-core/customer-memory/types.d.ts +111 -0
  327. package/dist/merchant-core/customer-memory/types.js +58 -0
  328. package/dist/merchant-core/customer-memory/types.js.map +1 -0
  329. package/dist/merchant-core/followup/repository.d.ts +2 -1
  330. package/dist/merchant-core/followup/repository.js +29 -23
  331. package/dist/merchant-core/followup/repository.js.map +1 -1
  332. package/dist/merchant-core/learning/evaluation-fixtures.d.ts +38 -0
  333. package/dist/merchant-core/learning/evaluation-fixtures.js +83 -0
  334. package/dist/merchant-core/learning/evaluation-fixtures.js.map +1 -0
  335. package/dist/merchant-core/learning/evaluation-suite-v1.d.ts +56 -0
  336. package/dist/merchant-core/learning/evaluation-suite-v1.js +129 -0
  337. package/dist/merchant-core/learning/evaluation-suite-v1.js.map +1 -0
  338. package/dist/merchant-core/learning/evaluation.d.ts +84 -0
  339. package/dist/merchant-core/learning/evaluation.js +581 -0
  340. package/dist/merchant-core/learning/evaluation.js.map +1 -0
  341. package/dist/merchant-core/learning/initial-skills.d.ts +36 -0
  342. package/dist/merchant-core/learning/initial-skills.js +67 -0
  343. package/dist/merchant-core/learning/initial-skills.js.map +1 -0
  344. package/dist/merchant-core/learning/precheck.d.ts +33 -0
  345. package/dist/merchant-core/learning/precheck.js +56 -0
  346. package/dist/merchant-core/learning/precheck.js.map +1 -0
  347. package/dist/merchant-core/learning/real-evaluation-runner.d.ts +52 -0
  348. package/dist/merchant-core/learning/real-evaluation-runner.js +167 -0
  349. package/dist/merchant-core/learning/real-evaluation-runner.js.map +1 -0
  350. package/dist/merchant-core/learning/reception-skill-catalog.d.ts +39 -0
  351. package/dist/merchant-core/learning/reception-skill-catalog.js +145 -0
  352. package/dist/merchant-core/learning/reception-skill-catalog.js.map +1 -0
  353. package/dist/merchant-core/learning/recovery-gateway.d.ts +27 -0
  354. package/dist/merchant-core/learning/recovery-gateway.js +106 -0
  355. package/dist/merchant-core/learning/recovery-gateway.js.map +1 -0
  356. package/dist/merchant-core/learning/repository.d.ts +130 -0
  357. package/dist/merchant-core/learning/repository.js +588 -0
  358. package/dist/merchant-core/learning/repository.js.map +1 -0
  359. package/dist/merchant-core/learning/service.d.ts +262 -0
  360. package/dist/merchant-core/learning/service.js +1498 -0
  361. package/dist/merchant-core/learning/service.js.map +1 -0
  362. package/dist/merchant-core/learning/test-dispatch-gateway.d.ts +43 -0
  363. package/dist/merchant-core/learning/test-dispatch-gateway.js +145 -0
  364. package/dist/merchant-core/learning/test-dispatch-gateway.js.map +1 -0
  365. package/dist/merchant-core/learning/types.d.ts +217 -0
  366. package/dist/merchant-core/learning/types.js +52 -0
  367. package/dist/merchant-core/learning/types.js.map +1 -0
  368. package/dist/merchant-core/migrations/ledgers.d.ts +40 -0
  369. package/dist/merchant-core/migrations/ledgers.js +824 -0
  370. package/dist/merchant-core/migrations/ledgers.js.map +1 -0
  371. package/dist/merchant-core/migrations/runner.d.ts +55 -0
  372. package/dist/merchant-core/migrations/runner.js +114 -0
  373. package/dist/merchant-core/migrations/runner.js.map +1 -0
  374. package/dist/merchant-core/operating/repository.d.ts +0 -1
  375. package/dist/merchant-core/operating/repository.js +2 -17
  376. package/dist/merchant-core/operating/repository.js.map +1 -1
  377. package/dist/merchant-core/operations-jobs/advice-runner.d.ts +63 -0
  378. package/dist/merchant-core/operations-jobs/advice-runner.js +199 -0
  379. package/dist/merchant-core/operations-jobs/advice-runner.js.map +1 -0
  380. package/dist/merchant-core/operations-jobs/pilot-evidence.d.ts +64 -0
  381. package/dist/merchant-core/operations-jobs/pilot-evidence.js +109 -0
  382. package/dist/merchant-core/operations-jobs/pilot-evidence.js.map +1 -0
  383. package/dist/merchant-core/operations-jobs/pilot-metrics.d.ts +70 -0
  384. package/dist/merchant-core/operations-jobs/pilot-metrics.js +98 -0
  385. package/dist/merchant-core/operations-jobs/pilot-metrics.js.map +1 -0
  386. package/dist/merchant-core/operations-jobs/projection.d.ts +41 -0
  387. package/dist/merchant-core/operations-jobs/projection.js +158 -0
  388. package/dist/merchant-core/operations-jobs/projection.js.map +1 -0
  389. package/dist/merchant-core/operations-jobs/scheduler.d.ts +68 -0
  390. package/dist/merchant-core/operations-jobs/scheduler.js +233 -0
  391. package/dist/merchant-core/operations-jobs/scheduler.js.map +1 -0
  392. package/dist/merchant-core/operations-jobs/service.d.ts +260 -0
  393. package/dist/merchant-core/operations-jobs/service.js +922 -0
  394. package/dist/merchant-core/operations-jobs/service.js.map +1 -0
  395. package/dist/merchant-core/opportunity/repository.d.ts +0 -1
  396. package/dist/merchant-core/opportunity/repository.js +2 -17
  397. package/dist/merchant-core/opportunity/repository.js.map +1 -1
  398. package/dist/merchant-core/ops/facade.d.ts +10 -0
  399. package/dist/merchant-core/ops/facade.js +52 -0
  400. package/dist/merchant-core/ops/facade.js.map +1 -1
  401. package/dist/merchant-core/ops/schema.d.ts +1 -1
  402. package/dist/merchant-core/ops/schema.js +119 -2
  403. package/dist/merchant-core/ops/schema.js.map +1 -1
  404. package/dist/merchant-core/ops/surface.d.ts +37 -0
  405. package/dist/merchant-core/ops/surface.js +240 -0
  406. package/dist/merchant-core/ops/surface.js.map +1 -1
  407. package/dist/merchant-core/orders/model.d.ts +1 -8
  408. package/dist/merchant-core/orders/model.js +10 -2
  409. package/dist/merchant-core/orders/model.js.map +1 -1
  410. package/dist/merchant-core/orders/repository.d.ts +0 -1
  411. package/dist/merchant-core/orders/repository.js +3 -18
  412. package/dist/merchant-core/orders/repository.js.map +1 -1
  413. package/dist/merchant-core/orders/service.js +34 -8
  414. package/dist/merchant-core/orders/service.js.map +1 -1
  415. package/dist/merchant-core/ownership/instance-ownership.d.ts +122 -0
  416. package/dist/merchant-core/ownership/instance-ownership.js +236 -0
  417. package/dist/merchant-core/ownership/instance-ownership.js.map +1 -0
  418. package/dist/merchant-core/ownership/runtime.d.ts +175 -0
  419. package/dist/merchant-core/ownership/runtime.js +422 -0
  420. package/dist/merchant-core/ownership/runtime.js.map +1 -0
  421. package/dist/merchant-core/proposal/engine.js +2 -0
  422. package/dist/merchant-core/proposal/engine.js.map +1 -1
  423. package/dist/merchant-core/proposal/publish.d.ts +0 -6
  424. package/dist/merchant-core/proposal/publish.js +37 -3
  425. package/dist/merchant-core/proposal/publish.js.map +1 -1
  426. package/dist/merchant-core/proposal/repository.d.ts +0 -7
  427. package/dist/merchant-core/proposal/repository.js +8 -17
  428. package/dist/merchant-core/proposal/repository.js.map +1 -1
  429. package/dist/merchant-core/proposal/types.d.ts +1 -0
  430. package/dist/merchant-core/proposal/types.js.map +1 -1
  431. package/dist/merchant-core/rfq/policy.d.ts +1 -0
  432. package/dist/merchant-core/rfq/policy.js +6 -7
  433. package/dist/merchant-core/rfq/policy.js.map +1 -1
  434. package/dist/merchant-core/rfq/repository.d.ts +0 -1
  435. package/dist/merchant-core/rfq/repository.js +2 -17
  436. package/dist/merchant-core/rfq/repository.js.map +1 -1
  437. package/dist/merchant-core/rfq/service.d.ts +2 -1
  438. package/dist/merchant-core/rfq/service.js +2 -4
  439. package/dist/merchant-core/rfq/service.js.map +1 -1
  440. package/dist/merchant-core/storage/transaction.d.ts +95 -7
  441. package/dist/merchant-core/storage/transaction.js +251 -2
  442. package/dist/merchant-core/storage/transaction.js.map +1 -1
  443. package/dist/merchant-credential-rotation.d.ts +4 -1
  444. package/dist/merchant-credential-rotation.js +12 -8
  445. package/dist/merchant-credential-rotation.js.map +1 -1
  446. package/dist/merchant-runtime/manager.d.ts +2 -0
  447. package/dist/merchant-runtime/manager.js +5 -0
  448. package/dist/merchant-runtime/manager.js.map +1 -1
  449. package/dist/negotiation/domain/objects.d.ts +2 -0
  450. package/dist/negotiation/domain/objects.js +3 -0
  451. package/dist/negotiation/domain/objects.js.map +1 -1
  452. package/dist/negotiation/ledger/store.d.ts +4 -0
  453. package/dist/negotiation/ledger/store.js +20 -0
  454. package/dist/negotiation/ledger/store.js.map +1 -1
  455. package/dist/product-init.d.ts +1 -0
  456. package/dist/product-init.js +4 -1
  457. package/dist/product-init.js.map +1 -1
  458. package/dist/trust/identity/message-signature.d.ts +1 -1
  459. package/dist/trust/identity/message-signature.js +6 -1
  460. package/dist/trust/identity/message-signature.js.map +1 -1
  461. package/dist/trust/identity/nonce.d.ts +5 -0
  462. package/dist/trust/identity/nonce.js +2 -0
  463. package/dist/trust/identity/nonce.js.map +1 -1
  464. package/dist/weixin/ilink-client.d.ts +3 -2
  465. package/dist/weixin/ilink-client.js +9 -2
  466. package/dist/weixin/ilink-client.js.map +1 -1
  467. package/package.json +2 -2
@@ -0,0 +1,106 @@
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
+ * 评测派发终态网关适配(交接报告恢复顺序第 1 步)。
18
+ *
19
+ * 网关必须能按 `dispatch_id` 回答整次评测关联请求的终态,并明确:
20
+ * - completed:返回该次尝试的结果;
21
+ * - not_executed:必须带 `future_execution_blocked=true` 与终态原因,证明
22
+ * 该 dispatch 今后不可能执行;仅 404/超时/查无记录都不算;
23
+ * - unknown:其余情况保持阻塞。
24
+ *
25
+ * 响应必须回传 binding_digest;与本地 binding 不一致时按 unknown 处理。
26
+ * 本模块不记录密钥或原始回执,只在内存中校验。
27
+ */
28
+ import { contentDigest } from "../../negotiation/jcs.js";
29
+ function validOutcome(value) {
30
+ if (value === null || typeof value !== "object" || Array.isArray(value))
31
+ return undefined;
32
+ const record = value;
33
+ if (typeof record.passed !== "boolean")
34
+ return undefined;
35
+ if (!Number.isSafeInteger(record.hard_gate_failures) || record.hard_gate_failures < 0) {
36
+ return undefined;
37
+ }
38
+ if (record.improvement_delta !== undefined &&
39
+ (typeof record.improvement_delta !== "number" || !Number.isFinite(record.improvement_delta))) {
40
+ return undefined;
41
+ }
42
+ return {
43
+ passed: record.passed,
44
+ hard_gate_failures: record.hard_gate_failures,
45
+ ...(typeof record.improvement_delta === "number"
46
+ ? { improvement_delta: record.improvement_delta }
47
+ : {}),
48
+ };
49
+ }
50
+ /** 构造 `recoveryVerifier`;任何网络/契约/摘要异常都返回 unknown(fail-closed)。 */
51
+ export function createRecoveryGatewayVerifier(options) {
52
+ const fetchImpl = options.fetchImpl ?? fetch;
53
+ return async (binding, _evidenceRef) => {
54
+ const controller = new AbortController();
55
+ const timer = setTimeout(() => controller.abort(), options.timeout_ms ?? 15_000);
56
+ try {
57
+ const url = new URL(`evaluations/dispatches/${encodeURIComponent(binding.dispatch_id)}`, options.base_url.endsWith("/") ? options.base_url : `${options.base_url}/`);
58
+ url.searchParams.set("binding_digest", contentDigest(binding));
59
+ const response = await fetchImpl(url, {
60
+ method: "GET",
61
+ headers: { accept: "application/json", ...options.headers },
62
+ signal: controller.signal,
63
+ });
64
+ if (response.status !== 200)
65
+ return { status: "unknown" };
66
+ const body = (await response.json());
67
+ if (body.dispatch_id !== binding.dispatch_id)
68
+ return { status: "unknown" };
69
+ if (body.binding_digest !== contentDigest(binding))
70
+ return { status: "unknown" };
71
+ if (body.status === "not_executed") {
72
+ if (body.future_execution_blocked !== true)
73
+ return { status: "unknown" };
74
+ if (typeof body.terminal_reason !== "string" || body.terminal_reason.trim() === "") {
75
+ return { status: "unknown" };
76
+ }
77
+ return { status: "not_executed", binding };
78
+ }
79
+ if (body.status === "completed") {
80
+ const outcome = validOutcome(body.outcome);
81
+ if (outcome === undefined)
82
+ return { status: "unknown" };
83
+ return { status: "completed", binding, outcome };
84
+ }
85
+ return { status: "unknown" };
86
+ }
87
+ catch {
88
+ return { status: "unknown" };
89
+ }
90
+ finally {
91
+ clearTimeout(timer);
92
+ }
93
+ };
94
+ }
95
+ /** 从环境变量构造;未配置 URL 时返回 undefined(保持原阻塞行为)。 */
96
+ export function createRecoveryGatewayVerifierFromEnv(env = process.env) {
97
+ const baseUrl = String(env.KIWI_EVAL_RECOVERY_GATEWAY_URL ?? "").trim();
98
+ if (baseUrl === "")
99
+ return undefined;
100
+ const token = String(env.KIWI_EVAL_RECOVERY_GATEWAY_TOKEN ?? "").trim();
101
+ return createRecoveryGatewayVerifier({
102
+ base_url: baseUrl,
103
+ ...(token !== "" ? { headers: { authorization: `Bearer ${token}` } } : {}),
104
+ });
105
+ }
106
+ //# sourceMappingURL=recovery-gateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-gateway.js","sourceRoot":"","sources":["../../../src/merchant-core/learning/recovery-gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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AE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3E,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,130 @@
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
+ * 学习域持久化(learning 账本 v1,设计 §18.1 / M2-0)。
18
+ *
19
+ * 所有查询带 merchant 作用域;写入由 service 放进 `inImmediateTransaction`
20
+ * 与幂等复查同事务。本文件不校验业务规则,只做行映射与 SQL。
21
+ */
22
+ import type { DatabaseSync } from "node:sqlite";
23
+ import type { LearningCandidate, LearningCase, LearningCorrection, LearningEvaluation, LearningReview, SkillActivePointer, SkillRelease } from "./types.js";
24
+ export declare class LearningRepository {
25
+ private readonly db;
26
+ constructor(options: {
27
+ db: DatabaseSync;
28
+ });
29
+ transaction<T>(work: () => T): T;
30
+ claimEvaluation(keys: readonly string[], owner: string, digest: string, now: number, ttl: number): void;
31
+ assertEvaluationClaim(keys: readonly string[], owner: string, now: number): void;
32
+ renewEvaluationClaim(keys: readonly string[], owner: string, now: number, ttl: number): void;
33
+ checkEvaluationConfig(key: string, digest: string, legacyRuns: number, nowMs?: number): {
34
+ binding: unknown;
35
+ outcome: unknown;
36
+ } | undefined;
37
+ readEvaluationConfig(key: string): {
38
+ config_digest: string;
39
+ pending_attempt: string | null;
40
+ } | undefined;
41
+ setEvaluationAttempt(key: string, attempt: string | null): void;
42
+ transitionEvaluationAttempt(key: string, expected: string, next: string): void;
43
+ hasActiveEvaluationClaim(key: string, now: number): boolean;
44
+ saveEvaluationReceipt(ref: string, binding: unknown, outcome: unknown): void;
45
+ readEvaluationReceipt(ref: string): {
46
+ binding: unknown;
47
+ outcome: unknown;
48
+ } | undefined;
49
+ deleteEvaluationReceipt(ref: string): void;
50
+ releaseEvaluationClaim(keys: readonly string[], owner: string, completed?: boolean): void;
51
+ /**
52
+ * Retain terminal decision summaries and replay bindings, while removing
53
+ * detailed evaluations and detached receipts after their retention window.
54
+ */
55
+ pruneEvaluationHistory(now: string): {
56
+ evaluations: number;
57
+ receipts: number;
58
+ };
59
+ readCorrection(merchantId: string, correctionId: string): LearningCorrection | undefined;
60
+ listCorrections(merchantId: string, limit: number): LearningCorrection[];
61
+ insertCorrection(record: LearningCorrection): void;
62
+ updateCorrection(record: LearningCorrection): void;
63
+ readCaseByCorrection(merchantId: string, correctionId: string): LearningCase | undefined;
64
+ readCase(merchantId: string, caseId: string): LearningCase | undefined;
65
+ insertCase(record: LearningCase): void;
66
+ updateCase(record: LearningCase): void;
67
+ /** 标记案例失效(纠正已变化);返回受影响行数。 */
68
+ markCaseStale(merchantId: string, caseId: string, now: string): number;
69
+ /** 案例内容变化后旧候选失效(A16)。返回受影响行数。 */
70
+ markCandidatesStaleForCase(merchantId: string, caseId: string, now: string): number;
71
+ readCandidate(merchantId: string, candidateId: string): LearningCandidate | undefined;
72
+ listCandidates(merchantId: string, limit: number): LearningCandidate[];
73
+ insertCandidate(record: LearningCandidate): void;
74
+ updateCandidate(record: LearningCandidate): void;
75
+ /** 重设候选的案例关联(编辑候选时整体替换)。 */
76
+ replaceCandidateCases(input: {
77
+ merchantId: string;
78
+ candidateId: string;
79
+ caseIds: readonly string[];
80
+ now: string;
81
+ }): void;
82
+ private readCandidateCaseIds;
83
+ readEvaluation(merchantId: string, evaluationId: string): LearningEvaluation | undefined;
84
+ findEvaluation(merchantId: string, candidateId: string, artifactHash: string, suiteVersion: string): LearningEvaluation | undefined;
85
+ listEvaluations(merchantId: string, limit: number): LearningEvaluation[];
86
+ insertEvaluation(record: LearningEvaluation): void;
87
+ updateEvaluation(record: LearningEvaluation): void;
88
+ insertReview(record: LearningReview): void;
89
+ readReview(merchantId: string, reviewId: string): LearningReview | undefined;
90
+ readReviewByApproval(merchantId: string, approvalRef: string): LearningReview | undefined;
91
+ listReviews(merchantId: string, limit: number): LearningReview[];
92
+ insertRelease(record: SkillRelease): void;
93
+ updateRelease(record: SkillRelease): void;
94
+ readRelease(merchantId: string, releaseId: string): SkillRelease | undefined;
95
+ findReleaseByApproval(merchantId: string, approvalRef: string): SkillRelease | undefined;
96
+ listReleases(merchantId: string, skillKey: string | undefined, limit: number): SkillRelease[];
97
+ readPointer(merchantId: string, skillKey: string): SkillActivePointer | undefined;
98
+ upsertPointer(record: SkillActivePointer): void;
99
+ appendEvent(input: {
100
+ merchantId: string;
101
+ subjectKind: string;
102
+ subjectId: string;
103
+ event: string;
104
+ detail: unknown;
105
+ createdAt: string;
106
+ }): void;
107
+ /** 最小拒绝登记:仅原因与摘要,不存正文、不含客户数据。 */
108
+ recordRejection(input: {
109
+ merchantId: string;
110
+ actorId: string;
111
+ operation: string;
112
+ reasonCode: string;
113
+ subjectDigest: string;
114
+ createdAt: string;
115
+ }): void;
116
+ countRejections(merchantId: string): number;
117
+ readIdempotent(merchantId: string, actorId: string, operation: string, commandId: string): {
118
+ requestDigest: string;
119
+ result: string;
120
+ } | undefined;
121
+ saveIdempotent(input: {
122
+ merchantId: string;
123
+ actorId: string;
124
+ operation: string;
125
+ commandId: string;
126
+ requestDigest: string;
127
+ result: unknown;
128
+ createdAt: string;
129
+ }): void;
130
+ }