@wenathlan/saddle 2.0.167 → 2.0.170

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.
package/workloadlaw.ts CHANGED
@@ -1,5 +1,6 @@
1
- // # workloadlaw — the family workload lane catalog and the join law of the
2
- // engine (root layer, wave WL1). One row per heavy workload lane of every
1
+ // # workloadlaw — the family workload lane catalog, the join law of the
2
+ // engine and the lane seat factory of the app seats (root layer, waves
3
+ // WL1 + W5). One row per heavy workload lane of every
3
4
  // official app of the family: the app that owns the lane, the lane's name,
4
5
  // the demand the lane puts on the sandbox (gpu, network, isolation depth,
5
6
  // boot budget) and where the lane runs today. The law this module answers
@@ -89,52 +90,268 @@ export type LaneJoin = {
89
90
  * the join computes the answer from the registry of record. */
90
91
  export const FAMILYLANES: readonly WorkloadLane[] = Object.freeze([
91
92
  // the argan lanes: the dns engine's heavy passes
92
- { app: "argan", lane: "dnssec-validate", role: "the dnssec chain validation walk: rrsig parsing, key tag checksums, validity windows and ds match rules over untrusted input", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "app-lane" },
93
- { app: "argan", lane: "zonefile-parse-diff", role: "the master file parse and the external-dns diff: tokenizer, normalization, creates/deletes/updates by group", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "app-lane" },
94
- { app: "argan", lane: "catalog-registry-serve", role: "the registry tables the catalog serves: mime types, protocols and seed rows over https and db, never the browser fallback", demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 }, today: "app-lane" },
95
- { app: "argan", lane: "label-store-seed", role: "the label manifest seed into the store: the upsert walk that protects translated rows, mirrored server-side", demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 }, today: "app-lane" },
93
+ {
94
+ app: "argan",
95
+ lane: "dnssec-validate",
96
+ role: "the dnssec chain validation walk: rrsig parsing, key tag checksums, validity windows and ds match rules over untrusted input",
97
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
98
+ today: "app-lane",
99
+ },
100
+ {
101
+ app: "argan",
102
+ lane: "zonefile-parse-diff",
103
+ role: "the master file parse and the external-dns diff: tokenizer, normalization, creates/deletes/updates by group",
104
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
105
+ today: "app-lane",
106
+ },
107
+ {
108
+ app: "argan",
109
+ lane: "catalog-registry-serve",
110
+ role: "the registry tables the catalog serves: mime types, protocols and seed rows over https and db, never the browser fallback",
111
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 },
112
+ today: "app-lane",
113
+ },
114
+ {
115
+ app: "argan",
116
+ lane: "label-store-seed",
117
+ role: "the label manifest seed into the store: the upsert walk that protects translated rows, mirrored server-side",
118
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 },
119
+ today: "app-lane",
120
+ },
96
121
  // the cadria lanes: the versawaze engine's generation passes
97
- { app: "cadria", lane: "analyze-wav", role: "the audio analysis pipeline: decode, downmix, resample, stft and the spectrum, rhythm, tonality, timbre and structure fusion", demand: { gpu: false, network: false, isolation: "process", bootbudget: 800 }, today: "engine-lane" },
98
- { app: "cadria", lane: "generate-image", role: "the image generation walk: palette, composition blocks, rhythm scatter, texture and motion into the deterministic project", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "engine-lane" },
99
- { app: "cadria", lane: "render-svg", role: "the svg render of the image project: draw command compilation and the byte-deterministic serialization", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "engine-lane" },
100
- { app: "cadria", lane: "decode-video", role: "the frame-accurate video decode lane: the container-namespace pass the codec walk rides, never the visitor decoder", demand: { gpu: false, network: false, isolation: "namespace", bootbudget: 800 }, today: "app-lane" },
101
- { app: "cadria", lane: "compile-shader", role: "the shader program assembly: the fragment library, the deterministic manifest and the sha digest, no visitor gpu ever compiles", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "engine-lane" },
122
+ {
123
+ app: "cadria",
124
+ lane: "analyze-wav",
125
+ role: "the audio analysis pipeline: decode, downmix, resample, stft and the spectrum, rhythm, tonality, timbre and structure fusion",
126
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 800 },
127
+ today: "engine-lane",
128
+ },
129
+ {
130
+ app: "cadria",
131
+ lane: "generate-image",
132
+ role: "the image generation walk: palette, composition blocks, rhythm scatter, texture and motion into the deterministic project",
133
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
134
+ today: "engine-lane",
135
+ },
136
+ {
137
+ app: "cadria",
138
+ lane: "render-svg",
139
+ role: "the svg render of the image project: draw command compilation and the byte-deterministic serialization",
140
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
141
+ today: "engine-lane",
142
+ },
143
+ {
144
+ app: "cadria",
145
+ lane: "decode-video",
146
+ role: "the frame-accurate video decode lane: the container-namespace pass the codec walk rides, never the visitor decoder",
147
+ demand: { gpu: false, network: false, isolation: "namespace", bootbudget: 800 },
148
+ today: "app-lane",
149
+ },
150
+ {
151
+ app: "cadria",
152
+ lane: "compile-shader",
153
+ role: "the shader program assembly: the fragment library, the deterministic manifest and the sha digest, no visitor gpu ever compiles",
154
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
155
+ today: "engine-lane",
156
+ },
102
157
  // the cobaia lanes: the monetization surface's light walks
103
- { app: "cobaia", lane: "plan-checkout", role: "the plan checkout surface: mrr plan rows, link validation and the billing webhook walk when it lands, secrets server-side", demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 }, today: "app-lane" },
104
- { app: "cobaia", lane: "ads-slot", role: "the honest ad slot lane: the reserved slots and the rotation decision the deploy answers before the render", demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 }, today: "app-lane" },
105
- { app: "cobaia", lane: "label-seed", role: "the label manifest seed of the monetization face: the store walk the sqlite vault carries", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "app-lane" },
158
+ {
159
+ app: "cobaia",
160
+ lane: "plan-checkout",
161
+ role: "the plan checkout surface: mrr plan rows, link validation and the billing webhook walk when it lands, secrets server-side",
162
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 },
163
+ today: "app-lane",
164
+ },
165
+ {
166
+ app: "cobaia",
167
+ lane: "ads-slot",
168
+ role: "the honest ad slot lane: the reserved slots and the rotation decision the deploy answers before the render",
169
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 },
170
+ today: "app-lane",
171
+ },
172
+ {
173
+ app: "cobaia",
174
+ lane: "label-seed",
175
+ role: "the label manifest seed of the monetization face: the store walk the sqlite vault carries",
176
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
177
+ today: "app-lane",
178
+ },
106
179
  // the debonair lanes: the kathesis engine's audio walks
107
- { app: "debonair", lane: "ingest-audio", role: "the ingest worker: the stream separation, the pcm downmix and the payload json the reconstruction reads", demand: { gpu: false, network: false, isolation: "process", bootbudget: 800 }, today: "engine-lane" },
108
- { app: "debonair", lane: "render-track", role: "the render worker: the composed plan render, the mastering chain and the wav encode into the take store", demand: { gpu: false, network: false, isolation: "process", bootbudget: 800 }, today: "engine-lane" },
180
+ {
181
+ app: "debonair",
182
+ lane: "ingest-audio",
183
+ role: "the ingest worker: the stream separation, the pcm downmix and the payload json the reconstruction reads",
184
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 800 },
185
+ today: "engine-lane",
186
+ },
187
+ {
188
+ app: "debonair",
189
+ lane: "render-track",
190
+ role: "the render worker: the composed plan render, the mastering chain and the wav encode into the take store",
191
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 800 },
192
+ today: "engine-lane",
193
+ },
109
194
  // the forge lanes: the execution clone's run walks
110
- { app: "forge", lane: "binary-run", role: "the binary run lane: the runner the saddle engine answers for the fleet, the mode gate resolving through the join", demand: { gpu: false, network: true, isolation: "namespace", bootbudget: 800 }, today: "app-lane" },
111
- { app: "forge", lane: "queue-priority", role: " the run queue walk: express, normal and batch ordering over the queue the lane serves", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "app-lane" },
195
+ {
196
+ app: "forge",
197
+ lane: "binary-run",
198
+ role: "the binary run lane: the runner the saddle engine answers for the fleet, the mode gate resolving through the join",
199
+ demand: { gpu: false, network: true, isolation: "namespace", bootbudget: 800 },
200
+ today: "app-lane",
201
+ },
202
+ {
203
+ app: "forge",
204
+ lane: "queue-priority",
205
+ role: " the run queue walk: express, normal and batch ordering over the queue the lane serves",
206
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
207
+ today: "app-lane",
208
+ },
112
209
  // the foundry lanes: the pipeline clone's graph walks
113
- { app: "foundry", lane: "pipeline-graph", role: "the pipeline graph lane: provision, pull, run, collect and store — the plan walk the herd drives", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "app-lane" },
114
- { app: "foundry", lane: "image-artifact", role: "the image artifact lane: the format plans, the checksum seals and the shelf records the vault stores", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "app-lane" },
210
+ {
211
+ app: "foundry",
212
+ lane: "pipeline-graph",
213
+ role: "the pipeline graph lane: provision, pull, run, collect and store — the plan walk the herd drives",
214
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
215
+ today: "app-lane",
216
+ },
217
+ {
218
+ app: "foundry",
219
+ lane: "image-artifact",
220
+ role: "the image artifact lane: the format plans, the checksum seals and the shelf records the vault stores",
221
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
222
+ today: "app-lane",
223
+ },
115
224
  // the getry lanes: the ai gateway's inference walks
116
- { app: "getry", lane: "inference-route", role: "the inference route lane: the provider pool, the sse parse and the model masking over the upstream calls", demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 }, today: "engine-lane" },
117
- { app: "getry", lane: "stream-fallback", role: "the resilience runner: the verdict ladder, the backoff walk and the trail the retry lane keeps", demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 }, today: "engine-lane" },
118
- { app: "getry", lane: "thinking-ladder", role: "the seven-level reasoning ladder: the budget resolution the request injects before the upstream call", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "engine-lane" },
119
- { app: "getry", lane: "router-rotation", role: "the rotation lane: the weighted draw, the cooldown ledger and the session rows the store keeps", demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 }, today: "engine-lane" },
225
+ {
226
+ app: "getry",
227
+ lane: "inference-route",
228
+ role: "the inference route lane: the provider pool, the sse parse and the model masking over the upstream calls",
229
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 },
230
+ today: "engine-lane",
231
+ },
232
+ {
233
+ app: "getry",
234
+ lane: "stream-fallback",
235
+ role: "the resilience runner: the verdict ladder, the backoff walk and the trail the retry lane keeps",
236
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 },
237
+ today: "engine-lane",
238
+ },
239
+ {
240
+ app: "getry",
241
+ lane: "thinking-ladder",
242
+ role: "the seven-level reasoning ladder: the budget resolution the request injects before the upstream call",
243
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
244
+ today: "engine-lane",
245
+ },
246
+ {
247
+ app: "getry",
248
+ lane: "router-rotation",
249
+ role: "the rotation lane: the weighted draw, the cooldown ledger and the session rows the store keeps",
250
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 },
251
+ today: "engine-lane",
252
+ },
120
253
  // the saddle lanes: the engine's own dispatch surface
121
- { app: "saddle", lane: "edge-dispatch", role: "the edge plane dispatch itself: the visitor guard, the lane resolution and the artifact commit through the vault seam", demand: { gpu: false, network: true, isolation: "process", bootbudget: 1500 }, today: "engine-lane" },
254
+ {
255
+ app: "saddle",
256
+ lane: "edge-dispatch",
257
+ role: "the edge plane dispatch itself: the visitor guard, the lane resolution and the artifact commit through the vault seam",
258
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 1500 },
259
+ today: "engine-lane",
260
+ },
122
261
  // the stealthhead lanes: the fps platform's simulation walks
123
- { app: "stealthhead", lane: "match-simulate", role: "the authoritative match simulation: the fixed-step physics, the reconcile and rewind twin and the seeded spawns", demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 }, today: "app-lane" },
124
- { app: "stealthhead", lane: "rank-compute", role: "the ranking walk: the elo ladder, the season batch and the position assignment over the standing rows", demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 }, today: "app-lane" },
125
- { app: "stealthhead", lane: "world-bake", role: "the world pre-compilation: the map bake through the render engine — the gpu pass the planned modalities answer", demand: { gpu: true, network: true, isolation: "vm", bootbudget: 1500 }, today: "app-lane" },
126
- { app: "stealthhead", lane: "ballistics-balance", role: "the armory balance sweep: falloff, shots-to-kill and ttk validation, offline and deterministic", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "app-lane" },
262
+ {
263
+ app: "stealthhead",
264
+ lane: "match-simulate",
265
+ role: "the authoritative match simulation: the fixed-step physics, the reconcile and rewind twin and the seeded spawns",
266
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 },
267
+ today: "app-lane",
268
+ },
269
+ {
270
+ app: "stealthhead",
271
+ lane: "rank-compute",
272
+ role: "the ranking walk: the elo ladder, the season batch and the position assignment over the standing rows",
273
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 },
274
+ today: "app-lane",
275
+ },
276
+ {
277
+ app: "stealthhead",
278
+ lane: "world-bake",
279
+ role: "the world pre-compilation: the map bake through the render engine — the gpu pass the planned modalities answer",
280
+ demand: { gpu: true, network: true, isolation: "vm", bootbudget: 1500 },
281
+ today: "app-lane",
282
+ },
283
+ {
284
+ app: "stealthhead",
285
+ lane: "ballistics-balance",
286
+ role: "the armory balance sweep: falloff, shots-to-kill and ttk validation, offline and deterministic",
287
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
288
+ today: "app-lane",
289
+ },
127
290
  // the vault lanes: the storage engine's object walks
128
- { app: "vault", lane: "blob-ingest", role: "the object deposit lane: path and mime validation, the quota gate inside the write transaction and the detach walk", demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 }, today: "engine-lane" },
129
- { app: "vault", lane: "chunk-window", role: "the chunk window lane: the fixed slicing, the per-window digest and the brotli decision over the byte stream", demand: { gpu: false, network: false, isolation: "process", bootbudget: 800 }, today: "engine-lane" },
130
- { app: "vault", lane: "digest-sha256", role: "the digest engine: the sha-256 master and chunk walks and the full re-verification the read path answers", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "engine-lane" },
131
- { app: "vault", lane: "ref-gc", role: "the reference gc lane: the soft-delete tombstones, the ref detach and the orphan sweep the store drives", demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 }, today: "engine-lane" },
291
+ {
292
+ app: "vault",
293
+ lane: "blob-ingest",
294
+ role: "the object deposit lane: path and mime validation, the quota gate inside the write transaction and the detach walk",
295
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 },
296
+ today: "engine-lane",
297
+ },
298
+ {
299
+ app: "vault",
300
+ lane: "chunk-window",
301
+ role: "the chunk window lane: the fixed slicing, the per-window digest and the brotli decision over the byte stream",
302
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 800 },
303
+ today: "engine-lane",
304
+ },
305
+ {
306
+ app: "vault",
307
+ lane: "digest-sha256",
308
+ role: "the digest engine: the sha-256 master and chunk walks and the full re-verification the read path answers",
309
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
310
+ today: "engine-lane",
311
+ },
312
+ {
313
+ app: "vault",
314
+ lane: "ref-gc",
315
+ role: "the reference gc lane: the soft-delete tombstones, the ref detach and the orphan sweep the store drives",
316
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 },
317
+ today: "engine-lane",
318
+ },
132
319
  // the devthink lanes: the os envelope's command walks
133
- { app: "devthink", lane: "chat-sandbox", role: "the chat sandbox lane: the session jail, the tool surface and the exec walks the engine dispatches server-side", demand: { gpu: false, network: true, isolation: "namespace", bootbudget: 1500 }, today: "engine-lane" },
134
- { app: "devthink", lane: "llm-gateway", role: "the universal gateway pipeline: model resolution, auth, body building, retry and the streaming byte passthrough", demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 }, today: "engine-lane" },
135
- { app: "devthink", lane: "stream-parse", role: "the streaming parser: the tolerant sse walk, the payload normalization and the delta tracking over the live stream", demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 }, today: "engine-lane" },
136
- { app: "devthink", lane: "graph-run", role: "the graph runner: the deterministic stage walk, the retry ladder and the progress views the console draws", demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 }, today: "engine-lane" },
137
- { app: "devthink", lane: "mcp-serve", role: "the mcp registry lane: the tool catalog, the approval gates and the transports the server answers", demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 }, today: "engine-lane" },
320
+ {
321
+ app: "devthink",
322
+ lane: "chat-sandbox",
323
+ role: "the chat sandbox lane: the session jail, the tool surface and the exec walks the engine dispatches server-side",
324
+ demand: { gpu: false, network: true, isolation: "namespace", bootbudget: 1500 },
325
+ today: "engine-lane",
326
+ },
327
+ {
328
+ app: "devthink",
329
+ lane: "llm-gateway",
330
+ role: "the universal gateway pipeline: model resolution, auth, body building, retry and the streaming byte passthrough",
331
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 },
332
+ today: "engine-lane",
333
+ },
334
+ {
335
+ app: "devthink",
336
+ lane: "stream-parse",
337
+ role: "the streaming parser: the tolerant sse walk, the payload normalization and the delta tracking over the live stream",
338
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 25 },
339
+ today: "engine-lane",
340
+ },
341
+ {
342
+ app: "devthink",
343
+ lane: "graph-run",
344
+ role: "the graph runner: the deterministic stage walk, the retry ladder and the progress views the console draws",
345
+ demand: { gpu: false, network: false, isolation: "process", bootbudget: 25 },
346
+ today: "engine-lane",
347
+ },
348
+ {
349
+ app: "devthink",
350
+ lane: "mcp-serve",
351
+ role: "the mcp registry lane: the tool catalog, the approval gates and the transports the server answers",
352
+ demand: { gpu: false, network: true, isolation: "process", bootbudget: 800 },
353
+ today: "engine-lane",
354
+ },
138
355
  ]);
139
356
 
140
357
  /** The official app slugs the catalog covers — the lockstep vocabulary the
@@ -291,3 +508,85 @@ export function workloadreport(): FamilyWorkloadReport {
291
508
  perapp,
292
509
  };
293
510
  }
511
+
512
+ // The lane seat engine (wave W5, the dedup law): every app file of the
513
+ // family once carried its own copy of the seat resolver (the deploy's
514
+ // opt-in walk — local, join or a pinned modality id), the env reader and
515
+ // the lane lookup beside its own lane table. The engine lives here once
516
+ // now: the factory below binds the law — ported verbatim from the app
517
+ // seats the wave folded, zero behavior change — to the app's own slug,
518
+ // env var name and lane table, and the app seats re-export the bound
519
+ // functions under the historical names their batteries pin, so the
520
+ // engine is never duplicated between apps (the family law: the owner
521
+ // exports, the apps import). The seat stays as pure as the catalog: no
522
+ // new imports, no storage, the browser-pure bundle keeps carrying it.
523
+
524
+ /** One workload lane row as the app seats speak it — the historical
525
+ * surface name of the engine's own row shape (WorkloadLane above): the
526
+ * alias keeps every app importer stable while the engine owns the shape
527
+ * (the dedup law — one row shape, one owner). */
528
+ export type AppWorkloadLane = WorkloadLane;
529
+
530
+ /** The typed answer of the lane seat: the declaration the deploy reads —
531
+ * local (the lanes run in the deploy's own process), join (the platform
532
+ * resolves every lane through the engine's join resolver), or the pinned
533
+ * modality id the deploy named (validated by the platform's join at
534
+ * dispatch, never judged here). every answer is honest: an absent or
535
+ * blank choice answers the declared default, never a silent switch. */
536
+ export type LaneSeatResult =
537
+ | { ok: true; seat: "local"; sandboxed: false }
538
+ | { ok: true; seat: "join"; sandboxed: true; pinned: false }
539
+ | { ok: true; seat: string; sandboxed: true; pinned: true };
540
+
541
+ /** One app's lane seating — the bound engine the app seats re-export:
542
+ * the app's own slug, env var name and lane table beside the seat
543
+ * functions the app surface speaks (the names the batteries pin). */
544
+ export type LaneSeating = {
545
+ /** The official app slug the seating carries. */
546
+ APPSLUG: string;
547
+ /** The environment name the deploy pins the seat through. */
548
+ SANDBOXLANEENV: string;
549
+ /** The lane table the seating answers lookups from. */
550
+ WORKLOADLANES: readonly AppWorkloadLane[];
551
+ /** Resolves the sandbox lane seat — the deploy's opt-in choice walk. */
552
+ lanesandbox: (choice: string | undefined) => LaneSeatResult;
553
+ /** Reads the seat off one environment lookup — the injected env carrier. */
554
+ lanesandboxfromenv: (lookup: (key: string) => string | undefined) => LaneSeatResult;
555
+ /** Answers one lane row by lane id — the lookup the app surfaces read. */
556
+ laneof: (lane: string) => AppWorkloadLane | undefined;
557
+ };
558
+
559
+ /** Builds one app's lane seating — the lane seat engine of the family
560
+ * bound to the app's own data: the resolver, the env reader and the lane
561
+ * lookup ported verbatim from the app files the wave folded, closed over
562
+ * the env var name and the lane table the app hands in. the app seat
563
+ * keeps only its data — the slug, the env var name, the lane table — and
564
+ * re-exports the bound functions under the names its surface always
565
+ * spoke, so the engine is never duplicated between apps (the family law:
566
+ * the owner exports, the apps import).
567
+ *
568
+ * @param options the app's own seating data: the slug, the env var name
569
+ * the deploy pins the seat through and the lane table the lookups read.
570
+ * @returns the bound seating.
571
+ */
572
+ export function laneseating(options: { slug: string; envvar: string; lanes: readonly AppWorkloadLane[] }): LaneSeating {
573
+ const SANDBOXLANEENV = options.envvar;
574
+ const WORKLOADLANES = options.lanes;
575
+ function lanesandbox(choice: string | undefined): LaneSeatResult {
576
+ const name = choice?.trim() ?? "";
577
+ if (name.length === 0 || name === "local") {
578
+ return { ok: true, seat: "local", sandboxed: false };
579
+ }
580
+ if (name === "join") {
581
+ return { ok: true, seat: "join", sandboxed: true, pinned: false };
582
+ }
583
+ return { ok: true, seat: name, sandboxed: true, pinned: true };
584
+ }
585
+ function lanesandboxfromenv(lookup: (key: string) => string | undefined): LaneSeatResult {
586
+ return lanesandbox(lookup(SANDBOXLANEENV));
587
+ }
588
+ function laneof(lane: string): AppWorkloadLane | undefined {
589
+ return WORKLOADLANES.find((row) => row.lane === lane);
590
+ }
591
+ return { APPSLUG: options.slug, SANDBOXLANEENV, WORKLOADLANES, lanesandbox, lanesandboxfromenv, laneof };
592
+ }