replicas-engine 0.1.1118 → 0.1.1120
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-NAVM3BKA.js → asp-host-4QH3XVXS.js} +5 -5
- package/dist/src/{chunk-HVWDNPHT.js → chunk-5XAQN5DP.js} +6 -6
- package/dist/src/{chunk-KYXXP4IF.js → chunk-646TX4O5.js} +1 -1
- package/dist/src/{chunk-MTP3S2LT.js → chunk-F7Z4EDBL.js} +1 -380
- package/dist/src/{chunk-Z5TOQDLX.js → chunk-IWQU3AIP.js} +1 -1
- package/dist/src/{chunk-FPITB6MD.js → chunk-OZIDIK2A.js} +2 -2
- package/dist/src/{chunk-XL7SGQND.js → chunk-RNZEQTP5.js} +3 -3
- package/dist/src/{chunk-Y47Q737L.js → chunk-YHC273BI.js} +2 -2
- package/dist/src/{chunk-P22VSOED.js → chunk-ZBPD3KGN.js} +2 -2
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +4 -4
- package/dist/src/index.js +155 -287
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
listRunningCodexModels,
|
|
9
9
|
restartCodexAspHost,
|
|
10
10
|
restartCodexAspHostIfRunning
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-5XAQN5DP.js";
|
|
12
|
+
import "./chunk-ZBPD3KGN.js";
|
|
13
|
+
import "./chunk-RNZEQTP5.js";
|
|
14
|
+
import "./chunk-646TX4O5.js";
|
|
15
15
|
import "./chunk-UZSNFLDQ.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-F7Z4EDBL.js";
|
|
17
17
|
import "./chunk-VEQXQN22.js";
|
|
18
18
|
export {
|
|
19
19
|
CODEX_ULTRAFAST_SERVICE_TIER,
|
|
@@ -10,15 +10,15 @@ import {
|
|
|
10
10
|
resolveDiffBase,
|
|
11
11
|
runGitCommand,
|
|
12
12
|
setAgentCredentialSnapshot
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZBPD3KGN.js";
|
|
14
14
|
import {
|
|
15
15
|
AppServerProcess,
|
|
16
16
|
buildCodexAgentEnv
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-RNZEQTP5.js";
|
|
18
18
|
import {
|
|
19
19
|
SUBPROCESS_MAX_BUFFER,
|
|
20
20
|
execFileAsync
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-646TX4O5.js";
|
|
22
22
|
import {
|
|
23
23
|
isRecord
|
|
24
24
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
resolveOpenAICompatibleModelsUrl,
|
|
56
56
|
splitMothershipInstructions,
|
|
57
57
|
withTimeout
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-F7Z4EDBL.js";
|
|
59
59
|
|
|
60
60
|
// src/managers/codex-token-manager.ts
|
|
61
61
|
import { promises as fs } from "fs";
|
|
@@ -291,7 +291,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
291
291
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
292
292
|
await this.applyCredentialsResponse(data);
|
|
293
293
|
setAgentCredentialSnapshot("codex", data);
|
|
294
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
294
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-4QH3XVXS.js");
|
|
295
295
|
await restartCodexAspHostIfRunning2();
|
|
296
296
|
});
|
|
297
297
|
await this.start(true);
|
|
@@ -312,7 +312,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
312
312
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
313
313
|
await this.applyCredentialsResponse(data);
|
|
314
314
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
315
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
315
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-4QH3XVXS.js");
|
|
316
316
|
await restartCodexAspHostIfRunning2();
|
|
317
317
|
}
|
|
318
318
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
HOOK_EXEC_MAX_BUFFER_BYTES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-F7Z4EDBL.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -1554,8 +1554,7 @@ var sendChatMessageRequestSchema = z4.object({
|
|
|
1554
1554
|
senderDisplayName: z4.string().optional(),
|
|
1555
1555
|
senderAvatarUrl: z4.string().optional(),
|
|
1556
1556
|
errorNotificationTarget: integrationErrorNotificationTargetSchema.optional(),
|
|
1557
|
-
errorNotificationTargets: z4.array(integrationErrorNotificationTargetSchema).optional()
|
|
1558
|
-
streamSlackActivity: z4.boolean().optional()
|
|
1557
|
+
errorNotificationTargets: z4.array(integrationErrorNotificationTargetSchema).optional()
|
|
1559
1558
|
}).passthrough();
|
|
1560
1559
|
function isChatMessageSender(value) {
|
|
1561
1560
|
return isRecord(value) && (value.messageId === void 0 || typeof value.messageId === "string") && typeof value.senderUserId === "string" && typeof value.senderEmail === "string" && typeof value.recordedAt === "string";
|
|
@@ -1803,12 +1802,6 @@ var SUBAGENT_MCP_TOOLS = {
|
|
|
1803
1802
|
deleteAgent: "delete_agent"
|
|
1804
1803
|
};
|
|
1805
1804
|
var SUBAGENT_MCP_TOOL_NAMES = Object.values(SUBAGENT_MCP_TOOLS);
|
|
1806
|
-
function isSubagentMcpToolName(tool) {
|
|
1807
|
-
return SUBAGENT_MCP_TOOL_NAMES.some((name) => name === tool);
|
|
1808
|
-
}
|
|
1809
|
-
function isSubagentMcpServerName(server) {
|
|
1810
|
-
return server === SUBAGENT_MCP_SERVER_NAME;
|
|
1811
|
-
}
|
|
1812
1805
|
|
|
1813
1806
|
// ../shared/src/workspace-identity.ts
|
|
1814
1807
|
import { z as z5 } from "zod";
|
|
@@ -2773,16 +2766,6 @@ function planItemsFromMessage(message2) {
|
|
|
2773
2766
|
return [{ text: text3, status: status === "completed" || status === "in_progress" ? status : "pending" }];
|
|
2774
2767
|
});
|
|
2775
2768
|
}
|
|
2776
|
-
function getDisplayMessageStatus(message2) {
|
|
2777
|
-
if (message2.type === "error" || message2.type === "quota_status") return "failed";
|
|
2778
|
-
if (message2.type === "auth_fallback") return message2.status === "switched" ? "completed" : "failed";
|
|
2779
|
-
if (message2.type === "interruption" || message2.type === "multitask_event") return "completed";
|
|
2780
|
-
if (message2.type === "background_task") return message2.status === "stopped" ? "completed" : message2.status;
|
|
2781
|
-
if (message2.type === "command" || message2.type === "patch") {
|
|
2782
|
-
return message2.status ?? (message2.exitCode === void 0 ? "in_progress" : message2.exitCode === 0 ? "completed" : "failed");
|
|
2783
|
-
}
|
|
2784
|
-
return "status" in message2 ? message2.status : void 0;
|
|
2785
|
-
}
|
|
2786
2769
|
function todoItemStatus(item) {
|
|
2787
2770
|
return item.itemStatus ?? (item.completed ? "completed" : "pending");
|
|
2788
2771
|
}
|
|
@@ -2816,17 +2799,6 @@ ${operation.diff}` : ""}`).join("\n\n");
|
|
|
2816
2799
|
if (message2.type === "multitask_event") return { kind: "task", title: "Subagent update", summary: message2.events.map((event) => `${event.agentName}: ${event.summary}`).join(" \xB7 "), content: "" };
|
|
2817
2800
|
return { kind: "error", title: "Agent error", summary: "", content: message2.message };
|
|
2818
2801
|
}
|
|
2819
|
-
function lineCountFromOutput(output) {
|
|
2820
|
-
if (!output) return null;
|
|
2821
|
-
let end = output.length;
|
|
2822
|
-
while (end > 0 && output[end - 1] === "\n") end--;
|
|
2823
|
-
if (end === 0) return null;
|
|
2824
|
-
let lines = 1;
|
|
2825
|
-
for (let i = 0; i < end; i++) {
|
|
2826
|
-
if (output[i] === "\n") lines++;
|
|
2827
|
-
}
|
|
2828
|
-
return lines;
|
|
2829
|
-
}
|
|
2830
2802
|
function fileContentDiff(path, content, action) {
|
|
2831
2803
|
const lines = content.replace(/\n$/, "").split("\n");
|
|
2832
2804
|
return [
|
|
@@ -2836,39 +2808,7 @@ function fileContentDiff(path, content, action) {
|
|
|
2836
2808
|
...lines.map((line) => `${action === "add" ? "+" : "-"}${line}`)
|
|
2837
2809
|
].join("\n");
|
|
2838
2810
|
}
|
|
2839
|
-
var READ_COMMANDS = /* @__PURE__ */ new Set([
|
|
2840
|
-
"cat",
|
|
2841
|
-
"find",
|
|
2842
|
-
"grep",
|
|
2843
|
-
"head",
|
|
2844
|
-
"ls",
|
|
2845
|
-
"nl",
|
|
2846
|
-
"pwd",
|
|
2847
|
-
"rg",
|
|
2848
|
-
"sed",
|
|
2849
|
-
"tail",
|
|
2850
|
-
"tree",
|
|
2851
|
-
"wc"
|
|
2852
|
-
]);
|
|
2853
2811
|
var SEARCH_COMMANDS = /* @__PURE__ */ new Set(["grep", "rg"]);
|
|
2854
|
-
var PIPE_FILTERS = /* @__PURE__ */ new Set(["awk", "cat", "column", "cut", "grep", "head", "jq", "nl", "rg", "sed", "sort", "tail", "tr", "uniq", "wc"]);
|
|
2855
|
-
var NEUTRAL_COMMANDS = /* @__PURE__ */ new Set(["cd", "echo", "printf", "true"]);
|
|
2856
|
-
var GIT_READ_COMMANDS = /* @__PURE__ */ new Set([
|
|
2857
|
-
"branch",
|
|
2858
|
-
"diff",
|
|
2859
|
-
"grep",
|
|
2860
|
-
"log",
|
|
2861
|
-
"ls-files",
|
|
2862
|
-
"show",
|
|
2863
|
-
"status"
|
|
2864
|
-
]);
|
|
2865
|
-
var GH_READ_COMMANDS = /* @__PURE__ */ new Set([
|
|
2866
|
-
"api",
|
|
2867
|
-
"issue",
|
|
2868
|
-
"pr",
|
|
2869
|
-
"repo",
|
|
2870
|
-
"run"
|
|
2871
|
-
]);
|
|
2872
2812
|
var OPTION_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
2873
2813
|
"-A",
|
|
2874
2814
|
"-B",
|
|
@@ -2891,26 +2831,9 @@ var LINE_COUNT_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
|
2891
2831
|
var SCRIPT_ROOT = "/";
|
|
2892
2832
|
var commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
|
|
2893
2833
|
var fileWrites = ({ writes }) => writes.filter(({ path }) => path !== "/dev/null");
|
|
2894
|
-
function displayPath(dir, path) {
|
|
2895
|
-
if (path.startsWith("~")) return path;
|
|
2896
|
-
const resolved = resolveShellPath(dir, path);
|
|
2897
|
-
if (resolved === null) return null;
|
|
2898
|
-
if (resolved === SCRIPT_ROOT) return ".";
|
|
2899
|
-
if (resolved.startsWith(`${SCRIPT_ROOT}/`)) return resolved.slice(SCRIPT_ROOT.length + 1);
|
|
2900
|
-
return path.startsWith("/") ? resolved : null;
|
|
2901
|
-
}
|
|
2902
2834
|
function shellCommands(command) {
|
|
2903
2835
|
return parseShellScript(command, SCRIPT_ROOT).filter(({ wrapper }) => !wrapper);
|
|
2904
2836
|
}
|
|
2905
|
-
function simpleCommands(command) {
|
|
2906
|
-
const commands = shellCommands(command);
|
|
2907
|
-
const hasRedirectOrSubshell = commands.some((shellCommand) => shellCommand.subshell || shellCommand.stdinFile !== null || !shellCommand.piped && shellCommand.stdin !== void 0 || fileWrites(shellCommand).length > 0);
|
|
2908
|
-
if (commands.length === 0 || hasRedirectOrSubshell) return null;
|
|
2909
|
-
return commands.map((shellCommand) => {
|
|
2910
|
-
const argv = shellCommand.argv.map((word) => word.replaceAll(SHELL_OPAQUE, "\u2026"));
|
|
2911
|
-
return { ...shellCommand, argv, name: commandName(argv) };
|
|
2912
|
-
});
|
|
2913
|
-
}
|
|
2914
2837
|
var SKILL_READ_COMMANDS = /* @__PURE__ */ new Set(["awk", "bat", "cat", "head", "less", "more", "nl", "sed", "tail"]);
|
|
2915
2838
|
function skillNamesFromCommand(command) {
|
|
2916
2839
|
return Array.from(new Set(shellCommands(command).flatMap((shellCommand) => {
|
|
@@ -2971,72 +2894,10 @@ function readCommandPaths(command, words) {
|
|
|
2971
2894
|
}
|
|
2972
2895
|
return pathArgs(words.slice(1), command === "head" || command === "tail" ? LINE_COUNT_VALUE_FLAGS : void 0);
|
|
2973
2896
|
}
|
|
2974
|
-
function readTitle(search, output, paths) {
|
|
2975
|
-
const lines = lineCountFromOutput(output);
|
|
2976
|
-
if (lines) return `Read ${lines} line${lines === 1 ? "" : "s"}${paths.length > 1 ? ` from ${paths.length} files` : ""}`;
|
|
2977
|
-
return search ? "Search" : paths.length > 1 ? `Read ${paths.length} files` : "Read";
|
|
2978
|
-
}
|
|
2979
|
-
function writtenFile(command) {
|
|
2980
|
-
const [write, ...rest] = shellCommands(command).filter(({ argv }) => !["cd", "mkdir"].includes(commandName(argv)));
|
|
2981
|
-
if (!write || rest.length > 0 || write.piped || write.subshell || write.stdinFile !== null) return null;
|
|
2982
|
-
if (!["cat", "echo", "printf"].includes(commandName(write.argv))) return null;
|
|
2983
|
-
const writes = fileWrites(write);
|
|
2984
|
-
return writes.length === 1 && writes[0].path ? displayPath(write.dir, writes[0].target) : null;
|
|
2985
|
-
}
|
|
2986
2897
|
function writesFiles(name, argv) {
|
|
2987
2898
|
if (name === "sed") return argv.some((word) => /^(-[a-zA-Z]*i|--in-place)/.test(word));
|
|
2988
2899
|
return name === "find" && argv.some((word) => /^-(exec|ok|delete|fprint|fls)/.test(word));
|
|
2989
2900
|
}
|
|
2990
|
-
function commandDisplayFromCommand(command, output) {
|
|
2991
|
-
const written = writtenFile(command);
|
|
2992
|
-
if (written) return { title: "Write", paths: [written] };
|
|
2993
|
-
const commands = simpleCommands(command);
|
|
2994
|
-
if (!commands || commands.some(({ name, argv, piped }) => writesFiles(name, argv) || piped && !PIPE_FILTERS.has(name))) return null;
|
|
2995
|
-
const mainCommands = commands.filter(({ name, piped }) => !piped && !NEUTRAL_COMMANDS.has(name));
|
|
2996
|
-
if (mainCommands.length === 0) return null;
|
|
2997
|
-
if (mainCommands.length === 1) {
|
|
2998
|
-
const [{ name, argv: words }] = mainCommands;
|
|
2999
|
-
if (name === "git" && words[1] && GIT_READ_COMMANDS.has(words[1])) {
|
|
3000
|
-
return { title: `Git ${words[1]}`, paths: [] };
|
|
3001
|
-
}
|
|
3002
|
-
if (name === "gh" && words[1] && GH_READ_COMMANDS.has(words[1])) {
|
|
3003
|
-
return { title: words[1] === "pr" && words[2] ? `GitHub PR ${words[2]}` : "GitHub", paths: [] };
|
|
3004
|
-
}
|
|
3005
|
-
}
|
|
3006
|
-
if (!mainCommands.every(({ name }) => READ_COMMANDS.has(name))) return null;
|
|
3007
|
-
const paths = /* @__PURE__ */ new Set();
|
|
3008
|
-
for (const { name, argv, dir } of mainCommands) {
|
|
3009
|
-
for (const path of readCommandPaths(name, argv)) {
|
|
3010
|
-
const shown = displayPath(dir, path);
|
|
3011
|
-
if (shown === null) return null;
|
|
3012
|
-
paths.add(shown);
|
|
3013
|
-
}
|
|
3014
|
-
}
|
|
3015
|
-
const search = mainCommands.every(({ name }) => SEARCH_COMMANDS.has(name));
|
|
3016
|
-
return { title: readTitle(search, output, [...paths]), paths: [...paths] };
|
|
3017
|
-
}
|
|
3018
|
-
|
|
3019
|
-
// ../shared/src/display-message/tool-call.ts
|
|
3020
|
-
function parseToolCallInput(inputValue) {
|
|
3021
|
-
const input = typeof inputValue === "string" ? inputValue : inputValue ? JSON.stringify(inputValue, null, 2) : "";
|
|
3022
|
-
let inputObject = null;
|
|
3023
|
-
if (inputValue && typeof inputValue !== "string") inputObject = inputValue;
|
|
3024
|
-
else if (input)
|
|
3025
|
-
try {
|
|
3026
|
-
const parsed = JSON.parse(input);
|
|
3027
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed))
|
|
3028
|
-
inputObject = Object.fromEntries(Object.entries(parsed));
|
|
3029
|
-
} catch {
|
|
3030
|
-
}
|
|
3031
|
-
const filePath = inputObject ? [inputObject.file_path, inputObject.filePath, inputObject.path, inputObject.filename, inputObject.file].find(
|
|
3032
|
-
(value) => typeof value === "string" && value.trim().length > 0
|
|
3033
|
-
) : void 0;
|
|
3034
|
-
return {
|
|
3035
|
-
input,
|
|
3036
|
-
inputObject,
|
|
3037
|
-
filePath: filePath ?? input.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m)?.[1]
|
|
3038
|
-
};
|
|
3039
|
-
}
|
|
3040
2901
|
|
|
3041
2902
|
// ../shared/src/display-message/parsers/mcp.ts
|
|
3042
2903
|
function parseMcpToolName(name) {
|
|
@@ -3051,28 +2912,6 @@ function parseMcpToolName(name) {
|
|
|
3051
2912
|
return { server, tool };
|
|
3052
2913
|
}
|
|
3053
2914
|
|
|
3054
|
-
// ../shared/src/display-message/subagent-tools.ts
|
|
3055
|
-
function chatIdFrom(input) {
|
|
3056
|
-
const value = parseToolCallInput(input).inputObject;
|
|
3057
|
-
if (!value) return null;
|
|
3058
|
-
if ("chatId" in value && typeof value.chatId === "string") return value.chatId;
|
|
3059
|
-
return "chat_id" in value && typeof value.chat_id === "string" ? value.chat_id : null;
|
|
3060
|
-
}
|
|
3061
|
-
function subagentToolName(message2) {
|
|
3062
|
-
const mcp = parseMcpToolName(message2.tool);
|
|
3063
|
-
const server = mcp?.server ?? message2.server;
|
|
3064
|
-
const tool = mcp?.tool ?? message2.tool;
|
|
3065
|
-
return isSubagentMcpServerName(server) ? tool : null;
|
|
3066
|
-
}
|
|
3067
|
-
function subagentChatId(message2) {
|
|
3068
|
-
const tool = subagentToolName(message2);
|
|
3069
|
-
if (!tool || tool === SUBAGENT_MCP_TOOLS.getProviders || !isSubagentMcpToolName(tool)) return null;
|
|
3070
|
-
const inputId = chatIdFrom(message2.input);
|
|
3071
|
-
if (inputId) return inputId;
|
|
3072
|
-
if (tool !== SUBAGENT_MCP_TOOLS.spawnAgent || !message2.output) return null;
|
|
3073
|
-
return chatIdFrom(message2.output);
|
|
3074
|
-
}
|
|
3075
|
-
|
|
3076
2915
|
// ../shared/src/mothership-events.ts
|
|
3077
2916
|
import { z as z16 } from "zod";
|
|
3078
2917
|
|
|
@@ -3166,7 +3005,6 @@ var terminalSocketServerMessageSchema = z13.discriminatedUnion("type", [
|
|
|
3166
3005
|
var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
|
|
3167
3006
|
|
|
3168
3007
|
// ../shared/src/replicas-mcp.ts
|
|
3169
|
-
var REPLICAS_MCP_SERVER_NAME = "replicas-mcp";
|
|
3170
3008
|
var REPLICAS_MCP_TOOLS = {
|
|
3171
3009
|
listEnvironments: "list_environments",
|
|
3172
3010
|
createAutomation: "create_automation",
|
|
@@ -5619,138 +5457,7 @@ function areUserMessagesWithinMatchWindow(a, b) {
|
|
|
5619
5457
|
return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
|
|
5620
5458
|
}
|
|
5621
5459
|
|
|
5622
|
-
// ../shared/src/display-message/turns.ts
|
|
5623
|
-
function isCompaction(message2) {
|
|
5624
|
-
return message2.type === "reasoning" && message2.content === COMPACTION_CONTENT;
|
|
5625
|
-
}
|
|
5626
|
-
function isGoalUpdate(message2) {
|
|
5627
|
-
return message2.type === "tool_call" && message2.server === "claude" && message2.tool === GOAL_TOOL_NAME;
|
|
5628
|
-
}
|
|
5629
|
-
|
|
5630
5460
|
// ../shared/src/display-message/steps.ts
|
|
5631
|
-
function inputString(input, ...keys) {
|
|
5632
|
-
for (const key of keys) {
|
|
5633
|
-
const value = input?.[key];
|
|
5634
|
-
if (typeof value === "string" && value.trim()) return value;
|
|
5635
|
-
}
|
|
5636
|
-
return void 0;
|
|
5637
|
-
}
|
|
5638
|
-
var COMMAND_PARSE_LIMIT = 4096;
|
|
5639
|
-
function shellPayload(command) {
|
|
5640
|
-
const [first] = parseShellScript(command, null);
|
|
5641
|
-
const flag = first?.wrapper ? first.argv.findIndex((arg, index) => index > 0 && /^-[A-Za-z]*c[A-Za-z]*$/.test(arg)) : -1;
|
|
5642
|
-
return (flag > 0 ? first.argv[flag + 1] : void 0)?.replaceAll(SHELL_OPAQUE, "\u2026") ?? command.trim();
|
|
5643
|
-
}
|
|
5644
|
-
function commandLabel(command) {
|
|
5645
|
-
const lines = shellPayload(command.slice(0, COMMAND_PARSE_LIMIT)).replace(/^cd\s+\S+\s*&&\s*/, "").split("\n").filter((line) => line.trim());
|
|
5646
|
-
const shown = lines.length > 1 && /(["']|<<-?\s*['"]?\w+['"]?)\s*$/.test(lines[0]) ? 2 : 1;
|
|
5647
|
-
const label = lines.slice(0, shown).map((line) => line.trim()).join(" ");
|
|
5648
|
-
return lines.length > shown ? `${label} \u2026` : label;
|
|
5649
|
-
}
|
|
5650
|
-
var BACKGROUND_META = {
|
|
5651
|
-
in_progress: "Running in background",
|
|
5652
|
-
completed: "Done in background",
|
|
5653
|
-
failed: "Failed in background",
|
|
5654
|
-
stopped: "Stopped in background"
|
|
5655
|
-
};
|
|
5656
|
-
var OPERATION_VERBS = {
|
|
5657
|
-
add: ["Creating", "Created", "file-plus"],
|
|
5658
|
-
delete: ["Deleting", "Deleted", "file-x"],
|
|
5659
|
-
update: ["Editing", "Edited", "file-pen"]
|
|
5660
|
-
};
|
|
5661
|
-
function describeMessageSteps(message2, durationMs, background) {
|
|
5662
|
-
const status = getDisplayMessageStatus(message2);
|
|
5663
|
-
const base = {
|
|
5664
|
-
message: message2,
|
|
5665
|
-
running: status === "in_progress",
|
|
5666
|
-
failed: status === "failed",
|
|
5667
|
-
durationMs
|
|
5668
|
-
};
|
|
5669
|
-
switch (message2.type) {
|
|
5670
|
-
case "reasoning":
|
|
5671
|
-
if (isCompaction(message2)) {
|
|
5672
|
-
return [{ ...base, key: message2.id, category: "compact", icon: "fold", live: "Compacting context", done: base.failed ? "Context compaction" : "Compacted context" }];
|
|
5673
|
-
}
|
|
5674
|
-
if (!message2.content.trim()) return [];
|
|
5675
|
-
return [{ ...base, key: message2.id, category: "think", icon: "brain", live: "Thinking", done: "Thought", failed: false, detail: "reasoning" }];
|
|
5676
|
-
case "command": {
|
|
5677
|
-
const policyBlocked = message2.status === "failed" && message2.exitCode == null && Boolean(message2.output?.toLowerCase().includes("blocked by organization policy"));
|
|
5678
|
-
const display = policyBlocked || message2.command.length > COMMAND_PARSE_LIMIT ? null : commandDisplayFromCommand(message2.command);
|
|
5679
|
-
const failed = policyBlocked || base.failed || message2.exitCode != null && message2.exitCode !== 0 || background?.status === "failed";
|
|
5680
|
-
const running = background ? background.status === "in_progress" : base.running;
|
|
5681
|
-
const meta = policyBlocked ? "Blocked by policy" : background ? BACKGROUND_META[background.status] : failed && message2.exitCode != null ? `Exit code ${message2.exitCode}` : void 0;
|
|
5682
|
-
if (display?.title.startsWith("Read") && display.paths.length > 0) {
|
|
5683
|
-
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 }));
|
|
5684
|
-
}
|
|
5685
|
-
if (display?.title === "Write") {
|
|
5686
|
-
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 }];
|
|
5687
|
-
}
|
|
5688
|
-
return [{
|
|
5689
|
-
...base,
|
|
5690
|
-
key: message2.id,
|
|
5691
|
-
category: display?.title === "Search" ? "search" : "command",
|
|
5692
|
-
icon: "terminal",
|
|
5693
|
-
live: "Running",
|
|
5694
|
-
done: "Ran",
|
|
5695
|
-
target: { text: commandLabel(message2.command) },
|
|
5696
|
-
meta,
|
|
5697
|
-
running,
|
|
5698
|
-
failed,
|
|
5699
|
-
detail: "shell",
|
|
5700
|
-
background
|
|
5701
|
-
}];
|
|
5702
|
-
}
|
|
5703
|
-
case "patch":
|
|
5704
|
-
return message2.operations.map((operation, index) => {
|
|
5705
|
-
const [live, done, icon] = OPERATION_VERBS[operation.action] ?? OPERATION_VERBS.update;
|
|
5706
|
-
return {
|
|
5707
|
-
...base,
|
|
5708
|
-
key: `${message2.id}-${index}`,
|
|
5709
|
-
category: "edit",
|
|
5710
|
-
icon,
|
|
5711
|
-
live,
|
|
5712
|
-
done,
|
|
5713
|
-
target: { text: operation.moveTo ?? operation.path, path: operation.moveTo ?? operation.path },
|
|
5714
|
-
detail: operation.diff ? "diff" : void 0,
|
|
5715
|
-
operation
|
|
5716
|
-
};
|
|
5717
|
-
});
|
|
5718
|
-
case "file_change":
|
|
5719
|
-
return message2.changes.map((change, index) => {
|
|
5720
|
-
const [live, done, icon] = OPERATION_VERBS[change.kind] ?? OPERATION_VERBS.update;
|
|
5721
|
-
return { ...base, key: `${message2.id}-${index}`, category: "edit", icon, live, done, target: { text: change.path, path: change.path } };
|
|
5722
|
-
});
|
|
5723
|
-
case "web_search":
|
|
5724
|
-
return [{ ...base, key: message2.id, category: "web", icon: "globe", live: "Searching the web for", done: "Searched the web for", target: { text: message2.query } }];
|
|
5725
|
-
case "skill": {
|
|
5726
|
-
if (message2.skillName.startsWith(LEARNED_SKILL_DIR_PREFIX)) {
|
|
5727
|
-
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) } }];
|
|
5728
|
-
}
|
|
5729
|
-
return [{ ...base, key: message2.id, category: "tool", icon: "zap", live: "Using skill", done: "Used skill", target: { text: message2.skillName } }];
|
|
5730
|
-
}
|
|
5731
|
-
case "subagent":
|
|
5732
|
-
return [{
|
|
5733
|
-
...base,
|
|
5734
|
-
...background && { running: background.status === "in_progress", failed: background.status === "failed" },
|
|
5735
|
-
key: message2.id,
|
|
5736
|
-
category: "agent",
|
|
5737
|
-
icon: "bot",
|
|
5738
|
-
live: "Running",
|
|
5739
|
-
done: "Ran",
|
|
5740
|
-
target: { text: message2.description, plain: true },
|
|
5741
|
-
background
|
|
5742
|
-
}];
|
|
5743
|
-
case "background_task":
|
|
5744
|
-
if (message2.toolUseId) return [];
|
|
5745
|
-
return [{ ...base, key: message2.id, category: "task", icon: "bell", live: "Running", done: "Ran", target: { text: message2.description ?? message2.summary ?? "background task", plain: true } }];
|
|
5746
|
-
case "tool_call": {
|
|
5747
|
-
const step = describeToolCall(message2, base);
|
|
5748
|
-
return step ? [step] : [];
|
|
5749
|
-
}
|
|
5750
|
-
default:
|
|
5751
|
-
return [];
|
|
5752
|
-
}
|
|
5753
|
-
}
|
|
5754
5461
|
var SUBAGENT_STEPS = {
|
|
5755
5462
|
[SUBAGENT_MCP_TOOLS.messageAgent]: { icon: "message", live: "Messaging", done: "Messaged" },
|
|
5756
5463
|
[SUBAGENT_MCP_TOOLS.waitAgent]: { icon: "clock", live: "Waiting for", done: "Waited for" },
|
|
@@ -5766,90 +5473,6 @@ var MOTHERSHIP_TOOL_ACTIONS = {
|
|
|
5766
5473
|
[REPLICAS_MCP_TOOLS.archiveSubagent]: "archive",
|
|
5767
5474
|
[REPLICAS_MCP_TOOLS.waitForSubagents]: "wait"
|
|
5768
5475
|
};
|
|
5769
|
-
var INTERNAL_TOOLS = /* @__PURE__ */ new Set(["ToolSearch", "ListMcpResourcesTool", "ReadMcpResourceTool", "TaskOutput", "BashOutput"]);
|
|
5770
|
-
function describeToolCall(message2, base) {
|
|
5771
|
-
const { inputObject: input, filePath } = parseToolCallInput(message2.input);
|
|
5772
|
-
const tool = message2.tool;
|
|
5773
|
-
const key = message2.id;
|
|
5774
|
-
if (INTERNAL_TOOLS.has(tool)) return null;
|
|
5775
|
-
if (isGoalUpdate(message2)) {
|
|
5776
|
-
const objective = inputString(input, "objective");
|
|
5777
|
-
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" };
|
|
5778
|
-
}
|
|
5779
|
-
const subagentTool = subagentToolName(message2);
|
|
5780
|
-
if (subagentTool && isSubagentMcpToolName(subagentTool)) {
|
|
5781
|
-
const failed = base.failed || typeof parseToolCallInput(message2.output).inputObject?.error === "string";
|
|
5782
|
-
if (subagentTool === SUBAGENT_MCP_TOOLS.spawnAgent) {
|
|
5783
|
-
return { ...base, key, category: "agent", icon: "bot", live: "Running", done: "Started", failed, target: { text: inputString(input, "title", "prompt") ?? "subagent", plain: true } };
|
|
5784
|
-
}
|
|
5785
|
-
const chatId = subagentChatId(message2);
|
|
5786
|
-
const provider2 = typeof input?.provider === "string" && isValidAgentProvider(input.provider) ? input.provider : null;
|
|
5787
|
-
const agent = inputString(input, "title") ?? chatId?.slice(0, 8) ?? (provider2 ? getProviderDisplayName(provider2) : void 0);
|
|
5788
|
-
return { ...base, key, category: "tool", ...SUBAGENT_STEPS[subagentTool], failed, target: agent ? { text: agent, plain: true } : void 0, detail: "subagent" };
|
|
5789
|
-
}
|
|
5790
|
-
const mcp = parseMcpToolName(tool);
|
|
5791
|
-
const mothershipAction = (mcp?.server ?? message2.server) === REPLICAS_MCP_SERVER_NAME ? MOTHERSHIP_TOOL_ACTIONS[mcp?.tool ?? tool] : void 0;
|
|
5792
|
-
if (mothershipAction) {
|
|
5793
|
-
const step = {
|
|
5794
|
-
...base,
|
|
5795
|
-
key,
|
|
5796
|
-
failed: base.failed || Boolean(message2.output?.startsWith("Error:")),
|
|
5797
|
-
mothership: { action: mothershipAction, name: inputString(input, "name"), agentId: inputString(input, "agent_id"), chatId: inputString(input, "chat_id"), text: inputString(input, "prompt", "message") }
|
|
5798
|
-
};
|
|
5799
|
-
if (mothershipAction === "spawn") return { ...step, category: "agent", icon: "network", live: "Spawning", done: "Spawned", detail: "mothership" };
|
|
5800
|
-
if (mothershipAction === "send") return { ...step, category: "agent", icon: "message", live: "Messaging", done: "Messaged", detail: "mothership" };
|
|
5801
|
-
if (mothershipAction === "wait") {
|
|
5802
|
-
return { ...step, category: "agent", icon: "clock", live: "Waiting for subagents", done: "Waited for subagents", detail: "mothership", mothership: { ...step.mothership, events: extractMothershipEvents(message2.output ?? "") } };
|
|
5803
|
-
}
|
|
5804
|
-
if (mothershipAction === "archive") return { ...step, category: "tool", icon: "archive", live: "Archiving subagent", done: "Archived subagent", detail: "io" };
|
|
5805
|
-
return mothershipAction === "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" };
|
|
5806
|
-
}
|
|
5807
|
-
const shellCommand = /^(bash|shell|run_shell_command)$/i.test(tool) ? inputString(input, "command", "cmd") : void 0;
|
|
5808
|
-
if (shellCommand) {
|
|
5809
|
-
return { ...base, key, category: "command", icon: "terminal", live: "Running", done: "Ran", target: { text: commandLabel(shellCommand) }, detail: "io" };
|
|
5810
|
-
}
|
|
5811
|
-
if (/^(read|read_file|view)$/i.test(tool) && filePath) {
|
|
5812
|
-
return { ...base, key, category: "read", icon: "book", live: "Reading", done: "Read", target: { text: filePath, path: filePath }, detail: "io" };
|
|
5813
|
-
}
|
|
5814
|
-
if (/^(grep|glob|search|find|codebase_search|file_search)$/i.test(tool)) {
|
|
5815
|
-
const scope = inputString(input, "path", "glob", "include", "target_directories");
|
|
5816
|
-
return {
|
|
5817
|
-
...base,
|
|
5818
|
-
key,
|
|
5819
|
-
category: "search",
|
|
5820
|
-
icon: "search",
|
|
5821
|
-
live: "Searching for",
|
|
5822
|
-
done: "Searched for",
|
|
5823
|
-
target: { text: inputString(input, "pattern", "query", "glob_pattern", "globPattern") ?? tool },
|
|
5824
|
-
scope,
|
|
5825
|
-
detail: message2.output ? "results" : void 0
|
|
5826
|
-
};
|
|
5827
|
-
}
|
|
5828
|
-
if (/^(ls|list_dir|list_directory)$/i.test(tool)) {
|
|
5829
|
-
const path = inputString(input, "path", "relative_workspace_path") ?? ".";
|
|
5830
|
-
return { ...base, key, category: "read", icon: "folder", live: "Listing", done: "Listed", target: { text: path, path }, detail: "io" };
|
|
5831
|
-
}
|
|
5832
|
-
if (/^(webfetch|web_fetch|fetch)$/i.test(tool)) {
|
|
5833
|
-
return { ...base, key, category: "web", icon: "globe", live: "Fetching", done: "Fetched", target: { text: inputString(input, "url") ?? tool }, detail: "io" };
|
|
5834
|
-
}
|
|
5835
|
-
if (/^(websearch|web_search)$/i.test(tool)) {
|
|
5836
|
-
return { ...base, key, category: "web", icon: "globe", live: "Searching the web for", done: "Searched the web for", target: { text: inputString(input, "query") ?? tool } };
|
|
5837
|
-
}
|
|
5838
|
-
if (/^(edit|write|multiedit|notebookedit|apply_patch|str_replace)/i.test(tool) && filePath) {
|
|
5839
|
-
return { ...base, key, category: "edit", icon: "file-pen", live: "Editing", done: "Edited", target: { text: filePath, path: filePath }, detail: "io" };
|
|
5840
|
-
}
|
|
5841
|
-
return {
|
|
5842
|
-
...base,
|
|
5843
|
-
key,
|
|
5844
|
-
category: "tool",
|
|
5845
|
-
icon: "wrench",
|
|
5846
|
-
live: "Calling",
|
|
5847
|
-
done: "Called",
|
|
5848
|
-
target: { text: mcp?.tool ?? tool },
|
|
5849
|
-
scope: mcp?.server ?? (message2.server && message2.server !== "claude" ? message2.server : void 0),
|
|
5850
|
-
detail: message2.input || message2.output ? "io" : void 0
|
|
5851
|
-
};
|
|
5852
|
-
}
|
|
5853
5476
|
|
|
5854
5477
|
// ../shared/src/user-message-attachments.ts
|
|
5855
5478
|
var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
|
|
@@ -10105,7 +9728,6 @@ export {
|
|
|
10105
9728
|
chatHistoryPageParamsFromQuery,
|
|
10106
9729
|
paginateChatHistory,
|
|
10107
9730
|
coerceBackgroundTaskPayload,
|
|
10108
|
-
planItemsFromMessage,
|
|
10109
9731
|
fileContentDiff,
|
|
10110
9732
|
skillNamesFromCommand,
|
|
10111
9733
|
SUBAGENT_MCP_SERVER_NAME,
|
|
@@ -10136,7 +9758,6 @@ export {
|
|
|
10136
9758
|
learnedSkillsManifestSchema,
|
|
10137
9759
|
learnedSkillFormatInstruction,
|
|
10138
9760
|
areUserMessagesWithinMatchWindow,
|
|
10139
|
-
describeMessageSteps,
|
|
10140
9761
|
extractErrorText,
|
|
10141
9762
|
isTransientErrorText,
|
|
10142
9763
|
extractToolResultText,
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
AspClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RNZEQTP5.js";
|
|
7
7
|
import {
|
|
8
8
|
ASTER_BASE_URL,
|
|
9
9
|
ASTER_PROVIDER,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
codexReasoningEffortForThinkingLevel,
|
|
12
12
|
isRecord,
|
|
13
13
|
readOllamaAuthEnv
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-F7Z4EDBL.js";
|
|
15
15
|
|
|
16
16
|
// src/managers/codex-asp/notification-dispatch.ts
|
|
17
17
|
var TURN_STARTED_METHOD = "turn/started";
|
|
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
execFileAsync
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-646TX4O5.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-F7Z4EDBL.js";
|
|
10
10
|
|
|
11
11
|
// src/utils/codex-agent-env.ts
|
|
12
12
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
|
|
|
240
240
|
if (method === "foundry") return "azure";
|
|
241
241
|
return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
|
|
242
242
|
}
|
|
243
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
243
|
+
var ENGINE_PACKAGE_VERSION = "0.1.1120";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
getOriginDefaultBranch,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
runGitCommand
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZBPD3KGN.js";
|
|
9
9
|
import {
|
|
10
10
|
extractCommandProtectionCommandText,
|
|
11
11
|
findCommandProtectionGitLookups,
|
|
12
12
|
findGitCommitSignals,
|
|
13
13
|
findPrMergeSignals,
|
|
14
14
|
parseCommandProtectionRequest
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-F7Z4EDBL.js";
|
|
16
16
|
|
|
17
17
|
// src/services/command-protection-service.ts
|
|
18
18
|
import { readFile, stat } from "fs/promises";
|
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
SUBPROCESS_MAX_BUFFER,
|
|
6
6
|
execFileAsync
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-646TX4O5.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord as isRecord2
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
isValidAgentProvider,
|
|
19
19
|
parsePosixEnvFile,
|
|
20
20
|
readReplicasRuntimeEnv
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-F7Z4EDBL.js";
|
|
22
22
|
|
|
23
23
|
// src/runtime-env-loader.ts
|
|
24
24
|
import { readFileSync } from "fs";
|
|
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
evaluateCommandProtection
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-YHC273BI.js";
|
|
7
|
+
import "./chunk-ZBPD3KGN.js";
|
|
8
|
+
import "./chunk-646TX4O5.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-F7Z4EDBL.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|