replicas-engine 0.1.902 → 0.1.903
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.
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
getCodexAspHost,
|
|
6
6
|
restartCodexAspHost,
|
|
7
7
|
restartCodexAspHostIfRunning
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GAA77UNT.js";
|
|
9
9
|
import "./chunk-OBD4D4AW.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-6YQDDPWU.js";
|
|
11
11
|
import "./chunk-UZSNFLDQ.js";
|
|
12
12
|
import "./chunk-2ROQAUB6.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
@@ -245,7 +245,7 @@ function getCodexModelProvider(method) {
|
|
|
245
245
|
if (method === "foundry") return "azure";
|
|
246
246
|
return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
|
|
247
247
|
}
|
|
248
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
248
|
+
var ENGINE_PACKAGE_VERSION = "0.1.903";
|
|
249
249
|
var INITIALIZE_METHOD = "initialize";
|
|
250
250
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
251
251
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
SUBPROCESS_MAX_BUFFER,
|
|
12
12
|
buildCodexAgentEnv,
|
|
13
13
|
execFileAsync
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6YQDDPWU.js";
|
|
15
15
|
import {
|
|
16
16
|
isRecord
|
|
17
17
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -255,7 +255,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
255
255
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
256
256
|
await this.applyCredentialsResponse(data);
|
|
257
257
|
if (data.scope) setAgentCredentialSnapshot("codex", { method: data.type, scope: data.scope, revision: data.revision });
|
|
258
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
258
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-FPOYHV6O.js");
|
|
259
259
|
await restartCodexAspHostIfRunning2();
|
|
260
260
|
});
|
|
261
261
|
await this.start(true);
|
|
@@ -275,7 +275,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
275
275
|
await this.applyCredentialUpdate(generation, async () => {
|
|
276
276
|
await this.applyCredentialsResponse(data);
|
|
277
277
|
if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
|
|
278
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
278
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-FPOYHV6O.js");
|
|
279
279
|
await restartCodexAspHostIfRunning2();
|
|
280
280
|
}
|
|
281
281
|
if (data.scope) {
|
package/dist/src/index.js
CHANGED
|
@@ -137,7 +137,7 @@ import {
|
|
|
137
137
|
refreshDelayMs,
|
|
138
138
|
restartCodexAspHost,
|
|
139
139
|
routineRefreshExclusions
|
|
140
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-GAA77UNT.js";
|
|
141
141
|
import {
|
|
142
142
|
ENGINE_ENV,
|
|
143
143
|
IS_WARMING_MODE,
|
|
@@ -151,7 +151,7 @@ import {
|
|
|
151
151
|
execAsync,
|
|
152
152
|
execFileAsync,
|
|
153
153
|
getCodexModelProvider
|
|
154
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-6YQDDPWU.js";
|
|
155
155
|
import {
|
|
156
156
|
isRecord as isRecord2
|
|
157
157
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -13179,12 +13179,16 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13179
13179
|
await this.abortAllPendingToolInputs();
|
|
13180
13180
|
await this.tearDownSession(true);
|
|
13181
13181
|
}
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
if (!
|
|
13187
|
-
await this.
|
|
13182
|
+
// Claude Code folds a `next`-priority prompt into the running turn at its next tool boundary.
|
|
13183
|
+
async steerRequest(request) {
|
|
13184
|
+
const pendingTurn = this.pendingTurn;
|
|
13185
|
+
const promptStream = this.activePromptStream;
|
|
13186
|
+
if (!pendingTurn || !promptStream) return false;
|
|
13187
|
+
const userMessage = await this.buildUserMessage(request);
|
|
13188
|
+
if (this.pendingTurn !== pendingTurn || this.activePromptStream !== promptStream) return false;
|
|
13189
|
+
pendingTurn.userMessageUuids.add(userMessage.uuid);
|
|
13190
|
+
await this.recordEvent(userMessage, request.messageId);
|
|
13191
|
+
promptStream.push({ ...userMessage, priority: "next" });
|
|
13188
13192
|
return true;
|
|
13189
13193
|
}
|
|
13190
13194
|
async abortAllPendingToolInputs() {
|
|
@@ -13574,7 +13578,6 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13574
13578
|
message,
|
|
13575
13579
|
model,
|
|
13576
13580
|
customInstructions,
|
|
13577
|
-
images,
|
|
13578
13581
|
planMode,
|
|
13579
13582
|
thinkingLevel,
|
|
13580
13583
|
enableInteractiveTools,
|
|
@@ -13585,36 +13588,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13585
13588
|
}
|
|
13586
13589
|
await this.initialized;
|
|
13587
13590
|
this.pendingInterrupt = false;
|
|
13588
|
-
const
|
|
13589
|
-
{
|
|
13590
|
-
type: "text",
|
|
13591
|
-
text: message
|
|
13592
|
-
}
|
|
13593
|
-
];
|
|
13594
|
-
if (images && images.length > 0) {
|
|
13595
|
-
const normalizedImages = await normalizeImages(images);
|
|
13596
|
-
for (const image of normalizedImages) {
|
|
13597
|
-
content.push({
|
|
13598
|
-
type: "image",
|
|
13599
|
-
source: {
|
|
13600
|
-
type: "base64",
|
|
13601
|
-
media_type: image.source.media_type,
|
|
13602
|
-
data: image.source.data
|
|
13603
|
-
}
|
|
13604
|
-
});
|
|
13605
|
-
}
|
|
13606
|
-
}
|
|
13607
|
-
const userMessageUuid = randomUUID5();
|
|
13608
|
-
const userMessage = {
|
|
13609
|
-
type: "user",
|
|
13610
|
-
uuid: userMessageUuid,
|
|
13611
|
-
message: {
|
|
13612
|
-
role: "user",
|
|
13613
|
-
content
|
|
13614
|
-
},
|
|
13615
|
-
parent_tool_use_id: null,
|
|
13616
|
-
session_id: this.sessionId ?? ""
|
|
13617
|
-
};
|
|
13591
|
+
const userMessage = await this.buildUserMessage(request);
|
|
13618
13592
|
if (!options.skipUserMessageRecord) {
|
|
13619
13593
|
await this.recordEvent(userMessage, request.messageId);
|
|
13620
13594
|
}
|
|
@@ -13653,10 +13627,41 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13653
13627
|
return;
|
|
13654
13628
|
}
|
|
13655
13629
|
await new Promise((resolve8, reject) => {
|
|
13656
|
-
this.pendingTurn = { resolve: resolve8, reject, sawActivity: false,
|
|
13630
|
+
this.pendingTurn = { resolve: resolve8, reject, sawActivity: false, userMessageUuids: /* @__PURE__ */ new Set([userMessage.uuid]) };
|
|
13657
13631
|
promptStream.push(userMessage);
|
|
13658
13632
|
});
|
|
13659
13633
|
}
|
|
13634
|
+
async buildUserMessage({ message, images }) {
|
|
13635
|
+
const content = [
|
|
13636
|
+
{
|
|
13637
|
+
type: "text",
|
|
13638
|
+
text: message
|
|
13639
|
+
}
|
|
13640
|
+
];
|
|
13641
|
+
if (images && images.length > 0) {
|
|
13642
|
+
const normalizedImages = await normalizeImages(images);
|
|
13643
|
+
for (const image of normalizedImages) {
|
|
13644
|
+
content.push({
|
|
13645
|
+
type: "image",
|
|
13646
|
+
source: {
|
|
13647
|
+
type: "base64",
|
|
13648
|
+
media_type: image.source.media_type,
|
|
13649
|
+
data: image.source.data
|
|
13650
|
+
}
|
|
13651
|
+
});
|
|
13652
|
+
}
|
|
13653
|
+
}
|
|
13654
|
+
return {
|
|
13655
|
+
type: "user",
|
|
13656
|
+
uuid: randomUUID5(),
|
|
13657
|
+
message: {
|
|
13658
|
+
role: "user",
|
|
13659
|
+
content
|
|
13660
|
+
},
|
|
13661
|
+
parent_tool_use_id: null,
|
|
13662
|
+
session_id: this.sessionId ?? ""
|
|
13663
|
+
};
|
|
13664
|
+
}
|
|
13660
13665
|
async ensureSession(args) {
|
|
13661
13666
|
const {
|
|
13662
13667
|
signature,
|
|
@@ -13888,7 +13893,11 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13888
13893
|
await this.recordContextUsage(response);
|
|
13889
13894
|
if (this.activeQuery !== response) break;
|
|
13890
13895
|
this.sessionLinearForwarder?.flushThoughtAsResponse();
|
|
13891
|
-
|
|
13896
|
+
const pendingUuids = this.pendingTurn?.userMessageUuids;
|
|
13897
|
+
if (msg.user_message_uuid) {
|
|
13898
|
+
for (const uuid of msg.user_message_uuids ?? [msg.user_message_uuid]) pendingUuids?.delete(uuid);
|
|
13899
|
+
if (pendingUuids?.size === 0) this.resolvePendingTurn();
|
|
13900
|
+
} else if (!msg.origin || msg.origin.kind === "human") {
|
|
13892
13901
|
this.resolvePendingTurn();
|
|
13893
13902
|
}
|
|
13894
13903
|
}
|
|
@@ -62137,31 +62146,10 @@ var ChatService = class {
|
|
|
62137
62146
|
}
|
|
62138
62147
|
async steerFromQueue(chatId, messageId) {
|
|
62139
62148
|
const chat = this.requireChat(chatId);
|
|
62140
|
-
const queuedMessageIds = new Set(chat.provider.getQueue().map((message) => message.id));
|
|
62141
|
-
const interruptedMessageId = chat.activeMessageId ?? chat.pendingMessageIds.find((pendingMessageId) => !queuedMessageIds.has(pendingMessageId)) ?? null;
|
|
62142
62149
|
const result = await chat.provider.steerFromQueue(messageId);
|
|
62143
|
-
if (
|
|
62144
|
-
return result;
|
|
62145
|
-
}
|
|
62146
|
-
if (getChatExecutionProvider(chat.persisted) !== "claude") {
|
|
62150
|
+
if (result.success) {
|
|
62147
62151
|
chat.pendingMessageIds = chat.pendingMessageIds.filter((pendingMessageId) => pendingMessageId !== messageId);
|
|
62148
|
-
return result;
|
|
62149
62152
|
}
|
|
62150
|
-
chat.pendingMessageIds = [
|
|
62151
|
-
messageId,
|
|
62152
|
-
...chat.pendingMessageIds.filter((pendingMessageId) => pendingMessageId !== messageId && pendingMessageId !== interruptedMessageId)
|
|
62153
|
-
];
|
|
62154
|
-
this.endTrackedTurn(chatId);
|
|
62155
|
-
chat.hasActiveTurn = false;
|
|
62156
|
-
chat.activeMessageId = null;
|
|
62157
|
-
if (interruptedMessageId) {
|
|
62158
|
-
chat.acceptedUserEvents.delete(interruptedMessageId);
|
|
62159
|
-
}
|
|
62160
|
-
this.touch(chat);
|
|
62161
|
-
await this.publish({
|
|
62162
|
-
type: "chat.interrupted",
|
|
62163
|
-
payload: { chatId, interrupted: true, queue: [] }
|
|
62164
|
-
});
|
|
62165
62153
|
return result;
|
|
62166
62154
|
}
|
|
62167
62155
|
async respondToToolInput(chatId, requestId, selectionId) {
|