muse-crew 0.1.0

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.
Files changed (42) hide show
  1. package/AGENTS.md +19 -0
  2. package/API.md +213 -0
  3. package/README.md +68 -0
  4. package/docs/AGENTS.md +3 -0
  5. package/docs/guide.md +333 -0
  6. package/identities/AGENTS.md +7 -0
  7. package/identities/cass.md +36 -0
  8. package/identities/hazel.md +35 -0
  9. package/identities/mara.md +31 -0
  10. package/identities/personality-notes.md +81 -0
  11. package/identities/sage.md +31 -0
  12. package/identities/tate.md +35 -0
  13. package/identities/wren.md +36 -0
  14. package/lib/AGENTS.md +8 -0
  15. package/lib/crew-release.sh +188 -0
  16. package/lib/merge-lock.sh +89 -0
  17. package/lib/orphan-sweep.sh +95 -0
  18. package/lib/worktree-lifecycle.sh +313 -0
  19. package/package.json +29 -0
  20. package/personas/AGENTS.md +5 -0
  21. package/personas/beginner.md +24 -0
  22. package/personas/completionist.md +24 -0
  23. package/personas/designer.md +26 -0
  24. package/personas/financial-stakeholder.md +25 -0
  25. package/personas/power-user.md +26 -0
  26. package/seed/AGENTS.md +8 -0
  27. package/seed/cron-body-template.md +20 -0
  28. package/seed/feedback/AGENTS.md +3 -0
  29. package/seed/feedback/README.md +40 -0
  30. package/seed/posture.md +8 -0
  31. package/seed/workflows/AGENTS.md +3 -0
  32. package/seed/workflows/bugfix.md +39 -0
  33. package/seed/workflows/chore.md +29 -0
  34. package/seed/workflows/docs.md +17 -0
  35. package/seed/workflows/standard.md +34 -0
  36. package/workflows/AGENTS.md +12 -0
  37. package/workflows/bugfix.js +341 -0
  38. package/workflows/chore.js +294 -0
  39. package/workflows/crew-dispatch.js +315 -0
  40. package/workflows/crew-init.js +254 -0
  41. package/workflows/docs.js +141 -0
  42. package/workflows/standard.js +350 -0
@@ -0,0 +1,350 @@
1
+ export const meta = {
2
+ name: "crew-standard",
3
+ description: "Standard workflow: Triage → Map → Build → Review → Integrate → Deploy → QA",
4
+ phases: ["Triage", "Map", "Build", "Review", "Integrate", "Deploy", "QA"],
5
+ steps: [
6
+ { name: "Triage", identity: "sage" },
7
+ { name: "Map", identity: "mara" },
8
+ { name: "Build", identity: "wren" },
9
+ { name: "Review", identity: "cass" },
10
+ { name: "Integrate", identity: "wren" },
11
+ { name: "Deploy", identity: "wren" },
12
+ { name: "QA", identity: "hazel" }
13
+ ],
14
+ reworkTarget: "Build"
15
+ };
16
+
17
+ const inputs = args ?? {};
18
+ const taskId = inputs.task_id;
19
+ const taskTitle = inputs.task_title || "";
20
+ const taskDescription = inputs.task_description || "";
21
+ const firstSessionId = inputs.session_id || null;
22
+ const startStepIndex = inputs.start_step_index || 0;
23
+
24
+ // Config from args — backward-compatible fallbacks for manual launches
25
+ const DASHBOARD_SLUG = inputs.dashboardSlug || "orchestra-dashboard";
26
+ const crewHome = inputs.crewHome || "~/workspace/.jarvis";
27
+ const ORCH_PATH = crewHome + "/.orchestration";
28
+
29
+ // Pin lifecycle scripts to this run — snapshot them so mid-run upgrades can't break us
30
+ const LIFECYCLE_SRC = crewHome + "/lib/worktree-lifecycle.sh";
31
+ const MERGE_LOCK_SRC = crewHome + "/lib/merge-lock.sh";
32
+ const RUN_LIB = "/tmp/crew-lib-" + taskId;
33
+ const LIFECYCLE = RUN_LIB + "/worktree-lifecycle.sh";
34
+ const MERGE_LOCK = RUN_LIB + "/merge-lock.sh";
35
+
36
+ // Project config — passed by dispatcher, falls back to dashboard defaults
37
+ const projectConfig = inputs.project_config || {};
38
+ const REPO_PATH = projectConfig.repo_path || "~/workspace/ts-spaces/orchestra-dashboard";
39
+ const DEPLOY_TYPE = projectConfig.deploy_type || "artifact";
40
+ const DEPLOY_SLUG = projectConfig.deploy_slug || DASHBOARD_SLUG;
41
+ const PROJECT_DESC = projectConfig.description || "React + TypeScript web dashboard (client/src/, server/src/, drizzle/)";
42
+ const RELEASE_SCRIPT = crewHome + "/crew-release.sh";
43
+
44
+ if (!taskId) {
45
+ throw new Error("task_id is required in args");
46
+ }
47
+
48
+ // Work-agent result schema. Runtime retries on non-JSON (structured outputs).
49
+ // Workflow wraps in try/catch so exhausted retries block instead of crashing.
50
+ const WORK_SCHEMA = {
51
+ type: "object",
52
+ properties: { passed: { type: "boolean" }, summary: { type: "string" } },
53
+ required: ["passed", "summary"]
54
+ };
55
+
56
+ // STEPS inline — export const meta is parsed as metadata, not a runtime binding
57
+ const STEPS = [
58
+ { name: "Triage", identity: "sage" },
59
+ { name: "Map", identity: "mara" },
60
+ { name: "Build", identity: "wren" },
61
+ { name: "Review", identity: "cass" },
62
+ { name: "Integrate", identity: "wren" },
63
+ { name: "Deploy", identity: "wren" },
64
+ { name: "QA", identity: "hazel" }
65
+ ];
66
+ const BUILD_INDEX = STEPS.findIndex(s => s.name === 'Build');
67
+ if (BUILD_INDEX < 0) throw new Error("STEPS missing 'Build' step");
68
+ const MAX_REWORK = 2;
69
+ let reworkCount = 0;
70
+ let rejectionNotes = inputs.rejection_notes || "";
71
+ let mapperSpec = "";
72
+ let i = startStepIndex;
73
+
74
+ // ── Pin lifecycle scripts ────────────────────────────────────────────
75
+ // Copy lifecycle scripts into a per-task temp dir so this run is immune
76
+ // to upgrades that land while it's in flight.
77
+ await agent(
78
+ "Snapshot lifecycle scripts for version pinning.\n" +
79
+ "Run these shell commands:\n" +
80
+ " mkdir -p " + RUN_LIB + "\n" +
81
+ " cp " + LIFECYCLE_SRC + " " + LIFECYCLE + "\n" +
82
+ " cp " + MERGE_LOCK_SRC + " " + MERGE_LOCK + "\n" +
83
+ " chmod +x " + LIFECYCLE + " " + MERGE_LOCK + "\n" +
84
+ "Confirm the files exist by listing " + RUN_LIB + ".",
85
+ { key: "pin-lifecycle", label: "Pinning lifecycle scripts", schema: { type: "object" } }
86
+ );
87
+ log("Lifecycle scripts pinned to " + RUN_LIB);
88
+
89
+ while (i < STEPS.length) {
90
+ const step = STEPS[i];
91
+ const isFirstClaim = (i === startStepIndex && reworkCount === 0);
92
+
93
+ phase(step.name);
94
+ log(step.name + " step (" + step.identity + ") for task " + taskId);
95
+
96
+ // Claim session — reuse dispatcher's session for the very first step
97
+ let activeSessionId;
98
+ if (isFirstClaim && firstSessionId) {
99
+ activeSessionId = firstSessionId;
100
+ } else {
101
+ const claimResult = await agent(
102
+ "Claim a session for this task step.\n" +
103
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"claimtask\", args:\n" +
104
+ "{ \"task_id\": \"" + taskId + "\", \"identity\": \"" + step.identity + "\", \"step\": \"" + step.name + "\", \"notes\": \"" + step.name + " step started" + (reworkCount > 0 ? " (rework #" + reworkCount + ")" : "") + "\" }.\n" +
105
+ "Return the session_id from the response.",
106
+ {
107
+ key: "claim-" + step.name + (reworkCount > 0 ? "-r" + reworkCount : ""),
108
+ label: "Claiming " + step.name,
109
+ schema: {
110
+ type: "object",
111
+ properties: { session_id: { type: "string" } },
112
+ required: ["session_id"]
113
+ }
114
+ }
115
+ );
116
+ activeSessionId = claimResult.session_id;
117
+ }
118
+
119
+ // Step-specific instructions
120
+ var safeTitle = taskTitle.replace(/"/g, "'").replace(/\\/g, "\\\\").replace(/`/g, "'");
121
+ var instructions = "";
122
+
123
+ if (step.name === "Triage") {
124
+ instructions = "Validate the task, check clarity, note dependencies, confirm the standard workflow assignment.\nWrite a brief triage assessment as notes for the next step.\nYour final response MUST be valid JSON and nothing else: { \"summary\": \"your assessment\", \"passed\": true }. No prose, no markdown, just the JSON object.";
125
+
126
+ } else if (step.name === "Map") {
127
+ instructions = "Research the problem space, evaluate options, pick the shortest path.\nWrite a clear spec that a builder can execute without asking questions.\nThe builder will edit source files in a git worktree.\nProject: " + PROJECT_DESC + "\nSave the spec to a file under " + crewHome + "/ if needed.\nYour final response MUST be valid JSON and nothing else: { \"summary\": \"what you specified\", \"passed\": true }. No prose, no markdown, just the JSON object.";
128
+
129
+ } else if (step.name === "Build") {
130
+ instructions = "STEP 1: Prepare your worktree.\n" +
131
+ "Run: CREW_REPO=" + REPO_PATH + " " + LIFECYCLE + " prepare " + taskId + "\n" +
132
+ "If the output says CREATED or REUSED, proceed. If it says ERROR, stop and set passed to false.\n\n" +
133
+ "STEP 2: Edit source files to implement the mapper's spec below.\n" +
134
+ (mapperSpec ? "MAPPER'S SPEC (implement exactly this):\n" + mapperSpec + "\n\n" : "") +
135
+ "Your working directory: " + REPO_PATH + "/.worktrees/" + taskId + "/\n" +
136
+ "This is the project source: " + PROJECT_DESC + "\n" +
137
+ "Edit source files directly. Do NOT use artifact_edit — that happens in the Deploy phase.\n" +
138
+ "Do not add unrequested features. Build exactly what the spec calls for.\n\n" +
139
+ "STEP 3: Commit your changes.\n" +
140
+ "cd " + REPO_PATH + "/.worktrees/" + taskId + "\n" +
141
+ "git add -A\n" +
142
+ "git commit -m \"" + safeTitle + "\"\n\n" +
143
+ (rejectionNotes ? "This is REWORK after rejection. Address these specific issues:\n" + rejectionNotes + "\n\n" : "") +
144
+ "Your final response MUST be valid JSON and nothing else: { \"summary\": \"what you built\", \"passed\": true }. No prose, no markdown, just the JSON object.";
145
+
146
+ } else if (step.name === "Review") {
147
+ instructions = "Review independently and cold. You have NOT seen any reasoning from the builder.\nDo NOT access the task dashboard, event log, or any comments. Your review is based solely on the spec and the code.\n\n" +
148
+ (mapperSpec ? "MAPPER'S SPEC (the builder was asked to implement exactly this):\n" + mapperSpec + "\n\n" : "Read the spec (from the task description or spec files under " + crewHome + "/).\n\n") +
149
+ "Examine the code changes by running:\n" +
150
+ "CREW_REPO=" + REPO_PATH + " " + LIFECYCLE + " inspect " + taskId + "\n\n" +
151
+ "You can also read specific files in the worktree at:\n" +
152
+ REPO_PATH + "/.worktrees/" + taskId + "/\n\n" +
153
+ "Check quality, correctness, and spec compliance.\n" +
154
+ "If the work passes review, your final response MUST be valid JSON and nothing else: { \"passed\": true, \"summary\": \"approval notes\" }.\n" +
155
+ "If the work fails review, your final response MUST be valid JSON and nothing else: { \"passed\": false, \"summary\": \"rejection notes explaining what needs to change\" }.\n" +
156
+ "No prose, no markdown, just the JSON object.";
157
+
158
+ } else if (step.name === "Integrate") {
159
+ instructions = "Merge the approved task branch into main.\n\n" +
160
+ "Run: CREW_REPO=" + REPO_PATH + " " + LIFECYCLE + " integrate " + taskId + " \"merge: " + safeTitle + "\"\n\n" +
161
+ "Read the output:\n" +
162
+ "- If it contains MERGED, integration succeeded. Report the merged commit hash.\n" +
163
+ "- If it contains LOCK_HELD, another task is deploying. Set passed to false with summary 'merge lock held'.\n" +
164
+ "- If it contains CONFLICT, a merge conflict occurred. Set passed to false with the conflict details.\n" +
165
+ "- If it contains ERROR, something else failed. Set passed to false with the error.\n\n" +
166
+ "Your final response MUST be valid JSON and nothing else: { \"summary\": \"result\", \"passed\": true/false }. No prose, no markdown, just the JSON object.";
167
+
168
+ } else if (step.name === "Deploy") {
169
+ if (DEPLOY_TYPE === "repo") {
170
+ // Repo projects: install immutable release and atomically activate
171
+ instructions = "Deploy repo changes via the immutable release system.\n\n" +
172
+ "STEP 0: Refresh the merge lock to prevent stale-lock breaking during deploy.\n" +
173
+ "Run: CREW_REPO=" + REPO_PATH + " " + LIFECYCLE + " refresh-lock " + taskId + "\n\n" +
174
+ "STEP 1: Install and activate the new release.\n" +
175
+ "Run: " + RELEASE_SCRIPT + " deploy " + REPO_PATH + "\n" +
176
+ "Verify the output contains INSTALLED and ACTIVATED (or EXISTS and ACTIVATED if unchanged).\n\n" +
177
+ "STEP 2: Finalize.\n" +
178
+ "Run: CREW_REPO=" + REPO_PATH + " " + LIFECYCLE + " post-deploy " + taskId + "\n" +
179
+ "If the output contains DEPLOYED, finalization is complete.\n\n" +
180
+ "Your final response MUST be valid JSON and nothing else: { \"summary\": \"release activated and finalized\", \"passed\": true }.\n" +
181
+ "No prose, no markdown, just the JSON object.";
182
+ } else {
183
+ // Artifact projects: deploy via artifact_edit then finalize
184
+ instructions = "Deploy the merged code to the live artifact.\n\n" +
185
+ "STEP 0: Refresh the merge lock to prevent stale-lock breaking during deploy.\n" +
186
+ "Run: CREW_REPO=" + REPO_PATH + " " + LIFECYCLE + " refresh-lock " + taskId + "\n\n" +
187
+ "STEP 1: Deploy to the live artifact.\n" +
188
+ "Get the change summary: cd " + REPO_PATH + " && git log -1 --stat\n" +
189
+ "Then call artifact_edit with slug \"" + DEPLOY_SLUG + "\" and verbatim_request:\n" +
190
+ "'Rebuild the application from current source. Do not modify any source files — just rebuild and deploy what is on disk.'\n" +
191
+ "Wait for the build to complete by polling artifact_status until it is no longer running.\n\n" +
192
+ "STEP 2: Finalize.\n" +
193
+ "Run: CREW_REPO=" + REPO_PATH + " " + LIFECYCLE + " post-deploy " + taskId + "\n" +
194
+ "If the output contains DEPLOYED, deployment is complete.\n\n" +
195
+ "If artifact_edit failed, still run post-deploy to release the merge lock and clean up.\n" +
196
+ "Report the failure: { \"passed\": false, \"summary\": \"artifact deployment failed: [details]\" }.\n\n" +
197
+ "Your final response MUST be valid JSON and nothing else: { \"summary\": \"deployed changes\", \"passed\": true }.\n" +
198
+ "No prose, no markdown, just the JSON object.";
199
+ }
200
+
201
+ } else if (step.name === "QA") {
202
+ if (DEPLOY_TYPE === "artifact") {
203
+ var safeDesc = taskDescription.replace(/"/g, "'").replace(/\\/g, "\\\\").slice(0, 500);
204
+ instructions = "You are code-blind QA. You NEVER read source files.\n\n" +
205
+ "STEP 1: Trigger a visual inspection of the deployed artifact.\n" +
206
+ "Call artifact_inspect with:\n" +
207
+ " slug: \"" + DEPLOY_SLUG + "\"\n" +
208
+ " repair_authorized: false\n" +
209
+ " verbatim_request: \"Verify task: " + safeTitle + ". " + safeDesc + "\"\n\n" +
210
+ "This call is asynchronous — it fires the inspection but results arrive outside this workflow. That is expected and correct.\n\n" +
211
+ "STEP 2: Verify data integrity via the dashboard API.\n" +
212
+ "Use artifact_invoke_action on slug \"" + DEPLOY_SLUG + "\" with read-only actions (e.g. gettasks, getagentsessions) to check the task's data-level effects.\n\n" +
213
+ "STEP 3: File follow-up tasks for any related issues you discover.\n" +
214
+ "Use artifact_invoke_action createtask on slug \"" + DASHBOARD_SLUG + "\" for each issue.\n\n" +
215
+ "Your final response MUST be valid JSON and nothing else:\n" +
216
+ "{ \"passed\": true, \"summary\": \"what data checks you ran and that visual inspection was requested\" }.\n" +
217
+ "No prose, no markdown, just the JSON object.";
218
+ } else {
219
+ instructions = "Test from a user's perspective. You are CODE-BLIND — do NOT read source code.\n" +
220
+ "Verify the change is working as described in the task.\n" +
221
+ "File follow-up tasks via artifact_invoke_action createtask on slug \"" + DASHBOARD_SLUG + "\" for related issues found.\n\n" +
222
+ "Your final response MUST be valid JSON and nothing else: { \"passed\": true/false, \"summary\": \"what you tested and found\" }.\n" +
223
+ "No prose, no markdown, just the JSON object.";
224
+ }
225
+ }
226
+
227
+ // Task event history — all phases except Review see the comment log
228
+ var eventPreamble = "";
229
+ if (step.name !== "Review") {
230
+ eventPreamble = "CONTEXT: First, fetch this task's event history for background.\n" +
231
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"getevents\", args: { \"limit\": 100 }.\n" +
232
+ "Look through returned events for entries matching task_id \"" + taskId + "\". They contain notes and decisions from prior phases.\n\n";
233
+ }
234
+
235
+ // Run work agent WITH schema — runtime retries on non-JSON via structured outputs
236
+ var stepResult;
237
+ try {
238
+ stepResult = await agent(
239
+ "Read the identity file at " + ORCH_PATH + "/identities/" + step.identity + ".md using the read tool, and embody that character fully.\n\n" +
240
+ "## Your Assignment\n\n" +
241
+ "Task: " + taskTitle + "\n" +
242
+ "Task ID: " + taskId + "\n" +
243
+ "Description: " + taskDescription + "\n" +
244
+ "Step: " + step.name + "\n" +
245
+ (step.name !== "Review" ? "Dashboard slug: " + DASHBOARD_SLUG + "\n" : "") +
246
+ "\n## Instructions\n\n" + eventPreamble + instructions + "\n\n" +
247
+ "CONSTRAINT: Do NOT call logevent or upsertagentsession — the workflow handles all phase tracking after your step completes.\n\n" +
248
+ "Stay in character. Do the work thoroughly.",
249
+ {
250
+ key: "work-" + step.name + (reworkCount > 0 ? "-r" + reworkCount : ""),
251
+ label: step.identity + ": " + step.name + " on \"" + taskTitle + "\"",
252
+ timeoutMs: 3600000,
253
+ schema: WORK_SCHEMA
254
+ }
255
+ );
256
+ } catch (e) {
257
+ log(step.name + " agent failed: " + (e.message || String(e)).slice(0, 500));
258
+ stepResult = null;
259
+ }
260
+
261
+ // If schema retries were exhausted, block gracefully
262
+ if (!stepResult || typeof stepResult.summary !== "string") {
263
+ log(step.name + " closeout unrecoverable — blocking");
264
+ await agent(
265
+ "Record closeout failure.\n" +
266
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"upsertagentsession\", args:\n" +
267
+ "{ \"id\": \"" + activeSessionId + "\", \"task_id\": \"" + taskId + "\", \"identity\": \"" + step.identity + "\", \"step\": \"" + step.name + "\", \"status\": \"blocked\", \"notes\": \"Agent failed to return structured result after retries\" }.\n" +
268
+ "Then call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"logevent\", args:\n" +
269
+ "{ \"task_id\": \"" + taskId + "\", \"type\": \"blocked\", \"message\": \"" + step.name + " agent failed after retries — workflow blocked\" }.",
270
+ { key: "record-block-" + step.name, label: "Recording closeout failure", schema: { type: "object" } }
271
+ );
272
+ return {
273
+ __hatchWorkflowControl: "blocked",
274
+ result: {
275
+ blocked_reason: step.name + " agent failed after retries",
276
+ message: "The " + step.identity + " agent's work may be valid — structured output failed.",
277
+ task_id: taskId
278
+ }
279
+ };
280
+ }
281
+
282
+ const summary = (stepResult.summary || "Step completed").slice(0, 2000);
283
+ const passed = stepResult.passed !== false;
284
+ const status = passed ? "completed" : "rejected";
285
+
286
+ // Capture mapper's spec for Build and Review
287
+ if (step.name === "Map" && passed) {
288
+ mapperSpec = summary;
289
+ }
290
+
291
+ // Record session result
292
+ await agent(
293
+ "Update the session and log the event.\n" +
294
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"upsertagentsession\", args:\n" +
295
+ "{ \"id\": \"" + activeSessionId + "\", \"task_id\": \"" + taskId + "\", \"identity\": \"" + step.identity + "\", \"step\": \"" + step.name + "\", \"status\": \"" + status + "\", \"notes\": " + JSON.stringify(summary) + " }.\n" +
296
+ "Then call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"logevent\", args:\n" +
297
+ "{ \"task_id\": \"" + taskId + "\", \"type\": \"" + status + "\", \"identity\": \"" + step.identity + "\", \"message\": \"" + step.name + " " + status + " by " + step.identity + "\" }.",
298
+ {
299
+ key: "record-" + step.name + (reworkCount > 0 ? "-r" + reworkCount : ""),
300
+ label: "Recording " + step.name + " result",
301
+ schema: { type: "object" }
302
+ }
303
+ );
304
+
305
+ // Handle rejection — bounce back to Build
306
+ if (!passed && (step.name === "Review" || step.name === "QA")) {
307
+ reworkCount++;
308
+ if (reworkCount > MAX_REWORK) {
309
+ log("Max rework attempts reached for task " + taskId + " — worktree preserved at .worktrees/" + taskId + " for manual inspection");
310
+ return { status: "blocked", task_id: taskId, reason: "Exceeded " + MAX_REWORK + " rework attempts after " + step.name + " rejection. Worktree preserved." };
311
+ }
312
+ rejectionNotes = summary;
313
+ i = BUILD_INDEX;
314
+ log(step.name + " rejected — bouncing to Build (rework #" + reworkCount + ")");
315
+ continue;
316
+ }
317
+
318
+ // Integrate failure blocks the task
319
+ if (!passed && step.name === "Integrate") {
320
+ log("Integration failed for task " + taskId + ": " + summary);
321
+ return { status: "blocked", task_id: taskId, reason: "Integration failed: " + summary };
322
+ }
323
+
324
+ // Deploy failure blocks the task
325
+ if (!passed && step.name === "Deploy") {
326
+ log("Deploy failed for task " + taskId + ": " + summary);
327
+ return { status: "blocked", task_id: taskId, reason: "Deploy failed: " + summary };
328
+ }
329
+
330
+ i++;
331
+ }
332
+
333
+ // All steps complete — mark task done
334
+ await agent(
335
+ "Mark this task as done.\n" +
336
+ "Call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"updatetask\", args: { \"id\": \"" + taskId + "\", \"state\": \"done\" }.\n" +
337
+ "Then call artifact_invoke_action on slug \"" + DASHBOARD_SLUG + "\", action \"logevent\", args:\n" +
338
+ "{ \"task_id\": \"" + taskId + "\", \"type\": \"completed\", \"message\": \"All standard workflow steps complete.\" }.",
339
+ { key: "task-done", label: "Completing task: " + taskTitle, schema: { type: "object" } }
340
+ );
341
+
342
+ log("Standard workflow complete for task " + taskId);
343
+
344
+ // Clean up pinned lifecycle scripts
345
+ await agent(
346
+ "Clean up pinned lifecycle scripts: rm -rf " + RUN_LIB,
347
+ { key: "cleanup-pins", label: "Cleaning pinned scripts", schema: { type: "object" } }
348
+ );
349
+
350
+ return { status: "ok", task_id: taskId, message: "Standard workflow complete for " + taskTitle };