replicas-engine 0.1.1189 → 0.1.1191
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-IY4BPGYV.js → asp-host-XOH4VZ54.js} +5 -5
- package/dist/src/{chunk-TUZLVYYH.js → chunk-2U32TFQX.js} +2 -2
- package/dist/src/{chunk-W5ERK2HR.js → chunk-3PVMBGPZ.js} +4 -4
- package/dist/src/{chunk-NRFMMDOT.js → chunk-4OY2UIEC.js} +10 -8
- package/dist/src/{chunk-VXPWAQR2.js → chunk-6GGRJKT4.js} +2 -2
- package/dist/src/{chunk-R6I3LT27.js → chunk-IXT5Q2OM.js} +1 -1
- package/dist/src/{chunk-NIT22CZW.js → chunk-TX3C2WLH.js} +1 -1
- package/dist/src/{chunk-QPVTETVI.js → chunk-VPJCBNAX.js} +3 -3
- package/dist/src/{chunk-4T2K6OBK.js → chunk-XCLNV3EB.js} +6 -0
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +4 -4
- package/dist/src/index.js +42 -16
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
- package/workspace-sdk/index.js +1 -0
|
@@ -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-4OY2UIEC.js";
|
|
12
|
+
import "./chunk-6GGRJKT4.js";
|
|
13
|
+
import "./chunk-VPJCBNAX.js";
|
|
14
|
+
import "./chunk-IXT5Q2OM.js";
|
|
15
15
|
import "./chunk-UZSNFLDQ.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-XCLNV3EB.js";
|
|
17
17
|
import "./chunk-VEQXQN22.js";
|
|
18
18
|
export {
|
|
19
19
|
CODEX_ULTRAFAST_SERVICE_TIER,
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
getOriginDefaultBranch,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
runGitCommand
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6GGRJKT4.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-XCLNV3EB.js";
|
|
16
16
|
|
|
17
17
|
// src/services/command-protection-service.ts
|
|
18
18
|
import { readFile, stat } from "fs/promises";
|
|
@@ -3,7 +3,7 @@ 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-VPJCBNAX.js";
|
|
7
7
|
import {
|
|
8
8
|
ASTER_BASE_URL,
|
|
9
9
|
ASTER_PROVIDER,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
codexReasoningEffortForThinkingLevel,
|
|
12
12
|
isRecord,
|
|
13
13
|
readOllamaAuthEnv
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XCLNV3EB.js";
|
|
15
15
|
|
|
16
16
|
// src/managers/codex-asp/notification-dispatch.ts
|
|
17
17
|
var TURN_STARTED_METHOD = "turn/started";
|
|
@@ -172,10 +172,10 @@ function uuidV7() {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
// src/managers/muse-msp.ts
|
|
175
|
-
function spawnMuseMsp(workingDirectory) {
|
|
175
|
+
function spawnMuseMsp(workingDirectory, env) {
|
|
176
176
|
const child = spawn("muse", ["serve", "--disable-sandbox", "--trust-workspace"], {
|
|
177
177
|
cwd: workingDirectory,
|
|
178
|
-
env: { ...process.env, MUSE_NO_AUTO_UPDATE: "1", NO_COLOR: "1" },
|
|
178
|
+
env: { ...process.env, MUSE_NO_AUTO_UPDATE: "1", NO_COLOR: "1", ...env },
|
|
179
179
|
stdio: ["pipe", "pipe", "pipe"]
|
|
180
180
|
});
|
|
181
181
|
return { child, client: new AspClient({ stdin: child.stdin, stdout: child.stdout, jsonRpcVersion: "2.0" }) };
|
|
@@ -10,15 +10,15 @@ import {
|
|
|
10
10
|
resolveDiffBase,
|
|
11
11
|
runGitCommand,
|
|
12
12
|
setAgentCredentialSnapshot
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6GGRJKT4.js";
|
|
14
14
|
import {
|
|
15
15
|
AppServerProcess,
|
|
16
16
|
buildCodexAgentEnv
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VPJCBNAX.js";
|
|
18
18
|
import {
|
|
19
19
|
SUBPROCESS_MAX_BUFFER,
|
|
20
20
|
execFileAsync
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-IXT5Q2OM.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-XCLNV3EB.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-XOH4VZ54.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-XOH4VZ54.js");
|
|
317
317
|
await restartCodexAspHostIfRunning2();
|
|
318
318
|
}
|
|
319
319
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -1773,7 +1773,7 @@ function turnsToAspTranscript(threadId, updatedAt, sourceTurns) {
|
|
|
1773
1773
|
});
|
|
1774
1774
|
return { threadId, updatedAt, turns };
|
|
1775
1775
|
}
|
|
1776
|
-
async function buildThreadStartParams(workingDirectory, request, developerInstructions, serviceTier, subagentMcpParentChatId, autoCompactTokens = null) {
|
|
1776
|
+
async function buildThreadStartParams(workingDirectory, request, developerInstructions, serviceTier, subagentMcpParentChatId, autoCompactTokens = null, originChatId) {
|
|
1777
1777
|
const additionalDirectories = await getAgentAdditionalDirectories();
|
|
1778
1778
|
return {
|
|
1779
1779
|
model: request.model ?? DEFAULT_MODEL,
|
|
@@ -1787,6 +1787,7 @@ async function buildThreadStartParams(workingDirectory, request, developerInstru
|
|
|
1787
1787
|
web_search: ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD === "ollama" ? "disabled" : "live",
|
|
1788
1788
|
model_reasoning_summary: "auto",
|
|
1789
1789
|
...autoCompactTokens ? { model_auto_compact_token_limit: autoCompactTokens } : {},
|
|
1790
|
+
...originChatId ? { "shell_environment_policy.set.REPLICAS_CHAT_ID": originChatId } : {},
|
|
1790
1791
|
...subagentMcpParentChatId ? {
|
|
1791
1792
|
// Codex gates its native collaboration tools on `agents.enabled`; `features.multi_agent` is now a no-op.
|
|
1792
1793
|
"agents.enabled": false,
|
|
@@ -1796,7 +1797,7 @@ async function buildThreadStartParams(workingDirectory, request, developerInstru
|
|
|
1796
1797
|
experimentalRawEvents: false
|
|
1797
1798
|
};
|
|
1798
1799
|
}
|
|
1799
|
-
async function buildThreadResumeParams(workingDirectory, threadId, request, developerInstructions, serviceTier, subagentMcpParentChatId, autoCompactTokens = null) {
|
|
1800
|
+
async function buildThreadResumeParams(workingDirectory, threadId, request, developerInstructions, serviceTier, subagentMcpParentChatId, autoCompactTokens = null, originChatId) {
|
|
1800
1801
|
const additionalDirectories = await getAgentAdditionalDirectories();
|
|
1801
1802
|
return {
|
|
1802
1803
|
threadId,
|
|
@@ -1811,6 +1812,7 @@ async function buildThreadResumeParams(workingDirectory, threadId, request, deve
|
|
|
1811
1812
|
web_search: ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD === "ollama" ? "disabled" : "live",
|
|
1812
1813
|
model_reasoning_summary: "auto",
|
|
1813
1814
|
...autoCompactTokens ? { model_auto_compact_token_limit: autoCompactTokens } : {},
|
|
1815
|
+
...originChatId ? { "shell_environment_policy.set.REPLICAS_CHAT_ID": originChatId } : {},
|
|
1814
1816
|
...subagentMcpParentChatId ? {
|
|
1815
1817
|
// Codex gates its native collaboration tools on `agents.enabled`; `features.multi_agent` is now a no-op.
|
|
1816
1818
|
"agents.enabled": false,
|
|
@@ -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-IXT5Q2OM.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-XCLNV3EB.js";
|
|
22
22
|
|
|
23
23
|
// src/runtime-env-loader.ts
|
|
24
24
|
import { readFileSync } from "fs";
|
|
@@ -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-XCLNV3EB.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-IXT5Q2OM.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XCLNV3EB.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.1191";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -93,6 +93,9 @@ var THINKING_LEVELS_BY_AGENT = {
|
|
|
93
93
|
opencode: STANDARD_THINKING_LEVELS,
|
|
94
94
|
pi: STANDARD_THINKING_LEVELS
|
|
95
95
|
};
|
|
96
|
+
function isValidThinkingLevel(value) {
|
|
97
|
+
return VALID_THINKING_LEVELS.some((l) => l === value);
|
|
98
|
+
}
|
|
96
99
|
var CODEX_REASONING_EFFORT_BY_THINKING_LEVEL = {
|
|
97
100
|
low: "low",
|
|
98
101
|
medium: "medium",
|
|
@@ -1575,6 +1578,7 @@ var sendChatMessageRequestSchema = z4.object({
|
|
|
1575
1578
|
})).optional(),
|
|
1576
1579
|
canvasUploadIds: z4.array(z4.string().min(1)).optional(),
|
|
1577
1580
|
thinkingLevel: z4.enum(VALID_THINKING_LEVELS).optional(),
|
|
1581
|
+
inheritThinkingLevel: z4.boolean().optional(),
|
|
1578
1582
|
goalMode: z4.boolean().optional(),
|
|
1579
1583
|
fastMode: z4.boolean().optional(),
|
|
1580
1584
|
ultrafastMode: z4.boolean().optional(),
|
|
@@ -5391,6 +5395,7 @@ If \`@replicas/sdk\` cannot be imported, use the gateway with workspace authenti
|
|
|
5391
5395
|
curl -sS --fail-with-body -X POST "\${REPLICAS_MONOLITH_URL:-$MONOLITH_URL}/v1/engine/slack/api" \\
|
|
5392
5396
|
-H "Authorization: Bearer $REPLICAS_ENGINE_SECRET" \\
|
|
5393
5397
|
-H "X-Workspace-Id: \${REPLICAS_WORKSPACE_ID:-$WORKSPACE_ID}" \\
|
|
5398
|
+
-H "X-Replicas-Chat-Id: \${REPLICAS_CHAT_ID:-}" \\
|
|
5394
5399
|
-H "Content-Type: application/json" \\
|
|
5395
5400
|
--data-binary @-
|
|
5396
5401
|
\`\`\`
|
|
@@ -9913,6 +9918,7 @@ export {
|
|
|
9913
9918
|
AGENT,
|
|
9914
9919
|
SUBAGENT_MCP_HARNESSES,
|
|
9915
9920
|
isValidAgentProvider,
|
|
9921
|
+
isValidThinkingLevel,
|
|
9916
9922
|
codexReasoningEffortForThinkingLevel,
|
|
9917
9923
|
getProviderDisplayName,
|
|
9918
9924
|
detectAgentQuotaLimit,
|
|
@@ -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-2U32TFQX.js";
|
|
7
|
+
import "./chunk-6GGRJKT4.js";
|
|
8
|
+
import "./chunk-IXT5Q2OM.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-XCLNV3EB.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-3PVMBGPZ.js";
|
|
17
17
|
import {
|
|
18
18
|
AppServerProcess,
|
|
19
19
|
buildCodexAgentEnv
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-VPJCBNAX.js";
|
|
21
|
+
import "./chunk-IXT5Q2OM.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-XCLNV3EB.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-2U32TFQX.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-3PVMBGPZ.js";
|
|
68
68
|
import {
|
|
69
69
|
publishedPullRequestUrls
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-TX3C2WLH.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-4OY2UIEC.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-6GGRJKT4.js";
|
|
152
152
|
import {
|
|
153
153
|
getCodexModelProvider
|
|
154
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-VPJCBNAX.js";
|
|
155
155
|
import {
|
|
156
156
|
SUBPROCESS_MAX_BUFFER,
|
|
157
157
|
execAsync,
|
|
158
158
|
execFileAsync
|
|
159
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-IXT5Q2OM.js";
|
|
160
160
|
import {
|
|
161
161
|
isRecord as isRecord2
|
|
162
162
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -332,6 +332,7 @@ import {
|
|
|
332
332
|
isTransientErrorText,
|
|
333
333
|
isValidAgentProvider,
|
|
334
334
|
isValidEngineLogSessionId,
|
|
335
|
+
isValidThinkingLevel,
|
|
335
336
|
lastUserBlockText,
|
|
336
337
|
learnedSkillFormatInstruction,
|
|
337
338
|
learnedSkillsManifestSchema,
|
|
@@ -383,7 +384,7 @@ import {
|
|
|
383
384
|
workspaceTokenRequestSchema,
|
|
384
385
|
workspaceTokenResponseSchema,
|
|
385
386
|
wrapInTag
|
|
386
|
-
} from "./chunk-
|
|
387
|
+
} from "./chunk-XCLNV3EB.js";
|
|
387
388
|
import {
|
|
388
389
|
cloneMcpConfig,
|
|
389
390
|
ensureCompatibilityImports,
|
|
@@ -11405,6 +11406,7 @@ var CodingAgentManager = class {
|
|
|
11405
11406
|
onUsageUpdate;
|
|
11406
11407
|
linearSessionId;
|
|
11407
11408
|
chatId;
|
|
11409
|
+
originChatId;
|
|
11408
11410
|
hostOnTurnComplete;
|
|
11409
11411
|
onProcessingChanged;
|
|
11410
11412
|
onMessageStarted;
|
|
@@ -11436,6 +11438,7 @@ var CodingAgentManager = class {
|
|
|
11436
11438
|
this.usesAutoCompactTokens = options.provider === "claude" || options.provider === "codex";
|
|
11437
11439
|
this.linearSessionId = options.linearSessionId;
|
|
11438
11440
|
this.chatId = options.chatId;
|
|
11441
|
+
this.originChatId = options.originChatId;
|
|
11439
11442
|
this.hostOnTurnComplete = options.onTurnComplete;
|
|
11440
11443
|
this.onProcessingChanged = options.onProcessingChanged ?? (() => {
|
|
11441
11444
|
});
|
|
@@ -13389,7 +13392,10 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13389
13392
|
}
|
|
13390
13393
|
/** Query inputs shared by real sessions and slash-command discovery. */
|
|
13391
13394
|
async buildSharedQueryOptions() {
|
|
13392
|
-
const env = buildClaudeAgentEnv(
|
|
13395
|
+
const env = buildClaudeAgentEnv({
|
|
13396
|
+
...this.subagentMcpParentChatId() && { CLAUDE_CODE_STREAM_CLOSE_TIMEOUT: "900000" },
|
|
13397
|
+
...this.originChatId && { REPLICAS_CHAT_ID: this.originChatId }
|
|
13398
|
+
});
|
|
13393
13399
|
const additionalDirectories = await getAgentAdditionalDirectories();
|
|
13394
13400
|
let plugins = [];
|
|
13395
13401
|
let enableAllSkills = false;
|
|
@@ -14575,7 +14581,7 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
14575
14581
|
const previous = coldResume ? await host.client.request(THREAD_READ_METHOD, { threadId: existingThreadId, includeTurns: true }).catch(() => null) : null;
|
|
14576
14582
|
const response = previous?.thread.modelProvider && previous.thread.modelProvider !== getCodexModelProvider(ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD) ? await this.continueWithNewProvider(host, previous.thread, request, developerInstructions, serviceTier2) : await host.client.request(
|
|
14577
14583
|
THREAD_RESUME_METHOD,
|
|
14578
|
-
await buildThreadResumeParams(this.workingDirectory, existingThreadId, request, developerInstructions, serviceTier2, subagentMcpParentChatId, this.autoCompactTokens)
|
|
14584
|
+
await buildThreadResumeParams(this.workingDirectory, existingThreadId, request, developerInstructions, serviceTier2, subagentMcpParentChatId, this.autoCompactTokens, this.originChatId)
|
|
14579
14585
|
);
|
|
14580
14586
|
this.currentThreadId = response.thread.id;
|
|
14581
14587
|
this.activeServiceTier = response.serviceTier;
|
|
@@ -14596,7 +14602,7 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
14596
14602
|
const serviceTier = await this.resolveRequestedServiceTier(host, request);
|
|
14597
14603
|
const threadStartResponse = await host.client.request(
|
|
14598
14604
|
THREAD_START_METHOD,
|
|
14599
|
-
await buildThreadStartParams(this.workingDirectory, request, developerInstructions, serviceTier, subagentMcpParentChatId, this.autoCompactTokens)
|
|
14605
|
+
await buildThreadStartParams(this.workingDirectory, request, developerInstructions, serviceTier, subagentMcpParentChatId, this.autoCompactTokens, this.originChatId)
|
|
14600
14606
|
);
|
|
14601
14607
|
const threadId = threadStartResponse.thread.id;
|
|
14602
14608
|
this.currentThreadId = threadId;
|
|
@@ -14618,7 +14624,7 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
14618
14624
|
await writeFile4(transcriptPath, text, "utf8");
|
|
14619
14625
|
const response = await host.client.request(
|
|
14620
14626
|
THREAD_START_METHOD,
|
|
14621
|
-
await buildThreadStartParams(this.workingDirectory, request, developerInstructions, serviceTier, this.subagentMcpParentChatId(), this.autoCompactTokens)
|
|
14627
|
+
await buildThreadStartParams(this.workingDirectory, request, developerInstructions, serviceTier, this.subagentMcpParentChatId(), this.autoCompactTokens, this.originChatId)
|
|
14622
14628
|
);
|
|
14623
14629
|
await host.client.request(THREAD_INJECT_ITEMS_METHOD, {
|
|
14624
14630
|
threadId: response.thread.id,
|
|
@@ -15868,7 +15874,7 @@ var MuseManager = class extends CodingAgentManager {
|
|
|
15868
15874
|
}
|
|
15869
15875
|
async start(model) {
|
|
15870
15876
|
if (this.process) return;
|
|
15871
|
-
const { child, client } = spawnMuseMsp(this.workingDirectory);
|
|
15877
|
+
const { child, client } = spawnMuseMsp(this.workingDirectory, this.originChatId ? { REPLICAS_CHAT_ID: this.originChatId } : void 0);
|
|
15872
15878
|
this.process = child;
|
|
15873
15879
|
this.client = client;
|
|
15874
15880
|
client.on("notification", (notification) => this.handleNotification(notification));
|
|
@@ -16613,11 +16619,14 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
16613
16619
|
}
|
|
16614
16620
|
};
|
|
16615
16621
|
}
|
|
16616
|
-
|
|
16622
|
+
if (this.originChatId) process.env.REPLICAS_CHAT_ID = this.originChatId;
|
|
16623
|
+
const serverStart = createOpencodeServer({
|
|
16617
16624
|
port: 0,
|
|
16618
16625
|
timeout: OPENCODE_SERVER_STARTUP_TIMEOUT_MS,
|
|
16619
16626
|
config
|
|
16620
16627
|
});
|
|
16628
|
+
delete process.env.REPLICAS_CHAT_ID;
|
|
16629
|
+
const server3 = await serverStart;
|
|
16621
16630
|
const client = createOpencodeClient({
|
|
16622
16631
|
baseUrl: server3.url,
|
|
16623
16632
|
fetch: opencodeFetch,
|
|
@@ -59476,6 +59485,7 @@ function normalizePersistedChat(chat) {
|
|
|
59476
59485
|
id: chat.id,
|
|
59477
59486
|
provider: chat.provider,
|
|
59478
59487
|
...typeof chat.model === "string" && chat.model ? { model: chat.model } : {},
|
|
59488
|
+
...isValidThinkingLevel(chat.thinkingLevel) ? { thinkingLevel: chat.thinkingLevel } : {},
|
|
59479
59489
|
title: chat.title,
|
|
59480
59490
|
...chat.displayName ? { displayName: chat.displayName } : {},
|
|
59481
59491
|
createdAt: chat.createdAt,
|
|
@@ -59770,7 +59780,11 @@ var ChatService = class {
|
|
|
59770
59780
|
};
|
|
59771
59781
|
}
|
|
59772
59782
|
const savedModel = chat.persisted.model ?? (!request.model ? extractLatestContextUsage((await chat.provider.getHistory()).events, chat.persisted.provider)?.model : void 0);
|
|
59773
|
-
request = {
|
|
59783
|
+
request = {
|
|
59784
|
+
...request,
|
|
59785
|
+
model: request.model ?? savedModel ?? void 0,
|
|
59786
|
+
thinkingLevel: request.thinkingLevel ?? (request.inheritThinkingLevel ? chat.persisted.thinkingLevel : void 0)
|
|
59787
|
+
};
|
|
59774
59788
|
return await chat.provider.enqueueMessage(
|
|
59775
59789
|
request,
|
|
59776
59790
|
(result, acceptedMessage) => this.handleMessageAccepted(
|
|
@@ -59819,6 +59833,7 @@ var ChatService = class {
|
|
|
59819
59833
|
const previousPersistedResponses = chat.persisted.acceptedSendResponses;
|
|
59820
59834
|
const previousLastMessageText = chat.persisted.lastMessageText;
|
|
59821
59835
|
const previousModel = chat.persisted.model;
|
|
59836
|
+
const previousThinkingLevel = chat.persisted.thinkingLevel;
|
|
59822
59837
|
const previousUpdatedAt = chat.persisted.updatedAt;
|
|
59823
59838
|
const previousFork = chat.persisted.fork;
|
|
59824
59839
|
const previousPendingForkHandoff = chat.persisted.pendingForkHandoff;
|
|
@@ -59839,6 +59854,7 @@ var ChatService = class {
|
|
|
59839
59854
|
}
|
|
59840
59855
|
chat.persisted.lastMessageText = typedMessage.trim().slice(0, LAST_MESSAGE_PREVIEW_MAX) || null;
|
|
59841
59856
|
chat.persisted.model = acceptedMessage.model ?? previousModel;
|
|
59857
|
+
chat.persisted.thinkingLevel = acceptedMessage.thinkingLevel;
|
|
59842
59858
|
chat.persisted.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
59843
59859
|
if (chat.persisted.pendingForkHandoff && chat.persisted.fork) {
|
|
59844
59860
|
chat.persisted.pendingForkHandoff = false;
|
|
@@ -59857,6 +59873,7 @@ var ChatService = class {
|
|
|
59857
59873
|
chat.persisted.acceptedSendResponses = previousPersistedResponses;
|
|
59858
59874
|
chat.persisted.lastMessageText = previousLastMessageText;
|
|
59859
59875
|
chat.persisted.model = previousModel;
|
|
59876
|
+
chat.persisted.thinkingLevel = previousThinkingLevel;
|
|
59860
59877
|
chat.persisted.updatedAt = previousUpdatedAt;
|
|
59861
59878
|
chat.persisted.fork = previousFork;
|
|
59862
59879
|
chat.persisted.pendingForkHandoff = previousPendingForkHandoff;
|
|
@@ -59891,7 +59908,7 @@ var ChatService = class {
|
|
|
59891
59908
|
}).catch((error) => {
|
|
59892
59909
|
console.error("[ChatService] Failed to publish accepted turn:", { chatId, messageId: result.messageId, error });
|
|
59893
59910
|
});
|
|
59894
|
-
if (chat.persisted.model !== previousModel || previousPendingForkHandoff) {
|
|
59911
|
+
if (chat.persisted.model !== previousModel || chat.persisted.thinkingLevel !== previousThinkingLevel || previousPendingForkHandoff) {
|
|
59895
59912
|
await this.publish({ type: "chat.updated", payload: { chat: this.toSummary(chat) } }).catch((error) => {
|
|
59896
59913
|
console.error("[ChatService] Failed to publish accepted chat update:", { chatId, error });
|
|
59897
59914
|
});
|
|
@@ -60511,6 +60528,13 @@ var ChatService = class {
|
|
|
60511
60528
|
if (persisted.parentChatId === void 0) {
|
|
60512
60529
|
persisted.parentChatId = null;
|
|
60513
60530
|
}
|
|
60531
|
+
let originChatId = persisted.id;
|
|
60532
|
+
for (let chat = persisted; chat; ) {
|
|
60533
|
+
const next = chat.parentChatId ?? chat.fork?.source.chatId;
|
|
60534
|
+
if (!next) break;
|
|
60535
|
+
originChatId = next;
|
|
60536
|
+
chat = this.chats.get(next)?.persisted;
|
|
60537
|
+
}
|
|
60514
60538
|
const baseProvider = persisted.provider;
|
|
60515
60539
|
const historyFilePath = join28(HISTORY_DIR_BY_PROVIDER[persisted.provider], `${persisted.id}.jsonl`);
|
|
60516
60540
|
const managerOptions = {
|
|
@@ -60527,6 +60551,7 @@ var ChatService = class {
|
|
|
60527
60551
|
onUsageUpdate: onProviderUsage,
|
|
60528
60552
|
fallbackContext,
|
|
60529
60553
|
chatId: persisted.id,
|
|
60554
|
+
originChatId,
|
|
60530
60555
|
onModelSwitched,
|
|
60531
60556
|
onChatCredential,
|
|
60532
60557
|
lastSenderKey: persisted.lastSenderKey,
|
|
@@ -60594,6 +60619,7 @@ var ChatService = class {
|
|
|
60594
60619
|
id: chat.persisted.id,
|
|
60595
60620
|
provider: chat.persisted.provider,
|
|
60596
60621
|
model: chat.persisted.model,
|
|
60622
|
+
thinkingLevel: chat.persisted.thinkingLevel,
|
|
60597
60623
|
title: chat.persisted.title,
|
|
60598
60624
|
displayName: chat.persisted.displayName,
|
|
60599
60625
|
createdAt: chat.persisted.createdAt,
|
|
@@ -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-TX3C2WLH.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-XCLNV3EB.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
package/workspace-sdk/index.js
CHANGED
|
@@ -22,6 +22,7 @@ async function requestResponse(path, options = {}) {
|
|
|
22
22
|
const headers = new Headers(options.headers);
|
|
23
23
|
headers.set('Authorization', `Bearer ${engineSecret}`);
|
|
24
24
|
headers.set('X-Workspace-Id', workspaceId);
|
|
25
|
+
if (process.env.REPLICAS_CHAT_ID) headers.set('X-Replicas-Chat-Id', process.env.REPLICAS_CHAT_ID);
|
|
25
26
|
if (options.body !== undefined) headers.set('Content-Type', 'application/json');
|
|
26
27
|
const response = await fetch(`${monolithUrl}${path}`, {
|
|
27
28
|
...options,
|