replicas-mcp 0.2.13 → 0.2.14
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/index.js +111 -24
- package/package.json +1 -1
- package/src/index.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ var AGENT = {
|
|
|
12
12
|
CURSOR: "cursor",
|
|
13
13
|
DEEPSEEK: "deepseek",
|
|
14
14
|
FX: "fx",
|
|
15
|
+
KIMI: "kimi",
|
|
15
16
|
OPENCODE: "opencode",
|
|
16
17
|
PI: "pi",
|
|
17
18
|
RELAY: "relay"
|
|
@@ -32,6 +33,7 @@ var THINKING_LEVELS_BY_AGENT = {
|
|
|
32
33
|
cursor: STANDARD_THINKING_LEVELS,
|
|
33
34
|
deepseek: STANDARD_THINKING_LEVELS,
|
|
34
35
|
fx: STANDARD_THINKING_LEVELS,
|
|
36
|
+
kimi: STANDARD_THINKING_LEVELS,
|
|
35
37
|
opencode: STANDARD_THINKING_LEVELS,
|
|
36
38
|
pi: STANDARD_THINKING_LEVELS,
|
|
37
39
|
relay: [...STANDARD_THINKING_LEVELS, "ultracode"]
|
|
@@ -49,6 +51,8 @@ function getProviderDisplayName(provider, variant = "short") {
|
|
|
49
51
|
return variant === "long" ? "DeepSeek Harness" : "DeepSeek";
|
|
50
52
|
case "fx":
|
|
51
53
|
return "fx";
|
|
54
|
+
case "kimi":
|
|
55
|
+
return variant === "long" ? "Kimi Code" : "Kimi";
|
|
52
56
|
case "opencode":
|
|
53
57
|
return "Opencode";
|
|
54
58
|
case "pi":
|
|
@@ -125,6 +129,9 @@ var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
|
|
|
125
129
|
[AGENT.FX]: [
|
|
126
130
|
{ method: CREDENTIAL_METHOD.AI_GATEWAY, credentialType: CREDENTIAL_TYPE.AI_GATEWAY_API_KEY }
|
|
127
131
|
],
|
|
132
|
+
[AGENT.KIMI]: [
|
|
133
|
+
{ method: CREDENTIAL_METHOD.AI_GATEWAY, credentialType: CREDENTIAL_TYPE.AI_GATEWAY_API_KEY }
|
|
134
|
+
],
|
|
128
135
|
[AGENT.OPENCODE]: [
|
|
129
136
|
{ method: CREDENTIAL_METHOD.OPENCODE_GO, credentialType: CREDENTIAL_TYPE.OPENCODE_GO_API_KEY },
|
|
130
137
|
{ method: CREDENTIAL_METHOD.ASTER, credentialType: CREDENTIAL_TYPE.ASTER_API_KEY },
|
|
@@ -1754,6 +1761,7 @@ var DEFAULT_OPENCODE_MODEL = "z-ai/glm-5.2";
|
|
|
1754
1761
|
var DEEPSEEK_V4_PRO_MODEL = "deepseek/deepseek-v4-pro-0813";
|
|
1755
1762
|
var DEEPSEEK_V4_FLASH_MODEL = "deepseek/deepseek-v4-flash-0731";
|
|
1756
1763
|
var DEFAULT_FX_MODEL = "zai/glm-5.2";
|
|
1764
|
+
var DEFAULT_KIMI_MODEL = "moonshotai/kimi-k2.6";
|
|
1757
1765
|
var OPENROUTER_MODELS = [
|
|
1758
1766
|
DEFAULT_OPENCODE_MODEL,
|
|
1759
1767
|
DEEPSEEK_V4_PRO_MODEL,
|
|
@@ -1825,6 +1833,7 @@ var AGENT_MODELS = {
|
|
|
1825
1833
|
],
|
|
1826
1834
|
deepseek: prioritizeDeepseekModels(OPENROUTER_MODELS),
|
|
1827
1835
|
fx: [DEFAULT_FX_MODEL],
|
|
1836
|
+
kimi: [DEFAULT_KIMI_MODEL],
|
|
1828
1837
|
opencode: [...OPENROUTER_MODELS, ...ASTER_MODELS],
|
|
1829
1838
|
pi: [...OPENROUTER_MODELS, ...ASTER_MODELS],
|
|
1830
1839
|
relay: [CLAUDE_FABLE_5_MODEL, CLAUDE_OPUS_5_MODEL, CLAUDE_OPUS_4_8_MODEL, CLAUDE_SONNET_5_MODEL]
|
|
@@ -2863,71 +2872,146 @@ function parseDeepseekEvents(events) {
|
|
|
2863
2872
|
return messages;
|
|
2864
2873
|
}
|
|
2865
2874
|
|
|
2866
|
-
// ../shared/src/display-message/parsers/
|
|
2867
|
-
|
|
2875
|
+
// ../shared/src/display-message/parsers/acp-parser.ts
|
|
2876
|
+
var FX_CONTEXT_DIAGNOSTIC = /^\[context\] skill catalog omitted .*?(?:\r?\n|$)/;
|
|
2877
|
+
function getAcpTextChunk(update, kind) {
|
|
2868
2878
|
if (!isRecord(update) || update.sessionUpdate !== kind || !isRecord(update.content) || update.content.type !== "text") return null;
|
|
2869
|
-
return typeof update.content.text === "string" && update.content.text ? update.content.text : null;
|
|
2879
|
+
return typeof update.content.text === "string" && update.content.text.length > 0 ? update.content.text : null;
|
|
2870
2880
|
}
|
|
2871
|
-
function
|
|
2881
|
+
function isProviderEvent(event, provider, suffix) {
|
|
2882
|
+
return event.type === `acp-${suffix}` && (event.payload.provider === void 0 || event.payload.provider === provider) || event.type === `${provider}-${suffix}`;
|
|
2883
|
+
}
|
|
2884
|
+
function parseAcpEvents(events, provider) {
|
|
2872
2885
|
const messages = [];
|
|
2886
|
+
const activeChunks = {};
|
|
2887
|
+
const resolvedInputs = /* @__PURE__ */ new Map();
|
|
2888
|
+
let chunkSequence = 0;
|
|
2873
2889
|
for (const event of events) {
|
|
2874
|
-
const
|
|
2875
|
-
if (
|
|
2876
|
-
|
|
2890
|
+
const userContent = getUserMessage(event);
|
|
2891
|
+
if (userContent !== null) {
|
|
2892
|
+
activeChunks.agent_message_chunk = void 0;
|
|
2893
|
+
activeChunks.agent_thought_chunk = void 0;
|
|
2894
|
+
if (userContent.trim()) {
|
|
2877
2895
|
messages.push({
|
|
2878
|
-
id: getUserMessageId(event) ??
|
|
2896
|
+
id: getUserMessageId(event) ?? `${provider}-user-${event.timestamp}`,
|
|
2879
2897
|
type: "user",
|
|
2880
|
-
content,
|
|
2898
|
+
content: userContent,
|
|
2881
2899
|
timestamp: event.timestamp
|
|
2882
2900
|
});
|
|
2883
2901
|
}
|
|
2884
2902
|
continue;
|
|
2885
2903
|
}
|
|
2886
|
-
if (event
|
|
2904
|
+
if (isProviderEvent(event, provider, "error")) {
|
|
2887
2905
|
messages.push({
|
|
2888
|
-
id:
|
|
2906
|
+
id: `${provider}-error-${event.timestamp}`,
|
|
2889
2907
|
type: "error",
|
|
2890
|
-
message: typeof event.payload.message === "string" ? event.payload.message :
|
|
2908
|
+
message: typeof event.payload.message === "string" ? event.payload.message : `${provider} failed`,
|
|
2891
2909
|
timestamp: event.timestamp
|
|
2892
2910
|
});
|
|
2893
2911
|
continue;
|
|
2894
2912
|
}
|
|
2895
|
-
if (event
|
|
2913
|
+
if (isProviderEvent(event, provider, "turn-complete")) {
|
|
2896
2914
|
for (const message of messages) {
|
|
2897
2915
|
if (message.type === "reasoning" && message.status === "in_progress") message.status = "completed";
|
|
2898
2916
|
}
|
|
2917
|
+
activeChunks.agent_message_chunk = void 0;
|
|
2918
|
+
activeChunks.agent_thought_chunk = void 0;
|
|
2919
|
+
continue;
|
|
2920
|
+
}
|
|
2921
|
+
if (event.type === "replicas-tool-input-request" && typeof event.payload.toolUseId === "string" && typeof event.payload.requestId === "string") {
|
|
2922
|
+
const message = messages.find((candidate) => candidate.type === "tool_call" && candidate.id === `${provider}-tool-${event.payload.toolUseId}`);
|
|
2923
|
+
if (message && (Array.isArray(event.payload.options) || Array.isArray(event.payload.questions))) {
|
|
2924
|
+
const resolved = resolvedInputs.get(event.payload.toolUseId);
|
|
2925
|
+
message.inputRequest = {
|
|
2926
|
+
requestId: event.payload.requestId,
|
|
2927
|
+
status: resolved?.selectionId === "aborted" ? "aborted" : resolved ? "resolved" : "pending",
|
|
2928
|
+
...Array.isArray(event.payload.options) ? { options: event.payload.options } : {},
|
|
2929
|
+
...Array.isArray(event.payload.questions) ? { questions: event.payload.questions } : {},
|
|
2930
|
+
...resolved ? { selectionId: resolved.selectionId } : {},
|
|
2931
|
+
...resolved?.selectionSummary ? { selectionSummary: resolved.selectionSummary } : {}
|
|
2932
|
+
};
|
|
2933
|
+
}
|
|
2899
2934
|
continue;
|
|
2900
2935
|
}
|
|
2901
|
-
if (event.type
|
|
2936
|
+
if (event.type === "replicas-tool-input-resolved" && typeof event.payload.toolUseId === "string" && typeof event.payload.selectionId === "string") {
|
|
2937
|
+
const resolved = {
|
|
2938
|
+
selectionId: event.payload.selectionId,
|
|
2939
|
+
...typeof event.payload.selectionSummary === "string" ? { selectionSummary: event.payload.selectionSummary } : {}
|
|
2940
|
+
};
|
|
2941
|
+
resolvedInputs.set(event.payload.toolUseId, resolved);
|
|
2942
|
+
const message = messages.find((candidate) => candidate.type === "tool_call" && candidate.id === `${provider}-tool-${event.payload.toolUseId}`);
|
|
2943
|
+
if (message?.inputRequest) {
|
|
2944
|
+
message.inputRequest = {
|
|
2945
|
+
...message.inputRequest,
|
|
2946
|
+
status: resolved.selectionId === "aborted" ? "aborted" : "resolved",
|
|
2947
|
+
...resolved
|
|
2948
|
+
};
|
|
2949
|
+
}
|
|
2950
|
+
continue;
|
|
2951
|
+
}
|
|
2952
|
+
if (!isProviderEvent(event, provider, "session-update") || !isRecord(event.payload.update)) continue;
|
|
2902
2953
|
const update = event.payload.update;
|
|
2903
2954
|
const kind = update.sessionUpdate;
|
|
2904
2955
|
if (kind === "agent_message_chunk" || kind === "agent_thought_chunk") {
|
|
2905
|
-
const
|
|
2906
|
-
if (
|
|
2907
|
-
const
|
|
2956
|
+
const content = getAcpTextChunk(update, kind);
|
|
2957
|
+
if (content === null) continue;
|
|
2958
|
+
const explicitId = typeof update.messageId === "string" && update.messageId.length > 0 ? `${provider}-${kind}-${update.messageId}` : null;
|
|
2959
|
+
const id = explicitId ?? activeChunks[kind] ?? `${provider}-${kind}-${chunkSequence++}`;
|
|
2960
|
+
activeChunks[kind] = id;
|
|
2961
|
+
const otherKind = kind === "agent_message_chunk" ? "agent_thought_chunk" : "agent_message_chunk";
|
|
2962
|
+
if (!explicitId) activeChunks[otherKind] = void 0;
|
|
2908
2963
|
const existing = messages.find((message) => message.id === id);
|
|
2909
|
-
const text = `${existing && "content" in existing && typeof existing.content === "string" ? existing.content : ""}${
|
|
2964
|
+
const text = `${existing && "content" in existing && typeof existing.content === "string" ? existing.content : ""}${content}`.replace(provider === "fx" ? FX_CONTEXT_DIAGNOSTIC : /$^/, "");
|
|
2965
|
+
if (!text) continue;
|
|
2910
2966
|
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 });
|
|
2911
2967
|
continue;
|
|
2912
2968
|
}
|
|
2969
|
+
activeChunks.agent_message_chunk = void 0;
|
|
2970
|
+
activeChunks.agent_thought_chunk = void 0;
|
|
2913
2971
|
if ((kind === "tool_call" || kind === "tool_call_update") && typeof update.toolCallId === "string") {
|
|
2914
|
-
const id =
|
|
2972
|
+
const id = `${provider}-tool-${update.toolCallId}`;
|
|
2915
2973
|
const existing = messages.find((message) => message.id === id && message.type === "tool_call");
|
|
2916
2974
|
const status = update.status === "completed" || update.status === "failed" ? update.status === "failed" ? "failed" : "completed" : "in_progress";
|
|
2975
|
+
const contentOutput = Array.isArray(update.content) && update.content.length > 0 ? stringifyDisplayValue(update.content) : void 0;
|
|
2917
2976
|
upsertDisplayMessage(messages, createCallDisplayMessage({
|
|
2918
2977
|
id,
|
|
2919
|
-
server:
|
|
2920
|
-
tool: typeof update.name === "string" ? update.name : typeof update.title === "string" ? update.title : existing?.tool ?? "tool",
|
|
2978
|
+
server: provider,
|
|
2979
|
+
tool: typeof update.name === "string" && update.name ? update.name : typeof update.title === "string" && update.title ? update.title : existing?.tool ?? (typeof update.kind === "string" ? update.kind : "tool"),
|
|
2921
2980
|
input: update.rawInput === void 0 ? existing?.input : isRecord(update.rawInput) ? update.rawInput : stringifyDisplayValue(update.rawInput),
|
|
2922
|
-
output: update.rawOutput === void 0 ? existing?.output : stringifyDisplayValue(update.rawOutput),
|
|
2981
|
+
output: update.rawOutput === void 0 ? contentOutput ?? existing?.output : stringifyDisplayValue(update.rawOutput),
|
|
2923
2982
|
status,
|
|
2924
|
-
timestamp: event.timestamp
|
|
2983
|
+
timestamp: existing?.timestamp ?? event.timestamp
|
|
2925
2984
|
}));
|
|
2985
|
+
continue;
|
|
2986
|
+
}
|
|
2987
|
+
const plan = kind === "plan" ? update : isRecord(update.plan) ? update.plan : void 0;
|
|
2988
|
+
if ((kind === "plan" || kind === "plan_update") && plan && Array.isArray(plan.entries)) {
|
|
2989
|
+
const items = plan.entries.flatMap((entry) => {
|
|
2990
|
+
if (!isRecord(entry) || typeof entry.content !== "string") return [];
|
|
2991
|
+
const itemStatus = entry.status === "completed" || entry.status === "in_progress" ? entry.status : "pending";
|
|
2992
|
+
return [{
|
|
2993
|
+
text: entry.content,
|
|
2994
|
+
completed: entry.status === "completed",
|
|
2995
|
+
itemStatus
|
|
2996
|
+
}];
|
|
2997
|
+
});
|
|
2998
|
+
upsertDisplayMessage(messages, {
|
|
2999
|
+
id: `${provider}-plan-${typeof plan.planId === "string" ? plan.planId : "current"}`,
|
|
3000
|
+
type: "todo_list",
|
|
3001
|
+
items,
|
|
3002
|
+
status: items.every((item) => item.completed) ? "completed" : "in_progress",
|
|
3003
|
+
timestamp: event.timestamp
|
|
3004
|
+
});
|
|
2926
3005
|
}
|
|
2927
3006
|
}
|
|
2928
3007
|
return messages;
|
|
2929
3008
|
}
|
|
2930
3009
|
|
|
3010
|
+
// ../shared/src/display-message/parsers/fx-parser.ts
|
|
3011
|
+
function parseFxEvents(events) {
|
|
3012
|
+
return parseAcpEvents(events, "fx");
|
|
3013
|
+
}
|
|
3014
|
+
|
|
2931
3015
|
// ../shared/src/display-message/parsers/opencode-parser.ts
|
|
2932
3016
|
function timestampFromMs(value, fallback) {
|
|
2933
3017
|
return typeof value === "number" && Number.isFinite(value) ? new Date(value).toISOString() : fallback;
|
|
@@ -3680,6 +3764,9 @@ function parseAgentEvents(events, agentType) {
|
|
|
3680
3764
|
if (agentType === "fx") {
|
|
3681
3765
|
return parseFxEvents(events);
|
|
3682
3766
|
}
|
|
3767
|
+
if (agentType === "kimi") {
|
|
3768
|
+
return parseAcpEvents(events, "kimi");
|
|
3769
|
+
}
|
|
3683
3770
|
if (agentType === "opencode") {
|
|
3684
3771
|
return parseOpencodeEvents(events);
|
|
3685
3772
|
}
|
|
@@ -3823,7 +3910,7 @@ function result(data, isError = false) {
|
|
|
3823
3910
|
}
|
|
3824
3911
|
var server = new McpServer({
|
|
3825
3912
|
name: "replicas-mcp",
|
|
3826
|
-
version: "0.2.
|
|
3913
|
+
version: "0.2.14"
|
|
3827
3914
|
});
|
|
3828
3915
|
var registerTool = server.registerTool.bind(server);
|
|
3829
3916
|
var codingAgentSchema = z3.string().refine(isValidCodingAgentProvider, {
|
package/package.json
CHANGED