replicas-engine 0.1.725 → 0.1.726
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/{chunk-FL2J2SZW.js → chunk-DFBYJH6I.js} +44 -6
- package/dist/src/{chunk-YWSBURLX.js → chunk-KZODFP3F.js} +1 -1
- package/dist/src/{chunk-WDZ5RUOJ.js → chunk-L3TAK4RD.js} +1 -1
- package/dist/src/{chunk-N26NDLI2.js → chunk-QL2YWG6O.js} +2 -2
- package/dist/src/command-protection-hook.js +2 -2
- package/dist/src/deepseek-command-protection-plugin.js +3 -3
- package/dist/src/headless-agent.js +2 -2
- package/dist/src/index.js +7 -4
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/package.json +1 -1
|
@@ -658,6 +658,11 @@ var CREDENTIAL_TYPE = {
|
|
|
658
658
|
OPENROUTER_API_KEY: "openrouter_api_key",
|
|
659
659
|
AI_GATEWAY_API_KEY: "ai_gateway_api_key"
|
|
660
660
|
};
|
|
661
|
+
var INFERENCE_PROVIDER_LABELS = {
|
|
662
|
+
[CREDENTIAL_METHOD.OPENCODE_GO]: "OpenCode Go",
|
|
663
|
+
[CREDENTIAL_METHOD.ASTER]: "Aster",
|
|
664
|
+
[CREDENTIAL_METHOD.OPENROUTER]: "OpenRouter"
|
|
665
|
+
};
|
|
661
666
|
var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
|
|
662
667
|
[AGENT.CLAUDE]: [
|
|
663
668
|
{ method: CREDENTIAL_METHOD.OAUTH, credentialType: CREDENTIAL_TYPE.CLAUDE_OAUTH },
|
|
@@ -5147,6 +5152,27 @@ function parseFxEvents(events) {
|
|
|
5147
5152
|
return parseAcpEvents(events, "fx");
|
|
5148
5153
|
}
|
|
5149
5154
|
|
|
5155
|
+
// ../shared/src/display-message/parsers/inference-error.ts
|
|
5156
|
+
var TRANSIENT_HTTP_STATUSES = [408, 429, 500, 502, 503, 504, 529];
|
|
5157
|
+
var SERVER_ERROR_TEXT_PATTERN = /internal ?server ?error|server ?error|service unavailable|bad gateway|gateway timeout|overloaded|too many requests/i;
|
|
5158
|
+
var INFERENCE_ERROR_DETAIL_MAX = 600;
|
|
5159
|
+
var INFERENCE_ERROR_RETRY_HINT = "This is usually temporary \u2014 retry the message.";
|
|
5160
|
+
function formatInferenceError(message, context = {}) {
|
|
5161
|
+
const label = context.provider ? INFERENCE_PROVIDER_LABELS[context.provider] ?? context.provider : null;
|
|
5162
|
+
const source = label ? `${label}${context.model ? ` (${context.model})` : ""} request failed${typeof context.status === "number" ? ` with HTTP ${context.status}` : ""}` : null;
|
|
5163
|
+
let body = source ? message ? `${source}: ${message}` : `${source}.` : message;
|
|
5164
|
+
const detail = context.detail?.trim();
|
|
5165
|
+
if (detail && !body.includes(detail)) {
|
|
5166
|
+
body = `${body}
|
|
5167
|
+
${detail.length > INFERENCE_ERROR_DETAIL_MAX ? `${detail.slice(0, INFERENCE_ERROR_DETAIL_MAX)}\u2026` : detail}`;
|
|
5168
|
+
}
|
|
5169
|
+
const sniffText = `${message}
|
|
5170
|
+
${detail ?? ""}`;
|
|
5171
|
+
const transient = context.retryable ?? (typeof context.status === "number" ? TRANSIENT_HTTP_STATUSES.includes(context.status) || context.status >= 500 : isTransientErrorText(sniffText, { httpStatuses: TRANSIENT_HTTP_STATUSES, includeRateLimit: true }) || SERVER_ERROR_TEXT_PATTERN.test(sniffText));
|
|
5172
|
+
return transient ? `${body}
|
|
5173
|
+
${INFERENCE_ERROR_RETRY_HINT}` : body;
|
|
5174
|
+
}
|
|
5175
|
+
|
|
5150
5176
|
// ../shared/src/display-message/parsers/opencode-parser.ts
|
|
5151
5177
|
function timestampFromMs(value, fallback) {
|
|
5152
5178
|
return typeof value === "number" && Number.isFinite(value) ? new Date(value).toISOString() : fallback;
|
|
@@ -5160,9 +5186,15 @@ function toolStatus(status) {
|
|
|
5160
5186
|
function assistantError(info) {
|
|
5161
5187
|
if (!isRecord(info) || !isRecord(info.error)) return null;
|
|
5162
5188
|
const data = isRecord(info.error.data) ? info.error.data : null;
|
|
5163
|
-
|
|
5164
|
-
if (
|
|
5165
|
-
return
|
|
5189
|
+
const message = typeof data?.message === "string" ? data.message : typeof info.error.message === "string" ? info.error.message : stringifyDisplayValue(info.error) ?? "Opencode run failed";
|
|
5190
|
+
if (info.error.name === "MessageAbortedError") return message;
|
|
5191
|
+
return formatInferenceError(message, {
|
|
5192
|
+
...typeof info.providerID === "string" ? { provider: info.providerID } : {},
|
|
5193
|
+
...typeof info.modelID === "string" ? { model: info.modelID } : {},
|
|
5194
|
+
...typeof data?.statusCode === "number" ? { status: data.statusCode } : {},
|
|
5195
|
+
...typeof data?.isRetryable === "boolean" ? { retryable: data.isRetryable } : {},
|
|
5196
|
+
...typeof data?.responseBody === "string" ? { detail: data.responseBody } : {}
|
|
5197
|
+
});
|
|
5166
5198
|
}
|
|
5167
5199
|
function parseOpencodeEvents(events) {
|
|
5168
5200
|
const messages = [];
|
|
@@ -5197,7 +5229,9 @@ function parseOpencodeEvents(events) {
|
|
|
5197
5229
|
messages.push({
|
|
5198
5230
|
id: `opencode-${event.type}-${event.timestamp}`,
|
|
5199
5231
|
type: "error",
|
|
5200
|
-
message,
|
|
5232
|
+
message: formatInferenceError(message, {
|
|
5233
|
+
...typeof event.payload.status === "number" ? { status: event.payload.status } : {}
|
|
5234
|
+
}),
|
|
5201
5235
|
timestamp: event.timestamp
|
|
5202
5236
|
});
|
|
5203
5237
|
continue;
|
|
@@ -5291,7 +5325,11 @@ function toolStatus2(value) {
|
|
|
5291
5325
|
}
|
|
5292
5326
|
function assistantErrorMessage(value) {
|
|
5293
5327
|
if (!isRecord(value) || value.role !== "assistant" || value.stopReason !== "error") return null;
|
|
5294
|
-
|
|
5328
|
+
const message = typeof value.errorMessage === "string" && value.errorMessage ? value.errorMessage : "Pi run failed";
|
|
5329
|
+
return formatInferenceError(message, {
|
|
5330
|
+
...typeof value.provider === "string" ? { provider: value.provider } : {},
|
|
5331
|
+
...typeof value.model === "string" ? { model: value.model } : {}
|
|
5332
|
+
});
|
|
5295
5333
|
}
|
|
5296
5334
|
function parsePiEvents(events) {
|
|
5297
5335
|
const messages = [];
|
|
@@ -5313,7 +5351,7 @@ function parsePiEvents(events) {
|
|
|
5313
5351
|
continue;
|
|
5314
5352
|
}
|
|
5315
5353
|
if (event.type === "pi-error") {
|
|
5316
|
-
messages.push({ id: `pi-error-${event.timestamp}-${messages.length}`, type: "error", message: String(event.payload.message ?? "Pi run failed"), timestamp: event.timestamp });
|
|
5354
|
+
messages.push({ id: `pi-error-${event.timestamp}-${messages.length}`, type: "error", message: formatInferenceError(String(event.payload.message ?? "Pi run failed")), timestamp: event.timestamp });
|
|
5317
5355
|
continue;
|
|
5318
5356
|
}
|
|
5319
5357
|
if (event.type === "pi-message_end") {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
HOOK_EXEC_MAX_BUFFER_BYTES,
|
|
4
4
|
isVersionBelow
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DFBYJH6I.js";
|
|
6
6
|
|
|
7
7
|
// src/utils/presigned-upload.ts
|
|
8
8
|
import { createReadStream } from "fs";
|
|
@@ -267,7 +267,7 @@ var DEFAULT_CODEX_ARGS = [
|
|
|
267
267
|
var MIN_CODEX_CLI_VERSION = "0.144.6";
|
|
268
268
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
269
269
|
var codexCliVersionEnsured = null;
|
|
270
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
270
|
+
var ENGINE_PACKAGE_VERSION = "0.1.726";
|
|
271
271
|
var INITIALIZE_METHOD = "initialize";
|
|
272
272
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
273
273
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
evaluateCommandProtection
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-L3TAK4RD.js";
|
|
5
5
|
import {
|
|
6
6
|
isRecord
|
|
7
7
|
} from "./chunk-2RB7SIP3.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-DFBYJH6I.js";
|
|
9
9
|
|
|
10
10
|
// src/command-protection-hook.ts
|
|
11
11
|
var provider = process.argv[2];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
evaluateCommandProtection
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-L3TAK4RD.js";
|
|
5
5
|
import {
|
|
6
6
|
notifyPostToolUse
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KZODFP3F.js";
|
|
8
8
|
import "./chunk-2RB7SIP3.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-DFBYJH6I.js";
|
|
10
10
|
|
|
11
11
|
// src/deepseek-command-protection-plugin.ts
|
|
12
12
|
function replicasCommandProtection(context) {
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
buildCodexAgentEnv,
|
|
5
5
|
putPresignedFile,
|
|
6
6
|
recoverCompletedTurn
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QL2YWG6O.js";
|
|
8
8
|
import {
|
|
9
9
|
AGENT,
|
|
10
10
|
getMemoryOutputSafetyViolation,
|
|
11
11
|
headlessAgentRequestSchema
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DFBYJH6I.js";
|
|
13
13
|
|
|
14
14
|
// src/headless-agent.ts
|
|
15
15
|
import { createHash } from "crypto";
|
package/dist/src/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
monolithService,
|
|
9
9
|
reportCommandProtectionBlock,
|
|
10
10
|
setAgentCredentialSnapshot
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-L3TAK4RD.js";
|
|
12
12
|
import {
|
|
13
13
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
14
14
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
execFileAsync,
|
|
36
36
|
putPresignedFile,
|
|
37
37
|
recoverCompletedTurn
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-QL2YWG6O.js";
|
|
39
39
|
import {
|
|
40
40
|
isRecord as isRecord2
|
|
41
41
|
} from "./chunk-2RB7SIP3.js";
|
|
@@ -216,7 +216,7 @@ import {
|
|
|
216
216
|
shellQuotePosix,
|
|
217
217
|
stripAgentDiagnosticErrors,
|
|
218
218
|
withTimeout
|
|
219
|
-
} from "./chunk-
|
|
219
|
+
} from "./chunk-DFBYJH6I.js";
|
|
220
220
|
|
|
221
221
|
// src/index.ts
|
|
222
222
|
import { serve } from "@hono/node-server";
|
|
@@ -9637,9 +9637,12 @@ function opencodeErrorMessage(error) {
|
|
|
9637
9637
|
function opencodeErrorPayload(error) {
|
|
9638
9638
|
const message = opencodeErrorMessage(error) ?? String(error);
|
|
9639
9639
|
const code = typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : void 0;
|
|
9640
|
+
const cause = error instanceof Error && isRecord2(error.cause) ? error.cause : null;
|
|
9641
|
+
const status = typeof cause?.status === "number" ? cause.status : void 0;
|
|
9640
9642
|
return {
|
|
9641
9643
|
message: code === "ENOENT" ? `Failed to start Opencode server binary (${message}).` : message,
|
|
9642
|
-
...code ? { code } : {}
|
|
9644
|
+
...code ? { code } : {},
|
|
9645
|
+
...status !== void 0 ? { status } : {}
|
|
9643
9646
|
};
|
|
9644
9647
|
}
|
|
9645
9648
|
function opencodeFetch(input, init) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
notifyPostToolUse
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KZODFP3F.js";
|
|
5
5
|
import {
|
|
6
6
|
isRecord
|
|
7
7
|
} from "./chunk-2RB7SIP3.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-DFBYJH6I.js";
|
|
9
9
|
|
|
10
10
|
// src/post-tool-pr-hook.ts
|
|
11
11
|
async function main() {
|