muse-crew 0.7.17 → 0.7.19

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.
@@ -29,6 +29,26 @@ if (!!dashboardSlug !== !!dashboardRepoPath) throw new Error("dashboardSlug and
29
29
 
30
30
  const orchDir = crewHome + "/.orchestration";
31
31
 
32
+ // ── Dependency node_modules resolution (clean-room defect 2026-09-16) ──
33
+ // lib/see-act.js and lib/render-html.js resolve playwright-core by name,
34
+ // but the release layout severs releases/<name>/lib/ from the npm install
35
+ // that provides node_modules — Node's upward walk never reaches it, so the
36
+ // QA see-act loop degraded to NOT POSSIBLE and a mechanical-only PASS
37
+ // stamped done (a rubber stamp). The crew home carries a top-level
38
+ // node_modules symlink into the install's node_modules, resolved here
39
+ // mechanically from crewRepoPath — no new parameters, no env vars, no
40
+ // agent judgment:
41
+ // npm flow: crewRepoPath is <install>/node_modules/muse-crew -> parent
42
+ // git flow: crewRepoPath is a checkout -> <repo>/node_modules
43
+ // crew-release.sh deploy enforces the same link on every deploy; the init
44
+ // step below is the belt-and-suspenders repeat for init.
45
+ function resolveDepNodeModules(repoPath) {
46
+ var r = String(repoPath).replace(/\/+$/, "");
47
+ var parent = r.split("/").slice(0, -1).join("/") || "/";
48
+ if (parent.split("/").pop() === "node_modules") return parent;
49
+ return r + "/node_modules";
50
+ }
51
+
32
52
  // ── Gate 0: Launchable-path validation ─────────────────────────────
33
53
  // workflow_launch only accepts workspace-contained scripts. A crewHome
34
54
  // outside the workspace would produce an instance whose workflows can
@@ -200,6 +220,48 @@ try {
200
220
  }
201
221
  log("Release: " + (releaseResult.existed ? "existing" : "bootstrapped") + " at " + releaseResult.hash);
202
222
 
223
+ // ── Dependency node_modules symlink ───────────────────────────────────
224
+ // The release bootstrap (crew-release.sh init -> deploy) already links
225
+ // $CREW_HOME/node_modules into the install's node_modules; this step is the
226
+ // explicit, mechanical belt-and-suspenders repeat. The target dir is
227
+ // computed by resolveDepNodeModules above — the agent only runs the shell
228
+ // verbatim, it judges nothing. A missing source dir is not fatal: the QA
229
+ // visual-loop guard parks instead of stamping when the tooling is
230
+ // unresolvable.
231
+ var depNodeModules = resolveDepNodeModules(crewRepoPath);
232
+ var safeDepNm = depNodeModules.split('"').join('\\"');
233
+ var safeCrewHomeNm = crewHome.split('"').join('\\"');
234
+ try {
235
+ var depLinkResult = await agent(
236
+ "Ensure the crew home's dependency node_modules symlink.\n\n" +
237
+ "Crew home: " + crewHome + "\n" +
238
+ "Dependency node_modules (computed, do not alter): " + depNodeModules + "\n\n" +
239
+ "Steps (run in shell exactly as written):\n" +
240
+ "if [ -d \"" + safeDepNm + "\" ]; then\n" +
241
+ " if [ -e \"" + safeCrewHomeNm + "/node_modules\" ] && [ ! -L \"" + safeCrewHomeNm + "/node_modules\" ]; then echo REAL_DIR_KEPT;\n" +
242
+ " else ln -sfn \"" + safeDepNm + "\" \"" + safeCrewHomeNm + "/node_modules\" && echo LINKED;\n" +
243
+ " fi\n" +
244
+ "else echo MISSING_SOURCE;\n" +
245
+ "fi\n\n" +
246
+ "Return JSON { linked: <true when the symlink now resolves into the computed dir, false otherwise>, note: \"<LINKED|REAL_DIR_KEPT|MISSING_SOURCE>\" }.",
247
+ {
248
+ key: "dep-node-modules-1",
249
+ label: "Linking dependency node_modules",
250
+ schema: {
251
+ type: "object",
252
+ properties: {
253
+ linked: { type: "boolean" },
254
+ note: { type: "string" }
255
+ },
256
+ required: ["linked", "note"]
257
+ }
258
+ }
259
+ );
260
+ log("Dependency node_modules: " + (depLinkResult.note || "unknown") + " -> " + depNodeModules);
261
+ } catch (e) {
262
+ log("Dependency node_modules link step errored (non-fatal): " + String(e.message || e));
263
+ }
264
+
203
265
  // ── Phase 2: Scaffold ─────────────────────────────────────────────────
204
266
  // Copies identities (with portraits), personas, workflow docs, and
205
267
  // feedback convention from the crew repo into .orchestration/ under crewHome.