replicas-engine 0.1.1279 → 0.1.1280
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-CYLNJ6JB.js → asp-host-OLAWGNOT.js} +5 -5
- package/dist/src/{chunk-CQR3GSM4.js → chunk-22IJF5CU.js} +1 -1
- package/dist/src/{chunk-GJN2TDJ7.js → chunk-2V3IUQEJ.js} +3 -3
- package/dist/src/{chunk-32B2T6C3.js → chunk-4F62FSBJ.js} +15 -6
- package/dist/src/{chunk-5WJNG5IX.js → chunk-EF54GE6V.js} +2 -2
- package/dist/src/{chunk-YD76ZL7D.js → chunk-IU3ZJUGP.js} +1 -1
- package/dist/src/{chunk-47JJX56J.js → chunk-J5KG7UVX.js} +14 -5
- package/dist/src/{chunk-HUUEA35W.js → chunk-PM7AZN6N.js} +2 -2
- package/dist/src/{chunk-VCCUBYU3.js → chunk-YPDZYUL7.js} +6 -6
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +9 -7
- package/dist/src/index.js +29 -26
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +3 -3
|
@@ -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-YPDZYUL7.js";
|
|
12
|
+
import "./chunk-PM7AZN6N.js";
|
|
13
|
+
import "./chunk-2V3IUQEJ.js";
|
|
14
|
+
import "./chunk-22IJF5CU.js";
|
|
15
15
|
import "./chunk-UZSNFLDQ.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-J5KG7UVX.js";
|
|
17
17
|
import "./chunk-VEQXQN22.js";
|
|
18
18
|
export {
|
|
19
19
|
CODEX_ULTRAFAST_SERVICE_TIER,
|
|
@@ -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-J5KG7UVX.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-22IJF5CU.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-J5KG7UVX.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.1280";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -3,17 +3,19 @@ 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-2V3IUQEJ.js";
|
|
7
7
|
import {
|
|
8
8
|
ASTER_BASE_URL,
|
|
9
9
|
ASTER_PROVIDER,
|
|
10
10
|
CREDENTIAL_METHOD,
|
|
11
11
|
OPENCODE_GO_PROVIDER,
|
|
12
|
+
OPENCODE_ZEN_PROVIDER,
|
|
12
13
|
codexReasoningEffortForThinkingLevel,
|
|
14
|
+
isOpenCodeZenModel,
|
|
13
15
|
isRecord,
|
|
14
16
|
readOllamaAuthEnv,
|
|
15
17
|
readOpenAICompatibleAuthEnv
|
|
16
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-J5KG7UVX.js";
|
|
17
19
|
|
|
18
20
|
// src/managers/codex-asp/notification-dispatch.ts
|
|
19
21
|
var TURN_STARTED_METHOD = "turn/started";
|
|
@@ -109,17 +111,23 @@ async function getOpencodeProvider() {
|
|
|
109
111
|
return "openrouter";
|
|
110
112
|
}
|
|
111
113
|
function getOpenCodeGoModel(model) {
|
|
112
|
-
return model.replace(/^[^/]+\//, "");
|
|
114
|
+
return isOpenCodeZenModel(model) ? model : model.replace(/^[^/]+\//, "");
|
|
115
|
+
}
|
|
116
|
+
function opencodeModelRef(provider, model) {
|
|
117
|
+
if (provider !== OPENCODE_GO_PROVIDER) return { providerID: provider, modelID: model };
|
|
118
|
+
return isOpenCodeZenModel(model) ? { providerID: OPENCODE_ZEN_PROVIDER, modelID: model.slice(OPENCODE_ZEN_PROVIDER.length + 1) } : { providerID: OPENCODE_GO_PROVIDER, modelID: getOpenCodeGoModel(model) };
|
|
113
119
|
}
|
|
114
120
|
function opencodeConfig(provider, model, providerModels = [model]) {
|
|
115
121
|
let config;
|
|
116
122
|
if (provider === OPENCODE_GO_PROVIDER) {
|
|
123
|
+
const { providerID, modelID } = opencodeModelRef(provider, model);
|
|
117
124
|
config = {
|
|
118
|
-
|
|
119
|
-
|
|
125
|
+
// Without a key OpenCode's own provider serves only its free Zen models.
|
|
126
|
+
enabled_providers: [OPENCODE_GO_PROVIDER, OPENCODE_ZEN_PROVIDER],
|
|
127
|
+
model: `${providerID}/${modelID}`,
|
|
120
128
|
provider: {
|
|
121
129
|
[OPENCODE_GO_PROVIDER]: {
|
|
122
|
-
models: Object.fromEntries(providerModels.map((candidate) => [candidate, {}]))
|
|
130
|
+
models: Object.fromEntries(providerModels.filter((candidate) => !isOpenCodeZenModel(candidate)).map((candidate) => [candidate, {}]))
|
|
123
131
|
}
|
|
124
132
|
},
|
|
125
133
|
permission: OPENCODE_WORKSPACE_PERMISSION,
|
|
@@ -235,6 +243,7 @@ export {
|
|
|
235
243
|
hasOpencodeCredentials,
|
|
236
244
|
getOpencodeProvider,
|
|
237
245
|
getOpenCodeGoModel,
|
|
246
|
+
opencodeModelRef,
|
|
238
247
|
opencodeConfig,
|
|
239
248
|
uuidV7,
|
|
240
249
|
spawnMuseMsp,
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
getOriginDefaultBranch,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
runGitCommand
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-PM7AZN6N.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-J5KG7UVX.js";
|
|
16
16
|
|
|
17
17
|
// src/services/command-protection-service.ts
|
|
18
18
|
import { readFile, stat } from "fs/promises";
|
|
@@ -167,14 +167,20 @@ async function fetchModelsDevCatalog() {
|
|
|
167
167
|
|
|
168
168
|
// ../shared/src/credentials/opencode-go.ts
|
|
169
169
|
var OPENCODE_GO_PROVIDER = "opencode-go";
|
|
170
|
+
var OPENCODE_ZEN_PROVIDER = "opencode";
|
|
170
171
|
var OPENCODE_GO_BASE_URL = "https://opencode.ai/zen/go/v1";
|
|
171
172
|
var DEFAULT_OPENCODE_GO_MODEL = "glm-5.3";
|
|
172
|
-
|
|
173
|
+
function isOpenCodeZenModel(model2) {
|
|
174
|
+
return model2.startsWith(`${OPENCODE_ZEN_PROVIDER}/`);
|
|
175
|
+
}
|
|
176
|
+
async function fetchOpenCodeGoCatalog(agent, fallbackModelIds = [DEFAULT_OPENCODE_GO_MODEL]) {
|
|
173
177
|
try {
|
|
174
|
-
const
|
|
178
|
+
const catalog = await fetchModelsDevCatalog();
|
|
179
|
+
const provider2 = catalog[OPENCODE_GO_PROVIDER];
|
|
175
180
|
if (!provider2) throw new Error("OpenCode Go model catalog is unavailable");
|
|
181
|
+
const zenFreeModels = agent === "opencode" ? Object.entries(catalog[OPENCODE_ZEN_PROVIDER]?.models ?? {}).filter(([, definition]) => definition.cost?.input === 0).map(([id, definition]) => [`${OPENCODE_ZEN_PROVIDER}/${id}`, definition]) : [];
|
|
176
182
|
const models = Object.fromEntries(
|
|
177
|
-
Object.entries(provider2.models).filter(([, definition]) => definition.status !== "deprecated" && definition.status !== "alpha").map(([id, definition]) => [id, {
|
|
183
|
+
[...Object.entries(provider2.models), ...zenFreeModels].filter(([, definition]) => definition.status !== "deprecated" && definition.status !== "alpha").map(([id, definition]) => [id, {
|
|
178
184
|
id: definition.id ?? id,
|
|
179
185
|
name: definition.name,
|
|
180
186
|
api: definition.provider?.npm === "@ai-sdk/anthropic" ? "anthropic-messages" : definition.provider?.npm === "@ai-sdk/openai" ? "openai-responses" : void 0,
|
|
@@ -187,7 +193,7 @@ async function fetchOpenCodeGoCatalog(fallbackModelIds = [DEFAULT_OPENCODE_GO_MO
|
|
|
187
193
|
} catch {
|
|
188
194
|
return {
|
|
189
195
|
authoritative: false,
|
|
190
|
-
models: Object.fromEntries(fallbackModelIds.map((id) => [id, {
|
|
196
|
+
models: Object.fromEntries(fallbackModelIds.filter((id) => agent === "opencode" || !isOpenCodeZenModel(id)).map((id) => [id, {
|
|
191
197
|
id,
|
|
192
198
|
name: id === DEFAULT_OPENCODE_GO_MODEL ? "GLM 5.3" : id
|
|
193
199
|
}]))
|
|
@@ -4496,6 +4502,7 @@ In agent mode the CLI hides commands that don't make sense for in-workspace agen
|
|
|
4496
4502
|
| "Make an automation that runs when a PR opens on \`acme/web\`" | \`replicas automation create ... --trigger-github pull_request.opened --trigger-github-repos acme/web\` |
|
|
4497
4503
|
| "Make an automation that runs when an MR opens on \`acme/web\`" | \`replicas automation create ... --trigger-gitlab merge_request.opened --trigger-gitlab-repos acme/web\` |
|
|
4498
4504
|
| "Ignore Dependabot for this PR automation" | \`replicas automation edit <id> --trigger-github-exclude-users 'dependabot[bot]'\` |
|
|
4505
|
+
| "Also run this PR automation on every push" | \`replicas automation edit <id> --keep-triggers --trigger-github pull_request.synchronize --trigger-github-repos acme/web\` |
|
|
4499
4506
|
| "What repos are connected?" | \`replicas repos\` |
|
|
4500
4507
|
| "Set up a \`replicas.json\` in this repo" | \`replicas init\` (\`-y\` for YAML) |
|
|
4501
4508
|
|
|
@@ -4657,7 +4664,7 @@ replicas automation edit <id> \\
|
|
|
4657
4664
|
--trigger-cron "0 4 * * *" # replaces existing triggers
|
|
4658
4665
|
\`\`\`
|
|
4659
4666
|
|
|
4660
|
-
\`replicas automation edit <id> --trigger-github-exclude-users "dependabot[bot],renovate[bot]"\` updates existing GitHub triggers without replacing the rest of the trigger list. The GitLab equivalent is \`--trigger-gitlab-exclude-users\`. Passing an empty string (for example, \`--trigger-github-exclude-users ""\`) clears existing exclusions for that code host. Passing \`--trigger-github\` or \`--trigger-gitlab\`
|
|
4667
|
+
\`replicas automation edit <id> --trigger-github-exclude-users "dependabot[bot],renovate[bot]"\` updates existing GitHub triggers without replacing the rest of the trigger list. The GitLab equivalent is \`--trigger-gitlab-exclude-users\`. Passing an empty string (for example, \`--trigger-github-exclude-users ""\`) clears existing exclusions for that code host. Passing \`--trigger-cron\`, \`--trigger-github\` or \`--trigger-gitlab\` replaces all triggers (repeat a flag for several events); add \`--keep-triggers\` to add them to the existing triggers instead. The repo, exclude and reviewer flags apply only to the events you pass.
|
|
4661
4668
|
|
|
4662
4669
|
\`replicas automation edit <id> --move-to-org\` turns a personal automation into a shared one the whole team can see. It can't be undone.
|
|
4663
4670
|
|
|
@@ -10586,8 +10593,10 @@ export {
|
|
|
10586
10593
|
DEFAULT_ASTER_MODEL,
|
|
10587
10594
|
ASTER_MODEL_LABELS,
|
|
10588
10595
|
OPENCODE_GO_PROVIDER,
|
|
10596
|
+
OPENCODE_ZEN_PROVIDER,
|
|
10589
10597
|
OPENCODE_GO_BASE_URL,
|
|
10590
10598
|
DEFAULT_OPENCODE_GO_MODEL,
|
|
10599
|
+
isOpenCodeZenModel,
|
|
10591
10600
|
fetchOpenCodeGoCatalog,
|
|
10592
10601
|
getChatKind,
|
|
10593
10602
|
isGitHubUrl,
|
|
@@ -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-22IJF5CU.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord as isRecord2
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
provisionedDeviceSchema,
|
|
23
23
|
readReplicasRuntimeEnv,
|
|
24
24
|
serializePosixEnvFile
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-J5KG7UVX.js";
|
|
26
26
|
|
|
27
27
|
// src/runtime-env-loader.ts
|
|
28
28
|
import { readFileSync } from "fs";
|
|
@@ -10,15 +10,15 @@ import {
|
|
|
10
10
|
resolveDiffBase,
|
|
11
11
|
runGitCommand,
|
|
12
12
|
setAgentCredentialSnapshot
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PM7AZN6N.js";
|
|
14
14
|
import {
|
|
15
15
|
AppServerProcess,
|
|
16
16
|
buildCodexAgentEnv
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-2V3IUQEJ.js";
|
|
18
18
|
import {
|
|
19
19
|
SUBPROCESS_MAX_BUFFER,
|
|
20
20
|
execFileAsync
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-22IJF5CU.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-J5KG7UVX.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-OLAWGNOT.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-OLAWGNOT.js");
|
|
317
317
|
await restartCodexAspHostIfRunning2();
|
|
318
318
|
}
|
|
319
319
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -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-EF54GE6V.js";
|
|
7
|
+
import "./chunk-PM7AZN6N.js";
|
|
8
|
+
import "./chunk-22IJF5CU.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-J5KG7UVX.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -9,16 +9,17 @@ import {
|
|
|
9
9
|
initializeMuse,
|
|
10
10
|
museTurnStartParams,
|
|
11
11
|
opencodeConfig,
|
|
12
|
+
opencodeModelRef,
|
|
12
13
|
opencodeThinkingVariant,
|
|
13
14
|
recoverCompletedTurn,
|
|
14
15
|
spawnMuseMsp,
|
|
15
16
|
startMuseSession
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4F62FSBJ.js";
|
|
17
18
|
import {
|
|
18
19
|
AppServerProcess,
|
|
19
20
|
buildCodexAgentEnv
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-2V3IUQEJ.js";
|
|
22
|
+
import "./chunk-22IJF5CU.js";
|
|
22
23
|
import {
|
|
23
24
|
AGENT,
|
|
24
25
|
OPENCODE_GO_PROVIDER,
|
|
@@ -28,7 +29,7 @@ import {
|
|
|
28
29
|
headlessAgentUsagePath,
|
|
29
30
|
isRecord,
|
|
30
31
|
withTimeout
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-J5KG7UVX.js";
|
|
32
33
|
import "./chunk-VEQXQN22.js";
|
|
33
34
|
|
|
34
35
|
// src/headless-agent.ts
|
|
@@ -175,6 +176,7 @@ async function runCodex(request) {
|
|
|
175
176
|
async function runOpencode(request) {
|
|
176
177
|
const provider = await getOpencodeProvider();
|
|
177
178
|
const model = provider === OPENCODE_GO_PROVIDER ? getOpenCodeGoModel(request.model) : request.model;
|
|
179
|
+
const { providerID, modelID } = opencodeModelRef(provider, model);
|
|
178
180
|
const server = await createOpencodeServer({ port: 0, timeout: 3e4, config: opencodeConfig(provider, model) });
|
|
179
181
|
try {
|
|
180
182
|
const password = process.env.OPENCODE_SERVER_PASSWORD;
|
|
@@ -182,12 +184,12 @@ async function runOpencode(request) {
|
|
|
182
184
|
baseUrl: server.url,
|
|
183
185
|
...password ? { headers: { Authorization: `Basic ${Buffer.from(`opencode:${password}`).toString("base64")}` } } : {}
|
|
184
186
|
});
|
|
185
|
-
const variant = opencodeThinkingVariant((await fetchOpencodeModelVariants(client, request.workingDirectory,
|
|
186
|
-
const session = await client.session.create({ directory: request.workingDirectory, model: { providerID
|
|
187
|
+
const variant = opencodeThinkingVariant((await fetchOpencodeModelVariants(client, request.workingDirectory, providerID)).get(modelID), request.thinkingLevel);
|
|
188
|
+
const session = await client.session.create({ directory: request.workingDirectory, model: { providerID, id: modelID } }, { throwOnError: true });
|
|
187
189
|
const result = await client.session.prompt({
|
|
188
190
|
sessionID: session.data.id,
|
|
189
191
|
directory: request.workingDirectory,
|
|
190
|
-
model: { providerID
|
|
192
|
+
model: { providerID, modelID },
|
|
191
193
|
...variant ? { variant } : {},
|
|
192
194
|
format: { type: "json_schema", schema: request.outputSchema, retryCount: 2 },
|
|
193
195
|
parts: [{ type: "text", text: request.prompt }]
|
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-EF54GE6V.js";
|
|
31
31
|
import {
|
|
32
32
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
33
33
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -59,15 +59,16 @@ import {
|
|
|
59
59
|
initializeMuse,
|
|
60
60
|
museTurnStartParams,
|
|
61
61
|
opencodeConfig,
|
|
62
|
+
opencodeModelRef,
|
|
62
63
|
opencodeThinkingVariant,
|
|
63
64
|
recoverCompletedTurn,
|
|
64
65
|
spawnMuseMsp,
|
|
65
66
|
startMuseSession,
|
|
66
67
|
uuidV7
|
|
67
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-4F62FSBJ.js";
|
|
68
69
|
import {
|
|
69
70
|
publishedPullRequestUrls
|
|
70
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-IU3ZJUGP.js";
|
|
71
72
|
import {
|
|
72
73
|
ACCOUNT_RATE_LIMITS_READ_METHOD,
|
|
73
74
|
AsyncLock,
|
|
@@ -140,7 +141,7 @@ import {
|
|
|
140
141
|
timestampFromSeconds,
|
|
141
142
|
upsertCredentialFileLines,
|
|
142
143
|
writeSecureCredentialFile
|
|
143
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-YPDZYUL7.js";
|
|
144
145
|
import {
|
|
145
146
|
ENGINE_ENV,
|
|
146
147
|
monolithRequest,
|
|
@@ -150,15 +151,15 @@ import {
|
|
|
150
151
|
resolveDiffBase,
|
|
151
152
|
setAgentCredentialSnapshot,
|
|
152
153
|
setLinearSessionId
|
|
153
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-PM7AZN6N.js";
|
|
154
155
|
import {
|
|
155
156
|
getCodexModelProvider
|
|
156
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-2V3IUQEJ.js";
|
|
157
158
|
import {
|
|
158
159
|
SUBPROCESS_MAX_BUFFER,
|
|
159
160
|
execAsync,
|
|
160
161
|
execFileAsync
|
|
161
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-22IJF5CU.js";
|
|
162
163
|
import {
|
|
163
164
|
isRecord as isRecord2
|
|
164
165
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -406,7 +407,7 @@ import {
|
|
|
406
407
|
workspaceTokenRequestSchema,
|
|
407
408
|
workspaceTokenResponseSchema,
|
|
408
409
|
wrapInTag
|
|
409
|
-
} from "./chunk-
|
|
410
|
+
} from "./chunk-J5KG7UVX.js";
|
|
410
411
|
import {
|
|
411
412
|
cloneMcpConfig,
|
|
412
413
|
ensureCompatibilityImports,
|
|
@@ -17036,7 +17037,7 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
17036
17037
|
const configuredModel = providerId === OPENCODE_GO_PROVIDER ? getOpenCodeGoModel(model) : model;
|
|
17037
17038
|
const ollama = providerId === "ollama" ? readOllamaAuthEnv("opencode", process.env) : null;
|
|
17038
17039
|
const compatible = providerId === CREDENTIAL_METHOD.OPENAI_COMPATIBLE ? readOpenAICompatibleAuthEnv("opencode", process.env) : null;
|
|
17039
|
-
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();
|
|
17040
|
+
const providerModels = ollama ? (await listOllamaModels(ollama)).map(({ id }) => id) : compatible ? (await listOpenAICompatibleModels(compatible)).map(({ id }) => id) : providerId === OPENCODE_GO_PROVIDER ? Object.keys((await fetchOpenCodeGoCatalog("opencode")).models) : providerId === ASTER_PROVIDER ? ASTER_MODELS : await getAllowedOpenRouterModels();
|
|
17040
17041
|
if (!providerModels.includes(configuredModel)) {
|
|
17041
17042
|
throw new Error(`Model ${configuredModel} is not available through ${providerId}.`);
|
|
17042
17043
|
}
|
|
@@ -17117,7 +17118,7 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
17117
17118
|
finishUpdate();
|
|
17118
17119
|
}
|
|
17119
17120
|
}
|
|
17120
|
-
async ensureSession(client, model, agent, variant) {
|
|
17121
|
+
async ensureSession(client, providerID, model, agent, variant) {
|
|
17121
17122
|
if (this.sessionId) {
|
|
17122
17123
|
try {
|
|
17123
17124
|
await client.session.get(
|
|
@@ -17132,28 +17133,29 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
17132
17133
|
const result = await client.session.create({
|
|
17133
17134
|
directory: this.workingDirectory,
|
|
17134
17135
|
agent,
|
|
17135
|
-
model: { providerID
|
|
17136
|
+
model: { providerID, id: model, ...variant ? { variant } : {} }
|
|
17136
17137
|
}, { throwOnError: true });
|
|
17137
17138
|
const session = result.data;
|
|
17138
17139
|
this.sessionId = session.id;
|
|
17139
17140
|
await this.onSaveSessionId(session.id);
|
|
17140
17141
|
return session.id;
|
|
17141
17142
|
}
|
|
17142
|
-
async getModelVariants(client, model) {
|
|
17143
|
-
const
|
|
17143
|
+
async getModelVariants(client, providerID, model) {
|
|
17144
|
+
const key = `${providerID}/${model}`;
|
|
17145
|
+
const cached = this.modelVariants.get(key);
|
|
17144
17146
|
if (cached) return cached;
|
|
17145
17147
|
try {
|
|
17146
|
-
for (const [id, variants] of await fetchOpencodeModelVariants(client, this.workingDirectory,
|
|
17147
|
-
this.modelVariants.set(id
|
|
17148
|
+
for (const [id, variants] of await fetchOpencodeModelVariants(client, this.workingDirectory, providerID)) {
|
|
17149
|
+
this.modelVariants.set(`${providerID}/${id}`, variants);
|
|
17148
17150
|
}
|
|
17149
17151
|
} catch {
|
|
17150
|
-
this.modelVariants.set(
|
|
17152
|
+
this.modelVariants.set(key, /* @__PURE__ */ new Set());
|
|
17151
17153
|
}
|
|
17152
|
-
return this.modelVariants.get(
|
|
17154
|
+
return this.modelVariants.get(key) ?? /* @__PURE__ */ new Set();
|
|
17153
17155
|
}
|
|
17154
|
-
async getThinkingVariant(client, model, thinkingLevel) {
|
|
17156
|
+
async getThinkingVariant(client, providerID, model, thinkingLevel) {
|
|
17155
17157
|
if (!thinkingLevel) return void 0;
|
|
17156
|
-
return opencodeThinkingVariant(await this.getModelVariants(client, model), thinkingLevel);
|
|
17158
|
+
return opencodeThinkingVariant(await this.getModelVariants(client, providerID, model), thinkingLevel);
|
|
17157
17159
|
}
|
|
17158
17160
|
async processMessageInternal(request) {
|
|
17159
17161
|
const provider = await getOpencodeProvider();
|
|
@@ -17166,17 +17168,17 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
17166
17168
|
try {
|
|
17167
17169
|
const model = request.model ?? await getDefaultOpencodeModel(provider);
|
|
17168
17170
|
const client = await this.ensureClient(model, provider);
|
|
17169
|
-
const
|
|
17171
|
+
const { providerID, modelID } = opencodeModelRef(this.providerId, model);
|
|
17170
17172
|
const agent = request.planMode ? "plan" : "build";
|
|
17171
|
-
const variant = await this.getThinkingVariant(client,
|
|
17172
|
-
const sessionId = await this.ensureSession(client,
|
|
17173
|
+
const variant = await this.getThinkingVariant(client, providerID, modelID, request.thinkingLevel);
|
|
17174
|
+
const sessionId = await this.ensureSession(client, providerID, modelID, agent, variant);
|
|
17173
17175
|
const system = this.buildCombinedInstructions(request.customInstructions);
|
|
17174
17176
|
this.recordUserMessageHistoryEvent(request, this.historyFile);
|
|
17175
17177
|
const result = await client.session.prompt({
|
|
17176
17178
|
sessionID: sessionId,
|
|
17177
17179
|
directory: this.workingDirectory,
|
|
17178
17180
|
agent,
|
|
17179
|
-
model: { providerID
|
|
17181
|
+
model: { providerID, modelID },
|
|
17180
17182
|
...variant ? { variant } : {},
|
|
17181
17183
|
...system ? { system } : {},
|
|
17182
17184
|
...this.subagentMcpParentChatId() ? { tools: { task: false } } : {},
|
|
@@ -17203,8 +17205,8 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
17203
17205
|
}
|
|
17204
17206
|
async subscribeToEvents(client, controller) {
|
|
17205
17207
|
let streamError;
|
|
17206
|
-
const result = await client.
|
|
17207
|
-
{
|
|
17208
|
+
const result = await client.event.subscribe(
|
|
17209
|
+
{ directory: this.workingDirectory },
|
|
17208
17210
|
{
|
|
17209
17211
|
signal: controller.signal,
|
|
17210
17212
|
sseMaxRetryAttempts: 1,
|
|
@@ -17225,6 +17227,7 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
17225
17227
|
if (!controller.signal.aborted && streamError) throw streamError;
|
|
17226
17228
|
}
|
|
17227
17229
|
recordOpencodeEvent(event) {
|
|
17230
|
+
if (!/^(session|message)\./.test(event.type)) return;
|
|
17228
17231
|
const payload = opencodeEventPayload(event);
|
|
17229
17232
|
if (!payload) return;
|
|
17230
17233
|
const sessionID = typeof payload.sessionID === "string" ? payload.sessionID : void 0;
|
|
@@ -58088,7 +58091,7 @@ var PiManager = class extends CodingAgentManager {
|
|
|
58088
58091
|
}))
|
|
58089
58092
|
});
|
|
58090
58093
|
} else if (this.providerId === OPENCODE_GO_PROVIDER) {
|
|
58091
|
-
const catalog = await fetchOpenCodeGoCatalog([request.model ?? DEFAULT_OPENCODE_GO_MODEL]);
|
|
58094
|
+
const catalog = await fetchOpenCodeGoCatalog("pi", [request.model ?? DEFAULT_OPENCODE_GO_MODEL]);
|
|
58092
58095
|
const models = Object.entries(catalog.models);
|
|
58093
58096
|
defaultModel = catalog.models[DEFAULT_OPENCODE_GO_MODEL] ? DEFAULT_OPENCODE_GO_MODEL : models[0]?.[0] ?? DEFAULT_OPENCODE_GO_MODEL;
|
|
58094
58097
|
registerPiProvider(modelRegistry, {
|
|
@@ -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-IU3ZJUGP.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-J5KG7UVX.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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "replicas-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1280",
|
|
4
4
|
"description": "Lightweight API server for Replicas workspaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"@earendil-works/pi-server": "0.85.0",
|
|
50
50
|
"@hono/node-server": "^1.19.5",
|
|
51
51
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
52
|
-
"@opencode-ai/sdk": "1.
|
|
52
|
+
"@opencode-ai/sdk": "1.19.4",
|
|
53
53
|
"bash-language-server": "^5.6.0",
|
|
54
54
|
"dockerfile-language-server-nodejs": "^0.14.1",
|
|
55
55
|
"hono": "^4.10.3",
|
|
56
|
-
"opencode-ai": "1.
|
|
56
|
+
"opencode-ai": "1.19.4",
|
|
57
57
|
"pi-mcp-adapter": "2.32.1",
|
|
58
58
|
"pyright": "^1.1.413",
|
|
59
59
|
"typescript": "^5.9.3",
|