@things-factory/figure-service 10.1.208 → 10.1.210

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 (253) hide show
  1. package/dist-server/service/figure/figure-context.d.ts +2 -1
  2. package/dist-server/service/figure/figure-context.js +2 -1
  3. package/dist-server/service/figure/figure-context.js.map +1 -1
  4. package/dist-server/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +3 -3
  6. package/recipes/_lib/model.mts +12 -8
  7. package/recipes/air-cylinder/models/default.json +1 -1
  8. package/recipes/air-cylinder/recipe.json +13 -10
  9. package/recipes/air-cylinder/spec.json +1 -1
  10. package/recipes/air-shower/models/default.json +1 -1
  11. package/recipes/air-shower/recipe.json +11 -8
  12. package/recipes/barrier-gate/models/default.json +1 -1
  13. package/recipes/barrier-gate/recipe.json +11 -7
  14. package/recipes/base-frame/models/default.json +1 -1
  15. package/recipes/base-frame/recipe.json +0 -4
  16. package/recipes/belt-surface/models/default.json +1 -1
  17. package/recipes/belt-surface/recipe.json +0 -1
  18. package/recipes/bin-row/models/default.json +1 -1
  19. package/recipes/bin-row/recipe.json +0 -1
  20. package/recipes/bollard-row/models/default.json +1 -1
  21. package/recipes/bollard-row/recipe.json +0 -1
  22. package/recipes/buzzer/models/default.json +1 -1
  23. package/recipes/buzzer/recipe.json +0 -1
  24. package/recipes/cabinet-doors/build.mts +1 -1
  25. package/recipes/cabinet-doors/models/default.json +1 -1
  26. package/recipes/cabinet-doors/models/doors=1.json +1 -1
  27. package/recipes/cabinet-doors/models/doors=2.json +1 -1
  28. package/recipes/cabinet-doors/recipe.json +21 -13
  29. package/recipes/cable-tray/models/default.json +1 -1
  30. package/recipes/cable-tray/recipe.json +0 -3
  31. package/recipes/camera-mount/models/default.json +1 -1
  32. package/recipes/camera-mount/recipe.json +11 -8
  33. package/recipes/canopy/models/default.json +1 -1
  34. package/recipes/canopy/recipe.json +0 -5
  35. package/recipes/cart/models/default.json +1 -1
  36. package/recipes/cart/recipe.json +0 -12
  37. package/recipes/cart-handle/models/default.json +1 -1
  38. package/recipes/cart-handle/recipe.json +0 -3
  39. package/recipes/casters-four/models/default.json +1 -1
  40. package/recipes/casters-four/recipe.json +0 -8
  41. package/recipes/ceiling-rail-carriage/build.mts +1 -1
  42. package/recipes/ceiling-rail-carriage/models/default.json +1 -1
  43. package/recipes/ceiling-rail-carriage/recipe.json +19 -16
  44. package/recipes/chain-rails/models/default.json +1 -1
  45. package/recipes/chain-rails/recipe.json +0 -2
  46. package/recipes/charging-station/models/default.json +1 -1
  47. package/recipes/charging-station/recipe.json +0 -2
  48. package/recipes/column-row/models/default.json +1 -1
  49. package/recipes/column-row/recipe.json +0 -1
  50. package/recipes/control-cabinet/models/default.json +1 -1
  51. package/recipes/control-cabinet/recipe.json +11 -8
  52. package/recipes/conveyor-skirts/models/default.json +1 -1
  53. package/recipes/conveyor-skirts/recipe.json +0 -2
  54. package/recipes/counter-display/models/default.json +1 -1
  55. package/recipes/counter-display/recipe.json +0 -2
  56. package/recipes/dock-bumpers/models/default.json +1 -1
  57. package/recipes/dock-bumpers/recipe.json +0 -2
  58. package/recipes/dock-leveler/models/default.json +1 -1
  59. package/recipes/dock-leveler/recipe.json +11 -7
  60. package/recipes/double-hinged-door/build.mts +1 -1
  61. package/recipes/double-hinged-door/models/default.json +1 -1
  62. package/recipes/double-hinged-door/recipe.json +21 -14
  63. package/recipes/drawer-stack/models/default.json +1 -1
  64. package/recipes/drawer-stack/models/drawers=2.json +1 -1
  65. package/recipes/drawer-stack/models/drawers=3.json +1 -1
  66. package/recipes/drawer-stack/models/drawers=4.json +1 -1
  67. package/recipes/drawer-stack/recipe.json +99 -63
  68. package/recipes/drip-tray/models/default.json +1 -1
  69. package/recipes/drip-tray/recipe.json +0 -1
  70. package/recipes/duct-fan/models/default.json +1 -1
  71. package/recipes/duct-fan/recipe.json +11 -8
  72. package/recipes/emergency-stop/models/default.json +1 -1
  73. package/recipes/emergency-stop/recipe.json +11 -8
  74. package/recipes/end-covers/models/default.json +1 -1
  75. package/recipes/end-covers/recipe.json +0 -2
  76. package/recipes/ffu-row/models/default.json +1 -1
  77. package/recipes/ffu-row/recipe.json +0 -1
  78. package/recipes/fire-extinguisher/models/default.json +1 -1
  79. package/recipes/fire-extinguisher/recipe.json +0 -2
  80. package/recipes/first-aid-box/models/default.json +1 -1
  81. package/recipes/first-aid-box/recipe.json +0 -2
  82. package/recipes/floor-zone/models/default.json +1 -1
  83. package/recipes/floor-zone/recipe.json +0 -4
  84. package/recipes/folding-door/build.mts +1 -1
  85. package/recipes/folding-door/models/default.json +1 -1
  86. package/recipes/folding-door/recipe.json +21 -14
  87. package/recipes/fork/build.mts +1 -1
  88. package/recipes/fork/models/default.json +1 -1
  89. package/recipes/fork/recipe.json +23 -15
  90. package/recipes/fork/spec.json +1 -1
  91. package/recipes/gantry-frame/models/default.json +1 -1
  92. package/recipes/gantry-frame/recipe.json +0 -3
  93. package/recipes/gripper-2f/build.mts +1 -1
  94. package/recipes/gripper-2f/models/default.json +1 -1
  95. package/recipes/gripper-2f/recipe.json +23 -16
  96. package/recipes/gripper-2f/spec.json +1 -1
  97. package/recipes/guard-cover/models/default.json +1 -1
  98. package/recipes/guard-cover/recipe.json +11 -7
  99. package/recipes/handrail/models/default.json +1 -1
  100. package/recipes/handrail/recipe.json +0 -2
  101. package/recipes/hatch/models/default.json +1 -1
  102. package/recipes/hatch/recipe.json +11 -8
  103. package/recipes/hinged-door/build.mts +2 -3
  104. package/recipes/hinged-door/models/default.json +1 -1
  105. package/recipes/hinged-door/models/hinge=left.json +1 -1
  106. package/recipes/hinged-door/models/hinge=right.json +1 -1
  107. package/recipes/hinged-door/recipe.json +22 -15
  108. package/recipes/hmi-monitor/models/default.json +1 -1
  109. package/recipes/hmi-monitor/recipe.json +11 -8
  110. package/recipes/hopper/models/default.json +1 -1
  111. package/recipes/hopper/recipe.json +0 -2
  112. package/recipes/interlock-switch/models/default.json +1 -1
  113. package/recipes/interlock-switch/recipe.json +0 -1
  114. package/recipes/junction-box/models/default.json +1 -1
  115. package/recipes/junction-box/recipe.json +0 -1
  116. package/recipes/ladder/models/default.json +1 -1
  117. package/recipes/ladder/recipe.json +0 -3
  118. package/recipes/legs-four/models/default.json +1 -1
  119. package/recipes/legs-four/recipe.json +0 -4
  120. package/recipes/leveling-feet/models/default.json +1 -1
  121. package/recipes/leveling-feet/recipe.json +0 -4
  122. package/recipes/lift-updown/models/default.json +1 -1
  123. package/recipes/lift-updown/recipe.json +13 -9
  124. package/recipes/lift-updown/spec.json +1 -1
  125. package/recipes/light-curtain/models/default.json +1 -1
  126. package/recipes/light-curtain/recipe.json +0 -2
  127. package/recipes/limit-switch/models/default.json +1 -1
  128. package/recipes/limit-switch/recipe.json +11 -8
  129. package/recipes/linear-guide/build.mts +1 -1
  130. package/recipes/linear-guide/models/default.json +1 -1
  131. package/recipes/linear-guide/recipe.json +19 -16
  132. package/recipes/locker-row/models/default.json +1 -1
  133. package/recipes/locker-row/recipe.json +0 -1
  134. package/recipes/motor-box/models/default.json +1 -1
  135. package/recipes/motor-box/recipe.json +0 -1
  136. package/recipes/observation-window/models/default.json +1 -1
  137. package/recipes/observation-window/recipe.json +0 -2
  138. package/recipes/operator-panel/models/buttons=2.json +1 -1
  139. package/recipes/operator-panel/models/buttons=3.json +1 -1
  140. package/recipes/operator-panel/models/buttons=4.json +1 -1
  141. package/recipes/operator-panel/models/buttons=5.json +1 -1
  142. package/recipes/operator-panel/models/default.json +1 -1
  143. package/recipes/operator-panel/recipe.json +0 -5
  144. package/recipes/pallet/models/default.json +1 -1
  145. package/recipes/pallet/recipe.json +0 -4
  146. package/recipes/partition-wall/models/default.json +1 -1
  147. package/recipes/partition-wall/recipe.json +0 -3
  148. package/recipes/pass-box/models/default.json +1 -1
  149. package/recipes/pass-box/recipe.json +11 -8
  150. package/recipes/peg-board/models/default.json +1 -1
  151. package/recipes/peg-board/recipe.json +0 -2
  152. package/recipes/photo-sensor-pair/models/default.json +1 -1
  153. package/recipes/photo-sensor-pair/recipe.json +0 -2
  154. package/recipes/pipe-run/models/default.json +1 -1
  155. package/recipes/pipe-run/recipe.json +0 -1
  156. package/recipes/platform/models/default.json +1 -1
  157. package/recipes/platform/recipe.json +0 -5
  158. package/recipes/power-box/models/default.json +1 -1
  159. package/recipes/power-box/recipe.json +0 -1
  160. package/recipes/pressure-gauge/models/default.json +1 -1
  161. package/recipes/pressure-gauge/recipe.json +0 -1
  162. package/recipes/pull-cord/models/default.json +1 -1
  163. package/recipes/pull-cord/recipe.json +0 -1
  164. package/recipes/pump/models/default.json +1 -1
  165. package/recipes/pump/recipe.json +0 -2
  166. package/recipes/pusher/build.mts +1 -1
  167. package/recipes/pusher/models/default.json +1 -1
  168. package/recipes/pusher/recipe.json +19 -15
  169. package/recipes/robot-plinth/models/default.json +1 -1
  170. package/recipes/robot-plinth/recipe.json +0 -2
  171. package/recipes/roll-up-shutter/build.mts +1 -1
  172. package/recipes/roll-up-shutter/models/default.json +1 -1
  173. package/recipes/roll-up-shutter/recipe.json +19 -16
  174. package/recipes/roller-row/models/default.json +1 -1
  175. package/recipes/roller-row/recipe.json +11 -7
  176. package/recipes/room-shell/models/default.json +1 -1
  177. package/recipes/room-shell/recipe.json +0 -5
  178. package/recipes/rotating-beacon/models/default.json +1 -1
  179. package/recipes/rotating-beacon/recipe.json +11 -9
  180. package/recipes/safety-fence/models/default.json +1 -1
  181. package/recipes/safety-fence/recipe.json +0 -2
  182. package/recipes/safety-mat/models/default.json +1 -1
  183. package/recipes/safety-mat/recipe.json +0 -1
  184. package/recipes/safety-sign-stand/models/default.json +1 -1
  185. package/recipes/safety-sign-stand/recipe.json +0 -3
  186. package/recipes/scanner-mount/models/default.json +1 -1
  187. package/recipes/scanner-mount/recipe.json +0 -3
  188. package/recipes/selector-switch/models/default.json +1 -1
  189. package/recipes/selector-switch/recipe.json +11 -8
  190. package/recipes/shelf-tiers/models/default.json +1 -1
  191. package/recipes/shelf-tiers/models/tiers=2.json +1 -1
  192. package/recipes/shelf-tiers/models/tiers=3.json +1 -1
  193. package/recipes/shelf-tiers/models/tiers=4.json +1 -1
  194. package/recipes/shelf-tiers/models/tiers=5.json +1 -1
  195. package/recipes/shelf-tiers/recipe.json +0 -4
  196. package/recipes/side-guides/models/default.json +1 -1
  197. package/recipes/side-guides/recipe.json +0 -2
  198. package/recipes/sign-board/models/default.json +1 -1
  199. package/recipes/sign-board/recipe.json +0 -1
  200. package/recipes/signal-tower-3/build.mts +1 -1
  201. package/recipes/signal-tower-3/models/default.json +1 -1
  202. package/recipes/signal-tower-3/recipe.json +11 -10
  203. package/recipes/sliding-door/build.mts +4 -7
  204. package/recipes/sliding-door/models/default.json +1 -1
  205. package/recipes/sliding-door/models/leaves=1,lamp=false.json +1 -1
  206. package/recipes/sliding-door/models/leaves=1,lamp=true.json +1 -1
  207. package/recipes/sliding-door/models/leaves=2,lamp=false.json +1 -1
  208. package/recipes/sliding-door/models/leaves=2,lamp=true.json +1 -1
  209. package/recipes/sliding-door/recipe.json +48 -38
  210. package/recipes/stairs/models/default.json +1 -1
  211. package/recipes/stairs/recipe.json +0 -1
  212. package/recipes/status-lamp/models/default.json +1 -1
  213. package/recipes/status-lamp/recipe.json +11 -9
  214. package/recipes/stopper/models/default.json +1 -1
  215. package/recipes/stopper/recipe.json +11 -7
  216. package/recipes/suction-pads/models/default.json +1 -1
  217. package/recipes/suction-pads/recipe.json +0 -1
  218. package/recipes/tank/models/default.json +1 -1
  219. package/recipes/tank/recipe.json +0 -1
  220. package/recipes/telescopic-arm/build.mts +1 -1
  221. package/recipes/telescopic-arm/models/default.json +1 -1
  222. package/recipes/telescopic-arm/recipe.json +21 -13
  223. package/recipes/toe-board/models/default.json +1 -1
  224. package/recipes/toe-board/recipe.json +0 -1
  225. package/recipes/tote/models/default.json +1 -1
  226. package/recipes/tote/recipe.json +0 -1
  227. package/recipes/traffic-cones/models/default.json +1 -1
  228. package/recipes/traffic-cones/recipe.json +0 -2
  229. package/recipes/transfer-belts/build.mts +1 -1
  230. package/recipes/transfer-belts/models/default.json +1 -1
  231. package/recipes/transfer-belts/recipe.json +23 -15
  232. package/recipes/transfer-belts/spec.json +1 -1
  233. package/recipes/tray-stack/models/default.json +1 -1
  234. package/recipes/tray-stack/models/trays=3.json +1 -1
  235. package/recipes/tray-stack/models/trays=4.json +1 -1
  236. package/recipes/tray-stack/models/trays=5.json +1 -1
  237. package/recipes/tray-stack/recipe.json +0 -5
  238. package/recipes/trough/models/default.json +1 -1
  239. package/recipes/trough/recipe.json +0 -1
  240. package/recipes/turntable/models/default.json +1 -1
  241. package/recipes/turntable/recipe.json +11 -8
  242. package/recipes/valve-handle/models/default.json +1 -1
  243. package/recipes/valve-handle/recipe.json +11 -9
  244. package/recipes/waste-bin/models/default.json +1 -1
  245. package/recipes/waste-bin/recipe.json +0 -1
  246. package/recipes/work-light/models/default.json +1 -1
  247. package/recipes/work-light/recipe.json +11 -9
  248. package/recipes/workbench-top/models/default.json +1 -1
  249. package/recipes/workbench-top/recipe.json +0 -1
  250. package/server/service/figure/figure-context.test.ts +3 -3
  251. package/server/service/figure/figure-context.ts +4 -2
  252. package/server/service/figure/figure-propose-clips.test.ts +1 -1
  253. package/server/service/figure/figure-release-record-db.test.ts +3 -3
@@ -21,9 +21,10 @@ export interface FigureOutlinePart {
21
21
  shape?: string;
22
22
  /** What it is fastened to: `<part>.<face>`, `mounting-plane`, or nothing when unfastened. */
23
23
  on?: string;
24
+ /** Its joint, and how it moves: each axis's type in order (ADR-0159); no motion for a fastening. */
24
25
  joint?: {
25
26
  id: string;
26
- type: string;
27
+ motion?: string[];
27
28
  };
28
29
  material?: string;
29
30
  /** How long its part read is: what reading it costs. */
@@ -102,7 +102,8 @@ function outlinePartsOf(asset) {
102
102
  id,
103
103
  ...(shape ? { shape } : {}),
104
104
  ...(on ? { on } : {}),
105
- ...(joint ? { joint: { id: joint.id, type: joint.type } } : {}),
105
+ /* How it moves: each axis of its joint in order (ADR-0159); none for a fastening. */
106
+ ...(joint ? { joint: { id: joint.id, ...(joint.motion?.length ? { motion: joint.motion.map((m) => m.type) } : {}) } } : {}),
106
107
  ...(look.material?.token ? { material: look.material.token } : {}),
107
108
  chars: length(figurePartReadOf(asset, id))
108
109
  };
@@ -1 +1 @@
1
- {"version":3,"file":"figure-context.js","sourceRoot":"","sources":["../../../server/service/figure/figure-context.ts"],"names":[],"mappings":";;;AAyHA,4CAWC;AAwED,0CAuCC;AAQD,oCA2DC;AA4ED,0CAiBC;AAoBD,gDA4BC;AApbD,oHAAoH;AACvG,QAAA,qBAAqB,GAAG,OAAO,CAAA;AAE5C,kHAAkH;AAClH,MAAM,aAAa,GAAG,6BAAqB,GAAG,CAAC,CAAA;AAE/C,qGAAqG;AACrG,MAAM,aAAa,GAAG,EAAE,CAAA;AAiExB,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC,CAAA;AACrE,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAW,EAAE,EAAE,CAAC,EAAE,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAA;AAErH,4FAA4F;AAE5F,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACrF,MAAM,SAAS,GAAG,CAAC,MAAoC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAClH,SAAS,QAAQ,CAAC,OAAe;IAC/B,IAAI,OAAO,OAAO,KAAK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AAM;QACR,CAAC;QACD,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAA;QAC/B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;YAChD,MAAM,KAAK,GAAG,GAAG,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAA;YACtD,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YAC3B,IAAI,IAAI;gBAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;iBAC1C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;gBAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QAClE,CAAC;IACH,CAAC,CAAA;IACD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAE,CAAA;QACzC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,CAAA;IACnF,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["/**\n * What of a figure the model is shown (ADR-0061 2026-10-16 decision 4).\n *\n * The kernel keeps a figure up to 1 MiB (`FIGURE_JSON_MAX_BYTES`); that is whether the figure is valid. How much of it the\n * model reads at once is another question with its own number. A figure that fits is shown whole. One that does not is\n * shown as an outline -- its sections, and every part by name, shape and what it is fastened to -- and in full only the\n * parts and sections asked for, while they fit. A section too large for the outline is left out, named by its JSON\n * Pointer with the entries inside it, and read by pointer. The full source stays on the server: a proposal is applied\n * and judged on it, on the version the request was made on.\n *\n * A proposal on a figure shown in part changes only what it was shown: no part not read in full, and nothing inside a\n * section left out and not read. Read is what the server put before the writer, never what a model says it read.\n */\nimport type { FigureAsset, FigureProposalStep } from '@hatiolab/figure-model'\n\n/** The most of a figure, serialized, the model is shown in one read. Not a validity limit: that is the kernel's. */\nexport const FIGURE_CONTEXT_BUDGET = 100_000\n\n/** Of the budget, what the outline's sections may take; the rest is for the parts and sections read beside it. */\nconst OUTLINE_SHARE = FIGURE_CONTEXT_BUDGET / 2\n\n/** How many entries of a section left out, or pointers in a reason, are named: the largest first. */\nconst ENTRIES_NAMED = 20\n\ntype Dynamic = any\n\nexport interface FigureOutlinePart {\n id: string\n /** The operation that makes its shape (`box@1`, `extrude@1`, ...). */\n shape?: string\n /** What it is fastened to: `<part>.<face>`, `mounting-plane`, or nothing when unfastened. */\n on?: string\n joint?: { id: string; type: string }\n material?: string\n /** How long its part read is: what reading it costs. */\n chars: number\n}\n\nexport interface FigureOmittedSection {\n /** The JSON Pointer of the section left out. */\n section: string\n chars: number\n /** Its largest entries, by pointer: what to read when the whole does not fit. */\n entries?: { section: string; chars: number }[]\n}\n\nexport interface FigureOutline {\n /** The whole source's length, and the budget it does not fit. */\n chars: number\n budget: number\n parts: FigureOutlinePart[]\n /** Parts the outline had no room to list, past the ones listed. */\n partsNotListed?: number\n /** Sections left out because they would crowd the outline. */\n omitted?: FigureOmittedSection[]\n [section: string]: unknown\n}\n\nexport interface FigurePartRead {\n appearance: Dynamic\n /** The fastenings that name it: its own (body1) and its children's (body0). */\n joints: Dynamic[]\n /** The graph nodes and constants under its name: `<part>` and `<part>.*` (a part id has no dot). */\n nodes: Dynamic[]\n constants: Dynamic[]\n}\n\nexport interface FigureReadRequest {\n parts?: readonly string[]\n /** JSON Pointers (RFC 6901) into the source, such as `/document/capabilities/bindings/0`. */\n sections?: readonly string[]\n}\n\nexport interface FigureView {\n whole: boolean\n /** Whole: the source as it is. */\n source?: FigureAsset\n outline?: FigureOutline\n /** The parts shown in full, by id, in the order asked. */\n parts?: Record<string, FigurePartRead>\n shown?: string[]\n /** The sections read, by pointer. */\n sections?: Record<string, unknown>\n /** What was asked for and not shown, with why and what to read instead. */\n notRead?: ({ part: string; reason: string } | { section: string; reason: string })[]\n}\n\nconst length = (value: unknown) => JSON.stringify(value)?.length ?? 0\nconst under = (part: string) => (id: unknown) => id === part || (typeof id === 'string' && id.startsWith(`${part}.`))\n\n/* ── JSON Pointer (RFC 6901) ─────────────────────────────────────────────────────────── */\n\nconst escapeToken = (token: string) => token.replace(/~/g, '~0').replace(/\\//g, '~1')\nconst pointerOf = (tokens: readonly (string | number)[]) => tokens.map(t => `/${escapeToken(String(t))}`).join('')\nfunction tokensOf(pointer: string): string[] | undefined {\n if (typeof pointer !== 'string' || !pointer.startsWith('/')) return undefined\n return pointer.slice(1).split('/').map(t => t.replace(/~1/g, '/').replace(/~0/g, '~'))\n}\nfunction valueAt(root: unknown, tokens: readonly string[]): { found: boolean; value?: unknown } {\n let at: Dynamic = root\n for (const token of tokens) {\n if (at === null || typeof at !== 'object' || !Object.prototype.hasOwnProperty.call(at, token)) return { found: false }\n at = at[token]\n }\n return { found: true, value: at }\n}\n/** `inner` is `outer` or inside it. */\nconst within = (inner: string, outer: string) => inner === outer || inner.startsWith(`${outer}/`)\n\n/** A value's entries by pointer, largest first, the first ENTRIES_NAMED of them. */\nfunction entriesOf(pointer: string, value: unknown): { section: string; chars: number }[] {\n if (value === null || typeof value !== 'object') return []\n const tokens = tokensOf(pointer)!\n return Object.entries(value as object)\n .map(([key, entry]) => ({ section: pointerOf([...tokens, key]), chars: length(entry) }))\n .sort((a, b) => b.chars - a.chars)\n .slice(0, ENTRIES_NAMED)\n}\n\n/* ── Parts ───────────────────────────────────────────────────────────────────────────── */\n\nexport function figurePartReadOf(asset: FigureAsset, part: string): FigurePartRead | undefined {\n const appearance = asset.appearance.find(a => a.target === part)\n if (!appearance) return undefined\n const model = asset.document.model as Dynamic\n const own = under(part)\n return {\n appearance,\n joints: ((asset as Dynamic).joints ?? []).filter((j: Dynamic) => j?.body1?.part === part || j?.body0?.part === part),\n nodes: model.nodes.filter((n: Dynamic) => own(n.id)),\n constants: model.constants.filter((c: Dynamic) => own(c.id))\n }\n}\n\n/** Where a part's records are, by pointer: for a part too large to read as one. */\nfunction partPointers(asset: FigureAsset, part: string): string[] {\n const model = asset.document.model as Dynamic\n const own = under(part)\n return [\n ...asset.appearance.flatMap((a, i) => (a.target === part ? [pointerOf(['appearance', i])] : [])),\n ...((asset as Dynamic).joints ?? []).flatMap((j: Dynamic, i: number) => (j?.body1?.part === part || j?.body0?.part === part ? [pointerOf(['joints', i])] : [])),\n ...model.nodes.flatMap((n: Dynamic, i: number) => (own(n.id) ? [pointerOf(['document', 'model', 'nodes', i])] : [])),\n ...model.constants.flatMap((c: Dynamic, i: number) => (own(c.id) ? [pointerOf(['document', 'model', 'constants', i])] : []))\n ]\n}\n\n/* ── The outline ─────────────────────────────────────────────────────────────────────── */\n\n/*\n The sections of an outline: every top-level field but the parts' records, the document's fields but its model, and the\n model's fields but its graph. Each may be left out by its pointer.\n*/\nconst PART_RECORDS = ['/document', '/appearance', '/joints', '/document/model', '/document/model/nodes', '/document/model/constants']\nfunction sectionsOf(asset: FigureAsset): string[] {\n const out: string[] = []\n const walk = (tokens: string[]) => {\n const { value } = valueAt(asset, tokens)\n for (const key of Object.keys(value as object)) {\n const pointer = pointerOf([...tokens, key])\n if (pointer === '/document' || pointer === '/document/model') walk([...tokens, key])\n else if (!PART_RECORDS.includes(pointer)) out.push(pointer)\n }\n }\n walk([])\n return out\n}\n\nfunction outlinePartsOf(asset: FigureAsset): FigureOutlinePart[] {\n const nodes = (asset.document.model as Dynamic).nodes\n const joints = (asset as Dynamic).joints ?? []\n return asset.appearance.map((look: Dynamic) => {\n const id = look.target\n const joint = joints.find((j: Dynamic) => j?.body1?.part === id)\n const body0 = joint?.body0\n const on = !joint ? undefined : body0?.part ? `${body0.part}.${body0.face}` : (body0?.plane ?? 'mounting-plane')\n const shape = nodes.find((n: Dynamic) => n.id === `${id}.shape`)?.op\n return {\n id,\n ...(shape ? { shape } : {}),\n ...(on ? { on } : {}),\n ...(joint ? { joint: { id: joint.id, type: joint.type } } : {}),\n ...(look.material?.token ? { material: look.material.token } : {}),\n chars: length(figurePartReadOf(asset, id))\n }\n })\n}\n\n/** Writes a section into the outline at its pointer, making the objects on the way. */\nfunction place(outline: Dynamic, tokens: readonly string[], value: unknown) {\n let at = outline\n tokens.slice(0, -1).forEach(token => (at = at[token] ??= {}))\n at[tokens[tokens.length - 1]!] = value\n}\n\n/**\n * What the view wraps the outline in, read or not: an outline that took the whole budget left the view over it by these\n * (53 characters, a figure of 3000 long-named parts, 2026-10-19).\n */\nconst VIEW_ENVELOPE = () => length({ whole: false, outline: {}, parts: {}, shown: [], sections: {}, notRead: [] }) - length({})\n\n/**\n * The outline: within OUTLINE_SHARE for its sections, the largest left out first; and, every field counted, within the\n * budget less what the view wraps it in -- a figure of very many parts lists them by id only, then as many as fit.\n */\nexport function figureOutlineOf(asset: FigureAsset, chars = length(asset)): FigureOutline {\n const limit = FIGURE_CONTEXT_BUDGET - VIEW_ENVELOPE()\n const model = asset.document.model as Dynamic\n const sections = sectionsOf(asset).map(pointer => ({ pointer, value: valueAt(asset, tokensOf(pointer)!).value }))\n const sized = sections.map(s => ({ ...s, chars: length(s.value) })).sort((a, b) => b.chars - a.chars)\n\n let total = sized.reduce((sum, s) => sum + s.chars, 0)\n const omitted: FigureOmittedSection[] = []\n const kept = new Set(sized.map(s => s.pointer))\n for (const s of sized) {\n if (total <= OUTLINE_SHARE) break\n kept.delete(s.pointer)\n total -= s.chars\n const entries = entriesOf(s.pointer, s.value)\n omitted.push({ section: s.pointer, chars: s.chars, ...(entries.length ? { entries } : {}) })\n }\n\n const outline: Dynamic = { chars, budget: FIGURE_CONTEXT_BUDGET }\n place(outline, ['document', 'model', 'nodes'], model.nodes.length)\n place(outline, ['document', 'model', 'constants'], model.constants.length)\n for (const s of sections) if (kept.has(s.pointer)) place(outline, tokensOf(s.pointer)!, s.value)\n if (omitted.length) outline.omitted = omitted\n\n let parts: Dynamic[] = outlinePartsOf(asset)\n outline.parts = parts\n if (length(outline) > limit) outline.parts = parts = parts.map(p => ({ id: p.id }))\n if (length(outline) > limit) {\n /* As many as fit, in part order, with how many more there are. */\n let room = limit - length({ ...outline, parts: [], partsNotListed: parts.length })\n const listed: Dynamic[] = []\n for (const p of parts) {\n room -= length(p) + 1\n if (room < 0) break\n listed.push(p)\n }\n outline.parts = listed\n outline.partsNotListed = parts.length - listed.length\n }\n return outline as FigureOutline\n}\n\n/* ── The view ────────────────────────────────────────────────────────────────────────── */\n\n/**\n * The view of a figure the model is shown: whole when it fits, else the outline and what was asked for -- parts, then\n * sections, each in the order asked -- while it fits beside it. Every field counted, the view is within the budget.\n */\nexport function figureViewOf(asset: FigureAsset, request: FigureReadRequest = {}): FigureView {\n const chars = length(asset)\n if (chars <= FIGURE_CONTEXT_BUDGET) return { whole: true, source: asset }\n\n const outline = figureOutlineOf(asset, chars)\n const view: FigureView = { whole: false, outline, parts: {}, shown: [], sections: {}, notRead: [] }\n const room = () => FIGURE_CONTEXT_BUDGET - length(view)\n const refuse = (one: { part: string; reason: string } | { section: string; reason: string }) => {\n if (length(one) + 1 <= room()) view.notRead!.push(one)\n }\n\n for (const part of [...new Set(request.parts ?? [])]) {\n const one = figurePartReadOf(asset, part)\n if (!one) {\n refuse({ part, reason: `${part} is not a part of this figure; the outline lists its parts` })\n continue\n }\n const cost = length(one) + length(part) + length(part) + 3\n view.parts![part] = one\n view.shown!.push(part)\n if (room() >= 0) continue\n delete view.parts![part]\n view.shown!.pop()\n if (cost <= FIGURE_CONTEXT_BUDGET - length(outline)) {\n refuse({ part, reason: `${part} (${cost} characters) does not fit beside what is already read; read it in another call with fewer parts or sections` })\n } else {\n const pointers = partPointers(asset, part)\n refuse({\n part,\n reason:\n `${part} (${cost} characters) is too large to show beside the outline; read its records as sections: ` +\n `${pointers.slice(0, ENTRIES_NAMED).join(', ')}${pointers.length > ENTRIES_NAMED ? ` and ${pointers.length - ENTRIES_NAMED} more` : ''}. ` +\n 'Parts read as sections are not counted as read in full: they cannot be changed'\n })\n }\n }\n\n for (const section of [...new Set(request.sections ?? [])]) {\n const tokens = tokensOf(section)\n const at = tokens && tokens.length ? valueAt(asset, tokens) : { found: false }\n if (!at.found) {\n refuse({ section, reason: `there is no section ${section}; a section is a JSON Pointer such as /document/capabilities/bindings/0` })\n continue\n }\n const cost = length(at.value) + length(section) + 2\n view.sections![section] = at.value\n if (room() >= 0) continue\n delete view.sections![section]\n const entries = entriesOf(section, at.value)\n refuse({\n section,\n reason: entries.length\n ? `${section} (${cost} characters) is too large to show at once here; read its entries: ${entries.map(e => `${e.section} (${e.chars})`).join(', ')}`\n : `${section} is one value of ${length(at.value)} characters, larger than can be shown here; it cannot be read or changed by a proposal`\n })\n }\n\n if (!view.notRead!.length) delete view.notRead\n return view\n}\n\n/* ── What a proposal may change ──────────────────────────────────────────────────────── */\n\ntype StepOf<K extends FigureProposalStep['kind']> = Extract<FigureProposalStep, { kind: K }>\ntype Subject = string | undefined\n\n/**\n * The part each kind of step changes, read from the field the kernel reads for that kind (audit D4-R1: a `part` beside a\n * `set-material`'s `target` is not read by the kernel, so it may not stand in for it). Every kind of the kernel's step\n * type is here, or this does not compile. A step that changes no one part says so with undefined: what it does to the\n * figure's sections is held by `unreadSectionEdits`.\n */\nconst SUBJECT: { [K in FigureProposalStep['kind']]: (step: StepOf<K>, base: FigureAsset) => Subject } = {\n 'add-part': () => undefined,\n 'set-section-corner': step => step.part,\n 'set-cavity': step => step.part,\n 'set-section': step => step.part,\n attach: step => step.part,\n 'link-dimension': step => step.part,\n 'follow-size': step => step.part,\n 'unlink-dimension': step => step.part,\n 'scale-position': step => step.part,\n 'fix-position': step => step.part,\n 'nudge-part': step => step.part,\n detach: step => step.part,\n 'make-repeat': step => step.part,\n 'set-repeat': step => step.part,\n 'remove-repeat': step => step.part,\n 'set-mounting-face': step => step.part,\n 'add-binding': step => step.part,\n 'set-joint': step => step.joint?.body1?.part,\n 'remove-joint': (step, base) => ((base as Dynamic).joints ?? []).find((j: Dynamic) => j?.id === step.id)?.body1?.part,\n 'set-material': step => step.target,\n 'set-segments': step => step.target,\n 'rename-part': step => step.target,\n 'set-visibility': step => step.target,\n 'remove-part': step => step.target,\n 'duplicate-part': step => step.target,\n 'move-part': step => step.target,\n 'set-placement': () => undefined,\n 'declare-instance-size': () => undefined,\n 'clear-mounting-face': () => undefined,\n 'scale-uniformly': () => undefined,\n 'follow-size-in-proportion': () => undefined,\n 'set-detail-level': () => undefined,\n 'add-design-input': () => undefined,\n 'set-input-range': () => undefined,\n 'publish-input': () => undefined,\n 'unpublish-input': () => undefined,\n 'remove-binding': () => undefined,\n 'set-slot-layout': () => undefined,\n 'remove-slot-layout': () => undefined,\n 'set-extension': () => undefined,\n rename: () => undefined,\n 'set-capabilities': () => undefined,\n 'set-state-input': () => undefined,\n 'set-state-defaults': () => undefined,\n 'set-driver': () => undefined,\n 'remove-driver': () => undefined,\n 'set-clip': () => undefined,\n 'set-motion-group': () => undefined,\n 'remove-motion-group': () => undefined,\n 'set-data-schema': () => undefined,\n 'rename-data-field': () => undefined,\n 'set-data-binding': () => undefined,\n 'remove-data-binding': () => undefined,\n 'set-status-port': () => undefined,\n 'remove-status-port': () => undefined\n}\n\n/**\n * The steps that change a part of the base not shown in full, as reasons said back to the writer. A part may still be\n * named to fasten to or to follow -- the kernel works from it, nothing about it is guessed -- and a new part is the\n * steps' own. A kind this table does not know is refused: it is not let through unjudged.\n */\nexport function unreadPartEdits(base: FigureAsset, steps: readonly FigureProposalStep[], view: FigureView): string[] {\n const existing = new Set(base.appearance.map(a => a.target))\n const shown = new Set(view.shown ?? [])\n const allowed = [...shown].join(', ') || 'none'\n return steps.flatMap((step, i) => {\n const kind = (step as Dynamic)?.kind\n if (typeof kind !== 'string') return []\n const judge = (SUBJECT as Record<string, (step: Dynamic, base: FigureAsset) => Subject>)[kind]\n if (!Object.prototype.hasOwnProperty.call(SUBJECT, kind) || !judge)\n return [`UNKNOWN_STEP: steps[${i}] has the kind \"${kind}\", which is not one of the commands; use only the commands taught.`]\n const part = judge(step, base)\n if (typeof part !== 'string' || !existing.has(part) || shown.has(part)) return []\n return [\n `UNREAD_PART: steps[${i}] (${kind}) changes \"${part}\", which was not shown in full, so its source is not known here. ` +\n `Change only the parts shown in full (${allowed}) or parts the steps add. To change ${part}, read it with getFigureSource parts and pass it in parts to proposeFigureCandidate.`\n ]\n })\n}\n\n/** Entries of a value, keyed by `id` when every entry of a list has a distinct one, else by place. */\nfunction keyedEntries(value: unknown): Map<string, { token: string; value: unknown }> {\n const out = new Map<string, { token: string; value: unknown }>()\n if (Array.isArray(value)) {\n const ids = value.map(v => (v && typeof v === 'object' && typeof (v as Dynamic).id === 'string' ? (v as Dynamic).id : undefined))\n const byId = ids.every(Boolean) && new Set(ids).size === ids.length\n value.forEach((v, i) => out.set(byId ? `id:${ids[i]}` : `at:${i}`, { token: String(i), value: v }))\n } else if (value && typeof value === 'object') {\n for (const [key, v] of Object.entries(value)) out.set(`key:${key}`, { token: key, value: v })\n }\n return out\n}\n\n/**\n * What of the sections left out of the outline and not read the steps changed, as reasons said back to the writer. Judged\n * on what the steps made, not on what they say: nothing that was there may be changed or taken away. A new entry -- a\n * record in a list, a key in a map -- is the steps' own.\n */\nexport function unreadSectionEdits(base: FigureAsset, after: FigureAsset, view: FigureView): string[] {\n const read = Object.keys(view.sections ?? {})\n const reasons: string[] = []\n const say = (pointer: string, what: string) =>\n reasons.push(\n `UNREAD_SECTION: the steps ${what} ${pointer}, which was left out of the outline and not read, so it is not known here. ` +\n `Leave it as it is; to change it, read it with getFigureSource sections and pass it in sections to proposeFigureCandidate.`\n )\n const check = (pointer: string, before: unknown, now: unknown) => {\n if (reasons.length >= ENTRIES_NAMED || read.some(r => within(pointer, r))) return\n const records = (v: unknown) => v !== null && typeof v === 'object'\n if (!records(before) || !records(now) || Array.isArray(before) !== Array.isArray(now)) {\n if (JSON.stringify(before) !== JSON.stringify(now)) say(pointer, 'change')\n return\n }\n const later = keyedEntries(now)\n for (const [key, entry] of keyedEntries(before)) {\n const child = `${pointer}/${escapeToken(entry.token)}`\n const kept = later.get(key)\n if (kept) check(child, entry.value, kept.value)\n else if (!read.some(r => within(child, r))) say(child, 'remove')\n }\n }\n for (const omitted of view.outline?.omitted ?? []) {\n const tokens = tokensOf(omitted.section)!\n check(omitted.section, valueAt(base, tokens).value, valueAt(after, tokens).value)\n }\n return reasons\n}\n"]}
1
+ {"version":3,"file":"figure-context.js","sourceRoot":"","sources":["../../../server/service/figure/figure-context.ts"],"names":[],"mappings":";;;AA0HA,4CAWC;AAyED,0CAuCC;AAQD,oCA2DC;AA4ED,0CAiBC;AAoBD,gDA4BC;AAtbD,oHAAoH;AACvG,QAAA,qBAAqB,GAAG,OAAO,CAAA;AAE5C,kHAAkH;AAClH,MAAM,aAAa,GAAG,6BAAqB,GAAG,CAAC,CAAA;AAE/C,qGAAqG;AACrG,MAAM,aAAa,GAAG,EAAE,CAAA;AAkExB,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC,CAAA;AACrE,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAW,EAAE,EAAE,CAAC,EAAE,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAA;AAErH,4FAA4F;AAE5F,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACrF,MAAM,SAA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AAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,CAAA;IACnF,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["/**\n * What of a figure the model is shown (ADR-0061 2026-10-16 decision 4).\n *\n * The kernel keeps a figure up to 1 MiB (`FIGURE_JSON_MAX_BYTES`); that is whether the figure is valid. How much of it the\n * model reads at once is another question with its own number. A figure that fits is shown whole. One that does not is\n * shown as an outline -- its sections, and every part by name, shape and what it is fastened to -- and in full only the\n * parts and sections asked for, while they fit. A section too large for the outline is left out, named by its JSON\n * Pointer with the entries inside it, and read by pointer. The full source stays on the server: a proposal is applied\n * and judged on it, on the version the request was made on.\n *\n * A proposal on a figure shown in part changes only what it was shown: no part not read in full, and nothing inside a\n * section left out and not read. Read is what the server put before the writer, never what a model says it read.\n */\nimport type { FigureAsset, FigureProposalStep } from '@hatiolab/figure-model'\n\n/** The most of a figure, serialized, the model is shown in one read. Not a validity limit: that is the kernel's. */\nexport const FIGURE_CONTEXT_BUDGET = 100_000\n\n/** Of the budget, what the outline's sections may take; the rest is for the parts and sections read beside it. */\nconst OUTLINE_SHARE = FIGURE_CONTEXT_BUDGET / 2\n\n/** How many entries of a section left out, or pointers in a reason, are named: the largest first. */\nconst ENTRIES_NAMED = 20\n\ntype Dynamic = any\n\nexport interface FigureOutlinePart {\n id: string\n /** The operation that makes its shape (`box@1`, `extrude@1`, ...). */\n shape?: string\n /** What it is fastened to: `<part>.<face>`, `mounting-plane`, or nothing when unfastened. */\n on?: string\n /** Its joint, and how it moves: each axis's type in order (ADR-0159); no motion for a fastening. */\n joint?: { id: string; motion?: string[] }\n material?: string\n /** How long its part read is: what reading it costs. */\n chars: number\n}\n\nexport interface FigureOmittedSection {\n /** The JSON Pointer of the section left out. */\n section: string\n chars: number\n /** Its largest entries, by pointer: what to read when the whole does not fit. */\n entries?: { section: string; chars: number }[]\n}\n\nexport interface FigureOutline {\n /** The whole source's length, and the budget it does not fit. */\n chars: number\n budget: number\n parts: FigureOutlinePart[]\n /** Parts the outline had no room to list, past the ones listed. */\n partsNotListed?: number\n /** Sections left out because they would crowd the outline. */\n omitted?: FigureOmittedSection[]\n [section: string]: unknown\n}\n\nexport interface FigurePartRead {\n appearance: Dynamic\n /** The fastenings that name it: its own (body1) and its children's (body0). */\n joints: Dynamic[]\n /** The graph nodes and constants under its name: `<part>` and `<part>.*` (a part id has no dot). */\n nodes: Dynamic[]\n constants: Dynamic[]\n}\n\nexport interface FigureReadRequest {\n parts?: readonly string[]\n /** JSON Pointers (RFC 6901) into the source, such as `/document/capabilities/bindings/0`. */\n sections?: readonly string[]\n}\n\nexport interface FigureView {\n whole: boolean\n /** Whole: the source as it is. */\n source?: FigureAsset\n outline?: FigureOutline\n /** The parts shown in full, by id, in the order asked. */\n parts?: Record<string, FigurePartRead>\n shown?: string[]\n /** The sections read, by pointer. */\n sections?: Record<string, unknown>\n /** What was asked for and not shown, with why and what to read instead. */\n notRead?: ({ part: string; reason: string } | { section: string; reason: string })[]\n}\n\nconst length = (value: unknown) => JSON.stringify(value)?.length ?? 0\nconst under = (part: string) => (id: unknown) => id === part || (typeof id === 'string' && id.startsWith(`${part}.`))\n\n/* ── JSON Pointer (RFC 6901) ─────────────────────────────────────────────────────────── */\n\nconst escapeToken = (token: string) => token.replace(/~/g, '~0').replace(/\\//g, '~1')\nconst pointerOf = (tokens: readonly (string | number)[]) => tokens.map(t => `/${escapeToken(String(t))}`).join('')\nfunction tokensOf(pointer: string): string[] | undefined {\n if (typeof pointer !== 'string' || !pointer.startsWith('/')) return undefined\n return pointer.slice(1).split('/').map(t => t.replace(/~1/g, '/').replace(/~0/g, '~'))\n}\nfunction valueAt(root: unknown, tokens: readonly string[]): { found: boolean; value?: unknown } {\n let at: Dynamic = root\n for (const token of tokens) {\n if (at === null || typeof at !== 'object' || !Object.prototype.hasOwnProperty.call(at, token)) return { found: false }\n at = at[token]\n }\n return { found: true, value: at }\n}\n/** `inner` is `outer` or inside it. */\nconst within = (inner: string, outer: string) => inner === outer || inner.startsWith(`${outer}/`)\n\n/** A value's entries by pointer, largest first, the first ENTRIES_NAMED of them. */\nfunction entriesOf(pointer: string, value: unknown): { section: string; chars: number }[] {\n if (value === null || typeof value !== 'object') return []\n const tokens = tokensOf(pointer)!\n return Object.entries(value as object)\n .map(([key, entry]) => ({ section: pointerOf([...tokens, key]), chars: length(entry) }))\n .sort((a, b) => b.chars - a.chars)\n .slice(0, ENTRIES_NAMED)\n}\n\n/* ── Parts ───────────────────────────────────────────────────────────────────────────── */\n\nexport function figurePartReadOf(asset: FigureAsset, part: string): FigurePartRead | undefined {\n const appearance = asset.appearance.find(a => a.target === part)\n if (!appearance) return undefined\n const model = asset.document.model as Dynamic\n const own = under(part)\n return {\n appearance,\n joints: ((asset as Dynamic).joints ?? []).filter((j: Dynamic) => j?.body1?.part === part || j?.body0?.part === part),\n nodes: model.nodes.filter((n: Dynamic) => own(n.id)),\n constants: model.constants.filter((c: Dynamic) => own(c.id))\n }\n}\n\n/** Where a part's records are, by pointer: for a part too large to read as one. */\nfunction partPointers(asset: FigureAsset, part: string): string[] {\n const model = asset.document.model as Dynamic\n const own = under(part)\n return [\n ...asset.appearance.flatMap((a, i) => (a.target === part ? [pointerOf(['appearance', i])] : [])),\n ...((asset as Dynamic).joints ?? []).flatMap((j: Dynamic, i: number) => (j?.body1?.part === part || j?.body0?.part === part ? [pointerOf(['joints', i])] : [])),\n ...model.nodes.flatMap((n: Dynamic, i: number) => (own(n.id) ? [pointerOf(['document', 'model', 'nodes', i])] : [])),\n ...model.constants.flatMap((c: Dynamic, i: number) => (own(c.id) ? [pointerOf(['document', 'model', 'constants', i])] : []))\n ]\n}\n\n/* ── The outline ─────────────────────────────────────────────────────────────────────── */\n\n/*\n The sections of an outline: every top-level field but the parts' records, the document's fields but its model, and the\n model's fields but its graph. Each may be left out by its pointer.\n*/\nconst PART_RECORDS = ['/document', '/appearance', '/joints', '/document/model', '/document/model/nodes', '/document/model/constants']\nfunction sectionsOf(asset: FigureAsset): string[] {\n const out: string[] = []\n const walk = (tokens: string[]) => {\n const { value } = valueAt(asset, tokens)\n for (const key of Object.keys(value as object)) {\n const pointer = pointerOf([...tokens, key])\n if (pointer === '/document' || pointer === '/document/model') walk([...tokens, key])\n else if (!PART_RECORDS.includes(pointer)) out.push(pointer)\n }\n }\n walk([])\n return out\n}\n\nfunction outlinePartsOf(asset: FigureAsset): FigureOutlinePart[] {\n const nodes = (asset.document.model as Dynamic).nodes\n const joints = (asset as Dynamic).joints ?? []\n return asset.appearance.map((look: Dynamic) => {\n const id = look.target\n const joint = joints.find((j: Dynamic) => j?.body1?.part === id)\n const body0 = joint?.body0\n const on = !joint ? undefined : body0?.part ? `${body0.part}.${body0.face}` : (body0?.plane ?? 'mounting-plane')\n const shape = nodes.find((n: Dynamic) => n.id === `${id}.shape`)?.op\n return {\n id,\n ...(shape ? { shape } : {}),\n ...(on ? { on } : {}),\n /* How it moves: each axis of its joint in order (ADR-0159); none for a fastening. */\n ...(joint ? { joint: { id: joint.id, ...(joint.motion?.length ? { motion: joint.motion.map((m: Dynamic) => m.type) } : {}) } } : {}),\n ...(look.material?.token ? { material: look.material.token } : {}),\n chars: length(figurePartReadOf(asset, id))\n }\n })\n}\n\n/** Writes a section into the outline at its pointer, making the objects on the way. */\nfunction place(outline: Dynamic, tokens: readonly string[], value: unknown) {\n let at = outline\n tokens.slice(0, -1).forEach(token => (at = at[token] ??= {}))\n at[tokens[tokens.length - 1]!] = value\n}\n\n/**\n * What the view wraps the outline in, read or not: an outline that took the whole budget left the view over it by these\n * (53 characters, a figure of 3000 long-named parts, 2026-10-19).\n */\nconst VIEW_ENVELOPE = () => length({ whole: false, outline: {}, parts: {}, shown: [], sections: {}, notRead: [] }) - length({})\n\n/**\n * The outline: within OUTLINE_SHARE for its sections, the largest left out first; and, every field counted, within the\n * budget less what the view wraps it in -- a figure of very many parts lists them by id only, then as many as fit.\n */\nexport function figureOutlineOf(asset: FigureAsset, chars = length(asset)): FigureOutline {\n const limit = FIGURE_CONTEXT_BUDGET - VIEW_ENVELOPE()\n const model = asset.document.model as Dynamic\n const sections = sectionsOf(asset).map(pointer => ({ pointer, value: valueAt(asset, tokensOf(pointer)!).value }))\n const sized = sections.map(s => ({ ...s, chars: length(s.value) })).sort((a, b) => b.chars - a.chars)\n\n let total = sized.reduce((sum, s) => sum + s.chars, 0)\n const omitted: FigureOmittedSection[] = []\n const kept = new Set(sized.map(s => s.pointer))\n for (const s of sized) {\n if (total <= OUTLINE_SHARE) break\n kept.delete(s.pointer)\n total -= s.chars\n const entries = entriesOf(s.pointer, s.value)\n omitted.push({ section: s.pointer, chars: s.chars, ...(entries.length ? { entries } : {}) })\n }\n\n const outline: Dynamic = { chars, budget: FIGURE_CONTEXT_BUDGET }\n place(outline, ['document', 'model', 'nodes'], model.nodes.length)\n place(outline, ['document', 'model', 'constants'], model.constants.length)\n for (const s of sections) if (kept.has(s.pointer)) place(outline, tokensOf(s.pointer)!, s.value)\n if (omitted.length) outline.omitted = omitted\n\n let parts: Dynamic[] = outlinePartsOf(asset)\n outline.parts = parts\n if (length(outline) > limit) outline.parts = parts = parts.map(p => ({ id: p.id }))\n if (length(outline) > limit) {\n /* As many as fit, in part order, with how many more there are. */\n let room = limit - length({ ...outline, parts: [], partsNotListed: parts.length })\n const listed: Dynamic[] = []\n for (const p of parts) {\n room -= length(p) + 1\n if (room < 0) break\n listed.push(p)\n }\n outline.parts = listed\n outline.partsNotListed = parts.length - listed.length\n }\n return outline as FigureOutline\n}\n\n/* ── The view ────────────────────────────────────────────────────────────────────────── */\n\n/**\n * The view of a figure the model is shown: whole when it fits, else the outline and what was asked for -- parts, then\n * sections, each in the order asked -- while it fits beside it. Every field counted, the view is within the budget.\n */\nexport function figureViewOf(asset: FigureAsset, request: FigureReadRequest = {}): FigureView {\n const chars = length(asset)\n if (chars <= FIGURE_CONTEXT_BUDGET) return { whole: true, source: asset }\n\n const outline = figureOutlineOf(asset, chars)\n const view: FigureView = { whole: false, outline, parts: {}, shown: [], sections: {}, notRead: [] }\n const room = () => FIGURE_CONTEXT_BUDGET - length(view)\n const refuse = (one: { part: string; reason: string } | { section: string; reason: string }) => {\n if (length(one) + 1 <= room()) view.notRead!.push(one)\n }\n\n for (const part of [...new Set(request.parts ?? [])]) {\n const one = figurePartReadOf(asset, part)\n if (!one) {\n refuse({ part, reason: `${part} is not a part of this figure; the outline lists its parts` })\n continue\n }\n const cost = length(one) + length(part) + length(part) + 3\n view.parts![part] = one\n view.shown!.push(part)\n if (room() >= 0) continue\n delete view.parts![part]\n view.shown!.pop()\n if (cost <= FIGURE_CONTEXT_BUDGET - length(outline)) {\n refuse({ part, reason: `${part} (${cost} characters) does not fit beside what is already read; read it in another call with fewer parts or sections` })\n } else {\n const pointers = partPointers(asset, part)\n refuse({\n part,\n reason:\n `${part} (${cost} characters) is too large to show beside the outline; read its records as sections: ` +\n `${pointers.slice(0, ENTRIES_NAMED).join(', ')}${pointers.length > ENTRIES_NAMED ? ` and ${pointers.length - ENTRIES_NAMED} more` : ''}. ` +\n 'Parts read as sections are not counted as read in full: they cannot be changed'\n })\n }\n }\n\n for (const section of [...new Set(request.sections ?? [])]) {\n const tokens = tokensOf(section)\n const at = tokens && tokens.length ? valueAt(asset, tokens) : { found: false }\n if (!at.found) {\n refuse({ section, reason: `there is no section ${section}; a section is a JSON Pointer such as /document/capabilities/bindings/0` })\n continue\n }\n const cost = length(at.value) + length(section) + 2\n view.sections![section] = at.value\n if (room() >= 0) continue\n delete view.sections![section]\n const entries = entriesOf(section, at.value)\n refuse({\n section,\n reason: entries.length\n ? `${section} (${cost} characters) is too large to show at once here; read its entries: ${entries.map(e => `${e.section} (${e.chars})`).join(', ')}`\n : `${section} is one value of ${length(at.value)} characters, larger than can be shown here; it cannot be read or changed by a proposal`\n })\n }\n\n if (!view.notRead!.length) delete view.notRead\n return view\n}\n\n/* ── What a proposal may change ──────────────────────────────────────────────────────── */\n\ntype StepOf<K extends FigureProposalStep['kind']> = Extract<FigureProposalStep, { kind: K }>\ntype Subject = string | undefined\n\n/**\n * The part each kind of step changes, read from the field the kernel reads for that kind (audit D4-R1: a `part` beside a\n * `set-material`'s `target` is not read by the kernel, so it may not stand in for it). Every kind of the kernel's step\n * type is here, or this does not compile. A step that changes no one part says so with undefined: what it does to the\n * figure's sections is held by `unreadSectionEdits`.\n */\nconst SUBJECT: { [K in FigureProposalStep['kind']]: (step: StepOf<K>, base: FigureAsset) => Subject } = {\n 'add-part': () => undefined,\n 'set-section-corner': step => step.part,\n 'set-cavity': step => step.part,\n 'set-section': step => step.part,\n attach: step => step.part,\n 'link-dimension': step => step.part,\n 'follow-size': step => step.part,\n 'unlink-dimension': step => step.part,\n 'scale-position': step => step.part,\n 'fix-position': step => step.part,\n 'nudge-part': step => step.part,\n detach: step => step.part,\n 'make-repeat': step => step.part,\n 'set-repeat': step => step.part,\n 'remove-repeat': step => step.part,\n 'set-mounting-face': step => step.part,\n 'add-binding': step => step.part,\n 'set-joint': step => step.joint?.body1?.part,\n 'remove-joint': (step, base) => ((base as Dynamic).joints ?? []).find((j: Dynamic) => j?.id === step.id)?.body1?.part,\n 'set-material': step => step.target,\n 'set-segments': step => step.target,\n 'rename-part': step => step.target,\n 'set-visibility': step => step.target,\n 'remove-part': step => step.target,\n 'duplicate-part': step => step.target,\n 'move-part': step => step.target,\n 'set-placement': () => undefined,\n 'declare-instance-size': () => undefined,\n 'clear-mounting-face': () => undefined,\n 'scale-uniformly': () => undefined,\n 'follow-size-in-proportion': () => undefined,\n 'set-detail-level': () => undefined,\n 'add-design-input': () => undefined,\n 'set-input-range': () => undefined,\n 'publish-input': () => undefined,\n 'unpublish-input': () => undefined,\n 'remove-binding': () => undefined,\n 'set-slot-layout': () => undefined,\n 'remove-slot-layout': () => undefined,\n 'set-extension': () => undefined,\n rename: () => undefined,\n 'set-capabilities': () => undefined,\n 'set-state-input': () => undefined,\n 'set-state-defaults': () => undefined,\n 'set-driver': () => undefined,\n 'remove-driver': () => undefined,\n 'set-clip': () => undefined,\n 'set-motion-group': () => undefined,\n 'remove-motion-group': () => undefined,\n 'set-data-schema': () => undefined,\n 'rename-data-field': () => undefined,\n 'set-data-binding': () => undefined,\n 'remove-data-binding': () => undefined,\n 'set-status-port': () => undefined,\n 'remove-status-port': () => undefined\n}\n\n/**\n * The steps that change a part of the base not shown in full, as reasons said back to the writer. A part may still be\n * named to fasten to or to follow -- the kernel works from it, nothing about it is guessed -- and a new part is the\n * steps' own. A kind this table does not know is refused: it is not let through unjudged.\n */\nexport function unreadPartEdits(base: FigureAsset, steps: readonly FigureProposalStep[], view: FigureView): string[] {\n const existing = new Set(base.appearance.map(a => a.target))\n const shown = new Set(view.shown ?? [])\n const allowed = [...shown].join(', ') || 'none'\n return steps.flatMap((step, i) => {\n const kind = (step as Dynamic)?.kind\n if (typeof kind !== 'string') return []\n const judge = (SUBJECT as Record<string, (step: Dynamic, base: FigureAsset) => Subject>)[kind]\n if (!Object.prototype.hasOwnProperty.call(SUBJECT, kind) || !judge)\n return [`UNKNOWN_STEP: steps[${i}] has the kind \"${kind}\", which is not one of the commands; use only the commands taught.`]\n const part = judge(step, base)\n if (typeof part !== 'string' || !existing.has(part) || shown.has(part)) return []\n return [\n `UNREAD_PART: steps[${i}] (${kind}) changes \"${part}\", which was not shown in full, so its source is not known here. ` +\n `Change only the parts shown in full (${allowed}) or parts the steps add. To change ${part}, read it with getFigureSource parts and pass it in parts to proposeFigureCandidate.`\n ]\n })\n}\n\n/** Entries of a value, keyed by `id` when every entry of a list has a distinct one, else by place. */\nfunction keyedEntries(value: unknown): Map<string, { token: string; value: unknown }> {\n const out = new Map<string, { token: string; value: unknown }>()\n if (Array.isArray(value)) {\n const ids = value.map(v => (v && typeof v === 'object' && typeof (v as Dynamic).id === 'string' ? (v as Dynamic).id : undefined))\n const byId = ids.every(Boolean) && new Set(ids).size === ids.length\n value.forEach((v, i) => out.set(byId ? `id:${ids[i]}` : `at:${i}`, { token: String(i), value: v }))\n } else if (value && typeof value === 'object') {\n for (const [key, v] of Object.entries(value)) out.set(`key:${key}`, { token: key, value: v })\n }\n return out\n}\n\n/**\n * What of the sections left out of the outline and not read the steps changed, as reasons said back to the writer. Judged\n * on what the steps made, not on what they say: nothing that was there may be changed or taken away. A new entry -- a\n * record in a list, a key in a map -- is the steps' own.\n */\nexport function unreadSectionEdits(base: FigureAsset, after: FigureAsset, view: FigureView): string[] {\n const read = Object.keys(view.sections ?? {})\n const reasons: string[] = []\n const say = (pointer: string, what: string) =>\n reasons.push(\n `UNREAD_SECTION: the steps ${what} ${pointer}, which was left out of the outline and not read, so it is not known here. ` +\n `Leave it as it is; to change it, read it with getFigureSource sections and pass it in sections to proposeFigureCandidate.`\n )\n const check = (pointer: string, before: unknown, now: unknown) => {\n if (reasons.length >= ENTRIES_NAMED || read.some(r => within(pointer, r))) return\n const records = (v: unknown) => v !== null && typeof v === 'object'\n if (!records(before) || !records(now) || Array.isArray(before) !== Array.isArray(now)) {\n if (JSON.stringify(before) !== JSON.stringify(now)) say(pointer, 'change')\n return\n }\n const later = keyedEntries(now)\n for (const [key, entry] of keyedEntries(before)) {\n const child = `${pointer}/${escapeToken(entry.token)}`\n const kept = later.get(key)\n if (kept) check(child, entry.value, kept.value)\n else if (!read.some(r => within(child, r))) say(child, 'remove')\n }\n }\n for (const omitted of view.outline?.omitted ?? []) {\n const tokens = tokensOf(omitted.section)!\n check(omitted.section, valueAt(base, tokens).value, valueAt(after, tokens).value)\n }\n return reasons\n}\n"]}