replicas-engine 0.1.1684 → 0.1.1687
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-4X4GZQ6G.js → asp-host-WH3FDXCT.js} +6 -5
- package/dist/src/{chunk-DRC5DLT3.js → chunk-25TILJOA.js} +67 -21
- package/dist/src/{chunk-6EPNWTJT.js → chunk-4WUIIT6Z.js} +2 -2
- package/dist/src/{chunk-IQFATVKH.js → chunk-67ZXXRJ5.js} +8 -8
- package/dist/src/chunk-7ZDAVYTV.js +18 -0
- package/dist/src/chunk-BXZA2HFS.js +35 -0
- package/dist/src/{chunk-E56ZPU6O.js → chunk-IL6OBS3T.js} +1 -1
- package/dist/src/{chunk-KAVLAXPC.js → chunk-JNVXGKRR.js} +3 -3
- package/dist/src/{chunk-Z7QHHFLU.js → chunk-KNEA2XCI.js} +1 -1
- package/dist/src/{chunk-C4B6D4PI.js → chunk-NR6MTHUJ.js} +13 -49
- package/dist/src/chunk-NYAS7KNX.js +48 -0
- package/dist/src/{chunk-3UEBJH7C.js → chunk-XL3IOGIZ.js} +5 -16
- package/dist/src/codemode-mcp.js +338 -0
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +5 -4
- package/dist/src/index.js +146 -149
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +3 -1
|
@@ -8,12 +8,13 @@ import {
|
|
|
8
8
|
listCodexModelsForDetails,
|
|
9
9
|
restartCodexAspHost,
|
|
10
10
|
restartCodexAspHostIfRunning
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-NR6MTHUJ.js";
|
|
12
|
+
import "./chunk-NYAS7KNX.js";
|
|
13
|
+
import "./chunk-67ZXXRJ5.js";
|
|
14
|
+
import "./chunk-JNVXGKRR.js";
|
|
15
|
+
import "./chunk-IL6OBS3T.js";
|
|
15
16
|
import "./chunk-UZSNFLDQ.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-25TILJOA.js";
|
|
17
18
|
import "./chunk-VEQXQN22.js";
|
|
18
19
|
export {
|
|
19
20
|
CODEX_ULTRAFAST_SERVICE_TIER,
|
|
@@ -11067,6 +11067,9 @@ function getEventStreamId(event) {
|
|
|
11067
11067
|
var CODEX_QUOTA_STATUS_EVENT_TYPE = "codex-quota-status";
|
|
11068
11068
|
var CHAT_INTERRUPTED_EVENT_TYPE = "replicas-interrupted";
|
|
11069
11069
|
var CHAT_MESSAGE_REJECTED_EVENT_TYPE = "replicas-message-rejected";
|
|
11070
|
+
var REJECTED_MESSAGE_ID_PAYLOAD_KEY = "rejectedMessageId";
|
|
11071
|
+
var REJECTED_CODE_PAYLOAD_KEY = "rejectedCode";
|
|
11072
|
+
var REFUSED_COPY_MESSAGE_ID_PREFIX = "refused-copy-";
|
|
11070
11073
|
var CHAT_TURN_LOST_EVENT_TYPE = "replicas-turn-lost";
|
|
11071
11074
|
var CHAT_TURN_LOST_MESSAGE = "The workspace restarted and cut this turn off. It wasn't retried.";
|
|
11072
11075
|
var CHAT_GOAL_EVENT_TYPE = "chat-goal";
|
|
@@ -11255,6 +11258,8 @@ var sendChatMessageRequestSchema = z9.object({
|
|
|
11255
11258
|
type: z9.string().min(1).optional(),
|
|
11256
11259
|
merge: z9.boolean().optional(),
|
|
11257
11260
|
idempotencyKey: z9.string().min(1).max(128).optional(),
|
|
11261
|
+
// The workspace's stop count as this send read it when it arrived: set by the monolith alone. Lower than the number of the engine's last Stop of the chat, the send is older than that Stop.
|
|
11262
|
+
stopsSeen: z9.number().int().nonnegative().optional(),
|
|
11258
11263
|
automationId: z9.string().optional(),
|
|
11259
11264
|
environmentId: z9.string().min(1).optional(),
|
|
11260
11265
|
senderUserId: z9.string().optional(),
|
|
@@ -11462,7 +11467,11 @@ var sendChatMessageResponseSchema = z9.object({
|
|
|
11462
11467
|
chatId: z9.string().optional(),
|
|
11463
11468
|
steered: z9.boolean().optional()
|
|
11464
11469
|
});
|
|
11465
|
-
var interruptChatRequestSchema = z9.object({
|
|
11470
|
+
var interruptChatRequestSchema = z9.object({
|
|
11471
|
+
stoppedAt: z9.string().datetime().optional(),
|
|
11472
|
+
// The workspace's stop count once this Stop was noted: set by the monolith alone. A send that saw a lower count is older than this Stop.
|
|
11473
|
+
stopNumber: z9.number().int().positive().optional()
|
|
11474
|
+
});
|
|
11466
11475
|
var respondToolInputRequestSchema = z9.object({
|
|
11467
11476
|
requestId: z9.string().min(1),
|
|
11468
11477
|
selectionId: z9.string().min(1),
|
|
@@ -12186,6 +12195,7 @@ var execRequestSchema = z15.object({
|
|
|
12186
12195
|
idleTtlMs: z15.number().int().positive().max(EXEC_MAX_IDLE_TTL_MS).optional(),
|
|
12187
12196
|
stdin: z15.boolean().optional()
|
|
12188
12197
|
}).refine((body2) => [body2.command, body2.argv, body2.mcpServer].filter((value) => value !== void 0).length === 1, { message: "Pass exactly one of command, argv or mcpServer" });
|
|
12198
|
+
var CODE_MODE_MCP_SERVER = "replicas-codemode";
|
|
12189
12199
|
var execStartedSchema = z15.object({ processId: z15.string(), pid: z15.number() });
|
|
12190
12200
|
var execExitSchema = z15.object({ exitCode: z15.number(), signal: z15.string().nullable(), reason: z15.enum(["exit", "timeout", "killed", "idle"]) });
|
|
12191
12201
|
var execReplySchemas = {
|
|
@@ -12271,6 +12281,28 @@ async function readSseStream(body2, onEvent, shouldContinue = () => true, onChun
|
|
|
12271
12281
|
|
|
12272
12282
|
// ../shared/src/types.ts
|
|
12273
12283
|
var ENGINE_SEND_MESSAGE_FAILED_ERROR = "Failed to send message";
|
|
12284
|
+
var CHAT_MESSAGE_CANCELLED_CODE = "message_cancelled";
|
|
12285
|
+
var CHAT_MESSAGE_HANDED_BACK_CODE = "message_handed_back";
|
|
12286
|
+
var CHAT_MESSAGE_OUTCOME_UNKNOWN_CODE = "message_outcome_unknown";
|
|
12287
|
+
var CHAT_MESSAGE_TAKEN_BACK_CODES = [CHAT_MESSAGE_CANCELLED_CODE, CHAT_MESSAGE_HANDED_BACK_CODE, CHAT_MESSAGE_OUTCOME_UNKNOWN_CODE];
|
|
12288
|
+
var CHAT_MESSAGE_TAKEN_BACK_DETAILS = {
|
|
12289
|
+
[CHAT_MESSAGE_CANCELLED_CODE]: "It was cancelled before it ran. Send it again as a new message.",
|
|
12290
|
+
[CHAT_MESSAGE_HANDED_BACK_CODE]: "It was handed back when Stop was pressed. Send it again as a new message.",
|
|
12291
|
+
[CHAT_MESSAGE_OUTCOME_UNKNOWN_CODE]: "It may still have reached the agent. Check the chat before sending it again."
|
|
12292
|
+
};
|
|
12293
|
+
var CHAT_MESSAGE_NOT_ACCEPTED_MAY_HAVE_RUN_CODE = "message_not_accepted_may_have_run";
|
|
12294
|
+
var CHAT_MESSAGE_CHAT_NOT_FOUND_CODE = "chat_not_found";
|
|
12295
|
+
var CHAT_MESSAGE_WORKSPACE_REFUSED_CODE = "workspace_refused_message";
|
|
12296
|
+
var CHAT_MESSAGE_NOT_DELIVERED_CODE = "message_not_delivered";
|
|
12297
|
+
var CHAT_MESSAGE_NOT_SUPPORTED_BY_WORKSPACE_CODE = "not_supported_by_workspace";
|
|
12298
|
+
var CHAT_MESSAGE_REFUSED_ROW_CODES = [
|
|
12299
|
+
...CHAT_MESSAGE_TAKEN_BACK_CODES,
|
|
12300
|
+
CHAT_MESSAGE_NOT_ACCEPTED_MAY_HAVE_RUN_CODE,
|
|
12301
|
+
CHAT_MESSAGE_CHAT_NOT_FOUND_CODE,
|
|
12302
|
+
CHAT_MESSAGE_WORKSPACE_REFUSED_CODE,
|
|
12303
|
+
CHAT_MESSAGE_NOT_DELIVERED_CODE,
|
|
12304
|
+
CHAT_MESSAGE_NOT_SUPPORTED_BY_WORKSPACE_CODE
|
|
12305
|
+
];
|
|
12274
12306
|
|
|
12275
12307
|
// ../shared/src/routes/workspaces.ts
|
|
12276
12308
|
import { z as z17 } from "zod";
|
|
@@ -16094,6 +16126,7 @@ var applyEnvironmentConfigSourceRequestSchema = z27.strictObject({
|
|
|
16094
16126
|
}).refine((input) => input.file ? !input.repository_id && !input.commit_sha : !!input.commit_sha, {
|
|
16095
16127
|
message: "File configuration requires file contents; Git configuration requires a reviewed commit"
|
|
16096
16128
|
});
|
|
16129
|
+
var validateEnvironmentConfigRequestSchema = z27.strictObject({ environment: replicasEnvironmentConfigSchema });
|
|
16097
16130
|
|
|
16098
16131
|
// ../shared/src/replicas-mcp.ts
|
|
16099
16132
|
var REPLICAS_MCP_SERVER_NAME = "replicas-mcp";
|
|
@@ -16783,6 +16816,23 @@ function threadHandoffText(content) {
|
|
|
16783
16816
|
return envelope.meta.trigger === "auto" ? "" : envelope.replyText;
|
|
16784
16817
|
}
|
|
16785
16818
|
|
|
16819
|
+
// ../shared/src/user-message-matching.ts
|
|
16820
|
+
var parsedTimestamps = /* @__PURE__ */ new Map();
|
|
16821
|
+
function parseTimestampMs(timestamp2) {
|
|
16822
|
+
if (typeof timestamp2 === "number") return Number.isFinite(timestamp2) ? timestamp2 : 0;
|
|
16823
|
+
let value = parsedTimestamps.get(timestamp2);
|
|
16824
|
+
if (value === void 0) {
|
|
16825
|
+
const parsed = Date.parse(timestamp2);
|
|
16826
|
+
value = Number.isFinite(parsed) ? parsed : 0;
|
|
16827
|
+
if (parsedTimestamps.size >= 5e4) parsedTimestamps.clear();
|
|
16828
|
+
parsedTimestamps.set(timestamp2, value);
|
|
16829
|
+
}
|
|
16830
|
+
return value;
|
|
16831
|
+
}
|
|
16832
|
+
function areUserMessagesWithinMatchWindow(a, b) {
|
|
16833
|
+
return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
|
|
16834
|
+
}
|
|
16835
|
+
|
|
16786
16836
|
// ../shared/src/display-message/chat-thread.ts
|
|
16787
16837
|
function describeHarnessSwitch(message2) {
|
|
16788
16838
|
if (message2.trigger === "switch") return `Switched from ${getProviderDisplayName(message2.fromProvider, "long")} to ${getProviderDisplayName(message2.toProvider, "long")}`;
|
|
@@ -17764,23 +17814,6 @@ var managerTicketThreadSchema = z32.array(z32.object({
|
|
|
17764
17814
|
var LINEAR_ISSUE_SUMMARIES_MAX = 50;
|
|
17765
17815
|
var linearIssueSummariesRequestSchema = z32.object({ identifiers: z32.array(linearIdentifier).min(1).max(LINEAR_ISSUE_SUMMARIES_MAX) });
|
|
17766
17816
|
|
|
17767
|
-
// ../shared/src/user-message-matching.ts
|
|
17768
|
-
var parsedTimestamps = /* @__PURE__ */ new Map();
|
|
17769
|
-
function parseTimestampMs(timestamp2) {
|
|
17770
|
-
if (typeof timestamp2 === "number") return Number.isFinite(timestamp2) ? timestamp2 : 0;
|
|
17771
|
-
let value = parsedTimestamps.get(timestamp2);
|
|
17772
|
-
if (value === void 0) {
|
|
17773
|
-
const parsed = Date.parse(timestamp2);
|
|
17774
|
-
value = Number.isFinite(parsed) ? parsed : 0;
|
|
17775
|
-
if (parsedTimestamps.size >= 5e4) parsedTimestamps.clear();
|
|
17776
|
-
parsedTimestamps.set(timestamp2, value);
|
|
17777
|
-
}
|
|
17778
|
-
return value;
|
|
17779
|
-
}
|
|
17780
|
-
function areUserMessagesWithinMatchWindow(a, b) {
|
|
17781
|
-
return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
|
|
17782
|
-
}
|
|
17783
|
-
|
|
17784
17817
|
// ../shared/src/display-message/turns.ts
|
|
17785
17818
|
function isCompaction(message2) {
|
|
17786
17819
|
return message2.type === "reasoning" && message2.content === COMPACTION_CONTENT;
|
|
@@ -20762,6 +20795,8 @@ function applyEngineNotices(messages, events) {
|
|
|
20762
20795
|
id: `message-rejected-${event.timestamp}-${index}`,
|
|
20763
20796
|
type: "error",
|
|
20764
20797
|
message: typeof event.payload.message === "string" ? event.payload.message : "Message was rejected",
|
|
20798
|
+
rejectedMessageId: typeof event.payload[REJECTED_MESSAGE_ID_PAYLOAD_KEY] === "string" ? event.payload[REJECTED_MESSAGE_ID_PAYLOAD_KEY] : void 0,
|
|
20799
|
+
rejectedCode: CHAT_MESSAGE_REFUSED_ROW_CODES.find((code) => code === event.payload[REJECTED_CODE_PAYLOAD_KEY]),
|
|
20765
20800
|
timestamp: event.timestamp
|
|
20766
20801
|
});
|
|
20767
20802
|
return;
|
|
@@ -20903,7 +20938,7 @@ function getUserMessageId(event) {
|
|
|
20903
20938
|
}
|
|
20904
20939
|
function getReplacedMessageId(event) {
|
|
20905
20940
|
const messageId = event.payload[REPLACED_MESSAGE_ID_PAYLOAD_KEY];
|
|
20906
|
-
return typeof messageId === "string" ? messageId : null;
|
|
20941
|
+
return typeof messageId === "string" && !messageId.startsWith(REFUSED_COPY_MESSAGE_ID_PREFIX) && !messageId.startsWith(`user-${REFUSED_COPY_MESSAGE_ID_PREFIX}`) ? messageId : null;
|
|
20907
20942
|
}
|
|
20908
20943
|
function getRemovedMessageIds(event) {
|
|
20909
20944
|
if (event.type !== QUEUED_MESSAGE_REMOVED_EVENT_TYPE) return [];
|
|
@@ -21600,7 +21635,7 @@ async function withRetry(label, fn, options) {
|
|
|
21600
21635
|
}
|
|
21601
21636
|
|
|
21602
21637
|
// ../shared/src/tensorlake.ts
|
|
21603
|
-
var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-20-
|
|
21638
|
+
var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-20-v35";
|
|
21604
21639
|
var TENSORLAKE_DISK_MB = 100 * 1024;
|
|
21605
21640
|
|
|
21606
21641
|
// ../shared/src/egress.ts
|
|
@@ -22340,6 +22375,15 @@ function hasChatStarted(chat) {
|
|
|
22340
22375
|
return chat.processing || Boolean(chat.awaitingInput) || Boolean(chat.goal) || Boolean(chat.lastMessageText) || chat.updatedAt > chat.createdAt;
|
|
22341
22376
|
}
|
|
22342
22377
|
|
|
22378
|
+
// ../shared/src/mcp-tool-search.ts
|
|
22379
|
+
function rankToolsByQuery(tools, query, text4) {
|
|
22380
|
+
const terms = query.toLowerCase().split(/[\s_-]+/).filter(Boolean);
|
|
22381
|
+
return tools.map((tool) => {
|
|
22382
|
+
const { name, description: description2 } = text4(tool);
|
|
22383
|
+
return { tool, score: terms.reduce((sum, term) => sum + (name.toLowerCase().includes(term) ? 3 : 0) + (description2.toLowerCase().includes(term) ? 1 : 0), 0) };
|
|
22384
|
+
}).filter(({ score }) => score > 0).sort((a, b) => b.score - a.score).map(({ tool }) => tool);
|
|
22385
|
+
}
|
|
22386
|
+
|
|
22343
22387
|
// ../shared/src/engine/exec-client.ts
|
|
22344
22388
|
var RECONNECT_GIVE_UP_MS = 2 * 6e4;
|
|
22345
22389
|
var encoder3 = new TextEncoder();
|
|
@@ -24124,6 +24168,7 @@ export {
|
|
|
24124
24168
|
formatChatForkHandoffMessage,
|
|
24125
24169
|
formatChatForkUpdateMessage,
|
|
24126
24170
|
threadHandoffText,
|
|
24171
|
+
areUserMessagesWithinMatchWindow,
|
|
24127
24172
|
INTERRUPTED_MESSAGE_REGEX,
|
|
24128
24173
|
isToolInputQuestion,
|
|
24129
24174
|
fileContentDiff,
|
|
@@ -24133,7 +24178,6 @@ export {
|
|
|
24133
24178
|
LEARNED_SKILLS_MANIFEST_PATH,
|
|
24134
24179
|
LEARNED_SKILL_DIR_PREFIX,
|
|
24135
24180
|
learnedSkillsManifestSchema,
|
|
24136
|
-
areUserMessagesWithinMatchWindow,
|
|
24137
24181
|
toolInputAnswer,
|
|
24138
24182
|
lastPlainStepLabel,
|
|
24139
24183
|
currentStepLabel,
|
|
@@ -24216,6 +24260,8 @@ export {
|
|
|
24216
24260
|
decodeExecFrame,
|
|
24217
24261
|
EXEC_ERROR_CODES,
|
|
24218
24262
|
execRequestSchema,
|
|
24263
|
+
CODE_MODE_MCP_SERVER,
|
|
24264
|
+
rankToolsByQuery,
|
|
24219
24265
|
CODEX_AUTH_ENV_KEYS,
|
|
24220
24266
|
codexAuthEnvFromResponse,
|
|
24221
24267
|
CODEX_AUTH_ENV_KEYS_BY_METHOD,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ENGINE_ENV,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
runGitCommand
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-67ZXXRJ5.js";
|
|
9
9
|
import {
|
|
10
10
|
COMMAND_PROTECTION_MAX_MESSAGE_FILE_BYTES,
|
|
11
11
|
COMMAND_PROTECTION_REPO_GIT_ARGS,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
parseCommandProtectionRequest,
|
|
19
19
|
toCommandProtectionRepoState,
|
|
20
20
|
withRetry
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-25TILJOA.js";
|
|
22
22
|
|
|
23
23
|
// src/services/command-protection-service.ts
|
|
24
24
|
import { readFile, stat } from "fs/promises";
|
|
@@ -4,9 +4,9 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
SUBPROCESS_MAX_BUFFER,
|
|
6
6
|
execFileAsync
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IL6OBS3T.js";
|
|
8
8
|
import {
|
|
9
|
-
isRecord
|
|
9
|
+
isRecord
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
11
11
|
import {
|
|
12
12
|
ENGINE_PORT,
|
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
createErrorResult,
|
|
16
16
|
createSuccessResult,
|
|
17
17
|
fallbackPlanResponseSchema,
|
|
18
|
-
isRecord,
|
|
18
|
+
isRecord as isRecord2,
|
|
19
19
|
isValidAgentProvider,
|
|
20
20
|
parsePosixEnv,
|
|
21
21
|
provisionedDeviceSchema,
|
|
22
22
|
readReplicasRuntimeEnv,
|
|
23
23
|
serializePosixEnvFile
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-25TILJOA.js";
|
|
25
25
|
|
|
26
26
|
// src/runtime-env-loader.ts
|
|
27
27
|
import { readFileSync } from "fs";
|
|
@@ -116,7 +116,7 @@ function parseAgentCredentialSnapshots(value) {
|
|
|
116
116
|
if (!value) return {};
|
|
117
117
|
try {
|
|
118
118
|
const parsed = JSON.parse(value);
|
|
119
|
-
if (!
|
|
119
|
+
if (!isRecord(parsed)) return {};
|
|
120
120
|
const snapshots = {};
|
|
121
121
|
for (const [provider, snapshot] of Object.entries(parsed)) {
|
|
122
122
|
if (!isValidAgentProvider(provider)) continue;
|
|
@@ -312,10 +312,10 @@ var MonolithService = class {
|
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
getSubagentMcpConfig() {
|
|
315
|
-
return this.getJson("/v1/engine/subagent-mcp", (body) =>
|
|
315
|
+
return this.getJson("/v1/engine/subagent-mcp", (body) => isRecord2(body) && typeof body.enabled === "boolean" && Array.isArray(body.providers) && body.providers.every((provider) => typeof provider === "string" && isValidAgentProvider(provider)) ? { enabled: body.enabled, providers: body.providers } : null, AbortSignal.timeout(1e4));
|
|
316
316
|
}
|
|
317
317
|
getAutoCompactConfig(provider) {
|
|
318
|
-
return this.getJson(`/v1/engine/auto-compact?provider=${provider}`, (body) =>
|
|
318
|
+
return this.getJson(`/v1/engine/auto-compact?provider=${provider}`, (body) => isRecord2(body) && (body.tokens === null || typeof body.tokens === "number") ? { tokens: body.tokens } : null, AbortSignal.timeout(1e4));
|
|
319
319
|
}
|
|
320
320
|
async generateChatName(request) {
|
|
321
321
|
const response = await monolithRequest("/v1/engine/chat-name", { body: request, signal: AbortSignal.timeout(3e4) });
|
|
@@ -324,7 +324,7 @@ var MonolithService = class {
|
|
|
324
324
|
return body.name;
|
|
325
325
|
}
|
|
326
326
|
getOpenRouterModels() {
|
|
327
|
-
return this.getJson("/v1/engine/openrouter-models", (body) =>
|
|
327
|
+
return this.getJson("/v1/engine/openrouter-models", (body) => isRecord2(body) && Array.isArray(body.models) && body.models.every((model) => typeof model === "string") ? body.models : null);
|
|
328
328
|
}
|
|
329
329
|
/** `unsupported` means an older monolith; `unavailable` means this one could not be read. */
|
|
330
330
|
async getFallbackPlan(params) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
3
|
+
const require = __createRequire(import.meta.url);
|
|
4
|
+
|
|
5
|
+
// src/managers/agent-auth-paths.ts
|
|
6
|
+
import { homedir } from "os";
|
|
7
|
+
import { join } from "path";
|
|
8
|
+
var OPENCODE_AUTH_PATH = join(homedir(), ".local", "share", "opencode", "auth.json");
|
|
9
|
+
var PI_AUTH_PATH = join(homedir(), ".pi", "agent", "auth.json");
|
|
10
|
+
var PI_MCP_CONFIG_PATH = join(homedir(), ".pi", "agent", "mcp.json");
|
|
11
|
+
var MUSE_AUTH_PATH = join(homedir(), ".config", "muse", "auth.json");
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
OPENCODE_AUTH_PATH,
|
|
15
|
+
PI_AUTH_PATH,
|
|
16
|
+
PI_MCP_CONFIG_PATH,
|
|
17
|
+
MUSE_AUTH_PATH
|
|
18
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
3
|
+
const require = __createRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
PI_MCP_CONFIG_PATH
|
|
6
|
+
} from "./chunk-7ZDAVYTV.js";
|
|
7
|
+
import {
|
|
8
|
+
engineScriptProcess
|
|
9
|
+
} from "./chunk-NYAS7KNX.js";
|
|
10
|
+
import {
|
|
11
|
+
isRecord
|
|
12
|
+
} from "./chunk-UZSNFLDQ.js";
|
|
13
|
+
|
|
14
|
+
// src/managers/managed-mcp-servers.ts
|
|
15
|
+
import { readFile } from "fs/promises";
|
|
16
|
+
async function getManagedPiMcpServers(path = PI_MCP_CONFIG_PATH) {
|
|
17
|
+
try {
|
|
18
|
+
const parsed = JSON.parse(await readFile(path, "utf8"));
|
|
19
|
+
if (!isRecord(parsed) || !isRecord(parsed.mcpServers)) return {};
|
|
20
|
+
return Object.fromEntries(Object.entries(parsed.mcpServers).filter(
|
|
21
|
+
(entry) => isRecord(entry[1]) && (typeof entry[1].command === "string" || typeof entry[1].url === "string")
|
|
22
|
+
));
|
|
23
|
+
} catch {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function managedMcpServerProcess(entry) {
|
|
28
|
+
if (entry.command) return { command: entry.command, args: entry.args ?? [], env: entry.env };
|
|
29
|
+
return { ...engineScriptProcess("mcp-http-bridge", []), env: { REPLICAS_MCP_URL: entry.url ?? "", REPLICAS_MCP_HEADERS: JSON.stringify(entry.headers ?? {}) } };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
getManagedPiMcpServers,
|
|
34
|
+
managedMcpServerProcess
|
|
35
|
+
};
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
HOOK_EXEC_MAX_BUFFER_BYTES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-25TILJOA.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
execFileAsync
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IL6OBS3T.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-25TILJOA.js";
|
|
10
10
|
|
|
11
11
|
// src/utils/codex-agent-env.ts
|
|
12
12
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -242,7 +242,7 @@ function getCodexModelProvider(method) {
|
|
|
242
242
|
if (method === "foundry") return "azure";
|
|
243
243
|
return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
|
|
244
244
|
}
|
|
245
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
245
|
+
var ENGINE_PACKAGE_VERSION = "0.1.1687";
|
|
246
246
|
var INITIALIZE_METHOD = "initialize";
|
|
247
247
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
248
248
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from 'node:module';
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
subagentCodexMcpConfig
|
|
6
|
+
} from "./chunk-NYAS7KNX.js";
|
|
4
7
|
import {
|
|
5
8
|
ENGINE_ENV,
|
|
6
9
|
UNQUOTED_PATHS_CONFIG,
|
|
@@ -12,15 +15,15 @@ import {
|
|
|
12
15
|
resolveDiffBase,
|
|
13
16
|
runGitCommand,
|
|
14
17
|
setAgentCredentialSnapshot
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-67ZXXRJ5.js";
|
|
16
19
|
import {
|
|
17
20
|
AppServerProcess,
|
|
18
21
|
buildCodexAgentEnv
|
|
19
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JNVXGKRR.js";
|
|
20
23
|
import {
|
|
21
24
|
SUBPROCESS_MAX_BUFFER,
|
|
22
25
|
execFileAsync
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-IL6OBS3T.js";
|
|
24
27
|
import {
|
|
25
28
|
isRecord
|
|
26
29
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -37,7 +40,6 @@ import {
|
|
|
37
40
|
MANAGER_INSTRUCTIONS_TAG,
|
|
38
41
|
SHRUNK_IMAGE_QUALITY,
|
|
39
42
|
SUBAGENT_MCP_SERVER_NAME,
|
|
40
|
-
SUBAGENT_MCP_TOOL_NAMES,
|
|
41
43
|
buildCodeHostPrUrl,
|
|
42
44
|
buildGitCredentialHelperScript,
|
|
43
45
|
buildOutputPreview,
|
|
@@ -61,7 +63,7 @@ import {
|
|
|
61
63
|
shrunkImageSize,
|
|
62
64
|
splitManagerInstructions,
|
|
63
65
|
withTimeout
|
|
64
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-25TILJOA.js";
|
|
65
67
|
|
|
66
68
|
// src/managers/codex-token-manager.ts
|
|
67
69
|
import { promises as fs } from "fs";
|
|
@@ -461,7 +463,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
461
463
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
462
464
|
await this.applyCredentialsResponse(data);
|
|
463
465
|
setAgentCredentialSnapshot("codex", data);
|
|
464
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
466
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-WH3FDXCT.js");
|
|
465
467
|
await restartCodexAspHostIfRunning2();
|
|
466
468
|
});
|
|
467
469
|
await this.start(true);
|
|
@@ -483,7 +485,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
483
485
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
484
486
|
await this.applyCredentialsResponse(data);
|
|
485
487
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
486
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
488
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-WH3FDXCT.js");
|
|
487
489
|
await restartCodexAspHostIfRunning2();
|
|
488
490
|
}
|
|
489
491
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -596,7 +598,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
596
598
|
var codexTokenManager = new CodexTokenManager();
|
|
597
599
|
|
|
598
600
|
// src/managers/codex-asp/mappers.ts
|
|
599
|
-
import { existsSync as
|
|
601
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
600
602
|
|
|
601
603
|
// src/git/service.ts
|
|
602
604
|
import { readdir, readFile as readFile3, realpath, stat } from "fs/promises";
|
|
@@ -1589,41 +1591,6 @@ var CodexQuotaStatusTracker = class {
|
|
|
1589
1591
|
}
|
|
1590
1592
|
};
|
|
1591
1593
|
|
|
1592
|
-
// src/managers/subagent-mcp-config.ts
|
|
1593
|
-
import { existsSync as existsSync2 } from "fs";
|
|
1594
|
-
import { dirname as dirname2, join as join6 } from "path";
|
|
1595
|
-
import { fileURLToPath } from "url";
|
|
1596
|
-
import { createRequire as createRequire2 } from "module";
|
|
1597
|
-
var SUBAGENT_MCP_TOOL_TIMEOUT_MS = 24 * 60 * 60 * 1e3 + 6e4;
|
|
1598
|
-
function engineScriptProcess(script, args) {
|
|
1599
|
-
const directory = dirname2(fileURLToPath(import.meta.url));
|
|
1600
|
-
const builtEntry = join6(directory, `${script}.js`);
|
|
1601
|
-
const sourceEntry = join6(directory, "..", `${script}.ts`);
|
|
1602
|
-
const entry = existsSync2(builtEntry) ? builtEntry : sourceEntry;
|
|
1603
|
-
return {
|
|
1604
|
-
command: process.execPath,
|
|
1605
|
-
args: [
|
|
1606
|
-
...entry.endsWith(".ts") ? ["--import", createRequire2(import.meta.url).resolve("tsx/esm")] : [],
|
|
1607
|
-
entry,
|
|
1608
|
-
...args
|
|
1609
|
-
]
|
|
1610
|
-
};
|
|
1611
|
-
}
|
|
1612
|
-
function subagentMcpProcessConfig(parentChatId) {
|
|
1613
|
-
return engineScriptProcess("subagent-mcp", ["--parent", parentChatId]);
|
|
1614
|
-
}
|
|
1615
|
-
function subagentCodexMcpConfig(parentChatId) {
|
|
1616
|
-
return {
|
|
1617
|
-
...subagentMcpProcessConfig(parentChatId),
|
|
1618
|
-
env_vars: ["REPLICAS_ENGINE_PORT", "REPLICAS_ENGINE_SECRET"],
|
|
1619
|
-
enabled_tools: [...SUBAGENT_MCP_TOOL_NAMES],
|
|
1620
|
-
required: true,
|
|
1621
|
-
default_tools_approval_mode: "approve",
|
|
1622
|
-
startup_timeout_sec: 10,
|
|
1623
|
-
tool_timeout_sec: Math.ceil(SUBAGENT_MCP_TOOL_TIMEOUT_MS / 1e3)
|
|
1624
|
-
};
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
1594
|
// src/managers/codex-asp/mappers.ts
|
|
1628
1595
|
var localImageCache = /* @__PURE__ */ new Map();
|
|
1629
1596
|
var DEFAULT_MODEL = DEFAULT_CODEX_MODEL;
|
|
@@ -1752,7 +1719,7 @@ function transcriptItemsForTurn(turn) {
|
|
|
1752
1719
|
function userImageForLocalPath(path2) {
|
|
1753
1720
|
const cached = localImageCache.get(path2);
|
|
1754
1721
|
if (cached) return cached;
|
|
1755
|
-
if (!
|
|
1722
|
+
if (!existsSync2(path2)) return null;
|
|
1756
1723
|
const image = {
|
|
1757
1724
|
type: "image",
|
|
1758
1725
|
mediaType: inferMediaType(path2),
|
|
@@ -2099,9 +2066,9 @@ async function buildTurnStartParams(threadId, request, serviceTier, unreadReques
|
|
|
2099
2066
|
// src/managers/codex-asp/openai-compatible-model-catalog.ts
|
|
2100
2067
|
import { writeFile as writeFile3 } from "fs/promises";
|
|
2101
2068
|
import { tmpdir } from "os";
|
|
2102
|
-
import { join as
|
|
2069
|
+
import { join as join6 } from "path";
|
|
2103
2070
|
var CATALOG_TTL_MS = 6e4;
|
|
2104
|
-
var CODEX_MODEL_CATALOG_PATH =
|
|
2071
|
+
var CODEX_MODEL_CATALOG_PATH = join6(tmpdir(), "replicas-openai-compatible-model-catalog.json");
|
|
2105
2072
|
var cachedCatalog = null;
|
|
2106
2073
|
async function writeCodexModelCatalog(modelsUrl) {
|
|
2107
2074
|
const ollama = ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD === "ollama" ? readOllamaAuthEnv("codex", process.env) : null;
|
|
@@ -2314,9 +2281,6 @@ export {
|
|
|
2314
2281
|
normalizeImages,
|
|
2315
2282
|
removeTempImageFiles,
|
|
2316
2283
|
CodexQuotaStatusTracker,
|
|
2317
|
-
SUBAGENT_MCP_TOOL_TIMEOUT_MS,
|
|
2318
|
-
engineScriptProcess,
|
|
2319
|
-
subagentMcpProcessConfig,
|
|
2320
2284
|
DEFAULT_MODEL,
|
|
2321
2285
|
THREAD_START_METHOD,
|
|
2322
2286
|
THREAD_RESUME_METHOD,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
3
|
+
const require = __createRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
SUBAGENT_MCP_TOOL_NAMES
|
|
6
|
+
} from "./chunk-25TILJOA.js";
|
|
7
|
+
|
|
8
|
+
// src/managers/subagent-mcp-config.ts
|
|
9
|
+
import { existsSync } from "fs";
|
|
10
|
+
import { dirname, join } from "path";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
import { createRequire } from "module";
|
|
13
|
+
var SUBAGENT_MCP_TOOL_TIMEOUT_MS = 24 * 60 * 60 * 1e3 + 6e4;
|
|
14
|
+
function engineScriptProcess(script, args) {
|
|
15
|
+
const directory = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const builtEntry = join(directory, `${script}.js`);
|
|
17
|
+
const sourceEntry = join(directory, "..", `${script}.ts`);
|
|
18
|
+
const entry = existsSync(builtEntry) ? builtEntry : sourceEntry;
|
|
19
|
+
return {
|
|
20
|
+
command: process.execPath,
|
|
21
|
+
args: [
|
|
22
|
+
...entry.endsWith(".ts") ? ["--import", createRequire(import.meta.url).resolve("tsx/esm")] : [],
|
|
23
|
+
entry,
|
|
24
|
+
...args
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function subagentMcpProcessConfig(parentChatId) {
|
|
29
|
+
return engineScriptProcess("subagent-mcp", ["--parent", parentChatId]);
|
|
30
|
+
}
|
|
31
|
+
function subagentCodexMcpConfig(parentChatId) {
|
|
32
|
+
return {
|
|
33
|
+
...subagentMcpProcessConfig(parentChatId),
|
|
34
|
+
env_vars: ["REPLICAS_ENGINE_PORT", "REPLICAS_ENGINE_SECRET"],
|
|
35
|
+
enabled_tools: [...SUBAGENT_MCP_TOOL_NAMES],
|
|
36
|
+
required: true,
|
|
37
|
+
default_tools_approval_mode: "approve",
|
|
38
|
+
startup_timeout_sec: 10,
|
|
39
|
+
tool_timeout_sec: Math.ceil(SUBAGENT_MCP_TOOL_TIMEOUT_MS / 1e3)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
SUBAGENT_MCP_TOOL_TIMEOUT_MS,
|
|
45
|
+
engineScriptProcess,
|
|
46
|
+
subagentMcpProcessConfig,
|
|
47
|
+
subagentCodexMcpConfig
|
|
48
|
+
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from 'node:module';
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
OPENCODE_AUTH_PATH
|
|
6
|
+
} from "./chunk-7ZDAVYTV.js";
|
|
4
7
|
import {
|
|
5
8
|
AspClient
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JNVXGKRR.js";
|
|
7
10
|
import {
|
|
8
11
|
ASTER_BASE_URL,
|
|
9
12
|
ASTER_PROVIDER,
|
|
@@ -15,7 +18,7 @@ import {
|
|
|
15
18
|
isRecord,
|
|
16
19
|
readOllamaAuthEnv,
|
|
17
20
|
readOpenAICompatibleAuthEnv
|
|
18
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-25TILJOA.js";
|
|
19
22
|
|
|
20
23
|
// src/managers/codex-asp/notification-dispatch.ts
|
|
21
24
|
var TURN_STARTED_METHOD = "turn/started";
|
|
@@ -60,16 +63,6 @@ function recoverCompletedTurn(turn, completedItems, agentMessageDeltas) {
|
|
|
60
63
|
import { existsSync } from "fs";
|
|
61
64
|
import { readFile } from "fs/promises";
|
|
62
65
|
import { z } from "zod";
|
|
63
|
-
|
|
64
|
-
// src/managers/agent-auth-paths.ts
|
|
65
|
-
import { homedir } from "os";
|
|
66
|
-
import { join } from "path";
|
|
67
|
-
var OPENCODE_AUTH_PATH = join(homedir(), ".local", "share", "opencode", "auth.json");
|
|
68
|
-
var PI_AUTH_PATH = join(homedir(), ".pi", "agent", "auth.json");
|
|
69
|
-
var PI_MCP_CONFIG_PATH = join(homedir(), ".pi", "agent", "mcp.json");
|
|
70
|
-
var MUSE_AUTH_PATH = join(homedir(), ".config", "muse", "auth.json");
|
|
71
|
-
|
|
72
|
-
// src/managers/opencode-config.ts
|
|
73
66
|
var OPENCODE_WORKSPACE_PERMISSION = "allow";
|
|
74
67
|
var OPENROUTER_IGNORED_PROVIDERS = ["baseten"];
|
|
75
68
|
var OPENCODE_VARIANT_CANDIDATES_BY_THINKING_LEVEL = {
|
|
@@ -237,10 +230,6 @@ export {
|
|
|
237
230
|
THREAD_STATUS_CHANGED_METHOD,
|
|
238
231
|
dispatchAspNotification,
|
|
239
232
|
recoverCompletedTurn,
|
|
240
|
-
OPENCODE_AUTH_PATH,
|
|
241
|
-
PI_AUTH_PATH,
|
|
242
|
-
PI_MCP_CONFIG_PATH,
|
|
243
|
-
MUSE_AUTH_PATH,
|
|
244
233
|
fetchOpencodeModelVariants,
|
|
245
234
|
opencodeThinkingVariant,
|
|
246
235
|
hasOpencodeCredentials,
|