replicas-cli 0.2.745 → 0.2.747
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 +346 -58
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -22590,12 +22590,13 @@ var CLAUDE_SONNET_5_BEDROCK_MODEL = "anthropic.claude-sonnet-5";
|
|
|
22590
22590
|
var CLAUDE_HAIKU_4_5_BEDROCK_MODEL = "us.anthropic.claude-haiku-4-5-20251001-v1:0";
|
|
22591
22591
|
var DEFAULT_CLAUDE_MODEL = CLAUDE_OPUS_5_5_MODEL;
|
|
22592
22592
|
var GPT_6_ASTRA_MODEL = "gpt-6-astra";
|
|
22593
|
+
var GPT_6_1_SOL_MODEL = "gpt-6.1-sol";
|
|
22593
22594
|
var GPT_6_SOL_MODEL = "gpt-6-sol";
|
|
22594
22595
|
var GPT_6_LUNA_MODEL = "gpt-6-luna";
|
|
22595
22596
|
var GPT_5_6_SOL_MODEL = "gpt-5.6-sol";
|
|
22596
22597
|
var GPT_5_6_TERRA_MODEL = "gpt-5.6-terra";
|
|
22597
22598
|
var GPT_5_6_LUNA_MODEL = "gpt-5.6-luna";
|
|
22598
|
-
var DEFAULT_CODEX_MODEL =
|
|
22599
|
+
var DEFAULT_CODEX_MODEL = GPT_6_1_SOL_MODEL;
|
|
22599
22600
|
var DEFAULT_OPENCODE_MODEL = "z-ai/glm-5.3";
|
|
22600
22601
|
var GLM_5_3_FLASH_MODEL = "z-ai/glm-5.3-flash";
|
|
22601
22602
|
var OX_ALPHA_MODEL = "stealth/ox-alpha";
|
|
@@ -22669,7 +22670,7 @@ var AGENT_MODELS = {
|
|
|
22669
22670
|
CLAUDE_SONNET_5_MODEL,
|
|
22670
22671
|
CLAUDE_HAIKU_4_5_MODEL
|
|
22671
22672
|
],
|
|
22672
|
-
codex: [DEFAULT_CODEX_MODEL, GPT_6_ASTRA_MODEL, GPT_6_LUNA_MODEL, GPT_5_6_SOL_MODEL, GPT_5_6_TERRA_MODEL, GPT_5_6_LUNA_MODEL, "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.2"],
|
|
22673
|
+
codex: [DEFAULT_CODEX_MODEL, GPT_6_SOL_MODEL, GPT_6_ASTRA_MODEL, GPT_6_LUNA_MODEL, GPT_5_6_SOL_MODEL, GPT_5_6_TERRA_MODEL, GPT_5_6_LUNA_MODEL, "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.2"],
|
|
22673
22674
|
cursor: [
|
|
22674
22675
|
CLAUDE_FABLE_5_1_MODEL,
|
|
22675
22676
|
CLAUDE_FABLE_5_MODEL,
|
|
@@ -22709,7 +22710,7 @@ var AGENT_MODELS = {
|
|
|
22709
22710
|
};
|
|
22710
22711
|
var DEFAULT_STATIC_AGENT_MODELS = {
|
|
22711
22712
|
claude: AGENT_MODELS.claude.filter((model) => model !== CLAUDE_FABLE_5_MODEL && model !== CLAUDE_OPUS_4_8_MODEL),
|
|
22712
|
-
codex: AGENT_MODELS.codex.filter((model) => !["gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.2"].includes(model))
|
|
22713
|
+
codex: AGENT_MODELS.codex.filter((model) => ![GPT_6_SOL_MODEL, "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.2"].includes(model))
|
|
22713
22714
|
};
|
|
22714
22715
|
var DEFAULT_CURSOR_MODELS = AGENT_MODELS.cursor;
|
|
22715
22716
|
function getAgentModelOptions(provider, overrides) {
|
|
@@ -22724,9 +22725,13 @@ var CLAUDE_MODEL_MIN_SANDBOX_IMAGE = {
|
|
|
22724
22725
|
};
|
|
22725
22726
|
var CODEX_MODEL_MIN_SANDBOX_IMAGE = {
|
|
22726
22727
|
[GPT_6_ASTRA_MODEL]: "replicas-sandbox-2026-09-04-v7",
|
|
22728
|
+
[GPT_6_1_SOL_MODEL]: "replicas-sandbox-2026-09-29-v8",
|
|
22727
22729
|
[GPT_6_SOL_MODEL]: "replicas-sandbox-2026-09-24-v1",
|
|
22728
22730
|
[GPT_6_LUNA_MODEL]: "replicas-sandbox-2026-09-24-v1"
|
|
22729
22731
|
};
|
|
22732
|
+
var SANDBOX_IMAGE_MODEL_FALLBACKS = {
|
|
22733
|
+
[GPT_6_1_SOL_MODEL]: GPT_6_SOL_MODEL
|
|
22734
|
+
};
|
|
22730
22735
|
function isAgentModelAllowed(provider, model, overrides) {
|
|
22731
22736
|
return overrides?.[provider] === null || getAgentModelOptions(provider, overrides).includes(model);
|
|
22732
22737
|
}
|
|
@@ -22744,6 +22749,7 @@ var MODEL_LABELS = {
|
|
|
22744
22749
|
[LEGACY_CLAUDE_OPUS_1M_MODEL]: "Opus (1M)",
|
|
22745
22750
|
haiku: "Haiku 4.5",
|
|
22746
22751
|
[GPT_6_ASTRA_MODEL]: "GPT-6 Astra",
|
|
22752
|
+
[GPT_6_1_SOL_MODEL]: "GPT-6.1 Sol",
|
|
22747
22753
|
[GPT_6_SOL_MODEL]: "GPT-6 Sol",
|
|
22748
22754
|
[GPT_6_LUNA_MODEL]: "GPT-6 Luna",
|
|
22749
22755
|
[GPT_5_6_SOL_MODEL]: "GPT-5.6 Sol",
|
|
@@ -23146,6 +23152,313 @@ function normalizeBackgroundTaskStatus(status) {
|
|
|
23146
23152
|
// ../shared/src/display-message/constants.ts
|
|
23147
23153
|
var USER_MESSAGE_MATCH_GRACE_PERIOD_MS = 3e4;
|
|
23148
23154
|
|
|
23155
|
+
// ../shared/src/shell-commands.ts
|
|
23156
|
+
var SHELL_OPAQUE = "\0";
|
|
23157
|
+
var MAX_DEPTH = 8;
|
|
23158
|
+
var OPERATOR = /&&|\|\||;;|\|&|<<<|<<-|<<|&>>|&>|>>|>&|>\||<&|<>|[;&|()<>]/y;
|
|
23159
|
+
var NAME = /[A-Za-z_]\w*/y;
|
|
23160
|
+
var SHELLS = /* @__PURE__ */ new Set(["sh", "bash", "zsh", "dash", "ksh"]);
|
|
23161
|
+
var PREFIX_WORDS = /* @__PURE__ */ new Set(["!", "{", "}", "if", "then", "else", "elif", "fi", "do", "done", "while", "until", "time", "exec", "command", "builtin", "nohup"]);
|
|
23162
|
+
var WRAPPER_VALUE_OPTIONS = {
|
|
23163
|
+
env: /^(?:-[uCS]|--(?:unset|chdir|split-string))$/,
|
|
23164
|
+
sudo: /^(?:-[ugCpUrhDRT]|--(?:user|group|close-from|prompt|other-user|role|type|host|chdir|command-timeout))$/,
|
|
23165
|
+
nice: /^(?:-n|--adjustment)$/,
|
|
23166
|
+
timeout: /^(?:-[sk]|--(?:signal|kill-after))$/
|
|
23167
|
+
};
|
|
23168
|
+
var ANSI_C_ESCAPES = { n: "\n", t: " ", r: "\r", a: "\x07", b: "\b", e: "\x1B", E: "\x1B", f: "\f", v: "\v" };
|
|
23169
|
+
function parseShellScript(script, cwd) {
|
|
23170
|
+
const scope = { src: script, vars: /* @__PURE__ */ new Map(), dir: cwd, commands: [], depth: 0 };
|
|
23171
|
+
parseUntil(scope, 0, false);
|
|
23172
|
+
return scope.commands;
|
|
23173
|
+
}
|
|
23174
|
+
function resolveShellPath(dir, path6) {
|
|
23175
|
+
if (path6.includes(SHELL_OPAQUE) || path6.startsWith("~")) return null;
|
|
23176
|
+
if (!path6.startsWith("/") && dir === null) return null;
|
|
23177
|
+
const parts = [];
|
|
23178
|
+
for (const part of (path6.startsWith("/") ? path6 : `${dir}/${path6}`).split("/")) {
|
|
23179
|
+
if (part === "..") parts.pop();
|
|
23180
|
+
else if (part && part !== ".") parts.push(part);
|
|
23181
|
+
}
|
|
23182
|
+
return `/${parts.join("/")}`;
|
|
23183
|
+
}
|
|
23184
|
+
function stripCommandPrefixes(words) {
|
|
23185
|
+
const assignments = [];
|
|
23186
|
+
let k = 0;
|
|
23187
|
+
while (k < words.length) {
|
|
23188
|
+
const word = words[k];
|
|
23189
|
+
if (/^[A-Za-z_]\w*=/.test(word)) assignments.push(word);
|
|
23190
|
+
else if (WRAPPER_VALUE_OPTIONS[word]) {
|
|
23191
|
+
while (words[k + 1]?.startsWith("-")) k += WRAPPER_VALUE_OPTIONS[word].test(words[k + 1]) ? 2 : 1;
|
|
23192
|
+
if (word === "timeout") k++;
|
|
23193
|
+
} else if (!PREFIX_WORDS.has(word)) break;
|
|
23194
|
+
k++;
|
|
23195
|
+
}
|
|
23196
|
+
return { argv: words.slice(k), assignments };
|
|
23197
|
+
}
|
|
23198
|
+
function indexOrEnd(src, search, from) {
|
|
23199
|
+
const index = src.indexOf(search, from);
|
|
23200
|
+
return index < 0 ? src.length : index;
|
|
23201
|
+
}
|
|
23202
|
+
function decodeAnsiC(text2) {
|
|
23203
|
+
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) => {
|
|
23204
|
+
if (escape[0] === "x" || escape[0] === "u") return String.fromCharCode(parseInt(escape.slice(1), 16));
|
|
23205
|
+
if (/^[0-7]/.test(escape)) return String.fromCharCode(parseInt(escape, 8));
|
|
23206
|
+
return ANSI_C_ESCAPES[escape] ?? escape;
|
|
23207
|
+
});
|
|
23208
|
+
}
|
|
23209
|
+
function staticOutput(argv, stdin) {
|
|
23210
|
+
const [name, ...args] = argv;
|
|
23211
|
+
if (name === "cat") return args.length === 0 || args.length === 1 && args[0] === "-" ? stdin : void 0;
|
|
23212
|
+
if (name === "echo") {
|
|
23213
|
+
let newline = true;
|
|
23214
|
+
let escapes = false;
|
|
23215
|
+
while (/^-[neE]+$/.test(args[0] ?? "")) {
|
|
23216
|
+
const flags = args.shift() ?? "";
|
|
23217
|
+
if (flags.includes("n")) newline = false;
|
|
23218
|
+
if (flags.includes("e")) escapes = true;
|
|
23219
|
+
}
|
|
23220
|
+
const text2 = args.join(" ");
|
|
23221
|
+
return (escapes ? decodeAnsiC(text2) : text2) + (newline ? "\n" : "");
|
|
23222
|
+
}
|
|
23223
|
+
if (name === "printf" && args.length > 0) {
|
|
23224
|
+
const format = decodeAnsiC(args[0]);
|
|
23225
|
+
if (/%(?![s%])/.test(format)) return void 0;
|
|
23226
|
+
const values = args.slice(1);
|
|
23227
|
+
let output = "";
|
|
23228
|
+
let next = 0;
|
|
23229
|
+
do {
|
|
23230
|
+
output += format.replace(/%([s%])/g, (_match, directive) => directive === "%" ? "%" : values[next++] ?? "");
|
|
23231
|
+
} while (format.includes("%s") && next < values.length);
|
|
23232
|
+
return output;
|
|
23233
|
+
}
|
|
23234
|
+
return void 0;
|
|
23235
|
+
}
|
|
23236
|
+
function commandStdin(raw) {
|
|
23237
|
+
const heredoc = raw.heredocs.at(-1);
|
|
23238
|
+
if (heredoc) return heredoc.body;
|
|
23239
|
+
const input = raw.redirects.findLast(({ op }) => op === "<<<" || op === "<" || op === "0<");
|
|
23240
|
+
if (input) return input.op === "<<<" ? `${input.target}
|
|
23241
|
+
` : SHELL_OPAQUE;
|
|
23242
|
+
if (raw.pipeFrom) return staticOutput(stripCommandPrefixes(raw.pipeFrom.words).argv, commandStdin(raw.pipeFrom)) ?? SHELL_OPAQUE;
|
|
23243
|
+
return void 0;
|
|
23244
|
+
}
|
|
23245
|
+
function assign(scope, assignments) {
|
|
23246
|
+
for (const assignment of assignments) {
|
|
23247
|
+
const separator = assignment.indexOf("=");
|
|
23248
|
+
scope.vars.set(assignment.slice(0, separator), assignment.slice(separator + 1));
|
|
23249
|
+
}
|
|
23250
|
+
}
|
|
23251
|
+
function emit(scope, raw) {
|
|
23252
|
+
const { argv, assignments } = stripCommandPrefixes(raw.words);
|
|
23253
|
+
if (argv.length === 0) {
|
|
23254
|
+
assign(scope, assignments);
|
|
23255
|
+
return;
|
|
23256
|
+
}
|
|
23257
|
+
const stdin = commandStdin(raw);
|
|
23258
|
+
const output = staticOutput(argv, stdin) ?? SHELL_OPAQUE;
|
|
23259
|
+
const stdinFile = raw.redirects.findLast(({ op }) => op === "<" || op === "0<");
|
|
23260
|
+
const name = argv[0].split("/").pop() ?? "";
|
|
23261
|
+
const flag = SHELLS.has(name) ? argv.findIndex((arg, index) => index > 0 && /^-[A-Za-z]*c[A-Za-z]*$/.test(arg)) : -1;
|
|
23262
|
+
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;
|
|
23263
|
+
const truncated = script !== void 0 && scope.depth >= MAX_DEPTH;
|
|
23264
|
+
scope.commands.push({
|
|
23265
|
+
argv,
|
|
23266
|
+
dir: scope.dir,
|
|
23267
|
+
stdin,
|
|
23268
|
+
afterAnd: raw.afterAnd,
|
|
23269
|
+
stdinFile: stdinFile ? resolveShellPath(scope.dir, stdinFile.target) : null,
|
|
23270
|
+
writes: raw.redirects.flatMap(({ op, target }) => /^(?:1?>|1?>\||1?>>|&>|&>>|>&)$/.test(op) && !/^(?:\d+|-)$/.test(target) ? [{ path: resolveShellPath(scope.dir, target), content: output, append: op.endsWith(">>") }] : []),
|
|
23271
|
+
wrapper: script !== void 0,
|
|
23272
|
+
truncated
|
|
23273
|
+
});
|
|
23274
|
+
if (name === "cd" || name === "pushd" || name === "popd") {
|
|
23275
|
+
scope.dir = name !== "popd" && argv[1] && argv[1] !== "-" ? resolveShellPath(scope.dir, argv[1]) : null;
|
|
23276
|
+
} else if (["export", "declare", "local", "readonly"].includes(name)) {
|
|
23277
|
+
assign(scope, argv.slice(1).filter((arg) => /^[A-Za-z_]\w*=/.test(arg)));
|
|
23278
|
+
}
|
|
23279
|
+
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);
|
|
23280
|
+
}
|
|
23281
|
+
function readHeredocBodies(scope, heredocs, start) {
|
|
23282
|
+
const { src } = scope;
|
|
23283
|
+
let position = start;
|
|
23284
|
+
for (const heredoc of heredocs) {
|
|
23285
|
+
const lines = [];
|
|
23286
|
+
while (position < src.length) {
|
|
23287
|
+
const end = indexOrEnd(src, "\n", position);
|
|
23288
|
+
const line = heredoc.strip ? src.slice(position, end).replace(/^\t+/, "") : src.slice(position, end);
|
|
23289
|
+
position = end + 1;
|
|
23290
|
+
if (line === heredoc.delimiter) break;
|
|
23291
|
+
lines.push(line);
|
|
23292
|
+
}
|
|
23293
|
+
heredoc.body = lines.length > 0 ? `${lines.join("\n")}
|
|
23294
|
+
` : "";
|
|
23295
|
+
if (heredoc.expand) heredoc.body = readDoubleQuoted({ ...scope, src: heredoc.body }, 0, null).value;
|
|
23296
|
+
}
|
|
23297
|
+
return Math.min(position, src.length);
|
|
23298
|
+
}
|
|
23299
|
+
function readDoubleQuoted(scope, start, terminator) {
|
|
23300
|
+
const { src } = scope;
|
|
23301
|
+
let value = "";
|
|
23302
|
+
let i = start;
|
|
23303
|
+
while (i < src.length && src[i] !== terminator) {
|
|
23304
|
+
const c = src[i];
|
|
23305
|
+
if (c === "\\" && i + 1 < src.length) {
|
|
23306
|
+
const next = src[i + 1];
|
|
23307
|
+
if (next === "\n") i += 2;
|
|
23308
|
+
else if ("$`\\".includes(next) || next === terminator) {
|
|
23309
|
+
value += next;
|
|
23310
|
+
i += 2;
|
|
23311
|
+
} else {
|
|
23312
|
+
value += c;
|
|
23313
|
+
i++;
|
|
23314
|
+
}
|
|
23315
|
+
} else if (c === "$" || c === "`") {
|
|
23316
|
+
const expansion = readExpansion(scope, i, true);
|
|
23317
|
+
value += expansion.value;
|
|
23318
|
+
i = expansion.end;
|
|
23319
|
+
} else {
|
|
23320
|
+
value += c;
|
|
23321
|
+
i++;
|
|
23322
|
+
}
|
|
23323
|
+
}
|
|
23324
|
+
return { value, end: i };
|
|
23325
|
+
}
|
|
23326
|
+
function substitute(scope, src, start, closeParen) {
|
|
23327
|
+
const child = { src, vars: new Map(scope.vars), dir: scope.dir, commands: [], depth: scope.depth + 1 };
|
|
23328
|
+
const end = parseUntil(child, start, closeParen);
|
|
23329
|
+
scope.commands.push(...child.commands);
|
|
23330
|
+
const [only] = child.commands;
|
|
23331
|
+
const output = child.commands.length === 1 ? staticOutput(only.argv, only.stdin) : void 0;
|
|
23332
|
+
return { value: output?.replace(/\n+$/, "") ?? SHELL_OPAQUE, end };
|
|
23333
|
+
}
|
|
23334
|
+
function readExpansion(scope, i, inDouble) {
|
|
23335
|
+
const { src } = scope;
|
|
23336
|
+
if (src[i] === "`") {
|
|
23337
|
+
let inner = "";
|
|
23338
|
+
let j = i + 1;
|
|
23339
|
+
while (j < src.length && src[j] !== "`") {
|
|
23340
|
+
if (src[j] === "\\" && "$`\\".includes(src[j + 1] ?? "")) {
|
|
23341
|
+
inner += src[j + 1];
|
|
23342
|
+
j += 2;
|
|
23343
|
+
} else inner += src[j++];
|
|
23344
|
+
}
|
|
23345
|
+
return { value: substitute(scope, inner, 0, false).value, end: j + 1 };
|
|
23346
|
+
}
|
|
23347
|
+
const next = src[i + 1];
|
|
23348
|
+
if (next === "(") return substitute(scope, src, i + 2, true);
|
|
23349
|
+
if (next === "{") {
|
|
23350
|
+
const end = indexOrEnd(src, "}", i + 2);
|
|
23351
|
+
return { value: scope.vars.get(src.slice(i + 2, end)) ?? SHELL_OPAQUE, end: end + 1 };
|
|
23352
|
+
}
|
|
23353
|
+
if (next === "'" && !inDouble) {
|
|
23354
|
+
let j = i + 2;
|
|
23355
|
+
while (j < src.length && src[j] !== "'") j += src[j] === "\\" ? 2 : 1;
|
|
23356
|
+
return { value: decodeAnsiC(src.slice(i + 2, j)), end: j + 1, quoted: true };
|
|
23357
|
+
}
|
|
23358
|
+
if (next === '"' && !inDouble) {
|
|
23359
|
+
const { value, end } = readDoubleQuoted(scope, i + 2, '"');
|
|
23360
|
+
return { value, end: end + 1, quoted: true };
|
|
23361
|
+
}
|
|
23362
|
+
NAME.lastIndex = i + 1;
|
|
23363
|
+
const name = NAME.exec(src)?.[0];
|
|
23364
|
+
if (name) return { value: scope.vars.get(name) ?? SHELL_OPAQUE, end: i + 1 + name.length };
|
|
23365
|
+
if (next && /[0-9@*#?$!-]/.test(next)) return { value: SHELL_OPAQUE, end: i + 2 };
|
|
23366
|
+
return { value: "$", end: i + 1 };
|
|
23367
|
+
}
|
|
23368
|
+
function parseUntil(scope, start, closeParen) {
|
|
23369
|
+
const { src } = scope;
|
|
23370
|
+
let i = start;
|
|
23371
|
+
let line = [];
|
|
23372
|
+
let current = { words: [], redirects: [], heredocs: [], afterAnd: false };
|
|
23373
|
+
let pendingHeredocs = [];
|
|
23374
|
+
let word = null;
|
|
23375
|
+
let quoted = false;
|
|
23376
|
+
let redirect = null;
|
|
23377
|
+
let parens = 0;
|
|
23378
|
+
const append = (text2, isQuoted = false) => {
|
|
23379
|
+
word = (word ?? "") + text2;
|
|
23380
|
+
quoted || (quoted = isQuoted);
|
|
23381
|
+
};
|
|
23382
|
+
const endWord = () => {
|
|
23383
|
+
if (word === null) return;
|
|
23384
|
+
if (redirect === "<<" || redirect === "<<-") {
|
|
23385
|
+
const heredoc = { strip: redirect === "<<-", delimiter: word, expand: !quoted, body: "" };
|
|
23386
|
+
current.heredocs.push(heredoc);
|
|
23387
|
+
pendingHeredocs.push(heredoc);
|
|
23388
|
+
} else if (redirect) {
|
|
23389
|
+
current.redirects.push({ op: redirect, target: word });
|
|
23390
|
+
} else {
|
|
23391
|
+
current.words.push(word);
|
|
23392
|
+
}
|
|
23393
|
+
word = null;
|
|
23394
|
+
quoted = false;
|
|
23395
|
+
redirect = null;
|
|
23396
|
+
};
|
|
23397
|
+
const endCommand = (op) => {
|
|
23398
|
+
endWord();
|
|
23399
|
+
const done = current;
|
|
23400
|
+
current = { words: [], redirects: [], heredocs: [], pipeFrom: op === "|" || op === "|&" ? done : void 0, afterAnd: op === "&&" };
|
|
23401
|
+
if (done.words.length > 0 || done.redirects.length > 0 || done.heredocs.length > 0) line.push(done);
|
|
23402
|
+
};
|
|
23403
|
+
const flush = () => {
|
|
23404
|
+
endCommand();
|
|
23405
|
+
for (const raw of line) emit(scope, raw);
|
|
23406
|
+
line = [];
|
|
23407
|
+
};
|
|
23408
|
+
while (i < src.length) {
|
|
23409
|
+
const c = src[i];
|
|
23410
|
+
if (c === "\\") {
|
|
23411
|
+
if (src[i + 1] !== "\n") append(src[i + 1] ?? "", true);
|
|
23412
|
+
i += 2;
|
|
23413
|
+
} else if (c === "'") {
|
|
23414
|
+
const end = indexOrEnd(src, "'", i + 1);
|
|
23415
|
+
append(src.slice(i + 1, end), true);
|
|
23416
|
+
i = end + 1;
|
|
23417
|
+
} else if (c === '"') {
|
|
23418
|
+
const { value, end } = readDoubleQuoted(scope, i + 1, '"');
|
|
23419
|
+
append(value, true);
|
|
23420
|
+
i = end + 1;
|
|
23421
|
+
} else if (c === "$" || c === "`") {
|
|
23422
|
+
const expansion = readExpansion(scope, i, false);
|
|
23423
|
+
append(expansion.value, expansion.quoted);
|
|
23424
|
+
i = expansion.end;
|
|
23425
|
+
} else if (c === "#" && word === null) {
|
|
23426
|
+
i = indexOrEnd(src, "\n", i);
|
|
23427
|
+
} else if (c === "\n") {
|
|
23428
|
+
endWord();
|
|
23429
|
+
i = readHeredocBodies(scope, pendingHeredocs, i + 1);
|
|
23430
|
+
pendingHeredocs = [];
|
|
23431
|
+
flush();
|
|
23432
|
+
} else if (c === " " || c === " " || c === "\r") {
|
|
23433
|
+
endWord();
|
|
23434
|
+
i++;
|
|
23435
|
+
} else if (c === ")" && parens === 0 && closeParen) {
|
|
23436
|
+
flush();
|
|
23437
|
+
return i + 1;
|
|
23438
|
+
} else {
|
|
23439
|
+
OPERATOR.lastIndex = i;
|
|
23440
|
+
const op = OPERATOR.exec(src)?.[0];
|
|
23441
|
+
if (!op) {
|
|
23442
|
+
append(c);
|
|
23443
|
+
i++;
|
|
23444
|
+
continue;
|
|
23445
|
+
}
|
|
23446
|
+
const fd = /[<>]/.test(op) && !quoted && /^\d+$/.test(word ?? "") ? word : null;
|
|
23447
|
+
if (fd !== null) word = null;
|
|
23448
|
+
endWord();
|
|
23449
|
+
i += op.length;
|
|
23450
|
+
if (/[<>]/.test(op)) redirect = `${fd ?? ""}${op}`;
|
|
23451
|
+
else {
|
|
23452
|
+
if (op === "(") parens++;
|
|
23453
|
+
if (op === ")") parens = Math.max(0, parens - 1);
|
|
23454
|
+
endCommand(op);
|
|
23455
|
+
}
|
|
23456
|
+
}
|
|
23457
|
+
}
|
|
23458
|
+
flush();
|
|
23459
|
+
return i;
|
|
23460
|
+
}
|
|
23461
|
+
|
|
23149
23462
|
// ../shared/src/display-message/parsers/utils.ts
|
|
23150
23463
|
var INTERRUPTED_MESSAGE_REGEX = /^\[Request interrupted by user.*\]$/;
|
|
23151
23464
|
function userMessageImages(value) {
|
|
@@ -23261,61 +23574,11 @@ function insertDisplayMessageByTimestamp(messages, message) {
|
|
|
23261
23574
|
}
|
|
23262
23575
|
|
|
23263
23576
|
// ../shared/src/display-message/format.ts
|
|
23264
|
-
function unquoteShellArg(value) {
|
|
23265
|
-
const trimmed = value.trim();
|
|
23266
|
-
if (trimmed.length < 2) return trimmed;
|
|
23267
|
-
if (trimmed[0] === "'" && trimmed[trimmed.length - 1] === "'") {
|
|
23268
|
-
return trimmed.slice(1, -1).replace(/'\\''/g, "'");
|
|
23269
|
-
}
|
|
23270
|
-
if (trimmed[0] === '"' && trimmed[trimmed.length - 1] === '"') {
|
|
23271
|
-
return trimmed.slice(1, -1).replace(/\\(["\\$`])/g, "$1");
|
|
23272
|
-
}
|
|
23273
|
-
return trimmed;
|
|
23274
|
-
}
|
|
23275
|
-
function shellPayload(command) {
|
|
23276
|
-
const match = command.trim().match(/^(?:\S*\/)?(?:ba|z|c|fi)?sh\s+-(?:[a-zA-Z]*c[a-zA-Z]*|c)\s+([\s\S]+)$/);
|
|
23277
|
-
return match ? unquoteShellArg(match[1]) : command.trim();
|
|
23278
|
-
}
|
|
23279
|
-
function splitShellWords(command) {
|
|
23280
|
-
const words = [];
|
|
23281
|
-
let word = "";
|
|
23282
|
-
let quote = null;
|
|
23283
|
-
let escaped = false;
|
|
23284
|
-
for (const char of command) {
|
|
23285
|
-
if (escaped) {
|
|
23286
|
-
word += char;
|
|
23287
|
-
escaped = false;
|
|
23288
|
-
continue;
|
|
23289
|
-
}
|
|
23290
|
-
if (char === "\\" && quote !== "'") {
|
|
23291
|
-
escaped = true;
|
|
23292
|
-
continue;
|
|
23293
|
-
}
|
|
23294
|
-
if (quote) {
|
|
23295
|
-
if (char === quote) quote = null;
|
|
23296
|
-
else word += char;
|
|
23297
|
-
continue;
|
|
23298
|
-
}
|
|
23299
|
-
if (char === '"' || char === "'") {
|
|
23300
|
-
quote = char;
|
|
23301
|
-
continue;
|
|
23302
|
-
}
|
|
23303
|
-
if (/\s/.test(char)) {
|
|
23304
|
-
if (word) {
|
|
23305
|
-
words.push(word);
|
|
23306
|
-
word = "";
|
|
23307
|
-
}
|
|
23308
|
-
continue;
|
|
23309
|
-
}
|
|
23310
|
-
word += char;
|
|
23311
|
-
}
|
|
23312
|
-
if (word) words.push(word);
|
|
23313
|
-
return words;
|
|
23314
|
-
}
|
|
23315
23577
|
function commandWords(command) {
|
|
23316
|
-
const
|
|
23317
|
-
if (
|
|
23318
|
-
|
|
23578
|
+
const commands = parseShellScript(command, null).filter(({ wrapper }) => !wrapper);
|
|
23579
|
+
if (commands.length !== 1) return null;
|
|
23580
|
+
const [{ argv, stdin, stdinFile, writes }] = commands;
|
|
23581
|
+
return stdin === void 0 && !stdinFile && writes.length === 0 ? argv.map((word) => word.replaceAll(SHELL_OPAQUE, "\u2026")) : null;
|
|
23319
23582
|
}
|
|
23320
23583
|
function skillNamesFromCommand(command) {
|
|
23321
23584
|
const words = commandWords(command);
|
|
@@ -27172,7 +27435,7 @@ var headlessFilesystemAgentResultSchema = external_exports.object({
|
|
|
27172
27435
|
});
|
|
27173
27436
|
|
|
27174
27437
|
// ../shared/src/cli-version.ts
|
|
27175
|
-
var CLI_VERSION = "0.2.
|
|
27438
|
+
var CLI_VERSION = "0.2.747";
|
|
27176
27439
|
|
|
27177
27440
|
// ../shared/src/version.ts
|
|
27178
27441
|
function compareVersions(v1, v2) {
|
|
@@ -27187,6 +27450,31 @@ function compareVersions(v1, v2) {
|
|
|
27187
27450
|
return 0;
|
|
27188
27451
|
}
|
|
27189
27452
|
|
|
27453
|
+
// ../shared/src/routes/command-protection.ts
|
|
27454
|
+
var commandProtectionRepoStateSchema = external_exports.object({
|
|
27455
|
+
branch: external_exports.string().nullable(),
|
|
27456
|
+
defaultBranch: external_exports.string().nullable(),
|
|
27457
|
+
pushBranch: external_exports.string().nullable(),
|
|
27458
|
+
pushConfig: external_exports.string().nullable(),
|
|
27459
|
+
headMessage: external_exports.string().nullable(),
|
|
27460
|
+
mergeInProgress: external_exports.boolean().optional()
|
|
27461
|
+
});
|
|
27462
|
+
var commandProtectionEvaluateRequestSchema = external_exports.object({
|
|
27463
|
+
provider: external_exports.enum(["claude", "codex", "cursor", "opencode", "pi"]),
|
|
27464
|
+
source: external_exports.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
|
|
27465
|
+
toolName: external_exports.string(),
|
|
27466
|
+
toolInput: external_exports.unknown(),
|
|
27467
|
+
command: external_exports.string().nullish(),
|
|
27468
|
+
cwd: external_exports.string().nullish(),
|
|
27469
|
+
toolUseId: external_exports.string().nullish(),
|
|
27470
|
+
// Read by the engine before the command runs, keyed by absolute path, so the
|
|
27471
|
+
// policy can see branches and commit messages the command text only references.
|
|
27472
|
+
gitContext: external_exports.object({
|
|
27473
|
+
repos: external_exports.record(external_exports.string(), commandProtectionRepoStateSchema),
|
|
27474
|
+
messageFiles: external_exports.record(external_exports.string(), external_exports.string())
|
|
27475
|
+
}).optional()
|
|
27476
|
+
});
|
|
27477
|
+
|
|
27190
27478
|
// ../shared/src/routes/linear.ts
|
|
27191
27479
|
var linearSessionMetadataSchema = external_exports.object({
|
|
27192
27480
|
via_mothership: external_exports.boolean().optional(),
|