@fluidgrids/cli 2026.1124.2 → 2026.1126.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.
Files changed (3) hide show
  1. package/README.md +30 -0
  2. package/dist/cli.js +947 -532
  3. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -1802,6 +1802,102 @@ var init_shared = __esm(() => {
1802
1802
  init_api();
1803
1803
  });
1804
1804
 
1805
+ // src/ai/operations.ts
1806
+ var NODE_CHANGE_FIELDS = `id label type fields`, EDGE_CHANGE_FIELDS = `source sourceHandle target targetHandle`, PROPOSAL_FIELDS, AI_PROPOSE_WORKFLOW_CHANGE, AI_PROPOSE_RUN_FIX, AI_GET_PROPOSAL, AI_APPLY_PROPOSAL, AI_EXPLAIN_RUN = `
1807
+ query FluidgridsAiExplainRun($runId: ID!) {
1808
+ explainRun(runId: $runId) {
1809
+ runId workflowId workflowKey version status failed cause errorType
1810
+ failingNodeId failingNodeLabel failingNodeType evidence suggestions
1811
+ }
1812
+ }
1813
+ `;
1814
+ var init_operations2 = __esm(() => {
1815
+ PROPOSAL_FIELDS = `
1816
+ id kind status prompt name description explanation message workflowKey
1817
+ baseVersion runId modelUsed attempts definitionJson
1818
+ diff {
1819
+ summary
1820
+ addedNodes { ${NODE_CHANGE_FIELDS} }
1821
+ removedNodes { ${NODE_CHANGE_FIELDS} }
1822
+ changedNodes { ${NODE_CHANGE_FIELDS} }
1823
+ addedEdges { ${EDGE_CHANGE_FIELDS} }
1824
+ removedEdges { ${EDGE_CHANGE_FIELDS} }
1825
+ }
1826
+ validation { valid errors warnings }
1827
+ progress { stage attempt updatedAt }
1828
+ appliedWorkflowKey appliedVersion appliedWorkflowId restoreHint rerunRunId rerunHint
1829
+ createdAt updatedAt
1830
+ `;
1831
+ AI_PROPOSE_WORKFLOW_CHANGE = `
1832
+ mutation FluidgridsAiProposeWorkflowChange($input: ProposeWorkflowChangeInput!) {
1833
+ proposeWorkflowChange(input: $input) { ${PROPOSAL_FIELDS} }
1834
+ }
1835
+ `;
1836
+ AI_PROPOSE_RUN_FIX = `
1837
+ mutation FluidgridsAiProposeRunFix($input: ProposeRunFixInput!) {
1838
+ proposeRunFix(input: $input) { ${PROPOSAL_FIELDS} }
1839
+ }
1840
+ `;
1841
+ AI_GET_PROPOSAL = `
1842
+ query FluidgridsAiGetProposal($id: ID!) {
1843
+ workflowProposal(id: $id) { ${PROPOSAL_FIELDS} }
1844
+ }
1845
+ `;
1846
+ AI_APPLY_PROPOSAL = `
1847
+ mutation FluidgridsAiApplyProposal($id: ID!, $rerun: Boolean) {
1848
+ applyWorkflowProposal(id: $id, rerun: $rerun) { ${PROPOSAL_FIELDS} }
1849
+ }
1850
+ `;
1851
+ });
1852
+
1853
+ // src/ai/api.ts
1854
+ import { CliAuthError as CliAuthError4 } from "@burdenoff/cli-sdk/core";
1855
+ function createAiApi(ctx) {
1856
+ async function request(document, variables) {
1857
+ if (!ctx.auth.isAuthenticated()) {
1858
+ throw new CliAuthError4("Authentication required.", {
1859
+ hint: `Run \`${ctx.productName} auth login\` or set FLUIDGRIDS_TOKEN.`
1860
+ });
1861
+ }
1862
+ try {
1863
+ return await ctx.gql.workspace.request(document, variables);
1864
+ } catch (err) {
1865
+ throw sanitizeGatewayError(err, variables);
1866
+ }
1867
+ }
1868
+ return {
1869
+ async proposeWorkflowChange(input) {
1870
+ const data = await request(AI_PROPOSE_WORKFLOW_CHANGE, { input });
1871
+ return data.proposeWorkflowChange;
1872
+ },
1873
+ async proposeRunFix(input) {
1874
+ const data = await request(AI_PROPOSE_RUN_FIX, { input });
1875
+ return data.proposeRunFix;
1876
+ },
1877
+ async getProposal(id) {
1878
+ const data = await request(AI_GET_PROPOSAL, {
1879
+ id
1880
+ });
1881
+ return data.workflowProposal;
1882
+ },
1883
+ async applyProposal(id, rerun) {
1884
+ const data = await request(AI_APPLY_PROPOSAL, {
1885
+ id,
1886
+ ...rerun !== undefined ? { rerun } : {}
1887
+ });
1888
+ return data.applyWorkflowProposal;
1889
+ },
1890
+ async explainRun(runId) {
1891
+ const data = await request(AI_EXPLAIN_RUN, { runId });
1892
+ return data.explainRun;
1893
+ }
1894
+ };
1895
+ }
1896
+ var init_api2 = __esm(() => {
1897
+ init_redact();
1898
+ init_operations2();
1899
+ });
1900
+
1805
1901
  // src/code-first/project.ts
1806
1902
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, readdirSync, statSync, writeFileSync as writeFileSync2 } from "fs";
1807
1903
  import { dirname as dirname2, isAbsolute, join as join2, posix, resolve } from "path";
@@ -2049,11 +2145,272 @@ var init_project = __esm(() => {
2049
2145
  SKIPPED_DIRS = new Set(["node_modules", "__pycache__", ".venv", "venv", ".git"]);
2050
2146
  });
2051
2147
 
2148
+ // src/ai/commands.ts
2149
+ import { CliUserError as CliUserError11 } from "@burdenoff/cli-sdk/core";
2150
+ function promptText(raw, what) {
2151
+ const text = (raw ?? "").trim();
2152
+ if (text === "")
2153
+ throw new CliUserError11(`The ${what} is empty.`);
2154
+ if (text.length > MAX_PROMPT_CHARS) {
2155
+ throw new CliUserError11(`The ${what} is ${text.length} characters; the limit is ${MAX_PROMPT_CHARS}.`);
2156
+ }
2157
+ return text;
2158
+ }
2159
+ function optionalText(raw, flag) {
2160
+ if (raw === undefined)
2161
+ return;
2162
+ const text = raw.trim();
2163
+ if (text === "")
2164
+ throw new CliUserError11(`${flag} is empty.`);
2165
+ return text;
2166
+ }
2167
+ function resumeId(raw) {
2168
+ if (raw === undefined)
2169
+ return;
2170
+ const id = raw.trim();
2171
+ if (!PROPOSAL_ID.test(id))
2172
+ throw new CliUserError11(`Invalid proposal id '${raw}' for --resume.`);
2173
+ return id;
2174
+ }
2175
+ function waitTimes(options) {
2176
+ return {
2177
+ timeoutMs: parsePositiveInt(options.timeout, "--timeout") ?? DEFAULT_AI_TIMEOUT_MS,
2178
+ pollMs: parsePositiveInt(options.pollInterval, "--poll-interval") ?? DEFAULT_AI_POLL_MS
2179
+ };
2180
+ }
2181
+ function resumeCommand(command, proposal) {
2182
+ return command === "propose-fix" && proposal.runId ? `fluidgrids ai propose-fix ${proposal.runId} --resume ${proposal.id}` : `fluidgrids ai generate --resume ${proposal.id}`;
2183
+ }
2184
+ async function existing(env, id) {
2185
+ const found = await env.ai.getProposal(id);
2186
+ if (found === null)
2187
+ throw new CliUserError11(`Proposal ${id} was not found.`);
2188
+ return found;
2189
+ }
2190
+ function endedError(proposal) {
2191
+ const reasons = proposal.validation?.errors ?? [];
2192
+ return new CliUserError11(`Proposal ${proposal.id} ended ${proposal.status}${proposal.message ? `: ${proposal.message}` : "."}`, reasons.length > 0 ? { hint: reasons.join(`
2193
+ `) } : undefined);
2194
+ }
2195
+ function reportResume(env, note) {
2196
+ if (isEnvelopeOutput(env.ctx.output)) {
2197
+ reportDiagnostics(env.ctx.output, [
2198
+ diagnostic({ severity: "info", code: "ai.resume", message: note })
2199
+ ]);
2200
+ } else {
2201
+ env.ctx.output.printInfo(note);
2202
+ }
2203
+ }
2204
+ async function guardProjectWorkspace(env) {
2205
+ await Promise.resolve().then(() => init_project());
2206
+ const root = findProjectRoot(env.cwd());
2207
+ if (root === null)
2208
+ return;
2209
+ assertProjectWorkspace(env, loadProject(root, root));
2210
+ }
2211
+ async function settle(env, command, started, options, rerun) {
2212
+ const { timeoutMs, pollMs } = waitTimes(options);
2213
+ const deadline = env.now() + timeoutMs;
2214
+ const resume = `${resumeCommand(command, started)}${options.apply ? " --apply" : ""}`;
2215
+ let current = started;
2216
+ const timedOut = () => new CliUserError11(`Proposal ${started.id} was still being made after ${timeoutMs} ms.`, {
2217
+ hint: `It keeps going on the service. Run \`${resume}\` to wait for it again (no new AI credit), or raise --timeout.`
2218
+ });
2219
+ try {
2220
+ while (current.status === "PROCESSING") {
2221
+ const left = deadline - env.now();
2222
+ if (left <= 0)
2223
+ throw timedOut();
2224
+ await env.sleep(Math.min(pollMs, left));
2225
+ if (env.now() >= deadline)
2226
+ throw timedOut();
2227
+ current = await existing(env, started.id);
2228
+ }
2229
+ if (current.status === "PROPOSED" && options.apply) {
2230
+ current = await env.ai.applyProposal(current.id, rerun);
2231
+ if (current.status !== "APPLIED")
2232
+ throw endedError(current);
2233
+ return { proposal: current, applied: true };
2234
+ }
2235
+ } catch (error) {
2236
+ const ended = current.status !== "PROCESSING" && current.status !== "PROPOSED";
2237
+ const expired = current.status === "PROCESSING" && env.now() >= deadline;
2238
+ if (!ended && !expired) {
2239
+ reportResume(env, `Proposal ${started.id} is kept on the service: \`${resume}\` picks it up again without a new model call.`);
2240
+ }
2241
+ throw error;
2242
+ }
2243
+ if (current.status === "PROPOSED" || current.status === "APPLIED") {
2244
+ return { proposal: current, applied: false };
2245
+ }
2246
+ throw endedError(current);
2247
+ }
2248
+ function reportWarnings(env, proposal) {
2249
+ const warnings = proposal.validation?.warnings ?? [];
2250
+ if (warnings.length === 0)
2251
+ return;
2252
+ reportDiagnostics(env.ctx.output, warnings.map((message) => diagnostic({ severity: "warning", code: "ai.validationWarning", message })));
2253
+ }
2254
+ function diffTable(proposal) {
2255
+ const diff = proposal.diff;
2256
+ const rows = [];
2257
+ if (diff) {
2258
+ for (const n of diff.addedNodes)
2259
+ rows.push(["+ node", n.id, n.label, n.type, ""]);
2260
+ for (const n of diff.removedNodes)
2261
+ rows.push(["- node", n.id, n.label, n.type, ""]);
2262
+ for (const n of diff.changedNodes) {
2263
+ rows.push(["~ node", n.id, n.label, n.type, n.fields.join(", ")]);
2264
+ }
2265
+ const edge = (e) => `${e.source}${e.sourceHandle ? `.${e.sourceHandle}` : ""} -> ${e.target}${e.targetHandle ? `.${e.targetHandle}` : ""}`;
2266
+ for (const e of diff.addedEdges)
2267
+ rows.push(["+ edge", edge(e), "", "", ""]);
2268
+ for (const e of diff.removedEdges)
2269
+ rows.push(["- edge", edge(e), "", "", ""]);
2270
+ }
2271
+ return { headers: ["Change", "Id", "Label", "Type", "Fields"], rows };
2272
+ }
2273
+ function proposalDetails(command, result) {
2274
+ const { proposal } = result;
2275
+ const lines = [
2276
+ `Proposal ${proposal.id}: ${proposal.status}${proposal.name ? ` (${proposal.name})` : ""}`
2277
+ ];
2278
+ if (proposal.diff)
2279
+ lines.push(`Diff: ${proposal.diff.summary}`);
2280
+ if (proposal.explanation)
2281
+ lines.push(`Why: ${proposal.explanation}`);
2282
+ for (const warning of proposal.validation?.warnings ?? [])
2283
+ lines.push(`warning: ${warning}`);
2284
+ if (proposal.status === "APPLIED") {
2285
+ const where = proposal.appliedWorkflowKey ?? proposal.workflowKey ?? "the workflow";
2286
+ lines.push(`${result.applied ? "Applied" : "Already applied"} as DRAFT version ${proposal.appliedVersion ?? "?"} of ${where}. It is not active: review and activate it in the builder.`);
2287
+ if (proposal.restoreHint)
2288
+ lines.push(proposal.restoreHint);
2289
+ if (proposal.rerunRunId)
2290
+ lines.push(`Re-run started as TEST run ${proposal.rerunRunId}.`);
2291
+ if (proposal.rerunHint)
2292
+ lines.push(`Not re-run: ${proposal.rerunHint}`);
2293
+ } else {
2294
+ lines.push(`Nothing is saved yet. Run \`${resumeCommand(command, proposal)} --apply\` to create a DRAFT version.`);
2295
+ }
2296
+ return lines;
2297
+ }
2298
+ function print(env, options, data, table, details) {
2299
+ const { output } = env.ctx;
2300
+ output.formatAndOutput(options, data, table);
2301
+ if (output.getFormat(options) === "table") {
2302
+ for (const line of details)
2303
+ console.log(line);
2304
+ }
2305
+ }
2306
+ async function runAiGenerate(env, rawGoal, options) {
2307
+ const resume = resumeId(options.resume);
2308
+ waitTimes(options);
2309
+ let started;
2310
+ if (resume !== undefined) {
2311
+ const building = [options.workflow, options.baseVersion, options.template, options.model].some((value) => value !== undefined);
2312
+ if ((rawGoal ?? "").trim() !== "" || building) {
2313
+ throw new CliUserError11("--resume waits for an earlier proposal; leave out the goal, --workflow, --base-version, --template and --model.");
2314
+ }
2315
+ await guardProjectWorkspace(env);
2316
+ started = await existing(env, resume);
2317
+ } else {
2318
+ const goal = promptText(rawGoal, "goal");
2319
+ const workflowKey = optionalText(options.workflow, "--workflow");
2320
+ const baseVersion = optionalText(options.baseVersion, "--base-version");
2321
+ if (baseVersion !== undefined && workflowKey === undefined) {
2322
+ throw new CliUserError11("--base-version names a version of --workflow; it needs --workflow.");
2323
+ }
2324
+ const template = optionalText(options.template, "--template");
2325
+ const model = optionalText(options.model, "--model");
2326
+ await guardProjectWorkspace(env);
2327
+ started = await env.ai.proposeWorkflowChange({
2328
+ prompt: goal,
2329
+ ...workflowKey !== undefined ? { workflowKey } : {},
2330
+ ...baseVersion !== undefined ? { baseVersion } : {},
2331
+ ...template !== undefined ? { template } : {},
2332
+ ...model !== undefined ? { model } : {}
2333
+ });
2334
+ }
2335
+ const result = await settle(env, "generate", started, options, undefined);
2336
+ reportWarnings(env, result.proposal);
2337
+ print(env, options, result, diffTable(result.proposal), proposalDetails("generate", result));
2338
+ return result;
2339
+ }
2340
+ async function runAiProposeFix(env, rawRunId, options) {
2341
+ const runId = optionalText(rawRunId, "The run id");
2342
+ if (runId === undefined)
2343
+ throw new CliUserError11("The run id is empty.");
2344
+ if (options.rerun && !options.apply) {
2345
+ throw new CliUserError11("--rerun re-runs an applied fix; it needs --apply.");
2346
+ }
2347
+ const resume = resumeId(options.resume);
2348
+ waitTimes(options);
2349
+ let started;
2350
+ if (resume !== undefined) {
2351
+ if (options.prompt !== undefined || options.model !== undefined) {
2352
+ throw new CliUserError11("--resume waits for an earlier fix; leave out --prompt and --model.");
2353
+ }
2354
+ await guardProjectWorkspace(env);
2355
+ started = await existing(env, resume);
2356
+ if (started.runId !== runId) {
2357
+ throw new CliUserError11(`Proposal ${resume} is not a fix for run ${runId}.`);
2358
+ }
2359
+ } else {
2360
+ const guidance = options.prompt === undefined ? undefined : promptText(options.prompt, "prompt");
2361
+ const model = optionalText(options.model, "--model");
2362
+ await guardProjectWorkspace(env);
2363
+ started = await env.ai.proposeRunFix({
2364
+ runId,
2365
+ ...guidance !== undefined ? { prompt: guidance } : {},
2366
+ ...model !== undefined ? { model } : {}
2367
+ });
2368
+ }
2369
+ const result = await settle(env, "propose-fix", started, options, options.rerun ? true : undefined);
2370
+ reportWarnings(env, result.proposal);
2371
+ print(env, options, result, diffTable(result.proposal), proposalDetails("propose-fix", result));
2372
+ return result;
2373
+ }
2374
+ async function runAiExplainRun(env, rawRunId, options) {
2375
+ const runId = optionalText(rawRunId, "The run id");
2376
+ if (runId === undefined)
2377
+ throw new CliUserError11("The run id is empty.");
2378
+ await guardProjectWorkspace(env);
2379
+ const explanation = await env.ai.explainRun(runId);
2380
+ const node = explanation.failingNodeId ? `${explanation.failingNodeLabel ?? explanation.failingNodeId} (${explanation.failingNodeId}${explanation.failingNodeType ? `, ${explanation.failingNodeType}` : ""})` : "";
2381
+ const details = [
2382
+ ...explanation.evidence.map((line) => `evidence: ${line}`),
2383
+ ...explanation.suggestions.map((line) => `suggestion: ${line}`)
2384
+ ];
2385
+ if (explanation.failed) {
2386
+ details.push(`Run \`fluidgrids ai propose-fix ${explanation.runId}\` for a fix proposal.`);
2387
+ }
2388
+ print(env, options, explanation, {
2389
+ headers: ["Field", "Value"],
2390
+ rows: [
2391
+ ["Run", explanation.runId],
2392
+ ["Workflow", `${explanation.workflowKey} ${explanation.version}`],
2393
+ ["Status", explanation.status],
2394
+ ["Failed", explanation.failed ? "yes" : "no"],
2395
+ ["Cause", explanation.cause],
2396
+ ["Error type", explanation.errorType ?? ""],
2397
+ ["Failing node", node]
2398
+ ]
2399
+ }, details);
2400
+ return explanation;
2401
+ }
2402
+ var MAX_PROMPT_CHARS = 4000, DEFAULT_AI_TIMEOUT_MS = 300000, DEFAULT_AI_POLL_MS = 2000, PROPOSAL_ID;
2403
+ var init_commands = __esm(() => {
2404
+ init_shared();
2405
+ init_json_contract();
2406
+ PROPOSAL_ID = /^[A-Za-z0-9_-]{1,128}$/;
2407
+ });
2408
+
2052
2409
  // src/code-first/python.ts
2053
2410
  import { spawn as spawn2 } from "child_process";
2054
2411
  import { existsSync as existsSync3 } from "fs";
2055
2412
  import { join as join3 } from "path";
2056
- import { CliUserError as CliUserError11 } from "@burdenoff/cli-sdk/core";
2413
+ import { CliUserError as CliUserError12 } from "@burdenoff/cli-sdk/core";
2057
2414
  import { irHash } from "@fluidgrids/workflows/ir";
2058
2415
  function calverAtLeast(a, b) {
2059
2416
  const parse = (value) => {
@@ -2115,13 +2472,13 @@ function lastLines(text, count) {
2115
2472
  function parseLowerResult(stdout) {
2116
2473
  const value = parseJsonObject(stdout);
2117
2474
  if (!value || value["format"] !== LOWER_RESULT_FORMAT || typeof value["sourceHash"] !== "string" || !Array.isArray(value["workflows"])) {
2118
- throw new CliUserError11(`python -m ${PYTHON_MODULE} lower returned an unexpected result (expected ${LOWER_RESULT_FORMAT}).`, { hint: UPGRADE_HINT });
2475
+ throw new CliUserError12(`python -m ${PYTHON_MODULE} lower returned an unexpected result (expected ${LOWER_RESULT_FORMAT}).`, { hint: UPGRADE_HINT });
2119
2476
  }
2120
2477
  const sdkVersion = typeof value["sdkVersion"] === "string" ? value["sdkVersion"] : "unknown";
2121
2478
  const warnings = [];
2122
2479
  const workflows = value["workflows"].map((item, index) => {
2123
2480
  if (!isRecord7(item) || typeof item["key"] !== "string" || typeof item["module"] !== "string" || typeof item["exportName"] !== "string" || !isRecord7(item["definition"])) {
2124
- throw new CliUserError11(`python -m ${PYTHON_MODULE} lower returned a malformed workflow at index ${index}.`, { hint: UPGRADE_HINT });
2481
+ throw new CliUserError12(`python -m ${PYTHON_MODULE} lower returned a malformed workflow at index ${index}.`, { hint: UPGRADE_HINT });
2125
2482
  }
2126
2483
  const reported = item["irHash"];
2127
2484
  const computed = irHash(item["definition"]);
@@ -2149,14 +2506,14 @@ function parseSourceFiles(value) {
2149
2506
  if (value === undefined)
2150
2507
  return;
2151
2508
  if (!isRecord7(value)) {
2152
- throw new CliUserError11(`python -m ${PYTHON_MODULE} lower returned malformed sourceFiles.`, {
2509
+ throw new CliUserError12(`python -m ${PYTHON_MODULE} lower returned malformed sourceFiles.`, {
2153
2510
  hint: UPGRADE_HINT
2154
2511
  });
2155
2512
  }
2156
2513
  const files = {};
2157
2514
  for (const [path, content] of Object.entries(value)) {
2158
2515
  if (typeof content !== "string" || path === "" || path.startsWith("/") || path.split("/").includes("..")) {
2159
- throw new CliUserError11(`python -m ${PYTHON_MODULE} lower returned a malformed source file (${JSON.stringify(path)}).`, { hint: UPGRADE_HINT });
2516
+ throw new CliUserError12(`python -m ${PYTHON_MODULE} lower returned a malformed source file (${JSON.stringify(path)}).`, { hint: UPGRADE_HINT });
2160
2517
  }
2161
2518
  Object.defineProperty(files, path, {
2162
2519
  value: content,
@@ -2171,13 +2528,13 @@ function parseIssues(value) {
2171
2528
  if (value === undefined)
2172
2529
  return [];
2173
2530
  if (!Array.isArray(value)) {
2174
- throw new CliUserError11(`python -m ${PYTHON_MODULE} lower returned malformed issues.`, {
2531
+ throw new CliUserError12(`python -m ${PYTHON_MODULE} lower returned malformed issues.`, {
2175
2532
  hint: UPGRADE_HINT
2176
2533
  });
2177
2534
  }
2178
2535
  return value.map((item, index) => {
2179
2536
  if (!isRecord7(item) || typeof item["code"] !== "string" || typeof item["message"] !== "string" || typeof item["module"] !== "string") {
2180
- throw new CliUserError11(`python -m ${PYTHON_MODULE} lower returned a malformed issue at index ${index}.`, { hint: UPGRADE_HINT });
2537
+ throw new CliUserError12(`python -m ${PYTHON_MODULE} lower returned a malformed issue at index ${index}.`, { hint: UPGRADE_HINT });
2181
2538
  }
2182
2539
  return {
2183
2540
  code: item["code"],
@@ -2201,12 +2558,12 @@ function reportedMessage(stderr) {
2201
2558
  }
2202
2559
  function pythonCliFailure(code, signal, stderr, python, command) {
2203
2560
  if (/No module named '?fluidgrids_workflows'?/.test(stderr)) {
2204
- return new CliUserError11(`The ${PYTHON_PACKAGE} Python package is not installed for ${python}.`, {
2561
+ return new CliUserError12(`The ${PYTHON_PACKAGE} Python package is not installed for ${python}.`, {
2205
2562
  hint: `Install it with \`${python} -m pip install ${PYTHON_PACKAGE}\`, or point FLUIDGRIDS_PYTHON (or "python" in fluidgrids.config.json) at an interpreter that has it.`
2206
2563
  });
2207
2564
  }
2208
2565
  if (code === 2 && (stderr.includes(`invalid choice: '${command}'`) || /unrecognized arguments/.test(stderr))) {
2209
- return new CliUserError11(`The installed ${PYTHON_PACKAGE} package cannot ${command === "lower" ? "lower" : command} projects.`, { hint: UPGRADE_HINT });
2566
+ return new CliUserError12(`The installed ${PYTHON_PACKAGE} package cannot ${command === "lower" ? "lower" : command} projects.`, { hint: UPGRADE_HINT });
2210
2567
  }
2211
2568
  const message = reportedMessage(stderr);
2212
2569
  if (message) {
@@ -2214,11 +2571,11 @@ function pythonCliFailure(code, signal, stderr, python, command) {
2214
2571
  if (names)
2215
2572
  return new PythonUnresolvedConnectionsError(message, names);
2216
2573
  const what = command === "lower" ? "Lowering" : command === "build" ? "Building" : "Running";
2217
- return new CliUserError11(`${what} the Python workflows failed: ${message}`);
2574
+ return new CliUserError12(`${what} the Python workflows failed: ${message}`);
2218
2575
  }
2219
2576
  const how = signal ? `was stopped by ${signal}` : `exited with status ${String(code)}`;
2220
2577
  const detail = lastLines(stderr, 20);
2221
- return new CliUserError11(`${python} -m ${PYTHON_MODULE} ${command} ${how}.`, detail ? { hint: detail } : undefined);
2578
+ return new CliUserError12(`${python} -m ${PYTHON_MODULE} ${command} ${how}.`, detail ? { hint: detail } : undefined);
2222
2579
  }
2223
2580
  function runPythonCli(options) {
2224
2581
  const args = ["-m", PYTHON_MODULE, ...options.args];
@@ -2244,13 +2601,13 @@ function runPythonCli(options) {
2244
2601
  };
2245
2602
  const timer = setTimeout(() => {
2246
2603
  child.kill("SIGKILL");
2247
- settle(() => reject(new CliUserError11(`python -m ${PYTHON_MODULE} ${options.command} did not finish within ${timeoutMs} ms.`)));
2604
+ settle(() => reject(new CliUserError12(`python -m ${PYTHON_MODULE} ${options.command} did not finish within ${timeoutMs} ms.`)));
2248
2605
  }, timeoutMs);
2249
2606
  const collect = (into) => (chunk) => {
2250
2607
  bytes += chunk.length;
2251
2608
  if (bytes > maxOutputBytes) {
2252
2609
  child.kill("SIGKILL");
2253
- settle(() => reject(new CliUserError11(`python -m ${PYTHON_MODULE} ${options.command} wrote more than ${maxOutputBytes} bytes; stopped it.`)));
2610
+ settle(() => reject(new CliUserError12(`python -m ${PYTHON_MODULE} ${options.command} wrote more than ${maxOutputBytes} bytes; stopped it.`)));
2254
2611
  return;
2255
2612
  }
2256
2613
  into.push(chunk);
@@ -2258,9 +2615,9 @@ function runPythonCli(options) {
2258
2615
  child.stdout.on("data", collect(stdout));
2259
2616
  child.stderr.on("data", collect(stderr));
2260
2617
  child.on("error", (error) => {
2261
- settle(() => reject(error.code === "ENOENT" ? new CliUserError11(`Python interpreter "${options.python}" was not found.`, {
2618
+ settle(() => reject(error.code === "ENOENT" ? new CliUserError12(`Python interpreter "${options.python}" was not found.`, {
2262
2619
  hint: `Install Python 3.11 or later with the ${PYTHON_PACKAGE} package, or set FLUIDGRIDS_PYTHON.`
2263
- }) : new CliUserError11(`Could not start ${options.python}: ${error.message}`)));
2620
+ }) : new CliUserError12(`Could not start ${options.python}: ${error.message}`)));
2264
2621
  });
2265
2622
  child.on("close", (code, signal) => {
2266
2623
  const out = Buffer.concat(stdout).toString("utf8");
@@ -2299,7 +2656,7 @@ async function lowerPython(options) {
2299
2656
  var PYTHON_MODULE = "fluidgrids_workflows", PYTHON_PACKAGE = "fluidgrids-workflows", LOWER_RESULT_FORMAT = "fluidgrids.python-lower-result", MAX_PYTHON_OUTPUT_BYTES, DEFAULT_PYTHON_TIMEOUT_MS = 120000, UNRESOLVED_PREFIX = "Create these connections in the workspace first: ", PythonUnresolvedConnectionsError, CUT_NODE_CLIENTS_SDK = "2026.1115.6", UPGRADE_HINT;
2300
2657
  var init_python = __esm(() => {
2301
2658
  MAX_PYTHON_OUTPUT_BYTES = 64 * 1024 * 1024;
2302
- PythonUnresolvedConnectionsError = class PythonUnresolvedConnectionsError extends CliUserError11 {
2659
+ PythonUnresolvedConnectionsError = class PythonUnresolvedConnectionsError extends CliUserError12 {
2303
2660
  names;
2304
2661
  constructor(message, names) {
2305
2662
  super(message);
@@ -2359,7 +2716,7 @@ var init_codegen = __esm(() => {
2359
2716
  // src/code-first/commands/init.ts
2360
2717
  import { existsSync as existsSync4 } from "fs";
2361
2718
  import { basename, join as join4, resolve as resolve2 } from "path";
2362
- import { CliUserError as CliUserError12 } from "@burdenoff/cli-sdk/core";
2719
+ import { CliUserError as CliUserError13 } from "@burdenoff/cli-sdk/core";
2363
2720
  import { SDK_VERSION as SDK_VERSION2 } from "@fluidgrids/workflows";
2364
2721
  function packageName(dir) {
2365
2722
  const name = basename(dir).toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[-._]+|[-._]+$/g, "");
@@ -2457,7 +2814,7 @@ async function runInit(env, dir, options) {
2457
2814
  const files = scaffoldFiles(root, language, config, env.ctx.productVersion);
2458
2815
  const existing = files.filter((file) => existsSync4(join4(root, ...file.path.split("/"))));
2459
2816
  if (existing.length > 0 && !options.force) {
2460
- throw new CliUserError12(`Refusing to overwrite: ${existing.map((file) => file.path).join(", ")}`, { hint: "Pass --force to overwrite them, or run init in an empty directory." });
2817
+ throw new CliUserError13(`Refusing to overwrite: ${existing.map((file) => file.path).join(", ")}`, { hint: "Pass --force to overwrite them, or run init in an empty directory." });
2461
2818
  }
2462
2819
  for (const file of files)
2463
2820
  writeProjectFile(root, file.path, file.content);
@@ -2661,7 +3018,7 @@ function refsForNames(refs, names) {
2661
3018
  var init_connections = () => {};
2662
3019
 
2663
3020
  // src/code-first/remote.ts
2664
- import { CliUserError as CliUserError13 } from "@burdenoff/cli-sdk/core";
3021
+ import { CliUserError as CliUserError14 } from "@burdenoff/cli-sdk/core";
2665
3022
  import { irHash as irHash2, normalizeDefinition } from "@fluidgrids/workflows/ir";
2666
3023
  function isRecord9(value) {
2667
3024
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -2680,7 +3037,7 @@ function pickVersion(versions, against) {
2680
3037
  function comparableRemote(definition, workflowKey) {
2681
3038
  const normalized = normalizeDefinition(definition);
2682
3039
  if (!isRecord9(normalized)) {
2683
- throw new CliUserError13(`The stored definition of ${workflowKey} is not an object.`);
3040
+ throw new CliUserError14(`The stored definition of ${workflowKey} is not an object.`);
2684
3041
  }
2685
3042
  const copy = { ...normalized };
2686
3043
  if (typeof copy["key"] !== "string" || copy["key"] === "")
@@ -2723,7 +3080,7 @@ class RemoteWorkflows {
2723
3080
  return { key, versions };
2724
3081
  const target = pickVersion(versions, this.against);
2725
3082
  if (!target) {
2726
- throw new CliUserError13(this.against === "active" ? `${key} has no ACTIVE version.` : `${key} has no version "${this.against}".`, { hint: `Stored versions: ${versions.map((version) => version.version).join(", ")}` });
3083
+ throw new CliUserError14(this.against === "active" ? `${key} has no ACTIVE version.` : `${key} has no version "${this.against}".`, { hint: `Stored versions: ${versions.map((version) => version.version).join(", ")}` });
2727
3084
  }
2728
3085
  return { key, versions, export: await this.api.exportWorkflow(key, target.version) };
2729
3086
  }
@@ -2758,7 +3115,7 @@ var init_remote = __esm(() => {
2758
3115
  // src/code-first/commands/pull.ts
2759
3116
  import { unlinkSync, existsSync as existsSync5 } from "fs";
2760
3117
  import { join as join5 } from "path";
2761
- import { CliUserError as CliUserError14 } from "@burdenoff/cli-sdk/core";
3118
+ import { CliUserError as CliUserError15 } from "@burdenoff/cli-sdk/core";
2762
3119
  import { registrySnapshotHash } from "@fluidgrids/workflows/codegen";
2763
3120
  import { buildExportDocument, irHash as irHash3, serializeWorkflowDocument } from "@fluidgrids/workflows/ir";
2764
3121
  import { exportWorkflowCode } from "@fluidgrids/workflows/roundtrip";
@@ -2808,7 +3165,7 @@ function splitFormat(options) {
2808
3165
  if (format !== "ts" && format !== "py")
2809
3166
  return { options, codeFormat: undefined };
2810
3167
  if (options.as !== undefined && options.as !== format) {
2811
- throw new CliUserError14(`--format ${format} and --as ${options.as} disagree.`);
3168
+ throw new CliUserError15(`--format ${format} and --as ${options.as} disagree.`);
2812
3169
  }
2813
3170
  const rest = { ...options };
2814
3171
  delete rest.format;
@@ -2828,14 +3185,14 @@ async function runPull(env, keys, rawOptions) {
2828
3185
  assertProjectWorkspace(env, project);
2829
3186
  const requested = parseChoice(options.as ?? codeFormat, "--as", WORKFLOW_FORMATS);
2830
3187
  if (options.wfVersion && keys.length !== 1) {
2831
- throw new CliUserError14("--wf-version needs exactly one workflow key.");
3188
+ throw new CliUserError15("--wf-version needs exactly one workflow key.");
2832
3189
  }
2833
3190
  if (options.server && requested === "json") {
2834
- throw new CliUserError14("--server renders code; JSON is always exported as stored.");
3191
+ throw new CliUserError15("--server renders code; JSON is always exported as stored.");
2835
3192
  }
2836
3193
  const targets = await keysToPull(env, project, keys);
2837
3194
  if (targets.length === 0) {
2838
- throw new CliUserError14("The workspace has no workflows to pull.");
3195
+ throw new CliUserError15("The workspace has no workflows to pull.");
2839
3196
  }
2840
3197
  const formats = new Map(targets.map((key) => [
2841
3198
  key,
@@ -2862,7 +3219,7 @@ async function runPull(env, keys, rawOptions) {
2862
3219
  const versions = sortVersions(await env.api.workflowVersions(key));
2863
3220
  const target = options.wfVersion ? pickVersion(versions, options.wfVersion) : pickVersion(versions, "latest");
2864
3221
  if (!target) {
2865
- throw new CliUserError14(versions.length === 0 ? `No workflow with key ${key} in this workspace.` : `${key} has no version "${options.wfVersion ?? ""}".`);
3222
+ throw new CliUserError15(versions.length === 0 ? `No workflow with key ${key} in this workspace.` : `${key} has no version "${options.wfVersion ?? ""}".`);
2866
3223
  }
2867
3224
  const format = formats.get(key) ?? project.config.language;
2868
3225
  let files;
@@ -2882,7 +3239,7 @@ async function runPull(env, keys, rawOptions) {
2882
3239
  });
2883
3240
  files = rendered.files.map((file) => {
2884
3241
  if (file.content === null) {
2885
- throw new CliUserError14(`The service returned ${file.path} without content.`);
3242
+ throw new CliUserError15(`The service returned ${file.path} without content.`);
2886
3243
  }
2887
3244
  return { path: file.path, contentType: file.contentType, content: file.content };
2888
3245
  });
@@ -2919,7 +3276,7 @@ async function runPull(env, keys, rawOptions) {
2919
3276
  for (const file of files) {
2920
3277
  const path = safeRelativePath(file.path, `${key} export`);
2921
3278
  if (!path.startsWith(`${WORKFLOWS_DIR}/`) && !path.startsWith(`${GENERATED_DIR}/`)) {
2922
- throw new CliUserError14(`${key} export: refusing ${path}, which is outside ${WORKFLOWS_DIR}/ and ${GENERATED_DIR}/.`);
3279
+ throw new CliUserError15(`${key} export: refusing ${path}, which is outside ${WORKFLOWS_DIR}/ and ${GENERATED_DIR}/.`);
2923
3280
  }
2924
3281
  }
2925
3282
  const codeFiles = (options.server ? files : files.filter((file) => !isNodesFile(file.path))).map((file) => keepUnlessChanged(file, readProjectFile(project.root, file.path)));
@@ -2929,7 +3286,7 @@ async function runPull(env, keys, rawOptions) {
2929
3286
  const changed = codeFiles.filter((file) => readProjectFile(project.root, file.path) !== file.content).map((file) => file.path);
2930
3287
  const main = codeFiles.find((file) => file.path.startsWith(`${WORKFLOWS_DIR}/`) && !isSidecar(file.path));
2931
3288
  if (!main)
2932
- throw new CliUserError14(`The export of ${key} has no workflow file.`);
3289
+ throw new CliUserError15(`The export of ${key} has no workflow file.`);
2933
3290
  const previous = project.lock.workflows[key];
2934
3291
  if (previous && previous.path !== main.path)
2935
3292
  removals.push(previous.path);
@@ -2988,7 +3345,7 @@ async function runPull(env, keys, rawOptions) {
2988
3345
  ])
2989
3346
  }, details);
2990
3347
  if (options.check && lossy.length > 0) {
2991
- throw new CliUserError14(`Lossy export: ${lossy.join(", ")}`, {
3348
+ throw new CliUserError15(`Lossy export: ${lossy.join(", ")}`, {
2992
3349
  hint: "The fidelity items above say what code cannot express exactly."
2993
3350
  });
2994
3351
  }
@@ -3059,7 +3416,7 @@ import { createHash } from "crypto";
3059
3416
  import { mkdtempSync, readFileSync as readFileSync3, rmSync, writeFileSync as writeFileSync3 } from "fs";
3060
3417
  import { tmpdir } from "os";
3061
3418
  import { join as join6, posix as posix3 } from "path";
3062
- import { CliUserError as CliUserError15 } from "@burdenoff/cli-sdk/core";
3419
+ import { CliUserError as CliUserError16 } from "@burdenoff/cli-sdk/core";
3063
3420
  import {
3064
3421
  serializeHistoryFile
3065
3422
  } from "@fluidgrids/workflows/history";
@@ -3067,7 +3424,7 @@ function isRecord10(value) {
3067
3424
  return typeof value === "object" && value !== null && !Array.isArray(value);
3068
3425
  }
3069
3426
  function unexpected(what) {
3070
- return new CliUserError15(`python -m ${PYTHON_MODULE} build returned ${what}.`, {
3427
+ return new CliUserError16(`python -m ${PYTHON_MODULE} build returned ${what}.`, {
3071
3428
  hint: UPGRADE_HINT2
3072
3429
  });
3073
3430
  }
@@ -3089,7 +3446,7 @@ function parseBuildResult(stdout) {
3089
3446
  }
3090
3447
  const buildId = value["buildId"];
3091
3448
  if (typeof buildId !== "string" || !/^sha256:[0-9a-f]{64}$/.test(buildId)) {
3092
- throw new CliUserError15("The Python project has no tier-2 functions, so there is no bundle.", {
3449
+ throw new CliUserError16("The Python project has no tier-2 functions, so there is no bundle.", {
3093
3450
  hint: "Durable functions are `@workflow` functions in workflows/*.py."
3094
3451
  });
3095
3452
  }
@@ -3163,10 +3520,10 @@ async function buildPython(options) {
3163
3520
  try {
3164
3521
  bundle = new Uint8Array(readFileSync3(out));
3165
3522
  } catch {
3166
- throw new CliUserError15(`python -m ${PYTHON_MODULE} build wrote no bundle to ${PYTHON_BUNDLE_PATH}.`);
3523
+ throw new CliUserError16(`python -m ${PYTHON_MODULE} build wrote no bundle to ${PYTHON_BUNDLE_PATH}.`);
3167
3524
  }
3168
3525
  if (sha256Id(bundle) !== parsed.buildId) {
3169
- throw new CliUserError15(`The Python bundle in ${PYTHON_BUNDLE_PATH} is not ${parsed.buildId}; the build is not reproducible.`);
3526
+ throw new CliUserError16(`The Python bundle in ${PYTHON_BUNDLE_PATH} is not ${parsed.buildId}; the build is not reproducible.`);
3170
3527
  }
3171
3528
  return {
3172
3529
  sdkVersion: parsed.sdkVersion,
@@ -3216,12 +3573,12 @@ function pythonReplayOutcome(stdout, file, name) {
3216
3573
  try {
3217
3574
  value = JSON.parse(stdout);
3218
3575
  } catch {
3219
- throw new CliUserError15(`python -m ${PYTHON_MODULE} replay returned output that is not JSON.`, {
3576
+ throw new CliUserError16(`python -m ${PYTHON_MODULE} replay returned output that is not JSON.`, {
3220
3577
  hint: UPGRADE_HINT2
3221
3578
  });
3222
3579
  }
3223
3580
  if (!isRecord10(value) || typeof value["ok"] !== "boolean") {
3224
- throw new CliUserError15(`python -m ${PYTHON_MODULE} replay returned an unexpected result.`, {
3581
+ throw new CliUserError16(`python -m ${PYTHON_MODULE} replay returned an unexpected result.`, {
3225
3582
  hint: UPGRADE_HINT2
3226
3583
  });
3227
3584
  }
@@ -3277,7 +3634,7 @@ var init_python_build = __esm(() => {
3277
3634
  });
3278
3635
 
3279
3636
  // src/code-first/lowering.ts
3280
- import { CliUserError as CliUserError16 } from "@burdenoff/cli-sdk/core";
3637
+ import { CliUserError as CliUserError17 } from "@burdenoff/cli-sdk/core";
3281
3638
  import { BuilderError, UnresolvedConnectionsError } from "@fluidgrids/workflows";
3282
3639
  import { parseWorkflowDocument } from "@fluidgrids/workflows/ir";
3283
3640
  import {
@@ -3294,12 +3651,12 @@ function isBuildFailure(error) {
3294
3651
  }
3295
3652
  function lowerFailure(error, what) {
3296
3653
  if (error instanceof LowerError || error instanceof BuilderError || isBuildFailure(error)) {
3297
- return new CliUserError16(`Lowering ${what} failed: ${error.message}`);
3654
+ return new CliUserError17(`Lowering ${what} failed: ${error.message}`);
3298
3655
  }
3299
3656
  return error;
3300
3657
  }
3301
3658
  function unresolvedError(names, explain) {
3302
- return new CliUserError16(`The code names connections that do not resolve in this workspace: ${[...names].sort().join(", ")}`, { hint: explain(names).join(`
3659
+ return new CliUserError17(`The code names connections that do not resolve in this workspace: ${[...names].sort().join(", ")}`, { hint: explain(names).join(`
3303
3660
  `) });
3304
3661
  }
3305
3662
  function isRecord11(value) {
@@ -3316,7 +3673,7 @@ function vendorProjectDependencies(root) {
3316
3673
  try {
3317
3674
  manifest = JSON.parse(readFileSync4(manifestPath, "utf8"));
3318
3675
  } catch {
3319
- throw new CliUserError16("package.json is not valid JSON.");
3676
+ throw new CliUserError17("package.json is not valid JSON.");
3320
3677
  }
3321
3678
  const dependencies = isRecord11(manifest) ? manifest["dependencies"] : undefined;
3322
3679
  if (!isRecord11(dependencies))
@@ -3341,7 +3698,7 @@ function jsonWorkflows(project, paths) {
3341
3698
  return readProjectFiles(project.root, paths).map((file) => {
3342
3699
  const parsed = parseWorkflowDocument(file.content);
3343
3700
  if (!parsed) {
3344
- throw new CliUserError16(`${file.path} is not a workflow export or definition.`);
3701
+ throw new CliUserError17(`${file.path} is not a workflow export or definition.`);
3345
3702
  }
3346
3703
  const stem = posix4.basename(file.path, ".json");
3347
3704
  const declared = typeof parsed.definitionJson["key"] === "string" ? parsed.definitionJson["key"] : null;
@@ -3464,13 +3821,13 @@ async function lowerProject(project, options) {
3464
3821
  });
3465
3822
  }
3466
3823
  if (buildIds.size > 1) {
3467
- throw new CliUserError16(`The Python workflows record ${buildIds.size} different build ids; one bundle serves a push.`, { hint: "Upgrade the fluidgrids-workflows package so the lowering builds one bundle." });
3824
+ throw new CliUserError17(`The Python workflows record ${buildIds.size} different build ids; one bundle serves a push.`, { hint: "Upgrade the fluidgrids-workflows package so the lowering builds one bundle." });
3468
3825
  }
3469
3826
  const [buildId] = [...buildIds];
3470
3827
  if (buildId !== undefined) {
3471
3828
  result.buildId = buildId;
3472
3829
  if (cutNodeClients && !lowered.sourceFiles) {
3473
- throw new CliUserError16(`python -m ${PYTHON_MODULE} lower --cut-node-clients listed no sourceFiles.`, { hint: "Reinstall the fluidgrids-workflows package." });
3830
+ throw new CliUserError17(`python -m ${PYTHON_MODULE} lower --cut-node-clients listed no sourceFiles.`, { hint: "Reinstall the fluidgrids-workflows package." });
3474
3831
  }
3475
3832
  result.sourceFiles = lowered.sourceFiles ?? pythonSourceFiles(project.root);
3476
3833
  result.buildPython = () => buildPython({ python, root: project.root, entries, connections, cutNodeClients });
@@ -3487,7 +3844,7 @@ async function lowerProject(project, options) {
3487
3844
  for (const workflow of workflows) {
3488
3845
  const previous = seen.get(workflow.key);
3489
3846
  if (previous) {
3490
- throw new CliUserError16(`Workflow key "${workflow.key}" is defined twice (${previous} and ${workflow.path}).`, { hint: "Delete one of the files; `fluidgrids pull --as` replaces the other format." });
3847
+ throw new CliUserError17(`Workflow key "${workflow.key}" is defined twice (${previous} and ${workflow.path}).`, { hint: "Delete one of the files; `fluidgrids pull --as` replaces the other format." });
3491
3848
  }
3492
3849
  seen.set(workflow.key, workflow.path);
3493
3850
  }
@@ -3504,17 +3861,17 @@ var init_lowering = __esm(() => {
3504
3861
  });
3505
3862
 
3506
3863
  // src/code-first/presigned.ts
3507
- import { CliUserError as CliUserError17 } from "@burdenoff/cli-sdk/core";
3864
+ import { CliUserError as CliUserError18 } from "@burdenoff/cli-sdk/core";
3508
3865
  function presignedUrl(raw, what) {
3509
3866
  let url;
3510
3867
  try {
3511
3868
  url = new URL(raw);
3512
3869
  } catch {
3513
- throw new CliUserError17(`The service returned an invalid ${what} URL.`);
3870
+ throw new CliUserError18(`The service returned an invalid ${what} URL.`);
3514
3871
  }
3515
3872
  const local = url.hostname === "localhost" || url.hostname === "127.0.0.1";
3516
3873
  if (url.protocol !== "https:" && !(url.protocol === "http:" && local)) {
3517
- throw new CliUserError17(`Refusing to transfer the ${what} over ${url.protocol}; expected https.`);
3874
+ throw new CliUserError18(`Refusing to transfer the ${what} over ${url.protocol}; expected https.`);
3518
3875
  }
3519
3876
  return url;
3520
3877
  }
@@ -3577,7 +3934,7 @@ var init_presigned = __esm(() => {
3577
3934
  });
3578
3935
 
3579
3936
  // src/code-first/code-upload.ts
3580
- import { CliUserError as CliUserError18 } from "@burdenoff/cli-sdk/core";
3937
+ import { CliUserError as CliUserError19 } from "@burdenoff/cli-sdk/core";
3581
3938
  import { SDK_VERSION as SDK_VERSION3 } from "@fluidgrids/workflows";
3582
3939
  import { packSources } from "@fluidgrids/workflows/roundtrip";
3583
3940
  import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
@@ -3592,13 +3949,13 @@ function lockText(root) {
3592
3949
  }
3593
3950
  function prepareBundle(project, lowered) {
3594
3951
  if (!lowered.bundle || !lowered.buildId || !lowered.sourceHash || !lowered.sourceFiles) {
3595
- throw new CliUserError18("This project has no code bundle to upload.", {
3952
+ throw new CliUserError19("This project has no code bundle to upload.", {
3596
3953
  hint: "Durable functions are TypeScript `workflow()` exports (Python ones arrive in Phase C)."
3597
3954
  });
3598
3955
  }
3599
3956
  const bundle = new TextEncoder().encode(lowered.bundle);
3600
3957
  if (bundle.byteLength > MAX_BUNDLE_BYTES) {
3601
- throw new CliUserError18(`The code bundle is ${bundle.byteLength} bytes; the limit is ${MAX_BUNDLE_BYTES}.`);
3958
+ throw new CliUserError19(`The code bundle is ${bundle.byteLength} bytes; the limit is ${MAX_BUNDLE_BYTES}.`);
3602
3959
  }
3603
3960
  const archiveInput = { files: lowered.sourceFiles };
3604
3961
  const lock = lockText(project.root);
@@ -3614,7 +3971,7 @@ function prepareBundle(project, lowered) {
3614
3971
  archiveInput.map = lowered.map;
3615
3972
  const archive = packSources(archiveInput);
3616
3973
  if (archive.byteLength > MAX_SOURCE_ARCHIVE_BYTES) {
3617
- throw new CliUserError18(`The source archive is ${archive.byteLength} bytes; the limit is ${MAX_SOURCE_ARCHIVE_BYTES}.`, { hint: "Vendored dependencies count toward it; drop unused `dependencies`." });
3974
+ throw new CliUserError19(`The source archive is ${archive.byteLength} bytes; the limit is ${MAX_SOURCE_ARCHIVE_BYTES}.`, { hint: "Vendored dependencies count toward it; drop unused `dependencies`." });
3618
3975
  }
3619
3976
  writeBuildBundle(project, TYPESCRIPT_BUNDLE_PATH, bundle);
3620
3977
  return {
@@ -3633,23 +3990,23 @@ function writeBuildBundle(project, path, bytes) {
3633
3990
  }
3634
3991
  async function preparePythonBundle(lowered) {
3635
3992
  if (!lowered.buildPython || !lowered.buildId || !lowered.sourceHash || !lowered.sourceFiles) {
3636
- throw new CliUserError18("This project has no code bundle to upload.", {
3993
+ throw new CliUserError19("This project has no code bundle to upload.", {
3637
3994
  hint: "Durable functions are `@workflow` functions in workflows/*.py."
3638
3995
  });
3639
3996
  }
3640
3997
  const built = await lowered.buildPython();
3641
3998
  if (built.buildId !== lowered.buildId || built.sourceHash !== lowered.sourceHash) {
3642
- throw new CliUserError18(`The Python build (${built.buildId}) does not match the lowering (${lowered.buildId}); the sources changed while pushing, or the SDK is not deterministic.`);
3999
+ throw new CliUserError19(`The Python build (${built.buildId}) does not match the lowering (${lowered.buildId}); the sources changed while pushing, or the SDK is not deterministic.`);
3643
4000
  }
3644
4001
  for (const issue of built.issues) {
3645
- throw new CliUserError18(`The Python build refused ${issue.module}: ${issue.code}: ${issue.message}`);
4002
+ throw new CliUserError19(`The Python build refused ${issue.module}: ${issue.code}: ${issue.message}`);
3646
4003
  }
3647
4004
  if (built.bundle.byteLength > MAX_BUNDLE_BYTES) {
3648
- throw new CliUserError18(`The code bundle is ${built.bundle.byteLength} bytes; the limit is ${MAX_BUNDLE_BYTES}.`);
4005
+ throw new CliUserError19(`The code bundle is ${built.bundle.byteLength} bytes; the limit is ${MAX_BUNDLE_BYTES}.`);
3649
4006
  }
3650
4007
  const archive = packSources({ files: lowered.sourceFiles });
3651
4008
  if (archive.byteLength > MAX_SOURCE_ARCHIVE_BYTES) {
3652
- throw new CliUserError18(`The source archive is ${archive.byteLength} bytes; the limit is ${MAX_SOURCE_ARCHIVE_BYTES}.`);
4009
+ throw new CliUserError19(`The source archive is ${archive.byteLength} bytes; the limit is ${MAX_SOURCE_ARCHIVE_BYTES}.`);
3653
4010
  }
3654
4011
  return {
3655
4012
  buildId: built.buildId,
@@ -3665,7 +4022,7 @@ async function prepareProjectBundle(project, lowered) {
3665
4022
  }
3666
4023
  async function put(env, target, body, what) {
3667
4024
  if (target.method.toUpperCase() !== "PUT") {
3668
- throw new CliUserError18(`The service asked for a ${target.method} ${what} upload; expected PUT.`);
4025
+ throw new CliUserError19(`The service asked for a ${target.method} ${what} upload; expected PUT.`);
3669
4026
  }
3670
4027
  presignedUrl(target.url, `${what} upload`);
3671
4028
  const headers = Object.fromEntries(Object.entries(target.headers).filter(([name]) => !CLIENT_HEADERS.has(name.toLowerCase())));
@@ -3673,12 +4030,12 @@ async function put(env, target, body, what) {
3673
4030
  try {
3674
4031
  response = await env.fetch(target.url, { method: "PUT", headers, body });
3675
4032
  } catch (error) {
3676
- throw new CliUserError18(`Uploading the ${what} failed: ${describeError(error)}`);
4033
+ throw new CliUserError19(`Uploading the ${what} failed: ${describeError(error)}`);
3677
4034
  }
3678
4035
  if (!response.ok) {
3679
4036
  const body = await readCapped(response, ERROR_BODY_BYTES, () => new Error("too large")).then((bytes) => new TextDecoder().decode(bytes)).catch(() => "");
3680
4037
  const summary = storageErrorSummary(body);
3681
- throw new CliUserError18(`Uploading the ${what} failed with HTTP ${response.status}${summary ? ` (${summary})` : ""}.`);
4038
+ throw new CliUserError19(`Uploading the ${what} failed with HTTP ${response.status}${summary ? ` (${summary})` : ""}.`);
3682
4039
  }
3683
4040
  }
3684
4041
  async function uploadBundle(env, prepared, workflowKey) {
@@ -3708,10 +4065,10 @@ function isRecord12(value) {
3708
4065
  function bundleCodeBlock(workflow, prepared) {
3709
4066
  const code = workflow.definition["code"];
3710
4067
  if (!isRecord12(code)) {
3711
- throw new CliUserError18(`${workflow.key} does not run code; it needs no bundle.`);
4068
+ throw new CliUserError19(`${workflow.key} does not run code; it needs no bundle.`);
3712
4069
  }
3713
4070
  if (code["buildId"] !== prepared.buildId) {
3714
- throw new CliUserError18(`${workflow.key} records buildId ${String(code["buildId"])}, but the bundle is ${prepared.buildId}.`);
4071
+ throw new CliUserError19(`${workflow.key} records buildId ${String(code["buildId"])}, but the bundle is ${prepared.buildId}.`);
3715
4072
  }
3716
4073
  return code;
3717
4074
  }
@@ -3746,7 +4103,7 @@ var init_code_upload = __esm(() => {
3746
4103
  });
3747
4104
 
3748
4105
  // src/code-first/history.ts
3749
- import { CliUserError as CliUserError19 } from "@burdenoff/cli-sdk/core";
4106
+ import { CliUserError as CliUserError20 } from "@burdenoff/cli-sdk/core";
3750
4107
  import {
3751
4108
  createHistoryFile,
3752
4109
  HistoryFileError,
@@ -3759,7 +4116,7 @@ function objectPayload(value, where) {
3759
4116
  if (value === null || value === undefined)
3760
4117
  return {};
3761
4118
  if (!isRecord13(value))
3762
- throw new CliUserError19(`${where}: the payload is not a JSON object.`);
4119
+ throw new CliUserError20(`${where}: the payload is not a JSON object.`);
3763
4120
  return value;
3764
4121
  }
3765
4122
  async function offloadedPayload(env, event, runId) {
@@ -3770,18 +4127,18 @@ async function offloadedPayload(env, event, runId) {
3770
4127
  try {
3771
4128
  response = await env.fetch(raw, { method: "GET" });
3772
4129
  } catch (error) {
3773
- throw new CliUserError19(`${where}: fetching the offloaded payload failed: ${describeError(error)}`);
4130
+ throw new CliUserError20(`${where}: fetching the offloaded payload failed: ${describeError(error)}`);
3774
4131
  }
3775
4132
  if (!response.ok) {
3776
- throw new CliUserError19(`${where}: fetching the offloaded payload failed with HTTP ${response.status}.`);
4133
+ throw new CliUserError20(`${where}: fetching the offloaded payload failed with HTTP ${response.status}.`);
3777
4134
  }
3778
- const tooLarge = () => new CliUserError19(`${where}: the offloaded payload is larger than the history cap (${MAX_OFFLOADED_PAYLOAD_BYTES} bytes).`);
4135
+ const tooLarge = () => new CliUserError20(`${where}: the offloaded payload is larger than the history cap (${MAX_OFFLOADED_PAYLOAD_BYTES} bytes).`);
3779
4136
  const text = new TextDecoder().decode(await readCapped(response, MAX_OFFLOADED_PAYLOAD_BYTES, tooLarge));
3780
4137
  let parsed;
3781
4138
  try {
3782
4139
  parsed = JSON.parse(text);
3783
4140
  } catch {
3784
- throw new CliUserError19(`${where}: the offloaded payload is not JSON.`);
4141
+ throw new CliUserError20(`${where}: the offloaded payload is not JSON.`);
3785
4142
  }
3786
4143
  return objectPayload(parsed, where);
3787
4144
  }
@@ -3789,7 +4146,7 @@ function assertArchiveReadable(runId, page) {
3789
4146
  if (!page.archived || page.archiveReadError === null)
3790
4147
  return;
3791
4148
  const where = page.archiveRef ? ` (${page.archiveRef})` : "";
3792
- throw new CliUserError19(`Run ${runId} was archived${where}, but its history could not be read back: ${page.archiveReadError}`, {
4149
+ throw new CliUserError20(`Run ${runId} was archived${where}, but its history could not be read back: ${page.archiveReadError}`, {
3793
4150
  hint: [
3794
4151
  "The archive destination must grant s3:GetObject on the archive prefix to the archive role.",
3795
4152
  `You can also download history.jsonl.gz from the archive yourself and run \`fluidgrids replay <path>/history.jsonl.gz\`.`
@@ -3825,11 +4182,11 @@ async function fetchRunEvents(env, runId) {
3825
4182
  }
3826
4183
  after = result.nextAfter ?? last.seq;
3827
4184
  }
3828
- throw new CliUserError19(`The history of run ${runId} did not end after ${MAX_PAGES} pages; refusing to continue.`);
4185
+ throw new CliUserError20(`The history of run ${runId} did not end after ${MAX_PAGES} pages; refusing to continue.`);
3829
4186
  }
3830
4187
  function assertDurable(run) {
3831
4188
  if (run.executionKind !== "DURABLE_FN") {
3832
- throw new CliUserError19(`Run ${run.id} is a ${run.executionKind} run; only durable-function runs have an event history.`, { hint: `Use \`fluidgrids runs logs ${run.id}\` for a canvas run.` });
4189
+ throw new CliUserError20(`Run ${run.id} is a ${run.executionKind} run; only durable-function runs have an event history.`, { hint: `Use \`fluidgrids runs logs ${run.id}\` for a canvas run.` });
3833
4190
  }
3834
4191
  }
3835
4192
  function workflowFnOf(run, events) {
@@ -3843,7 +4200,7 @@ function validated(file, runId) {
3843
4200
  return parseHistoryFile(file);
3844
4201
  } catch (error) {
3845
4202
  if (error instanceof HistoryFileError) {
3846
- throw new CliUserError19(`The history of run ${runId} is not a valid history file.`, {
4203
+ throw new CliUserError20(`The history of run ${runId} is not a valid history file.`, {
3847
4204
  hint: [error.message, ...error.issues].join(`
3848
4205
  `)
3849
4206
  });
@@ -3854,21 +4211,21 @@ function validated(file, runId) {
3854
4211
  async function fetchArchivedHistory(env, runId) {
3855
4212
  const archive = await env.api.runArchive(runId);
3856
4213
  if (!archive)
3857
- throw new CliUserError19(`Run ${runId} not found (NOT_FOUND)`);
4214
+ throw new CliUserError20(`Run ${runId} not found (NOT_FOUND)`);
3858
4215
  const where = `Run ${runId} was archived (${archive.archiveRef})`;
3859
4216
  if (archive.executionKind !== "DURABLE_FN") {
3860
- throw new CliUserError19(`${where} as a ${archive.executionKind} run; only durable-function runs have an event history.`, { hint: "A canvas run keeps its node executions in nodes.jsonl.gz next to the archive." });
4217
+ throw new CliUserError20(`${where} as a ${archive.executionKind} run; only durable-function runs have an event history.`, { hint: "A canvas run keeps its node executions in nodes.jsonl.gz next to the archive." });
3861
4218
  }
3862
4219
  if (!archive.includePayloads) {
3863
- throw new CliUserError19(`${where} without its payloads (includePayloads: false), so its history cannot be replayed.`);
4220
+ throw new CliUserError20(`${where} without its payloads (includePayloads: false), so its history cannot be replayed.`);
3864
4221
  }
3865
4222
  const fetched = await fetchRunEvents(env, runId);
3866
4223
  if (fetched.events.length === 0) {
3867
- throw new CliUserError19(`${where} with no history events.`);
4224
+ throw new CliUserError20(`${where} with no history events.`);
3868
4225
  }
3869
4226
  const workflowFn = workflowFnOf(null, fetched.events);
3870
4227
  if (!workflowFn)
3871
- throw new CliUserError19(`Run ${runId} records no workflow function.`);
4228
+ throw new CliUserError20(`Run ${runId} records no workflow function.`);
3872
4229
  const workspaceId = env.ctx.auth.read()?.workspaceId ?? "unknown";
3873
4230
  const file = createHistoryFile(workflowFn, fetched.events, {
3874
4231
  name: runId,
@@ -3882,7 +4239,7 @@ async function fetchArchivedHistory(env, runId) {
3882
4239
  };
3883
4240
  }
3884
4241
  function isRunNotFound(error) {
3885
- return error instanceof CliUserError19 && /\(NOT_FOUND\)/.test(error.message);
4242
+ return error instanceof CliUserError20 && /\(NOT_FOUND\)/.test(error.message);
3886
4243
  }
3887
4244
  async function fetchHistory(env, runId) {
3888
4245
  let run;
@@ -3897,7 +4254,7 @@ async function fetchHistory(env, runId) {
3897
4254
  const { events, historyBytes } = await fetchRunEvents(env, runId);
3898
4255
  const workflowFn = workflowFnOf(run, events);
3899
4256
  if (!workflowFn) {
3900
- throw new CliUserError19(`Run ${runId} records no workflow function.`);
4257
+ throw new CliUserError20(`Run ${runId} records no workflow function.`);
3901
4258
  }
3902
4259
  const workspaceId = env.ctx.auth.read()?.workspaceId ?? "unknown";
3903
4260
  const file = createHistoryFile(workflowFn, events, {
@@ -3920,7 +4277,7 @@ function parseHistoryText(text, path) {
3920
4277
  return parseHistoryFile(text);
3921
4278
  } catch (error) {
3922
4279
  if (error instanceof HistoryFileError) {
3923
- throw new CliUserError19(`${path} is not a valid history file: ${error.message}`, {
4280
+ throw new CliUserError20(`${path} is not a valid history file: ${error.message}`, {
3924
4281
  ...error.issues.length > 0 ? { hint: error.issues.join(`
3925
4282
  `) } : {}
3926
4283
  });
@@ -3979,7 +4336,7 @@ var init_replay = () => {};
3979
4336
 
3980
4337
  // src/code-first/commands/push.ts
3981
4338
  import { diffDefinitions, irHash as irHash4, validate } from "@fluidgrids/workflows/ir";
3982
- import { CliUserError as CliUserError20 } from "@burdenoff/cli-sdk/core";
4339
+ import { CliUserError as CliUserError21 } from "@burdenoff/cli-sdk/core";
3983
4340
  function durableSummary(issues) {
3984
4341
  if (issues.some((issue) => issue.code === "durable.phaseC"))
3985
4342
  return "The project uses durable-function features that arrive in Phase C";
@@ -3993,7 +4350,7 @@ function assertNoDurableIssues(issues) {
3993
4350
  if (issues.length === 0)
3994
4351
  return;
3995
4352
  const lines = issues.map((issue) => `${issue.key ? `${issue.key}: ` : ""}${issue.code}: ${issue.message}`);
3996
- throw new CliUserError20(`${durableSummary(issues)}; nothing was pushed.`, {
4353
+ throw new CliUserError21(`${durableSummary(issues)}; nothing was pushed.`, {
3997
4354
  hint: lines.join(`
3998
4355
  `)
3999
4356
  });
@@ -4051,21 +4408,21 @@ async function loadPushInputs(env, keys, options) {
4051
4408
  requireKnownKeys(keys, defined);
4052
4409
  const selected = keys.length > 0 ? lowered.workflows.filter((workflow) => keys.includes(workflow.key)) : lowered.workflows;
4053
4410
  if (selected.length === 0) {
4054
- throw new CliUserError20("The project defines no workflows to push.", {
4411
+ throw new CliUserError21("The project defines no workflows to push.", {
4055
4412
  hint: "Add workflows/<key>.ts|.py, or pull one with `fluidgrids pull <key>`."
4056
4413
  });
4057
4414
  }
4058
4415
  assertNoDurableIssues(lowered.issues);
4059
4416
  const errors = validationErrors(selected);
4060
4417
  if (errors.length > 0) {
4061
- throw new CliUserError20(`Validation failed; nothing was pushed.`, { hint: errors.join(`
4418
+ throw new CliUserError21(`Validation failed; nothing was pushed.`, { hint: errors.join(`
4062
4419
  `) });
4063
4420
  }
4064
4421
  return { project, lowered, selected, remote };
4065
4422
  }
4066
4423
  async function runPush(env, keys, options) {
4067
4424
  if (options.hotfix !== undefined) {
4068
- throw new CliUserError20("`--hotfix` is handled by runHotfix.");
4425
+ throw new CliUserError21("`--hotfix` is handled by runHotfix.");
4069
4426
  }
4070
4427
  const { project, lowered, selected, remote } = await loadPushInputs(env, keys, options);
4071
4428
  const stale = new Map;
@@ -4081,7 +4438,7 @@ async function runPush(env, keys, options) {
4081
4438
  stale.set(workflow.key, `${workflow.key} was pulled as ${tracked.version}, but the workspace now has ${base.version}`);
4082
4439
  }
4083
4440
  if (stale.size > 0 && !options.force && !options.dryRun) {
4084
- throw new CliUserError20("The workspace changed since the last pull; nothing was pushed.", {
4441
+ throw new CliUserError21("The workspace changed since the last pull; nothing was pushed.", {
4085
4442
  hint: [
4086
4443
  ...stale.values(),
4087
4444
  "Run `fluidgrids pull <key>` and re-apply the local edits, or pass --force to push over the newer versions."
@@ -4248,7 +4605,7 @@ var init_push = __esm(() => {
4248
4605
  });
4249
4606
 
4250
4607
  // src/code-first/commands/hotfix.ts
4251
- import { CliUserError as CliUserError21 } from "@burdenoff/cli-sdk/core";
4608
+ import { CliUserError as CliUserError22 } from "@burdenoff/cli-sdk/core";
4252
4609
  import { canonicalJson } from "@fluidgrids/workflows/ir";
4253
4610
  function isRecord15(value) {
4254
4611
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -4266,14 +4623,14 @@ function exportsOf(definition) {
4266
4623
  function pickWorkflow(selected, keys) {
4267
4624
  const durable = selected.filter((workflow) => workflow.durable);
4268
4625
  if (keys.length > 1) {
4269
- throw new CliUserError21("`--hotfix` replaces the code of one version; name one workflow key.");
4626
+ throw new CliUserError22("`--hotfix` replaces the code of one version; name one workflow key.");
4270
4627
  }
4271
4628
  const [only, ...rest] = keys.length === 1 ? selected : durable;
4272
4629
  if (!only || rest.length > 0) {
4273
- throw new CliUserError21(durable.length === 0 ? "The project defines no durable-function workflow to hotfix." : "`--hotfix` replaces the code of one version; name the workflow key.", durable.length > 1 ? { hint: `Durable workflows: ${durable.map((w) => w.key).join(", ")}` } : undefined);
4630
+ throw new CliUserError22(durable.length === 0 ? "The project defines no durable-function workflow to hotfix." : "`--hotfix` replaces the code of one version; name the workflow key.", durable.length > 1 ? { hint: `Durable workflows: ${durable.map((w) => w.key).join(", ")}` } : undefined);
4274
4631
  }
4275
4632
  if (!only.durable) {
4276
- throw new CliUserError21(`${only.key} does not run code; there is no bundle to hotfix.`);
4633
+ throw new CliUserError22(`${only.key} does not run code; there is no bundle to hotfix.`);
4277
4634
  }
4278
4635
  return only;
4279
4636
  }
@@ -4294,7 +4651,7 @@ async function localReplays(env, key, version, sample, openReplayer) {
4294
4651
  const runs = scanned.filter((run) => run.version === version && run.executionKind === "DURABLE_FN").slice(0, sample);
4295
4652
  const found = { requested: sample, found: runs.length, scanned: scanned.length };
4296
4653
  if (runs.length === 0) {
4297
- throw new CliUserError21(`--replay-sample ${sample} found no durable runs of ${key} ${version} among the newest ${scanned.length} runs; nothing was replaced.`, { hint: "Drop --replay-sample to rely on the service's replay verification alone." });
4654
+ throw new CliUserError22(`--replay-sample ${sample} found no durable runs of ${key} ${version} among the newest ${scanned.length} runs; nothing was replaced.`, { hint: "Drop --replay-sample to rely on the service's replay verification alone." });
4298
4655
  }
4299
4656
  const replayer = await openReplayer();
4300
4657
  try {
@@ -4322,10 +4679,10 @@ async function waitForJob(env, started, timeoutMs) {
4322
4679
  async function runHotfix(env, keys, options) {
4323
4680
  const version = options.hotfix;
4324
4681
  if (version === undefined || version.trim() === "") {
4325
- throw new CliUserError21("`--hotfix` needs the version to replace, for example `--hotfix v3`.");
4682
+ throw new CliUserError22("`--hotfix` needs the version to replace, for example `--hotfix v3`.");
4326
4683
  }
4327
4684
  if (options.dryRun)
4328
- throw new CliUserError21("`--hotfix` and `--dry-run` cannot be combined.");
4685
+ throw new CliUserError22("`--hotfix` and `--dry-run` cannot be combined.");
4329
4686
  const sample = parsePositiveInt(options.replaySample, "--replay-sample") ?? 0;
4330
4687
  const timeoutMs = parsePositiveInt(options.timeout, "--timeout") ?? HOTFIX_DEFAULT_TIMEOUT_MS;
4331
4688
  const inputs = await loadPushInputs(env, keys, options);
@@ -4344,24 +4701,24 @@ async function hotfixWorkflow(env, project, lowered, workflow, settings) {
4344
4701
  const stored = await env.api.exportWorkflow(workflow.key, version);
4345
4702
  const storedDefinition = comparableRemote(stored.definitionJson, workflow.key);
4346
4703
  if (!isRecord15(storedDefinition["code"])) {
4347
- throw new CliUserError21(`${workflow.key} ${version} has no code bundle; push a new version.`);
4704
+ throw new CliUserError22(`${workflow.key} ${version} has no code bundle; push a new version.`);
4348
4705
  }
4349
4706
  const outgoing = outgoingDefinition(workflow.definition, storedDefinition);
4350
4707
  if (!sameContent(withoutCode(outgoing), withoutCode(storedDefinition))) {
4351
- throw new CliUserError21(`The workflow graph of ${workflow.key} differs from ${version}; a hotfix replaces only code.`, { hint: "Push a new version instead (`fluidgrids push`)." });
4708
+ throw new CliUserError22(`The workflow graph of ${workflow.key} differs from ${version}; a hotfix replaces only code.`, { hint: "Push a new version instead (`fluidgrids push`)." });
4352
4709
  }
4353
4710
  if (exportsOf(workflow.definition) !== exportsOf(storedDefinition)) {
4354
- throw new CliUserError21(`The exported functions or interfaces of ${workflow.key} differ from ${version}; a hotfix replaces only code.`, { hint: "Push a new version instead (`fluidgrids push`)." });
4711
+ throw new CliUserError22(`The exported functions or interfaces of ${workflow.key} differ from ${version}; a hotfix replaces only code.`, { hint: "Push a new version instead (`fluidgrids push`)." });
4355
4712
  }
4356
4713
  const previous = storedDefinition["code"]["buildId"];
4357
4714
  if (previous === prepared.buildId) {
4358
- throw new CliUserError21(`${workflow.key} ${version} already runs ${prepared.buildId}.`);
4715
+ throw new CliUserError22(`${workflow.key} ${version} already runs ${prepared.buildId}.`);
4359
4716
  }
4360
4717
  const sampled = settings.sample > 0 ? await localReplays(env, workflow.key, version, settings.sample, () => prepared.language === "python" ? Promise.resolve(createPythonReplayer(lowered.python ?? "python3", project.root)) : createReplayer(lowered.bundle ?? "", prepared.buildId, "quickjs")) : undefined;
4361
4718
  const outcomes = sampled?.outcomes ?? [];
4362
4719
  const failed = outcomes.filter((outcome) => !outcome.ok);
4363
4720
  if (failed.length > 0) {
4364
- throw new CliUserError21(`The new code fails to replay ${failed.length} of ${outcomes.length} sampled runs; nothing was replaced.`, { hint: failed.map(describeOutcome).join(`
4721
+ throw new CliUserError22(`The new code fails to replay ${failed.length} of ${outcomes.length} sampled runs; nothing was replaced.`, { hint: failed.map(describeOutcome).join(`
4365
4722
  `) });
4366
4723
  }
4367
4724
  const upload = await uploadBundle(env, prepared, workflow.key);
@@ -4411,16 +4768,16 @@ async function hotfixWorkflow(env, project, lowered, workflow, settings) {
4411
4768
  rows: [[result.key, version, result.status, String(result.verifiedRuns), result.buildId]]
4412
4769
  }, details);
4413
4770
  if (timedOut) {
4414
- throw new CliUserError21(`The code replacement ${job.id} is still ${job.status} after ${settings.timeoutMs} ms.`, { hint: "It keeps running on the service; check it again with `fluidgrids versions list`." });
4771
+ throw new CliUserError22(`The code replacement ${job.id} is still ${job.status} after ${settings.timeoutMs} ms.`, { hint: "It keeps running on the service; check it again with `fluidgrids versions list`." });
4415
4772
  }
4416
4773
  if (job.status === "REJECTED") {
4417
- throw new CliUserError21(`The service rejected the new code for ${workflow.key} ${version}: ${job.violations.length} replay violation(s).`, {
4774
+ throw new CliUserError22(`The service rejected the new code for ${workflow.key} ${version}: ${job.violations.length} replay violation(s).`, {
4418
4775
  hint: job.violations.map((v) => `run ${v.runId}${v.seq !== null ? ` event ${v.seq}` : ""}: ${v.message}`).join(`
4419
4776
  `)
4420
4777
  });
4421
4778
  }
4422
4779
  if (!replaced) {
4423
- throw new CliUserError21(`The code replacement ${job.id} ended ${job.status}; the version keeps its code.`);
4780
+ throw new CliUserError22(`The code replacement ${job.id} ended ${job.status}; the version keeps its code.`);
4424
4781
  }
4425
4782
  return result;
4426
4783
  }
@@ -4438,7 +4795,7 @@ var init_hotfix = __esm(() => {
4438
4795
  });
4439
4796
 
4440
4797
  // src/code-first/commands/diff.ts
4441
- import { CliUserError as CliUserError22 } from "@burdenoff/cli-sdk/core";
4798
+ import { CliUserError as CliUserError23 } from "@burdenoff/cli-sdk/core";
4442
4799
  import { diffDefinitions as diffDefinitions2 } from "@fluidgrids/workflows/ir";
4443
4800
  async function runDiff(env, keys, options) {
4444
4801
  const project = loadProject(options.project, env.cwd());
@@ -4491,7 +4848,7 @@ async function runDiff(env, keys, options) {
4491
4848
  ])
4492
4849
  }, details);
4493
4850
  if (options.exitCode && items.some((item) => item.status !== "same")) {
4494
- throw new CliUserError22("The local workflows differ from the workspace.", { exitCode: 1 });
4851
+ throw new CliUserError23("The local workflows differ from the workspace.", { exitCode: 1 });
4495
4852
  }
4496
4853
  return result;
4497
4854
  }
@@ -4504,17 +4861,17 @@ var init_diff = __esm(() => {
4504
4861
  });
4505
4862
 
4506
4863
  // src/code-first/commands/validate.ts
4507
- import { CliUserError as CliUserError23 } from "@burdenoff/cli-sdk/core";
4864
+ import { CliUserError as CliUserError24 } from "@burdenoff/cli-sdk/core";
4508
4865
  import { validate as validate2 } from "@fluidgrids/workflows/ir";
4509
4866
  async function runValidate(env, keys, options) {
4510
4867
  if (options.offline && options.remote) {
4511
- throw new CliUserError23("--offline and --remote cannot be combined.");
4868
+ throw new CliUserError24("--offline and --remote cannot be combined.");
4512
4869
  }
4513
4870
  const project = loadProject(options.project, env.cwd());
4514
4871
  let index;
4515
4872
  if (!options.offline) {
4516
4873
  if (!env.ctx.auth.isAuthenticated()) {
4517
- throw new CliUserError23("Validating against the workspace needs a login.", {
4874
+ throw new CliUserError24("Validating against the workspace needs a login.", {
4518
4875
  hint: "Run `fluidgrids auth login`, set FLUIDGRIDS_TOKEN, or pass --offline.",
4519
4876
  exitCode: 2
4520
4877
  });
@@ -4531,7 +4888,7 @@ async function runValidate(env, keys, options) {
4531
4888
  requireKnownKeys(keys, lowered.workflows.map((workflow) => workflow.key));
4532
4889
  const selected = keys.length > 0 ? lowered.workflows.filter((workflow) => keys.includes(workflow.key)) : lowered.workflows;
4533
4890
  if (selected.length === 0)
4534
- throw new CliUserError23("The project defines no workflows.");
4891
+ throw new CliUserError24("The project defines no workflows.");
4535
4892
  const owner = (issue) => lowered.workflows.find((workflow) => issue.key !== undefined ? workflow.key === issue.key : workflow.path === issue.module);
4536
4893
  const durableIssue = (issue) => ({
4537
4894
  source: "local",
@@ -4628,7 +4985,7 @@ async function runValidate(env, keys, options) {
4628
4985
  invalid.unshift("the project");
4629
4986
  if (invalid.length > 0) {
4630
4987
  const durable = lowered.issues.length > 0 ? `; ${durableSummary(lowered.issues)}` : "";
4631
- throw new CliUserError23(`Invalid: ${invalid.join(", ")}${durable}`);
4988
+ throw new CliUserError24(`Invalid: ${invalid.join(", ")}${durable}`);
4632
4989
  }
4633
4990
  return result;
4634
4991
  }
@@ -4645,26 +5002,26 @@ var init_validate = __esm(() => {
4645
5002
  // src/phase-d/commands/n8n-import.ts
4646
5003
  import { existsSync as existsSync8, readFileSync as readFileSync6, statSync as statSync2 } from "fs";
4647
5004
  import { extname, resolve as resolve3 } from "path";
4648
- import { CliUserError as CliUserError24 } from "@burdenoff/cli-sdk/core";
5005
+ import { CliUserError as CliUserError25 } from "@burdenoff/cli-sdk/core";
4649
5006
  function readDocument(file, absolute) {
4650
5007
  if (!existsSync8(absolute) || !statSync2(absolute).isFile()) {
4651
- throw new CliUserError24(`${file} does not exist.`);
5008
+ throw new CliUserError25(`${file} does not exist.`);
4652
5009
  }
4653
5010
  if (extname(absolute).toLowerCase() !== ".json") {
4654
- throw new CliUserError24(`--from n8n imports an n8n export (.json); ${file} is not one.`);
5011
+ throw new CliUserError25(`--from n8n imports an n8n export (.json); ${file} is not one.`);
4655
5012
  }
4656
5013
  const bytes = statSync2(absolute).size;
4657
5014
  if (bytes > MAX_N8N_DOCUMENT_BYTES) {
4658
- throw new CliUserError24(`${file} is ${bytes} bytes; an n8n import takes at most ${MAX_N8N_DOCUMENT_BYTES}.`);
5015
+ throw new CliUserError25(`${file} is ${bytes} bytes; an n8n import takes at most ${MAX_N8N_DOCUMENT_BYTES}.`);
4659
5016
  }
4660
5017
  let parsed;
4661
5018
  try {
4662
5019
  parsed = JSON.parse(readFileSync6(absolute, "utf8"));
4663
5020
  } catch {
4664
- throw new CliUserError24(`${file} is not valid JSON.`);
5021
+ throw new CliUserError25(`${file} is not valid JSON.`);
4665
5022
  }
4666
5023
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
4667
- throw new CliUserError24(`${file} is not an n8n workflow export (a JSON object).`);
5024
+ throw new CliUserError25(`${file} is not an n8n workflow export (a JSON object).`);
4668
5025
  }
4669
5026
  return parsed;
4670
5027
  }
@@ -4714,10 +5071,10 @@ function reportDiagnosticsOf(report, file) {
4714
5071
  async function runN8nImport(env, file, options) {
4715
5072
  const provider = options.from.trim().toLowerCase();
4716
5073
  if (provider !== "n8n") {
4717
- throw new CliUserError24(`Invalid value '${options.from}' for --from. Allowed: ${IMPORT_SOURCES.join(", ")}`);
5074
+ throw new CliUserError25(`Invalid value '${options.from}' for --from. Allowed: ${IMPORT_SOURCES.join(", ")}`);
4718
5075
  }
4719
5076
  if (options.preview && (options.key || options.name || options.description || options.allowMissingNodes)) {
4720
- throw new CliUserError24("--preview stores nothing; --key, --name, --description and --allow-missing-nodes need an import.");
5077
+ throw new CliUserError25("--preview stores nothing; --key, --name, --description and --allow-missing-nodes need an import.");
4721
5078
  }
4722
5079
  const document = readDocument(file, resolve3(env.cwd(), file));
4723
5080
  const preview = await env.pd.previewN8nImport(document);
@@ -4838,7 +5195,7 @@ var FIDELITY_FIELDS = "level items { kind nodeId path detail }", GENERATION_FIEL
4838
5195
  }
4839
5196
  }
4840
5197
  `;
4841
- var init_operations2 = __esm(() => {
5198
+ var init_operations3 = __esm(() => {
4842
5199
  init_operations();
4843
5200
  PD_GENERATE_WORKFLOW = `
4844
5201
  mutation FluidgridsCodeGenerateWorkflow($input: GenerateWorkflowFromPromptInput!) {
@@ -4885,11 +5242,11 @@ var init_operations2 = __esm(() => {
4885
5242
  });
4886
5243
 
4887
5244
  // src/phase-d/api.ts
4888
- import { CliAuthError as CliAuthError4, CliUserError as CliUserError25 } from "@burdenoff/cli-sdk/core";
5245
+ import { CliAuthError as CliAuthError5, CliUserError as CliUserError26 } from "@burdenoff/cli-sdk/core";
4889
5246
  function createPhaseDApi(ctx) {
4890
5247
  async function request(document, variables, flags) {
4891
5248
  if (!ctx.auth.isAuthenticated()) {
4892
- throw new CliAuthError4("Authentication required.", {
5249
+ throw new CliAuthError5("Authentication required.", {
4893
5250
  hint: `Run \`${ctx.productName} auth login\` or set FLUIDGRIDS_TOKEN.`
4894
5251
  });
4895
5252
  }
@@ -4936,7 +5293,7 @@ function createPhaseDApi(ctx) {
4936
5293
  ...result.validation.errors,
4937
5294
  ...result.validation.missingNodes.map((node) => `node ${node.nodeId} uses ${node.nodeType}${node.nodeVersion ? `@${node.nodeVersion}` : ""}, which is not installed`)
4938
5295
  ];
4939
- throw new CliUserError25(`Importing ${input.workflowKey ?? input.name} failed: ${result.message ?? "no reason given"}`, reasons.length > 0 ? { hint: reasons.join(`
5296
+ throw new CliUserError26(`Importing ${input.workflowKey ?? input.name} failed: ${result.message ?? "no reason given"}`, reasons.length > 0 ? { hint: reasons.join(`
4940
5297
  `) } : undefined);
4941
5298
  }
4942
5299
  return { workflow: result.workflow, report: result.n8nReport };
@@ -4948,27 +5305,27 @@ function createPhaseDApi(ctx) {
4948
5305
  async startActivity(input) {
4949
5306
  const data = await request(PD_START_ACTIVITY, { input }, [F.standaloneActivities]);
4950
5307
  if (!data.startActivity)
4951
- throw new CliUserError25("startActivity returned no run.");
5308
+ throw new CliUserError26("startActivity returned no run.");
4952
5309
  return data.startActivity;
4953
5310
  }
4954
5311
  };
4955
5312
  }
4956
- var init_api2 = __esm(() => {
5313
+ var init_api3 = __esm(() => {
4957
5314
  init_redact();
4958
5315
  init_flag_hint();
4959
- init_operations2();
5316
+ init_operations3();
4960
5317
  });
4961
5318
 
4962
5319
  // src/phase-d/shared.ts
4963
5320
  import { isAbsolute as isAbsolute2 } from "path";
4964
- import { CliUserError as CliUserError26 } from "@burdenoff/cli-sdk/core";
5321
+ import { CliUserError as CliUserError27 } from "@burdenoff/cli-sdk/core";
4965
5322
  function phaseDEnv(env) {
4966
5323
  return { ...env, pd: createPhaseDApi(env.ctx), confirm: confirmOnTerminal };
4967
5324
  }
4968
5325
  function safeRelativePath2(raw, what) {
4969
5326
  const bad = raw === "" || raw.length > 512 || isAbsolute2(raw) || raw.startsWith("/") || /^[A-Za-z]:/.test(raw) || raw.includes("\\") || [...raw].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127) || raw.split("/").some((segment) => segment === "" || segment === "." || segment === "..");
4970
5327
  if (bad)
4971
- throw new CliUserError26(`The service sent an unsafe ${what} path: ${JSON.stringify(raw)}`);
5328
+ throw new CliUserError27(`The service sent an unsafe ${what} path: ${JSON.stringify(raw)}`);
4972
5329
  return raw;
4973
5330
  }
4974
5331
  function parseJsonObjectArg(raw, flag, readFile) {
@@ -4979,22 +5336,22 @@ function parseJsonObjectArg(raw, flag, readFile) {
4979
5336
  try {
4980
5337
  parsed = JSON.parse(text);
4981
5338
  } catch {
4982
- throw new CliUserError26(`${flag} must be a JSON object (or @file holding one).`);
5339
+ throw new CliUserError27(`${flag} must be a JSON object (or @file holding one).`);
4983
5340
  }
4984
5341
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
4985
- throw new CliUserError26(`${flag} must be a JSON object (or @file holding one).`);
5342
+ throw new CliUserError27(`${flag} must be a JSON object (or @file holding one).`);
4986
5343
  }
4987
5344
  return parsed;
4988
5345
  }
4989
5346
  var init_shared2 = __esm(() => {
4990
5347
  init_confirm();
4991
- init_api2();
5348
+ init_api3();
4992
5349
  });
4993
5350
 
4994
5351
  // src/code-first/commands/import.ts
4995
5352
  import { existsSync as existsSync9, readFileSync as readFileSync7 } from "fs";
4996
5353
  import { basename as basename2, dirname as dirname4, extname as extname2, relative, resolve as resolve4, sep } from "path";
4997
- import { CliUserError as CliUserError27 } from "@burdenoff/cli-sdk/core";
5354
+ import { CliUserError as CliUserError28 } from "@burdenoff/cli-sdk/core";
4998
5355
  import { irHash as irHash5, parseWorkflowDocument as parseWorkflowDocument2 } from "@fluidgrids/workflows/ir";
4999
5356
  import { bundledProjectFiles, lower as lower2 } from "@fluidgrids/workflows/roundtrip";
5000
5357
  import { UnresolvedConnectionsError as UnresolvedConnectionsError2 } from "@fluidgrids/workflows";
@@ -5011,11 +5368,11 @@ function common(options) {
5011
5368
  function prepareJson(path, absolute, text, options) {
5012
5369
  const parsed = parseWorkflowDocument2(text);
5013
5370
  if (!parsed)
5014
- throw new CliUserError27(`${path} is not a workflow export or definition.`);
5371
+ throw new CliUserError28(`${path} is not a workflow export or definition.`);
5015
5372
  const declared = parsed.definitionJson["key"];
5016
5373
  const key = options.key ?? parsed.workflowKey ?? (typeof declared === "string" && declared !== "" ? declared : undefined);
5017
5374
  if (!key) {
5018
- throw new CliUserError27(`${path} names no workflow key.`, { hint: "Pass --key <key>." });
5375
+ throw new CliUserError28(`${path} names no workflow key.`, { hint: "Pass --key <key>." });
5019
5376
  }
5020
5377
  const name = options.name ?? nameOf(parsed.definitionJson, key);
5021
5378
  const source = {
@@ -5044,13 +5401,13 @@ function recordingResolver(index) {
5044
5401
  };
5045
5402
  }
5046
5403
  function unresolved(names, index) {
5047
- return new CliUserError27(`The code names connections that do not resolve in this workspace: ${[...names].sort().join(", ")}`, { hint: explainUnresolved(names, index).join(`
5404
+ return new CliUserError28(`The code names connections that do not resolve in this workspace: ${[...names].sort().join(", ")}`, { hint: explainUnresolved(names, index).join(`
5048
5405
  `) });
5049
5406
  }
5050
5407
  function chooseWorkflow(found, file, key) {
5051
5408
  const chosen = found.length === 1 ? found[0] : found.find((item) => item.key === key);
5052
5409
  if (!chosen) {
5053
- throw new CliUserError27(found.length === 0 ? `${file} defines no workflow.` : key ? `${file} defines no workflow "${key}" (found: ${found.map((item) => item.key).join(", ")}).` : `${file} defines ${found.length} workflows (${found.map((item) => item.key).join(", ")}); pass --key to choose one.`);
5410
+ throw new CliUserError28(found.length === 0 ? `${file} defines no workflow.` : key ? `${file} defines no workflow "${key}" (found: ${found.map((item) => item.key).join(", ")}).` : `${file} defines ${found.length} workflows (${found.map((item) => item.key).join(", ")}); pass --key to choose one.`);
5054
5411
  }
5055
5412
  return chosen;
5056
5413
  }
@@ -5121,21 +5478,21 @@ async function preparePython(env, project, path, options) {
5121
5478
  function projectOf(absolute) {
5122
5479
  const root = findProjectRoot(dirname4(absolute));
5123
5480
  if (!root) {
5124
- throw new CliUserError27(`${absolute} is not inside a code-first project.`, {
5481
+ throw new CliUserError28(`${absolute} is not inside a code-first project.`, {
5125
5482
  hint: "Run `fluidgrids init` in the project directory first."
5126
5483
  });
5127
5484
  }
5128
5485
  const project = loadProject(root, root);
5129
5486
  const path = relative(root, absolute).split(sep).join("/");
5130
5487
  if (!path.startsWith(`${WORKFLOWS_DIR}/`)) {
5131
- throw new CliUserError27(`${path} is not under ${WORKFLOWS_DIR}/ of the project at ${root}.`);
5488
+ throw new CliUserError28(`${path} is not under ${WORKFLOWS_DIR}/ of the project at ${root}.`);
5132
5489
  }
5133
5490
  return { project, path };
5134
5491
  }
5135
5492
  async function runImport(env, file, options) {
5136
5493
  const absolute = resolve4(env.cwd(), file);
5137
5494
  if (!existsSync9(absolute))
5138
- throw new CliUserError27(`${file} does not exist.`);
5495
+ throw new CliUserError28(`${file} does not exist.`);
5139
5496
  const extension = extname2(absolute).toLowerCase();
5140
5497
  let prepared;
5141
5498
  if (extension === ".json") {
@@ -5144,11 +5501,11 @@ async function runImport(env, file, options) {
5144
5501
  const { project, path } = projectOf(absolute);
5145
5502
  assertProjectWorkspace(env, project);
5146
5503
  if (extension === ".ts" !== (project.config.language === "ts")) {
5147
- throw new CliUserError27(`${path} is ${extension === ".ts" ? "TypeScript" : "Python"}, but the project language is ${project.config.language}.`);
5504
+ throw new CliUserError28(`${path} is ${extension === ".ts" ? "TypeScript" : "Python"}, but the project language is ${project.config.language}.`);
5148
5505
  }
5149
5506
  prepared = extension === ".ts" ? await prepareTypeScript(env, project, path, options) : await preparePython(env, project, path, options);
5150
5507
  } else {
5151
- throw new CliUserError27(`Cannot import ${file}: expected a .json, .ts or .py file.`);
5508
+ throw new CliUserError28(`Cannot import ${file}: expected a .json, .ts or .py file.`);
5152
5509
  }
5153
5510
  const saved = await env.api.importWorkflow(prepared.input);
5154
5511
  const stored = await env.api.exportWorkflow(saved.workflowKey, saved.version);
@@ -5199,14 +5556,14 @@ import {
5199
5556
  writeFileSync as writeFileSync5
5200
5557
  } from "fs";
5201
5558
  import { dirname as dirname5, join as join9, relative as relative2, resolve as resolve5, sep as sep2 } from "path";
5202
- import { CliUserError as CliUserError28 } from "@burdenoff/cli-sdk/core";
5559
+ import { CliUserError as CliUserError29 } from "@burdenoff/cli-sdk/core";
5203
5560
  import { irHash as irHash6 } from "@fluidgrids/workflows/ir";
5204
5561
  function codeFormat(raw, projectLanguage) {
5205
5562
  if (raw === undefined)
5206
5563
  return projectLanguage === "py" ? "PYTHON" : "TYPESCRIPT";
5207
5564
  const format = Object.hasOwn(FORMATS, raw.trim().toLowerCase()) ? FORMATS[raw.trim().toLowerCase()] : undefined;
5208
5565
  if (format === undefined) {
5209
- throw new CliUserError28(`Invalid value '${raw}' for --as. Allowed: ts, py`);
5566
+ throw new CliUserError29(`Invalid value '${raw}' for --as. Allowed: ts, py`);
5210
5567
  }
5211
5568
  return format;
5212
5569
  }
@@ -5216,7 +5573,7 @@ function splitFormat2(options) {
5216
5573
  return { options, code: options.as };
5217
5574
  }
5218
5575
  if (options.as !== undefined && FORMATS[options.as.trim().toLowerCase()] !== FORMATS[format]) {
5219
- throw new CliUserError28(`--format ${format} and --as ${options.as} disagree.`);
5576
+ throw new CliUserError29(`--format ${format} and --as ${options.as} disagree.`);
5220
5577
  }
5221
5578
  const rest = { ...options };
5222
5579
  delete rest.format;
@@ -5227,7 +5584,7 @@ function workflowModule(files, format) {
5227
5584
  const modules = files.filter((file) => file.path.startsWith(`${WORKFLOWS_DIR}/`) && file.path.endsWith(extension) && !file.path.slice(WORKFLOWS_DIR.length + 1).includes("/"));
5228
5585
  const module = modules[0];
5229
5586
  if (modules.length !== 1 || module === undefined) {
5230
- throw new CliUserError28(`The draft has ${modules.length} workflow modules under ${WORKFLOWS_DIR}/; expected one.`);
5587
+ throw new CliUserError29(`The draft has ${modules.length} workflow modules under ${WORKFLOWS_DIR}/; expected one.`);
5231
5588
  }
5232
5589
  const name = module.path.slice(WORKFLOWS_DIR.length + 1, -extension.length);
5233
5590
  return { path: module.path, key: name };
@@ -5240,25 +5597,25 @@ async function waitForDraft(env, started, format, timeoutMs, pollMs) {
5240
5597
  return current;
5241
5598
  }
5242
5599
  if (Date.now() >= deadline) {
5243
- throw new CliUserError28(`Generation ${started.id} was still running after ${timeoutMs} ms.`, {
5600
+ throw new CliUserError29(`Generation ${started.id} was still running after ${timeoutMs} ms.`, {
5244
5601
  hint: "Raise --timeout; the generation keeps running on the service."
5245
5602
  });
5246
5603
  }
5247
5604
  await env.sleep(pollMs);
5248
5605
  current = await env.pd.workflowGeneration(started.id, format);
5249
5606
  if (current === null)
5250
- throw new CliUserError28(`Generation ${started.id} was not found.`);
5607
+ throw new CliUserError29(`Generation ${started.id} was not found.`);
5251
5608
  }
5252
5609
  }
5253
5610
  function draftCode(generation) {
5254
5611
  if (generation.status !== "COMPLETED") {
5255
5612
  const reasons = generation.validation?.errors ?? [];
5256
- throw new CliUserError28(`Generation ${generation.id} ended ${generation.status}${generation.message ? `: ${generation.message}` : "."}`, reasons.length > 0 ? { hint: reasons.join(`
5613
+ throw new CliUserError29(`Generation ${generation.id} ended ${generation.status}${generation.message ? `: ${generation.message}` : "."}`, reasons.length > 0 ? { hint: reasons.join(`
5257
5614
  `) } : undefined);
5258
5615
  }
5259
5616
  const code = generation.draft?.code;
5260
5617
  if (!code) {
5261
- throw new CliUserError28(`Generation ${generation.id} returned no code.`, {
5618
+ throw new CliUserError29(`Generation ${generation.id} returned no code.`, {
5262
5619
  hint: "Generate with AI as code needs the fluidgrids.code-first and fluidgrids.ai-code flags on the workspace."
5263
5620
  });
5264
5621
  }
@@ -5269,7 +5626,7 @@ function planFiles(code, out) {
5269
5626
  const planned = code.files.map((file) => {
5270
5627
  const path = safeRelativePath2(file.path, "generated file");
5271
5628
  if (file.content === null) {
5272
- throw new CliUserError28(`The service sent ${path} without its content.`);
5629
+ throw new CliUserError29(`The service sent ${path} without its content.`);
5273
5630
  }
5274
5631
  const absolute = join9(out, ...path.split("/"));
5275
5632
  if (!existsSync10(absolute))
@@ -5291,12 +5648,12 @@ function checkOutputDirectory(out) {
5291
5648
  existing = parent;
5292
5649
  }
5293
5650
  if (!statSync3(existing).isDirectory()) {
5294
- throw new CliUserError28(existing === out ? `--out ${out} is not a directory.` : `--out ${out} cannot be created: ${existing} is not a directory.`, { hint: "Pass --out <dir> naming a directory, or one that does not exist yet." });
5651
+ throw new CliUserError29(existing === out ? `--out ${out} is not a directory.` : `--out ${out} cannot be created: ${existing} is not a directory.`, { hint: "Pass --out <dir> naming a directory, or one that does not exist yet." });
5295
5652
  }
5296
5653
  try {
5297
5654
  accessSync(existing, constants.W_OK);
5298
5655
  } catch {
5299
- throw new CliUserError28(`Cannot write to ${existing}.`, {
5656
+ throw new CliUserError29(`Cannot write to ${existing}.`, {
5300
5657
  hint: "Pass --out <dir> naming a directory you can write to."
5301
5658
  });
5302
5659
  }
@@ -5330,7 +5687,7 @@ function resumeNote(generation, id) {
5330
5687
  }
5331
5688
  return `Generation ${id} is kept on the service: \`fluidgrids generate --resume ${id}\` fetches its draft again without starting a new generation.`;
5332
5689
  }
5333
- function reportResume(env, note) {
5690
+ function reportResume2(env, note) {
5334
5691
  if (isEnvelopeOutput(env.ctx.output)) {
5335
5692
  reportDiagnostics(env.ctx.output, [
5336
5693
  diagnostic({ severity: "info", code: "generate.resume", message: note })
@@ -5345,16 +5702,16 @@ async function runGenerate(env, rawPrompt, given) {
5345
5702
  const resumeId = options.resume?.trim();
5346
5703
  if (resumeId !== undefined) {
5347
5704
  if (!GENERATION_ID.test(resumeId)) {
5348
- throw new CliUserError28(`Invalid generation id '${options.resume ?? ""}' for --resume.`);
5705
+ throw new CliUserError29(`Invalid generation id '${options.resume ?? ""}' for --resume.`);
5349
5706
  }
5350
5707
  if (prompt !== "" || options.template !== undefined || options.model !== undefined) {
5351
- throw new CliUserError28("--resume fetches an earlier generation; leave out the prompt, --template and --model.");
5708
+ throw new CliUserError29("--resume fetches an earlier generation; leave out the prompt, --template and --model.");
5352
5709
  }
5353
5710
  } else {
5354
5711
  if (prompt === "")
5355
- throw new CliUserError28("The prompt is empty.");
5356
- if (prompt.length > MAX_PROMPT_CHARS) {
5357
- throw new CliUserError28(`The prompt is ${prompt.length} characters; the limit is ${MAX_PROMPT_CHARS}.`);
5712
+ throw new CliUserError29("The prompt is empty.");
5713
+ if (prompt.length > MAX_PROMPT_CHARS2) {
5714
+ throw new CliUserError29(`The prompt is ${prompt.length} characters; the limit is ${MAX_PROMPT_CHARS2}.`);
5358
5715
  }
5359
5716
  }
5360
5717
  const out = resolve5(env.cwd(), options.out ?? findProjectRoot(env.cwd()) ?? ".");
@@ -5363,11 +5720,11 @@ async function runGenerate(env, rawPrompt, given) {
5363
5720
  const project = projectRoot ? loadProject(projectRoot, projectRoot) : undefined;
5364
5721
  const format = codeFormat(requestedFormat, project?.config.language);
5365
5722
  if (options.key !== undefined && !options.import) {
5366
- throw new CliUserError28("--key names the imported workflow; it needs --import.");
5723
+ throw new CliUserError29("--key names the imported workflow; it needs --import.");
5367
5724
  }
5368
5725
  if (options.import && format === "PYTHON") {
5369
5726
  if (!project || project.config.language !== "py") {
5370
- throw new CliUserError28("--import of Python code needs --out inside a Python project.", {
5727
+ throw new CliUserError29("--import of Python code needs --out inside a Python project.", {
5371
5728
  hint: "Run `fluidgrids init --lang py` first, or generate TypeScript (--format ts)."
5372
5729
  });
5373
5730
  }
@@ -5399,7 +5756,7 @@ async function runGenerate(env, rawPrompt, given) {
5399
5756
  } catch (error) {
5400
5757
  const note = resumeNote(latest, started.id);
5401
5758
  if (note !== null)
5402
- reportResume(env, note);
5759
+ reportResume2(env, note);
5403
5760
  throw error;
5404
5761
  }
5405
5762
  const result = {
@@ -5477,7 +5834,7 @@ async function runGenerate(env, rawPrompt, given) {
5477
5834
  async function resumedGeneration(env, id, format) {
5478
5835
  const found = await env.pd.workflowGeneration(id, format);
5479
5836
  if (found === null)
5480
- throw new CliUserError28(`Generation ${id} was not found.`);
5837
+ throw new CliUserError29(`Generation ${id} was not found.`);
5481
5838
  return found;
5482
5839
  }
5483
5840
  function conflictError(conflicts, out, savedTo, id) {
@@ -5508,7 +5865,7 @@ function silentOutput(env) {
5508
5865
  }
5509
5866
  };
5510
5867
  }
5511
- var MAX_PROMPT_CHARS = 4000, DEFAULT_GENERATE_TIMEOUT_MS = 300000, DEFAULT_GENERATE_POLL_MS = 2000, DRAFTS_DIR = ".fluidgrids-drafts", GENERATION_ID, FORMATS;
5868
+ var MAX_PROMPT_CHARS2 = 4000, DEFAULT_GENERATE_TIMEOUT_MS = 300000, DEFAULT_GENERATE_POLL_MS = 2000, DRAFTS_DIR = ".fluidgrids-drafts", GENERATION_ID, FORMATS;
5512
5869
  var init_generate = __esm(() => {
5513
5870
  init_import();
5514
5871
  init_project();
@@ -5525,11 +5882,11 @@ var init_generate = __esm(() => {
5525
5882
  });
5526
5883
 
5527
5884
  // src/code-first/commands/interface.ts
5528
- import { CliUserError as CliUserError29 } from "@burdenoff/cli-sdk/core";
5885
+ import { CliUserError as CliUserError30 } from "@burdenoff/cli-sdk/core";
5529
5886
  async function runInterface(env, key, options) {
5530
5887
  const value = await env.api.workflowInterface(key, options.wfVersion);
5531
5888
  if (value === null || value === undefined) {
5532
- throw new CliUserError29(`${key}${options.wfVersion ? ` ${options.wfVersion}` : ""} has no interface.`);
5889
+ throw new CliUserError30(`${key}${options.wfVersion ? ` ${options.wfVersion}` : ""} has no interface.`);
5533
5890
  }
5534
5891
  const format = env.ctx.output.getFormat(options);
5535
5892
  if (format === "yaml")
@@ -5543,28 +5900,28 @@ var init_interface = () => {};
5543
5900
  // src/code-first/parity.ts
5544
5901
  import { readFileSync as readFileSync9 } from "fs";
5545
5902
  import { resolve as resolve6 } from "path";
5546
- import { CliUserError as CliUserError30 } from "@burdenoff/cli-sdk/core";
5903
+ import { CliUserError as CliUserError31 } from "@burdenoff/cli-sdk/core";
5547
5904
  import { durationMs } from "@fluidgrids/workflows/ir";
5548
5905
  function runRefOf(runId, options) {
5549
5906
  const targeted = options.workflowId !== undefined || options.key !== undefined || options.firstRunId !== undefined;
5550
5907
  if (!targeted) {
5551
5908
  if (runId === undefined || runId.trim() === "") {
5552
- throw new CliUserError30("Give a run id, or --workflow-id with --key.");
5909
+ throw new CliUserError31("Give a run id, or --workflow-id with --key.");
5553
5910
  }
5554
5911
  return { runId };
5555
5912
  }
5556
5913
  if (runId !== undefined) {
5557
- throw new CliUserError30("Give a run id or --workflow-id with --key, not both.");
5914
+ throw new CliUserError31("Give a run id or --workflow-id with --key, not both.");
5558
5915
  }
5559
5916
  const workflowId = options.workflowId?.trim() ?? "";
5560
5917
  const key = options.key?.trim() ?? "";
5561
5918
  if (workflowId === "" || key === "") {
5562
- throw new CliUserError30("--workflow-id and --key go together (the workflow id of that key).");
5919
+ throw new CliUserError31("--workflow-id and --key go together (the workflow id of that key).");
5563
5920
  }
5564
5921
  const target = { workflowKey: key, workflowId };
5565
5922
  if (options.firstRunId !== undefined) {
5566
5923
  if (options.firstRunId.trim() === "")
5567
- throw new CliUserError30("--first-run-id cannot be empty.");
5924
+ throw new CliUserError31("--first-run-id cannot be empty.");
5568
5925
  target.firstRunId = options.firstRunId;
5569
5926
  }
5570
5927
  return { target };
@@ -5575,7 +5932,7 @@ function describeTarget(target) {
5575
5932
  async function resolveTarget(env, target) {
5576
5933
  const run = await env.api.runByWorkflowId(target);
5577
5934
  if (!run)
5578
- throw new CliUserError30(`No run with ${describeTarget(target)} (NOT_FOUND)`);
5935
+ throw new CliUserError31(`No run with ${describeTarget(target)} (NOT_FOUND)`);
5579
5936
  return run;
5580
5937
  }
5581
5938
  async function resolveRunId(env, ref) {
@@ -5588,7 +5945,7 @@ function parseEnum(raw, flag, allowed) {
5588
5945
  const match = allowed.find((value) => value === normal);
5589
5946
  if (match === undefined) {
5590
5947
  const shown = allowed.map((value) => value.toLowerCase().replace(/_/g, "-"));
5591
- throw new CliUserError30(`Invalid value '${raw}' for ${flag}. Allowed: ${shown.join(", ")}`);
5948
+ throw new CliUserError31(`Invalid value '${raw}' for ${flag}. Allowed: ${shown.join(", ")}`);
5592
5949
  }
5593
5950
  return match;
5594
5951
  }
@@ -5612,9 +5969,9 @@ function parseGroupBy(raw) {
5612
5969
  }
5613
5970
  const distinct = [...new Set(columns)];
5614
5971
  if (distinct.length === 0)
5615
- throw new CliUserError30("--group-by needs a column.");
5972
+ throw new CliUserError31("--group-by needs a column.");
5616
5973
  if (distinct.length > 2)
5617
- throw new CliUserError30("--group-by takes at most two columns.");
5974
+ throw new CliUserError31("--group-by takes at most two columns.");
5618
5975
  return distinct;
5619
5976
  }
5620
5977
  function parseGroupByAttributes(raw, columns) {
@@ -5622,9 +5979,9 @@ function parseGroupByAttributes(raw, columns) {
5622
5979
  return [];
5623
5980
  const names = [...new Set(raw.split(",").map((part) => part.trim()))].filter((name) => name !== "");
5624
5981
  if (names.length === 0)
5625
- throw new CliUserError30("--group-by-attribute needs a search attribute name.");
5982
+ throw new CliUserError31("--group-by-attribute needs a search attribute name.");
5626
5983
  if (names.length + columns > 2) {
5627
- throw new CliUserError30("--group-by and --group-by-attribute take at most two columns together.");
5984
+ throw new CliUserError31("--group-by and --group-by-attribute take at most two columns together.");
5628
5985
  }
5629
5986
  return names;
5630
5987
  }
@@ -5636,7 +5993,7 @@ function parseDuration(raw, flag) {
5636
5993
  return value;
5637
5994
  const ms = value === "" ? undefined : durationMs(value, "ms");
5638
5995
  if (ms === undefined || !Number.isFinite(ms)) {
5639
- throw new CliUserError30(`Invalid value '${raw}' for ${flag}: expected milliseconds or a duration such as 1.5s, 5m, 2h, 2w or PT2H.`);
5996
+ throw new CliUserError31(`Invalid value '${raw}' for ${flag}: expected milliseconds or a duration such as 1.5s, 5m, 2h, 2w or PT2H.`);
5640
5997
  }
5641
5998
  return value;
5642
5999
  }
@@ -5644,17 +6001,17 @@ function parsePriority(raw) {
5644
6001
  if (raw === undefined)
5645
6002
  return;
5646
6003
  if (!/^[1-5]$/.test(raw.trim())) {
5647
- throw new CliUserError30(`Invalid value '${raw}' for --priority: expected 1 (highest) to 5.`);
6004
+ throw new CliUserError31(`Invalid value '${raw}' for --priority: expected 1 (highest) to 5.`);
5648
6005
  }
5649
6006
  return Number(raw.trim());
5650
6007
  }
5651
6008
  function addHeader(headers, name, value) {
5652
6009
  if (RESERVED_HEADER.test(name)) {
5653
- throw new CliUserError30(`--callback-header cannot set ${name}.`);
6010
+ throw new CliUserError31(`--callback-header cannot set ${name}.`);
5654
6011
  }
5655
6012
  const lower = name.toLowerCase();
5656
6013
  if (Object.keys(headers).some((existing) => existing.toLowerCase() === lower)) {
5657
- throw new CliUserError30(`--callback-header ${name} is given twice.`);
6014
+ throw new CliUserError31(`--callback-header ${name} is given twice.`);
5658
6015
  }
5659
6016
  Object.defineProperty(headers, name, {
5660
6017
  value,
@@ -5672,7 +6029,7 @@ function parseHeaders(raw, fromEnv) {
5672
6029
  const at = entry.indexOf(":");
5673
6030
  const name = (at < 0 ? "" : entry.slice(0, at)).trim();
5674
6031
  if (!HEADER_NAME.test(name)) {
5675
- throw new CliUserError30(`Invalid --callback-header #${index + 1}: expected 'Name: value' with a header name before the colon (the argument is not printed).`);
6032
+ throw new CliUserError31(`Invalid --callback-header #${index + 1}: expected 'Name: value' with a header name before the colon (the argument is not printed).`);
5676
6033
  }
5677
6034
  addHeader(headers, name, entry.slice(at + 1).trim());
5678
6035
  });
@@ -5681,11 +6038,11 @@ function parseHeaders(raw, fromEnv) {
5681
6038
  const name = (at < 0 ? "" : entry.slice(0, at)).trim();
5682
6039
  const variable = at < 0 ? "" : entry.slice(at + 1).trim();
5683
6040
  if (!HEADER_NAME.test(name) || !ENV_NAME.test(variable)) {
5684
- throw new CliUserError30(`Invalid --callback-header-env #${index + 1}: expected 'Name=ENV_VAR' (the argument is not printed).`);
6041
+ throw new CliUserError31(`Invalid --callback-header-env #${index + 1}: expected 'Name=ENV_VAR' (the argument is not printed).`);
5685
6042
  }
5686
6043
  const value = fromEnv?.env.getEnv(variable);
5687
6044
  if (value === undefined || value.trim() === "") {
5688
- throw new CliUserError30(`The environment variable ${variable} (--callback-header-env ${name}) is empty or unset.`);
6045
+ throw new CliUserError31(`The environment variable ${variable} (--callback-header-env ${name}) is empty or unset.`);
5689
6046
  }
5690
6047
  addHeader(headers, name, value.trim());
5691
6048
  });
@@ -5695,14 +6052,14 @@ function readSecretEnv(env, name) {
5695
6052
  if (name === undefined)
5696
6053
  return;
5697
6054
  if (!ENV_NAME.test(name)) {
5698
- throw new CliUserError30(`Invalid environment variable name for --callback-secret-env.`);
6055
+ throw new CliUserError31(`Invalid environment variable name for --callback-secret-env.`);
5699
6056
  }
5700
6057
  const value = env.getEnv(name);
5701
6058
  if (value === undefined || value.trim() === "") {
5702
- throw new CliUserError30(`The environment variable ${name} (--callback-secret-env) is empty or unset.`);
6059
+ throw new CliUserError31(`The environment variable ${name} (--callback-secret-env) is empty or unset.`);
5703
6060
  }
5704
6061
  if (value.length < 16 || value.length > 512) {
5705
- throw new CliUserError30(`The signing secret in ${name} must be 16 to 512 characters long (it has ${value.length}).`);
6062
+ throw new CliUserError31(`The signing secret in ${name} must be 16 to 512 characters long (it has ${value.length}).`);
5706
6063
  }
5707
6064
  return value;
5708
6065
  }
@@ -5711,7 +6068,7 @@ function parseJsonObject2(raw, flag) {
5711
6068
  if (value === undefined)
5712
6069
  return;
5713
6070
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
5714
- throw new CliUserError30(`${flag} must be a JSON object.`);
6071
+ throw new CliUserError31(`${flag} must be a JSON object.`);
5715
6072
  }
5716
6073
  return value;
5717
6074
  }
@@ -5719,7 +6076,7 @@ function parityStartFields(env, options) {
5719
6076
  const fields = {};
5720
6077
  if (options.workflowId !== undefined) {
5721
6078
  if (options.workflowId.trim() === "")
5722
- throw new CliUserError30("--workflow-id cannot be empty.");
6079
+ throw new CliUserError31("--workflow-id cannot be empty.");
5723
6080
  fields.workflowId = options.workflowId;
5724
6081
  }
5725
6082
  const reuse = parseIdReuse(options.idReuse);
@@ -5729,7 +6086,7 @@ function parityStartFields(env, options) {
5729
6086
  if (conflict)
5730
6087
  fields.idConflictPolicy = conflict;
5731
6088
  if (conflict === "TERMINATE_EXISTING" && fields.workflowId === undefined) {
5732
- throw new CliUserError30("--id-conflict terminate-existing needs --workflow-id.");
6089
+ throw new CliUserError31("--id-conflict terminate-existing needs --workflow-id.");
5733
6090
  }
5734
6091
  const delay = parseDuration(options.delay, "--delay");
5735
6092
  if (delay)
@@ -5750,7 +6107,7 @@ function parityStartFields(env, options) {
5750
6107
  try {
5751
6108
  fields.details = readFileSync9(path, "utf8");
5752
6109
  } catch (error) {
5753
- throw new CliUserError30(`Cannot read --details-file ${options.detailsFile}: ${describeError(error)}`);
6110
+ throw new CliUserError31(`Cannot read --details-file ${options.detailsFile}: ${describeError(error)}`);
5754
6111
  }
5755
6112
  }
5756
6113
  const memo = parseJsonObject2(options.memo, "--memo");
@@ -5763,17 +6120,17 @@ function parityStartFields(env, options) {
5763
6120
  const secret = readSecretEnv(env, options.callbackSecretEnv);
5764
6121
  if (options.callback === undefined) {
5765
6122
  if (headers || secret !== undefined) {
5766
- throw new CliUserError30("--callback-header, --callback-header-env and --callback-secret-env need --callback <url>.");
6123
+ throw new CliUserError31("--callback-header, --callback-header-env and --callback-secret-env need --callback <url>.");
5767
6124
  }
5768
6125
  } else {
5769
6126
  let url;
5770
6127
  try {
5771
6128
  url = new URL(options.callback);
5772
6129
  } catch {
5773
- throw new CliUserError30(`--callback must be an http(s) URL.`);
6130
+ throw new CliUserError31(`--callback must be an http(s) URL.`);
5774
6131
  }
5775
6132
  if (url.protocol !== "https:" && url.protocol !== "http:") {
5776
- throw new CliUserError30(`--callback must be an http(s) URL.`);
6133
+ throw new CliUserError31(`--callback must be an http(s) URL.`);
5777
6134
  }
5778
6135
  fields.completionCallbackUrl = options.callback;
5779
6136
  if (headers)
@@ -5818,7 +6175,7 @@ var init_parity = __esm(() => {
5818
6175
  import { writeFileSync as writeFileSync6 } from "fs";
5819
6176
  import { resolve as resolve7 } from "path";
5820
6177
  import { createInterface as createInterface2 } from "readline/promises";
5821
- import { CliUserError as CliUserError31 } from "@burdenoff/cli-sdk/core";
6178
+ import { CliUserError as CliUserError32 } from "@burdenoff/cli-sdk/core";
5822
6179
  import { serializeHistoryFile as serializeHistoryFile2 } from "@fluidgrids/workflows/history";
5823
6180
  function parityRows(run) {
5824
6181
  const rows = [
@@ -5890,7 +6247,7 @@ async function waitForRun(env, runId, options) {
5890
6247
  let run = await env.api.describeRun(runId);
5891
6248
  while (!TERMINAL_STATUSES.includes(run.status)) {
5892
6249
  if (Date.now() > deadline) {
5893
- throw new CliUserError31(`Timed out waiting for run ${runId} (last status ${run.status}).`);
6250
+ throw new CliUserError32(`Timed out waiting for run ${runId} (last status ${run.status}).`);
5894
6251
  }
5895
6252
  await env.sleep(interval);
5896
6253
  run = await env.api.describeRun(runId);
@@ -5919,21 +6276,21 @@ function phaseCStartFields(options) {
5919
6276
  if (options.taskQueue !== undefined) {
5920
6277
  const queue = options.taskQueue.trim();
5921
6278
  if (!/^[a-z0-9][a-z0-9-]{0,62}$/.test(queue)) {
5922
- throw new CliUserError31(`Invalid --task-queue '${options.taskQueue}': lower-case letters, digits and dashes (at most 63).`);
6279
+ throw new CliUserError32(`Invalid --task-queue '${options.taskQueue}': lower-case letters, digits and dashes (at most 63).`);
5923
6280
  }
5924
6281
  fields.taskQueue = queue;
5925
6282
  }
5926
6283
  if (options.fairnessKey !== undefined) {
5927
6284
  const key = options.fairnessKey.trim();
5928
6285
  if (key === "" || key.length > 255) {
5929
- throw new CliUserError31("--fairness-key is 1 to 255 characters.");
6286
+ throw new CliUserError32("--fairness-key is 1 to 255 characters.");
5930
6287
  }
5931
6288
  fields.fairnessKey = key;
5932
6289
  }
5933
6290
  if (options.fairnessWeight !== undefined) {
5934
6291
  const weight = Number(options.fairnessWeight.trim());
5935
6292
  if (options.fairnessWeight.trim() === "" || !Number.isFinite(weight) || weight < 0.1 || weight > 10) {
5936
- throw new CliUserError31(`Invalid value '${options.fairnessWeight}' for --fairness-weight: 0.1 to 10.`);
6293
+ throw new CliUserError32(`Invalid value '${options.fairnessWeight}' for --fairness-weight: 0.1 to 10.`);
5937
6294
  }
5938
6295
  fields.fairnessWeight = weight;
5939
6296
  }
@@ -5946,7 +6303,7 @@ function parseStartSignal(raw) {
5946
6303
  const at = raw.indexOf("=");
5947
6304
  const name = (at < 0 ? raw : raw.slice(0, at)).trim();
5948
6305
  if (name === "")
5949
- throw new CliUserError31(`Invalid --signal '${raw}': expected name or name=<json>.`);
6306
+ throw new CliUserError32(`Invalid --signal '${raw}': expected name or name=<json>.`);
5950
6307
  if (at < 0)
5951
6308
  return { name };
5952
6309
  return { name, payload: parseJsonOption(raw.slice(at + 1), `--signal ${name}`) };
@@ -5958,12 +6315,12 @@ async function runStart(env, workflowKey, options) {
5958
6315
  if (parity.idConflictPolicy === "TERMINATE_EXISTING" && !options.force) {
5959
6316
  const question = `Terminate the open run of workflow id ${parity.workflowId ?? ""} of ${workflowKey} (if any) and start a new one?`;
5960
6317
  if (!env.interactive()) {
5961
- throw new CliUserError31("--id-conflict terminate-existing needs confirmation.", {
6318
+ throw new CliUserError32("--id-conflict terminate-existing needs confirmation.", {
5962
6319
  hint: "Pass --force to terminate the open run without a prompt."
5963
6320
  });
5964
6321
  }
5965
6322
  if (!await confirm(question))
5966
- throw new CliUserError31("Aborted: nothing was changed.");
6323
+ throw new CliUserError32("Aborted: nothing was changed.");
5967
6324
  }
5968
6325
  const started = await env.api.startWorkflow({
5969
6326
  workflowKey,
@@ -5990,7 +6347,7 @@ async function runStart(env, workflowKey, options) {
5990
6347
  details.push(`Failure: ${JSON.stringify(result.outcome.failure)}`);
5991
6348
  emit(env, options, result, { headers: ["Field", "Value"], rows: runRows(result.run) }, details);
5992
6349
  if (options.wait && result.run.status !== "COMPLETED") {
5993
- throw new CliUserError31(`Run ${result.run.id} ended ${result.run.status}.`);
6350
+ throw new CliUserError32(`Run ${result.run.id} ended ${result.run.status}.`);
5994
6351
  }
5995
6352
  return result;
5996
6353
  }
@@ -6078,18 +6435,18 @@ async function runSignal(env, first, second, options) {
6078
6435
  let name;
6079
6436
  if (isTargeted(options)) {
6080
6437
  if (second !== undefined) {
6081
- throw new CliUserError31("With --workflow-id and --key, give only the signal name.");
6438
+ throw new CliUserError32("With --workflow-id and --key, give only the signal name.");
6082
6439
  }
6083
6440
  ref = runRefOf(undefined, options);
6084
6441
  name = first;
6085
6442
  } else {
6086
6443
  if (second === undefined)
6087
- throw new CliUserError31("Give the run id and the signal name.");
6444
+ throw new CliUserError32("Give the run id and the signal name.");
6088
6445
  ref = runRefOf(first, options);
6089
6446
  name = second;
6090
6447
  }
6091
6448
  if (name.trim() === "")
6092
- throw new CliUserError31("The signal name cannot be empty.");
6449
+ throw new CliUserError32("The signal name cannot be empty.");
6093
6450
  const payload = parseJsonOption(options.payload, "--payload");
6094
6451
  const runId = "runId" in ref ? ref.runId : describeTarget(ref.target);
6095
6452
  const result = "target" in ref ? await env.api.signalRunByTarget(ref.target, name, payload, options.idempotencyKey) : await env.api.signalRun({
@@ -6104,7 +6461,7 @@ async function runSignal(env, first, second, options) {
6104
6461
  rows: [[runId, name, how]]
6105
6462
  });
6106
6463
  if (!result.accepted)
6107
- throw new CliUserError31(`Run ${runId} did not accept signal ${name}.`);
6464
+ throw new CliUserError32(`Run ${runId} did not accept signal ${name}.`);
6108
6465
  return result;
6109
6466
  }
6110
6467
  async function confirm(question) {
@@ -6121,12 +6478,12 @@ async function runTerminate(env, runIdArg, options) {
6121
6478
  const runId = "runId" in ref ? ref.runId : `the latest run of ${describeTarget(ref.target)}`;
6122
6479
  if (!options.force) {
6123
6480
  if (!env.interactive()) {
6124
- throw new CliUserError31(`Terminating run ${runId} needs confirmation.`, {
6481
+ throw new CliUserError32(`Terminating run ${runId} needs confirmation.`, {
6125
6482
  hint: "Pass --force to terminate without a prompt."
6126
6483
  });
6127
6484
  }
6128
6485
  if (!await confirm(`Terminate run ${runId}? No code or node runs after this.`)) {
6129
- throw new CliUserError31("Aborted: nothing was changed.");
6486
+ throw new CliUserError32("Aborted: nothing was changed.");
6130
6487
  }
6131
6488
  }
6132
6489
  const run = "target" in ref ? await env.api.terminateRunByTarget(ref.target, options.reason) : await env.api.terminateRun(ref.runId, options.reason);
@@ -6183,7 +6540,7 @@ async function runResult(env, runIdArg, options) {
6183
6540
  let run = await read(runId);
6184
6541
  while (!TERMINAL_STATUSES.includes(run.status)) {
6185
6542
  if (Date.now() > deadline) {
6186
- throw new CliUserError31(`Timed out waiting for run ${runId} (last status ${run.status}).`);
6543
+ throw new CliUserError32(`Timed out waiting for run ${runId} (last status ${run.status}).`);
6187
6544
  }
6188
6545
  await env.sleep(interval);
6189
6546
  run = await read(runId);
@@ -6191,7 +6548,7 @@ async function runResult(env, runIdArg, options) {
6191
6548
  const next = run.continuedToRunId;
6192
6549
  if (followRuns && next) {
6193
6550
  if (chain.includes(next)) {
6194
- throw new CliUserError31(`Run ${runId} continues into a run seen before (${next}).`);
6551
+ throw new CliUserError32(`Run ${runId} continues into a run seen before (${next}).`);
6195
6552
  }
6196
6553
  runId = next;
6197
6554
  continue;
@@ -6209,7 +6566,7 @@ async function runResult(env, runIdArg, options) {
6209
6566
  details.push(`Followed ${chain.join(" -> ")}.`);
6210
6567
  emit(env, options, result, { headers: ["Run", "Status"], rows: [[run.id, run.status]] }, details);
6211
6568
  if (run.status !== "COMPLETED")
6212
- throw new CliUserError31(`Run ${run.id} ended ${run.status}.`);
6569
+ throw new CliUserError32(`Run ${run.id} ended ${run.status}.`);
6213
6570
  return result;
6214
6571
  }
6215
6572
  }
@@ -6251,20 +6608,20 @@ function canvasStartFields(options) {
6251
6608
  const fields = {};
6252
6609
  if (options.workflowId !== undefined) {
6253
6610
  if (options.workflowId.trim() === "")
6254
- throw new CliUserError31("--workflow-id cannot be empty.");
6611
+ throw new CliUserError32("--workflow-id cannot be empty.");
6255
6612
  fields.workflowId = options.workflowId;
6256
6613
  }
6257
6614
  const conflict = parseIdConflict(options.idConflict);
6258
6615
  if (conflict) {
6259
6616
  if (conflict !== "FAIL" && fields.workflowId === undefined) {
6260
- throw new CliUserError31(`--id-conflict ${options.idConflict ?? ""} needs --workflow-id.`);
6617
+ throw new CliUserError32(`--id-conflict ${options.idConflict ?? ""} needs --workflow-id.`);
6261
6618
  }
6262
6619
  fields.idConflictPolicy = conflict;
6263
6620
  }
6264
6621
  const delay = parseDuration(options.delay, "--delay");
6265
6622
  if (delay) {
6266
6623
  if (options.test) {
6267
- throw new CliUserError31("--delay applies to PRODUCTION runs only; drop --test or --delay.");
6624
+ throw new CliUserError32("--delay applies to PRODUCTION runs only; drop --test or --delay.");
6268
6625
  }
6269
6626
  fields.startDelay = delay;
6270
6627
  }
@@ -6282,10 +6639,10 @@ function triggerNodeIds(definition) {
6282
6639
  async function runRun(env, workflowKey, options) {
6283
6640
  const versions = sortVersions(await env.api.workflowVersions(workflowKey));
6284
6641
  if (versions.length === 0)
6285
- throw new CliUserError31(`Workflow ${workflowKey} not found (NOT_FOUND)`);
6642
+ throw new CliUserError32(`Workflow ${workflowKey} not found (NOT_FOUND)`);
6286
6643
  const target = options.wfVersion ? pickVersion(versions, options.wfVersion) : pickVersion(versions, "active") ?? pickVersion(versions, "latest");
6287
6644
  if (!target) {
6288
- throw new CliUserError31(`${workflowKey} has no version "${options.wfVersion ?? ""}".`, {
6645
+ throw new CliUserError32(`${workflowKey} has no version "${options.wfVersion ?? ""}".`, {
6289
6646
  hint: `Stored versions: ${versions.map((version) => version.version).join(", ")}`
6290
6647
  });
6291
6648
  }
@@ -6294,24 +6651,24 @@ async function runRun(env, workflowKey, options) {
6294
6651
  const exported = await env.api.exportWorkflow(workflowKey, target.version);
6295
6652
  const triggers = triggerNodeIds(exported.definitionJson);
6296
6653
  if (triggers.length !== 1) {
6297
- throw new CliUserError31(triggers.length === 0 ? `${workflowKey} ${target.version} has no trigger node.` : `${workflowKey} ${target.version} has ${triggers.length} trigger nodes; pick one with --trigger-node.`, triggers.length > 0 ? { hint: `Trigger nodes: ${triggers.join(", ")}` } : undefined);
6654
+ throw new CliUserError32(triggers.length === 0 ? `${workflowKey} ${target.version} has no trigger node.` : `${workflowKey} ${target.version} has ${triggers.length} trigger nodes; pick one with --trigger-node.`, triggers.length > 0 ? { hint: `Trigger nodes: ${triggers.join(", ")}` } : undefined);
6298
6655
  }
6299
6656
  triggerNodeId = triggers[0] ?? "";
6300
6657
  }
6301
6658
  const input = parseJsonOption(options.input, "--input");
6302
6659
  if (input !== undefined && !isRecord16(input)) {
6303
- throw new CliUserError31("--input must be a JSON object for a trigger.");
6660
+ throw new CliUserError32("--input must be a JSON object for a trigger.");
6304
6661
  }
6305
6662
  const startFields = canvasStartFields(options);
6306
6663
  if (startFields.idConflictPolicy === "TERMINATE_EXISTING" && !options.force) {
6307
6664
  const question = `Terminate the open run of workflow id ${startFields.workflowId ?? ""} of ${workflowKey} (if any) and start a new one?`;
6308
6665
  if (!env.interactive()) {
6309
- throw new CliUserError31("--id-conflict terminate-existing needs confirmation.", {
6666
+ throw new CliUserError32("--id-conflict terminate-existing needs confirmation.", {
6310
6667
  hint: "Pass --force to terminate the open run without a prompt."
6311
6668
  });
6312
6669
  }
6313
6670
  if (!await confirm(question))
6314
- throw new CliUserError31("Aborted: nothing was changed.");
6671
+ throw new CliUserError32("Aborted: nothing was changed.");
6315
6672
  }
6316
6673
  const trigger = await env.api.triggerWorkflow({
6317
6674
  workflowKey,
@@ -6332,7 +6689,7 @@ async function runRun(env, workflowKey, options) {
6332
6689
  rows: [[trigger.runId, workflowKey, target.version, triggerNodeId, status]]
6333
6690
  });
6334
6691
  if (options.wait && status !== "COMPLETED") {
6335
- throw new CliUserError31(`Run ${trigger.runId} ended ${status}.`);
6692
+ throw new CliUserError32(`Run ${trigger.runId} ended ${status}.`);
6336
6693
  }
6337
6694
  return result;
6338
6695
  }
@@ -6371,7 +6728,7 @@ var init_runs = __esm(() => {
6371
6728
  import { existsSync as existsSync11, readFileSync as readFileSync10 } from "fs";
6372
6729
  import { dirname as dirname6, join as join10 } from "path";
6373
6730
  import { gunzipSync } from "zlib";
6374
- import { CliUserError as CliUserError32 } from "@burdenoff/cli-sdk/core";
6731
+ import { CliUserError as CliUserError33 } from "@burdenoff/cli-sdk/core";
6375
6732
  import {
6376
6733
  createHistoryFile as createHistoryFile2,
6377
6734
  HistoryFileError as HistoryFileError2,
@@ -6399,15 +6756,15 @@ function parseRunDocument(text, display) {
6399
6756
  try {
6400
6757
  value = JSON.parse(text);
6401
6758
  } catch {
6402
- throw new CliUserError32(`${display} is not JSON.`);
6759
+ throw new CliUserError33(`${display} is not JSON.`);
6403
6760
  }
6404
6761
  if (!isRecord17(value) || value["format"] !== RUN_ARCHIVE_FORMAT) {
6405
- throw new CliUserError32(`${display} is not a run archive's run.json (format ${RUN_ARCHIVE_FORMAT}).`);
6762
+ throw new CliUserError33(`${display} is not a run archive's run.json (format ${RUN_ARCHIVE_FORMAT}).`);
6406
6763
  }
6407
6764
  const runId = optionalString2(value["runId"]);
6408
6765
  const workspaceId = optionalString2(value["workspaceId"]);
6409
6766
  if (!runId || !workspaceId) {
6410
- throw new CliUserError32(`${display} does not name the run and its workspace.`);
6767
+ throw new CliUserError33(`${display} does not name the run and its workspace.`);
6411
6768
  }
6412
6769
  const doc = { runId, workspaceId };
6413
6770
  const workflowKey = optionalString2(value["workflowKey"]);
@@ -6434,19 +6791,19 @@ function archivedEvent(line, lineNumber, display) {
6434
6791
  try {
6435
6792
  value = JSON.parse(line);
6436
6793
  } catch {
6437
- throw new CliUserError32(`${where} is not JSON.`);
6794
+ throw new CliUserError33(`${where} is not JSON.`);
6438
6795
  }
6439
6796
  if (!isRecord17(value))
6440
- throw new CliUserError32(`${where} is not a history event.`);
6797
+ throw new CliUserError33(`${where} is not a history event.`);
6441
6798
  const { seq, type, taskId, payload, createdAt } = value;
6442
6799
  if (typeof seq !== "number" || typeof type !== "string" || typeof createdAt !== "string") {
6443
- throw new CliUserError32(`${where} is not a history event (it needs seq, type and createdAt).`);
6800
+ throw new CliUserError33(`${where} is not a history event (it needs seq, type and createdAt).`);
6444
6801
  }
6445
6802
  if (payload === undefined) {
6446
- throw new CliUserError32(`${display} was archived without its payloads (includePayloads: false), so it cannot be replayed.`);
6803
+ throw new CliUserError33(`${display} was archived without its payloads (includePayloads: false), so it cannot be replayed.`);
6447
6804
  }
6448
6805
  if (!isRecord17(payload))
6449
- throw new CliUserError32(`${where}: the payload is not a JSON object.`);
6806
+ throw new CliUserError33(`${where}: the payload is not a JSON object.`);
6450
6807
  return {
6451
6808
  seq,
6452
6809
  type,
@@ -6471,10 +6828,10 @@ function infoOf(doc, fallbackRunId) {
6471
6828
  }
6472
6829
  function parseArchivedHistory(text, display, doc = null) {
6473
6830
  if (doc?.executionKind !== undefined && doc.executionKind !== "DURABLE_FN") {
6474
- throw new CliUserError32(`${display} is the archive of a ${doc.executionKind} run; only durable-function runs have an event history to replay.`);
6831
+ throw new CliUserError33(`${display} is the archive of a ${doc.executionKind} run; only durable-function runs have an event history to replay.`);
6475
6832
  }
6476
6833
  if (doc?.includePayloads === false) {
6477
- throw new CliUserError32(`${display} was archived without its payloads (includePayloads: false), so it cannot be replayed.`);
6834
+ throw new CliUserError33(`${display} was archived without its payloads (includePayloads: false), so it cannot be replayed.`);
6478
6835
  }
6479
6836
  const events = [];
6480
6837
  let lineNumber = 0;
@@ -6486,14 +6843,14 @@ function parseArchivedHistory(text, display, doc = null) {
6486
6843
  events.push(archivedEvent(line, lineNumber, display));
6487
6844
  }
6488
6845
  if (events.length === 0) {
6489
- throw new CliUserError32(`${display} holds no history events.`, {
6846
+ throw new CliUserError33(`${display} holds no history events.`, {
6490
6847
  hint: "A canvas (graph) run archives no history events; its node executions are in nodes.jsonl.gz."
6491
6848
  });
6492
6849
  }
6493
6850
  const started = events[0];
6494
6851
  const workflowFn = started?.type === "WORKFLOW_STARTED" && typeof started.payload["workflowFn"] === "string" ? started.payload["workflowFn"] : undefined;
6495
6852
  if (!workflowFn) {
6496
- throw new CliUserError32(`${display} does not start with a WORKFLOW_STARTED event naming its function.`);
6853
+ throw new CliUserError33(`${display} does not start with a WORKFLOW_STARTED event naming its function.`);
6497
6854
  }
6498
6855
  const file = createHistoryFile2(workflowFn, events, {
6499
6856
  name: doc?.runId ?? display,
@@ -6503,7 +6860,7 @@ function parseArchivedHistory(text, display, doc = null) {
6503
6860
  return parseHistoryFile2(file);
6504
6861
  } catch (error) {
6505
6862
  if (error instanceof HistoryFileError2) {
6506
- throw new CliUserError32(`${display} is not a valid run history: ${error.message}`, {
6863
+ throw new CliUserError33(`${display} is not a valid run history: ${error.message}`, {
6507
6864
  ...error.issues.length > 0 ? { hint: error.issues.join(`
6508
6865
  `) } : {}
6509
6866
  });
@@ -6517,9 +6874,9 @@ function gunzip(bytes, display) {
6517
6874
  } catch (error) {
6518
6875
  const code = isRecord17(error) ? error["code"] : undefined;
6519
6876
  if (code === "ERR_BUFFER_TOO_LARGE") {
6520
- throw new CliUserError32(`${display} decompresses to more than ${MAX_ARCHIVE_HISTORY_BYTES} bytes; it is not a run archive's history.`);
6877
+ throw new CliUserError33(`${display} decompresses to more than ${MAX_ARCHIVE_HISTORY_BYTES} bytes; it is not a run archive's history.`);
6521
6878
  }
6522
- throw new CliUserError32(`${display} is not a readable gzip file.`);
6879
+ throw new CliUserError33(`${display} is not a readable gzip file.`);
6523
6880
  }
6524
6881
  }
6525
6882
  function siblingRunDocument(path, display) {
@@ -6538,7 +6895,7 @@ function readHistoryFromDisk(path, display) {
6538
6895
  return parseArchivedHistory(text, display, siblingRunDocument(path, display));
6539
6896
  }
6540
6897
  if (path.endsWith(".gz"))
6541
- throw new CliUserError32(`${display} is not a readable gzip file.`);
6898
+ throw new CliUserError33(`${display} is not a readable gzip file.`);
6542
6899
  return parseHistoryText(text, display);
6543
6900
  }
6544
6901
  var RUN_ARCHIVE_FORMAT = "fluidgrids.run-archive", MAX_ARCHIVE_HISTORY_BYTES, GZIP_MAGIC;
@@ -6551,7 +6908,7 @@ var init_archive_file = __esm(() => {
6551
6908
  // src/code-first/commands/replay.ts
6552
6909
  import { existsSync as existsSync12, readdirSync as readdirSync2, readFileSync as readFileSync11, statSync as statSync4 } from "fs";
6553
6910
  import { join as join11, relative as relative3, resolve as resolve8, sep as sep3 } from "path";
6554
- import { CliUserError as CliUserError33 } from "@burdenoff/cli-sdk/core";
6911
+ import { CliUserError as CliUserError34 } from "@burdenoff/cli-sdk/core";
6555
6912
  function isRecord18(value) {
6556
6913
  return typeof value === "object" && value !== null && !Array.isArray(value);
6557
6914
  }
@@ -6577,7 +6934,7 @@ function durableExportNames(lowered) {
6577
6934
  }
6578
6935
  function requireBundle(lowered) {
6579
6936
  if (!lowered.bundle || !lowered.buildId || durableExportNames(lowered).length === 0) {
6580
- throw new CliUserError33("The project defines no durable functions to replay.", {
6937
+ throw new CliUserError34("The project defines no durable functions to replay.", {
6581
6938
  hint: "Durable functions are `workflow()` exports in workflows/*.ts."
6582
6939
  });
6583
6940
  }
@@ -6586,7 +6943,7 @@ function requireBundle(lowered) {
6586
6943
  async function openReplayer(project, lowered, isolate) {
6587
6944
  if (project.config.language === "py") {
6588
6945
  if (!lowered.buildId || durableExportNames(lowered).length === 0) {
6589
- throw new CliUserError33("The project defines no durable functions to replay.", {
6946
+ throw new CliUserError34("The project defines no durable functions to replay.", {
6590
6947
  hint: "Durable functions are `@workflow` functions in workflows/*.py."
6591
6948
  });
6592
6949
  }
@@ -6600,7 +6957,7 @@ async function openReplayer(project, lowered, isolate) {
6600
6957
  }
6601
6958
  function requireExport(file, exported, name) {
6602
6959
  if (!exported.includes(file.workflowFn)) {
6603
- throw new CliUserError33(`${name} runs ${file.workflowFn}, which this project does not export.`, {
6960
+ throw new CliUserError34(`${name} runs ${file.workflowFn}, which this project does not export.`, {
6604
6961
  hint: `Exported durable functions: ${exported.join(", ")}`
6605
6962
  });
6606
6963
  }
@@ -6627,7 +6984,7 @@ async function runReplay(env, target, options) {
6627
6984
  file = readHistoryFromDisk(path, target);
6628
6985
  name = target;
6629
6986
  } else if (looksLikeHistoryPath(target)) {
6630
- throw new CliUserError33(`History file not found: ${target}`);
6987
+ throw new CliUserError34(`History file not found: ${target}`);
6631
6988
  } else {
6632
6989
  file = (await fetchHistory(env, target)).file;
6633
6990
  name = target;
@@ -6637,7 +6994,7 @@ async function runReplay(env, target, options) {
6637
6994
  requireBundle(lowered);
6638
6995
  requireExport(file, durableExportNames(lowered), name);
6639
6996
  if (file.replay === false) {
6640
- throw new CliUserError33(`${name} is marked "replay": false (it uses Phase C features).`);
6997
+ throw new CliUserError34(`${name} is marked "replay": false (it uses Phase C features).`);
6641
6998
  }
6642
6999
  const { replayer, buildId } = await openReplayer(project, lowered, options.isolate);
6643
7000
  let outcome;
@@ -6667,7 +7024,7 @@ async function runReplay(env, target, options) {
6667
7024
  ]
6668
7025
  }, details);
6669
7026
  if (!outcome.ok) {
6670
- throw new CliUserError33(outcome.cause === "NON_DETERMINISM" ? `The local code does not replay ${name}: determinism violation.` : `Replaying ${name} failed (${outcome.cause ?? "INTERNAL"}).`, { hint: describeOutcome(outcome) });
7027
+ throw new CliUserError34(outcome.cause === "NON_DETERMINISM" ? `The local code does not replay ${name}: determinism violation.` : `Replaying ${name} failed (${outcome.cause ?? "INTERNAL"}).`, { hint: describeOutcome(outcome) });
6671
7028
  }
6672
7029
  return outcome;
6673
7030
  }
@@ -6695,7 +7052,7 @@ function testScript(root) {
6695
7052
  try {
6696
7053
  manifest = JSON.parse(readFileSync11(manifestPath, "utf8"));
6697
7054
  } catch {
6698
- throw new CliUserError33("package.json is not valid JSON.");
7055
+ throw new CliUserError34("package.json is not valid JSON.");
6699
7056
  }
6700
7057
  const scripts = isRecord18(manifest) ? manifest["scripts"] : undefined;
6701
7058
  if (!isRecord18(scripts) || typeof scripts["test"] !== "string")
@@ -6721,7 +7078,7 @@ async function runTest(env, options) {
6721
7078
  const exitCode = await env.exec(script.command, script.args, project.root);
6722
7079
  result.script = { command: `${script.command} ${script.args.join(" ")}`, exitCode };
6723
7080
  if (exitCode !== 0) {
6724
- throw new CliUserError33(`The project tests failed (\`${result.script.command}\` exited ${exitCode}).`);
7081
+ throw new CliUserError34(`The project tests failed (\`${result.script.command}\` exited ${exitCode}).`);
6725
7082
  }
6726
7083
  } else {
6727
7084
  details.push(project.config.language === "py" ? "No tests/ directory; skipped." : 'No "test" script in package.json; skipped.');
@@ -6731,11 +7088,11 @@ async function runTest(env, options) {
6731
7088
  if (options.replay !== undefined) {
6732
7089
  const dir = resolve8(env.cwd(), options.replay);
6733
7090
  if (!existsSync12(dir) || !statSync4(dir).isDirectory()) {
6734
- throw new CliUserError33(`--replay: ${options.replay} is not a directory.`);
7091
+ throw new CliUserError34(`--replay: ${options.replay} is not a directory.`);
6735
7092
  }
6736
7093
  const files = historyFiles(dir);
6737
7094
  if (files.length === 0) {
6738
- throw new CliUserError33(`--replay: no *.history.json files under ${options.replay}.`);
7095
+ throw new CliUserError34(`--replay: no *.history.json files under ${options.replay}.`);
6739
7096
  }
6740
7097
  const lowered = await lowerOffline(project);
6741
7098
  const exported = durableExportNames(lowered);
@@ -6768,7 +7125,7 @@ async function runTest(env, options) {
6768
7125
  }, details);
6769
7126
  const failed = outcomes.filter((outcome) => !outcome.ok);
6770
7127
  if (failed.length > 0) {
6771
- throw new CliUserError33(`${failed.length} of ${outcomes.length} histories failed to replay.`, {
7128
+ throw new CliUserError34(`${failed.length} of ${outcomes.length} histories failed to replay.`, {
6772
7129
  hint: failed.map(describeOutcome).join(`
6773
7130
  `)
6774
7131
  });
@@ -6796,7 +7153,7 @@ function breakAtMismatch() {
6796
7153
  import { existsSync as existsSync13, statSync as statSync5 } from "fs";
6797
7154
  import { resolve as resolve9 } from "path";
6798
7155
  import { pathToFileURL } from "url";
6799
- import { CliUserError as CliUserError34 } from "@burdenoff/cli-sdk/core";
7156
+ import { CliUserError as CliUserError35 } from "@burdenoff/cli-sdk/core";
6800
7157
  import { SDK_VERSION as SDK_VERSION4 } from "@fluidgrids/workflows";
6801
7158
  import {
6802
7159
  buildDebugScript,
@@ -6821,10 +7178,10 @@ function inspectAddress(raw) {
6821
7178
  const host = portOnly ? "127.0.0.1" : value.slice(0, at);
6822
7179
  const port = portOnly ? value : value.slice(at + 1);
6823
7180
  if (!portOnly && at <= 0 || !/^\d{1,5}$/.test(port) || Number(port) > 65535) {
6824
- throw new CliUserError34(`Invalid value '${value}' for --inspect: expected host:port or a port, such as ${DEFAULT_INSPECT_ADDRESS}.`, { hint: "Give the history or run id before --inspect, or write --inspect=<host:port>." });
7181
+ throw new CliUserError35(`Invalid value '${value}' for --inspect: expected host:port or a port, such as ${DEFAULT_INSPECT_ADDRESS}.`, { hint: "Give the history or run id before --inspect, or write --inspect=<host:port>." });
6825
7182
  }
6826
7183
  if (!LOOPBACK.has(host)) {
6827
- throw new CliUserError34(`--inspect listens on loopback only; ${host} is not.`, {
7184
+ throw new CliUserError35(`--inspect listens on loopback only; ${host} is not.`, {
6828
7185
  hint: "An inspector on another interface lets anyone who reaches it run code as you."
6829
7186
  });
6830
7187
  }
@@ -6877,24 +7234,24 @@ async function confirmRemoteCode(env, options, what) {
6877
7234
  return;
6878
7235
  const question = `Run the stored code of ${what} on this machine?`;
6879
7236
  if (isEnvelopeOutput(env.ctx.output) || !env.interactive()) {
6880
- throw new CliUserError34(`${question} This needs confirmation.`, {
7237
+ throw new CliUserError35(`${question} This needs confirmation.`, {
6881
7238
  hint: "Pass --yes to replay it without a prompt, once you trust whoever pushed that version."
6882
7239
  });
6883
7240
  }
6884
7241
  if (!await env.confirm(question)) {
6885
- throw new CliUserError34("Aborted: the stored code was not downloaded or run.");
7242
+ throw new CliUserError35("Aborted: the stored code was not downloaded or run.");
6886
7243
  }
6887
7244
  }
6888
7245
  async function reexecUnderInspector(env, options, facts) {
6889
7246
  const address = inspectAddress(options.inspect ?? true);
6890
7247
  if (!facts.node) {
6891
- throw new CliUserError34("--inspect needs the CLI to run on Node.", {
7248
+ throw new CliUserError35("--inspect needs the CLI to run on Node.", {
6892
7249
  hint: "Run it as `node <path to fluidgrids>/dist/cli.js replay … --inspect`."
6893
7250
  });
6894
7251
  }
6895
7252
  const script = facts.argv[1];
6896
7253
  if (script === undefined)
6897
- throw new CliUserError34("--inspect: the CLI script path is unknown.");
7254
+ throw new CliUserError35("--inspect: the CLI script path is unknown.");
6898
7255
  const args = childArgs(facts.argv, address);
6899
7256
  if (options.remoteCode === true) {
6900
7257
  await confirmRemoteCode(env, options, "the run");
@@ -6916,7 +7273,7 @@ async function loadHistory(env, target) {
6916
7273
  return { file: readHistoryFromDisk(path, target), name: target };
6917
7274
  }
6918
7275
  if (looksLikeHistoryPath(target))
6919
- throw new CliUserError34(`History file not found: ${target}`);
7276
+ throw new CliUserError35(`History file not found: ${target}`);
6920
7277
  return { file: (await fetchHistory(env, target)).file, name: target };
6921
7278
  }
6922
7279
  async function remoteScript(env, options, file, name) {
@@ -6924,17 +7281,17 @@ async function remoteScript(env, options, file, name) {
6924
7281
  const version = file.info?.version;
6925
7282
  const buildId = file.info?.buildId;
6926
7283
  if (!key || version === undefined || version === "" || !buildId) {
6927
- throw new CliUserError34(`${name} does not say which workflow version and build it ran (info.workflowKey, info.version, info.buildId).`, { hint: "Replay a run id, or a history file from `fluidgrids history <runId> --out`." });
7284
+ throw new CliUserError35(`${name} does not say which workflow version and build it ran (info.workflowKey, info.version, info.buildId).`, { hint: "Replay a run id, or a history file from `fluidgrids history <runId> --out`." });
6928
7285
  }
6929
7286
  const archive = await env.pd.workflowCodeArchive(key, String(version));
6930
7287
  if (archive === null) {
6931
- throw new CliUserError34(`${key} ${String(version)} has no stored source archive.`);
7288
+ throw new CliUserError35(`${key} ${String(version)} has no stored source archive.`);
6932
7289
  }
6933
7290
  if (archive.buildId !== buildId) {
6934
7291
  throw new CliDiagnosticsError(`The stored archive of ${key} ${String(version)} builds ${archive.buildId}, but the run used ${buildId}; the debugger only debugs the exact code that ran.`, "debug.buildIdMismatch", []);
6935
7292
  }
6936
7293
  if (archive.sdkVersion !== SDK_VERSION4) {
6937
- throw new CliUserError34(`The run was built with @fluidgrids/workflows ${archive.sdkVersion}; this CLI has ${SDK_VERSION4}.`, {
7294
+ throw new CliUserError35(`The run was built with @fluidgrids/workflows ${archive.sdkVersion}; this CLI has ${SDK_VERSION4}.`, {
6938
7295
  hint: `Use a CLI release that bundles @fluidgrids/workflows ${archive.sdkVersion} to rebuild the exact bundle.`
6939
7296
  });
6940
7297
  }
@@ -6944,17 +7301,17 @@ async function remoteScript(env, options, file, name) {
6944
7301
  try {
6945
7302
  response = await env.fetch(archive.url, { method: "GET" });
6946
7303
  } catch (error) {
6947
- throw new CliUserError34(`Fetching the source archive failed: ${describeError(error)}`);
7304
+ throw new CliUserError35(`Fetching the source archive failed: ${describeError(error)}`);
6948
7305
  }
6949
7306
  if (!response.ok) {
6950
- throw new CliUserError34(`Fetching the source archive failed with HTTP ${response.status}.`);
7307
+ throw new CliUserError35(`Fetching the source archive failed with HTTP ${response.status}.`);
6951
7308
  }
6952
- const bytes = await readCapped(response, MAX_SOURCE_ARCHIVE_BYTES, () => new CliUserError34(`The source archive is larger than ${MAX_SOURCE_ARCHIVE_BYTES} bytes; refusing to read it.`));
7309
+ const bytes = await readCapped(response, MAX_SOURCE_ARCHIVE_BYTES, () => new CliUserError35(`The source archive is larger than ${MAX_SOURCE_ARCHIVE_BYTES} bytes; refusing to read it.`));
6953
7310
  let sources;
6954
7311
  try {
6955
7312
  sources = unpackSources(bytes, { maxBytes: MAX_SOURCE_ARCHIVE_BYTES });
6956
7313
  } catch (error) {
6957
- throw new CliUserError34(`The source archive could not be read: ${describeError(error)}`);
7314
+ throw new CliUserError35(`The source archive could not be read: ${describeError(error)}`);
6958
7315
  }
6959
7316
  try {
6960
7317
  return await buildDebugScript(new Map(Object.entries(sources.files)), {
@@ -6966,13 +7323,13 @@ async function remoteScript(env, options, file, name) {
6966
7323
  if (error instanceof DebugBuildMismatchError) {
6967
7324
  throw new CliDiagnosticsError(error.message, error.code, []);
6968
7325
  }
6969
- throw new CliUserError34(`Rebuilding the run's code failed: ${describeError(error)}`);
7326
+ throw new CliUserError35(`Rebuilding the run's code failed: ${describeError(error)}`);
6970
7327
  }
6971
7328
  }
6972
7329
  async function localScript(env, options, file, name) {
6973
7330
  const project = loadProject(options.project, env.cwd());
6974
7331
  if (project.config.language === "py") {
6975
- throw new CliUserError34("The replay debugger needs a TypeScript project.", {
7332
+ throw new CliUserError35("The replay debugger needs a TypeScript project.", {
6976
7333
  hint: "Python projects replay with plain `fluidgrids replay` (no --trace or --break-on-mismatch)."
6977
7334
  });
6978
7335
  }
@@ -6983,12 +7340,12 @@ async function localScript(env, options, file, name) {
6983
7340
  });
6984
7341
  const exported = durableExportNames(lowered);
6985
7342
  if (!lowered.sourceFiles || exported.length === 0) {
6986
- throw new CliUserError34("The project defines no durable functions to replay.", {
7343
+ throw new CliUserError35("The project defines no durable functions to replay.", {
6987
7344
  hint: "Durable functions are `workflow()` exports in workflows/*.ts."
6988
7345
  });
6989
7346
  }
6990
7347
  if (!exported.includes(file.workflowFn)) {
6991
- throw new CliUserError34(`${name} runs ${file.workflowFn}, which this project does not export.`, {
7348
+ throw new CliUserError35(`${name} runs ${file.workflowFn}, which this project does not export.`, {
6992
7349
  hint: `Exported durable functions: ${exported.join(", ")}`
6993
7350
  });
6994
7351
  }
@@ -6999,7 +7356,7 @@ async function localScript(env, options, file, name) {
6999
7356
  sourceRoot: `${pathToFileURL(project.root).href}/`
7000
7357
  });
7001
7358
  } catch (error) {
7002
- throw new CliUserError34(`Building the debug script failed: ${describeError(error)}`);
7359
+ throw new CliUserError35(`Building the debug script failed: ${describeError(error)}`);
7003
7360
  }
7004
7361
  }
7005
7362
  function where(location) {
@@ -7020,13 +7377,13 @@ function failureDiagnostics(result) {
7020
7377
  }
7021
7378
  async function runDebugReplay(env, target, options, facts = currentProcess()) {
7022
7379
  if (options.isolate) {
7023
- throw new CliUserError34("--isolate does not combine with --trace, --break-on-mismatch, --inspect or --remote-code.", { hint: "The replay debugger runs in a Node vm; replay without them to use the isolate." });
7380
+ throw new CliUserError35("--isolate does not combine with --trace, --break-on-mismatch, --inspect or --remote-code.", { hint: "The replay debugger runs in a Node vm; replay without them to use the isolate." });
7024
7381
  }
7025
7382
  if (options.inspect !== undefined)
7026
7383
  return reexecUnderInspector(env, options, facts);
7027
7384
  const { file, name } = await loadHistory(env, target);
7028
7385
  if (file.replay === false) {
7029
- throw new CliUserError34(`${name} is marked "replay": false (it uses Phase C features).`);
7386
+ throw new CliUserError35(`${name} is marked "replay": false (it uses Phase C features).`);
7030
7387
  }
7031
7388
  const remote = options.remoteCode === true;
7032
7389
  const script = remote ? await remoteScript(env, options, file, name) : await localScript(env, options, file, name);
@@ -7224,7 +7581,7 @@ var REPLACEMENT_CHARACTER = "�";
7224
7581
  // src/code-first/commands/suite.ts
7225
7582
  import { writeFileSync as writeFileSync7 } from "fs";
7226
7583
  import { resolve as resolve10 } from "path";
7227
- import { CliAuthError as CliAuthError5, CliUserError as CliUserError35 } from "@burdenoff/cli-sdk/core";
7584
+ import { CliAuthError as CliAuthError6, CliUserError as CliUserError36 } from "@burdenoff/cli-sdk/core";
7228
7585
  function testSuiteOptions(options) {
7229
7586
  const misplaced = [
7230
7587
  options.replay !== undefined ? "--replay" : null,
@@ -7233,7 +7590,7 @@ function testSuiteOptions(options) {
7233
7590
  options.project !== undefined ? "--project" : null
7234
7591
  ].filter((flag) => flag !== null);
7235
7592
  if (misplaced.length > 0) {
7236
- throw new CliUserError35(`${misplaced.join(", ")} ${misplaced.length === 1 ? "applies" : "apply"} to the code-first tests, not to a workflow's test suite.`, { hint: "Run `fluidgrids test` without a workflow key in a code-first project for those." });
7593
+ throw new CliUserError36(`${misplaced.join(", ")} ${misplaced.length === 1 ? "applies" : "apply"} to the code-first tests, not to a workflow's test suite.`, { hint: "Run `fluidgrids test` without a workflow key in a code-first project for those." });
7237
7594
  }
7238
7595
  return {
7239
7596
  ...options.format !== undefined ? { format: options.format } : {},
@@ -7253,7 +7610,7 @@ function codeFirstTestOptions(options) {
7253
7610
  options.pollInterval !== undefined ? "--poll-interval" : null
7254
7611
  ].filter((flag) => flag !== null);
7255
7612
  if (misplaced.length > 0) {
7256
- throw new CliUserError35(`${misplaced.join(", ")} ${misplaced.length === 1 ? "needs" : "need"} a workflow key: \`fluidgrids test <workflowKey>\`.`);
7613
+ throw new CliUserError36(`${misplaced.join(", ")} ${misplaced.length === 1 ? "needs" : "need"} a workflow key: \`fluidgrids test <workflowKey>\`.`);
7257
7614
  }
7258
7615
  return {
7259
7616
  ...options.format !== undefined ? { format: options.format } : {},
@@ -7268,7 +7625,7 @@ function caseIds(raw) {
7268
7625
  return;
7269
7626
  const ids = [...new Set(raw.map((id) => id.trim()))];
7270
7627
  if (ids.some((id) => id === ""))
7271
- throw new CliUserError35("--case needs a test case id.");
7628
+ throw new CliUserError36("--case needs a test case id.");
7272
7629
  return ids;
7273
7630
  }
7274
7631
  function finished(suite) {
@@ -7290,13 +7647,13 @@ async function waitForSuite(env, started, timeoutMs, intervalMs) {
7290
7647
  next = await env.api.workflowTestRun(suite.id);
7291
7648
  failedPolls = 0;
7292
7649
  } catch (error) {
7293
- if (error instanceof CliAuthError5 || ++failedPolls >= POLL_ATTEMPTS)
7650
+ if (error instanceof CliAuthError6 || ++failedPolls >= POLL_ATTEMPTS)
7294
7651
  throw error;
7295
7652
  env.ctx.logger.warn(`Polling suite ${suite.id} failed (${failedPolls}/${POLL_ATTEMPTS}); retrying.`);
7296
7653
  continue;
7297
7654
  }
7298
7655
  if (!next) {
7299
- throw new CliUserError35(`Suite run ${suite.id} is no longer visible (NOT_FOUND).`);
7656
+ throw new CliUserError36(`Suite run ${suite.id} is no longer visible (NOT_FOUND).`);
7300
7657
  }
7301
7658
  suite = next;
7302
7659
  if (finished(suite) !== reported) {
@@ -7331,7 +7688,7 @@ function detailLines(suite, timedOut, junit) {
7331
7688
  async function runTestSuite(env, workflowKey, options) {
7332
7689
  const key = workflowKey.trim();
7333
7690
  if (key === "")
7334
- throw new CliUserError35("The workflow key is empty.");
7691
+ throw new CliUserError36("The workflow key is empty.");
7335
7692
  const timeoutMs = parsePositiveInt(options.timeout, "--timeout") ?? DEFAULT_SUITE_TIMEOUT_MS;
7336
7693
  const intervalMs = parsePositiveInt(options.pollInterval, "--poll-interval") ?? DEFAULT_SUITE_POLL_INTERVAL_MS;
7337
7694
  const ids = caseIds(options.case);
@@ -7350,7 +7707,7 @@ async function runTestSuite(env, workflowKey, options) {
7350
7707
  try {
7351
7708
  writeFileSync7(path, suiteToJUnit(suite), "utf8");
7352
7709
  } catch (error) {
7353
- throw new CliUserError35(`Could not write the JUnit report to ${options.junit}: ${error instanceof Error ? error.message : String(error)}`);
7710
+ throw new CliUserError36(`Could not write the JUnit report to ${options.junit}: ${error instanceof Error ? error.message : String(error)}`);
7354
7711
  }
7355
7712
  result.junit = options.junit;
7356
7713
  }
@@ -7364,16 +7721,16 @@ async function runTestSuite(env, workflowKey, options) {
7364
7721
  ])
7365
7722
  }, detailLines(suite, timedOut, result.junit));
7366
7723
  if (timedOut) {
7367
- throw new CliUserError35(`Suite ${suite.id} was still ${suite.status} after ${timeoutMs} ms (${finished(suite)}/${suite.summary.total} cases finished).`, {
7724
+ throw new CliUserError36(`Suite ${suite.id} was still ${suite.status} after ${timeoutMs} ms (${finished(suite)}/${suite.summary.total} cases finished).`, {
7368
7725
  exitCode: SUITE_TIMEOUT_EXIT_CODE,
7369
7726
  hint: "It keeps running on the service. Raise --timeout to wait longer."
7370
7727
  });
7371
7728
  }
7372
7729
  if (suite.status === "FAILED") {
7373
- throw new CliUserError35(`${suite.summary.failed} of ${suite.summary.total} test cases of ${suite.workflowKey} failed.`);
7730
+ throw new CliUserError36(`${suite.summary.failed} of ${suite.summary.total} test cases of ${suite.workflowKey} failed.`);
7374
7731
  }
7375
7732
  if (suite.status === "ERROR") {
7376
- throw new CliUserError35(`${suite.summary.errored} of ${suite.summary.total} test cases of ${suite.workflowKey} could not run.`);
7733
+ throw new CliUserError36(`${suite.summary.errored} of ${suite.summary.total} test cases of ${suite.workflowKey} could not run.`);
7377
7734
  }
7378
7735
  return result;
7379
7736
  }
@@ -7386,7 +7743,7 @@ var init_suite = __esm(() => {
7386
7743
 
7387
7744
  // src/code-first/commands/versions.ts
7388
7745
  import { createInterface as createInterface3 } from "readline/promises";
7389
- import { CliUserError as CliUserError36 } from "@burdenoff/cli-sdk/core";
7746
+ import { CliUserError as CliUserError37 } from "@burdenoff/cli-sdk/core";
7390
7747
  async function runVersionsList(env, workflowKey, options) {
7391
7748
  const versions = sortVersions(await env.api.workflowVersions(workflowKey));
7392
7749
  const rows = [];
@@ -7426,7 +7783,7 @@ function checkLine(check, what) {
7426
7783
  }
7427
7784
  function parsePercent(raw) {
7428
7785
  if (raw === undefined || !/^\d{1,3}$/.test(raw.trim()) || Number(raw) > 100) {
7429
- throw new CliUserError36(`Invalid value '${raw ?? ""}' for --percent: expected 0 to 100.`);
7786
+ throw new CliUserError37(`Invalid value '${raw ?? ""}' for --percent: expected 0 to 100.`);
7430
7787
  }
7431
7788
  return Number(raw.trim());
7432
7789
  }
@@ -7438,7 +7795,7 @@ async function runRollout(env, workflowKey, options) {
7438
7795
  return rollouts;
7439
7796
  }
7440
7797
  if (options.to === undefined || options.to.trim() === "") {
7441
- throw new CliUserError36("--percent needs --to <version>.");
7798
+ throw new CliUserError37("--percent needs --to <version>.");
7442
7799
  }
7443
7800
  const input = {
7444
7801
  toVersion: options.to,
@@ -7460,14 +7817,14 @@ async function runRollout(env, workflowKey, options) {
7460
7817
  function rolloutDeleteOptions(options, parent) {
7461
7818
  for (const flag of ["to", "percent", "from"]) {
7462
7819
  if (parent[flag] !== undefined) {
7463
- throw new CliUserError36(`--${flag} does not apply to \`versions rollout delete\`.`);
7820
+ throw new CliUserError37(`--${flag} does not apply to \`versions rollout delete\`.`);
7464
7821
  }
7465
7822
  }
7466
7823
  const inherited = parent["environment"];
7467
7824
  if (typeof inherited !== "string")
7468
7825
  return options;
7469
7826
  if (options.environment !== undefined && options.environment !== inherited) {
7470
- throw new CliUserError36(`Conflicting --environment values '${inherited}' and '${options.environment}'.`);
7827
+ throw new CliUserError37(`Conflicting --environment values '${inherited}' and '${options.environment}'.`);
7471
7828
  }
7472
7829
  return { ...options, environment: inherited };
7473
7830
  }
@@ -7484,12 +7841,12 @@ async function runRolloutDelete(env, workflowKey, options) {
7484
7841
  const environment = parseChoice(options.environment?.toUpperCase(), "--environment", ENVIRONMENTS);
7485
7842
  if (!options.force) {
7486
7843
  if (!env.interactive()) {
7487
- throw new CliUserError36(`Removing the rollout of ${workflowKey} needs confirmation.`, {
7844
+ throw new CliUserError37(`Removing the rollout of ${workflowKey} needs confirmation.`, {
7488
7845
  hint: "Pass --force to remove it without a prompt."
7489
7846
  });
7490
7847
  }
7491
7848
  if (!await confirm2(`Remove the rollout of ${workflowKey}? New starts run the ACTIVE version.`)) {
7492
- throw new CliUserError36("Aborted: nothing was changed.");
7849
+ throw new CliUserError37("Aborted: nothing was changed.");
7493
7850
  }
7494
7851
  }
7495
7852
  const removed = await env.api.deleteWorkflowRollout(workflowKey, environment);
@@ -7515,12 +7872,12 @@ async function runDrainage(env, workflowKey, version, options) {
7515
7872
  async function runOverride(env, runId, options) {
7516
7873
  const chosen = [options.pin !== undefined, options.autoUpgrade === true, options.clear === true];
7517
7874
  if (chosen.filter(Boolean).length !== 1) {
7518
- throw new CliUserError36("Give exactly one of --pin <version>, --auto-upgrade or --clear.");
7875
+ throw new CliUserError37("Give exactly one of --pin <version>, --auto-upgrade or --clear.");
7519
7876
  }
7520
7877
  let override = null;
7521
7878
  if (options.pin !== undefined) {
7522
7879
  if (options.pin.trim() === "")
7523
- throw new CliUserError36("--pin needs a version.");
7880
+ throw new CliUserError37("--pin needs a version.");
7524
7881
  override = { behavior: "PINNED", version: options.pin };
7525
7882
  } else if (options.autoUpgrade) {
7526
7883
  override = { behavior: "AUTO_UPGRADE" };
@@ -7549,12 +7906,12 @@ var init_versions = __esm(() => {
7549
7906
  });
7550
7907
 
7551
7908
  // src/code-first/commands/deploy.ts
7552
- import { CliUserError as CliUserError37 } from "@burdenoff/cli-sdk/core";
7909
+ import { CliUserError as CliUserError38 } from "@burdenoff/cli-sdk/core";
7553
7910
  function parseEnvironment(raw) {
7554
7911
  const value = raw?.trim().toUpperCase();
7555
7912
  const match = ENVIRONMENTS2.find((environment) => environment === value);
7556
7913
  if (match === undefined) {
7557
- throw new CliUserError37(raw === undefined ? "deploy needs --env dev, staging or prod." : `Invalid value '${raw}' for --env. Allowed: dev, staging, prod`);
7914
+ throw new CliUserError38(raw === undefined ? "deploy needs --env dev, staging or prod." : `Invalid value '${raw}' for --env. Allowed: dev, staging, prod`);
7558
7915
  }
7559
7916
  return match;
7560
7917
  }
@@ -7563,7 +7920,7 @@ function parseRamp(raw) {
7563
7920
  return;
7564
7921
  const trimmed = raw.trim();
7565
7922
  if (!/^\d{1,3}$/.test(trimmed) || Number(trimmed) > 100) {
7566
- throw new CliUserError37(`Invalid value '${raw}' for --ramp: expected 0 to 100.`);
7923
+ throw new CliUserError38(`Invalid value '${raw}' for --ramp: expected 0 to 100.`);
7567
7924
  }
7568
7925
  return Number(trimmed);
7569
7926
  }
@@ -7613,10 +7970,10 @@ async function runDeploy(env, workflowKey, options) {
7613
7970
  const environment = parseEnvironment(options.env);
7614
7971
  const ramp = parseRamp(options.ramp);
7615
7972
  if (ramp !== undefined && environment !== "PROD") {
7616
- throw new CliUserError37("--ramp applies to --env prod only (rollouts split PROD starts).");
7973
+ throw new CliUserError38("--ramp applies to --env prod only (rollouts split PROD starts).");
7617
7974
  }
7618
7975
  if (options.note !== undefined && environment === "DEV") {
7619
- throw new CliUserError37("--note is for promotion requests (--env staging or prod).");
7976
+ throw new CliUserError38("--note is for promotion requests (--env staging or prod).");
7620
7977
  }
7621
7978
  const timeoutMs = parsePositiveInt(options.timeout, "--timeout") ?? DEFAULT_DEPLOY_TIMEOUT_MS;
7622
7979
  const intervalMs = parsePositiveInt(options.pollInterval, "--poll-interval") ?? DEFAULT_DEPLOY_POLL_INTERVAL_MS;
@@ -7634,7 +7991,7 @@ async function deployToDev(env, workflowKey, options) {
7634
7991
  const versions = await env.api.workflowVersions(workflowKey);
7635
7992
  const picked = pickVersion(versions, wanted);
7636
7993
  if (!picked) {
7637
- throw new CliUserError37(versions.length === 0 ? `${workflowKey} has no stored version.` : `${workflowKey} has no version ${wanted}.`, versions.length === 0 ? { hint: "Push one first: fluidgrids push " + workflowKey } : { hint: `Stored: ${versions.map((version) => version.version).join(", ")}` });
7994
+ throw new CliUserError38(versions.length === 0 ? `${workflowKey} has no stored version.` : `${workflowKey} has no version ${wanted}.`, versions.length === 0 ? { hint: "Push one first: fluidgrids push " + workflowKey } : { hint: `Stored: ${versions.map((version) => version.version).join(", ")}` });
7638
7995
  }
7639
7996
  const before = await env.api.workflowEnvironments(workflowKey);
7640
7997
  const base = { workflowKey, environment: "DEV", version: picked.version };
@@ -7656,15 +8013,15 @@ async function promote(env, workflowKey, target, options) {
7656
8013
  const view = await env.api.workflowEnvironments(workflowKey);
7657
8014
  const source = stateOf(view, sourceName);
7658
8015
  if (!source?.version) {
7659
- throw new CliUserError37(`Nothing is deployed to ${sourceName} for ${workflowKey}.`, {
8016
+ throw new CliUserError38(`Nothing is deployed to ${sourceName} for ${workflowKey}.`, {
7660
8017
  hint: `Deploy there first: fluidgrids deploy ${workflowKey} --env ${sourceName.toLowerCase()}${sourceName === "DEV" ? " --wf-version <version>" : ""}`
7661
8018
  });
7662
8019
  }
7663
8020
  if (!source.available) {
7664
- throw new CliUserError37(`${sourceName} holds ${source.version} of ${workflowKey}, which has since been deleted.`, { hint: `Deploy another version to ${sourceName} first.` });
8021
+ throw new CliUserError38(`${sourceName} holds ${source.version} of ${workflowKey}, which has since been deleted.`, { hint: `Deploy another version to ${sourceName} first.` });
7665
8022
  }
7666
8023
  if (options.wfVersion !== undefined && options.wfVersion !== source.version) {
7667
- throw new CliUserError37(`${sourceName} holds ${source.version} of ${workflowKey}, not ${options.wfVersion}; ${target} is promoted from ${sourceName}.`, {
8024
+ throw new CliUserError38(`${sourceName} holds ${source.version} of ${workflowKey}, not ${options.wfVersion}; ${target} is promoted from ${sourceName}.`, {
7668
8025
  hint: `Deploy ${options.wfVersion} to ${sourceName} first: fluidgrids deploy ${workflowKey} --env ${sourceName.toLowerCase()} --wf-version ${options.wfVersion}`
7669
8026
  });
7670
8027
  }
@@ -7677,7 +8034,7 @@ async function promote(env, workflowKey, target, options) {
7677
8034
  }
7678
8035
  if (options.ramp !== undefined && options.ramp < 100) {
7679
8036
  if (view.policy.lockDirectActivation) {
7680
- throw new CliUserError37(`The workspace locks PROD to approved promotions, so ${workflowKey} cannot be ramped.`, { hint: `Promote it in full instead: fluidgrids deploy ${workflowKey} --env prod` });
8037
+ throw new CliUserError38(`The workspace locks PROD to approved promotions, so ${workflowKey} cannot be ramped.`, { hint: `Promote it in full instead: fluidgrids deploy ${workflowKey} --env prod` });
7681
8038
  }
7682
8039
  const rollout = await env.api.setWorkflowRollout(workflowKey, {
7683
8040
  toVersion: version,
@@ -7695,7 +8052,7 @@ async function promote(env, workflowKey, target, options) {
7695
8052
  }
7696
8053
  const pending = view.pendingPromotions.find((request) => request.toEnvironment === target);
7697
8054
  if (pending && pending.version !== version) {
7698
- throw new CliUserError37(`A promotion of ${pending.version} to ${target} (request ${pending.id}) is already waiting for an approver.`, { hint: "An approver decides it, or its requester cancels it, before another can be made." });
8055
+ throw new CliUserError38(`A promotion of ${pending.version} to ${target} (request ${pending.id}) is already waiting for an approver.`, { hint: "An approver decides it, or its requester cancels it, before another can be made." });
7699
8056
  }
7700
8057
  if (pending && options.note !== undefined) {
7701
8058
  notice(env, options, "warning", `Request ${pending.id} for ${version} is already open; --note was not added to it.`);
@@ -7721,7 +8078,7 @@ function finish(env, options, base, promotion) {
7721
8078
  ]);
7722
8079
  case "REJECTED":
7723
8080
  case "CANCELED":
7724
- throw new CliUserError37(`The promotion of ${version} of ${workflowKey} to ${environment} was ${promotion.status === "REJECTED" ? "rejected" : "canceled"}${promotion.reviewNote ? `: ${promotion.reviewNote}` : "."}`, { hint: `Request ${promotion.id}; ${environment} is unchanged.` });
8081
+ throw new CliUserError38(`The promotion of ${version} of ${workflowKey} to ${environment} was ${promotion.status === "REJECTED" ? "rejected" : "canceled"}${promotion.reviewNote ? `: ${promotion.reviewNote}` : "."}`, { hint: `Request ${promotion.id}; ${environment} is unchanged.` });
7725
8082
  }
7726
8083
  }
7727
8084
  async function waitForPromotion(env, promotion, options) {
@@ -7730,7 +8087,7 @@ async function waitForPromotion(env, promotion, options) {
7730
8087
  let current = promotion;
7731
8088
  while (current.status === "PENDING") {
7732
8089
  if (slept >= options.timeoutMs || Date.now() >= deadline) {
7733
- throw new CliUserError37(`Promotion ${current.id} of ${current.version} to ${current.toEnvironment} still waits for an approver after ${Math.round(options.timeoutMs / 1000)} s.`, {
8090
+ throw new CliUserError38(`Promotion ${current.id} of ${current.version} to ${current.toEnvironment} still waits for an approver after ${Math.round(options.timeoutMs / 1000)} s.`, {
7734
8091
  hint: "The request stays open; run the same command again to keep waiting, or pass --no-wait."
7735
8092
  });
7736
8093
  }
@@ -7739,7 +8096,7 @@ async function waitForPromotion(env, promotion, options) {
7739
8096
  const history = await env.api.promotionRequests(current.workflowKey, PROMOTION_HISTORY_LIMIT);
7740
8097
  const found = history.find((request) => request.id === current.id);
7741
8098
  if (!found) {
7742
- throw new CliUserError37(`Promotion ${current.id} is no longer in the promotion history of ${current.workflowKey}.`);
8099
+ throw new CliUserError38(`Promotion ${current.id} is no longer in the promotion history of ${current.workflowKey}.`);
7743
8100
  }
7744
8101
  current = found;
7745
8102
  }
@@ -8275,7 +8632,7 @@ var RUN_FIELDS = `
8275
8632
  ) { fireTimes queued alreadyQueued overlapPolicy }
8276
8633
  }
8277
8634
  `, PC_PAUSE_SCHEDULE, PC_UNPAUSE_SCHEDULE;
8278
- var init_operations3 = __esm(() => {
8635
+ var init_operations4 = __esm(() => {
8279
8636
  SCHEDULE_FIELDS = `
8280
8637
  workflowKey triggerNodeId version jobs specKind spec overlapPolicy catchupWindowSeconds
8281
8638
  jitterSeconds pauseOnFailure
@@ -8605,14 +8962,14 @@ var init_operations3 = __esm(() => {
8605
8962
  });
8606
8963
 
8607
8964
  // src/phase-c/api.ts
8608
- import { CliAuthError as CliAuthError6, CliUserError as CliUserError40 } from "@burdenoff/cli-sdk/core";
8965
+ import { CliAuthError as CliAuthError7, CliUserError as CliUserError41 } from "@burdenoff/cli-sdk/core";
8609
8966
  function runVariables(run) {
8610
8967
  return run.runId !== undefined ? { runId: run.runId } : { target: run.target };
8611
8968
  }
8612
8969
  function createPhaseCApi(ctx) {
8613
8970
  async function request(document, variables, flag) {
8614
8971
  if (!ctx.auth.isAuthenticated()) {
8615
- throw new CliAuthError6("Authentication required.", {
8972
+ throw new CliAuthError7("Authentication required.", {
8616
8973
  hint: `Run \`${ctx.productName} auth login\` or set FLUIDGRIDS_TOKEN.`
8617
8974
  });
8618
8975
  }
@@ -8625,7 +8982,7 @@ function createPhaseCApi(ctx) {
8625
8982
  function context() {
8626
8983
  const workspaceId = ctx.auth.read()?.workspaceId;
8627
8984
  if (!workspaceId) {
8628
- throw new CliUserError40("No workspace is selected.", {
8985
+ throw new CliUserError41("No workspace is selected.", {
8629
8986
  hint: `Run \`${ctx.productName} workspace set <id>\` or set FLUIDGRIDS_WORKSPACE_ID.`
8630
8987
  });
8631
8988
  }
@@ -8758,7 +9115,7 @@ function createPhaseCApi(ctx) {
8758
9115
  });
8759
9116
  const found = data.workflowRunByWorkflowId;
8760
9117
  if (!found) {
8761
- throw new CliUserError40(`No run with workflow id ${run.target.workflowId} of ${run.target.workflowKey} (NOT_FOUND)`);
9118
+ throw new CliUserError41(`No run with workflow id ${run.target.workflowId} of ${run.target.workflowKey} (NOT_FOUND)`);
8762
9119
  }
8763
9120
  return found.id;
8764
9121
  },
@@ -8893,7 +9250,7 @@ function createPhaseCApi(ctx) {
8893
9250
  if (!pagination?.hasMore || jobs.length === 0)
8894
9251
  return all;
8895
9252
  }
8896
- throw new CliUserError40(`The schedule listing did not end after ${MAX_SCHEDULE_PAGES} pages; refusing to continue.`);
9253
+ throw new CliUserError41(`The schedule listing did not end after ${MAX_SCHEDULE_PAGES} pages; refusing to continue.`);
8897
9254
  },
8898
9255
  async describeSchedule(workflowKey, triggerNodeId) {
8899
9256
  const data = await request(PC_SCHEDULE_DESCRIBE, { workflowKey, triggerNodeId }, P);
@@ -8919,25 +9276,25 @@ function createPhaseCApi(ctx) {
8919
9276
  return api;
8920
9277
  }
8921
9278
  var MAX_SCHEDULE_PAGES = 50, SCHEDULE_PAGE = 100;
8922
- var init_api3 = __esm(() => {
9279
+ var init_api4 = __esm(() => {
8923
9280
  init_redact();
8924
9281
  init_flag_hint();
8925
- init_operations3();
9282
+ init_operations4();
8926
9283
  init_flag_hint();
8927
9284
  });
8928
9285
 
8929
9286
  // src/phase-c/commands/queues.ts
8930
- import { CliUserError as CliUserError41 } from "@burdenoff/cli-sdk/core";
9287
+ import { CliUserError as CliUserError42 } from "@burdenoff/cli-sdk/core";
8931
9288
  function parseEnvironment2(raw) {
8932
9289
  return parseEnumOption(raw, "--environment", ENVIRONMENTS3);
8933
9290
  }
8934
9291
  function checkQueueName(name) {
8935
9292
  const value = name.trim();
8936
9293
  if (value === "managed") {
8937
- throw new CliUserError41("`managed` is the platform queue; it cannot be created or changed.");
9294
+ throw new CliUserError42("`managed` is the platform queue; it cannot be created or changed.");
8938
9295
  }
8939
9296
  if (!QUEUE_NAME.test(value)) {
8940
- throw new CliUserError41(`Invalid queue name '${name}': lower-case letters, digits and dashes, at most 63, starting with a letter or digit.`);
9297
+ throw new CliUserError42(`Invalid queue name '${name}': lower-case letters, digits and dashes, at most 63, starting with a letter or digit.`);
8941
9298
  }
8942
9299
  return value;
8943
9300
  }
@@ -8949,7 +9306,7 @@ function checkWorkerQueue(raw) {
8949
9306
  const name = checkQueueName(value.slice(0, at));
8950
9307
  const environment = value.slice(at + 1).toLowerCase();
8951
9308
  if (!ENVIRONMENTS3.some((allowed) => allowed.toLowerCase() === environment)) {
8952
- throw new CliUserError41(`Invalid queue '${raw}': the environment after @ must be dev, staging or prod.`);
9309
+ throw new CliUserError42(`Invalid queue '${raw}': the environment after @ must be dev, staging or prod.`);
8953
9310
  }
8954
9311
  return `${name}@${environment}`;
8955
9312
  }
@@ -8962,7 +9319,7 @@ function bindWorkerQueues(queues, raw) {
8962
9319
  if (at < 0)
8963
9320
  return `${queue}@${environment}`;
8964
9321
  if (queue.slice(at + 1) !== environment) {
8965
- throw new CliUserError41(`Queue '${queue}' is bound to ${queue.slice(at + 1)}, but --environment is ${environment}.`);
9322
+ throw new CliUserError42(`Queue '${queue}' is bound to ${queue.slice(at + 1)}, but --environment is ${environment}.`);
8966
9323
  }
8967
9324
  return queue;
8968
9325
  });
@@ -8978,11 +9335,11 @@ async function findQueue(env, name, environment) {
8978
9335
  if (found)
8979
9336
  return found;
8980
9337
  if (environment === undefined && rows.length > 0) {
8981
- throw new CliUserError41(`Queue ${name} has only environment-scoped rows.`, {
9338
+ throw new CliUserError42(`Queue ${name} has only environment-scoped rows.`, {
8982
9339
  hint: `Pass --environment (one of ${rows.map((queue) => queue.environment ?? "-").join(", ")}).`
8983
9340
  });
8984
9341
  }
8985
- throw new CliUserError41(`The workspace has no task queue ${environment ? `${name}@${environment}` : name}.`, { hint: "List them with `fluidgrids queues list`." });
9342
+ throw new CliUserError42(`The workspace has no task queue ${environment ? `${name}@${environment}` : name}.`, { hint: "List them with `fluidgrids queues list`." });
8986
9343
  }
8987
9344
  async function runQueuesList(env, options) {
8988
9345
  const queues = await env.pc.taskQueues();
@@ -9043,7 +9400,7 @@ async function runQueuesUpdate(env, name, options) {
9043
9400
  const environment = parseEnvironment2(options.environment);
9044
9401
  const maxTasksPerSecond = parseNumberOption(options.maxTasksPerSecond, "--max-tasks-per-second");
9045
9402
  if (maxTasksPerSecond !== undefined && options.clearMaxTasksPerSecond) {
9046
- throw new CliUserError41("Give --max-tasks-per-second or --clear-max-tasks-per-second, not both.");
9403
+ throw new CliUserError42("Give --max-tasks-per-second or --clear-max-tasks-per-second, not both.");
9047
9404
  }
9048
9405
  const timeout = parseNonNegativeInt(options.workerUnavailableTimeout, "--worker-unavailable-timeout");
9049
9406
  const input = {
@@ -9053,7 +9410,7 @@ async function runQueuesUpdate(env, name, options) {
9053
9410
  ...timeout !== undefined ? { workerUnavailableTimeoutSeconds: timeout } : {}
9054
9411
  };
9055
9412
  if (Object.keys(input).length === 0) {
9056
- throw new CliUserError41("Nothing to change.", {
9413
+ throw new CliUserError42("Nothing to change.", {
9057
9414
  hint: "Give --description, --max-tasks-per-second, --clear-max-tasks-per-second or --worker-unavailable-timeout."
9058
9415
  });
9059
9416
  }
@@ -9132,7 +9489,7 @@ import { existsSync as existsSync14 } from "fs";
9132
9489
  import { hostname } from "os";
9133
9490
  import { extname as extname3, isAbsolute as isAbsolute3, join as join12, resolve as resolve11 } from "path";
9134
9491
  import { pathToFileURL as pathToFileURL2 } from "url";
9135
- import { CliUserError as CliUserError42 } from "@burdenoff/cli-sdk/core";
9492
+ import { CliUserError as CliUserError43 } from "@burdenoff/cli-sdk/core";
9136
9493
  function isRecord19(value) {
9137
9494
  return typeof value === "object" && value !== null && !Array.isArray(value);
9138
9495
  }
@@ -9143,11 +9500,11 @@ function bridgeUrlFor(env, explicit, issued) {
9143
9500
  try {
9144
9501
  url = new URL(raw);
9145
9502
  } catch {
9146
- throw new CliUserError42(`Invalid bridge URL '${raw}'.`);
9503
+ throw new CliUserError43(`Invalid bridge URL '${raw}'.`);
9147
9504
  }
9148
9505
  const local = url.hostname === "localhost" || url.hostname === "127.0.0.1";
9149
9506
  if (url.protocol !== "wss:" && !(url.protocol === "ws:" && local)) {
9150
- throw new CliUserError42(`The bridge URL must be wss:// (ws:// only to this machine): ${raw}`);
9507
+ throw new CliUserError43(`The bridge URL must be wss:// (ws:// only to this machine): ${raw}`);
9151
9508
  }
9152
9509
  return url.toString();
9153
9510
  }
@@ -9163,18 +9520,18 @@ function bridgeHeaders(env) {
9163
9520
  const id = env.getEnv("FLUIDGRIDS_CF_ACCESS_CLIENT_ID")?.trim();
9164
9521
  const secret = env.getEnv("FLUIDGRIDS_CF_ACCESS_CLIENT_SECRET")?.trim();
9165
9522
  if ((id === undefined || id === "") !== (secret === undefined || secret === "")) {
9166
- throw new CliUserError42("Set both FLUIDGRIDS_CF_ACCESS_CLIENT_ID and FLUIDGRIDS_CF_ACCESS_CLIENT_SECRET, or neither.");
9523
+ throw new CliUserError43("Set both FLUIDGRIDS_CF_ACCESS_CLIENT_ID and FLUIDGRIDS_CF_ACCESS_CLIENT_SECRET, or neither.");
9167
9524
  }
9168
9525
  return id && secret ? { "CF-Access-Client-Id": id, "CF-Access-Client-Secret": secret } : {};
9169
9526
  }
9170
9527
  function workerToken(env, tokenEnv) {
9171
9528
  const variable = tokenEnv?.trim() || WORKER_TOKEN_ENV;
9172
9529
  if (!ENV_NAME2.test(variable)) {
9173
- throw new CliUserError42("Invalid environment variable name for --token-env.");
9530
+ throw new CliUserError43("Invalid environment variable name for --token-env.");
9174
9531
  }
9175
9532
  const token = env.getEnv(variable)?.trim() ?? "";
9176
9533
  if (!WORKER_TOKEN.test(token)) {
9177
- throw new CliUserError42(`${variable} must hold a worker token (fgr_ and 43 characters).`, {
9534
+ throw new CliUserError43(`${variable} must hold a worker token (fgr_ and 43 characters).`, {
9178
9535
  hint: "Issue one with `fluidgrids workers tokens create <name> --queue <queue>`."
9179
9536
  });
9180
9537
  }
@@ -9187,7 +9544,7 @@ async function buildWorkerBundle(project) {
9187
9544
  explainUnresolved: (names) => [...names]
9188
9545
  });
9189
9546
  if (!lowered.workflows.some((workflow) => workflow.durable)) {
9190
- throw new CliUserError42("The project defines no durable functions for a worker to serve.");
9547
+ throw new CliUserError43("The project defines no durable functions for a worker to serve.");
9191
9548
  }
9192
9549
  await prepareProjectBundle(project, lowered);
9193
9550
  return bundlePathOf(project);
@@ -9201,23 +9558,23 @@ function activitiesFor(project, raw) {
9201
9558
  return;
9202
9559
  const value = raw.trim();
9203
9560
  if (value === "")
9204
- throw new CliUserError42("--activities cannot be empty.");
9561
+ throw new CliUserError43("--activities cannot be empty.");
9205
9562
  if (project.config.language === "py") {
9206
9563
  if (!/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(value)) {
9207
- throw new CliUserError42(`--activities for a Python project is a module name importable from the project (for example activities), not '${raw}'.`);
9564
+ throw new CliUserError43(`--activities for a Python project is a module name importable from the project (for example activities), not '${raw}'.`);
9208
9565
  }
9209
9566
  return value;
9210
9567
  }
9211
9568
  const path = isAbsolute3(value) ? value : resolve11(project.root, value);
9212
9569
  if (!existsSync14(path))
9213
- throw new CliUserError42(`--activities: ${raw} not found.`);
9570
+ throw new CliUserError43(`--activities: ${raw} not found.`);
9214
9571
  return path;
9215
9572
  }
9216
9573
  function launchOf(settings) {
9217
9574
  const { project, options } = settings;
9218
9575
  const activities = activitiesFor(project, options.activities);
9219
9576
  if (!settings.bundlePath && !activities) {
9220
- throw new CliUserError42("The worker would serve nothing: give workflows, --activities or both.");
9577
+ throw new CliUserError43("The worker would serve nothing: give workflows, --activities or both.");
9221
9578
  }
9222
9579
  const maxActivities = parsePositiveInt(options.maxConcurrentActivities, "--max-concurrent-activities");
9223
9580
  const maxWorkflowTasks = parsePositiveInt(options.maxConcurrentWorkflowTasks, "--max-concurrent-workflow-tasks");
@@ -9250,7 +9607,7 @@ async function workflowBundle(project, options, build) {
9250
9607
  if (!existsSync14(path)) {
9251
9608
  if (options.activities !== undefined)
9252
9609
  return;
9253
- throw new CliUserError42(`No workflow bundle at ${path}.`, {
9610
+ throw new CliUserError43(`No workflow bundle at ${path}.`, {
9254
9611
  hint: "Run `fluidgrids push` first, or pass --build to build it now (or --no-workflows)."
9255
9612
  });
9256
9613
  }
@@ -9259,7 +9616,7 @@ async function workflowBundle(project, options, build) {
9259
9616
  async function runWorkerRun(env, options) {
9260
9617
  const queues = bindWorkerQueues(parseList(options.queue).map(checkWorkerQueue), options.environment);
9261
9618
  if (queues.length === 0)
9262
- throw new CliUserError42("Name the task queue(s) to serve with --queue.");
9619
+ throw new CliUserError43("Name the task queue(s) to serve with --queue.");
9263
9620
  const project = loadProject(options.project, env.cwd());
9264
9621
  const token = workerToken(env, options.tokenEnv);
9265
9622
  const launch = launchOf({
@@ -9282,7 +9639,7 @@ function devQueueName() {
9282
9639
  async function runDev(env, options) {
9283
9640
  const project = loadProject(options.project, env.cwd());
9284
9641
  if (options.lang !== undefined && options.lang !== project.config.language) {
9285
- throw new CliUserError42(`--lang ${options.lang} does not match the project language (${project.config.language}).`, { hint: "Run `fluidgrids dev` in a project of that language (`fluidgrids init --lang …`)." });
9642
+ throw new CliUserError43(`--lang ${options.lang} does not match the project language (${project.config.language}).`, { hint: "Run `fluidgrids dev` in a project of that language (`fluidgrids init --lang …`)." });
9286
9643
  }
9287
9644
  const bundlePath = await workflowBundle(project, options, options.workflows !== false);
9288
9645
  const queueName = devQueueName();
@@ -9385,7 +9742,7 @@ async function loadTypeScriptActivities(root, path) {
9385
9742
  }
9386
9743
  }
9387
9744
  if (found.length === 0) {
9388
- throw new CliUserError42(`${path} exports no activity implementations.`, {
9745
+ throw new CliUserError43(`${path} exports no activity implementations.`, {
9389
9746
  hint: "Export `implementActivity(...)` or `defineActivity(...)` values from it."
9390
9747
  });
9391
9748
  }
@@ -9411,21 +9768,21 @@ async function runTypeScriptWorker(launch) {
9411
9768
  }
9412
9769
  function pythonWorkerExitError(python, code, signal) {
9413
9770
  if (signal)
9414
- return new CliUserError42(`The Python worker was stopped by ${signal}.`);
9771
+ return new CliUserError43(`The Python worker was stopped by ${signal}.`);
9415
9772
  const status = String(code);
9416
9773
  switch (code) {
9417
9774
  case PYTHON_EXIT_NO_WORKER:
9418
- return new CliUserError42(`The Python worker could not import fluidgrids_workflows.worker (status ${status}).`, {
9775
+ return new CliUserError43(`The Python worker could not import fluidgrids_workflows.worker (status ${status}).`, {
9419
9776
  hint: `Install the worker extra: \`${python} -m pip install 'fluidgrids-workflows[worker]'\`.`
9420
9777
  });
9421
9778
  case PYTHON_EXIT_NO_ACTIVITIES:
9422
- return new CliUserError42(`The Python worker exited with status ${status}: the activities module defines no activities.`, {
9779
+ return new CliUserError43(`The Python worker exited with status ${status}: the activities module defines no activities.`, {
9423
9780
  hint: "Decorate the activities with @define_activity in the module --activities names, or pass the module that defines them."
9424
9781
  });
9425
9782
  case PYTHON_EXIT_BRIDGE_CLOSED:
9426
- return new CliUserError42(`The Python worker exited with status ${status}: the worker bridge closed the connection (the close code and its meaning are above).`);
9783
+ return new CliUserError43(`The Python worker exited with status ${status}: the worker bridge closed the connection (the close code and its meaning are above).`);
9427
9784
  default:
9428
- return new CliUserError42(`The Python worker exited with status ${status}.`);
9785
+ return new CliUserError43(`The Python worker exited with status ${status}.`);
9429
9786
  }
9430
9787
  }
9431
9788
  function pythonWorkerSpec(launch) {
@@ -9469,7 +9826,7 @@ function runPythonWorker(launch) {
9469
9826
  };
9470
9827
  child.on("error", (error) => {
9471
9828
  done();
9472
- reject(error.code === "ENOENT" ? new CliUserError42(`Python interpreter "${python}" was not found.`) : new CliUserError42(`Could not start ${python}: ${error.message}`));
9829
+ reject(error.code === "ENOENT" ? new CliUserError43(`Python interpreter "${python}" was not found.`) : new CliUserError43(`Could not start ${python}: ${error.message}`));
9473
9830
  });
9474
9831
  child.on("close", (code, signal) => {
9475
9832
  done();
@@ -9551,7 +9908,7 @@ except BridgeClosedError as error:
9551
9908
  });
9552
9909
 
9553
9910
  // src/phase-c/shared.ts
9554
- import { CliUserError as CliUserError43 } from "@burdenoff/cli-sdk/core";
9911
+ import { CliUserError as CliUserError44 } from "@burdenoff/cli-sdk/core";
9555
9912
  function phaseCEnv(env) {
9556
9913
  return {
9557
9914
  ...env,
@@ -9564,32 +9921,32 @@ async function requireConfirmation(env, question, force) {
9564
9921
  if (force)
9565
9922
  return;
9566
9923
  if (!env.interactive()) {
9567
- throw new CliUserError43(`${question} needs confirmation.`, {
9924
+ throw new CliUserError44(`${question} needs confirmation.`, {
9568
9925
  hint: "Pass --force to go ahead without a prompt."
9569
9926
  });
9570
9927
  }
9571
9928
  if (!await env.confirm(question))
9572
- throw new CliUserError43("Aborted: nothing was changed.");
9929
+ throw new CliUserError44("Aborted: nothing was changed.");
9573
9930
  }
9574
9931
  function runSelectorOf(runId, flags) {
9575
9932
  const targeted = flags.workflowId !== undefined || flags.key !== undefined || flags.firstRunId !== undefined;
9576
9933
  if (!targeted) {
9577
9934
  if (runId === undefined || runId.trim() === "") {
9578
- throw new CliUserError43("Give a run id, or --workflow-id with --key.");
9935
+ throw new CliUserError44("Give a run id, or --workflow-id with --key.");
9579
9936
  }
9580
9937
  return { runId: runId.trim() };
9581
9938
  }
9582
9939
  if (runId !== undefined) {
9583
- throw new CliUserError43("Give a run id or --workflow-id with --key, not both.");
9940
+ throw new CliUserError44("Give a run id or --workflow-id with --key, not both.");
9584
9941
  }
9585
9942
  const workflowId = flags.workflowId?.trim() ?? "";
9586
9943
  const key = flags.key?.trim() ?? "";
9587
9944
  if (workflowId === "" || key === "") {
9588
- throw new CliUserError43("--workflow-id and --key go together (the workflow id of that key).");
9945
+ throw new CliUserError44("--workflow-id and --key go together (the workflow id of that key).");
9589
9946
  }
9590
9947
  const firstRunId = flags.firstRunId?.trim();
9591
9948
  if (flags.firstRunId !== undefined && !firstRunId) {
9592
- throw new CliUserError43("--first-run-id cannot be empty.");
9949
+ throw new CliUserError44("--first-run-id cannot be empty.");
9593
9950
  }
9594
9951
  return {
9595
9952
  target: { workflowKey: key, workflowId, ...firstRunId ? { firstRunId } : {} }
@@ -9605,7 +9962,7 @@ function parseEnumOption(raw, flag, allowed) {
9605
9962
  const match = allowed.find((value) => value === normal);
9606
9963
  if (match === undefined) {
9607
9964
  const shown = allowed.map((value) => value.toLowerCase().replace(/_/g, "-"));
9608
- throw new CliUserError43(`Invalid value '${raw}' for ${flag}. Allowed: ${shown.join(", ")}`);
9965
+ throw new CliUserError44(`Invalid value '${raw}' for ${flag}. Allowed: ${shown.join(", ")}`);
9609
9966
  }
9610
9967
  return match;
9611
9968
  }
@@ -9614,7 +9971,7 @@ function parseNonNegativeInt(raw, flag) {
9614
9971
  return;
9615
9972
  const value = raw.trim();
9616
9973
  if (!/^\d+$/.test(value) || !Number.isSafeInteger(Number(value))) {
9617
- throw new CliUserError43(`Invalid value '${raw}' for ${flag}: expected a whole number.`);
9974
+ throw new CliUserError44(`Invalid value '${raw}' for ${flag}: expected a whole number.`);
9618
9975
  }
9619
9976
  return Number(value);
9620
9977
  }
@@ -9623,14 +9980,14 @@ function parseNumberOption(raw, flag) {
9623
9980
  return;
9624
9981
  const value = Number(raw.trim());
9625
9982
  if (raw.trim() === "" || !Number.isFinite(value)) {
9626
- throw new CliUserError43(`Invalid value '${raw}' for ${flag}: expected a number.`);
9983
+ throw new CliUserError44(`Invalid value '${raw}' for ${flag}: expected a number.`);
9627
9984
  }
9628
9985
  return value;
9629
9986
  }
9630
9987
  function requireText(raw, flag) {
9631
9988
  const value = raw?.trim() ?? "";
9632
9989
  if (value === "")
9633
- throw new CliUserError43(`${flag} is required.`);
9990
+ throw new CliUserError44(`${flag} is required.`);
9634
9991
  return value;
9635
9992
  }
9636
9993
  function parseList(raw) {
@@ -9660,17 +10017,17 @@ function parseInstant(raw, flag) {
9660
10017
  const value = raw.trim();
9661
10018
  const ms = Date.parse(value);
9662
10019
  if (value === "" || !Number.isFinite(ms) || !/^\d{4}-\d{2}-\d{2}/.test(value)) {
9663
- throw new CliUserError43(`Invalid value '${raw}' for ${flag}: expected an ISO-8601 date and time such as 2026-10-01T00:00:00Z.`);
10020
+ throw new CliUserError44(`Invalid value '${raw}' for ${flag}: expected an ISO-8601 date and time such as 2026-10-01T00:00:00Z.`);
9664
10021
  }
9665
10022
  return new Date(ms).toISOString();
9666
10023
  }
9667
10024
  var init_shared3 = __esm(() => {
9668
10025
  init_confirm();
9669
- init_api3();
10026
+ init_api4();
9670
10027
  });
9671
10028
 
9672
10029
  // src/config/commands.ts
9673
- import { CliUserError as CliUserError44 } from "@burdenoff/cli-sdk/core";
10030
+ import { CliUserError as CliUserError45 } from "@burdenoff/cli-sdk/core";
9674
10031
  function output(env, options, data, rows, headers) {
9675
10032
  env.ctx.output.formatAndOutput(options, data, { headers, rows });
9676
10033
  }
@@ -9686,7 +10043,7 @@ function isLocal(url) {
9686
10043
  function checkProfileValue(key, value, profile) {
9687
10044
  const trimmed = value.trim();
9688
10045
  if (trimmed === "" || trimmed.length > 2048) {
9689
- throw new CliUserError44(`${key} must be 1 to 2048 characters.`);
10046
+ throw new CliUserError45(`${key} must be 1 to 2048 characters.`);
9690
10047
  }
9691
10048
  switch (key) {
9692
10049
  case "apiUrl":
@@ -9695,20 +10052,20 @@ function checkProfileValue(key, value, profile) {
9695
10052
  try {
9696
10053
  url = new URL(trimmed);
9697
10054
  } catch {
9698
- throw new CliUserError44(`${key} must be a URL.`);
10055
+ throw new CliUserError45(`${key} must be a URL.`);
9699
10056
  }
9700
10057
  if (url.protocol !== "https:" && !(url.protocol === "http:" && isLocal(url))) {
9701
- throw new CliUserError44(`${key} must use https (http only for localhost).`);
10058
+ throw new CliUserError45(`${key} must use https (http only for localhost).`);
9702
10059
  }
9703
10060
  if (url.username || url.password) {
9704
- throw new CliUserError44(`${key} must not carry credentials.`);
10061
+ throw new CliUserError45(`${key} must not carry credentials.`);
9705
10062
  }
9706
10063
  return trimmed;
9707
10064
  }
9708
10065
  case "environment": {
9709
10066
  const upper = trimmed.toUpperCase();
9710
10067
  if (!ENVIRONMENTS4.includes(upper)) {
9711
- throw new CliUserError44(`environment must be one of ${ENVIRONMENTS4.join(", ")}.`);
10068
+ throw new CliUserError45(`environment must be one of ${ENVIRONMENTS4.join(", ")}.`);
9712
10069
  }
9713
10070
  return upper;
9714
10071
  }
@@ -9722,15 +10079,15 @@ function checkProfileValue(key, value, profile) {
9722
10079
  async function readToken(env, fromEnv) {
9723
10080
  if (fromEnv !== undefined) {
9724
10081
  if (!ENV_NAME3.test(fromEnv))
9725
- throw new CliUserError44("Invalid environment variable name for --from-env.");
10082
+ throw new CliUserError45("Invalid environment variable name for --from-env.");
9726
10083
  const value = env.env[fromEnv]?.trim() ?? "";
9727
10084
  if (value === "")
9728
- throw new CliUserError44(`The environment variable ${fromEnv} is empty or unset.`);
10085
+ throw new CliUserError45(`The environment variable ${fromEnv} is empty or unset.`);
9729
10086
  return value;
9730
10087
  }
9731
10088
  const piped = (await env.readStdin()).trim();
9732
10089
  if (piped === "") {
9733
- throw new CliUserError44("Pipe the token on standard input, or pass --from-env <VAR>.", {
10090
+ throw new CliUserError45("Pipe the token on standard input, or pass --from-env <VAR>.", {
9734
10091
  hint: 'For example: `printf %s "$TOKEN" | fluidgrids config set token --profile prod`.'
9735
10092
  });
9736
10093
  }
@@ -9750,7 +10107,7 @@ async function runConfigSet(env, key, value, options) {
9750
10107
  const profile = profileName(env, options);
9751
10108
  if (key === "token") {
9752
10109
  if (value !== undefined) {
9753
- throw new CliUserError44("A token is never given on the command line.", {
10110
+ throw new CliUserError45("A token is never given on the command line.", {
9754
10111
  hint: "Pipe it on standard input, or pass --from-env <VAR>."
9755
10112
  });
9756
10113
  }
@@ -9767,12 +10124,12 @@ async function runConfigSet(env, key, value, options) {
9767
10124
  return out;
9768
10125
  }
9769
10126
  if (!isProfileKey(key)) {
9770
- throw new CliUserError44(`Unknown profile key ${key}.`, {
10127
+ throw new CliUserError45(`Unknown profile key ${key}.`, {
9771
10128
  hint: `Keys: ${PROFILE_KEYS.join(", ")}, token, defaultProfile.`
9772
10129
  });
9773
10130
  }
9774
10131
  if (value === undefined)
9775
- throw new CliUserError44(`Give a value for ${key}.`);
10132
+ throw new CliUserError45(`Give a value for ${key}.`);
9776
10133
  const checked = checkProfileValue(key, value, profile);
9777
10134
  updateConfig(file, (document) => {
9778
10135
  const table = profileTable(document, profile, true);
@@ -9788,7 +10145,7 @@ async function runConfigGet(env, key, options) {
9788
10145
  const config = readConfig(file);
9789
10146
  const resolved = resolveProfile(config, env.env, options.profile, file);
9790
10147
  if (key !== undefined && !isProfileKey(key)) {
9791
- throw new CliUserError44(`Unknown profile key ${key}.`, {
10148
+ throw new CliUserError45(`Unknown profile key ${key}.`, {
9792
10149
  hint: `Keys: ${PROFILE_KEYS.join(", ")}.`
9793
10150
  });
9794
10151
  }
@@ -9833,10 +10190,10 @@ async function runConfigDelete(env, key, options) {
9833
10190
  const profile = profileName(env, options);
9834
10191
  const existing = readConfig(file).profiles[profile];
9835
10192
  if (existing === undefined)
9836
- throw new CliUserError44(`There is no profile ${profile} in ${file}.`);
10193
+ throw new CliUserError45(`There is no profile ${profile} in ${file}.`);
9837
10194
  if (key !== undefined) {
9838
10195
  if (!isProfileKey(key))
9839
- throw new CliUserError44(`Unknown profile key ${key}.`);
10196
+ throw new CliUserError45(`Unknown profile key ${key}.`);
9840
10197
  updateConfig(file, (document) => {
9841
10198
  const table = profileTable(document, profile, false);
9842
10199
  if (table)
@@ -9873,7 +10230,7 @@ async function runConfigMigrate(env, options) {
9873
10230
  values.workspace = workspace;
9874
10231
  if (options.tokenEnv !== undefined) {
9875
10232
  if (!ENV_NAME3.test(options.tokenEnv))
9876
- throw new CliUserError44("Invalid environment variable name for --token-env.");
10233
+ throw new CliUserError45("Invalid environment variable name for --token-env.");
9877
10234
  values.tokenRef = `env:${options.tokenEnv}`;
9878
10235
  }
9879
10236
  updateConfig(file, (document) => {
@@ -9891,14 +10248,14 @@ async function runConfigMigrate(env, options) {
9891
10248
  return out;
9892
10249
  }
9893
10250
  var ENV_NAME3, ENVIRONMENTS4;
9894
- var init_commands = __esm(() => {
10251
+ var init_commands2 = __esm(() => {
9895
10252
  init_profiles();
9896
10253
  ENV_NAME3 = /^[A-Za-z_][A-Za-z0-9_]*$/;
9897
10254
  ENVIRONMENTS4 = ["DEV", "STAGING", "PROD"];
9898
10255
  });
9899
10256
 
9900
10257
  // src/phase-c/commands/workers.ts
9901
- import { CliUserError as CliUserError45 } from "@burdenoff/cli-sdk/core";
10258
+ import { CliUserError as CliUserError46 } from "@burdenoff/cli-sdk/core";
9902
10259
  function workerRows(workers) {
9903
10260
  return workers.map((worker) => [
9904
10261
  worker.identity,
@@ -9912,7 +10269,7 @@ function workerRows(workers) {
9912
10269
  }
9913
10270
  async function runWorkersList(env, options) {
9914
10271
  if (options.stale && options.notStale) {
9915
- throw new CliUserError45("Give --stale or --not-stale, not both.");
10272
+ throw new CliUserError46("Give --stale or --not-stale, not both.");
9916
10273
  }
9917
10274
  const filter = {
9918
10275
  ...options.queue ? { taskQueue: checkWorkerQueue(options.queue) } : {},
@@ -9955,7 +10312,7 @@ function connectionNames(raw) {
9955
10312
  const names = parseList(raw);
9956
10313
  for (const name of names) {
9957
10314
  if (!CONNECTION_NAME.test(name)) {
9958
- throw new CliUserError45(`Invalid connection name '${name}'.`);
10315
+ throw new CliUserError46(`Invalid connection name '${name}'.`);
9959
10316
  }
9960
10317
  }
9961
10318
  return names;
@@ -9970,10 +10327,10 @@ function issued(env, options, result) {
9970
10327
  async function runTokensCreate(env, name, options) {
9971
10328
  const tokenName = name.trim();
9972
10329
  if (tokenName === "")
9973
- throw new CliUserError45("A worker token needs a name.");
10330
+ throw new CliUserError46("A worker token needs a name.");
9974
10331
  const taskQueues = parseList(options.queue).map(checkWorkerQueue);
9975
10332
  if (taskQueues.length === 0) {
9976
- throw new CliUserError45("A worker token needs at least one --queue.", {
10333
+ throw new CliUserError46("A worker token needs at least one --queue.", {
9977
10334
  hint: "Create the queue first with `fluidgrids queues create <name>`."
9978
10335
  });
9979
10336
  }
@@ -10002,10 +10359,10 @@ async function runTokensDelete(env, id, options) {
10002
10359
  async function runTokensAllowConnections(env, id, names, options) {
10003
10360
  const list = connectionNames(names);
10004
10361
  if (list.length === 0 && !options.clear) {
10005
- throw new CliUserError45("Name the connections to allow, or pass --clear to allow none.");
10362
+ throw new CliUserError46("Name the connections to allow, or pass --clear to allow none.");
10006
10363
  }
10007
10364
  if (list.length > 0 && options.clear) {
10008
- throw new CliUserError45("Give connection names or --clear, not both.");
10365
+ throw new CliUserError46("Give connection names or --clear, not both.");
10009
10366
  }
10010
10367
  const token = await env.pc.setWorkerTokenConnectionAllowlist(id, list);
10011
10368
  emit(env, options, token, { headers: TOKEN_HEADERS, rows: [tokenRow(token)] }, [
@@ -10025,17 +10382,17 @@ var init_workers = __esm(() => {
10025
10382
 
10026
10383
  // src/phase-c/commands/run-control.ts
10027
10384
  import { randomUUID } from "crypto";
10028
- import { CliUserError as CliUserError46 } from "@burdenoff/cli-sdk/core";
10385
+ import { CliUserError as CliUserError47 } from "@burdenoff/cli-sdk/core";
10029
10386
  function runAndName(first, second, flags) {
10030
10387
  const targeted = flags.workflowId !== undefined || flags.key !== undefined;
10031
10388
  if (targeted) {
10032
10389
  if (second !== undefined) {
10033
- throw new CliUserError46("With --workflow-id, give only the name: `<name> --workflow-id <id> --key <key>`.");
10390
+ throw new CliUserError47("With --workflow-id, give only the name: `<name> --workflow-id <id> --key <key>`.");
10034
10391
  }
10035
10392
  return { run: runSelectorOf(undefined, flags), name: first };
10036
10393
  }
10037
10394
  if (second === undefined) {
10038
- throw new CliUserError46("Give the run id and the name: `<runId> <name>`.");
10395
+ throw new CliUserError47("Give the run id and the name: `<runId> <name>`.");
10039
10396
  }
10040
10397
  return { run: runSelectorOf(first, flags), name: second };
10041
10398
  }
@@ -10049,7 +10406,7 @@ async function runQuery(env, first, second, options) {
10049
10406
  rows: [[result.name, String(result.rejected), JSON.stringify(result.value ?? null)]]
10050
10407
  }, result.error ? [`error: ${result.error}`] : []);
10051
10408
  if (result.rejected) {
10052
- throw new CliUserError46(`The query ${name} was refused: ${result.error ?? "no reason given"}`);
10409
+ throw new CliUserError47(`The query ${name} was refused: ${result.error ?? "no reason given"}`);
10053
10410
  }
10054
10411
  return result;
10055
10412
  }
@@ -10091,13 +10448,13 @@ async function runUpdate(env, first, second, options) {
10091
10448
  rows: [[result.updateId, result.name, result.status, JSON.stringify(result.result ?? null)]]
10092
10449
  });
10093
10450
  if (!reached(result.status, waitFor)) {
10094
- throw new CliUserError46(`The update ${name} is still ${result.status} after ${timeoutMs} ms (waiting for ${waitFor}); check it later with \`fluidgrids runs update-status ${result.runId} ${updateId}\`.`);
10451
+ throw new CliUserError47(`The update ${name} is still ${result.status} after ${timeoutMs} ms (waiting for ${waitFor}); check it later with \`fluidgrids runs update-status ${result.runId} ${updateId}\`.`);
10095
10452
  }
10096
10453
  if (result.status === "REJECTED") {
10097
- throw new CliUserError46(`The update ${name} was rejected: ${failureMessage(result.failure)}`);
10454
+ throw new CliUserError47(`The update ${name} was rejected: ${failureMessage(result.failure)}`);
10098
10455
  }
10099
10456
  if (result.status === "COMPLETED" && result.failure !== null && result.failure !== undefined) {
10100
- throw new CliUserError46(`The update handler of ${name} failed: ${failureMessage(result.failure)}`);
10457
+ throw new CliUserError47(`The update handler of ${name} failed: ${failureMessage(result.failure)}`);
10101
10458
  }
10102
10459
  return result;
10103
10460
  }
@@ -10113,33 +10470,33 @@ async function runUpdateStatus(env, first, second, options) {
10113
10470
  function parseResetTo(raw, buildId) {
10114
10471
  const value = raw?.trim() ?? "";
10115
10472
  if (value === "") {
10116
- throw new CliUserError46("--to is required: a history seq, first-task, last-task, last-continue-as-new, build-id or last-clean-task.");
10473
+ throw new CliUserError47("--to is required: a history seq, first-task, last-task, last-continue-as-new, build-id or last-clean-task.");
10117
10474
  }
10118
10475
  if (/^\d+$/.test(value)) {
10119
10476
  if (buildId !== undefined)
10120
- throw new CliUserError46("--build-id goes with --to build-id only.");
10477
+ throw new CliUserError47("--build-id goes with --to build-id only.");
10121
10478
  const seq = Number(value);
10122
10479
  if (!Number.isSafeInteger(seq) || seq <= 0) {
10123
- throw new CliUserError46(`Invalid value '${raw}' for --to: a seq is a positive integer.`);
10480
+ throw new CliUserError47(`Invalid value '${raw}' for --to: a seq is a positive integer.`);
10124
10481
  }
10125
10482
  return { seq };
10126
10483
  }
10127
10484
  const normal = value.toUpperCase().replace(/-/g, "_");
10128
10485
  if (normal === "LAST_CLEAN_TASK") {
10129
10486
  if (buildId !== undefined)
10130
- throw new CliUserError46("--build-id goes with --to build-id only.");
10487
+ throw new CliUserError47("--build-id goes with --to build-id only.");
10131
10488
  return "LAST_CLEAN_TASK";
10132
10489
  }
10133
10490
  const type = parseEnumOption(normal === "LAST_CONTINUE_AS_NEW" ? "LAST_CONTINUED_AS_NEW" : normal, "--to", RESET_TYPES);
10134
10491
  if (type === "BUILD_ID") {
10135
10492
  const id = buildId?.trim() ?? "";
10136
10493
  if (!/^sha256:[0-9a-f]{64}$/.test(id)) {
10137
- throw new CliUserError46("--to build-id needs --build-id sha256:<64 hex>.");
10494
+ throw new CliUserError47("--to build-id needs --build-id sha256:<64 hex>.");
10138
10495
  }
10139
10496
  return { type, buildId: id };
10140
10497
  }
10141
10498
  if (buildId !== undefined)
10142
- throw new CliUserError46("--build-id goes with --to build-id only.");
10499
+ throw new CliUserError47("--build-id goes with --to build-id only.");
10143
10500
  return { type };
10144
10501
  }
10145
10502
  async function runReset(env, runId, options) {
@@ -10198,7 +10555,7 @@ async function runTrace(env, runIdArg, options) {
10198
10555
  const runId = await env.pc.runIdOf(runSelectorOf(runIdArg, options));
10199
10556
  const hierarchy = await env.pc.runHierarchy(runId);
10200
10557
  if (!hierarchy)
10201
- throw new CliUserError46(`Run ${runId} not found (NOT_FOUND)`);
10558
+ throw new CliUserError47(`Run ${runId} not found (NOT_FOUND)`);
10202
10559
  const entries = flatten(hierarchy);
10203
10560
  const open = entries.filter((entry) => OPEN_STATUSES.includes(entry.run.status));
10204
10561
  const read = new Map;
@@ -10238,32 +10595,32 @@ var init_run_control = __esm(() => {
10238
10595
  });
10239
10596
 
10240
10597
  // src/phase-c/commands/activities.ts
10241
- import { CliUserError as CliUserError47 } from "@burdenoff/cli-sdk/core";
10598
+ import { CliUserError as CliUserError48 } from "@burdenoff/cli-sdk/core";
10242
10599
  import { durationMs as durationMs2 } from "@fluidgrids/workflows/ir";
10243
10600
  function completionOf(env, first, second, options) {
10244
10601
  if (options.taskTokenEnv !== undefined) {
10245
10602
  if (first !== undefined || options.workflowId !== undefined || options.key !== undefined) {
10246
- throw new CliUserError47("Give --task-token-env, or the run and activity id, not both.");
10603
+ throw new CliUserError48("Give --task-token-env, or the run and activity id, not both.");
10247
10604
  }
10248
10605
  const variable = options.taskTokenEnv.trim();
10249
10606
  if (!ENV_NAME4.test(variable)) {
10250
- throw new CliUserError47("Invalid environment variable name for --task-token-env.");
10607
+ throw new CliUserError48("Invalid environment variable name for --task-token-env.");
10251
10608
  }
10252
10609
  const taskToken = env.getEnv(variable)?.trim() ?? "";
10253
10610
  if (taskToken === "") {
10254
- throw new CliUserError47(`The environment variable ${variable} (--task-token-env) is empty or unset.`);
10611
+ throw new CliUserError48(`The environment variable ${variable} (--task-token-env) is empty or unset.`);
10255
10612
  }
10256
10613
  return { kind: "token", taskToken };
10257
10614
  }
10258
10615
  const targeted = options.workflowId !== undefined || options.key !== undefined;
10259
10616
  if (targeted) {
10260
10617
  if (first === undefined || second !== undefined) {
10261
- throw new CliUserError47("With --workflow-id, give only the activity id.");
10618
+ throw new CliUserError48("With --workflow-id, give only the activity id.");
10262
10619
  }
10263
10620
  return { kind: "id", run: runSelectorOf(undefined, options), activityId: first };
10264
10621
  }
10265
10622
  if (first === undefined || second === undefined) {
10266
- throw new CliUserError47("Give `<runId> <activityId>`, `<activityId> --workflow-id <id> --key <key>`, or --task-token-env.");
10623
+ throw new CliUserError48("Give `<runId> <activityId>`, `<activityId> --workflow-id <id> --key <key>`, or --task-token-env.");
10267
10624
  }
10268
10625
  return { kind: "id", run: runSelectorOf(first, options), activityId: second };
10269
10626
  }
@@ -10321,7 +10678,7 @@ function selectorOf(options) {
10321
10678
  options.all === true
10322
10679
  ];
10323
10680
  if (given.filter(Boolean).length !== 1) {
10324
- throw new CliUserError47("Choose the activities with exactly one of --activity-id, --type or --all.");
10681
+ throw new CliUserError48("Choose the activities with exactly one of --activity-id, --type or --all.");
10325
10682
  }
10326
10683
  if (options.activityId !== undefined) {
10327
10684
  return { activityId: requireText(options.activityId, "--activity-id") };
@@ -10362,18 +10719,18 @@ function parseMs(raw, flag) {
10362
10719
  const value = raw.trim();
10363
10720
  const ms = /^\d+$/.test(value) ? Number(value) : value === "" ? undefined : durationMs2(value, "ms");
10364
10721
  if (ms === undefined || !Number.isFinite(ms) || ms <= 0 || !Number.isSafeInteger(Math.round(ms))) {
10365
- throw new CliUserError47(`Invalid value '${raw}' for ${flag}: expected milliseconds or a duration such as 1.5s, 5m or PT2H.`);
10722
+ throw new CliUserError48(`Invalid value '${raw}' for ${flag}: expected milliseconds or a duration such as 1.5s, 5m or PT2H.`);
10366
10723
  }
10367
10724
  return Math.round(ms);
10368
10725
  }
10369
10726
  function activityOptionsOf(options) {
10370
10727
  const maxRetries = options.maxRetries === undefined ? undefined : /^\d+$/.test(options.maxRetries.trim()) ? Number(options.maxRetries.trim()) : NaN;
10371
10728
  if (Number.isNaN(maxRetries)) {
10372
- throw new CliUserError47(`Invalid value '${options.maxRetries}' for --max-retries.`);
10729
+ throw new CliUserError48(`Invalid value '${options.maxRetries}' for --max-retries.`);
10373
10730
  }
10374
10731
  const backoff = options.backoff === undefined ? undefined : Number(options.backoff.trim());
10375
10732
  if (backoff !== undefined && (!Number.isFinite(backoff) || backoff < 1)) {
10376
- throw new CliUserError47(`Invalid value '${options.backoff}' for --backoff: at least 1.`);
10733
+ throw new CliUserError48(`Invalid value '${options.backoff}' for --backoff: at least 1.`);
10377
10734
  }
10378
10735
  const retryOn = [];
10379
10736
  for (const value of parseList(options.retryOn)) {
@@ -10397,7 +10754,7 @@ function activityOptionsOf(options) {
10397
10754
  };
10398
10755
  const out = { ...timeouts, ...Object.keys(retry).length > 0 ? { retry } : {} };
10399
10756
  if (Object.keys(out).length === 0) {
10400
- throw new CliUserError47("Nothing to change: give a retry option or a timeout.");
10757
+ throw new CliUserError48("Nothing to change: give a retry option or a timeout.");
10401
10758
  }
10402
10759
  return out;
10403
10760
  }
@@ -10424,10 +10781,10 @@ async function runPauseRulesList(env, options) {
10424
10781
  }
10425
10782
  async function runPauseRulesCreate(env, options) {
10426
10783
  if (options.activityType === undefined && options.nodeType === undefined && options.workflowKey === undefined) {
10427
- throw new CliUserError47("A pause rule needs --activity-type, --node-type or --workflow-key.");
10784
+ throw new CliUserError48("A pause rule needs --activity-type, --node-type or --workflow-key.");
10428
10785
  }
10429
10786
  if (options.expiresAt !== undefined && options.expiresIn !== undefined) {
10430
- throw new CliUserError47("Give --expires-at or --expires-in, not both.");
10787
+ throw new CliUserError48("Give --expires-at or --expires-in, not both.");
10431
10788
  }
10432
10789
  const expiresIn = parseMs(options.expiresIn, "--expires-in");
10433
10790
  const expiresAt = expiresIn !== undefined ? new Date(Date.now() + expiresIn).toISOString() : parseInstant(options.expiresAt, "--expires-at");
@@ -10465,7 +10822,7 @@ var init_activities = __esm(() => {
10465
10822
  });
10466
10823
 
10467
10824
  // src/phase-c/commands/batch.ts
10468
- import { CliUserError as CliUserError48 } from "@burdenoff/cli-sdk/core";
10825
+ import { CliUserError as CliUserError49 } from "@burdenoff/cli-sdk/core";
10469
10826
  function isBatchType(name) {
10470
10827
  return Object.hasOwn(BATCH_TYPES, name);
10471
10828
  }
@@ -10478,7 +10835,7 @@ function batchSelection(options) {
10478
10835
  if (options.filter !== undefined) {
10479
10836
  const raw = parseJsonOption(options.filter, "--filter");
10480
10837
  if (!isRecord20(raw))
10481
- throw new CliUserError48("--filter must be a JSON object (ListWorkflowRunsInput).");
10838
+ throw new CliUserError49("--filter must be a JSON object (ListWorkflowRunsInput).");
10482
10839
  Object.assign(filter, raw);
10483
10840
  delete filter["limit"];
10484
10841
  delete filter["offset"];
@@ -10498,19 +10855,19 @@ function batchSelection(options) {
10498
10855
  if (options.searchAttributes !== undefined) {
10499
10856
  const query = parseJsonOption(options.searchAttributes, "--search-attributes");
10500
10857
  if (!isRecord20(query)) {
10501
- throw new CliUserError48("--search-attributes must be a JSON object ({and, or, text}).");
10858
+ throw new CliUserError49("--search-attributes must be a JSON object ({and, or, text}).");
10502
10859
  }
10503
10860
  filter["searchAttributes"] = query;
10504
10861
  }
10505
10862
  const filtered = Object.keys(filter).length > 0;
10506
10863
  if (runIds.length > 0 && filtered) {
10507
- throw new CliUserError48("Choose the runs with --run-id or with filter options, not both.");
10864
+ throw new CliUserError49("Choose the runs with --run-id or with filter options, not both.");
10508
10865
  }
10509
10866
  if (runIds.length > MAX_BATCH_RUN_IDS) {
10510
- throw new CliUserError48(`At most ${MAX_BATCH_RUN_IDS} --run-id values; use a filter for more.`);
10867
+ throw new CliUserError49(`At most ${MAX_BATCH_RUN_IDS} --run-id values; use a filter for more.`);
10511
10868
  }
10512
10869
  if (runIds.length === 0 && !filtered) {
10513
- throw new CliUserError48("Choose the runs: --run-id, or a filter (--key, --status, --kind, --workflow-id, --search-attributes, --filter).");
10870
+ throw new CliUserError49("Choose the runs: --run-id, or a filter (--key, --status, --kind, --workflow-id, --search-attributes, --filter).");
10514
10871
  }
10515
10872
  const rate = parsePositiveInt(options.rate, "--rate");
10516
10873
  return {
@@ -10572,7 +10929,7 @@ function batchPayload(type, options) {
10572
10929
  options.clearOverride === true
10573
10930
  ];
10574
10931
  if (chosen.filter(Boolean).length !== 1) {
10575
- throw new CliUserError48("Give exactly one of --pin <version>, --auto-upgrade or --clear-override.");
10932
+ throw new CliUserError49("Give exactly one of --pin <version>, --auto-upgrade or --clear-override.");
10576
10933
  }
10577
10934
  if (options.clearOverride)
10578
10935
  return { clearVersioningOverride: true };
@@ -10606,7 +10963,7 @@ function refuseUnused(type, options) {
10606
10963
  unused.push("--activity-id/--type/--all");
10607
10964
  }
10608
10965
  if (unused.length > 0) {
10609
- throw new CliUserError48(`${unused.join(", ")} do not apply to a ${type} batch.`);
10966
+ throw new CliUserError49(`${unused.join(", ")} do not apply to a ${type} batch.`);
10610
10967
  }
10611
10968
  }
10612
10969
  function jobRow(job) {
@@ -10634,7 +10991,7 @@ function jobDetails(job) {
10634
10991
  }
10635
10992
  async function runBatchStart(env, typeName, options) {
10636
10993
  if (!isBatchType(typeName)) {
10637
- throw new CliUserError48(`Unknown batch type '${typeName}'. Allowed: ${Object.keys(BATCH_TYPES).join(", ")}`);
10994
+ throw new CliUserError49(`Unknown batch type '${typeName}'. Allowed: ${Object.keys(BATCH_TYPES).join(", ")}`);
10638
10995
  }
10639
10996
  const type = BATCH_TYPES[typeName];
10640
10997
  refuseUnused(type, options);
@@ -10684,10 +11041,10 @@ async function runBatchDescribe(env, id, options) {
10684
11041
  }
10685
11042
  emit(env, options, job, { headers: JOB_HEADERS, rows: [jobRow(job)] }, jobDetails(job));
10686
11043
  if (options.watch && !TERMINAL_JOB.includes(job.status)) {
10687
- throw new CliUserError48(`Batch job ${id} is still ${job.status} after ${timeout} ms.`);
11044
+ throw new CliUserError49(`Batch job ${id} is still ${job.status} after ${timeout} ms.`);
10688
11045
  }
10689
11046
  if (options.watch && (job.status === "FAILED" || job.status === "CANCELLED")) {
10690
- throw new CliUserError48(`Batch job ${id} ended ${job.status}${job.failureMessage ? `: ${job.failureMessage}` : ""}.`);
11047
+ throw new CliUserError49(`Batch job ${id} ended ${job.status}${job.failureMessage ? `: ${job.failureMessage}` : ""}.`);
10691
11048
  }
10692
11049
  return job;
10693
11050
  }
@@ -10731,7 +11088,7 @@ var init_batch = __esm(() => {
10731
11088
  });
10732
11089
 
10733
11090
  // src/phase-d/duration.ts
10734
- import { CliUserError as CliUserError49 } from "@burdenoff/cli-sdk/core";
11091
+ import { CliUserError as CliUserError50 } from "@burdenoff/cli-sdk/core";
10735
11092
  import { toMs } from "@fluidgrids/workflows";
10736
11093
  function parseDurationOption(raw, flag) {
10737
11094
  if (raw === undefined)
@@ -10741,7 +11098,7 @@ function parseDurationOption(raw, flag) {
10741
11098
  try {
10742
11099
  toMs(sent, flag);
10743
11100
  } catch {
10744
- throw new CliUserError49(`Invalid value '${raw}' for ${flag}: expected a duration such as 1500 (milliseconds), 30s, 5m, 2h or PT2H.`);
11101
+ throw new CliUserError50(`Invalid value '${raw}' for ${flag}: expected a duration such as 1500 (milliseconds), 30s, 5m, 2h or PT2H.`);
10745
11102
  }
10746
11103
  return sent;
10747
11104
  }
@@ -10750,14 +11107,14 @@ var init_duration = () => {};
10750
11107
  // src/phase-d/commands/activity-start.ts
10751
11108
  import { existsSync as existsSync15, readFileSync as readFileSync12 } from "fs";
10752
11109
  import { resolve as resolve12 } from "path";
10753
- import { CliUserError as CliUserError50 } from "@burdenoff/cli-sdk/core";
11110
+ import { CliUserError as CliUserError51 } from "@burdenoff/cli-sdk/core";
10754
11111
  function retryPolicy(raw, maxAttempts, readFile) {
10755
11112
  const parsed = parseJsonObjectArg(raw, "--retry", readFile);
10756
11113
  const policy = {};
10757
11114
  if (parsed !== undefined) {
10758
11115
  for (const key of Object.keys(parsed)) {
10759
11116
  if (!RETRY_KEYS.some((known) => known === key)) {
10760
- throw new CliUserError50(`--retry: unknown field ${key}. Allowed: ${RETRY_KEYS.join(", ")}`);
11117
+ throw new CliUserError51(`--retry: unknown field ${key}. Allowed: ${RETRY_KEYS.join(", ")}`);
10761
11118
  }
10762
11119
  }
10763
11120
  const text = (key) => {
@@ -10765,7 +11122,7 @@ function retryPolicy(raw, maxAttempts, readFile) {
10765
11122
  if (value === undefined)
10766
11123
  return;
10767
11124
  if (typeof value !== "string")
10768
- throw new CliUserError50(`--retry: ${key} must be a duration.`);
11125
+ throw new CliUserError51(`--retry: ${key} must be a duration.`);
10769
11126
  policy[key] = parseDurationOption(value, `--retry ${key}`);
10770
11127
  };
10771
11128
  text("initialInterval");
@@ -10773,21 +11130,21 @@ function retryPolicy(raw, maxAttempts, readFile) {
10773
11130
  const backoff = parsed["backoffCoefficient"];
10774
11131
  if (backoff !== undefined) {
10775
11132
  if (typeof backoff !== "number" || !Number.isFinite(backoff) || backoff < 1) {
10776
- throw new CliUserError50("--retry: backoffCoefficient must be a number of at least 1.");
11133
+ throw new CliUserError51("--retry: backoffCoefficient must be a number of at least 1.");
10777
11134
  }
10778
11135
  policy.backoffCoefficient = backoff;
10779
11136
  }
10780
11137
  const attempts = parsed["maximumAttempts"];
10781
11138
  if (attempts !== undefined) {
10782
11139
  if (typeof attempts !== "number" || !Number.isSafeInteger(attempts) || attempts < 0) {
10783
- throw new CliUserError50("--retry: maximumAttempts must be a whole number (0 = unlimited).");
11140
+ throw new CliUserError51("--retry: maximumAttempts must be a whole number (0 = unlimited).");
10784
11141
  }
10785
11142
  policy.maximumAttempts = attempts;
10786
11143
  }
10787
11144
  const types = parsed["nonRetryableErrorTypes"];
10788
11145
  if (types !== undefined) {
10789
11146
  if (!Array.isArray(types) || types.some((type) => typeof type !== "string")) {
10790
- throw new CliUserError50("--retry: nonRetryableErrorTypes must be a list of strings.");
11147
+ throw new CliUserError51("--retry: nonRetryableErrorTypes must be a list of strings.");
10791
11148
  }
10792
11149
  policy.nonRetryableErrorTypes = types.filter((type) => typeof type === "string");
10793
11150
  }
@@ -10795,7 +11152,7 @@ function retryPolicy(raw, maxAttempts, readFile) {
10795
11152
  if (maxAttempts !== undefined) {
10796
11153
  const value = maxAttempts.trim();
10797
11154
  if (!/^\d+$/.test(value) || !Number.isSafeInteger(Number(value))) {
10798
- throw new CliUserError50(`Invalid value '${maxAttempts}' for --max-attempts: expected a whole number (0 = unlimited).`);
11155
+ throw new CliUserError51(`Invalid value '${maxAttempts}' for --max-attempts: expected a whole number (0 = unlimited).`);
10799
11156
  }
10800
11157
  policy.maximumAttempts = Number(value);
10801
11158
  }
@@ -10804,29 +11161,29 @@ function retryPolicy(raw, maxAttempts, readFile) {
10804
11161
  function requireName(raw, what) {
10805
11162
  const value = raw.trim();
10806
11163
  if (value === "")
10807
- throw new CliUserError50(`The ${what} is empty.`);
11164
+ throw new CliUserError51(`The ${what} is empty.`);
10808
11165
  return value;
10809
11166
  }
10810
11167
  async function runActivityStart(env, nodeType, operation, options) {
10811
11168
  const readFile = (path) => {
10812
11169
  const absolute = resolve12(env.cwd(), path);
10813
11170
  if (!existsSync15(absolute))
10814
- throw new CliUserError50(`${path} does not exist.`);
11171
+ throw new CliUserError51(`${path} does not exist.`);
10815
11172
  return readFileSync12(absolute, "utf8");
10816
11173
  };
10817
11174
  if (options.args === undefined) {
10818
- throw new CliUserError50("--args is required: the operation arguments as a JSON object.", {
11175
+ throw new CliUserError51("--args is required: the operation arguments as a JSON object.", {
10819
11176
  hint: `For example --args '{"url":"https://example.com"}', or --args @args.json.`
10820
11177
  });
10821
11178
  }
10822
11179
  const args = parseJsonObjectArg(options.args, "--args", readFile) ?? {};
10823
11180
  const summary = options.summary?.trim();
10824
11181
  if (summary !== undefined && (summary === "" || summary.length > MAX_SUMMARY_CHARS)) {
10825
- throw new CliUserError50(`--summary is 1 to ${MAX_SUMMARY_CHARS} characters.`);
11182
+ throw new CliUserError51(`--summary is 1 to ${MAX_SUMMARY_CHARS} characters.`);
10826
11183
  }
10827
11184
  const key = options.idempotencyKey?.trim();
10828
11185
  if (key !== undefined && !IDEMPOTENCY_KEY.test(key)) {
10829
- throw new CliUserError50(`--idempotency-key is 1 to ${MAX_IDEMPOTENCY_KEY_CHARS} letters, digits, dots, underscores, colons or dashes.`);
11186
+ throw new CliUserError51(`--idempotency-key is 1 to ${MAX_IDEMPOTENCY_KEY_CHARS} letters, digits, dots, underscores, colons or dashes.`);
10830
11187
  }
10831
11188
  const retry = retryPolicy(options.retry, options.maxAttempts, readFile);
10832
11189
  const nodeVersion = options.nodeVersion?.trim();
@@ -10870,7 +11227,7 @@ async function runActivityStart(env, nodeType, operation, options) {
10870
11227
  rows: [[result.run.id, finalStatus, started.existing ? "yes" : "no"]]
10871
11228
  }, details);
10872
11229
  if (options.wait && finalStatus !== "COMPLETED") {
10873
- throw new CliUserError50(`Run ${started.run.id} ended ${finalStatus}.`);
11230
+ throw new CliUserError51(`Run ${started.run.id} ended ${finalStatus}.`);
10874
11231
  }
10875
11232
  return result;
10876
11233
  }
@@ -10891,7 +11248,7 @@ var init_activity_start = __esm(() => {
10891
11248
  });
10892
11249
 
10893
11250
  // src/phase-c/commands/signal-tokens.ts
10894
- import { CliUserError as CliUserError51 } from "@burdenoff/cli-sdk/core";
11251
+ import { CliUserError as CliUserError52 } from "@burdenoff/cli-sdk/core";
10895
11252
  function row(token) {
10896
11253
  return [
10897
11254
  token.id,
@@ -10908,12 +11265,12 @@ async function runSignalTokenCreate(env, runId, options) {
10908
11265
  const signalName = requireText(options.signal, "--signal");
10909
11266
  const ttlMs = parseMs(options.ttl, "--ttl");
10910
11267
  if (ttlMs !== undefined && ttlMs % 1000 !== 0) {
10911
- throw new CliUserError51("--ttl is counted in whole seconds.");
11268
+ throw new CliUserError52("--ttl is counted in whole seconds.");
10912
11269
  }
10913
11270
  const ipAllowlist = parseList(options.allowIp);
10914
11271
  for (const entry of ipAllowlist) {
10915
11272
  if (!IPV4_OR_CIDR.test(entry)) {
10916
- throw new CliUserError51(`Invalid --allow-ip '${entry}': an IPv4 address or CIDR range.`);
11273
+ throw new CliUserError52(`Invalid --allow-ip '${entry}': an IPv4 address or CIDR range.`);
10917
11274
  }
10918
11275
  }
10919
11276
  const created = await env.pc.createSignalToken({
@@ -10949,7 +11306,7 @@ var init_signal_tokens = __esm(() => {
10949
11306
  });
10950
11307
 
10951
11308
  // src/phase-c/commands/search-attributes.ts
10952
- import { CliUserError as CliUserError52 } from "@burdenoff/cli-sdk/core";
11309
+ import { CliUserError as CliUserError53 } from "@burdenoff/cli-sdk/core";
10953
11310
  function row2(attribute) {
10954
11311
  return [
10955
11312
  attribute.name,
@@ -10966,11 +11323,11 @@ async function runSearchAttributesList(env, options) {
10966
11323
  }
10967
11324
  async function runSearchAttributesCreate(env, name, options) {
10968
11325
  if (!NAME.test(name)) {
10969
- throw new CliUserError52(`Invalid search attribute name '${name}': a letter, then letters, digits and underscores (at most 64).`);
11326
+ throw new CliUserError53(`Invalid search attribute name '${name}': a letter, then letters, digits and underscores (at most 64).`);
10970
11327
  }
10971
11328
  const type = parseEnumOption(options.type, "--type", SEARCH_ATTRIBUTE_TYPES);
10972
11329
  if (type === undefined) {
10973
- throw new CliUserError52(`--type is required: ${SEARCH_ATTRIBUTE_TYPES.join(", ")}.`);
11330
+ throw new CliUserError53(`--type is required: ${SEARCH_ATTRIBUTE_TYPES.join(", ")}.`);
10974
11331
  }
10975
11332
  const attribute = await env.pc.createSearchAttribute({
10976
11333
  name,
@@ -10983,7 +11340,7 @@ async function runSearchAttributesCreate(env, name, options) {
10983
11340
  async function runSearchAttributesDelete(env, name, options) {
10984
11341
  const attribute = (await env.pc.searchAttributes()).find((entry) => entry.name === name);
10985
11342
  if (!attribute) {
10986
- throw new CliUserError52(`The workspace has no search attribute ${name}.`, {
11343
+ throw new CliUserError53(`The workspace has no search attribute ${name}.`, {
10987
11344
  hint: "List them with `fluidgrids search-attributes list`."
10988
11345
  });
10989
11346
  }
@@ -11011,7 +11368,7 @@ var init_search_attributes = __esm(() => {
11011
11368
  });
11012
11369
 
11013
11370
  // src/phase-c/commands/schedules.ts
11014
- import { CliUserError as CliUserError53 } from "@burdenoff/cli-sdk/core";
11371
+ import { CliUserError as CliUserError54 } from "@burdenoff/cli-sdk/core";
11015
11372
  function isRecord21(value) {
11016
11373
  return typeof value === "object" && value !== null && !Array.isArray(value);
11017
11374
  }
@@ -11136,9 +11493,9 @@ async function runSchedulesBackfill(env, workflowKey, triggerNodeId, options) {
11136
11493
  const from = parseInstant(requireText(options.from, "--from"), "--from") ?? "";
11137
11494
  const to = parseInstant(requireText(options.to, "--to"), "--to") ?? "";
11138
11495
  if (from >= to)
11139
- throw new CliUserError53("--from must be before --to.");
11496
+ throw new CliUserError54("--from must be before --to.");
11140
11497
  if (Date.parse(to) > Date.now())
11141
- throw new CliUserError53("--to must be in the past.");
11498
+ throw new CliUserError54("--to must be in the past.");
11142
11499
  await requireConfirmation(env, `Backfill ${workflowKey} ${triggerNodeId} from ${from} to ${to}? Each fire time starts a run (at most ${MAX_BACKFILL_FIRES}) and counts toward the monthly runs.`, options.force);
11143
11500
  const overlapPolicy = parseOverlap(options.overlapPolicy);
11144
11501
  const result = await env.pc.backfillSchedule({
@@ -11190,7 +11547,7 @@ init_json_contract();
11190
11547
  import { readFileSync as readFileSync13 } from "fs";
11191
11548
  import { join as join13, dirname as dirname7 } from "path";
11192
11549
  import { fileURLToPath } from "url";
11193
- import { CliUserError as CliUserError54, defaultOutputAdapter } from "@burdenoff/cli-sdk/core";
11550
+ import { CliUserError as CliUserError55, defaultOutputAdapter } from "@burdenoff/cli-sdk/core";
11194
11551
 
11195
11552
  // src/output/run-envelope.ts
11196
11553
  init_json_contract();
@@ -11617,34 +11974,89 @@ import storeModule from "@burdenoff/cli-sdk/modules/store";
11617
11974
  import devportalModule from "@burdenoff/cli-sdk/modules/devportal";
11618
11975
  import healthModule from "@burdenoff/cli-sdk/modules/health";
11619
11976
 
11977
+ // src/ai/index.ts
11978
+ init_shared();
11979
+ var OUTPUT_OPTION = ["-f, --format <format>", "Output format (json, table, yaml)"];
11980
+ var TIMEOUT_OPTION = [
11981
+ "--timeout <ms>",
11982
+ "Stop waiting for the model after this many milliseconds (the proposal keeps going)",
11983
+ "300000"
11984
+ ];
11985
+ var POLL_OPTION = [
11986
+ "--poll-interval <ms>",
11987
+ "Delay between polls in milliseconds",
11988
+ "2000"
11989
+ ];
11990
+ async function aiEnv(ctx) {
11991
+ await Promise.resolve().then(() => init_api2());
11992
+ return {
11993
+ ctx,
11994
+ ai: createAiApi(ctx),
11995
+ cwd: () => process.cwd(),
11996
+ sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
11997
+ now: () => Date.now()
11998
+ };
11999
+ }
12000
+ var aiModule = {
12001
+ id: "fluidgrids-ai",
12002
+ version: "1.0.0",
12003
+ displayName: "FluidGrids AI commands",
12004
+ dependsOn: ["auth"],
12005
+ register(program, ctx) {
12006
+ const ai = program.command("ai").description("Generate workflows, explain failed runs and propose fixes with AI (drafts only; nothing is activated)");
12007
+ ai.command("generate [goal]").description("Propose a new workflow from a goal (or a change to --workflow) and print the graph diff; --apply creates a DRAFT version").option("--workflow <key>", "Change this workflow instead of proposing a new one").option("--base-version <version>", "With --workflow: the version to change (default: latest)").option("--template <id>", "Starting pattern from the generation templates").option("--model <id>", "Model override").option("--apply", "Create a new DRAFT version from the proposal (never activated)").option("--resume <proposalId>", "Wait for an earlier proposal again (no new AI credit) instead of a goal").option(...TIMEOUT_OPTION).option(...POLL_OPTION).option(...OUTPUT_OPTION).addHelpText("after", [
12008
+ "",
12009
+ "Examples:",
12010
+ ' $ fluidgrids ai generate "notify Slack when a Stripe refund exceeds 500"',
12011
+ ' $ fluidgrids ai generate "notify Slack when a Stripe refund exceeds 500" --apply',
12012
+ ' $ fluidgrids ai generate "retry the HTTP call twice" --workflow refund-alert --apply',
12013
+ "",
12014
+ "Documentation: https://docs.fluidgrids.ai/developers/ai-commands"
12015
+ ].join(`
12016
+ `)).action(async (goal, options, command) => {
12017
+ await Promise.resolve().then(() => init_commands());
12018
+ await runAiGenerate(await aiEnv(ctx), goal, withGlobalFormat(options, command));
12019
+ });
12020
+ ai.command("explain-run <runId>").description("Explain why a run failed: failing node, cause, evidence and suggested fixes (no AI credit)").option(...OUTPUT_OPTION).action(async (runId, options, command) => {
12021
+ await Promise.resolve().then(() => init_commands());
12022
+ await runAiExplainRun(await aiEnv(ctx), runId, withGlobalFormat(options, command));
12023
+ });
12024
+ ai.command("propose-fix <runId>").description("Propose a fix for a failed run and print the graph diff; --apply creates a DRAFT version").option("--prompt <text>", "Extra guidance for the fix").option("--model <id>", "Model override").option("--apply", "Create a new DRAFT version from the fix (never activated)").option("--rerun", "With --apply: re-run the failed input against the new DRAFT as a TEST run").option("--resume <proposalId>", "Wait for an earlier fix of this run again (no new AI credit)").option(...TIMEOUT_OPTION).option(...POLL_OPTION).option(...OUTPUT_OPTION).action(async (runId, options, command) => {
12025
+ await Promise.resolve().then(() => init_commands());
12026
+ await runAiProposeFix(await aiEnv(ctx), runId, withGlobalFormat(options, command));
12027
+ });
12028
+ }
12029
+ };
12030
+ var ai_default = aiModule;
12031
+
11620
12032
  // src/code-first/register.ts
11621
12033
  init_shared();
11622
- import { CliUserError as CliUserError38 } from "@burdenoff/cli-sdk/core";
12034
+ import { CliUserError as CliUserError39 } from "@burdenoff/cli-sdk/core";
11623
12035
  var PROJECT_OPTION = [
11624
12036
  "--project <dir>",
11625
12037
  "Project directory (default: nearest fluidgrids.config.json)"
11626
12038
  ];
11627
- var OUTPUT_OPTION = ["-f, --format <format>", "Output format (json, table, yaml)"];
12039
+ var OUTPUT_OPTION2 = ["-f, --format <format>", "Output format (json, table, yaml)"];
11628
12040
  function registerInit(program, env) {
11629
- program.command("init [dir]").description("Scaffold a code-first workflow project (fluidgrids.config.json, workflows/, lock.json)").option("--lang <lang>", "Project language: ts or py", "ts").option("--workspace <id>", "Workspace to sign in to and record in fluidgrids.config.json").option("--force", "Overwrite existing scaffold files").option("--no-codegen", "Do not generate the node clients now").option("--no-login", "Do not start the device-code login when signed out").option(...OUTPUT_OPTION).action(async (dir, options, command) => {
12041
+ program.command("init [dir]").description("Scaffold a code-first workflow project (fluidgrids.config.json, workflows/, lock.json)").option("--lang <lang>", "Project language: ts or py", "ts").option("--workspace <id>", "Workspace to sign in to and record in fluidgrids.config.json").option("--force", "Overwrite existing scaffold files").option("--no-codegen", "Do not generate the node clients now").option("--no-login", "Do not start the device-code login when signed out").option(...OUTPUT_OPTION2).action(async (dir, options, command) => {
11630
12042
  await Promise.resolve().then(() => init_init());
11631
12043
  await runInit(env, dir, withGlobalFormat(options, command));
11632
12044
  });
11633
12045
  }
11634
12046
  function registerCodegen(program, env) {
11635
- program.command("codegen").description("Regenerate the typed node clients (.fluidgrids/nodes.ts|py) from the workspace registry").option("--lang <lang>", "Client language: ts or py (default: the project language)").option(...PROJECT_OPTION).option(...OUTPUT_OPTION).action(async (options, command) => {
12047
+ program.command("codegen").description("Regenerate the typed node clients (.fluidgrids/nodes.ts|py) from the workspace registry").option("--lang <lang>", "Client language: ts or py (default: the project language)").option(...PROJECT_OPTION).option(...OUTPUT_OPTION2).action(async (options, command) => {
11636
12048
  await Promise.resolve().then(() => init_codegen());
11637
12049
  await runCodegen(env, withGlobalFormat(options, command));
11638
12050
  });
11639
12051
  }
11640
12052
  function registerPull(program, env) {
11641
- program.command("pull [keys...]").description("Export workflows into the project as TypeScript, Python or JSON").option("--as <format>", "Code format: ts, py or json (default: as tracked in lock.json, else the project language); `--format ts|py` also works").option("--check", "Write nothing; print the fidelity report and fail when an export is lossy").option("--wf-version <version>", "Pull this version instead of the latest (one key only)").option("--server", "Render the code on the service instead of locally").option("--pinned-data", "Also write pinned TEST data to workflows/<key>.pinned.json").option(...PROJECT_OPTION).option(...OUTPUT_OPTION).action(async (keys, options, command) => {
12053
+ program.command("pull [keys...]").description("Export workflows into the project as TypeScript, Python or JSON").option("--as <format>", "Code format: ts, py or json (default: as tracked in lock.json, else the project language); `--format ts|py` also works").option("--check", "Write nothing; print the fidelity report and fail when an export is lossy").option("--wf-version <version>", "Pull this version instead of the latest (one key only)").option("--server", "Render the code on the service instead of locally").option("--pinned-data", "Also write pinned TEST data to workflows/<key>.pinned.json").option(...PROJECT_OPTION).option(...OUTPUT_OPTION2).action(async (keys, options, command) => {
11642
12054
  await Promise.resolve().then(() => init_pull());
11643
12055
  await runPull(env, keys, withGlobalFormat(options, command));
11644
12056
  });
11645
12057
  }
11646
12058
  function registerPush(program, env) {
11647
- program.command("push [keys...]").description("Lower the project and create a version for every workflow that changed").option("--dry-run", "Lower, validate and diff against the latest version; create nothing").option("-m, --message <text>", "Description for the new versions").option("--force", "Push even when the workspace has versions newer than the one the project pulled").option("--hotfix <version>", "Replace the code bundle of this existing version instead (durable functions; replay-verified by the service)").option("--replay-sample <n>", "With --hotfix: replay the n latest runs of the version locally first").option("--no-verify-replay", "With --hotfix: skip the service replay verification (audited)").option("--timeout <ms>", "With --hotfix: how long to wait for the replacement job", "600000").option(...PROJECT_OPTION).option(...OUTPUT_OPTION).action(async (keys, options, command) => {
12059
+ program.command("push [keys...]").description("Lower the project and create a version for every workflow that changed").option("--dry-run", "Lower, validate and diff against the latest version; create nothing").option("-m, --message <text>", "Description for the new versions").option("--force", "Push even when the workspace has versions newer than the one the project pulled").option("--hotfix <version>", "Replace the code bundle of this existing version instead (durable functions; replay-verified by the service)").option("--replay-sample <n>", "With --hotfix: replay the n latest runs of the version locally first").option("--no-verify-replay", "With --hotfix: skip the service replay verification (audited)").option("--timeout <ms>", "With --hotfix: how long to wait for the replacement job", "600000").option(...PROJECT_OPTION).option(...OUTPUT_OPTION2).action(async (keys, options, command) => {
11648
12060
  const resolved = withGlobalFormat(options, command);
11649
12061
  if (resolved.hotfix !== undefined) {
11650
12062
  await Promise.resolve().then(() => init_hotfix());
@@ -11656,19 +12068,19 @@ function registerPush(program, env) {
11656
12068
  });
11657
12069
  }
11658
12070
  function registerDiff(program, env) {
11659
- program.command("diff [keys...]").description("IR diff of the local workflows against a stored version").option("--against <version>", "latest, active or a version such as v3", "latest").option("--exit-code", "Exit with status 1 when any workflow differs").option(...PROJECT_OPTION).option(...OUTPUT_OPTION).action(async (keys, options, command) => {
12071
+ program.command("diff [keys...]").description("IR diff of the local workflows against a stored version").option("--against <version>", "latest, active or a version such as v3", "latest").option("--exit-code", "Exit with status 1 when any workflow differs").option(...PROJECT_OPTION).option(...OUTPUT_OPTION2).action(async (keys, options, command) => {
11660
12072
  await Promise.resolve().then(() => init_diff());
11661
12073
  await runDiff(env, keys, withGlobalFormat(options, command));
11662
12074
  });
11663
12075
  }
11664
12076
  function registerValidate(program, env) {
11665
- program.command("validate [keys...]").description("Validate the local workflows as IR v2 (lowered from code where needed)").option("--strict", "Also apply the strict rules: no legacy mirrors, no ${...} templates, slug node ids").option("--remote", "Also validate on the service (task queues, installed nodes)").option("--offline", "Do not contact the workspace; connection names are not resolved").option(...PROJECT_OPTION).option(...OUTPUT_OPTION).action(async (keys, options, command) => {
12077
+ program.command("validate [keys...]").description("Validate the local workflows as IR v2 (lowered from code where needed)").option("--strict", "Also apply the strict rules: no legacy mirrors, no ${...} templates, slug node ids").option("--remote", "Also validate on the service (task queues, installed nodes)").option("--offline", "Do not contact the workspace; connection names are not resolved").option(...PROJECT_OPTION).option(...OUTPUT_OPTION2).action(async (keys, options, command) => {
11666
12078
  await Promise.resolve().then(() => init_validate());
11667
12079
  await runValidate(env, keys, withGlobalFormat(options, command));
11668
12080
  });
11669
12081
  }
11670
12082
  function registerImport(program, env) {
11671
- program.command("import <file>").description("Create a new workflow (DRAFT) from a .json, .ts or .py file; the service lowers TypeScript itself").option("--key <key>", "Workflow key (default: the key the file declares)").option("--name <name>", "Workflow name (default: the name the file declares, else the key)").option("--description <text>", "Description of the new workflow").option("--allow-missing-nodes", "Create it even when nodes it uses are not installed").option("--from <tool>", "Import a workflow exported from another tool: n8n").option("--preview", "With --from: print what the import would create; store nothing").option(...OUTPUT_OPTION).action(async (file, options, command) => {
12083
+ program.command("import <file>").description("Create a new workflow (DRAFT) from a .json, .ts or .py file; the service lowers TypeScript itself").option("--key <key>", "Workflow key (default: the key the file declares)").option("--name <name>", "Workflow name (default: the name the file declares, else the key)").option("--description <text>", "Description of the new workflow").option("--allow-missing-nodes", "Create it even when nodes it uses are not installed").option("--from <tool>", "Import a workflow exported from another tool: n8n").option("--preview", "With --from: print what the import would create; store nothing").option(...OUTPUT_OPTION2).action(async (file, options, command) => {
11672
12084
  const resolved = withGlobalFormat(options, command);
11673
12085
  if (resolved.from !== undefined) {
11674
12086
  await Promise.resolve().then(() => init_n8n_import());
@@ -11677,14 +12089,14 @@ function registerImport(program, env) {
11677
12089
  return;
11678
12090
  }
11679
12091
  if (resolved.preview) {
11680
- throw new CliUserError38("--preview needs --from <tool>.");
12092
+ throw new CliUserError39("--preview needs --from <tool>.");
11681
12093
  }
11682
12094
  await Promise.resolve().then(() => init_import());
11683
12095
  await runImport(env, file, resolved);
11684
12096
  });
11685
12097
  }
11686
12098
  function registerGenerate(program, env) {
11687
- program.command("generate [prompt]").description("Generate a workflow with AI as TypeScript or Python code (the service lifts a validated draft)").option("--as <format>", "Code format: ts or py (default: the project language, else ts); `--format ts|py` also works").option("--out <dir>", "Write the files here (default: the project root, else the current directory)").option("--force", "Overwrite files that differ").option("--import", "Also create the workflow (a DRAFT) from the generated code").option("--key <key>", "With --import: workflow key (default: the key of the generated code)").option("--name <name>", "With --import: workflow name (default: the draft name)").option("--description <text>", "With --import: description of the new workflow").option("--allow-missing-nodes", "With --import: create it even when nodes are not installed").option("--template <id>", "Starting pattern from the generation templates").option("--model <id>", "Model override").option("--timeout <ms>", "Give up waiting for the draft after this many milliseconds", "300000").option("--poll-interval <ms>", "Delay between polls in milliseconds", "2000").option("--resume <generationId>", "Fetch the draft of an earlier generation again (no new generation, no AI credit) instead of a prompt").option(...OUTPUT_OPTION).action(async (prompt, options, command) => {
12099
+ program.command("generate [prompt]").description("Generate a workflow with AI as TypeScript or Python code (the service lifts a validated draft)").option("--as <format>", "Code format: ts or py (default: the project language, else ts); `--format ts|py` also works").option("--out <dir>", "Write the files here (default: the project root, else the current directory)").option("--force", "Overwrite files that differ").option("--import", "Also create the workflow (a DRAFT) from the generated code").option("--key <key>", "With --import: workflow key (default: the key of the generated code)").option("--name <name>", "With --import: workflow name (default: the draft name)").option("--description <text>", "With --import: description of the new workflow").option("--allow-missing-nodes", "With --import: create it even when nodes are not installed").option("--template <id>", "Starting pattern from the generation templates").option("--model <id>", "Model override").option("--timeout <ms>", "Give up waiting for the draft after this many milliseconds", "300000").option("--poll-interval <ms>", "Delay between polls in milliseconds", "2000").option("--resume <generationId>", "Fetch the draft of an earlier generation again (no new generation, no AI credit) instead of a prompt").option(...OUTPUT_OPTION2).action(async (prompt, options, command) => {
11688
12100
  await Promise.resolve().then(() => init_generate());
11689
12101
  await Promise.resolve().then(() => init_shared2());
11690
12102
  await runGenerate(phaseDEnv(env), prompt, withGlobalFormat(options, command));
@@ -11707,24 +12119,24 @@ function addTargetOptions(command) {
11707
12119
  return command.option("--workflow-id <id>", "The latest run of this workflow id instead of a run id (with --key; needs durable-function parity)").option("--key <workflowKey>", "With --workflow-id: the workflow key").option("--first-run-id <id>", "With --workflow-id: only the chain that started with this run");
11708
12120
  }
11709
12121
  function addHistory(parent, env, name) {
11710
- addTargetOptions(parent.command(`${name} [runId]`).description("Download a durable run's event history (a fluidgrids.history file for replay)").option("--out <file>", "Write the history file here instead of printing the events")).option(...OUTPUT_OPTION).action(async (runId, options, command) => {
12122
+ addTargetOptions(parent.command(`${name} [runId]`).description("Download a durable run's event history (a fluidgrids.history file for replay)").option("--out <file>", "Write the history file here instead of printing the events")).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
11711
12123
  await Promise.resolve().then(() => init_runs());
11712
12124
  await runHistory(env, runId, withGlobalFormat(options, command));
11713
12125
  });
11714
12126
  }
11715
12127
  function addSignal(parent, env, name) {
11716
- addTargetOptions(parent.command(`${name} <runIdOrSignal> [signal]`).description("Send a signal to a run (a durable run, or a canvas run waiting for it): `<runId> <signal>`, or `<signal> --workflow-id <id> --key <key>`").option("--payload <json>", "Signal payload (JSON)").option("--idempotency-key <key>", "Deliver at most once for this key")).option(...OUTPUT_OPTION).action(async (first, second, options, command) => {
12128
+ addTargetOptions(parent.command(`${name} <runIdOrSignal> [signal]`).description("Send a signal to a run (a durable run, or a canvas run waiting for it): `<runId> <signal>`, or `<signal> --workflow-id <id> --key <key>`").option("--payload <json>", "Signal payload (JSON)").option("--idempotency-key <key>", "Deliver at most once for this key")).option(...OUTPUT_OPTION2).action(async (first, second, options, command) => {
11717
12129
  await Promise.resolve().then(() => init_runs());
11718
12130
  await runSignal(env, first, second, withGlobalFormat(options, command));
11719
12131
  });
11720
12132
  }
11721
12133
  function registerDurable(program, env) {
11722
12134
  const runs = program.commands.find((command) => command.name() === "runs") ?? program.command("runs").description("FluidGrids workflow runs");
11723
- runs.command("start <workflowKey>").description("Start a durable-function run of a workflow (startWorkflow)").option("--wf-version <version>", "Version (default: the active version)").option("--fn <name>", "Workflow function (default: the single exported one)").option("-i, --input <json>", "Input (JSON)").option("--signal <name[=json]>", "Signal delivered with the start (repeatable)", collect).option("--idempotency-key <key>", "Return the existing run for a repeated key").option("--workflow-id <id>", "Workflow id: unique among the open runs of the key").option("--id-reuse <policy>", "When a closed run has the workflow id: allow-duplicate, allow-duplicate-failed-only or reject-duplicate").option("--id-conflict <policy>", "When an open run has the workflow id: fail, use-existing or terminate-existing").option("--delay <duration>", "Start delay (ms, or 1.5s, 5m, 2h, 2w, PT2H; at most 30 days)").option("--run-timeout <duration>", "Bounds this run; restarts on continue-as-new and retries").option("--execution-timeout <duration>", "Bounds the whole chain under the workflow id").option("--task-timeout <duration>", "Workflow-task budget (at most 120 s)").option("--summary <text>", "One line shown in run lists (at most 200 characters)").option("--details-file <file>", "Markdown shown on the run page (at most 20 KiB)").option("--memo <json>", "The run's memo (a JSON object)").option("--callback <url>", "POSTed to with the outcome once the run (its chain) closes").option("--callback-header <name: value>", "Extra callback request header (repeatable); prefer --callback-header-env for credentials", collect).option("--callback-header-env <name=ENV_VAR>", "Extra callback request header whose value is read from an environment variable (repeatable)", collect).option("--callback-secret-env <name>", "Environment variable holding the callback signing secret (never given on the command line)").option("--priority <n>", "1 (highest) to 5 (default 3)").option("--versioning-behavior <behavior>", "pinned or auto-upgrade").option("--task-queue <name>", "Task queue of the run (a self-hosted queue needs fluidgrids.self-hosted-workers)").option("--fairness-key <key>", "Fairness key of the run and its children (1 to 255 characters)").option("--fairness-weight <n>", "Fairness weight, 0.1 to 10 (default 1)").option("--search-attributes <json>", "Search attributes of the run, a JSON object (needs fluidgrids.search-attributes)").option("--force", "With --id-conflict terminate-existing: skip the confirmation prompt").option("--wait", "Wait for the run to finish and print its output").option(...WAIT_OPTIONS.timeout).option(...WAIT_OPTIONS.poll).option(...OUTPUT_OPTION).action(async (workflowKey, options, command) => {
12135
+ runs.command("start <workflowKey>").description("Start a durable-function run of a workflow (startWorkflow)").option("--wf-version <version>", "Version (default: the active version)").option("--fn <name>", "Workflow function (default: the single exported one)").option("-i, --input <json>", "Input (JSON)").option("--signal <name[=json]>", "Signal delivered with the start (repeatable)", collect).option("--idempotency-key <key>", "Return the existing run for a repeated key").option("--workflow-id <id>", "Workflow id: unique among the open runs of the key").option("--id-reuse <policy>", "When a closed run has the workflow id: allow-duplicate, allow-duplicate-failed-only or reject-duplicate").option("--id-conflict <policy>", "When an open run has the workflow id: fail, use-existing or terminate-existing").option("--delay <duration>", "Start delay (ms, or 1.5s, 5m, 2h, 2w, PT2H; at most 30 days)").option("--run-timeout <duration>", "Bounds this run; restarts on continue-as-new and retries").option("--execution-timeout <duration>", "Bounds the whole chain under the workflow id").option("--task-timeout <duration>", "Workflow-task budget (at most 120 s)").option("--summary <text>", "One line shown in run lists (at most 200 characters)").option("--details-file <file>", "Markdown shown on the run page (at most 20 KiB)").option("--memo <json>", "The run's memo (a JSON object)").option("--callback <url>", "POSTed to with the outcome once the run (its chain) closes").option("--callback-header <name: value>", "Extra callback request header (repeatable); prefer --callback-header-env for credentials", collect).option("--callback-header-env <name=ENV_VAR>", "Extra callback request header whose value is read from an environment variable (repeatable)", collect).option("--callback-secret-env <name>", "Environment variable holding the callback signing secret (never given on the command line)").option("--priority <n>", "1 (highest) to 5 (default 3)").option("--versioning-behavior <behavior>", "pinned or auto-upgrade").option("--task-queue <name>", "Task queue of the run (a self-hosted queue needs fluidgrids.self-hosted-workers)").option("--fairness-key <key>", "Fairness key of the run and its children (1 to 255 characters)").option("--fairness-weight <n>", "Fairness weight, 0.1 to 10 (default 1)").option("--search-attributes <json>", "Search attributes of the run, a JSON object (needs fluidgrids.search-attributes)").option("--force", "With --id-conflict terminate-existing: skip the confirmation prompt").option("--wait", "Wait for the run to finish and print its output").option(...WAIT_OPTIONS.timeout).option(...WAIT_OPTIONS.poll).option(...OUTPUT_OPTION2).action(async (workflowKey, options, command) => {
11724
12136
  await Promise.resolve().then(() => init_runs());
11725
12137
  await runStart(env, workflowKey, withGlobalFormat(options, command));
11726
12138
  });
11727
- addTargetOptions(runs.command("describe [runId]").description("A run with its durable fields (kind, function, build, history length, task state)").option("--pending", "Also show what the run is waiting on (durable-function parity)")).option(...OUTPUT_OPTION).action(async (runId, options, command) => {
12139
+ addTargetOptions(runs.command("describe [runId]").description("A run with its durable fields (kind, function, build, history length, task state)").option("--pending", "Also show what the run is waiting on (durable-function parity)")).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
11728
12140
  await Promise.resolve().then(() => init_runs());
11729
12141
  await runDescribe(env, runId, withGlobalFormat(options, command));
11730
12142
  });
@@ -11733,29 +12145,29 @@ function registerDurable(program, env) {
11733
12145
  const sdkCancel = runs.commands.findIndex((command) => command.name() === "cancel");
11734
12146
  if (sdkCancel >= 0)
11735
12147
  runs.commands.splice(sdkCancel, 1);
11736
- addTargetOptions(runs.command("cancel [runId]").description("Cancel a run (a durable run records WORKFLOW_CANCEL_REQUESTED; its code decides)")).option(...OUTPUT_OPTION).action(async (runId, options, command) => {
12148
+ addTargetOptions(runs.command("cancel [runId]").description("Cancel a run (a durable run records WORKFLOW_CANCEL_REQUESTED; its code decides)")).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
11737
12149
  await Promise.resolve().then(() => init_runs());
11738
12150
  await runCancel(env, runId, withGlobalFormat(options, command));
11739
12151
  });
11740
- addTargetOptions(runs.command("terminate [runId]").description("Terminate a run now: no further code or node runs (both kinds)").option("--reason <text>", "Reason recorded on the run").option("--force", "Skip the confirmation prompt")).option(...OUTPUT_OPTION).action(async (runId, options, command) => {
12152
+ addTargetOptions(runs.command("terminate [runId]").description("Terminate a run now: no further code or node runs (both kinds)").option("--reason <text>", "Reason recorded on the run").option("--force", "Skip the confirmation prompt")).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
11741
12153
  await Promise.resolve().then(() => init_runs());
11742
12154
  await runTerminate(env, runId, withGlobalFormat(options, command));
11743
12155
  });
11744
- addTargetOptions(runs.command("stack [runId]").description("Where a durable run's code is waiting (the __stack_trace query)").option("--enhanced", "Structured trace with source locations (__enhanced_stack_trace)").option("--metadata", "Also the run's __metadata (durable-function parity)")).option(...OUTPUT_OPTION).action(async (runId, options, command) => {
12156
+ addTargetOptions(runs.command("stack [runId]").description("Where a durable run's code is waiting (the __stack_trace query)").option("--enhanced", "Structured trace with source locations (__enhanced_stack_trace)").option("--metadata", "Also the run's __metadata (durable-function parity)")).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
11745
12157
  await Promise.resolve().then(() => init_runs());
11746
12158
  await runStack(env, runId, withGlobalFormat(options, command));
11747
12159
  });
11748
- addTargetOptions(runs.command("result [runId]").description("Wait for a run and print its output (or how it ended)").option("--follow-runs", "Follow continue-as-new and run retries to the run that ends the chain (durable-function parity)").option(...WAIT_OPTIONS.timeout).option(...WAIT_OPTIONS.poll)).option(...OUTPUT_OPTION).action(async (runId, options, command) => {
12160
+ addTargetOptions(runs.command("result [runId]").description("Wait for a run and print its output (or how it ended)").option("--follow-runs", "Follow continue-as-new and run retries to the run that ends the chain (durable-function parity)").option(...WAIT_OPTIONS.timeout).option(...WAIT_OPTIONS.poll)).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
11749
12161
  await Promise.resolve().then(() => init_runs());
11750
12162
  await runResult(env, runId, withGlobalFormat(options, command));
11751
12163
  });
11752
- runs.command("count").description("How many runs match, in total and per group (durable-function parity)").option("--key <workflowKey>", "Only runs of this workflow key").option("--status <status>", "Only runs with this status").option("--kind <kind>", "Only GRAPH or DURABLE_FN runs").option("--workflow-id <id>", "Only runs with this workflow id").option("--first-run-id <id>", "Only the chain that started with this run").option("--root-run-id <id>", "Only runs under this root run").option("--memo <json>", "Only runs whose memo contains this JSON object").option("--group-by <columns>", "Up to two of status, workflow-key, execution-kind, task-queue (comma separated)").option("--group-by-attribute <names>", "Search attributes to group by after --group-by, two columns in all (needs fluidgrids.search-attributes)").option(...OUTPUT_OPTION).action(async (options, command) => {
12164
+ runs.command("count").description("How many runs match, in total and per group (durable-function parity)").option("--key <workflowKey>", "Only runs of this workflow key").option("--status <status>", "Only runs with this status").option("--kind <kind>", "Only GRAPH or DURABLE_FN runs").option("--workflow-id <id>", "Only runs with this workflow id").option("--first-run-id <id>", "Only the chain that started with this run").option("--root-run-id <id>", "Only runs under this root run").option("--memo <json>", "Only runs whose memo contains this JSON object").option("--group-by <columns>", "Up to two of status, workflow-key, execution-kind, task-queue (comma separated)").option("--group-by-attribute <names>", "Search attributes to group by after --group-by, two columns in all (needs fluidgrids.search-attributes)").option(...OUTPUT_OPTION2).action(async (options, command) => {
11753
12165
  await Promise.resolve().then(() => init_runs());
11754
12166
  await runCount(env, withGlobalFormat(options, command));
11755
12167
  });
11756
12168
  addHistory(program, env, "history");
11757
12169
  addSignal(program, env, "signal");
11758
- program.command("replay <history>").description("Replay a history file, a run archive's history.jsonl.gz or a run id against the local code; fails on non-determinism").option("--isolate", "Replay in the QuickJS isolate the managed workers use").option("--debug", "Print the full task result (commands, logs, stack)").option("--trace", "Print every step: the command, the recorded event and the source line").option("--break-on-mismatch", "Stop in an attached debugger where the code diverges").option("--inspect [address]", "Re-run under node --inspect-brk (loopback host:port, default 127.0.0.1:9229); implies --break-on-mismatch").option("--remote-code", "Rebuild the run's exact code from its source archive instead of the local project (asks first: it runs that code here)").option("--yes", "With --remote-code: run the stored code without asking (for scripts)").option(...PROJECT_OPTION).option(...OUTPUT_OPTION).action(async (history, options, command) => {
12170
+ program.command("replay <history>").description("Replay a history file, a run archive's history.jsonl.gz or a run id against the local code; fails on non-determinism").option("--isolate", "Replay in the QuickJS isolate the managed workers use").option("--debug", "Print the full task result (commands, logs, stack)").option("--trace", "Print every step: the command, the recorded event and the source line").option("--break-on-mismatch", "Stop in an attached debugger where the code diverges").option("--inspect [address]", "Re-run under node --inspect-brk (loopback host:port, default 127.0.0.1:9229); implies --break-on-mismatch").option("--remote-code", "Rebuild the run's exact code from its source archive instead of the local project (asks first: it runs that code here)").option("--yes", "With --remote-code: run the stored code without asking (for scripts)").option(...PROJECT_OPTION).option(...OUTPUT_OPTION2).action(async (history, options, command) => {
11759
12171
  const resolved = withGlobalFormat(options, command);
11760
12172
  if (resolved.trace || resolved.breakOnMismatch || resolved.inspect !== undefined || resolved.remoteCode) {
11761
12173
  await Promise.resolve().then(() => init_replay_debug());
@@ -11766,7 +12178,7 @@ function registerDurable(program, env) {
11766
12178
  await Promise.resolve().then(() => init_replay2());
11767
12179
  await runReplay(env, history, resolved);
11768
12180
  });
11769
- program.command("test [workflowKey]").description("Run a workflow's saved test cases on the service (CI: exit 1 on a failure); without a key, the code-first project's test script and history replays").option("--wf-version <version>", "With a key: version or alias (default: ACTIVE, else newest)").option("--case <id>", "With a key: run only this test case (repeatable)", collect).option("--junit <file>", "With a key: write a JUnit XML report").option("--timeout <ms>", "With a key: exit 3 if the suite is not done by then (default 1800000)").option("--poll-interval <ms>", "With a key: delay between polls (default 2000)").option("--replay <dir>", "Without a key: directory of history files to replay locally").option("--isolate", "Without a key: replay in the QuickJS isolate the managed workers use").option("--no-script", "Without a key: do not run the package.json test script").option(...PROJECT_OPTION).option(...OUTPUT_OPTION).action(async (workflowKey, options, command) => {
12181
+ program.command("test [workflowKey]").description("Run a workflow's saved test cases on the service (CI: exit 1 on a failure); without a key, the code-first project's test script and history replays").option("--wf-version <version>", "With a key: version or alias (default: ACTIVE, else newest)").option("--case <id>", "With a key: run only this test case (repeatable)", collect).option("--junit <file>", "With a key: write a JUnit XML report").option("--timeout <ms>", "With a key: exit 3 if the suite is not done by then (default 1800000)").option("--poll-interval <ms>", "With a key: delay between polls (default 2000)").option("--replay <dir>", "Without a key: directory of history files to replay locally").option("--isolate", "Without a key: replay in the QuickJS isolate the managed workers use").option("--no-script", "Without a key: do not run the package.json test script").option(...PROJECT_OPTION).option(...OUTPUT_OPTION2).action(async (workflowKey, options, command) => {
11770
12182
  const resolved = withGlobalFormat(options, command);
11771
12183
  await Promise.resolve().then(() => init_suite());
11772
12184
  if (workflowKey !== undefined) {
@@ -11777,34 +12189,34 @@ function registerDurable(program, env) {
11777
12189
  await Promise.resolve().then(() => init_replay2());
11778
12190
  await runTest(env, codeFirst);
11779
12191
  });
11780
- program.command("run <workflowKey>").description("Trigger a workflow from its version's trigger node, optionally waiting for the result").option("--wf-version <version>", "Version (default: the active version, else the newest)").option("--trigger-node <id>", "Trigger node (default: the only one)").option("-i, --input <json>", "Trigger data (a JSON object)").option("--test", "Run in TEST mode instead of PRODUCTION").option("--workflow-id <id>", "Workflow id: unique among the open runs of the key").option("--id-conflict <policy>", "When an open run has the workflow id: fail, use-existing or terminate-existing").option("--delay <duration>", "Start delay (ms, or 1.5s, 5m, 2h, 2w, PT2H; at most 30 days; not with --test)").option("--force", "With --id-conflict terminate-existing: skip the confirmation prompt").option("--wait", "Wait for the run to finish").option(...WAIT_OPTIONS.timeout).option(...WAIT_OPTIONS.poll).option(...OUTPUT_OPTION).action(async (workflowKey, options, command) => {
12192
+ program.command("run <workflowKey>").description("Trigger a workflow from its version's trigger node, optionally waiting for the result").option("--wf-version <version>", "Version (default: the active version, else the newest)").option("--trigger-node <id>", "Trigger node (default: the only one)").option("-i, --input <json>", "Trigger data (a JSON object)").option("--test", "Run in TEST mode instead of PRODUCTION").option("--workflow-id <id>", "Workflow id: unique among the open runs of the key").option("--id-conflict <policy>", "When an open run has the workflow id: fail, use-existing or terminate-existing").option("--delay <duration>", "Start delay (ms, or 1.5s, 5m, 2h, 2w, PT2H; at most 30 days; not with --test)").option("--force", "With --id-conflict terminate-existing: skip the confirmation prompt").option("--wait", "Wait for the run to finish").option(...WAIT_OPTIONS.timeout).option(...WAIT_OPTIONS.poll).option(...OUTPUT_OPTION2).action(async (workflowKey, options, command) => {
11781
12193
  await Promise.resolve().then(() => init_runs());
11782
12194
  await runRun(env, workflowKey, withGlobalFormat(options, command));
11783
12195
  });
11784
12196
  const versions = program.command("versions").description("Workflow versions, their code bundles, rollouts and drainage");
11785
- versions.command("list <workflowKey>").description("Every stored version with the code bundle it runs").option(...OUTPUT_OPTION).action(async (workflowKey, options, command) => {
12197
+ versions.command("list <workflowKey>").description("Every stored version with the code bundle it runs").option(...OUTPUT_OPTION2).action(async (workflowKey, options, command) => {
11786
12198
  await Promise.resolve().then(() => init_versions());
11787
12199
  await runVersionsList(env, workflowKey, withGlobalFormat(options, command));
11788
12200
  });
11789
- const rollout = versions.command("rollout").description("Show the rollouts of a workflow, or send --percent of its new starts to --to (durable-function parity)").argument("<workflowKey>", "Workflow key").option("--to <version>", "The version a share of new starts runs").option("--percent <n>", "0 to 100; 100 promotes --to (activates it after its check)").option("--from <version>", "The ACTIVE version the rollout starts from (the default)").option("--environment <env>", "PROD (the only one in this release)").option(...OUTPUT_OPTION).enablePositionalOptions().action(async (workflowKey, options, command) => {
12201
+ const rollout = versions.command("rollout").description("Show the rollouts of a workflow, or send --percent of its new starts to --to (durable-function parity)").argument("<workflowKey>", "Workflow key").option("--to <version>", "The version a share of new starts runs").option("--percent <n>", "0 to 100; 100 promotes --to (activates it after its check)").option("--from <version>", "The ACTIVE version the rollout starts from (the default)").option("--environment <env>", "PROD (the only one in this release)").option(...OUTPUT_OPTION2).enablePositionalOptions().action(async (workflowKey, options, command) => {
11790
12202
  await Promise.resolve().then(() => init_versions());
11791
12203
  await runRollout(env, workflowKey, withGlobalFormat(options, command));
11792
12204
  });
11793
- rollout.command("delete <workflowKey>").description("Remove a rollout: new starts run the ACTIVE version again").option("--environment <env>", "PROD (the default)").option("--force", "Skip the confirmation prompt").option(...OUTPUT_OPTION).action(async (workflowKey, options, command) => {
12205
+ rollout.command("delete <workflowKey>").description("Remove a rollout: new starts run the ACTIVE version again").option("--environment <env>", "PROD (the default)").option("--force", "Skip the confirmation prompt").option(...OUTPUT_OPTION2).action(async (workflowKey, options, command) => {
11794
12206
  await Promise.resolve().then(() => init_versions());
11795
12207
  await runRolloutDelete(env, workflowKey, withGlobalFormat(rolloutDeleteOptions(options, command.parent?.opts() ?? {}), command));
11796
12208
  });
11797
- versions.command("drainage <workflowKey> <version>").description("Whether a version's bundle still serves open runs (durable-function parity)").option(...OUTPUT_OPTION).action(async (workflowKey, version, options, command) => {
12209
+ versions.command("drainage <workflowKey> <version>").description("Whether a version's bundle still serves open runs (durable-function parity)").option(...OUTPUT_OPTION2).action(async (workflowKey, version, options, command) => {
11798
12210
  await Promise.resolve().then(() => init_versions());
11799
12211
  await runDrainage(env, workflowKey, version, withGlobalFormat(options, command));
11800
12212
  });
11801
- addTargetOptions(versions.command("override [runId]").description("Set or clear a run's versioning override (durable-function parity); a move to another bundle is replay-checked first").option("--pin <version>", "Pin the run to this version's bundle").option("--auto-upgrade", "Move the run to the ACTIVE version's bundle at each task").option("--clear", "Remove the override").option("--reason <text>", "Reason recorded on the run")).option(...OUTPUT_OPTION).action(async (runId, options, command) => {
12213
+ addTargetOptions(versions.command("override [runId]").description("Set or clear a run's versioning override (durable-function parity); a move to another bundle is replay-checked first").option("--pin <version>", "Pin the run to this version's bundle").option("--auto-upgrade", "Move the run to the ACTIVE version's bundle at each task").option("--clear", "Remove the override").option("--reason <text>", "Reason recorded on the run")).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
11802
12214
  await Promise.resolve().then(() => init_versions());
11803
12215
  await runOverride(env, runId, withGlobalFormat(options, command));
11804
12216
  });
11805
12217
  }
11806
12218
  function registerDeploy(program, env) {
11807
- program.command("deploy <workflowKey>").description("Deploy a version to DEV, or promote it to STAGING or PROD (waits for an approver; --ramp sets a gradual PROD rollout)").option("--env <env>", "dev, staging or prod").option("--wf-version <version>", "dev: the version to deploy (default: the newest; `active` names the ACTIVE one). staging/prod: refuse unless the source environment holds it").option("--ramp <n>", "prod only: 0 to 99 sends n% of new automatic starts to the STAGING version (durable functions); 100 promotes it in full").option("--note <text>", "Context for the approver of a promotion request").option("--no-wait", "Return once the promotion request is made instead of waiting for it").option("--timeout <ms>", "Give up waiting for an approver after this many milliseconds (the request stays open)", "900000").option("--poll-interval <ms>", "Delay between polls of the request in milliseconds", "5000").option(...OUTPUT_OPTION).action(async (workflowKey, options, command) => {
12219
+ program.command("deploy <workflowKey>").description("Deploy a version to DEV, or promote it to STAGING or PROD (waits for an approver; --ramp sets a gradual PROD rollout)").option("--env <env>", "dev, staging or prod").option("--wf-version <version>", "dev: the version to deploy (default: the newest; `active` names the ACTIVE one). staging/prod: refuse unless the source environment holds it").option("--ramp <n>", "prod only: 0 to 99 sends n% of new automatic starts to the STAGING version (durable functions); 100 promotes it in full").option("--note <text>", "Context for the approver of a promotion request").option("--no-wait", "Return once the promotion request is made instead of waiting for it").option("--timeout <ms>", "Give up waiting for an approver after this many milliseconds (the request stays open)", "900000").option("--poll-interval <ms>", "Delay between polls of the request in milliseconds", "5000").option(...OUTPUT_OPTION2).action(async (workflowKey, options, command) => {
11808
12220
  await Promise.resolve().then(() => init_deploy());
11809
12221
  await runDeploy(env, workflowKey, withGlobalFormat(options, command));
11810
12222
  });
@@ -11837,7 +12249,7 @@ var code_first_default = codeFirstModule;
11837
12249
  // src/mcp/index.ts
11838
12250
  init_bridge();
11839
12251
  import { createInterface as createInterface4 } from "readline";
11840
- import { CliUserError as CliUserError39 } from "@burdenoff/cli-sdk/core";
12252
+ import { CliUserError as CliUserError40 } from "@burdenoff/cli-sdk/core";
11841
12253
  var mcpModule = {
11842
12254
  id: "fluidgrids-mcp",
11843
12255
  version: "1.0.0",
@@ -11882,7 +12294,7 @@ var mcpModule = {
11882
12294
  });
11883
12295
  } catch (error) {
11884
12296
  if (error instanceof McpBridgeConfigError)
11885
- throw new CliUserError39(error.message);
12297
+ throw new CliUserError40(error.message);
11886
12298
  throw error;
11887
12299
  } finally {
11888
12300
  lines.close();
@@ -11897,7 +12309,7 @@ init_shared();
11897
12309
 
11898
12310
  // src/phase-c/register.ts
11899
12311
  init_shared();
11900
- var OUTPUT_OPTION2 = ["-f, --format <format>", "Output format (json, table, yaml)"];
12312
+ var OUTPUT_OPTION3 = ["-f, --format <format>", "Output format (json, table, yaml)"];
11901
12313
  var PROJECT_OPTION2 = [
11902
12314
  "--project <dir>",
11903
12315
  "Project directory (default: nearest fluidgrids.config.json)"
@@ -11949,84 +12361,84 @@ function registerConfig(program, env) {
11949
12361
  const profile = command.optsWithGlobals()["profile"];
11950
12362
  return typeof profile === "string" ? { ...resolved, profile } : resolved;
11951
12363
  };
11952
- config.command("set <key> [value]").description("Set a profile key (apiUrl, workspace, product, environment, tokenRef, codecServerUrl, payloadConverter), `token` (into the OS keychain, from stdin or --from-env) or `defaultProfile`").option("--from-env <VAR>", "With `token`: read the token from this environment variable").option(...OUTPUT_OPTION2).action(async (key, value, options, command) => {
11953
- await Promise.resolve().then(() => init_commands());
12364
+ config.command("set <key> [value]").description("Set a profile key (apiUrl, workspace, product, environment, tokenRef, codecServerUrl, payloadConverter), `token` (into the OS keychain, from stdin or --from-env) or `defaultProfile`").option("--from-env <VAR>", "With `token`: read the token from this environment variable").option(...OUTPUT_OPTION3).action(async (key, value, options, command) => {
12365
+ await Promise.resolve().then(() => init_commands2());
11954
12366
  await runConfigSet(await configEnv(), key, value, withProfile(options, command));
11955
12367
  });
11956
- config.command("get [key]").description("The resolved profile (environment overrides included); never a token").option(...OUTPUT_OPTION2).action(async (key, options, command) => {
11957
- await Promise.resolve().then(() => init_commands());
12368
+ config.command("get [key]").description("The resolved profile (environment overrides included); never a token").option(...OUTPUT_OPTION3).action(async (key, options, command) => {
12369
+ await Promise.resolve().then(() => init_commands2());
11958
12370
  await runConfigGet(await configEnv(), key, withProfile(options, command));
11959
12371
  });
11960
- config.command("list").description("Every profile of the config file").option(...OUTPUT_OPTION2).action(async (options, command) => {
11961
- await Promise.resolve().then(() => init_commands());
12372
+ config.command("list").description("Every profile of the config file").option(...OUTPUT_OPTION3).action(async (options, command) => {
12373
+ await Promise.resolve().then(() => init_commands2());
11962
12374
  await runConfigList(await configEnv(), withProfile(options, command));
11963
12375
  });
11964
- config.command("delete [key]").description("Remove a key, or the whole profile (and the keychain token the CLI stored for it)").option("--keep-token", "With no key: keep the keychain token").option(...OUTPUT_OPTION2).action(async (key, options, command) => {
11965
- await Promise.resolve().then(() => init_commands());
12376
+ config.command("delete [key]").description("Remove a key, or the whole profile (and the keychain token the CLI stored for it)").option("--keep-token", "With no key: keep the keychain token").option(...OUTPUT_OPTION3).action(async (key, options, command) => {
12377
+ await Promise.resolve().then(() => init_commands2());
11966
12378
  await runConfigDelete(await configEnv(), key, withProfile(options, command));
11967
12379
  });
11968
- config.command("migrate").description("Write the CLI's current workspace endpoint and workspace into a profile (tokens are never copied)").option("--token-env <VAR>", "Point the profile's tokenRef at this environment variable").option("--set-default", "Make it the default profile").option(...OUTPUT_OPTION2).action(async (options, command) => {
11969
- await Promise.resolve().then(() => init_commands());
12380
+ config.command("migrate").description("Write the CLI's current workspace endpoint and workspace into a profile (tokens are never copied)").option("--token-env <VAR>", "Point the profile's tokenRef at this environment variable").option("--set-default", "Make it the default profile").option(...OUTPUT_OPTION3).action(async (options, command) => {
12381
+ await Promise.resolve().then(() => init_commands2());
11970
12382
  await runConfigMigrate(await configEnv(), withProfile(options, command));
11971
12383
  });
11972
12384
  }
11973
12385
  function registerQueues(program, make) {
11974
12386
  const queues = program.command("queues").description("Task queues: managed and the self-hosted queues of the workspace");
11975
- queues.command("list").description("The workspace task queues (taskQueues)").option(...OUTPUT_OPTION2).action(async (options, command) => {
12387
+ queues.command("list").description("The workspace task queues (taskQueues)").option(...OUTPUT_OPTION3).action(async (options, command) => {
11976
12388
  await Promise.resolve().then(() => init_queues());
11977
12389
  await runQueuesList(await make(), withGlobalFormat(options, command));
11978
12390
  });
11979
- queues.command("describe <name>").description("Backlog, rates, pollers and workers of a queue (taskQueueStats, taskQueueWorkers)").option("--environment <env>", "DEV, STAGING or PROD (an environment-scoped queue)").option(...OUTPUT_OPTION2).action(async (name, options, command) => {
12391
+ queues.command("describe <name>").description("Backlog, rates, pollers and workers of a queue (taskQueueStats, taskQueueWorkers)").option("--environment <env>", "DEV, STAGING or PROD (an environment-scoped queue)").option(...OUTPUT_OPTION3).action(async (name, options, command) => {
11980
12392
  await Promise.resolve().then(() => init_queues());
11981
12393
  await runQueuesDescribe(await make(), name, withGlobalFormat(options, command));
11982
12394
  });
11983
- queues.command("create <name>").description("Create a self-hosted task queue (needs fluidgrids.self-hosted-workers)").option("--environment <env>", "Scope it to DEV, STAGING or PROD (default: every environment)").option("--description <text>", "Description").option("--max-tasks-per-second <n>", "Activity dispatch rate limit (0.01 to 10000)").option("--worker-unavailable-timeout <seconds>", "How long an activity waits for a worker (10 s to 7 days; default 600)").option(...OUTPUT_OPTION2).action(async (name, options, command) => {
12395
+ queues.command("create <name>").description("Create a self-hosted task queue (needs fluidgrids.self-hosted-workers)").option("--environment <env>", "Scope it to DEV, STAGING or PROD (default: every environment)").option("--description <text>", "Description").option("--max-tasks-per-second <n>", "Activity dispatch rate limit (0.01 to 10000)").option("--worker-unavailable-timeout <seconds>", "How long an activity waits for a worker (10 s to 7 days; default 600)").option(...OUTPUT_OPTION3).action(async (name, options, command) => {
11984
12396
  await Promise.resolve().then(() => init_queues());
11985
12397
  await runQueuesCreate(await make(), name, withGlobalFormat(options, command));
11986
12398
  });
11987
- queues.command("update <name>").description("Change a queue's description, rate limit or worker-unavailable timeout").option("--environment <env>", "The environment-scoped row to change").option("--description <text>", "New description (an empty string clears it)").option("--max-tasks-per-second <n>", "New rate limit").option("--clear-max-tasks-per-second", "Remove the rate limit").option("--worker-unavailable-timeout <seconds>", "New worker-unavailable timeout").option(...OUTPUT_OPTION2).action(async (name, options, command) => {
12399
+ queues.command("update <name>").description("Change a queue's description, rate limit or worker-unavailable timeout").option("--environment <env>", "The environment-scoped row to change").option("--description <text>", "New description (an empty string clears it)").option("--max-tasks-per-second <n>", "New rate limit").option("--clear-max-tasks-per-second", "Remove the rate limit").option("--worker-unavailable-timeout <seconds>", "New worker-unavailable timeout").option(...OUTPUT_OPTION3).action(async (name, options, command) => {
11988
12400
  await Promise.resolve().then(() => init_queues());
11989
12401
  await runQueuesUpdate(await make(), name, withGlobalFormat(options, command));
11990
12402
  });
11991
- queues.command("delete <name>").description("Delete a self-hosted queue (refused while open runs or activities use it)").option("--environment <env>", "The environment-scoped row to delete").option(...FORCE_OPTION).option(...OUTPUT_OPTION2).action(async (name, options, command) => {
12403
+ queues.command("delete <name>").description("Delete a self-hosted queue (refused while open runs or activities use it)").option("--environment <env>", "The environment-scoped row to delete").option(...FORCE_OPTION).option(...OUTPUT_OPTION3).action(async (name, options, command) => {
11992
12404
  await Promise.resolve().then(() => init_queues());
11993
12405
  await runQueuesDelete(await make(), name, withGlobalFormat(options, command));
11994
12406
  });
11995
- queues.command("builds <name>").description("The build ids the queue's workers serve").option(...OUTPUT_OPTION2).action(async (name, options, command) => {
12407
+ queues.command("builds <name>").description("The build ids the queue's workers serve").option(...OUTPUT_OPTION3).action(async (name, options, command) => {
11996
12408
  await Promise.resolve().then(() => init_queues());
11997
12409
  await runQueuesBuilds(await make(), name, withGlobalFormat(options, command));
11998
12410
  });
11999
12411
  }
12000
12412
  function registerWorkers(program, make) {
12001
12413
  const workers = program.command("workers").description("Self-hosted workers of the workspace and their worker tokens");
12002
- workers.command("list").description("Connected (and recently ended) self-hosted workers (workflowWorkers)").option("--queue <name>", "Only workers serving this task queue (name, or name@dev|staging|prod for one environment)").option("--build-id <id>", "Only workers serving this build").option("--stale", "Only stale workers (silent for 2 minutes)").option("--not-stale", "Only workers that are not stale").option("--include-ended", "Also workers that disconnected in the last 7 days").option(...OUTPUT_OPTION2).action(async (options, command) => {
12414
+ workers.command("list").description("Connected (and recently ended) self-hosted workers (workflowWorkers)").option("--queue <name>", "Only workers serving this task queue (name, or name@dev|staging|prod for one environment)").option("--build-id <id>", "Only workers serving this build").option("--stale", "Only stale workers (silent for 2 minutes)").option("--not-stale", "Only workers that are not stale").option("--include-ended", "Also workers that disconnected in the last 7 days").option(...OUTPUT_OPTION3).action(async (options, command) => {
12003
12415
  await Promise.resolve().then(() => init_workers());
12004
12416
  await runWorkersList(await make(), withGlobalFormat(options, command));
12005
12417
  });
12006
12418
  const tokens = workers.command("tokens").description("Worker tokens (fgr_…)");
12007
- tokens.command("list").description("The worker tokens (never the tokens themselves)").option(...OUTPUT_OPTION2).action(async (options, command) => {
12419
+ tokens.command("list").description("The worker tokens (never the tokens themselves)").option(...OUTPUT_OPTION3).action(async (options, command) => {
12008
12420
  await Promise.resolve().then(() => init_workers());
12009
12421
  await runTokensList(await make(), withGlobalFormat(options, command));
12010
12422
  });
12011
- tokens.command("create <name>").description("Issue a worker token for task queues; it is shown once").option("--queue <names>", "Self-hosted task queue, or name@dev|staging|prod to bind the token to one environment (comma separated, repeatable)", collect2).option("--allow-connection <names>", "Connections user activities may resolve through it (workspace admins; repeatable)", collect2).option(...OUTPUT_OPTION2).action(async (name, options, command) => {
12423
+ tokens.command("create <name>").description("Issue a worker token for task queues; it is shown once").option("--queue <names>", "Self-hosted task queue, or name@dev|staging|prod to bind the token to one environment (comma separated, repeatable)", collect2).option("--allow-connection <names>", "Connections user activities may resolve through it (workspace admins; repeatable)", collect2).option(...OUTPUT_OPTION3).action(async (name, options, command) => {
12012
12424
  await Promise.resolve().then(() => init_workers());
12013
12425
  await runTokensCreate(await make(), name, withGlobalFormat(options, command));
12014
12426
  });
12015
- tokens.command("rotate <id>").description("Issue a new token; the old one stops working and its workers disconnect").option(...FORCE_OPTION).option(...OUTPUT_OPTION2).action(async (id, options, command) => {
12427
+ tokens.command("rotate <id>").description("Issue a new token; the old one stops working and its workers disconnect").option(...FORCE_OPTION).option(...OUTPUT_OPTION3).action(async (id, options, command) => {
12016
12428
  await Promise.resolve().then(() => init_workers());
12017
12429
  await runTokensRotate(await make(), id, withGlobalFormat(options, command));
12018
12430
  });
12019
- tokens.command("delete <id>").description("Delete a worker token; its workers disconnect").option(...FORCE_OPTION).option(...OUTPUT_OPTION2).action(async (id, options, command) => {
12431
+ tokens.command("delete <id>").description("Delete a worker token; its workers disconnect").option(...FORCE_OPTION).option(...OUTPUT_OPTION3).action(async (id, options, command) => {
12020
12432
  await Promise.resolve().then(() => init_workers());
12021
12433
  await runTokensDelete(await make(), id, withGlobalFormat(options, command));
12022
12434
  });
12023
- tokens.command("allow-connections <id> [names...]").description("Replace the connections user activities may resolve through a token (workspace admins; each release is audited)").option("--clear", "Allow no connection").option(...OUTPUT_OPTION2).action(async (id, names, options, command) => {
12435
+ tokens.command("allow-connections <id> [names...]").description("Replace the connections user activities may resolve through a token (workspace admins; each release is audited)").option("--clear", "Allow no connection").option(...OUTPUT_OPTION3).action(async (id, names, options, command) => {
12024
12436
  await Promise.resolve().then(() => init_workers());
12025
12437
  await runTokensAllowConnections(await make(), id, names, withGlobalFormat(options, command));
12026
12438
  });
12027
12439
  }
12028
12440
  function addWorkerOptions(command) {
12029
- return command.option("--activities <module>", "Activities to serve: a .ts/.js module (TypeScript) or a module name (Python)").option("--no-workflows", "Serve activities only, no workflow bundle").option("--identity <name>", "Worker identity (default hostname@pid)").option("--max-concurrent-activities <n>", "Activity slots (default 100)").option("--max-concurrent-workflow-tasks <n>", "Workflow task slots (default 4)").option("--max-activities-per-second <n>", "This worker's activity start rate").option("--metrics-port <port>", "Serve Prometheus metrics on 127.0.0.1:<port>").option("--bridge-url <url>", "Bridge URL (default FLUIDGRIDS_BRIDGE_URL, else the workspace gateway /runner-bridge)").option(...PROJECT_OPTION2).option(...OUTPUT_OPTION2);
12441
+ return command.option("--activities <module>", "Activities to serve: a .ts/.js module (TypeScript) or a module name (Python)").option("--no-workflows", "Serve activities only, no workflow bundle").option("--identity <name>", "Worker identity (default hostname@pid)").option("--max-concurrent-activities <n>", "Activity slots (default 100)").option("--max-concurrent-workflow-tasks <n>", "Workflow task slots (default 4)").option("--max-activities-per-second <n>", "This worker's activity start rate").option("--metrics-port <port>", "Serve Prometheus metrics on 127.0.0.1:<port>").option("--bridge-url <url>", "Bridge URL (default FLUIDGRIDS_BRIDGE_URL, else the workspace gateway /runner-bridge)").option(...PROJECT_OPTION2).option(...OUTPUT_OPTION3);
12030
12442
  }
12031
12443
  function registerWorkerRun(program, make) {
12032
12444
  const worker = program.command("worker").description("Run a self-hosted worker for the project");
@@ -12044,42 +12456,42 @@ function runsGroup(program) {
12044
12456
  }
12045
12457
  function registerRunControl(program, make) {
12046
12458
  const runs = runsGroup(program);
12047
- addTargetOptions2(runs.command("query <runIdOrName> [name]").description("Ask a run a question without changing it: `<runId> <name>`, or `<name> --workflow-id <id> --key <key>` (needs fluidgrids.run-control)").option("--args <json>", "Query arguments (JSON)").option("--reject-condition <condition>", "none, not-open or not-completed-cleanly")).option(...OUTPUT_OPTION2).action(async (first, second, options, command) => {
12459
+ addTargetOptions2(runs.command("query <runIdOrName> [name]").description("Ask a run a question without changing it: `<runId> <name>`, or `<name> --workflow-id <id> --key <key>` (needs fluidgrids.run-control)").option("--args <json>", "Query arguments (JSON)").option("--reject-condition <condition>", "none, not-open or not-completed-cleanly")).option(...OUTPUT_OPTION3).action(async (first, second, options, command) => {
12048
12460
  await Promise.resolve().then(() => init_run_control());
12049
12461
  await runQuery(await make(), first, second, withGlobalFormat(options, command));
12050
12462
  });
12051
- addTargetOptions2(runs.command("update <runIdOrName> [name]").description("Send an update to a durable run and wait for it (needs fluidgrids.run-control): `<runId> <name>`").option("--args <json>", "Update arguments (JSON)").option("--update-id <id>", "Idempotency id (default a new UUID)").option("--wait-for <stage>", "accepted or completed (default completed)").option("--timeout <ms>", "Give up waiting after this many milliseconds", "60000").option("--poll-interval <ms>", "Delay between polls of an accepted update", "1000")).option(...OUTPUT_OPTION2).action(async (first, second, options, command) => {
12463
+ addTargetOptions2(runs.command("update <runIdOrName> [name]").description("Send an update to a durable run and wait for it (needs fluidgrids.run-control): `<runId> <name>`").option("--args <json>", "Update arguments (JSON)").option("--update-id <id>", "Idempotency id (default a new UUID)").option("--wait-for <stage>", "accepted or completed (default completed)").option("--timeout <ms>", "Give up waiting after this many milliseconds", "60000").option("--poll-interval <ms>", "Delay between polls of an accepted update", "1000")).option(...OUTPUT_OPTION3).action(async (first, second, options, command) => {
12052
12464
  await Promise.resolve().then(() => init_run_control());
12053
12465
  await runUpdate(await make(), first, second, withGlobalFormat(options, command));
12054
12466
  });
12055
- addTargetOptions2(runs.command("update-status <runIdOrUpdateId> [updateId]").description("One update of a run by its update id (workflowRunUpdate): `<runId> <updateId>`")).option(...OUTPUT_OPTION2).action(async (first, second, options, command) => {
12467
+ addTargetOptions2(runs.command("update-status <runIdOrUpdateId> [updateId]").description("One update of a run by its update id (workflowRunUpdate): `<runId> <updateId>`")).option(...OUTPUT_OPTION3).action(async (first, second, options, command) => {
12056
12468
  await Promise.resolve().then(() => init_run_control());
12057
12469
  await runUpdateStatus(await make(), first, second, withGlobalFormat(options, command));
12058
12470
  });
12059
- addTargetOptions2(runs.command("reset [runId]").description("Reset a durable run to a completed workflow task; a new run continues from there (needs fluidgrids.run-control)").option("--to <point>", "A history seq, first-task, last-task, last-continue-as-new, build-id or last-clean-task").option("--build-id <id>", "With --to build-id: the bundle the reset steps back from").option("--reason <text>", "Reason recorded on both runs").option("--no-reapply-signals", "Do not re-apply the signals received after the reset point").option("--no-reapply-updates", "Do not re-apply the updates accepted after the reset point").option(...FORCE_OPTION)).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
12471
+ addTargetOptions2(runs.command("reset [runId]").description("Reset a durable run to a completed workflow task; a new run continues from there (needs fluidgrids.run-control)").option("--to <point>", "A history seq, first-task, last-task, last-continue-as-new, build-id or last-clean-task").option("--build-id <id>", "With --to build-id: the bundle the reset steps back from").option("--reason <text>", "Reason recorded on both runs").option("--no-reapply-signals", "Do not re-apply the signals received after the reset point").option("--no-reapply-updates", "Do not re-apply the updates accepted after the reset point").option(...FORCE_OPTION)).option(...OUTPUT_OPTION3).action(async (runId, options, command) => {
12060
12472
  await Promise.resolve().then(() => init_run_control());
12061
12473
  await runReset(await make(), runId, withGlobalFormat(options, command));
12062
12474
  });
12063
- addTargetOptions2(runs.command("trace [runId]").description("The run hierarchy with what each open run waits on (workflowRunHierarchy, pending)")).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
12475
+ addTargetOptions2(runs.command("trace [runId]").description("The run hierarchy with what each open run waits on (workflowRunHierarchy, pending)")).option(...OUTPUT_OPTION3).action(async (runId, options, command) => {
12064
12476
  await Promise.resolve().then(() => init_run_control());
12065
12477
  await runTrace(await make(), runId, withGlobalFormat(options, command));
12066
12478
  });
12067
- addActivityOptionFlags(addSelectorOptions(runs.command("batch <type>").description("Apply an operation to many runs: signal, cancel, terminate, reset, pause-activity, unpause-activity, reset-activity, update-activity-options, update-run-options or export (needs fluidgrids.run-control)").option("--run-id <ids>", "The runs (comma separated, repeatable; at most 1,000)", collect2).option("--key <workflowKey>", "Filter: runs of this workflow key").option("--status <status>", "Filter: runs with this status").option("--kind <kind>", "Filter: GRAPH or DURABLE_FN runs").option("--workflow-id <id>", "Filter: runs with this workflow id").option("--first-run-id <id>", "Filter: the chain that started with this run").option("--search-attributes <json>", "Filter: a search-attribute filter ({and, or, text}; needs fluidgrids.search-attributes)").option("--filter <json>", "Filter: a ListWorkflowRunsInput object").option("--reason <text>", "Why (recorded with the job and each operation)").option("--rate <n>", "Operations per second, 1 to 50 (default 50)").option("--dry-run", "Count the runs the job would select; start nothing").option("--signal <name>", "signal: the signal to send").option("--payload <json>", "signal: its payload").option("--to <point>", "reset: where to reset each run").option("--build-id <id>", "reset --to build-id: the bundle to step back from").option("--no-reapply-signals", "reset: do not re-apply signals").option("--no-reapply-updates", "reset: do not re-apply updates").option("--reset-attempts", "unpause-activity: restart the attempt count").option("--reset-heartbeat", "unpause-activity, reset-activity: drop heartbeat details").option("--pin <version>", "update-run-options: pin each run to this version").option("--auto-upgrade", "update-run-options: move each run to the active version").option("--clear-override", "update-run-options: remove each run's override").option(...FORCE_OPTION))).option(...OUTPUT_OPTION2).action(async (type, options, command) => {
12479
+ addActivityOptionFlags(addSelectorOptions(runs.command("batch <type>").description("Apply an operation to many runs: signal, cancel, terminate, reset, pause-activity, unpause-activity, reset-activity, update-activity-options, update-run-options or export (needs fluidgrids.run-control)").option("--run-id <ids>", "The runs (comma separated, repeatable; at most 1,000)", collect2).option("--key <workflowKey>", "Filter: runs of this workflow key").option("--status <status>", "Filter: runs with this status").option("--kind <kind>", "Filter: GRAPH or DURABLE_FN runs").option("--workflow-id <id>", "Filter: runs with this workflow id").option("--first-run-id <id>", "Filter: the chain that started with this run").option("--search-attributes <json>", "Filter: a search-attribute filter ({and, or, text}; needs fluidgrids.search-attributes)").option("--filter <json>", "Filter: a ListWorkflowRunsInput object").option("--reason <text>", "Why (recorded with the job and each operation)").option("--rate <n>", "Operations per second, 1 to 50 (default 50)").option("--dry-run", "Count the runs the job would select; start nothing").option("--signal <name>", "signal: the signal to send").option("--payload <json>", "signal: its payload").option("--to <point>", "reset: where to reset each run").option("--build-id <id>", "reset --to build-id: the bundle to step back from").option("--no-reapply-signals", "reset: do not re-apply signals").option("--no-reapply-updates", "reset: do not re-apply updates").option("--reset-attempts", "unpause-activity: restart the attempt count").option("--reset-heartbeat", "unpause-activity, reset-activity: drop heartbeat details").option("--pin <version>", "update-run-options: pin each run to this version").option("--auto-upgrade", "update-run-options: move each run to the active version").option("--clear-override", "update-run-options: remove each run's override").option(...FORCE_OPTION))).option(...OUTPUT_OPTION3).action(async (type, options, command) => {
12068
12480
  await Promise.resolve().then(() => init_batch());
12069
12481
  await runBatchStart(await make(), type, withGlobalFormat(options, command));
12070
12482
  });
12071
12483
  }
12072
12484
  function registerBatch(program, make) {
12073
12485
  const batch = program.command("batch").description("Batch operations over runs (start one with `runs batch <type>`)");
12074
- batch.command("list").description("The workspace batch jobs, newest first").option("--status <status>", "PENDING, RUNNING, COMPLETED, FAILED or CANCELLED").option("--limit <n>", "Jobs per page (default 20)").option("--after <cursor>", "The next page").option(...OUTPUT_OPTION2).action(async (options, command) => {
12486
+ batch.command("list").description("The workspace batch jobs, newest first").option("--status <status>", "PENDING, RUNNING, COMPLETED, FAILED or CANCELLED").option("--limit <n>", "Jobs per page (default 20)").option("--after <cursor>", "The next page").option(...OUTPUT_OPTION3).action(async (options, command) => {
12075
12487
  await Promise.resolve().then(() => init_batch());
12076
12488
  await runBatchList(await make(), withGlobalFormat(options, command));
12077
12489
  });
12078
- batch.command("describe <id>").description("One batch job; --watch follows it until it ends").option("--watch", "Poll until the job ends").option("--poll-interval <ms>", "With --watch: delay between polls", "2000").option("--timeout <ms>", "With --watch: give up after this many milliseconds", "3600000").option(...OUTPUT_OPTION2).action(async (id, options, command) => {
12490
+ batch.command("describe <id>").description("One batch job; --watch follows it until it ends").option("--watch", "Poll until the job ends").option("--poll-interval <ms>", "With --watch: delay between polls", "2000").option("--timeout <ms>", "With --watch: give up after this many milliseconds", "3600000").option(...OUTPUT_OPTION3).action(async (id, options, command) => {
12079
12491
  await Promise.resolve().then(() => init_batch());
12080
12492
  await runBatchDescribe(await make(), id, withGlobalFormat(options, command));
12081
12493
  });
12082
- batch.command("cancel <id>").description("Cancel a batch job; the runs it has not reached are left as they are").option(...FORCE_OPTION).option(...OUTPUT_OPTION2).action(async (id, options, command) => {
12494
+ batch.command("cancel <id>").description("Cancel a batch job; the runs it has not reached are left as they are").option(...FORCE_OPTION).option(...OUTPUT_OPTION3).action(async (id, options, command) => {
12083
12495
  await Promise.resolve().then(() => init_batch());
12084
12496
  await runBatchCancel(await make(), id, withGlobalFormat(options, command));
12085
12497
  });
@@ -12089,106 +12501,106 @@ function addCompletionTarget(command) {
12089
12501
  }
12090
12502
  function registerActivities(program, make) {
12091
12503
  const activities = program.command("activities").alias("activity").description("Durable-function activities: standalone starts, completion, pause, reset, options and pause rules");
12092
- activities.command("start <nodeType> <operation>").description("Run one node operation as a durable activity (retries, timeouts, history; needs fluidgrids.standalone-activities)").option("--args <json>", "The operation arguments: a JSON object, or @file (literal values)").option("--node-version <version>", "Node version (default: the latest)").option("--connection <id>", "The connection id the operation authenticates with").option("--retry <json>", "Retry policy: {initialInterval, backoffCoefficient, maximumInterval, maximumAttempts, nonRetryableErrorTypes}").option("--max-attempts <n>", "Most attempts (0 = unlimited); overrides --retry").option("--start-to-close-timeout <duration>", "How long one attempt may run (30s, 5m, PT1H)").option("--schedule-to-close-timeout <duration>", "How long the activity may take overall, retries included").option("--heartbeat-timeout <duration>", "Longest gap between two heartbeats of an attempt").option("--summary <text>", "One line shown with the activity in the history").option("--idempotency-key <key>", "Return the run this key started before (yours only; needs fluidgrids.durable-parity)").option("--wait", "Wait for the run and print the activity's output").option("--timeout <ms>", "With --wait: give up after this many milliseconds", "300000").option("--poll-interval <ms>", "With --wait: delay between polls in milliseconds", "1000").option(...OUTPUT_OPTION2).action(async (nodeType, operation, options, command) => {
12504
+ activities.command("start <nodeType> <operation>").description("Run one node operation as a durable activity (retries, timeouts, history; needs fluidgrids.standalone-activities)").option("--args <json>", "The operation arguments: a JSON object, or @file (literal values)").option("--node-version <version>", "Node version (default: the latest)").option("--connection <id>", "The connection id the operation authenticates with").option("--retry <json>", "Retry policy: {initialInterval, backoffCoefficient, maximumInterval, maximumAttempts, nonRetryableErrorTypes}").option("--max-attempts <n>", "Most attempts (0 = unlimited); overrides --retry").option("--start-to-close-timeout <duration>", "How long one attempt may run (30s, 5m, PT1H)").option("--schedule-to-close-timeout <duration>", "How long the activity may take overall, retries included").option("--heartbeat-timeout <duration>", "Longest gap between two heartbeats of an attempt").option("--summary <text>", "One line shown with the activity in the history").option("--idempotency-key <key>", "Return the run this key started before (yours only; needs fluidgrids.durable-parity)").option("--wait", "Wait for the run and print the activity's output").option("--timeout <ms>", "With --wait: give up after this many milliseconds", "300000").option("--poll-interval <ms>", "With --wait: delay between polls in milliseconds", "1000").option(...OUTPUT_OPTION3).action(async (nodeType, operation, options, command) => {
12093
12505
  await Promise.resolve().then(() => init_activity_start());
12094
12506
  await Promise.resolve().then(() => init_shared2());
12095
12507
  await runActivityStart(phaseDEnv(await make()), nodeType, operation, withGlobalFormat(options, command));
12096
12508
  });
12097
- addCompletionTarget(activities.command("complete [runId] [activityId]").description("Complete an activity that waits for an asynchronous completion").option("--result <json>", "The result (JSON)")).option(...OUTPUT_OPTION2).action(async (first, second, options, command) => {
12509
+ addCompletionTarget(activities.command("complete [runId] [activityId]").description("Complete an activity that waits for an asynchronous completion").option("--result <json>", "The result (JSON)")).option(...OUTPUT_OPTION3).action(async (first, second, options, command) => {
12098
12510
  await Promise.resolve().then(() => init_activities());
12099
12511
  await runActivityComplete(await make(), first, second, withGlobalFormat(options, command));
12100
12512
  });
12101
- addCompletionTarget(activities.command("fail [runId] [activityId]").description("Fail an activity that waits for an asynchronous completion").option("--message <text>", "The failure message").option("--type <type>", "The application failure type").option("--error-type <type>", "TRANSIENT, PERMANENT, TIMEOUT, VALIDATION, … (default UNKNOWN)").option("--non-retryable", "Never retry it").option("--details <json>", "Failure details (JSON)")).option(...OUTPUT_OPTION2).action(async (first, second, options, command) => {
12513
+ addCompletionTarget(activities.command("fail [runId] [activityId]").description("Fail an activity that waits for an asynchronous completion").option("--message <text>", "The failure message").option("--type <type>", "The application failure type").option("--error-type <type>", "TRANSIENT, PERMANENT, TIMEOUT, VALIDATION, … (default UNKNOWN)").option("--non-retryable", "Never retry it").option("--details <json>", "Failure details (JSON)")).option(...OUTPUT_OPTION3).action(async (first, second, options, command) => {
12102
12514
  await Promise.resolve().then(() => init_activities());
12103
12515
  await runActivityFail(await make(), first, second, withGlobalFormat(options, command));
12104
12516
  });
12105
- addCompletionTarget(activities.command("heartbeat [runId] [activityId]").description("Heartbeat an activity that waits for an asynchronous completion").option("--details <json>", "Heartbeat details (JSON)")).option(...OUTPUT_OPTION2).action(async (first, second, options, command) => {
12517
+ addCompletionTarget(activities.command("heartbeat [runId] [activityId]").description("Heartbeat an activity that waits for an asynchronous completion").option("--details <json>", "Heartbeat details (JSON)")).option(...OUTPUT_OPTION3).action(async (first, second, options, command) => {
12106
12518
  await Promise.resolve().then(() => init_activities());
12107
12519
  await runActivityHeartbeat(await make(), first, second, withGlobalFormat(options, command));
12108
12520
  });
12109
- addTargetOptions2(addSelectorOptions(activities.command("pause [runId]").description("Pause activities of a run (needs fluidgrids.run-control)").option("--reason <text>", "Why"))).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
12521
+ addTargetOptions2(addSelectorOptions(activities.command("pause [runId]").description("Pause activities of a run (needs fluidgrids.run-control)").option("--reason <text>", "Why"))).option(...OUTPUT_OPTION3).action(async (runId, options, command) => {
12110
12522
  await Promise.resolve().then(() => init_activities());
12111
12523
  await runActivityPause(await make(), runId, withGlobalFormat(options, command));
12112
12524
  });
12113
- addTargetOptions2(addSelectorOptions(activities.command("unpause [runId]").description("Unpause activities; their next attempt is dispatched now").option("--reset-attempts", "Restart the attempt count").option("--reset-heartbeat", "Drop the heartbeat details"))).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
12525
+ addTargetOptions2(addSelectorOptions(activities.command("unpause [runId]").description("Unpause activities; their next attempt is dispatched now").option("--reset-attempts", "Restart the attempt count").option("--reset-heartbeat", "Drop the heartbeat details"))).option(...OUTPUT_OPTION3).action(async (runId, options, command) => {
12114
12526
  await Promise.resolve().then(() => init_activities());
12115
12527
  await runActivityUnpause(await make(), runId, withGlobalFormat(options, command));
12116
12528
  });
12117
- addTargetOptions2(addSelectorOptions(activities.command("reset [runId]").description("Restart activities at attempt 1 (a running attempt is cancelled first)").option("--reset-heartbeat", "Drop the heartbeat details").option(...FORCE_OPTION))).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
12529
+ addTargetOptions2(addSelectorOptions(activities.command("reset [runId]").description("Restart activities at attempt 1 (a running attempt is cancelled first)").option("--reset-heartbeat", "Drop the heartbeat details").option(...FORCE_OPTION))).option(...OUTPUT_OPTION3).action(async (runId, options, command) => {
12118
12530
  await Promise.resolve().then(() => init_activities());
12119
12531
  await runActivityReset(await make(), runId, withGlobalFormat(options, command));
12120
12532
  });
12121
- addActivityOptionFlags(addTargetOptions2(addSelectorOptions(activities.command("update-options [runId]").description("Change the retry policy and timeouts of activities from their next attempt (needs fluidgrids.run-control)")))).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
12533
+ addActivityOptionFlags(addTargetOptions2(addSelectorOptions(activities.command("update-options [runId]").description("Change the retry policy and timeouts of activities from their next attempt (needs fluidgrids.run-control)")))).option(...OUTPUT_OPTION3).action(async (runId, options, command) => {
12122
12534
  await Promise.resolve().then(() => init_activities());
12123
12535
  await runActivityUpdateOptions(await make(), runId, withGlobalFormat(options, command));
12124
12536
  });
12125
12537
  const rules = activities.command("pause-rules").description("Workspace rules that pause matching activities when they are scheduled");
12126
- rules.command("list").description("The pause rules that have not expired").option(...OUTPUT_OPTION2).action(async (options, command) => {
12538
+ rules.command("list").description("The pause rules that have not expired").option(...OUTPUT_OPTION3).action(async (options, command) => {
12127
12539
  await Promise.resolve().then(() => init_activities());
12128
12540
  await runPauseRulesList(await make(), withGlobalFormat(options, command));
12129
12541
  });
12130
- rules.command("create").description("Create a pause rule (at most 100; needs fluidgrids.run-control)").option("--activity-type <type>", "Matches the node type (or user activity name)").option("--node-type <type>", "Matches the node type").option("--workflow-key <key>", "Only activities of this workflow").option("--reason <text>", "Why").option("--expires-at <time>", "The rule ends then (ISO-8601)").option("--expires-in <duration>", "The rule ends after this long (5m, 2h, PT1H)").option(...OUTPUT_OPTION2).action(async (options, command) => {
12542
+ rules.command("create").description("Create a pause rule (at most 100; needs fluidgrids.run-control)").option("--activity-type <type>", "Matches the node type (or user activity name)").option("--node-type <type>", "Matches the node type").option("--workflow-key <key>", "Only activities of this workflow").option("--reason <text>", "Why").option("--expires-at <time>", "The rule ends then (ISO-8601)").option("--expires-in <duration>", "The rule ends after this long (5m, 2h, PT1H)").option(...OUTPUT_OPTION3).action(async (options, command) => {
12131
12543
  await Promise.resolve().then(() => init_activities());
12132
12544
  await runPauseRulesCreate(await make(), withGlobalFormat(options, command));
12133
12545
  });
12134
- rules.command("delete <id>").description("Delete a pause rule; everything it paused is unpaused").option(...OUTPUT_OPTION2).action(async (id, options, command) => {
12546
+ rules.command("delete <id>").description("Delete a pause rule; everything it paused is unpaused").option(...OUTPUT_OPTION3).action(async (id, options, command) => {
12135
12547
  await Promise.resolve().then(() => init_activities());
12136
12548
  await runPauseRulesDelete(await make(), id, withGlobalFormat(options, command));
12137
12549
  });
12138
12550
  }
12139
12551
  function registerSignalTokens(program, make) {
12140
12552
  const tokens = program.command("signal-token").description("Signal tokens: a URL that signals a run without a platform credential");
12141
- addTargetOptions2(tokens.command("create [runId]").description("Create a signal token for a run; shown once (needs fluidgrids.run-control)").option("--signal <name>", "The signal a POST sends (one the run declares)").option("--ttl <duration>", "Lifetime, 60 s to 90 days (default 30 days)").option("--reusable", "Usable until it expires (default: spent by its first signal)").option("--allow-ip <cidrs>", "IPv4 addresses or CIDR ranges a post must come from (repeatable)", collect2)).option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
12553
+ addTargetOptions2(tokens.command("create [runId]").description("Create a signal token for a run; shown once (needs fluidgrids.run-control)").option("--signal <name>", "The signal a POST sends (one the run declares)").option("--ttl <duration>", "Lifetime, 60 s to 90 days (default 30 days)").option("--reusable", "Usable until it expires (default: spent by its first signal)").option("--allow-ip <cidrs>", "IPv4 addresses or CIDR ranges a post must come from (repeatable)", collect2)).option(...OUTPUT_OPTION3).action(async (runId, options, command) => {
12142
12554
  await Promise.resolve().then(() => init_signal_tokens());
12143
12555
  await runSignalTokenCreate(await make(), runId, withGlobalFormat(options, command));
12144
12556
  });
12145
- tokens.command("revoke <id>").description("Revoke a signal token").option(...OUTPUT_OPTION2).action(async (id, options, command) => {
12557
+ tokens.command("revoke <id>").description("Revoke a signal token").option(...OUTPUT_OPTION3).action(async (id, options, command) => {
12146
12558
  await Promise.resolve().then(() => init_signal_tokens());
12147
12559
  await runSignalTokenRevoke(await make(), id, withGlobalFormat(options, command));
12148
12560
  });
12149
- tokens.command("list <runId>").description("The signal tokens of a run (never the tokens themselves)").option(...OUTPUT_OPTION2).action(async (runId, options, command) => {
12561
+ tokens.command("list <runId>").description("The signal tokens of a run (never the tokens themselves)").option(...OUTPUT_OPTION3).action(async (runId, options, command) => {
12150
12562
  await Promise.resolve().then(() => init_signal_tokens());
12151
12563
  await runSignalTokenList(await make(), runId, withGlobalFormat(options, command));
12152
12564
  });
12153
12565
  }
12154
12566
  function registerSearchAttributes(program, make) {
12155
12567
  const attributes = program.command("search-attributes").description("Run search attributes the workspace defines");
12156
- attributes.command("list").description("The defined search attributes").option(...OUTPUT_OPTION2).action(async (options, command) => {
12568
+ attributes.command("list").description("The defined search attributes").option(...OUTPUT_OPTION3).action(async (options, command) => {
12157
12569
  await Promise.resolve().then(() => init_search_attributes());
12158
12570
  await runSearchAttributesList(await make(), withGlobalFormat(options, command));
12159
12571
  });
12160
- attributes.command("create <name>").description("Define a search attribute (at most 50; needs fluidgrids.search-attributes)").option("--type <type>", "KEYWORD, TEXT, INT, DOUBLE, BOOL, DATETIME or KEYWORD_LIST").option("--description <text>", "Description").option(...OUTPUT_OPTION2).action(async (name, options, command) => {
12572
+ attributes.command("create <name>").description("Define a search attribute (at most 50; needs fluidgrids.search-attributes)").option("--type <type>", "KEYWORD, TEXT, INT, DOUBLE, BOOL, DATETIME or KEYWORD_LIST").option("--description <text>", "Description").option(...OUTPUT_OPTION3).action(async (name, options, command) => {
12161
12573
  await Promise.resolve().then(() => init_search_attributes());
12162
12574
  await runSearchAttributesCreate(await make(), name, withGlobalFormat(options, command));
12163
12575
  });
12164
- attributes.command("delete <name>").description("Delete a search attribute (runs keep their values)").option(...FORCE_OPTION).option(...OUTPUT_OPTION2).action(async (name, options, command) => {
12576
+ attributes.command("delete <name>").description("Delete a search attribute (runs keep their values)").option(...FORCE_OPTION).option(...OUTPUT_OPTION3).action(async (name, options, command) => {
12165
12577
  await Promise.resolve().then(() => init_search_attributes());
12166
12578
  await runSearchAttributesDelete(await make(), name, withGlobalFormat(options, command));
12167
12579
  });
12168
12580
  }
12169
12581
  function registerSchedules(program, make) {
12170
12582
  const schedules = program.command("schedules").description("Schedule Trigger nodes: describe, trigger, backfill, pause and unpause (created by pushing a version)");
12171
- schedules.command("list").description("One row per Schedule Trigger node (workflowScheduledJobs)").option("--key <workflowKey>", "Only this workflow").option(...OUTPUT_OPTION2).action(async (options, command) => {
12583
+ schedules.command("list").description("One row per Schedule Trigger node (workflowScheduledJobs)").option("--key <workflowKey>", "Only this workflow").option(...OUTPUT_OPTION3).action(async (options, command) => {
12172
12584
  await Promise.resolve().then(() => init_schedules());
12173
12585
  await runSchedulesList(await make(), withGlobalFormat(options, command));
12174
12586
  });
12175
- schedules.command("describe <workflowKey> <triggerNodeId>").description("Spec, state, next fire times and recent ticks (needs fluidgrids.schedule-policies)").option(...OUTPUT_OPTION2).action(async (key, node, options, command) => {
12587
+ schedules.command("describe <workflowKey> <triggerNodeId>").description("Spec, state, next fire times and recent ticks (needs fluidgrids.schedule-policies)").option(...OUTPUT_OPTION3).action(async (key, node, options, command) => {
12176
12588
  await Promise.resolve().then(() => init_schedules());
12177
12589
  await runSchedulesDescribe(await make(), key, node, withGlobalFormat(options, command));
12178
12590
  });
12179
- schedules.command("trigger <workflowKey> <triggerNodeId>").description("Start one action now (a MANUAL tick; counts one run)").option("--overlap-policy <policy>", "skip, buffer-one, buffer-all, cancel-other, terminate-other or allow-all").option(...OUTPUT_OPTION2).action(async (key, node, options, command) => {
12591
+ schedules.command("trigger <workflowKey> <triggerNodeId>").description("Start one action now (a MANUAL tick; counts one run)").option("--overlap-policy <policy>", "skip, buffer-one, buffer-all, cancel-other, terminate-other or allow-all").option(...OUTPUT_OPTION3).action(async (key, node, options, command) => {
12180
12592
  await Promise.resolve().then(() => init_schedules());
12181
12593
  await runSchedulesTrigger(await make(), key, node, withGlobalFormat(options, command));
12182
12594
  });
12183
- schedules.command("backfill <workflowKey> <triggerNodeId>").description("Run the fire times between --from and --to (at most 1,000, in the past)").option("--from <time>", "Start (ISO-8601)").option("--to <time>", "End (ISO-8601, in the past)").option("--overlap-policy <policy>", "Overlap policy of the backfilled ticks").option(...FORCE_OPTION).option(...OUTPUT_OPTION2).action(async (key, node, options, command) => {
12595
+ schedules.command("backfill <workflowKey> <triggerNodeId>").description("Run the fire times between --from and --to (at most 1,000, in the past)").option("--from <time>", "Start (ISO-8601)").option("--to <time>", "End (ISO-8601, in the past)").option("--overlap-policy <policy>", "Overlap policy of the backfilled ticks").option(...FORCE_OPTION).option(...OUTPUT_OPTION3).action(async (key, node, options, command) => {
12184
12596
  await Promise.resolve().then(() => init_schedules());
12185
12597
  await runSchedulesBackfill(await make(), key, node, withGlobalFormat(options, command));
12186
12598
  });
12187
- schedules.command("pause <workflowKey> <triggerNodeId>").description("Pause the schedule with a note until it is unpaused").option("--note <text>", "Why").option(...OUTPUT_OPTION2).action(async (key, node, options, command) => {
12599
+ schedules.command("pause <workflowKey> <triggerNodeId>").description("Pause the schedule with a note until it is unpaused").option("--note <text>", "Why").option(...OUTPUT_OPTION3).action(async (key, node, options, command) => {
12188
12600
  await Promise.resolve().then(() => init_schedules());
12189
12601
  await runSchedulesPause(await make(), key, node, withGlobalFormat(options, command));
12190
12602
  });
12191
- schedules.command("unpause <workflowKey> <triggerNodeId>").description("Unpause the schedule").option(...OUTPUT_OPTION2).action(async (key, node, options, command) => {
12603
+ schedules.command("unpause <workflowKey> <triggerNodeId>").description("Unpause the schedule").option(...OUTPUT_OPTION3).action(async (key, node, options, command) => {
12192
12604
  await Promise.resolve().then(() => init_schedules());
12193
12605
  await runSchedulesUnpause(await make(), key, node, withGlobalFormat(options, command));
12194
12606
  });
@@ -12245,6 +12657,7 @@ var modules = [
12245
12657
  healthModule,
12246
12658
  code_first_default,
12247
12659
  phase_c_default,
12660
+ ai_default,
12248
12661
  mcp_default
12249
12662
  ];
12250
12663
 
@@ -12282,6 +12695,8 @@ var HELP_EXAMPLES = [
12282
12695
  "",
12283
12696
  "$ fluidgrids config set apiUrl <url> --profile alpha # Client profile (~/.fluidgrids/config.toml)",
12284
12697
  "",
12698
+ '$ fluidgrids ai generate "Post new leads to Slack" --apply # AI proposal as a DRAFT version',
12699
+ "$ fluidgrids ai explain-run <runId> # Why a run failed",
12285
12700
  '$ fluidgrids generate "Post new leads to Slack" --format ts # Generate with AI, as code',
12286
12701
  "$ fluidgrids import n8n-export.json --from n8n --preview # What an n8n import would create",
12287
12702
  "$ fluidgrids replay <runId> --trace --remote-code # Replay debugger on the exact code that ran",
@@ -12344,7 +12759,7 @@ try {
12344
12759
  }
12345
12760
  } catch (error) {
12346
12761
  console.error(`✗ ${error instanceof Error ? error.message : String(error)}`);
12347
- if (error instanceof CliUserError54 && error.hint)
12762
+ if (error instanceof CliUserError55 && error.hint)
12348
12763
  console.error(`ℹ ${error.hint}`);
12349
- process.exitCode = error instanceof CliUserError54 ? error.exitCode : 1;
12764
+ process.exitCode = error instanceof CliUserError55 ? error.exitCode : 1;
12350
12765
  }