replicas-engine 0.1.933 → 0.1.935
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/src/{asp-host-V5JMSPLS.js → asp-host-TNBLV7CZ.js} +5 -4
- package/dist/src/chunk-4MN6PV5T.js +19 -0
- package/dist/src/{chunk-BXHF65NV.js → chunk-5S4DHSVO.js} +5 -13
- package/dist/src/{chunk-RVSMHQVH.js → chunk-7AHZJSWR.js} +685 -195
- package/dist/src/{chunk-5PTJWSW3.js → chunk-A753OSOP.js} +8 -6
- package/dist/src/chunk-H4VNL5V4.js +191 -0
- package/dist/src/{chunk-RAZD4N5G.js → chunk-JIWNLGNP.js} +1 -1
- package/dist/src/{chunk-3GJEQKPY.js → chunk-SJLJNLTL.js} +1 -1
- package/dist/src/command-protection-hook.js +5 -4
- package/dist/src/headless-agent.js +3 -2
- package/dist/src/index.js +341 -411
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/relay-mcp.js +1 -1
- package/package.json +1 -1
- package/dist/src/chunk-SY46VC2H.js +0 -75
|
@@ -221,12 +221,13 @@ var CLAUDE_SONNET_5_BEDROCK_MODEL = "anthropic.claude-sonnet-5";
|
|
|
221
221
|
var CLAUDE_HAIKU_4_5_BEDROCK_MODEL = "us.anthropic.claude-haiku-4-5-20251001-v1:0";
|
|
222
222
|
var DEFAULT_CLAUDE_MODEL = CLAUDE_OPUS_5_5_MODEL;
|
|
223
223
|
var GPT_6_ASTRA_MODEL = "gpt-6-astra";
|
|
224
|
+
var GPT_6_1_SOL_MODEL = "gpt-6.1-sol";
|
|
224
225
|
var GPT_6_SOL_MODEL = "gpt-6-sol";
|
|
225
226
|
var GPT_6_LUNA_MODEL = "gpt-6-luna";
|
|
226
227
|
var GPT_5_6_SOL_MODEL = "gpt-5.6-sol";
|
|
227
228
|
var GPT_5_6_TERRA_MODEL = "gpt-5.6-terra";
|
|
228
229
|
var GPT_5_6_LUNA_MODEL = "gpt-5.6-luna";
|
|
229
|
-
var DEFAULT_CODEX_MODEL =
|
|
230
|
+
var DEFAULT_CODEX_MODEL = GPT_6_1_SOL_MODEL;
|
|
230
231
|
var DEFAULT_CURSOR_MODEL = "composer-2.5";
|
|
231
232
|
var DEFAULT_OPENCODE_MODEL = "z-ai/glm-5.3";
|
|
232
233
|
var GLM_5_3_FLASH_MODEL = "z-ai/glm-5.3-flash";
|
|
@@ -328,7 +329,7 @@ var AGENT_MODELS = {
|
|
|
328
329
|
CLAUDE_SONNET_5_MODEL,
|
|
329
330
|
CLAUDE_HAIKU_4_5_MODEL
|
|
330
331
|
],
|
|
331
|
-
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"],
|
|
332
|
+
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"],
|
|
332
333
|
cursor: [
|
|
333
334
|
CLAUDE_FABLE_5_1_MODEL,
|
|
334
335
|
CLAUDE_FABLE_5_MODEL,
|
|
@@ -368,7 +369,7 @@ var AGENT_MODELS = {
|
|
|
368
369
|
};
|
|
369
370
|
var DEFAULT_STATIC_AGENT_MODELS = {
|
|
370
371
|
claude: AGENT_MODELS.claude.filter((model) => model !== CLAUDE_FABLE_5_MODEL && model !== CLAUDE_OPUS_4_8_MODEL),
|
|
371
|
-
codex: AGENT_MODELS.codex.filter((model) => !["gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.2"].includes(model))
|
|
372
|
+
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))
|
|
372
373
|
};
|
|
373
374
|
var DEFAULT_CURSOR_MODELS = AGENT_MODELS.cursor;
|
|
374
375
|
function getAgentModelOptions(provider, overrides) {
|
|
@@ -383,9 +384,13 @@ var CLAUDE_MODEL_MIN_SANDBOX_IMAGE = {
|
|
|
383
384
|
};
|
|
384
385
|
var CODEX_MODEL_MIN_SANDBOX_IMAGE = {
|
|
385
386
|
[GPT_6_ASTRA_MODEL]: "replicas-sandbox-2026-09-04-v7",
|
|
387
|
+
[GPT_6_1_SOL_MODEL]: "replicas-sandbox-2026-09-29-v8",
|
|
386
388
|
[GPT_6_SOL_MODEL]: "replicas-sandbox-2026-09-24-v1",
|
|
387
389
|
[GPT_6_LUNA_MODEL]: "replicas-sandbox-2026-09-24-v1"
|
|
388
390
|
};
|
|
391
|
+
var SANDBOX_IMAGE_MODEL_FALLBACKS = {
|
|
392
|
+
[GPT_6_1_SOL_MODEL]: GPT_6_SOL_MODEL
|
|
393
|
+
};
|
|
389
394
|
var MODEL_LABELS = {
|
|
390
395
|
fable: "Fable 5.1",
|
|
391
396
|
[CLAUDE_FABLE_5_1_MODEL]: "Fable 5.1",
|
|
@@ -400,6 +405,7 @@ var MODEL_LABELS = {
|
|
|
400
405
|
[LEGACY_CLAUDE_OPUS_1M_MODEL]: "Opus (1M)",
|
|
401
406
|
haiku: "Haiku 4.5",
|
|
402
407
|
[GPT_6_ASTRA_MODEL]: "GPT-6 Astra",
|
|
408
|
+
[GPT_6_1_SOL_MODEL]: "GPT-6.1 Sol",
|
|
403
409
|
[GPT_6_SOL_MODEL]: "GPT-6 Sol",
|
|
404
410
|
[GPT_6_LUNA_MODEL]: "GPT-6 Luna",
|
|
405
411
|
[GPT_5_6_SOL_MODEL]: "GPT-5.6 Sol",
|
|
@@ -2062,6 +2068,313 @@ function normalizeBackgroundTaskStatus(status) {
|
|
|
2062
2068
|
// ../shared/src/display-message/constants.ts
|
|
2063
2069
|
var USER_MESSAGE_MATCH_GRACE_PERIOD_MS = 3e4;
|
|
2064
2070
|
|
|
2071
|
+
// ../shared/src/shell-commands.ts
|
|
2072
|
+
var SHELL_OPAQUE = "\0";
|
|
2073
|
+
var MAX_DEPTH = 8;
|
|
2074
|
+
var OPERATOR = /&&|\|\||;;|\|&|<<<|<<-|<<|&>>|&>|>>|>&|>\||<&|<>|[;&|()<>]/y;
|
|
2075
|
+
var NAME = /[A-Za-z_]\w*/y;
|
|
2076
|
+
var SHELLS = /* @__PURE__ */ new Set(["sh", "bash", "zsh", "dash", "ksh"]);
|
|
2077
|
+
var PREFIX_WORDS = /* @__PURE__ */ new Set(["!", "{", "}", "if", "then", "else", "elif", "fi", "do", "done", "while", "until", "time", "exec", "command", "builtin", "nohup"]);
|
|
2078
|
+
var WRAPPER_VALUE_OPTIONS = {
|
|
2079
|
+
env: /^(?:-[uCS]|--(?:unset|chdir|split-string))$/,
|
|
2080
|
+
sudo: /^(?:-[ugCpUrhDRT]|--(?:user|group|close-from|prompt|other-user|role|type|host|chdir|command-timeout))$/,
|
|
2081
|
+
nice: /^(?:-n|--adjustment)$/,
|
|
2082
|
+
timeout: /^(?:-[sk]|--(?:signal|kill-after))$/
|
|
2083
|
+
};
|
|
2084
|
+
var ANSI_C_ESCAPES = { n: "\n", t: " ", r: "\r", a: "\x07", b: "\b", e: "\x1B", E: "\x1B", f: "\f", v: "\v" };
|
|
2085
|
+
function parseShellScript(script, cwd) {
|
|
2086
|
+
const scope = { src: script, vars: /* @__PURE__ */ new Map(), dir: cwd, commands: [], depth: 0 };
|
|
2087
|
+
parseUntil(scope, 0, false);
|
|
2088
|
+
return scope.commands;
|
|
2089
|
+
}
|
|
2090
|
+
function resolveShellPath(dir, path) {
|
|
2091
|
+
if (path.includes(SHELL_OPAQUE) || path.startsWith("~")) return null;
|
|
2092
|
+
if (!path.startsWith("/") && dir === null) return null;
|
|
2093
|
+
const parts = [];
|
|
2094
|
+
for (const part of (path.startsWith("/") ? path : `${dir}/${path}`).split("/")) {
|
|
2095
|
+
if (part === "..") parts.pop();
|
|
2096
|
+
else if (part && part !== ".") parts.push(part);
|
|
2097
|
+
}
|
|
2098
|
+
return `/${parts.join("/")}`;
|
|
2099
|
+
}
|
|
2100
|
+
function stripCommandPrefixes(words) {
|
|
2101
|
+
const assignments = [];
|
|
2102
|
+
let k = 0;
|
|
2103
|
+
while (k < words.length) {
|
|
2104
|
+
const word = words[k];
|
|
2105
|
+
if (/^[A-Za-z_]\w*=/.test(word)) assignments.push(word);
|
|
2106
|
+
else if (WRAPPER_VALUE_OPTIONS[word]) {
|
|
2107
|
+
while (words[k + 1]?.startsWith("-")) k += WRAPPER_VALUE_OPTIONS[word].test(words[k + 1]) ? 2 : 1;
|
|
2108
|
+
if (word === "timeout") k++;
|
|
2109
|
+
} else if (!PREFIX_WORDS.has(word)) break;
|
|
2110
|
+
k++;
|
|
2111
|
+
}
|
|
2112
|
+
return { argv: words.slice(k), assignments };
|
|
2113
|
+
}
|
|
2114
|
+
function indexOrEnd(src, search, from) {
|
|
2115
|
+
const index = src.indexOf(search, from);
|
|
2116
|
+
return index < 0 ? src.length : index;
|
|
2117
|
+
}
|
|
2118
|
+
function decodeAnsiC(text2) {
|
|
2119
|
+
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) => {
|
|
2120
|
+
if (escape[0] === "x" || escape[0] === "u") return String.fromCharCode(parseInt(escape.slice(1), 16));
|
|
2121
|
+
if (/^[0-7]/.test(escape)) return String.fromCharCode(parseInt(escape, 8));
|
|
2122
|
+
return ANSI_C_ESCAPES[escape] ?? escape;
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2125
|
+
function staticOutput(argv, stdin) {
|
|
2126
|
+
const [name, ...args] = argv;
|
|
2127
|
+
if (name === "cat") return args.length === 0 || args.length === 1 && args[0] === "-" ? stdin : void 0;
|
|
2128
|
+
if (name === "echo") {
|
|
2129
|
+
let newline = true;
|
|
2130
|
+
let escapes = false;
|
|
2131
|
+
while (/^-[neE]+$/.test(args[0] ?? "")) {
|
|
2132
|
+
const flags = args.shift() ?? "";
|
|
2133
|
+
if (flags.includes("n")) newline = false;
|
|
2134
|
+
if (flags.includes("e")) escapes = true;
|
|
2135
|
+
}
|
|
2136
|
+
const text2 = args.join(" ");
|
|
2137
|
+
return (escapes ? decodeAnsiC(text2) : text2) + (newline ? "\n" : "");
|
|
2138
|
+
}
|
|
2139
|
+
if (name === "printf" && args.length > 0) {
|
|
2140
|
+
const format = decodeAnsiC(args[0]);
|
|
2141
|
+
if (/%(?![s%])/.test(format)) return void 0;
|
|
2142
|
+
const values = args.slice(1);
|
|
2143
|
+
let output = "";
|
|
2144
|
+
let next = 0;
|
|
2145
|
+
do {
|
|
2146
|
+
output += format.replace(/%([s%])/g, (_match, directive) => directive === "%" ? "%" : values[next++] ?? "");
|
|
2147
|
+
} while (format.includes("%s") && next < values.length);
|
|
2148
|
+
return output;
|
|
2149
|
+
}
|
|
2150
|
+
return void 0;
|
|
2151
|
+
}
|
|
2152
|
+
function commandStdin(raw) {
|
|
2153
|
+
const heredoc = raw.heredocs.at(-1);
|
|
2154
|
+
if (heredoc) return heredoc.body;
|
|
2155
|
+
const input = raw.redirects.findLast(({ op }) => op === "<<<" || op === "<" || op === "0<");
|
|
2156
|
+
if (input) return input.op === "<<<" ? `${input.target}
|
|
2157
|
+
` : SHELL_OPAQUE;
|
|
2158
|
+
if (raw.pipeFrom) return staticOutput(stripCommandPrefixes(raw.pipeFrom.words).argv, commandStdin(raw.pipeFrom)) ?? SHELL_OPAQUE;
|
|
2159
|
+
return void 0;
|
|
2160
|
+
}
|
|
2161
|
+
function assign(scope, assignments) {
|
|
2162
|
+
for (const assignment of assignments) {
|
|
2163
|
+
const separator = assignment.indexOf("=");
|
|
2164
|
+
scope.vars.set(assignment.slice(0, separator), assignment.slice(separator + 1));
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
function emit(scope, raw) {
|
|
2168
|
+
const { argv, assignments } = stripCommandPrefixes(raw.words);
|
|
2169
|
+
if (argv.length === 0) {
|
|
2170
|
+
assign(scope, assignments);
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
2173
|
+
const stdin = commandStdin(raw);
|
|
2174
|
+
const output = staticOutput(argv, stdin) ?? SHELL_OPAQUE;
|
|
2175
|
+
const stdinFile = raw.redirects.findLast(({ op }) => op === "<" || op === "0<");
|
|
2176
|
+
const name = argv[0].split("/").pop() ?? "";
|
|
2177
|
+
const flag = SHELLS.has(name) ? argv.findIndex((arg, index) => index > 0 && /^-[A-Za-z]*c[A-Za-z]*$/.test(arg)) : -1;
|
|
2178
|
+
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;
|
|
2179
|
+
const truncated = script !== void 0 && scope.depth >= MAX_DEPTH;
|
|
2180
|
+
scope.commands.push({
|
|
2181
|
+
argv,
|
|
2182
|
+
dir: scope.dir,
|
|
2183
|
+
stdin,
|
|
2184
|
+
afterAnd: raw.afterAnd,
|
|
2185
|
+
stdinFile: stdinFile ? resolveShellPath(scope.dir, stdinFile.target) : null,
|
|
2186
|
+
writes: raw.redirects.flatMap(({ op, target }) => /^(?:1?>|1?>\||1?>>|&>|&>>|>&)$/.test(op) && !/^(?:\d+|-)$/.test(target) ? [{ path: resolveShellPath(scope.dir, target), content: output, append: op.endsWith(">>") }] : []),
|
|
2187
|
+
wrapper: script !== void 0,
|
|
2188
|
+
truncated
|
|
2189
|
+
});
|
|
2190
|
+
if (name === "cd" || name === "pushd" || name === "popd") {
|
|
2191
|
+
scope.dir = name !== "popd" && argv[1] && argv[1] !== "-" ? resolveShellPath(scope.dir, argv[1]) : null;
|
|
2192
|
+
} else if (["export", "declare", "local", "readonly"].includes(name)) {
|
|
2193
|
+
assign(scope, argv.slice(1).filter((arg) => /^[A-Za-z_]\w*=/.test(arg)));
|
|
2194
|
+
}
|
|
2195
|
+
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);
|
|
2196
|
+
}
|
|
2197
|
+
function readHeredocBodies(scope, heredocs, start) {
|
|
2198
|
+
const { src } = scope;
|
|
2199
|
+
let position = start;
|
|
2200
|
+
for (const heredoc of heredocs) {
|
|
2201
|
+
const lines = [];
|
|
2202
|
+
while (position < src.length) {
|
|
2203
|
+
const end = indexOrEnd(src, "\n", position);
|
|
2204
|
+
const line = heredoc.strip ? src.slice(position, end).replace(/^\t+/, "") : src.slice(position, end);
|
|
2205
|
+
position = end + 1;
|
|
2206
|
+
if (line === heredoc.delimiter) break;
|
|
2207
|
+
lines.push(line);
|
|
2208
|
+
}
|
|
2209
|
+
heredoc.body = lines.length > 0 ? `${lines.join("\n")}
|
|
2210
|
+
` : "";
|
|
2211
|
+
if (heredoc.expand) heredoc.body = readDoubleQuoted({ ...scope, src: heredoc.body }, 0, null).value;
|
|
2212
|
+
}
|
|
2213
|
+
return Math.min(position, src.length);
|
|
2214
|
+
}
|
|
2215
|
+
function readDoubleQuoted(scope, start, terminator) {
|
|
2216
|
+
const { src } = scope;
|
|
2217
|
+
let value = "";
|
|
2218
|
+
let i = start;
|
|
2219
|
+
while (i < src.length && src[i] !== terminator) {
|
|
2220
|
+
const c = src[i];
|
|
2221
|
+
if (c === "\\" && i + 1 < src.length) {
|
|
2222
|
+
const next = src[i + 1];
|
|
2223
|
+
if (next === "\n") i += 2;
|
|
2224
|
+
else if ("$`\\".includes(next) || next === terminator) {
|
|
2225
|
+
value += next;
|
|
2226
|
+
i += 2;
|
|
2227
|
+
} else {
|
|
2228
|
+
value += c;
|
|
2229
|
+
i++;
|
|
2230
|
+
}
|
|
2231
|
+
} else if (c === "$" || c === "`") {
|
|
2232
|
+
const expansion = readExpansion(scope, i, true);
|
|
2233
|
+
value += expansion.value;
|
|
2234
|
+
i = expansion.end;
|
|
2235
|
+
} else {
|
|
2236
|
+
value += c;
|
|
2237
|
+
i++;
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
return { value, end: i };
|
|
2241
|
+
}
|
|
2242
|
+
function substitute(scope, src, start, closeParen) {
|
|
2243
|
+
const child = { src, vars: new Map(scope.vars), dir: scope.dir, commands: [], depth: scope.depth + 1 };
|
|
2244
|
+
const end = parseUntil(child, start, closeParen);
|
|
2245
|
+
scope.commands.push(...child.commands);
|
|
2246
|
+
const [only] = child.commands;
|
|
2247
|
+
const output = child.commands.length === 1 ? staticOutput(only.argv, only.stdin) : void 0;
|
|
2248
|
+
return { value: output?.replace(/\n+$/, "") ?? SHELL_OPAQUE, end };
|
|
2249
|
+
}
|
|
2250
|
+
function readExpansion(scope, i, inDouble) {
|
|
2251
|
+
const { src } = scope;
|
|
2252
|
+
if (src[i] === "`") {
|
|
2253
|
+
let inner = "";
|
|
2254
|
+
let j = i + 1;
|
|
2255
|
+
while (j < src.length && src[j] !== "`") {
|
|
2256
|
+
if (src[j] === "\\" && "$`\\".includes(src[j + 1] ?? "")) {
|
|
2257
|
+
inner += src[j + 1];
|
|
2258
|
+
j += 2;
|
|
2259
|
+
} else inner += src[j++];
|
|
2260
|
+
}
|
|
2261
|
+
return { value: substitute(scope, inner, 0, false).value, end: j + 1 };
|
|
2262
|
+
}
|
|
2263
|
+
const next = src[i + 1];
|
|
2264
|
+
if (next === "(") return substitute(scope, src, i + 2, true);
|
|
2265
|
+
if (next === "{") {
|
|
2266
|
+
const end = indexOrEnd(src, "}", i + 2);
|
|
2267
|
+
return { value: scope.vars.get(src.slice(i + 2, end)) ?? SHELL_OPAQUE, end: end + 1 };
|
|
2268
|
+
}
|
|
2269
|
+
if (next === "'" && !inDouble) {
|
|
2270
|
+
let j = i + 2;
|
|
2271
|
+
while (j < src.length && src[j] !== "'") j += src[j] === "\\" ? 2 : 1;
|
|
2272
|
+
return { value: decodeAnsiC(src.slice(i + 2, j)), end: j + 1, quoted: true };
|
|
2273
|
+
}
|
|
2274
|
+
if (next === '"' && !inDouble) {
|
|
2275
|
+
const { value, end } = readDoubleQuoted(scope, i + 2, '"');
|
|
2276
|
+
return { value, end: end + 1, quoted: true };
|
|
2277
|
+
}
|
|
2278
|
+
NAME.lastIndex = i + 1;
|
|
2279
|
+
const name = NAME.exec(src)?.[0];
|
|
2280
|
+
if (name) return { value: scope.vars.get(name) ?? SHELL_OPAQUE, end: i + 1 + name.length };
|
|
2281
|
+
if (next && /[0-9@*#?$!-]/.test(next)) return { value: SHELL_OPAQUE, end: i + 2 };
|
|
2282
|
+
return { value: "$", end: i + 1 };
|
|
2283
|
+
}
|
|
2284
|
+
function parseUntil(scope, start, closeParen) {
|
|
2285
|
+
const { src } = scope;
|
|
2286
|
+
let i = start;
|
|
2287
|
+
let line = [];
|
|
2288
|
+
let current = { words: [], redirects: [], heredocs: [], afterAnd: false };
|
|
2289
|
+
let pendingHeredocs = [];
|
|
2290
|
+
let word = null;
|
|
2291
|
+
let quoted = false;
|
|
2292
|
+
let redirect = null;
|
|
2293
|
+
let parens = 0;
|
|
2294
|
+
const append = (text2, isQuoted = false) => {
|
|
2295
|
+
word = (word ?? "") + text2;
|
|
2296
|
+
quoted ||= isQuoted;
|
|
2297
|
+
};
|
|
2298
|
+
const endWord = () => {
|
|
2299
|
+
if (word === null) return;
|
|
2300
|
+
if (redirect === "<<" || redirect === "<<-") {
|
|
2301
|
+
const heredoc = { strip: redirect === "<<-", delimiter: word, expand: !quoted, body: "" };
|
|
2302
|
+
current.heredocs.push(heredoc);
|
|
2303
|
+
pendingHeredocs.push(heredoc);
|
|
2304
|
+
} else if (redirect) {
|
|
2305
|
+
current.redirects.push({ op: redirect, target: word });
|
|
2306
|
+
} else {
|
|
2307
|
+
current.words.push(word);
|
|
2308
|
+
}
|
|
2309
|
+
word = null;
|
|
2310
|
+
quoted = false;
|
|
2311
|
+
redirect = null;
|
|
2312
|
+
};
|
|
2313
|
+
const endCommand = (op) => {
|
|
2314
|
+
endWord();
|
|
2315
|
+
const done = current;
|
|
2316
|
+
current = { words: [], redirects: [], heredocs: [], pipeFrom: op === "|" || op === "|&" ? done : void 0, afterAnd: op === "&&" };
|
|
2317
|
+
if (done.words.length > 0 || done.redirects.length > 0 || done.heredocs.length > 0) line.push(done);
|
|
2318
|
+
};
|
|
2319
|
+
const flush = () => {
|
|
2320
|
+
endCommand();
|
|
2321
|
+
for (const raw of line) emit(scope, raw);
|
|
2322
|
+
line = [];
|
|
2323
|
+
};
|
|
2324
|
+
while (i < src.length) {
|
|
2325
|
+
const c = src[i];
|
|
2326
|
+
if (c === "\\") {
|
|
2327
|
+
if (src[i + 1] !== "\n") append(src[i + 1] ?? "", true);
|
|
2328
|
+
i += 2;
|
|
2329
|
+
} else if (c === "'") {
|
|
2330
|
+
const end = indexOrEnd(src, "'", i + 1);
|
|
2331
|
+
append(src.slice(i + 1, end), true);
|
|
2332
|
+
i = end + 1;
|
|
2333
|
+
} else if (c === '"') {
|
|
2334
|
+
const { value, end } = readDoubleQuoted(scope, i + 1, '"');
|
|
2335
|
+
append(value, true);
|
|
2336
|
+
i = end + 1;
|
|
2337
|
+
} else if (c === "$" || c === "`") {
|
|
2338
|
+
const expansion = readExpansion(scope, i, false);
|
|
2339
|
+
append(expansion.value, expansion.quoted);
|
|
2340
|
+
i = expansion.end;
|
|
2341
|
+
} else if (c === "#" && word === null) {
|
|
2342
|
+
i = indexOrEnd(src, "\n", i);
|
|
2343
|
+
} else if (c === "\n") {
|
|
2344
|
+
endWord();
|
|
2345
|
+
i = readHeredocBodies(scope, pendingHeredocs, i + 1);
|
|
2346
|
+
pendingHeredocs = [];
|
|
2347
|
+
flush();
|
|
2348
|
+
} else if (c === " " || c === " " || c === "\r") {
|
|
2349
|
+
endWord();
|
|
2350
|
+
i++;
|
|
2351
|
+
} else if (c === ")" && parens === 0 && closeParen) {
|
|
2352
|
+
flush();
|
|
2353
|
+
return i + 1;
|
|
2354
|
+
} else {
|
|
2355
|
+
OPERATOR.lastIndex = i;
|
|
2356
|
+
const op = OPERATOR.exec(src)?.[0];
|
|
2357
|
+
if (!op) {
|
|
2358
|
+
append(c);
|
|
2359
|
+
i++;
|
|
2360
|
+
continue;
|
|
2361
|
+
}
|
|
2362
|
+
const fd = /[<>]/.test(op) && !quoted && /^\d+$/.test(word ?? "") ? word : null;
|
|
2363
|
+
if (fd !== null) word = null;
|
|
2364
|
+
endWord();
|
|
2365
|
+
i += op.length;
|
|
2366
|
+
if (/[<>]/.test(op)) redirect = `${fd ?? ""}${op}`;
|
|
2367
|
+
else {
|
|
2368
|
+
if (op === "(") parens++;
|
|
2369
|
+
if (op === ")") parens = Math.max(0, parens - 1);
|
|
2370
|
+
endCommand(op);
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
flush();
|
|
2375
|
+
return i;
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2065
2378
|
// ../shared/src/display-message/parsers/utils.ts
|
|
2066
2379
|
var INTERRUPTED_MESSAGE_REGEX = /^\[Request interrupted by user.*\]$/;
|
|
2067
2380
|
function userMessageImages(value) {
|
|
@@ -2207,61 +2520,11 @@ ${operation.diff}` : ""}`).join("\n\n");
|
|
|
2207
2520
|
if (message.type === "interruption") return { kind: "error", title: "Agent stopped", summary: "", content: "" };
|
|
2208
2521
|
return { kind: "error", title: "Agent error", summary: "", content: message.message };
|
|
2209
2522
|
}
|
|
2210
|
-
function unquoteShellArg(value) {
|
|
2211
|
-
const trimmed = value.trim();
|
|
2212
|
-
if (trimmed.length < 2) return trimmed;
|
|
2213
|
-
if (trimmed[0] === "'" && trimmed[trimmed.length - 1] === "'") {
|
|
2214
|
-
return trimmed.slice(1, -1).replace(/'\\''/g, "'");
|
|
2215
|
-
}
|
|
2216
|
-
if (trimmed[0] === '"' && trimmed[trimmed.length - 1] === '"') {
|
|
2217
|
-
return trimmed.slice(1, -1).replace(/\\(["\\$`])/g, "$1");
|
|
2218
|
-
}
|
|
2219
|
-
return trimmed;
|
|
2220
|
-
}
|
|
2221
|
-
function shellPayload(command) {
|
|
2222
|
-
const match = command.trim().match(/^(?:\S*\/)?(?:ba|z|c|fi)?sh\s+-(?:[a-zA-Z]*c[a-zA-Z]*|c)\s+([\s\S]+)$/);
|
|
2223
|
-
return match ? unquoteShellArg(match[1]) : command.trim();
|
|
2224
|
-
}
|
|
2225
|
-
function splitShellWords(command) {
|
|
2226
|
-
const words = [];
|
|
2227
|
-
let word = "";
|
|
2228
|
-
let quote = null;
|
|
2229
|
-
let escaped = false;
|
|
2230
|
-
for (const char of command) {
|
|
2231
|
-
if (escaped) {
|
|
2232
|
-
word += char;
|
|
2233
|
-
escaped = false;
|
|
2234
|
-
continue;
|
|
2235
|
-
}
|
|
2236
|
-
if (char === "\\" && quote !== "'") {
|
|
2237
|
-
escaped = true;
|
|
2238
|
-
continue;
|
|
2239
|
-
}
|
|
2240
|
-
if (quote) {
|
|
2241
|
-
if (char === quote) quote = null;
|
|
2242
|
-
else word += char;
|
|
2243
|
-
continue;
|
|
2244
|
-
}
|
|
2245
|
-
if (char === '"' || char === "'") {
|
|
2246
|
-
quote = char;
|
|
2247
|
-
continue;
|
|
2248
|
-
}
|
|
2249
|
-
if (/\s/.test(char)) {
|
|
2250
|
-
if (word) {
|
|
2251
|
-
words.push(word);
|
|
2252
|
-
word = "";
|
|
2253
|
-
}
|
|
2254
|
-
continue;
|
|
2255
|
-
}
|
|
2256
|
-
word += char;
|
|
2257
|
-
}
|
|
2258
|
-
if (word) words.push(word);
|
|
2259
|
-
return words;
|
|
2260
|
-
}
|
|
2261
2523
|
function commandWords(command) {
|
|
2262
|
-
const
|
|
2263
|
-
if (
|
|
2264
|
-
|
|
2524
|
+
const commands = parseShellScript(command, null).filter(({ wrapper }) => !wrapper);
|
|
2525
|
+
if (commands.length !== 1) return null;
|
|
2526
|
+
const [{ argv, stdin, stdinFile, writes }] = commands;
|
|
2527
|
+
return stdin === void 0 && !stdinFile && writes.length === 0 ? argv.map((word) => word.replaceAll(SHELL_OPAQUE, "\u2026")) : null;
|
|
2265
2528
|
}
|
|
2266
2529
|
function skillNamesFromCommand(command) {
|
|
2267
2530
|
const words = commandWords(command);
|
|
@@ -7066,6 +7329,120 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
|
|
|
7066
7329
|
};
|
|
7067
7330
|
|
|
7068
7331
|
// ../shared/src/routes/command-protection.ts
|
|
7332
|
+
import { z as z10 } from "zod";
|
|
7333
|
+
|
|
7334
|
+
// ../shared/src/git-invocations.ts
|
|
7335
|
+
var COMMIT_VALUE_OPTIONS = /* @__PURE__ */ new Set(["message", "file", "trailer", "reuse-message", "reedit-message", "fixup", "squash", "template", "author", "date", "cleanup", "pathspec-from-file"]);
|
|
7336
|
+
function findGitInvocations(commands) {
|
|
7337
|
+
return commands.flatMap((command) => {
|
|
7338
|
+
const { argv } = command;
|
|
7339
|
+
if (argv[0].split("/").pop() !== "git") return [];
|
|
7340
|
+
let dir = command.dir;
|
|
7341
|
+
let index = 1;
|
|
7342
|
+
for (; argv[index]?.startsWith("-"); index++) {
|
|
7343
|
+
if (argv[index] === "-C" && argv[index + 1]) dir = resolveShellPath(dir, argv[index + 1]);
|
|
7344
|
+
if (/^--(?:git-dir|work-tree)\b/.test(argv[index])) dir = null;
|
|
7345
|
+
if (["-C", "-c", "--git-dir", "--work-tree", "--namespace"].includes(argv[index])) index++;
|
|
7346
|
+
}
|
|
7347
|
+
return argv[index] ? [{ dir, subcommand: argv[index], args: argv.slice(index + 1), command }] : [];
|
|
7348
|
+
});
|
|
7349
|
+
}
|
|
7350
|
+
function parseCommitArgs(args) {
|
|
7351
|
+
const messages = [];
|
|
7352
|
+
const trailers = [];
|
|
7353
|
+
let file;
|
|
7354
|
+
let reuse = false;
|
|
7355
|
+
let amend = false;
|
|
7356
|
+
for (let index = 0; index < args.length && args[index] !== "--"; index++) {
|
|
7357
|
+
const arg = args[index];
|
|
7358
|
+
const long = /^--([\w-]+)(?:=([\s\S]*))?$/.exec(arg);
|
|
7359
|
+
if (long) {
|
|
7360
|
+
const [, name, inline] = long;
|
|
7361
|
+
if (name === "amend") amend = true;
|
|
7362
|
+
if (!COMMIT_VALUE_OPTIONS.has(name)) continue;
|
|
7363
|
+
const value = inline ?? args[++index] ?? "";
|
|
7364
|
+
if (name === "message") messages.push(value);
|
|
7365
|
+
else if (name === "file") file = value;
|
|
7366
|
+
else if (name === "trailer") trailers.push(value);
|
|
7367
|
+
else if (["reuse-message", "reedit-message", "fixup", "squash"].includes(name)) reuse = true;
|
|
7368
|
+
continue;
|
|
7369
|
+
}
|
|
7370
|
+
if (!/^-[^-]/.test(arg)) continue;
|
|
7371
|
+
for (let position = 1; position < arg.length && !"Su".includes(arg[position]); position++) {
|
|
7372
|
+
const flag = arg[position];
|
|
7373
|
+
if (!"mFCct".includes(flag)) continue;
|
|
7374
|
+
const value = arg.slice(position + 1) || (args[++index] ?? "");
|
|
7375
|
+
if (flag === "m") messages.push(value);
|
|
7376
|
+
else if (flag === "F") file = value;
|
|
7377
|
+
else if (flag !== "t") reuse = true;
|
|
7378
|
+
break;
|
|
7379
|
+
}
|
|
7380
|
+
}
|
|
7381
|
+
return { messages, trailers, file, reuse, amend };
|
|
7382
|
+
}
|
|
7383
|
+
function parsePushArgs(args) {
|
|
7384
|
+
const positionals = [];
|
|
7385
|
+
const options = [];
|
|
7386
|
+
let all = false;
|
|
7387
|
+
let tags = false;
|
|
7388
|
+
let repo = false;
|
|
7389
|
+
for (let index = 0; index < args.length; index++) {
|
|
7390
|
+
const arg = args[index];
|
|
7391
|
+
const long = /^--([\w-]+)(?:=([\s\S]*))?$/.exec(arg);
|
|
7392
|
+
if (arg === "--") {
|
|
7393
|
+
positionals.push(...args.slice(index + 1));
|
|
7394
|
+
break;
|
|
7395
|
+
} else if (long) {
|
|
7396
|
+
const [, name, inline] = long;
|
|
7397
|
+
all ||= ["all", "mirror", "branches"].includes(name);
|
|
7398
|
+
tags ||= name === "tags";
|
|
7399
|
+
repo ||= name === "repo";
|
|
7400
|
+
if (["repo", "push-option", "receive-pack", "exec"].includes(name)) {
|
|
7401
|
+
const value = inline ?? args[++index] ?? "";
|
|
7402
|
+
if (name === "push-option") options.push(value);
|
|
7403
|
+
}
|
|
7404
|
+
} else if (/^-[^-]/.test(arg)) {
|
|
7405
|
+
const option = arg.indexOf("o");
|
|
7406
|
+
if (option > 0) options.push(arg.slice(option + 1) || (args[++index] ?? ""));
|
|
7407
|
+
} else {
|
|
7408
|
+
positionals.push(arg);
|
|
7409
|
+
}
|
|
7410
|
+
}
|
|
7411
|
+
return { refspecs: repo ? positionals : positionals.slice(1), options, all, tags };
|
|
7412
|
+
}
|
|
7413
|
+
function findCheckoutTarget(args) {
|
|
7414
|
+
if (args.includes("--")) return void 0;
|
|
7415
|
+
const create = args.findIndex((arg) => /^(?:-[bBcC]|--orphan)$/.test(arg));
|
|
7416
|
+
if (create >= 0) return { branch: args[create + 1] ?? null, certain: true };
|
|
7417
|
+
if (args.some((arg) => arg === "-" || arg === "--detach" || arg === "-d")) return { branch: null, certain: true };
|
|
7418
|
+
const positional = args.find((arg) => !arg.startsWith("-"));
|
|
7419
|
+
return positional === void 0 ? void 0 : { branch: positional, certain: false };
|
|
7420
|
+
}
|
|
7421
|
+
|
|
7422
|
+
// ../shared/src/routes/command-protection.ts
|
|
7423
|
+
var commandProtectionRepoStateSchema = z10.object({
|
|
7424
|
+
branch: z10.string().nullable(),
|
|
7425
|
+
defaultBranch: z10.string().nullable(),
|
|
7426
|
+
pushBranch: z10.string().nullable(),
|
|
7427
|
+
pushConfig: z10.string().nullable(),
|
|
7428
|
+
headMessage: z10.string().nullable(),
|
|
7429
|
+
mergeInProgress: z10.boolean().optional()
|
|
7430
|
+
});
|
|
7431
|
+
var commandProtectionEvaluateRequestSchema = z10.object({
|
|
7432
|
+
provider: z10.enum(["claude", "codex", "cursor", "opencode", "pi"]),
|
|
7433
|
+
source: z10.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
|
|
7434
|
+
toolName: z10.string(),
|
|
7435
|
+
toolInput: z10.unknown(),
|
|
7436
|
+
command: z10.string().nullish(),
|
|
7437
|
+
cwd: z10.string().nullish(),
|
|
7438
|
+
toolUseId: z10.string().nullish(),
|
|
7439
|
+
// Read by the engine before the command runs, keyed by absolute path, so the
|
|
7440
|
+
// policy can see branches and commit messages the command text only references.
|
|
7441
|
+
gitContext: z10.object({
|
|
7442
|
+
repos: z10.record(z10.string(), commandProtectionRepoStateSchema),
|
|
7443
|
+
messageFiles: z10.record(z10.string(), z10.string())
|
|
7444
|
+
}).optional()
|
|
7445
|
+
});
|
|
7069
7446
|
var COMMAND_PROTECTION_COMMAND_KEYS = ["command", "cmd", "script", "query", "endpoint", "path", "url", "mutation"];
|
|
7070
7447
|
function stringifyCommandProtectionInput(value) {
|
|
7071
7448
|
if (typeof value === "string") return value;
|
|
@@ -7096,41 +7473,152 @@ function extractCommandProtectionCommandText(request, options = {}) {
|
|
|
7096
7473
|
if (typeof input === "string") return input;
|
|
7097
7474
|
return options.stringifyFallback ? stringifyCommandProtectionInput(input) : null;
|
|
7098
7475
|
}
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
]
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7476
|
+
var PROTECTED_BRANCH = /^(?:main|master|trunk|develop)$/;
|
|
7477
|
+
var AUTO_MERGE_PUSH_OPTION = /merge_when_pipeline_succeeds|auto_merge/i;
|
|
7478
|
+
var CONFIGURED_AUTO_MERGE_PUSH_OPTION = /^push\.pushoption[ =].*(?:merge_when_pipeline_succeeds|auto_merge)/im;
|
|
7479
|
+
var MERGE_SIGNAL_CHECKS = [
|
|
7480
|
+
["gh-pr-merge", /\bgh\s+pr\s+merge\b/],
|
|
7481
|
+
["glab-mr-merge", /\bglab\s+mr\s+merge\b/],
|
|
7482
|
+
["gh-api-pulls-merge", /\bgh\s+api\b[\s\S]*\/pulls\/(?:\d+|[^/\s]+)\/merge\b/],
|
|
7483
|
+
["github-rest-pulls-merge", /api\.github\.com\/repos\/[^/\s]+\/[^/\s]+\/pulls\/(?:\d+|[^/\s]+)\/merge\b/],
|
|
7484
|
+
["gitlab-rest-mr-merge", /\/projects\/[^/\s]+\/merge_requests\/(?:\d+|[^/\s]+)\/merge\b/],
|
|
7485
|
+
["gitlab-rest-mr-merge-query", /\/projects\/[^/\s]+\/merge_requests\/(?:\d+|[^/\s]+)\b[\s\S]*\bmerge_when_pipeline_succeeds\b/],
|
|
7486
|
+
["github-rest-ref-update", /\b(?:gh\s+api|curl|wget|python3?)\b[\s\S]*(?:\/repos\/|repos\/)[^/\s]+\/[^/\s]+\/git\/refs\/heads\/(?:main|master|trunk|develop)\b[\s\S]*\b(?:patch|put|sha|oid|force)\b/],
|
|
7487
|
+
["github-graphql-merge-pr", /\bmergepullrequest\b/],
|
|
7488
|
+
["github-graphql-enable-auto-merge", /\benablepullrequestautomerge\b/],
|
|
7489
|
+
["github-graphql-update-ref", /\bupdateref\b/],
|
|
7490
|
+
["hub-merge", /\bhub\s+merge\b/],
|
|
7491
|
+
["obfuscated-gh-pr-merge", /printf\s+['"]?\\x67\\x68['"]?[\s\S]*\bpr\b[\s\S]*printf\s+['"]?m\\x65rge['"]?/],
|
|
7492
|
+
["mcp-merge-tool", /\bmcp__[^\s"]*merge[^\s"]*\b/]
|
|
7493
|
+
];
|
|
7494
|
+
var BROAD_MERGE_SIGNAL_CHECKS = [
|
|
7495
|
+
["git-push-default-branch-text", /\bgit\s+push\b[^;&|\n]*?\s(?:\S+:)?(?:refs\/heads\/)?(?:main|master|trunk|develop)\b/],
|
|
7496
|
+
["tool-merge-name", /\b(pr|pull[_-]?request|mr|merge[_-]?request).{0,40}\bmerge\b|\bmerge.{0,40}(pr|pull[_-]?request|mr|merge[_-]?request)\b/],
|
|
7497
|
+
["merge-word", /(?:^|[^a-z0-9])merge(?:$|[^a-z0-9])/]
|
|
7498
|
+
];
|
|
7499
|
+
function shellScript(input) {
|
|
7500
|
+
if (typeof input === "string") return input;
|
|
7501
|
+
if (!isRecord(input)) return null;
|
|
7502
|
+
for (const key of ["command", "cmd", "script"]) {
|
|
7503
|
+
const value = input[key];
|
|
7504
|
+
if (typeof value === "string") return value;
|
|
7505
|
+
if (Array.isArray(value) && value.every((item) => typeof item === "string")) return value.map(shellQuotePosix).join(" ");
|
|
7506
|
+
}
|
|
7507
|
+
return isRecord(input.args) ? shellScript(input.args) : null;
|
|
7508
|
+
}
|
|
7509
|
+
function workingDirectory({ toolInput, cwd }) {
|
|
7510
|
+
const input = isRecord(toolInput) ? toolInput : {};
|
|
7511
|
+
const dir = [input.workdir, input.cwd].find((value) => typeof value === "string" && value.trim() !== "");
|
|
7512
|
+
return dir ? resolveShellPath(cwd || null, dir) : cwd || null;
|
|
7513
|
+
}
|
|
7514
|
+
function parseCommandProtectionRequest(request) {
|
|
7515
|
+
const script = shellScript(request.toolInput);
|
|
7516
|
+
const dir = workingDirectory(request);
|
|
7517
|
+
const commands = script === null ? [] : parseShellScript(script, dir);
|
|
7518
|
+
return { request, script, workingDirectory: dir, commands, invocations: findGitInvocations(commands), truncated: commands.some(({ truncated }) => truncated) };
|
|
7519
|
+
}
|
|
7520
|
+
var isProtectedBranch = (branch, repo) => branch === repo?.defaultBranch || PROTECTED_BRANCH.test(branch);
|
|
7521
|
+
function trackCheckedOutBranches(commands, invocations, context) {
|
|
7522
|
+
const switches = /* @__PURE__ */ new Map();
|
|
7523
|
+
return invocations.map(({ dir, subcommand, args, command }) => {
|
|
7524
|
+
const repo = dir === null ? void 0 : context?.repos[dir];
|
|
7525
|
+
const index = commands.indexOf(command);
|
|
7526
|
+
const last = switches.get(dir);
|
|
7527
|
+
const mayStayOnBefore = last !== void 0 && !commands.slice(last.index + 1, index + 1).every(({ afterAnd }) => afterAnd);
|
|
7528
|
+
const branch = last === void 0 ? repo?.branch ?? null : mayStayOnBefore && (last.before === null || isProtectedBranch(last.before, repo)) ? null : last.branch;
|
|
7529
|
+
const target = subcommand === "checkout" || subcommand === "switch" ? findCheckoutTarget(args) : void 0;
|
|
7530
|
+
if (target) {
|
|
7531
|
+
const trusted = target.certain || isProtectedBranch(target.branch ?? "", repo) || branch !== null && !isProtectedBranch(branch, repo);
|
|
7532
|
+
switches.set(dir, { branch: trusted ? target.branch : null, before: branch, index });
|
|
7533
|
+
}
|
|
7534
|
+
return { branch, switched: last !== void 0 };
|
|
7535
|
+
});
|
|
7130
7536
|
}
|
|
7131
|
-
function
|
|
7132
|
-
const
|
|
7133
|
-
|
|
7537
|
+
function refspecDestination(refspec, current) {
|
|
7538
|
+
const spec = refspec.replace(/^\+/, "");
|
|
7539
|
+
const destination = spec.slice(spec.indexOf(":") + 1);
|
|
7540
|
+
if (destination === "" || destination.includes("*")) return "*";
|
|
7541
|
+
if (destination.includes(SHELL_OPAQUE)) return null;
|
|
7542
|
+
if (destination === "HEAD" || destination === "@") return current;
|
|
7543
|
+
return destination.startsWith("refs/tags/") ? void 0 : destination.replace(/^refs\/heads\//, "");
|
|
7544
|
+
}
|
|
7545
|
+
function findPushSignals({ commands, invocations, truncated }, context) {
|
|
7546
|
+
const branches = trackCheckedOutBranches(commands, invocations, context);
|
|
7547
|
+
const signals = invocations.flatMap(({ dir, subcommand, args, command }, index) => {
|
|
7548
|
+
if (subcommand === "config") {
|
|
7549
|
+
return args.some((arg) => /^push\.pushoption$/i.test(arg)) && args.some((arg) => AUTO_MERGE_PUSH_OPTION.test(arg)) ? ["git-push-auto-merge"] : [];
|
|
7550
|
+
}
|
|
7551
|
+
if (subcommand !== "push") return [];
|
|
7552
|
+
const repo = dir === null ? void 0 : context?.repos[dir];
|
|
7553
|
+
const { branch, switched } = branches[index];
|
|
7554
|
+
const { refspecs, options, all, tags } = parsePushArgs(args);
|
|
7555
|
+
const pushSignals = [];
|
|
7556
|
+
if (all) pushSignals.push("git-push-all");
|
|
7557
|
+
if (options.some((option) => AUTO_MERGE_PUSH_OPTION.test(option)) || CONFIGURED_AUTO_MERGE_PUSH_OPTION.test([repo?.pushConfig ?? "", ...command.argv].join("\n"))) {
|
|
7558
|
+
pushSignals.push("git-push-auto-merge");
|
|
7559
|
+
}
|
|
7560
|
+
const bareDestination = /^remote\..+\.push |^push\.default matching$/m.test(repo?.pushConfig ?? "") ? null : switched ? branch : repo?.pushBranch ?? branch;
|
|
7561
|
+
const destinations = refspecs.length > 0 ? refspecs.map((refspec) => refspecDestination(refspec, branch)) : all || tags ? [] : [bareDestination];
|
|
7562
|
+
for (const destination of destinations) {
|
|
7563
|
+
if (destination === "*") pushSignals.push("git-push-all");
|
|
7564
|
+
else if (destination === null) pushSignals.push("git-push-unknown-destination");
|
|
7565
|
+
else if (destination !== void 0 && isProtectedBranch(destination, repo)) pushSignals.push("git-push-default-branch");
|
|
7566
|
+
}
|
|
7567
|
+
return pushSignals;
|
|
7568
|
+
});
|
|
7569
|
+
return truncated ? [...signals, "git-push-unknown-destination"] : signals;
|
|
7570
|
+
}
|
|
7571
|
+
function isPrMergeCommand(argv) {
|
|
7572
|
+
const name = argv[0].split("/").pop();
|
|
7573
|
+
if (name !== "gh" && name !== "glab") return false;
|
|
7574
|
+
const args = argv.slice(1);
|
|
7575
|
+
if (args.includes("--help") || args.includes("-h")) return false;
|
|
7576
|
+
const words = args.filter((arg, index) => !arg.startsWith("-") && !/^(?:-R|--repo)$/.test(args[index - 1] ?? ""));
|
|
7577
|
+
if (words[0] === (name === "gh" ? "pr" : "mr") && words[1] === "merge") return true;
|
|
7578
|
+
const method = /(?:^|\s)(?:-X\s*|--method[\s=])(\w+)/i.exec(args.join(" "))?.[1];
|
|
7579
|
+
return words[0] === "api" && method?.toUpperCase() === "PUT" && words.some((word) => /\/(?:pulls|merge_requests)\/[^/]+\/merge$/.test(word));
|
|
7580
|
+
}
|
|
7581
|
+
var matchingChecks = (checks, text2) => checks.flatMap(([name, pattern]) => pattern.test(text2) ? [name] : []);
|
|
7582
|
+
function executedText(commands, keepWord = () => true) {
|
|
7583
|
+
return commands.filter(({ argv, wrapper, truncated }) => (!wrapper || truncated) && argv[0].split("/").pop() !== "git").map(({ argv, stdin }) => normalizeCommandProtectionText([...argv.filter(keepWord), stdin ?? ""].join(" ").replaceAll(SHELL_OPAQUE, " "))).join("\n");
|
|
7584
|
+
}
|
|
7585
|
+
function findShellMergeSignals(parsed, context) {
|
|
7586
|
+
const actions = parsed.commands.filter(({ argv }) => !["cd", "pushd"].includes(argv[0].split("/").pop() ?? ""));
|
|
7587
|
+
return [.../* @__PURE__ */ new Set([
|
|
7588
|
+
...matchingChecks(MERGE_SIGNAL_CHECKS, executedText(parsed.commands)),
|
|
7589
|
+
...matchingChecks(BROAD_MERGE_SIGNAL_CHECKS, executedText(actions, (word) => !word.includes("/"))),
|
|
7590
|
+
...parsed.commands.some(({ argv }) => isPrMergeCommand(argv)) ? ["pr-merge-command"] : [],
|
|
7591
|
+
...findPushSignals(parsed, context)
|
|
7592
|
+
])];
|
|
7593
|
+
}
|
|
7594
|
+
function findToolMergeSignals({ toolName, toolInput }) {
|
|
7595
|
+
if (/^(?:read|write|edit|multi_?edit|patch|apply_?patch|glob|grep|ls|list|notebook_?edit)$/i.test(toolName)) return [];
|
|
7596
|
+
const checks = [...MERGE_SIGNAL_CHECKS, ...BROAD_MERGE_SIGNAL_CHECKS];
|
|
7597
|
+
return [.../* @__PURE__ */ new Set([...matchingChecks(checks, toolName.toLowerCase()), ...matchingChecks(checks, normalizeCommandProtectionText(stringifyCommandProtectionInput(toolInput)))])].sort((a, b) => checks.findIndex(([name]) => name === a) - checks.findIndex(([name]) => name === b));
|
|
7598
|
+
}
|
|
7599
|
+
var DEFINITE_MERGE_REASONS = {
|
|
7600
|
+
"git-push-default-branch": "The command pushes to the default branch.",
|
|
7601
|
+
"git-push-auto-merge": "The command enables auto-merge through a git push option.",
|
|
7602
|
+
"pr-merge-command": "The command merges a pull request or merge request."
|
|
7603
|
+
};
|
|
7604
|
+
function findPrMergeSignals(parsed, context) {
|
|
7605
|
+
const signals = parsed.script === null ? findToolMergeSignals(parsed.request) : findShellMergeSignals(parsed, context);
|
|
7606
|
+
return { signals, definiteReasons: signals.flatMap((signal) => DEFINITE_MERGE_REASONS[signal] ?? []) };
|
|
7607
|
+
}
|
|
7608
|
+
function findGitCommitSignals({ invocations, truncated }) {
|
|
7609
|
+
return truncated || invocations.some(({ subcommand }) => subcommand === "commit") ? ["git-commit"] : [];
|
|
7610
|
+
}
|
|
7611
|
+
function findCommandProtectionGitLookups({ invocations }) {
|
|
7612
|
+
const writes = invocations.filter(({ subcommand }) => subcommand === "commit" || subcommand === "push");
|
|
7613
|
+
const messageFiles = writes.flatMap(({ subcommand, args, dir, command }) => {
|
|
7614
|
+
const { file } = subcommand === "commit" ? parseCommitArgs(args) : { file: void 0 };
|
|
7615
|
+
const path = file === "-" ? command.stdinFile : file === void 0 ? null : resolveShellPath(dir, file);
|
|
7616
|
+
return path ? [path] : [];
|
|
7617
|
+
});
|
|
7618
|
+
return {
|
|
7619
|
+
repoDirs: [...new Set(writes.flatMap(({ dir }) => dir === null ? [] : [dir]))],
|
|
7620
|
+
messageFiles: [...new Set(messageFiles)]
|
|
7621
|
+
};
|
|
7134
7622
|
}
|
|
7135
7623
|
function shouldRefreshPullRequests(toolName, toolInput) {
|
|
7136
7624
|
const name = toolName.toLowerCase();
|
|
@@ -7149,38 +7637,38 @@ function shouldRefreshPullRequests(toolName, toolInput) {
|
|
|
7149
7637
|
}
|
|
7150
7638
|
|
|
7151
7639
|
// ../shared/src/routes/linear.ts
|
|
7152
|
-
import { z as
|
|
7153
|
-
var linearSessionMetadataSchema =
|
|
7154
|
-
via_mothership:
|
|
7155
|
-
issue_id:
|
|
7156
|
-
issue_identifier:
|
|
7157
|
-
issue_title:
|
|
7158
|
-
issue_description:
|
|
7159
|
-
issue_url:
|
|
7160
|
-
comment_id:
|
|
7161
|
-
comment_body:
|
|
7162
|
-
triggered_by_id:
|
|
7163
|
-
triggered_by_name:
|
|
7164
|
-
triggered_by_email:
|
|
7165
|
-
linear_workspace_id:
|
|
7166
|
-
creator_id:
|
|
7167
|
-
creator_name:
|
|
7168
|
-
creator_email:
|
|
7169
|
-
assignee_id:
|
|
7170
|
-
assignee_name:
|
|
7171
|
-
assignee_email:
|
|
7172
|
-
issue_state:
|
|
7173
|
-
parent_issue:
|
|
7174
|
-
id:
|
|
7175
|
-
identifier:
|
|
7176
|
-
title:
|
|
7177
|
-
description:
|
|
7640
|
+
import { z as z11 } from "zod";
|
|
7641
|
+
var linearSessionMetadataSchema = z11.object({
|
|
7642
|
+
via_mothership: z11.boolean().optional(),
|
|
7643
|
+
issue_id: z11.string(),
|
|
7644
|
+
issue_identifier: z11.string(),
|
|
7645
|
+
issue_title: z11.string(),
|
|
7646
|
+
issue_description: z11.string(),
|
|
7647
|
+
issue_url: z11.string(),
|
|
7648
|
+
comment_id: z11.string(),
|
|
7649
|
+
comment_body: z11.string(),
|
|
7650
|
+
triggered_by_id: z11.string().optional(),
|
|
7651
|
+
triggered_by_name: z11.string().optional(),
|
|
7652
|
+
triggered_by_email: z11.string().optional(),
|
|
7653
|
+
linear_workspace_id: z11.string().optional(),
|
|
7654
|
+
creator_id: z11.string().optional(),
|
|
7655
|
+
creator_name: z11.string().optional(),
|
|
7656
|
+
creator_email: z11.string().optional(),
|
|
7657
|
+
assignee_id: z11.string().optional(),
|
|
7658
|
+
assignee_name: z11.string().optional(),
|
|
7659
|
+
assignee_email: z11.string().optional(),
|
|
7660
|
+
issue_state: z11.string().optional(),
|
|
7661
|
+
parent_issue: z11.object({
|
|
7662
|
+
id: z11.string(),
|
|
7663
|
+
identifier: z11.string(),
|
|
7664
|
+
title: z11.string(),
|
|
7665
|
+
description: z11.string().nullable()
|
|
7178
7666
|
}).optional(),
|
|
7179
|
-
workspace:
|
|
7180
|
-
id:
|
|
7181
|
-
coding_agent:
|
|
7182
|
-
task_description:
|
|
7183
|
-
created_at:
|
|
7667
|
+
workspace: z11.object({
|
|
7668
|
+
id: z11.string(),
|
|
7669
|
+
coding_agent: z11.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
|
|
7670
|
+
task_description: z11.string(),
|
|
7671
|
+
created_at: z11.string()
|
|
7184
7672
|
}).optional()
|
|
7185
7673
|
});
|
|
7186
7674
|
|
|
@@ -7515,46 +8003,46 @@ var DEFAULT_WORKSPACE_FILTERS = {
|
|
|
7515
8003
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
7516
8004
|
|
|
7517
8005
|
// ../shared/src/routes/workspace-events.ts
|
|
7518
|
-
import { z as
|
|
7519
|
-
var workspaceChangedEventSchema =
|
|
7520
|
-
|
|
7521
|
-
type:
|
|
7522
|
-
workspaceId:
|
|
7523
|
-
completion:
|
|
7524
|
-
workspaceName:
|
|
7525
|
-
completedAt:
|
|
7526
|
-
processing:
|
|
8006
|
+
import { z as z12 } from "zod";
|
|
8007
|
+
var workspaceChangedEventSchema = z12.discriminatedUnion("type", [
|
|
8008
|
+
z12.object({
|
|
8009
|
+
type: z12.literal("workspace.changed"),
|
|
8010
|
+
workspaceId: z12.string(),
|
|
8011
|
+
completion: z12.object({
|
|
8012
|
+
workspaceName: z12.string(),
|
|
8013
|
+
completedAt: z12.string(),
|
|
8014
|
+
processing: z12.boolean().optional()
|
|
7527
8015
|
}).optional(),
|
|
7528
|
-
ts:
|
|
8016
|
+
ts: z12.string()
|
|
7529
8017
|
}),
|
|
7530
|
-
|
|
7531
|
-
type:
|
|
7532
|
-
workspaceId:
|
|
7533
|
-
chatId:
|
|
7534
|
-
ts:
|
|
8018
|
+
z12.object({
|
|
8019
|
+
type: z12.literal("workspace.chat.changed"),
|
|
8020
|
+
workspaceId: z12.string(),
|
|
8021
|
+
chatId: z12.string(),
|
|
8022
|
+
ts: z12.string()
|
|
7535
8023
|
}),
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
type:
|
|
7539
|
-
workspaceId:
|
|
7540
|
-
ts:
|
|
8024
|
+
z12.object({ type: z12.literal("presence.changed"), ts: z12.string() }),
|
|
8025
|
+
z12.object({
|
|
8026
|
+
type: z12.literal("mobile-testing.changed"),
|
|
8027
|
+
workspaceId: z12.string(),
|
|
8028
|
+
ts: z12.string()
|
|
7541
8029
|
})
|
|
7542
8030
|
]);
|
|
7543
8031
|
|
|
7544
8032
|
// ../shared/src/routes/presence.ts
|
|
7545
|
-
import { z as
|
|
7546
|
-
var presenceStatusSchema =
|
|
7547
|
-
var presenceLocationSchema =
|
|
7548
|
-
environmentId:
|
|
7549
|
-
workspaceId:
|
|
8033
|
+
import { z as z13 } from "zod";
|
|
8034
|
+
var presenceStatusSchema = z13.enum(["online", "typing"]);
|
|
8035
|
+
var presenceLocationSchema = z13.object({
|
|
8036
|
+
environmentId: z13.string().optional(),
|
|
8037
|
+
workspaceId: z13.string().optional()
|
|
7550
8038
|
});
|
|
7551
|
-
var presenceEntrySchema =
|
|
7552
|
-
userId:
|
|
8039
|
+
var presenceEntrySchema = z13.object({
|
|
8040
|
+
userId: z13.string(),
|
|
7553
8041
|
status: presenceStatusSchema,
|
|
7554
8042
|
location: presenceLocationSchema,
|
|
7555
|
-
ts:
|
|
8043
|
+
ts: z13.string()
|
|
7556
8044
|
});
|
|
7557
|
-
var updatePresenceRequestSchema =
|
|
8045
|
+
var updatePresenceRequestSchema = z13.object({
|
|
7558
8046
|
status: presenceStatusSchema,
|
|
7559
8047
|
location: presenceLocationSchema.optional()
|
|
7560
8048
|
});
|
|
@@ -7898,7 +8386,7 @@ function isSkillRegistryManifest(value) {
|
|
|
7898
8386
|
}
|
|
7899
8387
|
|
|
7900
8388
|
// ../shared/src/routes/environment-setups.ts
|
|
7901
|
-
import { z as
|
|
8389
|
+
import { z as z14 } from "zod";
|
|
7902
8390
|
var ENVIRONMENT_SETUP_STEPS = [
|
|
7903
8391
|
{ key: "understand", label: "Understand the codebase" },
|
|
7904
8392
|
{ key: "install", label: "Install dependencies and run the app" },
|
|
@@ -7932,27 +8420,27 @@ var ENVIRONMENT_SETUP_LIMITS = {
|
|
|
7932
8420
|
};
|
|
7933
8421
|
var ENVIRONMENT_SETUP_VARIABLE_WAIT = { defaultMs: 5 * 6e4, maxMs: 15 * 6e4, pollMs: 5e3 };
|
|
7934
8422
|
var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
7935
|
-
var text = (max) => max === void 0 ?
|
|
8423
|
+
var text = (max) => max === void 0 ? z14.string().trim() : z14.string().trim().max(max);
|
|
7936
8424
|
var requiredText = (max) => text(max).min(1, "must not be empty");
|
|
7937
8425
|
var optionalText = (max) => text(max).nullish().transform((value) => value || null);
|
|
7938
8426
|
var clearableText = (max) => text(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
|
|
7939
|
-
var list = (item, max) => max === void 0 ?
|
|
8427
|
+
var list = (item, max) => max === void 0 ? z14.array(item) : z14.array(item).max(max);
|
|
7940
8428
|
var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
|
|
7941
8429
|
function isEnvironmentSetupAuthoredTriggerType(type) {
|
|
7942
8430
|
return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
|
|
7943
8431
|
}
|
|
7944
|
-
var repositoryTriggerConfigSchema =
|
|
7945
|
-
event:
|
|
7946
|
-
repository_ids:
|
|
7947
|
-
group_pr_events:
|
|
7948
|
-
excluded_actors:
|
|
8432
|
+
var repositoryTriggerConfigSchema = z14.object({
|
|
8433
|
+
event: z14.string(),
|
|
8434
|
+
repository_ids: z14.array(z14.string().regex(UUID_RE, "must be a repository id")).optional(),
|
|
8435
|
+
group_pr_events: z14.boolean().optional(),
|
|
8436
|
+
excluded_actors: z14.array(z14.string()).optional()
|
|
7949
8437
|
});
|
|
7950
|
-
var proposalTriggerSchema =
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
8438
|
+
var proposalTriggerSchema = z14.discriminatedUnion("type", [
|
|
8439
|
+
z14.object({ type: z14.literal("cron"), config: z14.object({ schedule: z14.string(), timezone: z14.string().optional() }) }),
|
|
8440
|
+
z14.object({ type: z14.literal("github"), config: repositoryTriggerConfigSchema }),
|
|
8441
|
+
z14.object({ type: z14.literal("gitlab"), config: repositoryTriggerConfigSchema })
|
|
7954
8442
|
]);
|
|
7955
|
-
var existingTriggerSchema =
|
|
8443
|
+
var existingTriggerSchema = z14.custom(
|
|
7956
8444
|
(value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
|
|
7957
8445
|
"must be an automation trigger"
|
|
7958
8446
|
);
|
|
@@ -7960,17 +8448,17 @@ var carriedTriggerSchema = existingTriggerSchema.refine(
|
|
|
7960
8448
|
(trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
|
|
7961
8449
|
);
|
|
7962
8450
|
function automationSchema(limits) {
|
|
7963
|
-
const authored =
|
|
8451
|
+
const authored = z14.object({
|
|
7964
8452
|
name: text(limits.nameChars),
|
|
7965
8453
|
description: text(limits.descriptionChars),
|
|
7966
8454
|
prompt: text(limits.automationPromptChars),
|
|
7967
8455
|
triggers: list(proposalTriggerSchema, limits.automationTriggers)
|
|
7968
8456
|
});
|
|
7969
|
-
const updated = authored.extend({ triggers: list(
|
|
7970
|
-
return
|
|
8457
|
+
const updated = authored.extend({ triggers: list(z14.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
|
|
8458
|
+
return z14.object({
|
|
7971
8459
|
key: requiredText(limits.automationKeyChars),
|
|
7972
|
-
action:
|
|
7973
|
-
automation_id:
|
|
8460
|
+
action: z14.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
|
|
8461
|
+
automation_id: z14.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
|
|
7974
8462
|
name: text().default(""),
|
|
7975
8463
|
description: optionalText().transform((value) => value ?? ""),
|
|
7976
8464
|
prompt: text().default(""),
|
|
@@ -7993,7 +8481,7 @@ function automationSchema(limits) {
|
|
|
7993
8481
|
const content = (automation.action === "update" ? updated : authored).safeParse(automation);
|
|
7994
8482
|
if (content.success) return { ...automation, ...content.data };
|
|
7995
8483
|
for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
|
|
7996
|
-
return
|
|
8484
|
+
return z14.NEVER;
|
|
7997
8485
|
});
|
|
7998
8486
|
}
|
|
7999
8487
|
function automationListSchema(limits) {
|
|
@@ -8011,7 +8499,7 @@ function automationListSchema(limits) {
|
|
|
8011
8499
|
});
|
|
8012
8500
|
}
|
|
8013
8501
|
function environmentSchema(limits) {
|
|
8014
|
-
return
|
|
8502
|
+
return z14.object({
|
|
8015
8503
|
name: optionalText(limits.nameChars).transform((value) => value ?? void 0),
|
|
8016
8504
|
description: clearableText(limits.descriptionChars),
|
|
8017
8505
|
system_prompt: clearableText(limits.systemPromptChars),
|
|
@@ -8020,26 +8508,26 @@ function environmentSchema(limits) {
|
|
|
8020
8508
|
});
|
|
8021
8509
|
}
|
|
8022
8510
|
function variableSchema(limits, requiredDefault) {
|
|
8023
|
-
return
|
|
8024
|
-
key:
|
|
8511
|
+
return z14.object({
|
|
8512
|
+
key: z14.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
|
|
8025
8513
|
description: optionalText(limits.variableDescriptionChars).transform((value) => value ?? ""),
|
|
8026
|
-
required:
|
|
8514
|
+
required: z14.boolean().default(requiredDefault)
|
|
8027
8515
|
});
|
|
8028
8516
|
}
|
|
8029
8517
|
function proposalSchema(limits) {
|
|
8030
|
-
return
|
|
8518
|
+
return z14.object({
|
|
8031
8519
|
summary: requiredText(limits.summaryChars),
|
|
8032
8520
|
stack: list(text(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
|
|
8033
8521
|
environment: environmentSchema(limits),
|
|
8034
8522
|
variables: list(variableSchema(limits, false), limits.variables).default([]),
|
|
8035
8523
|
automations: automationListSchema(limits),
|
|
8036
|
-
verification: list(
|
|
8524
|
+
verification: list(z14.object({
|
|
8037
8525
|
label: requiredText(limits.nameChars),
|
|
8038
|
-
status:
|
|
8526
|
+
status: z14.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
|
|
8039
8527
|
detail: optionalText(limits.verificationDetailChars).transform((value) => value ?? void 0)
|
|
8040
8528
|
}), limits.verificationItems).default([]),
|
|
8041
|
-
media: list(
|
|
8042
|
-
media_id:
|
|
8529
|
+
media: list(z14.object({
|
|
8530
|
+
media_id: z14.string().regex(UUID_RE, "must be a media id"),
|
|
8043
8531
|
title: requiredText(limits.nameChars)
|
|
8044
8532
|
}), limits.mediaItems).default([])
|
|
8045
8533
|
});
|
|
@@ -8047,35 +8535,35 @@ function proposalSchema(limits) {
|
|
|
8047
8535
|
var environmentSetupProposalSchema = proposalSchema({});
|
|
8048
8536
|
var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
|
|
8049
8537
|
var environmentSetupVariableRequestSchema = variableSchema({}, false).extend({
|
|
8050
|
-
status:
|
|
8051
|
-
requested_at:
|
|
8052
|
-
resolved_at:
|
|
8538
|
+
status: z14.enum(["pending", "provided", "skipped"]),
|
|
8539
|
+
requested_at: z14.string(),
|
|
8540
|
+
resolved_at: z14.string().nullable().default(null)
|
|
8053
8541
|
});
|
|
8054
|
-
var environmentSetupRunStateSchema =
|
|
8055
|
-
status:
|
|
8056
|
-
steps:
|
|
8542
|
+
var environmentSetupRunStateSchema = z14.object({
|
|
8543
|
+
status: z14.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
|
|
8544
|
+
steps: z14.partialRecord(z14.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z14.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
|
|
8057
8545
|
proposal: environmentSetupProposalSchema.nullable().default(null),
|
|
8058
|
-
applied:
|
|
8059
|
-
applied_at:
|
|
8060
|
-
automation_ids:
|
|
8546
|
+
applied: z14.object({
|
|
8547
|
+
applied_at: z14.string(),
|
|
8548
|
+
automation_ids: z14.array(z14.string())
|
|
8061
8549
|
}).nullable().default(null),
|
|
8062
|
-
variable_requests:
|
|
8550
|
+
variable_requests: z14.array(environmentSetupVariableRequestSchema).default([])
|
|
8063
8551
|
});
|
|
8064
|
-
var applyEnvironmentSetupRequestSchema =
|
|
8552
|
+
var applyEnvironmentSetupRequestSchema = z14.object({
|
|
8065
8553
|
environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
|
|
8066
|
-
variables: list(
|
|
8554
|
+
variables: list(z14.object({ key: z14.string().regex(VARIABLE_KEY_RE), value: z14.string() }), ENVIRONMENT_SETUP_LIMITS.variables).default([]).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys").transform((variables) => variables.filter((variable) => variable.value.length > 0)),
|
|
8067
8555
|
automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
|
|
8068
8556
|
});
|
|
8069
|
-
var requestEnvironmentSetupVariablesSchema =
|
|
8557
|
+
var requestEnvironmentSetupVariablesSchema = z14.object({
|
|
8070
8558
|
variables: list(variableSchema(ENVIRONMENT_SETUP_LIMITS, true), ENVIRONMENT_SETUP_LIMITS.variables).min(1, "must not be empty")
|
|
8071
8559
|
}).superRefine(({ variables }, ctx) => {
|
|
8072
8560
|
if (new Set(variables.map((variable) => variable.key)).size !== variables.length) {
|
|
8073
8561
|
ctx.addIssue({ code: "custom", path: ["variables"], message: "must have unique keys" });
|
|
8074
8562
|
}
|
|
8075
8563
|
});
|
|
8076
|
-
var respondEnvironmentSetupVariablesSchema =
|
|
8077
|
-
values:
|
|
8078
|
-
skipped:
|
|
8564
|
+
var respondEnvironmentSetupVariablesSchema = z14.object({
|
|
8565
|
+
values: z14.record(z14.string().regex(VARIABLE_KEY_RE), z14.string()).default({}),
|
|
8566
|
+
skipped: z14.array(z14.string().regex(VARIABLE_KEY_RE)).default([])
|
|
8079
8567
|
});
|
|
8080
8568
|
|
|
8081
8569
|
export {
|
|
@@ -8298,8 +8786,10 @@ export {
|
|
|
8298
8786
|
claudeAuthEnvFromResponse,
|
|
8299
8787
|
CLAUDE_AUTH_ENV_KEYS_BY_METHOD,
|
|
8300
8788
|
extractCommandProtectionCommandText,
|
|
8789
|
+
parseCommandProtectionRequest,
|
|
8301
8790
|
findPrMergeSignals,
|
|
8302
8791
|
findGitCommitSignals,
|
|
8792
|
+
findCommandProtectionGitLookups,
|
|
8303
8793
|
shouldRefreshPullRequests,
|
|
8304
8794
|
MAX_REPO_FILE_CONTENT_BYTES,
|
|
8305
8795
|
searchRepoFileIndex,
|