@bike4mind/cli 0.2.74-feat-parallel-tool-execution.22336 → 0.2.74
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/commands/doctorCommand.mjs +1 -1
- package/dist/commands/headlessCommand.mjs +1 -1
- package/dist/commands/updateCommand.mjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{tools-XBaSaxxI.mjs → tools-DAsbKA2E.mjs} +84 -224
- package/dist/{updateChecker-DVwDqGOi.mjs → updateChecker-RTwS54ns.mjs} +1 -1
- package/package.json +7 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as version, n as fetchLatestVersion, r as forceCheckForUpdate } from "../updateChecker-
|
|
2
|
+
import { i as version, n as fetchLatestVersion, r as forceCheckForUpdate } from "../updateChecker-RTwS54ns.mjs";
|
|
3
3
|
import { execSync } from "child_process";
|
|
4
4
|
import { constants, existsSync, promises } from "fs";
|
|
5
5
|
import { homedir } from "os";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { B as CustomCommandStore, C as getApiUrl, E as generateCliTools, I as buildCoreSystemPrompt, P as setWebSocketToolExecutor, R as isReadOnlyTool, S as loadContextFiles, T as PermissionManager, U as SessionStore, V as CheckpointStore, _ as ServerLlmBackend, a as createBackgroundAgentTools, c as AgentStore, f as ApiClient, g as WebSocketLlmBackend, h as FallbackLlmBackend, i as createWriteTodosTool, l as SubagentOrchestrator, m as WebSocketConnectionManager, n as createFindDefinitionTool, o as BackgroundAgentManager, p as WebSocketToolExecutor, r as createTodoStore, s as createAgentDelegateTool, t as createGetFileStructureTool, u as createSkillTool, v as McpManager, z as ReActAgent } from "../tools-
|
|
2
|
+
import { B as CustomCommandStore, C as getApiUrl, E as generateCliTools, I as buildCoreSystemPrompt, P as setWebSocketToolExecutor, R as isReadOnlyTool, S as loadContextFiles, T as PermissionManager, U as SessionStore, V as CheckpointStore, _ as ServerLlmBackend, a as createBackgroundAgentTools, c as AgentStore, f as ApiClient, g as WebSocketLlmBackend, h as FallbackLlmBackend, i as createWriteTodosTool, l as SubagentOrchestrator, m as WebSocketConnectionManager, n as createFindDefinitionTool, o as BackgroundAgentManager, p as WebSocketToolExecutor, r as createTodoStore, s as createAgentDelegateTool, t as createGetFileStructureTool, u as createSkillTool, v as McpManager, z as ReActAgent } from "../tools-DAsbKA2E.mjs";
|
|
3
3
|
import { n as logger, t as ConfigStore } from "../ConfigStore-C1UQBlv3.mjs";
|
|
4
4
|
import { t as DEFAULT_SANDBOX_CONFIG } from "../types-DBEjF9YS.mjs";
|
|
5
5
|
import { t as createSandboxRuntime } from "../SandboxRuntimeAdapter-C1B4t20N.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as version, r as forceCheckForUpdate } from "../updateChecker-
|
|
2
|
+
import { i as version, r as forceCheckForUpdate } from "../updateChecker-RTwS54ns.mjs";
|
|
3
3
|
import { execSync } from "child_process";
|
|
4
4
|
//#region src/commands/updateCommand.ts
|
|
5
5
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as useCliStore, t as selectActiveBackgroundAgents } from "./store-Dw1nZX2Y.mjs";
|
|
3
|
-
import { A as DEFAULT_RETRY_CONFIG, B as CustomCommandStore, C as getApiUrl, D as ALWAYS_DENIED_FOR_AGENTS, E as generateCliTools, F as OllamaBackend, G as hasFileReferences, H as CommandHistoryStore, I as buildCoreSystemPrompt, J as mergeCommands, K as processFileReferences, L as buildSkillsPromptSection, M as clearFeatureModuleTools, N as registerFeatureModuleTools, O as DEFAULT_AGENT_MODEL, P as setWebSocketToolExecutor, R as isReadOnlyTool, S as loadContextFiles, T as PermissionManager, U as SessionStore, V as CheckpointStore, W as OAuthClient, X as searchFiles, Y as formatFileSize, Z as warmFileCache, _ as ServerLlmBackend, a as createBackgroundAgentTools, b as formatStep, c as AgentStore, d as parseAgentConfig, f as ApiClient, g as WebSocketLlmBackend, h as FallbackLlmBackend, i as createWriteTodosTool, j as DEFAULT_THOROUGHNESS, k as DEFAULT_MAX_ITERATIONS, l as SubagentOrchestrator, m as WebSocketConnectionManager, n as createFindDefinitionTool, o as BackgroundAgentManager, p as WebSocketToolExecutor, q as searchCommands, r as createTodoStore, s as createAgentDelegateTool, t as createGetFileStructureTool, u as createSkillTool, v as McpManager, w as getEnvironmentName, x as extractCompactInstructions, y as substituteArguments, z as ReActAgent } from "./tools-
|
|
3
|
+
import { A as DEFAULT_RETRY_CONFIG, B as CustomCommandStore, C as getApiUrl, D as ALWAYS_DENIED_FOR_AGENTS, E as generateCliTools, F as OllamaBackend, G as hasFileReferences, H as CommandHistoryStore, I as buildCoreSystemPrompt, J as mergeCommands, K as processFileReferences, L as buildSkillsPromptSection, M as clearFeatureModuleTools, N as registerFeatureModuleTools, O as DEFAULT_AGENT_MODEL, P as setWebSocketToolExecutor, R as isReadOnlyTool, S as loadContextFiles, T as PermissionManager, U as SessionStore, V as CheckpointStore, W as OAuthClient, X as searchFiles, Y as formatFileSize, Z as warmFileCache, _ as ServerLlmBackend, a as createBackgroundAgentTools, b as formatStep, c as AgentStore, d as parseAgentConfig, f as ApiClient, g as WebSocketLlmBackend, h as FallbackLlmBackend, i as createWriteTodosTool, j as DEFAULT_THOROUGHNESS, k as DEFAULT_MAX_ITERATIONS, l as SubagentOrchestrator, m as WebSocketConnectionManager, n as createFindDefinitionTool, o as BackgroundAgentManager, p as WebSocketToolExecutor, q as searchCommands, r as createTodoStore, s as createAgentDelegateTool, t as createGetFileStructureTool, u as createSkillTool, v as McpManager, w as getEnvironmentName, x as extractCompactInstructions, y as substituteArguments, z as ReActAgent } from "./tools-DAsbKA2E.mjs";
|
|
4
4
|
import { Dt as validateJupyterKernelName, Ot as validateNotebookPath$1, g as ChatModels, m as CREDIT_DEDUCT_TRANSACTION_TYPES, n as logger, t as ConfigStore } from "./ConfigStore-C1UQBlv3.mjs";
|
|
5
|
-
import { i as version, t as checkForUpdate } from "./updateChecker-
|
|
5
|
+
import { i as version, t as checkForUpdate } from "./updateChecker-RTwS54ns.mjs";
|
|
6
6
|
import React, { useCallback, useEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
7
7
|
import { Box, Static, Text, render, useApp, useInput } from "ink";
|
|
8
8
|
import { execSync } from "child_process";
|
|
@@ -4359,133 +4359,69 @@ var OpenAIBackend = class {
|
|
|
4359
4359
|
id: toolCall.id
|
|
4360
4360
|
});
|
|
4361
4361
|
}
|
|
4362
|
-
if (options.executeTools !== false) {
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
if (!toolFn) continue;
|
|
4362
|
+
if (options.executeTools !== false) for (const toolCall of c.message.tool_calls) {
|
|
4363
|
+
if (toolCall.type !== "function") continue;
|
|
4364
|
+
const toolFn = options.tools?.find((tool) => tool.toolSchema.name === toolCall.function.name)?.toolFn;
|
|
4365
|
+
if (toolFn && toolCall.function.arguments) {
|
|
4366
|
+
this.logger.debug("Using tool:", toolCall.function.name);
|
|
4367
|
+
this.logger.debug("Tool arguments:", toolCall.function.arguments);
|
|
4369
4368
|
try {
|
|
4370
|
-
const
|
|
4371
|
-
|
|
4369
|
+
const result = await toolFn(JSON.parse(toolCall.function.arguments));
|
|
4370
|
+
this.logger.debug(`[Tool Result] Tool executed for ${toolCall.function.name}:`, result.toString().substring(0, 200) + "...");
|
|
4371
|
+
let artifactWasStreamed = false;
|
|
4372
|
+
await handleToolResultStreaming(toolCall.function.name, result, async (results) => {
|
|
4373
|
+
artifactWasStreamed = true;
|
|
4374
|
+
await callback(results, {
|
|
4375
|
+
inputTokens: 0,
|
|
4376
|
+
outputTokens: 0,
|
|
4377
|
+
toolsUsed: toolsUsed.length > 0 ? toolsUsed : void 0
|
|
4378
|
+
});
|
|
4379
|
+
});
|
|
4380
|
+
const resultStr = result.toString();
|
|
4381
|
+
const sanitizedResult = artifactWasStreamed ? resultStr.replace(/<artifact(?:\s[^>]*)?>[\s\S]*?<\/artifact>/gi, "[Artifact rendered and delivered to user]") : resultStr;
|
|
4382
|
+
this.pushToolMessages(messages, {
|
|
4372
4383
|
id: toolCall.id,
|
|
4373
4384
|
name: toolCall.function.name,
|
|
4374
|
-
parameters: toolCall.function.arguments
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
}
|
|
4382
|
-
}
|
|
4383
|
-
const parallelEnabled = options.parallelToolExecution !== false;
|
|
4384
|
-
let outcomes;
|
|
4385
|
-
if (parallelEnabled && resolvedTools.length > 1) {
|
|
4386
|
-
this.logger.debug("[Tool Execution] Executing tools in parallel (OpenAI non-streaming)", { toolNames: resolvedTools.map((t) => t.name) });
|
|
4387
|
-
outcomes = (await Promise.allSettled(resolvedTools.map(async ({ id, name, parameters, parsedParams, toolFn, isMcpTool }) => {
|
|
4388
|
-
this.logger.debug("Using tool (parallel):", name);
|
|
4389
|
-
return {
|
|
4390
|
-
ok: true,
|
|
4391
|
-
id,
|
|
4392
|
-
name,
|
|
4393
|
-
parameters,
|
|
4394
|
-
isMcpTool,
|
|
4395
|
-
result: await toolFn(parsedParams)
|
|
4385
|
+
parameters: toolCall.function.arguments
|
|
4386
|
+
}, sanitizedResult);
|
|
4387
|
+
const isMcpTool = options.tools?.find((t) => t.toolSchema.name === toolCall.function.name)?._isMcpTool;
|
|
4388
|
+
let recursiveBuffer = "";
|
|
4389
|
+
let recursiveMeta = {
|
|
4390
|
+
inputTokens: 0,
|
|
4391
|
+
outputTokens: 0
|
|
4396
4392
|
};
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
this.
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
} catch (error) {
|
|
4420
|
-
if (error instanceof PermissionDeniedError) throw error;
|
|
4421
|
-
this.logger.error(`Error processing ${name} tool:`, error);
|
|
4422
|
-
outcomes.push({
|
|
4423
|
-
ok: false,
|
|
4424
|
-
id,
|
|
4425
|
-
name,
|
|
4426
|
-
parameters,
|
|
4427
|
-
error
|
|
4428
|
-
});
|
|
4393
|
+
const recursiveCallback = artifactWasStreamed ? async (results, meta) => {
|
|
4394
|
+
for (const r of results) if (r != null) recursiveBuffer += r;
|
|
4395
|
+
if (meta.inputTokens || meta.outputTokens) recursiveMeta = { ...meta };
|
|
4396
|
+
} : callback;
|
|
4397
|
+
if (isMcpTool) await this.complete(model, messages, {
|
|
4398
|
+
...options,
|
|
4399
|
+
_internal: {
|
|
4400
|
+
...options._internal,
|
|
4401
|
+
toolCallCount: toolCallCount + 1
|
|
4402
|
+
}
|
|
4403
|
+
}, recursiveCallback, toolsUsed);
|
|
4404
|
+
else await this.complete(model, messages, {
|
|
4405
|
+
...options,
|
|
4406
|
+
tools: void 0,
|
|
4407
|
+
_internal: {
|
|
4408
|
+
...options._internal,
|
|
4409
|
+
toolCallCount: toolCallCount + 1
|
|
4410
|
+
}
|
|
4411
|
+
}, recursiveCallback, toolsUsed);
|
|
4412
|
+
if (artifactWasStreamed && recursiveBuffer) {
|
|
4413
|
+
const cleaned = recursiveBuffer.replace(/<artifact(?:\s[^>]*)?>[\s\S]*?<\/artifact>/gi, "").trim();
|
|
4414
|
+
if (cleaned) await callback([cleaned], recursiveMeta);
|
|
4429
4415
|
}
|
|
4416
|
+
return;
|
|
4417
|
+
} catch (error) {
|
|
4418
|
+
if (error instanceof PermissionDeniedError) throw error;
|
|
4419
|
+
console.error(`Error processing ${toolCall.function.name} tool:`, error);
|
|
4420
|
+
streamedText[c.index] = `Error processing ${toolCall.function.name} tool: ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
4430
4421
|
}
|
|
4431
4422
|
}
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
const anyMcpTool = resolvedTools.some((t) => t.isMcpTool);
|
|
4435
|
-
for (const outcome of outcomes) {
|
|
4436
|
-
if (!outcome.ok) {
|
|
4437
|
-
if (outcome.error instanceof PermissionDeniedError) throw outcome.error;
|
|
4438
|
-
const errorMsg = `Error processing ${outcome.name} tool: ${outcome.error instanceof Error ? outcome.error.message : "Unknown error"}`;
|
|
4439
|
-
streamedText[c.index] = errorMsg;
|
|
4440
|
-
this.pushToolMessages(messages, {
|
|
4441
|
-
id: outcome.id,
|
|
4442
|
-
name: outcome.name,
|
|
4443
|
-
parameters: outcome.parameters
|
|
4444
|
-
}, errorMsg);
|
|
4445
|
-
continue;
|
|
4446
|
-
}
|
|
4447
|
-
const resultStr = outcome.result.toString();
|
|
4448
|
-
this.logger.debug(`[Tool Result] Tool executed for ${outcome.name}:`, resultStr.substring(0, 200) + "...");
|
|
4449
|
-
let thisToolHadArtifact = false;
|
|
4450
|
-
await handleToolResultStreaming(outcome.name, outcome.result, async (results) => {
|
|
4451
|
-
thisToolHadArtifact = true;
|
|
4452
|
-
anyArtifactWasStreamed = true;
|
|
4453
|
-
await callback(results, {
|
|
4454
|
-
inputTokens: 0,
|
|
4455
|
-
outputTokens: 0,
|
|
4456
|
-
toolsUsed: toolsUsed.length > 0 ? toolsUsed : void 0
|
|
4457
|
-
});
|
|
4458
|
-
});
|
|
4459
|
-
const sanitizedResult = thisToolHadArtifact ? resultStr.replace(/<artifact(?:\s[^>]*)?>[\s\S]*?<\/artifact>/gi, "[Artifact rendered and delivered to user]") : resultStr;
|
|
4460
|
-
this.pushToolMessages(messages, {
|
|
4461
|
-
id: outcome.id,
|
|
4462
|
-
name: outcome.name,
|
|
4463
|
-
parameters: outcome.parameters
|
|
4464
|
-
}, sanitizedResult);
|
|
4465
|
-
}
|
|
4466
|
-
let recursiveBuffer = "";
|
|
4467
|
-
let recursiveMeta = {
|
|
4468
|
-
inputTokens: 0,
|
|
4469
|
-
outputTokens: 0
|
|
4470
|
-
};
|
|
4471
|
-
const recursiveCallback = anyArtifactWasStreamed ? async (results, meta) => {
|
|
4472
|
-
for (const r of results) if (r != null) recursiveBuffer += r;
|
|
4473
|
-
if (meta.inputTokens || meta.outputTokens) recursiveMeta = { ...meta };
|
|
4474
|
-
} : callback;
|
|
4475
|
-
await this.complete(model, messages, {
|
|
4476
|
-
...options,
|
|
4477
|
-
tools: anyMcpTool ? options.tools : void 0,
|
|
4478
|
-
_internal: {
|
|
4479
|
-
...options._internal,
|
|
4480
|
-
toolCallCount: toolCallCount + 1
|
|
4481
|
-
}
|
|
4482
|
-
}, recursiveCallback, toolsUsed);
|
|
4483
|
-
if (anyArtifactWasStreamed && recursiveBuffer) {
|
|
4484
|
-
const cleaned = recursiveBuffer.replace(/<artifact(?:\s[^>]*)?>[\s\S]*?<\/artifact>/gi, "").trim();
|
|
4485
|
-
if (cleaned) await callback([cleaned], recursiveMeta);
|
|
4486
|
-
}
|
|
4487
|
-
return;
|
|
4488
|
-
} else {
|
|
4423
|
+
}
|
|
4424
|
+
else {
|
|
4489
4425
|
this.logger.debug(`[Tool Execution] executeTools=false, passing tool calls to callback`);
|
|
4490
4426
|
await callback([null], {
|
|
4491
4427
|
inputTokens: response.usage?.prompt_tokens || 0,
|
|
@@ -4578,116 +4514,42 @@ var OpenAIBackend = class {
|
|
|
4578
4514
|
id: tool.id
|
|
4579
4515
|
});
|
|
4580
4516
|
if (options.executeTools !== false) {
|
|
4581
|
-
|
|
4582
|
-
for (const tool of func) {
|
|
4517
|
+
let anyArtifactWasStreamed = false;
|
|
4518
|
+
for await (const tool of func) {
|
|
4583
4519
|
const { id, name } = tool;
|
|
4584
|
-
if (!id || !name) continue;
|
|
4585
4520
|
const parameters = tool.parameters || "{}";
|
|
4586
|
-
const
|
|
4587
|
-
|
|
4588
|
-
if (!toolFn) continue;
|
|
4589
|
-
try {
|
|
4590
|
-
const parsedParams = JSON.parse(parameters);
|
|
4591
|
-
resolvedTools.push({
|
|
4592
|
-
id,
|
|
4593
|
-
name,
|
|
4594
|
-
parameters,
|
|
4595
|
-
parsedParams,
|
|
4596
|
-
toolFn,
|
|
4597
|
-
isMcpTool: toolDef?._isMcpTool ?? false
|
|
4598
|
-
});
|
|
4599
|
-
} catch {
|
|
4600
|
-
this.logger.warn("JSON parse error for tool parameters (skipping):", {
|
|
4601
|
-
name,
|
|
4602
|
-
parameters
|
|
4603
|
-
});
|
|
4604
|
-
}
|
|
4605
|
-
}
|
|
4606
|
-
const parallelEnabled = options.parallelToolExecution !== false;
|
|
4607
|
-
let outcomes;
|
|
4608
|
-
if (parallelEnabled && resolvedTools.length > 1) {
|
|
4609
|
-
this.logger.debug("[Tool Execution] Executing tools in parallel (OpenAI streaming)", { toolNames: resolvedTools.map((t) => t.name) });
|
|
4610
|
-
outcomes = (await Promise.allSettled(resolvedTools.map(async ({ id, name, parameters, parsedParams, toolFn, isMcpTool }) => {
|
|
4611
|
-
this.logger.debug("Using tool (parallel):", name);
|
|
4612
|
-
return {
|
|
4613
|
-
ok: true,
|
|
4614
|
-
id,
|
|
4615
|
-
name,
|
|
4616
|
-
parameters,
|
|
4617
|
-
isMcpTool,
|
|
4618
|
-
result: await toolFn(parsedParams)
|
|
4619
|
-
};
|
|
4620
|
-
}))).map((s, i) => s.status === "fulfilled" ? s.value : {
|
|
4621
|
-
ok: false,
|
|
4622
|
-
id: resolvedTools[i].id,
|
|
4623
|
-
name: resolvedTools[i].name,
|
|
4624
|
-
parameters: resolvedTools[i].parameters,
|
|
4625
|
-
error: s.reason
|
|
4626
|
-
});
|
|
4627
|
-
} else {
|
|
4628
|
-
outcomes = [];
|
|
4629
|
-
for (const { id, name, parameters, parsedParams, toolFn, isMcpTool } of resolvedTools) {
|
|
4521
|
+
const toolFn = options.tools?.find((tool) => tool.toolSchema.name === name)?.toolFn;
|
|
4522
|
+
if (id && name && toolFn) try {
|
|
4630
4523
|
this.logger.debug("Using tool:", name);
|
|
4631
4524
|
this.logger.debug("Tool arguments:", parameters);
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
});
|
|
4642
|
-
} catch (error) {
|
|
4643
|
-
if (error instanceof PermissionDeniedError) throw error;
|
|
4644
|
-
this.logger.updateMetadata({
|
|
4645
|
-
tool: name,
|
|
4646
|
-
parameters
|
|
4525
|
+
const result = await toolFn(JSON.parse(parameters));
|
|
4526
|
+
this.logger.debug(`[Tool Result] Tool executed for ${name}:`, result.toString().substring(0, 200) + "...");
|
|
4527
|
+
await handleToolResultStreaming(name, result, async (results) => {
|
|
4528
|
+
anyArtifactWasStreamed = true;
|
|
4529
|
+
await callback(results, {
|
|
4530
|
+
inputTokens,
|
|
4531
|
+
outputTokens,
|
|
4532
|
+
toolsUsed: toolsUsed.length > 0 ? toolsUsed : void 0,
|
|
4533
|
+
cacheStats
|
|
4647
4534
|
});
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
ok: false,
|
|
4652
|
-
id,
|
|
4653
|
-
name,
|
|
4654
|
-
parameters,
|
|
4655
|
-
error
|
|
4656
|
-
});
|
|
4657
|
-
}
|
|
4658
|
-
}
|
|
4659
|
-
}
|
|
4660
|
-
for (const outcome of outcomes) if (!outcome.ok && outcome.error instanceof PermissionDeniedError) throw outcome.error;
|
|
4661
|
-
let anyArtifactWasStreamed = false;
|
|
4662
|
-
const anyMcpTool = resolvedTools.some((t) => t.isMcpTool);
|
|
4663
|
-
for (const outcome of outcomes) {
|
|
4664
|
-
if (!outcome.ok) {
|
|
4535
|
+
});
|
|
4536
|
+
const resultStr = result.toString();
|
|
4537
|
+
const sanitizedResult = anyArtifactWasStreamed ? resultStr.replace(/<artifact(?:\s[^>]*)?>[\s\S]*?<\/artifact>/gi, "[Artifact rendered and delivered to user]") : resultStr;
|
|
4665
4538
|
this.pushToolMessages(messages, {
|
|
4666
|
-
id
|
|
4667
|
-
name
|
|
4668
|
-
parameters
|
|
4669
|
-
},
|
|
4539
|
+
id,
|
|
4540
|
+
name,
|
|
4541
|
+
parameters
|
|
4542
|
+
}, sanitizedResult);
|
|
4543
|
+
} catch (error) {
|
|
4544
|
+
if (error instanceof PermissionDeniedError) throw error;
|
|
4545
|
+
this.logger.updateMetadata({
|
|
4546
|
+
tool: name,
|
|
4547
|
+
parameters
|
|
4548
|
+
});
|
|
4549
|
+
if (error instanceof SyntaxError && /JSON/.test(error.message)) this.logger.warn("JSON parse error processing tool parameters:", error);
|
|
4550
|
+
else this.logger.error("Error processing tool:", error);
|
|
4670
4551
|
continue;
|
|
4671
4552
|
}
|
|
4672
|
-
const resultStr = outcome.result.toString();
|
|
4673
|
-
this.logger.debug(`[Tool Result] Tool executed for ${outcome.name}:`, resultStr.substring(0, 200) + "...");
|
|
4674
|
-
let thisToolHadArtifact = false;
|
|
4675
|
-
await handleToolResultStreaming(outcome.name, outcome.result, async (results) => {
|
|
4676
|
-
thisToolHadArtifact = true;
|
|
4677
|
-
anyArtifactWasStreamed = true;
|
|
4678
|
-
await callback(results, {
|
|
4679
|
-
inputTokens,
|
|
4680
|
-
outputTokens,
|
|
4681
|
-
toolsUsed: toolsUsed.length > 0 ? toolsUsed : void 0,
|
|
4682
|
-
cacheStats
|
|
4683
|
-
});
|
|
4684
|
-
});
|
|
4685
|
-
const sanitizedResult = thisToolHadArtifact ? resultStr.replace(/<artifact(?:\s[^>]*)?>[\s\S]*?<\/artifact>/gi, "[Artifact rendered and delivered to user]") : resultStr;
|
|
4686
|
-
this.pushToolMessages(messages, {
|
|
4687
|
-
id: outcome.id,
|
|
4688
|
-
name: outcome.name,
|
|
4689
|
-
parameters: outcome.parameters
|
|
4690
|
-
}, sanitizedResult);
|
|
4691
4553
|
}
|
|
4692
4554
|
if (anyArtifactWasStreamed) {
|
|
4693
4555
|
let recursiveBuffer = "";
|
|
@@ -4697,7 +4559,6 @@ var OpenAIBackend = class {
|
|
|
4697
4559
|
};
|
|
4698
4560
|
await this.complete(model, messages, {
|
|
4699
4561
|
...options,
|
|
4700
|
-
tools: anyMcpTool ? options.tools : void 0,
|
|
4701
4562
|
_internal: {
|
|
4702
4563
|
...options._internal,
|
|
4703
4564
|
toolCallCount: toolCallCount + 1
|
|
@@ -4710,7 +4571,6 @@ var OpenAIBackend = class {
|
|
|
4710
4571
|
if (cleaned) await callback([cleaned], recursiveMeta);
|
|
4711
4572
|
} else await this.complete(model, messages, {
|
|
4712
4573
|
...options,
|
|
4713
|
-
tools: anyMcpTool ? options.tools : void 0,
|
|
4714
4574
|
_internal: {
|
|
4715
4575
|
...options._internal,
|
|
4716
4576
|
toolCallCount: toolCallCount + 1
|
|
@@ -4,7 +4,7 @@ import { homedir } from "os";
|
|
|
4
4
|
import path from "path";
|
|
5
5
|
import axios from "axios";
|
|
6
6
|
//#region package.json
|
|
7
|
-
var version = "0.2.74
|
|
7
|
+
var version = "0.2.74";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/utils/updateChecker.ts
|
|
10
10
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.2.74
|
|
3
|
+
"version": "0.2.74",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -115,11 +115,11 @@
|
|
|
115
115
|
"zustand": "^4.5.4"
|
|
116
116
|
},
|
|
117
117
|
"devDependencies": {
|
|
118
|
-
"@bike4mind/agents": "0.4.11
|
|
119
|
-
"@bike4mind/common": "2.
|
|
120
|
-
"@bike4mind/mcp": "1.33.30
|
|
121
|
-
"@bike4mind/services": "2.73.1
|
|
122
|
-
"@bike4mind/utils": "2.16.12
|
|
118
|
+
"@bike4mind/agents": "0.4.11",
|
|
119
|
+
"@bike4mind/common": "2.82.0",
|
|
120
|
+
"@bike4mind/mcp": "1.33.30",
|
|
121
|
+
"@bike4mind/services": "2.73.1",
|
|
122
|
+
"@bike4mind/utils": "2.16.12",
|
|
123
123
|
"@types/better-sqlite3": "^7.6.13",
|
|
124
124
|
"@types/jsonwebtoken": "^9.0.4",
|
|
125
125
|
"@types/node": "^22.9.0",
|
|
@@ -136,5 +136,5 @@
|
|
|
136
136
|
"optionalDependencies": {
|
|
137
137
|
"@vscode/ripgrep": "^1.17.1"
|
|
138
138
|
},
|
|
139
|
-
"gitHead": "
|
|
139
|
+
"gitHead": "b527d82c033e659d0c4857f34e2bbf6870f271a4"
|
|
140
140
|
}
|