replicas-engine 0.1.660 → 0.1.663
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/{chunk-DNFS3CV6.js → chunk-R6UJFZCJ.js} +116 -11
- package/dist/src/headless-agent.js +1 -1
- package/dist/src/index.js +394 -168
- package/package.json +2 -1
|
@@ -6,6 +6,7 @@ var AGENT = {
|
|
|
6
6
|
CODEX: "codex",
|
|
7
7
|
CURSOR: "cursor",
|
|
8
8
|
DEEPSEEK: "deepseek",
|
|
9
|
+
FX: "fx",
|
|
9
10
|
OPENCODE: "opencode",
|
|
10
11
|
PI: "pi",
|
|
11
12
|
RELAY: "relay"
|
|
@@ -28,6 +29,7 @@ var THINKING_LEVELS_BY_AGENT = {
|
|
|
28
29
|
codex: [...STANDARD_THINKING_LEVELS, "ultra"],
|
|
29
30
|
cursor: STANDARD_THINKING_LEVELS,
|
|
30
31
|
deepseek: STANDARD_THINKING_LEVELS,
|
|
32
|
+
fx: STANDARD_THINKING_LEVELS,
|
|
31
33
|
opencode: STANDARD_THINKING_LEVELS,
|
|
32
34
|
pi: STANDARD_THINKING_LEVELS,
|
|
33
35
|
relay: [...STANDARD_THINKING_LEVELS, "ultracode"]
|
|
@@ -299,6 +301,7 @@ var DEFAULT_CHAT_TITLES = {
|
|
|
299
301
|
codex: "Codex",
|
|
300
302
|
cursor: "Cursor",
|
|
301
303
|
deepseek: "DeepSeek Harness",
|
|
304
|
+
fx: "fx",
|
|
302
305
|
opencode: "Opencode",
|
|
303
306
|
pi: "Pi",
|
|
304
307
|
relay: "Relay"
|
|
@@ -325,21 +328,31 @@ var GPT_5_6_LUNA_MODEL = "gpt-5.6-luna";
|
|
|
325
328
|
var DEFAULT_CODEX_MODEL = GPT_5_6_SOL_MODEL;
|
|
326
329
|
var DEFAULT_CURSOR_MODEL = "composer-2.5";
|
|
327
330
|
var DEFAULT_OPENCODE_MODEL = "z-ai/glm-5.2";
|
|
328
|
-
var
|
|
331
|
+
var DEEPSEEK_V4_PRO_MODEL = "deepseek/deepseek-v4-pro-0813";
|
|
332
|
+
var DEEPSEEK_V4_FLASH_MODEL = "deepseek/deepseek-v4-flash-0731";
|
|
333
|
+
var DEFAULT_DEEPSEEK_MODEL = DEEPSEEK_V4_PRO_MODEL;
|
|
334
|
+
var DEFAULT_FX_MODEL = "zai/glm-5.2";
|
|
329
335
|
var DEFAULT_PI_MODEL = DEFAULT_OPENCODE_MODEL;
|
|
330
336
|
var OPENROUTER_MODELS = [
|
|
331
337
|
DEFAULT_OPENCODE_MODEL,
|
|
332
|
-
|
|
333
|
-
|
|
338
|
+
DEEPSEEK_V4_PRO_MODEL,
|
|
339
|
+
DEEPSEEK_V4_FLASH_MODEL,
|
|
334
340
|
"minimax/minimax-m3",
|
|
335
341
|
"xiaomi/mimo-v2.5-pro",
|
|
336
342
|
"moonshotai/kimi-k2.6"
|
|
337
343
|
];
|
|
344
|
+
function prioritizeDeepseekModels(models) {
|
|
345
|
+
return [
|
|
346
|
+
...models.filter((model) => model.startsWith("deepseek/")),
|
|
347
|
+
...models.filter((model) => !model.startsWith("deepseek/"))
|
|
348
|
+
];
|
|
349
|
+
}
|
|
338
350
|
var FALLBACK_AGENT_MODEL = {
|
|
339
351
|
claude: DEFAULT_CLAUDE_MODEL,
|
|
340
352
|
codex: DEFAULT_CODEX_MODEL,
|
|
341
353
|
cursor: DEFAULT_CURSOR_MODEL,
|
|
342
354
|
deepseek: DEFAULT_DEEPSEEK_MODEL,
|
|
355
|
+
fx: DEFAULT_FX_MODEL,
|
|
343
356
|
opencode: DEFAULT_OPENCODE_MODEL,
|
|
344
357
|
pi: DEFAULT_PI_MODEL,
|
|
345
358
|
relay: DEFAULT_CLAUDE_MODEL
|
|
@@ -426,7 +439,8 @@ var AGENT_MODELS = {
|
|
|
426
439
|
CLAUDE_HAIKU_4_5_MODEL,
|
|
427
440
|
"kimi-k2.5"
|
|
428
441
|
],
|
|
429
|
-
deepseek:
|
|
442
|
+
deepseek: prioritizeDeepseekModels(OPENROUTER_MODELS),
|
|
443
|
+
fx: [DEFAULT_FX_MODEL],
|
|
430
444
|
opencode: [...OPENROUTER_MODELS, ...ASTER_MODELS],
|
|
431
445
|
pi: [...OPENROUTER_MODELS, ...ASTER_MODELS],
|
|
432
446
|
relay: [CLAUDE_FABLE_5_MODEL, CLAUDE_OPUS_5_MODEL, CLAUDE_OPUS_4_8_MODEL, CLAUDE_SONNET_5_MODEL]
|
|
@@ -446,8 +460,8 @@ var MODEL_LABELS = {
|
|
|
446
460
|
[GPT_5_6_LUNA_MODEL]: "GPT-5.6 Luna",
|
|
447
461
|
"gpt-5.5": "GPT-5.5",
|
|
448
462
|
[DEFAULT_OPENCODE_MODEL]: "GLM 5.2 via OpenRouter",
|
|
449
|
-
|
|
450
|
-
|
|
463
|
+
[DEEPSEEK_V4_PRO_MODEL]: "DeepSeek V4 Pro via OpenRouter",
|
|
464
|
+
[DEEPSEEK_V4_FLASH_MODEL]: "DeepSeek V4 Flash via OpenRouter",
|
|
451
465
|
"minimax/minimax-m3": "MiniMax M3 via OpenRouter",
|
|
452
466
|
"xiaomi/mimo-v2.5-pro": "MiMo V2.5 Pro via OpenRouter",
|
|
453
467
|
"moonshotai/kimi-k2.6": "Kimi K2.6 via OpenRouter",
|
|
@@ -588,7 +602,8 @@ var CREDENTIAL_METHOD = {
|
|
|
588
602
|
BEDROCK: "bedrock",
|
|
589
603
|
OPENCODE_GO: "opencode-go",
|
|
590
604
|
ASTER: "aster",
|
|
591
|
-
OPENROUTER: "openrouter"
|
|
605
|
+
OPENROUTER: "openrouter",
|
|
606
|
+
AI_GATEWAY: "ai-gateway"
|
|
592
607
|
};
|
|
593
608
|
var CREDENTIAL_TYPE = {
|
|
594
609
|
CLAUDE_OAUTH: "claude",
|
|
@@ -601,7 +616,8 @@ var CREDENTIAL_TYPE = {
|
|
|
601
616
|
CURSOR_API_KEY: "cursor_api_key",
|
|
602
617
|
OPENCODE_GO_API_KEY: "opencode_go_api_key",
|
|
603
618
|
ASTER_API_KEY: "aster_api_key",
|
|
604
|
-
OPENROUTER_API_KEY: "openrouter_api_key"
|
|
619
|
+
OPENROUTER_API_KEY: "openrouter_api_key",
|
|
620
|
+
AI_GATEWAY_API_KEY: "ai_gateway_api_key"
|
|
605
621
|
};
|
|
606
622
|
var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
|
|
607
623
|
[AGENT.CLAUDE]: [
|
|
@@ -621,6 +637,9 @@ var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
|
|
|
621
637
|
[AGENT.DEEPSEEK]: [
|
|
622
638
|
{ method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY }
|
|
623
639
|
],
|
|
640
|
+
[AGENT.FX]: [
|
|
641
|
+
{ method: CREDENTIAL_METHOD.AI_GATEWAY, credentialType: CREDENTIAL_TYPE.AI_GATEWAY_API_KEY }
|
|
642
|
+
],
|
|
624
643
|
[AGENT.OPENCODE]: [
|
|
625
644
|
{ method: CREDENTIAL_METHOD.OPENCODE_GO, credentialType: CREDENTIAL_TYPE.OPENCODE_GO_API_KEY },
|
|
626
645
|
{ method: CREDENTIAL_METHOD.ASTER, credentialType: CREDENTIAL_TYPE.ASTER_API_KEY },
|
|
@@ -802,6 +821,16 @@ function getCodexAspTurnResponse(turn) {
|
|
|
802
821
|
if (normalizeCodexAspTranscriptStatus(turn.status) === "in_progress") return null;
|
|
803
822
|
return turn.items.findLast((item) => item.type === "agentMessage") ?? null;
|
|
804
823
|
}
|
|
824
|
+
function renumberCodexAspTranscriptItems(transcript) {
|
|
825
|
+
let sequence = 0;
|
|
826
|
+
return {
|
|
827
|
+
...transcript,
|
|
828
|
+
turns: transcript.turns.map((turn) => ({
|
|
829
|
+
...turn,
|
|
830
|
+
items: turn.items.map((item) => ({ ...item, sequence: sequence++ }))
|
|
831
|
+
}))
|
|
832
|
+
};
|
|
833
|
+
}
|
|
805
834
|
function isCodexAspTranscript(value) {
|
|
806
835
|
if (!isRecord(value)) return false;
|
|
807
836
|
return typeof value.threadId === "string" && typeof value.updatedAt === "string" && Array.isArray(value.turns);
|
|
@@ -1501,7 +1530,7 @@ var SLASH_COMMANDS = [
|
|
|
1501
1530
|
command: "/plan",
|
|
1502
1531
|
description: "Switch to plan mode and optionally send a prompt.",
|
|
1503
1532
|
argumentHint: "[prompt]",
|
|
1504
|
-
providers: ["claude", "codex", "cursor", "deepseek", "opencode", "pi", "relay"]
|
|
1533
|
+
providers: ["claude", "codex", "cursor", "deepseek", "fx", "opencode", "pi", "relay"]
|
|
1505
1534
|
},
|
|
1506
1535
|
{
|
|
1507
1536
|
command: "/fast",
|
|
@@ -4471,6 +4500,71 @@ function parseDeepseekEvents(events) {
|
|
|
4471
4500
|
return messages;
|
|
4472
4501
|
}
|
|
4473
4502
|
|
|
4503
|
+
// ../shared/src/display-message/parsers/fx-parser.ts
|
|
4504
|
+
function getFxTextChunk(update, kind) {
|
|
4505
|
+
if (!isRecord(update) || update.sessionUpdate !== kind || !isRecord(update.content) || update.content.type !== "text") return null;
|
|
4506
|
+
return typeof update.content.text === "string" && update.content.text ? update.content.text : null;
|
|
4507
|
+
}
|
|
4508
|
+
function parseFxEvents(events) {
|
|
4509
|
+
const messages = [];
|
|
4510
|
+
for (const event of events) {
|
|
4511
|
+
const content = getUserMessage(event);
|
|
4512
|
+
if (content !== null) {
|
|
4513
|
+
if (content.trim()) {
|
|
4514
|
+
messages.push({
|
|
4515
|
+
id: getUserMessageId(event) ?? `fx-user-${event.timestamp}`,
|
|
4516
|
+
type: "user",
|
|
4517
|
+
content,
|
|
4518
|
+
timestamp: event.timestamp
|
|
4519
|
+
});
|
|
4520
|
+
}
|
|
4521
|
+
continue;
|
|
4522
|
+
}
|
|
4523
|
+
if (event.type === "fx-error") {
|
|
4524
|
+
messages.push({
|
|
4525
|
+
id: `fx-error-${event.timestamp}`,
|
|
4526
|
+
type: "error",
|
|
4527
|
+
message: typeof event.payload.message === "string" ? event.payload.message : "fx failed",
|
|
4528
|
+
timestamp: event.timestamp
|
|
4529
|
+
});
|
|
4530
|
+
continue;
|
|
4531
|
+
}
|
|
4532
|
+
if (event.type === "fx-turn-complete") {
|
|
4533
|
+
for (const message of messages) {
|
|
4534
|
+
if (message.type === "reasoning" && message.status === "in_progress") message.status = "completed";
|
|
4535
|
+
}
|
|
4536
|
+
continue;
|
|
4537
|
+
}
|
|
4538
|
+
if (event.type !== "fx-session-update" || !isRecord(event.payload.update)) continue;
|
|
4539
|
+
const update = event.payload.update;
|
|
4540
|
+
const kind = update.sessionUpdate;
|
|
4541
|
+
if (kind === "agent_message_chunk" || kind === "agent_thought_chunk") {
|
|
4542
|
+
const content2 = getFxTextChunk(update, kind);
|
|
4543
|
+
if (!content2) continue;
|
|
4544
|
+
const id = typeof update.messageId === "string" ? `fx-${update.messageId}` : `fx-${kind}-${event.timestamp}`;
|
|
4545
|
+
const existing = messages.find((message) => message.id === id);
|
|
4546
|
+
const text = `${existing && "content" in existing && typeof existing.content === "string" ? existing.content : ""}${content2}`;
|
|
4547
|
+
upsertDisplayMessage(messages, kind === "agent_thought_chunk" ? { id, type: "reasoning", content: text, status: "in_progress", timestamp: existing?.timestamp ?? event.timestamp } : { id, type: "agent", content: text, timestamp: existing?.timestamp ?? event.timestamp });
|
|
4548
|
+
continue;
|
|
4549
|
+
}
|
|
4550
|
+
if ((kind === "tool_call" || kind === "tool_call_update") && typeof update.toolCallId === "string") {
|
|
4551
|
+
const id = `fx-tool-${update.toolCallId}`;
|
|
4552
|
+
const existing = messages.find((message) => message.id === id && message.type === "tool_call");
|
|
4553
|
+
const status = update.status === "completed" || update.status === "failed" ? update.status === "failed" ? "failed" : "completed" : "in_progress";
|
|
4554
|
+
upsertDisplayMessage(messages, createCallDisplayMessage({
|
|
4555
|
+
id,
|
|
4556
|
+
server: "fx",
|
|
4557
|
+
tool: typeof update.name === "string" ? update.name : typeof update.title === "string" ? update.title : existing?.tool ?? "tool",
|
|
4558
|
+
input: update.rawInput === void 0 ? existing?.input : isRecord(update.rawInput) ? update.rawInput : stringifyDisplayValue(update.rawInput),
|
|
4559
|
+
output: update.rawOutput === void 0 ? existing?.output : stringifyDisplayValue(update.rawOutput),
|
|
4560
|
+
status,
|
|
4561
|
+
timestamp: event.timestamp
|
|
4562
|
+
}));
|
|
4563
|
+
}
|
|
4564
|
+
}
|
|
4565
|
+
return messages;
|
|
4566
|
+
}
|
|
4567
|
+
|
|
4474
4568
|
// ../shared/src/display-message/parsers/opencode-parser.ts
|
|
4475
4569
|
function timestampFromMs(value, fallback) {
|
|
4476
4570
|
return typeof value === "number" && Number.isFinite(value) ? new Date(value).toISOString() : fallback;
|
|
@@ -5560,7 +5654,12 @@ function mergeCodexAspDisplayMessages(primary, supplemental) {
|
|
|
5560
5654
|
indexMessage(message, merged.push(message) - 1);
|
|
5561
5655
|
} else if (message.type === "user") {
|
|
5562
5656
|
unindexMessage(merged[duplicateIndex], duplicateIndex);
|
|
5563
|
-
merged[duplicateIndex] = {
|
|
5657
|
+
merged[duplicateIndex] = {
|
|
5658
|
+
...merged[duplicateIndex],
|
|
5659
|
+
id: message.id,
|
|
5660
|
+
timestamp: message.timestamp
|
|
5661
|
+
};
|
|
5662
|
+
firstIndexById.set(message.id, duplicateIndex);
|
|
5564
5663
|
indexMessage(merged[duplicateIndex], duplicateIndex);
|
|
5565
5664
|
}
|
|
5566
5665
|
}
|
|
@@ -5632,6 +5731,9 @@ function parseAgentEvents(events, agentType) {
|
|
|
5632
5731
|
if (agentType === "deepseek") {
|
|
5633
5732
|
return parseDeepseekEvents(events);
|
|
5634
5733
|
}
|
|
5734
|
+
if (agentType === "fx") {
|
|
5735
|
+
return parseFxEvents(events);
|
|
5736
|
+
}
|
|
5635
5737
|
if (agentType === "opencode") {
|
|
5636
5738
|
return parseOpencodeEvents(events);
|
|
5637
5739
|
}
|
|
@@ -6230,7 +6332,7 @@ var DEFAULT_CODEX_ARGS = [
|
|
|
6230
6332
|
var MIN_CODEX_CLI_VERSION = "0.144.6";
|
|
6231
6333
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
6232
6334
|
var codexCliVersionEnsured = null;
|
|
6233
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
6335
|
+
var ENGINE_PACKAGE_VERSION = "0.1.663";
|
|
6234
6336
|
var INITIALIZE_METHOD = "initialize";
|
|
6235
6337
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
6236
6338
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -6495,6 +6597,7 @@ export {
|
|
|
6495
6597
|
DEFAULT_CURSOR_MODEL,
|
|
6496
6598
|
DEFAULT_OPENCODE_MODEL,
|
|
6497
6599
|
DEFAULT_DEEPSEEK_MODEL,
|
|
6600
|
+
DEFAULT_FX_MODEL,
|
|
6498
6601
|
DEFAULT_PI_MODEL,
|
|
6499
6602
|
getDefaultAgentModel,
|
|
6500
6603
|
normalizeClaudeModel,
|
|
@@ -6561,6 +6664,7 @@ export {
|
|
|
6561
6664
|
imageContentToUserMessageImages,
|
|
6562
6665
|
createAcceptedUserMessageEvent,
|
|
6563
6666
|
getCodexAspTurnResponse,
|
|
6667
|
+
renumberCodexAspTranscriptItems,
|
|
6564
6668
|
isCodexAspTranscript,
|
|
6565
6669
|
isCodexAspTranscriptDelta,
|
|
6566
6670
|
applyCodexAspTranscriptDelta,
|
|
@@ -6587,6 +6691,7 @@ export {
|
|
|
6587
6691
|
areSameUserMessageEvents,
|
|
6588
6692
|
parseAgentEventJsonlWithCodexAspTranscript,
|
|
6589
6693
|
getDeepseekAssistantMessageText,
|
|
6694
|
+
getFxTextChunk,
|
|
6590
6695
|
extractToolResultText,
|
|
6591
6696
|
normalizeContentBlocks,
|
|
6592
6697
|
TaskAccumulator,
|