@czap/core 0.1.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 (372) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -0
  3. package/dist/addressed-digest.d.ts +15 -0
  4. package/dist/addressed-digest.d.ts.map +1 -0
  5. package/dist/addressed-digest.js +35 -0
  6. package/dist/addressed-digest.js.map +1 -0
  7. package/dist/animation.d.ts +46 -0
  8. package/dist/animation.d.ts.map +1 -0
  9. package/dist/animation.js +70 -0
  10. package/dist/animation.js.map +1 -0
  11. package/dist/assembly.d.ts +25 -0
  12. package/dist/assembly.d.ts.map +1 -0
  13. package/dist/assembly.js +58 -0
  14. package/dist/assembly.js.map +1 -0
  15. package/dist/av-bridge.d.ts +74 -0
  16. package/dist/av-bridge.d.ts.map +1 -0
  17. package/dist/av-bridge.js +107 -0
  18. package/dist/av-bridge.js.map +1 -0
  19. package/dist/av-renderer.d.ts +56 -0
  20. package/dist/av-renderer.d.ts.map +1 -0
  21. package/dist/av-renderer.js +65 -0
  22. package/dist/av-renderer.js.map +1 -0
  23. package/dist/blend.d.ts +61 -0
  24. package/dist/blend.d.ts.map +1 -0
  25. package/dist/blend.js +100 -0
  26. package/dist/blend.js.map +1 -0
  27. package/dist/boundary.d.ts +154 -0
  28. package/dist/boundary.d.ts.map +1 -0
  29. package/dist/boundary.js +269 -0
  30. package/dist/boundary.js.map +1 -0
  31. package/dist/brands.d.ts +63 -0
  32. package/dist/brands.d.ts.map +1 -0
  33. package/dist/brands.js +31 -0
  34. package/dist/brands.js.map +1 -0
  35. package/dist/caps.d.ts +49 -0
  36. package/dist/caps.d.ts.map +1 -0
  37. package/dist/caps.js +73 -0
  38. package/dist/caps.js.map +1 -0
  39. package/dist/capsule.d.ts +77 -0
  40. package/dist/capsule.d.ts.map +1 -0
  41. package/dist/capsule.js +18 -0
  42. package/dist/capsule.js.map +1 -0
  43. package/dist/capsules/boundary-evaluate.d.ts +28 -0
  44. package/dist/capsules/boundary-evaluate.d.ts.map +1 -0
  45. package/dist/capsules/boundary-evaluate.js +117 -0
  46. package/dist/capsules/boundary-evaluate.js.map +1 -0
  47. package/dist/capsules/canonical-cbor.d.ts +13 -0
  48. package/dist/capsules/canonical-cbor.d.ts.map +1 -0
  49. package/dist/capsules/canonical-cbor.js +60 -0
  50. package/dist/capsules/canonical-cbor.js.map +1 -0
  51. package/dist/capsules/token-buffer.d.ts +24 -0
  52. package/dist/capsules/token-buffer.d.ts.map +1 -0
  53. package/dist/capsules/token-buffer.js +53 -0
  54. package/dist/capsules/token-buffer.js.map +1 -0
  55. package/dist/capture.d.ts +40 -0
  56. package/dist/capture.d.ts.map +1 -0
  57. package/dist/capture.js +10 -0
  58. package/dist/capture.js.map +1 -0
  59. package/dist/cbor.d.ts +33 -0
  60. package/dist/cbor.d.ts.map +1 -0
  61. package/dist/cbor.js +179 -0
  62. package/dist/cbor.js.map +1 -0
  63. package/dist/cell.d.ts +53 -0
  64. package/dist/cell.d.ts.map +1 -0
  65. package/dist/cell.js +83 -0
  66. package/dist/cell.js.map +1 -0
  67. package/dist/codec.d.ts +30 -0
  68. package/dist/codec.d.ts.map +1 -0
  69. package/dist/codec.js +25 -0
  70. package/dist/codec.js.map +1 -0
  71. package/dist/component.d.ts +52 -0
  72. package/dist/component.d.ts.map +1 -0
  73. package/dist/component.js +44 -0
  74. package/dist/component.js.map +1 -0
  75. package/dist/composable.d.ts +76 -0
  76. package/dist/composable.d.ts.map +1 -0
  77. package/dist/composable.js +221 -0
  78. package/dist/composable.js.map +1 -0
  79. package/dist/compositor-pool.d.ts +74 -0
  80. package/dist/compositor-pool.d.ts.map +1 -0
  81. package/dist/compositor-pool.js +119 -0
  82. package/dist/compositor-pool.js.map +1 -0
  83. package/dist/compositor.d.ts +90 -0
  84. package/dist/compositor.d.ts.map +1 -0
  85. package/dist/compositor.js +278 -0
  86. package/dist/compositor.js.map +1 -0
  87. package/dist/config.d.ts +72 -0
  88. package/dist/config.d.ts.map +1 -0
  89. package/dist/config.js +97 -0
  90. package/dist/config.js.map +1 -0
  91. package/dist/dag.d.ts +251 -0
  92. package/dist/dag.d.ts.map +1 -0
  93. package/dist/dag.js +450 -0
  94. package/dist/dag.js.map +1 -0
  95. package/dist/defaults.d.ts +45 -0
  96. package/dist/defaults.d.ts.map +1 -0
  97. package/dist/defaults.js +45 -0
  98. package/dist/defaults.js.map +1 -0
  99. package/dist/derived.d.ts +34 -0
  100. package/dist/derived.d.ts.map +1 -0
  101. package/dist/derived.js +101 -0
  102. package/dist/derived.js.map +1 -0
  103. package/dist/diagnostics.d.ts +77 -0
  104. package/dist/diagnostics.d.ts.map +1 -0
  105. package/dist/diagnostics.js +122 -0
  106. package/dist/diagnostics.js.map +1 -0
  107. package/dist/dirty.d.ts +55 -0
  108. package/dist/dirty.d.ts.map +1 -0
  109. package/dist/dirty.js +80 -0
  110. package/dist/dirty.js.map +1 -0
  111. package/dist/easing.d.ts +55 -0
  112. package/dist/easing.d.ts.map +1 -0
  113. package/dist/easing.js +291 -0
  114. package/dist/easing.js.map +1 -0
  115. package/dist/ecs.d.ts +105 -0
  116. package/dist/ecs.d.ts.map +1 -0
  117. package/dist/ecs.js +245 -0
  118. package/dist/ecs.js.map +1 -0
  119. package/dist/fnv.d.ts +14 -0
  120. package/dist/fnv.d.ts.map +1 -0
  121. package/dist/fnv.js +28 -0
  122. package/dist/fnv.js.map +1 -0
  123. package/dist/frame-budget.d.ts +73 -0
  124. package/dist/frame-budget.d.ts.map +1 -0
  125. package/dist/frame-budget.js +114 -0
  126. package/dist/frame-budget.js.map +1 -0
  127. package/dist/gen-frame.d.ts +102 -0
  128. package/dist/gen-frame.d.ts.map +1 -0
  129. package/dist/gen-frame.js +121 -0
  130. package/dist/gen-frame.js.map +1 -0
  131. package/dist/harness/arbitrary-from-schema.d.ts +28 -0
  132. package/dist/harness/arbitrary-from-schema.d.ts.map +1 -0
  133. package/dist/harness/arbitrary-from-schema.js +262 -0
  134. package/dist/harness/arbitrary-from-schema.js.map +1 -0
  135. package/dist/harness/cached-projection.d.ts +19 -0
  136. package/dist/harness/cached-projection.d.ts.map +1 -0
  137. package/dist/harness/cached-projection.js +39 -0
  138. package/dist/harness/cached-projection.js.map +1 -0
  139. package/dist/harness/index.d.ts +16 -0
  140. package/dist/harness/index.d.ts.map +1 -0
  141. package/dist/harness/index.js +15 -0
  142. package/dist/harness/index.js.map +1 -0
  143. package/dist/harness/policy-gate.d.ts +18 -0
  144. package/dist/harness/policy-gate.d.ts.map +1 -0
  145. package/dist/harness/policy-gate.js +46 -0
  146. package/dist/harness/policy-gate.js.map +1 -0
  147. package/dist/harness/pure-transform.d.ts +42 -0
  148. package/dist/harness/pure-transform.d.ts.map +1 -0
  149. package/dist/harness/pure-transform.js +76 -0
  150. package/dist/harness/pure-transform.js.map +1 -0
  151. package/dist/harness/receipted-mutation.d.ts +23 -0
  152. package/dist/harness/receipted-mutation.d.ts.map +1 -0
  153. package/dist/harness/receipted-mutation.js +52 -0
  154. package/dist/harness/receipted-mutation.js.map +1 -0
  155. package/dist/harness/scene-composition.d.ts +19 -0
  156. package/dist/harness/scene-composition.d.ts.map +1 -0
  157. package/dist/harness/scene-composition.js +47 -0
  158. package/dist/harness/scene-composition.js.map +1 -0
  159. package/dist/harness/site-adapter.d.ts +18 -0
  160. package/dist/harness/site-adapter.d.ts.map +1 -0
  161. package/dist/harness/site-adapter.js +38 -0
  162. package/dist/harness/site-adapter.js.map +1 -0
  163. package/dist/harness/state-machine.d.ts +19 -0
  164. package/dist/harness/state-machine.d.ts.map +1 -0
  165. package/dist/harness/state-machine.js +44 -0
  166. package/dist/harness/state-machine.js.map +1 -0
  167. package/dist/hlc.d.ts +99 -0
  168. package/dist/hlc.d.ts.map +1 -0
  169. package/dist/hlc.js +219 -0
  170. package/dist/hlc.js.map +1 -0
  171. package/dist/index.d.ts +104 -0
  172. package/dist/index.d.ts.map +1 -0
  173. package/dist/index.js +137 -0
  174. package/dist/index.js.map +1 -0
  175. package/dist/interpolate.d.ts +14 -0
  176. package/dist/interpolate.d.ts.map +1 -0
  177. package/dist/interpolate.js +31 -0
  178. package/dist/interpolate.js.map +1 -0
  179. package/dist/live-cell.d.ts +46 -0
  180. package/dist/live-cell.d.ts.map +1 -0
  181. package/dist/live-cell.js +154 -0
  182. package/dist/live-cell.js.map +1 -0
  183. package/dist/op.d.ts +58 -0
  184. package/dist/op.d.ts.map +1 -0
  185. package/dist/op.js +171 -0
  186. package/dist/op.js.map +1 -0
  187. package/dist/plan.d.ts +195 -0
  188. package/dist/plan.d.ts.map +1 -0
  189. package/dist/plan.js +211 -0
  190. package/dist/plan.js.map +1 -0
  191. package/dist/protocol.d.ts +33 -0
  192. package/dist/protocol.d.ts.map +1 -0
  193. package/dist/protocol.js +10 -0
  194. package/dist/protocol.js.map +1 -0
  195. package/dist/quantizer-types.d.ts +28 -0
  196. package/dist/quantizer-types.d.ts.map +1 -0
  197. package/dist/quantizer-types.js +9 -0
  198. package/dist/quantizer-types.js.map +1 -0
  199. package/dist/receipt.d.ts +294 -0
  200. package/dist/receipt.d.ts.map +1 -0
  201. package/dist/receipt.js +352 -0
  202. package/dist/receipt.js.map +1 -0
  203. package/dist/runtime-coordinator.d.ts +75 -0
  204. package/dist/runtime-coordinator.d.ts.map +1 -0
  205. package/dist/runtime-coordinator.js +149 -0
  206. package/dist/runtime-coordinator.js.map +1 -0
  207. package/dist/scheduler.d.ts +58 -0
  208. package/dist/scheduler.d.ts.map +1 -0
  209. package/dist/scheduler.js +109 -0
  210. package/dist/scheduler.js.map +1 -0
  211. package/dist/ship-capsule.d.ts +54 -0
  212. package/dist/ship-capsule.d.ts.map +1 -0
  213. package/dist/ship-capsule.js +142 -0
  214. package/dist/ship-capsule.js.map +1 -0
  215. package/dist/ship-manifest.d.ts +45 -0
  216. package/dist/ship-manifest.d.ts.map +1 -0
  217. package/dist/ship-manifest.js +175 -0
  218. package/dist/ship-manifest.js.map +1 -0
  219. package/dist/signal.d.ts +149 -0
  220. package/dist/signal.d.ts.map +1 -0
  221. package/dist/signal.js +277 -0
  222. package/dist/signal.js.map +1 -0
  223. package/dist/speculative.d.ts +67 -0
  224. package/dist/speculative.d.ts.map +1 -0
  225. package/dist/speculative.js +139 -0
  226. package/dist/speculative.js.map +1 -0
  227. package/dist/store.d.ts +39 -0
  228. package/dist/store.d.ts.map +1 -0
  229. package/dist/store.js +42 -0
  230. package/dist/store.js.map +1 -0
  231. package/dist/style.d.ts +119 -0
  232. package/dist/style.d.ts.map +1 -0
  233. package/dist/style.js +168 -0
  234. package/dist/style.js.map +1 -0
  235. package/dist/testing.d.ts +14 -0
  236. package/dist/testing.d.ts.map +1 -0
  237. package/dist/testing.js +14 -0
  238. package/dist/testing.js.map +1 -0
  239. package/dist/theme.d.ts +78 -0
  240. package/dist/theme.d.ts.map +1 -0
  241. package/dist/theme.js +109 -0
  242. package/dist/theme.js.map +1 -0
  243. package/dist/timeline.d.ts +45 -0
  244. package/dist/timeline.d.ts.map +1 -0
  245. package/dist/timeline.js +101 -0
  246. package/dist/timeline.js.map +1 -0
  247. package/dist/token-buffer.d.ts +43 -0
  248. package/dist/token-buffer.d.ts.map +1 -0
  249. package/dist/token-buffer.js +112 -0
  250. package/dist/token-buffer.js.map +1 -0
  251. package/dist/token.d.ts +107 -0
  252. package/dist/token.d.ts.map +1 -0
  253. package/dist/token.js +143 -0
  254. package/dist/token.js.map +1 -0
  255. package/dist/tuple.d.ts +16 -0
  256. package/dist/tuple.d.ts.map +1 -0
  257. package/dist/tuple.js +16 -0
  258. package/dist/tuple.js.map +1 -0
  259. package/dist/type-utils.d.ts +41 -0
  260. package/dist/type-utils.d.ts.map +1 -0
  261. package/dist/type-utils.js +10 -0
  262. package/dist/type-utils.js.map +1 -0
  263. package/dist/typed-ref.d.ts +50 -0
  264. package/dist/typed-ref.d.ts.map +1 -0
  265. package/dist/typed-ref.js +59 -0
  266. package/dist/typed-ref.js.map +1 -0
  267. package/dist/ui-quality.d.ts +50 -0
  268. package/dist/ui-quality.d.ts.map +1 -0
  269. package/dist/ui-quality.js +64 -0
  270. package/dist/ui-quality.js.map +1 -0
  271. package/dist/validation-error.d.ts +25 -0
  272. package/dist/validation-error.d.ts.map +1 -0
  273. package/dist/validation-error.js +32 -0
  274. package/dist/validation-error.js.map +1 -0
  275. package/dist/vector-clock.d.ts +46 -0
  276. package/dist/vector-clock.d.ts.map +1 -0
  277. package/dist/vector-clock.js +91 -0
  278. package/dist/vector-clock.js.map +1 -0
  279. package/dist/video.d.ts +62 -0
  280. package/dist/video.d.ts.map +1 -0
  281. package/dist/video.js +59 -0
  282. package/dist/video.js.map +1 -0
  283. package/dist/wasm-dispatch.d.ts +52 -0
  284. package/dist/wasm-dispatch.d.ts.map +1 -0
  285. package/dist/wasm-dispatch.js +204 -0
  286. package/dist/wasm-dispatch.js.map +1 -0
  287. package/dist/wasm-fallback.d.ts +19 -0
  288. package/dist/wasm-fallback.d.ts.map +1 -0
  289. package/dist/wasm-fallback.js +93 -0
  290. package/dist/wasm-fallback.js.map +1 -0
  291. package/dist/wire.d.ts +49 -0
  292. package/dist/wire.d.ts.map +1 -0
  293. package/dist/wire.js +201 -0
  294. package/dist/wire.js.map +1 -0
  295. package/dist/zap.d.ts +42 -0
  296. package/dist/zap.d.ts.map +1 -0
  297. package/dist/zap.js +172 -0
  298. package/dist/zap.js.map +1 -0
  299. package/package.json +71 -0
  300. package/src/addressed-digest.ts +48 -0
  301. package/src/animation.ts +103 -0
  302. package/src/assembly.ts +76 -0
  303. package/src/av-bridge.ts +161 -0
  304. package/src/av-renderer.ts +118 -0
  305. package/src/blend.ts +135 -0
  306. package/src/boundary.ts +363 -0
  307. package/src/brands.ts +86 -0
  308. package/src/caps.ts +100 -0
  309. package/src/capsule.ts +95 -0
  310. package/src/capsules/boundary-evaluate.ts +128 -0
  311. package/src/capsules/canonical-cbor.ts +60 -0
  312. package/src/capsules/token-buffer.ts +57 -0
  313. package/src/capture.ts +48 -0
  314. package/src/cbor.ts +199 -0
  315. package/src/cell.ts +130 -0
  316. package/src/codec.ts +39 -0
  317. package/src/component.ts +102 -0
  318. package/src/composable.ts +328 -0
  319. package/src/compositor-pool.ts +162 -0
  320. package/src/compositor.ts +387 -0
  321. package/src/config.ts +157 -0
  322. package/src/dag.ts +527 -0
  323. package/src/defaults.ts +60 -0
  324. package/src/derived.ts +164 -0
  325. package/src/diagnostics.ts +186 -0
  326. package/src/dirty.ts +101 -0
  327. package/src/easing.ts +334 -0
  328. package/src/ecs.ts +382 -0
  329. package/src/fnv.ts +31 -0
  330. package/src/frame-budget.ts +149 -0
  331. package/src/gen-frame.ts +229 -0
  332. package/src/harness/arbitrary-from-schema.ts +270 -0
  333. package/src/harness/cached-projection.ts +46 -0
  334. package/src/harness/index.ts +16 -0
  335. package/src/harness/policy-gate.ts +51 -0
  336. package/src/harness/pure-transform.ts +121 -0
  337. package/src/harness/receipted-mutation.ts +59 -0
  338. package/src/harness/scene-composition.ts +54 -0
  339. package/src/harness/site-adapter.ts +43 -0
  340. package/src/harness/state-machine.ts +49 -0
  341. package/src/hlc.ts +238 -0
  342. package/src/index.ts +274 -0
  343. package/src/interpolate.ts +37 -0
  344. package/src/live-cell.ts +199 -0
  345. package/src/op.ts +233 -0
  346. package/src/plan.ts +317 -0
  347. package/src/protocol.ts +49 -0
  348. package/src/quantizer-types.ts +29 -0
  349. package/src/receipt.ts +444 -0
  350. package/src/runtime-coordinator.ts +230 -0
  351. package/src/scheduler.ts +161 -0
  352. package/src/ship-capsule.ts +191 -0
  353. package/src/signal.ts +345 -0
  354. package/src/speculative.ts +186 -0
  355. package/src/store.ts +77 -0
  356. package/src/style.ts +249 -0
  357. package/src/testing.ts +14 -0
  358. package/src/theme.ts +153 -0
  359. package/src/timeline.ts +146 -0
  360. package/src/token-buffer.ts +151 -0
  361. package/src/token.ts +197 -0
  362. package/src/tuple.ts +19 -0
  363. package/src/type-utils.ts +48 -0
  364. package/src/typed-ref.ts +79 -0
  365. package/src/ui-quality.ts +105 -0
  366. package/src/validation-error.ts +34 -0
  367. package/src/vector-clock.ts +111 -0
  368. package/src/video.ts +106 -0
  369. package/src/wasm-dispatch.ts +300 -0
  370. package/src/wasm-fallback.ts +102 -0
  371. package/src/wire.ts +274 -0
  372. package/src/zap.ts +241 -0
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Branded type factories for `@czap/core`.
3
+ *
4
+ * All custom brands use unique symbols for nominal typing safety.
5
+ * Brand helpers produce branded wrappers at zero runtime cost.
6
+ *
7
+ * Types are re-anchored from `@czap/_spine` (the canonical source) via local
8
+ * type aliases so the names remain valid value exports (runtime constructors)
9
+ * in the same module without triggering `isolatedModules` conflicts.
10
+ *
11
+ * @module
12
+ */
13
+ import type { SignalInput as _SignalInput, ThresholdValue as _ThresholdValue, StateName as _StateName, ContentAddress as _ContentAddress, IntegrityDigest as _IntegrityDigest, AddressedDigest as _AddressedDigest, TokenRef as _TokenRef, Millis as _Millis } from '@czap/_spine';
14
+ /** Branded input signal name. Dot-notation signal path (e.g. viewport.width, prefers-color-scheme). */
15
+ export type SignalInput<I extends string = string> = _SignalInput<I>;
16
+ /** Branded threshold number on a boundary. Finite number on the signal's continuous range. */
17
+ export type ThresholdValue = _ThresholdValue;
18
+ /** Branded state name -- e.g. 'mobile', 'tablet', 'desktop' */
19
+ export type StateName<S extends string = string> = _StateName<S>;
20
+ /**
21
+ * Content-addressed hash.
22
+ * Format: fnv1a:XXXXXXXX (8 hex digits). Computed from CBOR-canonical payload via FNV-1a hash.
23
+ */
24
+ export type ContentAddress = _ContentAddress;
25
+ /**
26
+ * Cryptographic content digest brand. Format: `sha256:<64-hex>` or `blake3:<64-hex>`.
27
+ * The algorithmic complement to ContentAddress for external/release artifacts (ADR-0011).
28
+ */
29
+ export type IntegrityDigest = _IntegrityDigest;
30
+ /** Pair of identity hash + cryptographic digest over the same canonical bytes (ADR-0011). */
31
+ export type AddressedDigest = _AddressedDigest;
32
+ /** Branded token reference name */
33
+ export type TokenRef<N extends string = string> = _TokenRef<N>;
34
+ /**
35
+ * Branded millisecond duration -- forces explicit wrapping of raw numbers at temporal API boundaries.
36
+ * Non-negative millisecond duration. Fractional values allowed. Use Millis(0) for immediate.
37
+ */
38
+ export type Millis = _Millis;
39
+ /** Hybrid Logical Clock */
40
+ export interface HLC {
41
+ readonly wall_ms: number;
42
+ readonly counter: number;
43
+ readonly node_id: string;
44
+ }
45
+ /** Generic brand factory */
46
+ export declare function brand<T, B extends symbol>(value: T): T & {
47
+ readonly [K in B]: true;
48
+ };
49
+ /** Wrap a plain string as a {@link SignalInput} — the one sanctioned cast site for this brand. */
50
+ export declare const SignalInput: <I extends string>(value: I) => SignalInput<I>;
51
+ /** Wrap a plain number as a {@link ThresholdValue} — the one sanctioned cast site for this brand. */
52
+ export declare const ThresholdValue: (value: number) => ThresholdValue;
53
+ /** Wrap a plain string as a {@link StateName} — the one sanctioned cast site for this brand. */
54
+ export declare const StateName: <S extends string>(value: S) => StateName<S>;
55
+ /** Wrap a plain string as a {@link ContentAddress} — the one sanctioned cast site for this brand. */
56
+ export declare const ContentAddress: (value: string) => ContentAddress;
57
+ /** Wrap a plain string as an {@link IntegrityDigest} — the one sanctioned cast site for this brand. */
58
+ export declare const IntegrityDigest: (value: string) => IntegrityDigest;
59
+ /** Wrap a plain string as a {@link TokenRef} — the one sanctioned cast site for this brand. */
60
+ export declare const TokenRef: <N extends string>(value: N) => TokenRef<N>;
61
+ /** Wrap a plain number as a {@link Millis} — the one sanctioned cast site for this brand. */
62
+ export declare const Millis: (value: number) => Millis;
63
+ //# sourceMappingURL=brands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brands.d.ts","sourceRoot":"","sources":["../src/brands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,WAAW,IAAI,YAAY,EAC3B,cAAc,IAAI,eAAe,EACjC,SAAS,IAAI,UAAU,EACvB,cAAc,IAAI,eAAe,EACjC,eAAe,IAAI,gBAAgB,EACnC,eAAe,I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AAO,MAAM,KAAG,cAAyC,CAAC;AACzF,gGAAgG;AAChG,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,EAAE,OAAO,CAAC,KAAG,SAAS,CAAC,CAAC,CAA0B,CAAC;AAC7F,qGAAqG;AACrG,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,cAAyC,CAAC;AACzF,uGAAuG;AACvG,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,KAAG,eAA2C,CAAC;AAC5F,+FAA+F;AAC/F,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,EAAE,OAAO,CAAC,KAAG,QAAQ,CAAC,CAAC,CAAyB,CAAC;AAC1F,6FAA6F;AAC7F,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,KAAG,MAAyB,CAAC"}
package/dist/brands.js ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Branded type factories for `@czap/core`.
3
+ *
4
+ * All custom brands use unique symbols for nominal typing safety.
5
+ * Brand helpers produce branded wrappers at zero runtime cost.
6
+ *
7
+ * Types are re-anchored from `@czap/_spine` (the canonical source) via local
8
+ * type aliases so the names remain valid value exports (runtime constructors)
9
+ * in the same module without triggering `isolatedModules` conflicts.
10
+ *
11
+ * @module
12
+ */
13
+ /** Generic brand factory */
14
+ export function brand(value) {
15
+ return value;
16
+ }
17
+ /** Wrap a plain string as a {@link SignalInput} — the one sanctioned cast site for this brand. */
18
+ export const SignalInput = (value) => value;
19
+ /** Wrap a plain number as a {@link ThresholdValue} — the one sanctioned cast site for this brand. */
20
+ export const ThresholdValue = (value) => value;
21
+ /** Wrap a plain string as a {@link StateName} — the one sanctioned cast site for this brand. */
22
+ export const StateName = (value) => value;
23
+ /** Wrap a plain string as a {@link ContentAddress} — the one sanctioned cast site for this brand. */
24
+ export const ContentAddress = (value) => value;
25
+ /** Wrap a plain string as an {@link IntegrityDigest} — the one sanctioned cast site for this brand. */
26
+ export const IntegrityDigest = (value) => value;
27
+ /** Wrap a plain string as a {@link TokenRef} — the one sanctioned cast site for this brand. */
28
+ export const TokenRef = (value) => value;
29
+ /** Wrap a plain number as a {@link Millis} — the one sanctioned cast site for this brand. */
30
+ export const Millis = (value) => value;
31
+ //# sourceMappingURL=brands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brands.js","sourceRoot":"","sources":["../src/brands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwDH,4BAA4B;AAC5B,MAAM,UAAU,KAAK,CAAsB,KAAQ;IACjD,OAAO,KAAwC,CAAC;AAClD,CAAC;AAED,kGAAkG;AAClG,MAAM,CAAC,MAAM,WAAW,GAAG,CAAmB,KAAQ,EAAkB,EAAE,CAAC,KAAuB,CAAC;AACnG,qGAAqG;AACrG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAkB,EAAE,CAAC,KAAuB,CAAC;AACzF,gGAAgG;AAChG,MAAM,CAAC,MAAM,SAAS,GAAG,CAAmB,KAAQ,EAAgB,EAAE,CAAC,KAAqB,CAAC;AAC7F,qGAAqG;AACrG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAkB,EAAE,CAAC,KAAuB,CAAC;AACzF,uGAAuG;AACvG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAAmB,EAAE,CAAC,KAAwB,CAAC;AAC5F,+FAA+F;AAC/F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAmB,KAAQ,EAAe,EAAE,CAAC,KAAoB,CAAC;AAC1F,6FAA6F;AAC7F,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAe,CAAC"}
package/dist/caps.d.ts ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * CapSet -- capability lattice.
3
+ *
4
+ * Re-parameterized from `@kit`: `pure < read < ... < system` becomes `static < styled < reactive < animated < gpu`.
5
+ *
6
+ * @module
7
+ */
8
+ /**
9
+ * Rung on the rendering-capability ladder. Higher levels imply lower ones:
10
+ * `gpu > animated > reactive > styled > static`.
11
+ */
12
+ export type CapLevel = 'static' | 'styled' | 'reactive' | 'animated' | 'gpu';
13
+ /** Immutable set of {@link CapLevel}s — the tagged value returned by {@link Cap} combinators. */
14
+ export interface CapSet {
15
+ readonly _tag: 'CapSet';
16
+ readonly levels: ReadonlySet<CapLevel>;
17
+ }
18
+ /**
19
+ * Cap — algebra over {@link CapSet}.
20
+ * Pure, immutable helpers for building, combining, and comparing capability
21
+ * sets; the underlying `CapLevel` lattice is totally ordered via {@link Cap.ordinal}.
22
+ */
23
+ export declare const Cap: {
24
+ /** The empty {@link CapSet}. */
25
+ empty: () => CapSet;
26
+ /** Build a {@link CapSet} from an array of {@link CapLevel}s. */
27
+ from: (levels: ReadonlyArray<CapLevel>) => CapSet;
28
+ /** Return a new {@link CapSet} with the given level added. */
29
+ grant: (caps: CapSet, level: CapLevel) => CapSet;
30
+ /** Return a new {@link CapSet} with the given level removed. */
31
+ revoke: (caps: CapSet, level: CapLevel) => CapSet;
32
+ /** Whether a {@link CapSet} contains the given level. */
33
+ has: (caps: CapSet, level: CapLevel) => boolean;
34
+ /** Whether `a` contains every level of `b` (i.e. `a ⊇ b`). */
35
+ superset: (a: CapSet, b: CapSet) => boolean;
36
+ /** Set union of two {@link CapSet}s. */
37
+ union: (a: CapSet, b: CapSet) => CapSet;
38
+ /** Set intersection of two {@link CapSet}s. */
39
+ intersection: (a: CapSet, b: CapSet) => CapSet;
40
+ /** Whether `a` ranks `>=` `b` on the underlying ordered ladder. */
41
+ atLeast: (a: CapLevel, b: CapLevel) => boolean;
42
+ /** Integer ordinal for a {@link CapLevel} — useful for sorting / comparison. */
43
+ ordinal: (level: CapLevel) => number;
44
+ };
45
+ export declare namespace Cap {
46
+ /** Alias for {@link CapSet}. */
47
+ type Shape = CapSet;
48
+ }
49
+ //# sourceMappingURL=caps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caps.d.ts","sourceRoot":"","sources":["../src/caps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,KAAK,CAAC;AAU7E,iGAAiG;AACjG,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;CACxC;AA0CD;;;;GAIG;AACH,eAAO,MAAM,GAAG;IACd,gCAAgC;iBA9Cf,MAAM;IAgDvB,iEAAiE;mBA9C5C,aAAa,CAAC,QAAQ,CAAC,KAAG,MAAM;IAgDrD,8DAA8D;kBA3C1C,MAAM,SAAS,QAAQ,KAAG,MAAM;IA6CpD,gEAAgE;mBAxC3C,MAAM,SAAS,QAAQ,KAAG,MAAM;IA0CrD,yDAAyD;gBArCvC,MAAM,SAAS,QAAQ,KAAG,OAAO;IAuCnD,8DAA8D;kBArC1C,MAAM,KAAK,MAAM,KAAG,OAAO;IAuC/C,wCAAwC;eAhCvB,MAAM,KAAK,MAAM,KAAG,MAAM;IAkC3C,+CAA+C;sBA7BvB,MAAM,KAAK,MAAM,KAAG,MAAM;IA+BlD,mEAAmE;iBA1BhD,QAAQ,KAAK,QAAQ,KAAG,OAAO;IA4BlD,gFAAgF;qBA1BzD,QAAQ,KAAG,MAAM;CA4BzC,CAAC;AAEF,MAAM,CAAC,OAAO,WAAW,GAAG,CAAC;IAC3B,gCAAgC;IAChC,KAAY,KAAK,GAAG,MAAM,CAAC;CAC5B"}
package/dist/caps.js ADDED
@@ -0,0 +1,73 @@
1
+ /**
2
+ * CapSet -- capability lattice.
3
+ *
4
+ * Re-parameterized from `@kit`: `pure < read < ... < system` becomes `static < styled < reactive < animated < gpu`.
5
+ *
6
+ * @module
7
+ */
8
+ const LEVEL_ORD = {
9
+ static: 0,
10
+ styled: 1,
11
+ reactive: 2,
12
+ animated: 3,
13
+ gpu: 4,
14
+ };
15
+ const _empty = () => ({ _tag: 'CapSet', levels: new Set() });
16
+ const _from = (levels) => ({
17
+ _tag: 'CapSet',
18
+ levels: new Set(levels),
19
+ });
20
+ const _grant = (caps, level) => ({
21
+ _tag: 'CapSet',
22
+ levels: new Set([...caps.levels, level]),
23
+ });
24
+ const _revoke = (caps, level) => ({
25
+ _tag: 'CapSet',
26
+ levels: new Set([...caps.levels].filter((l) => l !== level)),
27
+ });
28
+ const _has = (caps, level) => caps.levels.has(level);
29
+ const _superset = (a, b) => {
30
+ for (const level of b.levels) {
31
+ if (!a.levels.has(level))
32
+ return false;
33
+ }
34
+ return true;
35
+ };
36
+ const _union = (a, b) => ({
37
+ _tag: 'CapSet',
38
+ levels: new Set([...a.levels, ...b.levels]),
39
+ });
40
+ const _intersection = (a, b) => ({
41
+ _tag: 'CapSet',
42
+ levels: new Set([...a.levels].filter((l) => b.levels.has(l))),
43
+ });
44
+ const _atLeast = (a, b) => LEVEL_ORD[a] >= LEVEL_ORD[b];
45
+ const _ordinal = (level) => LEVEL_ORD[level];
46
+ /**
47
+ * Cap — algebra over {@link CapSet}.
48
+ * Pure, immutable helpers for building, combining, and comparing capability
49
+ * sets; the underlying `CapLevel` lattice is totally ordered via {@link Cap.ordinal}.
50
+ */
51
+ export const Cap = {
52
+ /** The empty {@link CapSet}. */
53
+ empty: _empty,
54
+ /** Build a {@link CapSet} from an array of {@link CapLevel}s. */
55
+ from: _from,
56
+ /** Return a new {@link CapSet} with the given level added. */
57
+ grant: _grant,
58
+ /** Return a new {@link CapSet} with the given level removed. */
59
+ revoke: _revoke,
60
+ /** Whether a {@link CapSet} contains the given level. */
61
+ has: _has,
62
+ /** Whether `a` contains every level of `b` (i.e. `a ⊇ b`). */
63
+ superset: _superset,
64
+ /** Set union of two {@link CapSet}s. */
65
+ union: _union,
66
+ /** Set intersection of two {@link CapSet}s. */
67
+ intersection: _intersection,
68
+ /** Whether `a` ranks `>=` `b` on the underlying ordered ladder. */
69
+ atLeast: _atLeast,
70
+ /** Integer ordinal for a {@link CapLevel} — useful for sorting / comparison. */
71
+ ordinal: _ordinal,
72
+ };
73
+ //# sourceMappingURL=caps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caps.js","sourceRoot":"","sources":["../src/caps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,MAAM,SAAS,GAA6B;IAC1C,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,GAAG,EAAE,CAAC;CACP,CAAC;AAQF,MAAM,MAAM,GAAG,GAAW,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC;AAErE,MAAM,KAAK,GAAG,CAAC,MAA+B,EAAU,EAAE,CAAC,CAAC;IAC1D,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC;CACxB,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,KAAe,EAAU,EAAE,CAAC,CAAC;IACzD,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CACzC,CAAC,CAAC;AAEH,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,KAAe,EAAU,EAAE,CAAC,CAAC;IAC1D,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;CAC7D,CAAC,CAAC;AAEH,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,KAAe,EAAW,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,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EAAE,IAAI;IACT,8DAA8D;IAC9D,QAAQ,EAAE,SAAS;IACnB,wCAAwC;IACxC,KAAK,EAAE,MAAM;IACb,+CAA+C;IAC/C,YAAY,EAAE,aAAa;IAC3B,mEAAmE;IACnE,OAAO,EAAE,QAAQ;IACjB,gFAAgF;IAChF,OAAO,EAAE,QAAQ;CAClB,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Capsule — typed declaration of a business-logic unit that emits
3
+ * runtime behavior plus generated tests, benches, docs, and audit
4
+ * receipts through the czap factory.
5
+ *
6
+ * @module
7
+ */
8
+ import { type Effect, Schema } from 'effect';
9
+ import type { ContentAddress } from '@czap/_spine';
10
+ /** Closed seven-arm catalog of capsule kinds. Adding an eighth requires ADR amendment. */
11
+ export type AssemblyKind = 'pureTransform' | 'receiptedMutation' | 'stateMachine' | 'siteAdapter' | 'policyGate' | 'cachedProjection' | 'sceneComposition';
12
+ /** Where a capsule may run. */
13
+ export type Site = 'node' | 'browser' | 'worker' | 'edge';
14
+ /** What services a capsule reads / writes. `_R` parameter carried for type-level inference. */
15
+ export interface CapabilityDecl<_R> {
16
+ readonly reads: readonly string[];
17
+ readonly writes: readonly string[];
18
+ readonly effects?: readonly string[];
19
+ }
20
+ /** Performance + memory budgets a capsule promises to honor. */
21
+ export interface BudgetDecl {
22
+ readonly p95Ms?: number;
23
+ readonly memoryMb?: number;
24
+ readonly allocClass?: 'zero' | 'bounded' | 'unbounded';
25
+ }
26
+ /** A typed invariant over input and output that the harness will check. */
27
+ export interface Invariant<In, Out> {
28
+ readonly name: string;
29
+ readonly check: (input: In, output: Out) => boolean;
30
+ readonly message: string;
31
+ }
32
+ /** License and authorship metadata carried for audit receipts. */
33
+ export interface AttributionDecl {
34
+ readonly license: string;
35
+ readonly author: string;
36
+ readonly url?: string;
37
+ }
38
+ /**
39
+ * The contract shape a capsule declaration must satisfy. The factory
40
+ * uses this to generate tests, benches, docs, and audit receipts.
41
+ *
42
+ * `run` is optional: when present, the harness invokes it inside generated
43
+ * property tests so each declared {@link Invariant} is checked against
44
+ * real (input, output) pairs sampled from the input schema. Without `run`
45
+ * the harness emits an `it.skip` honest-placeholder so vacuous tests can't
46
+ * masquerade as proof.
47
+ */
48
+ export interface CapsuleContract<K extends AssemblyKind, In, Out, R> {
49
+ readonly _kind: K;
50
+ readonly id: ContentAddress;
51
+ readonly name: string;
52
+ readonly input: Schema.Schema<In>;
53
+ readonly output: Schema.Schema<Out>;
54
+ readonly capabilities: CapabilityDecl<R>;
55
+ readonly invariants: readonly Invariant<In, Out>[];
56
+ readonly budgets: BudgetDecl;
57
+ readonly site: readonly Site[];
58
+ readonly attribution?: AttributionDecl;
59
+ /**
60
+ * Optional pure-transform handler: takes a decoded input and returns a
61
+ * decoded output. Used by the harness to drive generated property tests
62
+ * end-to-end. Only meaningful for `pureTransform` arms today.
63
+ */
64
+ readonly run?: (input: In) => Out;
65
+ }
66
+ /**
67
+ * Runtime validator that verifies values against _spine-derived schemas.
68
+ * Used by capsule dispatchers to check inputs before invoking handlers.
69
+ */
70
+ export declare const TypeValidator: {
71
+ readonly validate: <T>(schema: Schema.Codec<T, T, never>, value: unknown) => Effect.Effect<T, Schema.SchemaError>;
72
+ };
73
+ export declare namespace TypeValidator {
74
+ /** Effect returned by {@link TypeValidator.validate} on a successful decode. */
75
+ type Result<T> = Effect.Effect<T, Schema.SchemaError>;
76
+ }
77
+ //# sourceMappingURL=capsule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capsule.d.ts","sourceRoot":"","sources":["../src/capsule.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,0FAA0F;AAC1F,MAAM,MAAM,YAAY,GACpB,eAAe,GACf,mBAAmB,GACnB,cAAc,GACd,aAAa,GACb,YAAY,GACZ,kBAAkB,G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IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACpC,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC;IACnD,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,eAAe,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,GAAG,CAAC;CACnC;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa;wBACf,CAAC,UAAU,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,SAAS,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;CAG5F,CAAC;AAEX,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC;IACrC,gFAAgF;IAChF,KAAY,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;CAC9D"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Capsule — typed declaration of a business-logic unit that emits
3
+ * runtime behavior plus generated tests, benches, docs, and audit
4
+ * receipts through the czap factory.
5
+ *
6
+ * @module
7
+ */
8
+ import { Schema } from 'effect';
9
+ /**
10
+ * Runtime validator that verifies values against _spine-derived schemas.
11
+ * Used by capsule dispatchers to check inputs before invoking handlers.
12
+ */
13
+ export const TypeValidator = {
14
+ validate(schema, value) {
15
+ return Schema.decodeUnknownEffect(schema)(value);
16
+ },
17
+ };
18
+ //# sourceMappingURL=capsule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capsule.js","sourceRoot":"","sources":["../src/capsule.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAe,MAAM,EAAE,MAAM,QAAQ,CAAC;AAyE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,QAAQ,CAAI,MAAiC,EAAE,KAAc;QAC3D,OAAO,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;CACO,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Capsule declaration wrapping `Boundary.evaluate` as a `pureTransform`
3
+ * instance. Proves the factory kernel against an existing, well-tested
4
+ * primitive with zero-allocation hot-path discipline.
5
+ *
6
+ * Input schema is structural — the run handler aligns the random
7
+ * thresholds + states arrays into a valid Boundary before evaluating.
8
+ * This way the harness-driven property tests exercise real boundary
9
+ * shapes without requiring the schema layer to encode the
10
+ * (thresholds.length === states.length, ascending, non-empty)
11
+ * invariants directly.
12
+ *
13
+ * @module
14
+ */
15
+ /**
16
+ * Declared capsule for `Boundary.evaluate`. Registered in the module-level
17
+ * catalog at import time; walked by `scripts/capsule-compile.ts` during
18
+ * the gauntlet's `capsule:compile` phase.
19
+ */
20
+ export declare const boundaryEvaluateCapsule: import("../assembly.js").CapsuleDef<"pureTransform", {
21
+ readonly states: readonly string[];
22
+ readonly thresholds: readonly number[];
23
+ readonly value: number;
24
+ }, {
25
+ readonly state: string;
26
+ readonly matched: boolean;
27
+ }, unknown>;
28
+ //# sourceMappingURL=boundary-evaluate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundary-evaluate.d.ts","sourceRoot":"","sources":["../../src/capsules/boundary-evaluate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAkFH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;WA2BlC,CAAC"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Capsule declaration wrapping `Boundary.evaluate` as a `pureTransform`
3
+ * instance. Proves the factory kernel against an existing, well-tested
4
+ * primitive with zero-allocation hot-path discipline.
5
+ *
6
+ * Input schema is structural — the run handler aligns the random
7
+ * thresholds + states arrays into a valid Boundary before evaluating.
8
+ * This way the harness-driven property tests exercise real boundary
9
+ * shapes without requiring the schema layer to encode the
10
+ * (thresholds.length === states.length, ascending, non-empty)
11
+ * invariants directly.
12
+ *
13
+ * @module
14
+ */
15
+ import { Schema } from 'effect';
16
+ import { defineCapsule } from '../assembly.js';
17
+ import { Boundary } from '../boundary.js';
18
+ const EvaluateInputSchema = Schema.Struct({
19
+ // Random arrays — the run handler dedupes states and aligns lengths.
20
+ // We use Schema.Array (not NonEmptyArray) for compatibility with the
21
+ // edge case `length === 0`, which we handle by short-circuiting in run.
22
+ thresholds: Schema.Array(Schema.Number),
23
+ states: Schema.Array(Schema.String),
24
+ value: Schema.Number,
25
+ });
26
+ const EvaluateOutputSchema = Schema.Struct({
27
+ state: Schema.String,
28
+ matched: Schema.Boolean,
29
+ });
30
+ /**
31
+ * Build a valid Boundary from arbitrary input and evaluate it. When the
32
+ * input cannot form a valid boundary (empty states, too few thresholds
33
+ * after dedupe), we emit `{state: '', matched: false}` so invariants
34
+ * downstream can short-circuit on `matched`.
35
+ */
36
+ function _runBoundary(input) {
37
+ // Dedupe state names and clamp to a usable count
38
+ const seenStates = new Set();
39
+ const uniqueStates = [];
40
+ for (const s of input.states) {
41
+ if (!seenStates.has(s)) {
42
+ seenStates.add(s);
43
+ uniqueStates.push(s);
44
+ }
45
+ }
46
+ if (uniqueStates.length === 0) {
47
+ return { state: '', matched: false };
48
+ }
49
+ // Build strictly-ascending thresholds. If we don't have enough unique
50
+ // thresholds for the available states, trim states to fit.
51
+ const sortedThresholds = [...input.thresholds].sort((a, b) => a - b);
52
+ const ascending = [];
53
+ let prev = Number.NEGATIVE_INFINITY;
54
+ for (const t of sortedThresholds) {
55
+ if (Number.isFinite(t) && t > prev) {
56
+ ascending.push(t);
57
+ prev = t;
58
+ }
59
+ }
60
+ // Boundary.make requires at least one [threshold, state] pair.
61
+ if (ascending.length === 0) {
62
+ // Fabricate a single-anchor boundary at 0 with the first state.
63
+ const onlyState = uniqueStates[0];
64
+ const b = Boundary.make({
65
+ input: 'cap.boundary-evaluate',
66
+ at: [[0, onlyState]],
67
+ });
68
+ const state = Boundary.evaluate(b, input.value);
69
+ return { state, matched: true };
70
+ }
71
+ const usableLen = Math.min(ascending.length, uniqueStates.length);
72
+ const pairs = [];
73
+ for (let i = 0; i < usableLen; i++) {
74
+ pairs.push([ascending[i], uniqueStates[i]]);
75
+ }
76
+ const b = Boundary.make({
77
+ input: 'cap.boundary-evaluate',
78
+ at: pairs,
79
+ });
80
+ const state = Boundary.evaluate(b, input.value);
81
+ return { state, matched: true };
82
+ }
83
+ /**
84
+ * Declared capsule for `Boundary.evaluate`. Registered in the module-level
85
+ * catalog at import time; walked by `scripts/capsule-compile.ts` during
86
+ * the gauntlet's `capsule:compile` phase.
87
+ */
88
+ export const boundaryEvaluateCapsule = defineCapsule({
89
+ _kind: 'pureTransform',
90
+ name: 'core.boundary.evaluate',
91
+ input: EvaluateInputSchema,
92
+ output: EvaluateOutputSchema,
93
+ capabilities: { reads: [], writes: [] },
94
+ invariants: [
95
+ {
96
+ name: 'state-from-input-states-when-matched',
97
+ check: (input, output) => {
98
+ // When the run handler reports `matched`, the emitted state
99
+ // must be one of the input.states (after dedupe). When unmatched,
100
+ // the invariant trivially holds.
101
+ if (!output.matched)
102
+ return true;
103
+ return input.states.includes(output.state);
104
+ },
105
+ message: 'emitted state must be one of input.states',
106
+ },
107
+ {
108
+ name: 'unmatched-implies-empty-state',
109
+ check: (_input, output) => output.matched || output.state === '',
110
+ message: 'unmatched outcomes must use empty-string state',
111
+ },
112
+ ],
113
+ budgets: { p95Ms: 0.1, allocClass: 'zero' },
114
+ site: ['node', 'browser', 'worker'],
115
+ run: (input) => _runBoundary(input),
116
+ });
117
+ //# sourceMappingURL=boundary-evaluate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundary-evaluate.js","sourceRoot":"","sources":["../../src/capsules/boundary-evaluate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,qEAAqE;IACrE,qEAAqE;IACrE,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC,MAAM;CACrB,CAAC,CAAC;AACH,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,OAAO,EAAE,MAAM,CAAC,OAAO;CACxB,CAAC,CAAC;AASH;;;;;GAKG;AACH,SAAS,YAAY,CAAC,KAAoB;IACxC,iDAAiD;IACjD,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IACrC,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAC7B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACvB,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAClB,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IACD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,K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,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE;IAC3C,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC;IACnC,GAAG,EAAE,CAAC,KAAoB,EAAkB,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;CACnE,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Capsule declaration wrapping CanonicalCbor as a `pureTransform`. Anchors
3
+ * the content-address kernel inside the 7-arm factory so the harness can
4
+ * audit the encoder alongside boundary evaluation and token buffering.
5
+ *
6
+ * @module
7
+ */
8
+ /**
9
+ * Declared capsule for `CanonicalCbor.encode`. Registered in the module-level
10
+ * catalog at import time; walked by the factory compiler.
11
+ */
12
+ export declare const canonicalCborCapsule: import("../assembly.js").CapsuleDef<"pureTransform", unknown, Uint8Array<ArrayBufferLike>, unknown>;
13
+ //# sourceMappingURL=canonical-cbor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical-cbor.d.ts","sourceRoot":"","sources":["../../src/capsules/canonical-cbor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,qGA2C/B,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Capsule declaration wrapping CanonicalCbor as a `pureTransform`. Anchors
3
+ * the content-address kernel inside the 7-arm factory so the harness can
4
+ * audit the encoder alongside boundary evaluation and token buffering.
5
+ *
6
+ * @module
7
+ */
8
+ import { Schema } from 'effect';
9
+ import { defineCapsule } from '../assembly.js';
10
+ import { CanonicalCbor } from '../cbor.js';
11
+ /**
12
+ * Declared capsule for `CanonicalCbor.encode`. Registered in the module-level
13
+ * catalog at import time; walked by the factory compiler.
14
+ */
15
+ export const canonicalCborCapsule = defineCapsule({
16
+ _kind: 'pureTransform',
17
+ name: 'core.canonical-cbor',
18
+ input: Schema.Unknown,
19
+ output: Schema.instanceOf(Uint8Array),
20
+ capabilities: { reads: [], writes: [] },
21
+ invariants: [
22
+ {
23
+ name: 'output-is-uint8array',
24
+ check: (_input, output) => output instanceof Uint8Array,
25
+ message: 'encoder output must be Uint8Array',
26
+ },
27
+ {
28
+ name: 'key-order-stable',
29
+ check: (input, output) => {
30
+ // For plain objects, re-encoding a key-permuted shallow copy must
31
+ // produce identical bytes. Cheap structural check that binds the
32
+ // capsule's intent (canonical key order) to its observable output.
33
+ if (input === null || typeof input !== 'object' || Array.isArray(input) || input instanceof Uint8Array) {
34
+ return true;
35
+ }
36
+ const keys = Object.keys(input);
37
+ if (keys.length < 2)
38
+ return true;
39
+ // Use Object.fromEntries to build the reversed copy so dangerous keys
40
+ // like '__proto__' become own properties (not prototype assignments).
41
+ // Mutating `reversed[k] = ...` would set the prototype for k === '__proto__'
42
+ // and silently produce a different object shape than the input had.
43
+ const reversed = Object.fromEntries([...keys].reverse().map((k) => [k, input[k]]));
44
+ const reencoded = CanonicalCbor.encode(reversed);
45
+ if (reencoded.length !== output.length)
46
+ return false;
47
+ for (let i = 0; i < output.length; i++) {
48
+ if (reencoded[i] !== output[i])
49
+ return false;
50
+ }
51
+ return true;
52
+ },
53
+ message: 'encoded output must be invariant under key permutation',
54
+ },
55
+ ],
56
+ budgets: { p95Ms: 1, allocClass: 'bounded' },
57
+ site: ['node', 'browser', 'worker', 'edge'],
58
+ run: (input) => CanonicalCbor.encode(input),
59
+ });
60
+ //# sourceMappingURL=canonical-cbor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical-cbor.js","sourceRoot":"","sources":["../../src/capsules/canonical-cbor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC;IAChD,KAAK,EAAE,eAAe;I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IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBACvC,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;wBAAE,OAAO,KAAK,CAAC;gBAC/C,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,EAAE,wDAAwD;SAClE;KACF;IACD,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE;IAC5C,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC;IAC3C,GAAG,EAAE,CAAC,KAAc,EAAc,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;CACjE,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Capsule declaration wrapping TokenBuffer as a stateMachine.
3
+ * Proves the factory kernel against a stateful LLM-token primitive
4
+ * with bounded-allocation discipline.
5
+ *
6
+ * @module
7
+ */
8
+ /**
9
+ * Declared capsule for TokenBuffer. Registered in the module-level
10
+ * catalog at import time; walked by the factory compiler.
11
+ */
12
+ export declare const tokenBufferCapsule: import("../assembly.js").CapsuleDef<"stateMachine", {
13
+ readonly _tag: "push";
14
+ readonly token: string;
15
+ } | {
16
+ readonly _tag: "flush";
17
+ } | {
18
+ readonly _tag: "reset";
19
+ }, {
20
+ readonly phase: "idle" | "buffering" | "draining";
21
+ readonly tokens: readonly string[];
22
+ readonly totalBytes: number;
23
+ }, unknown>;
24
+ //# sourceMappingURL=token-buffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-buffer.d.ts","sourceRoot":"","sources":["../../src/capsules/token-buffer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;WA2B7B,CAAC"}