aimeat 2.1.0 → 2.3.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 (1300) hide show
  1. package/README.md +110 -84
  2. package/dist/.env.example +57 -16
  3. package/dist/locales/en.json +277 -369
  4. package/dist/locales/fi.json +281 -373
  5. package/dist/public/components/ContactCard.js +30 -5
  6. package/dist/public/components/ContactPicker.js +3 -2
  7. package/dist/public/components/ImageDeliverable.js +2 -1
  8. package/dist/public/components/JsonView.js +1 -0
  9. package/dist/public/components/LinkPreview.js +1 -1
  10. package/dist/public/components/NotificationBell.js +6 -4
  11. package/dist/public/components/UsageChart.js +2 -1
  12. package/dist/public/cortex-bundled/aimeat-charts.js +158 -10
  13. package/dist/public/cortex-bundled/aimeat-charts.yaml +1 -1
  14. package/dist/public/cortex-bundled/aimeat-dag.js +515 -173
  15. package/dist/public/cortex-bundled/aimeat-dag.yaml +1 -1
  16. package/dist/public/cortex-bundled/aimeat-i18n.js +6 -1
  17. package/dist/public/cortex-bundled/aimeat-i18n.yaml +1 -1
  18. package/dist/public/cortex-bundled/aimeat-surface.js +577 -0
  19. package/dist/public/cortex-bundled/aimeat-surface.yaml +107 -0
  20. package/dist/public/cortex-bundled/aimeat-viewport.js +405 -0
  21. package/dist/public/cortex-bundled/aimeat-viewport.yaml +100 -0
  22. package/dist/public/css/theme.css +1516 -1432
  23. package/dist/public/css/views/app-grant.css +95 -36
  24. package/dist/public/css/views/help.css +28 -0
  25. package/dist/public/css/views/inbox.css +1 -1
  26. package/dist/public/css/views/landing.css +20 -0
  27. package/dist/public/css/views/members.css +40 -10
  28. package/dist/public/css/views/portal-dev.css +64 -45
  29. package/dist/public/css/views/profile.css +17 -0
  30. package/dist/public/js/api.js +1 -0
  31. package/dist/public/js/app-sandbox.js +1 -0
  32. package/dist/public/js/components/auth-image.js +3 -1
  33. package/dist/public/js/i18n.js +3 -1
  34. package/dist/public/js/presence-store.js +3 -1
  35. package/dist/public/js/recents.js +2 -0
  36. package/dist/public/js/services/agent-activity.js +2 -1
  37. package/dist/public/js/services/agent-directives.js +2 -1
  38. package/dist/public/js/services/agent-integration.js +2 -1
  39. package/dist/public/js/services/agent-messages.js +2 -1
  40. package/dist/public/js/services/agent-tasks.js +2 -1
  41. package/dist/public/js/services/agents.js +3 -2
  42. package/dist/public/js/services/calibrator.js +2 -1
  43. package/dist/public/js/services/consent.js +2 -1
  44. package/dist/public/js/services/contacts.js +2 -1
  45. package/dist/public/js/services/cortex.js +5 -4
  46. package/dist/public/js/services/ecosystem.js +2 -1
  47. package/dist/public/js/services/knowledge.js +2 -1
  48. package/dist/public/js/services/ledger.js +2 -1
  49. package/dist/public/js/services/living.js +10 -9
  50. package/dist/public/js/services/memory.js +2 -1
  51. package/dist/public/js/services/messages.js +53 -8
  52. package/dist/public/js/services/nodes.js +3 -2
  53. package/dist/public/js/services/notebook-plan.js +2 -1
  54. package/dist/public/js/services/notebook.js +6 -5
  55. package/dist/public/js/services/offers.js +6 -5
  56. package/dist/public/js/services/organisms.js +26 -25
  57. package/dist/public/js/services/organisms.prompts.js +3 -2
  58. package/dist/public/js/services/organisms.shared.js +2 -1
  59. package/dist/public/js/services/organisms.workspace-gen.js +3 -2
  60. package/dist/public/js/services/packages.js +1 -0
  61. package/dist/public/js/services/schedules.js +2 -1
  62. package/dist/public/js/services/security.js +3 -2
  63. package/dist/public/js/services/skills.js +1 -0
  64. package/dist/public/js/services/tracked-responses.js +4 -3
  65. package/dist/public/js/services/unfurl.js +4 -4
  66. package/dist/public/js/services/work.js +2 -1
  67. package/dist/public/js/site.js +74 -0
  68. package/dist/public/js/swallowed.js +69 -0
  69. package/dist/public/js/theme.js +2 -1
  70. package/dist/public/js/utils.js +3 -1
  71. package/dist/public/lib/VENDORED.md +7 -3
  72. package/dist/public/lib/aimeat-daisyui-bridge.css +39 -2
  73. package/dist/public/lib/aimeat-game/board.css +262 -0
  74. package/dist/public/lib/aimeat-game/progress.css +406 -0
  75. package/dist/public/lib/aimeat-game/shell.css +388 -0
  76. package/dist/public/lib/aimeat-game.css +394 -0
  77. package/dist/public/lib/aimeat-theme.css +538 -0
  78. package/dist/public/lib/fonts/LICENSE.md +11 -4
  79. package/dist/public/lib/fonts/fraunces-var-latin-ext.woff2 +0 -0
  80. package/dist/public/lib/fonts/fraunces-var-latin.woff2 +0 -0
  81. package/dist/public/lib/fonts/inter-var-latin-ext.woff2 +0 -0
  82. package/dist/public/lib/fonts/inter-var-latin.woff2 +0 -0
  83. package/dist/public/lib/fonts/jetbrains-mono-var-latin-ext.woff2 +0 -0
  84. package/dist/public/lib/fonts/jetbrains-mono-var-latin.woff2 +0 -0
  85. package/dist/public/lib/fonts/space-grotesk-var-latin-ext.woff2 +0 -0
  86. package/dist/public/lib/fonts/space-grotesk-var-latin.woff2 +0 -0
  87. package/dist/public/lib/pdfjs@6/pdf.min.mjs +29 -0
  88. package/dist/public/lib/pdfjs@6/pdf.worker.min.mjs +29 -0
  89. package/dist/public/lib/samples/theme-check.html +92 -0
  90. package/dist/public/lib/samples/themes-boot.js +20 -0
  91. package/dist/public/lib/samples/themes.html +154 -0
  92. package/dist/public/lib/samples/themes.js +60 -0
  93. package/dist/public/privacy.fi.html +1 -1
  94. package/dist/public/privacy.html +1 -1
  95. package/dist/public/spa.html +885 -793
  96. package/dist/public/sw.js +4 -2
  97. package/dist/public/views/admin/agent-integration-tab.js +7 -6
  98. package/dist/public/views/admin/ai-usage-tab.js +2 -1
  99. package/dist/public/views/admin/cortex-tab.js +2 -1
  100. package/dist/public/views/admin/economy-tab.js +0 -1
  101. package/dist/public/views/admin/email-tab.js +4 -2
  102. package/dist/public/views/admin/federation-tab.js +3 -2
  103. package/dist/public/views/admin/feedback-tab.js +2 -1
  104. package/dist/public/views/admin/knowledge-tab.js +2 -1
  105. package/dist/public/views/admin/messages-tab.js +2 -1
  106. package/dist/public/views/admin/msm-tab.js +2 -1
  107. package/dist/public/views/admin/packages-tab.js +3 -2
  108. package/dist/public/views/admin/portal-tab.js +7 -2
  109. package/dist/public/views/admin/push-tab.js +9 -4
  110. package/dist/public/views/admin/stats-tab.js +2 -1
  111. package/dist/public/views/admin/usage-tab.js +4 -3
  112. package/dist/public/views/admin.js +6 -4
  113. package/dist/public/views/agent-solo.js +4 -3
  114. package/dist/public/views/app-grant.js +105 -32
  115. package/dist/public/views/business.js +139 -55
  116. package/dist/public/views/command-palette.js +5 -3
  117. package/dist/public/views/companies.js +3 -2
  118. package/dist/public/views/doc-solo.js +2 -1
  119. package/dist/public/views/help.js +95 -15
  120. package/dist/public/views/how-it-works.js +41 -8
  121. package/dist/public/views/invite-accept.js +3 -2
  122. package/dist/public/views/landing-activity.js +3 -2
  123. package/dist/public/views/landing-node-totals.js +2 -1
  124. package/dist/public/views/landing.js +75 -152
  125. package/dist/public/views/members.js +29 -2
  126. package/dist/public/views/my-company.js +9 -7
  127. package/dist/public/views/my-company.payments.js +2 -1
  128. package/dist/public/views/portal-classic.js +2 -1
  129. package/dist/public/views/portal-dev.js +64 -35
  130. package/dist/public/views/portal-dev.panels.js +39 -2
  131. package/dist/public/views/portal-dev.upload.js +25 -196
  132. package/dist/public/views/portal.components.js +4 -3
  133. package/dist/public/views/portfolio.js +5 -4
  134. package/dist/public/views/profile/access-tab/access-tokens.js +2 -1
  135. package/dist/public/views/profile/access-tab/agent-defaults.js +3 -1
  136. package/dist/public/views/profile/access-tab/connected-apps.js +152 -7
  137. package/dist/public/views/profile/access-tab/sharing-groups.js +4 -1
  138. package/dist/public/views/profile/access-tab.js +3 -1
  139. package/dist/public/views/profile/agents/agent-card.js +6 -5
  140. package/dist/public/views/profile/agents/tab-activity.js +10 -8
  141. package/dist/public/views/profile/agents/tab-agent-config.js +3 -1
  142. package/dist/public/views/profile/agents/tab-contracts.js +2 -1
  143. package/dist/public/views/profile/agents/tab-data-access.js +10 -7
  144. package/dist/public/views/profile/agents/tab-helpers.js +5 -0
  145. package/dist/public/views/profile/agents/tab-integration.js +12 -9
  146. package/dist/public/views/profile/agents/tab-messages.js +6 -4
  147. package/dist/public/views/profile/agents/tab-quality.js +3 -2
  148. package/dist/public/views/profile/agents/tab-usage.js +5 -3
  149. package/dist/public/views/profile/agents/task-item.js +12 -7
  150. package/dist/public/views/profile/agents-activity-subtab.js +5 -2
  151. package/dist/public/views/profile/agents-capabilities-subtab.js +4 -2
  152. package/dist/public/views/profile/agents-messages-subtab.js +5 -2
  153. package/dist/public/views/profile/agents-services-subtab.js +1 -0
  154. package/dist/public/views/profile/agents-tab.js +11 -7
  155. package/dist/public/views/profile/appdev-tab.js +3 -2
  156. package/dist/public/views/profile/apps-tab.js +10 -8
  157. package/dist/public/views/profile/boards-tab.js +5 -4
  158. package/dist/public/views/profile/calibrator-batch.helpers.js +3 -2
  159. package/dist/public/views/profile/calibrator-batch.js +3 -1
  160. package/dist/public/views/profile/calibrator-llm-editor.js +3 -2
  161. package/dist/public/views/profile/calibrator-tab.js +5 -4
  162. package/dist/public/views/profile/capabilities-tab.js +2 -1
  163. package/dist/public/views/profile/chat-sessions-tab.js +6 -3
  164. package/dist/public/views/profile/contacts-tab.js +2 -1
  165. package/dist/public/views/profile/data-wallet-tab.js +5 -4
  166. package/dist/public/views/profile/discover-tab.js +4 -1
  167. package/dist/public/views/profile/ecosystem-tab.automation.js +13 -9
  168. package/dist/public/views/profile/ecosystem-tab.cards.js +3 -2
  169. package/dist/public/views/profile/ecosystem-tab.js +10 -7
  170. package/dist/public/views/profile/email-tab.js +2 -1
  171. package/dist/public/views/profile/extensions-tab.js +7 -6
  172. package/dist/public/views/profile/extensions-tab.maturity.js +6 -2
  173. package/dist/public/views/profile/extensions-tab.prompts.js +24 -0
  174. package/dist/public/views/profile/federation-tab.js +2 -1
  175. package/dist/public/views/profile/inbox-tab/components.js +30 -11
  176. package/dist/public/views/profile/inbox-tab/helpers.js +15 -1
  177. package/dist/public/views/profile/inbox-tab/use-thread-ux.js +30 -3
  178. package/dist/public/views/profile/inbox-tab.js +33 -30
  179. package/dist/public/views/profile/inline-panels.js +5 -4
  180. package/dist/public/views/profile/knowledge-tab.js +15 -13
  181. package/dist/public/views/profile/landing-page.cards.js +14 -9
  182. package/dist/public/views/profile/landing-page.helpers.js +5 -2
  183. package/dist/public/views/profile/landing-page.js +11 -7
  184. package/dist/public/views/profile/landing-page.modals.js +8 -5
  185. package/dist/public/views/profile/libraries-tab.js +10 -2
  186. package/dist/public/views/profile/living-tab.js +3 -2
  187. package/dist/public/views/profile/mcp-tab.js +4 -2
  188. package/dist/public/views/profile/memory-tab/browse-view.js +3 -2
  189. package/dist/public/views/profile/memory-tab/components.js +4 -3
  190. package/dist/public/views/profile/memory-tab/entries-view.js +3 -2
  191. package/dist/public/views/profile/memory-tab.js +18 -16
  192. package/dist/public/views/profile/nodes-tab.js +2 -1
  193. package/dist/public/views/profile/notebook-card.js +4 -3
  194. package/dist/public/views/profile/notebook-tab.js +7 -5
  195. package/dist/public/views/profile/notifications-tab.js +9 -5
  196. package/dist/public/views/profile/offers-tab.js +5 -4
  197. package/dist/public/views/profile/openrouter-settings.js +5 -4
  198. package/dist/public/views/profile/organisms/activity-panel.js +2 -1
  199. package/dist/public/views/profile/organisms/agents.js +2 -1
  200. package/dist/public/views/profile/organisms/document.js +13 -12
  201. package/dist/public/views/profile/organisms/helpers.js +2 -1
  202. package/dist/public/views/profile/organisms/home.js +7 -6
  203. package/dist/public/views/profile/organisms/invite-panel.js +1 -1
  204. package/dist/public/views/profile/organisms/members.js +7 -6
  205. package/dist/public/views/profile/organisms/mindmap.js +1 -1
  206. package/dist/public/views/profile/organisms/panels.js +4 -3
  207. package/dist/public/views/profile/organisms/participants-panel.js +11 -10
  208. package/dist/public/views/profile/organisms/readme-panel.js +1 -0
  209. package/dist/public/views/profile/organisms/sources-panel.js +2 -1
  210. package/dist/public/views/profile/organisms/workspace/doc-space.js +2 -1
  211. package/dist/public/views/profile/organisms/workspace/model.js +1 -0
  212. package/dist/public/views/profile/organisms/workspace-apps.js +4 -2
  213. package/dist/public/views/profile/organisms/workspace-comments.js +3 -2
  214. package/dist/public/views/profile/organisms/workspace-list.js +5 -4
  215. package/dist/public/views/profile/organisms/workspace.js +19 -16
  216. package/dist/public/views/profile/organisms-tab.js +20 -12
  217. package/dist/public/views/profile/packages-tab.js +6 -4
  218. package/dist/public/views/profile/portfolio-tab.js +1 -1
  219. package/dist/public/views/profile/scheduler-calendar.js +2 -1
  220. package/dist/public/views/profile/scheduler-tab.js +2 -1
  221. package/dist/public/views/profile/security-tab.js +2 -1
  222. package/dist/public/views/profile/services-tab.js +4 -3
  223. package/dist/public/views/profile/wallet-tab.js +106 -36
  224. package/dist/public/views/profile/work-tab.js +3 -2
  225. package/dist/public/views/profile/workflows-form.js +2 -1
  226. package/dist/public/views/profile/workflows-tab.js +3 -2
  227. package/dist/public/views/public-workspace-viewer.js +7 -4
  228. package/dist/scripts/build-sdk-libs.d.ts.map +1 -1
  229. package/dist/scripts/build-sdk-libs.js +4 -0
  230. package/dist/scripts/build-sdk-libs.js.map +1 -1
  231. package/dist/scripts/check-openapi.d.ts +2 -0
  232. package/dist/scripts/check-openapi.d.ts.map +1 -0
  233. package/dist/scripts/check-openapi.js +139 -0
  234. package/dist/scripts/check-openapi.js.map +1 -0
  235. package/dist/scripts/check-silent-catch.d.ts +2 -0
  236. package/dist/scripts/check-silent-catch.d.ts.map +1 -0
  237. package/dist/scripts/check-silent-catch.js +159 -0
  238. package/dist/scripts/check-silent-catch.js.map +1 -0
  239. package/dist/scripts/embed-viewport.d.ts +23 -0
  240. package/dist/scripts/embed-viewport.d.ts.map +1 -0
  241. package/dist/scripts/embed-viewport.js +116 -0
  242. package/dist/scripts/embed-viewport.js.map +1 -0
  243. package/dist/src/auth/jwt.d.ts +2 -0
  244. package/dist/src/auth/jwt.d.ts.map +1 -1
  245. package/dist/src/auth/jwt.js +15 -3
  246. package/dist/src/auth/jwt.js.map +1 -1
  247. package/dist/src/auth/keypair.d.ts.map +1 -1
  248. package/dist/src/auth/keypair.js +3 -0
  249. package/dist/src/auth/keypair.js.map +1 -1
  250. package/dist/src/auth/middleware.d.ts +2 -0
  251. package/dist/src/auth/middleware.d.ts.map +1 -1
  252. package/dist/src/auth/middleware.js +33 -14
  253. package/dist/src/auth/middleware.js.map +1 -1
  254. package/dist/src/auth/node-keys.d.ts.map +1 -1
  255. package/dist/src/auth/node-keys.js +59 -16
  256. package/dist/src/auth/node-keys.js.map +1 -1
  257. package/dist/src/auth/sse-domain-scopes.d.ts +50 -0
  258. package/dist/src/auth/sse-domain-scopes.d.ts.map +1 -0
  259. package/dist/src/auth/sse-domain-scopes.js +111 -0
  260. package/dist/src/auth/sse-domain-scopes.js.map +1 -0
  261. package/dist/src/cli/config-import.d.ts.map +1 -1
  262. package/dist/src/cli/config-import.js +3 -1
  263. package/dist/src/cli/config-import.js.map +1 -1
  264. package/dist/src/cli/connect/auth.d.ts.map +1 -1
  265. package/dist/src/cli/connect/auth.js +1 -0
  266. package/dist/src/cli/connect/auth.js.map +1 -1
  267. package/dist/src/cli/connect/config.d.ts.map +1 -1
  268. package/dist/src/cli/connect/config.js +3 -1
  269. package/dist/src/cli/connect/config.js.map +1 -1
  270. package/dist/src/cli/connect/keychain.d.ts.map +1 -1
  271. package/dist/src/cli/connect/keychain.js +6 -2
  272. package/dist/src/cli/connect/keychain.js.map +1 -1
  273. package/dist/src/cli/connect/mcp/local-server.d.ts.map +1 -1
  274. package/dist/src/cli/connect/mcp/local-server.js +9 -2
  275. package/dist/src/cli/connect/mcp/local-server.js.map +1 -1
  276. package/dist/src/cli/connect/mcp/tools/agent-tasks.d.ts.map +1 -1
  277. package/dist/src/cli/connect/mcp/tools/agent-tasks.js +4 -1
  278. package/dist/src/cli/connect/mcp/tools/agent-tasks.js.map +1 -1
  279. package/dist/src/cli/connect/mcp/tools/core.d.ts.map +1 -1
  280. package/dist/src/cli/connect/mcp/tools/core.js +14 -3
  281. package/dist/src/cli/connect/mcp/tools/core.js.map +1 -1
  282. package/dist/src/cli/connect/mcp/tools/workspaces.d.ts +3 -0
  283. package/dist/src/cli/connect/mcp/tools/workspaces.d.ts.map +1 -1
  284. package/dist/src/cli/connect/mcp/tools/workspaces.js +6 -2
  285. package/dist/src/cli/connect/mcp/tools/workspaces.js.map +1 -1
  286. package/dist/src/cli/connect/task-runner.d.ts.map +1 -1
  287. package/dist/src/cli/connect/task-runner.js +11 -4
  288. package/dist/src/cli/connect/task-runner.js.map +1 -1
  289. package/dist/src/cli/connect/tool-call-defs-core.d.ts.map +1 -1
  290. package/dist/src/cli/connect/tool-call-defs-core.js +13 -1
  291. package/dist/src/cli/connect/tool-call-defs-core.js.map +1 -1
  292. package/dist/src/cli/connect/tool-call-helpers.d.ts.map +1 -1
  293. package/dist/src/cli/connect/tool-call-helpers.js +1 -0
  294. package/dist/src/cli/connect/tool-call-helpers.js.map +1 -1
  295. package/dist/src/cli/connect/tunnel-client.d.ts.map +1 -1
  296. package/dist/src/cli/connect/tunnel-client.js +26 -8
  297. package/dist/src/cli/connect/tunnel-client.js.map +1 -1
  298. package/dist/src/cli/federation-join.d.ts.map +1 -1
  299. package/dist/src/cli/federation-join.js +7 -3
  300. package/dist/src/cli/federation-join.js.map +1 -1
  301. package/dist/src/cli/init-wizard/presets.d.ts.map +1 -1
  302. package/dist/src/cli/init-wizard/presets.js +21 -0
  303. package/dist/src/cli/init-wizard/presets.js.map +1 -1
  304. package/dist/src/cli/init-wizard/steps-advanced.d.ts.map +1 -1
  305. package/dist/src/cli/init-wizard/steps-advanced.js +2 -0
  306. package/dist/src/cli/init-wizard/steps-advanced.js.map +1 -1
  307. package/dist/src/cli/init-wizard/steps-operator.d.ts.map +1 -1
  308. package/dist/src/cli/init-wizard/steps-operator.js +10 -0
  309. package/dist/src/cli/init-wizard/steps-operator.js.map +1 -1
  310. package/dist/src/commerce/__tests__/x402-registry.test.d.ts +2 -0
  311. package/dist/src/commerce/__tests__/x402-registry.test.d.ts.map +1 -0
  312. package/dist/src/commerce/__tests__/x402-registry.test.js +105 -0
  313. package/dist/src/commerce/__tests__/x402-registry.test.js.map +1 -0
  314. package/dist/src/commerce/evm-address.d.ts +21 -0
  315. package/dist/src/commerce/evm-address.d.ts.map +1 -0
  316. package/dist/src/commerce/evm-address.js +94 -0
  317. package/dist/src/commerce/evm-address.js.map +1 -0
  318. package/dist/src/commerce/invoice-handler.d.ts +5 -0
  319. package/dist/src/commerce/invoice-handler.d.ts.map +1 -0
  320. package/dist/src/commerce/invoice-handler.js +41 -0
  321. package/dist/src/commerce/invoice-handler.js.map +1 -0
  322. package/dist/src/commerce/money.d.ts +18 -5
  323. package/dist/src/commerce/money.d.ts.map +1 -1
  324. package/dist/src/commerce/money.js +27 -6
  325. package/dist/src/commerce/money.js.map +1 -1
  326. package/dist/src/commerce/payable-book.d.ts +31 -0
  327. package/dist/src/commerce/payable-book.d.ts.map +1 -0
  328. package/dist/src/commerce/payable-book.js +27 -0
  329. package/dist/src/commerce/payable-book.js.map +1 -0
  330. package/dist/src/commerce/payment-handlers.d.ts.map +1 -1
  331. package/dist/src/commerce/payment-handlers.js +8 -4
  332. package/dist/src/commerce/payment-handlers.js.map +1 -1
  333. package/dist/src/commerce/sellable-resolvers.d.ts +6 -6
  334. package/dist/src/commerce/sellable-resolvers.d.ts.map +1 -1
  335. package/dist/src/commerce/sellable-resolvers.js +17 -4
  336. package/dist/src/commerce/sellable-resolvers.js.map +1 -1
  337. package/dist/src/commerce/session-service.js +2 -2
  338. package/dist/src/commerce/session-service.js.map +1 -1
  339. package/dist/src/commerce/stripe-handler.d.ts +33 -0
  340. package/dist/src/commerce/stripe-handler.d.ts.map +1 -0
  341. package/dist/src/commerce/stripe-handler.js +108 -0
  342. package/dist/src/commerce/stripe-handler.js.map +1 -0
  343. package/dist/src/commerce/types.d.ts +10 -12
  344. package/dist/src/commerce/types.d.ts.map +1 -1
  345. package/dist/src/commerce/x402-facilitator.d.ts +64 -13
  346. package/dist/src/commerce/x402-facilitator.d.ts.map +1 -1
  347. package/dist/src/commerce/x402-facilitator.js +72 -19
  348. package/dist/src/commerce/x402-facilitator.js.map +1 -1
  349. package/dist/src/commerce/x402-handler.d.ts +13 -7
  350. package/dist/src/commerce/x402-handler.d.ts.map +1 -1
  351. package/dist/src/commerce/x402-handler.js +23 -10
  352. package/dist/src/commerce/x402-handler.js.map +1 -1
  353. package/dist/src/commerce/x402.d.ts +11 -6
  354. package/dist/src/commerce/x402.d.ts.map +1 -1
  355. package/dist/src/commerce/x402.js +10 -7
  356. package/dist/src/commerce/x402.js.map +1 -1
  357. package/dist/src/config-types.d.ts +78 -0
  358. package/dist/src/config-types.d.ts.map +1 -1
  359. package/dist/src/config.d.ts.map +1 -1
  360. package/dist/src/config.js +70 -1
  361. package/dist/src/config.js.map +1 -1
  362. package/dist/src/data/app-templates/shells.d.ts +11 -3
  363. package/dist/src/data/app-templates/shells.d.ts.map +1 -1
  364. package/dist/src/data/app-templates/shells.js +87 -6
  365. package/dist/src/data/app-templates/shells.js.map +1 -1
  366. package/dist/src/data/app-templates.js +2 -2
  367. package/dist/src/data/app-templates.js.map +1 -1
  368. package/dist/src/data/library-packs/cortex.d.ts.map +1 -1
  369. package/dist/src/data/library-packs/cortex.js +108 -5
  370. package/dist/src/data/library-packs/cortex.js.map +1 -1
  371. package/dist/src/data/library-packs/sdk.d.ts +4 -0
  372. package/dist/src/data/library-packs/sdk.d.ts.map +1 -1
  373. package/dist/src/data/library-packs/sdk.js +78 -8
  374. package/dist/src/data/library-packs/sdk.js.map +1 -1
  375. package/dist/src/data/library-packs/vendored.d.ts.map +1 -1
  376. package/dist/src/data/library-packs/vendored.js +171 -6
  377. package/dist/src/data/library-packs/vendored.js.map +1 -1
  378. package/dist/src/generated/api-types.d.ts +949 -44
  379. package/dist/src/generated/api-types.d.ts.map +1 -1
  380. package/dist/src/index-connect.d.ts.map +1 -1
  381. package/dist/src/index-connect.js +4 -1
  382. package/dist/src/index-connect.js.map +1 -1
  383. package/dist/src/index-start.d.ts.map +1 -1
  384. package/dist/src/index-start.js +10 -6
  385. package/dist/src/index-start.js.map +1 -1
  386. package/dist/src/mcp/agent-tasks.d.ts +4 -0
  387. package/dist/src/mcp/agent-tasks.d.ts.map +1 -1
  388. package/dist/src/mcp/agent-tasks.js +20 -2
  389. package/dist/src/mcp/agent-tasks.js.map +1 -1
  390. package/dist/src/mcp/app-template-proposals.d.ts.map +1 -1
  391. package/dist/src/mcp/app-template-proposals.js +2 -1
  392. package/dist/src/mcp/app-template-proposals.js.map +1 -1
  393. package/dist/src/mcp/apps.d.ts.map +1 -1
  394. package/dist/src/mcp/apps.js +4 -3
  395. package/dist/src/mcp/apps.js.map +1 -1
  396. package/dist/src/mcp/capabilities.d.ts +7 -1
  397. package/dist/src/mcp/capabilities.d.ts.map +1 -1
  398. package/dist/src/mcp/capabilities.js +8 -4
  399. package/dist/src/mcp/capabilities.js.map +1 -1
  400. package/dist/src/mcp/catalog/definitions/commerce.d.ts.map +1 -1
  401. package/dist/src/mcp/catalog/definitions/commerce.js +4 -2
  402. package/dist/src/mcp/catalog/definitions/commerce.js.map +1 -1
  403. package/dist/src/mcp/catalog/definitions/discovery-work-boards.d.ts.map +1 -1
  404. package/dist/src/mcp/catalog/definitions/discovery-work-boards.js +4 -3
  405. package/dist/src/mcp/catalog/definitions/discovery-work-boards.js.map +1 -1
  406. package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js +1 -1
  407. package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js.map +1 -1
  408. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.d.ts.map +1 -1
  409. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js +3 -2
  410. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js.map +1 -1
  411. package/dist/src/mcp/catalog/output-schemas.d.ts +6 -1
  412. package/dist/src/mcp/catalog/output-schemas.d.ts.map +1 -1
  413. package/dist/src/mcp/catalog/output-schemas.js +6 -1
  414. package/dist/src/mcp/catalog/output-schemas.js.map +1 -1
  415. package/dist/src/mcp/catalog/scopes.d.ts +0 -1
  416. package/dist/src/mcp/catalog/scopes.d.ts.map +1 -1
  417. package/dist/src/mcp/catalog/scopes.js +2 -11
  418. package/dist/src/mcp/catalog/scopes.js.map +1 -1
  419. package/dist/src/mcp/catalog/surfaces.d.ts +1 -7
  420. package/dist/src/mcp/catalog/surfaces.d.ts.map +1 -1
  421. package/dist/src/mcp/catalog/surfaces.js +10 -16
  422. package/dist/src/mcp/catalog/surfaces.js.map +1 -1
  423. package/dist/src/mcp/commerce.d.ts.map +1 -1
  424. package/dist/src/mcp/commerce.js +50 -6
  425. package/dist/src/mcp/commerce.js.map +1 -1
  426. package/dist/src/mcp/core-storage.d.ts +23 -0
  427. package/dist/src/mcp/core-storage.d.ts.map +1 -0
  428. package/dist/src/mcp/core-storage.js +157 -0
  429. package/dist/src/mcp/core-storage.js.map +1 -0
  430. package/dist/src/mcp/core.d.ts +16 -0
  431. package/dist/src/mcp/core.d.ts.map +1 -1
  432. package/dist/src/mcp/core.js +78 -121
  433. package/dist/src/mcp/core.js.map +1 -1
  434. package/dist/src/mcp/dm-messages.d.ts +4 -0
  435. package/dist/src/mcp/dm-messages.d.ts.map +1 -1
  436. package/dist/src/mcp/dm-messages.js +43 -2
  437. package/dist/src/mcp/dm-messages.js.map +1 -1
  438. package/dist/src/mcp/exchange-run.d.ts +28 -0
  439. package/dist/src/mcp/exchange-run.d.ts.map +1 -1
  440. package/dist/src/mcp/exchange-run.js +58 -37
  441. package/dist/src/mcp/exchange-run.js.map +1 -1
  442. package/dist/src/mcp/exchange.d.ts.map +1 -1
  443. package/dist/src/mcp/exchange.js +12 -9
  444. package/dist/src/mcp/exchange.js.map +1 -1
  445. package/dist/src/mcp/extensions.d.ts.map +1 -1
  446. package/dist/src/mcp/extensions.js +66 -108
  447. package/dist/src/mcp/extensions.js.map +1 -1
  448. package/dist/src/mcp/index.d.ts +5 -0
  449. package/dist/src/mcp/index.d.ts.map +1 -1
  450. package/dist/src/mcp/index.js +24 -9
  451. package/dist/src/mcp/index.js.map +1 -1
  452. package/dist/src/mcp/knowledge.d.ts.map +1 -1
  453. package/dist/src/mcp/knowledge.js +1 -0
  454. package/dist/src/mcp/knowledge.js.map +1 -1
  455. package/dist/src/mcp/memory-namespace-hints.d.ts +33 -0
  456. package/dist/src/mcp/memory-namespace-hints.d.ts.map +1 -0
  457. package/dist/src/mcp/memory-namespace-hints.js +60 -0
  458. package/dist/src/mcp/memory-namespace-hints.js.map +1 -0
  459. package/dist/src/mcp/oauth.d.ts +3 -0
  460. package/dist/src/mcp/oauth.d.ts.map +1 -1
  461. package/dist/src/mcp/oauth.js +13 -8
  462. package/dist/src/mcp/oauth.js.map +1 -1
  463. package/dist/src/mcp/workspaces.d.ts +5 -0
  464. package/dist/src/mcp/workspaces.d.ts.map +1 -1
  465. package/dist/src/mcp/workspaces.js +12 -7
  466. package/dist/src/mcp/workspaces.js.map +1 -1
  467. package/dist/src/middleware/cors.d.ts.map +1 -1
  468. package/dist/src/middleware/cors.js +3 -1
  469. package/dist/src/middleware/cors.js.map +1 -1
  470. package/dist/src/middleware/subdomain.d.ts +4 -0
  471. package/dist/src/middleware/subdomain.d.ts.map +1 -1
  472. package/dist/src/middleware/subdomain.js +23 -2
  473. package/dist/src/middleware/subdomain.js.map +1 -1
  474. package/dist/src/models/agent-task-schemas.d.ts +25 -3
  475. package/dist/src/models/agent-task-schemas.d.ts.map +1 -1
  476. package/dist/src/models/agent-task-schemas.js +16 -0
  477. package/dist/src/models/agent-task-schemas.js.map +1 -1
  478. package/dist/src/models/app-tool-schemas.d.ts +553 -1
  479. package/dist/src/models/app-tool-schemas.d.ts.map +1 -1
  480. package/dist/src/models/app-tool-schemas.js +97 -1
  481. package/dist/src/models/app-tool-schemas.js.map +1 -1
  482. package/dist/src/models/odps-schemas.d.ts +305 -0
  483. package/dist/src/models/odps-schemas.d.ts.map +1 -0
  484. package/dist/src/models/odps-schemas.js +182 -0
  485. package/dist/src/models/odps-schemas.js.map +1 -0
  486. package/dist/src/models/offer-schemas.d.ts +357 -2
  487. package/dist/src/models/offer-schemas.d.ts.map +1 -1
  488. package/dist/src/models/offer-schemas.js +37 -0
  489. package/dist/src/models/offer-schemas.js.map +1 -1
  490. package/dist/src/models/schemas.d.ts +6 -3
  491. package/dist/src/models/schemas.d.ts.map +1 -1
  492. package/dist/src/models/schemas.js +10 -1
  493. package/dist/src/models/schemas.js.map +1 -1
  494. package/dist/src/models/webhook-schemas.d.ts +8 -8
  495. package/dist/src/routes/admin-config.d.ts.map +1 -1
  496. package/dist/src/routes/admin-config.js +4 -1
  497. package/dist/src/routes/admin-config.js.map +1 -1
  498. package/dist/src/routes/admin-extensions.d.ts.map +1 -1
  499. package/dist/src/routes/admin-extensions.js +2 -1
  500. package/dist/src/routes/admin-extensions.js.map +1 -1
  501. package/dist/src/routes/admin-monitoring.js +14 -5
  502. package/dist/src/routes/admin-monitoring.js.map +1 -1
  503. package/dist/src/routes/admin-security.d.ts.map +1 -1
  504. package/dist/src/routes/admin-security.js +4 -1
  505. package/dist/src/routes/admin-security.js.map +1 -1
  506. package/dist/src/routes/admin.d.ts.map +1 -1
  507. package/dist/src/routes/admin.js +6 -4
  508. package/dist/src/routes/admin.js.map +1 -1
  509. package/dist/src/routes/agent-activity.d.ts.map +1 -1
  510. package/dist/src/routes/agent-activity.js +4 -1
  511. package/dist/src/routes/agent-activity.js.map +1 -1
  512. package/dist/src/routes/agent-directives.d.ts +3 -10
  513. package/dist/src/routes/agent-directives.d.ts.map +1 -1
  514. package/dist/src/routes/agent-directives.js +7 -12
  515. package/dist/src/routes/agent-directives.js.map +1 -1
  516. package/dist/src/routes/agent-integration.d.ts.map +1 -1
  517. package/dist/src/routes/agent-integration.js +3 -1
  518. package/dist/src/routes/agent-integration.js.map +1 -1
  519. package/dist/src/routes/agent-messages.d.ts.map +1 -1
  520. package/dist/src/routes/agent-messages.js +5 -2
  521. package/dist/src/routes/agent-messages.js.map +1 -1
  522. package/dist/src/routes/agent-onboarding.d.ts.map +1 -1
  523. package/dist/src/routes/agent-onboarding.js +19 -6
  524. package/dist/src/routes/agent-onboarding.js.map +1 -1
  525. package/dist/src/routes/agent-skills-discovery.d.ts.map +1 -1
  526. package/dist/src/routes/agent-skills-discovery.js +2 -1
  527. package/dist/src/routes/agent-skills-discovery.js.map +1 -1
  528. package/dist/src/routes/agent-tasks/completion.js +1 -1
  529. package/dist/src/routes/agent-tasks/completion.js.map +1 -1
  530. package/dist/src/routes/agent-tasks/create-read.d.ts +4 -0
  531. package/dist/src/routes/agent-tasks/create-read.d.ts.map +1 -1
  532. package/dist/src/routes/agent-tasks/create-read.js +23 -2
  533. package/dist/src/routes/agent-tasks/create-read.js.map +1 -1
  534. package/dist/src/routes/agent-tasks/lifecycle.d.ts.map +1 -1
  535. package/dist/src/routes/agent-tasks/lifecycle.js +38 -9
  536. package/dist/src/routes/agent-tasks/lifecycle.js.map +1 -1
  537. package/dist/src/routes/agents/management.d.ts.map +1 -1
  538. package/dist/src/routes/agents/management.js +4 -1
  539. package/dist/src/routes/agents/management.js.map +1 -1
  540. package/dist/src/routes/agents/offers.d.ts +2 -0
  541. package/dist/src/routes/agents/offers.d.ts.map +1 -1
  542. package/dist/src/routes/agents/offers.js +0 -0
  543. package/dist/src/routes/agents/offers.js.map +1 -1
  544. package/dist/src/routes/agents/profile-metadata.d.ts.map +1 -1
  545. package/dist/src/routes/agents/profile-metadata.js +2 -1
  546. package/dist/src/routes/agents/profile-metadata.js.map +1 -1
  547. package/dist/src/routes/app-grants.d.ts +13 -0
  548. package/dist/src/routes/app-grants.d.ts.map +1 -1
  549. package/dist/src/routes/app-grants.js +124 -29
  550. package/dist/src/routes/app-grants.js.map +1 -1
  551. package/dist/src/routes/appdev-overview.d.ts.map +1 -1
  552. package/dist/src/routes/appdev-overview.js +2 -1
  553. package/dist/src/routes/appdev-overview.js.map +1 -1
  554. package/dist/src/routes/apps/catalogue-admin.d.ts.map +1 -1
  555. package/dist/src/routes/apps/catalogue-admin.js +2 -1
  556. package/dist/src/routes/apps/catalogue-admin.js.map +1 -1
  557. package/dist/src/routes/apps/drafts.d.ts +3 -0
  558. package/dist/src/routes/apps/drafts.d.ts.map +1 -1
  559. package/dist/src/routes/apps/drafts.js +65 -2
  560. package/dist/src/routes/apps/drafts.js.map +1 -1
  561. package/dist/src/routes/apps/fork-manage.d.ts.map +1 -1
  562. package/dist/src/routes/apps/fork-manage.js +6 -3
  563. package/dist/src/routes/apps/fork-manage.js.map +1 -1
  564. package/dist/src/routes/apps/helpers.d.ts.map +1 -1
  565. package/dist/src/routes/apps/helpers.js +5 -1
  566. package/dist/src/routes/apps/helpers.js.map +1 -1
  567. package/dist/src/routes/apps/publish.d.ts +2 -0
  568. package/dist/src/routes/apps/publish.d.ts.map +1 -1
  569. package/dist/src/routes/apps/publish.js +25 -5
  570. package/dist/src/routes/apps/publish.js.map +1 -1
  571. package/dist/src/routes/apps/read.d.ts.map +1 -1
  572. package/dist/src/routes/apps/read.js +2 -1
  573. package/dist/src/routes/apps/read.js.map +1 -1
  574. package/dist/src/routes/auth.d.ts.map +1 -1
  575. package/dist/src/routes/auth.js +2 -1
  576. package/dist/src/routes/auth.js.map +1 -1
  577. package/dist/src/routes/boards.js +1 -1
  578. package/dist/src/routes/boards.js.map +1 -1
  579. package/dist/src/routes/bootstrap.d.ts.map +1 -1
  580. package/dist/src/routes/bootstrap.js +8 -3
  581. package/dist/src/routes/bootstrap.js.map +1 -1
  582. package/dist/src/routes/capabilities.d.ts.map +1 -1
  583. package/dist/src/routes/capabilities.js +4 -3
  584. package/dist/src/routes/capabilities.js.map +1 -1
  585. package/dist/src/routes/commerce-acp.js +1 -1
  586. package/dist/src/routes/commerce-acp.js.map +1 -1
  587. package/dist/src/routes/commerce-ucp.d.ts +2 -3
  588. package/dist/src/routes/commerce-ucp.d.ts.map +1 -1
  589. package/dist/src/routes/commerce-ucp.js +6 -12
  590. package/dist/src/routes/commerce-ucp.js.map +1 -1
  591. package/dist/src/routes/commerce.d.ts +7 -1
  592. package/dist/src/routes/commerce.d.ts.map +1 -1
  593. package/dist/src/routes/commerce.js +175 -5
  594. package/dist/src/routes/commerce.js.map +1 -1
  595. package/dist/src/routes/csm.d.ts.map +1 -1
  596. package/dist/src/routes/csm.js +3 -1
  597. package/dist/src/routes/csm.js.map +1 -1
  598. package/dist/src/routes/ecosystem-apps.d.ts.map +1 -1
  599. package/dist/src/routes/ecosystem-apps.js +7 -6
  600. package/dist/src/routes/ecosystem-apps.js.map +1 -1
  601. package/dist/src/routes/exchange-market.d.ts +6 -2
  602. package/dist/src/routes/exchange-market.d.ts.map +1 -1
  603. package/dist/src/routes/exchange-market.js +163 -33
  604. package/dist/src/routes/exchange-market.js.map +1 -1
  605. package/dist/src/routes/exchange.d.ts +10 -1
  606. package/dist/src/routes/exchange.d.ts.map +1 -1
  607. package/dist/src/routes/exchange.js +349 -11
  608. package/dist/src/routes/exchange.js.map +1 -1
  609. package/dist/src/routes/extensions/actions.d.ts +2 -0
  610. package/dist/src/routes/extensions/actions.d.ts.map +1 -1
  611. package/dist/src/routes/extensions/actions.js +65 -8
  612. package/dist/src/routes/extensions/actions.js.map +1 -1
  613. package/dist/src/routes/extensions/crud.d.ts.map +1 -1
  614. package/dist/src/routes/extensions/crud.js +36 -3
  615. package/dist/src/routes/extensions/crud.js.map +1 -1
  616. package/dist/src/routes/extensions/entitlement-gate.d.ts +44 -7
  617. package/dist/src/routes/extensions/entitlement-gate.d.ts.map +1 -1
  618. package/dist/src/routes/extensions/entitlement-gate.js +22 -130
  619. package/dist/src/routes/extensions/entitlement-gate.js.map +1 -1
  620. package/dist/src/routes/extensions/internal-pass.d.ts +23 -0
  621. package/dist/src/routes/extensions/internal-pass.d.ts.map +1 -0
  622. package/dist/src/routes/extensions/internal-pass.js +70 -0
  623. package/dist/src/routes/extensions/internal-pass.js.map +1 -0
  624. package/dist/src/routes/extensions/manifest.d.ts +10 -0
  625. package/dist/src/routes/extensions/manifest.d.ts.map +1 -1
  626. package/dist/src/routes/extensions/manifest.js +136 -5
  627. package/dist/src/routes/extensions/manifest.js.map +1 -1
  628. package/dist/src/routes/extensions/metered-response.d.ts +37 -0
  629. package/dist/src/routes/extensions/metered-response.d.ts.map +1 -0
  630. package/dist/src/routes/extensions/metered-response.js +60 -0
  631. package/dist/src/routes/extensions/metered-response.js.map +1 -0
  632. package/dist/src/routes/extensions/pacing.d.ts +62 -0
  633. package/dist/src/routes/extensions/pacing.d.ts.map +1 -0
  634. package/dist/src/routes/extensions/pacing.js +45 -0
  635. package/dist/src/routes/extensions/pacing.js.map +1 -0
  636. package/dist/src/routes/extensions/paywall.d.ts +16 -0
  637. package/dist/src/routes/extensions/paywall.d.ts.map +1 -1
  638. package/dist/src/routes/extensions/paywall.js +170 -21
  639. package/dist/src/routes/extensions/paywall.js.map +1 -1
  640. package/dist/src/routes/extensions/priced-binding.d.ts +50 -0
  641. package/dist/src/routes/extensions/priced-binding.d.ts.map +1 -0
  642. package/dist/src/routes/extensions/priced-binding.js +46 -0
  643. package/dist/src/routes/extensions/priced-binding.js.map +1 -0
  644. package/dist/src/routes/federation-genesis.d.ts.map +1 -1
  645. package/dist/src/routes/federation-genesis.js +14 -5
  646. package/dist/src/routes/federation-genesis.js.map +1 -1
  647. package/dist/src/routes/federation-peer/introduce.d.ts.map +1 -1
  648. package/dist/src/routes/federation-peer/introduce.js +3 -1
  649. package/dist/src/routes/federation-peer/introduce.js.map +1 -1
  650. package/dist/src/routes/federation-peer/lifecycle.d.ts.map +1 -1
  651. package/dist/src/routes/federation-peer/lifecycle.js +3 -2
  652. package/dist/src/routes/federation-peer/lifecycle.js.map +1 -1
  653. package/dist/src/routes/federation-peer/peers.d.ts.map +1 -1
  654. package/dist/src/routes/federation-peer/peers.js +5 -3
  655. package/dist/src/routes/federation-peer/peers.js.map +1 -1
  656. package/dist/src/routes/federation-peer/policy-book.d.ts.map +1 -1
  657. package/dist/src/routes/federation-peer/policy-book.js +2 -1
  658. package/dist/src/routes/federation-peer/policy-book.js.map +1 -1
  659. package/dist/src/routes/federation-peer/promotion.d.ts.map +1 -1
  660. package/dist/src/routes/federation-peer/promotion.js +4 -1
  661. package/dist/src/routes/federation-peer/promotion.js.map +1 -1
  662. package/dist/src/routes/federation-settlements.js +2 -2
  663. package/dist/src/routes/federation-settlements.js.map +1 -1
  664. package/dist/src/routes/federation-sync/catalogue-trust.js +5 -3
  665. package/dist/src/routes/federation-sync/catalogue-trust.js.map +1 -1
  666. package/dist/src/routes/federation-sync/messaging.js +5 -3
  667. package/dist/src/routes/federation-sync/messaging.js.map +1 -1
  668. package/dist/src/routes/federation-sync/routing.d.ts.map +1 -1
  669. package/dist/src/routes/federation-sync/routing.js +7 -5
  670. package/dist/src/routes/federation-sync/routing.js.map +1 -1
  671. package/dist/src/routes/flags.d.ts.map +1 -1
  672. package/dist/src/routes/flags.js +3 -1
  673. package/dist/src/routes/flags.js.map +1 -1
  674. package/dist/src/routes/ghii/register-login.js +1 -1
  675. package/dist/src/routes/ghii/register-login.js.map +1 -1
  676. package/dist/src/routes/instances/install.d.ts.map +1 -1
  677. package/dist/src/routes/instances/install.js +2 -1
  678. package/dist/src/routes/instances/install.js.map +1 -1
  679. package/dist/src/routes/instances/manage.d.ts.map +1 -1
  680. package/dist/src/routes/instances/manage.js +2 -1
  681. package/dist/src/routes/instances/manage.js.map +1 -1
  682. package/dist/src/routes/knowledge/packages-core.d.ts.map +1 -1
  683. package/dist/src/routes/knowledge/packages-core.js +2 -1
  684. package/dist/src/routes/knowledge/packages-core.js.map +1 -1
  685. package/dist/src/routes/knowledge/sharing.d.ts.map +1 -1
  686. package/dist/src/routes/knowledge/sharing.js +2 -1
  687. package/dist/src/routes/knowledge/sharing.js.map +1 -1
  688. package/dist/src/routes/library-packs.d.ts.map +1 -1
  689. package/dist/src/routes/library-packs.js +10 -3
  690. package/dist/src/routes/library-packs.js.map +1 -1
  691. package/dist/src/routes/libs.d.ts +9 -0
  692. package/dist/src/routes/libs.d.ts.map +1 -1
  693. package/dist/src/routes/libs.js +11 -2
  694. package/dist/src/routes/libs.js.map +1 -1
  695. package/dist/src/routes/matches.d.ts.map +1 -1
  696. package/dist/src/routes/matches.js +7 -3
  697. package/dist/src/routes/matches.js.map +1 -1
  698. package/dist/src/routes/memory/bulk.d.ts.map +1 -1
  699. package/dist/src/routes/memory/bulk.js +3 -1
  700. package/dist/src/routes/memory/bulk.js.map +1 -1
  701. package/dist/src/routes/memory/crud.d.ts.map +1 -1
  702. package/dist/src/routes/memory/crud.js +14 -2
  703. package/dist/src/routes/memory/crud.js.map +1 -1
  704. package/dist/src/routes/memory/federation.d.ts.map +1 -1
  705. package/dist/src/routes/memory/federation.js +5 -0
  706. package/dist/src/routes/memory/federation.js.map +1 -1
  707. package/dist/src/routes/memory/key.d.ts.map +1 -1
  708. package/dist/src/routes/memory/key.js +9 -4
  709. package/dist/src/routes/memory/key.js.map +1 -1
  710. package/dist/src/routes/messages.d.ts.map +1 -1
  711. package/dist/src/routes/messages.js +2 -1
  712. package/dist/src/routes/messages.js.map +1 -1
  713. package/dist/src/routes/msm.d.ts.map +1 -1
  714. package/dist/src/routes/msm.js +3 -1
  715. package/dist/src/routes/msm.js.map +1 -1
  716. package/dist/src/routes/oauth-login.d.ts.map +1 -1
  717. package/dist/src/routes/oauth-login.js +1 -0
  718. package/dist/src/routes/oauth-login.js.map +1 -1
  719. package/dist/src/routes/openrouter.js +2 -2
  720. package/dist/src/routes/openrouter.js.map +1 -1
  721. package/dist/src/routes/organisms/crud.d.ts +3 -0
  722. package/dist/src/routes/organisms/crud.d.ts.map +1 -1
  723. package/dist/src/routes/organisms/crud.js +8 -4
  724. package/dist/src/routes/organisms/crud.js.map +1 -1
  725. package/dist/src/routes/organisms/gates.d.ts.map +1 -1
  726. package/dist/src/routes/organisms/gates.js +3 -2
  727. package/dist/src/routes/organisms/gates.js.map +1 -1
  728. package/dist/src/routes/organisms/intake.d.ts.map +1 -1
  729. package/dist/src/routes/organisms/intake.js +13 -1
  730. package/dist/src/routes/organisms/intake.js.map +1 -1
  731. package/dist/src/routes/organisms/shared.d.ts.map +1 -1
  732. package/dist/src/routes/organisms/shared.js +7 -3
  733. package/dist/src/routes/organisms/shared.js.map +1 -1
  734. package/dist/src/routes/organisms/workspace-ops.d.ts.map +1 -1
  735. package/dist/src/routes/organisms/workspace-ops.js +6 -5
  736. package/dist/src/routes/organisms/workspace-ops.js.map +1 -1
  737. package/dist/src/routes/organisms/workspace-read.d.ts.map +1 -1
  738. package/dist/src/routes/organisms/workspace-read.js +11 -4
  739. package/dist/src/routes/organisms/workspace-read.js.map +1 -1
  740. package/dist/src/routes/owners.d.ts.map +1 -1
  741. package/dist/src/routes/owners.js +37 -12
  742. package/dist/src/routes/owners.js.map +1 -1
  743. package/dist/src/routes/personal.js +3 -1
  744. package/dist/src/routes/personal.js.map +1 -1
  745. package/dist/src/routes/portal.d.ts +6 -1
  746. package/dist/src/routes/portal.d.ts.map +1 -1
  747. package/dist/src/routes/portal.js +75 -10
  748. package/dist/src/routes/portal.js.map +1 -1
  749. package/dist/src/routes/portfolio.d.ts.map +1 -1
  750. package/dist/src/routes/portfolio.js +5 -1
  751. package/dist/src/routes/portfolio.js.map +1 -1
  752. package/dist/src/routes/prompts.d.ts.map +1 -1
  753. package/dist/src/routes/prompts.js +36 -2
  754. package/dist/src/routes/prompts.js.map +1 -1
  755. package/dist/src/routes/public-events.d.ts.map +1 -1
  756. package/dist/src/routes/public-events.js +4 -1
  757. package/dist/src/routes/public-events.js.map +1 -1
  758. package/dist/src/routes/public-stats.d.ts +7 -0
  759. package/dist/src/routes/public-stats.d.ts.map +1 -1
  760. package/dist/src/routes/public-stats.js +57 -17
  761. package/dist/src/routes/public-stats.js.map +1 -1
  762. package/dist/src/routes/schedules.d.ts +3 -0
  763. package/dist/src/routes/schedules.d.ts.map +1 -1
  764. package/dist/src/routes/schedules.js +14 -1
  765. package/dist/src/routes/schedules.js.map +1 -1
  766. package/dist/src/routes/sse.d.ts +7 -0
  767. package/dist/src/routes/sse.d.ts.map +1 -1
  768. package/dist/src/routes/sse.js +36 -6
  769. package/dist/src/routes/sse.js.map +1 -1
  770. package/dist/src/routes/stats.d.ts.map +1 -1
  771. package/dist/src/routes/stats.js +5 -1
  772. package/dist/src/routes/stats.js.map +1 -1
  773. package/dist/src/routes/storage-files.d.ts +15 -0
  774. package/dist/src/routes/storage-files.d.ts.map +1 -1
  775. package/dist/src/routes/storage-files.js +69 -51
  776. package/dist/src/routes/storage-files.js.map +1 -1
  777. package/dist/src/routes/subdomains.d.ts +13 -0
  778. package/dist/src/routes/subdomains.d.ts.map +1 -1
  779. package/dist/src/routes/subdomains.js +106 -8
  780. package/dist/src/routes/subdomains.js.map +1 -1
  781. package/dist/src/routes/unfurl.d.ts.map +1 -1
  782. package/dist/src/routes/unfurl.js +13 -3
  783. package/dist/src/routes/unfurl.js.map +1 -1
  784. package/dist/src/routes/upload.d.ts +22 -0
  785. package/dist/src/routes/upload.d.ts.map +1 -1
  786. package/dist/src/routes/upload.js +204 -34
  787. package/dist/src/routes/upload.js.map +1 -1
  788. package/dist/src/routes/wallet.d.ts +3 -0
  789. package/dist/src/routes/wallet.d.ts.map +1 -1
  790. package/dist/src/routes/wallet.js +6 -1
  791. package/dist/src/routes/wallet.js.map +1 -1
  792. package/dist/src/routes/webmcp.d.ts +8 -0
  793. package/dist/src/routes/webmcp.d.ts.map +1 -1
  794. package/dist/src/routes/webmcp.js +97 -46
  795. package/dist/src/routes/webmcp.js.map +1 -1
  796. package/dist/src/routes/wellknown.d.ts.map +1 -1
  797. package/dist/src/routes/wellknown.js +1 -0
  798. package/dist/src/routes/wellknown.js.map +1 -1
  799. package/dist/src/schemas/knowledge-package.d.ts +1 -1
  800. package/dist/src/server-bootstrap/config-init.d.ts.map +1 -1
  801. package/dist/src/server-bootstrap/config-init.js +2 -0
  802. package/dist/src/server-bootstrap/config-init.js.map +1 -1
  803. package/dist/src/server-bootstrap/routes-loader.d.ts +4 -2
  804. package/dist/src/server-bootstrap/routes-loader.d.ts.map +1 -1
  805. package/dist/src/server-bootstrap/routes-loader.js +11 -22
  806. package/dist/src/server-bootstrap/routes-loader.js.map +1 -1
  807. package/dist/src/server-bootstrap/service-init.js +3 -1
  808. package/dist/src/server-bootstrap/service-init.js.map +1 -1
  809. package/dist/src/server-bootstrap/static-files.d.ts +4 -0
  810. package/dist/src/server-bootstrap/static-files.d.ts.map +1 -1
  811. package/dist/src/server-bootstrap/static-files.js +14 -1
  812. package/dist/src/server-bootstrap/static-files.js.map +1 -1
  813. package/dist/src/services/agent-statistics.d.ts.map +1 -1
  814. package/dist/src/services/agent-statistics.js +4 -1
  815. package/dist/src/services/agent-statistics.js.map +1 -1
  816. package/dist/src/services/app-agent-deploy.d.ts.map +1 -1
  817. package/dist/src/services/app-agent-deploy.js +4 -1
  818. package/dist/src/services/app-agent-deploy.js.map +1 -1
  819. package/dist/src/services/app-agent-surface.d.ts +78 -0
  820. package/dist/src/services/app-agent-surface.d.ts.map +1 -0
  821. package/dist/src/services/app-agent-surface.js +74 -0
  822. package/dist/src/services/app-agent-surface.js.map +1 -0
  823. package/dist/src/services/app-tool-names.d.ts +15 -0
  824. package/dist/src/services/app-tool-names.d.ts.map +1 -0
  825. package/dist/src/services/app-tool-names.js +24 -0
  826. package/dist/src/services/app-tool-names.js.map +1 -0
  827. package/dist/src/services/appdev-overview.d.ts.map +1 -1
  828. package/dist/src/services/appdev-overview.js +3 -2
  829. package/dist/src/services/appdev-overview.js.map +1 -1
  830. package/dist/src/services/attachment-duplication.js +3 -3
  831. package/dist/src/services/attachment-duplication.js.map +1 -1
  832. package/dist/src/services/build-app-prompt.d.ts +19 -0
  833. package/dist/src/services/build-app-prompt.d.ts.map +1 -1
  834. package/dist/src/services/build-app-prompt.js +97 -11
  835. package/dist/src/services/build-app-prompt.js.map +1 -1
  836. package/dist/src/services/build-extension-prompt.d.ts +40 -0
  837. package/dist/src/services/build-extension-prompt.d.ts.map +1 -0
  838. package/dist/src/services/build-extension-prompt.js +253 -0
  839. package/dist/src/services/build-extension-prompt.js.map +1 -0
  840. package/dist/src/services/cache-cleanup.d.ts.map +1 -1
  841. package/dist/src/services/cache-cleanup.js +2 -1
  842. package/dist/src/services/cache-cleanup.js.map +1 -1
  843. package/dist/src/services/call-timing.d.ts +51 -0
  844. package/dist/src/services/call-timing.d.ts.map +1 -0
  845. package/dist/src/services/call-timing.js +92 -0
  846. package/dist/src/services/call-timing.js.map +1 -0
  847. package/dist/src/services/capability-invoke.d.ts +8 -1
  848. package/dist/src/services/capability-invoke.d.ts.map +1 -1
  849. package/dist/src/services/capability-invoke.js +24 -2
  850. package/dist/src/services/capability-invoke.js.map +1 -1
  851. package/dist/src/services/catalogue-sync.d.ts.map +1 -1
  852. package/dist/src/services/catalogue-sync.js +1 -0
  853. package/dist/src/services/catalogue-sync.js.map +1 -1
  854. package/dist/src/services/component-registrar.d.ts.map +1 -1
  855. package/dist/src/services/component-registrar.js +22 -6
  856. package/dist/src/services/component-registrar.js.map +1 -1
  857. package/dist/src/services/config-loader.d.ts.map +1 -1
  858. package/dist/src/services/config-loader.js +6 -1
  859. package/dist/src/services/config-loader.js.map +1 -1
  860. package/dist/src/services/config-schema.d.ts.map +1 -1
  861. package/dist/src/services/config-schema.js +7 -0
  862. package/dist/src/services/config-schema.js.map +1 -1
  863. package/dist/src/services/connect-tunnel.d.ts.map +1 -1
  864. package/dist/src/services/connect-tunnel.js +17 -6
  865. package/dist/src/services/connect-tunnel.js.map +1 -1
  866. package/dist/src/services/consent.d.ts.map +1 -1
  867. package/dist/src/services/consent.js +3 -1
  868. package/dist/src/services/consent.js.map +1 -1
  869. package/dist/src/services/consul-config.d.ts.map +1 -1
  870. package/dist/src/services/consul-config.js +7 -2
  871. package/dist/src/services/consul-config.js.map +1 -1
  872. package/dist/src/services/contacts.js +4 -2
  873. package/dist/src/services/contacts.js.map +1 -1
  874. package/dist/src/services/core-jobs.js +1 -1
  875. package/dist/src/services/core-jobs.js.map +1 -1
  876. package/dist/src/services/db/agent-messages-overview-db-service.d.ts.map +1 -1
  877. package/dist/src/services/db/agent-messages-overview-db-service.js +2 -1
  878. package/dist/src/services/db/agent-messages-overview-db-service.js.map +1 -1
  879. package/dist/src/services/db/agent-quality-overview-db-service.d.ts.map +1 -1
  880. package/dist/src/services/db/agent-quality-overview-db-service.js +2 -1
  881. package/dist/src/services/db/agent-quality-overview-db-service.js.map +1 -1
  882. package/dist/src/services/db/messages-inbox-db-service.d.ts.map +1 -1
  883. package/dist/src/services/db/messages-inbox-db-service.js +3 -2
  884. package/dist/src/services/db/messages-inbox-db-service.js.map +1 -1
  885. package/dist/src/services/db/messaging-db-service.d.ts.map +1 -1
  886. package/dist/src/services/db/messaging-db-service.js +3 -2
  887. package/dist/src/services/db/messaging-db-service.js.map +1 -1
  888. package/dist/src/services/db/wallet-tab-db-service.d.ts +3 -3
  889. package/dist/src/services/doc-images.d.ts.map +1 -1
  890. package/dist/src/services/doc-images.js +7 -4
  891. package/dist/src/services/doc-images.js.map +1 -1
  892. package/dist/src/services/draft-token.d.ts +22 -2
  893. package/dist/src/services/draft-token.d.ts.map +1 -1
  894. package/dist/src/services/draft-token.js +52 -3
  895. package/dist/src/services/draft-token.js.map +1 -1
  896. package/dist/src/services/ecosystem-automation-notify.d.ts.map +1 -1
  897. package/dist/src/services/ecosystem-automation-notify.js +10 -4
  898. package/dist/src/services/ecosystem-automation-notify.js.map +1 -1
  899. package/dist/src/services/ecosystem-automation.d.ts.map +1 -1
  900. package/dist/src/services/ecosystem-automation.js +3 -2
  901. package/dist/src/services/ecosystem-automation.js.map +1 -1
  902. package/dist/src/services/ecosystem-events.js +1 -1
  903. package/dist/src/services/ecosystem-events.js.map +1 -1
  904. package/dist/src/services/entitlement-merge.d.ts +50 -0
  905. package/dist/src/services/entitlement-merge.d.ts.map +1 -0
  906. package/dist/src/services/entitlement-merge.js +116 -0
  907. package/dist/src/services/entitlement-merge.js.map +1 -0
  908. package/dist/src/services/entitlement-money.d.ts.map +1 -1
  909. package/dist/src/services/entitlement-money.js +4 -1
  910. package/dist/src/services/entitlement-money.js.map +1 -1
  911. package/dist/src/services/exchange-market.d.ts +88 -10
  912. package/dist/src/services/exchange-market.d.ts.map +1 -1
  913. package/dist/src/services/exchange-market.js +104 -11
  914. package/dist/src/services/exchange-market.js.map +1 -1
  915. package/dist/src/services/exchange-odps.d.ts +58 -0
  916. package/dist/src/services/exchange-odps.d.ts.map +1 -0
  917. package/dist/src/services/exchange-odps.js +400 -0
  918. package/dist/src/services/exchange-odps.js.map +1 -0
  919. package/dist/src/services/exchange-projection.d.ts +67 -0
  920. package/dist/src/services/exchange-projection.d.ts.map +1 -0
  921. package/dist/src/services/exchange-projection.js +629 -0
  922. package/dist/src/services/exchange-projection.js.map +1 -0
  923. package/dist/src/services/exchange-proposals.d.ts.map +1 -1
  924. package/dist/src/services/exchange-proposals.js +6 -2
  925. package/dist/src/services/exchange-proposals.js.map +1 -1
  926. package/dist/src/services/extension-files.d.ts +64 -0
  927. package/dist/src/services/extension-files.d.ts.map +1 -0
  928. package/dist/src/services/extension-files.js +88 -0
  929. package/dist/src/services/extension-files.js.map +1 -0
  930. package/dist/src/services/extension-purchase.d.ts +36 -0
  931. package/dist/src/services/extension-purchase.d.ts.map +1 -0
  932. package/dist/src/services/extension-purchase.js +110 -0
  933. package/dist/src/services/extension-purchase.js.map +1 -0
  934. package/dist/src/services/extension-runtime.d.ts +56 -1
  935. package/dist/src/services/extension-runtime.d.ts.map +1 -1
  936. package/dist/src/services/extension-runtime.js +73 -4
  937. package/dist/src/services/extension-runtime.js.map +1 -1
  938. package/dist/src/services/extension-secrets.d.ts +8 -0
  939. package/dist/src/services/extension-secrets.d.ts.map +1 -1
  940. package/dist/src/services/extension-secrets.js +14 -0
  941. package/dist/src/services/extension-secrets.js.map +1 -1
  942. package/dist/src/services/federation-availability.d.ts.map +1 -1
  943. package/dist/src/services/federation-availability.js +1 -0
  944. package/dist/src/services/federation-availability.js.map +1 -1
  945. package/dist/src/services/federation-book.js +15 -7
  946. package/dist/src/services/federation-book.js.map +1 -1
  947. package/dist/src/services/federation-helpers.d.ts.map +1 -1
  948. package/dist/src/services/federation-helpers.js +1 -0
  949. package/dist/src/services/federation-helpers.js.map +1 -1
  950. package/dist/src/services/federation.d.ts.map +1 -1
  951. package/dist/src/services/federation.js +8 -6
  952. package/dist/src/services/federation.js.map +1 -1
  953. package/dist/src/services/file-refs.d.ts +105 -0
  954. package/dist/src/services/file-refs.d.ts.map +1 -0
  955. package/dist/src/services/file-refs.js +106 -0
  956. package/dist/src/services/file-refs.js.map +1 -0
  957. package/dist/src/services/gate-expiry.d.ts.map +1 -1
  958. package/dist/src/services/gate-expiry.js +2 -1
  959. package/dist/src/services/gate-expiry.js.map +1 -1
  960. package/dist/src/services/genesis-sync.d.ts.map +1 -1
  961. package/dist/src/services/genesis-sync.js +9 -4
  962. package/dist/src/services/genesis-sync.js.map +1 -1
  963. package/dist/src/services/handbooks/commerce.d.ts +13 -0
  964. package/dist/src/services/handbooks/commerce.d.ts.map +1 -0
  965. package/dist/src/services/handbooks/commerce.js +60 -0
  966. package/dist/src/services/handbooks/commerce.js.map +1 -0
  967. package/dist/src/services/handbooks/index.d.ts +1 -0
  968. package/dist/src/services/handbooks/index.d.ts.map +1 -1
  969. package/dist/src/services/handbooks/index.js +2 -2
  970. package/dist/src/services/handbooks/index.js.map +1 -1
  971. package/dist/src/services/hooks.d.ts.map +1 -1
  972. package/dist/src/services/hooks.js +2 -0
  973. package/dist/src/services/hooks.js.map +1 -1
  974. package/dist/src/services/invitations.d.ts.map +1 -1
  975. package/dist/src/services/invitations.js +2 -0
  976. package/dist/src/services/invitations.js.map +1 -1
  977. package/dist/src/services/living-author.d.ts.map +1 -1
  978. package/dist/src/services/living-author.js +4 -1
  979. package/dist/src/services/living-author.js.map +1 -1
  980. package/dist/src/services/living-pulse.js +18 -6
  981. package/dist/src/services/living-pulse.js.map +1 -1
  982. package/dist/src/services/mailbox-notification.d.ts.map +1 -1
  983. package/dist/src/services/mailbox-notification.js +1 -0
  984. package/dist/src/services/mailbox-notification.js.map +1 -1
  985. package/dist/src/services/match-notification.d.ts.map +1 -1
  986. package/dist/src/services/match-notification.js +2 -1
  987. package/dist/src/services/match-notification.js.map +1 -1
  988. package/dist/src/services/matching.d.ts.map +1 -1
  989. package/dist/src/services/matching.js +5 -2
  990. package/dist/src/services/matching.js.map +1 -1
  991. package/dist/src/services/memory-replication.d.ts.map +1 -1
  992. package/dist/src/services/memory-replication.js +3 -1
  993. package/dist/src/services/memory-replication.js.map +1 -1
  994. package/dist/src/services/message-broadcast.d.ts.map +1 -1
  995. package/dist/src/services/message-broadcast.js +2 -1
  996. package/dist/src/services/message-broadcast.js.map +1 -1
  997. package/dist/src/services/message-delivery.d.ts.map +1 -1
  998. package/dist/src/services/message-delivery.js +9 -4
  999. package/dist/src/services/message-delivery.js.map +1 -1
  1000. package/dist/src/services/metered-access.d.ts +148 -0
  1001. package/dist/src/services/metered-access.d.ts.map +1 -0
  1002. package/dist/src/services/metered-access.js +128 -0
  1003. package/dist/src/services/metered-access.js.map +1 -0
  1004. package/dist/src/services/metered-entitlements.d.ts +147 -5
  1005. package/dist/src/services/metered-entitlements.d.ts.map +1 -1
  1006. package/dist/src/services/metered-entitlements.js +251 -30
  1007. package/dist/src/services/metered-entitlements.js.map +1 -1
  1008. package/dist/src/services/metered-settlement.d.ts +45 -0
  1009. package/dist/src/services/metered-settlement.d.ts.map +1 -0
  1010. package/dist/src/services/metered-settlement.js +117 -0
  1011. package/dist/src/services/metered-settlement.js.map +1 -0
  1012. package/dist/src/services/network-policy.d.ts.map +1 -1
  1013. package/dist/src/services/network-policy.js +6 -2
  1014. package/dist/src/services/network-policy.js.map +1 -1
  1015. package/dist/src/services/notebook-classify.d.ts.map +1 -1
  1016. package/dist/src/services/notebook-classify.js +7 -2
  1017. package/dist/src/services/notebook-classify.js.map +1 -1
  1018. package/dist/src/services/notebook-plan.d.ts.map +1 -1
  1019. package/dist/src/services/notebook-plan.js +4 -1
  1020. package/dist/src/services/notebook-plan.js.map +1 -1
  1021. package/dist/src/services/notify.d.ts.map +1 -1
  1022. package/dist/src/services/notify.js +6 -3
  1023. package/dist/src/services/notify.js.map +1 -1
  1024. package/dist/src/services/openrouter.d.ts.map +1 -1
  1025. package/dist/src/services/openrouter.js +1 -0
  1026. package/dist/src/services/openrouter.js.map +1 -1
  1027. package/dist/src/services/organism-export.d.ts.map +1 -1
  1028. package/dist/src/services/organism-export.js +4 -1
  1029. package/dist/src/services/organism-export.js.map +1 -1
  1030. package/dist/src/services/organism-import.d.ts.map +1 -1
  1031. package/dist/src/services/organism-import.js +5 -1
  1032. package/dist/src/services/organism-import.js.map +1 -1
  1033. package/dist/src/services/owner-memory.d.ts +14 -1
  1034. package/dist/src/services/owner-memory.d.ts.map +1 -1
  1035. package/dist/src/services/owner-memory.js +8 -14
  1036. package/dist/src/services/owner-memory.js.map +1 -1
  1037. package/dist/src/services/perf-trace.js +3 -1
  1038. package/dist/src/services/perf-trace.js.map +1 -1
  1039. package/dist/src/services/personal-tunnel.js +14 -8
  1040. package/dist/src/services/personal-tunnel.js.map +1 -1
  1041. package/dist/src/services/presence.d.ts.map +1 -1
  1042. package/dist/src/services/presence.js +11 -5
  1043. package/dist/src/services/presence.js.map +1 -1
  1044. package/dist/src/services/protected-resource.d.ts +60 -0
  1045. package/dist/src/services/protected-resource.d.ts.map +1 -0
  1046. package/dist/src/services/protected-resource.js +137 -0
  1047. package/dist/src/services/protected-resource.js.map +1 -0
  1048. package/dist/src/services/realtime-manager.d.ts.map +1 -1
  1049. package/dist/src/services/realtime-manager.js +8 -5
  1050. package/dist/src/services/realtime-manager.js.map +1 -1
  1051. package/dist/src/services/safe-zip.d.ts.map +1 -1
  1052. package/dist/src/services/safe-zip.js +4 -1
  1053. package/dist/src/services/safe-zip.js.map +1 -1
  1054. package/dist/src/services/scheduler-extension-job.js +2 -2
  1055. package/dist/src/services/scheduler-extension-job.js.map +1 -1
  1056. package/dist/src/services/scheduler.js +13 -7
  1057. package/dist/src/services/scheduler.js.map +1 -1
  1058. package/dist/src/services/security-incident.d.ts.map +1 -1
  1059. package/dist/src/services/security-incident.js +7 -2
  1060. package/dist/src/services/security-incident.js.map +1 -1
  1061. package/dist/src/services/site-sync.d.ts.map +1 -1
  1062. package/dist/src/services/site-sync.js +1 -0
  1063. package/dist/src/services/site-sync.js.map +1 -1
  1064. package/dist/src/services/site.d.ts +1 -1
  1065. package/dist/src/services/site.d.ts.map +1 -1
  1066. package/dist/src/services/site.js +29 -8
  1067. package/dist/src/services/site.js.map +1 -1
  1068. package/dist/src/services/structure-overview.d.ts.map +1 -1
  1069. package/dist/src/services/structure-overview.js +4 -1
  1070. package/dist/src/services/structure-overview.js.map +1 -1
  1071. package/dist/src/services/structure-snapshot.d.ts.map +1 -1
  1072. package/dist/src/services/structure-snapshot.js +3 -2
  1073. package/dist/src/services/structure-snapshot.js.map +1 -1
  1074. package/dist/src/services/sync-scheduler.js +3 -2
  1075. package/dist/src/services/sync-scheduler.js.map +1 -1
  1076. package/dist/src/services/task-files.d.ts +51 -0
  1077. package/dist/src/services/task-files.d.ts.map +1 -0
  1078. package/dist/src/services/task-files.js +58 -0
  1079. package/dist/src/services/task-files.js.map +1 -0
  1080. package/dist/src/services/tracked-response.js +1 -1
  1081. package/dist/src/services/tracked-response.js.map +1 -1
  1082. package/dist/src/services/trust-broadcast.d.ts.map +1 -1
  1083. package/dist/src/services/trust-broadcast.js +1 -0
  1084. package/dist/src/services/trust-broadcast.js.map +1 -1
  1085. package/dist/src/services/upload-token.d.ts +29 -0
  1086. package/dist/src/services/upload-token.d.ts.map +1 -1
  1087. package/dist/src/services/upload-token.js +37 -0
  1088. package/dist/src/services/upload-token.js.map +1 -1
  1089. package/dist/src/services/upload-zip.d.ts +9 -0
  1090. package/dist/src/services/upload-zip.d.ts.map +1 -1
  1091. package/dist/src/services/upload-zip.js +19 -81
  1092. package/dist/src/services/upload-zip.js.map +1 -1
  1093. package/dist/src/services/web-bot-auth.d.ts.map +1 -1
  1094. package/dist/src/services/web-bot-auth.js +1 -0
  1095. package/dist/src/services/web-bot-auth.js.map +1 -1
  1096. package/dist/src/services/workflow/engine-steps.d.ts.map +1 -1
  1097. package/dist/src/services/workflow/engine-steps.js +12 -6
  1098. package/dist/src/services/workflow/engine-steps.js.map +1 -1
  1099. package/dist/src/services/workspace-export.d.ts.map +1 -1
  1100. package/dist/src/services/workspace-export.js +5 -2
  1101. package/dist/src/services/workspace-export.js.map +1 -1
  1102. package/dist/src/services/workspace-import.d.ts.map +1 -1
  1103. package/dist/src/services/workspace-import.js +2 -1
  1104. package/dist/src/services/workspace-import.js.map +1 -1
  1105. package/dist/src/services/workspace-meta.d.ts +15 -0
  1106. package/dist/src/services/workspace-meta.d.ts.map +1 -1
  1107. package/dist/src/services/workspace-meta.js +17 -0
  1108. package/dist/src/services/workspace-meta.js.map +1 -1
  1109. package/dist/src/services/workspace-provision.d.ts +3 -0
  1110. package/dist/src/services/workspace-provision.d.ts.map +1 -1
  1111. package/dist/src/services/workspace-provision.js +5 -3
  1112. package/dist/src/services/workspace-provision.js.map +1 -1
  1113. package/dist/src/services/workspace-versions.d.ts.map +1 -1
  1114. package/dist/src/services/workspace-versions.js +0 -0
  1115. package/dist/src/services/workspace-versions.js.map +1 -1
  1116. package/dist/src/storage/providers/postgres-kysely/db-types.d.ts +5 -0
  1117. package/dist/src/storage/providers/postgres-kysely/db-types.d.ts.map +1 -1
  1118. package/dist/src/storage/providers/postgres-kysely/helpers.d.ts +11 -0
  1119. package/dist/src/storage/providers/postgres-kysely/helpers.d.ts.map +1 -1
  1120. package/dist/src/storage/providers/postgres-kysely/helpers.js +14 -0
  1121. package/dist/src/storage/providers/postgres-kysely/helpers.js.map +1 -1
  1122. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts +2 -1
  1123. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts.map +1 -1
  1124. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js +16 -0
  1125. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js.map +1 -1
  1126. package/dist/src/storage/providers/postgres-kysely/methods/capabilities.js +3 -3
  1127. package/dist/src/storage/providers/postgres-kysely/methods/capabilities.js.map +1 -1
  1128. package/dist/src/storage/providers/postgres-kysely/methods/ecosystem.js +3 -3
  1129. package/dist/src/storage/providers/postgres-kysely/methods/ecosystem.js.map +1 -1
  1130. package/dist/src/storage/providers/postgres-kysely/methods/federation.d.ts.map +1 -1
  1131. package/dist/src/storage/providers/postgres-kysely/methods/federation.js +12 -10
  1132. package/dist/src/storage/providers/postgres-kysely/methods/federation.js.map +1 -1
  1133. package/dist/src/storage/providers/postgres-kysely/methods/identity.d.ts.map +1 -1
  1134. package/dist/src/storage/providers/postgres-kysely/methods/identity.js +26 -12
  1135. package/dist/src/storage/providers/postgres-kysely/methods/identity.js.map +1 -1
  1136. package/dist/src/storage/providers/postgres-kysely/methods/marketplace.js +5 -5
  1137. package/dist/src/storage/providers/postgres-kysely/methods/marketplace.js.map +1 -1
  1138. package/dist/src/storage/providers/postgres-kysely/methods/memory.d.ts +2 -0
  1139. package/dist/src/storage/providers/postgres-kysely/methods/memory.d.ts.map +1 -1
  1140. package/dist/src/storage/providers/postgres-kysely/methods/memory.js +12 -1
  1141. package/dist/src/storage/providers/postgres-kysely/methods/memory.js.map +1 -1
  1142. package/dist/src/storage/providers/postgres-kysely/methods/node-ext-escrow.d.ts +9 -0
  1143. package/dist/src/storage/providers/postgres-kysely/methods/node-ext-escrow.d.ts.map +1 -1
  1144. package/dist/src/storage/providers/postgres-kysely/methods/node-ext-escrow.js +31 -27
  1145. package/dist/src/storage/providers/postgres-kysely/methods/node-ext-escrow.js.map +1 -1
  1146. package/dist/src/storage/providers/postgres-kysely/methods/organisms.d.ts.map +1 -1
  1147. package/dist/src/storage/providers/postgres-kysely/methods/organisms.js +15 -15
  1148. package/dist/src/storage/providers/postgres-kysely/methods/organisms.js.map +1 -1
  1149. package/dist/src/storage/providers/postgres-kysely/methods/otk.js +3 -3
  1150. package/dist/src/storage/providers/postgres-kysely/methods/otk.js.map +1 -1
  1151. package/dist/src/storage/providers/postgres-kysely/methods/packages.d.ts.map +1 -1
  1152. package/dist/src/storage/providers/postgres-kysely/methods/packages.js +4 -14
  1153. package/dist/src/storage/providers/postgres-kysely/methods/packages.js.map +1 -1
  1154. package/dist/src/storage/providers/postgres-kysely/methods/template-listings.d.ts.map +1 -1
  1155. package/dist/src/storage/providers/postgres-kysely/methods/template-listings.js +11 -10
  1156. package/dist/src/storage/providers/postgres-kysely/methods/template-listings.js.map +1 -1
  1157. package/dist/src/storage/providers/postgres-kysely/methods/wallet.d.ts.map +1 -1
  1158. package/dist/src/storage/providers/postgres-kysely/methods/wallet.js +3 -1
  1159. package/dist/src/storage/providers/postgres-kysely/methods/wallet.js.map +1 -1
  1160. package/dist/src/storage/providers/postgres-kysely/migrate.d.ts.map +1 -1
  1161. package/dist/src/storage/providers/postgres-kysely/migrate.js +3 -0
  1162. package/dist/src/storage/providers/postgres-kysely/migrate.js.map +1 -1
  1163. package/dist/src/storage/providers/postgres-kysely/migrations/0012_unique_live_app_grant.sql +29 -0
  1164. package/dist/src/storage/providers/postgres-kysely/migrations/0013_ghii_password_lockout.sql +12 -0
  1165. package/dist/src/storage/providers/postgres-kysely/migrations/0014_transaction_initiator.sql +6 -0
  1166. package/dist/src/storage/providers/postgres-kysely/migrations/0015_app_grant_spend_cap.sql +5 -0
  1167. package/dist/src/storage/providers/sqlite/methods/apps.d.ts +4 -1
  1168. package/dist/src/storage/providers/sqlite/methods/apps.d.ts.map +1 -1
  1169. package/dist/src/storage/providers/sqlite/methods/apps.js +19 -2
  1170. package/dist/src/storage/providers/sqlite/methods/apps.js.map +1 -1
  1171. package/dist/src/storage/providers/sqlite/methods/community.d.ts.map +1 -1
  1172. package/dist/src/storage/providers/sqlite/methods/community.js +6 -1
  1173. package/dist/src/storage/providers/sqlite/methods/community.js.map +1 -1
  1174. package/dist/src/storage/providers/sqlite/methods/governance.d.ts +1 -0
  1175. package/dist/src/storage/providers/sqlite/methods/governance.d.ts.map +1 -1
  1176. package/dist/src/storage/providers/sqlite/methods/governance.js +4 -1
  1177. package/dist/src/storage/providers/sqlite/methods/governance.js.map +1 -1
  1178. package/dist/src/storage/providers/sqlite/methods/identity-nodes.d.ts.map +1 -1
  1179. package/dist/src/storage/providers/sqlite/methods/identity-nodes.js +9 -2
  1180. package/dist/src/storage/providers/sqlite/methods/identity-nodes.js.map +1 -1
  1181. package/dist/src/storage/providers/sqlite/methods/owner.d.ts +5 -0
  1182. package/dist/src/storage/providers/sqlite/methods/owner.d.ts.map +1 -1
  1183. package/dist/src/storage/providers/sqlite/methods/owner.js +8 -0
  1184. package/dist/src/storage/providers/sqlite/methods/owner.js.map +1 -1
  1185. package/dist/src/storage/providers/sqlite/methods/work.d.ts.map +1 -1
  1186. package/dist/src/storage/providers/sqlite/methods/work.js +4 -2
  1187. package/dist/src/storage/providers/sqlite/methods/work.js.map +1 -1
  1188. package/dist/src/storage/providers/sqlite/repos/community.d.ts.map +1 -1
  1189. package/dist/src/storage/providers/sqlite/repos/community.js +6 -1
  1190. package/dist/src/storage/providers/sqlite/repos/community.js.map +1 -1
  1191. package/dist/src/storage/providers/sqlite/repos/identity.d.ts +3 -0
  1192. package/dist/src/storage/providers/sqlite/repos/identity.d.ts.map +1 -1
  1193. package/dist/src/storage/providers/sqlite/repos/identity.js +13 -4
  1194. package/dist/src/storage/providers/sqlite/repos/identity.js.map +1 -1
  1195. package/dist/src/storage/providers/sqlite/repos/work.d.ts.map +1 -1
  1196. package/dist/src/storage/providers/sqlite/repos/work.js +4 -2
  1197. package/dist/src/storage/providers/sqlite/repos/work.js.map +1 -1
  1198. package/dist/src/storage/providers/sqlite/schema-tables-1.d.ts.map +1 -1
  1199. package/dist/src/storage/providers/sqlite/schema-tables-1.js +1 -0
  1200. package/dist/src/storage/providers/sqlite/schema-tables-1.js.map +1 -1
  1201. package/dist/src/storage/providers/sqlite/schema-tables-2.d.ts.map +1 -1
  1202. package/dist/src/storage/providers/sqlite/schema-tables-2.js +2 -0
  1203. package/dist/src/storage/providers/sqlite/schema-tables-2.js.map +1 -1
  1204. package/dist/src/storage/providers/sqlite/schema.d.ts +3 -0
  1205. package/dist/src/storage/providers/sqlite/schema.d.ts.map +1 -1
  1206. package/dist/src/storage/providers/sqlite/schema.js +34 -1
  1207. package/dist/src/storage/providers/sqlite/schema.js.map +1 -1
  1208. package/dist/src/storage/repositories/app-grant.repository.d.ts +10 -2
  1209. package/dist/src/storage/repositories/app-grant.repository.d.ts.map +1 -1
  1210. package/dist/src/storage/repositories/memory.repository.d.ts +14 -0
  1211. package/dist/src/storage/repositories/memory.repository.d.ts.map +1 -1
  1212. package/dist/src/storage/repositories-impl/memory-repository.d.ts +8 -1
  1213. package/dist/src/storage/repositories-impl/memory-repository.d.ts.map +1 -1
  1214. package/dist/src/storage/repositories-impl/memory-repository.js +15 -4
  1215. package/dist/src/storage/repositories-impl/memory-repository.js.map +1 -1
  1216. package/dist/src/storage/types/agents-messaging.d.ts +19 -0
  1217. package/dist/src/storage/types/agents-messaging.d.ts.map +1 -1
  1218. package/dist/src/storage/types/agents-messaging.js.map +1 -1
  1219. package/dist/src/storage/types/auth.d.ts +9 -0
  1220. package/dist/src/storage/types/auth.d.ts.map +1 -1
  1221. package/dist/src/storage/types/commerce.d.ts +13 -0
  1222. package/dist/src/storage/types/commerce.d.ts.map +1 -1
  1223. package/dist/src/storage/types/organisms-federation.d.ts +29 -0
  1224. package/dist/src/storage/types/organisms-federation.d.ts.map +1 -1
  1225. package/dist/src/utils/app-agent-discovery.d.ts +31 -0
  1226. package/dist/src/utils/app-agent-discovery.d.ts.map +1 -0
  1227. package/dist/src/utils/app-agent-discovery.js +96 -0
  1228. package/dist/src/utils/app-agent-discovery.js.map +1 -0
  1229. package/dist/src/utils/app-badge.d.ts.map +1 -1
  1230. package/dist/src/utils/app-badge.js +7 -3
  1231. package/dist/src/utils/app-badge.js.map +1 -1
  1232. package/dist/src/utils/app-protect.d.ts.map +1 -1
  1233. package/dist/src/utils/app-protect.js +1 -0
  1234. package/dist/src/utils/app-protect.js.map +1 -1
  1235. package/dist/src/utils/env-validator.d.ts.map +1 -1
  1236. package/dist/src/utils/env-validator.js +5 -1
  1237. package/dist/src/utils/env-validator.js.map +1 -1
  1238. package/dist/src/utils/gaii.d.ts +50 -0
  1239. package/dist/src/utils/gaii.d.ts.map +1 -1
  1240. package/dist/src/utils/gaii.js +66 -0
  1241. package/dist/src/utils/gaii.js.map +1 -1
  1242. package/dist/src/utils/url-validator.d.ts.map +1 -1
  1243. package/dist/src/utils/url-validator.js +4 -1
  1244. package/dist/src/utils/url-validator.js.map +1 -1
  1245. package/dist/src/utils/version.d.ts.map +1 -1
  1246. package/dist/src/utils/version.js +1 -0
  1247. package/dist/src/utils/version.js.map +1 -1
  1248. package/dist/static/app-catalog/_template.html +6 -5
  1249. package/dist/static/app-catalog/js/cortex.js +3 -1
  1250. package/dist/static/app-catalog/js/detail.js +411 -36
  1251. package/dist/static/app-catalog/js/i18n-data.js +279 -3
  1252. package/dist/static/app-catalog/js/main.js +28 -37
  1253. package/dist/static/app-catalog/js/monetize.js +204 -16
  1254. package/dist/static/app-catalog/js/odps.js +489 -0
  1255. package/dist/static/app-catalog/js/render.js +3 -0
  1256. package/dist/static/app-catalog/js/workcopy.js +198 -0
  1257. package/dist/static/app-catalog/styles/app-catalog.css +60 -0
  1258. package/dist/static/app-catalog.html +1450 -137
  1259. package/dist/static/sdk-libs/agents/index.js +45 -7
  1260. package/dist/static/sdk-libs/auth/cluster.js +97 -0
  1261. package/dist/static/sdk-libs/auth/index.js +25 -1
  1262. package/dist/static/sdk-libs/auth/locale.js +151 -0
  1263. package/dist/static/sdk-libs/auth/modal.js +11 -2
  1264. package/dist/static/sdk-libs/auth/palette.js +172 -0
  1265. package/dist/static/sdk-libs/auth/pill.js +37 -6
  1266. package/dist/static/sdk-libs/auth/session.js +7 -3
  1267. package/dist/static/sdk-libs/auth/theme.js +61 -20
  1268. package/dist/static/sdk-libs/data/index.js +70 -8
  1269. package/dist/static/sdk-libs/dist/aimeat-agents.js +41 -8
  1270. package/dist/static/sdk-libs/dist/aimeat-auth.js +423 -22
  1271. package/dist/static/sdk-libs/dist/aimeat-data.js +50 -8
  1272. package/dist/static/sdk-libs/dist/aimeat-exchange.js +675 -0
  1273. package/dist/static/sdk-libs/dist/aimeat-game.js +1555 -0
  1274. package/dist/static/sdk-libs/dist/aimeat-live.js +54 -2
  1275. package/dist/static/sdk-libs/dist/aimeat-markdown.js +32 -1
  1276. package/dist/static/sdk-libs/dist/aimeat-webmcp.js +46 -0
  1277. package/dist/static/sdk-libs/exchange/browse.js +81 -0
  1278. package/dist/static/sdk-libs/exchange/client.js +131 -0
  1279. package/dist/static/sdk-libs/exchange/contracts.js +228 -0
  1280. package/dist/static/sdk-libs/exchange/demand.js +106 -0
  1281. package/dist/static/sdk-libs/exchange/earnings.js +39 -0
  1282. package/dist/static/sdk-libs/exchange/format.js +51 -0
  1283. package/dist/static/sdk-libs/exchange/index.js +70 -0
  1284. package/dist/static/sdk-libs/exchange/odps-completeness.js +177 -0
  1285. package/dist/static/sdk-libs/exchange/sell.js +253 -0
  1286. package/dist/static/sdk-libs/game/board.js +331 -0
  1287. package/dist/static/sdk-libs/game/dom.js +223 -0
  1288. package/dist/static/sdk-libs/game/i18n.js +201 -0
  1289. package/dist/static/sdk-libs/game/index.js +72 -0
  1290. package/dist/static/sdk-libs/game/markers.js +150 -0
  1291. package/dist/static/sdk-libs/game/menu.js +260 -0
  1292. package/dist/static/sdk-libs/game/overlay.js +193 -0
  1293. package/dist/static/sdk-libs/game/progress.js +280 -0
  1294. package/dist/static/sdk-libs/game/score.js +134 -0
  1295. package/dist/static/sdk-libs/game/screen.js +120 -0
  1296. package/dist/static/sdk-libs/game/units.js +55 -0
  1297. package/dist/static/sdk-libs/live/index.js +71 -4
  1298. package/dist/static/sdk-libs/markdown/index.js +49 -1
  1299. package/dist/static/sdk-libs/webmcp/index.js +63 -0
  1300. package/package.json +7 -2
@@ -0,0 +1,629 @@
1
+ /**
2
+ * @file src/services/exchange-projection.ts
3
+ * @description TARGET-050 — the EXCHANGE listing as a PROJECTION of its source, not a hand-authored
4
+ * snapshot. Before this, listing a capability was a second authoring step: the provider priced a tool
5
+ * in the app-catalog and then had to call the listing endpoint again, so the market showed stale prices,
6
+ * duplicate cards (one per relist) and outdated titles. Now the SOURCE owns the listing:
7
+ *
8
+ * app-tool → `apps.{appId}.tools` manifest entry with `exchange: true`
9
+ * ext-action → extension action `commercial.exchange === true`
10
+ * agent-work → `agents.{agent}.offers` entry with `exchange: true` (and visibility 'public')
11
+ *
12
+ * Reconcile projects those sources onto offerings: creates what is flagged, updates what changed,
13
+ * delists what is no longer flagged (or no longer priced). Identity of a listing is the DEDUPE KEY
14
+ * (kind, ext, action, unit, currency) — a price change therefore UPDATES the existing listing instead
15
+ * of minting a rival one.
16
+ *
17
+ * COMBINED PRICE: a source that names both a money price and a morsel figure is stating ONE price —
18
+ * "1 morsel · 0.01 EUR", which is how the authoring UI and the marketplace card both show it. It
19
+ * projects to ONE money listing carrying the morsels as its pacing toll, so a call pays the provider
20
+ * the money and burns the morsels. It used to project a morsel listing BESIDE the money one, which
21
+ * made two purchasable alternatives out of one declared product: a buyer could take the morsel side
22
+ * and never pay the provider anything, for a second product nobody authored. Morsels WITHOUT money
23
+ * remain a listing of their own — that one is a deliberate no-money offer.
24
+ *
25
+ * HARD INVARIANT: a projection never touches a CONTRACT. Entitlements keep the interface version and
26
+ * the price they were signed at (`app-tool-interfaces.ts` deliberately does not freeze price — it is
27
+ * authoritative at accept time and captured into the entitlement). Reconcile only writes offering
28
+ * records, and adopts a legacy listing by keeping its `offeringId` so `contractRef: offering:{id}`
29
+ * on existing entitlements keeps resolving.
30
+ * @structure ReconcileChange · ReconcileReport · reconcileOwnerOfferings · migrateLegacyOfferings ·
31
+ * desiredFromAppTools · desiredFromExtActions · desiredFromAgentOffers · moneyPricesOf
32
+ * @usage
33
+ * const report = await reconcileOwnerOfferings(storage, ownerGhii, { dryRun: true });
34
+ * await reconcileOwnerOfferings(storage, ownerGhii, { appId: 'prh.html' });
35
+ * @version-history
36
+ * v1.4.0 — 2026-07-27 — Combined price: money + morsels declared together project ONE money listing
37
+ * whose pacing toll is the morsel figure, instead of two rival listings a buyer could choose between.
38
+ * v1.3.0 — 2026-07-25 — Pacing projects too: the source's `tollMorsels` reaches the listing (and is
39
+ * overwritten when cleared, unlike an attestation — a stale brake keeps charging consumers).
40
+ * v1.2.0 — 2026-07-25 — App-level ODPS defaults: the tool manifest's root `odps`/`provenance` are
41
+ * inherited by every tool of that app (tool overrides field by field) and folded into the sourceHash.
42
+ * v1.1.0 — 2026-07-25 — Sources carry their own descriptor data: `provenance` + `odps` (the ODPS v4.0
43
+ * authoring block) project from the manifest/action/offer onto the listing and into its sourceHash.
44
+ * v1.0.0 — 2026-07-25 — Initial projection + reconcile + legacy adoption (TARGET-050 slices 1 & 3).
45
+ */
46
+ import { createHash } from 'node:crypto';
47
+ import { AppToolsDocSchema, appToolsKey } from '../models/app-tool-schemas.js';
48
+ import { OffersDocSchema } from '../models/offer-schemas.js';
49
+ import { ensureInterfaceVersion, getLatestInterface } from './app-tool-interfaces.js';
50
+ import { appToolCoordinate, agentWorkCoordinate, listAllOfferings, newOfferingId, putOffering, } from './exchange-market.js';
51
+ import { ODPS_VERSION, mergeOdpsExtras, mergeProvenance } from './exchange-odps.js';
52
+ import { logger } from '../utils/logger.js';
53
+ /** The dedupe identity of a listing: one per (kind, coordinate, unit, currency) — never one per relist. */
54
+ const listingKey = (kind, ext, action, unit, currency) => `${kind}|${ext}|${action}|${unit}|${currency ?? ''}`;
55
+ const offeringKey = (o) => listingKey(o.kind, o.ext, o.action, o.unit, o.currency);
56
+ const hasSchema = (v) => !!v && typeof v === 'object' && Object.keys(v).length > 0;
57
+ /** Same permissive-but-attributed defaults the manual listing route applies when a field is omitted. */
58
+ function usageTermsOf(src) {
59
+ return {
60
+ derivatives: src?.derivatives !== false,
61
+ resale: src?.resale === true,
62
+ attribution: src?.attribution !== false,
63
+ ...(src?.note ? { note: src.note } : {}),
64
+ };
65
+ }
66
+ /** Stamp the ODPS version onto a source-declared provenance, so every descriptor says which version it follows. */
67
+ function provenanceOf(src) {
68
+ if (!src || !Object.keys(src).length)
69
+ return null;
70
+ return { ...src, odpsVersion: src.odpsVersion ?? ODPS_VERSION };
71
+ }
72
+ /** Every money price a source declares, `priceMoney` first, de-duplicated by currency. */
73
+ function moneyPricesOf(primary, extra) {
74
+ const out = [];
75
+ const seen = new Set();
76
+ for (const p of [primary, ...(extra ?? [])]) {
77
+ if (!p || typeof p.amount !== 'number' || !Number.isInteger(p.amount) || p.amount <= 0 || !p.currency)
78
+ continue;
79
+ if (seen.has(p.currency))
80
+ continue;
81
+ seen.add(p.currency);
82
+ out.push({ amount: p.amount, currency: p.currency });
83
+ }
84
+ return out;
85
+ }
86
+ function contentHash(parts) {
87
+ return createHash('sha256').update(JSON.stringify(parts)).digest('hex').slice(0, 24);
88
+ }
89
+ /**
90
+ * The OWNER GHII behind any principal: `agent#owner@node` and `owner@node` both resolve to
91
+ * `owner@node`. Listings and their sources belong to the owner, never to the agent that happened
92
+ * to trigger the reconcile.
93
+ */
94
+ export function ownerGhiiOf(principal) {
95
+ const [namePart, host] = principal.split('@');
96
+ const owner = namePart.includes('#') ? namePart.split('#').pop() : namePart;
97
+ return host ? `${owner}@${host}` : owner;
98
+ }
99
+ // ── SOURCE → DESIRED LISTINGS ────────────────────────────────────────────────
100
+ /**
101
+ * App-tool manifests (`apps.{appId}.tools`) the owner has flagged for EXCHANGE.
102
+ *
103
+ * A manifest tool sells in one of two shapes, and the EXCHANGE now lists both:
104
+ * - BOUND (`action_id`) → an `app-tool` listing, metered per synchronous capability call.
105
+ * - UNBOUND (`agent`) → an `agent-work` listing, settled on delivery of a fulfillment task.
106
+ * The checkout path has fulfilled unbound tools as tasks since phase B; the projection used to skip
107
+ * them, so the market could not list what the shop could already sell. An unbound tool needs a named
108
+ * agent of this owner: `aimeat_exchange_work` builds the assignee GAII from the surface, so a listing
109
+ * with no real assignee would take an order nobody can deliver.
110
+ */
111
+ async function desiredFromAppTools(storage, ownerGhii, ownerName, only, skips, dryRun) {
112
+ const out = [];
113
+ /** The owner's agent names, read once and only when an unbound tool actually needs them. */
114
+ let assignees = null;
115
+ const canAssign = async (name) => {
116
+ if (!assignees) {
117
+ assignees = new Set((await storage.listAgents()).filter(a => a.owner === ownerName).map(a => a.name));
118
+ }
119
+ return assignees.has(name);
120
+ };
121
+ const records = only
122
+ ? [await storage.getMemory(ownerGhii, appToolsKey(only))].filter(Boolean)
123
+ : (await storage.listMemory(ownerGhii, { prefix: 'apps.' })).filter(r => /^apps\..+\.tools$/.test(r.key));
124
+ for (const rec of records) {
125
+ if (!rec)
126
+ continue;
127
+ const appId = rec.key.replace(/^apps\./, '').replace(/\.tools$/, '');
128
+ const parsed = AppToolsDocSchema.safeParse(rec.value);
129
+ if (!parsed.success) {
130
+ skips.push({ action: 'skipped', offeringId: null, kind: 'app-tool', label: appId, unit: null, currency: null, reason: 'INVALID_TOOL_MANIFEST' });
131
+ continue;
132
+ }
133
+ for (const tool of parsed.data.tools) {
134
+ if (tool.exchange !== true)
135
+ continue;
136
+ const label = `${appId}/${tool.name}`;
137
+ const skip = (reason) => skips.push({ action: 'skipped', offeringId: null, kind: 'app-tool', label, unit: null, currency: null, reason });
138
+ if (!hasSchema(tool.inputSchema) || !hasSchema(tool.outputSchema)) {
139
+ skip('SCHEMA_REQUIRED');
140
+ continue;
141
+ }
142
+ const money = moneyPricesOf(tool.priceMoney, tool.pricesMoney);
143
+ const morsels = tool.price && tool.price.morsels > 0 ? tool.price.morsels : 0;
144
+ if (!money.length && !morsels) {
145
+ skip('NOT_PRICED');
146
+ continue;
147
+ }
148
+ // ── UNBOUND: the task shape. Listed as agent-work, settled when the assignee delivers. ──
149
+ if (!tool.action_id) {
150
+ if (!tool.agent) {
151
+ skip('NO_ASSIGNEE');
152
+ continue;
153
+ }
154
+ if (!(await canAssign(tool.agent))) {
155
+ skip('ASSIGNEE_NOT_FOUND');
156
+ continue;
157
+ }
158
+ const taskCoord = agentWorkCoordinate(ownerName, tool.agent, tool.name);
159
+ const taskBase = {
160
+ kind: 'agent-work', ext: taskCoord.ext, action: taskCoord.action,
161
+ // appId is what makes this listing findable by a reconcile scoped to its own app — the
162
+ // agentwork coordinate carries no trace of where the tool was declared.
163
+ surface: { kind: 'agent-work', ownerName, agentName: tool.agent, taskType: tool.name, appId },
164
+ title: `${appId} · ${tool.name}`, description: tool.description ?? '',
165
+ plans: (tool.plans ?? []), usageTerms: usageTermsOf(tool.usageTerms), tags: [],
166
+ provenance: provenanceOf(mergeProvenance(parsed.data.provenance, tool.provenance) ?? undefined),
167
+ odps: mergeOdpsExtras(parsed.data.odps, tool.odps),
168
+ tollMorsels: pacingTollOf(tool.tollMorsels, morsels, money.length > 0),
169
+ taskSpec: { inputSchema: tool.inputSchema ?? {}, outputSchema: tool.outputSchema ?? {} },
170
+ };
171
+ for (const p of prices(morsels, money)) {
172
+ out.push({
173
+ ...taskBase, ...p,
174
+ key: listingKey('agent-work', taskCoord.ext, taskCoord.action, p.unit, p.currency),
175
+ // appId rides in the hash because it rides in the SURFACE and not in the key: without it
176
+ // an existing listing whose surface predates this field reads as `unchanged`, the update
177
+ // is skipped, and it keeps a surface no scoped reconcile can match.
178
+ sourceHash: contentHash([taskBase.title, taskBase.description, taskBase.taskSpec, taskBase.plans,
179
+ taskBase.usageTerms, taskBase.provenance, taskBase.odps, taskBase.tollMorsels, appId, p]),
180
+ });
181
+ }
182
+ continue;
183
+ }
184
+ // Pin (or read, when dry) the interface version — the integration contract, unchanged by this work.
185
+ const def = { inputSchema: tool.inputSchema ?? {}, outputSchema: tool.outputSchema ?? {}, binding: tool.action_id };
186
+ const iface = dryRun
187
+ ? await getLatestInterface(storage, ownerGhii, appId, tool.name)
188
+ : await ensureInterfaceVersion(storage, ownerGhii, appId, tool.name, def);
189
+ const ifaceVersion = iface?.ifaceVersion ?? 1;
190
+ const coord = appToolCoordinate(ownerName, appId, tool.name);
191
+ const base = {
192
+ kind: 'app-tool', ext: coord.ext, action: coord.action,
193
+ surface: { kind: 'app-tool', ownerName, appId, tool: tool.name, ifaceVersion },
194
+ title: `${appId} · ${tool.name}`, description: tool.description ?? '',
195
+ plans: (tool.plans ?? []), usageTerms: usageTermsOf(tool.usageTerms), tags: [],
196
+ // App-level defaults (manifest root) are inherited by every tool; the tool overrides field by field.
197
+ provenance: provenanceOf(mergeProvenance(parsed.data.provenance, tool.provenance) ?? undefined),
198
+ odps: mergeOdpsExtras(parsed.data.odps, tool.odps),
199
+ tollMorsels: pacingTollOf(tool.tollMorsels, morsels, money.length > 0),
200
+ };
201
+ for (const p of prices(morsels, money)) {
202
+ out.push({
203
+ ...base, ...p,
204
+ key: listingKey('app-tool', coord.ext, coord.action, p.unit, p.currency),
205
+ sourceHash: contentHash([base.title, base.description, base.plans, base.usageTerms, base.provenance, base.odps, base.tollMorsels, ifaceVersion, p]),
206
+ });
207
+ }
208
+ }
209
+ }
210
+ return out;
211
+ }
212
+ /** Extension actions the owner has flagged (`commercial.exchange === true`). */
213
+ async function desiredFromExtActions(storage, ownerName, only, skips) {
214
+ const out = [];
215
+ const all = await storage.listExtensions();
216
+ for (const ext of all) {
217
+ if (ext.installedBy !== ownerName)
218
+ continue;
219
+ if (only && ext.name !== only)
220
+ continue;
221
+ for (const act of ext.actions) {
222
+ const comm = act.commercial;
223
+ if (!comm || comm.exchange !== true)
224
+ continue;
225
+ const label = `${ext.name}/${act.id}`;
226
+ const skip = (reason) => skips.push({ action: 'skipped', offeringId: null, kind: 'ext-action', label, unit: null, currency: null, reason });
227
+ if (!hasSchema(act.inputSchema) || !hasSchema(act.outputSchema)) {
228
+ skip('SCHEMA_REQUIRED');
229
+ continue;
230
+ }
231
+ const money = moneyPricesOf(comm.payMoney, comm.pricesMoney);
232
+ const morsels = comm.payMorsels > 0 ? comm.payMorsels : 0;
233
+ if (!money.length && !morsels) {
234
+ skip('NOT_PRICED');
235
+ continue;
236
+ }
237
+ const base = {
238
+ kind: 'ext-action', ext: ext.name, action: act.id, surface: null,
239
+ title: `${ext.name} · ${act.id}`, description: ext.description ?? '',
240
+ plans: (comm.plans ?? []), usageTerms: usageTermsOf(comm.usageTerms), tags: [],
241
+ provenance: provenanceOf(comm.provenance), odps: comm.odps ?? null,
242
+ tollMorsels: pacingTollOf(act.tollMorsels, morsels, money.length > 0),
243
+ };
244
+ for (const p of prices(morsels, money)) {
245
+ out.push({
246
+ ...base, ...p,
247
+ key: listingKey('ext-action', ext.name, act.id, p.unit, p.currency),
248
+ sourceHash: contentHash([base.title, base.description, base.plans, base.usageTerms, base.provenance, base.odps, base.tollMorsels, p]),
249
+ });
250
+ }
251
+ }
252
+ }
253
+ return out;
254
+ }
255
+ /** Agent offers flagged for sale as agent work (`exchange: true` + public + priced + I/O declared). */
256
+ async function desiredFromAgentOffers(storage, ownerName, only, skips) {
257
+ const out = [];
258
+ const agents = (await storage.listAgents()).filter(a => a.owner === ownerName && (!only || a.name === only));
259
+ for (const agent of agents) {
260
+ const rec = await storage.getMemory(agent.gaii, `agents.${agent.name}.offers`);
261
+ if (!rec)
262
+ continue;
263
+ const parsed = OffersDocSchema.safeParse(rec.value);
264
+ if (!parsed.success) {
265
+ skips.push({ action: 'skipped', offeringId: null, kind: 'agent-work', label: agent.name, unit: null, currency: null, reason: 'INVALID_OFFERS_DOC' });
266
+ continue;
267
+ }
268
+ for (const offer of parsed.data.offers) {
269
+ if (offer.exchange !== true)
270
+ continue;
271
+ const label = `${agent.name}:${offer.id}`;
272
+ const skip = (reason) => skips.push({ action: 'skipped', offeringId: null, kind: 'agent-work', label, unit: null, currency: null, reason });
273
+ // Selling implies being discoverable: `exchange` is the sale switch, `visibility` the shop window.
274
+ if (offer.visibility !== 'public') {
275
+ skip('NOT_PUBLIC');
276
+ continue;
277
+ }
278
+ if (!hasSchema(offer.inputSchema) || !hasSchema(offer.outputSchema)) {
279
+ skip('SCHEMA_REQUIRED');
280
+ continue;
281
+ }
282
+ const money = moneyPricesOf(offer.priceMoney, offer.pricesMoney);
283
+ const morsels = offer.price && offer.price.morsels > 0 ? offer.price.morsels : 0;
284
+ if (!money.length && !morsels) {
285
+ skip('NOT_PRICED');
286
+ continue;
287
+ }
288
+ const coord = agentWorkCoordinate(ownerName, agent.name, offer.id);
289
+ const base = {
290
+ kind: 'agent-work', ext: coord.ext, action: coord.action,
291
+ surface: { kind: 'agent-work', ownerName, agentName: agent.name, taskType: offer.id },
292
+ title: offer.title || `${agent.name}: ${offer.id}`, description: offer.ask ?? '',
293
+ plans: [], usageTerms: usageTermsOf(offer.usageTerms), tags: (offer.tags ?? []),
294
+ provenance: provenanceOf(offer.provenance), odps: offer.odps ?? null,
295
+ tollMorsels: pacingTollOf(offer.tollMorsels, morsels, money.length > 0),
296
+ taskSpec: { inputSchema: offer.inputSchema ?? {}, outputSchema: offer.outputSchema ?? {} },
297
+ };
298
+ for (const p of prices(morsels, money)) {
299
+ out.push({
300
+ ...base, ...p,
301
+ key: listingKey('agent-work', coord.ext, coord.action, p.unit, p.currency),
302
+ sourceHash: contentHash([base.title, base.description, base.taskSpec, base.usageTerms, base.provenance, base.odps, base.tollMorsels, base.tags, p]),
303
+ });
304
+ }
305
+ }
306
+ }
307
+ return out;
308
+ }
309
+ /** One price row per sellable unit: morsels (when priced) plus every declared money currency. */
310
+ function prices(morsels, money) {
311
+ const rows = [];
312
+ // A source that declares BOTH a money price and a morsel figure is stating ONE combined price:
313
+ // "1 morsel · 0.01 EUR". The money is what the provider is paid; the morsels pace the call
314
+ // (see pacingTollOf below, which carries them onto the listing as the toll). This used to emit
315
+ // a separate morsel listing beside the money one, which turned one product into two purchasable
316
+ // alternatives — and a buyer who took the morsel one got the whole thing for pacing tokens,
317
+ // which the platform itself says are not a currency. Nobody ever declared that second product.
318
+ // Morsels WITHOUT money stay a listing of their own: that is a deliberate no-money offer.
319
+ if (morsels > 0 && money.length === 0)
320
+ rows.push({ unit: 'morsels', basePrice: morsels, currency: null });
321
+ for (const m of money)
322
+ rows.push({ unit: 'money', basePrice: m.amount, currency: m.currency });
323
+ return rows;
324
+ }
325
+ /**
326
+ * The pacing toll a listing carries. An explicit `tollMorsels` always wins — it is the declared
327
+ * one. Otherwise, when a source prices in money AND names a morsel figure, that figure IS the
328
+ * pacing half of the combined price and rides along as the toll, so a call costs the money to the
329
+ * provider and burns the morsels. Money-only stays untolled; morsels-only is priced in morsels
330
+ * already and must not be charged twice for the same number.
331
+ */
332
+ function pacingTollOf(declared, morsels, hasMoney) {
333
+ if (declared != null)
334
+ return declared;
335
+ return hasMoney && morsels > 0 ? morsels : null;
336
+ }
337
+ // ── RECONCILE ────────────────────────────────────────────────────────────────
338
+ /**
339
+ * Project every flagged source of one owner onto their EXCHANGE listings. Idempotent: running it twice
340
+ * changes nothing the second time. `dryRun` reports what WOULD change and writes nothing (not even an
341
+ * interface snapshot). Scope it with appId/extName/agentName to reconcile a single source after a write.
342
+ */
343
+ export async function reconcileOwnerOfferings(storage, principal, opts) {
344
+ const dryRun = opts?.dryRun === true;
345
+ /* Normalise HERE, not at the call sites. Sources live in the OWNER's namespace, so a GAII reaching
346
+ this far reads an agent's empty `apps.*` and every projected listing of that owner looks
347
+ unwanted — one agent browsing the market would delist the lot. The write path already
348
+ normalised; the browse path did not, and one asymmetry was enough. */
349
+ const ownerGhii = ownerGhiiOf(principal);
350
+ const ownerName = ownerGhii.split('@')[0].split('#').pop() ?? ownerGhii;
351
+ const scoped = !!(opts?.appId || opts?.extName || opts?.agentName);
352
+ const changes = [];
353
+ const sourced = [
354
+ ...(!scoped || opts?.appId ? await desiredFromAppTools(storage, ownerGhii, ownerName, opts?.appId, changes, dryRun) : []),
355
+ ...(!scoped || opts?.extName ? await desiredFromExtActions(storage, ownerName, opts?.extName, changes) : []),
356
+ ...(!scoped || opts?.agentName ? await desiredFromAgentOffers(storage, ownerName, opts?.agentName, changes) : []),
357
+ ];
358
+ /* Two sources can now want the SAME listing: an unbound app-tool projects onto (agent, toolName),
359
+ and that agent may publish an offer under the same id. The create branch below reads only the
360
+ pre-existing offerings, so a duplicate key would mint two rival cards — the exact defect this
361
+ projection exists to prevent. First source wins, and the loser is REPORTED rather than dropped
362
+ quietly: a capability that silently failed to list is worse than one that says why. */
363
+ const desired = [];
364
+ const claimed = new Map();
365
+ for (const d of sourced) {
366
+ const held = claimed.get(d.key);
367
+ if (held) {
368
+ skipped(changes, d, `DUPLICATE_OF ${labelOf(held)}`);
369
+ continue;
370
+ }
371
+ claimed.set(d.key, d);
372
+ desired.push(d);
373
+ }
374
+ const mine = (await listAllOfferings(storage)).filter(o => o.providerOwner === ownerName);
375
+ const byKey = new Map();
376
+ for (const o of mine) {
377
+ const k = offeringKey(o);
378
+ const prev = byKey.get(k);
379
+ // Prefer an already-projected listing, then a listed one, then whatever is oldest — so adoption is stable.
380
+ if (!prev || (o.auto && !prev.auto) || (o.state === 'listed' && prev.state !== 'listed'))
381
+ byKey.set(k, o);
382
+ }
383
+ const now = new Date().toISOString();
384
+ const wanted = new Set();
385
+ for (const d of desired) {
386
+ wanted.add(d.key);
387
+ const existing = byKey.get(d.key);
388
+ if (!existing) {
389
+ const offering = {
390
+ offeringId: newOfferingId(), providerGhii: ownerGhii, providerOwner: ownerName,
391
+ kind: d.kind, ext: d.ext, action: d.action, surface: d.surface,
392
+ title: d.title, description: d.description,
393
+ unit: d.unit, basePrice: d.basePrice, currency: d.currency, plans: d.plans,
394
+ ...(d.taskSpec ? { taskSpec: d.taskSpec } : {}),
395
+ provenance: d.provenance, odps: d.odps, tollMorsels: d.tollMorsels, usageTerms: d.usageTerms, tags: d.tags,
396
+ state: 'listed', auto: true, sourceHash: d.sourceHash, createdAt: now, updatedAt: now,
397
+ };
398
+ if (!dryRun)
399
+ await putOffering(storage, offering);
400
+ changes.push({ action: 'created', offeringId: offering.offeringId, kind: d.kind, label: labelOf(d), unit: d.unit, currency: d.currency });
401
+ continue;
402
+ }
403
+ const adopting = !existing.auto;
404
+ const unchanged = !adopting && existing.state === 'listed' && existing.sourceHash === d.sourceHash
405
+ && existing.basePrice === d.basePrice;
406
+ if (unchanged) {
407
+ changes.push({ action: 'unchanged', offeringId: existing.offeringId, kind: d.kind, label: labelOf(d), unit: d.unit, currency: d.currency });
408
+ continue;
409
+ }
410
+ // Keep offeringId: existing entitlements carry `contractRef: offering:{id}`.
411
+ const updated = {
412
+ ...existing,
413
+ kind: d.kind, ext: d.ext, action: d.action, surface: d.surface,
414
+ title: d.title, description: d.description,
415
+ unit: d.unit, basePrice: d.basePrice, currency: d.currency, plans: d.plans,
416
+ ...(d.taskSpec ? { taskSpec: d.taskSpec } : {}),
417
+ usageTerms: d.usageTerms, tags: d.tags,
418
+ // The descriptor is only overwritten when the SOURCE actually states one. Adopting a
419
+ // hand-authored listing whose source carries no provenance must not erase the attestation
420
+ // the provider already made — an emptied legal basis is worse than a stale one.
421
+ ...(d.provenance ? { provenance: d.provenance } : {}),
422
+ ...(d.odps ? { odps: d.odps } : {}),
423
+ // Pacing IS overwritten from the source even when cleared: unlike an attestation, a stale brake
424
+ // the provider has since removed keeps charging consumers for a limit nobody asked for.
425
+ tollMorsels: d.tollMorsels,
426
+ state: 'listed', auto: true, sourceHash: d.sourceHash, updatedAt: now,
427
+ };
428
+ if (!dryRun)
429
+ await putOffering(storage, updated);
430
+ changes.push({
431
+ action: adopting ? 'adopted' : 'updated', offeringId: existing.offeringId,
432
+ kind: d.kind, label: labelOf(d), unit: d.unit, currency: d.currency,
433
+ });
434
+ }
435
+ // Anything this owner PROJECTED that the sources no longer ask for → delist. Hand-authored listings are
436
+ // never delisted here: the provider made them by hand, only they (or the migration) may retire them.
437
+ for (const o of mine) {
438
+ if (!o.auto || o.state !== 'listed')
439
+ continue;
440
+ if (wanted.has(offeringKey(o)))
441
+ continue;
442
+ if (scoped && !inScope(o, opts))
443
+ continue;
444
+ if (!dryRun)
445
+ await putOffering(storage, { ...o, state: 'delisted', updatedAt: now });
446
+ changes.push({ action: 'delisted', offeringId: o.offeringId, kind: o.kind, label: `${o.ext}/${o.action}`, unit: o.unit, currency: o.currency });
447
+ }
448
+ return summarise(ownerName, dryRun, changes);
449
+ }
450
+ /** Record a desired listing that will NOT be created, with the reason on its own coordinate. */
451
+ const skipped = (changes, d, reason) => {
452
+ changes.push({ action: 'skipped', offeringId: null, kind: d.kind, label: labelOf(d), unit: d.unit, currency: d.currency, reason });
453
+ };
454
+ const labelOf = (d) => d.surface?.kind === 'app-tool' ? `${d.surface.appId}/${d.surface.tool}`
455
+ : d.surface?.kind === 'agent-work' ? `${d.surface.agentName}:${d.surface.taskType}`
456
+ : `${d.ext}/${d.action}`;
457
+ /** Does a projected offering belong to the source this scoped reconcile is about? */
458
+ function inScope(o, opts) {
459
+ // An app manifest sources BOTH kinds: a bound tool lists as app-tool, an unbound one as agent-work.
460
+ // Matching only the first left a task-shape listing that its own manifest could never retire.
461
+ if (opts?.appId) {
462
+ if (o.surface?.kind === 'app-tool')
463
+ return o.surface.appId === opts.appId;
464
+ if (o.surface?.kind === 'agent-work')
465
+ return o.surface.appId === opts.appId;
466
+ return false;
467
+ }
468
+ if (opts?.extName)
469
+ return o.kind === 'ext-action' && o.ext === opts.extName;
470
+ if (opts?.agentName)
471
+ return o.kind === 'agent-work' && o.surface?.kind === 'agent-work' && o.surface.agentName === opts.agentName;
472
+ return true;
473
+ }
474
+ function summarise(owner, dryRun, changes) {
475
+ const count = (a) => changes.filter(c => c.action === a).length;
476
+ return {
477
+ owner, dryRun, changes,
478
+ created: count('created'), updated: count('updated'), adopted: count('adopted'),
479
+ delisted: count('delisted'), unchanged: count('unchanged'), skipped: count('skipped'),
480
+ };
481
+ }
482
+ /**
483
+ * Browsing the market refreshes the CALLER's own projections, but a browse must not pay for a full source
484
+ * scan every time: writes already reconcile eagerly, so this is only a safety net. One pass per owner per
485
+ * window is plenty. In-process (like the node's other read caches) — a restart just re-arms it.
486
+ */
487
+ const RECONCILE_WINDOW_MS = 30_000;
488
+ const lastReconcile = new Map();
489
+ export async function reconcileOwnerOfferingsThrottled(storage, principal) {
490
+ // Key the throttle on the OWNER too, so five of one owner's agents browsing do not buy five passes.
491
+ const ownerGhii = ownerGhiiOf(principal);
492
+ const now = Date.now();
493
+ const prev = lastReconcile.get(ownerGhii) ?? 0;
494
+ if (now - prev < RECONCILE_WINDOW_MS)
495
+ return;
496
+ lastReconcile.set(ownerGhii, now);
497
+ await reconcileOwnerOfferings(storage, ownerGhii);
498
+ }
499
+ /**
500
+ * Reconcile after a SOURCE record was written, so pricing a tool in the app-catalog (or via MCP) is on the
501
+ * market when the save returns — no second step, and no race for the caller to lose. Recognises the two
502
+ * memory-backed sources (`apps.{appId}.tools`, `agents.{agent}.offers`); anything else returns immediately,
503
+ * so an ordinary memory write pays nothing. AWAITED on purpose: "I saved the price, is it live?" must have a
504
+ * definite answer, and these keys are written rarely. Never rejects into the caller's response path — a
505
+ * failed projection must not fail the write that triggered it.
506
+ */
507
+ export async function reconcileAfterSourceWrite(storage, ownerGaii, key) {
508
+ const app = /^apps\.(.+)\.tools$/.exec(key);
509
+ const offers = /^agents\.(.+)\.offers$/.exec(key);
510
+ if (!app && !offers)
511
+ return;
512
+ // An offers doc lives under the AGENT's GAII (`agent#owner@node`); listings belong to the owner GHII.
513
+ const ownerGhii = ownerGhiiOf(ownerGaii);
514
+ const opts = app ? { appId: app[1] } : { agentName: offers[1] };
515
+ // A source write is the authoritative signal — clear the browse throttle so a later read cannot serve a
516
+ // view older than this write.
517
+ lastReconcile.delete(ownerGhii);
518
+ try {
519
+ await reconcileOwnerOfferings(storage, ownerGhii, opts);
520
+ }
521
+ catch (err) {
522
+ logger.warn('reconcileAfterSourceWrite: projection is best-effort: never fail the write that triggered it', { error: String(err) });
523
+ }
524
+ }
525
+ /** Same, for an extension whose actions may carry `commercial.exchange`. */
526
+ export async function reconcileAfterExtensionWrite(storage, ownerName, nodeId, extName) {
527
+ const ownerGhii = `${ownerName}@${nodeId}`;
528
+ lastReconcile.delete(ownerGhii);
529
+ try {
530
+ await reconcileOwnerOfferings(storage, ownerGhii, { extName });
531
+ }
532
+ catch (err) {
533
+ logger.warn('reconcileAfterExtensionWrite: projection is best-effort', { error: String(err) });
534
+ }
535
+ }
536
+ // ── MIGRATION (TARGET-050 slice 3) ───────────────────────────────────────────
537
+ /**
538
+ * Bring hand-authored listings into the projection model: for each of the owner's listed offerings that is
539
+ * not yet a projection, flip the `exchange` flag ON in its SOURCE (so the source now explains why the
540
+ * listing exists) and let reconcile adopt the existing record — keeping its `offeringId`, so entitlements
541
+ * referencing `offering:{id}` keep resolving. A listing whose source is gone is reported as an orphan and
542
+ * left exactly as it is. Idempotent; `dryRun` writes nothing.
543
+ */
544
+ export async function migrateLegacyOfferings(storage, ownerGhii, opts) {
545
+ const dryRun = opts?.dryRun === true;
546
+ const ownerName = ownerGhii.split('@')[0].split('#').pop() ?? ownerGhii;
547
+ const legacy = (await listAllOfferings(storage)).filter(o => o.providerOwner === ownerName && o.state === 'listed' && !o.auto);
548
+ const orphans = [];
549
+ const flagged = [];
550
+ for (const o of legacy) {
551
+ if (o.kind === 'app-tool' && o.surface?.kind === 'app-tool') {
552
+ const { appId, tool: toolName } = o.surface;
553
+ const key = appToolsKey(appId);
554
+ const rec = await storage.getMemory(ownerGhii, key);
555
+ const parsed = rec ? AppToolsDocSchema.safeParse(rec.value) : null;
556
+ const tool = parsed?.success ? parsed.data.tools.find((t) => t.name === toolName) : null;
557
+ if (!rec || !parsed?.success || !tool) {
558
+ orphans.push(`${o.offeringId} (${o.ext}/${o.action})`);
559
+ continue;
560
+ }
561
+ if (tool.exchange === true)
562
+ continue;
563
+ flagged.push(`${appId}/${tool.name}`);
564
+ if (!dryRun) {
565
+ tool.exchange = true;
566
+ if (!tool.usageTerms && o.usageTerms)
567
+ tool.usageTerms = { ...o.usageTerms };
568
+ await storage.setMemory({
569
+ key, ownerGaii: ownerGhii, value: { ...parsed.data, updatedAt: new Date().toISOString() },
570
+ visibility: 'public', tags: ['app-tools'], ttlHours: null, version: 1,
571
+ createdAt: rec.createdAt ?? new Date().toISOString(), updatedAt: new Date().toISOString(),
572
+ });
573
+ }
574
+ continue;
575
+ }
576
+ if (o.kind === 'ext-action') {
577
+ const ext = await storage.getExtension(o.ext);
578
+ const act = ext?.actions.find(a => a.id === o.action);
579
+ if (!ext || !act || ext.installedBy !== ownerName) {
580
+ orphans.push(`${o.offeringId} (${o.ext}/${o.action})`);
581
+ continue;
582
+ }
583
+ if (act.commercial?.exchange === true)
584
+ continue;
585
+ flagged.push(`${ext.name}/${act.id}`);
586
+ if (!dryRun && act.commercial) {
587
+ act.commercial.exchange = true;
588
+ if (!act.commercial.usageTerms && o.usageTerms)
589
+ act.commercial.usageTerms = { ...o.usageTerms };
590
+ await storage.updateExtension(ext.name, { actions: ext.actions });
591
+ }
592
+ continue;
593
+ }
594
+ if (o.kind === 'agent-work' && o.surface?.kind === 'agent-work') {
595
+ const agentName = o.surface.agentName;
596
+ const agent = (await storage.listAgents()).find(a => a.owner === ownerName && a.name === agentName);
597
+ const rec = agent ? await storage.getMemory(agent.gaii, `agents.${agentName}.offers`) : null;
598
+ const parsed = rec ? OffersDocSchema.safeParse(rec.value) : null;
599
+ const offer = parsed?.success ? parsed.data.offers.find((f) => f.id === o.action) : null;
600
+ if (!agent || !rec || !parsed?.success || !offer) {
601
+ orphans.push(`${o.offeringId} (${o.ext}/${o.action})`);
602
+ continue;
603
+ }
604
+ if (offer.exchange === true)
605
+ continue;
606
+ flagged.push(`${agentName}:${offer.id}`);
607
+ if (!dryRun) {
608
+ offer.exchange = true;
609
+ offer.visibility = 'public';
610
+ if (!offer.inputSchema && o.taskSpec?.inputSchema)
611
+ offer.inputSchema = o.taskSpec.inputSchema;
612
+ if (!offer.outputSchema && o.taskSpec?.outputSchema)
613
+ offer.outputSchema = o.taskSpec.outputSchema;
614
+ if (!offer.usageTerms && o.usageTerms)
615
+ offer.usageTerms = { ...o.usageTerms };
616
+ await storage.setMemory({
617
+ key: `agents.${agentName}.offers`, ownerGaii: agent.gaii, value: { ...parsed.data, updatedAt: new Date().toISOString() },
618
+ visibility: rec.visibility ?? 'owner', tags: ['offers'], ttlHours: null, version: 1,
619
+ createdAt: rec.createdAt ?? new Date().toISOString(), updatedAt: new Date().toISOString(),
620
+ });
621
+ }
622
+ continue;
623
+ }
624
+ orphans.push(`${o.offeringId} (${o.ext}/${o.action})`);
625
+ }
626
+ const report = await reconcileOwnerOfferings(storage, ownerGhii, { dryRun });
627
+ return { ...report, orphans, flagged };
628
+ }
629
+ //# sourceMappingURL=exchange-projection.js.map