@pithy-sh/core 0.1.2 → 0.1.3

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 (393) hide show
  1. package/dist/address/address.d.ts +57 -0
  2. package/dist/address/address.d.ts.map +1 -0
  3. package/dist/address/address.js +71 -0
  4. package/dist/audit/auditEvent.d.ts +89 -0
  5. package/dist/audit/auditEvent.d.ts.map +1 -0
  6. package/dist/audit/auditEvent.js +69 -0
  7. package/dist/audit/recorder.d.ts +18 -0
  8. package/dist/audit/recorder.d.ts.map +1 -0
  9. package/dist/audit/recorder.js +8 -0
  10. package/dist/capability/bindings.d.ts +62 -0
  11. package/dist/capability/bindings.d.ts.map +1 -0
  12. package/dist/capability/bindings.js +97 -0
  13. package/dist/capability/capability.d.ts +501 -0
  14. package/dist/capability/capability.d.ts.map +1 -0
  15. package/dist/capability/capability.js +16 -0
  16. package/dist/capability/client.d.ts +70 -0
  17. package/dist/capability/client.d.ts.map +1 -0
  18. package/dist/capability/client.js +86 -0
  19. package/dist/capability/compose.d.ts +25 -0
  20. package/dist/capability/compose.d.ts.map +1 -0
  21. package/dist/capability/compose.js +54 -0
  22. package/dist/capability/composition.d.ts +26 -0
  23. package/dist/capability/composition.d.ts.map +1 -0
  24. package/dist/capability/composition.js +84 -0
  25. package/dist/capability/config.d.ts +7 -0
  26. package/dist/capability/config.d.ts.map +1 -0
  27. package/dist/capability/config.js +14 -0
  28. package/dist/capability/devSecret.d.ts +32 -0
  29. package/dist/capability/devSecret.d.ts.map +1 -0
  30. package/dist/capability/devSecret.js +28 -0
  31. package/dist/capability/manifest.d.ts +298 -0
  32. package/dist/capability/manifest.d.ts.map +1 -0
  33. package/dist/capability/manifest.js +356 -0
  34. package/dist/capability/secretOrigin.d.ts +121 -0
  35. package/dist/capability/secretOrigin.d.ts.map +1 -0
  36. package/dist/capability/secretOrigin.js +134 -0
  37. package/dist/capability/settings.d.ts +119 -0
  38. package/dist/capability/settings.d.ts.map +1 -0
  39. package/dist/capability/settings.js +66 -0
  40. package/dist/capability/validateBindings.d.ts +4 -0
  41. package/dist/capability/validateBindings.d.ts.map +1 -0
  42. package/dist/capability/validateBindings.js +34 -0
  43. package/dist/capability/vanishingKey.d.ts +31 -0
  44. package/dist/capability/vanishingKey.d.ts.map +1 -0
  45. package/dist/capability/vanishingKey.js +79 -0
  46. package/dist/controlPlane/audit/actions.d.ts +70 -0
  47. package/dist/controlPlane/audit/actions.d.ts.map +1 -0
  48. package/dist/controlPlane/audit/actions.js +76 -0
  49. package/dist/controlPlane/capability.d.ts +47 -0
  50. package/dist/controlPlane/capability.d.ts.map +1 -0
  51. package/dist/controlPlane/capability.js +138 -0
  52. package/dist/controlPlane/config/config.d.ts +19 -0
  53. package/dist/controlPlane/config/config.d.ts.map +1 -0
  54. package/dist/controlPlane/config/config.js +85 -0
  55. package/dist/controlPlane/context.d.ts +27 -0
  56. package/dist/controlPlane/context.d.ts.map +1 -0
  57. package/dist/controlPlane/context.js +29 -0
  58. package/dist/controlPlane/data/connection.d.ts +79 -0
  59. package/dist/controlPlane/data/connection.d.ts.map +1 -0
  60. package/dist/controlPlane/data/connection.js +55 -0
  61. package/dist/controlPlane/data/keyLifecycle.d.ts +62 -0
  62. package/dist/controlPlane/data/keyLifecycle.d.ts.map +1 -0
  63. package/dist/controlPlane/data/keyLifecycle.js +126 -0
  64. package/dist/controlPlane/data/replay.d.ts +18 -0
  65. package/dist/controlPlane/data/replay.d.ts.map +1 -0
  66. package/dist/controlPlane/data/replay.js +20 -0
  67. package/dist/controlPlane/data/tables.d.ts +34 -0
  68. package/dist/controlPlane/data/tables.d.ts.map +1 -0
  69. package/dist/controlPlane/data/tables.js +37 -0
  70. package/dist/controlPlane/discovery/adminRoute.d.ts +313 -0
  71. package/dist/controlPlane/discovery/adminRoute.d.ts.map +1 -0
  72. package/dist/controlPlane/discovery/adminRoute.js +136 -0
  73. package/dist/controlPlane/discovery/configuration.d.ts +108 -0
  74. package/dist/controlPlane/discovery/configuration.d.ts.map +1 -0
  75. package/dist/controlPlane/discovery/configuration.js +187 -0
  76. package/dist/controlPlane/discovery/drift.d.ts +64 -0
  77. package/dist/controlPlane/discovery/drift.d.ts.map +1 -0
  78. package/dist/controlPlane/discovery/drift.js +58 -0
  79. package/dist/controlPlane/discovery/health.d.ts +99 -0
  80. package/dist/controlPlane/discovery/health.d.ts.map +1 -0
  81. package/dist/controlPlane/discovery/health.js +151 -0
  82. package/dist/controlPlane/discovery/healthSummary.d.ts +236 -0
  83. package/dist/controlPlane/discovery/healthSummary.d.ts.map +1 -0
  84. package/dist/controlPlane/discovery/healthSummary.js +278 -0
  85. package/dist/controlPlane/error/errors.d.ts +67 -0
  86. package/dist/controlPlane/error/errors.d.ts.map +1 -0
  87. package/dist/controlPlane/error/errors.js +79 -0
  88. package/dist/controlPlane/http/cors.d.ts +112 -0
  89. package/dist/controlPlane/http/cors.d.ts.map +1 -0
  90. package/dist/controlPlane/http/cors.js +192 -0
  91. package/dist/controlPlane/http/guard.d.ts +77 -0
  92. package/dist/controlPlane/http/guard.d.ts.map +1 -0
  93. package/dist/controlPlane/http/guard.js +142 -0
  94. package/dist/controlPlane/http/handlers.d.ts +179 -0
  95. package/dist/controlPlane/http/handlers.d.ts.map +1 -0
  96. package/dist/controlPlane/http/handlers.js +245 -0
  97. package/dist/controlPlane/http/responses.d.ts +99 -0
  98. package/dist/controlPlane/http/responses.d.ts.map +1 -0
  99. package/dist/controlPlane/http/responses.js +63 -0
  100. package/dist/controlPlane/http/routes.d.ts +40 -0
  101. package/dist/controlPlane/http/routes.d.ts.map +1 -0
  102. package/dist/controlPlane/http/routes.js +83 -0
  103. package/dist/controlPlane/http/schemas.d.ts +39 -0
  104. package/dist/controlPlane/http/schemas.d.ts.map +1 -0
  105. package/dist/controlPlane/http/schemas.js +31 -0
  106. package/dist/controlPlane/http/verify.d.ts +84 -0
  107. package/dist/controlPlane/http/verify.d.ts.map +1 -0
  108. package/dist/controlPlane/http/verify.js +65 -0
  109. package/dist/controlPlane/migrations/0001_init.d.ts +51 -0
  110. package/dist/controlPlane/migrations/0001_init.d.ts.map +1 -0
  111. package/dist/controlPlane/migrations/0001_init.js +65 -0
  112. package/dist/controlPlane/replay/d1Guard.d.ts +29 -0
  113. package/dist/controlPlane/replay/d1Guard.d.ts.map +1 -0
  114. package/dist/controlPlane/replay/d1Guard.js +39 -0
  115. package/dist/controlPlane/replay/guard.d.ts +52 -0
  116. package/dist/controlPlane/replay/guard.d.ts.map +1 -0
  117. package/dist/controlPlane/replay/guard.js +0 -0
  118. package/dist/controlPlane/replay/kvGuard.d.ts +99 -0
  119. package/dist/controlPlane/replay/kvGuard.d.ts.map +1 -0
  120. package/dist/controlPlane/replay/kvGuard.js +101 -0
  121. package/dist/controlPlane/scope/scope.d.ts +68 -0
  122. package/dist/controlPlane/scope/scope.d.ts.map +1 -0
  123. package/dist/controlPlane/scope/scope.js +63 -0
  124. package/dist/controlPlane/token/base64url.d.ts +10 -0
  125. package/dist/controlPlane/token/base64url.d.ts.map +1 -0
  126. package/dist/controlPlane/token/base64url.js +48 -0
  127. package/dist/controlPlane/token/claims.d.ts +83 -0
  128. package/dist/controlPlane/token/claims.d.ts.map +1 -0
  129. package/dist/controlPlane/token/claims.js +86 -0
  130. package/dist/controlPlane/token/digest.d.ts +44 -0
  131. package/dist/controlPlane/token/digest.d.ts.map +1 -0
  132. package/dist/controlPlane/token/digest.js +56 -0
  133. package/dist/controlPlane/token/jws.d.ts +52 -0
  134. package/dist/controlPlane/token/jws.d.ts.map +1 -0
  135. package/dist/controlPlane/token/jws.js +65 -0
  136. package/dist/controlPlane/token/mint.d.ts +56 -0
  137. package/dist/controlPlane/token/mint.d.ts.map +1 -0
  138. package/dist/controlPlane/token/mint.js +55 -0
  139. package/dist/controlPlane/wire.d.ts +122 -0
  140. package/dist/controlPlane/wire.d.ts.map +1 -0
  141. package/dist/controlPlane/wire.js +123 -0
  142. package/dist/createBackend.d.ts +58 -0
  143. package/dist/createBackend.d.ts.map +1 -0
  144. package/dist/createBackend.js +170 -0
  145. package/dist/createEntrypoint.d.ts +53 -0
  146. package/dist/createEntrypoint.d.ts.map +1 -0
  147. package/dist/createEntrypoint.js +52 -0
  148. package/dist/data/boundParameters.d.ts +83 -0
  149. package/dist/data/boundParameters.d.ts.map +1 -0
  150. package/dist/data/boundParameters.js +162 -0
  151. package/dist/data/codecs.d.ts +34 -0
  152. package/dist/data/codecs.d.ts.map +1 -0
  153. package/dist/data/codecs.js +135 -0
  154. package/dist/data/cursor.d.ts +81 -0
  155. package/dist/data/cursor.d.ts.map +1 -0
  156. package/dist/data/cursor.js +104 -0
  157. package/dist/data/databases.d.ts +55 -0
  158. package/dist/data/databases.d.ts.map +1 -0
  159. package/dist/data/databases.js +32 -0
  160. package/dist/data/db.d.ts +42 -0
  161. package/dist/data/db.d.ts.map +1 -0
  162. package/dist/data/db.js +24 -0
  163. package/dist/data/withD1Retry.d.ts +91 -0
  164. package/dist/data/withD1Retry.d.ts.map +1 -0
  165. package/dist/data/withD1Retry.js +152 -0
  166. package/dist/entitlement/entitlement.d.ts +118 -0
  167. package/dist/entitlement/entitlement.d.ts.map +1 -0
  168. package/dist/entitlement/entitlement.js +59 -0
  169. package/dist/entitlement/gateScan.d.ts +26 -0
  170. package/dist/entitlement/gateScan.d.ts.map +1 -0
  171. package/dist/entitlement/gateScan.js +96 -0
  172. package/dist/entitlement/require.d.ts +12 -0
  173. package/dist/entitlement/require.d.ts.map +1 -0
  174. package/dist/entitlement/require.js +123 -0
  175. package/dist/env/ambient.d.ts +52 -0
  176. package/dist/env/ambient.d.ts.map +1 -0
  177. package/dist/env/ambient.js +35 -0
  178. package/dist/env/ci.d.ts +36 -0
  179. package/dist/env/ci.d.ts.map +1 -0
  180. package/dist/env/ci.js +40 -0
  181. package/dist/env/stem.d.ts +23 -0
  182. package/dist/env/stem.d.ts.map +1 -0
  183. package/dist/env/stem.js +29 -0
  184. package/dist/error/cause.d.ts +143 -0
  185. package/dist/error/cause.d.ts.map +1 -0
  186. package/dist/error/cause.js +192 -0
  187. package/dist/error/client.d.ts +35 -0
  188. package/dist/error/client.d.ts.map +1 -0
  189. package/dist/error/client.js +38 -0
  190. package/dist/error/extend.d.ts +101 -0
  191. package/dist/error/extend.d.ts.map +1 -0
  192. package/dist/error/extend.js +76 -0
  193. package/dist/error/http.d.ts +1516 -0
  194. package/dist/error/http.d.ts.map +1 -0
  195. package/dist/error/http.js +72 -0
  196. package/dist/error/payload.d.ts +3034 -0
  197. package/dist/error/payload.d.ts.map +1 -0
  198. package/dist/error/payload.js +1110 -0
  199. package/dist/error/pithyError.d.ts +154 -0
  200. package/dist/error/pithyError.d.ts.map +1 -0
  201. package/dist/error/pithyError.js +197 -0
  202. package/dist/error/terminal.d.ts +28 -0
  203. package/dist/error/terminal.d.ts.map +1 -0
  204. package/dist/error/terminal.js +33 -0
  205. package/dist/http/authContext.d.ts +21 -0
  206. package/dist/http/authContext.d.ts.map +1 -0
  207. package/dist/http/authContext.js +23 -0
  208. package/dist/http/routeContract.d.ts +39 -0
  209. package/dist/http/routeContract.d.ts.map +1 -0
  210. package/dist/http/routeContract.js +82 -0
  211. package/dist/http/sameOrigin.d.ts +47 -0
  212. package/dist/http/sameOrigin.d.ts.map +1 -0
  213. package/dist/http/sameOrigin.js +24 -0
  214. package/dist/http/signedWebhook.d.ts +225 -0
  215. package/dist/http/signedWebhook.d.ts.map +1 -0
  216. package/dist/http/signedWebhook.js +247 -0
  217. package/dist/http/validation.d.ts +37 -0
  218. package/dist/http/validation.d.ts.map +1 -0
  219. package/dist/http/validation.js +14 -0
  220. package/dist/http/verification.d.ts +10 -0
  221. package/dist/http/verification.d.ts.map +1 -0
  222. package/dist/http/verification.js +17 -0
  223. package/dist/i18n/acceptLanguage.d.ts +22 -0
  224. package/dist/i18n/acceptLanguage.d.ts.map +1 -0
  225. package/dist/i18n/acceptLanguage.js +55 -0
  226. package/dist/i18n/catalog.d.ts +39 -0
  227. package/dist/i18n/catalog.d.ts.map +1 -0
  228. package/dist/i18n/catalog.js +57 -0
  229. package/dist/i18n/locale.d.ts +74 -0
  230. package/dist/i18n/locale.d.ts.map +1 -0
  231. package/dist/i18n/locale.js +109 -0
  232. package/dist/i18n/localeMarker.d.ts +29 -0
  233. package/dist/i18n/localeMarker.d.ts.map +1 -0
  234. package/dist/i18n/localeMarker.js +112 -0
  235. package/dist/i18n/match.d.ts +26 -0
  236. package/dist/i18n/match.d.ts.map +1 -0
  237. package/dist/i18n/match.js +88 -0
  238. package/dist/i18n/registry.d.ts +25 -0
  239. package/dist/i18n/registry.d.ts.map +1 -0
  240. package/dist/i18n/registry.js +51 -0
  241. package/dist/i18n/translator.d.ts +107 -0
  242. package/dist/i18n/translator.d.ts.map +1 -0
  243. package/dist/i18n/translator.js +80 -0
  244. package/dist/index.d.ts +32 -0
  245. package/dist/index.d.ts.map +1 -0
  246. package/dist/index.js +17 -0
  247. package/dist/kv/kv.d.ts +166 -0
  248. package/dist/kv/kv.d.ts.map +1 -0
  249. package/dist/kv/kv.js +261 -0
  250. package/dist/kv/namespaces.d.ts +58 -0
  251. package/dist/kv/namespaces.d.ts.map +1 -0
  252. package/dist/kv/namespaces.js +40 -0
  253. package/dist/logger/local.d.ts +41 -0
  254. package/dist/logger/local.d.ts.map +1 -0
  255. package/dist/logger/local.js +45 -0
  256. package/dist/logger/logger.d.ts +56 -0
  257. package/dist/logger/logger.d.ts.map +1 -0
  258. package/dist/logger/logger.js +83 -0
  259. package/dist/logger/record.d.ts +919 -0
  260. package/dist/logger/record.d.ts.map +1 -0
  261. package/dist/logger/record.js +79 -0
  262. package/dist/logger/worker.d.ts +74 -0
  263. package/dist/logger/worker.d.ts.map +1 -0
  264. package/dist/logger/worker.js +54 -0
  265. package/dist/migrations/batch.d.ts +10 -0
  266. package/dist/migrations/batch.d.ts.map +1 -0
  267. package/dist/migrations/batch.js +193 -0
  268. package/dist/migrations/bookkeeping.d.ts +24 -0
  269. package/dist/migrations/bookkeeping.d.ts.map +1 -0
  270. package/dist/migrations/bookkeeping.js +57 -0
  271. package/dist/migrations/owner.d.ts +41 -0
  272. package/dist/migrations/owner.d.ts.map +1 -0
  273. package/dist/migrations/owner.js +105 -0
  274. package/dist/migrations/registry.d.ts +36 -0
  275. package/dist/migrations/registry.d.ts.map +1 -0
  276. package/dist/migrations/registry.js +70 -0
  277. package/dist/migrations/runner.d.ts +67 -0
  278. package/dist/migrations/runner.d.ts.map +1 -0
  279. package/dist/migrations/runner.js +218 -0
  280. package/dist/naming/domains.d.ts +108 -0
  281. package/dist/naming/domains.d.ts.map +1 -0
  282. package/dist/naming/domains.js +156 -0
  283. package/dist/naming/environment.d.ts +118 -0
  284. package/dist/naming/environment.d.ts.map +1 -0
  285. package/dist/naming/environment.js +190 -0
  286. package/dist/naming/feature.d.ts +68 -0
  287. package/dist/naming/feature.d.ts.map +1 -0
  288. package/dist/naming/feature.js +106 -0
  289. package/dist/naming/limits.d.ts +229 -0
  290. package/dist/naming/limits.d.ts.map +1 -0
  291. package/dist/naming/limits.js +187 -0
  292. package/dist/naming/provisionScope.d.ts +91 -0
  293. package/dist/naming/provisionScope.d.ts.map +1 -0
  294. package/dist/naming/provisionScope.js +65 -0
  295. package/dist/naming/resource.d.ts +169 -0
  296. package/dist/naming/resource.d.ts.map +1 -0
  297. package/dist/naming/resource.js +220 -0
  298. package/dist/naming/resourceNames.d.ts +83 -0
  299. package/dist/naming/resourceNames.d.ts.map +1 -0
  300. package/dist/naming/resourceNames.js +102 -0
  301. package/dist/naming/segment.d.ts +29 -0
  302. package/dist/naming/segment.d.ts.map +1 -0
  303. package/dist/naming/segment.js +31 -0
  304. package/dist/projection/asRead.d.ts +72 -0
  305. package/dist/projection/asRead.d.ts.map +1 -0
  306. package/dist/projection/asRead.js +169 -0
  307. package/dist/projection/published.d.ts +95 -0
  308. package/dist/projection/published.d.ts.map +1 -0
  309. package/dist/projection/published.js +114 -0
  310. package/dist/schema/describedness.d.ts +55 -0
  311. package/dist/schema/describedness.d.ts.map +1 -0
  312. package/dist/schema/describedness.js +180 -0
  313. package/dist/seed/compose.d.ts +41 -0
  314. package/dist/seed/compose.d.ts.map +1 -0
  315. package/dist/seed/compose.js +51 -0
  316. package/dist/seed/devLogin.d.ts +50 -0
  317. package/dist/seed/devLogin.d.ts.map +1 -0
  318. package/dist/seed/devLogin.js +52 -0
  319. package/dist/seed/exampleIdentities.d.ts +58 -0
  320. package/dist/seed/exampleIdentities.d.ts.map +1 -0
  321. package/dist/seed/exampleIdentities.js +26 -0
  322. package/dist/seed/metadata.d.ts +20 -0
  323. package/dist/seed/metadata.d.ts.map +1 -0
  324. package/dist/seed/metadata.js +27 -0
  325. package/dist/seed/seed.d.ts +264 -0
  326. package/dist/seed/seed.d.ts.map +1 -0
  327. package/dist/seed/seed.js +37 -0
  328. package/dist/seed/seededRows.d.ts +26 -0
  329. package/dist/seed/seededRows.d.ts.map +1 -0
  330. package/dist/seed/seededRows.js +20 -0
  331. package/dist/seed/writeD1.d.ts +43 -0
  332. package/dist/seed/writeD1.d.ts.map +1 -0
  333. package/dist/seed/writeD1.js +73 -0
  334. package/dist/seed/writeKv.d.ts +29 -0
  335. package/dist/seed/writeKv.d.ts.map +1 -0
  336. package/dist/seed/writeKv.js +63 -0
  337. package/dist/semver/semver.d.ts +62 -0
  338. package/dist/semver/semver.d.ts.map +1 -0
  339. package/dist/semver/semver.js +137 -0
  340. package/dist/text/comments.d.ts +62 -0
  341. package/dist/text/comments.d.ts.map +1 -0
  342. package/dist/text/comments.js +161 -0
  343. package/dist/version.generated.d.ts +5 -0
  344. package/dist/version.generated.d.ts.map +1 -0
  345. package/dist/version.generated.js +7 -0
  346. package/dist/worker/health.d.ts +39 -0
  347. package/dist/worker/health.d.ts.map +1 -0
  348. package/dist/worker/health.js +41 -0
  349. package/dist/worker/identity.d.ts +191 -0
  350. package/dist/worker/identity.d.ts.map +1 -0
  351. package/dist/worker/identity.js +162 -0
  352. package/dist/workflow/bindings.d.ts +41 -0
  353. package/dist/workflow/bindings.d.ts.map +1 -0
  354. package/dist/workflow/bindings.js +53 -0
  355. package/dist/workflow/dispatch.d.ts +98 -0
  356. package/dist/workflow/dispatch.d.ts.map +1 -0
  357. package/dist/workflow/dispatch.js +148 -0
  358. package/dist/workflow/dispatchRoute.d.ts +80 -0
  359. package/dist/workflow/dispatchRoute.d.ts.map +1 -0
  360. package/dist/workflow/dispatchRoute.js +134 -0
  361. package/dist/workflow/faults.d.ts +97 -0
  362. package/dist/workflow/faults.d.ts.map +1 -0
  363. package/dist/workflow/faults.js +111 -0
  364. package/dist/workflow/host.d.ts +176 -0
  365. package/dist/workflow/host.d.ts.map +1 -0
  366. package/dist/workflow/host.js +116 -0
  367. package/dist/workflow/hostEntry.d.ts +50 -0
  368. package/dist/workflow/hostEntry.d.ts.map +1 -0
  369. package/dist/workflow/hostEntry.js +24 -0
  370. package/dist/workflow/hostEnv.d.ts +143 -0
  371. package/dist/workflow/hostEnv.d.ts.map +1 -0
  372. package/dist/workflow/hostEnv.js +170 -0
  373. package/dist/workflow/loopback.d.ts +52 -0
  374. package/dist/workflow/loopback.d.ts.map +1 -0
  375. package/dist/workflow/loopback.js +76 -0
  376. package/dist/workflow/naming.d.ts +79 -0
  377. package/dist/workflow/naming.d.ts.map +1 -0
  378. package/dist/workflow/naming.js +138 -0
  379. package/dist/workflow/register.d.ts +19 -0
  380. package/dist/workflow/register.d.ts.map +1 -0
  381. package/dist/workflow/register.js +40 -0
  382. package/dist/workflow/schemas.d.ts +44 -0
  383. package/dist/workflow/schemas.d.ts.map +1 -0
  384. package/dist/workflow/schemas.js +43 -0
  385. package/dist/workflow/spec.d.ts +81 -0
  386. package/dist/workflow/spec.d.ts.map +1 -0
  387. package/dist/workflow/spec.js +0 -0
  388. package/dist/workflow/stepMessage.d.ts +122 -0
  389. package/dist/workflow/stepMessage.d.ts.map +1 -0
  390. package/dist/workflow/stepMessage.js +152 -0
  391. package/package.json +20 -9
  392. package/src/capability/manifest.ts +21 -0
  393. package/src/version.generated.ts +1 -1
@@ -0,0 +1,99 @@
1
+ import type { Context } from "hono";
2
+ import type { z } from "zod";
3
+ import type { Capability, PithyHonoEnv } from "../../capability/capability";
4
+ import { type CapabilityHealthReport, type HealthSummary, HealthSummaryKey } from "./healthSummary";
5
+ /**
6
+ * The seam a capability implements to contribute a health summary to its own manifest entry (#317).
7
+ *
8
+ * The vocabulary itself — what a key may be called, what it may hold, what it costs, and the four
9
+ * states it travels in — is `./healthSummary`, and that argument is stated there in full. This is the
10
+ * other half: the branded declaration a `Capability` carries, the assembly-time check that a key
11
+ * inherits a scope its own routes already gate, and the per-request read that decides between a number,
12
+ * a withholding and a failure.
13
+ *
14
+ * **The two are separate modules because the compiler follows a type-only edge (#430).** Everything
15
+ * here needs `Capability`, `PithyHonoEnv` and `Context`, which reach D1, KV and Hono; nothing a browser
16
+ * imports needs any of it. Leaving the wire vocabulary in this file put all of that one `import type`
17
+ * away from every management client, through `adminRoute.ts`. Nothing in `./healthSummary` may import
18
+ * this module, and `tooling/browser-scopes` is the gate that says so.
19
+ */
20
+ /**
21
+ * The brand only {@link defineCapabilityHealth} can produce.
22
+ *
23
+ * Module-local and never exported, so nothing outside this file can write it: the factory becomes the
24
+ * **only** way to build the seam, and a declaration therefore cannot reach a manifest without having
25
+ * been parsed. An inline object literal on `Capability.health` is a compile error, which is what stops
26
+ * the next producer from re-inventing this with a key nothing validated — the failure mode every defect
27
+ * class in this kit has had in common.
28
+ *
29
+ * `Symbol()` rather than `Symbol.for()`, unlike the seam's `ANY_VERIFIED_CALLER`: that one is a
30
+ * requirement a route states and nobody may forge over the wire; this is a mark only this module applies.
31
+ */
32
+ declare const healthSeam: unique symbol;
33
+ /** What a capability declares and how it produces it. Built only by {@link defineCapabilityHealth}. */
34
+ export interface CapabilityHealth {
35
+ /** The brand. Present only on a declaration that went through the factory, and never serialized. */
36
+ readonly [healthSeam]: true;
37
+ /** The closed vocabulary: every key this capability may report, parsed. */
38
+ readonly keys: readonly HealthSummaryKey[];
39
+ /** Produce every declared key for this request. Bounded by the declaration, never by adopter data. */
40
+ readonly read: (c: Context<PithyHonoEnv>) => Promise<HealthSummary>;
41
+ }
42
+ /** The authoring shape — keys as written, before parsing. */
43
+ export interface CapabilityHealthInput {
44
+ /** Every key this capability may report. At least one; an empty vocabulary is not a summary. */
45
+ keys: readonly z.input<typeof HealthSummaryKey>[];
46
+ /** Produce every declared key for this request. */
47
+ read: (c: Context<PithyHonoEnv>) => Promise<HealthSummary>;
48
+ }
49
+ /**
50
+ * Declare a capability's health summary. The one constructor, so every declaration in the tree is
51
+ * parsed — kind against states, cost against the closed vocabulary, key against the name pattern.
52
+ */
53
+ export declare function defineCapabilityHealth(input: CapabilityHealthInput): CapabilityHealth;
54
+ /** One capability's contribution, as the seam holds it between assembly and a request. */
55
+ export interface CapabilityHealthSource {
56
+ /** Which capability contributes it — named in every refusal, because the fix is always in that package. */
57
+ capability: string;
58
+ /** Its closed vocabulary. */
59
+ keys: readonly HealthSummaryKey[];
60
+ /** Its producer. */
61
+ read: (c: Context<PithyHonoEnv>) => Promise<HealthSummary>;
62
+ }
63
+ /**
64
+ * Every composed capability's health contribution, checked at assembly.
65
+ *
66
+ * **The check is that a summary inherits a scope, never invents one**, and it is compared against a
67
+ * different artifact than the one it polices: the capability's own `adminRoutes`. That is not a
68
+ * tidiness rule. `pithy dashboard connect` offers an adopter the scopes it reads off `adminRoutes`, so
69
+ * a key behind a scope no route requires is a number that could never be granted — permanently
70
+ * withheld, with nothing an adopter could do about it, and no error anywhere to say why. Failing at
71
+ * assembly turns that into a deploy that does not start.
72
+ */
73
+ export declare function capabilityHealthSources(capabilities: readonly Capability[]): ReadonlyMap<string, CapabilityHealthSource>;
74
+ /**
75
+ * One capability's summary for one caller.
76
+ *
77
+ * **The producer is not called when no key is permitted**, so a caller with no grant costs the adopter's
78
+ * Worker nothing at all. When it *is* called, the whole of what it produced is checked before anything
79
+ * is withheld: a producer must not be able to hide a violation behind a scope the caller happens to
80
+ * lack.
81
+ *
82
+ * **A failure is caught here and goes no further.** The manifest is the read every other pane is built
83
+ * from, so one capability's bad afternoon must cost that capability's number and nothing else. Both
84
+ * kinds of failure land in the same state, because from a caller's side they are one fact — this
85
+ * capability could not say: the producer threw, or what it produced its own declaration does not
86
+ * permit. An author's mistake is not what this hides. The scope a key inherits, its name, its cost and
87
+ * the brand on the declaration are all checked at assembly, so the shape of a declaration fails a
88
+ * deploy rather than a request; what reaches here is data-dependent, which is the transient kind.
89
+ *
90
+ * **The caught error is dropped whole, and the `catch` takes no binding so that is visible rather than
91
+ * asserted.** It may be a `PithyError` whose `detail` names a row, a key id, or a query — throw-site
92
+ * context, which is exactly what a producer should put there and exactly what must not travel. Nothing
93
+ * derived from it reaches the manifest, a log, or a response: what survives is that this capability
94
+ * failed, and its name, which the manifest already carries in public. An adopter diagnoses it at their
95
+ * own throw site, where the context is theirs and stays theirs.
96
+ */
97
+ export declare function readCapabilityHealth(source: CapabilityHealthSource | undefined, grantedScopes: readonly string[], produce: (source: CapabilityHealthSource) => Promise<HealthSummary>): Promise<CapabilityHealthReport>;
98
+ export {};
99
+ //# sourceMappingURL=health.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/discovery/health.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE5E,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,UAAU,EAAE,OAAO,MAAsD,CAAC;AAEhF,uGAAuG;AACvG,MAAM,WAAW,gBAAgB;IAC/B,oGAAoG;IACpG,QAAQ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jC"}
@@ -0,0 +1,151 @@
1
+ import { InternalError } from "../../error/pithyError.js";
2
+ import { HealthSummaryKey } from "./healthSummary.js";
3
+ //#region src/controlPlane/discovery/health.ts
4
+ /**
5
+ * The seam a capability implements to contribute a health summary to its own manifest entry (#317).
6
+ *
7
+ * The vocabulary itself — what a key may be called, what it may hold, what it costs, and the four
8
+ * states it travels in — is `./healthSummary`, and that argument is stated there in full. This is the
9
+ * other half: the branded declaration a `Capability` carries, the assembly-time check that a key
10
+ * inherits a scope its own routes already gate, and the per-request read that decides between a number,
11
+ * a withholding and a failure.
12
+ *
13
+ * **The two are separate modules because the compiler follows a type-only edge (#430).** Everything
14
+ * here needs `Capability`, `PithyHonoEnv` and `Context`, which reach D1, KV and Hono; nothing a browser
15
+ * imports needs any of it. Leaving the wire vocabulary in this file put all of that one `import type`
16
+ * away from every management client, through `adminRoute.ts`. Nothing in `./healthSummary` may import
17
+ * this module, and `tooling/browser-scopes` is the gate that says so.
18
+ */
19
+ /**
20
+ * The brand only {@link defineCapabilityHealth} can produce.
21
+ *
22
+ * Module-local and never exported, so nothing outside this file can write it: the factory becomes the
23
+ * **only** way to build the seam, and a declaration therefore cannot reach a manifest without having
24
+ * been parsed. An inline object literal on `Capability.health` is a compile error, which is what stops
25
+ * the next producer from re-inventing this with a key nothing validated — the failure mode every defect
26
+ * class in this kit has had in common.
27
+ *
28
+ * `Symbol()` rather than `Symbol.for()`, unlike the seam's `ANY_VERIFIED_CALLER`: that one is a
29
+ * requirement a route states and nobody may forge over the wire; this is a mark only this module applies.
30
+ */
31
+ const healthSeam = Symbol("pithy.controlPlane.capabilityHealth");
32
+ /**
33
+ * Declare a capability's health summary. The one constructor, so every declaration in the tree is
34
+ * parsed — kind against states, cost against the closed vocabulary, key against the name pattern.
35
+ */
36
+ function defineCapabilityHealth(input) {
37
+ if (input.keys.length === 0) throw new InternalError({
38
+ message: "A capability declared a health summary with no keys.",
39
+ action: "Declare at least one key, or omit the health seam entirely.",
40
+ detail: "defineCapabilityHealth received an empty key list; an empty vocabulary is not a summary."
41
+ });
42
+ const keys = input.keys.map((key) => HealthSummaryKey.parse(key));
43
+ const seen = /* @__PURE__ */ new Set();
44
+ for (const key of keys) {
45
+ if (seen.has(key.key)) throw new InternalError({
46
+ message: "A capability declared the same health key twice.",
47
+ action: "Give each key one declaration — the second silently decides what the first meant.",
48
+ detail: `health key ${key.key} is declared more than once`
49
+ });
50
+ seen.add(key.key);
51
+ }
52
+ return {
53
+ [healthSeam]: true,
54
+ keys,
55
+ read: input.read
56
+ };
57
+ }
58
+ /**
59
+ * Every composed capability's health contribution, checked at assembly.
60
+ *
61
+ * **The check is that a summary inherits a scope, never invents one**, and it is compared against a
62
+ * different artifact than the one it polices: the capability's own `adminRoutes`. That is not a
63
+ * tidiness rule. `pithy dashboard connect` offers an adopter the scopes it reads off `adminRoutes`, so
64
+ * a key behind a scope no route requires is a number that could never be granted — permanently
65
+ * withheld, with nothing an adopter could do about it, and no error anywhere to say why. Failing at
66
+ * assembly turns that into a deploy that does not start.
67
+ */
68
+ function capabilityHealthSources(capabilities) {
69
+ const sources = /* @__PURE__ */ new Map();
70
+ for (const capability of capabilities) {
71
+ const health = capability.health;
72
+ if (!health) continue;
73
+ const gated = new Set((capability.adminRoutes ?? []).flatMap((route) => route.scope ? [route.scope] : []));
74
+ for (const key of health.keys) if (!gated.has(key.scope)) throw new InternalError({
75
+ message: "A capability's health summary is behind a scope none of its admin routes requires.",
76
+ action: "Put the value behind a scope the capability already gates a read with.",
77
+ detail: `capability ${capability.name} declares health key ${key.key} behind ${key.scope}, which no admin route of that capability requires — an adopter is never offered it, so the value could never be granted`
78
+ });
79
+ sources.set(capability.name, {
80
+ capability: capability.name,
81
+ keys: health.keys,
82
+ read: health.read
83
+ });
84
+ }
85
+ return sources;
86
+ }
87
+ /** Refuse a produced summary that its declaration cannot name. Total over what a producer may return. */
88
+ function checked(source, produced) {
89
+ const declared = new Map(source.keys.map((key) => [key.key, key]));
90
+ for (const key of Object.keys(produced)) if (!declared.has(key)) throw new InternalError({
91
+ message: "A capability reported a health value it never declared.",
92
+ action: "Declare the key alongside the capability's routes, or stop reporting it.",
93
+ detail: `capability ${source.capability} produced health key ${key}, which its declaration does not name`
94
+ });
95
+ for (const key of source.keys) {
96
+ const value = produced[key.key];
97
+ if (value === void 0) throw new InternalError({
98
+ message: "A capability omitted a health value it declared.",
99
+ action: "Produce every declared key, or remove the declaration.",
100
+ detail: `capability ${source.capability} declares health key ${key.key} and produced nothing for it`
101
+ });
102
+ if (!(key.kind === "count" ? typeof value === "number" && Number.isInteger(value) && value >= 0 : typeof value === "string" && (key.states ?? []).includes(value))) throw new InternalError({
103
+ message: "A capability reported a health value its declaration does not permit.",
104
+ action: "Report a whole non-negative number for a count, or a declared member for a state.",
105
+ detail: `capability ${source.capability} produced ${JSON.stringify(value)} for ${key.kind} key ${key.key}`
106
+ });
107
+ }
108
+ return produced;
109
+ }
110
+ /**
111
+ * One capability's summary for one caller.
112
+ *
113
+ * **The producer is not called when no key is permitted**, so a caller with no grant costs the adopter's
114
+ * Worker nothing at all. When it *is* called, the whole of what it produced is checked before anything
115
+ * is withheld: a producer must not be able to hide a violation behind a scope the caller happens to
116
+ * lack.
117
+ *
118
+ * **A failure is caught here and goes no further.** The manifest is the read every other pane is built
119
+ * from, so one capability's bad afternoon must cost that capability's number and nothing else. Both
120
+ * kinds of failure land in the same state, because from a caller's side they are one fact — this
121
+ * capability could not say: the producer threw, or what it produced its own declaration does not
122
+ * permit. An author's mistake is not what this hides. The scope a key inherits, its name, its cost and
123
+ * the brand on the declaration are all checked at assembly, so the shape of a declaration fails a
124
+ * deploy rather than a request; what reaches here is data-dependent, which is the transient kind.
125
+ *
126
+ * **The caught error is dropped whole, and the `catch` takes no binding so that is visible rather than
127
+ * asserted.** It may be a `PithyError` whose `detail` names a row, a key id, or a query — throw-site
128
+ * context, which is exactly what a producer should put there and exactly what must not travel. Nothing
129
+ * derived from it reaches the manifest, a log, or a response: what survives is that this capability
130
+ * failed, and its name, which the manifest already carries in public. An adopter diagnoses it at their
131
+ * own throw site, where the context is theirs and stays theirs.
132
+ */
133
+ async function readCapabilityHealth(source, grantedScopes, produce) {
134
+ if (!source) return { state: "undeclared" };
135
+ const permitted = source.keys.filter((key) => grantedScopes.includes(key.scope));
136
+ if (permitted.length === 0) return { state: "withheld" };
137
+ let produced;
138
+ try {
139
+ produced = checked(source, await produce(source));
140
+ } catch {
141
+ return { state: "unavailable" };
142
+ }
143
+ const visible = {};
144
+ for (const key of permitted) visible[key.key] = produced[key.key];
145
+ return {
146
+ state: "reported",
147
+ values: visible
148
+ };
149
+ }
150
+ //#endregion
151
+ export { capabilityHealthSources, defineCapabilityHealth, readCapabilityHealth };
@@ -0,0 +1,236 @@
1
+ import { z } from "zod";
2
+ /** What kind of scalar a key reports. */
3
+ export declare const HealthValueKind: z.ZodEnum<{
4
+ count: "count";
5
+ state: "state";
6
+ }>;
7
+ export type HealthValueKind = z.output<typeof HealthValueKind>;
8
+ /**
9
+ * What producing one value costs on a manifest read.
10
+ *
11
+ * **There is deliberately no member for a scan.** That is the whole constraint expressed as a
12
+ * vocabulary: a capability whose number would need one cannot state its cost, so it cannot declare the
13
+ * key, so the manifest stays cheap by construction rather than by everybody remembering.
14
+ */
15
+ export declare const HealthValueCost: z.ZodEnum<{
16
+ indexed: "indexed";
17
+ memory: "memory";
18
+ }>;
19
+ export type HealthValueCost = z.output<typeof HealthValueCost>;
20
+ /**
21
+ * One value a summary may carry. A number or a member of a declared enum — never anything else.
22
+ *
23
+ * This is the rule the issue asked to be in the type: `number | string` has no room for a row, an id, a
24
+ * nested object, or a collection that grows with an adopter's data.
25
+ */
26
+ export declare const HealthSummaryValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
27
+ export type HealthSummaryValue = z.output<typeof HealthSummaryValue>;
28
+ /** Anything that is not a scalar. Named as a type so the tripwire below is a list to delete from. */
29
+ type NonScalar = object | ((...args: never[]) => unknown);
30
+ /**
31
+ * `true` while `T` is scalars only, `never` the moment it admits anything else — so the assignment
32
+ * below stops compiling if {@link HealthSummaryValue} is ever widened.
33
+ *
34
+ * The tuple wrapper is not decoration: a bare `Extract<...> extends never` distributes over a union and
35
+ * would answer `true` for every member, which is the one way this check could quietly pass.
36
+ */
37
+ export type ScalarOnly<T> = [Extract<T, NonScalar>] extends [never] ? true : never;
38
+ /** The compile-time half of "scalars only". Widen the value type and this line names the file. */
39
+ export declare const HEALTH_SUMMARY_IS_SCALAR_ONLY: ScalarOnly<HealthSummaryValue>;
40
+ /**
41
+ * What a count must be for its key to be nominal — a bound, in either direction or both.
42
+ *
43
+ * **Both are optional and at least one is required**, which is the whole of the shape. `atMost: 0` is
44
+ * `secretsDueForRotation`, where zero is the good answer; `atLeast: 1` is a count of things that must
45
+ * exist, where zero is the fault. A declaration carrying neither is a claim with no content, and one
46
+ * carrying an inverted pair is a claim nothing can satisfy — both would make every value on that key
47
+ * want attention forever, which is worse than declaring nothing.
48
+ *
49
+ * Inclusive at the edge. A cadence saying *no more than zero overdue* means zero is fine.
50
+ */
51
+ export declare const HealthCountNominal: z.ZodObject<{
52
+ atMost: z.ZodOptional<z.ZodNumber>;
53
+ atLeast: z.ZodOptional<z.ZodNumber>;
54
+ }, z.core.$strip>;
55
+ export type HealthCountNominal = z.output<typeof HealthCountNominal>;
56
+ /**
57
+ * What a key claims a nominal value is, or null where it makes no claim at all.
58
+ *
59
+ * **Null is the default and stays supported forever.** Some measures genuinely have no good or bad
60
+ * value — a count of things that simply exist — and a vocabulary that forced a claim would collect
61
+ * invented ones. What must never happen is a client reading null as *fine*; {@link standingOf} answers
62
+ * `unknowable` for it, and that is the point of this whole field.
63
+ */
64
+ export declare const HealthNominal: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
65
+ atMost: z.ZodOptional<z.ZodNumber>;
66
+ atLeast: z.ZodOptional<z.ZodNumber>;
67
+ }, z.core.$strip>, z.ZodArray<z.ZodString>]>>;
68
+ export type HealthNominal = z.output<typeof HealthNominal>;
69
+ /**
70
+ * One key a capability may report, declared alongside its routes.
71
+ *
72
+ * `scope` is **not nullable**, unlike an admin route's. A route may need only a verified caller — the
73
+ * seam's `ping` does — but a number about somebody's posture never may, and an optional field here is a
74
+ * field somebody forgets.
75
+ */
76
+ export declare const HealthSummaryKey: z.ZodObject<{
77
+ key: z.ZodString;
78
+ kind: z.ZodEnum<{
79
+ count: "count";
80
+ state: "state";
81
+ }>;
82
+ states: z.ZodNullable<z.ZodArray<z.ZodString>>;
83
+ scope: z.ZodString;
84
+ cost: z.ZodEnum<{
85
+ indexed: "indexed";
86
+ memory: "memory";
87
+ }>;
88
+ summary: z.ZodString;
89
+ nominal: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
90
+ atMost: z.ZodOptional<z.ZodNumber>;
91
+ atLeast: z.ZodOptional<z.ZodNumber>;
92
+ }, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
93
+ }, z.core.$strip>;
94
+ export type HealthSummaryKey = z.output<typeof HealthSummaryKey>;
95
+ /**
96
+ * A capability's summary as the manifest carries it: declared key → scalar.
97
+ *
98
+ * A record rather than a closed object, because the vocabulary is federated the way scopes and audit
99
+ * actions are. **Parsing tolerates a key it has never heard of on purpose** — a client reading a newer
100
+ * Worker must render the unknown one as nothing rather than fail the whole manifest.
101
+ */
102
+ export declare const HealthSummary: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
103
+ export type HealthSummary = z.output<typeof HealthSummary>;
104
+ /**
105
+ * What one capability's summary is, for one caller. Four states, and the value carries which.
106
+ *
107
+ * A discriminated union rather than a nullable record with a flag beside it, and that is the whole
108
+ * point of #350. A flag is the same information and the opposite property: correct for whoever
109
+ * remembered to read it, and a zero for everybody else. Here the scalars are unreachable without
110
+ * narrowing on `state`, so forgetting the sick case is a type error rather than a screen that says
111
+ * everything is fine.
112
+ *
113
+ * - `undeclared` — the capability contributes no summary. Nothing to show, and nothing wrong.
114
+ * - `withheld` — it declares one, and this connection was not granted the scope it sits behind. Read
115
+ * `healthKeys` beside this and a client can say a number exists that it may not see.
116
+ * - `reported` — the values, each one named by a declaration that travels with it. Zero is one of these.
117
+ * - `unavailable` — producing the summary failed. Not zero, not withheld, and never both.
118
+ */
119
+ export declare const CapabilityHealthReport: z.ZodDiscriminatedUnion<[z.ZodObject<{
120
+ state: z.ZodLiteral<"undeclared">;
121
+ }, z.core.$strip>, z.ZodObject<{
122
+ state: z.ZodLiteral<"withheld">;
123
+ }, z.core.$strip>, z.ZodObject<{
124
+ state: z.ZodLiteral<"reported">;
125
+ values: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
126
+ }, z.core.$strip>, z.ZodObject<{
127
+ state: z.ZodLiteral<"unavailable">;
128
+ }, z.core.$strip>], "state">;
129
+ export type CapabilityHealthReport = z.output<typeof CapabilityHealthReport>;
130
+ /** A manifest entry's health as the wire carries it: the #317 fields, plus the flag #350 added. */
131
+ export interface CapabilityHealthWire {
132
+ /** The closed vocabulary this capability may report. Empty when it declares none. */
133
+ healthKeys: readonly HealthSummaryKey[];
134
+ /** The values this caller may see, or null when there are none to give. Null is never zero. */
135
+ health: HealthSummary | null;
136
+ /** Whether producing the summary failed on this read. */
137
+ healthUnavailable: boolean;
138
+ }
139
+ /**
140
+ * Read the four states off a manifest entry.
141
+ *
142
+ * **The failure flag is checked first and wins.** A Worker that sends both a failure and values is
143
+ * describing a producer that did not finish, and reading what it sent anyway is reading whatever the
144
+ * failure left behind.
145
+ *
146
+ * A Worker deployed before #350 sends no flag, which defaults to false, and lands on the three states
147
+ * it already had. A Worker deployed before #317 sends neither field and lands on `undeclared`.
148
+ */
149
+ export declare function healthReport(entry: CapabilityHealthWire): CapabilityHealthReport;
150
+ /**
151
+ * Put a report back on the wire.
152
+ *
153
+ * The one place the two fields are written, so a handler cannot set the values and forget the flag.
154
+ * `undeclared` and `withheld` encode alike on purpose — `healthKeys` rides in the same entry and tells
155
+ * them apart, which is the arrangement #317 chose and this does not disturb.
156
+ */
157
+ export declare function healthWire(report: CapabilityHealthReport): {
158
+ health: HealthSummary | null;
159
+ healthUnavailable: boolean;
160
+ };
161
+ /** One value with the declaration that says how to render it. */
162
+ export interface NamedHealthValue {
163
+ /** The declaration — its kind, its closed list, what it means, and what it cost. */
164
+ key: HealthSummaryKey;
165
+ /** The scalar reported for it. */
166
+ value: HealthSummaryValue;
167
+ }
168
+ /**
169
+ * Pair a capability's reported values with their declarations, dropping any value nothing declares.
170
+ *
171
+ * This is how "an unknown summary key is renderable as nothing rather than as an error" is real rather
172
+ * than aspirational: a client renders what this returns, so a key from a Worker newer than its
173
+ * declaration simply is not in the list.
174
+ *
175
+ * **Only `reported` has values.** A withheld summary and a failed one both name nothing here, which is
176
+ * right for a list of numbers — and it is why a surface that must say *why* there is no number reads
177
+ * `state` rather than the length of this.
178
+ */
179
+ export declare function namedHealthValues(descriptor: {
180
+ healthKeys: readonly HealthSummaryKey[];
181
+ health: CapabilityHealthReport;
182
+ }): NamedHealthValue[];
183
+ /**
184
+ * Where one value stands against its own declaration — #471.
185
+ *
186
+ * Three answers, and the third is the reason this exists.
187
+ *
188
+ * - `nominal` — the value is what the capability said it should be.
189
+ * - `attention` — it is not.
190
+ * - `unknowable` — **nobody said what it should be**, so nothing can be concluded.
191
+ *
192
+ * **`unknowable` is never `nominal`, and a client must not collapse them.** A key that declares no
193
+ * bound is a key nobody can grade; answering `nominal` for it would let a management client read
194
+ * healthy because nothing told it otherwise, which is the defect this whole field was filed to remove
195
+ * rather than relocate. #350 made the four report states a discriminated union for the same reason —
196
+ * so a consumer that forgets the sick case gets a type error instead of a screen that lies — and this
197
+ * is the same choice one level down.
198
+ *
199
+ * It is also the answer for a value whose **type** contradicts its `kind` — a string where a count was
200
+ * declared. `checked()` refuses that on the producing side, but a client parses manifests from Workers
201
+ * it does not control, and grading a value that is not the kind of thing being graded is inventing an
202
+ * answer about it.
203
+ *
204
+ * **A `state` value outside its own `states` is a different case and is `attention`, deliberately.** It
205
+ * is a string, so it is the kind of thing being graded; it is simply not one the capability said it
206
+ * would send. Answering `unknowable` there would file a Worker reporting `storeState: "exploded"` under
207
+ * *nothing can be concluded*, when what can be concluded is that something is wrong.
208
+ */
209
+ export type HealthStanding = "nominal" | "attention" | "unknowable";
210
+ /** Where {@link HealthSummaryValue} stands against the key that declared it. See {@link HealthStanding}. */
211
+ export declare function standingOf(key: HealthSummaryKey, value: HealthSummaryValue): HealthStanding;
212
+ /**
213
+ * Every value this capability reported that wants somebody's attention, in declaration order.
214
+ *
215
+ * `namedHealthValues` one filter later, and here rather than in every client so the filter is written
216
+ * once. The three stateless reports answer empty: `undeclared`, `withheld` and `unavailable` are states
217
+ * of the *report* rather than of any value, and folding one of them into a list of graded measures is
218
+ * exactly the collapse #350 and #471 each exist to prevent — a withheld number is not a bad number, and
219
+ * a failed read is not a finding about the thing that failed to be read.
220
+ *
221
+ * A value standing at `unknowable` is not here either. The list is what wants attention, and a measure
222
+ * nobody grades cannot want it.
223
+ *
224
+ * **So an empty list is not a clean bill of health, and a client that renders it as one has rebuilt
225
+ * #471 one layer up.** Five situations answer `[]`: nothing declared, withheld, unavailable, everything
226
+ * nominal, and everything ungradeable. Three of those are *could not look* rather than *nothing is
227
+ * wrong*. A surface that wants to tell them apart has what it needs — the report's own state separates
228
+ * the first three, and mapping {@link namedHealthValues} through {@link standingOf} separates the last
229
+ * two — but it has to ask, and this function deliberately does not answer it.
230
+ */
231
+ export declare function healthAttention(descriptor: {
232
+ healthKeys: readonly HealthSummaryKey[];
233
+ health: CapabilityHealthReport;
234
+ }): NamedHealthValue[];
235
+ export {};
236
+ //# sourceMappingURL=healthSummary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"healthSummary.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/discovery/healthSummary.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuExB,yCAAyC;AACzC,eAAO,M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