@bike4mind/cli 0.1.3 → 0.1.5-feat-automate-cli-publishing.16903
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/README.md +58 -1
- package/bin/bike4mind-cli.mjs +21 -0
- package/dist/{artifactExtractor-QN34RFDM.js → artifactExtractor-Y5UYA5XK.js} +1 -1
- package/dist/{chunk-B3YFSFVU.js → chunk-G2XBD676.js} +262 -204
- package/dist/{chunk-MKO2KCCS.js → chunk-PG4BD2XZ.js} +51 -1
- package/dist/{chunk-TPSQ5MIR.js → chunk-PMPXEVZQ.js} +2 -2
- package/dist/{chunk-KZGZGNHL.js → chunk-PYV7BIVP.js} +2 -2
- package/dist/{chunk-XANFVWI6.js → chunk-ZJBAQHHQ.js} +2 -2
- package/dist/{create-DGRMWHIN.js → create-2BDFUWVK.js} +3 -3
- package/dist/index.js +2163 -259
- package/dist/{llmMarkdownGenerator-JBDLN44A.js → llmMarkdownGenerator-SPSSOLJI.js} +1 -1
- package/dist/{markdownGenerator-MM5N3H5I.js → markdownGenerator-ZBS2ID6T.js} +1 -1
- package/dist/{mementoService-23ROW7I4.js → mementoService-RHDGBSB3.js} +3 -3
- package/dist/{src-K5MFQICX.js → src-3SNCFJQX.js} +2 -2
- package/dist/{src-OVEHYUVN.js → src-FPGIEUD3.js} +1 -1
- package/dist/{subtractCredits-YAWCGKMX.js → subtractCredits-D7M2BCM2.js} +3 -3
- package/package.json +11 -7
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
dayjsConfig_default,
|
|
17
17
|
extractSnippetMeta,
|
|
18
18
|
settingsMap
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-PG4BD2XZ.js";
|
|
20
20
|
|
|
21
21
|
// ../../b4m-core/packages/utils/dist/src/storage/S3Storage.js
|
|
22
22
|
import { S3Client, PutObjectCommand, DeleteObjectCommand, GetObjectCommand, HeadObjectCommand } from "@aws-sdk/client-s3";
|
|
@@ -1051,19 +1051,29 @@ var BaseBedrockBackend = class {
|
|
|
1051
1051
|
}
|
|
1052
1052
|
if (func.some((f) => f.name)) {
|
|
1053
1053
|
for await (const tool of func) {
|
|
1054
|
-
const {
|
|
1055
|
-
|
|
1056
|
-
if (id && name && parameters && toolFn) {
|
|
1057
|
-
const result = await toolFn(JSON.parse(parameters));
|
|
1054
|
+
const { name, parameters } = tool;
|
|
1055
|
+
if (name && parameters) {
|
|
1058
1056
|
toolsUsed.push({ name, arguments: parameters });
|
|
1059
|
-
await handleToolResultStreaming(name, result, async (results) => {
|
|
1060
|
-
await callback(results, { inputTokens, outputTokens, toolsUsed });
|
|
1061
|
-
});
|
|
1062
|
-
this.pushToolMessages(messages, { id, name, parameters }, result);
|
|
1063
1057
|
}
|
|
1064
1058
|
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1059
|
+
if (options.executeTools !== false) {
|
|
1060
|
+
for await (const tool of func) {
|
|
1061
|
+
const { id, name, parameters } = tool;
|
|
1062
|
+
const toolFn = options.tools?.find((tool2) => tool2.toolSchema.name === name)?.toolFn;
|
|
1063
|
+
if (id && name && parameters && toolFn) {
|
|
1064
|
+
const result = await toolFn(JSON.parse(parameters));
|
|
1065
|
+
await handleToolResultStreaming(name, result, async (results) => {
|
|
1066
|
+
await callback(results, { inputTokens, outputTokens, toolsUsed });
|
|
1067
|
+
});
|
|
1068
|
+
this.pushToolMessages(messages, { id, name, parameters }, result);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
await callback(["\n\n"], { inputTokens, outputTokens, toolsUsed });
|
|
1072
|
+
await this.complete(model, messages, { ...options, thinking: { enabled: false, budget_tokens: 0 } }, callback, toolsUsed);
|
|
1073
|
+
} else {
|
|
1074
|
+
console.log("[BaseBedrockBackend] executeTools=false, passing tool calls to callback");
|
|
1075
|
+
await callback([null], { inputTokens, outputTokens, toolsUsed });
|
|
1076
|
+
}
|
|
1067
1077
|
return;
|
|
1068
1078
|
}
|
|
1069
1079
|
} else {
|
|
@@ -1084,16 +1094,24 @@ var BaseBedrockBackend = class {
|
|
|
1084
1094
|
const toolChoice = chunk?.choices.find((choice) => choice.statusEndReason === ChoiceEndReason.TOOL_USE);
|
|
1085
1095
|
if (toolChoice?.tool) {
|
|
1086
1096
|
const { id, name, parameters } = toolChoice.tool;
|
|
1087
|
-
|
|
1088
|
-
if (id && name && parameters && toolFn) {
|
|
1089
|
-
const result = await toolFn(JSON.parse(parameters));
|
|
1097
|
+
if (name && parameters) {
|
|
1090
1098
|
toolsUsed.push({ name, arguments: parameters });
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1099
|
+
}
|
|
1100
|
+
if (options.executeTools !== false) {
|
|
1101
|
+
const toolFn = options.tools?.find((tool) => tool.toolSchema.name === name)?.toolFn;
|
|
1102
|
+
if (id && name && parameters && toolFn) {
|
|
1103
|
+
const result = await toolFn(JSON.parse(parameters));
|
|
1104
|
+
await handleToolResultStreaming(name, result, async (results) => {
|
|
1105
|
+
await callback(results, { inputTokens, outputTokens, toolsUsed });
|
|
1106
|
+
});
|
|
1107
|
+
this.pushToolMessages(messages, { id, name, parameters }, result);
|
|
1108
|
+
await callback(["\n\n"], { inputTokens, outputTokens, toolsUsed });
|
|
1109
|
+
await this.complete(model, messages, { ...options, thinking: { enabled: false, budget_tokens: 0 } }, callback, toolsUsed);
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
} else {
|
|
1113
|
+
console.log("[BaseBedrockBackend] executeTools=false, passing tool calls to callback");
|
|
1114
|
+
await callback([null], { inputTokens, outputTokens, toolsUsed });
|
|
1097
1115
|
return;
|
|
1098
1116
|
}
|
|
1099
1117
|
}
|
|
@@ -3007,58 +3025,63 @@ var GeminiBackend = class {
|
|
|
3007
3025
|
}
|
|
3008
3026
|
if (toolCalls.length > 0 && options.tools?.length) {
|
|
3009
3027
|
console.log("[DEBUG] Gemini executing tools immediately:", toolCalls.map((tc) => tc.name));
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
const
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
await
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3028
|
+
if (options.executeTools !== false) {
|
|
3029
|
+
const assistantMessage = {
|
|
3030
|
+
role: "assistant",
|
|
3031
|
+
content: toolCalls.map((toolCall, index) => ({
|
|
3032
|
+
type: "tool_use",
|
|
3033
|
+
id: toolCall.id,
|
|
3034
|
+
name: toolCall.name,
|
|
3035
|
+
input: toolCall.parameters,
|
|
3036
|
+
// Only first tool call gets thought_signature (Gemini 3 requirement for parallel calls)
|
|
3037
|
+
thought_signature: index === 0 ? toolCall.thought_signature : void 0
|
|
3038
|
+
}))
|
|
3039
|
+
};
|
|
3040
|
+
messages.push(assistantMessage);
|
|
3041
|
+
for (const toolCall of toolCalls) {
|
|
3042
|
+
const toolFn = options.tools.find((tool) => tool.toolSchema.name === toolCall.name)?.toolFn;
|
|
3043
|
+
if (!toolFn) {
|
|
3044
|
+
console.warn(`[WARN] Tool ${toolCall.name} not found`);
|
|
3045
|
+
continue;
|
|
3046
|
+
}
|
|
3047
|
+
try {
|
|
3048
|
+
const result2 = await toolFn(toolCall.parameters);
|
|
3049
|
+
await handleToolResultStreaming(toolCall.name, result2, async (results) => {
|
|
3050
|
+
await callback(results, { toolsUsed });
|
|
3051
|
+
});
|
|
3052
|
+
messages.push({
|
|
3053
|
+
role: "tool",
|
|
3054
|
+
content: [
|
|
3055
|
+
{
|
|
3056
|
+
type: "tool_result",
|
|
3057
|
+
content: JSON.stringify({ result: result2 }),
|
|
3058
|
+
tool_use_id: toolCall.id
|
|
3059
|
+
}
|
|
3060
|
+
]
|
|
3061
|
+
});
|
|
3062
|
+
} catch (error) {
|
|
3063
|
+
if (error instanceof PermissionDeniedError) {
|
|
3064
|
+
throw error;
|
|
3065
|
+
}
|
|
3066
|
+
console.error(`[ERROR] Error executing tool ${toolCall.name}:`, error);
|
|
3067
|
+
messages.push({
|
|
3068
|
+
role: "tool",
|
|
3069
|
+
content: [
|
|
3070
|
+
{
|
|
3071
|
+
type: "tool_result",
|
|
3072
|
+
content: JSON.stringify({ error: error instanceof Error ? error.message : "Unknown error" }),
|
|
3073
|
+
tool_use_id: toolCall.id
|
|
3074
|
+
}
|
|
3075
|
+
]
|
|
3076
|
+
});
|
|
3046
3077
|
}
|
|
3047
|
-
console.error(`[ERROR] Error executing tool ${toolCall.name}:`, error);
|
|
3048
|
-
messages.push({
|
|
3049
|
-
role: "tool",
|
|
3050
|
-
content: [
|
|
3051
|
-
{
|
|
3052
|
-
type: "tool_result",
|
|
3053
|
-
content: JSON.stringify({ error: error instanceof Error ? error.message : "Unknown error" }),
|
|
3054
|
-
tool_use_id: toolCall.id
|
|
3055
|
-
}
|
|
3056
|
-
]
|
|
3057
|
-
});
|
|
3058
3078
|
}
|
|
3079
|
+
await callback(["\n\n"], { toolsUsed });
|
|
3080
|
+
await this.complete(modelName, messages, options, callback, toolsUsed);
|
|
3081
|
+
} else {
|
|
3082
|
+
console.log("[DEBUG] Gemini executeTools=false, passing tool calls to callback");
|
|
3083
|
+
await callback([null], { toolsUsed });
|
|
3059
3084
|
}
|
|
3060
|
-
await callback(["\n\n"], { toolsUsed });
|
|
3061
|
-
await this.complete(modelName, messages, options, callback, toolsUsed);
|
|
3062
3085
|
return;
|
|
3063
3086
|
}
|
|
3064
3087
|
} catch (error) {
|
|
@@ -3096,58 +3119,63 @@ var GeminiBackend = class {
|
|
|
3096
3119
|
}
|
|
3097
3120
|
if (!options.stream && toolCalls.length > 0 && options.tools?.length) {
|
|
3098
3121
|
console.log("[DEBUG] Gemini executing tools (non-streaming mode):", toolCalls.map((tc) => tc.name));
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
const
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
await
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3122
|
+
if (options.executeTools !== false) {
|
|
3123
|
+
const assistantMessage = {
|
|
3124
|
+
role: "assistant",
|
|
3125
|
+
content: toolCalls.map((toolCall, index) => ({
|
|
3126
|
+
type: "tool_use",
|
|
3127
|
+
id: toolCall.id,
|
|
3128
|
+
name: toolCall.name,
|
|
3129
|
+
input: toolCall.parameters,
|
|
3130
|
+
// Only first tool call gets thought_signature (Gemini 3 requirement for parallel calls)
|
|
3131
|
+
thought_signature: index === 0 ? toolCall.thought_signature : void 0
|
|
3132
|
+
}))
|
|
3133
|
+
};
|
|
3134
|
+
messages.push(assistantMessage);
|
|
3135
|
+
for (const toolCall of toolCalls) {
|
|
3136
|
+
const toolFn = options.tools.find((tool) => tool.toolSchema.name === toolCall.name)?.toolFn;
|
|
3137
|
+
if (!toolFn) {
|
|
3138
|
+
console.warn(`[WARN] Tool ${toolCall.name} not found`);
|
|
3139
|
+
continue;
|
|
3140
|
+
}
|
|
3141
|
+
try {
|
|
3142
|
+
const result = await toolFn(toolCall.parameters);
|
|
3143
|
+
await handleToolResultStreaming(toolCall.name, result, async (results) => {
|
|
3144
|
+
await callback(results, { toolsUsed });
|
|
3145
|
+
});
|
|
3146
|
+
messages.push({
|
|
3147
|
+
role: "tool",
|
|
3148
|
+
content: [
|
|
3149
|
+
{
|
|
3150
|
+
type: "tool_result",
|
|
3151
|
+
content: JSON.stringify({ result }),
|
|
3152
|
+
tool_use_id: toolCall.id
|
|
3153
|
+
}
|
|
3154
|
+
]
|
|
3155
|
+
});
|
|
3156
|
+
} catch (error) {
|
|
3157
|
+
if (error instanceof PermissionDeniedError) {
|
|
3158
|
+
throw error;
|
|
3159
|
+
}
|
|
3160
|
+
console.error(`[ERROR] Error executing tool ${toolCall.name}:`, error);
|
|
3161
|
+
messages.push({
|
|
3162
|
+
role: "tool",
|
|
3163
|
+
content: [
|
|
3164
|
+
{
|
|
3165
|
+
type: "tool_result",
|
|
3166
|
+
content: JSON.stringify({ error: error instanceof Error ? error.message : "Unknown error" }),
|
|
3167
|
+
tool_use_id: toolCall.id
|
|
3168
|
+
}
|
|
3169
|
+
]
|
|
3170
|
+
});
|
|
3135
3171
|
}
|
|
3136
|
-
console.error(`[ERROR] Error executing tool ${toolCall.name}:`, error);
|
|
3137
|
-
messages.push({
|
|
3138
|
-
role: "tool",
|
|
3139
|
-
content: [
|
|
3140
|
-
{
|
|
3141
|
-
type: "tool_result",
|
|
3142
|
-
content: JSON.stringify({ error: error instanceof Error ? error.message : "Unknown error" }),
|
|
3143
|
-
tool_use_id: toolCall.id
|
|
3144
|
-
}
|
|
3145
|
-
]
|
|
3146
|
-
});
|
|
3147
3172
|
}
|
|
3173
|
+
await callback(["\n\n"], { toolsUsed });
|
|
3174
|
+
await this.complete(modelName, messages, options, callback, toolsUsed);
|
|
3175
|
+
} else {
|
|
3176
|
+
console.log("[DEBUG] Gemini executeTools=false, passing tool calls to callback");
|
|
3177
|
+
await callback([null], { toolsUsed });
|
|
3148
3178
|
}
|
|
3149
|
-
await callback(["\n\n"], { toolsUsed });
|
|
3150
|
-
await this.complete(modelName, messages, options, callback, toolsUsed);
|
|
3151
3179
|
}
|
|
3152
3180
|
}
|
|
3153
3181
|
formatMessagesIntoGeminiContent(messages) {
|
|
@@ -4584,67 +4612,83 @@ var XAIBackend = class {
|
|
|
4584
4612
|
}
|
|
4585
4613
|
if (c.message.tool_calls && c.message.tool_calls.length > 0) {
|
|
4586
4614
|
for (const toolCall of c.message.tool_calls) {
|
|
4587
|
-
if (toolCall.type !== "function")
|
|
4615
|
+
if (toolCall.type !== "function")
|
|
4588
4616
|
continue;
|
|
4589
|
-
|
|
4590
|
-
const toolFn = options.tools?.find((tool) => tool.toolSchema.name === toolCall.function.name)?.toolFn;
|
|
4591
|
-
if (toolFn && toolCall.function.arguments) {
|
|
4617
|
+
if (toolCall.function.arguments) {
|
|
4592
4618
|
toolsUsed.push({
|
|
4593
4619
|
name: toolCall.function.name,
|
|
4594
4620
|
arguments: toolCall.function.arguments
|
|
4595
4621
|
});
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
}
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4622
|
+
}
|
|
4623
|
+
}
|
|
4624
|
+
if (options.executeTools !== false) {
|
|
4625
|
+
for (const toolCall of c.message.tool_calls) {
|
|
4626
|
+
if (toolCall.type !== "function") {
|
|
4627
|
+
continue;
|
|
4628
|
+
}
|
|
4629
|
+
const toolFn = options.tools?.find((tool) => tool.toolSchema.name === toolCall.function.name)?.toolFn;
|
|
4630
|
+
if (toolFn && toolCall.function.arguments) {
|
|
4631
|
+
try {
|
|
4632
|
+
const parsedParams = JSON.parse(toolCall.function.arguments);
|
|
4633
|
+
const result = await toolFn(parsedParams);
|
|
4634
|
+
this.pushToolMessages(messages, {
|
|
4635
|
+
id: toolCall.id,
|
|
4636
|
+
name: toolCall.function.name,
|
|
4637
|
+
parameters: toolCall.function.arguments
|
|
4638
|
+
}, result.toString());
|
|
4639
|
+
const isMcpTool = options.tools?.find((t) => t.toolSchema.name === toolCall.function.name)?._isMcpTool;
|
|
4640
|
+
if (isMcpTool) {
|
|
4641
|
+
await this.complete(model, messages, {
|
|
4642
|
+
...options,
|
|
4643
|
+
_internal: {
|
|
4644
|
+
toolCallCount: toolCallCount + 1
|
|
4645
|
+
}
|
|
4646
|
+
}, callback, toolsUsed);
|
|
4647
|
+
} else {
|
|
4648
|
+
await this.complete(model, messages, {
|
|
4649
|
+
...options,
|
|
4650
|
+
tools: void 0,
|
|
4651
|
+
_internal: void 0
|
|
4652
|
+
}, callback, toolsUsed);
|
|
4653
|
+
}
|
|
4654
|
+
return;
|
|
4655
|
+
} catch (error) {
|
|
4656
|
+
if (error instanceof PermissionDeniedError) {
|
|
4657
|
+
throw error;
|
|
4658
|
+
}
|
|
4659
|
+
console.warn(`Error processing ${toolCall.function.name} tool:`, error);
|
|
4660
|
+
this.pushToolMessages(messages, {
|
|
4661
|
+
id: toolCall.id,
|
|
4662
|
+
name: toolCall.function.name,
|
|
4663
|
+
parameters: toolCall.function.arguments
|
|
4664
|
+
}, `Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
4665
|
+
const isMcpToolError = options.tools?.find((t) => t.toolSchema.name === toolCall.function.name)?._isMcpTool;
|
|
4666
|
+
if (isMcpToolError) {
|
|
4667
|
+
await this.complete(model, messages, {
|
|
4668
|
+
...options,
|
|
4669
|
+
_internal: {
|
|
4670
|
+
toolCallCount: toolCallCount + 1
|
|
4671
|
+
}
|
|
4672
|
+
}, callback, toolsUsed);
|
|
4673
|
+
} else {
|
|
4674
|
+
await this.complete(model, messages, {
|
|
4675
|
+
...options,
|
|
4676
|
+
tools: void 0,
|
|
4677
|
+
_internal: void 0
|
|
4678
|
+
}, callback, toolsUsed);
|
|
4679
|
+
}
|
|
4680
|
+
return;
|
|
4644
4681
|
}
|
|
4645
|
-
return;
|
|
4646
4682
|
}
|
|
4647
4683
|
}
|
|
4684
|
+
} else {
|
|
4685
|
+
this.logger.debug(`[Tool Execution] executeTools=false, passing tool calls to callback`);
|
|
4686
|
+
await callback([null], {
|
|
4687
|
+
inputTokens: 0,
|
|
4688
|
+
outputTokens: 0,
|
|
4689
|
+
toolsUsed: toolsUsed.length > 0 ? toolsUsed : void 0
|
|
4690
|
+
});
|
|
4691
|
+
return;
|
|
4648
4692
|
}
|
|
4649
4693
|
} else {
|
|
4650
4694
|
streamedText[c.index] = c.message.content || "";
|
|
@@ -4700,43 +4744,57 @@ var XAIBackend = class {
|
|
|
4700
4744
|
}
|
|
4701
4745
|
if (func.length > 0) {
|
|
4702
4746
|
for await (const tool of func) {
|
|
4703
|
-
const {
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4747
|
+
const { name, parameters: parameters2 } = tool;
|
|
4748
|
+
if (name && parameters2) {
|
|
4749
|
+
toolsUsed.push({
|
|
4750
|
+
name,
|
|
4751
|
+
arguments: parameters2
|
|
4752
|
+
});
|
|
4753
|
+
}
|
|
4754
|
+
}
|
|
4755
|
+
if (options.executeTools !== false) {
|
|
4756
|
+
for await (const tool of func) {
|
|
4757
|
+
const { id, name, parameters: parameters2 } = tool;
|
|
4758
|
+
const toolFn = options.tools?.find((tool2) => tool2.toolSchema.name === name)?.toolFn;
|
|
4759
|
+
if (id && name && parameters2 && toolFn) {
|
|
4760
|
+
try {
|
|
4761
|
+
const result = await toolFn(JSON.parse(parameters2));
|
|
4762
|
+
this.pushToolMessages(messages, {
|
|
4763
|
+
id,
|
|
4764
|
+
name,
|
|
4765
|
+
parameters: parameters2
|
|
4766
|
+
}, result);
|
|
4767
|
+
} catch (error) {
|
|
4768
|
+
if (error instanceof PermissionDeniedError) {
|
|
4769
|
+
throw error;
|
|
4770
|
+
}
|
|
4771
|
+
this.logger.updateMetadata({
|
|
4772
|
+
tool: name,
|
|
4773
|
+
parameters: parameters2
|
|
4774
|
+
});
|
|
4775
|
+
if (error instanceof SyntaxError && /JSON/.test(error.message)) {
|
|
4776
|
+
this.logger.warn("JSON parse error processing tool parameters:", error);
|
|
4777
|
+
} else {
|
|
4778
|
+
this.logger.error("Error processing tool:", error);
|
|
4779
|
+
}
|
|
4780
|
+
this.pushToolMessages(messages, {
|
|
4781
|
+
id,
|
|
4782
|
+
name,
|
|
4783
|
+
parameters: parameters2
|
|
4784
|
+
}, `Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
4785
|
+
continue;
|
|
4729
4786
|
}
|
|
4730
|
-
this.pushToolMessages(messages, {
|
|
4731
|
-
id,
|
|
4732
|
-
name,
|
|
4733
|
-
parameters: parameters2
|
|
4734
|
-
}, `Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
4735
|
-
continue;
|
|
4736
4787
|
}
|
|
4737
4788
|
}
|
|
4789
|
+
await this.complete(model, messages, { ...options, tools: options.tools }, callback, toolsUsed);
|
|
4790
|
+
} else {
|
|
4791
|
+
this.logger.debug(`[Tool Execution] executeTools=false, passing tool calls to callback`);
|
|
4792
|
+
await callback([null], {
|
|
4793
|
+
inputTokens,
|
|
4794
|
+
outputTokens,
|
|
4795
|
+
toolsUsed: toolsUsed.length > 0 ? toolsUsed : void 0
|
|
4796
|
+
});
|
|
4738
4797
|
}
|
|
4739
|
-
await this.complete(model, messages, { ...options, tools: options.tools }, callback, toolsUsed);
|
|
4740
4798
|
}
|
|
4741
4799
|
}
|
|
4742
4800
|
formatMessages(messages) {
|
|
@@ -219,6 +219,12 @@ var b4mLLMTools = z3.enum([
|
|
|
219
219
|
"blog_publish",
|
|
220
220
|
"blog_edit",
|
|
221
221
|
"blog_draft",
|
|
222
|
+
// Time Machine & Night Sky tools
|
|
223
|
+
"wikipedia_on_this_day",
|
|
224
|
+
"moon_phase",
|
|
225
|
+
"sunrise_sunset",
|
|
226
|
+
"iss_tracker",
|
|
227
|
+
"planet_visibility",
|
|
222
228
|
// File operation tools
|
|
223
229
|
"file_read",
|
|
224
230
|
"create_file",
|
|
@@ -2091,7 +2097,11 @@ var SettingKeySchema = z19.enum([
|
|
|
2091
2097
|
"whatsNewAutomationEnabled",
|
|
2092
2098
|
"whatsNewConfig",
|
|
2093
2099
|
// AGENT PROACTIVE MESSAGING SETTINGS
|
|
2094
|
-
"enableAgentProactiveMessages"
|
|
2100
|
+
"enableAgentProactiveMessages",
|
|
2101
|
+
// TIME MACHINE & NIGHT SKY SETTINGS
|
|
2102
|
+
"EnableEnhancedDateTime",
|
|
2103
|
+
"EnableHistoricalFeatures",
|
|
2104
|
+
"EnableAstronomyFeatures"
|
|
2095
2105
|
]);
|
|
2096
2106
|
var CategoryOrder = [
|
|
2097
2107
|
"AI",
|
|
@@ -2555,6 +2565,17 @@ var API_SERVICE_GROUPS = {
|
|
|
2555
2565
|
description: "PDF.js Express Viewer settings",
|
|
2556
2566
|
icon: "PictureAsPdf",
|
|
2557
2567
|
settings: [{ key: "pdfjsExpressViewerKey", order: 1 }]
|
|
2568
|
+
},
|
|
2569
|
+
DATETIME_ASTRONOMY: {
|
|
2570
|
+
id: "datetimeAstronomyService",
|
|
2571
|
+
name: "Time Machine & Night Sky",
|
|
2572
|
+
description: "Enhanced datetime, historical events, and astronomical tools",
|
|
2573
|
+
icon: "NightsStay",
|
|
2574
|
+
settings: [
|
|
2575
|
+
{ key: "EnableEnhancedDateTime", order: 1 },
|
|
2576
|
+
{ key: "EnableHistoricalFeatures", order: 2 },
|
|
2577
|
+
{ key: "EnableAstronomyFeatures", order: 3 }
|
|
2578
|
+
]
|
|
2558
2579
|
}
|
|
2559
2580
|
};
|
|
2560
2581
|
var settingsMap = {
|
|
@@ -3494,6 +3515,34 @@ var settingsMap = {
|
|
|
3494
3515
|
category: "Experimental",
|
|
3495
3516
|
group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
|
|
3496
3517
|
order: 6
|
|
3518
|
+
}),
|
|
3519
|
+
// Time Machine & Night Sky Settings
|
|
3520
|
+
EnableEnhancedDateTime: makeBooleanSetting({
|
|
3521
|
+
key: "EnableEnhancedDateTime",
|
|
3522
|
+
name: "Enable Enhanced DateTime",
|
|
3523
|
+
defaultValue: true,
|
|
3524
|
+
description: "Enable advanced datetime features: Unix timestamps, Julian days, date calculations, historical day lookups.",
|
|
3525
|
+
category: "Tools",
|
|
3526
|
+
group: API_SERVICE_GROUPS.DATETIME_ASTRONOMY.id,
|
|
3527
|
+
order: 1
|
|
3528
|
+
}),
|
|
3529
|
+
EnableHistoricalFeatures: makeBooleanSetting({
|
|
3530
|
+
key: "EnableHistoricalFeatures",
|
|
3531
|
+
name: "Enable Historical Features",
|
|
3532
|
+
defaultValue: true,
|
|
3533
|
+
description: 'Enable Wikipedia "On This Day" tool for historical events, births, deaths, and holidays.',
|
|
3534
|
+
category: "Tools",
|
|
3535
|
+
group: API_SERVICE_GROUPS.DATETIME_ASTRONOMY.id,
|
|
3536
|
+
order: 2
|
|
3537
|
+
}),
|
|
3538
|
+
EnableAstronomyFeatures: makeBooleanSetting({
|
|
3539
|
+
key: "EnableAstronomyFeatures",
|
|
3540
|
+
name: "Enable Astronomy Features",
|
|
3541
|
+
defaultValue: true,
|
|
3542
|
+
description: "Enable astronomy tools: moon phases, sunrise/sunset calculations, and ISS tracking.",
|
|
3543
|
+
category: "Tools",
|
|
3544
|
+
group: API_SERVICE_GROUPS.DATETIME_ASTRONOMY.id,
|
|
3545
|
+
order: 3
|
|
3497
3546
|
})
|
|
3498
3547
|
// Add more settings as needed
|
|
3499
3548
|
};
|
|
@@ -3770,6 +3819,7 @@ var AuthEvents;
|
|
|
3770
3819
|
AuthEvents2["RESET_LAND_PASSWORD"] = "Password Reset Landed";
|
|
3771
3820
|
AuthEvents2["RESET_PASSWORD_TOKEN_EXPIRED"] = "Password Reset Token Expired";
|
|
3772
3821
|
AuthEvents2["CHANGE_PASSWORD"] = "Password Changed";
|
|
3822
|
+
AuthEvents2["FORCE_CHANGE_PASSWORD"] = "Forced Password Changed";
|
|
3773
3823
|
AuthEvents2["ADMIN_RESET_PASSWORD"] = "Admin Password Reset";
|
|
3774
3824
|
AuthEvents2["FAILED_LOGIN"] = "Failed Login Attempt";
|
|
3775
3825
|
AuthEvents2["EMAIL_VERIFIED"] = "Email Verified";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BadRequestError,
|
|
4
4
|
secureParameters
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-G2XBD676.js";
|
|
6
6
|
import {
|
|
7
7
|
GenericCreditDeductTransaction,
|
|
8
8
|
ImageEditUsageTransaction,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
RealtimeVoiceUsageTransaction,
|
|
11
11
|
TextGenerationUsageTransaction,
|
|
12
12
|
TransferCreditTransaction
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PG4BD2XZ.js";
|
|
14
14
|
|
|
15
15
|
// ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
|
|
16
16
|
import { z } from "zod";
|