replicas-engine 0.1.554 → 0.1.556
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 +71 -17
- 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-v3";
|
|
729
729
|
|
|
730
730
|
// ../shared/src/runtime-env.ts
|
|
731
731
|
function shellQuotePosix(value) {
|
|
@@ -3627,8 +3627,25 @@ 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 parseSkillFilePath(input) {
|
|
3631
|
+
const parsedInput = typeof input === "string" ? safeJsonParse(input, null) : input;
|
|
3632
|
+
if (!isRecord(parsedInput)) return null;
|
|
3633
|
+
const path6 = [parsedInput.path, parsedInput.filePath, parsedInput.file_path].find((value) => typeof value === "string" && value.length > 0);
|
|
3634
|
+
if (!path6) return null;
|
|
3635
|
+
const parts = path6.split(/[\\/]+/).filter(Boolean);
|
|
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;
|
|
3640
|
+
}
|
|
3641
|
+
function skillNameFromToolCall(tool2, input) {
|
|
3642
|
+
const directSkillName = parseSkillName(tool2, input);
|
|
3643
|
+
if (directSkillName) return directSkillName;
|
|
3644
|
+
if (typeof tool2 !== "string" || !["read", "read_file", "readfile"].includes(tool2.toLowerCase())) return null;
|
|
3645
|
+
return parseSkillFilePath(input);
|
|
3646
|
+
}
|
|
3630
3647
|
function createCallDisplayMessage(message) {
|
|
3631
|
-
const skillName = message.server.toLowerCase() === "skills" ? message.tool :
|
|
3648
|
+
const skillName = message.server.toLowerCase() === "skills" ? message.tool : skillNameFromToolCall(message.tool, message.input);
|
|
3632
3649
|
if (skillName === null) return { ...message, type: "tool_call" };
|
|
3633
3650
|
return {
|
|
3634
3651
|
id: message.id,
|
|
@@ -4295,6 +4312,15 @@ function parsePiEvents(events) {
|
|
|
4295
4312
|
for (const event of events) {
|
|
4296
4313
|
if (event.type === "event_msg" && event.payload.type === "user_message" && typeof event.payload.message === "string") {
|
|
4297
4314
|
messages.push({ id: `pi-user-${event.timestamp}-${messages.length}`, type: "user", content: event.payload.message, timestamp: event.timestamp });
|
|
4315
|
+
if (typeof event.payload.skillName === "string" && event.payload.skillName) {
|
|
4316
|
+
messages.push({
|
|
4317
|
+
id: `pi-skill-${event.timestamp}-${messages.length}`,
|
|
4318
|
+
type: "skill",
|
|
4319
|
+
skillName: event.payload.skillName,
|
|
4320
|
+
status: "completed",
|
|
4321
|
+
timestamp: event.timestamp
|
|
4322
|
+
});
|
|
4323
|
+
}
|
|
4298
4324
|
continue;
|
|
4299
4325
|
}
|
|
4300
4326
|
if (event.type === "pi-error") {
|
|
@@ -5121,6 +5147,20 @@ function messageForItem(item) {
|
|
|
5121
5147
|
timestamp: item.timestamp
|
|
5122
5148
|
};
|
|
5123
5149
|
}
|
|
5150
|
+
function skillMessagesForItem(item) {
|
|
5151
|
+
if (item.type !== "userMessage" || !item.skillNames) return [];
|
|
5152
|
+
return item.skillNames.filter((skillName) => skillName.trim().length > 0).map((skillName, index) => ({
|
|
5153
|
+
id: `skill-${item.id}-${index}`,
|
|
5154
|
+
type: "skill",
|
|
5155
|
+
skillName,
|
|
5156
|
+
status: "completed",
|
|
5157
|
+
timestamp: item.timestamp
|
|
5158
|
+
}));
|
|
5159
|
+
}
|
|
5160
|
+
function parseLatestCodexAspTranscriptTurn(transcript) {
|
|
5161
|
+
const latestTurn = transcript.turns.reduce((latest, turn) => !latest || Date.parse(turn.startedAt) >= Date.parse(latest.startedAt) ? turn : latest, null);
|
|
5162
|
+
return latestTurn ? parseCodexAspTranscript({ ...transcript, turns: [latestTurn] }) : [];
|
|
5163
|
+
}
|
|
5124
5164
|
function stableString(value) {
|
|
5125
5165
|
if (value === void 0) return "";
|
|
5126
5166
|
if (typeof value !== "object" || value === null) return String(value);
|
|
@@ -5178,6 +5218,7 @@ function parseCodexAspTranscript(transcript) {
|
|
|
5178
5218
|
if (message) {
|
|
5179
5219
|
messages.push(message);
|
|
5180
5220
|
}
|
|
5221
|
+
messages.push(...skillMessagesForItem(item));
|
|
5181
5222
|
}
|
|
5182
5223
|
return messages;
|
|
5183
5224
|
}
|
|
@@ -10608,7 +10649,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
|
|
|
10608
10649
|
var MIN_CODEX_CLI_VERSION = "0.144.6";
|
|
10609
10650
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
10610
10651
|
var codexCliVersionEnsured = null;
|
|
10611
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
10652
|
+
var ENGINE_PACKAGE_VERSION = "0.1.556";
|
|
10612
10653
|
var INITIALIZE_METHOD = "initialize";
|
|
10613
10654
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
10614
10655
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -11027,10 +11068,12 @@ function userImagesForInput(input) {
|
|
|
11027
11068
|
function itemToTranscriptItem(item, timestamp, status) {
|
|
11028
11069
|
if (item.type === "userMessage") {
|
|
11029
11070
|
const content = item.content.filter((input) => input.type === "text").map((input) => input.text).join("\n");
|
|
11071
|
+
const skillNames = item.content.filter((input) => input.type === "skill").map((input) => input.name).filter((name) => name.trim().length > 0);
|
|
11030
11072
|
return {
|
|
11031
11073
|
type: "userMessage",
|
|
11032
11074
|
id: item.id,
|
|
11033
11075
|
content,
|
|
11076
|
+
...skillNames.length > 0 ? { skillNames } : {},
|
|
11034
11077
|
images: userImagesForInput(item.content),
|
|
11035
11078
|
timestamp
|
|
11036
11079
|
};
|
|
@@ -14034,6 +14077,11 @@ function registerOpenRouterModels(modelRegistry, apiKey, modelIds) {
|
|
|
14034
14077
|
function eventPayload(event) {
|
|
14035
14078
|
return isRecord4(event) ? { ...event } : { value: event };
|
|
14036
14079
|
}
|
|
14080
|
+
function explicitSkillName(session, message) {
|
|
14081
|
+
const match = message.match(/^\/skill:([^\s]+)(?:\s|$)/);
|
|
14082
|
+
if (!match) return null;
|
|
14083
|
+
return session.resourceLoader.getSkills().skills.some((skill) => skill.name === match[1]) ? match[1] : null;
|
|
14084
|
+
}
|
|
14037
14085
|
function registerCommandProtection(cwd) {
|
|
14038
14086
|
return (pi) => {
|
|
14039
14087
|
pi.on("tool_call", async (event) => {
|
|
@@ -14079,8 +14127,10 @@ var PiManager = class extends CodingAgentManager {
|
|
|
14079
14127
|
await this.session?.abort();
|
|
14080
14128
|
}
|
|
14081
14129
|
async steerRequest(request) {
|
|
14082
|
-
|
|
14083
|
-
|
|
14130
|
+
const session = this.session;
|
|
14131
|
+
if (!session?.isStreaming) return false;
|
|
14132
|
+
await session.steer(request.message);
|
|
14133
|
+
this.recordUserMessage(session, request.message);
|
|
14084
14134
|
return true;
|
|
14085
14135
|
}
|
|
14086
14136
|
async getHistory() {
|
|
@@ -14196,10 +14246,18 @@ var PiManager = class extends CodingAgentManager {
|
|
|
14196
14246
|
const payload = eventPayload(event);
|
|
14197
14247
|
this.recordHistoryEvent(`pi-${event.type}`, payload, this.historyFile);
|
|
14198
14248
|
}
|
|
14249
|
+
recordUserMessage(session, message) {
|
|
14250
|
+
const skillName = explicitSkillName(session, message);
|
|
14251
|
+
this.recordHistoryEvent("event_msg", {
|
|
14252
|
+
type: "user_message",
|
|
14253
|
+
message,
|
|
14254
|
+
...skillName ? { skillName } : {}
|
|
14255
|
+
}, this.historyFile);
|
|
14256
|
+
}
|
|
14199
14257
|
async processMessageInternal(request) {
|
|
14200
14258
|
try {
|
|
14201
14259
|
const session = await this.ensureSession(request);
|
|
14202
|
-
this.
|
|
14260
|
+
this.recordUserMessage(session, request.message);
|
|
14203
14261
|
const images = request.images && request.images.length > 0 ? (await normalizeImages(request.images)).map((image) => ({
|
|
14204
14262
|
type: "image",
|
|
14205
14263
|
data: image.source.data,
|
|
@@ -14943,9 +15001,10 @@ function mcpNameFromToolCall(message) {
|
|
|
14943
15001
|
}
|
|
14944
15002
|
return NON_MCP_SERVERS.has(message.server) ? null : message.server;
|
|
14945
15003
|
}
|
|
14946
|
-
function extractSkillMcpCalls(messages) {
|
|
15004
|
+
function extractSkillMcpCalls(messages, provider) {
|
|
14947
15005
|
return messages.flatMap((message) => {
|
|
14948
15006
|
if (message.type === "skill") {
|
|
15007
|
+
if (provider === "relay") return [];
|
|
14949
15008
|
return [{ kind: "skill", id: message.id, skillName: message.skillName, occurredAt: message.timestamp }];
|
|
14950
15009
|
}
|
|
14951
15010
|
if (message.type !== "tool_call") return [];
|
|
@@ -15008,7 +15067,7 @@ var AnalyticsService = class {
|
|
|
15008
15067
|
noteSkillMcpCalls(chatId, messages) {
|
|
15009
15068
|
const turn = this.activeTurns.get(chatId);
|
|
15010
15069
|
if (!turn) return;
|
|
15011
|
-
for (const call of extractSkillMcpCalls(messages)) {
|
|
15070
|
+
for (const call of extractSkillMcpCalls(messages, turn.provider)) {
|
|
15012
15071
|
if (turn.seenCallIds.has(call.id)) continue;
|
|
15013
15072
|
turn.seenCallIds.add(call.id);
|
|
15014
15073
|
const common = {
|
|
@@ -16241,15 +16300,10 @@ var ChatService = class {
|
|
|
16241
16300
|
}
|
|
16242
16301
|
const codexTranscript = getCodexTranscriptFromEvent(event);
|
|
16243
16302
|
if (chat.hasActiveTurn) {
|
|
16244
|
-
const displayMessages = parseDisplayMessages(
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
{
|
|
16249
|
-
filter: false,
|
|
16250
|
-
parentToolUseId: typeof event.payload.parent_tool_use_id === "string" ? event.payload.parent_tool_use_id : null
|
|
16251
|
-
}
|
|
16252
|
-
);
|
|
16303
|
+
const displayMessages = codexTranscript ? parseLatestCodexAspTranscriptTurn(codexTranscript) : parseDisplayMessages([event], chat.persisted.provider, null, {
|
|
16304
|
+
filter: false,
|
|
16305
|
+
parentToolUseId: typeof event.payload.parent_tool_use_id === "string" ? event.payload.parent_tool_use_id : null
|
|
16306
|
+
});
|
|
16253
16307
|
this.analyticsService.noteSkillMcpCalls(chatId, displayMessages);
|
|
16254
16308
|
}
|
|
16255
16309
|
const terminalErrors = terminalErrorsFromEvent(event, chat.persisted.provider, codexTranscript);
|