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 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/fx-parser.ts
2867
- function getFxTextChunk(update, kind) {
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 parseFxEvents(events) {
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 content = getUserMessage(event);
2875
- if (content !== null) {
2876
- if (content.trim()) {
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) ?? `fx-user-${event.timestamp}`,
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.type === "fx-error") {
2904
+ if (isProviderEvent(event, provider, "error")) {
2887
2905
  messages.push({
2888
- id: `fx-error-${event.timestamp}`,
2906
+ id: `${provider}-error-${event.timestamp}`,
2889
2907
  type: "error",
2890
- message: typeof event.payload.message === "string" ? event.payload.message : "fx failed",
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.type === "fx-turn-complete") {
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 !== "fx-session-update" || !isRecord(event.payload.update)) continue;
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 content2 = getFxTextChunk(update, kind);
2906
- if (!content2) continue;
2907
- const id = typeof update.messageId === "string" ? `fx-${update.messageId}` : `fx-${kind}-${event.timestamp}`;
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 : ""}${content2}`;
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 = `fx-tool-${update.toolCallId}`;
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: "fx",
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.13"
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-mcp",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -71,7 +71,7 @@ type RegisterToolFn = (
71
71
 
72
72
  const server = new McpServer({
73
73
  name: 'replicas-mcp',
74
- version: '0.2.13',
74
+ version: '0.2.14',
75
75
  });
76
76
 
77
77
  const registerTool = server.registerTool.bind(server) as RegisterToolFn;