@melite/harness-provisioner 0.1.4-alpha → 0.1.5-pre-alpha

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/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ ---
2
+ description: The vanilla-DSH provisioner — mounts the Melite estate bundle and renders ready-to-boot profiles into any DSH_HOME.
3
+ kind: package-bundle
4
+ ---
5
+
1
6
  # @melite/harness-provisioner
2
7
 
3
8
  The provisioner mounts the Melite estate into a vanilla DSH installation and
@@ -19,12 +24,13 @@ The workspace-linked bundle mounts the estate host row and its DSH surfaces:
19
24
 
20
25
  The package's own `cordis.patch.yml` and the packages' self-registration rows
21
26
  own the Cordis composition. This README does not duplicate those rows.
27
+ Declared exports: `.` (the workspace-linked bundle row) and `./package.json`.
22
28
 
23
29
  ## Render profiles
24
30
 
25
31
  ```sh
26
32
  node packages/harness/provisioner/bin/infer-provision.mjs all
27
- node packages/harness/provisioner/bin/infer-provision.mjs profile inference
33
+ node packages/harness/provisioner/bin/infer-provision.mjs profile melite-test
28
34
  node packages/harness/provisioner/bin/infer-provision.mjs profile headless --dsh-home /tmp/melite-dsh
29
35
  ```
30
36
 
@@ -63,3 +69,29 @@ pnpm run lint
63
69
  The profile renderer and its package links are the source of truth for profile
64
70
  membership; the current documentation index points here for the operator
65
71
  workflow.
72
+
73
+ ## Model Experience
74
+
75
+ ### Request context and condition
76
+
77
+ #### What the model sees
78
+
79
+ None — the package contributes no model-visible input; it renders profiles
80
+ and mounts rows, and whatever reaches a model request arrives through the
81
+ mounted tool plane, not this package.
82
+
83
+ #### Token effect
84
+
85
+ Zero-direct token effect.
86
+
87
+ #### KV Cache effect
88
+
89
+ Independent — no conversation state.
90
+
91
+ ## Known Limitations and Deferred Work
92
+
93
+ - **Rendered profiles are machine-local state** — they are not a source of
94
+ truth; re-render after manifest or workspace changes.
95
+ - **Headless selection is render-time** — `MELITE_HEADLESS` picks the
96
+ delegated run interface per profile; there is no per-request interface
97
+ switch.
@@ -3,8 +3,10 @@
3
3
  * infer-provision — profile provisioner for vanilla DSH installs.
4
4
  *
5
5
  * The bundle patch (cordis.patch.yml) covers the ROWS; this bin covers
6
- * the PROFILES: renders ready-to-boot profile dirs (inference /
7
- * headless / estate / melite-test) and installs their link deps.
6
+ * the PROFILES: renders ready-to-boot profile dirs (melite-test /
7
+ * headless / estate) and installs their link deps. Every render
8
+ * stamps render-provenance.json (F5: who/what/when/flags) and holds
9
+ * the profile's render lock across render+install (F6).
8
10
  * Self-locating — every path derives from this file's own location
9
11
  * (the provisioner package and its siblings), so a family re-split
10
12
  * or repo move changes nothing.
@@ -14,17 +16,29 @@
14
16
  * infer-provision profile <name> # render one profile dir
15
17
  * infer-provision preset # install the agent preset
16
18
  * Flags:
17
- * --dsh-home <dir> default $DSH_HOME || ~/.dsh
19
+ * --dsh-home <dir> default $DSH_HOME || ~/.dsh
20
+ * --estate-agent-route <p/m> estate agent brain, "provider/model"
21
+ * --estate-state-root <dir> override the estate row's stateRoot
22
+ * (walls render hermetic roots through
23
+ * config — never an env redirect)
24
+ * --profile-rows <file> operator rows (llm providers…), verbatim
18
25
  *
19
- * Rendered profiles mount the SAME rows the bundle patch mounts (the
20
- * profile's cordis.patch.yml user layer stays EMPTY by design — the
21
- * bundle owns the rows, so `dsh plugin add` and rendered profiles can
22
- * never drift apart). The template pins: our bundle + the dsh web base
23
- * for 'inference', the plain headless base for 'headless'.
26
+ * Rendered profiles mount the SAME melite rows the bundle patch mounts
27
+ * (the bundle owns the rows, so `dsh plugin add` and rendered profiles
28
+ * can never drift apart). The PROFILE layer (this dir's cordis.patch.yml)
29
+ * owns what no bundle can know: the estate row's seat config — repoRoot
30
+ * always (mechanical: this render's own repo root; the queue seats refuse
31
+ * an unpinned boot loud by design) and agentRoute when the flag names a
32
+ * brain — plus any operator rows spliced verbatim by --profile-rows
33
+ * (llm provider rows ride the profile layer the same way the web
34
+ * profile's own patch carries them; the file is never re-serialized).
35
+ * The template pins: our bundle + the dsh web base for 'melite-test',
36
+ * the plain headless base for 'headless'.
24
37
  */
25
38
 
26
39
  import { execSync } from 'node:child_process'
27
- import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs'
40
+ import { createHash } from 'node:crypto'
41
+ import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, unlinkSync, writeFileSync } from 'node:fs'
28
42
  import { dirname, join, resolve } from 'node:path'
29
43
  import { fileURLToPath } from 'node:url'
30
44
  import process from 'node:process'
@@ -40,14 +54,110 @@ const flag = (name, dflt) => {
40
54
  return i >= 0 && argv[i + 1] ? argv[i + 1] : dflt
41
55
  }
42
56
  const DSH_HOME = flag('--dsh-home', process.env.DSH_HOME || join(process.env.HOME || '~', '.dsh'))
43
- const PROFILE = argv[1] && !argv[1].startsWith('--') ? argv[1] : 'inference'
57
+ const PROFILE = argv[1] && !argv[1].startsWith('--') ? argv[1] : 'melite-test'
58
+ const ESTATE_AGENT_ROUTE = flag('--estate-agent-route', '')
59
+ const ESTATE_STATE_ROOT = flag('--estate-state-root', '')
60
+ const PROFILE_ROWS = flag('--profile-rows', '')
44
61
 
45
62
  const log = (...a) => console.log(...a)
46
63
  const die = (msg) => { console.error('infer-provision: ' + msg); process.exit(1) }
47
64
 
65
+ // ── F6 guards: atomic writes, the render lock, the install ceiling ──
66
+ // ATOMIC WRITES: the renderer owns its files wholesale but wrote
67
+ // them direct — a crash mid-render left a half-written profile that
68
+ // boots strange. Temp + rename per file (J6's writeJsonAtomic idiom,
69
+ // local: this bin is self-contained, no workspace imports). The tmp
70
+ // name is FIXED per file (never pid-suffixed): a killed run's
71
+ // leftover is overwritten by the next render, never accumulated —
72
+ // and the render lock below serializes renders, so no two writers
73
+ // share a tmp.
74
+ function writeFileAtomic(path, content) {
75
+ writeFileSync(path + '.tmp', content)
76
+ renameSync(path + '.tmp', path)
77
+ }
78
+
79
+ // THE RENDER LOCK: two renders (two `all` runs, a render racing a
80
+ // re-render) interleaved package.json and the patch row by row —
81
+ // both callers rendered-then-installed with no mutual exclusion.
82
+ // One lock file per profile dir, exclusive-create: a live holder
83
+ // refuses loud, a stale one (dead pid) is taken with a warning.
84
+ const LOCK_NAME = '.render.lock'
85
+ function acquireLock(dst) {
86
+ const lock = join(dst, LOCK_NAME)
87
+ const take = () => writeFileSync(lock, String(process.pid) + '\n', { flag: 'wx' })
88
+ try {
89
+ take()
90
+ return
91
+ } catch (err) {
92
+ if (err === null || typeof err !== 'object' || err.code !== 'EEXIST') throw err
93
+ }
94
+ const prev = readFileSync(lock, 'utf8').split('\n')[0]
95
+ const pid = Number(prev)
96
+ let alive = false
97
+ if (Number.isInteger(pid) && pid > 0) {
98
+ try { process.kill(pid, 0); alive = true } catch { /* dead */ }
99
+ }
100
+ if (alive) die(`profile dir ${dst} is already being rendered (lock ${lock}, holder pid ${pid}) — refusing a concurrent render`)
101
+ log(` stale render lock (holder pid ${prev.trim() || '<unparsed>'} dead) — taking it`)
102
+ try { unlinkSync(lock) } catch { /* raced away */ }
103
+ try {
104
+ take()
105
+ } catch {
106
+ die(`profile dir ${dst} lost a lock race (${lock}) — re-run the render`)
107
+ }
108
+ }
109
+ function releaseLock(dst) {
110
+ try { unlinkSync(join(dst, LOCK_NAME)) } catch { /* never held / already gone */ }
111
+ }
112
+
113
+ // PROVENANCE (provisioner audit F5): a rendered profile dir is an
114
+ // artifact with no memory — when a boot misbehaves nothing says
115
+ // which provisioner, which tree, which flags laid it. Every render
116
+ // writes render-provenance.json beside the profile files:
117
+ // machine-readable, DSH-loader-inert (a data file, never a config
118
+ // plane — the loader reads package.json/cordis.* only), the
119
+ // fossil-vs-fresh question answered without archaeology.
120
+ function provenanceDoc(name, provPkg, bundles, profileRowsSha) {
121
+ const root = resolve(PROVISIONER, '../../..')
122
+ let commit = null
123
+ let dirty = null
124
+ try {
125
+ const sha = execSync('git rev-parse HEAD', { cwd: root, stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim()
126
+ commit = /^[0-9a-f]{40}$/.test(sha) ? sha : null
127
+ if (commit !== null) {
128
+ dirty = execSync('git status --porcelain', { cwd: root, stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim() !== ''
129
+ }
130
+ } catch { /* not a git checkout — the stamp says so honestly (nulls) */ }
131
+ return {
132
+ renderedAt: new Date().toISOString(),
133
+ renderer: 'infer-provision',
134
+ provisioner: { name: provPkg.name, version: provPkg.version },
135
+ source: { root, commit, dirty },
136
+ profile: name,
137
+ bundles: [...bundles],
138
+ flags: {
139
+ estateAgentRoute: ESTATE_AGENT_ROUTE || null,
140
+ estateStateRoot: ESTATE_STATE_ROOT || null,
141
+ profileRows: PROFILE_ROWS ? { path: PROFILE_ROWS, sha256: profileRowsSha } : null,
142
+ },
143
+ }
144
+ }
145
+
146
+ // agentRoute wears the estate row's own shape (packages/web/melite-estate
147
+ // src/index.ts): "provider/model" — the same regex the seat applies. A
148
+ // malformed route dies HERE, at the earliest resolvable point, never as a
149
+ // silently-unseated engine three boots later.
150
+ if (ESTATE_AGENT_ROUTE && !/^([^/\s]+)\/(.+)$/.test(ESTATE_AGENT_ROUTE)) {
151
+ die('--estate-agent-route wants provider/model (e.g. opencode-go/muse-spark-1.3-contributor), got "' + ESTATE_AGENT_ROUTE + '"')
152
+ }
153
+
48
154
  // ── profile rendering ───────────────────────────────────────────────────
49
155
  const PROFILE_BASES = {
50
- // inference = the studio: web app base + the SELF-REGISTERING
156
+ // melite-test = THE studio/test lane, ONE name (single-setup law
157
+
158
+ // two names for one mount, and the README + runbook pointed at
159
+ // different ones. `inference` is gone; this base is the only web
160
+ // mount): web app base + the SELF-REGISTERING
51
161
 
52
162
  // its existence row in ITS OWN package — the provisioner stopped
53
163
 
@@ -59,9 +169,38 @@ const PROFILE_BASES = {
59
169
  // @melite/card-base/client for the browser graph — every card
60
170
  // client externalizes it, and without the row the loader's
61
171
  // require misses the module table at web boot.
62
- inference: ['@deepseek-ai/dsh-base', '@deepseek-ai/dsh-web-app', '@melite/harness-provisioner',
63
- '@melite/harness-tools', '@melite/card-base', '@melite-plugin/dsh-card-view', '@melite-plugin/dsh-card-deck',
64
- '@melite-plugin/dsh-gallery'],
172
+ // three-client rides the WEB base for the SAME law (the :3088 boot
173
+
174
+ // externalize @melite/three-client/client, and three-client's own
175
+ // patch is the ONLY row that materializes it ("bundling
176
+ // @melite/three-client in a profile applies this patch" — the
177
+ // package's own contract). Without the bundle, four plugins die
178
+ // at boot with `missed the module table` and the deck pends on
179
+ // remote.manage behind them.
180
+ // dsh-estate rides the web base too (the :3088 browser census,
181
+
182
+ // as child plugins — drafts (bench/subscribe), models (the
183
+ // /v1/model-catalog discovery door), media, queue, runs, manage.
184
+ // Without it the studio lane BOOTS CLEAN but serves a husk: the
185
+ // bench spotlight stream and the catalog toast 500 in the browser
186
+ // console while the boot log stays silent — the same
187
+ // seed-has-it-base-does-not drift as three-client.
188
+ // the two card STUDIOS ride the web base (the H3 bar autopsy,
189
+
190
+ // own their rows in their OWN bundle patches, and this bundle's
191
+ // patch carries no twin ("NO row here — the profile bundles it",
192
+ // cordis.patch.yml) — so while no base mounted them they were
193
+ // deps with no door: installed by the manifest mirror above, rows
194
+ // mounted by nothing, client entries in no browser graph. The H3
195
+ // card then rendered the generic form — NO timeline bar — with
196
+ // every wall green (the e2e seed mounts both; the live base did
197
+ // not). @melite/3d-img-to-mesh needs no bundle row: this bundle's
198
+ // own card-studio-img-to-mesh row mounts it, and a bundle would be
199
+ // the twin-row crash law.
200
+ 'melite-test': ['@deepseek-ai/dsh-base', '@deepseek-ai/dsh-web-app', '@melite/harness-provisioner',
201
+ '@melite/harness-tools', '@melite-plugin/dsh-estate', '@melite/card-base', '@melite/three-client',
202
+ '@melite-plugin/dsh-card-view', '@melite-plugin/dsh-card-deck', '@melite-plugin/dsh-gallery',
203
+ '@melite/video-h3-timeline', '@melite/motion-motion'],
65
204
  // headless = the agent server: one-shot task runner + the tools
66
205
  // plane (harness-tools self-registers its melite-tools row; the
67
206
  // renderer disables the web-plane doors row in this mount).
@@ -81,16 +220,6 @@ const PROFILE_BASES = {
81
220
  // tools row's HEADLESS interface by its self-registration id.
82
221
  estate: ['@deepseek-ai/dsh-base', '@deepseek-ai/dsh-sdk-app', '@melite/harness-provisioner',
83
222
  '@melite/harness-tools', '@melite-plugin/dsh-estate'],
84
- // melite-test = THE TEST LANE, RE-COMPOSED (REBUILD-20, gateway
85
-
86
- // melite-test profile mounting the estate API as a SECOND
87
- // process on :33081) died with the gateway. Its replacement is
88
- // the SAME row set as the studio — web app base + the estate
89
- // rows in ONE process. Custom bakes serve from this name; the
90
- // :33081 wire never existed here.
91
- 'melite-test': ['@deepseek-ai/dsh-base', '@deepseek-ai/dsh-web-app', '@melite/harness-provisioner',
92
- '@melite/harness-tools', '@melite/card-base', '@melite-plugin/dsh-card-view', '@melite-plugin/dsh-card-deck',
93
- '@melite-plugin/dsh-gallery'],
94
223
  }
95
224
 
96
225
  /** Maps every workspace package's name to its directory by reading
@@ -138,7 +267,14 @@ function workspacePackages() {
138
267
  function renderProfile(name) { // In-box bundles (@deepseek-ai/*) resolve from the DSH INSTALL, never
139
268
  // from a registry - only OUR link goes in dependencies. Mirrors what
140
269
  // `dsh plugin` itself initializes (PROFILE_TEMPLATES + reconcile).
141
- const bundles = PROFILE_BASES[name] || PROFILE_BASES.headless
270
+
271
+ // old `|| PROFILE_BASES.headless` fallback turned a typo into a
272
+ // bootable-looking directory with the wrong rows and exit 0.
273
+ if (!(name in PROFILE_BASES)) {
274
+ console.error(`infer-provision: unknown profile '${name}' — known: ${Object.keys(PROFILE_BASES).join(', ')}`)
275
+ process.exit(1)
276
+ }
277
+ const bundles = PROFILE_BASES[name]
142
278
  const dst = join(DSH_HOME, 'profiles', name)
143
279
  mkdirSync(dst, { recursive: true })
144
280
  const link = 'link:' + PROVISIONER
@@ -170,6 +306,23 @@ function renderProfile(name) { // In-box bundles (@deepseek-ai/*) resolve from
170
306
  // the provisioner is linked, its install resolves it in the repo
171
307
  // workspace.
172
308
  }
309
+
310
+ // non-in-box bundle the profile base mounts ALSO becomes a direct
311
+ // link: dep — the F5 comment's own intent above ("every plugin
312
+ // package the bundle rows name must become a DIRECT link: dep"),
313
+ // which the mirror-the-manifest loop never implemented for bundles
314
+ // outside the provisioner's own manifest (@melite/card-base rode
315
+ // the inference/melite-test bases with no installed package, and
316
+
317
+ // @deepseek-ai/* bundles resolve from the DSH install, never here;
318
+ // any other unresolvable bundle fails the RENDER loud, never a
319
+ // boot three steps later.
320
+ const bundleDeps = {}
321
+ for (const b of bundles) {
322
+ if (b.startsWith('@deepseek-ai/')) continue
323
+ if (!byName.has(b)) die(`profile base mounts ${b} but no workspace package carries that name — refusing an unresolvable bundle`)
324
+ bundleDeps[b] = 'link:' + byName.get(b)
325
+ }
173
326
 
174
327
  const pkgPath = join(dst, 'package.json')
175
328
  let pkg = { name: 'dsh-profile-' + name, private: true, dependencies: {} }
@@ -185,9 +338,10 @@ function renderProfile(name) { // In-box bundles (@deepseek-ai/*) resolve from
185
338
  // and pnpm warned "installing a dependency from a non-existent
186
339
  // directory" on every install while the profile silently carried
187
340
 
188
- // on every render; user-added registry deps belong in the bundle, not
189
- // here.
190
- pkg.dependencies = { ...rowDeps, '@melite/harness-provisioner': link }
341
+ // on every render; bundleDeps cover every mounted non-in-box bundle
342
+ // (the coverage cure above); user-added registry deps belong in the
343
+ // bundle, not here.
344
+ pkg.dependencies = { ...bundleDeps, ...rowDeps, '@melite/harness-provisioner': link }
191
345
 
192
346
  // twin rows for the self-registering packages (channel law
193
347
 
@@ -203,57 +357,156 @@ function renderProfile(name) { // In-box bundles (@deepseek-ai/*) resolve from
203
357
  // the bases). The bases OWN this list wholesale; a retired
204
358
  // package leaves the profile the day it leaves PROFILE_BASES.
205
359
  pkg.dsh = { profile: { bundles: [...new Set(bundles)] } }
206
- writeFileSync(join(dst, 'package.json'), JSON.stringify(pkg, null, 2) + String.fromCharCode(10))
207
- // user layer stays EMPTY in web mounts — the bundle patch owns every
208
- // row (no drift). NON-web mounts (headless/SDK) get the web-surface
209
- // rows mechanically DISABLED (by the packages' SELF-REGISTRATION
360
+ writeFileAtomic(join(dst, 'package.json'), JSON.stringify(pkg, null, 2) + String.fromCharCode(10))
361
+ // The cordis.yml USER layer stays EMPTY — the bundle patch owns every
362
+ // melite row (no drift). NON-web mounts (headless/SDK) get the
363
+ // web-surface rows mechanically DISABLED in the profile patch (by the
210
364
 
211
- // The bundle owns the rows; the renderer owns the per-app mount
212
- // shape.
365
+ // exists to activate them. The bundle owns the rows; the renderer
366
+ // owns the per-app mount shape and the seat pins below.
213
367
  const webMount = bundles.includes('@deepseek-ai/dsh-web-app')
214
368
  // melite-tools-doors is web-profiles-only by its own contract (the
215
369
  // ✦ doors need webServer+llm — absent in sdk/headless mounts); the
216
370
  // renderer disables it with the other web rows in non-web mounts.
217
371
  const webRows = ['melite-tools-doors',
218
372
  'infer-card-view', 'ray-card-deck', 'infer-gallery']
219
- writeFileSync(join(dst, 'cordis.patch.yml'),
373
+
374
+ // decided seating is retired — the estate row's CONFIG owns it. Every
375
+ // profile mounting dsh-estate carries repoRoot here: mechanical (this
376
+ // render's own repo root), so the runs/drafts seats never boot
377
+ // unpinned (they refuse loud by design). agentRoute names the agent
378
+ // brain (provider/model); absent, the estate logs the engine unseated
379
+ // — the honest state, never a silent default.
380
+ const estateRow = bundles.includes('@melite-plugin/dsh-estate')
381
+ ? '# ESTATE SEAT PIN — the estate row config owns every seat:\n'
382
+ + '# repoRoot pins the runs/drafts seats (unpinned boots refuse loud);\n'
383
+ + '# stateRoot overrides it (J12: walls render hermetic roots by\n'
384
+ + '# config — stateRoot wins over repoRoot in the queue seat).\n'
385
+ + '# agentRoute names the agent brain (absent = unseated, logged loud).\n'
386
+ + '- id: melite-estate\n'
387
+ + ' config:\n'
388
+ + ' repoRoot: ' + JSON.stringify(resolve(PROVISIONER, '../../..')) + '\n'
389
+ + (ESTATE_STATE_ROOT
390
+ ? ' stateRoot: ' + JSON.stringify(ESTATE_STATE_ROOT) + '\n'
391
+ : '')
392
+ + (ESTATE_AGENT_ROUTE
393
+ ? ' agentRoute: ' + JSON.stringify(ESTATE_AGENT_ROUTE) + '\n'
394
+ : '')
395
+ : ''
396
+ // OPERATOR ROWS (--profile-rows <file>): verbatim text splice, never
397
+ // re-serialized (the web profile's preset-row law). Llm provider rows
398
+ // ride the profile layer because the bundle patch owns MELITE rows
399
+ // only — the same home the web profile's own patch gives its
400
+ // providers. Rows apply by id; a row here never inserts a melite
401
+ // bundle row (the no-drift law holds — the ids belong to the
402
+ // operator's adapter mounts).
403
+ let operatorRows = ''
404
+ let profileRowsSha = null
405
+ if (PROFILE_ROWS) {
406
+ if (!existsSync(PROFILE_ROWS)) die('--profile-rows: no such file: ' + PROFILE_ROWS)
407
+ const text = readFileSync(PROFILE_ROWS, 'utf8')
408
+ profileRowsSha = createHash('sha256').update(text, 'utf8').digest('hex')
409
+ const firstRow = text.split('\n').find((l) => l.trim() !== '' && !l.trim().startsWith('#'))
410
+ if (firstRow === undefined || !firstRow.startsWith('- ')) {
411
+ die('--profile-rows: ' + PROFILE_ROWS + ' is not a YAML row list (the first non-comment line must start with "- ")')
412
+ }
413
+ operatorRows = '# operator rows (verbatim splice: ' + PROFILE_ROWS + ')\n'
414
+ + text + (text.endsWith('\n') ? '' : '\n')
415
+ }
416
+ writeFileAtomic(join(dst, 'cordis.patch.yml'),
220
417
  webMount
221
- ? '# rendered by infer-provision - rows live in the bundle' + '\n' + '[]' + '\n'
222
- : '# rendered by infer-provision - rows live in the bundle.\n'
418
+ ? '# rendered by infer-provision - melite rows live in the bundle;\n'
419
+ + '# the rows below are the profile layer (seat pin + operator rows).\n'
420
+ + (estateRow + operatorRows || '[]\n')
421
+ : '# rendered by infer-provision - melite rows live in the bundle.\n'
223
422
  + '# No webServer service in this mount: the four web-surface rows\n'
224
423
  + '# are disabled so activation cannot pend forever.\n'
225
424
  + webRows.map(id => '- id: ' + id + '\n disabled: true\n').join('')
226
- // ESTATE JOB SERVER (name === 'estate'): this mount IS the
227
- // delegated operator — the tools row selects the HEADLESS
228
- // interface (the melite_flow + run_status run doors). Pinned
229
- // in the render (not ambient env) because the interface is
230
- // profile state: browser mounts compose, the job server
231
- // executes. Every other mount keeps the browser default.
232
- + (name === 'estate'
425
+ + estateRow + operatorRows
426
+ // DELEGATED-OPERATOR MOUNTS (estate | headless): this mount
427
+ // RUNS jobs — the tools row selects the HEADLESS interface
428
+ // (the melite_flow + run_status run doors). Pinned in the
429
+ // render (not ambient env) because the interface is profile
430
+ // state: browser mounts compose, the job server executes.
431
+ // The 'headless' agent server rides the same pin — its base
432
+ // list promises melite_flow ("a headless task that composes
433
+ // media reaches the same runs/queue/drafts seats"), and the
434
+
435
+ // compose-only mount: benches composed and validated, every
436
+ // execution refused at the absent verb. Every other mount
437
+ // keeps the browser default.
438
+ + (name === 'estate' || name === 'headless'
233
439
  ? '# HEADLESS interface: the delegated operator runs jobs here.\n'
234
440
  + '- id: melite-tools\n config:\n headless: true\n'
235
441
  : ''))
236
- writeFileSync(join(dst, 'cordis.yml'), '# rendered by infer-provision' + '\n' + '[]' + '\n')
442
+ writeFileAtomic(join(dst, 'cordis.yml'), '# rendered by infer-provision' + '\n' + '[]' + '\n')
237
443
  const ws = join(dst, 'pnpm-workspace.yaml')
238
- if (!existsSync(ws)) writeFileSync(ws, 'packages:' + '\n' + ' - node_modules/*' + '\n')
444
+ if (!existsSync(ws)) writeFileAtomic(ws, 'packages:' + '\n' + ' - node_modules/*' + '\n')
445
+ // F5 — the provenance stamp (see provenanceDoc): fossil-vs-fresh,
446
+ // answered in one read.
447
+ writeFileAtomic(join(dst, 'render-provenance.json'),
448
+ JSON.stringify(provenanceDoc(name, provPkg, bundles, profileRowsSha), null, 2) + '\n')
239
449
 
240
450
  log('rendered profile :', dst)
241
451
  log(' bundles :', bundles.join(', '))
242
452
  return dst
243
453
  }
244
454
 
455
+ // INSTALL GUARDS (F6): the install ran with no timeout (a hung
456
+ // registry stalled forever), no catch (a failed install threw a raw
457
+ // stack with no manual-command hint), and both callers ignored the
458
+ // `false` return (missing-pnpm printed a warning, then the boot
459
+ // lines printed as if everything were installed). Now: a 10-minute
460
+ // ceiling (link-only installs take seconds; a cold-registry fetch
461
+ // takes minutes; a hang dies loud, never stalls CI forever) and
462
+ // every failure logged loud with the manual command. The boolean is
463
+ // HONORED by both callers through renderInstall below.
464
+ const INSTALL_TIMEOUT_MS = 600_000
245
465
  function installDeps(profileDir) {
246
466
  const pm = execSync('command -v pnpm || true').toString().trim()
247
467
  || join(process.env.HOME || '', '.local/share/pnpm/pnpm')
248
468
  if (!existsSync(pm)) {
249
- log(' WARNING: pnpm not found — run manually: (cd ' + profileDir + ' && pnpm install)')
469
+ console.error('infer-provision: pnpm not found — deps NOT installed for ' + profileDir
470
+ + '; run manually: (cd ' + profileDir + ' && pnpm install)')
250
471
  return false
251
472
  }
252
473
  log(' installing deps with', pm, '…')
253
- execSync('"' + pm + '" install', { cwd: profileDir, stdio: 'inherit' })
474
+ try {
475
+ execSync('"' + pm + '" install', { cwd: profileDir, stdio: 'inherit', timeout: INSTALL_TIMEOUT_MS })
476
+ } catch (err) {
477
+ const e = (err !== null && typeof err === 'object') ? err : {}
478
+ const why = e.code === 'ETIMEDOUT'
479
+ ? 'timed out after ' + String(INSTALL_TIMEOUT_MS / 1000) + 's'
480
+ : 'failed (status ' + String(e.status ?? e.signal ?? e.code ?? 'unknown') + ') — output above'
481
+ console.error('infer-provision: pnpm install ' + why + ' in ' + profileDir
482
+ + '; fix the failure and re-run, or install manually: (cd ' + profileDir + ' && pnpm install)')
483
+ return false
484
+ }
254
485
  return true
255
486
  }
256
487
 
488
+ // RENDER+INSTALL, LOCKED (F6): the one door both commands use — the
489
+ // lock covers the render AND the install (an install reading
490
+ // package.json mid-render is the same race). The install's boolean
491
+ // is honored HERE, and the die sits AFTER the finally on purpose:
492
+ // process.exit skips finally blocks, so a die inside the try would
493
+ // leak the lock forever.
494
+ function renderInstall(name) {
495
+ const dst = join(DSH_HOME, 'profiles', name)
496
+ mkdirSync(dst, { recursive: true })
497
+ acquireLock(dst)
498
+ let dir = dst
499
+ let ok = false
500
+ try {
501
+ dir = renderProfile(name)
502
+ ok = installDeps(dir)
503
+ } finally {
504
+ releaseLock(dst)
505
+ }
506
+ if (!ok) die(`profile '${name}' rendered but deps NOT installed — boot would fail at bundle resolution; run manually: (cd ${dir} && pnpm install)`)
507
+ return dir
508
+ }
509
+
257
510
  // ── main ────────────────────────────────────────────────────────────────
258
511
  switch (cmd) {
259
512
  case 'all': {
@@ -264,8 +517,8 @@ switch (cmd) {
264
517
  // command renders + installs every profile (the gateway health
265
518
  // check died with the gateway — there is no second process to
266
519
  // probe anymore).
267
- for (const name of ['inference', 'headless', 'estate', 'melite-test']) {
268
- installDeps(renderProfile(name))
520
+ for (const name of ['melite-test', 'headless', 'estate']) {
521
+ renderInstall(name)
269
522
  }
270
523
  log('boot with:')
271
524
  log(' LANES BOOT ONLY THROUGH THE PROVISION (the lane law, li-bu):')
@@ -273,15 +526,14 @@ switch (cmd) {
273
526
  log(' (this command installs the profiles; the sibling provisioner owns the')
274
527
  log(' launch — binary pin, version floor, home, and unit. The shapes below')
275
528
  log(' are what the door runs UNDER THE HOOD, never a hand-run shortcut:)')
276
- log(' dsh --profile inference # the studio GUI')
529
+ log(' dsh --profile melite-test # the studio GUI + TEST lane (one process, no :33081)')
277
530
  log(' dsh --profile headless "<task>" # one-shot agent with card tools')
278
531
  log(' dsh --profile estate # the SDK job server (estate row)')
279
- log(' dsh --profile melite-test # the TEST lane (one process, no :33081)')
280
532
  break
281
533
  }
282
534
  case 'profile': {
283
- installDeps(renderProfile(PROFILE))
284
- log('boot with: dsh --profile ' + PROFILE + (PROFILE === 'inference' ? '' : ' "<task>"'))
535
+ renderInstall(PROFILE)
536
+ log('boot with: dsh --profile ' + PROFILE + (PROFILE === 'melite-test' ? '' : ' "<task>"'))
285
537
  break
286
538
  }
287
539
  // the `preset` arm died with installPreset (undefined since the
package/cordis.patch.yml CHANGED
@@ -23,8 +23,13 @@
23
23
  # owning DSH cross-host).
24
24
  #
25
25
  # All rows resolve BY PACKAGE NAME through this bundle's own link:
26
- # dependencies (pnpm workspace links back into the repo) — never baked
27
- # absolute paths, so the repo can move without re-provisioning.
26
+ # dependencies. THE RENDER PATH BAKES ABSOLUTE PATHS (the bin's
27
+ # renderProfile resolves every link: against the checkout at render
28
+
29
+ # renamed checkout needs a re-provision, and a stale profile
30
+ # carries dead links pnpm warns about. Rows THIS patch serves to an
31
+ # installed profile (via the bundle's own dependency table) stay
32
+ # name-resolved.
28
33
  #
29
34
 
30
35
  # is the ONLY app — there is no second process, no :33081, no
@@ -85,16 +90,21 @@
85
90
  # ride the packages' dsh.client declarations (src/client ->
86
91
  # lib/client.js).
87
92
  #
88
- # card-studio-anny: NO row here — @melite/3d-anny self-registers
89
- # (anny-studio, its own cordis.patch.yml, 6a16cfc9); a twin row
90
- # double-mounted the package in every profile bundling it
93
+ # card-studio-anny: NO row here, and nothing to mount either —
94
+ # @melite/3d-anny's studio is RETIRED (stroke 89): the package
95
+ # ships no client face and no cordis.patch.yml, and its bundle
96
+ # left the web bases (bin/infer-provision.mjs, the stroke-89
97
+ # note). A row here would mount a package that composes
98
+ # nothing. Should a self-registering anny studio ever return, it
99
+ # comes back as a mounted bundle in the bases, never as a twin
91
100
 
92
- # profile (their self-patch never applies there).
101
+ # for studios not bundled by the profile (their self-patch never
102
+ # applies there).
93
103
 
94
104
  # card-studio-h3-timeline: NO row here — @melite/video-h3-timeline
95
105
  # self-registers (its own cordis.patch.yml); a twin row here
96
106
  # double-mounted the package in every profile bundling both
97
- # (same crash law as card-studio-anny).
107
+
98
108
 
99
109
  # card-studio-ideogram4 RETIRED with its card (the form-seams
100
110
 
@@ -111,7 +121,7 @@
111
121
  # card-studio-motion: NO row here — @melite/motion-motion
112
122
  # self-registers (its own cordis.patch.yml); a twin row here
113
123
  # double-mounted the package in every profile bundling both
114
- # (same crash law as card-studio-anny).
124
+
115
125
 
116
126
 
117
127
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melite/harness-provisioner",
3
- "version": "0.1.4-alpha",
3
+ "version": "0.1.5-pre-alpha",
4
4
  "license": "SSPL-1.0",
5
5
  "description": "Vanilla-DSH provisioner for the inference.cpp media stack: one bundle mounts the estate row (in-process seats, no second process), the tool surface, the card view/deck, media previews, and the runs gallery — and the infer-provision bin renders ready-to-boot profiles (inference / headless / estate / melite-test) into any DSH_HOME.",
6
6
  "type": "module",
@@ -27,14 +27,14 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
30
- "@melite-plugin/dsh-estate": "0.1.4-alpha",
31
- "@melite-plugin/dsh-card-deck": "0.1.4-alpha",
32
- "@melite-plugin/dsh-card-view": "0.1.4-alpha",
33
- "@melite/motion-motion": "0.1.4-alpha",
34
- "@melite-plugin/dsh-gallery": "0.1.4-alpha",
35
- "@melite/harness-tools": "0.1.4-alpha",
36
- "@melite/3d-img-to-mesh": "0.1.4-alpha",
37
- "@melite/video-h3-timeline": "0.1.4-alpha"
30
+ "@melite-plugin/dsh-card-deck": "0.1.5-pre-alpha",
31
+ "@melite-plugin/dsh-card-view": "0.1.5-pre-alpha",
32
+ "@melite-plugin/dsh-estate": "0.1.5-pre-alpha",
33
+ "@melite-plugin/dsh-gallery": "0.1.5-pre-alpha",
34
+ "@melite/harness-tools": "0.1.5-pre-alpha",
35
+ "@melite/motion-motion": "0.1.5-pre-alpha",
36
+ "@melite/3d-img-to-mesh": "0.1.5-pre-alpha",
37
+ "@melite/video-h3-timeline": "0.1.5-pre-alpha"
38
38
  },
39
39
  "dsh": {
40
40
  "bundle": {