replicas-engine 0.1.1361 → 0.1.1363
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-OBF4WP6L.js → asp-host-UNKNQSUT.js} +2 -2
- package/dist/src/{chunk-ZDKOXODA.js → chunk-2WJHTBM5.js} +3 -3
- package/dist/src/{chunk-JP54MG3X.js → chunk-B4JWWQR5.js} +1 -1
- package/dist/src/{chunk-NQSMRY4V.js → chunk-TPN7XDWM.js} +1 -1
- package/dist/src/headless-agent.js +2 -2
- package/dist/src/index.js +25 -12
- 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-2WJHTBM5.js";
|
|
12
12
|
import "./chunk-YQI4XGIX.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-B4JWWQR5.js";
|
|
14
14
|
import "./chunk-QCX45VR3.js";
|
|
15
15
|
import "./chunk-UZSNFLDQ.js";
|
|
16
16
|
import "./chunk-TQ6XAXNA.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
AppServerProcess,
|
|
16
16
|
buildCodexAgentEnv
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-B4JWWQR5.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-UNKNQSUT.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-UNKNQSUT.js");
|
|
345
345
|
await restartCodexAspHostIfRunning2();
|
|
346
346
|
}
|
|
347
347
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -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.1363";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -14,11 +14,11 @@ import {
|
|
|
14
14
|
recoverCompletedTurn,
|
|
15
15
|
spawnMuseMsp,
|
|
16
16
|
startMuseSession
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TPN7XDWM.js";
|
|
18
18
|
import {
|
|
19
19
|
AppServerProcess,
|
|
20
20
|
buildCodexAgentEnv
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-B4JWWQR5.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-TPN7XDWM.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-2WJHTBM5.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-B4JWWQR5.js";
|
|
160
160
|
import {
|
|
161
161
|
SUBPROCESS_MAX_BUFFER,
|
|
162
162
|
execAsync,
|
|
@@ -11721,6 +11721,7 @@ var CodingAgentManager = class _CodingAgentManager {
|
|
|
11721
11721
|
usesAutoCompactTokens;
|
|
11722
11722
|
autoCompactTokens = null;
|
|
11723
11723
|
unreadSteers = /* @__PURE__ */ new Map();
|
|
11724
|
+
// A harness can read a steer before steerRequest returns, so a read is noted here until the steer settles.
|
|
11724
11725
|
steersInFlight = /* @__PURE__ */ new Map();
|
|
11725
11726
|
steerSettlements = /* @__PURE__ */ new Set();
|
|
11726
11727
|
earlySteers = [];
|
|
@@ -11962,7 +11963,8 @@ ${request.message}` }, senderKey };
|
|
|
11962
11963
|
getQueue() {
|
|
11963
11964
|
return [
|
|
11964
11965
|
...[...this.unreadSteers.values()].map(({ message, steeredAt }) => ({ ...toQueuedMessageInfo(message), steeredAt })),
|
|
11965
|
-
...[...this.steersInFlight.values()
|
|
11966
|
+
...[...this.steersInFlight.values()].filter(({ read }) => !read).map(({ message }) => toQueuedMessageInfo(message)),
|
|
11967
|
+
...this.messageQueue.getQueue().map(toQueuedMessageInfo)
|
|
11966
11968
|
];
|
|
11967
11969
|
}
|
|
11968
11970
|
async removeFromQueue(messageId, persistRemoval) {
|
|
@@ -12018,7 +12020,6 @@ ${request.message}` }, senderKey };
|
|
|
12018
12020
|
if (!taken) {
|
|
12019
12021
|
return { success: false, queue: this.getQueue() };
|
|
12020
12022
|
}
|
|
12021
|
-
this.steersInFlight.set(messageId, taken.message);
|
|
12022
12023
|
let steered = false;
|
|
12023
12024
|
const { request: withSender, senderKey } = this.withSenderLine(taken.message);
|
|
12024
12025
|
const note = wrapInTag("You received this message while working. The chat folds everything before your last message of this turn, so that message must answer it too, even if you already did earlier.", REPLICAS_INSTRUCTIONS_TAG);
|
|
@@ -12026,18 +12027,21 @@ ${request.message}` }, senderKey };
|
|
|
12026
12027
|
const delivered = command ? withSender : { ...withSender, message: `${withSender.message}
|
|
12027
12028
|
|
|
12028
12029
|
${note}` };
|
|
12030
|
+
const inFlight = { message: taken.message, delivered, read: false };
|
|
12031
|
+
this.steersInFlight.set(messageId, inFlight);
|
|
12029
12032
|
try {
|
|
12030
12033
|
steered = this.earlySteers.length === 0 && await this.steerRequest(delivered);
|
|
12031
|
-
if (!steered && this.turnOpen && !command && this.steerRequest !== _CodingAgentManager.prototype.steerRequest) {
|
|
12034
|
+
if (!steered && !inFlight.read && this.turnOpen && !command && this.steerRequest !== _CodingAgentManager.prototype.steerRequest) {
|
|
12032
12035
|
this.earlySteers.push(delivered);
|
|
12033
12036
|
steered = true;
|
|
12034
12037
|
void this.deliverEarlySteers();
|
|
12035
12038
|
}
|
|
12036
|
-
if (steered) await this.saveLastSenderKey(senderKey);
|
|
12039
|
+
if (steered || inFlight.read) await this.saveLastSenderKey(senderKey);
|
|
12037
12040
|
} catch (error) {
|
|
12038
12041
|
console.error("[CodingAgentManager] steerRequest threw, keeping message queued:", error);
|
|
12039
12042
|
}
|
|
12040
12043
|
this.steersInFlight.delete(messageId);
|
|
12044
|
+
if (inFlight.read) return { success: true, queue: this.getQueue() };
|
|
12041
12045
|
if (steered) {
|
|
12042
12046
|
this.unreadSteers.set(messageId, { message: taken.message, delivered, steeredAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
12043
12047
|
this.onQueueChanged();
|
|
@@ -12052,7 +12056,9 @@ ${note}` };
|
|
|
12052
12056
|
if (!queued && !this.unreadSteers.has(messageId)) return { success: false, queue: this.getQueue() };
|
|
12053
12057
|
const turnRunning = this.messageQueue.isProcessing();
|
|
12054
12058
|
if (turnRunning && this.canDeliverSteersNow()) {
|
|
12055
|
-
if (queued
|
|
12059
|
+
if (queued && (await this.steerFromQueue(messageId)).success && !this.unreadSteers.has(messageId)) {
|
|
12060
|
+
return { success: true, queue: this.getQueue() };
|
|
12061
|
+
}
|
|
12056
12062
|
if (this.unreadSteers.has(messageId)) {
|
|
12057
12063
|
await this.deliverSteersNow();
|
|
12058
12064
|
return { success: true, queue: this.getQueue() };
|
|
@@ -12087,7 +12093,12 @@ ${note}` };
|
|
|
12087
12093
|
markSteerRead(messageId) {
|
|
12088
12094
|
const steer = this.unreadSteers.get(messageId);
|
|
12089
12095
|
if (this.unreadSteers.delete(messageId)) this.onQueueChanged();
|
|
12090
|
-
|
|
12096
|
+
const inFlight = this.steersInFlight.get(messageId);
|
|
12097
|
+
if (inFlight && !inFlight.read) {
|
|
12098
|
+
inFlight.read = true;
|
|
12099
|
+
this.onQueueChanged();
|
|
12100
|
+
}
|
|
12101
|
+
return steer?.delivered ?? inFlight?.delivered ?? this.messageQueue.takeFromQueue(messageId)?.message;
|
|
12091
12102
|
}
|
|
12092
12103
|
canDeliverSteersNow() {
|
|
12093
12104
|
return false;
|
|
@@ -61970,8 +61981,10 @@ ${note}`;
|
|
|
61970
61981
|
}
|
|
61971
61982
|
const stillProcessing = processing || forked;
|
|
61972
61983
|
const answer = chat.turnAnswer;
|
|
61984
|
+
const request = chat.turnRequest;
|
|
61973
61985
|
chat.turnAnswer = null;
|
|
61974
|
-
|
|
61986
|
+
if (answer) chat.turnRequest = null;
|
|
61987
|
+
const responseComplete = this.publishTurnCompleted(chat, completedAt, stillProcessing, answer, request, userTurn);
|
|
61975
61988
|
const completion = this.publishAgentTurnCompleteWebhook(chat, completedAt, stillProcessing, forked ? null : exhaustion, responseComplete, chat.turnCompletion).catch((error) => console.error("[ChatService] Failed to report turn completion:", { chatId, error })).finally(() => {
|
|
61976
61989
|
if (chat.turnCompletion === completion) chat.turnCompletion = null;
|
|
61977
61990
|
this.notifyWorkspaceAgentIdle();
|
|
@@ -61979,7 +61992,7 @@ ${note}`;
|
|
|
61979
61992
|
});
|
|
61980
61993
|
chat.turnCompletion = completion;
|
|
61981
61994
|
}
|
|
61982
|
-
async publishTurnCompleted(chat, completedAt, processing, answer, userTurn) {
|
|
61995
|
+
async publishTurnCompleted(chat, completedAt, processing, answer, request, userTurn) {
|
|
61983
61996
|
if (chat.persisted.parentChatId) {
|
|
61984
61997
|
this.publish({ type: "chat.updated", payload: { chat: this.toSummary(chat) } }).catch(() => {
|
|
61985
61998
|
});
|
|
@@ -62002,7 +62015,7 @@ ${note}`;
|
|
|
62002
62015
|
completedAt,
|
|
62003
62016
|
processing,
|
|
62004
62017
|
...userTurn || answer ? { chatId: chat.persisted.id } : {},
|
|
62005
|
-
...answer ? { finalMessage: answer, ...
|
|
62018
|
+
...answer ? { finalMessage: answer, ...request ? { request } : {} } : {},
|
|
62006
62019
|
...isPullRequestFeedbackChat(chat.persisted) ? { pullRequestFeedback: true } : {}
|
|
62007
62020
|
}
|
|
62008
62021
|
}, AbortSignal.timeout(1e4));
|