replicas-engine 0.1.1031 → 0.1.1032
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-QBDCXAI6.js → asp-host-2AILA3GI.js} +5 -5
- package/dist/src/{chunk-IEA3U7JP.js → chunk-4LOZTMKD.js} +6 -6
- package/dist/src/{chunk-K4DFY56I.js → chunk-7HXLO5LH.js} +3 -3
- package/dist/src/{chunk-5HLMUJTJ.js → chunk-AXT547FH.js} +693 -303
- package/dist/src/{chunk-ABUMJRPU.js → chunk-ERFW4IL4.js} +1 -1
- package/dist/src/{chunk-RVXD24D4.js → chunk-EWPMMKGJ.js} +1 -1
- package/dist/src/{chunk-ADUHQPYR.js → chunk-FMLTSHIC.js} +3 -3
- package/dist/src/{chunk-7PXLG7IJ.js → chunk-JOX732WB.js} +1 -1
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +3 -3
- package/dist/src/index.js +181 -179
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -1505,6 +1505,12 @@ var SUBAGENT_MCP_TOOLS = {
|
|
|
1505
1505
|
deleteAgent: "delete_agent"
|
|
1506
1506
|
};
|
|
1507
1507
|
var SUBAGENT_MCP_TOOL_NAMES = Object.values(SUBAGENT_MCP_TOOLS);
|
|
1508
|
+
function isSubagentMcpToolName(tool) {
|
|
1509
|
+
return SUBAGENT_MCP_TOOL_NAMES.some((name) => name === tool);
|
|
1510
|
+
}
|
|
1511
|
+
function isSubagentMcpServerName(server) {
|
|
1512
|
+
return server === SUBAGENT_MCP_SERVER_NAME;
|
|
1513
|
+
}
|
|
1508
1514
|
|
|
1509
1515
|
// ../shared/src/workspace-identity.ts
|
|
1510
1516
|
import { z as z4 } from "zod";
|
|
@@ -2512,6 +2518,16 @@ function planItemsFromMessage(message2) {
|
|
|
2512
2518
|
return [{ text: text2, status: status === "completed" || status === "in_progress" ? status : "pending" }];
|
|
2513
2519
|
});
|
|
2514
2520
|
}
|
|
2521
|
+
function getDisplayMessageStatus(message2) {
|
|
2522
|
+
if (message2.type === "error" || message2.type === "quota_status") return "failed";
|
|
2523
|
+
if (message2.type === "auth_fallback") return message2.status === "switched" ? "completed" : "failed";
|
|
2524
|
+
if (message2.type === "interruption") return "completed";
|
|
2525
|
+
if (message2.type === "background_task") return message2.status === "stopped" ? "completed" : message2.status;
|
|
2526
|
+
if (message2.type === "command" || message2.type === "patch") {
|
|
2527
|
+
return message2.status ?? (message2.exitCode === void 0 ? "in_progress" : message2.exitCode === 0 ? "completed" : "failed");
|
|
2528
|
+
}
|
|
2529
|
+
return "status" in message2 ? message2.status : void 0;
|
|
2530
|
+
}
|
|
2515
2531
|
function todoItemStatus(item) {
|
|
2516
2532
|
return item.itemStatus ?? (item.completed ? "completed" : "pending");
|
|
2517
2533
|
}
|
|
@@ -2544,6 +2560,17 @@ ${operation.diff}` : ""}`).join("\n\n");
|
|
|
2544
2560
|
if (message2.type === "interruption") return { kind: "error", title: "Agent stopped", summary: "", content: "" };
|
|
2545
2561
|
return { kind: "error", title: "Agent error", summary: "", content: message2.message };
|
|
2546
2562
|
}
|
|
2563
|
+
function lineCountFromOutput(output) {
|
|
2564
|
+
if (!output) return null;
|
|
2565
|
+
let end = output.length;
|
|
2566
|
+
while (end > 0 && output[end - 1] === "\n") end--;
|
|
2567
|
+
if (end === 0) return null;
|
|
2568
|
+
let lines = 1;
|
|
2569
|
+
for (let i = 0; i < end; i++) {
|
|
2570
|
+
if (output[i] === "\n") lines++;
|
|
2571
|
+
}
|
|
2572
|
+
return lines;
|
|
2573
|
+
}
|
|
2547
2574
|
function fileContentDiff(path, content, action) {
|
|
2548
2575
|
const lines = content.replace(/\n$/, "").split("\n");
|
|
2549
2576
|
return [
|
|
@@ -2553,7 +2580,39 @@ function fileContentDiff(path, content, action) {
|
|
|
2553
2580
|
...lines.map((line) => `${action === "add" ? "+" : "-"}${line}`)
|
|
2554
2581
|
].join("\n");
|
|
2555
2582
|
}
|
|
2583
|
+
var READ_COMMANDS = /* @__PURE__ */ new Set([
|
|
2584
|
+
"cat",
|
|
2585
|
+
"find",
|
|
2586
|
+
"grep",
|
|
2587
|
+
"head",
|
|
2588
|
+
"ls",
|
|
2589
|
+
"nl",
|
|
2590
|
+
"pwd",
|
|
2591
|
+
"rg",
|
|
2592
|
+
"sed",
|
|
2593
|
+
"tail",
|
|
2594
|
+
"tree",
|
|
2595
|
+
"wc"
|
|
2596
|
+
]);
|
|
2556
2597
|
var SEARCH_COMMANDS = /* @__PURE__ */ new Set(["grep", "rg"]);
|
|
2598
|
+
var PIPE_FILTERS = /* @__PURE__ */ new Set(["awk", "cat", "column", "cut", "grep", "head", "jq", "nl", "rg", "sed", "sort", "tail", "tr", "uniq", "wc"]);
|
|
2599
|
+
var NEUTRAL_COMMANDS = /* @__PURE__ */ new Set(["cd", "echo", "printf", "true"]);
|
|
2600
|
+
var GIT_READ_COMMANDS = /* @__PURE__ */ new Set([
|
|
2601
|
+
"branch",
|
|
2602
|
+
"diff",
|
|
2603
|
+
"grep",
|
|
2604
|
+
"log",
|
|
2605
|
+
"ls-files",
|
|
2606
|
+
"show",
|
|
2607
|
+
"status"
|
|
2608
|
+
]);
|
|
2609
|
+
var GH_READ_COMMANDS = /* @__PURE__ */ new Set([
|
|
2610
|
+
"api",
|
|
2611
|
+
"issue",
|
|
2612
|
+
"pr",
|
|
2613
|
+
"repo",
|
|
2614
|
+
"run"
|
|
2615
|
+
]);
|
|
2557
2616
|
var OPTION_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
2558
2617
|
"-A",
|
|
2559
2618
|
"-B",
|
|
@@ -2576,9 +2635,26 @@ var LINE_COUNT_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
|
2576
2635
|
var SCRIPT_ROOT = "/";
|
|
2577
2636
|
var commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
|
|
2578
2637
|
var fileWrites = ({ writes }) => writes.filter(({ path }) => path !== "/dev/null");
|
|
2638
|
+
function displayPath(dir, path) {
|
|
2639
|
+
if (path.startsWith("~")) return path;
|
|
2640
|
+
const resolved = resolveShellPath(dir, path);
|
|
2641
|
+
if (resolved === null) return null;
|
|
2642
|
+
if (resolved === SCRIPT_ROOT) return ".";
|
|
2643
|
+
if (resolved.startsWith(`${SCRIPT_ROOT}/`)) return resolved.slice(SCRIPT_ROOT.length + 1);
|
|
2644
|
+
return path.startsWith("/") ? resolved : null;
|
|
2645
|
+
}
|
|
2579
2646
|
function shellCommands(command) {
|
|
2580
2647
|
return parseShellScript(command, SCRIPT_ROOT).filter(({ wrapper }) => !wrapper);
|
|
2581
2648
|
}
|
|
2649
|
+
function simpleCommands(command) {
|
|
2650
|
+
const commands = shellCommands(command);
|
|
2651
|
+
const hasRedirectOrSubshell = commands.some((shellCommand) => shellCommand.subshell || shellCommand.stdinFile !== null || !shellCommand.piped && shellCommand.stdin !== void 0 || fileWrites(shellCommand).length > 0);
|
|
2652
|
+
if (commands.length === 0 || hasRedirectOrSubshell) return null;
|
|
2653
|
+
return commands.map((shellCommand) => {
|
|
2654
|
+
const argv = shellCommand.argv.map((word) => word.replaceAll(SHELL_OPAQUE, "\u2026"));
|
|
2655
|
+
return { ...shellCommand, argv, name: commandName(argv) };
|
|
2656
|
+
});
|
|
2657
|
+
}
|
|
2582
2658
|
var SKILL_READ_COMMANDS = /* @__PURE__ */ new Set(["awk", "bat", "cat", "head", "less", "more", "nl", "sed", "tail"]);
|
|
2583
2659
|
function skillNamesFromCommand(command) {
|
|
2584
2660
|
return Array.from(new Set(shellCommands(command).flatMap((shellCommand) => {
|
|
@@ -2639,20 +2715,174 @@ function readCommandPaths(command, words) {
|
|
|
2639
2715
|
}
|
|
2640
2716
|
return pathArgs(words.slice(1), command === "head" || command === "tail" ? LINE_COUNT_VALUE_FLAGS : void 0);
|
|
2641
2717
|
}
|
|
2718
|
+
function readTitle(search, output, paths) {
|
|
2719
|
+
const lines = lineCountFromOutput(output);
|
|
2720
|
+
if (lines) return `Read ${lines} line${lines === 1 ? "" : "s"}${paths.length > 1 ? ` from ${paths.length} files` : ""}`;
|
|
2721
|
+
return search ? "Search" : paths.length > 1 ? `Read ${paths.length} files` : "Read";
|
|
2722
|
+
}
|
|
2723
|
+
function writtenFile(command) {
|
|
2724
|
+
const [write, ...rest] = shellCommands(command).filter(({ argv }) => !["cd", "mkdir"].includes(commandName(argv)));
|
|
2725
|
+
if (!write || rest.length > 0 || write.piped || write.subshell || write.stdinFile !== null) return null;
|
|
2726
|
+
if (!["cat", "echo", "printf"].includes(commandName(write.argv))) return null;
|
|
2727
|
+
const writes = fileWrites(write);
|
|
2728
|
+
return writes.length === 1 && writes[0].path ? displayPath(write.dir, writes[0].target) : null;
|
|
2729
|
+
}
|
|
2642
2730
|
function writesFiles(name, argv) {
|
|
2643
2731
|
if (name === "sed") return argv.some((word) => /^(-[a-zA-Z]*i|--in-place)/.test(word));
|
|
2644
2732
|
return name === "find" && argv.some((word) => /^-(exec|ok|delete|fprint|fls)/.test(word));
|
|
2645
2733
|
}
|
|
2734
|
+
function commandDisplayFromCommand(command, output) {
|
|
2735
|
+
const written = writtenFile(command);
|
|
2736
|
+
if (written) return { title: "Write", paths: [written] };
|
|
2737
|
+
const commands = simpleCommands(command);
|
|
2738
|
+
if (!commands || commands.some(({ name, argv, piped }) => writesFiles(name, argv) || piped && !PIPE_FILTERS.has(name))) return null;
|
|
2739
|
+
const mainCommands = commands.filter(({ name, piped }) => !piped && !NEUTRAL_COMMANDS.has(name));
|
|
2740
|
+
if (mainCommands.length === 0) return null;
|
|
2741
|
+
if (mainCommands.length === 1) {
|
|
2742
|
+
const [{ name, argv: words }] = mainCommands;
|
|
2743
|
+
if (name === "git" && words[1] && GIT_READ_COMMANDS.has(words[1])) {
|
|
2744
|
+
return { title: `Git ${words[1]}`, paths: [] };
|
|
2745
|
+
}
|
|
2746
|
+
if (name === "gh" && words[1] && GH_READ_COMMANDS.has(words[1])) {
|
|
2747
|
+
return { title: words[1] === "pr" && words[2] ? `GitHub PR ${words[2]}` : "GitHub", paths: [] };
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
if (!mainCommands.every(({ name }) => READ_COMMANDS.has(name))) return null;
|
|
2751
|
+
const paths = /* @__PURE__ */ new Set();
|
|
2752
|
+
for (const { name, argv, dir } of mainCommands) {
|
|
2753
|
+
for (const path of readCommandPaths(name, argv)) {
|
|
2754
|
+
const shown = displayPath(dir, path);
|
|
2755
|
+
if (shown === null) return null;
|
|
2756
|
+
paths.add(shown);
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
const search = mainCommands.every(({ name }) => SEARCH_COMMANDS.has(name));
|
|
2760
|
+
return { title: readTitle(search, output, [...paths]), paths: [...paths] };
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
// ../shared/src/display-message/tool-call.ts
|
|
2764
|
+
function parseToolCallInput(inputValue) {
|
|
2765
|
+
const input = typeof inputValue === "string" ? inputValue : inputValue ? JSON.stringify(inputValue, null, 2) : "";
|
|
2766
|
+
let inputObject = null;
|
|
2767
|
+
if (inputValue && typeof inputValue !== "string") inputObject = inputValue;
|
|
2768
|
+
else if (input)
|
|
2769
|
+
try {
|
|
2770
|
+
const parsed = JSON.parse(input);
|
|
2771
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed))
|
|
2772
|
+
inputObject = Object.fromEntries(Object.entries(parsed));
|
|
2773
|
+
} catch {
|
|
2774
|
+
}
|
|
2775
|
+
const filePath = inputObject ? [inputObject.file_path, inputObject.filePath, inputObject.path, inputObject.filename, inputObject.file].find(
|
|
2776
|
+
(value) => typeof value === "string" && value.trim().length > 0
|
|
2777
|
+
) : void 0;
|
|
2778
|
+
return {
|
|
2779
|
+
input,
|
|
2780
|
+
inputObject,
|
|
2781
|
+
filePath: filePath ?? input.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m)?.[1]
|
|
2782
|
+
};
|
|
2783
|
+
}
|
|
2646
2784
|
|
|
2647
|
-
// ../shared/src/
|
|
2648
|
-
function
|
|
2649
|
-
const
|
|
2650
|
-
|
|
2785
|
+
// ../shared/src/display-message/parsers/mcp.ts
|
|
2786
|
+
function parseMcpToolName(name) {
|
|
2787
|
+
const prefix = "mcp__";
|
|
2788
|
+
if (!name.startsWith(prefix)) return null;
|
|
2789
|
+
const rest = name.slice(prefix.length);
|
|
2790
|
+
const sep = rest.indexOf("__");
|
|
2791
|
+
if (sep <= 0) return null;
|
|
2792
|
+
const server = rest.slice(0, sep);
|
|
2793
|
+
const tool = rest.slice(sep + 2);
|
|
2794
|
+
if (!server || !tool) return null;
|
|
2795
|
+
return { server, tool };
|
|
2651
2796
|
}
|
|
2652
|
-
|
|
2653
|
-
|
|
2797
|
+
|
|
2798
|
+
// ../shared/src/display-message/subagent-tools.ts
|
|
2799
|
+
function chatIdFrom(input) {
|
|
2800
|
+
const value = parseToolCallInput(input).inputObject;
|
|
2801
|
+
if (!value) return null;
|
|
2802
|
+
if ("chatId" in value && typeof value.chatId === "string") return value.chatId;
|
|
2803
|
+
return "chat_id" in value && typeof value.chat_id === "string" ? value.chat_id : null;
|
|
2804
|
+
}
|
|
2805
|
+
function subagentToolName(message2) {
|
|
2806
|
+
const mcp = parseMcpToolName(message2.tool);
|
|
2807
|
+
const server = mcp?.server ?? message2.server;
|
|
2808
|
+
const tool = mcp?.tool ?? message2.tool;
|
|
2809
|
+
return isSubagentMcpServerName(server) ? tool : null;
|
|
2810
|
+
}
|
|
2811
|
+
function subagentChatId(message2) {
|
|
2812
|
+
const tool = subagentToolName(message2);
|
|
2813
|
+
if (!tool || tool === SUBAGENT_MCP_TOOLS.getProviders || !isSubagentMcpToolName(tool)) return null;
|
|
2814
|
+
const inputId = chatIdFrom(message2.input);
|
|
2815
|
+
if (inputId) return inputId;
|
|
2816
|
+
if (tool !== SUBAGENT_MCP_TOOLS.spawnAgent || !message2.output) return null;
|
|
2817
|
+
return chatIdFrom(message2.output);
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
// ../shared/src/learned-skills.ts
|
|
2821
|
+
import { z as z10 } from "zod";
|
|
2822
|
+
|
|
2823
|
+
// ../shared/src/frontmatter.ts
|
|
2824
|
+
import { parse as parseYaml } from "yaml";
|
|
2825
|
+
function parseFrontmatter(content) {
|
|
2826
|
+
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
|
|
2827
|
+
if (!match) return {};
|
|
2828
|
+
try {
|
|
2829
|
+
const parsed = parseYaml(match[1]);
|
|
2830
|
+
if (typeof parsed !== "object" || parsed === null) return {};
|
|
2831
|
+
return {
|
|
2832
|
+
..."name" in parsed && typeof parsed.name === "string" ? { name: parsed.name.trim() } : {},
|
|
2833
|
+
..."description" in parsed && typeof parsed.description === "string" ? { description: parsed.description.trim() } : {}
|
|
2834
|
+
};
|
|
2835
|
+
} catch {
|
|
2836
|
+
return {};
|
|
2837
|
+
}
|
|
2654
2838
|
}
|
|
2655
2839
|
|
|
2840
|
+
// ../shared/src/sandbox.ts
|
|
2841
|
+
var SANDBOX_LIFECYCLE = {
|
|
2842
|
+
AUTO_STOP_MINUTES: 60,
|
|
2843
|
+
AUTO_ARCHIVE_MINUTES: 60 * 24 * 7,
|
|
2844
|
+
AUTO_DELETE_MINUTES: -1,
|
|
2845
|
+
SSH_TOKEN_EXPIRATION_MINUTES: 3 * 60
|
|
2846
|
+
};
|
|
2847
|
+
var SANDBOX_SKILL_DIRS = [
|
|
2848
|
+
".agents/skills",
|
|
2849
|
+
".claude/skills",
|
|
2850
|
+
".codex/skills",
|
|
2851
|
+
".cursor/skills",
|
|
2852
|
+
".config/opencode/skills",
|
|
2853
|
+
".pi/agent/skills",
|
|
2854
|
+
".replicas/skill-registries"
|
|
2855
|
+
];
|
|
2856
|
+
var SANDBOX_PATHS = {
|
|
2857
|
+
HOME_DIR: "/home/user",
|
|
2858
|
+
WORKSPACES_DIR: "/home/user/workspaces",
|
|
2859
|
+
REPLICAS_DIR: "/home/user/.replicas",
|
|
2860
|
+
REPLICAS_CANVAS_DIR: "/home/user/.replicas/canvas",
|
|
2861
|
+
REPLICAS_RUNTIME_ENV_FILE: "/home/user/.replicas/runtime-env.sh"
|
|
2862
|
+
};
|
|
2863
|
+
var WORKSPACE_SIZES = ["small", "large"];
|
|
2864
|
+
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
2865
|
+
|
|
2866
|
+
// ../shared/src/learned-skills.ts
|
|
2867
|
+
var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
|
|
2868
|
+
var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
|
|
2869
|
+
var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
|
|
2870
|
+
var learnedSkillsManifestSchema = z10.object({
|
|
2871
|
+
skills: z10.array(z10.object({ name: z10.string(), sha256: z10.string() }))
|
|
2872
|
+
});
|
|
2873
|
+
|
|
2874
|
+
// ../shared/src/replicas-mcp.ts
|
|
2875
|
+
import { z as z15 } from "zod";
|
|
2876
|
+
|
|
2877
|
+
// ../shared/src/automations/trigger-schemas.ts
|
|
2878
|
+
import { z as z11 } from "zod";
|
|
2879
|
+
|
|
2880
|
+
// ../shared/src/uuid.ts
|
|
2881
|
+
function createUuidFromHex(value) {
|
|
2882
|
+
return `${value.slice(0, 8)}-${value.slice(8, 12)}-5${value.slice(13, 16)}-${(Number.parseInt(value.slice(16, 17), 16) & 3 | 8).toString(16)}${value.slice(17, 20)}-${value.slice(20, 32)}`;
|
|
2883
|
+
}
|
|
2884
|
+
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
2885
|
+
|
|
2656
2886
|
// ../shared/src/urls.ts
|
|
2657
2887
|
var DASHBOARD_PATH = "/dashboard";
|
|
2658
2888
|
var WEB_APP_PATHS = {
|
|
@@ -2750,18 +2980,6 @@ function buildCodeHostPrUrl(repoUrl, provider2, prNumber) {
|
|
|
2750
2980
|
return `${normalizedRepoUrl}/pull/${prNumber}`;
|
|
2751
2981
|
}
|
|
2752
2982
|
|
|
2753
|
-
// ../shared/src/replicas-mcp.ts
|
|
2754
|
-
import { z as z14 } from "zod";
|
|
2755
|
-
|
|
2756
|
-
// ../shared/src/automations/trigger-schemas.ts
|
|
2757
|
-
import { z as z10 } from "zod";
|
|
2758
|
-
|
|
2759
|
-
// ../shared/src/uuid.ts
|
|
2760
|
-
function createUuidFromHex(value) {
|
|
2761
|
-
return `${value.slice(0, 8)}-${value.slice(8, 12)}-5${value.slice(13, 16)}-${(Number.parseInt(value.slice(16, 17), 16) & 3 | 8).toString(16)}${value.slice(17, 20)}-${value.slice(20, 32)}`;
|
|
2762
|
-
}
|
|
2763
|
-
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
2764
|
-
|
|
2765
2983
|
// ../shared/src/automations/github/index.ts
|
|
2766
2984
|
var REVIEW_REQUESTED_EVENT = "pull_request.review_requested";
|
|
2767
2985
|
|
|
@@ -2771,47 +2989,47 @@ function getReviewerLoginsError(event, logins) {
|
|
|
2771
2989
|
if (isReviewRequested === !!logins?.some((login) => login.trim().replace(/^@+/, ""))) return null;
|
|
2772
2990
|
return isReviewRequested ? "The PR review requested trigger needs at least one GitHub username" : "Requested reviewers only apply to the PR review requested trigger";
|
|
2773
2991
|
}
|
|
2774
|
-
var repositoryTriggerConfigSchema =
|
|
2775
|
-
event:
|
|
2776
|
-
repository_ids:
|
|
2777
|
-
group_pr_events:
|
|
2778
|
-
excluded_actors:
|
|
2779
|
-
reviewer_logins:
|
|
2992
|
+
var repositoryTriggerConfigSchema = z11.object({
|
|
2993
|
+
event: z11.string(),
|
|
2994
|
+
repository_ids: z11.array(z11.string().regex(UUID_RE, "must be a repository id")).optional(),
|
|
2995
|
+
group_pr_events: z11.boolean().optional(),
|
|
2996
|
+
excluded_actors: z11.array(z11.string()).optional(),
|
|
2997
|
+
reviewer_logins: z11.array(z11.string()).optional()
|
|
2780
2998
|
});
|
|
2781
|
-
var cronTriggerSchema =
|
|
2782
|
-
var githubTriggerSchema =
|
|
2783
|
-
type:
|
|
2999
|
+
var cronTriggerSchema = z11.object({ type: z11.literal("cron"), config: z11.object({ schedule: z11.string(), timezone: z11.string().optional() }) });
|
|
3000
|
+
var githubTriggerSchema = z11.object({
|
|
3001
|
+
type: z11.literal("github"),
|
|
2784
3002
|
config: repositoryTriggerConfigSchema.superRefine((config, ctx) => {
|
|
2785
3003
|
const message2 = getReviewerLoginsError(config.event, config.reviewer_logins);
|
|
2786
3004
|
if (message2) ctx.addIssue({ code: "custom", message: message2, path: ["reviewer_logins"] });
|
|
2787
3005
|
})
|
|
2788
3006
|
});
|
|
2789
|
-
var gitlabTriggerSchema =
|
|
2790
|
-
var automationTriggerSchema =
|
|
3007
|
+
var gitlabTriggerSchema = z11.object({ type: z11.literal("gitlab"), config: repositoryTriggerConfigSchema });
|
|
3008
|
+
var automationTriggerSchema = z11.discriminatedUnion("type", [
|
|
2791
3009
|
cronTriggerSchema,
|
|
2792
3010
|
githubTriggerSchema,
|
|
2793
3011
|
gitlabTriggerSchema,
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
3012
|
+
z11.object({ type: z11.literal("slack"), config: z11.object({ event: z11.string(), channel_ids: z11.array(z11.string()).optional(), group_thread_replies: z11.boolean().optional() }) }),
|
|
3013
|
+
z11.object({ type: z11.literal("sentry"), config: z11.object({ event: z11.string(), project_slugs: z11.array(z11.string()).optional(), min_level: z11.string().optional() }) }),
|
|
3014
|
+
z11.object({ type: z11.literal("custom"), config: z11.object({}) })
|
|
2797
3015
|
]);
|
|
2798
3016
|
|
|
2799
3017
|
// ../shared/src/routes/environment.ts
|
|
2800
|
-
import { z as
|
|
3018
|
+
import { z as z12 } from "zod";
|
|
2801
3019
|
var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
|
|
2802
|
-
var stringMap =
|
|
2803
|
-
var createEnvironmentMcpRequestSchema =
|
|
2804
|
-
name:
|
|
2805
|
-
transport:
|
|
2806
|
-
config:
|
|
2807
|
-
|
|
2808
|
-
|
|
3020
|
+
var stringMap = z12.record(z12.string(), z12.string());
|
|
3021
|
+
var createEnvironmentMcpRequestSchema = z12.object({
|
|
3022
|
+
name: z12.string(),
|
|
3023
|
+
transport: z12.enum(ENVIRONMENT_MCP_TRANSPORTS),
|
|
3024
|
+
config: z12.union([
|
|
3025
|
+
z12.object({ command: z12.string().min(1), args: z12.array(z12.string()).optional(), env: stringMap.optional() }),
|
|
3026
|
+
z12.object({ url: z12.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
|
|
2809
3027
|
]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
|
|
2810
3028
|
});
|
|
2811
3029
|
var updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
|
|
2812
3030
|
|
|
2813
3031
|
// ../shared/src/routes/workspaces.ts
|
|
2814
|
-
import { z as
|
|
3032
|
+
import { z as z14 } from "zod";
|
|
2815
3033
|
|
|
2816
3034
|
// ../shared/src/default-skills/replicas-agent/abilities/computer.ts
|
|
2817
3035
|
var SECTION = `### Computer use (Linux desktop control)
|
|
@@ -3083,7 +3301,7 @@ var DOCKER_ABILITY = {
|
|
|
3083
3301
|
};
|
|
3084
3302
|
|
|
3085
3303
|
// ../shared/src/routes/environment-setups.ts
|
|
3086
|
-
import { z as
|
|
3304
|
+
import { z as z13 } from "zod";
|
|
3087
3305
|
var ENVIRONMENT_SETUP_STEPS = [
|
|
3088
3306
|
{ key: "understand", label: "Understand the codebase" },
|
|
3089
3307
|
{ key: "install", label: "Install dependencies and run the app" },
|
|
@@ -3117,17 +3335,17 @@ var ENVIRONMENT_SETUP_LIMITS = {
|
|
|
3117
3335
|
};
|
|
3118
3336
|
var ENVIRONMENT_SETUP_VARIABLE_WAIT = { defaultMs: 5 * 6e4, maxMs: 15 * 6e4, pollMs: 5e3 };
|
|
3119
3337
|
var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
3120
|
-
var text = (max) => max === void 0 ?
|
|
3338
|
+
var text = (max) => max === void 0 ? z13.string().trim() : z13.string().trim().max(max);
|
|
3121
3339
|
var requiredText = (max) => text(max).min(1, "must not be empty");
|
|
3122
3340
|
var optionalText = (max) => text(max).nullish().transform((value) => value || null);
|
|
3123
3341
|
var clearableText = (max) => text(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
|
|
3124
|
-
var list = (item, max) => max === void 0 ?
|
|
3342
|
+
var list = (item, max) => max === void 0 ? z13.array(item) : z13.array(item).max(max);
|
|
3125
3343
|
var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
|
|
3126
3344
|
function isEnvironmentSetupAuthoredTriggerType(type) {
|
|
3127
3345
|
return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
|
|
3128
3346
|
}
|
|
3129
|
-
var proposalTriggerSchema =
|
|
3130
|
-
var existingTriggerSchema =
|
|
3347
|
+
var proposalTriggerSchema = z13.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
|
|
3348
|
+
var existingTriggerSchema = z13.custom(
|
|
3131
3349
|
(value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
|
|
3132
3350
|
"must be an automation trigger"
|
|
3133
3351
|
);
|
|
@@ -3135,17 +3353,17 @@ var carriedTriggerSchema = existingTriggerSchema.refine(
|
|
|
3135
3353
|
(trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
|
|
3136
3354
|
);
|
|
3137
3355
|
function automationSchema(limits) {
|
|
3138
|
-
const authored =
|
|
3356
|
+
const authored = z13.object({
|
|
3139
3357
|
name: text(limits.nameChars),
|
|
3140
3358
|
description: text(limits.descriptionChars),
|
|
3141
3359
|
prompt: text(limits.automationPromptChars),
|
|
3142
3360
|
triggers: list(proposalTriggerSchema, limits.automationTriggers)
|
|
3143
3361
|
});
|
|
3144
|
-
const updated = authored.extend({ triggers: list(
|
|
3145
|
-
return
|
|
3362
|
+
const updated = authored.extend({ triggers: list(z13.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
|
|
3363
|
+
return z13.object({
|
|
3146
3364
|
key: requiredText(limits.automationKeyChars),
|
|
3147
|
-
action:
|
|
3148
|
-
automation_id:
|
|
3365
|
+
action: z13.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
|
|
3366
|
+
automation_id: z13.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
|
|
3149
3367
|
name: text().default(""),
|
|
3150
3368
|
description: optionalText().transform((value) => value ?? ""),
|
|
3151
3369
|
prompt: text().default(""),
|
|
@@ -3168,7 +3386,7 @@ function automationSchema(limits) {
|
|
|
3168
3386
|
const content = (automation.action === "update" ? updated : authored).safeParse(automation);
|
|
3169
3387
|
if (content.success) return { ...automation, ...content.data };
|
|
3170
3388
|
for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
|
|
3171
|
-
return
|
|
3389
|
+
return z13.NEVER;
|
|
3172
3390
|
});
|
|
3173
3391
|
}
|
|
3174
3392
|
function automationListSchema(limits) {
|
|
@@ -3186,7 +3404,7 @@ function automationListSchema(limits) {
|
|
|
3186
3404
|
});
|
|
3187
3405
|
}
|
|
3188
3406
|
function environmentSchema(limits) {
|
|
3189
|
-
return
|
|
3407
|
+
return z13.object({
|
|
3190
3408
|
name: optionalText(limits.nameChars).transform((value) => value ?? void 0),
|
|
3191
3409
|
description: clearableText(limits.descriptionChars),
|
|
3192
3410
|
system_prompt: clearableText(limits.systemPromptChars),
|
|
@@ -3195,26 +3413,26 @@ function environmentSchema(limits) {
|
|
|
3195
3413
|
});
|
|
3196
3414
|
}
|
|
3197
3415
|
function variableSchema(limits, requiredDefault) {
|
|
3198
|
-
return
|
|
3199
|
-
key:
|
|
3416
|
+
return z13.object({
|
|
3417
|
+
key: z13.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
|
|
3200
3418
|
description: optionalText(limits.variableDescriptionChars).transform((value) => value ?? ""),
|
|
3201
|
-
required:
|
|
3419
|
+
required: z13.boolean().default(requiredDefault)
|
|
3202
3420
|
});
|
|
3203
3421
|
}
|
|
3204
3422
|
function proposalSchema(limits) {
|
|
3205
|
-
return
|
|
3423
|
+
return z13.object({
|
|
3206
3424
|
summary: requiredText(limits.summaryChars),
|
|
3207
3425
|
stack: list(text(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
|
|
3208
3426
|
environment: environmentSchema(limits),
|
|
3209
3427
|
variables: list(variableSchema(limits, false), limits.variables).default([]),
|
|
3210
3428
|
automations: automationListSchema(limits),
|
|
3211
|
-
verification: list(
|
|
3429
|
+
verification: list(z13.object({
|
|
3212
3430
|
label: requiredText(limits.nameChars),
|
|
3213
|
-
status:
|
|
3431
|
+
status: z13.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
|
|
3214
3432
|
detail: optionalText(limits.verificationDetailChars).transform((value) => value ?? void 0)
|
|
3215
3433
|
}), limits.verificationItems).default([]),
|
|
3216
|
-
media: list(
|
|
3217
|
-
media_id:
|
|
3434
|
+
media: list(z13.object({
|
|
3435
|
+
media_id: z13.string().regex(UUID_RE, "must be a media id"),
|
|
3218
3436
|
title: requiredText(limits.nameChars)
|
|
3219
3437
|
}), limits.mediaItems).default([])
|
|
3220
3438
|
});
|
|
@@ -3222,35 +3440,35 @@ function proposalSchema(limits) {
|
|
|
3222
3440
|
var environmentSetupProposalSchema = proposalSchema({});
|
|
3223
3441
|
var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
|
|
3224
3442
|
var environmentSetupVariableRequestSchema = variableSchema({}, false).extend({
|
|
3225
|
-
status:
|
|
3226
|
-
requested_at:
|
|
3227
|
-
resolved_at:
|
|
3443
|
+
status: z13.enum(["pending", "provided", "skipped"]),
|
|
3444
|
+
requested_at: z13.string(),
|
|
3445
|
+
resolved_at: z13.string().nullable().default(null)
|
|
3228
3446
|
});
|
|
3229
|
-
var environmentSetupRunStateSchema =
|
|
3230
|
-
status:
|
|
3231
|
-
steps:
|
|
3447
|
+
var environmentSetupRunStateSchema = z13.object({
|
|
3448
|
+
status: z13.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
|
|
3449
|
+
steps: z13.partialRecord(z13.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z13.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
|
|
3232
3450
|
proposal: environmentSetupProposalSchema.nullable().default(null),
|
|
3233
|
-
applied:
|
|
3234
|
-
applied_at:
|
|
3235
|
-
automation_ids:
|
|
3451
|
+
applied: z13.object({
|
|
3452
|
+
applied_at: z13.string(),
|
|
3453
|
+
automation_ids: z13.array(z13.string())
|
|
3236
3454
|
}).nullable().default(null),
|
|
3237
|
-
variable_requests:
|
|
3455
|
+
variable_requests: z13.array(environmentSetupVariableRequestSchema).default([])
|
|
3238
3456
|
});
|
|
3239
|
-
var applyEnvironmentSetupRequestSchema =
|
|
3457
|
+
var applyEnvironmentSetupRequestSchema = z13.object({
|
|
3240
3458
|
environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
|
|
3241
|
-
variables: list(
|
|
3459
|
+
variables: list(z13.object({ key: z13.string().regex(VARIABLE_KEY_RE), value: z13.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)),
|
|
3242
3460
|
automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
|
|
3243
3461
|
});
|
|
3244
|
-
var requestEnvironmentSetupVariablesSchema =
|
|
3462
|
+
var requestEnvironmentSetupVariablesSchema = z13.object({
|
|
3245
3463
|
variables: list(variableSchema(ENVIRONMENT_SETUP_LIMITS, true), ENVIRONMENT_SETUP_LIMITS.variables).min(1, "must not be empty")
|
|
3246
3464
|
}).superRefine(({ variables }, ctx) => {
|
|
3247
3465
|
if (new Set(variables.map((variable) => variable.key)).size !== variables.length) {
|
|
3248
3466
|
ctx.addIssue({ code: "custom", path: ["variables"], message: "must have unique keys" });
|
|
3249
3467
|
}
|
|
3250
3468
|
});
|
|
3251
|
-
var respondEnvironmentSetupVariablesSchema =
|
|
3252
|
-
values:
|
|
3253
|
-
skipped:
|
|
3469
|
+
var respondEnvironmentSetupVariablesSchema = z13.object({
|
|
3470
|
+
values: z13.record(z13.string().regex(VARIABLE_KEY_RE), z13.string()).default({}),
|
|
3471
|
+
skipped: z13.array(z13.string().regex(VARIABLE_KEY_RE)).default([])
|
|
3254
3472
|
});
|
|
3255
3473
|
|
|
3256
3474
|
// ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
|
|
@@ -4770,32 +4988,6 @@ var SENTRY_ABILITY = {
|
|
|
4770
4988
|
referenceFile: { name: "SENTRY.md", content: REFERENCE11 }
|
|
4771
4989
|
};
|
|
4772
4990
|
|
|
4773
|
-
// ../shared/src/sandbox.ts
|
|
4774
|
-
var SANDBOX_LIFECYCLE = {
|
|
4775
|
-
AUTO_STOP_MINUTES: 60,
|
|
4776
|
-
AUTO_ARCHIVE_MINUTES: 60 * 24 * 7,
|
|
4777
|
-
AUTO_DELETE_MINUTES: -1,
|
|
4778
|
-
SSH_TOKEN_EXPIRATION_MINUTES: 3 * 60
|
|
4779
|
-
};
|
|
4780
|
-
var SANDBOX_SKILL_DIRS = [
|
|
4781
|
-
".agents/skills",
|
|
4782
|
-
".claude/skills",
|
|
4783
|
-
".codex/skills",
|
|
4784
|
-
".cursor/skills",
|
|
4785
|
-
".config/opencode/skills",
|
|
4786
|
-
".pi/agent/skills",
|
|
4787
|
-
".replicas/skill-registries"
|
|
4788
|
-
];
|
|
4789
|
-
var SANDBOX_PATHS = {
|
|
4790
|
-
HOME_DIR: "/home/user",
|
|
4791
|
-
WORKSPACES_DIR: "/home/user/workspaces",
|
|
4792
|
-
REPLICAS_DIR: "/home/user/.replicas",
|
|
4793
|
-
REPLICAS_CANVAS_DIR: "/home/user/.replicas/canvas",
|
|
4794
|
-
REPLICAS_RUNTIME_ENV_FILE: "/home/user/.replicas/runtime-env.sh"
|
|
4795
|
-
};
|
|
4796
|
-
var WORKSPACE_SIZES = ["small", "large"];
|
|
4797
|
-
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
4798
|
-
|
|
4799
4991
|
// ../shared/src/memory.ts
|
|
4800
4992
|
var HISTORY_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/history`;
|
|
4801
4993
|
var HISTORY_INDEX_FILENAME = "INDEX.md";
|
|
@@ -4984,20 +5176,21 @@ var DEFAULT_WORKSPACE_FILTERS = {
|
|
|
4984
5176
|
activity: "any"
|
|
4985
5177
|
};
|
|
4986
5178
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4987
|
-
var workspaceExecRequestSchema =
|
|
4988
|
-
command:
|
|
4989
|
-
timeout_seconds:
|
|
5179
|
+
var workspaceExecRequestSchema = z14.object({
|
|
5180
|
+
command: z14.string().regex(/\S/, "command is required"),
|
|
5181
|
+
timeout_seconds: z14.number().int().min(1).max(50).optional().describe("Default: 30")
|
|
4990
5182
|
});
|
|
4991
|
-
var terminalRtcCandidateSchema =
|
|
4992
|
-
var terminalSocketServerMessageSchema =
|
|
4993
|
-
|
|
4994
|
-
|
|
5183
|
+
var terminalRtcCandidateSchema = z14.object({ type: z14.literal("rtc-candidate"), candidate: z14.string(), mid: z14.string() });
|
|
5184
|
+
var terminalSocketServerMessageSchema = z14.discriminatedUnion("type", [
|
|
5185
|
+
z14.object({ type: z14.literal("output"), data: z14.string() }),
|
|
5186
|
+
z14.object({ type: z14.literal("rtc-answer"), sdp: z14.string() }),
|
|
4995
5187
|
terminalRtcCandidateSchema,
|
|
4996
|
-
|
|
5188
|
+
z14.object({ type: z14.literal("rtc-switch") })
|
|
4997
5189
|
]);
|
|
4998
5190
|
var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
|
|
4999
5191
|
|
|
5000
5192
|
// ../shared/src/replicas-mcp.ts
|
|
5193
|
+
var REPLICAS_MCP_SERVER_NAME = "replicas-mcp";
|
|
5001
5194
|
var REPLICAS_MCP_TOOLS = {
|
|
5002
5195
|
listEnvironments: "list_environments",
|
|
5003
5196
|
createAutomation: "create_automation",
|
|
@@ -5014,44 +5207,281 @@ var REPLICAS_MCP_TOOLS = {
|
|
|
5014
5207
|
readSubagent: "read_subagent",
|
|
5015
5208
|
archiveSubagent: "archive_subagent"
|
|
5016
5209
|
};
|
|
5017
|
-
var automationToolInputSchema =
|
|
5018
|
-
name:
|
|
5019
|
-
prompt:
|
|
5020
|
-
environment_id:
|
|
5021
|
-
triggers:
|
|
5210
|
+
var automationToolInputSchema = z15.object({
|
|
5211
|
+
name: z15.string().describe("Short automation name."),
|
|
5212
|
+
prompt: z15.string().describe("Prompt each automation run starts with."),
|
|
5213
|
+
environment_id: z15.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
|
|
5214
|
+
triggers: z15.array(automationTriggerSchema).min(1).describe(
|
|
5022
5215
|
'One or more triggers. Cron: `{ "type": "cron", "config": { "schedule": "0 9 * * 1", "timezone": "America/New_York" } }`. GitHub: `{ "type": "github", "config": { "event": "pull_request.opened", "repository_ids": ["<repository uuid>"] } }`.'
|
|
5023
5216
|
),
|
|
5024
|
-
description:
|
|
5025
|
-
plan_mode:
|
|
5026
|
-
goal_mode:
|
|
5027
|
-
fast_mode:
|
|
5217
|
+
description: z15.string().optional().describe("One-line summary shown in the dashboard."),
|
|
5218
|
+
plan_mode: z15.boolean().optional(),
|
|
5219
|
+
goal_mode: z15.boolean().optional(),
|
|
5220
|
+
fast_mode: z15.boolean().optional()
|
|
5028
5221
|
});
|
|
5029
5222
|
var automationCreateToolInputSchema = automationToolInputSchema.extend({
|
|
5030
|
-
scope:
|
|
5223
|
+
scope: z15.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
|
|
5031
5224
|
});
|
|
5032
5225
|
var automationUpdateToolInputSchema = automationToolInputSchema.partial().extend({
|
|
5033
|
-
automation_id:
|
|
5034
|
-
enabled:
|
|
5035
|
-
agent_provider:
|
|
5036
|
-
model:
|
|
5037
|
-
thinking_level:
|
|
5038
|
-
workspace_lifecycle_policy:
|
|
5039
|
-
workspace_size:
|
|
5226
|
+
automation_id: z15.string().describe("Automation ID"),
|
|
5227
|
+
enabled: z15.boolean().optional(),
|
|
5228
|
+
agent_provider: z15.enum(AGENT).nullable().optional(),
|
|
5229
|
+
model: z15.string().nullable().optional(),
|
|
5230
|
+
thinking_level: z15.enum(VALID_THINKING_LEVELS).nullable().optional(),
|
|
5231
|
+
workspace_lifecycle_policy: z15.enum(VALID_LIFECYCLE_POLICIES).optional(),
|
|
5232
|
+
workspace_size: z15.enum(WORKSPACE_SIZES).optional()
|
|
5040
5233
|
});
|
|
5041
|
-
var chatPath = { id:
|
|
5234
|
+
var chatPath = { id: z15.string().describe("Workspace ID"), chat_id: z15.string().describe("Chat ID") };
|
|
5042
5235
|
var { provider, model, thinkingLevel, title, message } = forkChatRequestSchema.shape;
|
|
5043
|
-
var createChatToolInputSchema =
|
|
5044
|
-
var forkChatToolInputSchema =
|
|
5045
|
-
var renameChatToolInputSchema =
|
|
5046
|
-
var runCommandToolInputSchema =
|
|
5047
|
-
var environmentMcpPath = { environment_id:
|
|
5048
|
-
var createEnvironmentMcpToolInputSchema =
|
|
5049
|
-
var updateEnvironmentMcpToolInputSchema =
|
|
5236
|
+
var createChatToolInputSchema = z15.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
|
|
5237
|
+
var forkChatToolInputSchema = z15.object({ ...chatPath, provider, model, thinkingLevel, title, message });
|
|
5238
|
+
var renameChatToolInputSchema = z15.object({ ...chatPath, ...updateChatDisplayNameRequestSchema.shape });
|
|
5239
|
+
var runCommandToolInputSchema = z15.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
|
|
5240
|
+
var environmentMcpPath = { environment_id: z15.string().describe("Environment ID") };
|
|
5241
|
+
var createEnvironmentMcpToolInputSchema = z15.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
|
|
5242
|
+
var updateEnvironmentMcpToolInputSchema = z15.object({
|
|
5050
5243
|
...environmentMcpPath,
|
|
5051
|
-
mcp_id:
|
|
5244
|
+
mcp_id: z15.string().describe("MCP ID"),
|
|
5052
5245
|
...updateEnvironmentMcpRequestSchema.shape
|
|
5053
5246
|
});
|
|
5054
5247
|
|
|
5248
|
+
// ../shared/src/user-message-matching.ts
|
|
5249
|
+
function parseTimestampMs(timestamp) {
|
|
5250
|
+
const value = typeof timestamp === "number" ? timestamp : Date.parse(timestamp);
|
|
5251
|
+
return Number.isFinite(value) ? value : 0;
|
|
5252
|
+
}
|
|
5253
|
+
function areUserMessagesWithinMatchWindow(a, b) {
|
|
5254
|
+
return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
|
|
5255
|
+
}
|
|
5256
|
+
|
|
5257
|
+
// ../shared/src/display-message/turns.ts
|
|
5258
|
+
function isCompaction(message2) {
|
|
5259
|
+
return message2.type === "reasoning" && message2.content === COMPACTION_CONTENT;
|
|
5260
|
+
}
|
|
5261
|
+
function isGoalUpdate(message2) {
|
|
5262
|
+
return message2.type === "tool_call" && message2.server === "claude" && message2.tool === GOAL_TOOL_NAME;
|
|
5263
|
+
}
|
|
5264
|
+
|
|
5265
|
+
// ../shared/src/display-message/steps.ts
|
|
5266
|
+
function inputString(input, ...keys) {
|
|
5267
|
+
for (const key of keys) {
|
|
5268
|
+
const value = input?.[key];
|
|
5269
|
+
if (typeof value === "string" && value.trim()) return value;
|
|
5270
|
+
}
|
|
5271
|
+
return void 0;
|
|
5272
|
+
}
|
|
5273
|
+
var COMMAND_PARSE_LIMIT = 4096;
|
|
5274
|
+
function shellPayload(command) {
|
|
5275
|
+
const [first] = parseShellScript(command, null);
|
|
5276
|
+
const flag = first?.wrapper ? first.argv.findIndex((arg, index) => index > 0 && /^-[A-Za-z]*c[A-Za-z]*$/.test(arg)) : -1;
|
|
5277
|
+
return (flag > 0 ? first.argv[flag + 1] : void 0)?.replaceAll(SHELL_OPAQUE, "\u2026") ?? command.trim();
|
|
5278
|
+
}
|
|
5279
|
+
function commandLabel(command) {
|
|
5280
|
+
const lines = shellPayload(command.slice(0, COMMAND_PARSE_LIMIT)).replace(/^cd\s+\S+\s*&&\s*/, "").split("\n").filter((line) => line.trim());
|
|
5281
|
+
const shown = lines.length > 1 && /(["']|<<-?\s*['"]?\w+['"]?)\s*$/.test(lines[0]) ? 2 : 1;
|
|
5282
|
+
const label = lines.slice(0, shown).map((line) => line.trim()).join(" ");
|
|
5283
|
+
return lines.length > shown ? `${label} \u2026` : label;
|
|
5284
|
+
}
|
|
5285
|
+
var BACKGROUND_META = {
|
|
5286
|
+
in_progress: "Running in background",
|
|
5287
|
+
completed: "Done in background",
|
|
5288
|
+
failed: "Failed in background",
|
|
5289
|
+
stopped: "Stopped in background"
|
|
5290
|
+
};
|
|
5291
|
+
var OPERATION_VERBS = {
|
|
5292
|
+
add: ["Creating", "Created", "file-plus"],
|
|
5293
|
+
delete: ["Deleting", "Deleted", "file-x"],
|
|
5294
|
+
update: ["Editing", "Edited", "file-pen"]
|
|
5295
|
+
};
|
|
5296
|
+
function describeMessageSteps(message2, durationMs, background) {
|
|
5297
|
+
const status = getDisplayMessageStatus(message2);
|
|
5298
|
+
const base = {
|
|
5299
|
+
message: message2,
|
|
5300
|
+
running: status === "in_progress",
|
|
5301
|
+
failed: status === "failed",
|
|
5302
|
+
durationMs
|
|
5303
|
+
};
|
|
5304
|
+
switch (message2.type) {
|
|
5305
|
+
case "reasoning":
|
|
5306
|
+
if (isCompaction(message2)) {
|
|
5307
|
+
return [{ ...base, key: message2.id, category: "compact", icon: "fold", live: "Compacting context", done: base.failed ? "Context compaction" : "Compacted context" }];
|
|
5308
|
+
}
|
|
5309
|
+
if (!message2.content.trim()) return [];
|
|
5310
|
+
return [{ ...base, key: message2.id, category: "think", icon: "brain", live: "Thinking", done: "Thought", failed: false, detail: "reasoning" }];
|
|
5311
|
+
case "command": {
|
|
5312
|
+
const policyBlocked = message2.status === "failed" && message2.exitCode == null && Boolean(message2.output?.toLowerCase().includes("blocked by organization policy"));
|
|
5313
|
+
const display = policyBlocked || message2.command.length > COMMAND_PARSE_LIMIT ? null : commandDisplayFromCommand(message2.command);
|
|
5314
|
+
const failed = policyBlocked || base.failed || message2.exitCode != null && message2.exitCode !== 0 || background?.status === "failed";
|
|
5315
|
+
const running = background ? background.status === "in_progress" : base.running;
|
|
5316
|
+
const meta = policyBlocked ? "Blocked by policy" : background ? BACKGROUND_META[background.status] : failed && message2.exitCode != null ? `Exit code ${message2.exitCode}` : void 0;
|
|
5317
|
+
if (display?.title.startsWith("Read") && display.paths.length > 0) {
|
|
5318
|
+
return display.paths.map((path, index) => ({ ...base, key: index ? `${message2.id}-${index}` : message2.id, category: "read", icon: "book", live: "Reading", done: "Read", target: { text: path, path }, meta, running, failed, detail: "shell", background }));
|
|
5319
|
+
}
|
|
5320
|
+
if (display?.title === "Write") {
|
|
5321
|
+
return [{ ...base, key: message2.id, category: "edit", icon: "file-pen", live: "Writing", done: "Wrote", target: { text: display.paths[0], path: display.paths[0] }, meta, running, failed, detail: "shell", background }];
|
|
5322
|
+
}
|
|
5323
|
+
return [{
|
|
5324
|
+
...base,
|
|
5325
|
+
key: message2.id,
|
|
5326
|
+
category: display?.title === "Search" ? "search" : "command",
|
|
5327
|
+
icon: "terminal",
|
|
5328
|
+
live: "Running",
|
|
5329
|
+
done: "Ran",
|
|
5330
|
+
target: { text: commandLabel(message2.command) },
|
|
5331
|
+
meta,
|
|
5332
|
+
running,
|
|
5333
|
+
failed,
|
|
5334
|
+
detail: "shell",
|
|
5335
|
+
background
|
|
5336
|
+
}];
|
|
5337
|
+
}
|
|
5338
|
+
case "patch":
|
|
5339
|
+
return message2.operations.map((operation, index) => {
|
|
5340
|
+
const [live, done, icon] = OPERATION_VERBS[operation.action] ?? OPERATION_VERBS.update;
|
|
5341
|
+
return {
|
|
5342
|
+
...base,
|
|
5343
|
+
key: `${message2.id}-${index}`,
|
|
5344
|
+
category: "edit",
|
|
5345
|
+
icon,
|
|
5346
|
+
live,
|
|
5347
|
+
done,
|
|
5348
|
+
target: { text: operation.moveTo ?? operation.path, path: operation.moveTo ?? operation.path },
|
|
5349
|
+
detail: operation.diff ? "diff" : void 0,
|
|
5350
|
+
operation
|
|
5351
|
+
};
|
|
5352
|
+
});
|
|
5353
|
+
case "file_change":
|
|
5354
|
+
return message2.changes.map((change, index) => {
|
|
5355
|
+
const [live, done, icon] = OPERATION_VERBS[change.kind] ?? OPERATION_VERBS.update;
|
|
5356
|
+
return { ...base, key: `${message2.id}-${index}`, category: "edit", icon, live, done, target: { text: change.path, path: change.path } };
|
|
5357
|
+
});
|
|
5358
|
+
case "web_search":
|
|
5359
|
+
return [{ ...base, key: message2.id, category: "web", icon: "globe", live: "Searching the web for", done: "Searched the web for", target: { text: message2.query } }];
|
|
5360
|
+
case "skill": {
|
|
5361
|
+
if (message2.skillName.startsWith(LEARNED_SKILL_DIR_PREFIX)) {
|
|
5362
|
+
return [{ ...base, key: message2.id, category: "tool", icon: "lightbulb", live: "Using learning", done: "Used learning", target: { text: message2.skillName.slice(LEARNED_SKILL_DIR_PREFIX.length) } }];
|
|
5363
|
+
}
|
|
5364
|
+
return [{ ...base, key: message2.id, category: "tool", icon: "zap", live: "Using skill", done: "Used skill", target: { text: message2.skillName } }];
|
|
5365
|
+
}
|
|
5366
|
+
case "subagent":
|
|
5367
|
+
return [{
|
|
5368
|
+
...base,
|
|
5369
|
+
...background && { running: background.status === "in_progress", failed: background.status === "failed" },
|
|
5370
|
+
key: message2.id,
|
|
5371
|
+
category: "agent",
|
|
5372
|
+
icon: "bot",
|
|
5373
|
+
live: "Running",
|
|
5374
|
+
done: "Ran",
|
|
5375
|
+
target: { text: message2.description, plain: true },
|
|
5376
|
+
background
|
|
5377
|
+
}];
|
|
5378
|
+
case "background_task":
|
|
5379
|
+
if (message2.toolUseId) return [];
|
|
5380
|
+
return [{ ...base, key: message2.id, category: "task", icon: "bell", live: "Running", done: "Ran", target: { text: message2.description ?? message2.summary ?? "background task", plain: true } }];
|
|
5381
|
+
case "tool_call": {
|
|
5382
|
+
const step = describeToolCall(message2, base);
|
|
5383
|
+
return step ? [step] : [];
|
|
5384
|
+
}
|
|
5385
|
+
default:
|
|
5386
|
+
return [];
|
|
5387
|
+
}
|
|
5388
|
+
}
|
|
5389
|
+
var SUBAGENT_STEPS = {
|
|
5390
|
+
[SUBAGENT_MCP_TOOLS.messageAgent]: { icon: "message", live: "Messaging", done: "Messaged" },
|
|
5391
|
+
[SUBAGENT_MCP_TOOLS.waitAgent]: { icon: "clock", live: "Waiting for", done: "Waited for" },
|
|
5392
|
+
[SUBAGENT_MCP_TOOLS.getAgent]: { icon: "search", live: "Checking", done: "Checked" },
|
|
5393
|
+
[SUBAGENT_MCP_TOOLS.deleteAgent]: { icon: "trash", live: "Deleting", done: "Deleted" },
|
|
5394
|
+
[SUBAGENT_MCP_TOOLS.getProviders]: { icon: "list", live: "Listing available providers", done: "Listed available providers" }
|
|
5395
|
+
};
|
|
5396
|
+
var MULTITASK_TOOL_ACTIONS = {
|
|
5397
|
+
[REPLICAS_MCP_TOOLS.spawnSubagent]: "spawn",
|
|
5398
|
+
[REPLICAS_MCP_TOOLS.messageSubagent]: "send",
|
|
5399
|
+
[REPLICAS_MCP_TOOLS.listSubagents]: "list",
|
|
5400
|
+
[REPLICAS_MCP_TOOLS.readSubagent]: "read",
|
|
5401
|
+
[REPLICAS_MCP_TOOLS.archiveSubagent]: "archive"
|
|
5402
|
+
};
|
|
5403
|
+
var INTERNAL_TOOLS = /* @__PURE__ */ new Set(["ToolSearch", "ListMcpResourcesTool", "ReadMcpResourceTool", "TaskOutput", "BashOutput"]);
|
|
5404
|
+
function describeToolCall(message2, base) {
|
|
5405
|
+
const { inputObject: input, filePath } = parseToolCallInput(message2.input);
|
|
5406
|
+
const tool = message2.tool;
|
|
5407
|
+
const key = message2.id;
|
|
5408
|
+
if (INTERNAL_TOOLS.has(tool)) return null;
|
|
5409
|
+
if (isGoalUpdate(message2)) {
|
|
5410
|
+
const objective = inputString(input, "objective");
|
|
5411
|
+
return objective ? { ...base, key, category: "tool", icon: "target", live: "Setting goal", done: "Set goal", target: { text: objective, plain: true } } : { ...base, key, category: "tool", icon: "target", live: "Clearing goal", done: "Cleared goal" };
|
|
5412
|
+
}
|
|
5413
|
+
const subagentTool = subagentToolName(message2);
|
|
5414
|
+
if (subagentTool && isSubagentMcpToolName(subagentTool)) {
|
|
5415
|
+
const failed = base.failed || typeof parseToolCallInput(message2.output).inputObject?.error === "string";
|
|
5416
|
+
if (subagentTool === SUBAGENT_MCP_TOOLS.spawnAgent) {
|
|
5417
|
+
return { ...base, key, category: "agent", icon: "bot", live: "Running", done: "Started", failed, target: { text: inputString(input, "title", "prompt") ?? "subagent", plain: true } };
|
|
5418
|
+
}
|
|
5419
|
+
const chatId = subagentChatId(message2);
|
|
5420
|
+
const provider2 = typeof input?.provider === "string" && isValidAgentProvider(input.provider) ? input.provider : null;
|
|
5421
|
+
const agent = inputString(input, "title") ?? chatId?.slice(0, 8) ?? (provider2 ? getProviderDisplayName(provider2) : void 0);
|
|
5422
|
+
return { ...base, key, category: "tool", ...SUBAGENT_STEPS[subagentTool], failed, target: agent ? { text: agent, plain: true } : void 0, detail: "subagent" };
|
|
5423
|
+
}
|
|
5424
|
+
const mcp = parseMcpToolName(tool);
|
|
5425
|
+
const multitaskAction = (mcp?.server ?? message2.server) === REPLICAS_MCP_SERVER_NAME ? MULTITASK_TOOL_ACTIONS[mcp?.tool ?? tool] : void 0;
|
|
5426
|
+
if (multitaskAction) {
|
|
5427
|
+
const step = {
|
|
5428
|
+
...base,
|
|
5429
|
+
key,
|
|
5430
|
+
failed: base.failed || Boolean(message2.output?.startsWith("Error:")),
|
|
5431
|
+
multitask: { action: multitaskAction, name: inputString(input, "name"), agentId: inputString(input, "agent_id"), text: inputString(input, "prompt", "message") }
|
|
5432
|
+
};
|
|
5433
|
+
if (multitaskAction === "spawn") return { ...step, category: "agent", icon: "network", live: "Spawning", done: "Spawned", detail: "multitask" };
|
|
5434
|
+
if (multitaskAction === "send") return { ...step, category: "agent", icon: "message", live: "Messaging", done: "Messaged", detail: "multitask" };
|
|
5435
|
+
if (multitaskAction === "archive") return { ...step, category: "tool", icon: "archive", live: "Archiving subagent", done: "Archived subagent", detail: "io" };
|
|
5436
|
+
return multitaskAction === "list" ? { ...step, category: "tool", icon: "network", live: "Listing subagents", done: "Listed subagents", detail: "io" } : { ...step, category: "tool", icon: "network", live: "Reading subagent response", done: "Read subagent response", detail: "io" };
|
|
5437
|
+
}
|
|
5438
|
+
const shellCommand = /^(bash|shell|run_shell_command)$/i.test(tool) ? inputString(input, "command", "cmd") : void 0;
|
|
5439
|
+
if (shellCommand) {
|
|
5440
|
+
return { ...base, key, category: "command", icon: "terminal", live: "Running", done: "Ran", target: { text: commandLabel(shellCommand) }, detail: "io" };
|
|
5441
|
+
}
|
|
5442
|
+
if (/^(read|read_file|view)$/i.test(tool) && filePath) {
|
|
5443
|
+
return { ...base, key, category: "read", icon: "book", live: "Reading", done: "Read", target: { text: filePath, path: filePath }, detail: "io" };
|
|
5444
|
+
}
|
|
5445
|
+
if (/^(grep|glob|search|find|codebase_search|file_search)$/i.test(tool)) {
|
|
5446
|
+
const scope = inputString(input, "path", "glob", "include", "target_directories");
|
|
5447
|
+
return {
|
|
5448
|
+
...base,
|
|
5449
|
+
key,
|
|
5450
|
+
category: "search",
|
|
5451
|
+
icon: "search",
|
|
5452
|
+
live: "Searching for",
|
|
5453
|
+
done: "Searched for",
|
|
5454
|
+
target: { text: inputString(input, "pattern", "query", "glob_pattern", "globPattern") ?? tool },
|
|
5455
|
+
scope,
|
|
5456
|
+
detail: message2.output ? "results" : void 0
|
|
5457
|
+
};
|
|
5458
|
+
}
|
|
5459
|
+
if (/^(ls|list_dir|list_directory)$/i.test(tool)) {
|
|
5460
|
+
const path = inputString(input, "path", "relative_workspace_path") ?? ".";
|
|
5461
|
+
return { ...base, key, category: "read", icon: "folder", live: "Listing", done: "Listed", target: { text: path, path }, detail: "io" };
|
|
5462
|
+
}
|
|
5463
|
+
if (/^(webfetch|web_fetch|fetch)$/i.test(tool)) {
|
|
5464
|
+
return { ...base, key, category: "web", icon: "globe", live: "Fetching", done: "Fetched", target: { text: inputString(input, "url") ?? tool }, detail: "io" };
|
|
5465
|
+
}
|
|
5466
|
+
if (/^(websearch|web_search)$/i.test(tool)) {
|
|
5467
|
+
return { ...base, key, category: "web", icon: "globe", live: "Searching the web for", done: "Searched the web for", target: { text: inputString(input, "query") ?? tool } };
|
|
5468
|
+
}
|
|
5469
|
+
if (/^(edit|write|multiedit|notebookedit|apply_patch|str_replace)/i.test(tool) && filePath) {
|
|
5470
|
+
return { ...base, key, category: "edit", icon: "file-pen", live: "Editing", done: "Edited", target: { text: filePath, path: filePath }, detail: "io" };
|
|
5471
|
+
}
|
|
5472
|
+
return {
|
|
5473
|
+
...base,
|
|
5474
|
+
key,
|
|
5475
|
+
category: "tool",
|
|
5476
|
+
icon: "wrench",
|
|
5477
|
+
live: "Calling",
|
|
5478
|
+
done: "Called",
|
|
5479
|
+
target: { text: mcp?.tool ?? tool },
|
|
5480
|
+
scope: mcp?.server ?? (message2.server && message2.server !== "claude" ? message2.server : void 0),
|
|
5481
|
+
detail: message2.input || message2.output ? "io" : void 0
|
|
5482
|
+
};
|
|
5483
|
+
}
|
|
5484
|
+
|
|
5055
5485
|
// ../shared/src/routes/preferences.ts
|
|
5056
5486
|
var EMPTY_AGENT_DEFAULT_SETTINGS = {
|
|
5057
5487
|
agent_provider: null,
|
|
@@ -6929,19 +7359,6 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6929
7359
|
return messages.filter((_, index) => !staleIndexes.has(index));
|
|
6930
7360
|
}
|
|
6931
7361
|
|
|
6932
|
-
// ../shared/src/display-message/parsers/mcp.ts
|
|
6933
|
-
function parseMcpToolName(name) {
|
|
6934
|
-
const prefix = "mcp__";
|
|
6935
|
-
if (!name.startsWith(prefix)) return null;
|
|
6936
|
-
const rest = name.slice(prefix.length);
|
|
6937
|
-
const sep = rest.indexOf("__");
|
|
6938
|
-
if (sep <= 0) return null;
|
|
6939
|
-
const server = rest.slice(0, sep);
|
|
6940
|
-
const tool = rest.slice(sep + 2);
|
|
6941
|
-
if (!server || !tool) return null;
|
|
6942
|
-
return { server, tool };
|
|
6943
|
-
}
|
|
6944
|
-
|
|
6945
7362
|
// ../shared/src/display-message/parsers/index.ts
|
|
6946
7363
|
var INTERRUPTION_DEDUP_WINDOW_MS = 15e3;
|
|
6947
7364
|
function parseAgentEvents(events, agentType) {
|
|
@@ -7838,7 +8255,7 @@ var MOTHERSHIP_PRESET_ICONS = [
|
|
|
7838
8255
|
];
|
|
7839
8256
|
|
|
7840
8257
|
// ../shared/src/replicas-config.ts
|
|
7841
|
-
import { parse as
|
|
8258
|
+
import { parse as parseYaml2 } from "yaml";
|
|
7842
8259
|
|
|
7843
8260
|
// ../shared/src/hook-config.ts
|
|
7844
8261
|
function resolveHookConfig(value) {
|
|
@@ -7966,7 +8383,7 @@ function parseReplicasConfigString(content, filename) {
|
|
|
7966
8383
|
const isYaml = filename.endsWith(".yaml") || filename.endsWith(".yml");
|
|
7967
8384
|
let parsed;
|
|
7968
8385
|
if (isYaml) {
|
|
7969
|
-
parsed =
|
|
8386
|
+
parsed = parseYaml2(content);
|
|
7970
8387
|
} else {
|
|
7971
8388
|
parsed = JSON.parse(content);
|
|
7972
8389
|
}
|
|
@@ -8178,7 +8595,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
|
|
|
8178
8595
|
};
|
|
8179
8596
|
|
|
8180
8597
|
// ../shared/src/routes/command-protection.ts
|
|
8181
|
-
import { z as
|
|
8598
|
+
import { z as z16 } from "zod";
|
|
8182
8599
|
|
|
8183
8600
|
// ../shared/src/git-invocations.ts
|
|
8184
8601
|
var COMMIT_VALUE_OPTIONS = /* @__PURE__ */ new Set(["message", "file", "trailer", "reuse-message", "reedit-message", "fixup", "squash", "template", "author", "date", "cleanup", "pathspec-from-file"]);
|
|
@@ -8269,27 +8686,27 @@ function findCheckoutTarget(args) {
|
|
|
8269
8686
|
}
|
|
8270
8687
|
|
|
8271
8688
|
// ../shared/src/routes/command-protection.ts
|
|
8272
|
-
var commandProtectionRepoStateSchema =
|
|
8273
|
-
branch:
|
|
8274
|
-
defaultBranch:
|
|
8275
|
-
pushBranch:
|
|
8276
|
-
pushConfig:
|
|
8277
|
-
headMessage:
|
|
8278
|
-
mergeInProgress:
|
|
8689
|
+
var commandProtectionRepoStateSchema = z16.object({
|
|
8690
|
+
branch: z16.string().nullable(),
|
|
8691
|
+
defaultBranch: z16.string().nullable(),
|
|
8692
|
+
pushBranch: z16.string().nullable(),
|
|
8693
|
+
pushConfig: z16.string().nullable(),
|
|
8694
|
+
headMessage: z16.string().nullable(),
|
|
8695
|
+
mergeInProgress: z16.boolean().optional()
|
|
8279
8696
|
});
|
|
8280
|
-
var commandProtectionEvaluateRequestSchema =
|
|
8281
|
-
provider:
|
|
8282
|
-
source:
|
|
8283
|
-
toolName:
|
|
8284
|
-
toolInput:
|
|
8285
|
-
command:
|
|
8286
|
-
cwd:
|
|
8287
|
-
toolUseId:
|
|
8697
|
+
var commandProtectionEvaluateRequestSchema = z16.object({
|
|
8698
|
+
provider: z16.enum(["claude", "codex", "cursor", "opencode", "pi"]),
|
|
8699
|
+
source: z16.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
|
|
8700
|
+
toolName: z16.string(),
|
|
8701
|
+
toolInput: z16.unknown(),
|
|
8702
|
+
command: z16.string().nullish(),
|
|
8703
|
+
cwd: z16.string().nullish(),
|
|
8704
|
+
toolUseId: z16.string().nullish(),
|
|
8288
8705
|
// Read by the engine before the command runs, keyed by absolute path, so the
|
|
8289
8706
|
// policy can see branches and commit messages the command text only references.
|
|
8290
|
-
gitContext:
|
|
8291
|
-
repos:
|
|
8292
|
-
messageFiles:
|
|
8707
|
+
gitContext: z16.object({
|
|
8708
|
+
repos: z16.record(z16.string(), commandProtectionRepoStateSchema),
|
|
8709
|
+
messageFiles: z16.record(z16.string(), z16.string())
|
|
8293
8710
|
}).optional()
|
|
8294
8711
|
});
|
|
8295
8712
|
var COMMAND_PROTECTION_COMMAND_KEYS = ["command", "cmd", "script", "query", "endpoint", "path", "url", "mutation"];
|
|
@@ -8486,89 +8903,89 @@ function shouldRefreshPullRequests(toolName, toolInput) {
|
|
|
8486
8903
|
}
|
|
8487
8904
|
|
|
8488
8905
|
// ../shared/src/routes/linear.ts
|
|
8489
|
-
import { z as
|
|
8490
|
-
var linearSessionMetadataSchema =
|
|
8491
|
-
via_mothership:
|
|
8492
|
-
issue_id:
|
|
8493
|
-
issue_identifier:
|
|
8494
|
-
issue_title:
|
|
8495
|
-
issue_description:
|
|
8496
|
-
issue_url:
|
|
8497
|
-
comment_id:
|
|
8498
|
-
comment_body:
|
|
8499
|
-
triggered_by_id:
|
|
8500
|
-
triggered_by_name:
|
|
8501
|
-
triggered_by_email:
|
|
8502
|
-
linear_workspace_id:
|
|
8503
|
-
creator_id:
|
|
8504
|
-
creator_name:
|
|
8505
|
-
creator_email:
|
|
8506
|
-
assignee_id:
|
|
8507
|
-
assignee_name:
|
|
8508
|
-
assignee_email:
|
|
8509
|
-
issue_state:
|
|
8510
|
-
parent_issue:
|
|
8511
|
-
id:
|
|
8512
|
-
identifier:
|
|
8513
|
-
title:
|
|
8514
|
-
description:
|
|
8906
|
+
import { z as z17 } from "zod";
|
|
8907
|
+
var linearSessionMetadataSchema = z17.object({
|
|
8908
|
+
via_mothership: z17.boolean().optional(),
|
|
8909
|
+
issue_id: z17.string(),
|
|
8910
|
+
issue_identifier: z17.string(),
|
|
8911
|
+
issue_title: z17.string(),
|
|
8912
|
+
issue_description: z17.string(),
|
|
8913
|
+
issue_url: z17.string(),
|
|
8914
|
+
comment_id: z17.string(),
|
|
8915
|
+
comment_body: z17.string(),
|
|
8916
|
+
triggered_by_id: z17.string().optional(),
|
|
8917
|
+
triggered_by_name: z17.string().optional(),
|
|
8918
|
+
triggered_by_email: z17.string().optional(),
|
|
8919
|
+
linear_workspace_id: z17.string().optional(),
|
|
8920
|
+
creator_id: z17.string().optional(),
|
|
8921
|
+
creator_name: z17.string().optional(),
|
|
8922
|
+
creator_email: z17.string().optional(),
|
|
8923
|
+
assignee_id: z17.string().optional(),
|
|
8924
|
+
assignee_name: z17.string().optional(),
|
|
8925
|
+
assignee_email: z17.string().optional(),
|
|
8926
|
+
issue_state: z17.string().optional(),
|
|
8927
|
+
parent_issue: z17.object({
|
|
8928
|
+
id: z17.string(),
|
|
8929
|
+
identifier: z17.string(),
|
|
8930
|
+
title: z17.string(),
|
|
8931
|
+
description: z17.string().nullable()
|
|
8515
8932
|
}).optional(),
|
|
8516
|
-
workspace:
|
|
8517
|
-
id:
|
|
8518
|
-
coding_agent:
|
|
8519
|
-
task_description:
|
|
8520
|
-
created_at:
|
|
8933
|
+
workspace: z17.object({
|
|
8934
|
+
id: z17.string(),
|
|
8935
|
+
coding_agent: z17.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
|
|
8936
|
+
task_description: z17.string(),
|
|
8937
|
+
created_at: z17.string()
|
|
8521
8938
|
}).optional()
|
|
8522
8939
|
});
|
|
8523
8940
|
|
|
8524
8941
|
// ../shared/src/routes/mothership.ts
|
|
8525
|
-
import { z as
|
|
8942
|
+
import { z as z18 } from "zod";
|
|
8526
8943
|
var MOTHERSHIP_LINEAR_ACTIONS = ["ask", "start"];
|
|
8527
|
-
var mothershipLinearSessionIntentRequestSchema =
|
|
8528
|
-
comment_id:
|
|
8529
|
-
action:
|
|
8944
|
+
var mothershipLinearSessionIntentRequestSchema = z18.object({
|
|
8945
|
+
comment_id: z18.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
|
|
8946
|
+
action: z18.enum(MOTHERSHIP_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it is the complete task prompt.")
|
|
8530
8947
|
});
|
|
8531
|
-
var mothershipLinearStartRequestSchema =
|
|
8532
|
-
issue_id:
|
|
8533
|
-
agent_session_id:
|
|
8534
|
-
prompt:
|
|
8948
|
+
var mothershipLinearStartRequestSchema = z18.object({
|
|
8949
|
+
issue_id: z18.string().describe("Linear issue id from the envelope's `issue_id`."),
|
|
8950
|
+
agent_session_id: z18.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
|
|
8951
|
+
prompt: z18.string().trim().min(1).describe("Complete task prompt for the coding workspace.")
|
|
8535
8952
|
});
|
|
8536
|
-
var slackChannelIdSchema =
|
|
8537
|
-
var slackThreadTsSchema =
|
|
8538
|
-
var mothershipSlackSpawnRequestSchema =
|
|
8953
|
+
var slackChannelIdSchema = z18.string().describe("Slack channel id from the envelope's `channel_id`.");
|
|
8954
|
+
var slackThreadTsSchema = z18.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
|
|
8955
|
+
var mothershipSlackSpawnRequestSchema = z18.object({
|
|
8539
8956
|
channel_id: slackChannelIdSchema,
|
|
8540
8957
|
thread_ts: slackThreadTsSchema,
|
|
8541
|
-
message_ts:
|
|
8542
|
-
user_id:
|
|
8543
|
-
prompt:
|
|
8544
|
-
environment_id:
|
|
8958
|
+
message_ts: z18.string().describe("Timestamp of the Slack message that asked for the work (the envelope's `message_ts`). The server verifies this message and its author."),
|
|
8959
|
+
user_id: z18.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
|
|
8960
|
+
prompt: z18.string().describe("Complete task for the new workspace, written so it stands on its own."),
|
|
8961
|
+
environment_id: z18.string().optional().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`. Pass it only when clearly confident it fits; omit it to let routing choose. If routing cannot choose, the call fails and nothing is posted, so pick one or ask the person.`)
|
|
8545
8962
|
});
|
|
8546
|
-
var mothershipSlackRelayRequestSchema =
|
|
8963
|
+
var mothershipSlackRelayRequestSchema = z18.object({
|
|
8547
8964
|
channel_id: slackChannelIdSchema,
|
|
8548
8965
|
thread_ts: slackThreadTsSchema,
|
|
8549
|
-
message:
|
|
8550
|
-
user_id:
|
|
8551
|
-
queue:
|
|
8966
|
+
message: z18.string().describe("The follow-up to deliver, combining every fresh message that belongs to this update."),
|
|
8967
|
+
user_id: z18.string().optional().describe("Slack user id of the follow-up's author (the envelope's `user_id`), so it is attributed to them. Defaults to the thread's original requester."),
|
|
8968
|
+
queue: z18.boolean().optional().describe("Set true only when the person explicitly asked for this to happen after the current task finishes. Delivers behind the active turn instead of interrupting it.")
|
|
8552
8969
|
});
|
|
8553
|
-
var mothershipSlackConfirmationSchema =
|
|
8554
|
-
confirmation_channel_id:
|
|
8555
|
-
confirmation_thread_ts:
|
|
8556
|
-
confirmation_message_ts:
|
|
8557
|
-
confirmation_user_id:
|
|
8970
|
+
var mothershipSlackConfirmationSchema = z18.object({
|
|
8971
|
+
confirmation_channel_id: z18.string().describe("`channel_id` from the envelope of the Slack message that asked for or accepted this."),
|
|
8972
|
+
confirmation_thread_ts: z18.string().describe("`thread_ts` from that message's envelope."),
|
|
8973
|
+
confirmation_message_ts: z18.string().describe("`message_ts` from that message's envelope."),
|
|
8974
|
+
confirmation_user_id: z18.string().describe("`user_id` from that message's envelope.")
|
|
8558
8975
|
});
|
|
8559
8976
|
var mothershipAutomationToolInputSchema = automationToolInputSchema.extend(mothershipSlackConfirmationSchema.shape);
|
|
8560
8977
|
var mothershipSaveChannelPresetToolInputSchema = mothershipSlackConfirmationSchema.extend({
|
|
8561
|
-
preset_id:
|
|
8562
|
-
name:
|
|
8563
|
-
description:
|
|
8564
|
-
icon:
|
|
8565
|
-
instructions:
|
|
8978
|
+
preset_id: z18.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
|
|
8979
|
+
name: z18.string().trim().min(1).max(MOTHERSHIP_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
|
|
8980
|
+
description: z18.string().optional().describe("One-line summary shown in settings."),
|
|
8981
|
+
icon: z18.enum(MOTHERSHIP_PRESET_ICONS).optional(),
|
|
8982
|
+
instructions: z18.string().optional().describe("Complete preset instructions; replaces the existing text. Required when creating.")
|
|
8566
8983
|
});
|
|
8567
8984
|
var mothershipUpdateChannelSettingsToolInputSchema = mothershipSlackConfirmationSchema.extend({
|
|
8568
|
-
source:
|
|
8569
|
-
external_id:
|
|
8570
|
-
preset_id:
|
|
8571
|
-
instructions:
|
|
8985
|
+
source: z18.enum(MOTHERSHIP_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
|
|
8986
|
+
external_id: z18.string().describe(`Slack channel id or Linear team id of an already monitored source, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`),
|
|
8987
|
+
preset_id: z18.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
|
|
8988
|
+
instructions: z18.string().nullable().optional().describe("Complete channel-specific instructions, applied after the preset; replaces the existing text. `null` clears them. Omit to keep them.")
|
|
8572
8989
|
});
|
|
8573
8990
|
|
|
8574
8991
|
// ../shared/src/routes/plugin-catalog.ts
|
|
@@ -8893,45 +9310,45 @@ var workspaceAttentionDoneClientStateKey = orgUserClientStateKey(WORKSPACE_ATTEN
|
|
|
8893
9310
|
var workspaceStagesClientStateKey = orgUserClientStateKey(WORKSPACE_STAGES_CLIENT_STATE_KEY_PREFIX);
|
|
8894
9311
|
|
|
8895
9312
|
// ../shared/src/routes/workspace-events.ts
|
|
8896
|
-
import { z as
|
|
8897
|
-
var workspaceChangedEventSchema =
|
|
8898
|
-
|
|
8899
|
-
type:
|
|
8900
|
-
workspaceId:
|
|
8901
|
-
completion:
|
|
8902
|
-
workspaceName:
|
|
8903
|
-
completedAt:
|
|
8904
|
-
processing:
|
|
9313
|
+
import { z as z19 } from "zod";
|
|
9314
|
+
var workspaceChangedEventSchema = z19.discriminatedUnion("type", [
|
|
9315
|
+
z19.object({
|
|
9316
|
+
type: z19.literal("workspace.changed"),
|
|
9317
|
+
workspaceId: z19.string(),
|
|
9318
|
+
completion: z19.object({
|
|
9319
|
+
workspaceName: z19.string(),
|
|
9320
|
+
completedAt: z19.string(),
|
|
9321
|
+
processing: z19.boolean().optional()
|
|
8905
9322
|
}).optional(),
|
|
8906
|
-
ts:
|
|
9323
|
+
ts: z19.string()
|
|
8907
9324
|
}),
|
|
8908
|
-
|
|
8909
|
-
type:
|
|
8910
|
-
workspaceId:
|
|
8911
|
-
chatId:
|
|
8912
|
-
ts:
|
|
9325
|
+
z19.object({
|
|
9326
|
+
type: z19.literal("workspace.chat.changed"),
|
|
9327
|
+
workspaceId: z19.string(),
|
|
9328
|
+
chatId: z19.string(),
|
|
9329
|
+
ts: z19.string()
|
|
8913
9330
|
}),
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
type:
|
|
8917
|
-
workspaceId:
|
|
8918
|
-
ts:
|
|
9331
|
+
z19.object({ type: z19.literal("presence.changed"), ts: z19.string() }),
|
|
9332
|
+
z19.object({
|
|
9333
|
+
type: z19.literal("mobile-testing.changed"),
|
|
9334
|
+
workspaceId: z19.string(),
|
|
9335
|
+
ts: z19.string()
|
|
8919
9336
|
})
|
|
8920
9337
|
]);
|
|
8921
9338
|
|
|
8922
9339
|
// ../shared/src/routes/presence.ts
|
|
8923
|
-
import { z as
|
|
8924
|
-
var presenceStatusSchema =
|
|
8925
|
-
var presenceLocationSchema =
|
|
8926
|
-
workspaceId:
|
|
9340
|
+
import { z as z20 } from "zod";
|
|
9341
|
+
var presenceStatusSchema = z20.enum(["online", "typing"]);
|
|
9342
|
+
var presenceLocationSchema = z20.object({
|
|
9343
|
+
workspaceId: z20.string().optional()
|
|
8927
9344
|
});
|
|
8928
|
-
var presenceEntrySchema =
|
|
8929
|
-
userId:
|
|
9345
|
+
var presenceEntrySchema = z20.object({
|
|
9346
|
+
userId: z20.string(),
|
|
8930
9347
|
status: presenceStatusSchema,
|
|
8931
9348
|
location: presenceLocationSchema,
|
|
8932
|
-
ts:
|
|
9349
|
+
ts: z20.string()
|
|
8933
9350
|
});
|
|
8934
|
-
var updatePresenceRequestSchema =
|
|
9351
|
+
var updatePresenceRequestSchema = z20.object({
|
|
8935
9352
|
status: presenceStatusSchema,
|
|
8936
9353
|
location: presenceLocationSchema.optional()
|
|
8937
9354
|
});
|
|
@@ -9213,34 +9630,6 @@ function parseChatTranscriptArtifact(value) {
|
|
|
9213
9630
|
};
|
|
9214
9631
|
}
|
|
9215
9632
|
|
|
9216
|
-
// ../shared/src/learned-skills.ts
|
|
9217
|
-
import { z as z20 } from "zod";
|
|
9218
|
-
|
|
9219
|
-
// ../shared/src/frontmatter.ts
|
|
9220
|
-
import { parse as parseYaml2 } from "yaml";
|
|
9221
|
-
function parseFrontmatter(content) {
|
|
9222
|
-
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
|
|
9223
|
-
if (!match) return {};
|
|
9224
|
-
try {
|
|
9225
|
-
const parsed = parseYaml2(match[1]);
|
|
9226
|
-
if (typeof parsed !== "object" || parsed === null) return {};
|
|
9227
|
-
return {
|
|
9228
|
-
..."name" in parsed && typeof parsed.name === "string" ? { name: parsed.name.trim() } : {},
|
|
9229
|
-
..."description" in parsed && typeof parsed.description === "string" ? { description: parsed.description.trim() } : {}
|
|
9230
|
-
};
|
|
9231
|
-
} catch {
|
|
9232
|
-
return {};
|
|
9233
|
-
}
|
|
9234
|
-
}
|
|
9235
|
-
|
|
9236
|
-
// ../shared/src/learned-skills.ts
|
|
9237
|
-
var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
|
|
9238
|
-
var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
|
|
9239
|
-
var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
|
|
9240
|
-
var learnedSkillsManifestSchema = z20.object({
|
|
9241
|
-
skills: z20.array(z20.object({ name: z20.string(), sha256: z20.string() }))
|
|
9242
|
-
});
|
|
9243
|
-
|
|
9244
9633
|
// ../shared/src/skill-registry.ts
|
|
9245
9634
|
var SKILL_REGISTRY_MANIFEST_VERSION = 1;
|
|
9246
9635
|
function isSkillRegistryManifest(value) {
|
|
@@ -9377,18 +9766,22 @@ export {
|
|
|
9377
9766
|
paginateChatHistory,
|
|
9378
9767
|
coerceBackgroundTaskPayload,
|
|
9379
9768
|
planItemsFromMessage,
|
|
9380
|
-
getDisplayMessageActivity,
|
|
9381
9769
|
fileContentDiff,
|
|
9382
9770
|
skillNamesFromCommand,
|
|
9383
|
-
|
|
9771
|
+
SUBAGENT_MCP_SERVER_NAME,
|
|
9772
|
+
SUBAGENT_MCP_TOOLS,
|
|
9773
|
+
SUBAGENT_MCP_TOOL_NAMES,
|
|
9774
|
+
parseMcpToolName,
|
|
9775
|
+
parseFrontmatter,
|
|
9776
|
+
SANDBOX_SKILL_DIRS,
|
|
9777
|
+
LEARNED_SKILLS_MANIFEST_PATH,
|
|
9778
|
+
LEARNED_SKILL_DIR_PREFIX,
|
|
9779
|
+
learnedSkillsManifestSchema,
|
|
9780
|
+
createUuidFromHex,
|
|
9384
9781
|
isGitHubUrl,
|
|
9385
9782
|
parseCodeHostPrUrl,
|
|
9386
9783
|
decodePathSegments,
|
|
9387
9784
|
buildCodeHostPrUrl,
|
|
9388
|
-
createUuidFromHex,
|
|
9389
|
-
SUBAGENT_MCP_SERVER_NAME,
|
|
9390
|
-
SUBAGENT_MCP_TOOLS,
|
|
9391
|
-
SUBAGENT_MCP_TOOL_NAMES,
|
|
9392
9785
|
WORKSPACE_IDENTITY_AUDIENCE,
|
|
9393
9786
|
AWS_SOURCE_IDENTITY_CLAIM,
|
|
9394
9787
|
IDENTITY_PROXY_PORT,
|
|
@@ -9398,10 +9791,12 @@ export {
|
|
|
9398
9791
|
workspaceTokenResponseSchema,
|
|
9399
9792
|
legacyWorkspaceTokenBundleSchema,
|
|
9400
9793
|
engineMcpOAuthTokenResponseSchema,
|
|
9401
|
-
SANDBOX_SKILL_DIRS,
|
|
9402
9794
|
HISTORY_ROOT,
|
|
9403
9795
|
HISTORY_INDEX_FILENAME,
|
|
9404
9796
|
TERMINAL_RTC_ICE_SERVER,
|
|
9797
|
+
areUserMessagesWithinMatchWindow,
|
|
9798
|
+
isCompaction,
|
|
9799
|
+
describeMessageSteps,
|
|
9405
9800
|
REPLICAS_INSTRUCTIONS_TAG,
|
|
9406
9801
|
wrapInTag,
|
|
9407
9802
|
extractErrorText,
|
|
@@ -9412,7 +9807,6 @@ export {
|
|
|
9412
9807
|
coerceClaudeResultPayload,
|
|
9413
9808
|
stripAgentDiagnosticErrors,
|
|
9414
9809
|
isClaudeResultError,
|
|
9415
|
-
parseMcpToolName,
|
|
9416
9810
|
parseAgentEvents,
|
|
9417
9811
|
parseDisplayMessages,
|
|
9418
9812
|
extractFinalResponse,
|
|
@@ -9491,10 +9885,6 @@ export {
|
|
|
9491
9885
|
readJsonlPage,
|
|
9492
9886
|
normalizeChatTranscriptMetadata,
|
|
9493
9887
|
parseChatTranscriptArtifact,
|
|
9494
|
-
parseFrontmatter,
|
|
9495
|
-
LEARNED_SKILLS_MANIFEST_PATH,
|
|
9496
|
-
LEARNED_SKILL_DIR_PREFIX,
|
|
9497
|
-
learnedSkillsManifestSchema,
|
|
9498
9888
|
readSseStream,
|
|
9499
9889
|
isSkillRegistryManifest
|
|
9500
9890
|
};
|