@harrylabsj/kiwi 0.12.30 → 0.12.32

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 (330) hide show
  1. package/dist/a2a/node.d.ts +1 -0
  2. package/dist/a2a/node.js +170 -2
  3. package/dist/a2a/node.js.map +1 -1
  4. package/dist/a2a/reception/agent-runtime.d.ts +32 -1
  5. package/dist/a2a/reception/agent-runtime.js +420 -11
  6. package/dist/a2a/reception/agent-runtime.js.map +1 -1
  7. package/dist/a2a/reception/customer-memory-tools.d.ts +73 -0
  8. package/dist/a2a/reception/customer-memory-tools.js +17 -0
  9. package/dist/a2a/reception/customer-memory-tools.js.map +1 -0
  10. package/dist/a2a/reception/engine.d.ts +12 -0
  11. package/dist/a2a/reception/engine.js +42 -1
  12. package/dist/a2a/reception/engine.js.map +1 -1
  13. package/dist/a2a/reception/publish.d.ts +14 -1
  14. package/dist/a2a/reception/publish.js +62 -1
  15. package/dist/a2a/reception/publish.js.map +1 -1
  16. package/dist/a2a/reception/question-spec.d.ts +91 -0
  17. package/dist/a2a/reception/question-spec.js +260 -0
  18. package/dist/a2a/reception/question-spec.js.map +1 -0
  19. package/dist/a2a/reception/reply-outbox.d.ts +6 -0
  20. package/dist/a2a/reception/reply-outbox.js +44 -0
  21. package/dist/a2a/reception/reply-outbox.js.map +1 -1
  22. package/dist/a2a/reception/responder.d.ts +13 -1
  23. package/dist/a2a/reception/responder.js +26 -3
  24. package/dist/a2a/reception/responder.js.map +1 -1
  25. package/dist/a2a/reception/skill-catalog.d.ts +72 -0
  26. package/dist/a2a/reception/skill-catalog.js +85 -0
  27. package/dist/a2a/reception/skill-catalog.js.map +1 -0
  28. package/dist/a2a/reception/skill-contract.d.ts +70 -0
  29. package/dist/a2a/reception/skill-contract.js +183 -0
  30. package/dist/a2a/reception/skill-contract.js.map +1 -0
  31. package/dist/a2a/reception/types.d.ts +12 -0
  32. package/dist/a2a/server/customer-identity-gateway.d.ts +111 -0
  33. package/dist/a2a/server/customer-identity-gateway.js +441 -0
  34. package/dist/a2a/server/customer-identity-gateway.js.map +1 -0
  35. package/dist/a2a/server/merchant-handler.d.ts +56 -1
  36. package/dist/a2a/server/merchant-handler.js +659 -44
  37. package/dist/a2a/server/merchant-handler.js.map +1 -1
  38. package/dist/a2a/server/pipeline.js +74 -29
  39. package/dist/a2a/server/pipeline.js.map +1 -1
  40. package/dist/a2a/server/types.d.ts +2 -0
  41. package/dist/a2a/unit-alias.d.ts +3 -3
  42. package/dist/a2a/unit-alias.js +9 -5
  43. package/dist/a2a/unit-alias.js.map +1 -1
  44. package/dist/agent/buyer/buyer-tools.js +1 -2
  45. package/dist/agent/buyer/buyer-tools.js.map +1 -1
  46. package/dist/agent/buyer/search-loop.js +0 -1
  47. package/dist/agent/buyer/search-loop.js.map +1 -1
  48. package/dist/auth/merchant-sessions.d.ts +3 -0
  49. package/dist/auth/merchant-sessions.js +21 -5
  50. package/dist/auth/merchant-sessions.js.map +1 -1
  51. package/dist/buyer-core/a2a-knp.d.ts +4 -2
  52. package/dist/buyer-core/a2a-knp.js +5 -2
  53. package/dist/buyer-core/a2a-knp.js.map +1 -1
  54. package/dist/buyer-core/a2a-negotiator.d.ts +1 -0
  55. package/dist/buyer-core/a2a-negotiator.js +18 -11
  56. package/dist/buyer-core/a2a-negotiator.js.map +1 -1
  57. package/dist/buyer-core/a2a-quote-fetcher.d.ts +25 -0
  58. package/dist/buyer-core/a2a-quote-fetcher.js +82 -4
  59. package/dist/buyer-core/a2a-quote-fetcher.js.map +1 -1
  60. package/dist/buyer-core/a2a-quote-history.d.ts +94 -0
  61. package/dist/buyer-core/a2a-quote-history.js +149 -0
  62. package/dist/buyer-core/a2a-quote-history.js.map +1 -0
  63. package/dist/buyer-core/build-service.d.ts +19 -0
  64. package/dist/buyer-core/build-service.js +30 -1
  65. package/dist/buyer-core/build-service.js.map +1 -1
  66. package/dist/buyer-core/errors.d.ts +1 -1
  67. package/dist/buyer-core/errors.js +1 -0
  68. package/dist/buyer-core/errors.js.map +1 -1
  69. package/dist/buyer-core/merchant-index.js +0 -1
  70. package/dist/buyer-core/merchant-index.js.map +1 -1
  71. package/dist/buyer-core/open-inquiry-signer.d.ts +1 -0
  72. package/dist/buyer-core/open-inquiry-signer.js +5 -2
  73. package/dist/buyer-core/open-inquiry-signer.js.map +1 -1
  74. package/dist/buyer-core/protocol-recovery.d.ts +2 -1
  75. package/dist/buyer-core/protocol-recovery.js +14 -4
  76. package/dist/buyer-core/protocol-recovery.js.map +1 -1
  77. package/dist/buyer-core/service.d.ts +58 -5
  78. package/dist/buyer-core/service.js +279 -53
  79. package/dist/buyer-core/service.js.map +1 -1
  80. package/dist/buyer-core/store.d.ts +8 -0
  81. package/dist/buyer-core/store.js +37 -7
  82. package/dist/buyer-core/store.js.map +1 -1
  83. package/dist/cli.js +136 -34
  84. package/dist/cli.js.map +1 -1
  85. package/dist/cloud/bootstrap.d.ts +1 -1
  86. package/dist/cloud/bootstrap.js +162 -35
  87. package/dist/cloud/bootstrap.js.map +1 -1
  88. package/dist/cloud/product-import-tabular.js +13 -5
  89. package/dist/cloud/product-import-tabular.js.map +1 -1
  90. package/dist/cloud/trade-platforms-client.d.ts +30 -0
  91. package/dist/cloud/trade-platforms-client.js +34 -1
  92. package/dist/cloud/trade-platforms-client.js.map +1 -1
  93. package/dist/commerce/receipt/dispatcher.d.ts +42 -0
  94. package/dist/commerce/receipt/dispatcher.js +68 -0
  95. package/dist/commerce/receipt/dispatcher.js.map +1 -0
  96. package/dist/commerce/receipt/receipts.d.ts +140 -0
  97. package/dist/commerce/receipt/receipts.js +247 -0
  98. package/dist/commerce/receipt/receipts.js.map +1 -0
  99. package/dist/config/profile.d.ts +2 -2
  100. package/dist/handoff/order-receipts.d.ts +62 -0
  101. package/dist/handoff/order-receipts.js +71 -0
  102. package/dist/handoff/order-receipts.js.map +1 -0
  103. package/dist/handoff/trade-platform-rules.js +5 -2
  104. package/dist/handoff/trade-platform-rules.js.map +1 -1
  105. package/dist/handoff/ucp-checkout/cart-channel.d.ts +2 -1
  106. package/dist/handoff/ucp-checkout/cart-channel.js +1 -0
  107. package/dist/handoff/ucp-checkout/cart-channel.js.map +1 -1
  108. package/dist/handoff/ucp-checkout/channel.d.ts +6 -0
  109. package/dist/handoff/ucp-checkout/channel.js +44 -0
  110. package/dist/handoff/ucp-checkout/channel.js.map +1 -1
  111. package/dist/http/cli.js +6 -0
  112. package/dist/http/cli.js.map +1 -1
  113. package/dist/http/merchant-management/api.d.ts +11 -1
  114. package/dist/http/merchant-management/api.js +471 -3
  115. package/dist/http/merchant-management/api.js.map +1 -1
  116. package/dist/http/merchant-management/draft-store.js +8 -6
  117. package/dist/http/merchant-management/draft-store.js.map +1 -1
  118. package/dist/http/merchant-management/page.js +83 -22
  119. package/dist/http/merchant-management/page.js.map +1 -1
  120. package/dist/mcp/cli.js +6 -0
  121. package/dist/mcp/cli.js.map +1 -1
  122. package/dist/mcp/merchant-runtime-assembly.d.ts +20 -0
  123. package/dist/mcp/merchant-runtime-assembly.js +93 -3
  124. package/dist/mcp/merchant-runtime-assembly.js.map +1 -1
  125. package/dist/mcp/merchant-server.d.ts +5 -0
  126. package/dist/mcp/merchant-server.js +12 -0
  127. package/dist/mcp/merchant-server.js.map +1 -1
  128. package/dist/mcp/tools.js +12 -3
  129. package/dist/mcp/tools.js.map +1 -1
  130. package/dist/merchant/application/actor.d.ts +1 -1
  131. package/dist/merchant/application/actor.js +15 -0
  132. package/dist/merchant/application/actor.js.map +1 -1
  133. package/dist/merchant/workbench-server.d.ts +38 -0
  134. package/dist/merchant/workbench-server.js +428 -0
  135. package/dist/merchant/workbench-server.js.map +1 -0
  136. package/dist/merchant-core/budget/background-budget.d.ts +132 -0
  137. package/dist/merchant-core/budget/background-budget.js +308 -0
  138. package/dist/merchant-core/budget/background-budget.js.map +1 -0
  139. package/dist/merchant-core/context-governance/actor-context.d.ts +56 -0
  140. package/dist/merchant-core/context-governance/actor-context.js +76 -0
  141. package/dist/merchant-core/context-governance/actor-context.js.map +1 -0
  142. package/dist/merchant-core/context-governance/authority.d.ts +39 -0
  143. package/dist/merchant-core/context-governance/authority.js +28 -0
  144. package/dist/merchant-core/context-governance/authority.js.map +1 -0
  145. package/dist/merchant-core/context-governance/context-guard.d.ts +104 -0
  146. package/dist/merchant-core/context-governance/context-guard.js +194 -0
  147. package/dist/merchant-core/context-governance/context-guard.js.map +1 -0
  148. package/dist/merchant-core/context-governance/data-use-grant.d.ts +91 -0
  149. package/dist/merchant-core/context-governance/data-use-grant.js +211 -0
  150. package/dist/merchant-core/context-governance/data-use-grant.js.map +1 -0
  151. package/dist/merchant-core/context-governance/feature-flags.d.ts +32 -0
  152. package/dist/merchant-core/context-governance/feature-flags.js +83 -0
  153. package/dist/merchant-core/context-governance/feature-flags.js.map +1 -0
  154. package/dist/merchant-core/context-governance/pilot-readiness.d.ts +39 -0
  155. package/dist/merchant-core/context-governance/pilot-readiness.js +141 -0
  156. package/dist/merchant-core/context-governance/pilot-readiness.js.map +1 -0
  157. package/dist/merchant-core/context-governance/source-governance.d.ts +157 -0
  158. package/dist/merchant-core/context-governance/source-governance.js +492 -0
  159. package/dist/merchant-core/context-governance/source-governance.js.map +1 -0
  160. package/dist/merchant-core/context-governance/types.d.ts +62 -0
  161. package/dist/merchant-core/context-governance/types.js +92 -0
  162. package/dist/merchant-core/context-governance/types.js.map +1 -0
  163. package/dist/merchant-core/customer-delivery/binding.d.ts +55 -0
  164. package/dist/merchant-core/customer-delivery/binding.js +121 -0
  165. package/dist/merchant-core/customer-delivery/binding.js.map +1 -0
  166. package/dist/merchant-core/customer-delivery/channel.d.ts +75 -0
  167. package/dist/merchant-core/customer-delivery/channel.js +157 -0
  168. package/dist/merchant-core/customer-delivery/channel.js.map +1 -0
  169. package/dist/merchant-core/customer-delivery/consent-repository.d.ts +50 -0
  170. package/dist/merchant-core/customer-delivery/consent-repository.js +160 -0
  171. package/dist/merchant-core/customer-delivery/consent-repository.js.map +1 -0
  172. package/dist/merchant-core/customer-delivery/dispatcher-loop.d.ts +68 -0
  173. package/dist/merchant-core/customer-delivery/dispatcher-loop.js +132 -0
  174. package/dist/merchant-core/customer-delivery/dispatcher-loop.js.map +1 -0
  175. package/dist/merchant-core/customer-delivery/dispatcher.d.ts +118 -0
  176. package/dist/merchant-core/customer-delivery/dispatcher.js +166 -0
  177. package/dist/merchant-core/customer-delivery/dispatcher.js.map +1 -0
  178. package/dist/merchant-core/customer-delivery/email-adapter.d.ts +31 -0
  179. package/dist/merchant-core/customer-delivery/email-adapter.js +90 -0
  180. package/dist/merchant-core/customer-delivery/email-adapter.js.map +1 -0
  181. package/dist/merchant-core/customer-delivery/gate.d.ts +37 -0
  182. package/dist/merchant-core/customer-delivery/gate.js +196 -0
  183. package/dist/merchant-core/customer-delivery/gate.js.map +1 -0
  184. package/dist/merchant-core/customer-delivery/reconciliation.d.ts +13 -0
  185. package/dist/merchant-core/customer-delivery/reconciliation.js +70 -0
  186. package/dist/merchant-core/customer-delivery/reconciliation.js.map +1 -0
  187. package/dist/merchant-core/customer-delivery/repository.d.ts +55 -0
  188. package/dist/merchant-core/customer-delivery/repository.js +235 -0
  189. package/dist/merchant-core/customer-delivery/repository.js.map +1 -0
  190. package/dist/merchant-core/customer-delivery/smtp-adapter.d.ts +30 -0
  191. package/dist/merchant-core/customer-delivery/smtp-adapter.js +183 -0
  192. package/dist/merchant-core/customer-delivery/smtp-adapter.js.map +1 -0
  193. package/dist/merchant-core/customer-delivery/stream-gate.d.ts +45 -0
  194. package/dist/merchant-core/customer-delivery/stream-gate.js +123 -0
  195. package/dist/merchant-core/customer-delivery/stream-gate.js.map +1 -0
  196. package/dist/merchant-core/customer-delivery/types.d.ts +103 -0
  197. package/dist/merchant-core/customer-delivery/types.js +32 -0
  198. package/dist/merchant-core/customer-delivery/types.js.map +1 -0
  199. package/dist/merchant-core/customer-delivery/weixin-adapter.d.ts +35 -0
  200. package/dist/merchant-core/customer-delivery/weixin-adapter.js +56 -0
  201. package/dist/merchant-core/customer-delivery/weixin-adapter.js.map +1 -0
  202. package/dist/merchant-core/customer-memory/auto-identity.d.ts +43 -0
  203. package/dist/merchant-core/customer-memory/auto-identity.js +163 -0
  204. package/dist/merchant-core/customer-memory/auto-identity.js.map +1 -0
  205. package/dist/merchant-core/customer-memory/grants.d.ts +72 -0
  206. package/dist/merchant-core/customer-memory/grants.js +224 -0
  207. package/dist/merchant-core/customer-memory/grants.js.map +1 -0
  208. package/dist/merchant-core/customer-memory/history.d.ts +51 -0
  209. package/dist/merchant-core/customer-memory/history.js +252 -0
  210. package/dist/merchant-core/customer-memory/history.js.map +1 -0
  211. package/dist/merchant-core/customer-memory/identity.d.ts +66 -0
  212. package/dist/merchant-core/customer-memory/identity.js +249 -0
  213. package/dist/merchant-core/customer-memory/identity.js.map +1 -0
  214. package/dist/merchant-core/customer-memory/maintenance.d.ts +51 -0
  215. package/dist/merchant-core/customer-memory/maintenance.js +67 -0
  216. package/dist/merchant-core/customer-memory/maintenance.js.map +1 -0
  217. package/dist/merchant-core/customer-memory/memory.d.ts +119 -0
  218. package/dist/merchant-core/customer-memory/memory.js +502 -0
  219. package/dist/merchant-core/customer-memory/memory.js.map +1 -0
  220. package/dist/merchant-core/customer-memory/private-transport.d.ts +10 -0
  221. package/dist/merchant-core/customer-memory/private-transport.js +108 -0
  222. package/dist/merchant-core/customer-memory/private-transport.js.map +1 -0
  223. package/dist/merchant-core/customer-memory/quote-history.d.ts +160 -0
  224. package/dist/merchant-core/customer-memory/quote-history.js +392 -0
  225. package/dist/merchant-core/customer-memory/quote-history.js.map +1 -0
  226. package/dist/merchant-core/customer-memory/reception-provider.d.ts +69 -0
  227. package/dist/merchant-core/customer-memory/reception-provider.js +250 -0
  228. package/dist/merchant-core/customer-memory/reception-provider.js.map +1 -0
  229. package/dist/merchant-core/customer-memory/reception-writer.d.ts +19 -0
  230. package/dist/merchant-core/customer-memory/reception-writer.js +32 -0
  231. package/dist/merchant-core/customer-memory/reception-writer.js.map +1 -0
  232. package/dist/merchant-core/customer-memory/types.d.ts +111 -0
  233. package/dist/merchant-core/customer-memory/types.js +58 -0
  234. package/dist/merchant-core/customer-memory/types.js.map +1 -0
  235. package/dist/merchant-core/followup/repository.d.ts +2 -1
  236. package/dist/merchant-core/followup/repository.js +29 -23
  237. package/dist/merchant-core/followup/repository.js.map +1 -1
  238. package/dist/merchant-core/learning/evaluation-fixtures.d.ts +38 -0
  239. package/dist/merchant-core/learning/evaluation-fixtures.js +83 -0
  240. package/dist/merchant-core/learning/evaluation-fixtures.js.map +1 -0
  241. package/dist/merchant-core/learning/evaluation-suite-v1.d.ts +56 -0
  242. package/dist/merchant-core/learning/evaluation-suite-v1.js +129 -0
  243. package/dist/merchant-core/learning/evaluation-suite-v1.js.map +1 -0
  244. package/dist/merchant-core/learning/evaluation.d.ts +84 -0
  245. package/dist/merchant-core/learning/evaluation.js +581 -0
  246. package/dist/merchant-core/learning/evaluation.js.map +1 -0
  247. package/dist/merchant-core/learning/initial-skills.d.ts +36 -0
  248. package/dist/merchant-core/learning/initial-skills.js +67 -0
  249. package/dist/merchant-core/learning/initial-skills.js.map +1 -0
  250. package/dist/merchant-core/learning/precheck.d.ts +33 -0
  251. package/dist/merchant-core/learning/precheck.js +56 -0
  252. package/dist/merchant-core/learning/precheck.js.map +1 -0
  253. package/dist/merchant-core/learning/real-evaluation-runner.d.ts +52 -0
  254. package/dist/merchant-core/learning/real-evaluation-runner.js +167 -0
  255. package/dist/merchant-core/learning/real-evaluation-runner.js.map +1 -0
  256. package/dist/merchant-core/learning/reception-skill-catalog.d.ts +39 -0
  257. package/dist/merchant-core/learning/reception-skill-catalog.js +145 -0
  258. package/dist/merchant-core/learning/reception-skill-catalog.js.map +1 -0
  259. package/dist/merchant-core/learning/recovery-gateway.d.ts +27 -0
  260. package/dist/merchant-core/learning/recovery-gateway.js +106 -0
  261. package/dist/merchant-core/learning/recovery-gateway.js.map +1 -0
  262. package/dist/merchant-core/learning/repository.d.ts +130 -0
  263. package/dist/merchant-core/learning/repository.js +588 -0
  264. package/dist/merchant-core/learning/repository.js.map +1 -0
  265. package/dist/merchant-core/learning/service.d.ts +262 -0
  266. package/dist/merchant-core/learning/service.js +1498 -0
  267. package/dist/merchant-core/learning/service.js.map +1 -0
  268. package/dist/merchant-core/learning/test-dispatch-gateway.d.ts +43 -0
  269. package/dist/merchant-core/learning/test-dispatch-gateway.js +145 -0
  270. package/dist/merchant-core/learning/test-dispatch-gateway.js.map +1 -0
  271. package/dist/merchant-core/learning/types.d.ts +217 -0
  272. package/dist/merchant-core/learning/types.js +52 -0
  273. package/dist/merchant-core/learning/types.js.map +1 -0
  274. package/dist/merchant-core/migrations/ledgers.d.ts +40 -0
  275. package/dist/merchant-core/migrations/ledgers.js +824 -0
  276. package/dist/merchant-core/migrations/ledgers.js.map +1 -0
  277. package/dist/merchant-core/migrations/runner.d.ts +55 -0
  278. package/dist/merchant-core/migrations/runner.js +114 -0
  279. package/dist/merchant-core/migrations/runner.js.map +1 -0
  280. package/dist/merchant-core/operations-jobs/advice-runner.d.ts +63 -0
  281. package/dist/merchant-core/operations-jobs/advice-runner.js +199 -0
  282. package/dist/merchant-core/operations-jobs/advice-runner.js.map +1 -0
  283. package/dist/merchant-core/operations-jobs/pilot-evidence.d.ts +64 -0
  284. package/dist/merchant-core/operations-jobs/pilot-evidence.js +109 -0
  285. package/dist/merchant-core/operations-jobs/pilot-evidence.js.map +1 -0
  286. package/dist/merchant-core/operations-jobs/pilot-metrics.d.ts +70 -0
  287. package/dist/merchant-core/operations-jobs/pilot-metrics.js +98 -0
  288. package/dist/merchant-core/operations-jobs/pilot-metrics.js.map +1 -0
  289. package/dist/merchant-core/operations-jobs/projection.d.ts +41 -0
  290. package/dist/merchant-core/operations-jobs/projection.js +158 -0
  291. package/dist/merchant-core/operations-jobs/projection.js.map +1 -0
  292. package/dist/merchant-core/operations-jobs/scheduler.d.ts +68 -0
  293. package/dist/merchant-core/operations-jobs/scheduler.js +233 -0
  294. package/dist/merchant-core/operations-jobs/scheduler.js.map +1 -0
  295. package/dist/merchant-core/operations-jobs/service.d.ts +260 -0
  296. package/dist/merchant-core/operations-jobs/service.js +922 -0
  297. package/dist/merchant-core/operations-jobs/service.js.map +1 -0
  298. package/dist/merchant-core/ops/facade.d.ts +10 -0
  299. package/dist/merchant-core/ops/facade.js +52 -0
  300. package/dist/merchant-core/ops/facade.js.map +1 -1
  301. package/dist/merchant-core/ops/schema.d.ts +1 -1
  302. package/dist/merchant-core/ops/schema.js +119 -2
  303. package/dist/merchant-core/ops/schema.js.map +1 -1
  304. package/dist/merchant-core/ops/surface.d.ts +37 -0
  305. package/dist/merchant-core/ops/surface.js +240 -0
  306. package/dist/merchant-core/ops/surface.js.map +1 -1
  307. package/dist/merchant-core/ownership/instance-ownership.d.ts +122 -0
  308. package/dist/merchant-core/ownership/instance-ownership.js +236 -0
  309. package/dist/merchant-core/ownership/instance-ownership.js.map +1 -0
  310. package/dist/merchant-core/ownership/runtime.d.ts +175 -0
  311. package/dist/merchant-core/ownership/runtime.js +422 -0
  312. package/dist/merchant-core/ownership/runtime.js.map +1 -0
  313. package/dist/merchant-core/storage/transaction.d.ts +102 -7
  314. package/dist/merchant-core/storage/transaction.js +274 -3
  315. package/dist/merchant-core/storage/transaction.js.map +1 -1
  316. package/dist/merchant-credential-rotation.d.ts +4 -1
  317. package/dist/merchant-credential-rotation.js +12 -8
  318. package/dist/merchant-credential-rotation.js.map +1 -1
  319. package/dist/merchant-gateway/catalog-tools.js +4 -2
  320. package/dist/merchant-gateway/catalog-tools.js.map +1 -1
  321. package/dist/merchant-runtime/manager.d.ts +2 -0
  322. package/dist/merchant-runtime/manager.js +5 -0
  323. package/dist/merchant-runtime/manager.js.map +1 -1
  324. package/dist/product-buyer.d.ts +1 -0
  325. package/dist/product-buyer.js +0 -1
  326. package/dist/product-buyer.js.map +1 -1
  327. package/dist/product-cli.js +11 -1
  328. package/dist/product-cli.js.map +1 -1
  329. package/package.json +5 -3
  330. package/skills/kiwi-buyer/SKILL.md +1 -1
@@ -0,0 +1,67 @@
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
+ * M5 三个初始接待技能(设计 v1.1 §8)。
18
+ *
19
+ * 它们是商家可评审/可发布的候选内容,不包含包装倍率、折扣权限或任何价格
20
+ * 事实;编译后必须通过 `compileReceptionSkillArtifact` 的固定动作/问题/守卫
21
+ * 校验。技能版本与商品事实版本分别管理。
22
+ */
23
+ import { compileReceptionSkillArtifact, } from "../../a2a/reception/skill-contract.js";
24
+ export const INITIAL_SKILLS = [
25
+ {
26
+ skill_key: "trial-unit-clarification",
27
+ trigger_text: "买家询问试用装且数量/单位不明确时,先读取商家单位规则再澄清",
28
+ description: "试用询价澄清:读取当前事实,按注册问题确认数量与单位",
29
+ steps: [
30
+ { action_ref: "get_commercial_facts" },
31
+ { action_ref: "ask_registered_question", question_id: "q_unit_mismatch_v1", guard_ref: "unit_unresolved" },
32
+ { action_ref: "propose_reply" },
33
+ ],
34
+ },
35
+ {
36
+ skill_key: "price-objection",
37
+ trigger_text: "买家提出目标价或认为价格偏高时,只用当前公开事实解释并转受控协商",
38
+ description: "价格异议处理:解释可证内容,越界转人工审批,不承诺折扣",
39
+ steps: [
40
+ { action_ref: "get_commercial_facts" },
41
+ { action_ref: "request_human_help" },
42
+ { action_ref: "propose_reply" },
43
+ ],
44
+ },
45
+ {
46
+ skill_key: "public-option-comparison",
47
+ trigger_text: "买家在同一商品有多个公开候选需要比较时,按公开价格/库存给出可验证理由",
48
+ description: "公开方案比较:只比较公开事实,不推荐未验证或私有方案",
49
+ steps: [
50
+ { action_ref: "search_products" },
51
+ { action_ref: "compare_products" },
52
+ { action_ref: "get_commercial_facts" },
53
+ { action_ref: "propose_reply" },
54
+ ],
55
+ },
56
+ ];
57
+ /** 编译并校验三个初始技能;任何契约变化都应在发布前失败。 */
58
+ export function compileInitialSkills() {
59
+ return INITIAL_SKILLS.map((definition) => ({
60
+ definition,
61
+ compiled: compileReceptionSkillArtifact({
62
+ skill_key: definition.skill_key,
63
+ steps: definition.steps,
64
+ }),
65
+ }));
66
+ }
67
+ //# sourceMappingURL=initial-skills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initial-skills.js","sourceRoot":"","sources":["../../../src/merchant-core/learning/initial-skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AAEH,OAAO,EACL,6BAA6B,GAG9B,MAAM,uCAAuC,CAAC;AAS/C,MAAM,CAAC,MAAM,cAAc,GAAsC;IAC/D;QACE,SAAS,EAAE,0BAA0B;QACrC,YAAY,EAAE,gCAAgC;QAC9C,WAAW,EAAE,4BAA4B;QACzC,KAAK,EAAE;YACL,EAAE,UAAU,EAAE,sBAAsB,EAAE;YACtC,EAAE,UAAU,EAAE,yBAAyB,EAAE,WAAW,EAAE,oBAAoB,EAAE,SAAS,EAAE,iBAAiB,EAAE;YAC1G,EAAE,UAAU,EAAE,eAAe,EAAE;SAChC;KACF;IACD;QACE,SAAS,EAAE,iBAAiB;QAC5B,YAAY,EAAE,kCAAkC;QAChD,WAAW,EAAE,6BAA6B;QAC1C,KAAK,EAAE;YACL,EAAE,UAAU,EAAE,sBAAsB,EAAE;YACtC,EAAE,UAAU,EAAE,oBAAoB,EAAE;YACpC,EAAE,UAAU,EAAE,eAAe,EAAE;SAChC;KACF;IACD;QACE,SAAS,EAAE,0BAA0B;QACrC,YAAY,EAAE,qCAAqC;QACnD,WAAW,EAAE,4BAA4B;QACzC,KAAK,EAAE;YACL,EAAE,UAAU,EAAE,iBAAiB,EAAE;YACjC,EAAE,UAAU,EAAE,kBAAkB,EAAE;YAClC,EAAE,UAAU,EAAE,sBAAsB,EAAE;YACtC,EAAE,UAAU,EAAE,eAAe,EAAE;SAChC;KACF;CACF,CAAC;AAOF,kCAAkC;AAClC,MAAM,UAAU,oBAAoB;IAClC,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACzC,UAAU;QACV,QAAQ,EAAE,6BAA6B,CAAC;YACtC,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,KAAK,EAAE,UAAU,CAAC,KAAK;SACxB,CAAC;KACH,CAAC,CAAC,CAAC;AACN,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
+ * 纠正正文入库前预检(设计 §5.1 / §21.1 / A03 / A13)。
18
+ *
19
+ * 客户标识、联系方式、凭据和价格底线不得进入学习域:命中即拒绝(不静默
20
+ * 保存),并只登记原因与摘要。检测是保守的启发式——宁可要求商家改写为
21
+ * 抽象流程纠正,也不把敏感原文送进模型或候选。
22
+ *
23
+ * 明确边界:姓名、模糊地址等低结构信息无法可靠识别;产品约束是纠正正文
24
+ * 只描述抽象流程,客户案例通过 `case_refs` 引用已授权案例,不内联原文。
25
+ */
26
+ export type CorrectionSensitiveReason = "phone" | "email" | "id_card" | "credential" | "floor_price" | "address";
27
+ /** 控制字符(允许换行与制表);用于正文与 ID 的形状校验。 */
28
+ export declare const CONTROL_CHARS_PATTERN: RegExp;
29
+ /**
30
+ * 返回首个命中的敏感类别;`undefined` 表示通过预检。
31
+ * 顺序固定,便于审计与稳定原因码。
32
+ */
33
+ export declare function detectCorrectionSensitiveContent(text: string): CorrectionSensitiveReason | undefined;
@@ -0,0 +1,56 @@
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
+ const PHONE_PATTERNS = [
17
+ /(?<!\d)1[3-9]\d{9}(?!\d)/u,
18
+ /(?<!\d)0\d{2,3}-?\d{7,8}(?!\d)/u,
19
+ /(?<!\d)\+\d{1,3}[ -]?\d{6,14}(?!\d)/u,
20
+ ];
21
+ const EMAIL_PATTERN = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/u;
22
+ const ID_CARD_PATTERN = /(?<!\d)\d{17}[\dXx](?!\d)/u;
23
+ const CREDENTIAL_PATTERNS = [
24
+ /\bsk-[A-Za-z0-9_-]{10,}\b/u,
25
+ /\bAKIA[0-9A-Z]{12,}\b/u,
26
+ /\bBearer\s+[A-Za-z0-9._~+/-]{10,}/u,
27
+ /\b(api[_-]?key|access[_-]?token|secret|password|passwd)\s*[:=]\s*\S{6,}/iu,
28
+ /(密码|密钥|凭据|令牌)\s*[::=]\s*\S{4,}/u,
29
+ ];
30
+ const HARD_FLOOR_PRICE_PATTERN = /(底价|成本价|进价|出厂价|最低可售|最低成交价|floor\s*price|cost\s*price)/iu;
31
+ const SOFT_FLOOR_PRICE_PATTERN = /最低价\s*[::]?\s*[¥¥]?\s*\d/u;
32
+ const ADDRESS_PATTERN = /(详细地址|收货地址|家庭住址|门牌号|地址\s*[::]\s*\S{6,})/u;
33
+ /** 控制字符(允许换行与制表);用于正文与 ID 的形状校验。 */
34
+ // eslint-disable-next-line no-control-regex
35
+ export const CONTROL_CHARS_PATTERN = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/u;
36
+ /**
37
+ * 返回首个命中的敏感类别;`undefined` 表示通过预检。
38
+ * 顺序固定,便于审计与稳定原因码。
39
+ */
40
+ export function detectCorrectionSensitiveContent(text) {
41
+ if (PHONE_PATTERNS.some((pattern) => pattern.test(text)))
42
+ return "phone";
43
+ if (EMAIL_PATTERN.test(text))
44
+ return "email";
45
+ if (ID_CARD_PATTERN.test(text))
46
+ return "id_card";
47
+ if (CREDENTIAL_PATTERNS.some((pattern) => pattern.test(text)))
48
+ return "credential";
49
+ if (HARD_FLOOR_PRICE_PATTERN.test(text) || SOFT_FLOOR_PRICE_PATTERN.test(text)) {
50
+ return "floor_price";
51
+ }
52
+ if (ADDRESS_PATTERN.test(text))
53
+ return "address";
54
+ return undefined;
55
+ }
56
+ //# sourceMappingURL=precheck.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"precheck.js","sourceRoot":"","sources":["../../../src/merchant-core/learning/precheck.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAqBH,MAAM,cAAc,GAAsB;IACxC,2BAA2B;IAC3B,iCAAiC;IACjC,sCAAsC;CACvC,CAAC;AAEF,MAAM,aAAa,GAAG,iDAAiD,CAAC;AACxE,MAAM,eAAe,GAAG,4BAA4B,CAAC;AAErD,MAAM,mBAAmB,GAAsB;IAC7C,4BAA4B;IAC5B,wBAAwB;IACxB,oCAAoC;IACpC,2EAA2E;IAC3E,iCAAiC;CAClC,CAAC;AAEF,MAAM,wBAAwB,GAC5B,yDAAyD,CAAC;AAC5D,MAAM,wBAAwB,GAAG,2BAA2B,CAAC;AAE7D,MAAM,eAAe,GACnB,0CAA0C,CAAC;AAE7C,oCAAoC;AACpC,4CAA4C;AAC5C,MAAM,CAAC,MAAM,qBAAqB,GAAG,iDAAiD,CAAC;AAEvF;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC9C,IAAY;IAEZ,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC;IACzE,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC;IAC7C,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACjD,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,YAAY,CAAC;IACnF,IAAI,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/E,OAAO,aAAa,CAAC;IACvB,CAAC;IACD,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACjD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,52 @@
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
+ * 真实 provider 评测 runner(M5-3)。
18
+ *
19
+ * 用调用方提供的 streamFn/model/商品源执行同一接待 runtime:基线变体不加载
20
+ * 候选技能,候选变体加载冻结产物;两变体同模型、同夹具、同问题注册表。
21
+ * 验收标准来自 `evaluation-suite-v1` 的冻结案例;硬门(越权工具、私密
22
+ * 泄露、未经批准承诺、绕过批准)任一违反即计失败。
23
+ *
24
+ * 本文件不读取凭据、不写数据库;真实模型回放由 M5 运行环境注入。
25
+ */
26
+ import type { StreamFn } from "@earendil-works/pi-agent-core";
27
+ import type { Api, Model } from "@earendil-works/pi-ai";
28
+ import { type QuestionSpecRegistry } from "../../a2a/reception/question-spec.js";
29
+ import type { ReceptionProductSource } from "../../a2a/reception/engine.js";
30
+ import type { MerchantPolicy } from "../../config/profile.js";
31
+ import type { EvaluationRunner } from "./evaluation.js";
32
+ export interface ReceptionEvaluationRunnerOptions {
33
+ readonly merchantId: string;
34
+ readonly streamFn: StreamFn;
35
+ /** 可选:为基线/候选提供独立脚本(测试/对照夹具);缺省沿用 streamFn。 */
36
+ readonly streamFnForVariant?: (variant: "baseline" | "candidate") => StreamFn;
37
+ /** 每个模型流调用可由可信传输适配器绑定调度标识;不代表 HTTP 请求或重试次数。 */
38
+ readonly streamFnForDispatch?: (binding: {
39
+ readonly dispatch_id: string;
40
+ readonly stream_ordinal: number;
41
+ }, streamFn: StreamFn) => StreamFn;
42
+ readonly model: Model<Api>;
43
+ readonly productSource?: ReceptionProductSource;
44
+ readonly policy?: () => MerchantPolicy | undefined;
45
+ readonly now: () => string;
46
+ readonly questionRegistry?: QuestionSpecRegistry;
47
+ }
48
+ /**
49
+ * 创建可注入评测执行器的真实 runner。基线/候选按 scenario+attempt 配对,
50
+ * 候选相对基线的通过变化进入 improvement_delta。
51
+ */
52
+ export declare function createReceptionEvaluationRunner(options: ReceptionEvaluationRunnerOptions): EvaluationRunner;
@@ -0,0 +1,167 @@
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
+ import { getQuestionIdByReason } from "../../a2a/reception/question-spec.js";
17
+ import { DEFAULT_QUESTION_SPEC_REGISTRY, } from "../../a2a/reception/question-spec.js";
18
+ import { createPiReceptionRuntime, } from "../../a2a/reception/agent-runtime.js";
19
+ import { InMemoryFactRegistry, publishResponsePlan } from "../../a2a/reception/publish.js";
20
+ import { createStaticSkillCatalog, } from "../../a2a/reception/skill-catalog.js";
21
+ function candidateBinding(candidate) {
22
+ return {
23
+ skill_key: candidate.skill_key,
24
+ release_id: `eval_${candidate.candidate_id}_${candidate.revision}`,
25
+ compiled_artifact_hash: candidate.compiled_artifact_hash,
26
+ generation: candidate.revision,
27
+ revocation_epoch: 0,
28
+ trigger_text: candidate.trigger_text,
29
+ question_schema_version: candidate.question_schema_version,
30
+ tool_contract_digest: candidate.tool_contract_digest,
31
+ body_text: candidate.compiled_artifact.body_text,
32
+ steps: candidate.compiled_artifact.steps,
33
+ required_tools: candidate.compiled_artifact.required_tools,
34
+ };
35
+ }
36
+ function asInput(scenario) {
37
+ const input = scenario.input;
38
+ if (typeof input !== "object" ||
39
+ input === null ||
40
+ typeof input.text !== "string") {
41
+ return { text: "" };
42
+ }
43
+ return input;
44
+ }
45
+ function asCriteria(scenario) {
46
+ const expected = scenario.expected;
47
+ return typeof expected === "object" && expected !== null
48
+ ? expected
49
+ : {};
50
+ }
51
+ /**
52
+ * 创建可注入评测执行器的真实 runner。基线/候选按 scenario+attempt 配对,
53
+ * 候选相对基线的通过变化进入 improvement_delta。
54
+ */
55
+ export function createReceptionEvaluationRunner(options) {
56
+ const questions = options.questionRegistry ?? DEFAULT_QUESTION_SPEC_REGISTRY;
57
+ const baselineResults = new Map();
58
+ function runtimeFor(variant, candidate, dispatchId) {
59
+ const catalog = variant === "candidate"
60
+ ? createStaticSkillCatalog([candidateBinding(candidate)])
61
+ : createStaticSkillCatalog([]);
62
+ const selectedStreamFn = options.streamFnForVariant !== undefined
63
+ ? options.streamFnForVariant(variant)
64
+ : options.streamFn;
65
+ let ordinal = 0;
66
+ const correlate = options.streamFnForDispatch;
67
+ const streamFn = correlate !== undefined && dispatchId !== undefined && dispatchId.length > 0
68
+ ? (...args) => correlate({ dispatch_id: dispatchId, stream_ordinal: ++ordinal }, selectedStreamFn)(...args)
69
+ : selectedStreamFn;
70
+ return createPiReceptionRuntime({
71
+ streamFn,
72
+ model: options.model,
73
+ skillCatalog: catalog,
74
+ questionRegistry: questions,
75
+ ...(options.productSource !== undefined ? { productSource: options.productSource } : {}),
76
+ ...(options.policy !== undefined ? { policy: options.policy } : {}),
77
+ requireCompleteModelRun: true,
78
+ maxSteps: 6,
79
+ maxToolAttempts: 10,
80
+ // 与生产 profile 的 turn_timeout_seconds=90 对齐;30s 会把真实模型
81
+ // 的慢回合误判成质量失败(无 diagnostics 的 passed=false)。
82
+ timeoutMs: 90_000,
83
+ });
84
+ }
85
+ return async ({ scenario, variant, attempt, candidate, baseline_passed, dispatch_id }) => {
86
+ const input = asInput(scenario);
87
+ const criteria = asCriteria(scenario);
88
+ const now = options.now();
89
+ const registry = new InMemoryFactRegistry();
90
+ const runtime = runtimeFor(variant, candidate, dispatch_id);
91
+ const outcome = await runtime.run({
92
+ merchantId: options.merchantId,
93
+ identity: `eval:${scenario.scenario_id}:${variant}:${attempt}:${dispatch_id ?? "unbound"}`,
94
+ contextId: `eval:${scenario.scenario_id}:${variant}:${attempt}:${dispatch_id ?? "unbound"}`,
95
+ text: input.text,
96
+ ...(input.structuredSku !== undefined ? { structuredSku: input.structuredSku } : {}),
97
+ registry,
98
+ now,
99
+ });
100
+ if (outcome === undefined) {
101
+ if (variant === "baseline")
102
+ baselineResults.set(`${scenario.scenario_id}:${attempt}`, false);
103
+ return { passed: false, hard_gate_failures: 0 };
104
+ }
105
+ const published = publishResponsePlan({
106
+ plan: outcome.plan,
107
+ registry,
108
+ merchantId: options.merchantId,
109
+ now,
110
+ questions,
111
+ });
112
+ const blockKinds = outcome.plan.blocks.map((block) => block.kind);
113
+ const questionIds = [
114
+ ...outcome.plan.blocks
115
+ .filter((block) => block.kind === "ask_registered_question")
116
+ .map((block) => block.question_id),
117
+ ...outcome.plan.blocks
118
+ .filter((block) => block.kind === "ask_clarification")
119
+ .map((block) => getQuestionIdByReason(block.reason))
120
+ .filter((id) => id !== undefined),
121
+ ];
122
+ const tools = Object.entries(outcome.metrics.toolCalls)
123
+ .filter(([, count]) => count > 0)
124
+ .map(([name]) => name);
125
+ let hardGateFailures = 0;
126
+ for (const forbidden of criteria.forbidden_block_kinds ?? []) {
127
+ if (blockKinds.includes(forbidden))
128
+ hardGateFailures += 1;
129
+ }
130
+ for (const forbidden of criteria.forbidden_tools ?? []) {
131
+ if (tools.includes(forbidden))
132
+ hardGateFailures += 1;
133
+ }
134
+ for (const forbidden of criteria.forbidden_text ?? []) {
135
+ if (published.text.includes(forbidden))
136
+ hardGateFailures += 1;
137
+ }
138
+ const anyBlockOk = criteria.any_block_kinds === undefined ||
139
+ criteria.any_block_kinds.length === 0 ||
140
+ criteria.any_block_kinds.some((kind) => blockKinds.includes(kind));
141
+ const anyQuestionOk = criteria.any_question_ids === undefined ||
142
+ criteria.any_question_ids.length === 0 ||
143
+ criteria.any_question_ids.some((id) => questionIds.includes(id));
144
+ const passed = hardGateFailures === 0 && anyBlockOk && anyQuestionOk;
145
+ const diagnostics = {
146
+ block_kinds: blockKinds,
147
+ question_ids: questionIds,
148
+ tools,
149
+ text_excerpt: published.text.slice(0, 400),
150
+ };
151
+ if (variant === "baseline") {
152
+ baselineResults.set(`${scenario.scenario_id}:${attempt}`, passed);
153
+ return { passed, hard_gate_failures: hardGateFailures, diagnostics };
154
+ }
155
+ const baselinePassed = baseline_passed ?? baselineResults.get(`${scenario.scenario_id}:${attempt}`);
156
+ if (baselinePassed === undefined) {
157
+ throw new Error("evaluation_baseline_missing");
158
+ }
159
+ return {
160
+ passed,
161
+ hard_gate_failures: hardGateFailures,
162
+ improvement_delta: passed === baselinePassed ? 0 : passed ? 1 : -1,
163
+ diagnostics,
164
+ };
165
+ };
166
+ }
167
+ //# sourceMappingURL=real-evaluation-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"real-evaluation-runner.js","sourceRoot":"","sources":["../../../src/merchant-core/learning/real-evaluation-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,8BAA8B,GAE/B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,wBAAwB,GAEzB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC3F,OAAO,EACL,wBAAwB,GAEzB,MAAM,sCAAsC,CAAC;AA0B9C,SAAS,gBAAgB,CAAC,SAA4B;IACpD,OAAO;QACL,SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,UAAU,EAAE,QAAQ,SAAS,CAAC,YAAY,IAAI,SAAS,CAAC,QAAQ,EAAE;QAClE,sBAAsB,EAAE,SAAS,CAAC,sBAAsB;QACxD,UAAU,EAAE,SAAS,CAAC,QAAQ;QAC9B,gBAAgB,EAAE,CAAC;QACnB,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,uBAAuB,EAAE,SAAS,CAAC,uBAAuB;QAC1D,oBAAoB,EAAE,SAAS,CAAC,oBAAoB;QACpD,SAAS,EAAE,SAAS,CAAC,iBAAiB,CAAC,SAAS;QAChD,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,KAAK;QACxC,cAAc,EAAE,S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C,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAClE,WAAW;SACZ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,39 @@
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
+ import type { CurrentSkillBinding } from "../context-governance/context-guard.js";
17
+ import { type ReceptionSkillBinding, type ReceptionSkillCatalog, type SkillSummaryResult } from "../../a2a/reception/skill-catalog.js";
18
+ export declare class SqliteReceptionSkillCatalog implements ReceptionSkillCatalog {
19
+ private readonly dbPath;
20
+ private handle;
21
+ private unavailable;
22
+ constructor(options: {
23
+ dbPath: string;
24
+ });
25
+ private db;
26
+ private rows;
27
+ activeBindings(merchantId: string): ReceptionSkillBinding[];
28
+ summaries(merchantId: string): SkillSummaryResult;
29
+ currentBinding(merchantId: string, skillKey: string): CurrentSkillBinding | undefined;
30
+ /**
31
+ * 加载运行快照中已固定的产物(A10)。
32
+ *
33
+ * RETIRED 不再分配给新运行,但已固定且仍兼容的在途运行可完成;REVOKED
34
+ * 一律拒绝。调用方只在运行快照包含该 release 时才会请求,因此这里不
35
+ * 依赖当前生效指针。
36
+ */
37
+ loadArtifact(merchantId: string, skillKey: string, releaseId: string): ReceptionSkillBinding | undefined;
38
+ close(): void;
39
+ }
@@ -0,0 +1,145 @@
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
+ * 基于 state.sqlite 的接待技能目录(M2-6)。
18
+ *
19
+ * 只读取生效指针指向且 state=ACTIVE 的发布版本;撤回/退役后立即不再返回。
20
+ * 数据库是懒打开:首个技能发布前或旧二进制库中没有学习表时返回空目录,
21
+ * 不影响现有接待(fail-open 到“无技能”,而不是破坏接待启动)。
22
+ */
23
+ import { existsSync } from "node:fs";
24
+ import { DatabaseSync } from "node:sqlite";
25
+ import { summarizeBindings, } from "../../a2a/reception/skill-catalog.js";
26
+ const ACTIVE_BINDINGS_SQL = `
27
+ SELECT r.release_id, r.skill_key, r.trigger_text, r.generation, r.artifact_hash,
28
+ r.compiled_artifact_json, r.question_schema_version, r.tool_contract_digest,
29
+ r.revocation_epoch
30
+ FROM skill_active_pointers p
31
+ JOIN skill_releases r
32
+ ON r.merchant_id = p.merchant_id AND r.release_id = p.release_id
33
+ WHERE p.merchant_id = ? AND p.release_id IS NOT NULL AND r.state = 'ACTIVE'
34
+ ORDER BY r.skill_key ASC
35
+ `;
36
+ function toBinding(row) {
37
+ let artifact;
38
+ try {
39
+ artifact = JSON.parse(row.compiled_artifact_json);
40
+ }
41
+ catch {
42
+ return undefined;
43
+ }
44
+ if (artifact === null ||
45
+ typeof artifact !== "object" ||
46
+ typeof artifact.body_text !== "string" ||
47
+ !Array.isArray(artifact.steps) ||
48
+ !Array.isArray(artifact.required_tools)) {
49
+ return undefined;
50
+ }
51
+ return {
52
+ skill_key: row.skill_key,
53
+ release_id: row.release_id,
54
+ compiled_artifact_hash: row.artifact_hash,
55
+ generation: row.generation,
56
+ revocation_epoch: row.revocation_epoch,
57
+ trigger_text: row.trigger_text,
58
+ question_schema_version: row.question_schema_version,
59
+ tool_contract_digest: row.tool_contract_digest,
60
+ body_text: artifact.body_text,
61
+ steps: artifact.steps,
62
+ required_tools: artifact.required_tools,
63
+ };
64
+ }
65
+ export class SqliteReceptionSkillCatalog {
66
+ dbPath;
67
+ handle;
68
+ unavailable = false;
69
+ constructor(options) {
70
+ this.dbPath = options.dbPath;
71
+ }
72
+ db() {
73
+ if (this.handle !== undefined)
74
+ return this.handle;
75
+ if (this.unavailable || !existsSync(this.dbPath))
76
+ return undefined;
77
+ try {
78
+ this.handle = new DatabaseSync(this.dbPath);
79
+ return this.handle;
80
+ }
81
+ catch {
82
+ this.unavailable = true;
83
+ return undefined;
84
+ }
85
+ }
86
+ rows(sql, ...params) {
87
+ const db = this.db();
88
+ if (db === undefined)
89
+ return [];
90
+ try {
91
+ return db.prepare(sql).all(...params);
92
+ }
93
+ catch {
94
+ // 旧库/迁移未完成:保持空目录,不阻断接待。
95
+ return [];
96
+ }
97
+ }
98
+ activeBindings(merchantId) {
99
+ return this.rows(ACTIVE_BINDINGS_SQL, merchantId)
100
+ .map(toBinding)
101
+ .filter((binding) => binding !== undefined);
102
+ }
103
+ summaries(merchantId) {
104
+ return summarizeBindings(this.activeBindings(merchantId));
105
+ }
106
+ currentBinding(merchantId, skillKey) {
107
+ const binding = this.activeBindings(merchantId).find((item) => item.skill_key === skillKey);
108
+ return binding === undefined
109
+ ? undefined
110
+ : {
111
+ release_id: binding.release_id,
112
+ compiled_artifact_hash: binding.compiled_artifact_hash,
113
+ generation: binding.generation,
114
+ revocation_epoch: binding.revocation_epoch,
115
+ };
116
+ }
117
+ /**
118
+ * 加载运行快照中已固定的产物(A10)。
119
+ *
120
+ * RETIRED 不再分配给新运行,但已固定且仍兼容的在途运行可完成;REVOKED
121
+ * 一律拒绝。调用方只在运行快照包含该 release 时才会请求,因此这里不
122
+ * 依赖当前生效指针。
123
+ */
124
+ loadArtifact(merchantId, skillKey, releaseId) {
125
+ const rows = this.rows(`SELECT r.release_id, r.skill_key, r.trigger_text, r.generation, r.artifact_hash,
126
+ r.compiled_artifact_json, r.question_schema_version, r.tool_contract_digest,
127
+ r.revocation_epoch
128
+ FROM skill_releases r
129
+ WHERE r.merchant_id = ? AND r.skill_key = ? AND r.release_id = ?
130
+ AND r.state IN ('ACTIVE','RETIRED') AND r.revoked_at IS NULL`, merchantId, skillKey, releaseId);
131
+ return rows.length === 1 ? toBinding(rows[0]) : undefined;
132
+ }
133
+ close() {
134
+ if (this.handle !== undefined) {
135
+ try {
136
+ this.handle.close();
137
+ }
138
+ catch {
139
+ // 关闭失败不影响退出。
140
+ }
141
+ this.handle = undefined;
142
+ }
143
+ }
144
+ }
145
+ //# sourceMappingURL=reception-skill-catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reception-skill-catalog.js","sourceRoot":"","sources":["../../../src/merchant-core/learning/reception-skill-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EACL,iBAAiB,GAIlB,MAAM,sCAAsC,CAAC;AAmB9C,MAAM,mBAAmB,GAAG;;;;;;;;;CAS3B,CAAC;AAEF,SAAS,SAAS,CAAC,GAAe;IAChC,IAAI,QAAgC,CAAC;IACrC,IAAI,CAAC;QACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAA2B,CAAC;IAC9E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IACE,QAAQ,KAAK,IAAI;QACjB,OAAO,QAAQ,KAAK,QAAQ;QAC5B,OAAO,QAAQ,CAAC,SAAS,KAAK,QAAQ;QACtC,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KA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AAQ,EACR,SAAS,CACV,CAAC;QACF,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7D,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC9B,IAAI,CAAC;gBACH,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACtB,CAAC;YAAC,MAAM,CAAC;gBACP,aAAa;YACf,CAAC;YACD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QAC1B,CAAC;IACH,CAAC;CACF"}
@@ -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
+ import type { EvaluationRecoveryBinding, EvaluationRecoveryVerification } from "./service.js";
17
+ export interface RecoveryGatewayOptions {
18
+ readonly base_url: string;
19
+ /** 网关鉴权头;由调用方从安全配置读取,不落日志。 */
20
+ readonly headers?: Readonly<Record<string, string>>;
21
+ readonly fetchImpl?: typeof fetch;
22
+ readonly timeout_ms?: number;
23
+ }
24
+ /** 构造 `recoveryVerifier`;任何网络/契约/摘要异常都返回 unknown(fail-closed)。 */
25
+ export declare function createRecoveryGatewayVerifier(options: RecoveryGatewayOptions): (binding: EvaluationRecoveryBinding, evidenceRef: string) => Promise<EvaluationRecoveryVerification>;
26
+ /** 从环境变量构造;未配置 URL 时返回 undefined(保持原阻塞行为)。 */
27
+ export declare function createRecoveryGatewayVerifierFromEnv(env?: Record<string, string | undefined>): ((binding: EvaluationRecoveryBinding, evidenceRef: string) => Promise<EvaluationRecoveryVerification>) | undefined;