replicas-engine 0.1.557 → 0.1.558
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/index.js +102 -7
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -725,7 +725,7 @@ var WORKSPACE_SIZES = ["small", "large"];
|
|
|
725
725
|
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
726
726
|
|
|
727
727
|
// ../shared/src/e2b.ts
|
|
728
|
-
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-08-04-
|
|
728
|
+
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-08-04-v5";
|
|
729
729
|
|
|
730
730
|
// ../shared/src/runtime-env.ts
|
|
731
731
|
function shellQuotePosix(value) {
|
|
@@ -3627,16 +3627,27 @@ function parseSkillName(tool2, input) {
|
|
|
3627
3627
|
const skillName = parsedInput.skill ?? parsedInput.name;
|
|
3628
3628
|
return typeof skillName === "string" && skillName ? skillName : null;
|
|
3629
3629
|
}
|
|
3630
|
+
function skillNameFromFilePath(path6) {
|
|
3631
|
+
const skillName = skillNameFromSkillRootPath(path6);
|
|
3632
|
+
if (skillName) return skillName;
|
|
3633
|
+
const parts = path6.split(/[\\/]+/).filter(Boolean);
|
|
3634
|
+
if (parts.length < 2 || parts[parts.length - 1].toLowerCase() !== "skill.md") return null;
|
|
3635
|
+
const fallbackSkillName = parts[parts.length - 2];
|
|
3636
|
+
return fallbackSkillName && fallbackSkillName.toLowerCase() !== "skills" ? fallbackSkillName : null;
|
|
3637
|
+
}
|
|
3638
|
+
function skillNameFromSkillRootPath(path6) {
|
|
3639
|
+
const parts = path6.split(/[\\/]+/).filter(Boolean);
|
|
3640
|
+
const skillsIndex = parts.findLastIndex((part) => part.toLowerCase() === "skills");
|
|
3641
|
+
if (skillsIndex === -1) return null;
|
|
3642
|
+
const skillName = parts[skillsIndex + 1];
|
|
3643
|
+
return skillName && skillName.toLowerCase() !== "skill.md" ? skillName : null;
|
|
3644
|
+
}
|
|
3630
3645
|
function parseSkillFilePath(input) {
|
|
3631
3646
|
const parsedInput = typeof input === "string" ? safeJsonParse(input, null) : input;
|
|
3632
3647
|
if (!isRecord(parsedInput)) return null;
|
|
3633
3648
|
const path6 = [parsedInput.path, parsedInput.filePath, parsedInput.file_path].find((value) => typeof value === "string" && value.length > 0);
|
|
3634
3649
|
if (!path6) return null;
|
|
3635
|
-
|
|
3636
|
-
if (parts.length < 2) return null;
|
|
3637
|
-
if (parts[parts.length - 1].toLowerCase() !== "skill.md") return null;
|
|
3638
|
-
const skillName = parts[parts.length - 2];
|
|
3639
|
-
return skillName && skillName.toLowerCase() !== "skills" ? skillName : null;
|
|
3650
|
+
return skillNameFromFilePath(path6);
|
|
3640
3651
|
}
|
|
3641
3652
|
function skillNameFromToolCall(tool2, input) {
|
|
3642
3653
|
const directSkillName = parseSkillName(tool2, input);
|
|
@@ -3656,6 +3667,72 @@ function createCallDisplayMessage(message) {
|
|
|
3656
3667
|
};
|
|
3657
3668
|
}
|
|
3658
3669
|
|
|
3670
|
+
// ../shared/src/display-message/format.ts
|
|
3671
|
+
function unquoteShellArg(value) {
|
|
3672
|
+
const trimmed = value.trim();
|
|
3673
|
+
if (trimmed.length < 2) return trimmed;
|
|
3674
|
+
if (trimmed[0] === "'" && trimmed[trimmed.length - 1] === "'") {
|
|
3675
|
+
return trimmed.slice(1, -1).replace(/'\\''/g, "'");
|
|
3676
|
+
}
|
|
3677
|
+
if (trimmed[0] === '"' && trimmed[trimmed.length - 1] === '"') {
|
|
3678
|
+
return trimmed.slice(1, -1).replace(/\\(["\\$`])/g, "$1");
|
|
3679
|
+
}
|
|
3680
|
+
return trimmed;
|
|
3681
|
+
}
|
|
3682
|
+
function shellPayload(command) {
|
|
3683
|
+
const match = command.trim().match(/^(?:\S*\/)?(?:ba|z|c|fi)?sh\s+-(?:[a-zA-Z]*c[a-zA-Z]*|c)\s+([\s\S]+)$/);
|
|
3684
|
+
return match ? unquoteShellArg(match[1]) : command.trim();
|
|
3685
|
+
}
|
|
3686
|
+
function splitShellWords(command) {
|
|
3687
|
+
const words = [];
|
|
3688
|
+
let word = "";
|
|
3689
|
+
let quote = null;
|
|
3690
|
+
let escaped = false;
|
|
3691
|
+
for (const char of command) {
|
|
3692
|
+
if (escaped) {
|
|
3693
|
+
word += char;
|
|
3694
|
+
escaped = false;
|
|
3695
|
+
continue;
|
|
3696
|
+
}
|
|
3697
|
+
if (char === "\\" && quote !== "'") {
|
|
3698
|
+
escaped = true;
|
|
3699
|
+
continue;
|
|
3700
|
+
}
|
|
3701
|
+
if (quote) {
|
|
3702
|
+
if (char === quote) quote = null;
|
|
3703
|
+
else word += char;
|
|
3704
|
+
continue;
|
|
3705
|
+
}
|
|
3706
|
+
if (char === '"' || char === "'") {
|
|
3707
|
+
quote = char;
|
|
3708
|
+
continue;
|
|
3709
|
+
}
|
|
3710
|
+
if (/\s/.test(char)) {
|
|
3711
|
+
if (word) {
|
|
3712
|
+
words.push(word);
|
|
3713
|
+
word = "";
|
|
3714
|
+
}
|
|
3715
|
+
continue;
|
|
3716
|
+
}
|
|
3717
|
+
word += char;
|
|
3718
|
+
}
|
|
3719
|
+
if (word) words.push(word);
|
|
3720
|
+
return words;
|
|
3721
|
+
}
|
|
3722
|
+
function commandWords(command) {
|
|
3723
|
+
const payload = shellPayload(command);
|
|
3724
|
+
if (!payload || /[;|<>]|&&/.test(payload)) return null;
|
|
3725
|
+
return splitShellWords(payload);
|
|
3726
|
+
}
|
|
3727
|
+
function skillNamesFromCommand(command) {
|
|
3728
|
+
const words = commandWords(command);
|
|
3729
|
+
if (!words) return [];
|
|
3730
|
+
return Array.from(new Set(words.flatMap((word) => {
|
|
3731
|
+
const skillName = skillNameFromSkillRootPath(word);
|
|
3732
|
+
return skillName ? [skillName] : [];
|
|
3733
|
+
})));
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3659
3736
|
// ../shared/src/user-message-matching.ts
|
|
3660
3737
|
function parseTimestampMs(timestamp) {
|
|
3661
3738
|
const value = Date.parse(timestamp);
|
|
@@ -3867,10 +3944,12 @@ function parseCodexEvents(events) {
|
|
|
3867
3944
|
const callId = event.payload.call_id;
|
|
3868
3945
|
const args = safeJsonParse(event.payload.arguments || "{}", {});
|
|
3869
3946
|
const command = args.cmd || (Array.isArray(args.command) ? args.command.join(" ") : args.command) || "";
|
|
3947
|
+
const skillNames = skillNamesFromCommand(command);
|
|
3870
3948
|
const msg = {
|
|
3871
3949
|
id: `command-${callId || "no-call-id"}-${eventIndex}`,
|
|
3872
3950
|
type: "command",
|
|
3873
3951
|
command,
|
|
3952
|
+
...skillNames.length > 0 ? { skillNames } : {},
|
|
3874
3953
|
output: "",
|
|
3875
3954
|
status: "in_progress",
|
|
3876
3955
|
timestamp: event.timestamp
|
|
@@ -4741,10 +4820,12 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
4741
4820
|
} else if (toolName === "Bash" || toolName === "bash" || toolName === "shell") {
|
|
4742
4821
|
const inputObj = typeof toolInput === "string" ? safeJsonParse(toolInput, {}) : toolInput;
|
|
4743
4822
|
const command = inputObj.command || "";
|
|
4823
|
+
const skillNames = skillNamesFromCommand(command);
|
|
4744
4824
|
messages.push({
|
|
4745
4825
|
id: `command-${event.timestamp}-${messages.length}`,
|
|
4746
4826
|
type: "command",
|
|
4747
4827
|
command,
|
|
4828
|
+
...skillNames.length > 0 ? { skillNames } : {},
|
|
4748
4829
|
output: "",
|
|
4749
4830
|
status: "in_progress",
|
|
4750
4831
|
timestamp: event.timestamp
|
|
@@ -5064,10 +5145,12 @@ function messageForItem(item) {
|
|
|
5064
5145
|
};
|
|
5065
5146
|
}
|
|
5066
5147
|
if (item.type === "commandExecution") {
|
|
5148
|
+
const skillNames = skillNamesFromCommand(item.command);
|
|
5067
5149
|
return {
|
|
5068
5150
|
id: `command-${item.id}`,
|
|
5069
5151
|
type: "command",
|
|
5070
5152
|
command: item.command,
|
|
5153
|
+
...skillNames.length > 0 ? { skillNames } : {},
|
|
5071
5154
|
output: item.output,
|
|
5072
5155
|
exitCode: item.exitCode ?? void 0,
|
|
5073
5156
|
status: normalizeCodexAspTranscriptStatus(item.status),
|
|
@@ -10649,7 +10732,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
|
|
|
10649
10732
|
var MIN_CODEX_CLI_VERSION = "0.144.6";
|
|
10650
10733
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
10651
10734
|
var codexCliVersionEnsured = null;
|
|
10652
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
10735
|
+
var ENGINE_PACKAGE_VERSION = "0.1.558";
|
|
10653
10736
|
var INITIALIZE_METHOD = "initialize";
|
|
10654
10737
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
10655
10738
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -15001,12 +15084,24 @@ function mcpNameFromToolCall(message) {
|
|
|
15001
15084
|
}
|
|
15002
15085
|
return NON_MCP_SERVERS.has(message.server) ? null : message.server;
|
|
15003
15086
|
}
|
|
15087
|
+
function skillCallsFromCommand(message) {
|
|
15088
|
+
const skillNames = message.skillNames ?? [];
|
|
15089
|
+
return skillNames.map((skillName, index) => ({
|
|
15090
|
+
kind: "skill",
|
|
15091
|
+
id: skillNames.length === 1 ? message.id : `${message.id}-${index}`,
|
|
15092
|
+
skillName,
|
|
15093
|
+
occurredAt: message.timestamp
|
|
15094
|
+
}));
|
|
15095
|
+
}
|
|
15004
15096
|
function extractSkillMcpCalls(messages, provider) {
|
|
15005
15097
|
return messages.flatMap((message) => {
|
|
15006
15098
|
if (message.type === "skill") {
|
|
15007
15099
|
if (provider === "relay") return [];
|
|
15008
15100
|
return [{ kind: "skill", id: message.id, skillName: message.skillName, occurredAt: message.timestamp }];
|
|
15009
15101
|
}
|
|
15102
|
+
if (message.type === "command") {
|
|
15103
|
+
return skillCallsFromCommand(message);
|
|
15104
|
+
}
|
|
15010
15105
|
if (message.type !== "tool_call") return [];
|
|
15011
15106
|
const mcpName = mcpNameFromToolCall(message);
|
|
15012
15107
|
return mcpName ? [{ kind: "mcp", id: message.id, mcpName, occurredAt: message.timestamp }] : [];
|