clementine-agent 1.0.63 → 1.0.65
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/agent/assistant.js +74 -1
- package/package.json +1 -1
package/dist/agent/assistant.js
CHANGED
|
@@ -702,6 +702,21 @@ export class PersonalAssistant {
|
|
|
702
702
|
if (sysMsg.mcp_servers) {
|
|
703
703
|
this._lastMcpStatus = sysMsg.mcp_servers;
|
|
704
704
|
this._lastMcpStatusTime = new Date().toISOString();
|
|
705
|
+
// Diagnostic (1.0.64+): log per-server connection status on every
|
|
706
|
+
// init so we can tell whether "No such tool available" errors are
|
|
707
|
+
// caused by a failed spawn vs misconfigured allowedTools vs session
|
|
708
|
+
// weirdness. Single-line grep target: 'SDK init — MCP servers'.
|
|
709
|
+
try {
|
|
710
|
+
const statuses = sysMsg.mcp_servers.map((s) => `${s.name}:${s.status}`);
|
|
711
|
+
logger.info({
|
|
712
|
+
statuses,
|
|
713
|
+
toolCount: Array.isArray(sysMsg.tools) ? sysMsg.tools.length : 0,
|
|
714
|
+
sessionId: sysMsg.session_id,
|
|
715
|
+
cwd: sysMsg.cwd,
|
|
716
|
+
model: sysMsg.model,
|
|
717
|
+
}, 'SDK init — MCP servers');
|
|
718
|
+
}
|
|
719
|
+
catch { /* non-fatal */ }
|
|
705
720
|
}
|
|
706
721
|
// Auto-register Claude Desktop integrations from the authoritative tool
|
|
707
722
|
// list the SDK reports on init. Previously the claude-integrations file
|
|
@@ -1659,7 +1674,16 @@ You have a cost budget per message — not a hard turn limit. Work until the tas
|
|
|
1659
1674
|
...(abortController ? { abortController } : {}),
|
|
1660
1675
|
maxTurns: effectiveMaxTurns,
|
|
1661
1676
|
cwd: BASE_DIR,
|
|
1662
|
-
env: SAFE_ENV
|
|
1677
|
+
// NOTE: do NOT pass `env: SAFE_ENV` here. The SDK's `env` option
|
|
1678
|
+
// replaces process.env for the claude CLI subprocess, and the CLI's
|
|
1679
|
+
// claude.ai remote connector bootstrap (Drive, Gmail, Calendar, M365,
|
|
1680
|
+
// Slack) silently drops when vars it expects aren't present. The
|
|
1681
|
+
// probeAvailableTools() call doesn't pass `env`, inherits process.env,
|
|
1682
|
+
// and correctly surfaces claude.ai connectors. Matching that behavior
|
|
1683
|
+
// here is the fix for the week-long "No such tool available:
|
|
1684
|
+
// mcp__claude_ai_Google_Drive__*" bug. Per-MCP-server env isolation
|
|
1685
|
+
// still happens inside the mcpServers entries (line ~1855) — this
|
|
1686
|
+
// change only affects the CLI subprocess's own env.
|
|
1663
1687
|
...(computedEffort ? { effort: computedEffort } : {}),
|
|
1664
1688
|
// maxBudgetUsd intentionally omitted — see comment above.
|
|
1665
1689
|
...(computedThinking ? { thinking: computedThinking } : {}),
|
|
@@ -2246,6 +2270,20 @@ You have a cost budget per message — not a hard turn limit. Work until the tas
|
|
|
2246
2270
|
eventLog.emitQueryStart(sessionKey, prompt, { model: sdkOptions.model ?? undefined, source: 'chat' });
|
|
2247
2271
|
}
|
|
2248
2272
|
try {
|
|
2273
|
+
// Diagnostic (1.0.64+): log the exact options we hand to query().
|
|
2274
|
+
// Compare against a known-working standalone call to pinpoint
|
|
2275
|
+
// config drift. Single-line grep target: 'query() options'.
|
|
2276
|
+
logger.info({
|
|
2277
|
+
sessionKey,
|
|
2278
|
+
cwd: sdkOptions.cwd,
|
|
2279
|
+
mcpServerKeys: Object.keys(sdkOptions.mcpServers ?? {}),
|
|
2280
|
+
toolsCount: Array.isArray(sdkOptions.tools) ? sdkOptions.tools.length : 'preset-or-omitted',
|
|
2281
|
+
allowedToolsCount: sdkOptions.allowedTools?.length ?? 0,
|
|
2282
|
+
disallowedToolsCount: sdkOptions.disallowedTools?.length ?? 0,
|
|
2283
|
+
hasResume: !!sdkOptions.resume,
|
|
2284
|
+
resumeSessionId: sdkOptions.resume,
|
|
2285
|
+
model: sdkOptions.model,
|
|
2286
|
+
}, 'query() options');
|
|
2249
2287
|
const stream = query({ prompt, options: sdkOptions });
|
|
2250
2288
|
let gotStreamEvents = false;
|
|
2251
2289
|
for await (const message of stream) {
|
|
@@ -2609,6 +2647,41 @@ You have a cost budget per message — not a hard turn limit. Work until the tas
|
|
|
2609
2647
|
})(),
|
|
2610
2648
|
replyPreview: responseText.slice(0, 200).replace(/\n/g, ' '),
|
|
2611
2649
|
}, 'Contradiction validator pass');
|
|
2650
|
+
// Diagnostic (1.0.64+): dump EVERY tool_result whose content
|
|
2651
|
+
// looks like the SDK's "No such tool available" error, with
|
|
2652
|
+
// its full content + corresponding tool_use. The specific
|
|
2653
|
+
// pairing is what we need to diagnose whether a particular
|
|
2654
|
+
// server failed to register vs a specific tool was dropped.
|
|
2655
|
+
try {
|
|
2656
|
+
const useById = new Map();
|
|
2657
|
+
for (const msg of collectedSdkMessages) {
|
|
2658
|
+
if (msg.type !== 'assistant' || !msg.message?.content)
|
|
2659
|
+
continue;
|
|
2660
|
+
for (const b of (Array.isArray(msg.message.content) ? msg.message.content : [])) {
|
|
2661
|
+
if (b?.type === 'tool_use' && b.id && b.name)
|
|
2662
|
+
useById.set(b.id, b.name);
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
for (const msg of collectedSdkMessages) {
|
|
2666
|
+
if (msg.type !== 'user' || !msg.message?.content)
|
|
2667
|
+
continue;
|
|
2668
|
+
for (const b of (Array.isArray(msg.message.content) ? msg.message.content : [])) {
|
|
2669
|
+
if (b?.type !== 'tool_result')
|
|
2670
|
+
continue;
|
|
2671
|
+
const contentStr = typeof b.content === 'string' ? b.content : JSON.stringify(b.content);
|
|
2672
|
+
if (/tool_use_error/i.test(contentStr)) {
|
|
2673
|
+
logger.warn({
|
|
2674
|
+
sessionKey,
|
|
2675
|
+
tool_use_id: b.tool_use_id,
|
|
2676
|
+
tool_name: useById.get(b.tool_use_id) ?? '(unknown)',
|
|
2677
|
+
is_error: b.is_error,
|
|
2678
|
+
content: contentStr.slice(0, 600),
|
|
2679
|
+
}, 'SDK tool_use_error surfaced');
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
catch { /* non-fatal */ }
|
|
2612
2685
|
}
|
|
2613
2686
|
const finding = detectContradiction(responseText, toolCallRecords);
|
|
2614
2687
|
if (finding) {
|