@noodleseed/one 0.161.2 → 0.163.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 (315) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +3 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/billing-catalog-ops.d.ts +4 -0
  5. package/dist/commands/billing-catalog-ops.d.ts.map +1 -0
  6. package/dist/commands/billing-catalog-ops.js +58 -0
  7. package/dist/commands/billing-catalog-ops.js.map +1 -0
  8. package/dist/commands/billing-ops.d.ts.map +1 -1
  9. package/dist/commands/billing-ops.js +3 -0
  10. package/dist/commands/billing-ops.js.map +1 -1
  11. package/dist/commands/catalog.d.ts.map +1 -1
  12. package/dist/commands/catalog.js +3 -0
  13. package/dist/commands/catalog.js.map +1 -1
  14. package/dist/commands/config-values.d.ts.map +1 -1
  15. package/dist/commands/config-values.js +16 -0
  16. package/dist/commands/config-values.js.map +1 -1
  17. package/dist/commands/installation-variables.d.ts +26 -0
  18. package/dist/commands/installation-variables.d.ts.map +1 -0
  19. package/dist/commands/installation-variables.js +171 -0
  20. package/dist/commands/installation-variables.js.map +1 -0
  21. package/dist/commands/solutions-activity.d.ts +5 -0
  22. package/dist/commands/solutions-activity.d.ts.map +1 -0
  23. package/dist/commands/solutions-activity.js +116 -0
  24. package/dist/commands/solutions-activity.js.map +1 -0
  25. package/dist/commands/solutions-connections.d.ts +7 -0
  26. package/dist/commands/solutions-connections.d.ts.map +1 -0
  27. package/dist/commands/solutions-connections.js +88 -0
  28. package/dist/commands/solutions-connections.js.map +1 -0
  29. package/dist/commands/solutions-installation-options.d.ts +5 -0
  30. package/dist/commands/solutions-installation-options.d.ts.map +1 -0
  31. package/dist/commands/solutions-installation-options.js +52 -0
  32. package/dist/commands/solutions-installation-options.js.map +1 -0
  33. package/dist/commands/solutions-onboarding.d.ts +5 -0
  34. package/dist/commands/solutions-onboarding.d.ts.map +1 -0
  35. package/dist/commands/solutions-onboarding.js +113 -0
  36. package/dist/commands/solutions-onboarding.js.map +1 -0
  37. package/dist/commands/solutions-ops.d.ts +7 -0
  38. package/dist/commands/solutions-ops.d.ts.map +1 -0
  39. package/dist/commands/solutions-ops.js +544 -0
  40. package/dist/commands/solutions-ops.js.map +1 -0
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +1 -1
  44. package/dist/index.js.map +1 -1
  45. package/node_modules/@noodle-borg/admission-limits/dist/counter-store.d.ts +21 -2
  46. package/node_modules/@noodle-borg/admission-limits/dist/counter-store.js +10 -1
  47. package/node_modules/@noodle-borg/admission-limits/dist/in-memory-counter-store.d.ts +5 -1
  48. package/node_modules/@noodle-borg/admission-limits/dist/in-memory-counter-store.js +31 -2
  49. package/node_modules/@noodle-borg/admission-limits/dist/portable.d.ts +3 -0
  50. package/node_modules/@noodle-borg/admission-limits/dist/portable.js +3 -0
  51. package/node_modules/@noodle-borg/admission-limits/dist/public-admission-assertion.d.ts +28 -0
  52. package/node_modules/@noodle-borg/admission-limits/dist/public-admission-assertion.js +124 -0
  53. package/node_modules/@noodle-borg/admission-limits/dist/public-record-admission.d.ts +54 -0
  54. package/node_modules/@noodle-borg/admission-limits/dist/public-record-admission.js +74 -0
  55. package/node_modules/@noodle-borg/admission-limits/dist/request-attribution.d.ts +11 -0
  56. package/node_modules/@noodle-borg/admission-limits/dist/request-attribution.js +19 -0
  57. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js +4 -0
  58. package/node_modules/@noodle-borg/agent-kit/dist/curated/error-fixes.js +4 -1
  59. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +5 -5
  60. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +6 -0
  61. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js +21 -2
  62. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js +1 -1
  63. package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
  64. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-configuration.d.ts +9 -1
  65. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-configuration.js +33 -2
  66. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-execution-bound.d.ts +3 -0
  67. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-execution-bound.js +29 -0
  68. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-interaction-state.d.ts +5 -3
  69. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-interaction-state.js +21 -10
  70. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-store.d.ts +1 -1
  71. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-store.js +3 -3
  72. package/node_modules/@noodle-borg/assistant-gateway/dist/portable.d.ts +1 -0
  73. package/node_modules/@noodle-borg/assistant-gateway/dist/portable.js +1 -0
  74. package/node_modules/@noodle-borg/assistant-gateway/dist/session-target.js +5 -4
  75. package/node_modules/@noodle-borg/authoring/dist/config.d.ts +20 -0
  76. package/node_modules/@noodle-borg/authoring/dist/config.js +29 -2
  77. package/node_modules/@noodle-borg/authoring/dist/connectors.d.ts +6 -1
  78. package/node_modules/@noodle-borg/authoring/dist/connectors.js +5 -0
  79. package/node_modules/@noodle-borg/authoring/dist/index.d.ts +2 -1
  80. package/node_modules/@noodle-borg/authoring/dist/index.js +1 -0
  81. package/node_modules/@noodle-borg/authoring/dist/json-schema.d.ts +1 -1
  82. package/node_modules/@noodle-borg/authoring/dist/json-schema.js +15 -2
  83. package/node_modules/@noodle-borg/authoring/dist/load-authored.js +1 -1
  84. package/node_modules/@noodle-borg/authoring/dist/managed-collection.d.ts +40 -0
  85. package/node_modules/@noodle-borg/authoring/dist/managed-collection.js +39 -0
  86. package/node_modules/@noodle-borg/authoring/dist/platform.d.ts +3 -0
  87. package/node_modules/@noodle-borg/authoring/dist/platform.js +4 -0
  88. package/node_modules/@noodle-borg/authoring/dist/server-presentation.js +43 -0
  89. package/node_modules/@noodle-borg/authoring/dist/server.d.ts +6 -1
  90. package/node_modules/@noodle-borg/authoring/dist/server.js +5 -43
  91. package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-billing.js +18 -0
  92. package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-config.js +31 -4
  93. package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-solutions.js +778 -0
  94. package/node_modules/@noodle-borg/cli-catalog/dist/catalog-types.js +7 -0
  95. package/node_modules/@noodle-borg/cli-catalog/dist/index.js +20 -0
  96. package/node_modules/@noodle-borg/compiler/dist/artifact/assemble.js +5 -1
  97. package/node_modules/@noodle-borg/compiler/dist/artifact/catalog-emission.js +3 -1
  98. package/node_modules/@noodle-borg/compiler/dist/artifact/config.js +3 -0
  99. package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts +26 -0
  100. package/node_modules/@noodle-borg/compiler/dist/artifact/version.d.ts +9 -1
  101. package/node_modules/@noodle-borg/compiler/dist/artifact/version.js +9 -1
  102. package/node_modules/@noodle-borg/compiler/dist/business-variables.d.ts +27 -0
  103. package/node_modules/@noodle-borg/compiler/dist/business-variables.js +230 -0
  104. package/node_modules/@noodle-borg/compiler/dist/compile.js +9 -0
  105. package/node_modules/@noodle-borg/compiler/dist/errors.d.ts +1 -1
  106. package/node_modules/@noodle-borg/compiler/dist/index.d.ts +5 -1
  107. package/node_modules/@noodle-borg/compiler/dist/index.js +4 -0
  108. package/node_modules/@noodle-borg/compiler/dist/managed-collection-controls.d.ts +52 -0
  109. package/node_modules/@noodle-borg/compiler/dist/managed-collection-controls.js +92 -0
  110. package/node_modules/@noodle-borg/compiler/dist/managed-collections.d.ts +50 -0
  111. package/node_modules/@noodle-borg/compiler/dist/managed-collections.js +373 -0
  112. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +114 -36
  113. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +5 -0
  114. package/node_modules/@noodle-borg/compiler/dist/native-record-operations.d.ts +7 -0
  115. package/node_modules/@noodle-borg/compiler/dist/native-record-operations.js +59 -0
  116. package/node_modules/@noodle-borg/connector-defs/dist/compile-http.js +83 -8
  117. package/node_modules/@noodle-borg/connector-defs/dist/schema.d.ts +31 -1
  118. package/node_modules/@noodle-borg/connector-defs/dist/schema.js +16 -0
  119. package/node_modules/@noodle-borg/connector-http/dist/http-connector.d.ts +12 -3
  120. package/node_modules/@noodle-borg/connector-http/dist/http-connector.js +41 -2
  121. package/node_modules/@noodle-borg/connector-http/dist/http-response.js +3 -2
  122. package/node_modules/@noodle-borg/connector-http/dist/mcp/config.js +1 -1
  123. package/node_modules/@noodle-borg/connector-http/dist/url-resolution.js +1 -1
  124. package/node_modules/@noodle-borg/control-plane/dist/contracts.d.ts +2 -1
  125. package/node_modules/@noodle-borg/control-plane/dist/in-memory-organization-store.d.ts +3 -0
  126. package/node_modules/@noodle-borg/control-plane/dist/in-memory-organization-store.js +11 -0
  127. package/node_modules/@noodle-borg/control-plane/dist/organization-agreements.d.ts +45 -0
  128. package/node_modules/@noodle-borg/control-plane/dist/organization-agreements.js +74 -0
  129. package/node_modules/@noodle-borg/control-plane/dist/portable.d.ts +1 -0
  130. package/node_modules/@noodle-borg/control-plane/dist/portable.js +1 -0
  131. package/node_modules/@noodle-borg/module/dist/contract.d.ts +20 -0
  132. package/node_modules/@noodle-borg/module/dist/platform-human-identity.d.ts +2 -0
  133. package/node_modules/@noodle-borg/protocol/dist/request-deps.js +1 -0
  134. package/node_modules/@noodle-borg/protocol/dist/request-state.d.ts +1 -0
  135. package/node_modules/@noodle-borg/protocol/dist/request-state.js +11 -2
  136. package/node_modules/@noodle-borg/protocol/dist/sdk-server.d.ts +2 -0
  137. package/node_modules/@noodle-borg/protocol/dist/v2/input-required.js +2 -1
  138. package/node_modules/@noodle-borg/protocol/dist/v2/server.js +2 -1
  139. package/node_modules/@noodle-borg/runtime/dist/ambient-context.js +6 -1
  140. package/node_modules/@noodle-borg/runtime/dist/broker/types.d.ts +2 -0
  141. package/node_modules/@noodle-borg/runtime/dist/business-variables.d.ts +15 -0
  142. package/node_modules/@noodle-borg/runtime/dist/business-variables.js +75 -0
  143. package/node_modules/@noodle-borg/runtime/dist/confirmation-continuation.js +2 -1
  144. package/node_modules/@noodle-borg/runtime/dist/confirmation.js +23 -3
  145. package/node_modules/@noodle-borg/runtime/dist/connector/types.d.ts +17 -1
  146. package/node_modules/@noodle-borg/runtime/dist/connector-snapshot.js +6 -0
  147. package/node_modules/@noodle-borg/runtime/dist/execute.d.ts +18 -3
  148. package/node_modules/@noodle-borg/runtime/dist/execute.js +13 -3
  149. package/node_modules/@noodle-borg/runtime/dist/index.d.ts +2 -0
  150. package/node_modules/@noodle-borg/runtime/dist/index.js +1 -0
  151. package/node_modules/@noodle-borg/runtime/dist/interactive.js +11 -0
  152. package/node_modules/@noodle-borg/runtime/dist/managed-origins.d.ts +3 -1
  153. package/node_modules/@noodle-borg/runtime/dist/managed-origins.js +32 -7
  154. package/node_modules/@noodle-borg/runtime/dist/operation-credential.js +6 -0
  155. package/node_modules/@noodle-borg/runtime/dist/operation-evidence.d.ts +30 -0
  156. package/node_modules/@noodle-borg/runtime/dist/operation-evidence.js +68 -0
  157. package/node_modules/@noodle-borg/runtime/dist/operation-execution.d.ts +2 -2
  158. package/node_modules/@noodle-borg/runtime/dist/operation-execution.js +142 -71
  159. package/node_modules/@noodle-borg/runtime/dist/result.d.ts +6 -4
  160. package/node_modules/@noodle-borg/runtime/dist/tool-dispatch.d.ts +7 -0
  161. package/node_modules/@noodle-borg/runtime/dist/tool-dispatch.js +48 -4
  162. package/node_modules/@noodle-borg/service/dist/admission.js +2 -1
  163. package/node_modules/@noodle-borg/service/dist/application-activity.js +236 -0
  164. package/node_modules/@noodle-borg/service/dist/application-business-notice.js +28 -0
  165. package/node_modules/@noodle-borg/service/dist/application-runtime-target.js +141 -0
  166. package/node_modules/@noodle-borg/service/dist/application-settings-targets.js +72 -0
  167. package/node_modules/@noodle-borg/service/dist/application-settings.js +210 -0
  168. package/node_modules/@noodle-borg/service/dist/business-api-admission.js +121 -0
  169. package/node_modules/@noodle-borg/service/dist/business-information/activity-pagination.js +73 -0
  170. package/node_modules/@noodle-borg/service/dist/business-information/business-notice.d.ts +24 -0
  171. package/node_modules/@noodle-borg/service/dist/business-information/business-notice.js +18 -0
  172. package/node_modules/@noodle-borg/service/dist/business-information/collection-controls.js +51 -0
  173. package/node_modules/@noodle-borg/service/dist/business-information/contracts.d.ts +439 -0
  174. package/node_modules/@noodle-borg/service/dist/business-information/contracts.js +5 -0
  175. package/node_modules/@noodle-borg/service/dist/business-information/definition-resolver.js +94 -0
  176. package/node_modules/@noodle-borg/service/dist/business-information/in-memory-installation-lifecycle.js +136 -0
  177. package/node_modules/@noodle-borg/service/dist/business-information/in-memory-invitations.js +160 -0
  178. package/node_modules/@noodle-borg/service/dist/business-information/in-memory-locks.js +23 -0
  179. package/node_modules/@noodle-borg/service/dist/business-information/in-memory-store.js +557 -0
  180. package/node_modules/@noodle-borg/service/dist/business-information/installation-capacity.js +10 -0
  181. package/node_modules/@noodle-borg/service/dist/business-information/invitations.js +68 -0
  182. package/node_modules/@noodle-borg/service/dist/business-information/legacy-request-migration.js +60 -0
  183. package/node_modules/@noodle-borg/service/dist/business-information/managed-releases.js +245 -0
  184. package/node_modules/@noodle-borg/service/dist/business-information/managed-solution-blueprints.js +51 -0
  185. package/node_modules/@noodle-borg/service/dist/business-information/managed-solution-executable.js +76 -0
  186. package/node_modules/@noodle-borg/service/dist/business-information/model.js +393 -0
  187. package/node_modules/@noodle-borg/service/dist/business-information/native-query.js +162 -0
  188. package/node_modules/@noodle-borg/service/dist/business-information/native-storage-budget.js +60 -0
  189. package/node_modules/@noodle-borg/service/dist/business-information/pagination.js +78 -0
  190. package/node_modules/@noodle-borg/service/dist/business-information/portable.js +15 -0
  191. package/node_modules/@noodle-borg/service/dist/business-information/principal-authority.d.ts +11 -0
  192. package/node_modules/@noodle-borg/service/dist/business-information/principal-authority.js +42 -0
  193. package/node_modules/@noodle-borg/service/dist/business-information/profiles.js +252 -0
  194. package/node_modules/@noodle-borg/service/dist/business-information/reader-floor.js +26 -0
  195. package/node_modules/@noodle-borg/service/dist/business-information/source-credential-fence.js +79 -0
  196. package/node_modules/@noodle-borg/service/dist/business-information/source-custody-budget.js +30 -0
  197. package/node_modules/@noodle-borg/service/dist/business-information/source-custody-memory.js +122 -0
  198. package/node_modules/@noodle-borg/service/dist/business-information/source-executor.js +191 -0
  199. package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-contracts.js +2 -0
  200. package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-coordinator.js +136 -0
  201. package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-failures.js +32 -0
  202. package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-memory-state.js +154 -0
  203. package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-memory-store.js +568 -0
  204. package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-memory-types.js +26 -0
  205. package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-memory-values.js +59 -0
  206. package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-pagination.js +54 -0
  207. package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-validation.js +163 -0
  208. package/node_modules/@noodle-borg/service/dist/business-information/source-refresh-retention.js +29 -0
  209. package/node_modules/@noodle-borg/service/dist/business-information/validation.js +200 -0
  210. package/node_modules/@noodle-borg/service/dist/business-information-runtime.js +80 -0
  211. package/node_modules/@noodle-borg/service/dist/business-onboarding.js +73 -0
  212. package/node_modules/@noodle-borg/service/dist/connections/types.js +8 -0
  213. package/node_modules/@noodle-borg/service/dist/credential-binding-index.js +38 -33
  214. package/node_modules/@noodle-borg/service/dist/deployment-execution.js +275 -0
  215. package/node_modules/@noodle-borg/service/dist/external-credential-binding-broker.js +19 -1
  216. package/node_modules/@noodle-borg/service/dist/external-credential-exchange.d.ts +16 -1
  217. package/node_modules/@noodle-borg/service/dist/modules/host.js +4 -1
  218. package/node_modules/@noodle-borg/service/dist/native-record-connector.d.ts +20 -0
  219. package/node_modules/@noodle-borg/service/dist/native-record-connector.js +206 -0
  220. package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts +5 -2
  221. package/node_modules/@noodle-borg/service/dist/operation-evidence.js +89 -0
  222. package/node_modules/@noodle-borg/service/dist/recovery-quarantine.js +49 -0
  223. package/node_modules/@noodle-borg/service/dist/registry-compile.js +60 -11
  224. package/node_modules/@noodle-borg/service/dist/registry-deploy-transaction.js +18 -0
  225. package/node_modules/@noodle-borg/service/dist/registry-rollback.js +2 -1
  226. package/node_modules/@noodle-borg/service/dist/registry-state.d.ts +1 -1
  227. package/node_modules/@noodle-borg/service/dist/registry-state.js +6 -3
  228. package/node_modules/@noodle-borg/service/dist/registry-targets.js +49 -0
  229. package/node_modules/@noodle-borg/service/dist/registry-types.d.ts +2 -0
  230. package/node_modules/@noodle-borg/service/dist/registry.d.ts +15 -3
  231. package/node_modules/@noodle-borg/service/dist/registry.js +177 -137
  232. package/node_modules/@noodle-borg/service/dist/routes/assistant-appearance.js +3 -2
  233. package/node_modules/@noodle-borg/service/dist/routes/assistant-clients.js +2 -1
  234. package/node_modules/@noodle-borg/service/dist/routes/assistant-doctor.js +2 -1
  235. package/node_modules/@noodle-borg/service/dist/routes/assistant-embeds.js +8 -3
  236. package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-replay.js +1 -1
  237. package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js +48 -36
  238. package/node_modules/@noodle-borg/service/dist/routes/assistant-public-configuration.js +3 -2
  239. package/node_modules/@noodle-borg/service/dist/routes/assistant-public-session.js +10 -10
  240. package/node_modules/@noodle-borg/service/dist/routes/assistant-session-target.js +32 -3
  241. package/node_modules/@noodle-borg/service/dist/routes/assistant-suggestions.js +1 -1
  242. package/node_modules/@noodle-borg/service/dist/routes/assistant-transcript.js +1 -1
  243. package/node_modules/@noodle-borg/service/dist/routes/assistant.js +10 -10
  244. package/node_modules/@noodle-borg/service/dist/routes/business-information-activity.js +83 -0
  245. package/node_modules/@noodle-borg/service/dist/routes/business-information-admission.js +26 -0
  246. package/node_modules/@noodle-borg/service/dist/routes/business-information-channels.js +153 -0
  247. package/node_modules/@noodle-borg/service/dist/routes/business-information-connections.js +107 -0
  248. package/node_modules/@noodle-borg/service/dist/routes/business-information-dispatch.js +131 -0
  249. package/node_modules/@noodle-borg/service/dist/routes/business-information-external.js +79 -0
  250. package/node_modules/@noodle-borg/service/dist/routes/business-information-installation.js +24 -0
  251. package/node_modules/@noodle-borg/service/dist/routes/business-information-notice.js +69 -0
  252. package/node_modules/@noodle-borg/service/dist/routes/business-information-onboarding.js +58 -0
  253. package/node_modules/@noodle-borg/service/dist/routes/business-information-paths.js +168 -0
  254. package/node_modules/@noodle-borg/service/dist/routes/business-information-public.js +151 -0
  255. package/node_modules/@noodle-borg/service/dist/routes/business-information-reader-floor.js +15 -0
  256. package/node_modules/@noodle-borg/service/dist/routes/business-information-record-create.js +29 -0
  257. package/node_modules/@noodle-borg/service/dist/routes/business-information-record-reads.js +36 -0
  258. package/node_modules/@noodle-borg/service/dist/routes/business-information-request.js +64 -0
  259. package/node_modules/@noodle-borg/service/dist/routes/business-information-settings.js +64 -0
  260. package/node_modules/@noodle-borg/service/dist/routes/business-information-source.js +249 -0
  261. package/node_modules/@noodle-borg/service/dist/routes/business-information-staff.js +258 -0
  262. package/node_modules/@noodle-borg/service/dist/routes/business-information-wire.js +317 -0
  263. package/node_modules/@noodle-borg/service/dist/routes/business-information.js +592 -0
  264. package/node_modules/@noodle-borg/service/dist/routes/config-values-dispatch.js +1 -1
  265. package/node_modules/@noodle-borg/service/dist/routes/config-values.js +26 -4
  266. package/node_modules/@noodle-borg/service/dist/routes/control-plane.js +19 -233
  267. package/node_modules/@noodle-borg/service/dist/routes/deployment-activation-response.js +13 -4
  268. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js +6 -0
  269. package/node_modules/@noodle-borg/service/dist/service.js +77 -6
  270. package/node_modules/@noodle-borg/service/dist/solution-installation-activation.js +149 -0
  271. package/node_modules/@noodle-borg/service/dist/source-configuration-authority.js +94 -0
  272. package/node_modules/@noodle-borg/service/dist/state-catalog.js +6 -5
  273. package/node_modules/@noodle-borg/service/dist/store/config-values.d.ts +42 -17
  274. package/node_modules/@noodle-borg/service/dist/store/config-values.js +123 -24
  275. package/node_modules/@noodle-borg/service/dist/store/in-memory.d.ts +1 -0
  276. package/node_modules/@noodle-borg/service/dist/store/in-memory.js +3 -0
  277. package/node_modules/@noodle-borg/service/dist/store/json-file.d.ts +1 -0
  278. package/node_modules/@noodle-borg/service/dist/store/json-file.js +3 -0
  279. package/node_modules/@noodle-borg/service/dist/store.d.ts +3 -1
  280. package/node_modules/@noodle-borg/service/package.json +2 -2
  281. package/node_modules/@noodle-borg/transport-http/dist/serve-request.js +9 -0
  282. package/node_modules/@noodle-borg/transport-http/package.json +1 -0
  283. package/node_modules/@noodle-borg/wire-contracts/dist/application-activity.d.ts +143 -0
  284. package/node_modules/@noodle-borg/wire-contracts/dist/application-activity.js +90 -0
  285. package/node_modules/@noodle-borg/wire-contracts/dist/application-channels.d.ts +130 -0
  286. package/node_modules/@noodle-borg/wire-contracts/dist/application-channels.js +77 -0
  287. package/node_modules/@noodle-borg/wire-contracts/dist/application-connections.d.ts +105 -0
  288. package/node_modules/@noodle-borg/wire-contracts/dist/application-connections.js +67 -0
  289. package/node_modules/@noodle-borg/wire-contracts/dist/application-onboarding.d.ts +27 -0
  290. package/node_modules/@noodle-borg/wire-contracts/dist/application-onboarding.js +28 -0
  291. package/node_modules/@noodle-borg/wire-contracts/dist/application-settings.d.ts +112 -0
  292. package/node_modules/@noodle-borg/wire-contracts/dist/application-settings.js +88 -0
  293. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts +1 -1
  294. package/node_modules/@noodle-borg/wire-contracts/dist/billing-catalog.d.ts +62 -0
  295. package/node_modules/@noodle-borg/wire-contracts/dist/billing-catalog.js +57 -0
  296. package/node_modules/@noodle-borg/wire-contracts/dist/billing-enforcement.d.ts +12 -12
  297. package/node_modules/@noodle-borg/wire-contracts/dist/billing-metering.d.ts +4 -4
  298. package/node_modules/@noodle-borg/wire-contracts/dist/billing-org-transfer.d.ts +3 -3
  299. package/node_modules/@noodle-borg/wire-contracts/dist/business-information-query.d.ts +25 -0
  300. package/node_modules/@noodle-borg/wire-contracts/dist/business-information-query.js +37 -0
  301. package/node_modules/@noodle-borg/wire-contracts/dist/business-information.d.ts +2241 -0
  302. package/node_modules/@noodle-borg/wire-contracts/dist/business-information.js +580 -0
  303. package/node_modules/@noodle-borg/wire-contracts/dist/control-plane.d.ts +2 -2
  304. package/node_modules/@noodle-borg/wire-contracts/dist/distribution.d.ts +5 -5
  305. package/node_modules/@noodle-borg/wire-contracts/dist/index.d.ts +12 -3
  306. package/node_modules/@noodle-borg/wire-contracts/dist/index.js +9 -0
  307. package/node_modules/@noodle-borg/wire-contracts/dist/knowledge.d.ts +6 -6
  308. package/node_modules/@noodle-borg/wire-contracts/dist/managed-assistant-sponsorship.d.ts +15 -15
  309. package/node_modules/@noodle-borg/wire-contracts/dist/platform-account-reset.d.ts +5 -0
  310. package/node_modules/@noodle-borg/wire-contracts/dist/platform-account-reset.js +1 -0
  311. package/node_modules/@noodle-borg/wire-contracts/dist/platform-auth.d.ts +66 -66
  312. package/node_modules/@noodle-borg/wire-contracts/dist/solution-onboarding.d.ts +143 -0
  313. package/node_modules/@noodle-borg/wire-contracts/dist/solution-onboarding.js +94 -0
  314. package/node_modules/@noodleseed/assistant/README.md +5 -0
  315. package/package.json +2 -2
@@ -0,0 +1,206 @@
1
+ import { admitPublicRecord } from '@noodle-borg/admission-limits/portable';
2
+ import { RECORD_CONNECTOR_ID, RECORD_CONNECTOR_VERSION, RECORD_OPERATION_SIGNATURES, validateJsonSchema, } from '@noodle-borg/compiler';
3
+ import { ConnectorInvocationError } from '@noodle-borg/runtime';
4
+ import { creationPayload } from './business-information/collection-controls.js';
5
+ import { businessGrantAllows, idempotencyDigest, requestFingerprint, } from './business-information/model.js';
6
+ import { NativeStorageLimitError } from './business-information/native-storage-budget.js';
7
+ import { CursorValidationError, PayloadValidationError, } from './business-information/validation.js';
8
+ import { recordToWire } from './routes/business-information-wire.js';
9
+ /** Platform composition supplies storage; an authored declaration alone grants no installed authority. */
10
+ export function createDeploymentNativeRecordConnector(input, dependencies) {
11
+ if (!input.artifact.server.managedCollections?.some((collection) => collection.source.authority === 'native'))
12
+ return undefined;
13
+ return new NativeRecordConnector(input, dependencies);
14
+ }
15
+ class NativeRecordConnector {
16
+ input;
17
+ dependencies;
18
+ id = RECORD_CONNECTOR_ID;
19
+ version = RECORD_CONNECTOR_VERSION;
20
+ constructor(input, dependencies) {
21
+ this.input = input;
22
+ this.dependencies = dependencies;
23
+ }
24
+ signature(operation) {
25
+ return RECORD_OPERATION_SIGNATURES[operation];
26
+ }
27
+ executionBoundMs(operation) {
28
+ return this.signature(operation)?.type === 'action' ? 10_000 : undefined;
29
+ }
30
+ async invoke(call) {
31
+ const signature = this.signature(call.operation);
32
+ if (signature === undefined || validateJsonSchema(signature.input, call.args).length > 0)
33
+ return fail(call, 400, 'Invalid native record operation arguments.');
34
+ if (signature.type === 'action' && !/^[a-f0-9]{64}$/.test(call.execution?.id ?? ''))
35
+ return fail(call, 503, 'A trusted execution identity is required before a native record write.');
36
+ const installations = (await this.dependencies.store.listInstallations(this.input.tenant.org)).filter((installation) => installation.scope.app === this.input.tenant.app &&
37
+ installation.scope.env === this.input.tenant.env);
38
+ if (installations.length !== 1)
39
+ return fail(call, 503, 'Native record installation is unavailable.');
40
+ const installation = installations[0];
41
+ if (installation === undefined)
42
+ return fail(call, 503, 'Native record installation is unavailable.');
43
+ const collection = installation.definition.collections.find((entry) => entry.key === call.args.collection);
44
+ const authored = this.input.artifact.server.managedCollections?.find((entry) => entry.name === call.args.collection);
45
+ if (collection === undefined ||
46
+ authored === undefined ||
47
+ !installation.managedCollections.includes(collection.key))
48
+ return fail(call, 404, 'Native collection is not enabled for this application.');
49
+ if (collection.authority.authority !== 'native' || authored.source.authority !== 'native')
50
+ return fail(call, 405, 'External reference collections do not accept native record operations.');
51
+ if (collection.schemaDigest.replace(/^sha256:/, '') !==
52
+ authored.schemaDigest.replace(/^sha256:/, ''))
53
+ return fail(call, 409, 'Collection definition changed; activate the current application before continuing.');
54
+ const publicInput = call.operation === 'submit_record';
55
+ if (!publicInput)
56
+ await this.authorize(call, installation);
57
+ try {
58
+ return await this.execute(call, installation, collection, publicInput);
59
+ }
60
+ catch (error) {
61
+ if (error instanceof CursorValidationError)
62
+ return fail(call, 400, 'Invalid or stale record cursor; restart the query.');
63
+ if (error instanceof NativeStorageLimitError)
64
+ return fail(call, 409, error.message);
65
+ if (error instanceof PayloadValidationError)
66
+ return fail(call, 400, 'Record fields do not match the declared collection permissions and schema.');
67
+ throw error;
68
+ }
69
+ }
70
+ async authorize(call, installation) {
71
+ if (call.caller?.identityKind !== 'platform')
72
+ return fail(call, 403, 'A live business grant is required for staff record operations.');
73
+ const permission = call.operation === 'create_record'
74
+ ? 'records:create'
75
+ : call.operation === 'update_record'
76
+ ? 'records:update'
77
+ : call.operation === 'delete_record'
78
+ ? 'records:delete'
79
+ : 'records:read';
80
+ const grant = await this.dependencies.store.getGrant(installation.scope, call.caller.subject);
81
+ if (!businessGrantAllows(grant, permission))
82
+ return fail(call, 403, 'A live business grant is required for this record operation.');
83
+ }
84
+ async execute(call, installation, collection, publicInput) {
85
+ const store = this.dependencies.store;
86
+ const scope = installation.scope;
87
+ const actorSubject = call.caller?.subject ?? 'anonymous';
88
+ if (call.operation === 'submit_record' || call.operation === 'create_record') {
89
+ // Validate before receipt probing/admission, and preserve the admitted payload as the replay fingerprint.
90
+ creationPayload(collection, call.args.payload, publicInput);
91
+ const payload = call.args.payload;
92
+ const key = call.execution?.id;
93
+ if (key === undefined)
94
+ return fail(call, 503, 'A trusted execution identity is required.');
95
+ const request = {
96
+ scope,
97
+ collectionKey: collection.key,
98
+ idempotencyKey: key,
99
+ payload,
100
+ ...(publicInput ? { publicInput: true } : {}),
101
+ origin: { kind: 'mcp', reference: 'native-tool' },
102
+ actorSubject,
103
+ };
104
+ const completed = await store.probeRequest(request);
105
+ if (completed.disposition === 'conflict')
106
+ return fail(call, 409, 'This execution identity was already used with different record content.');
107
+ if (completed.disposition === 'replayed') {
108
+ call.reportOutcome?.({ outcome: 'completed', reference: completed.record.id });
109
+ return publicInput
110
+ ? receipt(completed.record)
111
+ : { ok: true, record: recordToWire(completed.record) };
112
+ }
113
+ if (publicInput) {
114
+ if (!installation.intakeActive || this.dependencies.publicIntakeEnabled === false)
115
+ return fail(call, 503, 'Public record intake is paused.');
116
+ if (call.publicAdmission === undefined || !call.publicAdmission.network)
117
+ return fail(call, 503, 'Trusted network admission context is required for public record writes.');
118
+ const quota = await admitPublicRecord({
119
+ counters: this.dependencies.counters,
120
+ surfaceId: installation.publicId,
121
+ attempt: {
122
+ key: `solution-intake:logical:${installation.publicId}:${idempotencyDigest(key)}`,
123
+ fingerprint: requestFingerprint(request),
124
+ },
125
+ buckets: call.publicAdmission,
126
+ now: this.dependencies.now?.() ?? new Date(),
127
+ });
128
+ if (!quota.allowed)
129
+ return fail(call, quota.reason === 'quota_exceeded'
130
+ ? 429
131
+ : quota.reason === 'idempotency_conflict'
132
+ ? 409
133
+ : 503, quota.reason === 'quota_exceeded'
134
+ ? 'Public record admission limit exceeded.'
135
+ : 'Public record admission is unavailable.');
136
+ }
137
+ else
138
+ await this.authorize(call, installation);
139
+ if (call.signal?.aborted)
140
+ return fail(call, 503, 'Native record write was cancelled before dispatch.');
141
+ const created = await store.createRequest(request);
142
+ if (created.disposition === 'conflict')
143
+ return fail(call, 409, 'Record creation conflicts with the original execution.');
144
+ if (created.disposition === 'paused')
145
+ return fail(call, 503, 'Public record intake is paused.');
146
+ call.reportOutcome?.({ outcome: 'completed', reference: created.record.id });
147
+ return publicInput
148
+ ? receipt(created.record)
149
+ : { ok: true, record: recordToWire(created.record) };
150
+ }
151
+ if (call.operation === 'list_records') {
152
+ const result = await store.listRequests({
153
+ scope,
154
+ collectionKey: collection.key,
155
+ ...(call.args.cursor === undefined ? {} : { cursor: String(call.args.cursor) }),
156
+ ...(call.args.limit === undefined ? {} : { limit: Number(call.args.limit) }),
157
+ });
158
+ return {
159
+ ok: true,
160
+ records: result.records.map(recordToWire),
161
+ ...(result.nextCursor === undefined ? {} : { nextCursor: result.nextCursor }),
162
+ };
163
+ }
164
+ const id = String(call.args.id);
165
+ if (call.operation === 'get_record') {
166
+ const record = await store.getRequest(scope, collection.key, id);
167
+ if (record === undefined)
168
+ return fail(call, 404, 'Native record was not found.');
169
+ return { ok: true, record: recordToWire(record) };
170
+ }
171
+ await this.authorize(call, installation);
172
+ const mutation = {
173
+ scope,
174
+ collectionKey: collection.key,
175
+ id,
176
+ expectedRevision: Number(call.args.expectedRevision),
177
+ actorSubject,
178
+ };
179
+ if (call.signal?.aborted)
180
+ return fail(call, 503, 'Native record write was cancelled before dispatch.');
181
+ const result = call.operation === 'delete_record'
182
+ ? await store.deleteRequest({ ...mutation, reason: 'customer_request' })
183
+ : await store.mutateRequest({
184
+ ...mutation,
185
+ operation: {
186
+ kind: 'update',
187
+ payload: call.args.patch,
188
+ ...(call.args.unset === undefined ? {} : { unset: call.args.unset }),
189
+ },
190
+ });
191
+ if (!result.ok)
192
+ return fail(call, result.reason === 'not_found' ? 404 : result.reason === 'conflict' ? 409 : 422, 'Native record operation was not applied; inspect the current record and revision.');
193
+ call.reportOutcome?.({ outcome: 'completed', reference: result.record.id });
194
+ return call.operation === 'delete_record'
195
+ ? receipt(result.record)
196
+ : { ok: true, record: recordToWire(result.record) };
197
+ }
198
+ }
199
+ function receipt(record) {
200
+ return { ok: true, recordId: record.id, revision: record.revision };
201
+ }
202
+ function fail(call, status, message) {
203
+ call.reportOutcome?.({ outcome: 'rejected' });
204
+ throw new ConnectorInvocationError(message, { status, retryable: false });
205
+ }
206
+ //# sourceMappingURL=native-record-connector.js.map
@@ -169,9 +169,11 @@ export interface DelegatedCredentialLookup {
169
169
  export interface OAuthStore extends DeviceAuthorizationStore {
170
170
  /** Dynamic client registration (RFC 7591): persist + read the SDK-generated client info. */
171
171
  getClient(clientId: string): Promise<OAuthClientInformationFull | undefined>;
172
+ /** Durable server-owned purpose; absent registration is distinct from a known dynamic client. */
173
+ getClientPurpose(clientId: string): Promise<'console' | 'portal' | 'dynamic' | undefined>;
172
174
  putClient(client: OAuthClientInformationFull): Promise<OAuthClientInformationFull>;
173
175
  /** Atomically reserves or reconciles a server-owned client without taking over a DCR registration. */
174
- putFirstPartyClient(owner: 'console', client: OAuthClientInformationFull): Promise<OAuthClientInformationFull>;
176
+ putFirstPartyClient(owner: 'console' | 'portal', client: OAuthClientInformationFull): Promise<OAuthClientInformationFull>;
175
177
  /** Pending authorization (single-use). A provider mismatch leaves the record live for its real callback. */
176
178
  createPendingAuthorization(record: PendingAuthorizationRecord): Promise<void>;
177
179
  consumePendingAuthorization(state: string, expectedUpstreamProvider: PendingAuthorizationCallbackKind): Promise<PendingAuthorizationRecord | undefined>;
@@ -219,8 +221,9 @@ export interface OAuthStore extends DeviceAuthorizationStore {
219
221
  export declare class InMemoryOAuthStore implements OAuthStore {
220
222
  #private;
221
223
  getClient(clientId: string): Promise<OAuthClientInformationFull | undefined>;
224
+ getClientPurpose(clientId: string): Promise<'console' | 'portal' | 'dynamic' | undefined>;
222
225
  putClient(client: OAuthClientInformationFull): Promise<OAuthClientInformationFull>;
223
- putFirstPartyClient(owner: 'console', client: OAuthClientInformationFull): Promise<OAuthClientInformationFull>;
226
+ putFirstPartyClient(owner: 'console' | 'portal', client: OAuthClientInformationFull): Promise<OAuthClientInformationFull>;
224
227
  createPendingAuthorization(record: PendingAuthorizationRecord): Promise<void>;
225
228
  consumePendingAuthorization(state: string, expectedUpstreamProvider: PendingAuthorizationRecord['upstreamProvider']): Promise<PendingAuthorizationRecord | undefined>;
226
229
  createAuthorizationCode(record: AuthorizationCodeRecord): Promise<void>;
@@ -0,0 +1,89 @@
1
+ import { createHmac, randomUUID } from 'node:crypto';
2
+ import { canonicalJson } from '@noodle-borg/compiler';
3
+ /** Generic execution evidence adapter. It stores no application input and cannot dispatch or replay work. */
4
+ export function createOperationEvidencePort(options) {
5
+ if (options.identityKey.length < 32 || !/^[A-Za-z0-9_-]{16,128}$/.test(options.epoch))
6
+ throw new Error('Invalid operation evidence configuration');
7
+ const hash = (value) => createHmac('sha256', options.identityKey).update(canonicalJson(value)).digest('hex');
8
+ const now = () => options.now?.() ?? Date.now();
9
+ return {
10
+ async begin(intent) {
11
+ const startedAt = now();
12
+ const bound = options.executionBoundMs(intent);
13
+ const days = await options.historyDays();
14
+ if (!Number.isSafeInteger(bound) ||
15
+ bound === undefined ||
16
+ bound < 1 ||
17
+ !Number.isInteger(days) ||
18
+ days < 1 ||
19
+ days > 365 ||
20
+ bound >= days * 86_400_000 ||
21
+ !(await options.authorize(intent)))
22
+ throw new Error('Operation evidence authority unavailable');
23
+ const connectionId = intent.operation.credentialBinding?.connectionId;
24
+ const generation = connectionId === undefined ? undefined : options.connectionGeneration(connectionId);
25
+ if (connectionId !== undefined && generation === undefined)
26
+ throw new Error('Original connected account unavailable');
27
+ const record = {
28
+ scope: options.scope,
29
+ id: intent.id,
30
+ lease: randomUUID(),
31
+ epoch: options.epoch,
32
+ deploymentId: options.deploymentId,
33
+ tool: intent.tool,
34
+ connector: intent.operation.connectorId,
35
+ operation: intent.operation.operation,
36
+ ...(connectionId === undefined ? {} : { connectionId }),
37
+ ...(generation === undefined ? {} : { generation }),
38
+ actorDigest: hash(intent.caller ?? null),
39
+ intentDigest: hash({
40
+ scope: options.scope,
41
+ deploymentId: options.deploymentId,
42
+ epoch: options.epoch,
43
+ operation: intent.operation,
44
+ input: intent.arguments,
45
+ caller: intent.caller ?? null,
46
+ revision: intent.executionRevision ?? null,
47
+ generation: generation ?? null,
48
+ }),
49
+ startedAt,
50
+ executionDeadline: startedAt + bound,
51
+ historyExpiresAt: startedAt + days * 86_400_000,
52
+ outcome: 'dispatching',
53
+ };
54
+ if (!(await options.store.claim(record)))
55
+ return undefined;
56
+ return {
57
+ async finish(evidence) {
58
+ const completionDays = await options.historyDays();
59
+ if (!Number.isInteger(completionDays) || completionDays < 1 || completionDays > 365)
60
+ throw new Error('Operation history policy unavailable');
61
+ if (!(await options.store.finish(options.scope, record.id, record.lease, record.epoch, evidence, now(), completionDays)))
62
+ throw new Error('Operation evidence claim expired');
63
+ },
64
+ };
65
+ },
66
+ };
67
+ }
68
+ /** Store adapters use the same narrow transition; late results cannot replace an expired/terminal claim. */
69
+ export function completeOperationEvidence(record, lease, epoch, evidence, now, historyDays) {
70
+ if (record.lease !== lease ||
71
+ record.epoch !== epoch ||
72
+ record.outcome !== 'dispatching' ||
73
+ record.executionDeadline <= now)
74
+ return undefined;
75
+ return {
76
+ ...record,
77
+ outcome: evidence.outcome,
78
+ completedAt: now,
79
+ historyExpiresAt: now +
80
+ (historyDays === undefined
81
+ ? record.historyExpiresAt - record.startedAt
82
+ : historyDays * 86_400_000),
83
+ ...(evidence.reference === undefined ? {} : { reference: evidence.reference }),
84
+ };
85
+ }
86
+ export function operationEvidenceKey(scope, id) {
87
+ return JSON.stringify([scope.org, scope.app, scope.env, scope.installationId, id]);
88
+ }
89
+ //# sourceMappingURL=operation-evidence.js.map
@@ -0,0 +1,49 @@
1
+ import { createServer } from 'node:http';
2
+ import { applySecurityHeaders, sendJson } from '@noodle-borg/transport-http';
3
+ import { resolveBuildInfo, serviceInfoPayload } from './build-info.js';
4
+ import { ServerRegistry } from './registry.js';
5
+ import { closeHttpServer, listenHttpServer } from './service-resource-cleanup.js';
6
+ export function resolveRecoveryMode(value) {
7
+ if (value === undefined)
8
+ return undefined;
9
+ if (value === 'quarantined' || value === 'reopened')
10
+ return value;
11
+ throw new Error('Invalid recovery mode; expected quarantined or reopened');
12
+ }
13
+ /** Deliberately no authorization/store lookup, artifact serving or application dispatch. */
14
+ export function createRecoveryQuarantineHandler(options) {
15
+ const build = options.buildInfo ?? resolveBuildInfo();
16
+ return (req, res) => {
17
+ applySecurityHeaders(res, options.tls ?? {});
18
+ res.setHeader('cache-control', 'no-store');
19
+ const path = new URL(req.url ?? '/', 'http://localhost').pathname;
20
+ if (req.method === 'GET') {
21
+ if (path === '/healthz')
22
+ return sendJson(res, 200, { status: 'ok' });
23
+ if (path === '/readyz')
24
+ return sendJson(res, 503, { status: 'quarantined' });
25
+ if (path === '/v1/service/info')
26
+ return sendJson(res, 200, serviceInfoPayload(build, false));
27
+ }
28
+ sendJson(res, 503, {
29
+ error: 'This service is quarantined for recovery.',
30
+ code: 'recovery_quarantined',
31
+ });
32
+ };
33
+ }
34
+ /** No restored store is constructed or borrowed; even startup migrations/workers remain stopped. */
35
+ export async function serveRecoveryQuarantine(options) {
36
+ const host = options.host ?? '127.0.0.1';
37
+ const http = createServer(createRecoveryQuarantineHandler(options));
38
+ await listenHttpServer(http, options.port ?? 8787, host);
39
+ const { port } = http.address();
40
+ return {
41
+ http,
42
+ port,
43
+ url: `http://${host.includes(':') ? `[${host}]` : host}:${port}`,
44
+ // The existing programmatic return contract gets an empty local registry, never restored authority.
45
+ registry: new ServerRegistry(),
46
+ close: () => closeHttpServer(http),
47
+ };
48
+ }
49
+ //# sourceMappingURL=recovery-quarantine.js.map
@@ -1,7 +1,7 @@
1
1
  import { publicSurfaceDelegatedAuthErrors } from '@noodle-borg/assistant-gateway/portable';
2
- import { compile, InMemoryCatalog, } from '@noodle-borg/compiler';
2
+ import { compile, InMemoryCatalog, RECORD_CONNECTOR_ID, } from '@noodle-borg/compiler';
3
3
  import { compileConnectors, delegatedTokenExchangeIdentityErrors, } from '@noodle-borg/connector-defs';
4
- import { InMemoryConnectorRegistry, resolveManagedOrigins, } from '@noodle-borg/runtime';
4
+ import { InMemoryConnectorRegistry, resolveManagedOrigins, resolveVariableEnvironment, } from '@noodle-borg/runtime';
5
5
  import { AppPackageSnapshotError, createAppPackageSnapshot, } from './app-package-snapshot.js';
6
6
  import { missingServerConfigErrors } from './assistant-bindings.js';
7
7
  import { ManagedConfigBroker } from './credential-broker.js';
@@ -20,6 +20,17 @@ export async function compileRegistryTarget(context, input) {
20
20
  const cc = compileConnectors(connectors);
21
21
  if (!cc.ok)
22
22
  return { ok: false, errors: cc.errors };
23
+ if (cc.catalog.some((entry) => entry.id === RECORD_CONNECTOR_ID))
24
+ return {
25
+ ok: false,
26
+ errors: [
27
+ {
28
+ code: 'reserved_connector',
29
+ path: 'connectors',
30
+ message: 'The native record connector is platform-owned and cannot be supplied by an application.',
31
+ },
32
+ ],
33
+ };
23
34
  catalogConnectors = cc.catalog;
24
35
  httpConnectors = cc.connectors;
25
36
  secretBindings = cc.secretBindings;
@@ -49,25 +60,54 @@ export async function compileRegistryTarget(context, input) {
49
60
  const projectionErrors = compiled.ok
50
61
  ? publicSurfaceDelegatedAuthErrors(compiled.artifact, secretBindings)
51
62
  : [];
52
- const [resolvedSecrets, resolvedVariables] = await Promise.all([
53
- context.configStore.resolveConfigValues('secret', scope),
54
- context.configStore.resolveConfigValues('variable', scope),
55
- ]);
63
+ const resolvedSecrets = await context.configStore.resolveConfigValues('secret', scope);
64
+ const resolvedVariables = await context.configStore.resolveConfigValues('variable', scope);
65
+ const businessVariables = new Set(compiled.ok
66
+ ? compiled.artifact.server.variables
67
+ ?.filter((declaration) => declaration.portal !== undefined)
68
+ .map((declaration) => declaration.name)
69
+ : []);
56
70
  const connectorConfigErrors = [
57
71
  ...missingSecretErrors(secretBindings, resolvedSecrets),
58
- ...missingVariableErrors(variableBindings, resolvedVariables),
72
+ ...missingVariableErrors(variableBindings.filter((name) => !businessVariables.has(name)), resolvedVariables),
59
73
  ];
60
74
  if (!compiled.ok) {
61
75
  return { ok: false, errors: [...connectorConfigErrors, ...compiled.errors] };
62
76
  }
63
- const missingServerConfig = missingServerConfigErrors(compiled.artifact, resolvedSecrets, resolvedVariables);
77
+ const missingServerConfig = missingServerConfigErrors(compiled.artifact, resolvedSecrets, resolvedVariables).filter((error) => error.code !== 'missing_variable' ||
78
+ !businessVariables.has(error.path.replace(/^variables\./, '')));
64
79
  const errors = [
65
80
  ...identityErrors,
66
81
  ...projectionErrors,
67
82
  ...connectorConfigErrors,
68
83
  ...missingServerConfig,
69
84
  ];
70
- const originResolution = resolveManagedOrigins(compiled.artifact, resolvedVariables);
85
+ const settings = resolveVariableEnvironment(compiled.artifact.server.variables ?? [], resolvedVariables);
86
+ if (!settings.ok)
87
+ errors.push({ ...settings.error, path: 'server.variables' });
88
+ if (settings.ok && deploymentId === undefined && settings.missing.length > 0) {
89
+ const previous = await context.activeArtifact();
90
+ if (previous !== undefined) {
91
+ const previouslyMissing = resolveVariableEnvironment(previous.server.variables ?? [], resolvedVariables);
92
+ for (const declaration of compiled.artifact.server.variables ?? []) {
93
+ if (!settings.missing.includes(declaration.name))
94
+ continue;
95
+ const old = previous.server.variables?.find((entry) => entry.name === declaration.name);
96
+ if (declaration.requiredFor.some((tool) => previous.tools.some((entry) => entry.name === tool) &&
97
+ !(previouslyMissing.ok &&
98
+ previouslyMissing.missing.includes(declaration.name) &&
99
+ old?.requiredFor.includes(tool))))
100
+ errors.push({
101
+ code: 'configuration_required',
102
+ path: `variables.${declaration.name}`,
103
+ message: 'Configure the new requirement before updating an existing capability.',
104
+ });
105
+ }
106
+ }
107
+ }
108
+ const originResolution = resolveManagedOrigins(compiled.artifact, resolvedVariables, {
109
+ allowUnconfiguredPortal: true,
110
+ });
71
111
  if (!originResolution.ok) {
72
112
  const missingVariables = new Set(errors.filter((error) => error.code === 'missing_variable').map((error) => error.path));
73
113
  errors.push(...originResolution.errors
@@ -92,7 +132,8 @@ export async function compileRegistryTarget(context, input) {
92
132
  if (errors.length > 0 || !originResolution.ok) {
93
133
  return { ok: false, errors, compiledArtifact: compiled.artifact };
94
134
  }
95
- const artifact = originResolution.artifact;
135
+ // Keep declarations reusable; serving binds live operator settings once for each request.
136
+ const artifact = compiled.artifact;
96
137
  const localAuthority = context.delegatedExchange === undefined &&
97
138
  secretBindings.some((binding) => binding.authKind === 'delegatedTokenExchange')
98
139
  ? await context.localDevtoolsDelegatedExchange?.resolve()
@@ -138,18 +179,26 @@ export async function compileRegistryTarget(context, input) {
138
179
  }),
139
180
  });
140
181
  const stateConnector = createDeploymentStateConnector(artifact.server.state, boundDeploymentId, context.stateHandleStoreFactory);
182
+ const nativeRecords = context.nativeRecords?.({
183
+ tenant,
184
+ artifact,
185
+ ...(boundDeploymentId === undefined ? {} : { deploymentId: boundDeploymentId }),
186
+ });
141
187
  return {
142
188
  artifact,
143
189
  deps: {
144
190
  connectors: new InMemoryConnectorRegistry([
145
191
  ...context.platformConnectors,
192
+ ...(nativeRecords === undefined ? [] : [nativeRecords]),
146
193
  ...(stateConnector !== undefined ? [stateConnector] : []),
147
194
  ...httpConnectors,
148
195
  ]),
149
196
  broker,
150
197
  tenantId: `${tenant.org}/${tenant.app}/${tenant.env}`,
151
198
  ...(boundDeploymentId !== undefined ? { deploymentId: boundDeploymentId } : {}),
152
- env: () => context.configStore.resolveConfigValues('variable', scope),
199
+ env: () => context.configStore.transactConfig === undefined
200
+ ? context.configStore.resolveConfigValues('variable', scope)
201
+ : context.configStore.transactConfig(scope.org, (transaction) => transaction.resolveConfigValues('variable', scope)),
153
202
  ...(context.policyGate !== undefined ? { policy: context.policyGate } : {}),
154
203
  ...(context.knowledgeSearch !== undefined && (artifact.server.knowledge?.length ?? 0) > 0
155
204
  ? {
@@ -1,6 +1,24 @@
1
1
  import { normalizeServerVersion } from '@noodle-borg/module';
2
2
  import { deployAccessRequiresActor, deployerRequiredError, deploymentOwnerSubject, emptyMembershipSourcesError, membershipSourcesRequireOrgMembersError, missingCapabilityErrors, serverAuthRequiredError, } from './registry-helpers.js';
3
3
  import { idempotentDeploymentId, mintDeploymentId } from './registry-targets.js';
4
+ /** Serialize candidate validation/activation with hierarchical configuration writers. */
5
+ export async function withDeploymentConfiguration(config, org, work) {
6
+ if (!config.transactConfig)
7
+ return work();
8
+ let result;
9
+ try {
10
+ return await config.transactConfig(org, async () => {
11
+ result = await work();
12
+ return result;
13
+ });
14
+ }
15
+ catch (error) {
16
+ // A nested activation rejection has rolled back; preserve its already mapped public diagnostic.
17
+ if (result?.ok === false)
18
+ return result;
19
+ throw error;
20
+ }
21
+ }
4
22
  export async function preflightRegistryDeploy(input) {
5
23
  const { actor, accessMode, orgMembershipSources } = input.options;
6
24
  if (input.options.serverVersion !== undefined) {
@@ -1,3 +1,4 @@
1
+ import { withDeploymentConfiguration } from './registry-deploy-transaction.js';
1
2
  import { deploymentOwnerSubject, missingCapabilityErrors } from './registry-helpers.js';
2
3
  import { activateInMemory } from './registry-state.js';
3
4
  import { recordMatchesTenant, servedTargetFor, tenantDeploymentKey, tenantKey, tryServedTargetFor, } from './registry-targets.js';
@@ -7,7 +8,7 @@ import { recordMatchesTenant, servedTargetFor, tenantDeploymentKey, tenantKey, t
7
8
  */
8
9
  export async function rollbackWithMappedErrors(input) {
9
10
  try {
10
- const result = await input.run();
11
+ const result = await withDeploymentConfiguration(input.configStore, input.org, input.run);
11
12
  if (result.ok)
12
13
  await input.pairKnowledge();
13
14
  return result;
@@ -57,7 +57,7 @@ export declare function registryArchiveApp(state: RegistryStateView, org: string
57
57
  export declare function registryRestoreApp(state: RegistryStateView, org: string, app: string, compileRecord: CompileCustomerAuthRecord): Promise<AppRestoreResult | undefined>;
58
58
  /** Compile exact private auth snapshots for a later atomic bulk-restore precondition. */
59
59
  export declare function registryCustomerAuthRestoreProjections(state: RegistryStateView, deploymentIds: readonly string[], compileRecord: CompileCustomerAuthRecord): Promise<readonly CustomerAuthRestoreProjection[]>;
60
- export declare function registrySweepArchived(state: RegistryStateView, before: string): Promise<readonly DeployRecord[]>;
60
+ export declare function registrySweepArchived(state: RegistryStateView, before: string, onPurge?: (org: string, app: string, at: string, retired?: boolean) => Promise<void>): Promise<readonly DeployRecord[]>;
61
61
  /** The `apps` resource, store-first with a no-store fallback over the registry's own record cache. */
62
62
  export declare function registryListApps(state: RegistryStateView, org: string, opts: {
63
63
  readonly includeArchived?: boolean;
@@ -9,7 +9,7 @@ import { assertCustomerAuthRestorePrecondition, assertUniqueActiveCustomerAuthAu
9
9
  import { assertDeploymentActivationUnlocked, assertDeploymentAppendUnlocked, } from './deployment-lock.js';
10
10
  import { defaultActiveRecord } from './deployment-versioning.js';
11
11
  import { recordMatchesTenant, tenantDeploymentKey, tenantKey } from './registry-targets.js';
12
- import { appArchivedAt, deploymentSummary, paginateAppSummaries, planAppArchive, planAppRestore, resolveProductionEnvironment, summarizeApps, summarizeEnvs, withoutArchiveStamp, } from './store/records.js';
12
+ import { appArchivedAt, deploymentSummary, paginateAppSummaries, planAppArchive, planAppRestore, planArchivedAppSweep, resolveProductionEnvironment, summarizeApps, summarizeEnvs, withoutArchiveStamp, } from './store/records.js';
13
13
  import { validateSlug, validateTenantRef } from './store/validate.js';
14
14
  export function reconcilePlatformAccountResetRegistryCache(state, input) {
15
15
  for (const app of input.apps) {
@@ -269,13 +269,13 @@ function deactivateScope(records, candidate) {
269
269
  }
270
270
  }
271
271
  }
272
- export async function registrySweepArchived(state, before) {
272
+ export async function registrySweepArchived(state, before, onPurge) {
273
273
  let deleted;
274
274
  if (state.store !== undefined) {
275
275
  deleted = await state.store.sweepArchived(before);
276
276
  }
277
277
  else {
278
- deleted = [...state.records.values()].filter((record) => record.archivedAt !== undefined && record.archivedAt < before);
278
+ deleted = planArchivedAppSweep([...state.records.values()], before);
279
279
  }
280
280
  const ids = new Set(deleted.map((record) => record.deploymentId));
281
281
  for (const id of ids) {
@@ -283,6 +283,9 @@ export async function registrySweepArchived(state, before) {
283
283
  state.servers.delete(id);
284
284
  }
285
285
  purgeActiveTenantEntries(state, ids);
286
+ const apps = new Map(deleted.map((record) => [`${record.orgSlug}/${record.appSlug}`, record]));
287
+ for (const app of apps.values())
288
+ await onPurge?.(app.orgSlug, app.appSlug, new Date().toISOString(), true);
286
289
  return deleted;
287
290
  }
288
291
  /** The `apps` resource, store-first with a no-store fallback over the registry's own record cache. */
@@ -1,7 +1,34 @@
1
1
  import { createHash, randomUUID } from 'node:crypto';
2
+ import { RECORD_CONNECTOR_ID } from '@noodle-borg/compiler';
2
3
  import { parseAppPackageSnapshot } from './app-package-snapshot.js';
3
4
  import { hasExactCustomerAuthProjection } from './customer-auth-audience-binding.js';
4
5
  import { deploymentOwnerSubject } from './registry-helpers.js';
6
+ import { validateTenantRef } from './store.js';
7
+ /** Replace only the platform record port; unrelated compiled runtime ports retain their authority. */
8
+ export function rebindNativeRecords(target, record, factory) {
9
+ const native = factory?.({
10
+ tenant: recordTenant(record),
11
+ artifact: target.served.artifact,
12
+ deploymentId: record.deploymentId,
13
+ });
14
+ const previous = target.served.deps.connectors;
15
+ return {
16
+ ...target,
17
+ served: {
18
+ ...target.served,
19
+ deps: {
20
+ ...target.served.deps,
21
+ connectors: {
22
+ resolve: (ref) => ref.connectorId === RECORD_CONNECTOR_ID
23
+ ? native?.version === ref.connectorVersion
24
+ ? native
25
+ : undefined
26
+ : previous.resolve(ref),
27
+ },
28
+ },
29
+ },
30
+ };
31
+ }
5
32
  /**
6
33
  * Build the front-door {@link ServedTarget} for a persisted record: its access mode plus the credential the
7
34
  * front-door checks. Legacy alpha records without an identity access mode are not served.
@@ -163,4 +190,26 @@ function deploymentSlug(name) {
163
190
  .replace(/[^a-z0-9]+/g, '-')
164
191
  .replace(/^-+|-+$/g, '') || 'server');
165
192
  }
193
+ /** Immutable source projection shared by registry installation consumers. */
194
+ export async function deploymentSourceFor(state, tenant, deploymentId) {
195
+ const safeTenant = validateTenantRef(tenant);
196
+ const record = state.store
197
+ ? await state.store.get(deploymentId)
198
+ : state.records.get(deploymentId);
199
+ if (record === undefined ||
200
+ record.archivedAt !== undefined ||
201
+ record.orgSlug !== safeTenant.org ||
202
+ record.appSlug !== safeTenant.app ||
203
+ record.environment !== safeTenant.env)
204
+ return undefined;
205
+ return {
206
+ manifest: record.manifest,
207
+ ...(record.connectors === undefined ? {} : { connectors: record.connectors }),
208
+ ...(record.hostedAssets === undefined
209
+ ? {}
210
+ : { hostedAssets: structuredClone(record.hostedAssets) }),
211
+ ...(record.accessMode === undefined ? {} : { accessMode: record.accessMode }),
212
+ ...(record.serverVersion === undefined ? {} : { serverVersion: record.serverVersion }),
213
+ };
214
+ }
166
215
  //# sourceMappingURL=registry-targets.js.map