muse-crew 0.14.4 → 0.14.5

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.
@@ -50,6 +50,42 @@ const MAX_TASKS_PER_POLL = inputs.maxTasksPerPoll || 6;
50
50
  // inputs.registry. Fall back to the agent() load only when the caller
51
51
  // predates the registry — slow, but never broken.
52
52
  var registryResult = inputs.registry;
53
+ // Nested-registry seam (2026-09-20): a malformed nested registry object
54
+ // (e.g. a workflow key mapping to null/undefined, or a steps entry without
55
+ // a name) used to die deep in the lookup tables with a cryptic TypeError
56
+ // ("cannot convert 'null' or 'undefined' to object"). Validate the shape
57
+ // deterministically first; a malformed registry falls back to the slow
58
+ // agent load with a loud log, exactly like a missing one — the defect is
59
+ // named, never a crash.
60
+ function validateRegistry(reg) {
61
+ var wfNames = ["standard", "bugfix", "chore", "docs", "upgrade"];
62
+ if (!reg || typeof reg !== "object" || Array.isArray(reg)) {
63
+ return { ok: false, reason: "registry is missing or not an object" };
64
+ }
65
+ for (var i = 0; i < wfNames.length; i++) {
66
+ var wf = reg[wfNames[i]];
67
+ if (!wf || typeof wf !== "object") {
68
+ return { ok: false, reason: "workflow '" + wfNames[i] + "' is missing or not an object" };
69
+ }
70
+ if (!Array.isArray(wf.steps)) {
71
+ return { ok: false, reason: "workflow '" + wfNames[i] + "' has no steps array" };
72
+ }
73
+ for (var j = 0; j < wf.steps.length; j++) {
74
+ if (!wf.steps[j] || typeof wf.steps[j].name !== "string") {
75
+ return { ok: false, reason: "workflow '" + wfNames[i] + "' step " + j + " has no name" };
76
+ }
77
+ }
78
+ if (typeof wf.reworkTarget !== "string") {
79
+ return { ok: false, reason: "workflow '" + wfNames[i] + "' has no reworkTarget string" };
80
+ }
81
+ }
82
+ return { ok: true };
83
+ }
84
+ var registryCheck = validateRegistry(registryResult);
85
+ if (!registryCheck.ok) {
86
+ log("WARNING: registry failed shape validation (" + registryCheck.reason + ") — falling back to slow registry load");
87
+ registryResult = null;
88
+ }
53
89
  if (!registryResult) {
54
90
  log("WARNING: no registry in args — falling back to slow registry load");
55
91
  registryResult = await agent(