replicas-cli 0.2.744 → 0.2.746
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +380 -56
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -22841,7 +22841,7 @@ var chatForkInfoSchema = external_exports.object({
|
|
|
22841
22841
|
provider: external_exports.enum(VALID_AGENT_PROVIDERS),
|
|
22842
22842
|
title: external_exports.string()
|
|
22843
22843
|
}),
|
|
22844
|
-
trigger: external_exports.enum(["manual", "auto"]),
|
|
22844
|
+
trigger: external_exports.enum(["manual", "auto", "side"]),
|
|
22845
22845
|
reason: quotaLimitKindSchema.optional(),
|
|
22846
22846
|
state: external_exports.enum(["preparing", "ready", "failed"]),
|
|
22847
22847
|
error: external_exports.string().optional(),
|
|
@@ -22935,9 +22935,12 @@ var createChatRequestSchema = external_exports.object({
|
|
|
22935
22935
|
title: external_exports.string().min(1).optional(),
|
|
22936
22936
|
parentChatId: external_exports.string().uuid().optional(),
|
|
22937
22937
|
forkSourceChatId: external_exports.string().uuid().optional(),
|
|
22938
|
+
sideChat: external_exports.boolean().optional(),
|
|
22938
22939
|
clientRequestId: external_exports.string().min(1).max(128).optional()
|
|
22939
22940
|
}).refine((request) => request.provider === "relay" || request.relayBaseProvider === void 0, {
|
|
22940
22941
|
message: "relayBaseProvider is only valid for Relay chats"
|
|
22942
|
+
}).refine((request) => !request.sideChat || request.forkSourceChatId !== void 0 && request.parentChatId === request.forkSourceChatId, {
|
|
22943
|
+
message: "A side chat must fork its parent chat"
|
|
22941
22944
|
});
|
|
22942
22945
|
var spawnRelaySubagentRequestSchema = external_exports.object({
|
|
22943
22946
|
provider: external_exports.enum(VALID_AGENT_PROVIDERS),
|
|
@@ -23143,6 +23146,313 @@ function normalizeBackgroundTaskStatus(status) {
|
|
|
23143
23146
|
// ../shared/src/display-message/constants.ts
|
|
23144
23147
|
var USER_MESSAGE_MATCH_GRACE_PERIOD_MS = 3e4;
|
|
23145
23148
|
|
|
23149
|
+
// ../shared/src/shell-commands.ts
|
|
23150
|
+
var SHELL_OPAQUE = "\0";
|
|
23151
|
+
var MAX_DEPTH = 8;
|
|
23152
|
+
var OPERATOR = /&&|\|\||;;|\|&|<<<|<<-|<<|&>>|&>|>>|>&|>\||<&|<>|[;&|()<>]/y;
|
|
23153
|
+
var NAME = /[A-Za-z_]\w*/y;
|
|
23154
|
+
var SHELLS = /* @__PURE__ */ new Set(["sh", "bash", "zsh", "dash", "ksh"]);
|
|
23155
|
+
var PREFIX_WORDS = /* @__PURE__ */ new Set(["!", "{", "}", "if", "then", "else", "elif", "fi", "do", "done", "while", "until", "time", "exec", "command", "builtin", "nohup"]);
|
|
23156
|
+
var WRAPPER_VALUE_OPTIONS = {
|
|
23157
|
+
env: /^(?:-[uCS]|--(?:unset|chdir|split-string))$/,
|
|
23158
|
+
sudo: /^(?:-[ugCpUrhDRT]|--(?:user|group|close-from|prompt|other-user|role|type|host|chdir|command-timeout))$/,
|
|
23159
|
+
nice: /^(?:-n|--adjustment)$/,
|
|
23160
|
+
timeout: /^(?:-[sk]|--(?:signal|kill-after))$/
|
|
23161
|
+
};
|
|
23162
|
+
var ANSI_C_ESCAPES = { n: "\n", t: " ", r: "\r", a: "\x07", b: "\b", e: "\x1B", E: "\x1B", f: "\f", v: "\v" };
|
|
23163
|
+
function parseShellScript(script, cwd) {
|
|
23164
|
+
const scope = { src: script, vars: /* @__PURE__ */ new Map(), dir: cwd, commands: [], depth: 0 };
|
|
23165
|
+
parseUntil(scope, 0, false);
|
|
23166
|
+
return scope.commands;
|
|
23167
|
+
}
|
|
23168
|
+
function resolveShellPath(dir, path6) {
|
|
23169
|
+
if (path6.includes(SHELL_OPAQUE) || path6.startsWith("~")) return null;
|
|
23170
|
+
if (!path6.startsWith("/") && dir === null) return null;
|
|
23171
|
+
const parts = [];
|
|
23172
|
+
for (const part of (path6.startsWith("/") ? path6 : `${dir}/${path6}`).split("/")) {
|
|
23173
|
+
if (part === "..") parts.pop();
|
|
23174
|
+
else if (part && part !== ".") parts.push(part);
|
|
23175
|
+
}
|
|
23176
|
+
return `/${parts.join("/")}`;
|
|
23177
|
+
}
|
|
23178
|
+
function stripCommandPrefixes(words) {
|
|
23179
|
+
const assignments = [];
|
|
23180
|
+
let k = 0;
|
|
23181
|
+
while (k < words.length) {
|
|
23182
|
+
const word = words[k];
|
|
23183
|
+
if (/^[A-Za-z_]\w*=/.test(word)) assignments.push(word);
|
|
23184
|
+
else if (WRAPPER_VALUE_OPTIONS[word]) {
|
|
23185
|
+
while (words[k + 1]?.startsWith("-")) k += WRAPPER_VALUE_OPTIONS[word].test(words[k + 1]) ? 2 : 1;
|
|
23186
|
+
if (word === "timeout") k++;
|
|
23187
|
+
} else if (!PREFIX_WORDS.has(word)) break;
|
|
23188
|
+
k++;
|
|
23189
|
+
}
|
|
23190
|
+
return { argv: words.slice(k), assignments };
|
|
23191
|
+
}
|
|
23192
|
+
function indexOrEnd(src, search, from) {
|
|
23193
|
+
const index = src.indexOf(search, from);
|
|
23194
|
+
return index < 0 ? src.length : index;
|
|
23195
|
+
}
|
|
23196
|
+
function decodeAnsiC(text2) {
|
|
23197
|
+
return text2.replace(/\\(x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{1,4}|[0-7]{1,3}|[\s\S])/g, (_match, escape) => {
|
|
23198
|
+
if (escape[0] === "x" || escape[0] === "u") return String.fromCharCode(parseInt(escape.slice(1), 16));
|
|
23199
|
+
if (/^[0-7]/.test(escape)) return String.fromCharCode(parseInt(escape, 8));
|
|
23200
|
+
return ANSI_C_ESCAPES[escape] ?? escape;
|
|
23201
|
+
});
|
|
23202
|
+
}
|
|
23203
|
+
function staticOutput(argv, stdin) {
|
|
23204
|
+
const [name, ...args] = argv;
|
|
23205
|
+
if (name === "cat") return args.length === 0 || args.length === 1 && args[0] === "-" ? stdin : void 0;
|
|
23206
|
+
if (name === "echo") {
|
|
23207
|
+
let newline = true;
|
|
23208
|
+
let escapes = false;
|
|
23209
|
+
while (/^-[neE]+$/.test(args[0] ?? "")) {
|
|
23210
|
+
const flags = args.shift() ?? "";
|
|
23211
|
+
if (flags.includes("n")) newline = false;
|
|
23212
|
+
if (flags.includes("e")) escapes = true;
|
|
23213
|
+
}
|
|
23214
|
+
const text2 = args.join(" ");
|
|
23215
|
+
return (escapes ? decodeAnsiC(text2) : text2) + (newline ? "\n" : "");
|
|
23216
|
+
}
|
|
23217
|
+
if (name === "printf" && args.length > 0) {
|
|
23218
|
+
const format = decodeAnsiC(args[0]);
|
|
23219
|
+
if (/%(?![s%])/.test(format)) return void 0;
|
|
23220
|
+
const values = args.slice(1);
|
|
23221
|
+
let output = "";
|
|
23222
|
+
let next = 0;
|
|
23223
|
+
do {
|
|
23224
|
+
output += format.replace(/%([s%])/g, (_match, directive) => directive === "%" ? "%" : values[next++] ?? "");
|
|
23225
|
+
} while (format.includes("%s") && next < values.length);
|
|
23226
|
+
return output;
|
|
23227
|
+
}
|
|
23228
|
+
return void 0;
|
|
23229
|
+
}
|
|
23230
|
+
function commandStdin(raw) {
|
|
23231
|
+
const heredoc = raw.heredocs.at(-1);
|
|
23232
|
+
if (heredoc) return heredoc.body;
|
|
23233
|
+
const input = raw.redirects.findLast(({ op }) => op === "<<<" || op === "<" || op === "0<");
|
|
23234
|
+
if (input) return input.op === "<<<" ? `${input.target}
|
|
23235
|
+
` : SHELL_OPAQUE;
|
|
23236
|
+
if (raw.pipeFrom) return staticOutput(stripCommandPrefixes(raw.pipeFrom.words).argv, commandStdin(raw.pipeFrom)) ?? SHELL_OPAQUE;
|
|
23237
|
+
return void 0;
|
|
23238
|
+
}
|
|
23239
|
+
function assign(scope, assignments) {
|
|
23240
|
+
for (const assignment of assignments) {
|
|
23241
|
+
const separator = assignment.indexOf("=");
|
|
23242
|
+
scope.vars.set(assignment.slice(0, separator), assignment.slice(separator + 1));
|
|
23243
|
+
}
|
|
23244
|
+
}
|
|
23245
|
+
function emit(scope, raw) {
|
|
23246
|
+
const { argv, assignments } = stripCommandPrefixes(raw.words);
|
|
23247
|
+
if (argv.length === 0) {
|
|
23248
|
+
assign(scope, assignments);
|
|
23249
|
+
return;
|
|
23250
|
+
}
|
|
23251
|
+
const stdin = commandStdin(raw);
|
|
23252
|
+
const output = staticOutput(argv, stdin) ?? SHELL_OPAQUE;
|
|
23253
|
+
const stdinFile = raw.redirects.findLast(({ op }) => op === "<" || op === "0<");
|
|
23254
|
+
const name = argv[0].split("/").pop() ?? "";
|
|
23255
|
+
const flag = SHELLS.has(name) ? argv.findIndex((arg, index) => index > 0 && /^-[A-Za-z]*c[A-Za-z]*$/.test(arg)) : -1;
|
|
23256
|
+
const script = flag > 0 ? argv[flag + 1] : SHELLS.has(name) && argv.length === 1 && stdin !== SHELL_OPAQUE ? stdin : name === "eval" ? argv.slice(1).join(" ") : void 0;
|
|
23257
|
+
const truncated = script !== void 0 && scope.depth >= MAX_DEPTH;
|
|
23258
|
+
scope.commands.push({
|
|
23259
|
+
argv,
|
|
23260
|
+
dir: scope.dir,
|
|
23261
|
+
stdin,
|
|
23262
|
+
afterAnd: raw.afterAnd,
|
|
23263
|
+
stdinFile: stdinFile ? resolveShellPath(scope.dir, stdinFile.target) : null,
|
|
23264
|
+
writes: raw.redirects.flatMap(({ op, target }) => /^(?:1?>|1?>\||1?>>|&>|&>>|>&)$/.test(op) && !/^(?:\d+|-)$/.test(target) ? [{ path: resolveShellPath(scope.dir, target), content: output, append: op.endsWith(">>") }] : []),
|
|
23265
|
+
wrapper: script !== void 0,
|
|
23266
|
+
truncated
|
|
23267
|
+
});
|
|
23268
|
+
if (name === "cd" || name === "pushd" || name === "popd") {
|
|
23269
|
+
scope.dir = name !== "popd" && argv[1] && argv[1] !== "-" ? resolveShellPath(scope.dir, argv[1]) : null;
|
|
23270
|
+
} else if (["export", "declare", "local", "readonly"].includes(name)) {
|
|
23271
|
+
assign(scope, argv.slice(1).filter((arg) => /^[A-Za-z_]\w*=/.test(arg)));
|
|
23272
|
+
}
|
|
23273
|
+
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);
|
|
23274
|
+
}
|
|
23275
|
+
function readHeredocBodies(scope, heredocs, start) {
|
|
23276
|
+
const { src } = scope;
|
|
23277
|
+
let position = start;
|
|
23278
|
+
for (const heredoc of heredocs) {
|
|
23279
|
+
const lines = [];
|
|
23280
|
+
while (position < src.length) {
|
|
23281
|
+
const end = indexOrEnd(src, "\n", position);
|
|
23282
|
+
const line = heredoc.strip ? src.slice(position, end).replace(/^\t+/, "") : src.slice(position, end);
|
|
23283
|
+
position = end + 1;
|
|
23284
|
+
if (line === heredoc.delimiter) break;
|
|
23285
|
+
lines.push(line);
|
|
23286
|
+
}
|
|
23287
|
+
heredoc.body = lines.length > 0 ? `${lines.join("\n")}
|
|
23288
|
+
` : "";
|
|
23289
|
+
if (heredoc.expand) heredoc.body = readDoubleQuoted({ ...scope, src: heredoc.body }, 0, null).value;
|
|
23290
|
+
}
|
|
23291
|
+
return Math.min(position, src.length);
|
|
23292
|
+
}
|
|
23293
|
+
function readDoubleQuoted(scope, start, terminator) {
|
|
23294
|
+
const { src } = scope;
|
|
23295
|
+
let value = "";
|
|
23296
|
+
let i = start;
|
|
23297
|
+
while (i < src.length && src[i] !== terminator) {
|
|
23298
|
+
const c = src[i];
|
|
23299
|
+
if (c === "\\" && i + 1 < src.length) {
|
|
23300
|
+
const next = src[i + 1];
|
|
23301
|
+
if (next === "\n") i += 2;
|
|
23302
|
+
else if ("$`\\".includes(next) || next === terminator) {
|
|
23303
|
+
value += next;
|
|
23304
|
+
i += 2;
|
|
23305
|
+
} else {
|
|
23306
|
+
value += c;
|
|
23307
|
+
i++;
|
|
23308
|
+
}
|
|
23309
|
+
} else if (c === "$" || c === "`") {
|
|
23310
|
+
const expansion = readExpansion(scope, i, true);
|
|
23311
|
+
value += expansion.value;
|
|
23312
|
+
i = expansion.end;
|
|
23313
|
+
} else {
|
|
23314
|
+
value += c;
|
|
23315
|
+
i++;
|
|
23316
|
+
}
|
|
23317
|
+
}
|
|
23318
|
+
return { value, end: i };
|
|
23319
|
+
}
|
|
23320
|
+
function substitute(scope, src, start, closeParen) {
|
|
23321
|
+
const child = { src, vars: new Map(scope.vars), dir: scope.dir, commands: [], depth: scope.depth + 1 };
|
|
23322
|
+
const end = parseUntil(child, start, closeParen);
|
|
23323
|
+
scope.commands.push(...child.commands);
|
|
23324
|
+
const [only] = child.commands;
|
|
23325
|
+
const output = child.commands.length === 1 ? staticOutput(only.argv, only.stdin) : void 0;
|
|
23326
|
+
return { value: output?.replace(/\n+$/, "") ?? SHELL_OPAQUE, end };
|
|
23327
|
+
}
|
|
23328
|
+
function readExpansion(scope, i, inDouble) {
|
|
23329
|
+
const { src } = scope;
|
|
23330
|
+
if (src[i] === "`") {
|
|
23331
|
+
let inner = "";
|
|
23332
|
+
let j = i + 1;
|
|
23333
|
+
while (j < src.length && src[j] !== "`") {
|
|
23334
|
+
if (src[j] === "\\" && "$`\\".includes(src[j + 1] ?? "")) {
|
|
23335
|
+
inner += src[j + 1];
|
|
23336
|
+
j += 2;
|
|
23337
|
+
} else inner += src[j++];
|
|
23338
|
+
}
|
|
23339
|
+
return { value: substitute(scope, inner, 0, false).value, end: j + 1 };
|
|
23340
|
+
}
|
|
23341
|
+
const next = src[i + 1];
|
|
23342
|
+
if (next === "(") return substitute(scope, src, i + 2, true);
|
|
23343
|
+
if (next === "{") {
|
|
23344
|
+
const end = indexOrEnd(src, "}", i + 2);
|
|
23345
|
+
return { value: scope.vars.get(src.slice(i + 2, end)) ?? SHELL_OPAQUE, end: end + 1 };
|
|
23346
|
+
}
|
|
23347
|
+
if (next === "'" && !inDouble) {
|
|
23348
|
+
let j = i + 2;
|
|
23349
|
+
while (j < src.length && src[j] !== "'") j += src[j] === "\\" ? 2 : 1;
|
|
23350
|
+
return { value: decodeAnsiC(src.slice(i + 2, j)), end: j + 1, quoted: true };
|
|
23351
|
+
}
|
|
23352
|
+
if (next === '"' && !inDouble) {
|
|
23353
|
+
const { value, end } = readDoubleQuoted(scope, i + 2, '"');
|
|
23354
|
+
return { value, end: end + 1, quoted: true };
|
|
23355
|
+
}
|
|
23356
|
+
NAME.lastIndex = i + 1;
|
|
23357
|
+
const name = NAME.exec(src)?.[0];
|
|
23358
|
+
if (name) return { value: scope.vars.get(name) ?? SHELL_OPAQUE, end: i + 1 + name.length };
|
|
23359
|
+
if (next && /[0-9@*#?$!-]/.test(next)) return { value: SHELL_OPAQUE, end: i + 2 };
|
|
23360
|
+
return { value: "$", end: i + 1 };
|
|
23361
|
+
}
|
|
23362
|
+
function parseUntil(scope, start, closeParen) {
|
|
23363
|
+
const { src } = scope;
|
|
23364
|
+
let i = start;
|
|
23365
|
+
let line = [];
|
|
23366
|
+
let current = { words: [], redirects: [], heredocs: [], afterAnd: false };
|
|
23367
|
+
let pendingHeredocs = [];
|
|
23368
|
+
let word = null;
|
|
23369
|
+
let quoted = false;
|
|
23370
|
+
let redirect = null;
|
|
23371
|
+
let parens = 0;
|
|
23372
|
+
const append = (text2, isQuoted = false) => {
|
|
23373
|
+
word = (word ?? "") + text2;
|
|
23374
|
+
quoted || (quoted = isQuoted);
|
|
23375
|
+
};
|
|
23376
|
+
const endWord = () => {
|
|
23377
|
+
if (word === null) return;
|
|
23378
|
+
if (redirect === "<<" || redirect === "<<-") {
|
|
23379
|
+
const heredoc = { strip: redirect === "<<-", delimiter: word, expand: !quoted, body: "" };
|
|
23380
|
+
current.heredocs.push(heredoc);
|
|
23381
|
+
pendingHeredocs.push(heredoc);
|
|
23382
|
+
} else if (redirect) {
|
|
23383
|
+
current.redirects.push({ op: redirect, target: word });
|
|
23384
|
+
} else {
|
|
23385
|
+
current.words.push(word);
|
|
23386
|
+
}
|
|
23387
|
+
word = null;
|
|
23388
|
+
quoted = false;
|
|
23389
|
+
redirect = null;
|
|
23390
|
+
};
|
|
23391
|
+
const endCommand = (op) => {
|
|
23392
|
+
endWord();
|
|
23393
|
+
const done = current;
|
|
23394
|
+
current = { words: [], redirects: [], heredocs: [], pipeFrom: op === "|" || op === "|&" ? done : void 0, afterAnd: op === "&&" };
|
|
23395
|
+
if (done.words.length > 0 || done.redirects.length > 0 || done.heredocs.length > 0) line.push(done);
|
|
23396
|
+
};
|
|
23397
|
+
const flush = () => {
|
|
23398
|
+
endCommand();
|
|
23399
|
+
for (const raw of line) emit(scope, raw);
|
|
23400
|
+
line = [];
|
|
23401
|
+
};
|
|
23402
|
+
while (i < src.length) {
|
|
23403
|
+
const c = src[i];
|
|
23404
|
+
if (c === "\\") {
|
|
23405
|
+
if (src[i + 1] !== "\n") append(src[i + 1] ?? "", true);
|
|
23406
|
+
i += 2;
|
|
23407
|
+
} else if (c === "'") {
|
|
23408
|
+
const end = indexOrEnd(src, "'", i + 1);
|
|
23409
|
+
append(src.slice(i + 1, end), true);
|
|
23410
|
+
i = end + 1;
|
|
23411
|
+
} else if (c === '"') {
|
|
23412
|
+
const { value, end } = readDoubleQuoted(scope, i + 1, '"');
|
|
23413
|
+
append(value, true);
|
|
23414
|
+
i = end + 1;
|
|
23415
|
+
} else if (c === "$" || c === "`") {
|
|
23416
|
+
const expansion = readExpansion(scope, i, false);
|
|
23417
|
+
append(expansion.value, expansion.quoted);
|
|
23418
|
+
i = expansion.end;
|
|
23419
|
+
} else if (c === "#" && word === null) {
|
|
23420
|
+
i = indexOrEnd(src, "\n", i);
|
|
23421
|
+
} else if (c === "\n") {
|
|
23422
|
+
endWord();
|
|
23423
|
+
i = readHeredocBodies(scope, pendingHeredocs, i + 1);
|
|
23424
|
+
pendingHeredocs = [];
|
|
23425
|
+
flush();
|
|
23426
|
+
} else if (c === " " || c === " " || c === "\r") {
|
|
23427
|
+
endWord();
|
|
23428
|
+
i++;
|
|
23429
|
+
} else if (c === ")" && parens === 0 && closeParen) {
|
|
23430
|
+
flush();
|
|
23431
|
+
return i + 1;
|
|
23432
|
+
} else {
|
|
23433
|
+
OPERATOR.lastIndex = i;
|
|
23434
|
+
const op = OPERATOR.exec(src)?.[0];
|
|
23435
|
+
if (!op) {
|
|
23436
|
+
append(c);
|
|
23437
|
+
i++;
|
|
23438
|
+
continue;
|
|
23439
|
+
}
|
|
23440
|
+
const fd = /[<>]/.test(op) && !quoted && /^\d+$/.test(word ?? "") ? word : null;
|
|
23441
|
+
if (fd !== null) word = null;
|
|
23442
|
+
endWord();
|
|
23443
|
+
i += op.length;
|
|
23444
|
+
if (/[<>]/.test(op)) redirect = `${fd ?? ""}${op}`;
|
|
23445
|
+
else {
|
|
23446
|
+
if (op === "(") parens++;
|
|
23447
|
+
if (op === ")") parens = Math.max(0, parens - 1);
|
|
23448
|
+
endCommand(op);
|
|
23449
|
+
}
|
|
23450
|
+
}
|
|
23451
|
+
}
|
|
23452
|
+
flush();
|
|
23453
|
+
return i;
|
|
23454
|
+
}
|
|
23455
|
+
|
|
23146
23456
|
// ../shared/src/display-message/parsers/utils.ts
|
|
23147
23457
|
var INTERRUPTED_MESSAGE_REGEX = /^\[Request interrupted by user.*\]$/;
|
|
23148
23458
|
function userMessageImages(value) {
|
|
@@ -23258,61 +23568,11 @@ function insertDisplayMessageByTimestamp(messages, message) {
|
|
|
23258
23568
|
}
|
|
23259
23569
|
|
|
23260
23570
|
// ../shared/src/display-message/format.ts
|
|
23261
|
-
function unquoteShellArg(value) {
|
|
23262
|
-
const trimmed = value.trim();
|
|
23263
|
-
if (trimmed.length < 2) return trimmed;
|
|
23264
|
-
if (trimmed[0] === "'" && trimmed[trimmed.length - 1] === "'") {
|
|
23265
|
-
return trimmed.slice(1, -1).replace(/'\\''/g, "'");
|
|
23266
|
-
}
|
|
23267
|
-
if (trimmed[0] === '"' && trimmed[trimmed.length - 1] === '"') {
|
|
23268
|
-
return trimmed.slice(1, -1).replace(/\\(["\\$`])/g, "$1");
|
|
23269
|
-
}
|
|
23270
|
-
return trimmed;
|
|
23271
|
-
}
|
|
23272
|
-
function shellPayload(command) {
|
|
23273
|
-
const match = command.trim().match(/^(?:\S*\/)?(?:ba|z|c|fi)?sh\s+-(?:[a-zA-Z]*c[a-zA-Z]*|c)\s+([\s\S]+)$/);
|
|
23274
|
-
return match ? unquoteShellArg(match[1]) : command.trim();
|
|
23275
|
-
}
|
|
23276
|
-
function splitShellWords(command) {
|
|
23277
|
-
const words = [];
|
|
23278
|
-
let word = "";
|
|
23279
|
-
let quote = null;
|
|
23280
|
-
let escaped = false;
|
|
23281
|
-
for (const char of command) {
|
|
23282
|
-
if (escaped) {
|
|
23283
|
-
word += char;
|
|
23284
|
-
escaped = false;
|
|
23285
|
-
continue;
|
|
23286
|
-
}
|
|
23287
|
-
if (char === "\\" && quote !== "'") {
|
|
23288
|
-
escaped = true;
|
|
23289
|
-
continue;
|
|
23290
|
-
}
|
|
23291
|
-
if (quote) {
|
|
23292
|
-
if (char === quote) quote = null;
|
|
23293
|
-
else word += char;
|
|
23294
|
-
continue;
|
|
23295
|
-
}
|
|
23296
|
-
if (char === '"' || char === "'") {
|
|
23297
|
-
quote = char;
|
|
23298
|
-
continue;
|
|
23299
|
-
}
|
|
23300
|
-
if (/\s/.test(char)) {
|
|
23301
|
-
if (word) {
|
|
23302
|
-
words.push(word);
|
|
23303
|
-
word = "";
|
|
23304
|
-
}
|
|
23305
|
-
continue;
|
|
23306
|
-
}
|
|
23307
|
-
word += char;
|
|
23308
|
-
}
|
|
23309
|
-
if (word) words.push(word);
|
|
23310
|
-
return words;
|
|
23311
|
-
}
|
|
23312
23571
|
function commandWords(command) {
|
|
23313
|
-
const
|
|
23314
|
-
if (
|
|
23315
|
-
|
|
23572
|
+
const commands = parseShellScript(command, null).filter(({ wrapper }) => !wrapper);
|
|
23573
|
+
if (commands.length !== 1) return null;
|
|
23574
|
+
const [{ argv, stdin, stdinFile, writes }] = commands;
|
|
23575
|
+
return stdin === void 0 && !stdinFile && writes.length === 0 ? argv.map((word) => word.replaceAll(SHELL_OPAQUE, "\u2026")) : null;
|
|
23316
23576
|
}
|
|
23317
23577
|
function skillNamesFromCommand(command) {
|
|
23318
23578
|
const words = commandWords(command);
|
|
@@ -27066,6 +27326,45 @@ var EGRESS_WORKSPACE_SHELL_VARS = {
|
|
|
27066
27326
|
EGRESS_EXIT_IP_ENDPOINTS: EGRESS_EXIT_IP_ENDPOINTS.join(" ")
|
|
27067
27327
|
};
|
|
27068
27328
|
|
|
27329
|
+
// ../shared/src/slash-commands.ts
|
|
27330
|
+
var SIDE_CHAT_COMMANDS = ["/btw", "/side"];
|
|
27331
|
+
var SLASH_COMMANDS = [
|
|
27332
|
+
{
|
|
27333
|
+
command: "/plan",
|
|
27334
|
+
description: "Switch to plan mode and optionally send a prompt.",
|
|
27335
|
+
argumentHint: "[prompt]",
|
|
27336
|
+
providers: ["claude", "codex", "cursor", "muse", "opencode", "pi", "relay"]
|
|
27337
|
+
},
|
|
27338
|
+
{
|
|
27339
|
+
command: "/fast",
|
|
27340
|
+
description: "Use the fast service tier for future turns.",
|
|
27341
|
+
providers: ["claude", "codex"]
|
|
27342
|
+
},
|
|
27343
|
+
{
|
|
27344
|
+
command: "/goal",
|
|
27345
|
+
description: "Set, pause, resume, or clear a task goal.",
|
|
27346
|
+
argumentHint: "<objective | pause | resume | clear>",
|
|
27347
|
+
providers: ["codex"]
|
|
27348
|
+
},
|
|
27349
|
+
{
|
|
27350
|
+
command: "/goal",
|
|
27351
|
+
description: "Set or clear a completion condition to keep working toward.",
|
|
27352
|
+
argumentHint: "<condition | clear>",
|
|
27353
|
+
providers: ["claude"]
|
|
27354
|
+
},
|
|
27355
|
+
{
|
|
27356
|
+
command: "/compact",
|
|
27357
|
+
description: "Compact the conversation context.",
|
|
27358
|
+
providers: ["codex", "muse"]
|
|
27359
|
+
},
|
|
27360
|
+
...SIDE_CHAT_COMMANDS.map((command) => ({
|
|
27361
|
+
command,
|
|
27362
|
+
description: "Open a side chat about this chat without interrupting it.",
|
|
27363
|
+
argumentHint: "[question]",
|
|
27364
|
+
providers: [...VALID_AGENT_PROVIDERS]
|
|
27365
|
+
}))
|
|
27366
|
+
];
|
|
27367
|
+
|
|
27069
27368
|
// ../shared/src/replicas-config.ts
|
|
27070
27369
|
var import_yaml = __toESM(require_dist());
|
|
27071
27370
|
|
|
@@ -27130,7 +27429,7 @@ var headlessFilesystemAgentResultSchema = external_exports.object({
|
|
|
27130
27429
|
});
|
|
27131
27430
|
|
|
27132
27431
|
// ../shared/src/cli-version.ts
|
|
27133
|
-
var CLI_VERSION = "0.2.
|
|
27432
|
+
var CLI_VERSION = "0.2.746";
|
|
27134
27433
|
|
|
27135
27434
|
// ../shared/src/version.ts
|
|
27136
27435
|
function compareVersions(v1, v2) {
|
|
@@ -27145,6 +27444,31 @@ function compareVersions(v1, v2) {
|
|
|
27145
27444
|
return 0;
|
|
27146
27445
|
}
|
|
27147
27446
|
|
|
27447
|
+
// ../shared/src/routes/command-protection.ts
|
|
27448
|
+
var commandProtectionRepoStateSchema = external_exports.object({
|
|
27449
|
+
branch: external_exports.string().nullable(),
|
|
27450
|
+
defaultBranch: external_exports.string().nullable(),
|
|
27451
|
+
pushBranch: external_exports.string().nullable(),
|
|
27452
|
+
pushConfig: external_exports.string().nullable(),
|
|
27453
|
+
headMessage: external_exports.string().nullable(),
|
|
27454
|
+
mergeInProgress: external_exports.boolean().optional()
|
|
27455
|
+
});
|
|
27456
|
+
var commandProtectionEvaluateRequestSchema = external_exports.object({
|
|
27457
|
+
provider: external_exports.enum(["claude", "codex", "cursor", "opencode", "pi"]),
|
|
27458
|
+
source: external_exports.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
|
|
27459
|
+
toolName: external_exports.string(),
|
|
27460
|
+
toolInput: external_exports.unknown(),
|
|
27461
|
+
command: external_exports.string().nullish(),
|
|
27462
|
+
cwd: external_exports.string().nullish(),
|
|
27463
|
+
toolUseId: external_exports.string().nullish(),
|
|
27464
|
+
// Read by the engine before the command runs, keyed by absolute path, so the
|
|
27465
|
+
// policy can see branches and commit messages the command text only references.
|
|
27466
|
+
gitContext: external_exports.object({
|
|
27467
|
+
repos: external_exports.record(external_exports.string(), commandProtectionRepoStateSchema),
|
|
27468
|
+
messageFiles: external_exports.record(external_exports.string(), external_exports.string())
|
|
27469
|
+
}).optional()
|
|
27470
|
+
});
|
|
27471
|
+
|
|
27148
27472
|
// ../shared/src/routes/linear.ts
|
|
27149
27473
|
var linearSessionMetadataSchema = external_exports.object({
|
|
27150
27474
|
via_mothership: external_exports.boolean().optional(),
|