replicas-cli 0.2.766 → 0.2.768

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 +31 -19
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -23182,7 +23182,7 @@ var WRAPPER_VALUE_OPTIONS = {
23182
23182
  };
23183
23183
  var ANSI_C_ESCAPES = { n: "\n", t: " ", r: "\r", a: "\x07", b: "\b", e: "\x1B", E: "\x1B", f: "\f", v: "\v" };
23184
23184
  function parseShellScript(script, cwd) {
23185
- const scope = { src: script, vars: /* @__PURE__ */ new Map(), dir: cwd, commands: [], depth: 0 };
23185
+ const scope = { src: script, vars: /* @__PURE__ */ new Map(), dir: cwd, commands: [], depth: 0, subshell: false };
23186
23186
  parseUntil(scope, 0, false);
23187
23187
  return scope.commands;
23188
23188
  }
@@ -23282,16 +23282,18 @@ function emit(scope, raw) {
23282
23282
  stdin,
23283
23283
  afterAnd: raw.afterAnd,
23284
23284
  stdinFile: stdinFile ? resolveShellPath(scope.dir, stdinFile.target) : null,
23285
- writes: raw.redirects.flatMap(({ op, target }) => /^(?:1?>|1?>\||1?>>|&>|&>>|>&)$/.test(op) && !/^(?:\d+|-)$/.test(target) ? [{ path: resolveShellPath(scope.dir, target), content: output, append: op.endsWith(">>") }] : []),
23285
+ writes: raw.redirects.flatMap(({ op, target }) => /^(?:1?>|1?>\||1?>>|&>|&>>|>&)$/.test(op) && !/^(?:\d+|-)$/.test(target) ? [{ path: resolveShellPath(scope.dir, target), target, content: output, append: op.endsWith(">>") }] : []),
23286
23286
  wrapper: script !== void 0,
23287
- truncated
23287
+ truncated,
23288
+ piped: raw.pipeFrom !== void 0,
23289
+ subshell: scope.subshell || raw.subshell
23288
23290
  });
23289
23291
  if (name === "cd" || name === "pushd" || name === "popd") {
23290
23292
  scope.dir = name !== "popd" && argv[1] && argv[1] !== "-" ? resolveShellPath(scope.dir, argv[1]) : null;
23291
23293
  } else if (["export", "declare", "local", "readonly"].includes(name)) {
23292
23294
  assign(scope, argv.slice(1).filter((arg) => /^[A-Za-z_]\w*=/.test(arg)));
23293
23295
  }
23294
- if (script && !truncated) parseUntil({ src: script, vars: name === "eval" ? scope.vars : /* @__PURE__ */ new Map(), dir: scope.dir, commands: scope.commands, depth: scope.depth + 1 }, 0, false);
23296
+ if (script && !truncated) parseUntil({ src: script, vars: name === "eval" ? scope.vars : /* @__PURE__ */ new Map(), dir: scope.dir, commands: scope.commands, depth: scope.depth + 1, subshell: scope.subshell || raw.subshell }, 0, false);
23295
23297
  }
23296
23298
  function readHeredocBodies(scope, heredocs, start) {
23297
23299
  const { src } = scope;
@@ -23339,7 +23341,7 @@ function readDoubleQuoted(scope, start, terminator) {
23339
23341
  return { value, end: i };
23340
23342
  }
23341
23343
  function substitute(scope, src, start, closeParen) {
23342
- const child = { src, vars: new Map(scope.vars), dir: scope.dir, commands: [], depth: scope.depth + 1 };
23344
+ const child = { src, vars: new Map(scope.vars), dir: scope.dir, commands: [], depth: scope.depth + 1, subshell: true };
23343
23345
  const end = parseUntil(child, start, closeParen);
23344
23346
  scope.commands.push(...child.commands);
23345
23347
  const [only] = child.commands;
@@ -23384,7 +23386,7 @@ function parseUntil(scope, start, closeParen) {
23384
23386
  const { src } = scope;
23385
23387
  let i = start;
23386
23388
  let line = [];
23387
- let current = { words: [], redirects: [], heredocs: [], afterAnd: false };
23389
+ let current = { words: [], redirects: [], heredocs: [], afterAnd: false, subshell: false };
23388
23390
  let pendingHeredocs = [];
23389
23391
  let word = null;
23390
23392
  let quoted = false;
@@ -23412,7 +23414,8 @@ function parseUntil(scope, start, closeParen) {
23412
23414
  const endCommand = (op) => {
23413
23415
  endWord();
23414
23416
  const done = current;
23415
- current = { words: [], redirects: [], heredocs: [], pipeFrom: op === "|" || op === "|&" ? done : void 0, afterAnd: op === "&&" };
23417
+ if (op === "&") done.subshell = true;
23418
+ current = { words: [], redirects: [], heredocs: [], pipeFrom: op === "|" || op === "|&" ? done : void 0, afterAnd: op === "&&", subshell: parens > 0 };
23416
23419
  if (done.words.length > 0 || done.redirects.length > 0 || done.heredocs.length > 0) line.push(done);
23417
23420
  };
23418
23421
  const flush = () => {
@@ -23589,16 +23592,25 @@ function insertDisplayMessageByTimestamp(messages, message) {
23589
23592
  }
23590
23593
 
23591
23594
  // ../shared/src/display-message/format.ts
23592
- function commandWords(command) {
23593
- const commands = parseShellScript(command, null).filter(({ wrapper }) => !wrapper);
23594
- if (commands.length !== 1) return null;
23595
- const [{ argv, stdin, stdinFile, writes }] = commands;
23596
- return stdin === void 0 && !stdinFile && writes.length === 0 ? argv.map((word) => word.replaceAll(SHELL_OPAQUE, "\u2026")) : null;
23595
+ var SCRIPT_ROOT = "/";
23596
+ var commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
23597
+ var fileWrites = ({ writes }) => writes.filter(({ path: path7 }) => path7 !== "/dev/null");
23598
+ function shellCommands(command) {
23599
+ return parseShellScript(command, SCRIPT_ROOT).filter(({ wrapper }) => !wrapper);
23600
+ }
23601
+ function simpleCommands(command) {
23602
+ const commands = shellCommands(command);
23603
+ const hasRedirectOrSubshell = commands.some((shellCommand) => shellCommand.subshell || shellCommand.stdinFile !== null || !shellCommand.piped && shellCommand.stdin !== void 0 || fileWrites(shellCommand).length > 0);
23604
+ if (commands.length === 0 || hasRedirectOrSubshell) return null;
23605
+ return commands.map((shellCommand) => {
23606
+ const argv = shellCommand.argv.map((word) => word.replaceAll(SHELL_OPAQUE, "\u2026"));
23607
+ return { ...shellCommand, argv, name: commandName(argv) };
23608
+ });
23597
23609
  }
23598
23610
  function skillNamesFromCommand(command) {
23599
- const words = commandWords(command);
23600
- if (!words) return [];
23601
- return Array.from(new Set(words.flatMap((word) => {
23611
+ const commands = simpleCommands(command);
23612
+ if (!commands) return [];
23613
+ return Array.from(new Set(commands.flatMap(({ argv }) => argv).flatMap((word) => {
23602
23614
  const skillName = skillNameFromSkillRootPath(word);
23603
23615
  return skillName ? [skillName] : [];
23604
23616
  })));
@@ -25550,8 +25562,8 @@ var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZ
25550
25562
  var HISTORY_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/history`;
25551
25563
  var HISTORY_INDEX_FILENAME = "INDEX.md";
25552
25564
  var memoryExtractionResultSchema = external_exports.object({
25553
- seatSummary: external_exports.string().nullable(),
25554
- organizationSummary: external_exports.string().nullable()
25565
+ summary: external_exports.string().nullable(),
25566
+ indexEntry: external_exports.string().nullable()
25555
25567
  });
25556
25568
  var { $schema: _, ...MEMORY_EXTRACTION_SCHEMA } = external_exports.toJSONSchema(memoryExtractionResultSchema);
25557
25569
 
@@ -25565,7 +25577,7 @@ var REFERENCE12 = `# Session history
25565
25577
  Past sessions are installed under \`${HISTORY_ROOT}\`:
25566
25578
 
25567
25579
  - \`${HISTORY_INDEX_FILENAME}\` lists every session, grouped under \`## YYYY-MM-DD\` headings by start day (UTC). Each line is \`- <date> <time> | <who> | <workspace> | <description> | active: <days> | <summary>\`; \`active:\` appears only for sessions spanning several days.
25568
- - \`summaries/<YYYY-MM-DD>-<id>.md\` holds the summary of a session you can read. Teammates' private sessions show "Private session" and \`\u2014\` instead of a summary path.
25580
+ - \`summaries/<YYYY-MM-DD>-<id>.md\` holds the summary of a session you can read. Teammates' private sessions show \`\u2014\` instead of a summary path. Sessions without a shareable description show "Private session" unless they are yours.
25569
25581
 
25570
25582
  Search the index, then open the referenced summaries:
25571
25583
 
@@ -27936,7 +27948,7 @@ var headlessAgentRequestSchema = external_exports.object({
27936
27948
  });
27937
27949
 
27938
27950
  // ../shared/src/cli-version.ts
27939
- var CLI_VERSION = "0.2.766";
27951
+ var CLI_VERSION = "0.2.768";
27940
27952
 
27941
27953
  // ../shared/src/version.ts
27942
27954
  function compareVersions(v1, v2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.766",
3
+ "version": "0.2.768",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {