replicas-engine 0.1.1020 → 0.1.1022
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-5WGJNLEZ.js → asp-host-QDG4NGFE.js} +5 -5
- package/dist/src/{chunk-77TEQCW5.js → chunk-3PGSQAYB.js} +3 -3
- package/dist/src/{chunk-UCM46K5V.js → chunk-3VEV6OKT.js} +6 -6
- package/dist/src/{chunk-QHQGQJCB.js → chunk-7OCJPQZ4.js} +1 -1
- package/dist/src/{chunk-HCVB7XLV.js → chunk-FB2CARXP.js} +1 -1
- package/dist/src/{chunk-WJGY4JE2.js → chunk-K64GTMH6.js} +1 -1
- package/dist/src/{chunk-Y7NT47YP.js → chunk-XR5FZAUG.js} +3 -3
- package/dist/src/{chunk-B5WGCH5R.js → chunk-ZXU7SQP3.js} +45 -22
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +3 -3
- package/dist/src/index.js +57 -11
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +2 -2
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
getCodexAspHost,
|
|
6
6
|
restartCodexAspHost,
|
|
7
7
|
restartCodexAspHostIfRunning
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-3VEV6OKT.js";
|
|
9
|
+
import "./chunk-K64GTMH6.js";
|
|
10
|
+
import "./chunk-XR5FZAUG.js";
|
|
11
|
+
import "./chunk-FB2CARXP.js";
|
|
12
12
|
import "./chunk-UZSNFLDQ.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-ZXU7SQP3.js";
|
|
14
14
|
import "./chunk-VEQXQN22.js";
|
|
15
15
|
export {
|
|
16
16
|
getCodexAspHost,
|
|
@@ -3,18 +3,18 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
monolithRequest
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-K64GTMH6.js";
|
|
7
7
|
import {
|
|
8
8
|
SUBPROCESS_MAX_BUFFER,
|
|
9
9
|
execFileAsync
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FB2CARXP.js";
|
|
11
11
|
import {
|
|
12
12
|
extractCommandProtectionCommandText,
|
|
13
13
|
findCommandProtectionGitLookups,
|
|
14
14
|
findGitCommitSignals,
|
|
15
15
|
findPrMergeSignals,
|
|
16
16
|
parseCommandProtectionRequest
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ZXU7SQP3.js";
|
|
18
18
|
|
|
19
19
|
// src/services/command-protection-service.ts
|
|
20
20
|
import { readFile, stat } from "fs/promises";
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
ENGINE_ENV,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
setAgentCredentialSnapshot
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-K64GTMH6.js";
|
|
9
9
|
import {
|
|
10
10
|
AppServerProcess,
|
|
11
11
|
buildCodexAgentEnv
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XR5FZAUG.js";
|
|
13
13
|
import {
|
|
14
14
|
SUBPROCESS_MAX_BUFFER,
|
|
15
15
|
execFileAsync
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FB2CARXP.js";
|
|
17
17
|
import {
|
|
18
18
|
isRecord
|
|
19
19
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
listOpenAICompatibleModels,
|
|
29
29
|
readOllamaAuthEnv,
|
|
30
30
|
resolveOpenAICompatibleModelsUrl
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-ZXU7SQP3.js";
|
|
32
32
|
|
|
33
33
|
// src/managers/codex-token-manager.ts
|
|
34
34
|
import { promises as fs } from "fs";
|
|
@@ -264,7 +264,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
264
264
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
265
265
|
await this.applyCredentialsResponse(data);
|
|
266
266
|
setAgentCredentialSnapshot("codex", data);
|
|
267
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
267
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QDG4NGFE.js");
|
|
268
268
|
await restartCodexAspHostIfRunning2();
|
|
269
269
|
});
|
|
270
270
|
await this.start(true);
|
|
@@ -285,7 +285,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
285
285
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
286
286
|
await this.applyCredentialsResponse(data);
|
|
287
287
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
288
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
288
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QDG4NGFE.js");
|
|
289
289
|
await restartCodexAspHostIfRunning2();
|
|
290
290
|
}
|
|
291
291
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -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-ZXU7SQP3.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-FB2CARXP.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZXU7SQP3.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.1022";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -196,6 +196,7 @@ var CLAUDE_OPUS_5_MODEL = "claude-opus-5";
|
|
|
196
196
|
var CLAUDE_OPUS_4_8_MODEL = "claude-opus-4-8";
|
|
197
197
|
var CLAUDE_SONNET_5_5_MODEL = "claude-sonnet-5-5";
|
|
198
198
|
var CLAUDE_SONNET_5_MODEL = "claude-sonnet-5";
|
|
199
|
+
var CLAUDE_HAIKU_5_5_MODEL = "claude-haiku-5-5";
|
|
199
200
|
var CLAUDE_HAIKU_4_5_MODEL = "claude-haiku-4-5";
|
|
200
201
|
var CLAUDE_FABLE_5_1_BEDROCK_MODEL = "anthropic.claude-fable-5-1";
|
|
201
202
|
var CLAUDE_FABLE_5_BEDROCK_MODEL = "anthropic.claude-fable-5";
|
|
@@ -204,6 +205,7 @@ var CLAUDE_OPUS_5_BEDROCK_MODEL = "anthropic.claude-opus-5";
|
|
|
204
205
|
var CLAUDE_OPUS_4_8_BEDROCK_MODEL = "us.anthropic.claude-opus-4-8";
|
|
205
206
|
var CLAUDE_SONNET_5_5_BEDROCK_MODEL = "anthropic.claude-sonnet-5-5";
|
|
206
207
|
var CLAUDE_SONNET_5_BEDROCK_MODEL = "anthropic.claude-sonnet-5";
|
|
208
|
+
var CLAUDE_HAIKU_5_5_BEDROCK_MODEL = "anthropic.claude-haiku-5-5";
|
|
207
209
|
var CLAUDE_HAIKU_4_5_BEDROCK_MODEL = "us.anthropic.claude-haiku-4-5-20251001-v1:0";
|
|
208
210
|
var DEFAULT_CLAUDE_MODEL = CLAUDE_OPUS_5_5_MODEL;
|
|
209
211
|
var GPT_6_ASTRA_MODEL = "gpt-6-astra";
|
|
@@ -284,6 +286,8 @@ function toClaudeCodeModel(model, bedrock) {
|
|
|
284
286
|
return CLAUDE_SONNET_5_5_BEDROCK_MODEL;
|
|
285
287
|
case CLAUDE_SONNET_5_MODEL:
|
|
286
288
|
return "sonnet";
|
|
289
|
+
case CLAUDE_HAIKU_5_5_MODEL:
|
|
290
|
+
return CLAUDE_HAIKU_5_5_BEDROCK_MODEL;
|
|
287
291
|
case CLAUDE_HAIKU_4_5_MODEL:
|
|
288
292
|
return "haiku";
|
|
289
293
|
default:
|
|
@@ -298,6 +302,7 @@ var CLAUDE_MODEL_CONTEXT_WINDOWS = {
|
|
|
298
302
|
[CLAUDE_OPUS_4_8_MODEL]: 1e6,
|
|
299
303
|
[CLAUDE_SONNET_5_5_MODEL]: 1e6,
|
|
300
304
|
[CLAUDE_SONNET_5_MODEL]: 1e6,
|
|
305
|
+
[CLAUDE_HAIKU_5_5_MODEL]: 1e6,
|
|
301
306
|
[CLAUDE_HAIKU_4_5_MODEL]: 2e5,
|
|
302
307
|
[CLAUDE_FABLE_5_1_BEDROCK_MODEL]: 1e6,
|
|
303
308
|
[CLAUDE_FABLE_5_BEDROCK_MODEL]: 1e6,
|
|
@@ -306,6 +311,7 @@ var CLAUDE_MODEL_CONTEXT_WINDOWS = {
|
|
|
306
311
|
[CLAUDE_OPUS_4_8_BEDROCK_MODEL]: 1e6,
|
|
307
312
|
[CLAUDE_SONNET_5_5_BEDROCK_MODEL]: 1e6,
|
|
308
313
|
[CLAUDE_SONNET_5_BEDROCK_MODEL]: 1e6,
|
|
314
|
+
[CLAUDE_HAIKU_5_5_BEDROCK_MODEL]: 1e6,
|
|
309
315
|
[CLAUDE_HAIKU_4_5_BEDROCK_MODEL]: 2e5,
|
|
310
316
|
"anthropic.claude-opus-4-8": 1e6,
|
|
311
317
|
"us.anthropic.claude-sonnet-5": 1e6,
|
|
@@ -322,18 +328,33 @@ function canUseClaudeFastMode(model) {
|
|
|
322
328
|
const normalized = normalizeClaudeModel(model);
|
|
323
329
|
return normalized === CLAUDE_OPUS_5_5_MODEL || normalized === CLAUDE_OPUS_5_MODEL || normalized === CLAUDE_OPUS_4_8_MODEL || model === "claude-opus-4-7";
|
|
324
330
|
}
|
|
331
|
+
var CLAUDE_MODEL_MIN_SANDBOX_IMAGE = {
|
|
332
|
+
[CLAUDE_FABLE_5_1_MODEL]: "replicas-sandbox-2026-09-01-v6",
|
|
333
|
+
[CLAUDE_FABLE_5_MODEL]: null,
|
|
334
|
+
[CLAUDE_OPUS_5_5_MODEL]: "replicas-sandbox-2026-09-22-v4",
|
|
335
|
+
[CLAUDE_OPUS_5_MODEL]: null,
|
|
336
|
+
[CLAUDE_OPUS_4_8_MODEL]: null,
|
|
337
|
+
[CLAUDE_SONNET_5_5_MODEL]: "replicas-sandbox-2026-09-28-v7",
|
|
338
|
+
[CLAUDE_SONNET_5_MODEL]: null,
|
|
339
|
+
[CLAUDE_HAIKU_5_5_MODEL]: "replicas-sandbox-2026-10-08-v4",
|
|
340
|
+
[CLAUDE_HAIKU_4_5_MODEL]: null
|
|
341
|
+
};
|
|
342
|
+
var CODEX_MODEL_MIN_SANDBOX_IMAGE = {
|
|
343
|
+
[DEFAULT_CODEX_MODEL]: "replicas-sandbox-2026-09-30-v11",
|
|
344
|
+
[GPT_6_SOL_MODEL]: "replicas-sandbox-2026-09-24-v1",
|
|
345
|
+
[GPT_6_ASTRA_MODEL]: "replicas-sandbox-2026-09-04-v7",
|
|
346
|
+
[GPT_6_LUNA_MODEL]: "replicas-sandbox-2026-09-24-v1",
|
|
347
|
+
[GPT_5_6_SOL_MODEL]: null,
|
|
348
|
+
[GPT_5_6_TERRA_MODEL]: null,
|
|
349
|
+
[GPT_5_6_LUNA_MODEL]: null,
|
|
350
|
+
"gpt-5.5": null,
|
|
351
|
+
"gpt-5.4": null,
|
|
352
|
+
"gpt-5.4-mini": null,
|
|
353
|
+
"gpt-5.2": null
|
|
354
|
+
};
|
|
325
355
|
var AGENT_MODELS = {
|
|
326
|
-
claude:
|
|
327
|
-
|
|
328
|
-
CLAUDE_FABLE_5_MODEL,
|
|
329
|
-
CLAUDE_OPUS_5_5_MODEL,
|
|
330
|
-
CLAUDE_OPUS_5_MODEL,
|
|
331
|
-
CLAUDE_OPUS_4_8_MODEL,
|
|
332
|
-
CLAUDE_SONNET_5_5_MODEL,
|
|
333
|
-
CLAUDE_SONNET_5_MODEL,
|
|
334
|
-
CLAUDE_HAIKU_4_5_MODEL
|
|
335
|
-
],
|
|
336
|
-
codex: [DEFAULT_CODEX_MODEL, GPT_6_SOL_MODEL, GPT_6_ASTRA_MODEL, GPT_6_LUNA_MODEL, GPT_5_6_SOL_MODEL, GPT_5_6_TERRA_MODEL, GPT_5_6_LUNA_MODEL, "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.2"],
|
|
356
|
+
claude: Object.keys(CLAUDE_MODEL_MIN_SANDBOX_IMAGE),
|
|
357
|
+
codex: Object.keys(CODEX_MODEL_MIN_SANDBOX_IMAGE),
|
|
337
358
|
cursor: [
|
|
338
359
|
CLAUDE_FABLE_5_1_MODEL,
|
|
339
360
|
CLAUDE_FABLE_5_MODEL,
|
|
@@ -412,20 +433,10 @@ function getAgentModelOptions(provider, overrides) {
|
|
|
412
433
|
if (provider === "cursor") return DEFAULT_CURSOR_MODELS;
|
|
413
434
|
return AGENT_MODELS[provider];
|
|
414
435
|
}
|
|
415
|
-
var CLAUDE_MODEL_MIN_SANDBOX_IMAGE = {
|
|
416
|
-
[CLAUDE_FABLE_5_1_MODEL]: "replicas-sandbox-2026-09-01-v6",
|
|
417
|
-
[CLAUDE_OPUS_5_5_MODEL]: "replicas-sandbox-2026-09-22-v4",
|
|
418
|
-
[CLAUDE_SONNET_5_5_MODEL]: "replicas-sandbox-2026-09-28-v7"
|
|
419
|
-
};
|
|
420
|
-
var CODEX_MODEL_MIN_SANDBOX_IMAGE = {
|
|
421
|
-
[GPT_6_ASTRA_MODEL]: "replicas-sandbox-2026-09-04-v7",
|
|
422
|
-
[GPT_6_1_SOL_MODEL]: "replicas-sandbox-2026-09-30-v11",
|
|
423
|
-
[GPT_6_SOL_MODEL]: "replicas-sandbox-2026-09-24-v1",
|
|
424
|
-
[GPT_6_LUNA_MODEL]: "replicas-sandbox-2026-09-24-v1"
|
|
425
|
-
};
|
|
426
436
|
var SANDBOX_IMAGE_MODEL_FALLBACKS = {
|
|
427
437
|
[CLAUDE_OPUS_5_5_MODEL]: CLAUDE_OPUS_5_MODEL,
|
|
428
438
|
[CLAUDE_SONNET_5_5_MODEL]: CLAUDE_SONNET_5_MODEL,
|
|
439
|
+
[CLAUDE_HAIKU_5_5_MODEL]: CLAUDE_HAIKU_4_5_MODEL,
|
|
429
440
|
[GPT_6_1_SOL_MODEL]: GPT_6_SOL_MODEL,
|
|
430
441
|
[GPT_6_SOL_MODEL]: GPT_5_6_SOL_MODEL,
|
|
431
442
|
[GPT_6_ASTRA_MODEL]: GPT_5_6_TERRA_MODEL,
|
|
@@ -479,6 +490,7 @@ var MODEL_LABELS = {
|
|
|
479
490
|
"composer-2.5": "Composer 2.5",
|
|
480
491
|
[CLAUDE_OPUS_4_8_MODEL]: "Opus 4.8",
|
|
481
492
|
"claude-opus-4-7": "Opus 4.7",
|
|
493
|
+
[CLAUDE_HAIKU_5_5_MODEL]: "Haiku 5.5",
|
|
482
494
|
[CLAUDE_HAIKU_4_5_MODEL]: "Haiku 4.5",
|
|
483
495
|
"gemini-3.8-flash": "Gemini 3.8 Flash",
|
|
484
496
|
"gemini-3.1-pro": "Gemini 3.1 Pro",
|
|
@@ -910,6 +922,9 @@ function getCredentialMethodLabel(agent, method) {
|
|
|
910
922
|
var WORKSPACE_SOURCES = ["api", "dashboard", "slack", "linear", "github", "gitlab", "automation", "mothership"];
|
|
911
923
|
var CLIENT_MESSAGE_SOURCES = ["web", "desktop", "mobile", "tui"];
|
|
912
924
|
var MESSAGE_SOURCES = [...CLIENT_MESSAGE_SOURCES, ...WORKSPACE_SOURCES];
|
|
925
|
+
function isClientMessageSource(value) {
|
|
926
|
+
return typeof value === "string" && CLIENT_MESSAGE_SOURCES.some((source) => source === value);
|
|
927
|
+
}
|
|
913
928
|
function isMessageSource(value) {
|
|
914
929
|
return typeof value === "string" && MESSAGE_SOURCES.some((source) => source === value);
|
|
915
930
|
}
|
|
@@ -4935,6 +4950,11 @@ var DEFAULT_DEFAULT_SKILLS = {
|
|
|
4935
4950
|
|
|
4936
4951
|
// ../shared/src/prompts.ts
|
|
4937
4952
|
var REPLICAS_INSTRUCTIONS_TAG = "replicas_instructions";
|
|
4953
|
+
function wrapInTag(content, tag) {
|
|
4954
|
+
return `<${tag}>
|
|
4955
|
+
${content}
|
|
4956
|
+
</${tag}>`;
|
|
4957
|
+
}
|
|
4938
4958
|
function removeTag(text2, tag) {
|
|
4939
4959
|
const regex = new RegExp(`<${tag}>[\\s\\S]*?</${tag}>`, "g");
|
|
4940
4960
|
return text2.replace(regex, "").trim();
|
|
@@ -9201,6 +9221,7 @@ export {
|
|
|
9201
9221
|
detectEnvironmentAuthMethod,
|
|
9202
9222
|
AGENT_CREDENTIAL_METHODS_IN_ORDER,
|
|
9203
9223
|
describeCredential,
|
|
9224
|
+
isClientMessageSource,
|
|
9204
9225
|
agentCredentialSnapshotSchema,
|
|
9205
9226
|
isSameCredential,
|
|
9206
9227
|
isAgentChatTurnActivityRecord,
|
|
@@ -9309,6 +9330,8 @@ export {
|
|
|
9309
9330
|
SANDBOX_SKILL_DIRS,
|
|
9310
9331
|
HISTORY_ROOT,
|
|
9311
9332
|
HISTORY_INDEX_FILENAME,
|
|
9333
|
+
REPLICAS_INSTRUCTIONS_TAG,
|
|
9334
|
+
wrapInTag,
|
|
9312
9335
|
extractErrorText,
|
|
9313
9336
|
isTransientErrorText,
|
|
9314
9337
|
extractToolResultText,
|
|
@@ -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-3PGSQAYB.js";
|
|
7
|
+
import "./chunk-K64GTMH6.js";
|
|
8
|
+
import "./chunk-FB2CARXP.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-ZXU7SQP3.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
AppServerProcess,
|
|
9
9
|
buildCodexAgentEnv
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-XR5FZAUG.js";
|
|
11
|
+
import "./chunk-FB2CARXP.js";
|
|
12
12
|
import {
|
|
13
13
|
AGENT,
|
|
14
14
|
headlessAgentRequestSchema
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZXU7SQP3.js";
|
|
16
16
|
import "./chunk-VEQXQN22.js";
|
|
17
17
|
|
|
18
18
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
reportCommandProtectionBlock,
|
|
33
33
|
resolveDiffBase,
|
|
34
34
|
runGitCommand
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-3PGSQAYB.js";
|
|
36
36
|
import {
|
|
37
37
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
38
38
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
} from "./chunk-P73LGPQO.js";
|
|
58
58
|
import {
|
|
59
59
|
publishedPullRequestUrls
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-7OCJPQZ4.js";
|
|
61
61
|
import {
|
|
62
62
|
BaseRefreshManager,
|
|
63
63
|
CodexAspAuthMethodChangedError,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
refreshDelayMs,
|
|
72
72
|
restartCodexAspHost,
|
|
73
73
|
routineRefreshRequest
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-3VEV6OKT.js";
|
|
75
75
|
import {
|
|
76
76
|
ENGINE_ENV,
|
|
77
77
|
monolithRequest,
|
|
@@ -79,16 +79,16 @@ import {
|
|
|
79
79
|
readRuntimeEnvFile,
|
|
80
80
|
reloadEngineEnv,
|
|
81
81
|
setAgentCredentialSnapshot
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-K64GTMH6.js";
|
|
83
83
|
import {
|
|
84
84
|
AspClient,
|
|
85
85
|
getCodexModelProvider
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-XR5FZAUG.js";
|
|
87
87
|
import {
|
|
88
88
|
SUBPROCESS_MAX_BUFFER,
|
|
89
89
|
execAsync,
|
|
90
90
|
execFileAsync
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-FB2CARXP.js";
|
|
92
92
|
import {
|
|
93
93
|
isRecord as isRecord2
|
|
94
94
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -164,6 +164,7 @@ import {
|
|
|
164
164
|
QUEUED_MESSAGE_REMOVED_EVENT_TYPE,
|
|
165
165
|
REMOVED_MESSAGE_IDS_PAYLOAD_KEY,
|
|
166
166
|
REPLICAS_CONFIG_FILENAMES,
|
|
167
|
+
REPLICAS_INSTRUCTIONS_TAG,
|
|
167
168
|
REPLICAS_RUNTIME_ENV_ALIASES,
|
|
168
169
|
SANDBOX_SKILL_DIRS,
|
|
169
170
|
SUBAGENT_MCP_HARNESSES,
|
|
@@ -255,6 +256,7 @@ import {
|
|
|
255
256
|
isChatMessageSender,
|
|
256
257
|
isClaudeAuthErrorText,
|
|
257
258
|
isClaudeResultError,
|
|
259
|
+
isClientMessageSource,
|
|
258
260
|
isCodexAuthError,
|
|
259
261
|
isDefaultChat,
|
|
260
262
|
isExcludedRepoFilePath,
|
|
@@ -315,8 +317,9 @@ import {
|
|
|
315
317
|
workspaceAudienceSchema,
|
|
316
318
|
workspaceCredentialProviderSchema,
|
|
317
319
|
workspaceTokenRequestSchema,
|
|
318
|
-
workspaceTokenResponseSchema
|
|
319
|
-
|
|
320
|
+
workspaceTokenResponseSchema,
|
|
321
|
+
wrapInTag
|
|
322
|
+
} from "./chunk-ZXU7SQP3.js";
|
|
320
323
|
import {
|
|
321
324
|
cloneMcpConfig,
|
|
322
325
|
ensureCompatibilityImports,
|
|
@@ -11999,10 +12002,15 @@ var CodingAgentManager = class {
|
|
|
11999
12002
|
subagentMcpChatId;
|
|
12000
12003
|
subagentMcpEnabledForTurn = false;
|
|
12001
12004
|
unreadSteers = /* @__PURE__ */ new Map();
|
|
12005
|
+
lastSenderKey;
|
|
12006
|
+
onLastSenderKeyChanged;
|
|
12002
12007
|
constructor(options) {
|
|
12003
12008
|
this.workingDirectory = options.workingDirectory ?? ENGINE_ENV.WORKSPACE_ROOT;
|
|
12004
12009
|
this.initialSessionId = options.initialSessionId;
|
|
12005
|
-
this.onSaveSessionId =
|
|
12010
|
+
this.onSaveSessionId = async (sessionId) => {
|
|
12011
|
+
if (!sessionId) await this.saveLastSenderKey(null);
|
|
12012
|
+
await options.onSaveSessionId(sessionId);
|
|
12013
|
+
};
|
|
12006
12014
|
this.onEvent = options.onEvent;
|
|
12007
12015
|
this.onUsageUpdate = options.onUsageUpdate ?? (() => {
|
|
12008
12016
|
});
|
|
@@ -12016,6 +12024,9 @@ var CodingAgentManager = class {
|
|
|
12016
12024
|
});
|
|
12017
12025
|
this.onModelSwitched = options.onModelSwitched ?? (async () => {
|
|
12018
12026
|
});
|
|
12027
|
+
this.lastSenderKey = options.lastSenderKey ?? null;
|
|
12028
|
+
this.onLastSenderKeyChanged = options.onLastSenderKeyChanged ?? (async () => {
|
|
12029
|
+
});
|
|
12019
12030
|
this.authFallback = options.provider ? new AuthFallbackCoordinator(options.provider, (event) => {
|
|
12020
12031
|
this.onEvent(event);
|
|
12021
12032
|
this.getHistorySink()?.append(event);
|
|
@@ -12076,13 +12087,33 @@ var CodingAgentManager = class {
|
|
|
12076
12087
|
async (request, signal) => {
|
|
12077
12088
|
await this.refreshSubagentMcp();
|
|
12078
12089
|
if (signal.aborted) return;
|
|
12079
|
-
|
|
12090
|
+
const { request: delivered, senderKey } = this.withSenderLine(request);
|
|
12091
|
+
await this.saveLastSenderKey(senderKey);
|
|
12092
|
+
await processMessage(delivered, signal);
|
|
12080
12093
|
},
|
|
12081
12094
|
this.onProcessingChanged,
|
|
12082
12095
|
this.onMessageStarted
|
|
12083
12096
|
);
|
|
12084
12097
|
this.initialized = this.initialize();
|
|
12085
12098
|
}
|
|
12099
|
+
// Integration turns (Slack, GitHub, Linear) carry no sender fields and name their sender in the text, so they reset the key.
|
|
12100
|
+
withSenderLine(request) {
|
|
12101
|
+
if (request.goalMode || request.message.trimStart().startsWith("/")) return { request, senderKey: this.lastSenderKey };
|
|
12102
|
+
if (!request.senderUserId || !request.senderEmail) return { request, senderKey: null };
|
|
12103
|
+
const via = request.source && !isClientMessageSource(request.source) ? request.source : void 0;
|
|
12104
|
+
const senderKey = `${request.senderUserId}:${via ?? ""}`;
|
|
12105
|
+
if (senderKey === this.lastSenderKey) return { request, senderKey };
|
|
12106
|
+
const name = request.senderDisplayName && request.senderDisplayName !== request.senderEmail ? `${request.senderDisplayName} (${request.senderEmail})` : request.senderEmail;
|
|
12107
|
+
const line = wrapInTag(`From ${name}${via ? ` via ${via}` : ""}.`, REPLICAS_INSTRUCTIONS_TAG);
|
|
12108
|
+
return { request: { ...request, message: `${line}
|
|
12109
|
+
|
|
12110
|
+
${request.message}` }, senderKey };
|
|
12111
|
+
}
|
|
12112
|
+
async saveLastSenderKey(senderKey) {
|
|
12113
|
+
if (senderKey === this.lastSenderKey) return;
|
|
12114
|
+
this.lastSenderKey = senderKey;
|
|
12115
|
+
await this.onLastSenderKeyChanged(senderKey);
|
|
12116
|
+
}
|
|
12086
12117
|
/** The workspace preference is resolved per turn so a change applies to the next turn; failures keep the last value. */
|
|
12087
12118
|
async refreshSubagentMcp() {
|
|
12088
12119
|
if (!this.subagentMcpChatId || !ENGINE_ENV.REPLICAS_WORKSPACE_ID) return;
|
|
@@ -12199,8 +12230,10 @@ var CodingAgentManager = class {
|
|
|
12199
12230
|
return { success: false, queue: this.getQueue() };
|
|
12200
12231
|
}
|
|
12201
12232
|
let steered = false;
|
|
12233
|
+
const { request: delivered, senderKey } = this.withSenderLine(taken.message);
|
|
12202
12234
|
try {
|
|
12203
|
-
steered = await this.steerRequest(
|
|
12235
|
+
steered = await this.steerRequest(delivered);
|
|
12236
|
+
if (steered) await this.saveLastSenderKey(senderKey);
|
|
12204
12237
|
} catch (error) {
|
|
12205
12238
|
console.error("[CodingAgentManager] steerRequest threw, keeping message queued:", error);
|
|
12206
12239
|
}
|
|
@@ -12234,6 +12267,11 @@ var CodingAgentManager = class {
|
|
|
12234
12267
|
const steers = [...this.unreadSteers.values()].map(({ message }) => message);
|
|
12235
12268
|
this.unreadSteers.clear();
|
|
12236
12269
|
this.restoreQueuedMessages(steers.map((message) => ({ message, index: 0 })));
|
|
12270
|
+
if (steers.length > 0) {
|
|
12271
|
+
this.saveLastSenderKey(null).catch((error) => {
|
|
12272
|
+
console.error("[CodingAgentManager] Failed to reset last sender:", error);
|
|
12273
|
+
});
|
|
12274
|
+
}
|
|
12237
12275
|
}
|
|
12238
12276
|
markSteerRead(messageId) {
|
|
12239
12277
|
const steer = this.unreadSteers.get(messageId);
|
|
@@ -12268,6 +12306,7 @@ var CodingAgentManager = class {
|
|
|
12268
12306
|
if (enginePortProtectionInstruction) {
|
|
12269
12307
|
parts.push(enginePortProtectionInstruction);
|
|
12270
12308
|
}
|
|
12309
|
+
parts.push("Each message names its sender when the sender changes. Any account email the harness attaches, such as Claude Code's `userEmail`, belongs to the inference account: never use it to identify or contact the user.");
|
|
12271
12310
|
parts.push(`Unless the user asks for a different location, clone a repository you will change into ${ENGINE_ENV.WORKSPACE_ROOT}/<repository-name> so the user can review its changes in the workspace. Clones you only read can go anywhere.`);
|
|
12272
12311
|
if (startHooksInstruction) {
|
|
12273
12312
|
parts.push(startHooksInstruction);
|
|
@@ -60591,6 +60630,7 @@ function normalizePersistedChat(chat) {
|
|
|
60591
60630
|
pendingForkHandoff: chat.pendingForkHandoff === true,
|
|
60592
60631
|
...chat.chatCredential === "workspace" || agentCredentialSnapshotSchema.safeParse(chat.chatCredential).success ? { chatCredential: chat.chatCredential } : {},
|
|
60593
60632
|
transcriptAuth: normalizeTranscriptAuth(chat.transcriptAuth),
|
|
60633
|
+
...typeof chat.lastSenderKey === "string" ? { lastSenderKey: chat.lastSenderKey } : {},
|
|
60594
60634
|
removedMessageIds: Array.isArray(chat.removedMessageIds) ? chat.removedMessageIds.filter((id) => typeof id === "string").slice(-MAX_REMOVED_MESSAGE_IDS) : [],
|
|
60595
60635
|
acceptedSendResponses: isRecord2(chat.acceptedSendResponses) ? Object.fromEntries(Object.entries(chat.acceptedSendResponses).filter((entry) => {
|
|
60596
60636
|
const response = entry[1];
|
|
@@ -61534,6 +61574,10 @@ var ChatService = class {
|
|
|
61534
61574
|
console.error("[ChatService] Failed to record chat credential:", { chatId: persisted.id, error });
|
|
61535
61575
|
});
|
|
61536
61576
|
};
|
|
61577
|
+
const onLastSenderKeyChanged = async (senderKey) => {
|
|
61578
|
+
persisted.lastSenderKey = senderKey ?? void 0;
|
|
61579
|
+
await this.persistAllChats();
|
|
61580
|
+
};
|
|
61537
61581
|
const onProcessingChanged = (processing) => {
|
|
61538
61582
|
if (processing) return;
|
|
61539
61583
|
this.handleProcessingStopped(persisted.id);
|
|
@@ -61576,6 +61620,8 @@ var ChatService = class {
|
|
|
61576
61620
|
chatId: persisted.id,
|
|
61577
61621
|
onModelSwitched,
|
|
61578
61622
|
onChatCredential,
|
|
61623
|
+
lastSenderKey: persisted.lastSenderKey,
|
|
61624
|
+
onLastSenderKeyChanged,
|
|
61579
61625
|
linearSessionId: persisted.parentChatId === null ? ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID : void 0,
|
|
61580
61626
|
parentChatId: persisted.parentChatId
|
|
61581
61627
|
};
|
|
@@ -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-7OCJPQZ4.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-ZXU7SQP3.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.1022",
|
|
4
4
|
"description": "Lightweight API server for Replicas workspaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"author": "Replicas",
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
42
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.293",
|
|
43
43
|
"@anthropic-ai/sdk": "0.128.0",
|
|
44
44
|
"@connectrpc/connect-node": "1.7.0",
|
|
45
45
|
"@cursor/sdk": "1.0.36",
|