muse-crew 0.6.0 → 0.6.1

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/API.md CHANGED
@@ -258,7 +258,7 @@ Set a global configuration value.
258
258
 
259
259
  ### `setprovenance`
260
260
 
261
- Stamp publication provenance. Called by the crew Publish phase after rebuilding the artifact.
261
+ Stamp publication provenance. Called by the crew Publish phase after rebuilding the artifact, and after installing/activating a crew release (npm path): in the release case Publish refreshes `crew_release` to the live release identity while preserving the existing `source_commit`.
262
262
 
263
263
  | Field | Type | Required | Notes |
264
264
  |-------|------|----------|-------|
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muse-crew",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Opinionated orchestration for Muse \u2014 workflows, identities, and tooling for autonomous software development.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -22,6 +22,14 @@ const taskTitle = inputs.task_title || "";
22
22
  const taskDescription = inputs.task_description || "";
23
23
  const startStepIndex = inputs.start_step_index || 0;
24
24
 
25
+ // Dispatcher-carried facts for the claim-time persist: the workflow name the
26
+ // dispatcher actually resolved and launched, and whether the task record had
27
+ // no workflow (the standard fallback). The launched workflow writes the
28
+ // resolution back via updatetask in the self-claim below.
29
+ const RESOLVED_WORKFLOW = inputs.resolved_workflow || null;
30
+ const WORKFLOW_WAS_NULL = inputs.workflow_was_null === true;
31
+ const CLAIM_WORKFLOW_PERSIST = (WORKFLOW_WAS_NULL && RESOLVED_WORKFLOW) ? ", \"workflow\": \"" + RESOLVED_WORKFLOW + "\"" : "";
32
+
25
33
  // Config from args — backward-compatible fallbacks for manual launches
26
34
  const DASHBOARD_SLUG = inputs.dashboardSlug || "orchestra-dashboard";
27
35
  const crewHome = inputs.crewHome || "~/workspace/.jarvis";
@@ -660,7 +668,7 @@ while (i < STEPS.length) {
660
668
  if (isFirstClaim) {
661
669
  const claimResult = await agent(
662
670
  "Claim this task for the " + step.name + " step.\n" +
663
- "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"updatetask\", args: { \"id\": \"" + taskId + "\", \"state\": \"in_progress\" }.\n" +
671
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"updatetask\", args: { \"id\": \"" + taskId + "\", \"state\": \"in_progress\"" + CLAIM_WORKFLOW_PERSIST + " }.\n" +
664
672
  "Then call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"claimtask\", args:\n" +
665
673
  "{ \"task_id\": \"" + taskId + "\", \"identity\": \"" + step.identity + "\", \"step\": \"" + step.name + "\", \"notes\": \"" + step.name + " step started\" }.\n" +
666
674
  "Do not interpret the claim response. It already contains an explicit \"claimed\" field — copy it verbatim.\n" +
@@ -1357,8 +1365,39 @@ while (i < STEPS.length) {
1357
1365
  return await parkTask("Publish verification failed: registry shows " + regVer + " but the release decision required " +
1358
1366
  publishTarget.target + " (" + publishTarget.base + " + " + publishTarget.scope + "). The publish did not land.");
1359
1367
  }
1360
- log("Publish verified for task " + taskId + ": registry at " + regVer);
1361
1368
  publishVerified = true;
1369
+ // Provenance refresh for self-publishes (task 7946d2a4): the npm path
1370
+ // installs and activates a new immutable release (crew-release.sh deploy
1371
+ // swaps the `current` symlink inside publish-npm.sh) but never stamped
1372
+ // the dashboard's provenance record — every crew release left
1373
+ // crew_release pointing at a pruned release. After a verified landed
1374
+ // publish, refresh the record's crew_release to the now-live release
1375
+ // identity, preserving the existing source_commit (the dashboard
1376
+ // artifact's build source — a crew-repo commit here would fail the
1377
+ // dashboard QA source check).
1378
+ try {
1379
+ var provRefresh = await agent(
1380
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"getprovenance\", args: {}. " +
1381
+ "If the response has no provenance (null), return JSON { \"refreshed\": false, \"reason\": \"no-record\" } and stop. " +
1382
+ "Otherwise run: basename $(readlink " + crewHome + "/current) — call this REL; " +
1383
+ "run: date -u +%Y-%m-%dT%H:%M:%SZ — call this TS. " +
1384
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"setprovenance\", args: " +
1385
+ "{ \"source_commit\": \"<existing provenance.source_commit>\", \"crew_release\": \"<REL trimmed>\", \"published_at\": \"<TS trimmed>\", \"task_id\": \"" + taskId + "\" }. " +
1386
+ "Return JSON { \"refreshed\": <true if the setprovenance response contains ok: true, false otherwise>, \"crew_release\": \"<REL trimmed>\", \"published_at\": \"<TS trimmed>\" } and nothing else.",
1387
+ { key: attemptKey("publish-provenance-refresh-" + taskId, totalReworkCount), label: "Refreshing dashboard provenance after crew release",
1388
+ schema: { type: "object", properties: { refreshed: { type: "boolean" }, reason: { type: "string" }, crew_release: { type: "string" }, published_at: { type: "string" } }, required: ["refreshed"] } }
1389
+ );
1390
+ if (provRefresh.refreshed) {
1391
+ log("Provenance refreshed for task " + taskId + ": crew_release " + provRefresh.crew_release);
1392
+ } else if (provRefresh.reason === "no-record") {
1393
+ log("Provenance refresh skipped for task " + taskId + ": no existing record to refresh (fresh instance — the dashboard's first artifact publish will create it)");
1394
+ } else {
1395
+ return await parkTask("Provenance refresh failed after a verified npm publish (crew_release " + (provRefresh.crew_release || "unknown") + "). The release is live but the dashboard record is stale — fail-closed.");
1396
+ }
1397
+ } catch (e) {
1398
+ return await parkTask("Provenance refresh failed: could not refresh dashboard provenance after a verified npm publish (" + (e && e.message ? e.message : e) + "). Fail-closed.");
1399
+ }
1400
+
1362
1401
  } catch (e) {
1363
1402
  return await parkTask("Publish verification failed: could not read the registry version (" + (e && e.message ? e.message : e) + "). Fail-closed.");
1364
1403
  }
@@ -20,6 +20,14 @@ const taskTitle = inputs.task_title || "";
20
20
  const taskDescription = inputs.task_description || "";
21
21
  const startStepIndex = inputs.start_step_index || 0;
22
22
 
23
+ // Dispatcher-carried facts for the claim-time persist: the workflow name the
24
+ // dispatcher actually resolved and launched, and whether the task record had
25
+ // no workflow (the standard fallback). The launched workflow writes the
26
+ // resolution back via updatetask in the self-claim below.
27
+ const RESOLVED_WORKFLOW = inputs.resolved_workflow || null;
28
+ const WORKFLOW_WAS_NULL = inputs.workflow_was_null === true;
29
+ const CLAIM_WORKFLOW_PERSIST = (WORKFLOW_WAS_NULL && RESOLVED_WORKFLOW) ? ", \"workflow\": \"" + RESOLVED_WORKFLOW + "\"" : "";
30
+
23
31
  // Config from args — backward-compatible fallbacks for manual launches
24
32
  const DASHBOARD_SLUG = inputs.dashboardSlug || "orchestra-dashboard";
25
33
  const crewHome = inputs.crewHome || "~/workspace/.jarvis";
@@ -618,7 +626,7 @@ while (i < STEPS.length) {
618
626
  if (isFirstClaim) {
619
627
  const claimResult = await agent(
620
628
  "Claim this task for the " + step.name + " step.\n" +
621
- "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"updatetask\", args: { \"id\": \"" + taskId + "\", \"state\": \"in_progress\" }.\n" +
629
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"updatetask\", args: { \"id\": \"" + taskId + "\", \"state\": \"in_progress\"" + CLAIM_WORKFLOW_PERSIST + " }.\n" +
622
630
  "Then call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"claimtask\", args:\n" +
623
631
  "{ \"task_id\": \"" + taskId + "\", \"identity\": \"" + step.identity + "\", \"step\": \"" + step.name + "\", \"notes\": \"" + step.name + " step started\" }.\n" +
624
632
  "Do not interpret the claim response. It already contains an explicit \"claimed\" field — copy it verbatim.\n" +
@@ -1232,8 +1240,39 @@ while (i < STEPS.length) {
1232
1240
  return await parkTask("Publish verification failed: registry shows " + regVer + " but the release decision required " +
1233
1241
  publishTarget.target + " (" + publishTarget.base + " + " + publishTarget.scope + "). The publish did not land.");
1234
1242
  }
1235
- log("Publish verified for task " + taskId + ": registry at " + regVer);
1236
1243
  publishVerified = true;
1244
+ // Provenance refresh for self-publishes (task 7946d2a4): the npm path
1245
+ // installs and activates a new immutable release (crew-release.sh deploy
1246
+ // swaps the `current` symlink inside publish-npm.sh) but never stamped
1247
+ // the dashboard's provenance record — every crew release left
1248
+ // crew_release pointing at a pruned release. After a verified landed
1249
+ // publish, refresh the record's crew_release to the now-live release
1250
+ // identity, preserving the existing source_commit (the dashboard
1251
+ // artifact's build source — a crew-repo commit here would fail the
1252
+ // dashboard QA source check).
1253
+ try {
1254
+ var provRefresh = await agent(
1255
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"getprovenance\", args: {}. " +
1256
+ "If the response has no provenance (null), return JSON { \"refreshed\": false, \"reason\": \"no-record\" } and stop. " +
1257
+ "Otherwise run: basename $(readlink " + crewHome + "/current) — call this REL; " +
1258
+ "run: date -u +%Y-%m-%dT%H:%M:%SZ — call this TS. " +
1259
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"setprovenance\", args: " +
1260
+ "{ \"source_commit\": \"<existing provenance.source_commit>\", \"crew_release\": \"<REL trimmed>\", \"published_at\": \"<TS trimmed>\", \"task_id\": \"" + taskId + "\" }. " +
1261
+ "Return JSON { \"refreshed\": <true if the setprovenance response contains ok: true, false otherwise>, \"crew_release\": \"<REL trimmed>\", \"published_at\": \"<TS trimmed>\" } and nothing else.",
1262
+ { key: attemptKey("publish-provenance-refresh-" + taskId, reworkCount), label: "Refreshing dashboard provenance after crew release",
1263
+ schema: { type: "object", properties: { refreshed: { type: "boolean" }, reason: { type: "string" }, crew_release: { type: "string" }, published_at: { type: "string" } }, required: ["refreshed"] } }
1264
+ );
1265
+ if (provRefresh.refreshed) {
1266
+ log("Provenance refreshed for task " + taskId + ": crew_release " + provRefresh.crew_release);
1267
+ } else if (provRefresh.reason === "no-record") {
1268
+ log("Provenance refresh skipped for task " + taskId + ": no existing record to refresh (fresh instance — the dashboard's first artifact publish will create it)");
1269
+ } else {
1270
+ return await parkTask("Provenance refresh failed after a verified npm publish (crew_release " + (provRefresh.crew_release || "unknown") + "). The release is live but the dashboard record is stale — fail-closed.");
1271
+ }
1272
+ } catch (e) {
1273
+ return await parkTask("Provenance refresh failed: could not refresh dashboard provenance after a verified npm publish (" + (e && e.message ? e.message : e) + "). Fail-closed.");
1274
+ }
1275
+
1237
1276
  } catch (e) {
1238
1277
  return await parkTask("Publish verification failed: could not read the registry version (" + (e && e.message ? e.message : e) + "). Fail-closed.");
1239
1278
  }
@@ -593,7 +593,13 @@ for (var p = 0; p < toProcess.length; p++) {
593
593
  project_config: projectCfg,
594
594
  project_id: taskProject,
595
595
  dashboardSlug: DASHBOARD_SLUG,
596
- crewHome: crewHome
596
+ crewHome: crewHome,
597
+ // Facts the launched workflow needs to persist the resolution at claim time:
598
+ // the workflow name the dispatcher actually resolved and is launching, and
599
+ // whether the task record had no workflow (playtest filings carry explicit
600
+ // workflow:'standard', so they correctly get false).
601
+ resolved_workflow: iworkflow,
602
+ workflow_was_null: (itask.workflow == null)
597
603
  };
598
604
 
599
605
  log("Recommended " + iworkflow + " for \"" + itask.title + "\" [" + taskProject + "] at step " + nextStepName);
package/workflows/docs.js CHANGED
@@ -16,6 +16,14 @@ const taskTitle = inputs.task_title || "";
16
16
  const taskDescription = inputs.task_description || "";
17
17
  const startStepIndex = inputs.start_step_index || 0;
18
18
 
19
+ // Dispatcher-carried facts for the claim-time persist: the workflow name the
20
+ // dispatcher actually resolved and launched, and whether the task record had
21
+ // no workflow (the standard fallback). The launched workflow writes the
22
+ // resolution back via updatetask in the self-claim below.
23
+ const RESOLVED_WORKFLOW = inputs.resolved_workflow || null;
24
+ const WORKFLOW_WAS_NULL = inputs.workflow_was_null === true;
25
+ const CLAIM_WORKFLOW_PERSIST = (WORKFLOW_WAS_NULL && RESOLVED_WORKFLOW) ? ", \"workflow\": \"" + RESOLVED_WORKFLOW + "\"" : "";
26
+
19
27
  // Config from args — backward-compatible fallbacks for manual launches
20
28
  const DASHBOARD_SLUG = inputs.dashboardSlug || "orchestra-dashboard";
21
29
  const crewHome = inputs.crewHome || "~/workspace/.jarvis";
@@ -125,7 +133,7 @@ while (i < STEPS.length) {
125
133
  if (isFirstClaim) {
126
134
  const claimResult = await agent(
127
135
  "Claim this task for the " + step.name + " step.\n" +
128
- "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"updatetask\", args: { \"id\": \"" + taskId + "\", \"state\": \"in_progress\" }.\n" +
136
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"updatetask\", args: { \"id\": \"" + taskId + "\", \"state\": \"in_progress\"" + CLAIM_WORKFLOW_PERSIST + " }.\n" +
129
137
  "Then call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"claimtask\", args:\n" +
130
138
  "{ \"task_id\": \"" + taskId + "\", \"identity\": \"" + step.identity + "\", \"step\": \"" + step.name + "\", \"notes\": \"" + step.name + " step started\" }.\n" +
131
139
  "Do not interpret the claim response. It already contains an explicit \"claimed\" field — copy it verbatim.\n" +
@@ -21,6 +21,14 @@ const taskTitle = inputs.task_title || "";
21
21
  const taskDescription = inputs.task_description || "";
22
22
  const startStepIndex = inputs.start_step_index || 0;
23
23
 
24
+ // Dispatcher-carried facts for the claim-time persist: the workflow name the
25
+ // dispatcher actually resolved and launched, and whether the task record had
26
+ // no workflow (the standard fallback). The launched workflow writes the
27
+ // resolution back via updatetask in the self-claim below.
28
+ const RESOLVED_WORKFLOW = inputs.resolved_workflow || null;
29
+ const WORKFLOW_WAS_NULL = inputs.workflow_was_null === true;
30
+ const CLAIM_WORKFLOW_PERSIST = (WORKFLOW_WAS_NULL && RESOLVED_WORKFLOW) ? ", \"workflow\": \"" + RESOLVED_WORKFLOW + "\"" : "";
31
+
24
32
  // Config from args — backward-compatible fallbacks for manual launches
25
33
  const DASHBOARD_SLUG = inputs.dashboardSlug || "orchestra-dashboard";
26
34
  const crewHome = inputs.crewHome || "~/workspace/.jarvis";
@@ -659,7 +667,7 @@ while (i < STEPS.length) {
659
667
  if (isFirstClaim) {
660
668
  const claimResult = await agent(
661
669
  "Claim this task for the " + step.name + " step.\n" +
662
- "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"updatetask\", args: { \"id\": \"" + taskId + "\", \"state\": \"in_progress\" }.\n" +
670
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"updatetask\", args: { \"id\": \"" + taskId + "\", \"state\": \"in_progress\"" + CLAIM_WORKFLOW_PERSIST + " }.\n" +
663
671
  "Then call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"claimtask\", args:\n" +
664
672
  "{ \"task_id\": \"" + taskId + "\", \"identity\": \"" + step.identity + "\", \"step\": \"" + step.name + "\", \"notes\": \"" + step.name + " step started\" }.\n" +
665
673
  "Do not interpret the claim response. It already contains an explicit \"claimed\" field — copy it verbatim.\n" +
@@ -1367,8 +1375,39 @@ while (i < STEPS.length) {
1367
1375
  return await parkTask("Publish verification failed: registry shows " + regVer + " but the release decision required " +
1368
1376
  publishTarget.target + " (" + publishTarget.base + " + " + publishTarget.scope + "). The publish did not land.");
1369
1377
  }
1370
- log("Publish verified for task " + taskId + ": registry at " + regVer);
1371
1378
  publishVerified = true;
1379
+ // Provenance refresh for self-publishes (task 7946d2a4): the npm path
1380
+ // installs and activates a new immutable release (crew-release.sh deploy
1381
+ // swaps the `current` symlink inside publish-npm.sh) but never stamped
1382
+ // the dashboard's provenance record — every crew release left
1383
+ // crew_release pointing at a pruned release. After a verified landed
1384
+ // publish, refresh the record's crew_release to the now-live release
1385
+ // identity, preserving the existing source_commit (the dashboard
1386
+ // artifact's build source — a crew-repo commit here would fail the
1387
+ // dashboard QA source check).
1388
+ try {
1389
+ var provRefresh = await agent(
1390
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"getprovenance\", args: {}. " +
1391
+ "If the response has no provenance (null), return JSON { \"refreshed\": false, \"reason\": \"no-record\" } and stop. " +
1392
+ "Otherwise run: basename $(readlink " + crewHome + "/current) — call this REL; " +
1393
+ "run: date -u +%Y-%m-%dT%H:%M:%SZ — call this TS. " +
1394
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"setprovenance\", args: " +
1395
+ "{ \"source_commit\": \"<existing provenance.source_commit>\", \"crew_release\": \"<REL trimmed>\", \"published_at\": \"<TS trimmed>\", \"task_id\": \"" + taskId + "\" }. " +
1396
+ "Return JSON { \"refreshed\": <true if the setprovenance response contains ok: true, false otherwise>, \"crew_release\": \"<REL trimmed>\", \"published_at\": \"<TS trimmed>\" } and nothing else.",
1397
+ { key: attemptKey("publish-provenance-refresh-" + taskId, totalReworkCount), label: "Refreshing dashboard provenance after crew release",
1398
+ schema: { type: "object", properties: { refreshed: { type: "boolean" }, reason: { type: "string" }, crew_release: { type: "string" }, published_at: { type: "string" } }, required: ["refreshed"] } }
1399
+ );
1400
+ if (provRefresh.refreshed) {
1401
+ log("Provenance refreshed for task " + taskId + ": crew_release " + provRefresh.crew_release);
1402
+ } else if (provRefresh.reason === "no-record") {
1403
+ log("Provenance refresh skipped for task " + taskId + ": no existing record to refresh (fresh instance — the dashboard's first artifact publish will create it)");
1404
+ } else {
1405
+ return await parkTask("Provenance refresh failed after a verified npm publish (crew_release " + (provRefresh.crew_release || "unknown") + "). The release is live but the dashboard record is stale — fail-closed.");
1406
+ }
1407
+ } catch (e) {
1408
+ return await parkTask("Provenance refresh failed: could not refresh dashboard provenance after a verified npm publish (" + (e && e.message ? e.message : e) + "). Fail-closed.");
1409
+ }
1410
+
1372
1411
  } catch (e) {
1373
1412
  return await parkTask("Publish verification failed: could not read the registry version (" + (e && e.message ? e.message : e) + "). Fail-closed.");
1374
1413
  }