replicas-engine 0.1.1363 → 0.1.1365
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-UNKNQSUT.js → asp-host-BRGFQFHZ.js} +2 -2
- package/dist/src/{chunk-TPN7XDWM.js → chunk-3FLP6Y2W.js} +1 -1
- package/dist/src/{chunk-B4JWWQR5.js → chunk-EP357UKU.js} +1 -1
- package/dist/src/{chunk-2WJHTBM5.js → chunk-VMYOMUFX.js} +3 -3
- package/dist/src/headless-agent.js +2 -2
- package/dist/src/index.js +40 -20
- package/package.json +1 -1
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
listRunningCodexModels,
|
|
9
9
|
restartCodexAspHost,
|
|
10
10
|
restartCodexAspHostIfRunning
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-VMYOMUFX.js";
|
|
12
12
|
import "./chunk-YQI4XGIX.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-EP357UKU.js";
|
|
14
14
|
import "./chunk-QCX45VR3.js";
|
|
15
15
|
import "./chunk-UZSNFLDQ.js";
|
|
16
16
|
import "./chunk-TQ6XAXNA.js";
|
|
@@ -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.1365";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
AppServerProcess,
|
|
16
16
|
buildCodexAgentEnv
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-EP357UKU.js";
|
|
18
18
|
import {
|
|
19
19
|
SUBPROCESS_MAX_BUFFER,
|
|
20
20
|
execFileAsync
|
|
@@ -319,7 +319,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
319
319
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
320
320
|
await this.applyCredentialsResponse(data);
|
|
321
321
|
setAgentCredentialSnapshot("codex", data);
|
|
322
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
322
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-BRGFQFHZ.js");
|
|
323
323
|
await restartCodexAspHostIfRunning2();
|
|
324
324
|
});
|
|
325
325
|
await this.start(true);
|
|
@@ -341,7 +341,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
341
341
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
342
342
|
await this.applyCredentialsResponse(data);
|
|
343
343
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
344
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
344
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-BRGFQFHZ.js");
|
|
345
345
|
await restartCodexAspHostIfRunning2();
|
|
346
346
|
}
|
|
347
347
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -14,11 +14,11 @@ import {
|
|
|
14
14
|
recoverCompletedTurn,
|
|
15
15
|
spawnMuseMsp,
|
|
16
16
|
startMuseSession
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3FLP6Y2W.js";
|
|
18
18
|
import {
|
|
19
19
|
AppServerProcess,
|
|
20
20
|
buildCodexAgentEnv
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-EP357UKU.js";
|
|
22
22
|
import "./chunk-QCX45VR3.js";
|
|
23
23
|
import {
|
|
24
24
|
AGENT,
|
package/dist/src/index.js
CHANGED
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
spawnMuseMsp,
|
|
66
66
|
startMuseSession,
|
|
67
67
|
uuidV7
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-3FLP6Y2W.js";
|
|
69
69
|
import {
|
|
70
70
|
publishedPullRequestUrls
|
|
71
71
|
} from "./chunk-6FLA4WPX.js";
|
|
@@ -143,7 +143,7 @@ import {
|
|
|
143
143
|
timestampFromSeconds,
|
|
144
144
|
upsertCredentialFileLines,
|
|
145
145
|
writeSecureCredentialFile
|
|
146
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-VMYOMUFX.js";
|
|
147
147
|
import {
|
|
148
148
|
ENGINE_ENV,
|
|
149
149
|
monolithRequest,
|
|
@@ -156,7 +156,7 @@ import {
|
|
|
156
156
|
} from "./chunk-YQI4XGIX.js";
|
|
157
157
|
import {
|
|
158
158
|
getCodexModelProvider
|
|
159
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-EP357UKU.js";
|
|
160
160
|
import {
|
|
161
161
|
SUBPROCESS_MAX_BUFFER,
|
|
162
162
|
execAsync,
|
|
@@ -12054,20 +12054,15 @@ ${note}` };
|
|
|
12054
12054
|
await this.initialized;
|
|
12055
12055
|
const queued = this.messageQueue.getQueue().some(({ id }) => id === messageId);
|
|
12056
12056
|
if (!queued && !this.unreadSteers.has(messageId)) return { success: false, queue: this.getQueue() };
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
return { success: true, queue: this.getQueue() };
|
|
12061
|
-
}
|
|
12062
|
-
if (this.unreadSteers.has(messageId)) {
|
|
12063
|
-
await this.deliverSteersNow();
|
|
12064
|
-
return { success: true, queue: this.getQueue() };
|
|
12065
|
-
}
|
|
12057
|
+
if (this.messageQueue.isProcessing() && (!queued || (await this.steerFromQueue(messageId)).success)) {
|
|
12058
|
+
if (this.unreadSteers.has(messageId) && this.canDeliverSteersNow()) await this.deliverSteersNow();
|
|
12059
|
+
return { success: true, queue: this.getQueue() };
|
|
12066
12060
|
}
|
|
12067
12061
|
this.requeueUnreadSteers();
|
|
12068
12062
|
const taken = this.messageQueue.takeFromQueue(messageId);
|
|
12069
|
-
if (taken) this.
|
|
12070
|
-
|
|
12063
|
+
if (!taken) return { success: true, queue: this.getQueue() };
|
|
12064
|
+
this.messageQueue.restoreToQueue(taken.message, 0);
|
|
12065
|
+
if (this.messageQueue.isProcessing()) {
|
|
12071
12066
|
this.recordInterrupted((/* @__PURE__ */ new Date()).toISOString(), true);
|
|
12072
12067
|
this.messageQueue.cancelActiveTurn();
|
|
12073
12068
|
await this.interruptActiveTurn();
|
|
@@ -13164,6 +13159,9 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13164
13159
|
turnPromptRecorded = false;
|
|
13165
13160
|
// Claude Code never sees a prompt stopped before it started, so it is sent again with the next message.
|
|
13166
13161
|
unreadPrompt = null;
|
|
13162
|
+
runningTools = /* @__PURE__ */ new Map();
|
|
13163
|
+
// Claude Code tells the model the user rejected the tool calls a stop cuts off, so the next prompt corrects that.
|
|
13164
|
+
cutOffTools = /* @__PURE__ */ new Map();
|
|
13167
13165
|
backgroundTasks = new ClaudeBackgroundTasks();
|
|
13168
13166
|
backgroundRecoveryAttempted = false;
|
|
13169
13167
|
// Ultracode workflow child agents never reach the SDK stream (forwardSubagentText
|
|
@@ -13815,10 +13813,21 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13815
13813
|
}
|
|
13816
13814
|
await this.dropRecordedUnreadPrompt();
|
|
13817
13815
|
const prompt = goalCommand ? [{ type: "text", text: `/goal ${goalObjective ?? "clear"}` }] : userMessage.message.content;
|
|
13818
|
-
const
|
|
13816
|
+
const notedCutOffs = [...this.cutOffTools.keys()];
|
|
13817
|
+
const cutOffNote = notedCutOffs.length > 0 ? [{
|
|
13818
|
+
type: "text",
|
|
13819
|
+
text: wrapInTag(`The user interrupted your last turn, cutting off these tool calls before they returned: ${[...new Set(this.cutOffTools.values())].map((name) => `\`${name}\``).join(", ")}. Nobody rejected them, whatever their results say. They may or may not have taken effect, so check before relying on or repeating them.`, REPLICAS_INSTRUCTIONS_TAG)
|
|
13820
|
+
}] : [];
|
|
13821
|
+
const dropNotedCutOffs = () => {
|
|
13822
|
+
for (const id of notedCutOffs) this.cutOffTools.delete(id);
|
|
13823
|
+
};
|
|
13824
|
+
const content = appendUserContent(appendUserContent(cutOffNote, this.unreadPrompt?.content ?? []), prompt);
|
|
13819
13825
|
if (this.pendingInterrupt || options.signal?.aborted) {
|
|
13820
13826
|
this.pendingInterrupt = false;
|
|
13821
|
-
if (!options.engineTurn)
|
|
13827
|
+
if (!options.engineTurn) {
|
|
13828
|
+
this.unreadPrompt = { uuid: userMessage.uuid, content };
|
|
13829
|
+
dropNotedCutOffs();
|
|
13830
|
+
}
|
|
13822
13831
|
return;
|
|
13823
13832
|
}
|
|
13824
13833
|
this.turnPromptRecorded = false;
|
|
@@ -13837,6 +13846,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13837
13846
|
void this.deliverEarlySteers();
|
|
13838
13847
|
});
|
|
13839
13848
|
} finally {
|
|
13849
|
+
if (this.turnPromptRecorded || options.signal?.aborted && !options.engineTurn) dropNotedCutOffs();
|
|
13840
13850
|
if (this.turnPromptRecorded) this.unreadPrompt = null;
|
|
13841
13851
|
else if (options.signal?.aborted && !options.engineTurn) this.unreadPrompt = { uuid: userMessage.uuid, content };
|
|
13842
13852
|
}
|
|
@@ -14065,6 +14075,15 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
14065
14075
|
if (next.done || this.activeQuery !== response) break;
|
|
14066
14076
|
const msg = next.value;
|
|
14067
14077
|
if (!msg) break;
|
|
14078
|
+
if ((msg.type === "assistant" || msg.type === "user") && msg.parent_tool_use_id === null && Array.isArray(msg.message.content)) {
|
|
14079
|
+
for (const block of msg.message.content) {
|
|
14080
|
+
if (block.type === "tool_use") this.runningTools.set(block.id, block.name);
|
|
14081
|
+
if (block.type !== "tool_result") continue;
|
|
14082
|
+
const name = this.runningTools.get(block.tool_use_id);
|
|
14083
|
+
this.runningTools.delete(block.tool_use_id);
|
|
14084
|
+
if (name && this.pendingInterrupt && block.is_error) this.cutOffTools.set(block.tool_use_id, name);
|
|
14085
|
+
}
|
|
14086
|
+
}
|
|
14068
14087
|
if (this.pendingInterrupt) {
|
|
14069
14088
|
if (msg.type === "assistant" || msg.type === "user") await this.recordEvent(msg);
|
|
14070
14089
|
else if (msg.type === "result") this.stoppedTurnEnded?.resolve();
|
|
@@ -14202,6 +14221,7 @@ ${msg.result}` } : { ...msg, errors: [loginFailure, ...msg.errors] } : msg);
|
|
|
14202
14221
|
}
|
|
14203
14222
|
this.partialMessageFlushTimers.clear();
|
|
14204
14223
|
this.partialMessageStreams.clear();
|
|
14224
|
+
this.runningTools.clear();
|
|
14205
14225
|
if (hadBackgroundTasks && !this.isProcessing()) this.onProcessingChanged(false);
|
|
14206
14226
|
}
|
|
14207
14227
|
resolvePendingTurn() {
|
|
@@ -16188,11 +16208,11 @@ var CursorManager = class extends CodingAgentManager {
|
|
|
16188
16208
|
await this.cancelRun(this.activeRun);
|
|
16189
16209
|
this.abortActiveTurn?.();
|
|
16190
16210
|
}
|
|
16191
|
-
// Cursor's steer API is text-only, so an image message
|
|
16211
|
+
// Cursor's steer API is text-only, so an image message waits for the turn to end.
|
|
16192
16212
|
async steerFromQueue(messageId) {
|
|
16193
16213
|
await this.initialized;
|
|
16194
16214
|
const queued = this.messageQueue.getQueue().find(({ id }) => id === messageId);
|
|
16195
|
-
return queued?.images?.length ? this.
|
|
16215
|
+
return queued?.images?.length ? { success: false, queue: this.getQueue() } : super.steerFromQueue(messageId);
|
|
16196
16216
|
}
|
|
16197
16217
|
// Cursor's steer resolves once the turn appends the message, so it settles later; the turn
|
|
16198
16218
|
// waits for pending steers before completing, and an unread one is requeued as a follow-up.
|
|
@@ -60576,7 +60596,7 @@ var ChatService = class {
|
|
|
60576
60596
|
requireSubagent(parentChatId, chatId) {
|
|
60577
60597
|
this.requireSubagentParent(parentChatId);
|
|
60578
60598
|
const child = this.requireChat(chatId);
|
|
60579
|
-
if (child.persisted.parentChatId !== parentChatId) throw new Error("Chat is not a subagent of this chat");
|
|
60599
|
+
if (child.persisted.parentChatId !== parentChatId || child.persisted.fork?.trigger === "side") throw new Error("Chat is not a subagent of this chat");
|
|
60580
60600
|
return child;
|
|
60581
60601
|
}
|
|
60582
60602
|
async waitForSubagent(parentChatId, chatId, timeoutMinutes, signal) {
|
|
@@ -61996,7 +62016,7 @@ ${note}`;
|
|
|
61996
62016
|
if (chat.persisted.parentChatId) {
|
|
61997
62017
|
this.publish({ type: "chat.updated", payload: { chat: this.toSummary(chat) } }).catch(() => {
|
|
61998
62018
|
});
|
|
61999
|
-
if (!processing) void this.reportSubagentToParent(chat, completedAt, chat.lastTurnErrors);
|
|
62019
|
+
if (!processing && chat.persisted.fork?.trigger !== "side") void this.reportSubagentToParent(chat, completedAt, chat.lastTurnErrors);
|
|
62000
62020
|
return;
|
|
62001
62021
|
}
|
|
62002
62022
|
this.publish({
|