@noodleseed/one 0.45.0 → 0.47.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 (338) hide show
  1. package/dist/commands/auth-ops.d.ts.map +1 -1
  2. package/dist/commands/auth-ops.js +28 -4
  3. package/dist/commands/auth-ops.js.map +1 -1
  4. package/dist/commands/billing-enforcement-ops.d.ts +2 -0
  5. package/dist/commands/billing-enforcement-ops.d.ts.map +1 -0
  6. package/dist/commands/billing-enforcement-ops.js +312 -0
  7. package/dist/commands/billing-enforcement-ops.js.map +1 -0
  8. package/dist/commands/billing-metering-ops.d.ts +2 -0
  9. package/dist/commands/billing-metering-ops.d.ts.map +1 -0
  10. package/dist/commands/billing-metering-ops.js +128 -0
  11. package/dist/commands/billing-metering-ops.js.map +1 -0
  12. package/dist/commands/billing-metering-validation-ops.d.ts +2 -0
  13. package/dist/commands/billing-metering-validation-ops.d.ts.map +1 -0
  14. package/dist/commands/billing-metering-validation-ops.js +186 -0
  15. package/dist/commands/billing-metering-validation-ops.js.map +1 -0
  16. package/dist/commands/billing-ops.d.ts.map +1 -1
  17. package/dist/commands/billing-ops.js +6 -0
  18. package/dist/commands/billing-ops.js.map +1 -1
  19. package/dist/commands/catalog-data-resources.d.ts.map +1 -1
  20. package/dist/commands/catalog-data-resources.js +14 -3
  21. package/dist/commands/catalog-data-resources.js.map +1 -1
  22. package/dist/commands/catalog-render.d.ts.map +1 -1
  23. package/dist/commands/catalog-render.js +7 -5
  24. package/dist/commands/catalog-render.js.map +1 -1
  25. package/dist/commands/deploy-ops.d.ts.map +1 -1
  26. package/dist/commands/deploy-ops.js +10 -1
  27. package/dist/commands/deploy-ops.js.map +1 -1
  28. package/dist/commands/deploy-output.d.ts.map +1 -1
  29. package/dist/commands/deploy-output.js +4 -0
  30. package/dist/commands/deploy-output.js.map +1 -1
  31. package/dist/commands/deploy-version-resolution.d.ts +1 -0
  32. package/dist/commands/deploy-version-resolution.d.ts.map +1 -1
  33. package/dist/commands/deploy-version-resolution.js +8 -0
  34. package/dist/commands/deploy-version-resolution.js.map +1 -1
  35. package/dist/commands/mcp-apps-chatgpt.d.ts +7 -0
  36. package/dist/commands/mcp-apps-chatgpt.d.ts.map +1 -0
  37. package/dist/commands/mcp-apps-chatgpt.js +143 -0
  38. package/dist/commands/mcp-apps-chatgpt.js.map +1 -0
  39. package/dist/commands/mcp-apps.d.ts.map +1 -1
  40. package/dist/commands/mcp-apps.js +2 -114
  41. package/dist/commands/mcp-apps.js.map +1 -1
  42. package/dist/deploy-payload-size.d.ts +3 -0
  43. package/dist/deploy-payload-size.d.ts.map +1 -0
  44. package/dist/deploy-payload-size.js +29 -0
  45. package/dist/deploy-payload-size.js.map +1 -0
  46. package/dist/deploy.d.ts.map +1 -1
  47. package/dist/deploy.js +16 -8
  48. package/dist/deploy.js.map +1 -1
  49. package/dist/saas-scaffold-template.js +1 -1
  50. package/dist/saas-scaffold-template.js.map +1 -1
  51. package/dist/sdk-version-skew.d.ts +3 -0
  52. package/dist/sdk-version-skew.d.ts.map +1 -0
  53. package/dist/sdk-version-skew.js +34 -0
  54. package/dist/sdk-version-skew.js.map +1 -0
  55. package/dist/widget-scaffold-template.d.ts.map +1 -1
  56. package/dist/widget-scaffold-template.js +4 -2
  57. package/dist/widget-scaffold-template.js.map +1 -1
  58. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +3 -3
  59. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js.map +1 -1
  60. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js +1 -1
  61. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js.map +1 -1
  62. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js +1 -1
  63. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js.map +1 -1
  64. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.d.ts.map +1 -1
  65. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js +6 -4
  66. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js.map +1 -1
  67. package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
  68. package/node_modules/@noodle-borg/authoring/dist/assistant.d.ts +9 -0
  69. package/node_modules/@noodle-borg/authoring/dist/assistant.d.ts.map +1 -1
  70. package/node_modules/@noodle-borg/authoring/dist/assistant.js.map +1 -1
  71. package/node_modules/@noodle-borg/authoring/dist/server.d.ts +7 -0
  72. package/node_modules/@noodle-borg/authoring/dist/server.d.ts.map +1 -1
  73. package/node_modules/@noodle-borg/authoring/dist/server.js +2 -0
  74. package/node_modules/@noodle-borg/authoring/dist/server.js.map +1 -1
  75. package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts +10 -1
  76. package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts.map +1 -1
  77. package/node_modules/@noodle-borg/compiler/dist/artifact/types.js +6 -1
  78. package/node_modules/@noodle-borg/compiler/dist/artifact/types.js.map +1 -1
  79. package/node_modules/@noodle-borg/compiler/dist/compile.d.ts.map +1 -1
  80. package/node_modules/@noodle-borg/compiler/dist/compile.js +4 -0
  81. package/node_modules/@noodle-borg/compiler/dist/compile.js.map +1 -1
  82. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +52 -0
  83. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts.map +1 -1
  84. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +17 -0
  85. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js.map +1 -1
  86. package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts.map +1 -1
  87. package/node_modules/@noodle-borg/protocol/dist/mapping.js +1 -0
  88. package/node_modules/@noodle-borg/protocol/dist/mapping.js.map +1 -1
  89. package/node_modules/@noodle-borg/protocol/dist/sdk-server.js +18 -0
  90. package/node_modules/@noodle-borg/protocol/dist/sdk-server.js.map +1 -1
  91. package/node_modules/@noodle-borg/protocol/dist/tool-interaction.d.ts +3 -0
  92. package/node_modules/@noodle-borg/protocol/dist/tool-interaction.d.ts.map +1 -1
  93. package/node_modules/@noodle-borg/protocol/dist/tool-interaction.js +12 -3
  94. package/node_modules/@noodle-borg/protocol/dist/tool-interaction.js.map +1 -1
  95. package/node_modules/@noodle-borg/service/dist/assistant-interactive.d.ts.map +1 -1
  96. package/node_modules/@noodle-borg/service/dist/assistant-interactive.js +7 -3
  97. package/node_modules/@noodle-borg/service/dist/assistant-interactive.js.map +1 -1
  98. package/node_modules/@noodle-borg/service/dist/assistant-presentation.d.ts +11 -0
  99. package/node_modules/@noodle-borg/service/dist/assistant-presentation.d.ts.map +1 -1
  100. package/node_modules/@noodle-borg/service/dist/assistant-presentation.js +67 -3
  101. package/node_modules/@noodle-borg/service/dist/assistant-presentation.js.map +1 -1
  102. package/node_modules/@noodle-borg/service/dist/billing/enforcement-profile.d.ts +96 -0
  103. package/node_modules/@noodle-borg/service/dist/billing/enforcement-profile.d.ts.map +1 -0
  104. package/node_modules/@noodle-borg/service/dist/billing/enforcement-profile.js +198 -0
  105. package/node_modules/@noodle-borg/service/dist/billing/enforcement-profile.js.map +1 -0
  106. package/node_modules/@noodle-borg/service/dist/billing/integration.d.ts +25 -2
  107. package/node_modules/@noodle-borg/service/dist/billing/integration.d.ts.map +1 -1
  108. package/node_modules/@noodle-borg/service/dist/billing/integration.js +51 -5
  109. package/node_modules/@noodle-borg/service/dist/billing/integration.js.map +1 -1
  110. package/node_modules/@noodle-borg/service/dist/billing/meter-capacity.d.ts +77 -0
  111. package/node_modules/@noodle-borg/service/dist/billing/meter-capacity.d.ts.map +1 -0
  112. package/node_modules/@noodle-borg/service/dist/billing/meter-capacity.js +202 -0
  113. package/node_modules/@noodle-borg/service/dist/billing/meter-capacity.js.map +1 -0
  114. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation-contract.d.ts +8 -0
  115. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation-contract.d.ts.map +1 -0
  116. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation-contract.js +93 -0
  117. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation-contract.js.map +1 -0
  118. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation.d.ts +76 -0
  119. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation.d.ts.map +1 -0
  120. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation.js +233 -0
  121. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation.js.map +1 -0
  122. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness-health.d.ts +89 -0
  123. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness-health.d.ts.map +1 -0
  124. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness-health.js +191 -0
  125. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness-health.js.map +1 -0
  126. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness.d.ts +99 -0
  127. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness.d.ts.map +1 -0
  128. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness.js +136 -0
  129. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness.js.map +1 -0
  130. package/node_modules/@noodle-borg/service/dist/billing/meter-runtime-config.d.ts +9 -0
  131. package/node_modules/@noodle-borg/service/dist/billing/meter-runtime-config.d.ts.map +1 -0
  132. package/node_modules/@noodle-borg/service/dist/billing/meter-runtime-config.js +24 -0
  133. package/node_modules/@noodle-borg/service/dist/billing/meter-runtime-config.js.map +1 -0
  134. package/node_modules/@noodle-borg/service/dist/billing/meter-validation-epoch.d.ts +75 -0
  135. package/node_modules/@noodle-borg/service/dist/billing/meter-validation-epoch.d.ts.map +1 -0
  136. package/node_modules/@noodle-borg/service/dist/billing/meter-validation-epoch.js +127 -0
  137. package/node_modules/@noodle-borg/service/dist/billing/meter-validation-epoch.js.map +1 -0
  138. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.d.ts +4 -0
  139. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.d.ts.map +1 -0
  140. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.js +107 -0
  141. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.js.map +1 -0
  142. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile.d.ts +18 -0
  143. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile.d.ts.map +1 -0
  144. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile.js +341 -0
  145. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile.js.map +1 -0
  146. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-clock.d.ts +3 -0
  147. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-clock.d.ts.map +1 -0
  148. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-clock.js +9 -0
  149. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-clock.js.map +1 -0
  150. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epoch-fixtures.d.ts +13 -0
  151. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epoch-fixtures.d.ts.map +1 -0
  152. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epoch-fixtures.js +102 -0
  153. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epoch-fixtures.js.map +1 -0
  154. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epochs.d.ts +41 -0
  155. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epochs.d.ts.map +1 -0
  156. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epochs.js +289 -0
  157. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epochs.js.map +1 -0
  158. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-evidence-retention.d.ts +16 -0
  159. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-evidence-retention.d.ts.map +1 -0
  160. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-evidence-retention.js +126 -0
  161. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-evidence-retention.js.map +1 -0
  162. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-live-validation.d.ts +33 -0
  163. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-live-validation.d.ts.map +1 -0
  164. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-live-validation.js +436 -0
  165. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-live-validation.js.map +1 -0
  166. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-maintenance.d.ts +26 -0
  167. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-maintenance.d.ts.map +1 -0
  168. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-maintenance.js +146 -0
  169. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-maintenance.js.map +1 -0
  170. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-partition.d.ts +8 -0
  171. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-partition.d.ts.map +1 -0
  172. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-partition.js +42 -0
  173. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-partition.js.map +1 -0
  174. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-prepare-preflight.d.ts +8 -0
  175. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-prepare-preflight.d.ts.map +1 -0
  176. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-prepare-preflight.js +44 -0
  177. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-prepare-preflight.js.map +1 -0
  178. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness-live.d.ts +13 -0
  179. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness-live.d.ts.map +1 -0
  180. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness-live.js +189 -0
  181. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness-live.js.map +1 -0
  182. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness.d.ts +18 -0
  183. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness.d.ts.map +1 -0
  184. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness.js +342 -0
  185. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness.js.map +1 -0
  186. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-reconciliation.d.ts +27 -0
  187. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-reconciliation.d.ts.map +1 -0
  188. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-reconciliation.js +304 -0
  189. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-reconciliation.js.map +1 -0
  190. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-retention.d.ts +22 -0
  191. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-retention.d.ts.map +1 -0
  192. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-retention.js +224 -0
  193. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-retention.js.map +1 -0
  194. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-runtime.d.ts +33 -0
  195. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-runtime.d.ts.map +1 -0
  196. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-runtime.js +173 -0
  197. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-runtime.js.map +1 -0
  198. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-schema.d.ts +7 -0
  199. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-schema.d.ts.map +1 -0
  200. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-schema.js +50 -0
  201. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-schema.js.map +1 -0
  202. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-store.d.ts +34 -0
  203. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-store.d.ts.map +1 -0
  204. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-store.js +157 -0
  205. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-store.js.map +1 -0
  206. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler.d.ts +56 -0
  207. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler.d.ts.map +1 -0
  208. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler.js +264 -0
  209. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler.js.map +1 -0
  210. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-schema.d.ts +6 -0
  211. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-schema.d.ts.map +1 -0
  212. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-schema.js +414 -0
  213. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-schema.js.map +1 -0
  214. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-validation.d.ts +43 -0
  215. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-validation.d.ts.map +1 -0
  216. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-validation.js +321 -0
  217. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-validation.js.map +1 -0
  218. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-lock.d.ts +10 -0
  219. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-lock.d.ts.map +1 -0
  220. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-lock.js +13 -0
  221. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-lock.js.map +1 -0
  222. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-schema.d.ts +6 -0
  223. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-schema.d.ts.map +1 -0
  224. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-schema.js +248 -0
  225. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-schema.js.map +1 -0
  226. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-compaction.d.ts +29 -0
  227. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-compaction.d.ts.map +1 -0
  228. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-compaction.js +240 -0
  229. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-compaction.js.map +1 -0
  230. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-health-schema.d.ts +4 -0
  231. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-health-schema.d.ts.map +1 -0
  232. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-health-schema.js +140 -0
  233. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-health-schema.js.map +1 -0
  234. package/node_modules/@noodle-borg/service/dist/billing/postgres-migration.d.ts.map +1 -1
  235. package/node_modules/@noodle-borg/service/dist/billing/postgres-migration.js +4 -0
  236. package/node_modules/@noodle-borg/service/dist/billing/postgres-migration.js.map +1 -1
  237. package/node_modules/@noodle-borg/service/dist/billing/postgres-schema.d.ts.map +1 -1
  238. package/node_modules/@noodle-borg/service/dist/billing/postgres-schema.js +6 -0
  239. package/node_modules/@noodle-borg/service/dist/billing/postgres-schema.js.map +1 -1
  240. package/node_modules/@noodle-borg/service/dist/billing/postgres.d.ts.map +1 -1
  241. package/node_modules/@noodle-borg/service/dist/billing/postgres.js +3 -0
  242. package/node_modules/@noodle-borg/service/dist/billing/postgres.js.map +1 -1
  243. package/node_modules/@noodle-borg/service/dist/billing/service-meter-runtime.d.ts +7 -0
  244. package/node_modules/@noodle-borg/service/dist/billing/service-meter-runtime.d.ts.map +1 -0
  245. package/node_modules/@noodle-borg/service/dist/billing/service-meter-runtime.js +19 -0
  246. package/node_modules/@noodle-borg/service/dist/billing/service-meter-runtime.js.map +1 -0
  247. package/node_modules/@noodle-borg/service/dist/billing/shadow-meter.d.ts +9 -4
  248. package/node_modules/@noodle-borg/service/dist/billing/shadow-meter.d.ts.map +1 -1
  249. package/node_modules/@noodle-borg/service/dist/billing/shadow-meter.js +34 -95
  250. package/node_modules/@noodle-borg/service/dist/billing/shadow-meter.js.map +1 -1
  251. package/node_modules/@noodle-borg/service/dist/billing/usage-identity.d.ts +14 -0
  252. package/node_modules/@noodle-borg/service/dist/billing/usage-identity.d.ts.map +1 -0
  253. package/node_modules/@noodle-borg/service/dist/billing/usage-identity.js +87 -0
  254. package/node_modules/@noodle-borg/service/dist/billing/usage-identity.js.map +1 -0
  255. package/node_modules/@noodle-borg/service/dist/billing/usage-observer.d.ts +6 -0
  256. package/node_modules/@noodle-borg/service/dist/billing/usage-observer.d.ts.map +1 -0
  257. package/node_modules/@noodle-borg/service/dist/billing/usage-observer.js +26 -0
  258. package/node_modules/@noodle-borg/service/dist/billing/usage-observer.js.map +1 -0
  259. package/node_modules/@noodle-borg/service/dist/billing-public.d.ts +16 -0
  260. package/node_modules/@noodle-borg/service/dist/billing-public.d.ts.map +1 -0
  261. package/node_modules/@noodle-borg/service/dist/billing-public.js +15 -0
  262. package/node_modules/@noodle-borg/service/dist/billing-public.js.map +1 -0
  263. package/node_modules/@noodle-borg/service/dist/customer-verifier.d.ts +1 -0
  264. package/node_modules/@noodle-borg/service/dist/customer-verifier.d.ts.map +1 -1
  265. package/node_modules/@noodle-borg/service/dist/customer-verifier.js +15 -0
  266. package/node_modules/@noodle-borg/service/dist/customer-verifier.js.map +1 -1
  267. package/node_modules/@noodle-borg/service/dist/http-util.d.ts +2 -0
  268. package/node_modules/@noodle-borg/service/dist/http-util.d.ts.map +1 -1
  269. package/node_modules/@noodle-borg/service/dist/http-util.js +1 -1
  270. package/node_modules/@noodle-borg/service/dist/http-util.js.map +1 -1
  271. package/node_modules/@noodle-borg/service/dist/index.d.ts +2 -7
  272. package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
  273. package/node_modules/@noodle-borg/service/dist/index.js +1 -6
  274. package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
  275. package/node_modules/@noodle-borg/service/dist/main.js +3 -0
  276. package/node_modules/@noodle-borg/service/dist/main.js.map +1 -1
  277. package/node_modules/@noodle-borg/service/dist/options.d.ts +18 -0
  278. package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
  279. package/node_modules/@noodle-borg/service/dist/persistence-options.d.ts +4 -0
  280. package/node_modules/@noodle-borg/service/dist/persistence-options.d.ts.map +1 -0
  281. package/node_modules/@noodle-borg/service/dist/persistence-options.js +22 -0
  282. package/node_modules/@noodle-borg/service/dist/persistence-options.js.map +1 -0
  283. package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.d.ts.map +1 -1
  284. package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.js +2 -1
  285. package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.js.map +1 -1
  286. package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.d.ts.map +1 -1
  287. package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js +6 -2
  288. package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js.map +1 -1
  289. package/node_modules/@noodle-borg/service/dist/routes/billing-enforcement-cohort.d.ts +17 -0
  290. package/node_modules/@noodle-borg/service/dist/routes/billing-enforcement-cohort.d.ts.map +1 -0
  291. package/node_modules/@noodle-borg/service/dist/routes/billing-enforcement-cohort.js +145 -0
  292. package/node_modules/@noodle-borg/service/dist/routes/billing-enforcement-cohort.js.map +1 -0
  293. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-readiness.d.ts +15 -0
  294. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-readiness.d.ts.map +1 -0
  295. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-readiness.js +78 -0
  296. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-readiness.js.map +1 -0
  297. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-validation.d.ts +15 -0
  298. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-validation.d.ts.map +1 -0
  299. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-validation.js +108 -0
  300. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-validation.js.map +1 -0
  301. package/node_modules/@noodle-borg/service/dist/routes/commercial-dispatch.d.ts +6 -0
  302. package/node_modules/@noodle-borg/service/dist/routes/commercial-dispatch.d.ts.map +1 -1
  303. package/node_modules/@noodle-borg/service/dist/routes/commercial-dispatch.js +99 -0
  304. package/node_modules/@noodle-borg/service/dist/routes/commercial-dispatch.js.map +1 -1
  305. package/node_modules/@noodle-borg/service/dist/routes/commercial-service-deps.d.ts +25 -0
  306. package/node_modules/@noodle-borg/service/dist/routes/commercial-service-deps.d.ts.map +1 -0
  307. package/node_modules/@noodle-borg/service/dist/routes/commercial-service-deps.js +35 -0
  308. package/node_modules/@noodle-borg/service/dist/routes/commercial-service-deps.js.map +1 -0
  309. package/node_modules/@noodle-borg/service/dist/routes/control-plane.d.ts.map +1 -1
  310. package/node_modules/@noodle-borg/service/dist/routes/control-plane.js +3 -1
  311. package/node_modules/@noodle-borg/service/dist/routes/control-plane.js.map +1 -1
  312. package/node_modules/@noodle-borg/service/dist/serve-options.d.ts +93 -0
  313. package/node_modules/@noodle-borg/service/dist/serve-options.d.ts.map +1 -0
  314. package/node_modules/@noodle-borg/service/dist/serve-options.js +2 -0
  315. package/node_modules/@noodle-borg/service/dist/serve-options.js.map +1 -0
  316. package/node_modules/@noodle-borg/service/dist/serve.d.ts +2 -92
  317. package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
  318. package/node_modules/@noodle-borg/service/dist/serve.js +64 -59
  319. package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
  320. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts +22 -0
  321. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts.map +1 -0
  322. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js +51 -0
  323. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js.map +1 -0
  324. package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
  325. package/node_modules/@noodle-borg/service/dist/service.js +10 -21
  326. package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
  327. package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.d.ts.map +1 -1
  328. package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.js +7 -1
  329. package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.js.map +1 -1
  330. package/node_modules/@noodle-borg/service/dist/store/postgres-billing.d.ts +6 -2
  331. package/node_modules/@noodle-borg/service/dist/store/postgres-billing.d.ts.map +1 -1
  332. package/node_modules/@noodle-borg/service/dist/store/postgres-billing.js +11 -1
  333. package/node_modules/@noodle-borg/service/dist/store/postgres-billing.js.map +1 -1
  334. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts +3 -0
  335. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts.map +1 -1
  336. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js +3 -0
  337. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js.map +1 -1
  338. package/package.json +1 -1
@@ -0,0 +1,264 @@
1
+ import { noopLogger } from '@noodle-borg/transport-http';
2
+ import { runBillingMeterMaintenanceOnClient } from './postgres-meter-maintenance.js';
3
+ import { BillingMeterConnectionUnsafeError, reconcileBillingMeterWindowOnClient, } from './postgres-meter-reconciliation.js';
4
+ import { completeBillingMeterSchedulerRun, configureBillingMeterSchedulerSession, discoverBillingMeterSchedulerWindows, startBillingMeterSchedulerRun, } from './postgres-meter-scheduler-store.js';
5
+ export { ensureBillingMeterSchedulerSchema } from './postgres-meter-scheduler-schema.js';
6
+ export { BILLING_METER_SCHEDULER_CONTRACT_VERSION, } from './postgres-meter-scheduler-store.js';
7
+ export const BILLING_METER_SCHEDULER_LOCK_KEY = 'billing-meter-maintenance-scheduler:v1';
8
+ export const BILLING_METER_SCHEDULER_INTERVAL_MS = 5 * 60 * 1_000;
9
+ export const BILLING_METER_SCHEDULER_MAX_WINDOWS_PER_CYCLE = 100;
10
+ export const BILLING_METER_SCHEDULER_STATEMENT_TIMEOUT_MS = 30_000;
11
+ export const BILLING_METER_SCHEDULER_LOCK_TIMEOUT_MS = 5_000;
12
+ export const BILLING_METER_SCHEDULER_CYCLE_TIMEOUT_MS = 4 * 60 * 1_000;
13
+ const DEFAULT_OPERATIONS = {
14
+ reconcileWindow: (client, window) => reconcileBillingMeterWindowOnClient(client, window),
15
+ runMaintenance: (client) => runBillingMeterMaintenanceOnClient(client),
16
+ };
17
+ /**
18
+ * One scheduler may run in every stateless service instance. Local recursion prevents overlap in
19
+ * one process; the session advisory lock elects one leader across the fleet for the complete cycle.
20
+ * Validation remains fail-open and this class never activates an epoch or changes admission.
21
+ */
22
+ export class PostgresBillingMeterScheduler {
23
+ #pool;
24
+ #releaseSha;
25
+ #intervalMs;
26
+ #maxWindowsPerCycle;
27
+ #statementTimeoutMs;
28
+ #lockTimeoutMs;
29
+ #cycleTimeoutMs;
30
+ #logger;
31
+ #operations;
32
+ #started = false;
33
+ #timer;
34
+ #cycleInFlight;
35
+ constructor(pool, options) {
36
+ this.#pool = pool;
37
+ this.#releaseSha = validateReleaseSha(options.releaseSha);
38
+ if (options.cpuAlwaysAllocated !== true) {
39
+ throw new Error('billing meter scheduler requires CPU to be always allocated');
40
+ }
41
+ this.#intervalMs = validatePositiveBoundedInteger('billing meter scheduler interval', options.intervalMs ?? BILLING_METER_SCHEDULER_INTERVAL_MS);
42
+ this.#maxWindowsPerCycle = validatePositiveBoundedInteger('billing meter scheduler window limit', options.maxWindowsPerCycle ?? BILLING_METER_SCHEDULER_MAX_WINDOWS_PER_CYCLE);
43
+ this.#statementTimeoutMs = validatePositiveBoundedInteger('billing meter scheduler statement timeout', options.statementTimeoutMs ?? BILLING_METER_SCHEDULER_STATEMENT_TIMEOUT_MS);
44
+ this.#lockTimeoutMs = validatePositiveBoundedInteger('billing meter scheduler lock timeout', options.lockTimeoutMs ?? BILLING_METER_SCHEDULER_LOCK_TIMEOUT_MS);
45
+ this.#cycleTimeoutMs = validatePositiveBoundedInteger('billing meter scheduler cycle timeout', options.cycleTimeoutMs ?? BILLING_METER_SCHEDULER_CYCLE_TIMEOUT_MS);
46
+ this.#logger = options.logger ?? noopLogger;
47
+ this.#operations = options.operations ?? DEFAULT_OPERATIONS;
48
+ }
49
+ /** Start one immediate cycle, followed by a recursive delay measured after each completion. */
50
+ start() {
51
+ if (this.#started)
52
+ return;
53
+ this.#started = true;
54
+ void this.#runScheduledCycle();
55
+ }
56
+ /** Stop future recursion and wait for the current bounded cycle to release its database client. */
57
+ async stop() {
58
+ this.#started = false;
59
+ if (this.#timer !== undefined) {
60
+ clearTimeout(this.#timer);
61
+ this.#timer = undefined;
62
+ }
63
+ await this.#cycleInFlight?.catch(() => undefined);
64
+ }
65
+ /** Run now, or join the already-running local cycle rather than overlapping it. */
66
+ runNow() {
67
+ if (this.#cycleInFlight !== undefined)
68
+ return this.#cycleInFlight;
69
+ const cycle = this.#runCycle();
70
+ this.#cycleInFlight = cycle;
71
+ const clear = () => {
72
+ if (this.#cycleInFlight === cycle)
73
+ this.#cycleInFlight = undefined;
74
+ };
75
+ void cycle.then(clear, clear);
76
+ return cycle;
77
+ }
78
+ async #runScheduledCycle() {
79
+ try {
80
+ await this.runNow();
81
+ }
82
+ catch (error) {
83
+ this.#logger.warn('billing.meter.scheduler.cycle_failed', {
84
+ errorKind: error instanceof Error ? error.name : 'unknown',
85
+ });
86
+ }
87
+ finally {
88
+ if (this.#started) {
89
+ this.#timer = setTimeout(() => {
90
+ this.#timer = undefined;
91
+ void this.#runScheduledCycle();
92
+ }, this.#intervalMs);
93
+ }
94
+ }
95
+ }
96
+ async #runCycle() {
97
+ const client = await this.#pool.connect();
98
+ let lockHeld = false;
99
+ let clientReusable = true;
100
+ let clientReleasedByDeadline = false;
101
+ try {
102
+ await configureBillingMeterSchedulerSession(client, this.#statementTimeoutMs, this.#lockTimeoutMs);
103
+ const leader = await client.query(`SELECT pg_try_advisory_lock(
104
+ hashtextextended(
105
+ $1 || ':' || 'billing_meter_scheduler_runs'::regclass::oid::text,
106
+ 0
107
+ )
108
+ ) AS acquired`, [BILLING_METER_SCHEDULER_LOCK_KEY]);
109
+ if (leader.rows[0]?.acquired !== true) {
110
+ return { status: 'skipped', reason: 'lock_not_acquired' };
111
+ }
112
+ lockHeld = true;
113
+ try {
114
+ return await withCycleDeadline(client, this.#cycleTimeoutMs, () => this.#runLeaderCycle(client), () => {
115
+ clientReleasedByDeadline = true;
116
+ });
117
+ }
118
+ catch (error) {
119
+ if (error instanceof BillingMeterConnectionUnsafeError)
120
+ clientReusable = false;
121
+ throw error;
122
+ }
123
+ }
124
+ finally {
125
+ if (lockHeld && !clientReleasedByDeadline) {
126
+ try {
127
+ const unlock = await client.query(`SELECT pg_advisory_unlock(
128
+ hashtextextended(
129
+ $1 || ':' || 'billing_meter_scheduler_runs'::regclass::oid::text,
130
+ 0
131
+ )
132
+ ) AS unlocked`, [BILLING_METER_SCHEDULER_LOCK_KEY]);
133
+ clientReusable = clientReusable && unlock.rows[0]?.unlocked === true;
134
+ }
135
+ catch {
136
+ clientReusable = false;
137
+ }
138
+ }
139
+ if (!clientReleasedByDeadline)
140
+ client.release(clientReusable ? undefined : true);
141
+ }
142
+ }
143
+ async #runLeaderCycle(client) {
144
+ const evidence = await startBillingMeterSchedulerRun(client, this.#releaseSha);
145
+ let counts = {
146
+ windowsDiscovered: 0,
147
+ windowsProcessed: 0,
148
+ windowsSucceeded: 0,
149
+ windowsFailed: 0,
150
+ backlogDetected: false,
151
+ maintenanceRunId: null,
152
+ };
153
+ try {
154
+ const discovered = await discoverBillingMeterSchedulerWindows(client, this.#maxWindowsPerCycle + 1);
155
+ const backlogDetected = discovered.length > this.#maxWindowsPerCycle;
156
+ const windows = discovered.slice(0, this.#maxWindowsPerCycle);
157
+ let windowsSucceeded = 0;
158
+ let windowsFailed = 0;
159
+ for (const window of windows) {
160
+ try {
161
+ const reconciliation = await this.#operations.reconcileWindow(client, window);
162
+ if (reconciliation.status === 'succeeded')
163
+ windowsSucceeded += 1;
164
+ else
165
+ windowsFailed += 1;
166
+ }
167
+ catch (error) {
168
+ if (error instanceof BillingMeterConnectionUnsafeError)
169
+ throw error;
170
+ windowsFailed += 1;
171
+ this.#logger.warn('billing.meter.scheduler.reconciliation_failed', {
172
+ runId: evidence.runId,
173
+ epochId: window.epochId,
174
+ errorKind: error instanceof Error ? error.name : 'unknown',
175
+ });
176
+ }
177
+ }
178
+ let maintenanceRunId = null;
179
+ let maintenanceFailed = false;
180
+ try {
181
+ maintenanceRunId = (await this.#operations.runMaintenance(client)).runId;
182
+ }
183
+ catch (error) {
184
+ if (error instanceof BillingMeterConnectionUnsafeError)
185
+ throw error;
186
+ maintenanceFailed = true;
187
+ this.#logger.warn('billing.meter.scheduler.maintenance_failed', {
188
+ runId: evidence.runId,
189
+ errorKind: error instanceof Error ? error.name : 'unknown',
190
+ });
191
+ }
192
+ counts = {
193
+ windowsDiscovered: discovered.length,
194
+ windowsProcessed: windows.length,
195
+ windowsSucceeded,
196
+ windowsFailed,
197
+ backlogDetected,
198
+ maintenanceRunId,
199
+ };
200
+ const failureCode = deriveFailureCode(windowsFailed, maintenanceFailed);
201
+ const status = failureCode !== null ? 'failed' : backlogDetected ? 'backlogged' : 'succeeded';
202
+ return await completeBillingMeterSchedulerRun(client, evidence, counts, status, failureCode);
203
+ }
204
+ catch (error) {
205
+ if (error instanceof BillingMeterConnectionUnsafeError)
206
+ throw error;
207
+ this.#logger.warn('billing.meter.scheduler.unexpected_failure', {
208
+ runId: evidence.runId,
209
+ errorKind: error instanceof Error ? error.name : 'unknown',
210
+ });
211
+ return await completeBillingMeterSchedulerRun(client, evidence, counts, 'failed', 'cycle_failed');
212
+ }
213
+ }
214
+ }
215
+ async function withCycleDeadline(client, timeoutMs, operation, onClientReleased) {
216
+ let timer;
217
+ const deadline = new Promise((_resolve, reject) => {
218
+ timer = setTimeout(() => {
219
+ onClientReleased();
220
+ try {
221
+ client.release(true);
222
+ }
223
+ finally {
224
+ reject(new BillingMeterSchedulerCycleTimeoutError());
225
+ }
226
+ }, timeoutMs);
227
+ });
228
+ try {
229
+ return await Promise.race([operation(), deadline]);
230
+ }
231
+ finally {
232
+ if (timer !== undefined)
233
+ clearTimeout(timer);
234
+ }
235
+ }
236
+ export class BillingMeterSchedulerCycleTimeoutError extends Error {
237
+ constructor() {
238
+ super('billing meter scheduler cycle exceeded its bounded duration');
239
+ this.name = 'BillingMeterSchedulerCycleTimeoutError';
240
+ }
241
+ }
242
+ function deriveFailureCode(windowsFailed, maintenanceFailed) {
243
+ if (windowsFailed > 0 && maintenanceFailed) {
244
+ return 'reconciliation_and_maintenance_failed';
245
+ }
246
+ if (windowsFailed > 0)
247
+ return 'reconciliation_failed';
248
+ if (maintenanceFailed)
249
+ return 'maintenance_failed';
250
+ return null;
251
+ }
252
+ function validateReleaseSha(value) {
253
+ if (!/^[0-9a-f]{40}$/.test(value)) {
254
+ throw new Error('billing meter scheduler release SHA must be a full 40-character commit digest');
255
+ }
256
+ return value;
257
+ }
258
+ function validatePositiveBoundedInteger(label, value) {
259
+ if (!Number.isSafeInteger(value) || value < 1 || value > 2_147_483_647) {
260
+ throw new Error(`${label} must be a positive bounded integer`);
261
+ }
262
+ return value;
263
+ }
264
+ //# sourceMappingURL=postgres-meter-scheduler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres-meter-scheduler.js","sourceRoot":"","sources":["../../src/billing/postgres-meter-scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAE,kCAAkC,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EACL,iCAAiC,EACjC,mCAAmC,GACpC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAKL,gCAAgC,EAChC,qCAAqC,EACrC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AC;QACrE,IAAI,CAAC,IAAI,GAAG,wCAAwC,CAAC;IACvD,CAAC;CACF;AAED,SAAS,iBAAiB,CACxB,aAAqB,EACrB,iBAA0B;IAE1B,IAAI,aAAa,GAAG,CAAC,IAAI,iBAAiB,EAAE,CAAC;QAC3C,OAAO,uCAAuC,CAAC;IACjD,CAAC;IACD,IAAI,aAAa,GAAG,CAAC;QAAE,OAAO,uBAAuB,CAAC;IACtD,IAAI,iBAAiB;QAAE,OAAO,oBAAoB,CAAC;IACnD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa;IACvC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,8BAA8B,CAAC,KAAa,EAAE,KAAa;IAClE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,aAAa,EAAE,CAAC;QACvE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,qCAAqC,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Pool, PoolClient } from 'pg';
2
+ /** Additive, inactive storage for validation and readiness evidence. Never activates a meter epoch. */
3
+ export declare function ensureAuthoritativeMeterSchema(pool: Pool): Promise<void>;
4
+ export declare function ensureAuthoritativeMeterPartitions(pool: Pool | PoolClient): Promise<void>;
5
+ export declare function billingMeterPartitionName(month: Date): string;
6
+ //# sourceMappingURL=postgres-meter-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres-meter-schema.d.ts","sourceRoot":"","sources":["../../src/billing/postgres-meter-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAc3C,uGAAuG;AACvG,wBAAsB,8BAA8B,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAyY9E;AAED,wBAAsB,kCAAkC,CAAC,IAAI,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAY/F;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,CAK7D"}