replicas-engine 0.1.1192 → 0.1.1194
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-IPWWQ36D.js → asp-host-2PTQ4WBJ.js} +5 -5
- package/dist/src/{chunk-XCLNV3EB.js → chunk-7LBCGK6Y.js} +86 -64
- package/dist/src/{chunk-TX3C2WLH.js → chunk-CNWTNVTV.js} +1 -1
- package/dist/src/{chunk-IXT5Q2OM.js → chunk-FIBXPCOA.js} +1 -1
- package/dist/src/{chunk-2U32TFQX.js → chunk-GK57LZQO.js} +2 -2
- package/dist/src/{chunk-4NFYMG76.js → chunk-RSL22FZF.js} +3 -3
- package/dist/src/{chunk-5ZJLLVQI.js → chunk-TEYBJDAM.js} +18 -7
- package/dist/src/{chunk-5S6AMTCX.js → chunk-UALQQL4Y.js} +6 -6
- package/dist/src/{chunk-6GGRJKT4.js → chunk-ZR5BD5SR.js} +2 -2
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +4 -4
- package/dist/src/index.js +62 -16
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
listRunningCodexModels,
|
|
9
9
|
restartCodexAspHost,
|
|
10
10
|
restartCodexAspHostIfRunning
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-UALQQL4Y.js";
|
|
12
|
+
import "./chunk-ZR5BD5SR.js";
|
|
13
|
+
import "./chunk-RSL22FZF.js";
|
|
14
|
+
import "./chunk-FIBXPCOA.js";
|
|
15
15
|
import "./chunk-UZSNFLDQ.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-7LBCGK6Y.js";
|
|
17
17
|
import "./chunk-VEQXQN22.js";
|
|
18
18
|
export {
|
|
19
19
|
CODEX_ULTRAFAST_SERVICE_TIER,
|
|
@@ -996,10 +996,7 @@ async function listOpenAICompatibleModels(credential) {
|
|
|
996
996
|
for (let page = 0; page < MAX_CATALOG_PAGES; page += 1) {
|
|
997
997
|
validateExternalApiHost(modelsUrl, "Models endpoint");
|
|
998
998
|
const response = await fetch(modelsUrl, {
|
|
999
|
-
headers: {
|
|
1000
|
-
Accept: "application/json",
|
|
1001
|
-
Authorization: credential.authorizationHeader || `Bearer ${credential.apiKey}`
|
|
1002
|
-
},
|
|
999
|
+
headers: { Accept: "application/json", Authorization: credential.authorizationHeader || `Bearer ${credential.apiKey}` },
|
|
1003
1000
|
redirect: "error",
|
|
1004
1001
|
signal
|
|
1005
1002
|
});
|
|
@@ -1021,6 +1018,13 @@ async function listOpenAICompatibleModels(credential) {
|
|
|
1021
1018
|
function resolveOpenAICompatibleModelsUrl(values) {
|
|
1022
1019
|
return values.modelsUrl || `${values.baseUrl}/models`;
|
|
1023
1020
|
}
|
|
1021
|
+
function openAICompatibleAuthEnvKeys(agent) {
|
|
1022
|
+
return ["API_KEY", "BASE_URL", "MODELS_URL", "AUTHORIZATION_HEADER"].map((key) => `REPLICAS_${agent.toUpperCase()}_OPENAI_COMPATIBLE_${key}`);
|
|
1023
|
+
}
|
|
1024
|
+
function readOpenAICompatibleAuthEnv(agent, env) {
|
|
1025
|
+
const [apiKey, baseUrl, modelsUrl, authorizationHeader] = openAICompatibleAuthEnvKeys(agent).map((key) => env[key] || void 0);
|
|
1026
|
+
return baseUrl && (apiKey || authorizationHeader) ? { apiKey, baseUrl, modelsUrl, authorizationHeader } : null;
|
|
1027
|
+
}
|
|
1024
1028
|
|
|
1025
1029
|
// ../shared/src/credentials/ollama.ts
|
|
1026
1030
|
var OLLAMA_AGENTS = ["claude", "codex", "opencode", "pi"];
|
|
@@ -1152,7 +1156,8 @@ var INFERENCE_PROVIDER_LABELS = {
|
|
|
1152
1156
|
[CREDENTIAL_METHOD.OLLAMA]: "Ollama",
|
|
1153
1157
|
[CREDENTIAL_METHOD.OPENCODE_GO]: "OpenCode Go",
|
|
1154
1158
|
[CREDENTIAL_METHOD.ASTER]: "Aster",
|
|
1155
|
-
[CREDENTIAL_METHOD.OPENROUTER]: "OpenRouter"
|
|
1159
|
+
[CREDENTIAL_METHOD.OPENROUTER]: "OpenRouter",
|
|
1160
|
+
[CREDENTIAL_METHOD.OPENAI_COMPATIBLE]: "OpenAI-compatible endpoint"
|
|
1156
1161
|
};
|
|
1157
1162
|
var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
|
|
1158
1163
|
[AGENT.CLAUDE]: [
|
|
@@ -1180,12 +1185,14 @@ var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
|
|
|
1180
1185
|
{ method: CREDENTIAL_METHOD.OPENCODE_GO, credentialType: CREDENTIAL_TYPE.OPENCODE_GO_API_KEY },
|
|
1181
1186
|
{ method: CREDENTIAL_METHOD.ASTER, credentialType: CREDENTIAL_TYPE.ASTER_API_KEY },
|
|
1182
1187
|
{ method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY },
|
|
1188
|
+
{ method: CREDENTIAL_METHOD.OPENAI_COMPATIBLE, credentialType: CREDENTIAL_TYPE.OPENAI_COMPATIBLE },
|
|
1183
1189
|
{ method: CREDENTIAL_METHOD.OLLAMA, credentialType: CREDENTIAL_TYPE.OLLAMA }
|
|
1184
1190
|
],
|
|
1185
1191
|
[AGENT.PI]: [
|
|
1186
1192
|
{ method: CREDENTIAL_METHOD.OPENCODE_GO, credentialType: CREDENTIAL_TYPE.OPENCODE_GO_API_KEY },
|
|
1187
1193
|
{ method: CREDENTIAL_METHOD.ASTER, credentialType: CREDENTIAL_TYPE.ASTER_API_KEY },
|
|
1188
1194
|
{ method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY },
|
|
1195
|
+
{ method: CREDENTIAL_METHOD.OPENAI_COMPATIBLE, credentialType: CREDENTIAL_TYPE.OPENAI_COMPATIBLE },
|
|
1189
1196
|
{ method: CREDENTIAL_METHOD.OLLAMA, credentialType: CREDENTIAL_TYPE.OLLAMA }
|
|
1190
1197
|
]
|
|
1191
1198
|
};
|
|
@@ -1202,8 +1209,6 @@ function getCredentialMethodLabel(agent, method) {
|
|
|
1202
1209
|
if (agent === AGENT.CURSOR) return "Cursor API key";
|
|
1203
1210
|
if (agent === AGENT.MUSE) return "Muse API key";
|
|
1204
1211
|
return "Anthropic API key";
|
|
1205
|
-
case CREDENTIAL_METHOD.OPENAI_COMPATIBLE:
|
|
1206
|
-
return "OpenAI-compatible endpoint";
|
|
1207
1212
|
case CREDENTIAL_METHOD.FOUNDRY:
|
|
1208
1213
|
return "Microsoft Foundry";
|
|
1209
1214
|
case CREDENTIAL_METHOD.BEDROCK:
|
|
@@ -1212,6 +1217,7 @@ function getCredentialMethodLabel(agent, method) {
|
|
|
1212
1217
|
case CREDENTIAL_METHOD.OPENCODE_GO:
|
|
1213
1218
|
case CREDENTIAL_METHOD.ASTER:
|
|
1214
1219
|
case CREDENTIAL_METHOD.OPENROUTER:
|
|
1220
|
+
case CREDENTIAL_METHOD.OPENAI_COMPATIBLE:
|
|
1215
1221
|
return INFERENCE_PROVIDER_LABELS[method];
|
|
1216
1222
|
case CREDENTIAL_METHOD.MUSE_OAUTH:
|
|
1217
1223
|
return "Muse account";
|
|
@@ -2263,6 +2269,12 @@ var agentQuotaExhaustedPayloadSchema = z9.object({
|
|
|
2263
2269
|
function defaultForkChatTitle(source, provider2) {
|
|
2264
2270
|
return isDefaultChat(source) ? `Forked from ${source.title}` : `${source.title} (${getProviderDisplayName(provider2)})`;
|
|
2265
2271
|
}
|
|
2272
|
+
var continuesChat = (chat, source) => !chat.deletedAt && chat.fork?.trigger === "auto" && chat.fork.source.chatId === source.id && source.updatedAt <= chat.fork.startedAt;
|
|
2273
|
+
function getChatContinuation(chats, chatId) {
|
|
2274
|
+
const source = chatId ? chats.find((chat) => chat.id === chatId) : void 0;
|
|
2275
|
+
const next = source && chats.find((chat) => continuesChat(chat, source));
|
|
2276
|
+
return next && (getChatContinuation(chats, next.id) ?? next);
|
|
2277
|
+
}
|
|
2266
2278
|
|
|
2267
2279
|
// ../shared/src/credential-pool.ts
|
|
2268
2280
|
import { z as z10 } from "zod";
|
|
@@ -2357,6 +2369,66 @@ var USER_MESSAGE_MATCH_GRACE_PERIOD_MS = 3e4;
|
|
|
2357
2369
|
var COMPACTION_CONTENT = "Context compacted";
|
|
2358
2370
|
var GOAL_TOOL_NAME = "goal";
|
|
2359
2371
|
|
|
2372
|
+
// ../shared/src/user-message-parser/chat-fork.ts
|
|
2373
|
+
var OPEN_MARKER = "<!-- replicas:chat-fork ";
|
|
2374
|
+
var OPEN_MARKER_END = " -->";
|
|
2375
|
+
var CLOSE_MARKER = "<!-- /replicas:chat-fork -->";
|
|
2376
|
+
var CHAT_FORK_EXCERPT_OMITTED_NOTICE = "[earlier turns omitted; read the transcript file for them]";
|
|
2377
|
+
function formatChatForkHandoffMessage(handoff) {
|
|
2378
|
+
const meta = {
|
|
2379
|
+
sourceProvider: handoff.source.provider,
|
|
2380
|
+
sourceTitle: handoff.source.title,
|
|
2381
|
+
trigger: handoff.trigger,
|
|
2382
|
+
reason: handoff.reason
|
|
2383
|
+
};
|
|
2384
|
+
const sourceName = getProviderDisplayName(handoff.source.provider, "long");
|
|
2385
|
+
const reason = describeChatForkReason(handoff.reason, handoff.source.provider);
|
|
2386
|
+
const why = handoff.trigger === "auto" ? `until ${reason ?? "it stopped"}, so Replicas moved the conversation to you automatically` : "until the user forked it to you";
|
|
2387
|
+
const side = handoff.trigger === "side";
|
|
2388
|
+
const body = [
|
|
2389
|
+
side ? "# Side chat" : handoff.subagent ? "# Delegated task context" : `# Continuing a ${sourceName} chat`,
|
|
2390
|
+
"",
|
|
2391
|
+
side ? `You are a side chat the user opened next to the main chat "${handoff.source.title}" (${sourceName}) in this same workspace, to talk about it without interrupting it. The main chat may still be working, and nothing you say reaches it or its agent. Answer from its transcript and the workspace. The recent turns below are a snapshot from when you were opened and the main chat has likely moved on, so re-read the transcript file before answering anything about what it is doing or has done. Its agent works in the same files, so don't edit files, change git state, or start or stop processes unless the user explicitly asks you to.` : handoff.subagent ? `You are a subagent of the chat "${handoff.source.title}" in this same workspace. The inherited transcript is background for your assigned task below. Follow that task and report your result to the parent; do not take over the parent's entire request. Workspace files and git state are shared and authoritative.` : `You are picking up the chat "${handoff.source.title}" in this same workspace. It was running on ${sourceName} ${why}. Everything the previous agent changed is already on disk: the workspace files and git state are authoritative.`,
|
|
2392
|
+
"",
|
|
2393
|
+
"## Transcript",
|
|
2394
|
+
"",
|
|
2395
|
+
side ? `- Main chat transcript: \`${handoff.transcriptPath}\` (Replicas refreshes it with the main chat's latest turns before each of your turns; re-read it whenever you need the main chat's current state)` : `- Sanitized transcript: \`${handoff.transcriptPath}\` (read or grep it for anything not in the excerpt below)`,
|
|
2396
|
+
...handoff.rawHistoryPath ? [`- Raw event log: \`${handoff.rawHistoryPath}\``] : [],
|
|
2397
|
+
...handoff.sourceTruncated ? [`- The chat was too large to sanitize in full; the sanitized file holds only its most recent part.${handoff.rawHistoryPath ? " Grep the raw event log for anything older." : ""}`] : [],
|
|
2398
|
+
"",
|
|
2399
|
+
"## Recent turns",
|
|
2400
|
+
"",
|
|
2401
|
+
...handoff.excerptTruncated ? [CHAT_FORK_EXCERPT_OMITTED_NOTICE, ""] : [],
|
|
2402
|
+
handoff.excerpt.trim() || "_The source chat had no messages yet._"
|
|
2403
|
+
].join("\n");
|
|
2404
|
+
const instruction = handoff.message?.trim() || (side ? "Say in one sentence that you are ready for questions about the main chat." : handoff.resumeRequest ? `The previous agent was interrupted before it finished this request from the user. Continue it now:
|
|
2405
|
+
|
|
2406
|
+
${handoff.resumeRequest.trim().replace(/^/gm, "> ")}` : "Review the recent turns and the current workspace state, then continue where the previous agent left off. If nothing is pending, confirm in a sentence or two what you know and wait for the next request.");
|
|
2407
|
+
return `${OPEN_MARKER}${JSON.stringify(meta)}${OPEN_MARKER_END}
|
|
2408
|
+
${body}
|
|
2409
|
+
${CLOSE_MARKER}
|
|
2410
|
+
|
|
2411
|
+
${instruction}`;
|
|
2412
|
+
}
|
|
2413
|
+
function formatSideChatUpdateMessage(source, turns, message2) {
|
|
2414
|
+
const meta = { sourceProvider: source.provider, sourceTitle: source.title, trigger: "side" };
|
|
2415
|
+
return `${OPEN_MARKER}${JSON.stringify(meta)}${OPEN_MARKER_END}
|
|
2416
|
+
# Main chat update
|
|
2417
|
+
|
|
2418
|
+
The main chat "${source.title}" has new turns since your last reply:
|
|
2419
|
+
|
|
2420
|
+
${turns}
|
|
2421
|
+
${CLOSE_MARKER}
|
|
2422
|
+
|
|
2423
|
+
${message2}`;
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
// ../shared/src/display-message/chat-thread.ts
|
|
2427
|
+
function describeHarnessSwitch(message2) {
|
|
2428
|
+
const reason = describeChatForkReason(message2.reason, message2.fromProvider) ?? `${getProviderDisplayName(message2.fromProvider)} stopped`;
|
|
2429
|
+
return `${reason}, continuing in ${getProviderDisplayName(message2.toProvider, "long")}`;
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2360
2432
|
// ../shared/src/shell-commands.ts
|
|
2361
2433
|
var SHELL_OPAQUE = "\0";
|
|
2362
2434
|
var MAX_DEPTH = 8;
|
|
@@ -2815,6 +2887,7 @@ ${operation.diff}` : ""}`).join("\n\n");
|
|
|
2815
2887
|
const { headline, outcomeClause } = describeAuthFallback(message2);
|
|
2816
2888
|
return { kind: "error", title: "Credential fallback", summary: headline, content: [`The workspace ${outcomeClause}.`, message2.detail].filter(Boolean).join("\n\n") };
|
|
2817
2889
|
}
|
|
2890
|
+
if (message2.type === "harness_switch") return { kind: "error", title: describeHarnessSwitch(message2), summary: "", content: "" };
|
|
2818
2891
|
if (message2.type === "interruption") return { kind: "error", title: "Agent stopped", summary: "", content: "" };
|
|
2819
2892
|
if (message2.type === "multitask_event") return { kind: "task", title: "Subagent update", summary: message2.events.map((event) => `${event.agentName}: ${event.summary}`).join(" \xB7 "), content: "" };
|
|
2820
2893
|
return { kind: "error", title: "Agent error", summary: "", content: message2.message };
|
|
@@ -7949,60 +8022,6 @@ function lastUserBlockText(blocks) {
|
|
|
7949
8022
|
return body || null;
|
|
7950
8023
|
}
|
|
7951
8024
|
|
|
7952
|
-
// ../shared/src/user-message-parser/chat-fork.ts
|
|
7953
|
-
var OPEN_MARKER = "<!-- replicas:chat-fork ";
|
|
7954
|
-
var OPEN_MARKER_END = " -->";
|
|
7955
|
-
var CLOSE_MARKER = "<!-- /replicas:chat-fork -->";
|
|
7956
|
-
var CHAT_FORK_EXCERPT_OMITTED_NOTICE = "[earlier turns omitted; read the transcript file for them]";
|
|
7957
|
-
function formatChatForkHandoffMessage(handoff) {
|
|
7958
|
-
const meta = {
|
|
7959
|
-
sourceProvider: handoff.source.provider,
|
|
7960
|
-
sourceTitle: handoff.source.title,
|
|
7961
|
-
trigger: handoff.trigger,
|
|
7962
|
-
reason: handoff.reason
|
|
7963
|
-
};
|
|
7964
|
-
const sourceName = getProviderDisplayName(handoff.source.provider, "long");
|
|
7965
|
-
const reason = describeChatForkReason(handoff.reason, handoff.source.provider);
|
|
7966
|
-
const why = handoff.trigger === "auto" ? `until ${reason ?? "it stopped"}, so Replicas moved the conversation to you automatically` : "until the user forked it to you";
|
|
7967
|
-
const side = handoff.trigger === "side";
|
|
7968
|
-
const body = [
|
|
7969
|
-
side ? "# Side chat" : handoff.subagent ? "# Delegated task context" : `# Continuing a ${sourceName} chat`,
|
|
7970
|
-
"",
|
|
7971
|
-
side ? `You are a side chat the user opened next to the main chat "${handoff.source.title}" (${sourceName}) in this same workspace, to talk about it without interrupting it. The main chat may still be working, and nothing you say reaches it or its agent. Answer from its transcript and the workspace. The recent turns below are a snapshot from when you were opened and the main chat has likely moved on, so re-read the transcript file before answering anything about what it is doing or has done. Its agent works in the same files, so don't edit files, change git state, or start or stop processes unless the user explicitly asks you to.` : handoff.subagent ? `You are a subagent of the chat "${handoff.source.title}" in this same workspace. The inherited transcript is background for your assigned task below. Follow that task and report your result to the parent; do not take over the parent's entire request. Workspace files and git state are shared and authoritative.` : `You are picking up the chat "${handoff.source.title}" in this same workspace. It was running on ${sourceName} ${why}. Everything the previous agent changed is already on disk: the workspace files and git state are authoritative.`,
|
|
7972
|
-
"",
|
|
7973
|
-
"## Transcript",
|
|
7974
|
-
"",
|
|
7975
|
-
side ? `- Main chat transcript: \`${handoff.transcriptPath}\` (Replicas refreshes it with the main chat's latest turns before each of your turns; re-read it whenever you need the main chat's current state)` : `- Sanitized transcript: \`${handoff.transcriptPath}\` (read or grep it for anything not in the excerpt below)`,
|
|
7976
|
-
...handoff.rawHistoryPath ? [`- Raw event log: \`${handoff.rawHistoryPath}\``] : [],
|
|
7977
|
-
...handoff.sourceTruncated ? [`- The chat was too large to sanitize in full; the sanitized file holds only its most recent part.${handoff.rawHistoryPath ? " Grep the raw event log for anything older." : ""}`] : [],
|
|
7978
|
-
"",
|
|
7979
|
-
"## Recent turns",
|
|
7980
|
-
"",
|
|
7981
|
-
...handoff.excerptTruncated ? [CHAT_FORK_EXCERPT_OMITTED_NOTICE, ""] : [],
|
|
7982
|
-
handoff.excerpt.trim() || "_The source chat had no messages yet._"
|
|
7983
|
-
].join("\n");
|
|
7984
|
-
const instruction = handoff.message?.trim() || (side ? "Say in one sentence that you are ready for questions about the main chat." : handoff.resumeRequest ? `The previous agent was interrupted before it finished this request from the user. Continue it now:
|
|
7985
|
-
|
|
7986
|
-
${handoff.resumeRequest.trim().replace(/^/gm, "> ")}` : "Review the recent turns and the current workspace state, then continue where the previous agent left off. If nothing is pending, confirm in a sentence or two what you know and wait for the next request.");
|
|
7987
|
-
return `${OPEN_MARKER}${JSON.stringify(meta)}${OPEN_MARKER_END}
|
|
7988
|
-
${body}
|
|
7989
|
-
${CLOSE_MARKER}
|
|
7990
|
-
|
|
7991
|
-
${instruction}`;
|
|
7992
|
-
}
|
|
7993
|
-
function formatSideChatUpdateMessage(source, turns, message2) {
|
|
7994
|
-
const meta = { sourceProvider: source.provider, sourceTitle: source.title, trigger: "side" };
|
|
7995
|
-
return `${OPEN_MARKER}${JSON.stringify(meta)}${OPEN_MARKER_END}
|
|
7996
|
-
# Main chat update
|
|
7997
|
-
|
|
7998
|
-
The main chat "${source.title}" has new turns since your last reply:
|
|
7999
|
-
|
|
8000
|
-
${turns}
|
|
8001
|
-
${CLOSE_MARKER}
|
|
8002
|
-
|
|
8003
|
-
${message2}`;
|
|
8004
|
-
}
|
|
8005
|
-
|
|
8006
8025
|
// ../shared/src/transcript-condense.ts
|
|
8007
8026
|
var W = "[\\p{L}\\p{N}_]";
|
|
8008
8027
|
var NOT_BEFORE = `(?<!${W})`;
|
|
@@ -9924,6 +9943,7 @@ export {
|
|
|
9924
9943
|
detectAgentQuotaLimit,
|
|
9925
9944
|
listOpenAICompatibleModels,
|
|
9926
9945
|
resolveOpenAICompatibleModelsUrl,
|
|
9946
|
+
readOpenAICompatibleAuthEnv,
|
|
9927
9947
|
OLLAMA_AGENTS,
|
|
9928
9948
|
readOllamaAuthEnv,
|
|
9929
9949
|
DEFAULT_OLLAMA_MODEL,
|
|
@@ -9959,6 +9979,7 @@ export {
|
|
|
9959
9979
|
decodePathSegments,
|
|
9960
9980
|
buildCodeHostPrUrl,
|
|
9961
9981
|
detectLanguageByPath,
|
|
9982
|
+
DEFAULT_CHAT_TITLES,
|
|
9962
9983
|
isDefaultChat,
|
|
9963
9984
|
CLAUDE_OPUS_4_8_BEDROCK_MODEL,
|
|
9964
9985
|
CLAUDE_SONNET_5_BEDROCK_MODEL,
|
|
@@ -9990,6 +10011,7 @@ export {
|
|
|
9990
10011
|
AGENT_QUOTA_EXHAUSTED_EVENT_TYPE,
|
|
9991
10012
|
agentQuotaExhaustedPayloadSchema,
|
|
9992
10013
|
defaultForkChatTitle,
|
|
10014
|
+
getChatContinuation,
|
|
9993
10015
|
CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE,
|
|
9994
10016
|
ACCEPTED_USER_MESSAGE_SOURCE,
|
|
9995
10017
|
QUEUED_MESSAGE_REMOVED_EVENT_TYPE,
|
|
@@ -10038,6 +10060,9 @@ export {
|
|
|
10038
10060
|
chatHistoryPageParamsFromQuery,
|
|
10039
10061
|
paginateChatHistory,
|
|
10040
10062
|
coerceBackgroundTaskPayload,
|
|
10063
|
+
CHAT_FORK_EXCERPT_OMITTED_NOTICE,
|
|
10064
|
+
formatChatForkHandoffMessage,
|
|
10065
|
+
formatSideChatUpdateMessage,
|
|
10041
10066
|
fileContentDiff,
|
|
10042
10067
|
skillNamesFromCommand,
|
|
10043
10068
|
SUBAGENT_MCP_SERVER_NAME,
|
|
@@ -10091,9 +10116,6 @@ export {
|
|
|
10091
10116
|
CodexHistoryEventFolder,
|
|
10092
10117
|
canonicalizeChatTranscriptBlocks,
|
|
10093
10118
|
lastUserBlockText,
|
|
10094
|
-
CHAT_FORK_EXCERPT_OMITTED_NOTICE,
|
|
10095
|
-
formatChatForkHandoffMessage,
|
|
10096
|
-
formatSideChatUpdateMessage,
|
|
10097
10119
|
percentage,
|
|
10098
10120
|
autoCompactThresholdField,
|
|
10099
10121
|
normalizeAutoCompactThreshold,
|
|
@@ -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-7LBCGK6Y.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
getOriginDefaultBranch,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
runGitCommand
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZR5BD5SR.js";
|
|
9
9
|
import {
|
|
10
10
|
extractCommandProtectionCommandText,
|
|
11
11
|
findCommandProtectionGitLookups,
|
|
12
12
|
findGitCommitSignals,
|
|
13
13
|
findPrMergeSignals,
|
|
14
14
|
parseCommandProtectionRequest
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7LBCGK6Y.js";
|
|
16
16
|
|
|
17
17
|
// src/services/command-protection-service.ts
|
|
18
18
|
import { readFile, stat } from "fs/promises";
|
|
@@ -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-FIBXPCOA.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7LBCGK6Y.js";
|
|
10
10
|
|
|
11
11
|
// src/utils/codex-agent-env.ts
|
|
12
12
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -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.1194";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -3,15 +3,17 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
AspClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RSL22FZF.js";
|
|
7
7
|
import {
|
|
8
8
|
ASTER_BASE_URL,
|
|
9
9
|
ASTER_PROVIDER,
|
|
10
|
+
CREDENTIAL_METHOD,
|
|
10
11
|
OPENCODE_GO_PROVIDER,
|
|
11
12
|
codexReasoningEffortForThinkingLevel,
|
|
12
13
|
isRecord,
|
|
13
|
-
readOllamaAuthEnv
|
|
14
|
-
|
|
14
|
+
readOllamaAuthEnv,
|
|
15
|
+
readOpenAICompatibleAuthEnv
|
|
16
|
+
} from "./chunk-7LBCGK6Y.js";
|
|
15
17
|
|
|
16
18
|
// src/managers/codex-asp/notification-dispatch.ts
|
|
17
19
|
var TURN_STARTED_METHOD = "turn/started";
|
|
@@ -90,6 +92,7 @@ var opencodeAuthSchema = z.record(z.string(), z.object({
|
|
|
90
92
|
}));
|
|
91
93
|
async function hasOpencodeCredentials(provider) {
|
|
92
94
|
if (provider === "ollama") return !!readOllamaAuthEnv("opencode", process.env);
|
|
95
|
+
if (provider === CREDENTIAL_METHOD.OPENAI_COMPATIBLE) return !!readOpenAICompatibleAuthEnv("opencode", process.env);
|
|
93
96
|
if (!existsSync(OPENCODE_AUTH_PATH)) return false;
|
|
94
97
|
try {
|
|
95
98
|
const auth = opencodeAuthSchema.safeParse(JSON.parse(await readFile(OPENCODE_AUTH_PATH, "utf8")));
|
|
@@ -100,6 +103,7 @@ async function hasOpencodeCredentials(provider) {
|
|
|
100
103
|
}
|
|
101
104
|
async function getOpencodeProvider() {
|
|
102
105
|
if (readOllamaAuthEnv("opencode", process.env)) return "ollama";
|
|
106
|
+
if (readOpenAICompatibleAuthEnv("opencode", process.env)) return CREDENTIAL_METHOD.OPENAI_COMPATIBLE;
|
|
103
107
|
if (await hasOpencodeCredentials(OPENCODE_GO_PROVIDER)) return OPENCODE_GO_PROVIDER;
|
|
104
108
|
if (await hasOpencodeCredentials(ASTER_PROVIDER)) return ASTER_PROVIDER;
|
|
105
109
|
return "openrouter";
|
|
@@ -121,16 +125,23 @@ function opencodeConfig(provider, model, providerModels = [model]) {
|
|
|
121
125
|
permission: OPENCODE_WORKSPACE_PERMISSION,
|
|
122
126
|
share: "disabled"
|
|
123
127
|
};
|
|
124
|
-
} else if (provider === ASTER_PROVIDER || provider === "ollama") {
|
|
128
|
+
} else if (provider === ASTER_PROVIDER || provider === "ollama" || provider === CREDENTIAL_METHOD.OPENAI_COMPATIBLE) {
|
|
125
129
|
const ollama = provider === "ollama" ? readOllamaAuthEnv("opencode", process.env) : null;
|
|
130
|
+
const compatible = provider === CREDENTIAL_METHOD.OPENAI_COMPATIBLE ? readOpenAICompatibleAuthEnv("opencode", process.env) : null;
|
|
126
131
|
config = {
|
|
127
132
|
enabled_providers: [provider],
|
|
128
133
|
model: `${provider}/${model}`,
|
|
129
134
|
provider: {
|
|
130
135
|
[provider]: {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
// Responses API: OpenAI models reject function tools with reasoning on Chat Completions.
|
|
137
|
+
npm: compatible ? "@ai-sdk/openai" : "@ai-sdk/openai-compatible",
|
|
138
|
+
name: ollama ? "Ollama" : compatible ? "OpenAI-compatible endpoint" : "Aster",
|
|
139
|
+
options: ollama ? { baseURL: `${ollama.baseUrl}/v1`, apiKey: ollama.apiKey } : compatible ? {
|
|
140
|
+
baseURL: compatible.baseUrl,
|
|
141
|
+
// The SDK refuses to start without a key; an exact Authorization header replaces the bearer it builds.
|
|
142
|
+
apiKey: compatible.apiKey ?? "unused",
|
|
143
|
+
...compatible.authorizationHeader ? { headers: { Authorization: compatible.authorizationHeader } } : {}
|
|
144
|
+
} : { baseURL: ASTER_BASE_URL },
|
|
134
145
|
models: Object.fromEntries(providerModels.map((candidate) => [candidate, {}]))
|
|
135
146
|
}
|
|
136
147
|
},
|
|
@@ -10,15 +10,15 @@ import {
|
|
|
10
10
|
resolveDiffBase,
|
|
11
11
|
runGitCommand,
|
|
12
12
|
setAgentCredentialSnapshot
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZR5BD5SR.js";
|
|
14
14
|
import {
|
|
15
15
|
AppServerProcess,
|
|
16
16
|
buildCodexAgentEnv
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-RSL22FZF.js";
|
|
18
18
|
import {
|
|
19
19
|
SUBPROCESS_MAX_BUFFER,
|
|
20
20
|
execFileAsync
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-FIBXPCOA.js";
|
|
22
22
|
import {
|
|
23
23
|
isRecord
|
|
24
24
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
resolveOpenAICompatibleModelsUrl,
|
|
56
56
|
splitMothershipInstructions,
|
|
57
57
|
withTimeout
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-7LBCGK6Y.js";
|
|
59
59
|
|
|
60
60
|
// src/managers/codex-token-manager.ts
|
|
61
61
|
import { promises as fs } from "fs";
|
|
@@ -291,7 +291,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
291
291
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
292
292
|
await this.applyCredentialsResponse(data);
|
|
293
293
|
setAgentCredentialSnapshot("codex", data);
|
|
294
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
294
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-2PTQ4WBJ.js");
|
|
295
295
|
await restartCodexAspHostIfRunning2();
|
|
296
296
|
});
|
|
297
297
|
await this.start(true);
|
|
@@ -313,7 +313,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
313
313
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
314
314
|
await this.applyCredentialsResponse(data);
|
|
315
315
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
316
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
316
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-2PTQ4WBJ.js");
|
|
317
317
|
await restartCodexAspHostIfRunning2();
|
|
318
318
|
}
|
|
319
319
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
SUBPROCESS_MAX_BUFFER,
|
|
6
6
|
execFileAsync
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FIBXPCOA.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord as isRecord2
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
isValidAgentProvider,
|
|
19
19
|
parsePosixEnvFile,
|
|
20
20
|
readReplicasRuntimeEnv
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-7LBCGK6Y.js";
|
|
22
22
|
|
|
23
23
|
// src/runtime-env-loader.ts
|
|
24
24
|
import { readFileSync } from "fs";
|
|
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
evaluateCommandProtection
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-GK57LZQO.js";
|
|
7
|
+
import "./chunk-ZR5BD5SR.js";
|
|
8
|
+
import "./chunk-FIBXPCOA.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-7LBCGK6Y.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
recoverCompletedTurn,
|
|
14
14
|
spawnMuseMsp,
|
|
15
15
|
startMuseSession
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TEYBJDAM.js";
|
|
17
17
|
import {
|
|
18
18
|
AppServerProcess,
|
|
19
19
|
buildCodexAgentEnv
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-RSL22FZF.js";
|
|
21
|
+
import "./chunk-FIBXPCOA.js";
|
|
22
22
|
import {
|
|
23
23
|
AGENT,
|
|
24
24
|
OPENCODE_GO_PROVIDER,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
headlessAgentUsagePath,
|
|
29
29
|
isRecord,
|
|
30
30
|
withTimeout
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-7LBCGK6Y.js";
|
|
32
32
|
import "./chunk-VEQXQN22.js";
|
|
33
33
|
|
|
34
34
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
evaluateCommandProtection,
|
|
28
28
|
extractToolCommand,
|
|
29
29
|
reportCommandProtectionBlock
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-GK57LZQO.js";
|
|
31
31
|
import {
|
|
32
32
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
33
33
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -64,10 +64,10 @@ import {
|
|
|
64
64
|
spawnMuseMsp,
|
|
65
65
|
startMuseSession,
|
|
66
66
|
uuidV7
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-TEYBJDAM.js";
|
|
68
68
|
import {
|
|
69
69
|
publishedPullRequestUrls
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-CNWTNVTV.js";
|
|
71
71
|
import {
|
|
72
72
|
ACCOUNT_RATE_LIMITS_READ_METHOD,
|
|
73
73
|
AsyncLock,
|
|
@@ -139,7 +139,7 @@ import {
|
|
|
139
139
|
timestampFromSeconds,
|
|
140
140
|
upsertCredentialFileLines,
|
|
141
141
|
writeSecureCredentialFile
|
|
142
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-UALQQL4Y.js";
|
|
143
143
|
import {
|
|
144
144
|
ENGINE_ENV,
|
|
145
145
|
monolithRequest,
|
|
@@ -148,15 +148,15 @@ import {
|
|
|
148
148
|
reloadEngineEnv,
|
|
149
149
|
resolveDiffBase,
|
|
150
150
|
setAgentCredentialSnapshot
|
|
151
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-ZR5BD5SR.js";
|
|
152
152
|
import {
|
|
153
153
|
getCodexModelProvider
|
|
154
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-RSL22FZF.js";
|
|
155
155
|
import {
|
|
156
156
|
SUBPROCESS_MAX_BUFFER,
|
|
157
157
|
execAsync,
|
|
158
158
|
execFileAsync
|
|
159
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-FIBXPCOA.js";
|
|
160
160
|
import {
|
|
161
161
|
isRecord as isRecord2
|
|
162
162
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -193,6 +193,7 @@ import {
|
|
|
193
193
|
CURSOR_CONNECTION_STATUS_EVENT_TYPE,
|
|
194
194
|
CodexHistoryEventFolder,
|
|
195
195
|
DEFAULT_ASTER_MODEL,
|
|
196
|
+
DEFAULT_CHAT_TITLES,
|
|
196
197
|
DEFAULT_CLAUDE_MODEL,
|
|
197
198
|
DEFAULT_CURSOR_MODEL,
|
|
198
199
|
DEFAULT_MUSE_MODEL,
|
|
@@ -292,6 +293,7 @@ import {
|
|
|
292
293
|
forkChatRequestSchema,
|
|
293
294
|
formatChatForkHandoffMessage,
|
|
294
295
|
formatSideChatUpdateMessage,
|
|
296
|
+
getChatContinuation,
|
|
295
297
|
getChatHistoryPageSenders,
|
|
296
298
|
getClaudeModelContextWindow,
|
|
297
299
|
getDefaultAgentModel,
|
|
@@ -338,6 +340,7 @@ import {
|
|
|
338
340
|
learnedSkillsManifestSchema,
|
|
339
341
|
legacyWorkspaceTokenBundleSchema,
|
|
340
342
|
listOllamaModels,
|
|
343
|
+
listOpenAICompatibleModels,
|
|
341
344
|
mergeSlashCommands,
|
|
342
345
|
messageSubagentRequestSchema,
|
|
343
346
|
normalizeAutoCompactThreshold,
|
|
@@ -361,6 +364,7 @@ import {
|
|
|
361
364
|
readJsonlAppended,
|
|
362
365
|
readJsonlPage,
|
|
363
366
|
readOllamaAuthEnv,
|
|
367
|
+
readOpenAICompatibleAuthEnv,
|
|
364
368
|
readReplicasRuntimeEnv,
|
|
365
369
|
resolveWarmHookConfig,
|
|
366
370
|
safeJsonParse,
|
|
@@ -384,7 +388,7 @@ import {
|
|
|
384
388
|
workspaceTokenRequestSchema,
|
|
385
389
|
workspaceTokenResponseSchema,
|
|
386
390
|
wrapInTag
|
|
387
|
-
} from "./chunk-
|
|
391
|
+
} from "./chunk-7LBCGK6Y.js";
|
|
388
392
|
import {
|
|
389
393
|
cloneMcpConfig,
|
|
390
394
|
ensureCompatibilityImports,
|
|
@@ -9498,9 +9502,9 @@ function detectAgentAuthMethod(provider) {
|
|
|
9498
9502
|
if (ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.muse?.method === "muse-oauth") return "oauth";
|
|
9499
9503
|
return ENGINE_ENV.REPLICAS_MUSE_AUTH_METHOD ?? "oauth";
|
|
9500
9504
|
case AGENT.OPENCODE:
|
|
9501
|
-
return existsSync(OPENCODE_AUTH_PATH) ? "api_key" : "none";
|
|
9502
9505
|
case AGENT.PI:
|
|
9503
|
-
|
|
9506
|
+
if (readOpenAICompatibleAuthEnv(provider, process.env)) return "openai-compatible";
|
|
9507
|
+
return existsSync(provider === AGENT.OPENCODE ? OPENCODE_AUTH_PATH : PI_AUTH_PATH) ? "api_key" : "none";
|
|
9504
9508
|
}
|
|
9505
9509
|
}
|
|
9506
9510
|
function isAgentAvailable(provider) {
|
|
@@ -9512,6 +9516,8 @@ import { readFile } from "fs/promises";
|
|
|
9512
9516
|
async function getPiProviderCredentials() {
|
|
9513
9517
|
const ollama = readOllamaAuthEnv("pi", process.env);
|
|
9514
9518
|
if (ollama) return createSuccessResult({ provider: "ollama", apiKey: ollama.apiKey });
|
|
9519
|
+
const compatible = readOpenAICompatibleAuthEnv("pi", process.env);
|
|
9520
|
+
if (compatible) return createSuccessResult({ provider: "openai-compatible", apiKey: compatible.apiKey ?? "" });
|
|
9515
9521
|
let credentials;
|
|
9516
9522
|
try {
|
|
9517
9523
|
credentials = JSON.parse(await readFile(PI_AUTH_PATH, "utf8"));
|
|
@@ -11058,7 +11064,7 @@ function describeQuotaExhaustion(provider, reason, credential, fallback) {
|
|
|
11058
11064
|
const agent = getProviderDisplayName(provider);
|
|
11059
11065
|
const account = credential ? describeCredential(provider, credential) : "the credential this workspace is using";
|
|
11060
11066
|
const limit = reason === "out_of_credits" ? `${agent} ran out of credits on ${account}.` : reason === "auth_failed" ? `${agent} could not authenticate with ${account}.` : `${agent} hit the usage limit on ${account}.`;
|
|
11061
|
-
const next = fallback.outcome === "fork" ? `
|
|
11067
|
+
const next = fallback.outcome === "fork" ? `Continuing in ${getProviderDisplayName(fallback.target.provider, "long")}.` : QUOTA_STOP_NEXT_STEP[fallback.outcome];
|
|
11062
11068
|
return `${limit} ${next}`;
|
|
11063
11069
|
}
|
|
11064
11070
|
var fallbackLocks = /* @__PURE__ */ new Map();
|
|
@@ -16350,6 +16356,8 @@ async function getDefaultOpencodeModel(provider) {
|
|
|
16350
16356
|
if (!model) throw new Error("Select a tool-capable Ollama model in the model picker.");
|
|
16351
16357
|
return model;
|
|
16352
16358
|
}
|
|
16359
|
+
const compatible = provider === CREDENTIAL_METHOD.OPENAI_COMPATIBLE ? readOpenAICompatibleAuthEnv("opencode", process.env) : null;
|
|
16360
|
+
if (compatible) return (await listOpenAICompatibleModels(compatible))[0].id;
|
|
16353
16361
|
if (provider === OPENCODE_GO_PROVIDER) return DEFAULT_OPENCODE_GO_MODEL;
|
|
16354
16362
|
if (provider === ASTER_PROVIDER) return DEFAULT_ASTER_MODEL;
|
|
16355
16363
|
return (await getAllowedOpenRouterModels())[0] ?? DEFAULT_OPENCODE_MODEL;
|
|
@@ -16577,7 +16585,8 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
16577
16585
|
this.providerId = providerId;
|
|
16578
16586
|
const configuredModel = providerId === OPENCODE_GO_PROVIDER ? getOpenCodeGoModel(model) : model;
|
|
16579
16587
|
const ollama = providerId === "ollama" ? readOllamaAuthEnv("opencode", process.env) : null;
|
|
16580
|
-
const
|
|
16588
|
+
const compatible = providerId === CREDENTIAL_METHOD.OPENAI_COMPATIBLE ? readOpenAICompatibleAuthEnv("opencode", process.env) : null;
|
|
16589
|
+
const providerModels = ollama ? (await listOllamaModels(ollama)).map(({ id }) => id) : compatible ? (await listOpenAICompatibleModels(compatible)).map(({ id }) => id) : providerId === OPENCODE_GO_PROVIDER ? Object.keys((await fetchOpenCodeGoCatalog()).models) : providerId === ASTER_PROVIDER ? ASTER_MODELS : await getAllowedOpenRouterModels();
|
|
16581
16590
|
if (!providerModels.includes(configuredModel)) {
|
|
16582
16591
|
throw new Error(`Model ${configuredModel} is not available through ${providerId}.`);
|
|
16583
16592
|
}
|
|
@@ -16585,7 +16594,7 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
16585
16594
|
return this.client;
|
|
16586
16595
|
}
|
|
16587
16596
|
if (!await hasOpencodeCredentials(providerId)) {
|
|
16588
|
-
throw new Error("OpenCode Go, Aster, OpenRouter, or Ollama credentials are not configured for Opencode in this workspace.");
|
|
16597
|
+
throw new Error("OpenCode Go, Aster, OpenRouter, OpenAI-compatible, or Ollama credentials are not configured for Opencode in this workspace.");
|
|
16589
16598
|
}
|
|
16590
16599
|
if (!existsSync8(OPENCODE_COMMAND_PROTECTION_PLUGIN_SOURCE)) {
|
|
16591
16600
|
throw new Error("Opencode command protection plugin is missing from the engine package.");
|
|
@@ -57422,6 +57431,7 @@ function registerPiProvider(modelRegistry, {
|
|
|
57422
57431
|
name,
|
|
57423
57432
|
apiKey,
|
|
57424
57433
|
baseUrl,
|
|
57434
|
+
headers,
|
|
57425
57435
|
models
|
|
57426
57436
|
}) {
|
|
57427
57437
|
modelRegistry.registerProvider(providerId, {
|
|
@@ -57429,7 +57439,8 @@ function registerPiProvider(modelRegistry, {
|
|
|
57429
57439
|
api: "openai-completions",
|
|
57430
57440
|
apiKey,
|
|
57431
57441
|
baseUrl,
|
|
57432
|
-
authHeader:
|
|
57442
|
+
authHeader: !headers?.Authorization,
|
|
57443
|
+
...headers ? { headers } : {},
|
|
57433
57444
|
models: models.map((model) => {
|
|
57434
57445
|
const builtin = modelRegistry.find(providerId, model.id);
|
|
57435
57446
|
const api = model.api ?? builtin?.api ?? "openai-completions";
|
|
@@ -57533,7 +57544,7 @@ var PiManager = class extends CodingAgentManager {
|
|
|
57533
57544
|
async enqueueMessage(request, onAccepted) {
|
|
57534
57545
|
await this.initialized;
|
|
57535
57546
|
if (!this.session && !(await getPiProviderCredentials()).ok) {
|
|
57536
|
-
throw new Error("OpenCode Go, Aster, or
|
|
57547
|
+
throw new Error("OpenCode Go, Aster, OpenRouter, or OpenAI-compatible authentication is missing for Pi. Add one in Settings \u2192 Coding agents.");
|
|
57537
57548
|
}
|
|
57538
57549
|
return this.messageQueue.enqueue(request, onAccepted);
|
|
57539
57550
|
}
|
|
@@ -57578,7 +57589,7 @@ var PiManager = class extends CodingAgentManager {
|
|
|
57578
57589
|
}
|
|
57579
57590
|
const modelRuntime = await this.getModelRuntime();
|
|
57580
57591
|
const credentialResult = await getPiProviderCredentials();
|
|
57581
|
-
if (!credentialResult.ok) throw new Error("OpenCode Go, Aster, or
|
|
57592
|
+
if (!credentialResult.ok) throw new Error("OpenCode Go, Aster, OpenRouter, or OpenAI-compatible credentials are not configured for Pi.");
|
|
57582
57593
|
const credentials = credentialResult.data;
|
|
57583
57594
|
this.providerId = credentials.provider;
|
|
57584
57595
|
this.providerApiKey = credentials.apiKey;
|
|
@@ -57606,6 +57617,27 @@ var PiManager = class extends CodingAgentManager {
|
|
|
57606
57617
|
input: model2.capabilities?.includes("vision") ? ["text", "image"] : ["text"]
|
|
57607
57618
|
}))
|
|
57608
57619
|
});
|
|
57620
|
+
} else if (this.providerId === CREDENTIAL_METHOD.OPENAI_COMPATIBLE) {
|
|
57621
|
+
const compatible = readOpenAICompatibleAuthEnv("pi", process.env);
|
|
57622
|
+
if (!compatible) throw new Error("OpenAI-compatible endpoint is not configured for Pi.");
|
|
57623
|
+
const models = await listOpenAICompatibleModels(compatible);
|
|
57624
|
+
defaultModel = models[0].id;
|
|
57625
|
+
registerPiProvider(modelRegistry, {
|
|
57626
|
+
providerId: CREDENTIAL_METHOD.OPENAI_COMPATIBLE,
|
|
57627
|
+
name: "OpenAI-compatible endpoint",
|
|
57628
|
+
apiKey: compatible.apiKey ?? "",
|
|
57629
|
+
baseUrl: compatible.baseUrl,
|
|
57630
|
+
...compatible.authorizationHeader ? { headers: { Authorization: compatible.authorizationHeader } } : {},
|
|
57631
|
+
// The catalog says nothing about reasoning or output limits, so ask for neither beyond what any chat model accepts.
|
|
57632
|
+
models: models.map((model2) => ({
|
|
57633
|
+
id: model2.id,
|
|
57634
|
+
name: model2.displayName,
|
|
57635
|
+
api: "openai-responses",
|
|
57636
|
+
reasoning: false,
|
|
57637
|
+
maxTokens: 16384,
|
|
57638
|
+
...model2.contextWindow ? { contextWindow: model2.contextWindow } : {}
|
|
57639
|
+
}))
|
|
57640
|
+
});
|
|
57609
57641
|
} else if (this.providerId === OPENCODE_GO_PROVIDER) {
|
|
57610
57642
|
const catalog = await fetchOpenCodeGoCatalog([request.model ?? DEFAULT_OPENCODE_GO_MODEL]);
|
|
57611
57643
|
const models = Object.entries(catalog.models);
|
|
@@ -59629,6 +59661,7 @@ var ChatService = class {
|
|
|
59629
59661
|
providerSessionId: null,
|
|
59630
59662
|
parentChatId,
|
|
59631
59663
|
fork: request.fork ?? null,
|
|
59664
|
+
...request.displayName ? { displayName: request.displayName } : {},
|
|
59632
59665
|
...source ? {
|
|
59633
59666
|
displayName: request.title?.trim() || void 0,
|
|
59634
59667
|
model: source.persisted.provider === request.provider ? source.persisted.model : void 0,
|
|
@@ -59759,6 +59792,8 @@ var ChatService = class {
|
|
|
59759
59792
|
const accepting2 = chat.acceptingSendResponses.get(idempotencyKey);
|
|
59760
59793
|
if (accepting2) return accepting2;
|
|
59761
59794
|
}
|
|
59795
|
+
const continuation = getChatContinuation(this.listChats(), chatId);
|
|
59796
|
+
if (continuation) return { ...await this.sendMessage(continuation.id, request), chatId: continuation.id };
|
|
59762
59797
|
const previousAcceptance = chat.lastSendAcceptance;
|
|
59763
59798
|
const accepting = (async () => {
|
|
59764
59799
|
chat.acceptingMessages += 1;
|
|
@@ -60181,6 +60216,13 @@ var ChatService = class {
|
|
|
60181
60216
|
target.persisted.updatedAt = restoredAt;
|
|
60182
60217
|
await this.publish({ type: "chat.created", payload: { chat: this.toSummary(target) } });
|
|
60183
60218
|
}
|
|
60219
|
+
for (let fork = chat.persisted.fork; fork?.trigger === "auto"; ) {
|
|
60220
|
+
const source = this.chats.get(fork.source.chatId);
|
|
60221
|
+
if (!source?.persisted.deletedAt || source.persisted.updatedAt > fork.startedAt) break;
|
|
60222
|
+
source.persisted.deletedAt = null;
|
|
60223
|
+
await this.publish({ type: "chat.created", payload: { chat: this.toSummary(source) } });
|
|
60224
|
+
fork = source.persisted.fork;
|
|
60225
|
+
}
|
|
60184
60226
|
await this.persistAllChats();
|
|
60185
60227
|
return this.toSummary(chat);
|
|
60186
60228
|
}
|
|
@@ -60222,10 +60264,14 @@ var ChatService = class {
|
|
|
60222
60264
|
if (trigger === "manual" && !isAgentAvailable(request.provider)) {
|
|
60223
60265
|
throw new ChatProviderUnavailableError(request.provider);
|
|
60224
60266
|
}
|
|
60267
|
+
const sourceName = source.persisted.displayName ?? source.persisted.title;
|
|
60225
60268
|
return this.createChat({
|
|
60226
60269
|
id: request.id,
|
|
60227
60270
|
provider: request.provider,
|
|
60228
60271
|
title: request.title?.trim() || defaultForkChatTitle(source.persisted, request.provider),
|
|
60272
|
+
...trigger === "auto" ? {
|
|
60273
|
+
displayName: sourceName === DEFAULT_CHAT_TITLES[source.persisted.provider] ? DEFAULT_CHAT_TITLES[request.provider] : sourceName
|
|
60274
|
+
} : {},
|
|
60229
60275
|
clientRequestId: request.clientRequestId,
|
|
60230
60276
|
fork: createForkInfo(source.persisted, trigger, (/* @__PURE__ */ new Date()).toISOString(), reason)
|
|
60231
60277
|
});
|
|
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
publishedPullRequestUrls
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CNWTNVTV.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
9
|
} from "./chunk-UZSNFLDQ.js";
|
|
10
10
|
import {
|
|
11
11
|
shouldRefreshPullRequests
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7LBCGK6Y.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/services/post-tool-pr-notifier.ts
|
package/dist/src/subagent-mcp.js
CHANGED