replicas-engine 0.1.1409 → 0.1.1410
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-UGWOQUUM.js → asp-host-7ANHAPMH.js} +2 -2
- package/dist/src/{chunk-UT4M3G7S.js → chunk-67NAZF37.js} +1 -1
- package/dist/src/{chunk-7NQSJFHH.js → chunk-H52RF7SR.js} +1 -1
- package/dist/src/{chunk-VIR2MHE6.js → chunk-LLLRQMDU.js} +3 -3
- package/dist/src/headless-agent.js +2 -2
- package/dist/src/index.js +37 -5
- package/package.json +1 -1
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
listCodexModelsForDetails,
|
|
9
9
|
restartCodexAspHost,
|
|
10
10
|
restartCodexAspHostIfRunning
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LLLRQMDU.js";
|
|
12
12
|
import "./chunk-NHUBCJNW.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-H52RF7SR.js";
|
|
14
14
|
import "./chunk-TUQXIQW2.js";
|
|
15
15
|
import "./chunk-UZSNFLDQ.js";
|
|
16
16
|
import "./chunk-MFWP7NCP.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.1410";
|
|
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-H52RF7SR.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-7ANHAPMH.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-7ANHAPMH.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-67NAZF37.js";
|
|
18
18
|
import {
|
|
19
19
|
AppServerProcess,
|
|
20
20
|
buildCodexAgentEnv
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-H52RF7SR.js";
|
|
22
22
|
import "./chunk-TUQXIQW2.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-67NAZF37.js";
|
|
69
69
|
import {
|
|
70
70
|
publishedPullRequestUrls
|
|
71
71
|
} from "./chunk-KLYGOYQ4.js";
|
|
@@ -143,7 +143,7 @@ import {
|
|
|
143
143
|
timestampFromSeconds,
|
|
144
144
|
upsertCredentialFileLines,
|
|
145
145
|
writeSecureCredentialFile
|
|
146
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-LLLRQMDU.js";
|
|
147
147
|
import {
|
|
148
148
|
ENGINE_ENV,
|
|
149
149
|
monolithRequest,
|
|
@@ -156,7 +156,7 @@ import {
|
|
|
156
156
|
} from "./chunk-NHUBCJNW.js";
|
|
157
157
|
import {
|
|
158
158
|
getCodexModelProvider
|
|
159
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-H52RF7SR.js";
|
|
160
160
|
import {
|
|
161
161
|
SUBPROCESS_MAX_BUFFER,
|
|
162
162
|
execAsync,
|
|
@@ -13191,6 +13191,12 @@ var ClaudeMissingSessionError = class extends Error {
|
|
|
13191
13191
|
this.name = "ClaudeMissingSessionError";
|
|
13192
13192
|
}
|
|
13193
13193
|
};
|
|
13194
|
+
var ClaudeContextBlockedError = class extends Error {
|
|
13195
|
+
constructor(message) {
|
|
13196
|
+
super(message);
|
|
13197
|
+
this.name = "ClaudeContextBlockedError";
|
|
13198
|
+
}
|
|
13199
|
+
};
|
|
13194
13200
|
var ClaudeQuotaError = class extends Error {
|
|
13195
13201
|
constructor(message, kind, resetsAt) {
|
|
13196
13202
|
super(message);
|
|
@@ -13654,6 +13660,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13654
13660
|
let transientRetries = 0;
|
|
13655
13661
|
let midTurnContinues = 0;
|
|
13656
13662
|
let missingSessionReset = false;
|
|
13663
|
+
let compactedForContext = false;
|
|
13664
|
+
let compactBeforeRetry = false;
|
|
13657
13665
|
let currentRequest = request;
|
|
13658
13666
|
let carriedSteers = /* @__PURE__ */ new Map();
|
|
13659
13667
|
this.turnLoginFailure = null;
|
|
@@ -13668,12 +13676,27 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13668
13676
|
carriedSteers = /* @__PURE__ */ new Map();
|
|
13669
13677
|
this.attemptSawActivity = false;
|
|
13670
13678
|
try {
|
|
13679
|
+
if (compactBeforeRetry) {
|
|
13680
|
+
await this.executeQuery({ ...currentRequest, message: "/compact", images: [], goalMode: false }, { skipUserMessageRecord: true, engineTurn: true, signal });
|
|
13681
|
+
compactBeforeRetry = false;
|
|
13682
|
+
}
|
|
13671
13683
|
await this.executeQuery(currentRequest, { skipUserMessageRecord: attempt > 0 || request.engineTurn, engineTurn: request.engineTurn, signal, steers });
|
|
13672
13684
|
return;
|
|
13673
13685
|
} catch (error) {
|
|
13674
13686
|
lastError = error;
|
|
13687
|
+
if (error instanceof ClaudeContextBlockedError) {
|
|
13688
|
+
if (compactedForContext) {
|
|
13689
|
+
await this.emitTerminalErrorResult(error.message, [error.message]);
|
|
13690
|
+
return;
|
|
13691
|
+
}
|
|
13692
|
+
compactedForContext = compactBeforeRetry = true;
|
|
13693
|
+
currentRequest = { ...currentRequest, message: request.message, images: request.images, goalMode: request.goalMode };
|
|
13694
|
+
carriedSteers = steers;
|
|
13695
|
+
attempt++;
|
|
13696
|
+
continue;
|
|
13697
|
+
}
|
|
13675
13698
|
if (this.attemptSawActivity) failedCredentials = [];
|
|
13676
|
-
if (this.turnPromptRecorded) {
|
|
13699
|
+
if (this.turnPromptRecorded && !compactBeforeRetry) {
|
|
13677
13700
|
currentRequest = { ...currentRequest, message: CLAUDE_RETRY_PROMPT, images: [], goalMode: false };
|
|
13678
13701
|
}
|
|
13679
13702
|
const modelUnavailable = error instanceof ClaudeModelUnavailableError;
|
|
@@ -14166,6 +14189,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
14166
14189
|
let creditsRequired = false;
|
|
14167
14190
|
let resetsAt;
|
|
14168
14191
|
let turnFailed = false;
|
|
14192
|
+
let heldRefusal = null;
|
|
14169
14193
|
try {
|
|
14170
14194
|
while (true) {
|
|
14171
14195
|
const next = await iterator.next();
|
|
@@ -14186,6 +14210,10 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
14186
14210
|
else if (msg.type === "result") this.stoppedTurnEnded?.resolve();
|
|
14187
14211
|
continue;
|
|
14188
14212
|
}
|
|
14213
|
+
if (msg.type === "assistant" && msg.error === "invalid_request" && msg.message.model === "<synthetic>") {
|
|
14214
|
+
heldRefusal = msg;
|
|
14215
|
+
continue;
|
|
14216
|
+
}
|
|
14189
14217
|
if (msg.type === "rate_limit_event") {
|
|
14190
14218
|
creditsRequired = msg.rate_limit_info.errorCode === "credits_required";
|
|
14191
14219
|
if (msg.rate_limit_info.status === "rejected" && msg.rate_limit_info.resetsAt) {
|
|
@@ -14194,7 +14222,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
14194
14222
|
}
|
|
14195
14223
|
const authErrorMessage = _ClaudeManager.detectAuthErrorInMessage(msg);
|
|
14196
14224
|
const transientErrorMessage = _ClaudeManager.detectTransientTurnErrorInMessage(msg);
|
|
14197
|
-
const turnError = authErrorMessage ? new ClaudeAuthError(authErrorMessage) : _ClaudeManager.isModelUnavailableMessage(msg) ? new ClaudeModelUnavailableError(_ClaudeManager.assistantText(msg)) : msg.type === "result" && msg.subtype !== "success" && msg.num_turns === 0 && msg.errors.some((err) => err.startsWith("No conversation found with session ID")) ? new ClaudeMissingSessionError(msg.errors.join("\n")) : _ClaudeManager.detectQuotaErrorInMessage(msg, creditsRequired, resetsAt) ?? (transientErrorMessage ? new ClaudeTransientTurnError(transientErrorMessage, this.pendingTurn?.sawActivity ?? false) : null);
|
|
14225
|
+
const turnError = authErrorMessage ? new ClaudeAuthError(authErrorMessage) : _ClaudeManager.isModelUnavailableMessage(msg) ? new ClaudeModelUnavailableError(_ClaudeManager.assistantText(msg)) : msg.type === "result" && msg.terminal_reason === "blocking_limit" ? new ClaudeContextBlockedError(msg.subtype === "success" ? msg.result : msg.errors.join("\n")) : msg.type === "result" && msg.subtype !== "success" && msg.num_turns === 0 && msg.errors.some((err) => err.startsWith("No conversation found with session ID")) ? new ClaudeMissingSessionError(msg.errors.join("\n")) : _ClaudeManager.detectQuotaErrorInMessage(msg, creditsRequired, resetsAt) ?? (transientErrorMessage ? new ClaudeTransientTurnError(transientErrorMessage, this.pendingTurn?.sawActivity ?? false) : null);
|
|
14198
14226
|
if (turnError) {
|
|
14199
14227
|
suppressLinearResponseFlush = true;
|
|
14200
14228
|
turnFailed = true;
|
|
@@ -14206,6 +14234,10 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
14206
14234
|
}
|
|
14207
14235
|
return;
|
|
14208
14236
|
}
|
|
14237
|
+
if (heldRefusal) {
|
|
14238
|
+
await this.handleMessage(heldRefusal);
|
|
14239
|
+
heldRefusal = null;
|
|
14240
|
+
}
|
|
14209
14241
|
const wasProcessing = this.isProcessing();
|
|
14210
14242
|
this.setAuthRetrying(false);
|
|
14211
14243
|
const lifecycle2 = msg;
|