@sigmacamellia/dsh-dynamic-workflow 0.1.4 → 0.1.6

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/lib/index.js CHANGED
@@ -210777,9 +210777,9 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
210777
210777
  });
210778
210778
 
210779
210779
  // src/index.ts
210780
- import { existsSync as existsSync4, mkdirSync as mkdirSync4 } from "node:fs";
210780
+ import { existsSync as existsSync5, mkdirSync as mkdirSync4 } from "node:fs";
210781
210781
  import { homedir as homedir2 } from "node:os";
210782
- import { dirname as dirname2, join as join7 } from "node:path";
210782
+ import { dirname as dirname2, join as join8 } from "node:path";
210783
210783
  import { fileURLToPath } from "node:url";
210784
210784
 
210785
210785
  // src/dsh/messages.ts
@@ -215646,8 +215646,8 @@ function evalCall(ev, node2, ctx) {
215646
215646
  if (hole !== void 0) return handleHole(ev, node2, hole, ctx);
215647
215647
  const world = ev.s.worldByCall.get(node2);
215648
215648
  if (world !== void 0) return handleWorldRead(ev, world.id, world.args, ctx);
215649
- const join8 = ev.s.joinByCall.get(node2);
215650
- if (join8 !== void 0) return handleJoin(ev, node2, join8.id, join8.arg, ctx);
215649
+ const join9 = ev.s.joinByCall.get(node2);
215650
+ if (join9 !== void 0) return handleJoin(ev, node2, join9.id, join9.arg, ctx);
215651
215651
  if (import_typescript22.default.isPropertyAccessExpression(node2.expression)) {
215652
215652
  const cand = ev.s.candByCall.get(node2);
215653
215653
  if (cand !== void 0) return handleArrayMethod(ev, node2, cand, ctx);
@@ -249342,6 +249342,13 @@ function describePath(cwd, path) {
249342
249342
  const rel = relative4(cwd, path);
249343
249343
  return rel.startsWith("..") || isAbsolute4(rel) ? path : rel;
249344
249344
  }
249345
+ var SAVED_WORKFLOW_NAME_PATTERN = /^[A-Za-z0-9_.-]+$/u;
249346
+ var SAVED_WORKFLOW_NAME_MAX_CHARS = 64;
249347
+ function isValidSavedWorkflowName(name2) {
249348
+ if (name2.length === 0 || name2.length > SAVED_WORKFLOW_NAME_MAX_CHARS) return false;
249349
+ if (!SAVED_WORKFLOW_NAME_PATTERN.test(name2)) return false;
249350
+ return name2.replaceAll(".", "").length > 0;
249351
+ }
249345
249352
  var HEADER = /^\s*\/\*\s*dsh-workflow\s*([\s\S]*?)\*\/\s*/u;
249346
249353
  function stripSavedHeader(text) {
249347
249354
  const match = HEADER.exec(text);
@@ -249373,7 +249380,16 @@ function listSavedAll(cwd) {
249373
249380
  try {
249374
249381
  const { meta: meta3, script } = stripSavedHeader(readFileSync(path, "utf8"));
249375
249382
  const name2 = meta3?.name ?? file2.slice(0, -".dwf.ts".length);
249376
- out.push({ name: name2, description: meta3?.description ?? "", ...meta3?.whenToUse === void 0 ? {} : { whenToUse: meta3.whenToUse }, ...meta3?.args === void 0 ? {} : { args: meta3.args }, scope, path, script });
249383
+ out.push({
249384
+ name: name2,
249385
+ description: meta3?.description ?? "",
249386
+ ...meta3?.whenToUse === void 0 ? {} : { whenToUse: meta3.whenToUse },
249387
+ ...meta3?.fromRunId === void 0 ? {} : { fromRunId: meta3.fromRunId },
249388
+ ...meta3?.args === void 0 ? {} : { args: meta3.args },
249389
+ scope,
249390
+ path,
249391
+ script
249392
+ });
249377
249393
  } catch {
249378
249394
  }
249379
249395
  }
@@ -249391,7 +249407,16 @@ function listSaved(cwd) {
249391
249407
  try {
249392
249408
  const { meta: meta3, script } = stripSavedHeader(readFileSync(path, "utf8"));
249393
249409
  const name2 = meta3?.name ?? file2.slice(0, -".dwf.ts".length);
249394
- out.set(name2, { name: name2, description: meta3?.description ?? "", ...meta3?.whenToUse === void 0 ? {} : { whenToUse: meta3.whenToUse }, ...meta3?.args === void 0 ? {} : { args: meta3.args }, scope, path, script });
249410
+ out.set(name2, {
249411
+ name: name2,
249412
+ description: meta3?.description ?? "",
249413
+ ...meta3?.whenToUse === void 0 ? {} : { whenToUse: meta3.whenToUse },
249414
+ ...meta3?.fromRunId === void 0 ? {} : { fromRunId: meta3.fromRunId },
249415
+ ...meta3?.args === void 0 ? {} : { args: meta3.args },
249416
+ scope,
249417
+ path,
249418
+ script
249419
+ });
249395
249420
  } catch {
249396
249421
  }
249397
249422
  }
@@ -249947,7 +249972,8 @@ ${result.diagnostics.map((d) => `L${d.line}:C${d.column} ${d.message}`).join("\n
249947
249972
  scope: { type: "string", enum: ["project", "global"] },
249948
249973
  script: { type: "string" },
249949
249974
  script_path: { type: "string" },
249950
- run_id: { type: "string", description: "Save the effective script of this run." },
249975
+ run_id: { type: "string", description: "Save the effective script of this run (when neither script nor script_path is given), or link provenance to that run." },
249976
+ from_run_id: { type: "string", description: "Provenance only: the id of the run this workflow was distilled from, so that run knows it has been saved." },
249951
249977
  args: { type: "object", description: "Declared arguments: { name: { type, description, default, required } }." }
249952
249978
  },
249953
249979
  required: ["name", "description", "scope"],
@@ -249980,10 +250006,12 @@ ${diagnosticsText(analysis)}` };
249980
250006
  if (decision.kind !== "allow") {
249981
250007
  return { ok: false, text: "The user declined to save this workflow. Nothing was written." };
249982
250008
  }
250009
+ const fromRunId = str(args.from_run_id) ?? str(args.run_id);
249983
250010
  const path = writeSaved(cwd, scope, {
249984
250011
  name: workflowName,
249985
250012
  description,
249986
250013
  ...typeof args.whenToUse === "string" ? { whenToUse: args.whenToUse } : {},
250014
+ ...fromRunId === void 0 ? {} : { fromRunId },
249987
250015
  ...typeof args.args === "object" && args.args !== null ? { args: args.args } : {}
249988
250016
  }, script);
249989
250017
  return { ok: true, text: `Saved "${workflowName}" at ${describePath(cwd, path)}. Run it with create_workflow { saved: { name: "${workflowName}" } }.` };
@@ -250066,8 +250094,9 @@ Revise the script accordingly and call ${tool} again.${pathNote}`,
250066
250094
  }
250067
250095
 
250068
250096
  // src/web/routes.ts
250069
- import { createReadStream } from "node:fs";
250097
+ import { createReadStream, existsSync as existsSync3 } from "node:fs";
250070
250098
  import { stat as stat3 } from "node:fs/promises";
250099
+ import { join as join6 } from "node:path";
250071
250100
 
250072
250101
  // src/dsh/owner.ts
250073
250102
  async function resolveOwnerAgent(ctx, sessionId) {
@@ -250151,6 +250180,39 @@ async function listModelIds(ctx) {
250151
250180
  }
250152
250181
  return out;
250153
250182
  }
250183
+ function buildDistillSavePrompt(input2) {
250184
+ const name2 = input2.name.trim();
250185
+ const description = input2.description.trim();
250186
+ const runName = input2.runName?.trim();
250187
+ if (input2.locale === "zh") {
250188
+ const target2 = input2.scope === "global" ? '\u4FDD\u5B58\u4E3A\u5168\u5C40\u5DE5\u4F5C\u6D41\uFF08scope: "global"\uFF09' : "\u4FDD\u5B58\u5230\u672C\u9879\u76EE";
250189
+ return [
250190
+ `/${WORKFLOW_SKILL_NAME} \u8BF7\u628A\u521A\u8DD1\u5B8C\u7684\u5DE5\u4F5C\u6D41${runName ? `\u300C${runName}\u300D` : ""}\u63D0\u70BC\u6210\u53EF\u4EE5\u590D\u7528\u7684\u5DE5\u4F5C\u6D41\uFF0C\u7528 save_workflow ${target2}\uFF1A`,
250191
+ "1. \u811A\u672C\u4EE5\u8FD9\u6B21\u8FD0\u884C\u5B9E\u9645\u6267\u884C\u7684\u90A3\u4E00\u4EFD\u4E3A\u51C6\uFF0C\u4E0D\u8981\u6539\u52A8\u5B83\u7684\u903B\u8F91\u3002",
250192
+ "2. \u628A\u4E24\u6B21\u8FD0\u884C\u4E4B\u95F4\u4F1A\u53D8\u5316\u7684\u503C\u62BD\u6210 args\uFF08\u5199\u597D\u8BF4\u660E\u4E0E\u5408\u7406\u9ED8\u8BA4\u503C\uFF09\uFF0C\u5E76\u8865\u9F50 description \u4E0E whenToUse\u3002",
250193
+ name2.length > 0 ? `3. \u540D\u5B57\u7528 \`${name2}\`\u3002` : "3. \u540D\u5B57\u8BF7\u4F60\u6765\u53D6\uFF08\u53EA\u80FD\u7528\u5B57\u6BCD\u3001\u6570\u5B57\u548C - _ .\uFF09\u3002",
250194
+ description.length > 0 ? `4. \u8BF4\u660E\u53EF\u4EE5\u53C2\u8003\uFF1A${description}` : "",
250195
+ `5. \u8C03\u7528 save_workflow \u65F6\u5E26\u4E0A from_run_id: "${input2.runId}"\u2014\u2014\u8FD9\u6B21\u8FD0\u884C\u8981\u636E\u6B64\u8BA4\u51FA\u81EA\u5DF1\u5DF2\u88AB\u4FDD\u5B58\u3002`
250196
+ ].filter((line) => line.length > 0).join("\n");
250197
+ }
250198
+ const target = input2.scope === "global" ? 'save it as a global workflow (scope: "global")' : "save it to this project";
250199
+ return [
250200
+ `/${WORKFLOW_SKILL_NAME} Please distill the workflow that just finished${runName ? ` ("${runName}")` : ""} into a reusable one and ${target} with save_workflow:`,
250201
+ "1. Use the script this run actually executed; do not change its logic.",
250202
+ "2. Lift the values that change between runs into args (with descriptions and sensible defaults), and write description and whenToUse.",
250203
+ name2.length > 0 ? `3. Name it \`${name2}\`.` : "3. Pick the name yourself (letters, digits and - _ . only).",
250204
+ description.length > 0 ? `4. For the description, start from: ${description}` : "",
250205
+ `5. Pass from_run_id: "${input2.runId}" to save_workflow, so that run can tell it has been saved.`
250206
+ ].filter((line) => line.length > 0).join("\n");
250207
+ }
250208
+ function findSavedForRun(cwd, runId, runName) {
250209
+ if (cwd === void 0) return null;
250210
+ const all = listSavedAll(cwd);
250211
+ const hit = [...all].reverse().find((item) => item.fromRunId === runId) ?? (runName !== void 0 && isValidSavedWorkflowName(runName) ? [...all].reverse().find((item) => item.name === runName) : void 0);
250212
+ if (hit === void 0) return null;
250213
+ const hasRequiredArgs = Object.values(hit.args ?? {}).some((spec) => spec.required === true && spec.default === void 0);
250214
+ return { name: hit.name, scope: hit.scope, hasRequiredArgs };
250215
+ }
250154
250216
  function registerWorkflowRoutes(ctx, deps) {
250155
250217
  ctx.inject(["webServer"], (scope) => {
250156
250218
  const webServer = scope.get("webServer");
@@ -250201,7 +250263,26 @@ function registerWorkflowRoutes(ctx, deps) {
250201
250263
  const snapshot = deps.service.snapshot(runId);
250202
250264
  const row = deps.service.journal.getRun(runId);
250203
250265
  const script = deps.service.liveRun(runId)?.scriptText ?? row?.scriptText ?? null;
250204
- json2(res, 200, { snapshot, script, graph: script === null ? null : graphOfScript(script), parentSessionId: row?.parentSessionId ?? null });
250266
+ const spans = deps.service.journal.listRunLifeSpans(runId);
250267
+ const durationMs = spans.length === 0 ? null : spans.reduce((sum, s) => sum + Math.max(0, s.lastActivityAt - s.startedAt), 0);
250268
+ const savedAs = findSavedForRun(row?.cwd, runId, snapshot.name);
250269
+ const canSave = script !== null && (row?.cwd !== void 0 || row?.parentSessionId !== void 0);
250270
+ json2(res, 200, { snapshot, script, graph: script === null ? null : graphOfScript(script), parentSessionId: row?.parentSessionId ?? null, durationMs, savedAs, canSave });
250271
+ return;
250272
+ }
250273
+ if (method === "GET" && segments[0] === "runs" && segments[2] === "save-probe" && segments.length === 3) {
250274
+ const runId = segments[1];
250275
+ const row = deps.service.journal.getRun(runId);
250276
+ const name2 = (url2.searchParams.get("name") ?? "").trim();
250277
+ const scope2 = url2.searchParams.get("scope") === "global" ? "global" : "project";
250278
+ if (row?.cwd === void 0 || !isValidSavedWorkflowName(name2)) {
250279
+ json2(res, 200, { taken: false, shadowing: false });
250280
+ return;
250281
+ }
250282
+ const other = scope2 === "global" ? "project" : "global";
250283
+ const taken = existsSync3(join6(savedDir(row.cwd, scope2), `${name2}.dwf.ts`));
250284
+ const shadowing = existsSync3(join6(savedDir(row.cwd, other), `${name2}.dwf.ts`));
250285
+ json2(res, 200, { taken, shadowing });
250205
250286
  return;
250206
250287
  }
250207
250288
  if (method === "GET" && segments[0] === "runs" && segments[2] === "nodes") {
@@ -250279,8 +250360,9 @@ function registerWorkflowRoutes(ctx, deps) {
250279
250360
  description: item.description,
250280
250361
  scope: item.scope,
250281
250362
  ...item.whenToUse === void 0 ? {} : { whenToUse: item.whenToUse },
250363
+ ...item.fromRunId === void 0 ? {} : { fromRunId: item.fromRunId },
250282
250364
  ...item.args === void 0 ? {} : { args: item.args },
250283
- runs: history.filter((row) => row.name === item.name).slice(0, 5).map((row) => ({ runId: row.runId, status: row.status, ...row.stopReason === void 0 ? {} : { stopReason: row.stopReason }, updated: row.updated, spentTokens: row.spentTokens, mine: row.parentSessionId === segments[1] }))
250365
+ runs: history.filter((row) => row.name === item.name || row.runId === item.fromRunId).slice(0, 5).map((row) => ({ runId: row.runId, status: row.status, ...row.stopReason === void 0 ? {} : { stopReason: row.stopReason }, updated: row.updated, spentTokens: row.spentTokens, mine: row.parentSessionId === segments[1] }))
250284
250366
  }));
250285
250367
  json2(res, 200, { saved, available: true, canRun: deps.access?.enabled !== false });
250286
250368
  return;
@@ -250383,6 +250465,70 @@ function registerWorkflowRoutes(ctx, deps) {
250383
250465
  json2(res, 200, await deps.service.configure(runId, parent, { ...max === void 0 ? {} : { maxConcurrency: max }, ...model === void 0 ? {} : { subagentModel: model } }));
250384
250466
  return;
250385
250467
  }
250468
+ if (action === "save") {
250469
+ const body = await readBody(req);
250470
+ const name2 = typeof body.name === "string" ? body.name.trim() : "";
250471
+ if (!isValidSavedWorkflowName(name2)) {
250472
+ json2(res, 400, { ok: false, reason: "invalid_name", message: "Invalid workflow file name." });
250473
+ return;
250474
+ }
250475
+ const scope2 = body.scope === "global" ? "global" : "project";
250476
+ const row = deps.service.journal.getRun(runId);
250477
+ const script = deps.service.liveRun(runId)?.scriptText ?? row?.scriptText;
250478
+ const parent = row?.parentSessionId === void 0 ? void 0 : await resolveOwnerAgent(ctx, row.parentSessionId);
250479
+ const cwd = row?.cwd ?? parent?.session.header.cwd;
250480
+ if (script === void 0 || cwd === void 0) {
250481
+ json2(res, 404, { ok: false, reason: "missing_run", message: "Run script or workspace is not available." });
250482
+ return;
250483
+ }
250484
+ const analysis = analyzeWorkflowScript(script);
250485
+ if (!analysis.ok) {
250486
+ json2(res, 422, { ok: false, reason: "compile_failed", message: "The run script does not compile." });
250487
+ return;
250488
+ }
250489
+ const targetPath = join6(savedDir(cwd, scope2), `${name2}.dwf.ts`);
250490
+ if (existsSync3(targetPath) && body.overwrite !== true) {
250491
+ json2(res, 200, { ok: false, reason: "target_exists" });
250492
+ return;
250493
+ }
250494
+ const description = typeof body.description === "string" && body.description.trim() !== "" ? body.description.trim() : row?.name ?? name2;
250495
+ const written = writeSaved(cwd, scope2, { name: name2, description, fromRunId: runId }, script);
250496
+ json2(res, 200, { ok: true, name: name2, scope: scope2, path: describePath(cwd, written) });
250497
+ return;
250498
+ }
250499
+ if (action === "distill") {
250500
+ if (deps.access?.enabled === false) {
250501
+ json2(res, 409, { ok: false, message: "Dynamic workflows are disabled in this deployment." });
250502
+ return;
250503
+ }
250504
+ const body = await readBody(req);
250505
+ const row = deps.service.journal.getRun(runId);
250506
+ const parent = row?.parentSessionId === void 0 ? void 0 : await resolveOwnerAgent(ctx, row.parentSessionId);
250507
+ if (parent === void 0) {
250508
+ json2(res, 409, { ok: false, message: "The session that owns this run is not available." });
250509
+ return;
250510
+ }
250511
+ const name2 = typeof body.name === "string" ? body.name.trim() : "";
250512
+ const scope2 = body.scope === "global" ? "global" : "project";
250513
+ const description = typeof body.description === "string" ? body.description.trim() : "";
250514
+ const rawLocale = typeof body.locale === "string" ? body.locale.toLowerCase() : "";
250515
+ const locale = rawLocale.startsWith("en") ? "en" : rawLocale.startsWith("zh") ? "zh" : /[\u4e00-\u9fff]/u.test(row?.name ?? description) ? "zh" : "en";
250516
+ const prompt = buildDistillSavePrompt({
250517
+ locale,
250518
+ runId,
250519
+ ...row?.name === void 0 ? {} : { runName: row.name },
250520
+ name: name2,
250521
+ scope: scope2,
250522
+ description
250523
+ });
250524
+ deps.access?.activate(parent);
250525
+ const message = userMessage(prompt, { kind: "user" });
250526
+ const live = parent;
250527
+ if (live.status === "idle" || live.steer === void 0) live.followup(message);
250528
+ else live.steer(message);
250529
+ json2(res, 200, { ok: true, sessionId: row?.parentSessionId });
250530
+ return;
250531
+ }
250386
250532
  if (action === "resume") {
250387
250533
  if (deps.access?.enabled === false) {
250388
250534
  json2(res, 409, { ok: false, message: "Dynamic workflows are disabled in this deployment; existing runs can be viewed but not resumed." });
@@ -252529,11 +252675,11 @@ function installGovernor(ctx, governor) {
252529
252675
  }
252530
252676
 
252531
252677
  // src/skill.ts
252532
- import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
252533
- import { join as join6 } from "node:path";
252678
+ import { existsSync as existsSync4, readFileSync as readFileSync2 } from "node:fs";
252679
+ import { join as join7 } from "node:path";
252534
252680
  function loadSkillContent(dir) {
252535
- const file2 = join6(dir, "SKILL.md");
252536
- if (!existsSync3(file2)) return void 0;
252681
+ const file2 = join7(dir, "SKILL.md");
252682
+ if (!existsSync4(file2)) return void 0;
252537
252683
  const text = readFileSync2(file2, "utf8");
252538
252684
  const match = /^---\n([\s\S]*?)\n---\n/.exec(text);
252539
252685
  if (match === null) return { description: "Authoring contract for dynamic-workflow scripts (create_workflow).", content: text };
@@ -252553,11 +252699,11 @@ function loadSkillContent(dir) {
252553
252699
  const description = field("description") ?? "Authoring contract for dynamic-workflow scripts (create_workflow).";
252554
252700
  const whenToUse = field("when_to_use");
252555
252701
  const body = text.slice(match[0].length);
252556
- const resources = ["patterns.md", "examples.md"].filter((name2) => existsSync3(join6(dir, name2)));
252702
+ const resources = ["patterns.md", "examples.md"].filter((name2) => existsSync4(join7(dir, name2)));
252557
252703
  const footer = resources.length === 0 ? "" : `
252558
252704
 
252559
252705
  ---
252560
- Resources next to this skill (read them with the read tool when \xA7"Going deeper" points at them): ${resources.map((name2) => join6(dir, name2)).join(", ")}`;
252706
+ Resources next to this skill (read them with the read tool when \xA7"Going deeper" points at them): ${resources.map((name2) => join7(dir, name2)).join(", ")}`;
252561
252707
  return { description, ...whenToUse === void 0 ? {} : { whenToUse }, content: body + footer };
252562
252708
  }
252563
252709
 
@@ -252795,15 +252941,15 @@ var name = "dynamic-workflow";
252795
252941
  var inject = ["tools", "agents", "systemPrompt"];
252796
252942
  var PROGRESS_EVENT = "plugin:dynamic-workflow/progress";
252797
252943
  function dshHome2() {
252798
- return process.env.DSH_HOME ?? join7(homedir2(), ".dsh");
252944
+ return process.env.DSH_HOME ?? join8(homedir2(), ".dsh");
252799
252945
  }
252800
252946
  function packageRoot() {
252801
- return join7(dirname2(fileURLToPath(import.meta.url)), "..");
252947
+ return join8(dirname2(fileURLToPath(import.meta.url)), "..");
252802
252948
  }
252803
252949
  function apply(ctx, config2 = {}) {
252804
- const stateDir = config2.stateDir ?? join7(dshHome2(), "state", "dynamic-workflow");
252950
+ const stateDir = config2.stateDir ?? join8(dshHome2(), "state", "dynamic-workflow");
252805
252951
  mkdirSync4(stateDir, { recursive: true });
252806
- const db = openJournalDatabase(join7(stateDir, "journal.sqlite"));
252952
+ const db = openJournalDatabase(join8(stateDir, "journal.sqlite"));
252807
252953
  try {
252808
252954
  applyWithDatabase(ctx, config2, stateDir, db);
252809
252955
  } catch (error62) {
@@ -252817,7 +252963,7 @@ function apply(ctx, config2 = {}) {
252817
252963
  function applyWithDatabase(ctx, config2, stateDir, db) {
252818
252964
  const journal = createSqliteJournal(db);
252819
252965
  const escalations = createEscalationRegistry();
252820
- const artifacts = createArtifactStore(join7(stateDir, "artifacts"));
252966
+ const artifacts = createArtifactStore(join8(stateDir, "artifacts"));
252821
252967
  const logger = ctx.logger;
252822
252968
  let service;
252823
252969
  let governor;
@@ -252912,7 +253058,7 @@ function applyWithDatabase(ctx, config2, stateDir, db) {
252912
253058
  interpolate: false,
252913
253059
  text: (context) => context.agent === void 0 ? "" : service.runtimeStatus(context.agent.id)
252914
253060
  });
252915
- const skillDir = join7(packageRoot(), "skills", WORKFLOW_SKILL_NAME);
253061
+ const skillDir = join8(packageRoot(), "skills", WORKFLOW_SKILL_NAME);
252916
253062
  if (access.enabled) ctx.inject(["skills"], (scope) => {
252917
253063
  const skills = scope.get("skills");
252918
253064
  const loaded = loadSkillContent(skillDir);
@@ -252926,7 +253072,7 @@ function applyWithDatabase(ctx, config2, stateDir, db) {
252926
253072
  ...loaded.whenToUse === void 0 ? {} : { whenToUse: loaded.whenToUse },
252927
253073
  content: loaded.content,
252928
253074
  source: "runtime",
252929
- ...existsSync4(skillDir) ? { resourceBase: { kind: "directory", path: skillDir } } : {}
253075
+ ...existsSync5(skillDir) ? { resourceBase: { kind: "directory", path: skillDir } } : {}
252930
253076
  }));
252931
253077
  });
252932
253078
  ctx.inject(["commands"], (scope) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigmacamellia/dsh-dynamic-workflow",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Typechecked TypeScript multi-agent dynamic workflow plugin for DeepSeek Harness (DSH): parallel subagents, SQLite durable journal (resume / amend / holes / escalations), vertical spine timeline, and live dashboard artifacts. Ported from ZCode (Apache-2.0).",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1577,6 +1577,9 @@ Saves a script with its metadata so it can be run again by name — through `cre
1577
1577
  directory, a depth. Each declaration gives a `type` (`string`, `number`,
1578
1578
  `boolean`, or `json` for anything else), and optionally a `description`, `required: true`
1579
1579
  and a `default`; every future call is validated against them.
1580
+ - `from_run_id`: provenance only — the id of the run this workflow was distilled from, when
1581
+ saving a workflow that just ran. Pass it whenever you know it; it lets that run's card show
1582
+ that it has been saved.
1580
1583
 
1581
1584
  The saved file is valid TypeScript: a `/* dsh-workflow` block of JSON metadata, then the
1582
1585
  script verbatim. The script is typechecked by the same compiler as `create_workflow`, before