replicas-cli 0.3.686 → 0.3.687

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 (2) hide show
  1. package/dist/index.cjs +348 -278
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -277,7 +277,7 @@ var init_urls = __esm({
277
277
  WEB_APP_PATHS.automations,
278
278
  `${WEB_APP_PATHS.automations}/${UUID_PATTERN}`
279
279
  ];
280
- APP_LINK_PATTERNS = APP_LINK_PATHS.map((path14) => new RegExp(`^${path14.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\?/g, ".").replace(/\*/g, ".*")}$`));
280
+ APP_LINK_PATTERNS = APP_LINK_PATHS.map((path16) => new RegExp(`^${path16.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\?/g, ".").replace(/\*/g, ".*")}$`));
281
281
  LEGACY_WEB_APP_PATHS = {
282
282
  app: "/app",
283
283
  home: "/home",
@@ -671,10 +671,10 @@ function mergeDefs(...defs) {
671
671
  function cloneDef(schema) {
672
672
  return mergeDefs(schema._zod.def);
673
673
  }
674
- function getElementAtPath(obj, path14) {
675
- if (!path14)
674
+ function getElementAtPath(obj, path16) {
675
+ if (!path16)
676
676
  return obj;
677
- return path14.reduce((acc, key2) => acc?.[key2], obj);
677
+ return path16.reduce((acc, key2) => acc?.[key2], obj);
678
678
  }
679
679
  function promiseAllObject(promisesObj) {
680
680
  const keys = Object.keys(promisesObj);
@@ -933,11 +933,11 @@ function explicitlyAborted(x, startIndex = 0) {
933
933
  }
934
934
  return false;
935
935
  }
936
- function prefixIssues(path14, issues) {
936
+ function prefixIssues(path16, issues) {
937
937
  return issues.map((iss) => {
938
938
  var _a3;
939
939
  (_a3 = iss).path ?? (_a3.path = []);
940
- iss.path.unshift(path14);
940
+ iss.path.unshift(path16);
941
941
  return iss;
942
942
  });
943
943
  }
@@ -1472,16 +1472,16 @@ function flattenError(error62, mapper = (issue3) => issue3.message) {
1472
1472
  }
1473
1473
  function formatError(error62, mapper = (issue3) => issue3.message) {
1474
1474
  const fieldErrors = { _errors: [] };
1475
- const processError = (error63, path14 = []) => {
1475
+ const processError = (error63, path16 = []) => {
1476
1476
  for (const issue3 of error63.issues) {
1477
1477
  if (issue3.code === "invalid_union" && issue3.errors.length) {
1478
- issue3.errors.map((issues) => processError({ issues }, [...path14, ...issue3.path]));
1478
+ issue3.errors.map((issues) => processError({ issues }, [...path16, ...issue3.path]));
1479
1479
  } else if (issue3.code === "invalid_key") {
1480
- processError({ issues: issue3.issues }, [...path14, ...issue3.path]);
1480
+ processError({ issues: issue3.issues }, [...path16, ...issue3.path]);
1481
1481
  } else if (issue3.code === "invalid_element") {
1482
- processError({ issues: issue3.issues }, [...path14, ...issue3.path]);
1482
+ processError({ issues: issue3.issues }, [...path16, ...issue3.path]);
1483
1483
  } else {
1484
- const fullpath = [...path14, ...issue3.path];
1484
+ const fullpath = [...path16, ...issue3.path];
1485
1485
  if (fullpath.length === 0) {
1486
1486
  fieldErrors._errors.push(mapper(issue3));
1487
1487
  } else {
@@ -1520,17 +1520,17 @@ function formatError(error62, mapper = (issue3) => issue3.message) {
1520
1520
  }
1521
1521
  function treeifyError(error62, mapper = (issue3) => issue3.message) {
1522
1522
  const result = { errors: [] };
1523
- const processError = (error63, path14 = []) => {
1523
+ const processError = (error63, path16 = []) => {
1524
1524
  var _a3;
1525
1525
  for (const issue3 of error63.issues) {
1526
1526
  if (issue3.code === "invalid_union" && issue3.errors.length) {
1527
- issue3.errors.map((issues) => processError({ issues }, [...path14, ...issue3.path]));
1527
+ issue3.errors.map((issues) => processError({ issues }, [...path16, ...issue3.path]));
1528
1528
  } else if (issue3.code === "invalid_key") {
1529
- processError({ issues: issue3.issues }, [...path14, ...issue3.path]);
1529
+ processError({ issues: issue3.issues }, [...path16, ...issue3.path]);
1530
1530
  } else if (issue3.code === "invalid_element") {
1531
- processError({ issues: issue3.issues }, [...path14, ...issue3.path]);
1531
+ processError({ issues: issue3.issues }, [...path16, ...issue3.path]);
1532
1532
  } else {
1533
- const fullpath = [...path14, ...issue3.path];
1533
+ const fullpath = [...path16, ...issue3.path];
1534
1534
  if (fullpath.length === 0) {
1535
1535
  result.errors.push(mapper(issue3));
1536
1536
  continue;
@@ -1569,8 +1569,8 @@ function treeifyError(error62, mapper = (issue3) => issue3.message) {
1569
1569
  }
1570
1570
  function toDotPath(_path) {
1571
1571
  const segs = [];
1572
- const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1573
- for (const seg of path14) {
1572
+ const path16 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1573
+ for (const seg of path16) {
1574
1574
  if (typeof seg === "number")
1575
1575
  segs.push(`[${seg}]`);
1576
1576
  else if (typeof seg === "symbol")
@@ -19688,13 +19688,13 @@ function resolveRef(ref, ctx) {
19688
19688
  if (!ref.startsWith("#")) {
19689
19689
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
19690
19690
  }
19691
- const path14 = ref.slice(1).split("/").filter(Boolean);
19692
- if (path14.length === 0) {
19691
+ const path16 = ref.slice(1).split("/").filter(Boolean);
19692
+ if (path16.length === 0) {
19693
19693
  return ctx.rootSchema;
19694
19694
  }
19695
19695
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19696
- if (path14[0] === defsKey) {
19697
- const key2 = path14[1] === void 0 ? void 0 : decodeJSONPointerSegment(path14[1]);
19696
+ if (path16[0] === defsKey) {
19697
+ const key2 = path16[1] === void 0 ? void 0 : decodeJSONPointerSegment(path16[1]);
19698
19698
  if (!key2 || !ctx.defs[key2]) {
19699
19699
  throw new Error(`Reference not found: ${ref}`);
19700
19700
  }
@@ -21728,7 +21728,7 @@ var init_repository_path = __esm({
21728
21728
  "use strict";
21729
21729
  init_zod();
21730
21730
  repositoryPathSchema = external_exports.string().trim().min(1).max(1e3).refine(
21731
- (path14) => !path14.startsWith("/") && path14.split("/").every((part) => part !== "" && part !== "." && part !== ".."),
21731
+ (path16) => !path16.startsWith("/") && path16.split("/").every((part) => part !== "" && part !== "." && part !== ".."),
21732
21732
  "path is relative to the repository root, with no empty, . or .. parts"
21733
21733
  );
21734
21734
  }
@@ -22067,7 +22067,7 @@ function jsonStrings(raw) {
22067
22067
  } catch {
22068
22068
  return null;
22069
22069
  }
22070
- const strings = [], path14 = [], inObject = [];
22070
+ const strings = [], path16 = [], inObject = [];
22071
22071
  let expectKey = false;
22072
22072
  for (let index = 0; index < raw.length; index++) {
22073
22073
  const char = raw[index];
@@ -22075,22 +22075,22 @@ function jsonStrings(raw) {
22075
22075
  let end = index + 1;
22076
22076
  while (raw[end] !== '"') end += raw[end] === "\\" ? 2 : 1;
22077
22077
  const key2 = inObject.at(-1) === true && expectKey;
22078
- if (key2) path14[path14.length - 1] = parseJsonString(raw.slice(index, end + 1));
22079
- strings.push({ start: index, end: end + 1, path: key2 ? path14.slice(0, -1) : [...path14], key: key2 });
22078
+ if (key2) path16[path16.length - 1] = parseJsonString(raw.slice(index, end + 1));
22079
+ strings.push({ start: index, end: end + 1, path: key2 ? path16.slice(0, -1) : [...path16], key: key2 });
22080
22080
  expectKey = false;
22081
22081
  index = end;
22082
22082
  } else if (char === "{" || char === "[") {
22083
22083
  inObject.push(char === "{");
22084
- path14.push(char === "{" ? "" : 0);
22084
+ path16.push(char === "{" ? "" : 0);
22085
22085
  expectKey = char === "{";
22086
22086
  } else if (char === "}" || char === "]") {
22087
22087
  inObject.pop();
22088
- path14.pop();
22088
+ path16.pop();
22089
22089
  } else if (char === ",") {
22090
22090
  if (inObject.at(-1)) expectKey = true;
22091
22091
  else {
22092
- const last = path14[path14.length - 1];
22093
- if (typeof last === "number") path14[path14.length - 1] = last + 1;
22092
+ const last = path16[path16.length - 1];
22093
+ if (typeof last === "number") path16[path16.length - 1] = last + 1;
22094
22094
  }
22095
22095
  }
22096
22096
  }
@@ -22234,8 +22234,8 @@ function proofValues(content, known, allowCommitted) {
22234
22234
  else high = middle - 1;
22235
22235
  }
22236
22236
  if (strings && (!string4 || start >= string4.end)) return { label: "the JSON outside any string", kept: false };
22237
- const path14 = string4 ? fieldPath(string4.path, known) : "";
22238
- if (string4?.key) return { label: `a JSON key${path14 ? ` in ${path14}` : ""}`, kept: false };
22237
+ const path16 = string4 ? fieldPath(string4.path, known) : "";
22238
+ if (string4?.key) return { label: `a JSON key${path16 ? ` in ${path16}` : ""}`, kept: false };
22239
22239
  let body2, from = start, to = end;
22240
22240
  if (string4) {
22241
22241
  let own2 = read.get(string4.start);
@@ -22243,7 +22243,7 @@ function proofValues(content, known, allowCommitted) {
22243
22243
  body2 = own2;
22244
22244
  [from, to] = [own2.at[start - string4.start], own2.at[Math.min(end, string4.end - 1) - string4.start]];
22245
22245
  } else body2 = whole ?? (whole = readText(content, null));
22246
- const field2 = path14 || "content", line = lineAt(body2.lineStarts, from);
22246
+ const field2 = path16 || "content", line = lineAt(body2.lineStarts, from);
22247
22247
  if (!body2.diff) return { label: body2.text.includes("\n") ? `${field2}, line ${line + 1}` : field2, kept: false };
22248
22248
  const kind = body2.diff.kinds[line], file2 = body2.diff.files[line];
22249
22249
  const where = file2 === null ? "" : containsProofSecret(file2, known) ? ", in a file whose path holds the value" : `, in ${file2}`;
@@ -22500,7 +22500,7 @@ var init_secrets = __esm({
22500
22500
  [STANDALONE_TOKEN, "a token"]
22501
22501
  ]);
22502
22502
  POSITIONAL = /* @__PURE__ */ new Set([...BY_NAME, ...SECRET_PATTERNS.slice(1, 5)]);
22503
- fieldPath = (path14, known) => path14.map((part) => typeof part === "number" ? `[${part}]` : containsProofSecret(part, known) ? ".<key>" : `.${part}`).join("").replace(/^\./, "");
22503
+ fieldPath = (path16, known) => path16.map((part) => typeof part === "number" ? `[${part}]` : containsProofSecret(part, known) ? ".<key>" : `.${part}`).join("").replace(/^\./, "");
22504
22504
  DIFF = /^(?:diff --git |--- \S|\+\+\+ \S|@@ -\d)/m;
22505
22505
  HUNK = /^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@/;
22506
22506
  SIDES = [/* @__PURE__ */ new Set(["removed", "context"]), /* @__PURE__ */ new Set(["added", "context"])];
@@ -23639,7 +23639,7 @@ var init_security = __esm({
23639
23639
  FIRST_VALUE_PLACEHOLDER = "{first.value}";
23640
23640
  declaredReplayRequestSchema = (placeholders) => external_exports.strictObject({
23641
23641
  method: external_exports.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]),
23642
- path: external_exports.string().startsWith("/", 'path must start with "/"').max(2e3).refine((path14) => !/[{}]/.test(placeholders.reduce((rest, placeholder) => rest.replaceAll(placeholder, ""), path14)), `the only placeholders in path are ${placeholders.join(" and ")}`),
23642
+ path: external_exports.string().startsWith("/", 'path must start with "/"').max(2e3).refine((path16) => !/[{}]/.test(placeholders.reduce((rest, placeholder) => rest.replaceAll(placeholder, ""), path16)), `the only placeholders in path are ${placeholders.join(" and ")}`),
23643
23643
  body: external_exports.json().optional()
23644
23644
  });
23645
23645
  usesFirstValue = (request2) => `${request2.path}${JSON.stringify(request2.body ?? null)}`.includes(FIRST_VALUE_PLACEHOLDER);
@@ -25749,27 +25749,26 @@ Artifacts are the home for everything this workspace generates: docs, diagrams,
25749
25749
  **Reference:** \`references/ARTIFACTS.md\`
25750
25750
 
25751
25751
  Use this when:
25752
- - You generate anything someone might want to see after the workspace is deleted
25752
+ - You save a file you generated so the person can open it, now or after the workspace is gone
25753
25753
  - You need to list, rename, share or delete an artifact`;
25754
25754
  REFERENCE = `# Artifacts
25755
25755
 
25756
- An artifact is anything this workspace generates that someone might want to see after the workspace is deleted. Work on plans and notes in the Canvas, and save one with \`replicas artifact upload\` when the person will want it after the workspace is gone. An artifact belongs to the person this workspace belongs to and is private to them until it is shared. A workspace with no owner saves artifacts that belong to the whole organization.
25756
+ An artifact is a file this workspace saved for people to open. It belongs to the person this workspace belongs to and is private to them until it is shared. A workspace with no owner saves artifacts that belong to the whole organization.
25757
25757
 
25758
- ## Mutable or immutable
25758
+ ## Temporary or permanent
25759
25759
 
25760
- Every artifact is one or the other. Choose by what the thing is, not by whether someone might want it later:
25760
+ Every upload passes \`--permanent false\` or \`--permanent true\`; the command refuses one without it.
25761
25761
 
25762
- - **Immutable** (\`--immutable\`): a record of this workspace's work, which a later version would sit beside rather than replace. Screenshots, recordings, GIFs, before/after images, test output, one-off renders. It is deleted when the workspace is deleted.
25763
- - **Mutable**: a document people come back to, share or review, which a later version would replace. A plan, report, design doc, dashboard or dataset. It is kept after the workspace is gone and shows on the person's Artifacts page.
25762
+ - **Temporary** (\`--permanent false\`): deleted with this workspace. Screenshots, recordings, GIFs, test output, one-off renders, and working files such as plans and notes.
25763
+ - **Permanent** (\`--permanent true\`): kept after the workspace is gone and listed on the person's Artifacts page. Only when the person asked to keep it, or it is the finished deliverable of the task: a report, dashboard or dataset.
25764
25764
 
25765
- If you're unsure, save it as immutable. A screenshot or recording is immutable.
25766
-
25767
- Save everything with \`replicas artifact upload\`, adding \`--immutable\` for anything immutable. Paste the line the command prints into your reply.
25765
+ If you're unsure, use \`--permanent false\`. If the person says you chose wrong, upload the same file again with the other value: if it is unchanged, that changes the saved artifact; if you edited it, it is saved as a new artifact. Paste the line the upload prints into your reply.
25768
25766
 
25769
25767
  ## Commands
25770
25768
 
25771
25769
  \`\`\`bash
25772
- replicas artifact upload report.pdf diagram.mmd --name "Q3 report" --name "Signup flow"
25770
+ replicas artifact upload /tmp/login.png --name "Login page after fix" --permanent false
25771
+ replicas artifact upload report.pdf --name "Q3 report" --permanent true
25773
25772
  replicas artifact list
25774
25773
  replicas artifact url <id>
25775
25774
  replicas artifact rename <id> "Q3 report (final)"
@@ -25781,7 +25780,7 @@ replicas artifact delete <id>
25781
25780
  \`\`\`
25782
25781
 
25783
25782
  - Pass one \`--name\` per file: the name people will see. Up to 50 MB per file.
25784
- - \`list\` shows yours and those shared with you, mutable only; \`--all\`, \`--kind\`, \`--owner\` and \`--workspace\` widen or narrow it. \`url\` prints a short-lived download link. Sharing gives view unless you pass \`--permission edit\`.
25783
+ - \`list\` shows your permanent artifacts and those shared with you; \`--permanent false\`, \`--all\`, \`--kind\`, \`--owner\` and \`--workspace\` widen or narrow it. \`url\` prints a short-lived download link. Sharing gives view unless you pass \`--permission edit\`.
25785
25784
  - You act with the workspace owner's access: an \`edit\` share lets you rename and reshare. Only the owner can delete, except that anyone in the organization can delete an artifact the organization owns.
25786
25785
  - Share only when the person asks.
25787
25786
  `;
@@ -26896,8 +26895,8 @@ function parseIssueContractRecord(schema, value, at, report) {
26896
26895
  return result.data;
26897
26896
  }
26898
26897
  for (const issue3 of result.error.issues) {
26899
- const path14 = [at, ...issue3.path.map((key2) => typeof key2 === "number" || UUID_RE.test(String(key2)) ? "*" : String(key2))].filter(Boolean).join(".");
26900
- report.problems.add(`${path14} ${issue3.code}${issue3.code === "invalid_value" ? ` ${String(issue3.input).slice(0, 40)}` : ""}`);
26898
+ const path16 = [at, ...issue3.path.map((key2) => typeof key2 === "number" || UUID_RE.test(String(key2)) ? "*" : String(key2))].filter(Boolean).join(".");
26899
+ report.problems.add(`${path16} ${issue3.code}${issue3.code === "invalid_value" ? ` ${String(issue3.input).slice(0, 40)}` : ""}`);
26901
26900
  }
26902
26901
  report.dropped++;
26903
26902
  return void 0;
@@ -27991,20 +27990,20 @@ replicas media upload chart-a.svg chart-b.svg --name "Latency chart" --name "Err
27991
27990
  ARTIFACT_UPLOADING = `## Uploading to Replicas
27992
27991
 
27993
27992
  \`\`\`bash
27994
- replicas artifact upload <path-to-file> --name "<display name>" [<path-to-file> --name "<display name>" ...]
27993
+ replicas artifact upload <path-to-file> --name "<display name>" [<path-to-file> --name "<display name>" ...] --permanent false
27995
27994
  \`\`\`
27996
27995
 
27997
- Pass one or more file paths, each with a required \`--name\` (see below). Uploading several files in a single invocation is preferred over running the command repeatedly: it's faster and keeps the output grouped.
27996
+ Pass one or more file paths, each with a required \`--name\` (see below), and \`--permanent false\` or \`--permanent true\`. Uploading several files in a single invocation is preferred over running the command repeatedly: it's faster and keeps the output grouped.
27998
27997
 
27999
27998
  ### Name each upload
28000
27999
 
28001
28000
  \`--name\` is **required** and sets the short, human-readable name people see in Replicas. Make it descriptive of the content, e.g. \`Login page after fix\` or \`DB latency chart\`. Never use a generic value like \`screenshot\` or \`image\`, and give every upload a distinct name.
28002
28001
 
28003
28002
  \`\`\`bash
28004
- replicas artifact upload /tmp/before.png /tmp/after.png --name "Before fix" --name "After fix" --immutable
28003
+ replicas artifact upload /tmp/before.png /tmp/after.png --name "Before fix" --name "After fix" --permanent false
28005
28004
  \`\`\`
28006
28005
 
28007
- A screenshot or recording is immutable, so these examples pass \`--immutable\`, which also lists it in the workspace's Media folder (see \`ARTIFACTS.md\`).
28006
+ A screenshot or recording is temporary: it is deleted with this workspace (see \`ARTIFACTS.md\`).
28008
28007
 
28009
28008
  For each image, video or audio file, the CLI prints an embed line and a dashboard link:
28010
28009
 
@@ -28023,7 +28022,7 @@ The kind comes from the filename extension. Images (\`png\`, \`jpg\`, \`jpeg\`,
28023
28022
  ## Options
28024
28023
 
28025
28024
  - \`--name <name>\`: required name people see, one per file in order
28026
- - \`--immutable\`: a record of this workspace's work, such as a screenshot or recording, deleted with the workspace (see \`ARTIFACTS.md\`)
28025
+ - \`--permanent false|true\`, required: false (temporary) for screenshots, recordings, test output and working files, deleted with the workspace; permanent only for something the person asked to keep or a finished deliverable (see \`ARTIFACTS.md\`)
28027
28026
  `;
28028
28027
  githubAttachUsage = (textName, replaced) => `\`\`\`bash
28029
28028
  gh pr create --title "Describe the change" --body-file /tmp/pr-body.md --attach './after.png#Settings page after the fix'
@@ -28078,7 +28077,7 @@ ${GITHUB_DONT}
28078
28077
  githubDelivery: `On GitHub, \`gh \u2026 --attach\` uploads screenshots and recording previews and links them.`,
28079
28078
  github: `### GitHub: link images and recordings
28080
28079
 
28081
- GitHub can't show Replicas files inline, and artifacts are never public, so on GitHub you link them: the link opens the file for people signed in to Replicas who can see it. Attach images with \`gh --attach\`, in public and private repositories alike: \`gh\` uploads each image with \`replicas artifact upload --immutable\` and puts its signed-in link in the body. It prints each image's chat embed, so paste those in your chat reply too:
28080
+ GitHub can't show Replicas files inline, and artifacts are never public, so on GitHub you link them: the link opens the file for people signed in to Replicas who can see it. Attach images with \`gh --attach\`, in public and private repositories alike: \`gh\` uploads each image with \`replicas artifact upload --permanent false\` and puts its signed-in link in the body. It prints each image's chat embed, so paste those in your chat reply too:
28082
28081
 
28083
28082
  ${githubAttachUsage("Link text", "becomes a link to the image; other images are appended as links")}
28084
28083
 
@@ -29442,8 +29441,8 @@ var init_preferences = __esm({
29442
29441
  });
29443
29442
 
29444
29443
  // ../shared/src/environment-files.ts
29445
- function validateEnvironmentFilePath(path14) {
29446
- const trimmedPath = path14.trim();
29444
+ function validateEnvironmentFilePath(path16) {
29445
+ const trimmedPath = path16.trim();
29447
29446
  if (!trimmedPath) {
29448
29447
  return "Path is required.";
29449
29448
  }
@@ -29876,7 +29875,7 @@ var init_environment_config = __esm({
29876
29875
  }).nullable().optional(),
29877
29876
  repositories: external_exports.array(external_exports.string().trim().min(1)).optional(),
29878
29877
  workspaceSize: external_exports.enum(WORKSPACE_SIZE_OPTIONS).optional(),
29879
- files: external_exports.record(external_exports.string().trim().refine((path14) => !validateEnvironmentFilePath(path14), "must be a file path starting with ~/"), external_exports.strictObject({
29878
+ files: external_exports.record(external_exports.string().trim().refine((path16) => !validateEnvironmentFilePath(path16), "must be a file path starting with ~/"), external_exports.strictObject({
29880
29879
  name: external_exports.string().trim().min(1).optional(),
29881
29880
  content: external_exports.string().max(65536)
29882
29881
  })).optional(),
@@ -30739,11 +30738,11 @@ function parseShellScript(script, cwd) {
30739
30738
  parseUntil(scope, 0, false);
30740
30739
  return scope.commands;
30741
30740
  }
30742
- function resolveShellPath(dir, path14) {
30743
- if (path14.includes(SHELL_OPAQUE)) return null;
30744
- if (!path14.startsWith("/") && dir === null) return null;
30741
+ function resolveShellPath(dir, path16) {
30742
+ if (path16.includes(SHELL_OPAQUE)) return null;
30743
+ if (!path16.startsWith("/") && dir === null) return null;
30745
30744
  const parts = [];
30746
- for (const part of (path14.startsWith("/") ? path14 : `${dir}/${path14}`).split("/")) {
30745
+ for (const part of (path16.startsWith("/") ? path16 : `${dir}/${path16}`).split("/")) {
30747
30746
  if (part === "..") parts.pop();
30748
30747
  else if (part && part !== ".") parts.push(part);
30749
30748
  }
@@ -31204,8 +31203,8 @@ function parseSkillName(tool, input2) {
31204
31203
  const skillName = parsedInput.skill ?? parsedInput.name;
31205
31204
  return typeof skillName === "string" && skillName ? skillName : null;
31206
31205
  }
31207
- function skillNameFromFilePath(path14) {
31208
- const parts = path14.split(/[\\/]+/).filter(Boolean);
31206
+ function skillNameFromFilePath(path16) {
31207
+ const parts = path16.split(/[\\/]+/).filter(Boolean);
31209
31208
  if (parts.length < 2 || parts[parts.length - 1].toLowerCase() !== "skill.md") return null;
31210
31209
  const skillName = parts[parts.length - 2];
31211
31210
  return /[*?[\]{}…$]/.test(skillName) || ["skills", ".system"].includes(skillName.toLowerCase()) ? null : skillName;
@@ -31214,19 +31213,19 @@ function skillFilePath(tool, input2) {
31214
31213
  if (!READ_TOOL_NAMES.has(tool.toLowerCase())) return null;
31215
31214
  const parsedInput = typeof input2 === "string" ? safeJsonParse(input2, null) : input2;
31216
31215
  if (!isRecord(parsedInput)) return null;
31217
- const path14 = [parsedInput.path, parsedInput.filePath, parsedInput.file_path].find((value) => typeof value === "string" && value.length > 0);
31218
- return path14 && skillNameFromFilePath(path14) ? path14 : null;
31216
+ const path16 = [parsedInput.path, parsedInput.filePath, parsedInput.file_path].find((value) => typeof value === "string" && value.length > 0);
31217
+ return path16 && skillNameFromFilePath(path16) ? path16 : null;
31219
31218
  }
31220
31219
  function createCallDisplayMessage(message2) {
31221
31220
  if (message2.inputRequest) return { ...message2, type: "tool_call" };
31222
- const path14 = skillFilePath(message2.tool, message2.input);
31223
- const skillName = message2.server.toLowerCase() === "skills" ? message2.tool : path14 ? skillNameFromFilePath(path14) : parseSkillName(message2.tool, message2.input);
31221
+ const path16 = skillFilePath(message2.tool, message2.input);
31222
+ const skillName = message2.server.toLowerCase() === "skills" ? message2.tool : path16 ? skillNameFromFilePath(path16) : parseSkillName(message2.tool, message2.input);
31224
31223
  if (skillName === null) return { ...message2, type: "tool_call" };
31225
31224
  return {
31226
31225
  id: message2.id,
31227
31226
  type: "skill",
31228
31227
  skillName,
31229
- ...path14 ? { path: path14 } : {},
31228
+ ...path16 ? { path: path16 } : {},
31230
31229
  status: message2.status,
31231
31230
  timestamp: message2.timestamp
31232
31231
  };
@@ -31258,11 +31257,11 @@ function userMessageText(message2) {
31258
31257
 
31259
31258
  ${message2.content}` : message2.content;
31260
31259
  }
31261
- function fileContentDiff(path14, content, action) {
31260
+ function fileContentDiff(path16, content, action) {
31262
31261
  const lines = content.replace(/\n$/, "").split("\n");
31263
31262
  return [
31264
- `--- ${action === "add" ? "/dev/null" : `a/${path14}`}`,
31265
- `+++ ${action === "add" ? `b/${path14}` : "/dev/null"}`,
31263
+ `--- ${action === "add" ? "/dev/null" : `a/${path16}`}`,
31264
+ `+++ ${action === "add" ? `b/${path16}` : "/dev/null"}`,
31266
31265
  action === "add" ? `@@ -0,0 +1,${lines.length} @@` : `@@ -1,${lines.length} +0,0 @@`,
31267
31266
  ...lines.map((line) => `${action === "add" ? "+" : "-"}${line}`)
31268
31267
  ].join("\n");
@@ -31277,8 +31276,8 @@ function skillNamesFromCommand(command) {
31277
31276
  if (!SKILL_READ_COMMANDS.has(name) || writesFiles(name, argv) || fileWrites(shellCommand).length > 0) return [];
31278
31277
  const paths = readCommandPaths(name, argv);
31279
31278
  const stdinTarget = shellCommand.stdinTarget?.replaceAll(SHELL_OPAQUE, "\u2026");
31280
- return (paths.length === 0 && stdinTarget ? [stdinTarget] : paths).flatMap((path14) => {
31281
- const resolved = path14.startsWith("~") ? path14 : resolveShellPath(shellCommand.dir, path14)?.replace(SCRIPT_ROOT, "");
31279
+ return (paths.length === 0 && stdinTarget ? [stdinTarget] : paths).flatMap((path16) => {
31280
+ const resolved = path16.startsWith("~") ? path16 : resolveShellPath(shellCommand.dir, path16)?.replace(SCRIPT_ROOT, "");
31282
31281
  const skillName = resolved && skillNameFromFilePath(resolved);
31283
31282
  return skillName ? [skillName] : [];
31284
31283
  });
@@ -31362,7 +31361,7 @@ var init_format2 = __esm({
31362
31361
  PATTERN_FLAGS = /* @__PURE__ */ new Set(["-e", "-f", "--file", "--regexp"]);
31363
31362
  SCRIPT_ROOT = "/";
31364
31363
  commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
31365
- fileWrites = ({ writes }) => writes.filter(({ path: path14 }) => path14 !== "/dev/null");
31364
+ fileWrites = ({ writes }) => writes.filter(({ path: path16 }) => path16 !== "/dev/null");
31366
31365
  SKILL_READ_COMMANDS = /* @__PURE__ */ new Set(["awk", "bat", "cat", "head", "less", "more", "nl", "sed", "tail"]);
31367
31366
  }
31368
31367
  });
@@ -31477,17 +31476,17 @@ var require_visit = __commonJS({
31477
31476
  visit2.BREAK = BREAK;
31478
31477
  visit2.SKIP = SKIP;
31479
31478
  visit2.REMOVE = REMOVE;
31480
- function visit_(key2, node2, visitor, path14) {
31481
- const ctrl = callVisitor(key2, node2, visitor, path14);
31479
+ function visit_(key2, node2, visitor, path16) {
31480
+ const ctrl = callVisitor(key2, node2, visitor, path16);
31482
31481
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
31483
- replaceNode(key2, path14, ctrl);
31484
- return visit_(key2, ctrl, visitor, path14);
31482
+ replaceNode(key2, path16, ctrl);
31483
+ return visit_(key2, ctrl, visitor, path16);
31485
31484
  }
31486
31485
  if (typeof ctrl !== "symbol") {
31487
31486
  if (identity.isCollection(node2)) {
31488
- path14 = Object.freeze(path14.concat(node2));
31487
+ path16 = Object.freeze(path16.concat(node2));
31489
31488
  for (let i = 0; i < node2.items.length; ++i) {
31490
- const ci = visit_(i, node2.items[i], visitor, path14);
31489
+ const ci = visit_(i, node2.items[i], visitor, path16);
31491
31490
  if (typeof ci === "number")
31492
31491
  i = ci - 1;
31493
31492
  else if (ci === BREAK)
@@ -31498,13 +31497,13 @@ var require_visit = __commonJS({
31498
31497
  }
31499
31498
  }
31500
31499
  } else if (identity.isPair(node2)) {
31501
- path14 = Object.freeze(path14.concat(node2));
31502
- const ck = visit_("key", node2.key, visitor, path14);
31500
+ path16 = Object.freeze(path16.concat(node2));
31501
+ const ck = visit_("key", node2.key, visitor, path16);
31503
31502
  if (ck === BREAK)
31504
31503
  return BREAK;
31505
31504
  else if (ck === REMOVE)
31506
31505
  node2.key = null;
31507
- const cv = visit_("value", node2.value, visitor, path14);
31506
+ const cv = visit_("value", node2.value, visitor, path16);
31508
31507
  if (cv === BREAK)
31509
31508
  return BREAK;
31510
31509
  else if (cv === REMOVE)
@@ -31525,17 +31524,17 @@ var require_visit = __commonJS({
31525
31524
  visitAsync.BREAK = BREAK;
31526
31525
  visitAsync.SKIP = SKIP;
31527
31526
  visitAsync.REMOVE = REMOVE;
31528
- async function visitAsync_(key2, node2, visitor, path14) {
31529
- const ctrl = await callVisitor(key2, node2, visitor, path14);
31527
+ async function visitAsync_(key2, node2, visitor, path16) {
31528
+ const ctrl = await callVisitor(key2, node2, visitor, path16);
31530
31529
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
31531
- replaceNode(key2, path14, ctrl);
31532
- return visitAsync_(key2, ctrl, visitor, path14);
31530
+ replaceNode(key2, path16, ctrl);
31531
+ return visitAsync_(key2, ctrl, visitor, path16);
31533
31532
  }
31534
31533
  if (typeof ctrl !== "symbol") {
31535
31534
  if (identity.isCollection(node2)) {
31536
- path14 = Object.freeze(path14.concat(node2));
31535
+ path16 = Object.freeze(path16.concat(node2));
31537
31536
  for (let i = 0; i < node2.items.length; ++i) {
31538
- const ci = await visitAsync_(i, node2.items[i], visitor, path14);
31537
+ const ci = await visitAsync_(i, node2.items[i], visitor, path16);
31539
31538
  if (typeof ci === "number")
31540
31539
  i = ci - 1;
31541
31540
  else if (ci === BREAK)
@@ -31546,13 +31545,13 @@ var require_visit = __commonJS({
31546
31545
  }
31547
31546
  }
31548
31547
  } else if (identity.isPair(node2)) {
31549
- path14 = Object.freeze(path14.concat(node2));
31550
- const ck = await visitAsync_("key", node2.key, visitor, path14);
31548
+ path16 = Object.freeze(path16.concat(node2));
31549
+ const ck = await visitAsync_("key", node2.key, visitor, path16);
31551
31550
  if (ck === BREAK)
31552
31551
  return BREAK;
31553
31552
  else if (ck === REMOVE)
31554
31553
  node2.key = null;
31555
- const cv = await visitAsync_("value", node2.value, visitor, path14);
31554
+ const cv = await visitAsync_("value", node2.value, visitor, path16);
31556
31555
  if (cv === BREAK)
31557
31556
  return BREAK;
31558
31557
  else if (cv === REMOVE)
@@ -31579,23 +31578,23 @@ var require_visit = __commonJS({
31579
31578
  }
31580
31579
  return visitor;
31581
31580
  }
31582
- function callVisitor(key2, node2, visitor, path14) {
31581
+ function callVisitor(key2, node2, visitor, path16) {
31583
31582
  if (typeof visitor === "function")
31584
- return visitor(key2, node2, path14);
31583
+ return visitor(key2, node2, path16);
31585
31584
  if (identity.isMap(node2))
31586
- return visitor.Map?.(key2, node2, path14);
31585
+ return visitor.Map?.(key2, node2, path16);
31587
31586
  if (identity.isSeq(node2))
31588
- return visitor.Seq?.(key2, node2, path14);
31587
+ return visitor.Seq?.(key2, node2, path16);
31589
31588
  if (identity.isPair(node2))
31590
- return visitor.Pair?.(key2, node2, path14);
31589
+ return visitor.Pair?.(key2, node2, path16);
31591
31590
  if (identity.isScalar(node2))
31592
- return visitor.Scalar?.(key2, node2, path14);
31591
+ return visitor.Scalar?.(key2, node2, path16);
31593
31592
  if (identity.isAlias(node2))
31594
- return visitor.Alias?.(key2, node2, path14);
31593
+ return visitor.Alias?.(key2, node2, path16);
31595
31594
  return void 0;
31596
31595
  }
31597
- function replaceNode(key2, path14, node2) {
31598
- const parent = path14[path14.length - 1];
31596
+ function replaceNode(key2, path16, node2) {
31597
+ const parent = path16[path16.length - 1];
31599
31598
  if (identity.isCollection(parent)) {
31600
31599
  parent.items[key2] = node2;
31601
31600
  } else if (identity.isPair(parent)) {
@@ -32205,10 +32204,10 @@ var require_Collection = __commonJS({
32205
32204
  var createNode = require_createNode();
32206
32205
  var identity = require_identity();
32207
32206
  var Node = require_Node();
32208
- function collectionFromPath(schema, path14, value) {
32207
+ function collectionFromPath(schema, path16, value) {
32209
32208
  let v2 = value;
32210
- for (let i = path14.length - 1; i >= 0; --i) {
32211
- const k = path14[i];
32209
+ for (let i = path16.length - 1; i >= 0; --i) {
32210
+ const k = path16[i];
32212
32211
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
32213
32212
  const a = [];
32214
32213
  a[k] = v2;
@@ -32227,7 +32226,7 @@ var require_Collection = __commonJS({
32227
32226
  sourceObjects: /* @__PURE__ */ new Map()
32228
32227
  });
32229
32228
  }
32230
- var isEmptyPath = (path14) => path14 == null || typeof path14 === "object" && !!path14[Symbol.iterator]().next().done;
32229
+ var isEmptyPath = (path16) => path16 == null || typeof path16 === "object" && !!path16[Symbol.iterator]().next().done;
32231
32230
  var Collection = class extends Node.NodeBase {
32232
32231
  constructor(type, schema) {
32233
32232
  super(type);
@@ -32257,11 +32256,11 @@ var require_Collection = __commonJS({
32257
32256
  * be a Pair instance or a `{ key, value }` object, which may not have a key
32258
32257
  * that already exists in the map.
32259
32258
  */
32260
- addIn(path14, value) {
32261
- if (isEmptyPath(path14))
32259
+ addIn(path16, value) {
32260
+ if (isEmptyPath(path16))
32262
32261
  this.add(value);
32263
32262
  else {
32264
- const [key2, ...rest] = path14;
32263
+ const [key2, ...rest] = path16;
32265
32264
  const node2 = this.get(key2, true);
32266
32265
  if (identity.isCollection(node2))
32267
32266
  node2.addIn(rest, value);
@@ -32275,8 +32274,8 @@ var require_Collection = __commonJS({
32275
32274
  * Removes a value from the collection.
32276
32275
  * @returns `true` if the item was found and removed.
32277
32276
  */
32278
- deleteIn(path14) {
32279
- const [key2, ...rest] = path14;
32277
+ deleteIn(path16) {
32278
+ const [key2, ...rest] = path16;
32280
32279
  if (rest.length === 0)
32281
32280
  return this.delete(key2);
32282
32281
  const node2 = this.get(key2, true);
@@ -32290,8 +32289,8 @@ var require_Collection = __commonJS({
32290
32289
  * scalar values from their surrounding node; to disable set `keepScalar` to
32291
32290
  * `true` (collections are always returned intact).
32292
32291
  */
32293
- getIn(path14, keepScalar) {
32294
- const [key2, ...rest] = path14;
32292
+ getIn(path16, keepScalar) {
32293
+ const [key2, ...rest] = path16;
32295
32294
  const node2 = this.get(key2, true);
32296
32295
  if (rest.length === 0)
32297
32296
  return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
@@ -32309,8 +32308,8 @@ var require_Collection = __commonJS({
32309
32308
  /**
32310
32309
  * Checks if the collection includes a value with the key `key`.
32311
32310
  */
32312
- hasIn(path14) {
32313
- const [key2, ...rest] = path14;
32311
+ hasIn(path16) {
32312
+ const [key2, ...rest] = path16;
32314
32313
  if (rest.length === 0)
32315
32314
  return this.has(key2);
32316
32315
  const node2 = this.get(key2, true);
@@ -32320,8 +32319,8 @@ var require_Collection = __commonJS({
32320
32319
  * Sets a value in this collection. For `!!set`, `value` needs to be a
32321
32320
  * boolean to add/remove the item from the set.
32322
32321
  */
32323
- setIn(path14, value) {
32324
- const [key2, ...rest] = path14;
32322
+ setIn(path16, value) {
32323
+ const [key2, ...rest] = path16;
32325
32324
  if (rest.length === 0) {
32326
32325
  this.set(key2, value);
32327
32326
  } else {
@@ -34836,9 +34835,9 @@ var require_Document = __commonJS({
34836
34835
  this.contents.add(value);
34837
34836
  }
34838
34837
  /** Adds a value to the document. */
34839
- addIn(path14, value) {
34838
+ addIn(path16, value) {
34840
34839
  if (assertCollection(this.contents))
34841
- this.contents.addIn(path14, value);
34840
+ this.contents.addIn(path16, value);
34842
34841
  }
34843
34842
  /**
34844
34843
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -34913,14 +34912,14 @@ var require_Document = __commonJS({
34913
34912
  * Removes a value from the document.
34914
34913
  * @returns `true` if the item was found and removed.
34915
34914
  */
34916
- deleteIn(path14) {
34917
- if (Collection.isEmptyPath(path14)) {
34915
+ deleteIn(path16) {
34916
+ if (Collection.isEmptyPath(path16)) {
34918
34917
  if (this.contents == null)
34919
34918
  return false;
34920
34919
  this.contents = null;
34921
34920
  return true;
34922
34921
  }
34923
- return assertCollection(this.contents) ? this.contents.deleteIn(path14) : false;
34922
+ return assertCollection(this.contents) ? this.contents.deleteIn(path16) : false;
34924
34923
  }
34925
34924
  /**
34926
34925
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -34935,10 +34934,10 @@ var require_Document = __commonJS({
34935
34934
  * scalar values from their surrounding node; to disable set `keepScalar` to
34936
34935
  * `true` (collections are always returned intact).
34937
34936
  */
34938
- getIn(path14, keepScalar) {
34939
- if (Collection.isEmptyPath(path14))
34937
+ getIn(path16, keepScalar) {
34938
+ if (Collection.isEmptyPath(path16))
34940
34939
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
34941
- return identity.isCollection(this.contents) ? this.contents.getIn(path14, keepScalar) : void 0;
34940
+ return identity.isCollection(this.contents) ? this.contents.getIn(path16, keepScalar) : void 0;
34942
34941
  }
34943
34942
  /**
34944
34943
  * Checks if the document includes a value with the key `key`.
@@ -34949,10 +34948,10 @@ var require_Document = __commonJS({
34949
34948
  /**
34950
34949
  * Checks if the document includes a value at `path`.
34951
34950
  */
34952
- hasIn(path14) {
34953
- if (Collection.isEmptyPath(path14))
34951
+ hasIn(path16) {
34952
+ if (Collection.isEmptyPath(path16))
34954
34953
  return this.contents !== void 0;
34955
- return identity.isCollection(this.contents) ? this.contents.hasIn(path14) : false;
34954
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path16) : false;
34956
34955
  }
34957
34956
  /**
34958
34957
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -34969,13 +34968,13 @@ var require_Document = __commonJS({
34969
34968
  * Sets a value in this document. For `!!set`, `value` needs to be a
34970
34969
  * boolean to add/remove the item from the set.
34971
34970
  */
34972
- setIn(path14, value) {
34973
- if (Collection.isEmptyPath(path14)) {
34971
+ setIn(path16, value) {
34972
+ if (Collection.isEmptyPath(path16)) {
34974
34973
  this.contents = value;
34975
34974
  } else if (this.contents == null) {
34976
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path14), value);
34975
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path16), value);
34977
34976
  } else if (assertCollection(this.contents)) {
34978
- this.contents.setIn(path14, value);
34977
+ this.contents.setIn(path16, value);
34979
34978
  }
34980
34979
  }
34981
34980
  /**
@@ -36935,9 +36934,9 @@ var require_cst_visit = __commonJS({
36935
36934
  visit2.BREAK = BREAK;
36936
36935
  visit2.SKIP = SKIP;
36937
36936
  visit2.REMOVE = REMOVE;
36938
- visit2.itemAtPath = (cst, path14) => {
36937
+ visit2.itemAtPath = (cst, path16) => {
36939
36938
  let item = cst;
36940
- for (const [field2, index] of path14) {
36939
+ for (const [field2, index] of path16) {
36941
36940
  const tok = item?.[field2];
36942
36941
  if (tok && "items" in tok) {
36943
36942
  item = tok.items[index];
@@ -36946,23 +36945,23 @@ var require_cst_visit = __commonJS({
36946
36945
  }
36947
36946
  return item;
36948
36947
  };
36949
- visit2.parentCollection = (cst, path14) => {
36950
- const parent = visit2.itemAtPath(cst, path14.slice(0, -1));
36951
- const field2 = path14[path14.length - 1][0];
36948
+ visit2.parentCollection = (cst, path16) => {
36949
+ const parent = visit2.itemAtPath(cst, path16.slice(0, -1));
36950
+ const field2 = path16[path16.length - 1][0];
36952
36951
  const coll = parent?.[field2];
36953
36952
  if (coll && "items" in coll)
36954
36953
  return coll;
36955
36954
  throw new Error("Parent collection not found");
36956
36955
  };
36957
- function _visit(path14, item, visitor) {
36958
- let ctrl = visitor(item, path14);
36956
+ function _visit(path16, item, visitor) {
36957
+ let ctrl = visitor(item, path16);
36959
36958
  if (typeof ctrl === "symbol")
36960
36959
  return ctrl;
36961
36960
  for (const field2 of ["key", "value"]) {
36962
36961
  const token = item[field2];
36963
36962
  if (token && "items" in token) {
36964
36963
  for (let i = 0; i < token.items.length; ++i) {
36965
- const ci = _visit(Object.freeze(path14.concat([[field2, i]])), token.items[i], visitor);
36964
+ const ci = _visit(Object.freeze(path16.concat([[field2, i]])), token.items[i], visitor);
36966
36965
  if (typeof ci === "number")
36967
36966
  i = ci - 1;
36968
36967
  else if (ci === BREAK)
@@ -36973,10 +36972,10 @@ var require_cst_visit = __commonJS({
36973
36972
  }
36974
36973
  }
36975
36974
  if (typeof ctrl === "function" && field2 === "key")
36976
- ctrl = ctrl(item, path14);
36975
+ ctrl = ctrl(item, path16);
36977
36976
  }
36978
36977
  }
36979
- return typeof ctrl === "function" ? ctrl(item, path14) : ctrl;
36978
+ return typeof ctrl === "function" ? ctrl(item, path16) : ctrl;
36980
36979
  }
36981
36980
  exports2.visit = visit2;
36982
36981
  }
@@ -38278,14 +38277,14 @@ var require_parser = __commonJS({
38278
38277
  case "scalar":
38279
38278
  case "single-quoted-scalar":
38280
38279
  case "double-quoted-scalar": {
38281
- const fs15 = this.flowScalar(this.type);
38280
+ const fs16 = this.flowScalar(this.type);
38282
38281
  if (atNextItem || it.value) {
38283
- map2.items.push({ start, key: fs15, sep: [] });
38282
+ map2.items.push({ start, key: fs16, sep: [] });
38284
38283
  this.onKeyLine = true;
38285
38284
  } else if (it.sep) {
38286
- this.stack.push(fs15);
38285
+ this.stack.push(fs16);
38287
38286
  } else {
38288
- Object.assign(it, { key: fs15, sep: [] });
38287
+ Object.assign(it, { key: fs16, sep: [] });
38289
38288
  this.onKeyLine = true;
38290
38289
  }
38291
38290
  return;
@@ -38413,13 +38412,13 @@ var require_parser = __commonJS({
38413
38412
  case "scalar":
38414
38413
  case "single-quoted-scalar":
38415
38414
  case "double-quoted-scalar": {
38416
- const fs15 = this.flowScalar(this.type);
38415
+ const fs16 = this.flowScalar(this.type);
38417
38416
  if (!it || it.value)
38418
- fc.items.push({ start: [], key: fs15, sep: [] });
38417
+ fc.items.push({ start: [], key: fs16, sep: [] });
38419
38418
  else if (it.sep)
38420
- this.stack.push(fs15);
38419
+ this.stack.push(fs16);
38421
38420
  else
38422
- Object.assign(it, { key: fs15, sep: [] });
38421
+ Object.assign(it, { key: fs16, sep: [] });
38423
38422
  return;
38424
38423
  }
38425
38424
  case "flow-map-end":
@@ -38967,7 +38966,7 @@ function stripAttachmentNote(text5) {
38967
38966
  if (annotationsNote) content = content.slice(0, annotationsNote.index).trim();
38968
38967
  return {
38969
38968
  content,
38970
- files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([, path14]) => path14) : [],
38969
+ files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([, path16]) => path16) : [],
38971
38970
  walkthroughs,
38972
38971
  appshots,
38973
38972
  annotations: annotationsNote ? parseAnnotationsNote(annotationsNote.body) : []
@@ -39006,7 +39005,7 @@ var init_user_message_attachments = __esm({
39006
39005
  WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
39007
39006
  TRUNCATED_WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]*)(?:" duration_seconds="(\d*))?(?:" audio="(true)?)?[^<]*(?:<\/?[a-z_]*)?$/;
39008
39007
  VIDEO_SIZES_REGEX = /<replicas_instructions>\nThe attached videos' frame sizes, in pixels:((?:\n- .+: \d+x\d+)+)(?:\nFor display only; ignore\.)?\n<\/replicas_instructions>/;
39009
- parseVideoSizes = (raw) => Object.fromEntries([...(raw.match(VIDEO_SIZES_REGEX)?.[1] ?? "").matchAll(/^- (.+): (\d+)x(\d+)$/gm)].map(([, path14, width, height]) => [path14, { width: Number(width), height: Number(height) }]));
39008
+ parseVideoSizes = (raw) => Object.fromEntries([...(raw.match(VIDEO_SIZES_REGEX)?.[1] ?? "").matchAll(/^- (.+): (\d+)x(\d+)$/gm)].map(([, path16, width, height]) => [path16, { width: Number(width), height: Number(height) }]));
39010
39009
  }
39011
39010
  });
39012
39011
 
@@ -40387,7 +40386,7 @@ function parseOpencodeEvents(events) {
40387
40386
  upsertDisplayMessage(messages, {
40388
40387
  id,
40389
40388
  type: "file_change",
40390
- changes: files.map((path14) => ({ path: path14, kind: "update" })),
40389
+ changes: files.map((path16) => ({ path: path16, kind: "update" })),
40391
40390
  status: "completed",
40392
40391
  timestamp: timestamp2
40393
40392
  });
@@ -43585,7 +43584,7 @@ var CLI_VERSION;
43585
43584
  var init_cli_version = __esm({
43586
43585
  "../shared/src/cli-version.ts"() {
43587
43586
  "use strict";
43588
- CLI_VERSION = "0.3.685";
43587
+ CLI_VERSION = "0.3.687";
43589
43588
  }
43590
43589
  });
43591
43590
 
@@ -44136,7 +44135,7 @@ var init_web_auth = __esm({
44136
44135
  });
44137
44136
 
44138
44137
  // ../shared/src/routes/artifacts.ts
44139
- var ARTIFACT_KINDS, ARTIFACT_MUTABILITIES, ARTIFACT_PERMISSIONS, ARTIFACT_LIST_OWNERS, ARTIFACT_DISPLAY_NAME_MAX_LENGTH, artifactMetadataSchema, listArtifactsQuerySchema, listArtifactWorkspacesQuerySchema, updateArtifactRequestSchema, setArtifactShareRequestSchema;
44138
+ var ARTIFACT_KINDS, ARTIFACT_PERMISSIONS, ARTIFACT_LIST_OWNERS, ARTIFACT_DISPLAY_NAME_MAX_LENGTH, artifactMetadataSchema, listArtifactsQuerySchema, listArtifactWorkspacesQuerySchema, updateArtifactRequestSchema, setArtifactShareRequestSchema;
44140
44139
  var init_artifacts2 = __esm({
44141
44140
  "../shared/src/routes/artifacts.ts"() {
44142
44141
  "use strict";
@@ -44144,7 +44143,6 @@ var init_artifacts2 = __esm({
44144
44143
  init_types4();
44145
44144
  init_visuals();
44146
44145
  ARTIFACT_KINDS = CANVAS_ITEM_KINDS.filter((kind) => kind !== "other");
44147
- ARTIFACT_MUTABILITIES = ["mutable", "immutable"];
44148
44146
  ARTIFACT_PERMISSIONS = ["view", "edit"];
44149
44147
  ARTIFACT_LIST_OWNERS = ["me", "others", "organization"];
44150
44148
  ARTIFACT_DISPLAY_NAME_MAX_LENGTH = 200;
@@ -44152,7 +44150,7 @@ var init_artifacts2 = __esm({
44152
44150
  visual_heights: visualHeightsSchema.optional()
44153
44151
  });
44154
44152
  listArtifactsQuerySchema = external_exports.object({
44155
- mutability: external_exports.enum([...ARTIFACT_MUTABILITIES, "all"]).optional(),
44153
+ permanent: external_exports.enum(["true", "false", "all"]).transform((value) => value === "all" ? null : value === "true").optional(),
44156
44154
  owner: external_exports.array(external_exports.enum(ARTIFACT_LIST_OWNERS)),
44157
44155
  kind: external_exports.array(external_exports.enum(ARTIFACT_KINDS)),
44158
44156
  workspace_id: external_exports.string().uuid().optional(),
@@ -44166,8 +44164,9 @@ var init_artifacts2 = __esm({
44166
44164
  owner: external_exports.array(external_exports.union([external_exports.literal("organization"), external_exports.string().uuid()]))
44167
44165
  });
44168
44166
  updateArtifactRequestSchema = external_exports.object({
44169
- display_name: external_exports.string().trim().min(1).max(ARTIFACT_DISPLAY_NAME_MAX_LENGTH)
44170
- });
44167
+ display_name: external_exports.string().trim().min(1).max(ARTIFACT_DISPLAY_NAME_MAX_LENGTH).optional(),
44168
+ permanent: external_exports.boolean().optional()
44169
+ }).refine((body2) => body2.display_name !== void 0 || body2.permanent !== void 0);
44171
44170
  setArtifactShareRequestSchema = external_exports.object({ permission: external_exports.enum(ARTIFACT_PERMISSIONS) });
44172
44171
  }
44173
44172
  });
@@ -57133,8 +57132,8 @@ var init_claude_auth2 = __esm({
57133
57132
  });
57134
57133
 
57135
57134
  // src/lib/muse-oauth.ts
57136
- async function post(path14, body2) {
57137
- return fetch(`${AUTH_URL}${path14}`, {
57135
+ async function post(path16, body2) {
57136
+ return fetch(`${AUTH_URL}${path16}`, {
57138
57137
  method: "POST",
57139
57138
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
57140
57139
  body: body2
@@ -57408,7 +57407,7 @@ async function credentialsGetCommand(service, options) {
57408
57407
  });
57409
57408
  }
57410
57409
  async function credentialsSetCommand(service, options) {
57411
- const path14 = credentialsPath(service, options, true);
57410
+ const path16 = credentialsPath(service, options, true);
57412
57411
  const { org: org2, models, ...fields } = options;
57413
57412
  const secretField = service === "bedrock" ? "aws_secret_access_key" : "api_key";
57414
57413
  const body2 = {
@@ -57416,7 +57415,7 @@ async function credentialsSetCommand(service, options) {
57416
57415
  ...models ? { models: models.split(",").map((model2) => model2.trim()).filter(Boolean) } : {},
57417
57416
  [secretField]: await readSecret(service, secretField === "api_key" ? "API key" : "AWS secret access key")
57418
57417
  };
57419
- const response = await orgAuthenticatedFetch(path14, { method: "POST", body: body2 });
57418
+ const response = await orgAuthenticatedFetch(path16, { method: "POST", body: body2 });
57420
57419
  output2(response, () => console.log(import_chalk19.default.green(`Saved ${scopeLabel(options)} ${service} credentials.`)));
57421
57420
  }
57422
57421
  async function credentialsRemoveCommand(service, options) {
@@ -59128,8 +59127,8 @@ async function chatQueueListCommand(id, chatId) {
59128
59127
  printQueue(queue);
59129
59128
  });
59130
59129
  }
59131
- async function mutateQueue(path14, method, body2) {
59132
- output2(await orgAuthenticatedFetch(path14, { method, body: body2 }), ({ queue }) => {
59130
+ async function mutateQueue(path16, method, body2) {
59131
+ output2(await orgAuthenticatedFetch(path16, { method, body: body2 }), ({ queue }) => {
59133
59132
  if (queue) printQueue(queue);
59134
59133
  else console.log("Done.");
59135
59134
  });
@@ -59143,7 +59142,7 @@ var init_chat = __esm({
59143
59142
  init_api2();
59144
59143
  init_output();
59145
59144
  init_replica2();
59146
- chatPath2 = (id, chatId, path14 = "") => `/v1/replica/${id}/chats/${chatId}${path14}`;
59145
+ chatPath2 = (id, chatId, path16 = "") => `/v1/replica/${id}/chats/${chatId}${path16}`;
59147
59146
  chatQueueClearCommand = (id, chatId) => mutateQueue(chatPath2(id, chatId, "/queue"), "DELETE");
59148
59147
  chatQueueRemoveCommand = (id, chatId, messageId) => mutateQueue(chatPath2(id, chatId, `/queue/${messageId}`), "DELETE");
59149
59148
  chatQueueEditCommand = (id, chatId, messageId, message2) => mutateQueue(chatPath2(id, chatId, `/queue/${messageId}`), "PATCH", { message: message2 });
@@ -59194,7 +59193,7 @@ var init_plugins3 = __esm({
59194
59193
  init_command_utils();
59195
59194
  init_output();
59196
59195
  init_environment3();
59197
- pluginsPath = async ({ env }, path14) => env ? `/v1/environments/${await resolveEnvironmentId(env)}/plugins${path14}` : `/v1/plugins${path14}`;
59196
+ pluginsPath = async ({ env }, path16) => env ? `/v1/environments/${await resolveEnvironmentId(env)}/plugins${path16}` : `/v1/plugins${path16}`;
59198
59197
  }
59199
59198
  });
59200
59199
 
@@ -60216,10 +60215,10 @@ var init_automation = __esm({
60216
60215
  });
60217
60216
 
60218
60217
  // src/lib/agent-api.ts
60219
- async function agentFetch(path14, options) {
60220
- return (await agentRequest(path14, options)).json();
60218
+ async function agentFetch(path16, options) {
60219
+ return (await agentRequest(path16, options)).json();
60221
60220
  }
60222
- async function agentRequest(path14, options) {
60221
+ async function agentRequest(path16, options) {
60223
60222
  const config3 = readAgentConfig();
60224
60223
  if (!config3) {
60225
60224
  throw new Error("Agent mode config not found");
@@ -60235,7 +60234,7 @@ async function agentRequest(path14, options) {
60235
60234
  ...options?.headers || {}
60236
60235
  };
60237
60236
  const body2 = rawBody === void 0 ? void 0 : rawBody instanceof FormData || rawBody instanceof ReadableStream ? rawBody : JSON.stringify(rawBody);
60238
- const response = await fetch(`${MONOLITH_URL}${path14}`, {
60237
+ const response = await fetch(`${MONOLITH_URL}${path16}`, {
60239
60238
  ...options,
60240
60239
  headers,
60241
60240
  body: body2,
@@ -60247,7 +60246,7 @@ async function agentRequest(path14, options) {
60247
60246
  }
60248
60247
  return response;
60249
60248
  }
60250
- async function engineFetch(path14, options) {
60249
+ async function engineFetch(path16, options) {
60251
60250
  const config3 = readAgentConfig();
60252
60251
  if (!config3) {
60253
60252
  throw new Error("Agent mode config not found");
@@ -60257,7 +60256,7 @@ async function engineFetch(path14, options) {
60257
60256
  "Content-Type": "application/json",
60258
60257
  ...options?.headers || {}
60259
60258
  };
60260
- const response = await fetch(`http://localhost:${ENGINE_PORT2}${path14}`, {
60259
+ const response = await fetch(`http://localhost:${ENGINE_PORT2}${path16}`, {
60261
60260
  ...options,
60262
60261
  headers,
60263
60262
  body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0
@@ -60681,27 +60680,88 @@ var init_media_gif = __esm({
60681
60680
  }
60682
60681
  });
60683
60682
 
60683
+ // src/lib/artifact-files.ts
60684
+ function readArtifactFiles() {
60685
+ try {
60686
+ return artifactFilesSchema.parse(JSON.parse(import_node_fs2.default.readFileSync(ARTIFACT_FILES_PATH, "utf8")));
60687
+ } catch {
60688
+ return { files: {} };
60689
+ }
60690
+ }
60691
+ function writeArtifactFiles(record2) {
60692
+ try {
60693
+ const temporary = `${ARTIFACT_FILES_PATH}.${process.pid}.tmp`;
60694
+ import_node_fs2.default.mkdirSync(import_node_path2.default.dirname(ARTIFACT_FILES_PATH), { recursive: true });
60695
+ import_node_fs2.default.writeFileSync(temporary, JSON.stringify(record2, null, 2));
60696
+ import_node_fs2.default.renameSync(temporary, ARTIFACT_FILES_PATH);
60697
+ } catch {
60698
+ }
60699
+ }
60700
+ function sha2562(body2) {
60701
+ return (0, import_node_crypto2.createHash)("sha256").update(body2).digest("hex");
60702
+ }
60703
+ var import_node_crypto2, import_node_fs2, import_node_path2, artifactFilesSchema, ARTIFACT_FILES_PATH;
60704
+ var init_artifact_files = __esm({
60705
+ "src/lib/artifact-files.ts"() {
60706
+ "use strict";
60707
+ import_node_crypto2 = require("crypto");
60708
+ import_node_fs2 = __toESM(require("fs"));
60709
+ import_node_path2 = __toESM(require("path"));
60710
+ init_zod();
60711
+ init_config();
60712
+ artifactFilesSchema = external_exports.looseObject({
60713
+ files: external_exports.record(external_exports.string(), external_exports.looseObject({ artifactId: external_exports.string(), sha256: external_exports.string() }))
60714
+ });
60715
+ ARTIFACT_FILES_PATH = import_node_path2.default.join(CONFIG_DIR, "artifacts.json");
60716
+ }
60717
+ });
60718
+
60684
60719
  // src/commands/artifact.ts
60685
- async function uploadArtifact(filePath, displayName, options) {
60720
+ async function uploadArtifact(filePath, displayName, permanent, record2) {
60686
60721
  const { fileName, body: body2 } = readUploadFile(filePath);
60722
+ const absolutePath = import_node_path3.default.resolve(filePath);
60723
+ const hash2 = sha2562(body2);
60724
+ const saved = record2.files[absolutePath];
60725
+ if (saved?.sha256 === hash2) {
60726
+ const existing = await agentFetch(`/v1/artifacts/${saved.artifactId}`).catch((error62) => {
60727
+ if (error62 instanceof AgentRequestError && error62.status === 404) return null;
60728
+ throw error62;
60729
+ });
60730
+ if (existing?.artifact.permanent === permanent) return { artifact: existing.artifact, outcome: "unchanged" };
60731
+ if (existing) {
60732
+ const { artifact: artifact3 } = await agentFetch(`/v1/artifacts/${saved.artifactId}`, { method: "PATCH", body: { permanent } });
60733
+ return { artifact: artifact3, outcome: permanent ? "kept" : "unkept" };
60734
+ }
60735
+ }
60687
60736
  const form = new FormData();
60688
60737
  form.append("file", new Blob([body2]), fileName);
60689
60738
  form.append("display_name", displayName);
60690
- form.append("mutability", options.immutable ? "immutable" : "mutable");
60739
+ form.append("permanent", String(permanent));
60691
60740
  const { artifact: artifact2 } = await agentFetch("/v1/artifacts", { method: "POST", body: form });
60692
- return artifact2;
60741
+ record2.files[absolutePath] = { artifactId: artifact2.id, sha256: hash2 };
60742
+ return { artifact: artifact2, outcome: "saved" };
60693
60743
  }
60694
60744
  async function artifactUploadCommand(filePaths, options) {
60695
60745
  if (!isAgentMode()) throw new Error("Run this inside a Replicas workspace. Only workspaces can upload artifacts.");
60746
+ if (options.permanent !== "true" && options.permanent !== "false") {
60747
+ throw new Error([
60748
+ "Pass --permanent false or --permanent true.",
60749
+ "--permanent false: deleted with this workspace. Screenshots, recordings, GIFs, test output, one-off renders, and working files such as plans and notes. If unsure, false.",
60750
+ "--permanent true: kept after the workspace is gone. Only when the person asked to keep it, or it is the finished deliverable of the task (a report, dashboard or dataset)."
60751
+ ].join("\n"));
60752
+ }
60753
+ const permanent = options.permanent === "true";
60696
60754
  const names = requireNamePerFile(filePaths, options.name ?? []);
60755
+ const record2 = readArtifactFiles();
60697
60756
  const results = await Promise.allSettled(
60698
- filePaths.map((filePath, i) => uploadArtifact(filePath, names[i], options))
60757
+ filePaths.map((filePath, i) => uploadArtifact(filePath, names[i], permanent, record2))
60699
60758
  );
60759
+ writeArtifactFiles(record2);
60700
60760
  const uploads = [];
60701
60761
  const failures = [];
60702
60762
  results.forEach((result, i) => {
60703
60763
  if (result.status === "fulfilled") {
60704
- uploads.push({ file: filePaths[i], artifact: result.value });
60764
+ uploads.push({ file: filePaths[i], ...result.value });
60705
60765
  } else {
60706
60766
  const reason = result.reason instanceof Error ? result.reason.message : String(result.reason);
60707
60767
  failures.push(`${filePaths[i]}: ${reason}`);
@@ -60709,10 +60769,11 @@ async function artifactUploadCommand(filePaths, options) {
60709
60769
  });
60710
60770
  const workspaceId = readAgentConfig()?.workspace_id;
60711
60771
  output2({ uploads }, () => {
60712
- for (const { artifact: artifact2 } of uploads) {
60772
+ for (const { artifact: artifact2, outcome } of uploads) {
60713
60773
  const size = formatBytes(artifact2.size_bytes);
60714
60774
  const visibility = artifact2.owner ? `Private to ${artifact2.owner.display_name} until shared.` : "This workspace has no owner, so it belongs to the organization: everyone in it can see, rename and delete it.";
60715
- console.log(`Saved artifact "${artifact2.display_name}" (${artifact2.kind}, ${size}). ${visibility}`);
60775
+ const lifetime = artifact2.permanent ? "Permanent: kept after this workspace is gone." : "Temporary: deleted with this workspace.";
60776
+ console.log(`${OUTCOME_LABELS[outcome]} "${artifact2.display_name}" (${artifact2.kind}, ${size}). ${lifetime} ${visibility}`);
60716
60777
  const mediaKind = MEDIA_KINDS.find((kind) => kind === artifact2.kind);
60717
60778
  if (!mediaKind) {
60718
60779
  console.log(`[${markdownLabel(artifact2.display_name)}](${getArtifactUrl(artifact2.id)})`);
@@ -60727,8 +60788,8 @@ async function artifactUploadCommand(filePaths, options) {
60727
60788
  }
60728
60789
  async function artifactListCommand(options) {
60729
60790
  const query = new URLSearchParams();
60730
- if (options.all) query.set("mutability", "all");
60731
- else if (options.immutable) query.set("mutability", "immutable");
60791
+ if (options.all) query.set("permanent", "all");
60792
+ else if (options.permanent) query.set("permanent", options.permanent);
60732
60793
  for (const owner of options.owner ?? []) query.append("owner", owner);
60733
60794
  for (const kind of options.kind ?? []) query.append("kind", kind);
60734
60795
  if (options.workspace) {
@@ -60744,15 +60805,15 @@ async function artifactListCommand(options) {
60744
60805
  for (const artifact2 of artifacts) {
60745
60806
  const owner = artifact2.owner?.email ?? "organization";
60746
60807
  const size = formatBytes(artifact2.size_bytes);
60747
- const columns = [artifact2.id, artifact2.kind, artifact2.mutability, artifact2.display_name, owner, size, artifact2.updated_at];
60808
+ const columns = [artifact2.id, artifact2.kind, artifact2.permanent ? "permanent" : "temporary", artifact2.display_name, owner, size, artifact2.updated_at];
60748
60809
  console.log(columns.join(" "));
60749
60810
  }
60750
60811
  if (total > artifacts.length) console.log(`Showing ${artifacts.length} of ${total}. Use --page for more.`);
60751
60812
  });
60752
60813
  }
60753
60814
  async function artifactUrlCommand(artifactId) {
60754
- const path14 = `/v1/artifacts/${artifactId}/url?disposition=attachment`;
60755
- const response = await orgAuthenticatedFetch(path14);
60815
+ const path16 = `/v1/artifacts/${artifactId}/url?disposition=attachment`;
60816
+ const response = await orgAuthenticatedFetch(path16);
60756
60817
  output2(response, ({ url: url2 }) => console.log(url2));
60757
60818
  }
60758
60819
  async function artifactRenameCommand(artifactId, name) {
@@ -60782,13 +60843,13 @@ async function artifactShareCommand(artifactId, options) {
60782
60843
  if (!permission) {
60783
60844
  throw new Error(`Invalid permission '${options.permission}'. Must be one of: ${ARTIFACT_PERMISSIONS.join(", ")}`);
60784
60845
  }
60785
- const { path: path14, granteeName } = await resolveGrantPath(artifactId, options);
60786
- const { share: share2 } = await orgAuthenticatedFetch(path14, { method: "PUT", body: { permission } });
60846
+ const { path: path16, granteeName } = await resolveGrantPath(artifactId, options);
60847
+ const { share: share2 } = await orgAuthenticatedFetch(path16, { method: "PUT", body: { permission } });
60787
60848
  output2({ share: share2 }, () => console.log(`Shared artifact ${artifactId} with ${granteeName} (${share2.permission}).`));
60788
60849
  }
60789
60850
  async function artifactUnshareCommand(artifactId, options) {
60790
- const { path: path14, granteeName } = await resolveGrantPath(artifactId, options);
60791
- await orgAuthenticatedFetch(path14, { method: "DELETE" });
60851
+ const { path: path16, granteeName } = await resolveGrantPath(artifactId, options);
60852
+ await orgAuthenticatedFetch(path16, { method: "DELETE" });
60792
60853
  outputSuccess(`Artifact ${artifactId} is no longer shared with ${granteeName}.`);
60793
60854
  }
60794
60855
  async function artifactSharesCommand(artifactId) {
@@ -60799,16 +60860,25 @@ async function artifactSharesCommand(artifactId) {
60799
60860
  for (const share2 of users) console.log(`${share2.user?.email} ${share2.permission}`);
60800
60861
  });
60801
60862
  }
60863
+ var import_node_path3, OUTCOME_LABELS;
60802
60864
  var init_artifact = __esm({
60803
60865
  "src/commands/artifact.ts"() {
60804
60866
  "use strict";
60867
+ import_node_path3 = __toESM(require("path"));
60805
60868
  init_src();
60806
60869
  init_agent_api();
60870
+ init_artifact_files();
60807
60871
  init_api2();
60808
60872
  init_command_utils();
60809
60873
  init_config();
60810
60874
  init_members();
60811
60875
  init_output();
60876
+ OUTCOME_LABELS = {
60877
+ saved: "Saved artifact",
60878
+ unchanged: "Already saved, nothing uploaded:",
60879
+ kept: "Now permanent:",
60880
+ unkept: "Now temporary:"
60881
+ };
60812
60882
  }
60813
60883
  });
60814
60884
 
@@ -60833,12 +60903,12 @@ async function callIssueTool(name, args, schema, printHuman) {
60833
60903
  async function uploadAttachments(files) {
60834
60904
  if (!files?.length) return void 0;
60835
60905
  if (!isAgentMode()) throw new Error("--attach works inside a workspace. Elsewhere, embed an image URL in the markdown.");
60836
- const uploaded = await Promise.all(files.map((file2) => uploadOne(file2, import_node_path2.default.basename(file2), resolveKind(import_node_path2.default.extname(file2).slice(1).toLowerCase()), {})));
60906
+ const uploaded = await Promise.all(files.map((file2) => uploadOne(file2, import_node_path4.default.basename(file2), resolveKind(import_node_path4.default.extname(file2).slice(1).toLowerCase()), {})));
60837
60907
  return uploaded.map(({ media: media2 }) => media2.id);
60838
60908
  }
60839
60909
  function readText2(inline, file2, what) {
60840
60910
  if (inline !== void 0 && file2 !== void 0) throw new Error(`Pass either --${what} or --${what}-file, not both`);
60841
- return file2 === void 0 ? inline : import_node_fs2.default.readFileSync(file2 === "-" ? 0 : file2, "utf8");
60911
+ return file2 === void 0 ? inline : import_node_fs3.default.readFileSync(file2 === "-" ? 0 : file2, "utf8");
60842
60912
  }
60843
60913
  async function issueCreateCommand(title3, options) {
60844
60914
  await callIssueTool(ISSUE_COMMANDS.create, {
@@ -60940,12 +61010,12 @@ async function issueUnlinkPrCommand(issue3, url2) {
60940
61010
  async function issueRelateCommand(issue3, type, related) {
60941
61011
  await callIssueTool(ISSUE_COMMANDS.relate, { issue: issue3, type, related_issue: related }, noData, () => console.log(`${import_chalk30.default.green("\u2713")} ${issue3} ${type.replace("_", " ")} ${related}`));
60942
61012
  }
60943
- var import_node_fs2, import_node_path2, import_chalk30, mutationSchema, noData, csv, issueLine, printMutation;
61013
+ var import_node_fs3, import_node_path4, import_chalk30, mutationSchema, noData, csv, issueLine, printMutation;
60944
61014
  var init_issue = __esm({
60945
61015
  "src/commands/issue.ts"() {
60946
61016
  "use strict";
60947
- import_node_fs2 = __toESM(require("fs"));
60948
- import_node_path2 = __toESM(require("path"));
61017
+ import_node_fs3 = __toESM(require("fs"));
61018
+ import_node_path4 = __toESM(require("path"));
60949
61019
  import_chalk30 = __toESM(require("chalk"));
60950
61020
  init_zod();
60951
61021
  init_src();
@@ -61408,16 +61478,16 @@ function computeExecCommand(kind) {
61408
61478
  return async (command, options) => {
61409
61479
  if (command.length === 0) throw new Error(`Pass a command after --, e.g. replicas ${kind} exec -- ${kind === "gpu" ? "nvidia-smi" : "xcodebuild -version"}`);
61410
61480
  const sandboxId = await resolveSandboxId(kind, options);
61411
- const path14 = `${BASE}/${sandboxId}/exec`;
61481
+ const path16 = `${BASE}/${sandboxId}/exec`;
61412
61482
  if (options.detach) {
61413
- const { jobId } = await agentFetch(path14, execRequest(command.join(" "), options));
61483
+ const { jobId } = await agentFetch(path16, execRequest(command.join(" "), options));
61414
61484
  output2({ jobId, sandboxId }, () => {
61415
61485
  console.log(`Started job ${import_chalk31.default.bold(jobId)} in ${sandboxId}`);
61416
61486
  console.log(import_chalk31.default.gray(`Follow it with: replicas ${kind} logs ${jobId} -f`));
61417
61487
  });
61418
61488
  return;
61419
61489
  }
61420
- const exitCode = await streamOutput(await agentRequest(path14, execRequest(command.join(" "), options)));
61490
+ const exitCode = await streamOutput(await agentRequest(path16, execRequest(command.join(" "), options)));
61421
61491
  process.exitCode = exitCode ?? 1;
61422
61492
  if (isJsonMode()) output2({ sandboxId, exitCode }, () => {
61423
61493
  });
@@ -61450,21 +61520,21 @@ function assertTransferSize(bytes, localPath) {
61450
61520
  }
61451
61521
  }
61452
61522
  function archive(localPath) {
61453
- const path14 = (0, import_node_path3.resolve)(localPath);
61454
- if (!(0, import_node_fs3.existsSync)(path14)) throw new Error(`${path14} does not exist`);
61455
- if (!(0, import_node_fs3.statSync)(path14).isDirectory()) {
61456
- assertTransferSize((0, import_node_fs3.statSync)(path14).size, localPath);
61457
- return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", (0, import_node_path3.dirname)(path14), (0, import_node_path3.basename)(path14)], { stdio: ["ignore", "pipe", "pipe"] });
61523
+ const path16 = (0, import_node_path5.resolve)(localPath);
61524
+ if (!(0, import_node_fs4.existsSync)(path16)) throw new Error(`${path16} does not exist`);
61525
+ if (!(0, import_node_fs4.statSync)(path16).isDirectory()) {
61526
+ assertTransferSize((0, import_node_fs4.statSync)(path16).size, localPath);
61527
+ return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", (0, import_node_path5.dirname)(path16), (0, import_node_path5.basename)(path16)], { stdio: ["ignore", "pipe", "pipe"] });
61458
61528
  }
61459
- const listed = (0, import_node_child_process2.spawnSync)("git", ["-C", path14, "ls-files", "-co", "--exclude-standard", "-z"], { maxBuffer: 256 * 1024 * 1024 });
61529
+ const listed = (0, import_node_child_process2.spawnSync)("git", ["-C", path16, "ls-files", "-co", "--exclude-standard", "-z"], { maxBuffer: 256 * 1024 * 1024 });
61460
61530
  if (listed.status !== 0) {
61461
- const du = (0, import_node_child_process2.spawnSync)("du", ["-sk", "--exclude=.git", "--exclude=node_modules", path14]);
61531
+ const du = (0, import_node_child_process2.spawnSync)("du", ["-sk", "--exclude=.git", "--exclude=node_modules", path16]);
61462
61532
  assertTransferSize(Number(du.stdout.toString().split(" ")[0]) * 1024, localPath);
61463
- return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", path14, "--exclude=.git", "--exclude=node_modules", "."], { stdio: ["ignore", "pipe", "pipe"] });
61533
+ return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", path16, "--exclude=.git", "--exclude=node_modules", "."], { stdio: ["ignore", "pipe", "pipe"] });
61464
61534
  }
61465
- const files = listed.stdout.toString().split("\0").filter((file2) => file2 && (0, import_node_fs3.existsSync)((0, import_node_path3.join)(path14, file2)));
61466
- assertTransferSize(files.reduce((total, file2) => total + (0, import_node_fs3.statSync)((0, import_node_path3.join)(path14, file2)).size, 0), localPath);
61467
- const child = (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", path14, "--null", "-T", "-"], { stdio: ["pipe", "pipe", "pipe"] });
61535
+ const files = listed.stdout.toString().split("\0").filter((file2) => file2 && (0, import_node_fs4.existsSync)((0, import_node_path5.join)(path16, file2)));
61536
+ assertTransferSize(files.reduce((total, file2) => total + (0, import_node_fs4.statSync)((0, import_node_path5.join)(path16, file2)).size, 0), localPath);
61537
+ const child = (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", path16, "--null", "-T", "-"], { stdio: ["pipe", "pipe", "pipe"] });
61468
61538
  child.stdin.end(files.map((file2) => `${file2}\0`).join(""));
61469
61539
  return child;
61470
61540
  }
@@ -61479,17 +61549,17 @@ async function push(sandboxId, localPath, remotePath) {
61479
61549
  });
61480
61550
  const exited = new Promise((done) => tar.on("close", done));
61481
61551
  const pathQuery = `?path=${encodeURIComponent(remotePath)}`;
61482
- const archivePath = (0, import_node_path3.join)((0, import_node_os2.tmpdir)(), `replicas-push-${(0, import_node_crypto2.randomUUID)()}.tgz`);
61552
+ const archivePath = (0, import_node_path5.join)((0, import_node_os2.tmpdir)(), `replicas-push-${(0, import_node_crypto3.randomUUID)()}.tgz`);
61483
61553
  try {
61484
- await (0, import_promises.pipeline)(tar.stdout, (0, import_node_fs3.createWriteStream)(archivePath, { mode: 384 }));
61554
+ await (0, import_promises.pipeline)(tar.stdout, (0, import_node_fs4.createWriteStream)(archivePath, { mode: 384 }));
61485
61555
  if (await exited !== 0) throw new Error(`Archiving ${localPath} failed: ${stderr.trim()}`);
61486
61556
  try {
61487
- const size = (0, import_node_fs3.statSync)(archivePath).size;
61557
+ const size = (0, import_node_fs4.statSync)(archivePath).size;
61488
61558
  const { uploadId, uploadUrl } = await agentFetch(`${BASE}/${sandboxId}/uploads`, {
61489
61559
  method: "POST",
61490
61560
  body: { size }
61491
61561
  });
61492
- const chunks = (0, import_node_fs3.createReadStream)(archivePath)[Symbol.asyncIterator]();
61562
+ const chunks = (0, import_node_fs4.createReadStream)(archivePath)[Symbol.asyncIterator]();
61493
61563
  const upload = {
61494
61564
  method: "PUT",
61495
61565
  headers: { "content-type": "application/gzip", "content-length": String(size) },
@@ -61507,10 +61577,10 @@ async function push(sandboxId, localPath, remotePath) {
61507
61577
  await agentRequest(`${BASE}/${sandboxId}/uploads/${uploadId}/extract`, { method: "POST", body: { path: remotePath } });
61508
61578
  } catch (error62) {
61509
61579
  if (!mustStream(error62)) throw error62;
61510
- await agentRequest(`${BASE}/${sandboxId}/files${pathQuery}`, { method: "PUT", body: import_node_stream.Readable.toWeb((0, import_node_fs3.createReadStream)(archivePath)) });
61580
+ await agentRequest(`${BASE}/${sandboxId}/files${pathQuery}`, { method: "PUT", body: import_node_stream.Readable.toWeb((0, import_node_fs4.createReadStream)(archivePath)) });
61511
61581
  }
61512
61582
  } finally {
61513
- (0, import_node_fs3.rmSync)(archivePath, { force: true });
61583
+ (0, import_node_fs4.rmSync)(archivePath, { force: true });
61514
61584
  }
61515
61585
  }
61516
61586
  function computePushCommand(kind) {
@@ -61530,7 +61600,7 @@ async function pull(sandboxId, remotePath, localPath) {
61530
61600
  response = await agentRequest(`${BASE}/${sandboxId}/files?path=${encodeURIComponent(remotePath)}`);
61531
61601
  }
61532
61602
  if (!response.ok || !response.body) throw new Error(`Downloading ${remotePath} failed (${response.status})`);
61533
- (0, import_node_fs3.mkdirSync)(localPath, { recursive: true });
61603
+ (0, import_node_fs4.mkdirSync)(localPath, { recursive: true });
61534
61604
  const tar = (0, import_node_child_process2.spawn)("tar", ["-xzf", "-", "-C", localPath], { stdio: ["pipe", "ignore", "pipe"] });
61535
61605
  let stderr = "";
61536
61606
  tar.stderr.on("data", (chunk) => {
@@ -61571,16 +61641,16 @@ function computeRunCommand(kind) {
61571
61641
  }
61572
61642
  };
61573
61643
  }
61574
- var import_chalk31, import_node_child_process2, import_node_crypto2, import_node_fs3, import_node_os2, import_node_path3, import_node_stream, import_promises, BASE, CREATE_POLL_INTERVAL_MS, CREATE_WAIT_TIMEOUT_MS;
61644
+ var import_chalk31, import_node_child_process2, import_node_crypto3, import_node_fs4, import_node_os2, import_node_path5, import_node_stream, import_promises, BASE, CREATE_POLL_INTERVAL_MS, CREATE_WAIT_TIMEOUT_MS;
61575
61645
  var init_compute2 = __esm({
61576
61646
  "src/commands/compute.ts"() {
61577
61647
  "use strict";
61578
61648
  import_chalk31 = __toESM(require("chalk"));
61579
61649
  import_node_child_process2 = require("child_process");
61580
- import_node_crypto2 = require("crypto");
61581
- import_node_fs3 = require("fs");
61650
+ import_node_crypto3 = require("crypto");
61651
+ import_node_fs4 = require("fs");
61582
61652
  import_node_os2 = require("os");
61583
- import_node_path3 = require("path");
61653
+ import_node_path5 = require("path");
61584
61654
  import_node_stream = require("stream");
61585
61655
  import_promises = require("stream/promises");
61586
61656
  init_src();
@@ -61643,9 +61713,9 @@ async function readConfigFile(filename) {
61643
61713
  async function sourceInput2(options) {
61644
61714
  if (options.file && options.repository) throw new Error("Choose either --file or --repository");
61645
61715
  if (options.file) {
61646
- const filename = (0, import_node_path4.resolve)(options.file);
61716
+ const filename = (0, import_node_path6.resolve)(options.file);
61647
61717
  const entrypoint = await readConfigFile(filename);
61648
- const result = await resolveReplicasEnvironmentConfig(entrypoint, async (pointer) => createSuccessResult(await readConfigFile((0, import_node_path4.resolve)((0, import_node_path4.dirname)(filename), pointer))));
61718
+ const result = await resolveReplicasEnvironmentConfig(entrypoint, async (pointer) => createSuccessResult(await readConfigFile((0, import_node_path6.resolve)((0, import_node_path6.dirname)(filename), pointer))));
61649
61719
  if (!result.ok) throw new Error(result.error.message);
61650
61720
  return { file: { filename: result.data.filename, environment: result.data.config.environment } };
61651
61721
  }
@@ -61715,13 +61785,13 @@ async function environmentConfigAutoApplyCommand(environment2, mode) {
61715
61785
  body: { auto_apply: mode === "on" }
61716
61786
  }), printSource);
61717
61787
  }
61718
- var import_chalk32, import_promises2, import_node_path4;
61788
+ var import_chalk32, import_promises2, import_node_path6;
61719
61789
  var init_environment_config2 = __esm({
61720
61790
  "src/commands/environment-config.ts"() {
61721
61791
  "use strict";
61722
61792
  import_chalk32 = __toESM(require("chalk"));
61723
61793
  import_promises2 = require("fs/promises");
61724
- import_node_path4 = require("path");
61794
+ import_node_path6 = require("path");
61725
61795
  init_src();
61726
61796
  init_api2();
61727
61797
  init_command_utils();
@@ -61738,18 +61808,18 @@ async function historyTranscriptCommand(name) {
61738
61808
  throw new Error(`Invalid session name '${name}'. Use the name from INDEX.md, e.g. 2026-01-31-<id>`);
61739
61809
  }
61740
61810
  const response = await agentRequest(`/v1/engine/history/transcripts/${session}`);
61741
- const dir = (0, import_node_path5.join)(HISTORY_ROOT, "transcripts");
61742
- (0, import_node_fs4.mkdirSync)(dir, { recursive: true });
61743
- const file2 = (0, import_node_path5.join)(dir, `${session}.jsonl`);
61744
- (0, import_node_fs4.writeFileSync)(file2, Buffer.from(await response.arrayBuffer()));
61811
+ const dir = (0, import_node_path7.join)(HISTORY_ROOT, "transcripts");
61812
+ (0, import_node_fs5.mkdirSync)(dir, { recursive: true });
61813
+ const file2 = (0, import_node_path7.join)(dir, `${session}.jsonl`);
61814
+ (0, import_node_fs5.writeFileSync)(file2, Buffer.from(await response.arrayBuffer()));
61745
61815
  output2({ path: file2 }, () => console.log(file2));
61746
61816
  }
61747
- var import_node_fs4, import_node_path5;
61817
+ var import_node_fs5, import_node_path7;
61748
61818
  var init_history = __esm({
61749
61819
  "src/commands/history.ts"() {
61750
61820
  "use strict";
61751
- import_node_fs4 = require("fs");
61752
- import_node_path5 = require("path");
61821
+ import_node_fs5 = require("fs");
61822
+ import_node_path7 = require("path");
61753
61823
  init_src();
61754
61824
  init_agent_api();
61755
61825
  init_output();
@@ -61763,7 +61833,7 @@ async function skillsSuggestCommand(file2, options) {
61763
61833
  throw new Error(`Invalid --scope '${options.scope}'. Use one of: ${LEARNED_SKILL_SCOPES.join(", ")}`);
61764
61834
  }
61765
61835
  const target = scope ? { scope } : {};
61766
- const body2 = options.delete ? { remove: options.delete, ...target } : file2 && options.title ? { content: (0, import_node_fs5.readFileSync)(file2, "utf-8"), title: options.title, ...target } : null;
61836
+ const body2 = options.delete ? { remove: options.delete, ...target } : file2 && options.title ? { content: (0, import_node_fs6.readFileSync)(file2, "utf-8"), title: options.title, ...target } : null;
61767
61837
  if (!body2) throw new Error("Pass a SKILL.md file with --title, or --delete <name-or-id>");
61768
61838
  const { id, name, update, scope: resolvedScope, managerWorkspaceId } = await agentFetch("/v1/learned-skills/suggestions", {
61769
61839
  method: "POST",
@@ -61784,7 +61854,7 @@ async function skillsListCommand() {
61784
61854
  });
61785
61855
  }
61786
61856
  async function skillsCreateCommand(file2, options) {
61787
- const body2 = { content: (0, import_node_fs5.readFileSync)(file2, "utf-8"), title: options.title };
61857
+ const body2 = { content: (0, import_node_fs6.readFileSync)(file2, "utf-8"), title: options.title };
61788
61858
  output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body: body2 }), ({ id, name }) => console.log(import_chalk33.default.green(`Saved learning '${name}' (${id})`)));
61789
61859
  }
61790
61860
  async function skillsUpdateCommand(id, options) {
@@ -61793,7 +61863,7 @@ async function skillsUpdateCommand(id, options) {
61793
61863
  if (!existing) throw new Error(`Learning not found: ${id}`);
61794
61864
  const body2 = {
61795
61865
  title: options.title ?? existing.title,
61796
- content: options.file ? (0, import_node_fs5.readFileSync)(options.file, "utf-8") : existing.content
61866
+ content: options.file ? (0, import_node_fs6.readFileSync)(options.file, "utf-8") : existing.content
61797
61867
  };
61798
61868
  output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body: body2 }), ({ name }) => console.log(import_chalk33.default.green(`Updated learning '${name}'`)));
61799
61869
  }
@@ -61801,11 +61871,11 @@ async function skillsDeleteCommand(id) {
61801
61871
  await orgAuthenticatedFetch(`/v1/learned-skills/${id}`, { method: "DELETE" });
61802
61872
  outputSuccess(`Deleted learning ${id}`);
61803
61873
  }
61804
- var import_node_fs5, import_chalk33;
61874
+ var import_node_fs6, import_chalk33;
61805
61875
  var init_skills = __esm({
61806
61876
  "src/commands/skills.ts"() {
61807
61877
  "use strict";
61808
- import_node_fs5 = require("fs");
61878
+ import_node_fs6 = require("fs");
61809
61879
  import_chalk33 = __toESM(require("chalk"));
61810
61880
  init_src();
61811
61881
  init_agent_api();
@@ -61910,7 +61980,7 @@ function tailLines(content, lines) {
61910
61980
  return all.slice(-lines).join("\n").trim();
61911
61981
  }
61912
61982
  function statePath(name) {
61913
- return (0, import_node_path6.join)(SERVICES_DIR, `${name}.json`);
61983
+ return (0, import_node_path8.join)(SERVICES_DIR, `${name}.json`);
61914
61984
  }
61915
61985
  function isServiceState(value) {
61916
61986
  if (typeof value !== "object" || value === null) return false;
@@ -61920,7 +61990,7 @@ function isServiceState(value) {
61920
61990
  function readState(name) {
61921
61991
  let parsed;
61922
61992
  try {
61923
- parsed = JSON.parse((0, import_node_fs6.readFileSync)(statePath(name), "utf-8"));
61993
+ parsed = JSON.parse((0, import_node_fs7.readFileSync)(statePath(name), "utf-8"));
61924
61994
  } catch {
61925
61995
  return null;
61926
61996
  }
@@ -61940,15 +62010,15 @@ function sleep(ms) {
61940
62010
  function tailLog(logFile, lines) {
61941
62011
  let fd;
61942
62012
  try {
61943
- fd = (0, import_node_fs6.openSync)(logFile, "r");
61944
- const { size } = (0, import_node_fs6.fstatSync)(fd);
62013
+ fd = (0, import_node_fs7.openSync)(logFile, "r");
62014
+ const { size } = (0, import_node_fs7.fstatSync)(fd);
61945
62015
  const buffer = Buffer.alloc(Math.min(size, LOG_KEEP_BYTES));
61946
- const read = (0, import_node_fs6.readSync)(fd, buffer, 0, buffer.length, size - buffer.length);
62016
+ const read = (0, import_node_fs7.readSync)(fd, buffer, 0, buffer.length, size - buffer.length);
61947
62017
  return tailLines(buffer.toString("utf-8", 0, read), lines);
61948
62018
  } catch {
61949
62019
  return "";
61950
62020
  } finally {
61951
- if (fd !== void 0) (0, import_node_fs6.closeSync)(fd);
62021
+ if (fd !== void 0) (0, import_node_fs7.closeSync)(fd);
61952
62022
  }
61953
62023
  }
61954
62024
  async function serviceStartCommand(name, commandParts, options) {
@@ -61964,11 +62034,11 @@ async function serviceStartCommand(name, commandParts, options) {
61964
62034
  console.log(`Stopping existing "${name}" (pid ${existing.pid}) before restart`);
61965
62035
  await stopProcessGroups([existing.pid], 5e3);
61966
62036
  }
61967
- (0, import_node_fs6.mkdirSync)(SERVICES_DIR, { recursive: true });
61968
- const cwd = (0, import_node_path6.resolve)(options.cwd ?? process.cwd());
61969
- const logFile = (0, import_node_path6.join)(SERVICES_DIR, `${name}.log`);
61970
- const logFd = (0, import_node_fs6.openSync)(logFile, "a");
61971
- (0, import_node_fs6.writeFileSync)(logFd, `
62037
+ (0, import_node_fs7.mkdirSync)(SERVICES_DIR, { recursive: true });
62038
+ const cwd = (0, import_node_path8.resolve)(options.cwd ?? process.cwd());
62039
+ const logFile = (0, import_node_path8.join)(SERVICES_DIR, `${name}.log`);
62040
+ const logFd = (0, import_node_fs7.openSync)(logFile, "a");
62041
+ (0, import_node_fs7.writeFileSync)(logFd, `
61972
62042
  === [replicas service] "${name}" started ${(/* @__PURE__ */ new Date()).toISOString()} in ${cwd}: ${command} ===
61973
62043
  `);
61974
62044
  const child = (0, import_node_child_process3.spawn)("bash", ["-lc", command], {
@@ -61977,7 +62047,7 @@ async function serviceStartCommand(name, commandParts, options) {
61977
62047
  stdio: ["ignore", logFd, logFd],
61978
62048
  env: process.env
61979
62049
  });
61980
- (0, import_node_fs6.closeSync)(logFd);
62050
+ (0, import_node_fs7.closeSync)(logFd);
61981
62051
  if (child.pid === void 0) {
61982
62052
  throw new Error("Failed to spawn service process");
61983
62053
  }
@@ -61991,11 +62061,11 @@ async function serviceStartCommand(name, commandParts, options) {
61991
62061
  logFile,
61992
62062
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
61993
62063
  };
61994
- (0, import_node_fs6.writeFileSync)(statePath(name), JSON.stringify(state, null, 2));
62064
+ (0, import_node_fs7.writeFileSync)(statePath(name), JSON.stringify(state, null, 2));
61995
62065
  await sleep(1e3);
61996
62066
  if (!isRunning(child.pid)) {
61997
62067
  const logs = tailLog(logFile, 20);
61998
- (0, import_node_fs6.rmSync)(statePath(name), { force: true });
62068
+ (0, import_node_fs7.rmSync)(statePath(name), { force: true });
61999
62069
  throw new Error(`Service "${name}" exited immediately.${logs ? `
62000
62070
 
62001
62071
  Last log output:
@@ -62013,7 +62083,7 @@ async function serviceStopCommand(name) {
62013
62083
  }
62014
62084
  const wasRunning = isRunning(state.pid);
62015
62085
  if (wasRunning) await stopProcessGroups([state.pid], 5e3);
62016
- (0, import_node_fs6.rmSync)(statePath(name), { force: true });
62086
+ (0, import_node_fs7.rmSync)(statePath(name), { force: true });
62017
62087
  output2({ name, pid: state.pid, was_running: wasRunning }, () => {
62018
62088
  console.log(wasRunning ? `Stopped "${name}" (pid ${state.pid})` : `Service "${name}" was not running`);
62019
62089
  });
@@ -62021,7 +62091,7 @@ async function serviceStopCommand(name) {
62021
62091
  async function serviceListCommand() {
62022
62092
  let entries;
62023
62093
  try {
62024
- entries = (0, import_node_fs6.readdirSync)(SERVICES_DIR).filter((f) => f.endsWith(".json"));
62094
+ entries = (0, import_node_fs7.readdirSync)(SERVICES_DIR).filter((f) => f.endsWith(".json"));
62025
62095
  } catch {
62026
62096
  entries = [];
62027
62097
  }
@@ -62052,19 +62122,19 @@ async function serviceLogsCommand(name, options) {
62052
62122
  console.log(logs || "(no log output yet)");
62053
62123
  });
62054
62124
  }
62055
- var import_chalk35, import_node_child_process3, import_node_fs6, import_node_os3, import_node_path6, SERVICES_DIR, NAME_PATTERN, LOG_KEEP_BYTES, LOG_TRIM_LOOP;
62125
+ var import_chalk35, import_node_child_process3, import_node_fs7, import_node_os3, import_node_path8, SERVICES_DIR, NAME_PATTERN, LOG_KEEP_BYTES, LOG_TRIM_LOOP;
62056
62126
  var init_service = __esm({
62057
62127
  "src/commands/service.ts"() {
62058
62128
  "use strict";
62059
62129
  import_chalk35 = __toESM(require("chalk"));
62060
62130
  import_node_child_process3 = require("child_process");
62061
- import_node_fs6 = require("fs");
62131
+ import_node_fs7 = require("fs");
62062
62132
  import_node_os3 = require("os");
62063
- import_node_path6 = require("path");
62133
+ import_node_path8 = require("path");
62064
62134
  init_src();
62065
62135
  init_process_group();
62066
62136
  init_output();
62067
- SERVICES_DIR = (0, import_node_path6.join)((0, import_node_os3.homedir)(), ".replicas", "services");
62137
+ SERVICES_DIR = (0, import_node_path8.join)((0, import_node_os3.homedir)(), ".replicas", "services");
62068
62138
  NAME_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
62069
62139
  LOG_KEEP_BYTES = 5 * 1024 * 1024;
62070
62140
  LOG_TRIM_LOOP = `trim() { ${trimLogTailCommand('"$1"', 10 * 1024 * 1024, LOG_KEEP_BYTES)}; }
@@ -62215,13 +62285,13 @@ async function themePublishCommand(options) {
62215
62285
  };
62216
62286
  let body2 = payload;
62217
62287
  if (options.wallpaper) {
62218
- const resolvedPath = import_node_path7.default.resolve(options.wallpaper);
62219
- if (!import_node_fs7.default.existsSync(resolvedPath)) throw new Error(`Wallpaper file not found: ${resolvedPath}`);
62220
- const { mimeType } = classifyCanvasFilename(import_node_path7.default.basename(resolvedPath));
62288
+ const resolvedPath = import_node_path9.default.resolve(options.wallpaper);
62289
+ if (!import_node_fs8.default.existsSync(resolvedPath)) throw new Error(`Wallpaper file not found: ${resolvedPath}`);
62290
+ const { mimeType } = classifyCanvasFilename(import_node_path9.default.basename(resolvedPath));
62221
62291
  if (!IMAGE_MEDIA_TYPES.some((allowed) => allowed === mimeType)) throw new Error("Wallpaper must be a PNG, JPEG, WebP, or GIF image.");
62222
62292
  const form = new FormData();
62223
62293
  form.set("data", JSON.stringify(payload));
62224
- form.set("image", new File([import_node_fs7.default.readFileSync(resolvedPath)], import_node_path7.default.basename(resolvedPath), { type: mimeType }));
62294
+ form.set("image", new File([import_node_fs8.default.readFileSync(resolvedPath)], import_node_path9.default.basename(resolvedPath), { type: mimeType }));
62225
62295
  body2 = form;
62226
62296
  }
62227
62297
  const published = await agentFetch("/v1/engine/theme/publish", { method: "POST", body: body2 });
@@ -62234,12 +62304,12 @@ async function themePublishCommand(options) {
62234
62304
  if (item.content.wallpaper) console.log(`wallpaper: ${item.content.wallpaper.url} (${item.content.wallpaper.effect})`);
62235
62305
  });
62236
62306
  }
62237
- var import_node_fs7, import_node_path7, print;
62307
+ var import_node_fs8, import_node_path9, print;
62238
62308
  var init_theme = __esm({
62239
62309
  "src/commands/theme.ts"() {
62240
62310
  "use strict";
62241
- import_node_fs7 = __toESM(require("fs"));
62242
- import_node_path7 = __toESM(require("path"));
62311
+ import_node_fs8 = __toESM(require("fs"));
62312
+ import_node_path9 = __toESM(require("path"));
62243
62313
  init_src();
62244
62314
  init_design_tokens();
62245
62315
  init_agent_api();
@@ -62348,7 +62418,7 @@ var init_local_control = __esm({
62348
62418
 
62349
62419
  // ../shared/src/security-checkout.ts
62350
62420
  function checkoutWithCommit(root, commitSha) {
62351
- return (0, import_node_fs8.readdirSync)(root).map((name) => (0, import_node_path8.join)(root, name)).find((dir) => {
62421
+ return (0, import_node_fs9.readdirSync)(root).map((name) => (0, import_node_path10.join)(root, name)).find((dir) => {
62352
62422
  try {
62353
62423
  (0, import_node_child_process5.execFileSync)("git", ["-C", dir, "cat-file", "-e", `${commitSha}^{commit}`], { stdio: "ignore" });
62354
62424
  return true;
@@ -62357,13 +62427,13 @@ function checkoutWithCommit(root, commitSha) {
62357
62427
  }
62358
62428
  }) ?? null;
62359
62429
  }
62360
- var import_node_child_process5, import_node_fs8, import_node_path8;
62430
+ var import_node_child_process5, import_node_fs9, import_node_path10;
62361
62431
  var init_security_checkout = __esm({
62362
62432
  "../shared/src/security-checkout.ts"() {
62363
62433
  "use strict";
62364
62434
  import_node_child_process5 = require("child_process");
62365
- import_node_fs8 = require("fs");
62366
- import_node_path8 = require("path");
62435
+ import_node_fs9 = require("fs");
62436
+ import_node_path10 = require("path");
62367
62437
  }
62368
62438
  });
62369
62439
 
@@ -62387,13 +62457,13 @@ function oneOf(values, value, label) {
62387
62457
  if (!match) throw new Error(`Unknown ${label} "${value}". Use one of: ${values.join(", ")}`);
62388
62458
  return match;
62389
62459
  }
62390
- function maskBody(path14, body2) {
62460
+ function maskBody(path16, body2) {
62391
62461
  let masked = 0;
62392
62462
  const mask = (value) => {
62393
62463
  masked += stringsIn(value).reduce((count, text5) => count + countSecrets(text5), 0);
62394
62464
  return maskSecretsDeep(value);
62395
62465
  };
62396
- const setup = path14 === "/app-setup" ? securityAppSetupSubmissionSchema.safeParse(body2) : null;
62466
+ const setup = path16 === "/app-setup" ? securityAppSetupSubmissionSchema.safeParse(body2) : null;
62397
62467
  if (setup?.success) {
62398
62468
  const { recipe } = setup.data;
62399
62469
  const prepared = recipe && prepareSecurityAppRecipe(recipe);
@@ -62405,23 +62475,23 @@ function maskBody(path14, body2) {
62405
62475
  };
62406
62476
  }
62407
62477
  if (setup) return { body: body2, masked };
62408
- if (path14.endsWith("/proofs") && body2 && typeof body2 === "object" && "content" in body2) {
62478
+ if (path16.endsWith("/proofs") && body2 && typeof body2 === "object" && "content" in body2) {
62409
62479
  const { content, ...meta3 } = body2;
62410
62480
  return { body: { ...mask(meta3), content }, masked };
62411
62481
  }
62412
- if (path14 === "/fix" && body2 && typeof body2 === "object" && "files" in body2) {
62482
+ if (path16 === "/fix" && body2 && typeof body2 === "object" && "files" in body2) {
62413
62483
  const { files, ...meta3 } = body2;
62414
62484
  return { body: { ...mask(meta3), files }, masked };
62415
62485
  }
62416
62486
  return { body: mask(body2), masked };
62417
62487
  }
62418
- function request(path14, init) {
62488
+ function request(path16, init) {
62419
62489
  ensureOrgApiAuthenticated();
62420
- if (!init) return orgAuthenticatedFetch(`/v1/code-security/run${path14}`);
62421
- const { body: body2, masked } = maskBody(path14, init.body);
62490
+ if (!init) return orgAuthenticatedFetch(`/v1/code-security/run${path16}`);
62491
+ const { body: body2, masked } = maskBody(path16, init.body);
62422
62492
  if (masked > 0) process.stderr.write(`masked ${masked} secret-shaped value(s) before sending
62423
62493
  `);
62424
- return orgAuthenticatedFetch(`/v1/code-security/run${path14}`, { ...init, body: body2 });
62494
+ return orgAuthenticatedFetch(`/v1/code-security/run${path16}`, { ...init, body: body2 });
62425
62495
  }
62426
62496
  function printRun({ run: run2 }) {
62427
62497
  const units = Object.values(run2.coverage);
@@ -62792,11 +62862,11 @@ function registerEnvironmentHookCommands(parent, config3) {
62792
62862
  }
62793
62863
  hooks.command("repository-hooks <env>").description(`List per-repo ${config3.kind} hooks defined in replicas.json / replicas.yaml`).action(run(config3.repositoryHooks));
62794
62864
  }
62795
- var import_config22, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, billing, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, artifact, media, issue2, environment, envConfig, envVars, envFiles, envSkills, envMcps, parsePortOption, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
62865
+ var import_config23, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, billing, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, artifact, media, issue2, environment, envConfig, envVars, envFiles, envSkills, envMcps, parsePortOption, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
62796
62866
  var init_src2 = __esm({
62797
62867
  "src/index.ts"() {
62798
62868
  "use strict";
62799
- import_config22 = require("dotenv/config");
62869
+ import_config23 = require("dotenv/config");
62800
62870
  import_commander = require("commander");
62801
62871
  init_login3();
62802
62872
  init_logout();
@@ -63001,8 +63071,8 @@ var init_src2 = __esm({
63001
63071
  skills.command("update <name-or-id>").description("Update an organization skill").option("--title <text>", "New title").option("-f, --file <file>", "New SKILL.md content").action(run(skillsUpdateCommand));
63002
63072
  skills.command("delete <id>").description("Delete an organization skill").action(run(skillsDeleteCommand));
63003
63073
  artifact = program.command("artifact").description("Keep files a workspace made: deliverables people can find, open and share after the workspace is gone");
63004
- artifact.command("upload <files...>").description("Upload one or more files as artifacts, concurrently. They belong to the person this workspace belongs to").option("-n, --name <name>", "Required name people see. Pass one --name per file, in order.", collect, []).option("--immutable", "A record that never changes, such as a screenshot (default: mutable)").action(run(artifactUploadCommand));
63005
- artifact.command("list").description("List your artifacts and those shared with you (mutable only unless --immutable or --all)").option("--immutable", "Only immutable artifacts").option("--all", "Mutable and immutable artifacts").option("--owner <owner>", "me, others or organization (repeatable)", collect, []).option("-k, --kind <kind>", "Viewer kind such as markdown, html or image (repeatable)", collect, []).option("-w, --workspace [id]", "Everything a workspace made that you can open (this workspace if no id)").option("-l, --limit <n>", "Page size (default 50, max 200)").option("-p, --page <n>", "Page number (default 1)").action(run(artifactListCommand));
63074
+ artifact.command("upload <files...>").description("Upload one or more files as artifacts, concurrently. They belong to the person this workspace belongs to").option("-n, --name <name>", "Required name people see. Pass one --name per file, in order.", collect, []).option("--permanent [true|false]", "Required. false: deleted with this workspace, such as a screenshot, recording or working plan. true: kept after it, for something the person asked to keep or a finished deliverable").action(run(artifactUploadCommand));
63075
+ artifact.command("list").description("List your permanent artifacts and those shared with you (--permanent false or --all for others; --workspace lists both)").option("--permanent <true|false>", "Only permanent (true) or temporary (false) artifacts").option("--all", "Permanent and temporary artifacts").option("--owner <owner>", "me, others or organization (repeatable)", collect, []).option("-k, --kind <kind>", "Viewer kind such as markdown, html or image (repeatable)", collect, []).option("-w, --workspace [id]", "Everything a workspace made that you can open (this workspace if no id)").option("-l, --limit <n>", "Page size (default 50, max 200)").option("-p, --page <n>", "Page number (default 1)").action(run(artifactListCommand));
63006
63076
  artifact.command("url <artifactId>").description("Print a short-lived download URL for an artifact").action(run(artifactUrlCommand));
63007
63077
  artifact.command("rename <artifactId> <name>").description("Rename an artifact (needs edit access)").action(run(artifactRenameCommand));
63008
63078
  artifact.command("share <artifactId>").description("Share an artifact with a member or the whole organization (needs edit access)").option("-u, --user <email>", "Member to share with").option("--organization", "Share with everyone in the organization").option("--permission <permission>", "view or edit (default view)").action(run(artifactShareCommand));
@@ -63147,7 +63217,7 @@ var init_src2 = __esm({
63147
63217
  service.command("list").description("List registered services and whether they are running").action(run(serviceListCommand));
63148
63218
  service.command("logs <name>").description("Print the last lines of a service log").option("-n, --lines <n>", "Number of lines to print (default 50)").action(run(serviceLogsCommand));
63149
63219
  addGifCommand(media, "replicas media upload");
63150
- addGifCommand(artifact, "replicas artifact upload");
63220
+ addGifCommand(artifact, "replicas artifact upload --permanent false");
63151
63221
  media.command("upload <files...>").description("Upload one or more image, video, or audio files. Multiple files are uploaded concurrently. Publish HTML pages with `replicas visualize`.").option("-k, --kind <kind>", "Media kind: image, video, or audio (inferred from extension if omitted)").option("-s, --session-id <id>", "Session ID to associate the asset with").option(
63152
63222
  "-n, --name <name>",
63153
63223
  "Required human-facing display name shown in the dashboard. Pass one --name per file, in order.",