@peakflo/agent-harness 0.2.24-rc.1 → 0.2.24

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.
@@ -120,7 +120,7 @@ export declare class ClaudeCodeAdapter implements CodingAgentAdapter {
120
120
  startTime?: number;
121
121
  input?: Record<string, unknown>;
122
122
  }>>;
123
- pollMessages(sessionId: string, _seenMessageIds: Set<string>, seenPartIds: Set<string>, partContentLengths: Map<string, string>, _config: SessionConfig): Promise<MessagePart[]>;
123
+ pollMessages(sessionId: string, _seenMessageIds: Set<string>, seenPartIds: Set<string>, partContentLengths: Map<string, string>, config: SessionConfig): Promise<MessagePart[]>;
124
124
  abortPrompt(sessionId: string, _config: SessionConfig): Promise<void>;
125
125
  destroySession(sessionId: string, _config: SessionConfig): Promise<void>;
126
126
  getAllMessages(sessionId: string, _config: SessionConfig): Promise<SessionMessage[]>;
@@ -950,7 +950,7 @@ class ClaudeCodeAdapter {
950
950
  input: { taskType: t.taskType ?? 'unknown', description: t.description ?? '' },
951
951
  }));
952
952
  }
953
- async pollMessages(sessionId, _seenMessageIds, seenPartIds, partContentLengths, _config) {
953
+ async pollMessages(sessionId, _seenMessageIds, seenPartIds, partContentLengths, config) {
954
954
  const session = this.sessions.get(sessionId);
955
955
  if (!session) {
956
956
  return [];
@@ -964,7 +964,7 @@ class ClaudeCodeAdapter {
964
964
  if (!msgId)
965
965
  continue;
966
966
  // Convert SDKMessage to MessagePart
967
- const parts = this.convertSDKMessageToParts(sdkMsg, seenPartIds, partContentLengths);
967
+ const parts = this.convertSDKMessageToParts(sdkMsg, seenPartIds, partContentLengths, config);
968
968
  newParts.push(...parts);
969
969
  }
970
970
  // Advance cursor past processed messages
@@ -1480,7 +1480,7 @@ class ClaudeCodeAdapter {
1480
1480
  /**
1481
1481
  * Converts SDKMessage to MessagePart[] format
1482
1482
  */
1483
- convertSDKMessageToParts(msg, seenPartIds, partContentLengths) {
1483
+ convertSDKMessageToParts(msg, seenPartIds, partContentLengths, config) {
1484
1484
  const parts = [];
1485
1485
  const msgWithProps = msg;
1486
1486
  // ── Skip messages from inside a subtask ──
@@ -1897,8 +1897,35 @@ class ClaudeCodeAdapter {
1897
1897
  });
1898
1898
  return parts;
1899
1899
  }
1900
- // Skip system init messages - they're internal session setup
1900
+ // Claude Code can skip a configured MCP server before it reaches the
1901
+ // model. Its "workspace" name is reserved, for example. The harness's
1902
+ // own preflight cannot detect that client-side refusal. Surface it in
1903
+ // the transcript instead of leaving the user with a smaller silent list.
1901
1904
  if (msgWithProps.subtype === ClaudeSystemSubtype.INIT) {
1905
+ const init = msgWithProps;
1906
+ if (config && Array.isArray(init.mcp_servers)) {
1907
+ const loaded = new Map(init.mcp_servers.map((server) => [server.name, server.status]));
1908
+ for (const name of Object.keys(config.mcpServers ?? {})) {
1909
+ const status = loaded.get(name);
1910
+ if (status === 'connected' || status === 'pending')
1911
+ continue;
1912
+ const partId = `claude-mcp-unavailable-${msgWithProps.uuid}-${name}`;
1913
+ if (seenPartIds.has(partId))
1914
+ continue;
1915
+ seenPartIds.add(partId);
1916
+ const reason = status
1917
+ ? `status: ${status}`
1918
+ : 'not loaded by Claude Code';
1919
+ const text = `MCP server "${name}" is unavailable in Claude Code (${reason}). Its tools cannot be used in this turn.`;
1920
+ partContentLengths.set(partId, String(text.length));
1921
+ parts.push({
1922
+ id: partId,
1923
+ type: coding_agent_adapter_1.MessagePartType.ERROR,
1924
+ role: 'system',
1925
+ text
1926
+ });
1927
+ }
1928
+ }
1902
1929
  return parts;
1903
1930
  }
1904
1931
  // SDKTaskStartedMessage — subagent task started
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peakflo/agent-harness",
3
- "version": "0.2.24-rc.1",
3
+ "version": "0.2.24",
4
4
  "description": "Headless Peakflo coding-agent harness. One codebase, three hosting modes: a Daytona cloud sandbox, a customer VM, and the 20x desktop.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",