@bike4mind/cli 0.2.21-feat-parallel-tool-execution.18205 → 0.2.21-feat-cli-skill-frontmatter-spec.18206
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/{artifactExtractor-Q3U32BGB.js → artifactExtractor-GANN5ZGT.js} +1 -1
- package/dist/{chunk-JDCBPT4Y.js → chunk-3NN5PD22.js} +2 -2
- package/dist/{chunk-HERXMXE5.js → chunk-4UPFBOWT.js} +2 -2
- package/dist/{chunk-QKJ4CHK6.js → chunk-HXWD4UGK.js} +1 -1
- package/dist/{chunk-YLRAYIDX.js → chunk-NAIQUTDD.js} +2 -2
- package/dist/{chunk-VDLQKG5O.js → chunk-QZAVSLFW.js} +2 -15
- package/dist/{create-BORKSAPA.js → create-EZHKFCZQ.js} +3 -3
- package/dist/index.js +1320 -1349
- package/dist/{llmMarkdownGenerator-G5UCCD47.js → llmMarkdownGenerator-L5I7ENTP.js} +1 -1
- package/dist/{markdownGenerator-LJS2P3UY.js → markdownGenerator-XVAVZGQA.js} +1 -1
- package/dist/{mementoService-K3XVUSAT.js → mementoService-C34LNDCN.js} +3 -3
- package/dist/{src-6OQGDGBO.js → src-2ENQ4HWZ.js} +2 -2
- package/dist/{src-GQEERNRB.js → src-J7E4QLQO.js} +1 -1
- package/dist/{subtractCredits-VXQRRSZG.js → subtractCredits-5SDCKUXU.js} +3 -3
- package/package.json +6 -7
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
getEffectiveApiKey,
|
|
5
5
|
getOpenWeatherKey,
|
|
6
6
|
getSerperKey
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NAIQUTDD.js";
|
|
8
8
|
import {
|
|
9
9
|
ConfigStore
|
|
10
10
|
} from "./chunk-VFQF2JIT.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-4UPFBOWT.js";
|
|
12
|
+
import "./chunk-3NN5PD22.js";
|
|
13
13
|
import {
|
|
14
14
|
BFLImageService,
|
|
15
15
|
BaseStorage,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
OpenAIBackend,
|
|
22
22
|
OpenAIImageService,
|
|
23
23
|
XAIImageService
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-HXWD4UGK.js";
|
|
25
25
|
import {
|
|
26
26
|
AiEvents,
|
|
27
27
|
ApiKeyEvents,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
XAI_IMAGE_MODELS,
|
|
78
78
|
b4mLLMTools,
|
|
79
79
|
getMcpProviderMetadata
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-QZAVSLFW.js";
|
|
81
81
|
import {
|
|
82
82
|
Logger
|
|
83
83
|
} from "./chunk-OCYRD7D6.js";
|
|
@@ -2500,10 +2500,8 @@ import { z } from "zod";
|
|
|
2500
2500
|
var flexibleString = z.union([z.string(), z.array(z.string())]).transform((val) => Array.isArray(val) ? val.join(" ") : val).optional();
|
|
2501
2501
|
function needsQuoting(value) {
|
|
2502
2502
|
const firstChar = value.charAt(0);
|
|
2503
|
-
const
|
|
2504
|
-
|
|
2505
|
-
const containsColon = value.includes(":");
|
|
2506
|
-
return containsColon && !isAlreadyQuoted && !isStructured;
|
|
2503
|
+
const isProtected = firstChar === '"' || firstChar === "'" || firstChar === "[" || firstChar === "{";
|
|
2504
|
+
return value.includes(":") && !isProtected;
|
|
2507
2505
|
}
|
|
2508
2506
|
function preprocessFrontmatter(content) {
|
|
2509
2507
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
@@ -2525,29 +2523,66 @@ function preprocessFrontmatter(content) {
|
|
|
2525
2523
|
${processedFrontmatter}
|
|
2526
2524
|
---`);
|
|
2527
2525
|
}
|
|
2526
|
+
var HooksSchema = z.object({
|
|
2527
|
+
/** Script to run before skill execution */
|
|
2528
|
+
"pre-invoke": z.string().optional(),
|
|
2529
|
+
/** Script to run after successful skill execution */
|
|
2530
|
+
"post-invoke": z.string().optional(),
|
|
2531
|
+
/** Script to run when skill execution fails */
|
|
2532
|
+
"on-error": z.string().optional()
|
|
2533
|
+
}).optional();
|
|
2534
|
+
var AgentConfigSchema = z.union([
|
|
2535
|
+
z.string(),
|
|
2536
|
+
// Simple: "explore"
|
|
2537
|
+
z.object({
|
|
2538
|
+
// Complex config
|
|
2539
|
+
type: z.string(),
|
|
2540
|
+
// Agent type name
|
|
2541
|
+
thoroughness: z.enum(["quick", "medium", "very_thorough"]).optional(),
|
|
2542
|
+
config: z.record(z.any()).optional()
|
|
2543
|
+
// Additional agent-specific config
|
|
2544
|
+
})
|
|
2545
|
+
]);
|
|
2546
|
+
var VALID_MODELS = ["opus", "sonnet", "haiku"];
|
|
2528
2547
|
var FrontmatterSchema = z.object({
|
|
2548
|
+
// Display name for the skill (defaults to filename if not specified)
|
|
2549
|
+
name: z.string().optional(),
|
|
2529
2550
|
description: flexibleString,
|
|
2530
2551
|
"argument-hint": flexibleString,
|
|
2552
|
+
// Model override - validated against allowed values (opus, sonnet, haiku)
|
|
2531
2553
|
model: z.string().optional(),
|
|
2532
2554
|
// Agent integration fields
|
|
2533
|
-
agent:
|
|
2555
|
+
agent: AgentConfigSchema.optional(),
|
|
2534
2556
|
thoroughness: z.enum(["quick", "medium", "very_thorough"]).optional(),
|
|
2535
2557
|
variables: z.record(z.string()).optional(),
|
|
2536
|
-
//
|
|
2537
|
-
"allowed-tools": z.
|
|
2538
|
-
context:
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2558
|
+
// Tool filtering - restrict which tools are available during skill execution
|
|
2559
|
+
"allowed-tools": z.array(z.string()).optional(),
|
|
2560
|
+
// Execution context: 'inline' (default) runs in main context, 'fork' runs in subagent
|
|
2561
|
+
context: z.enum(["fork", "inline"]).default("inline"),
|
|
2562
|
+
// Visibility controls
|
|
2563
|
+
/** When true, skill is hidden from AI's auto-loading in system prompt */
|
|
2564
|
+
"disable-model-invocation": z.boolean().default(false),
|
|
2565
|
+
/** When false, skill is hidden from /commands menu but still callable */
|
|
2566
|
+
"user-invocable": z.boolean().default(true),
|
|
2567
|
+
// Lifecycle hooks
|
|
2568
|
+
hooks: HooksSchema
|
|
2569
|
+
});
|
|
2570
|
+
var DESCRIPTION_MAX_LENGTH = 100;
|
|
2571
|
+
var DEFAULT_DESCRIPTION = "Custom command";
|
|
2542
2572
|
function extractDescriptionFromBody(body) {
|
|
2543
2573
|
const lines = body.trim().split("\n");
|
|
2544
|
-
|
|
2545
|
-
const
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2574
|
+
const firstContentLine = lines.find((line) => {
|
|
2575
|
+
const trimmed2 = line.trim();
|
|
2576
|
+
return trimmed2 && !trimmed2.startsWith("#");
|
|
2577
|
+
});
|
|
2578
|
+
if (!firstContentLine) {
|
|
2579
|
+
return DEFAULT_DESCRIPTION;
|
|
2549
2580
|
}
|
|
2550
|
-
|
|
2581
|
+
const trimmed = firstContentLine.trim();
|
|
2582
|
+
if (trimmed.length <= DESCRIPTION_MAX_LENGTH) {
|
|
2583
|
+
return trimmed;
|
|
2584
|
+
}
|
|
2585
|
+
return trimmed.substring(0, DESCRIPTION_MAX_LENGTH - 3) + "...";
|
|
2551
2586
|
}
|
|
2552
2587
|
function parseCommandFile(fileContent, filePath, commandName, source) {
|
|
2553
2588
|
try {
|
|
@@ -2561,9 +2596,20 @@ function parseCommandFile(fileContent, filePath, commandName, source) {
|
|
|
2561
2596
|
);
|
|
2562
2597
|
}
|
|
2563
2598
|
const validFrontmatter = validationResult.success ? validationResult.data : {};
|
|
2564
|
-
const description = validFrontmatter.description || extractDescriptionFromBody(body)
|
|
2599
|
+
const description = validFrontmatter.description || extractDescriptionFromBody(body);
|
|
2600
|
+
if (validFrontmatter.model && !VALID_MODELS.includes(validFrontmatter.model)) {
|
|
2601
|
+
console.warn(
|
|
2602
|
+
`Warning: Invalid model "${validFrontmatter.model}" in ${filePath}. Valid values are: ${VALID_MODELS.join(", ")}`
|
|
2603
|
+
);
|
|
2604
|
+
}
|
|
2605
|
+
if (validFrontmatter.agent && validFrontmatter.context !== "fork") {
|
|
2606
|
+
console.warn(
|
|
2607
|
+
`Warning: Skill "${commandName}" has "agent" specified but "context" is not "fork". The agent field is only used when context is "fork". Consider adding "context: fork" to the frontmatter.`
|
|
2608
|
+
);
|
|
2609
|
+
}
|
|
2565
2610
|
return {
|
|
2566
2611
|
name: commandName,
|
|
2612
|
+
displayName: validFrontmatter.name,
|
|
2567
2613
|
description,
|
|
2568
2614
|
argumentHint: validFrontmatter["argument-hint"],
|
|
2569
2615
|
model: validFrontmatter.model,
|
|
@@ -2572,7 +2618,14 @@ function parseCommandFile(fileContent, filePath, commandName, source) {
|
|
|
2572
2618
|
filePath,
|
|
2573
2619
|
agent: validFrontmatter.agent,
|
|
2574
2620
|
thoroughness: validFrontmatter.thoroughness,
|
|
2575
|
-
variables: validFrontmatter.variables
|
|
2621
|
+
variables: validFrontmatter.variables,
|
|
2622
|
+
// New Claude Code spec fields
|
|
2623
|
+
allowedTools: validFrontmatter["allowed-tools"],
|
|
2624
|
+
context: validFrontmatter.context || "inline",
|
|
2625
|
+
disableModelInvocation: validFrontmatter["disable-model-invocation"] || false,
|
|
2626
|
+
userInvocable: validFrontmatter["user-invocable"] !== false,
|
|
2627
|
+
// Default true
|
|
2628
|
+
hooks: validFrontmatter.hooks
|
|
2576
2629
|
};
|
|
2577
2630
|
} catch (error) {
|
|
2578
2631
|
throw new Error(
|
|
@@ -2580,12 +2633,9 @@ function parseCommandFile(fileContent, filePath, commandName, source) {
|
|
|
2580
2633
|
);
|
|
2581
2634
|
}
|
|
2582
2635
|
}
|
|
2636
|
+
var COMMAND_NAME_PATTERN = /^[a-z0-9-_:]+$/i;
|
|
2583
2637
|
function isValidCommandName(name) {
|
|
2584
|
-
|
|
2585
|
-
return false;
|
|
2586
|
-
}
|
|
2587
|
-
const validPattern = /^[a-z0-9-_:]+$/i;
|
|
2588
|
-
return validPattern.test(name);
|
|
2638
|
+
return Boolean(name) && COMMAND_NAME_PATTERN.test(name);
|
|
2589
2639
|
}
|
|
2590
2640
|
function extractCommandName(filename) {
|
|
2591
2641
|
if (!filename.endsWith(".md")) {
|
|
@@ -2803,127 +2853,6 @@ You can use:
|
|
|
2803
2853
|
|
|
2804
2854
|
// ../../b4m-core/packages/agents/src/ReActAgent.ts
|
|
2805
2855
|
import { EventEmitter } from "events";
|
|
2806
|
-
|
|
2807
|
-
// ../../b4m-core/packages/agents/src/toolParallelizer.ts
|
|
2808
|
-
var DEFAULT_WRITE_TOOLS = /* @__PURE__ */ new Set([
|
|
2809
|
-
"edit_file",
|
|
2810
|
-
"edit_local_file",
|
|
2811
|
-
"create_file",
|
|
2812
|
-
"delete_file",
|
|
2813
|
-
"shell_execute",
|
|
2814
|
-
"bash_execute",
|
|
2815
|
-
"git_commit",
|
|
2816
|
-
"git_push"
|
|
2817
|
-
]);
|
|
2818
|
-
function defaultIsReadOnlyTool(toolName) {
|
|
2819
|
-
return !DEFAULT_WRITE_TOOLS.has(toolName);
|
|
2820
|
-
}
|
|
2821
|
-
function getToolId(tool) {
|
|
2822
|
-
return `${tool.name}_${JSON.stringify(tool.arguments)}`;
|
|
2823
|
-
}
|
|
2824
|
-
function categorizeTools(toolsUsed, isReadOnly = defaultIsReadOnlyTool) {
|
|
2825
|
-
const parallelBatch = [];
|
|
2826
|
-
const sequentialBatch = [];
|
|
2827
|
-
const originalOrder = [];
|
|
2828
|
-
for (const tool of toolsUsed) {
|
|
2829
|
-
originalOrder.push(getToolId(tool));
|
|
2830
|
-
if (isReadOnly(tool.name)) {
|
|
2831
|
-
parallelBatch.push(tool);
|
|
2832
|
-
} else {
|
|
2833
|
-
sequentialBatch.push(tool);
|
|
2834
|
-
}
|
|
2835
|
-
}
|
|
2836
|
-
return {
|
|
2837
|
-
parallelBatch,
|
|
2838
|
-
sequentialBatch,
|
|
2839
|
-
originalOrder
|
|
2840
|
-
};
|
|
2841
|
-
}
|
|
2842
|
-
async function executeToolsInParallel(plan, executor, signal) {
|
|
2843
|
-
const results = /* @__PURE__ */ new Map();
|
|
2844
|
-
if (signal?.aborted) {
|
|
2845
|
-
throw new Error("Tool execution aborted");
|
|
2846
|
-
}
|
|
2847
|
-
if (plan.parallelBatch.length > 0) {
|
|
2848
|
-
const parallelPromises = plan.parallelBatch.map(async (tool) => {
|
|
2849
|
-
const toolId = getToolId(tool);
|
|
2850
|
-
if (signal?.aborted) {
|
|
2851
|
-
return {
|
|
2852
|
-
toolId,
|
|
2853
|
-
result: {
|
|
2854
|
-
toolName: tool.name,
|
|
2855
|
-
error: new Error("Tool execution aborted"),
|
|
2856
|
-
status: "rejected"
|
|
2857
|
-
}
|
|
2858
|
-
};
|
|
2859
|
-
}
|
|
2860
|
-
try {
|
|
2861
|
-
const result = await executor(tool);
|
|
2862
|
-
return {
|
|
2863
|
-
toolId,
|
|
2864
|
-
result: {
|
|
2865
|
-
toolName: tool.name,
|
|
2866
|
-
result,
|
|
2867
|
-
status: "fulfilled"
|
|
2868
|
-
}
|
|
2869
|
-
};
|
|
2870
|
-
} catch (error) {
|
|
2871
|
-
return {
|
|
2872
|
-
toolId,
|
|
2873
|
-
result: {
|
|
2874
|
-
toolName: tool.name,
|
|
2875
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
2876
|
-
status: "rejected"
|
|
2877
|
-
}
|
|
2878
|
-
};
|
|
2879
|
-
}
|
|
2880
|
-
});
|
|
2881
|
-
const settledResults = await Promise.allSettled(parallelPromises);
|
|
2882
|
-
for (const settled of settledResults) {
|
|
2883
|
-
if (settled.status === "fulfilled") {
|
|
2884
|
-
results.set(settled.value.toolId, settled.value.result);
|
|
2885
|
-
}
|
|
2886
|
-
}
|
|
2887
|
-
}
|
|
2888
|
-
if (signal?.aborted) {
|
|
2889
|
-
throw new Error("Tool execution aborted");
|
|
2890
|
-
}
|
|
2891
|
-
for (const tool of plan.sequentialBatch) {
|
|
2892
|
-
const toolId = getToolId(tool);
|
|
2893
|
-
if (signal?.aborted) {
|
|
2894
|
-
results.set(toolId, {
|
|
2895
|
-
toolName: tool.name,
|
|
2896
|
-
error: new Error("Tool execution aborted"),
|
|
2897
|
-
status: "rejected"
|
|
2898
|
-
});
|
|
2899
|
-
throw new Error("Tool execution aborted");
|
|
2900
|
-
}
|
|
2901
|
-
try {
|
|
2902
|
-
const result = await executor(tool);
|
|
2903
|
-
results.set(toolId, {
|
|
2904
|
-
toolName: tool.name,
|
|
2905
|
-
result,
|
|
2906
|
-
status: "fulfilled"
|
|
2907
|
-
});
|
|
2908
|
-
} catch (error) {
|
|
2909
|
-
results.set(toolId, {
|
|
2910
|
-
toolName: tool.name,
|
|
2911
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
2912
|
-
status: "rejected"
|
|
2913
|
-
});
|
|
2914
|
-
}
|
|
2915
|
-
}
|
|
2916
|
-
return results;
|
|
2917
|
-
}
|
|
2918
|
-
function shouldUseParallelExecution(toolsUsed, isReadOnly = defaultIsReadOnlyTool) {
|
|
2919
|
-
if (toolsUsed.length < 2) {
|
|
2920
|
-
return false;
|
|
2921
|
-
}
|
|
2922
|
-
const readOnlyCount = toolsUsed.filter((tool) => isReadOnly(tool.name)).length;
|
|
2923
|
-
return readOnlyCount >= 2;
|
|
2924
|
-
}
|
|
2925
|
-
|
|
2926
|
-
// ../../b4m-core/packages/agents/src/ReActAgent.ts
|
|
2927
2856
|
var ReActAgent = class extends EventEmitter {
|
|
2928
2857
|
constructor(context) {
|
|
2929
2858
|
super();
|
|
@@ -3051,51 +2980,77 @@ ${options.context}` : this.getSystemPrompt()
|
|
|
3051
2980
|
if (completionInfo.toolsUsed && completionInfo.toolsUsed.length > 0) {
|
|
3052
2981
|
hadToolCalls = true;
|
|
3053
2982
|
const thinkingBlocks = completionInfo.thinking || [];
|
|
3054
|
-
const unprocessedTools = [];
|
|
3055
2983
|
for (const toolUse of completionInfo.toolsUsed) {
|
|
3056
|
-
const
|
|
3057
|
-
if (
|
|
3058
|
-
|
|
3059
|
-
unprocessedTools.push(toolUse);
|
|
2984
|
+
const toolCallId = `${toolUse.name}_${JSON.stringify(toolUse.arguments)}`;
|
|
2985
|
+
if (processedToolIds.has(toolCallId)) {
|
|
2986
|
+
continue;
|
|
3060
2987
|
}
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
`
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
const plan = categorizeTools(unprocessedTools, options.isReadOnlyTool ?? defaultIsReadOnlyTool);
|
|
3071
|
-
const results = await executeToolsInParallel(
|
|
3072
|
-
plan,
|
|
3073
|
-
(toolUse) => this.executeToolWithQueueFallback(toolUse),
|
|
3074
|
-
options.signal
|
|
3075
|
-
);
|
|
3076
|
-
for (const toolUse of unprocessedTools) {
|
|
3077
|
-
const toolIdStr = getToolId(toolUse);
|
|
3078
|
-
const result2 = results.get(toolIdStr);
|
|
3079
|
-
const observation = result2?.status === "fulfilled" ? result2.result ?? "" : `Error: ${result2?.error?.message ?? "Unknown error"}`;
|
|
3080
|
-
this.appendToolMessages(messages, toolUse, observation, thinkingBlocks);
|
|
3081
|
-
this.emitObservationStep(toolUse.name, observation);
|
|
3082
|
-
}
|
|
3083
|
-
} else {
|
|
3084
|
-
for (const toolUse of unprocessedTools) {
|
|
3085
|
-
this.emitActionStep(toolUse);
|
|
3086
|
-
const queuedObs = this.observationQueue.find((obs) => obs.toolName === toolUse.name);
|
|
3087
|
-
let observation;
|
|
3088
|
-
if (queuedObs) {
|
|
3089
|
-
const result2 = queuedObs.result;
|
|
3090
|
-
const index = this.observationQueue.indexOf(queuedObs);
|
|
3091
|
-
this.observationQueue.splice(index, 1);
|
|
3092
|
-
observation = typeof result2 === "string" ? result2 : JSON.stringify(result2);
|
|
3093
|
-
} else {
|
|
3094
|
-
observation = await this.executeToolWithQueueFallback(toolUse);
|
|
3095
|
-
this.appendToolMessages(messages, toolUse, observation, thinkingBlocks);
|
|
2988
|
+
processedToolIds.add(toolCallId);
|
|
2989
|
+
this.toolCallCount++;
|
|
2990
|
+
const actionStep = {
|
|
2991
|
+
type: "action",
|
|
2992
|
+
content: `Using tool: ${toolUse.name}`,
|
|
2993
|
+
metadata: {
|
|
2994
|
+
toolName: toolUse.name,
|
|
2995
|
+
toolInput: toolUse.arguments,
|
|
2996
|
+
timestamp: Date.now()
|
|
3096
2997
|
}
|
|
3097
|
-
|
|
2998
|
+
};
|
|
2999
|
+
this.steps.push(actionStep);
|
|
3000
|
+
this.emit("action", actionStep);
|
|
3001
|
+
const queuedObs = this.observationQueue.find((obs) => obs.toolName === toolUse.name);
|
|
3002
|
+
let observation;
|
|
3003
|
+
if (queuedObs) {
|
|
3004
|
+
observation = queuedObs.result;
|
|
3005
|
+
const index = this.observationQueue.indexOf(queuedObs);
|
|
3006
|
+
this.observationQueue.splice(index, 1);
|
|
3007
|
+
} else {
|
|
3008
|
+
const tool = this.context.tools.find((t) => t.toolSchema.name === toolUse.name);
|
|
3009
|
+
if (!tool) {
|
|
3010
|
+
throw new Error(`Tool ${toolUse.name} not found in agent context`);
|
|
3011
|
+
}
|
|
3012
|
+
const params = typeof toolUse.arguments === "string" ? JSON.parse(toolUse.arguments) : toolUse.arguments;
|
|
3013
|
+
observation = await tool.toolFn(params);
|
|
3014
|
+
const toolCallId2 = `${toolUse.name}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
3015
|
+
const assistantContent = [
|
|
3016
|
+
// Include thinking blocks first (required by Anthropic when thinking is enabled)
|
|
3017
|
+
...thinkingBlocks,
|
|
3018
|
+
// Then the tool use
|
|
3019
|
+
{
|
|
3020
|
+
type: "tool_use",
|
|
3021
|
+
id: toolCallId2,
|
|
3022
|
+
name: toolUse.name,
|
|
3023
|
+
input: params
|
|
3024
|
+
}
|
|
3025
|
+
];
|
|
3026
|
+
this.context.logger.debug(
|
|
3027
|
+
`[assistantContent] ${assistantContent.length} blocks (${thinkingBlocks.length} thinking, 1 tool_use)`
|
|
3028
|
+
);
|
|
3029
|
+
messages.push({
|
|
3030
|
+
role: "assistant",
|
|
3031
|
+
content: assistantContent
|
|
3032
|
+
});
|
|
3033
|
+
messages.push({
|
|
3034
|
+
role: "user",
|
|
3035
|
+
content: [
|
|
3036
|
+
{
|
|
3037
|
+
type: "tool_result",
|
|
3038
|
+
tool_use_id: toolCallId2,
|
|
3039
|
+
content: typeof observation === "string" ? observation : JSON.stringify(observation)
|
|
3040
|
+
}
|
|
3041
|
+
]
|
|
3042
|
+
});
|
|
3098
3043
|
}
|
|
3044
|
+
const observationStep = {
|
|
3045
|
+
type: "observation",
|
|
3046
|
+
content: typeof observation === "string" ? observation : JSON.stringify(observation),
|
|
3047
|
+
metadata: {
|
|
3048
|
+
toolName: toolUse.name,
|
|
3049
|
+
timestamp: Date.now()
|
|
3050
|
+
}
|
|
3051
|
+
};
|
|
3052
|
+
this.steps.push(observationStep);
|
|
3053
|
+
this.emit("observation", observationStep);
|
|
3099
3054
|
}
|
|
3100
3055
|
}
|
|
3101
3056
|
}
|
|
@@ -3232,159 +3187,7 @@ Remember: You are an autonomous AGENT. Act independently and solve problems proa
|
|
|
3232
3187
|
getToolCallCount() {
|
|
3233
3188
|
return this.toolCallCount;
|
|
3234
3189
|
}
|
|
3235
|
-
/**
|
|
3236
|
-
* Create and emit an action step for a tool use
|
|
3237
|
-
*/
|
|
3238
|
-
emitActionStep(toolUse) {
|
|
3239
|
-
this.toolCallCount++;
|
|
3240
|
-
const actionStep = {
|
|
3241
|
-
type: "action",
|
|
3242
|
-
content: `Using tool: ${toolUse.name}`,
|
|
3243
|
-
metadata: {
|
|
3244
|
-
toolName: toolUse.name,
|
|
3245
|
-
toolInput: toolUse.arguments,
|
|
3246
|
-
timestamp: Date.now()
|
|
3247
|
-
}
|
|
3248
|
-
};
|
|
3249
|
-
this.steps.push(actionStep);
|
|
3250
|
-
this.emit("action", actionStep);
|
|
3251
|
-
}
|
|
3252
|
-
/**
|
|
3253
|
-
* Create and emit an observation step
|
|
3254
|
-
*/
|
|
3255
|
-
emitObservationStep(toolName, observation) {
|
|
3256
|
-
const observationStep = {
|
|
3257
|
-
type: "observation",
|
|
3258
|
-
content: observation,
|
|
3259
|
-
metadata: {
|
|
3260
|
-
toolName,
|
|
3261
|
-
timestamp: Date.now()
|
|
3262
|
-
}
|
|
3263
|
-
};
|
|
3264
|
-
this.steps.push(observationStep);
|
|
3265
|
-
this.emit("observation", observationStep);
|
|
3266
|
-
}
|
|
3267
|
-
/**
|
|
3268
|
-
* Parse tool arguments, handling both string and object forms
|
|
3269
|
-
*/
|
|
3270
|
-
parseToolArguments(args) {
|
|
3271
|
-
return typeof args === "string" ? JSON.parse(args) : args;
|
|
3272
|
-
}
|
|
3273
|
-
/**
|
|
3274
|
-
* Execute a tool and return the result as a string.
|
|
3275
|
-
* Checks observation queue first for backward compatibility.
|
|
3276
|
-
*/
|
|
3277
|
-
async executeToolWithQueueFallback(toolUse) {
|
|
3278
|
-
const queuedObs = this.observationQueue.find((obs) => obs.toolName === toolUse.name);
|
|
3279
|
-
if (queuedObs) {
|
|
3280
|
-
const result2 = queuedObs.result;
|
|
3281
|
-
const index = this.observationQueue.indexOf(queuedObs);
|
|
3282
|
-
this.observationQueue.splice(index, 1);
|
|
3283
|
-
return typeof result2 === "string" ? result2 : JSON.stringify(result2);
|
|
3284
|
-
}
|
|
3285
|
-
const tool = this.context.tools.find((t) => t.toolSchema.name === toolUse.name);
|
|
3286
|
-
if (!tool) {
|
|
3287
|
-
throw new Error(`Tool ${toolUse.name} not found in agent context`);
|
|
3288
|
-
}
|
|
3289
|
-
const params = this.parseToolArguments(toolUse.arguments);
|
|
3290
|
-
const result = await tool.toolFn(params);
|
|
3291
|
-
return typeof result === "string" ? result : JSON.stringify(result);
|
|
3292
|
-
}
|
|
3293
|
-
/**
|
|
3294
|
-
* Build and append tool call/result messages for the conversation history
|
|
3295
|
-
*/
|
|
3296
|
-
appendToolMessages(messages, toolUse, observation, thinkingBlocks) {
|
|
3297
|
-
const params = this.parseToolArguments(toolUse.arguments);
|
|
3298
|
-
const msgToolCallId = `${toolUse.name}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
3299
|
-
const assistantContent = [
|
|
3300
|
-
...thinkingBlocks,
|
|
3301
|
-
{
|
|
3302
|
-
type: "tool_use",
|
|
3303
|
-
id: msgToolCallId,
|
|
3304
|
-
name: toolUse.name,
|
|
3305
|
-
input: params
|
|
3306
|
-
}
|
|
3307
|
-
];
|
|
3308
|
-
messages.push({
|
|
3309
|
-
role: "assistant",
|
|
3310
|
-
content: assistantContent
|
|
3311
|
-
});
|
|
3312
|
-
messages.push({
|
|
3313
|
-
role: "user",
|
|
3314
|
-
content: [
|
|
3315
|
-
{
|
|
3316
|
-
type: "tool_result",
|
|
3317
|
-
tool_use_id: msgToolCallId,
|
|
3318
|
-
content: observation
|
|
3319
|
-
}
|
|
3320
|
-
]
|
|
3321
|
-
});
|
|
3322
|
-
}
|
|
3323
|
-
};
|
|
3324
|
-
|
|
3325
|
-
// src/config/toolSafety.ts
|
|
3326
|
-
import { z as z2 } from "zod";
|
|
3327
|
-
var ToolCategorySchema = z2.enum([
|
|
3328
|
-
"auto_approve",
|
|
3329
|
-
// Safe tools that run automatically without permission
|
|
3330
|
-
"prompt_always",
|
|
3331
|
-
// Dangerous tools that ALWAYS require permission (cannot be trusted)
|
|
3332
|
-
"prompt_default"
|
|
3333
|
-
// Tools that prompt by default but can be trusted
|
|
3334
|
-
]);
|
|
3335
|
-
var ToolSafetyConfigSchema = z2.object({
|
|
3336
|
-
categories: z2.record(z2.string(), ToolCategorySchema),
|
|
3337
|
-
trustedTools: z2.array(z2.string())
|
|
3338
|
-
});
|
|
3339
|
-
var DEFAULT_TOOL_CATEGORIES = {
|
|
3340
|
-
// ===== AUTO APPROVE (Safe tools) =====
|
|
3341
|
-
// These tools have no side effects and are always safe to execute
|
|
3342
|
-
math_evaluate: "auto_approve",
|
|
3343
|
-
current_datetime: "auto_approve",
|
|
3344
|
-
dice_roll: "auto_approve",
|
|
3345
|
-
prompt_enhancement: "auto_approve",
|
|
3346
|
-
weather_info: "prompt_default",
|
|
3347
|
-
// ===== PROMPT ALWAYS (Dangerous tools) =====
|
|
3348
|
-
// These tools can modify files, execute code, or have other dangerous side effects
|
|
3349
|
-
// They ALWAYS require permission and cannot be trusted automatically
|
|
3350
|
-
edit_file: "prompt_always",
|
|
3351
|
-
edit_local_file: "prompt_always",
|
|
3352
|
-
create_file: "prompt_always",
|
|
3353
|
-
delete_file: "prompt_always",
|
|
3354
|
-
shell_execute: "prompt_always",
|
|
3355
|
-
bash_execute: "prompt_always",
|
|
3356
|
-
git_commit: "prompt_always",
|
|
3357
|
-
git_push: "prompt_always",
|
|
3358
|
-
// ===== PROMPT DEFAULT (Repository read tools) =====
|
|
3359
|
-
// These tools read from the repository but don't modify anything
|
|
3360
|
-
// Users can trust them if they want to avoid prompts
|
|
3361
|
-
web_search: "prompt_default",
|
|
3362
|
-
deep_research: "prompt_default",
|
|
3363
|
-
file_read: "prompt_default",
|
|
3364
|
-
grep_search: "prompt_default",
|
|
3365
|
-
glob_files: "prompt_default",
|
|
3366
|
-
get_file_tree: "prompt_default",
|
|
3367
|
-
git_status: "prompt_default",
|
|
3368
|
-
git_diff: "prompt_default",
|
|
3369
|
-
git_log: "prompt_default",
|
|
3370
|
-
git_branch: "prompt_default"
|
|
3371
3190
|
};
|
|
3372
|
-
function getToolCategory(toolName, customCategories) {
|
|
3373
|
-
if (customCategories && toolName in customCategories) {
|
|
3374
|
-
return customCategories[toolName];
|
|
3375
|
-
}
|
|
3376
|
-
if (toolName in DEFAULT_TOOL_CATEGORIES) {
|
|
3377
|
-
return DEFAULT_TOOL_CATEGORIES[toolName];
|
|
3378
|
-
}
|
|
3379
|
-
return "prompt_default";
|
|
3380
|
-
}
|
|
3381
|
-
function canTrustTool(toolName, customCategories) {
|
|
3382
|
-
const category = getToolCategory(toolName, customCategories);
|
|
3383
|
-
return category !== "prompt_always";
|
|
3384
|
-
}
|
|
3385
|
-
function isReadOnlyTool(toolName, customCategories) {
|
|
3386
|
-
return getToolCategory(toolName, customCategories) !== "prompt_always";
|
|
3387
|
-
}
|
|
3388
3191
|
|
|
3389
3192
|
// src/core/prompts.ts
|
|
3390
3193
|
var TOOL_GREP_SEARCH = "grep_search";
|
|
@@ -3486,38 +3289,38 @@ Remember: Use context from previous messages to understand follow-up questions.$
|
|
|
3486
3289
|
// ../../b4m-core/packages/services/dist/src/referService/generateCodes.js
|
|
3487
3290
|
import { randomBytes } from "crypto";
|
|
3488
3291
|
import range from "lodash/range.js";
|
|
3489
|
-
import { z as
|
|
3490
|
-
var generateReferralCodesSchema =
|
|
3491
|
-
count:
|
|
3492
|
-
unlimitedUse:
|
|
3493
|
-
expiresAt:
|
|
3292
|
+
import { z as z2 } from "zod";
|
|
3293
|
+
var generateReferralCodesSchema = z2.object({
|
|
3294
|
+
count: z2.number().optional(),
|
|
3295
|
+
unlimitedUse: z2.boolean().optional(),
|
|
3296
|
+
expiresAt: z2.date().optional()
|
|
3494
3297
|
});
|
|
3495
3298
|
|
|
3496
3299
|
// ../../b4m-core/packages/services/dist/src/referService/delete.js
|
|
3497
|
-
import { z as
|
|
3498
|
-
var deleteInviteCodesSchema =
|
|
3499
|
-
ids:
|
|
3300
|
+
import { z as z3 } from "zod";
|
|
3301
|
+
var deleteInviteCodesSchema = z3.object({
|
|
3302
|
+
ids: z3.array(z3.string())
|
|
3500
3303
|
});
|
|
3501
3304
|
|
|
3502
3305
|
// ../../b4m-core/packages/services/dist/src/userService/login.js
|
|
3503
|
-
import { z as
|
|
3306
|
+
import { z as z4 } from "zod";
|
|
3504
3307
|
import bcrypt from "bcryptjs";
|
|
3505
|
-
var loginUserSchema =
|
|
3506
|
-
usernameOrEmail:
|
|
3507
|
-
password:
|
|
3508
|
-
metadata:
|
|
3509
|
-
loginTime:
|
|
3510
|
-
userAgent:
|
|
3511
|
-
browser:
|
|
3512
|
-
operatingSystem:
|
|
3513
|
-
deviceType:
|
|
3514
|
-
screenResolution:
|
|
3515
|
-
viewportSize:
|
|
3516
|
-
colorDepth:
|
|
3517
|
-
pixelDepth:
|
|
3518
|
-
devicePixelRatio:
|
|
3519
|
-
ip:
|
|
3520
|
-
location:
|
|
3308
|
+
var loginUserSchema = z4.object({
|
|
3309
|
+
usernameOrEmail: z4.string(),
|
|
3310
|
+
password: z4.string(),
|
|
3311
|
+
metadata: z4.object({
|
|
3312
|
+
loginTime: z4.date(),
|
|
3313
|
+
userAgent: z4.string(),
|
|
3314
|
+
browser: z4.string(),
|
|
3315
|
+
operatingSystem: z4.string(),
|
|
3316
|
+
deviceType: z4.string(),
|
|
3317
|
+
screenResolution: z4.string(),
|
|
3318
|
+
viewportSize: z4.string(),
|
|
3319
|
+
colorDepth: z4.number(),
|
|
3320
|
+
pixelDepth: z4.number(),
|
|
3321
|
+
devicePixelRatio: z4.number(),
|
|
3322
|
+
ip: z4.string().optional().default(""),
|
|
3323
|
+
location: z4.string().optional()
|
|
3521
3324
|
}).optional()
|
|
3522
3325
|
});
|
|
3523
3326
|
|
|
@@ -3527,78 +3330,78 @@ import escapeRegExp from "lodash/escapeRegExp.js";
|
|
|
3527
3330
|
|
|
3528
3331
|
// ../../b4m-core/packages/services/dist/src/userService/forgotPassword.js
|
|
3529
3332
|
import { randomUUID } from "crypto";
|
|
3530
|
-
import { z as
|
|
3531
|
-
var forgotPasswordUserSchema =
|
|
3532
|
-
email:
|
|
3333
|
+
import { z as z5 } from "zod";
|
|
3334
|
+
var forgotPasswordUserSchema = z5.object({
|
|
3335
|
+
email: z5.string().email()
|
|
3533
3336
|
});
|
|
3534
3337
|
|
|
3535
3338
|
// ../../b4m-core/packages/services/dist/src/userService/update.js
|
|
3536
3339
|
import bcrypt3 from "bcryptjs";
|
|
3537
|
-
import { z as
|
|
3538
|
-
var updateUserSchema =
|
|
3539
|
-
name:
|
|
3540
|
-
username:
|
|
3340
|
+
import { z as z6 } from "zod";
|
|
3341
|
+
var updateUserSchema = z6.object({
|
|
3342
|
+
name: z6.string().optional(),
|
|
3343
|
+
username: z6.string().optional(),
|
|
3541
3344
|
// email field removed - users must use the secure email change verification flow
|
|
3542
3345
|
// See requestEmailChange and verifyEmailChange in userService
|
|
3543
|
-
password:
|
|
3544
|
-
team:
|
|
3545
|
-
role:
|
|
3546
|
-
phone:
|
|
3547
|
-
preferredLanguage:
|
|
3548
|
-
preferredContact:
|
|
3549
|
-
preferredVoice:
|
|
3550
|
-
tshirtSize:
|
|
3551
|
-
geoLocation:
|
|
3552
|
-
lastNotebookId:
|
|
3553
|
-
tags:
|
|
3554
|
-
lastCreditsPurchasedAt:
|
|
3555
|
-
systemFiles:
|
|
3556
|
-
fileId:
|
|
3557
|
-
enabled:
|
|
3346
|
+
password: z6.string().nullable().optional(),
|
|
3347
|
+
team: z6.string().nullable().optional(),
|
|
3348
|
+
role: z6.string().nullable().optional(),
|
|
3349
|
+
phone: z6.string().nullable().optional(),
|
|
3350
|
+
preferredLanguage: z6.string().nullable().optional(),
|
|
3351
|
+
preferredContact: z6.string().nullable().optional(),
|
|
3352
|
+
preferredVoice: z6.string().nullable().optional(),
|
|
3353
|
+
tshirtSize: z6.string().nullable().optional(),
|
|
3354
|
+
geoLocation: z6.string().nullable().optional(),
|
|
3355
|
+
lastNotebookId: z6.string().nullable().optional(),
|
|
3356
|
+
tags: z6.array(z6.string()).nullable().optional(),
|
|
3357
|
+
lastCreditsPurchasedAt: z6.date().nullable().optional(),
|
|
3358
|
+
systemFiles: z6.array(z6.object({
|
|
3359
|
+
fileId: z6.string(),
|
|
3360
|
+
enabled: z6.boolean()
|
|
3558
3361
|
})).nullable().optional(),
|
|
3559
|
-
securityQuestions:
|
|
3560
|
-
photoUrl:
|
|
3561
|
-
showCreditsUsed:
|
|
3362
|
+
securityQuestions: z6.array(z6.object({ question: z6.string(), answer: z6.string() })).nullable().optional(),
|
|
3363
|
+
photoUrl: z6.string().nullable().optional(),
|
|
3364
|
+
showCreditsUsed: z6.boolean().optional()
|
|
3562
3365
|
});
|
|
3563
3366
|
|
|
3564
3367
|
// ../../b4m-core/packages/services/dist/src/userService/adminUpdate.js
|
|
3565
|
-
import { z as
|
|
3368
|
+
import { z as z8 } from "zod";
|
|
3566
3369
|
|
|
3567
3370
|
// ../../b4m-core/packages/services/dist/src/friendshipService/sendFriendRequest.js
|
|
3568
|
-
import { z as
|
|
3569
|
-
var sendFriendRequestSchema =
|
|
3570
|
-
requesterId:
|
|
3571
|
-
recipientId:
|
|
3572
|
-
message:
|
|
3371
|
+
import { z as z7 } from "zod";
|
|
3372
|
+
var sendFriendRequestSchema = z7.object({
|
|
3373
|
+
requesterId: z7.string(),
|
|
3374
|
+
recipientId: z7.string(),
|
|
3375
|
+
message: z7.string().optional()
|
|
3573
3376
|
});
|
|
3574
3377
|
|
|
3575
3378
|
// ../../b4m-core/packages/services/dist/src/userService/adminUpdate.js
|
|
3576
3379
|
var adminUpdateUserSchema = updateUserSchema.extend({
|
|
3577
|
-
id:
|
|
3380
|
+
id: z8.string(),
|
|
3578
3381
|
// Admins can directly update email addresses without verification
|
|
3579
|
-
email:
|
|
3580
|
-
role:
|
|
3581
|
-
isAdmin:
|
|
3582
|
-
organizationId:
|
|
3583
|
-
storageLimit:
|
|
3584
|
-
currentCredits:
|
|
3585
|
-
isBanned:
|
|
3586
|
-
isModerated:
|
|
3587
|
-
subscribedUntil:
|
|
3588
|
-
systemFiles:
|
|
3589
|
-
level:
|
|
3590
|
-
lastNotebookId:
|
|
3591
|
-
userNotes:
|
|
3592
|
-
numReferralsAvailable:
|
|
3382
|
+
email: z8.string().email().optional(),
|
|
3383
|
+
role: z8.string().optional().nullable(),
|
|
3384
|
+
isAdmin: z8.boolean().optional(),
|
|
3385
|
+
organizationId: z8.string().optional().nullable(),
|
|
3386
|
+
storageLimit: z8.number().optional(),
|
|
3387
|
+
currentCredits: z8.number().optional(),
|
|
3388
|
+
isBanned: z8.boolean().optional(),
|
|
3389
|
+
isModerated: z8.boolean().optional(),
|
|
3390
|
+
subscribedUntil: z8.string().optional().nullable(),
|
|
3391
|
+
systemFiles: z8.array(z8.object({ fileId: z8.string(), enabled: z8.boolean() })).optional(),
|
|
3392
|
+
level: z8.enum(["DemoUser", "PaidUser", "VIPUser", "ManagerUser", "AdminUser"]).optional(),
|
|
3393
|
+
lastNotebookId: z8.string().optional().nullable(),
|
|
3394
|
+
userNotes: z8.array(z8.object({ timestamp: z8.string(), note: z8.string(), userName: z8.string() })).optional(),
|
|
3395
|
+
numReferralsAvailable: z8.number().optional()
|
|
3593
3396
|
});
|
|
3594
3397
|
|
|
3595
3398
|
// ../../b4m-core/packages/services/dist/src/userService/register.js
|
|
3596
|
-
import { z as
|
|
3399
|
+
import { z as z10 } from "zod";
|
|
3597
3400
|
import bcrypt4 from "bcryptjs";
|
|
3598
3401
|
|
|
3599
3402
|
// ../../b4m-core/packages/services/dist/src/creditService/addCredits.js
|
|
3600
|
-
import { z as
|
|
3601
|
-
var AddCreditsSchema =
|
|
3403
|
+
import { z as z9 } from "zod";
|
|
3404
|
+
var AddCreditsSchema = z9.discriminatedUnion("type", [
|
|
3602
3405
|
PurchaseTransaction.omit({ createdAt: true, updatedAt: true }),
|
|
3603
3406
|
SubscriptionCreditTransaction.omit({ createdAt: true, updatedAt: true }),
|
|
3604
3407
|
GenericCreditAddTransaction.omit({ createdAt: true, updatedAt: true }),
|
|
@@ -3606,57 +3409,57 @@ var AddCreditsSchema = z10.discriminatedUnion("type", [
|
|
|
3606
3409
|
]);
|
|
3607
3410
|
|
|
3608
3411
|
// ../../b4m-core/packages/services/dist/src/userService/register.js
|
|
3609
|
-
var registerUserSchema =
|
|
3610
|
-
username:
|
|
3611
|
-
email:
|
|
3612
|
-
name:
|
|
3613
|
-
inviteCode:
|
|
3614
|
-
password:
|
|
3615
|
-
metadata:
|
|
3616
|
-
loginTime:
|
|
3617
|
-
userAgent:
|
|
3618
|
-
browser:
|
|
3619
|
-
operatingSystem:
|
|
3620
|
-
deviceType:
|
|
3621
|
-
screenResolution:
|
|
3622
|
-
viewportSize:
|
|
3623
|
-
colorDepth:
|
|
3624
|
-
pixelDepth:
|
|
3625
|
-
devicePixelRatio:
|
|
3626
|
-
ip:
|
|
3627
|
-
location:
|
|
3412
|
+
var registerUserSchema = z10.object({
|
|
3413
|
+
username: z10.string(),
|
|
3414
|
+
email: z10.string(),
|
|
3415
|
+
name: z10.string(),
|
|
3416
|
+
inviteCode: z10.string(),
|
|
3417
|
+
password: z10.string(),
|
|
3418
|
+
metadata: z10.object({
|
|
3419
|
+
loginTime: z10.date(),
|
|
3420
|
+
userAgent: z10.string(),
|
|
3421
|
+
browser: z10.string(),
|
|
3422
|
+
operatingSystem: z10.string(),
|
|
3423
|
+
deviceType: z10.string(),
|
|
3424
|
+
screenResolution: z10.string(),
|
|
3425
|
+
viewportSize: z10.string(),
|
|
3426
|
+
colorDepth: z10.number(),
|
|
3427
|
+
pixelDepth: z10.number(),
|
|
3428
|
+
devicePixelRatio: z10.number(),
|
|
3429
|
+
ip: z10.string().optional().default(""),
|
|
3430
|
+
location: z10.string().optional()
|
|
3628
3431
|
}).optional()
|
|
3629
3432
|
});
|
|
3630
3433
|
|
|
3631
3434
|
// ../../b4m-core/packages/services/dist/src/userService/adminDelete.js
|
|
3632
|
-
import { z as
|
|
3633
|
-
var adminDeleteUserSchema =
|
|
3634
|
-
id:
|
|
3435
|
+
import { z as z11 } from "zod";
|
|
3436
|
+
var adminDeleteUserSchema = z11.object({
|
|
3437
|
+
id: z11.string()
|
|
3635
3438
|
});
|
|
3636
3439
|
|
|
3637
3440
|
// ../../b4m-core/packages/services/dist/src/userService/searchUserCollection.js
|
|
3638
|
-
import { z as
|
|
3639
|
-
var searchUserCollectionSchema =
|
|
3640
|
-
userId:
|
|
3641
|
-
page:
|
|
3642
|
-
limit:
|
|
3643
|
-
search:
|
|
3644
|
-
type:
|
|
3441
|
+
import { z as z12 } from "zod";
|
|
3442
|
+
var searchUserCollectionSchema = z12.object({
|
|
3443
|
+
userId: z12.string(),
|
|
3444
|
+
page: z12.coerce.number().optional().default(1),
|
|
3445
|
+
limit: z12.coerce.number().optional().default(10),
|
|
3446
|
+
search: z12.string().optional().default(""),
|
|
3447
|
+
type: z12.nativeEnum(CollectionType).optional()
|
|
3645
3448
|
});
|
|
3646
3449
|
|
|
3647
3450
|
// ../../b4m-core/packages/services/dist/src/userService/recalculateUserStorage.js
|
|
3648
|
-
import { z as
|
|
3649
|
-
var recalculateUserStorageSchema =
|
|
3451
|
+
import { z as z13 } from "zod";
|
|
3452
|
+
var recalculateUserStorageSchema = z13.object({
|
|
3650
3453
|
/**
|
|
3651
3454
|
* The user to recalculate the storage for
|
|
3652
3455
|
*/
|
|
3653
|
-
userId:
|
|
3456
|
+
userId: z13.string()
|
|
3654
3457
|
});
|
|
3655
3458
|
|
|
3656
3459
|
// ../../b4m-core/packages/services/dist/src/userService/listRecentActivities.js
|
|
3657
|
-
import { z as
|
|
3658
|
-
var listRecentActivitiesSchema =
|
|
3659
|
-
coverage:
|
|
3460
|
+
import { z as z14 } from "zod";
|
|
3461
|
+
var listRecentActivitiesSchema = z14.object({
|
|
3462
|
+
coverage: z14.enum(["all", "important"]).default("important")
|
|
3660
3463
|
});
|
|
3661
3464
|
var IMPORTANT_COUNTER_NAMES = [
|
|
3662
3465
|
SessionEvents.CREATE_SESSION,
|
|
@@ -3670,82 +3473,82 @@ var IMPORTANT_COUNTER_NAMES = [
|
|
|
3670
3473
|
|
|
3671
3474
|
// ../../b4m-core/packages/services/dist/src/userService/sendEmailVerification.js
|
|
3672
3475
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
3673
|
-
import { z as
|
|
3674
|
-
var sendEmailVerificationSchema =
|
|
3675
|
-
userId:
|
|
3476
|
+
import { z as z15 } from "zod";
|
|
3477
|
+
var sendEmailVerificationSchema = z15.object({
|
|
3478
|
+
userId: z15.string()
|
|
3676
3479
|
});
|
|
3677
3480
|
|
|
3678
3481
|
// ../../b4m-core/packages/services/dist/src/userService/verifyEmailToken.js
|
|
3679
|
-
import { z as
|
|
3482
|
+
import { z as z16 } from "zod";
|
|
3680
3483
|
|
|
3681
3484
|
// ../../b4m-core/packages/services/dist/src/utils/crypto.js
|
|
3682
3485
|
import crypto from "crypto";
|
|
3683
3486
|
|
|
3684
3487
|
// ../../b4m-core/packages/services/dist/src/userService/verifyEmailToken.js
|
|
3685
|
-
var verifyEmailTokenSchema =
|
|
3686
|
-
token:
|
|
3488
|
+
var verifyEmailTokenSchema = z16.object({
|
|
3489
|
+
token: z16.string()
|
|
3687
3490
|
});
|
|
3688
3491
|
|
|
3689
3492
|
// ../../b4m-core/packages/services/dist/src/userService/resendEmailVerification.js
|
|
3690
3493
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
3691
|
-
import { z as
|
|
3692
|
-
var resendEmailVerificationSchema =
|
|
3693
|
-
userId:
|
|
3494
|
+
import { z as z17 } from "zod";
|
|
3495
|
+
var resendEmailVerificationSchema = z17.object({
|
|
3496
|
+
userId: z17.string()
|
|
3694
3497
|
});
|
|
3695
3498
|
|
|
3696
3499
|
// ../../b4m-core/packages/services/dist/src/userService/requestEmailChange.js
|
|
3697
3500
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
3698
|
-
import { z as
|
|
3699
|
-
var requestEmailChangeSchema =
|
|
3700
|
-
userId:
|
|
3701
|
-
newEmail:
|
|
3702
|
-
password:
|
|
3501
|
+
import { z as z18 } from "zod";
|
|
3502
|
+
var requestEmailChangeSchema = z18.object({
|
|
3503
|
+
userId: z18.string(),
|
|
3504
|
+
newEmail: z18.string().email(),
|
|
3505
|
+
password: z18.string()
|
|
3703
3506
|
});
|
|
3704
3507
|
|
|
3705
3508
|
// ../../b4m-core/packages/services/dist/src/userService/verifyEmailChange.js
|
|
3706
|
-
import { z as
|
|
3707
|
-
var verifyEmailChangeSchema =
|
|
3708
|
-
token:
|
|
3509
|
+
import { z as z19 } from "zod";
|
|
3510
|
+
var verifyEmailChangeSchema = z19.object({
|
|
3511
|
+
token: z19.string()
|
|
3709
3512
|
});
|
|
3710
3513
|
|
|
3711
3514
|
// ../../b4m-core/packages/services/dist/src/userService/cancelEmailChange.js
|
|
3712
|
-
import { z as
|
|
3713
|
-
var cancelEmailChangeSchema =
|
|
3714
|
-
userId:
|
|
3515
|
+
import { z as z20 } from "zod";
|
|
3516
|
+
var cancelEmailChangeSchema = z20.object({
|
|
3517
|
+
userId: z20.string()
|
|
3715
3518
|
});
|
|
3716
3519
|
|
|
3717
3520
|
// ../../b4m-core/packages/services/dist/src/userApiKeyService/create.js
|
|
3718
3521
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
3719
3522
|
import bcrypt5 from "bcryptjs";
|
|
3720
|
-
import { z as
|
|
3721
|
-
var createUserApiKeySchema =
|
|
3722
|
-
name:
|
|
3723
|
-
scopes:
|
|
3724
|
-
expiresAt:
|
|
3725
|
-
rateLimit:
|
|
3726
|
-
requestsPerMinute:
|
|
3727
|
-
requestsPerDay:
|
|
3523
|
+
import { z as z21 } from "zod";
|
|
3524
|
+
var createUserApiKeySchema = z21.object({
|
|
3525
|
+
name: z21.string().min(1).max(100),
|
|
3526
|
+
scopes: z21.array(z21.nativeEnum(ApiKeyScope)).min(1),
|
|
3527
|
+
expiresAt: z21.date().optional(),
|
|
3528
|
+
rateLimit: z21.object({
|
|
3529
|
+
requestsPerMinute: z21.number().min(1).max(1e3).default(60),
|
|
3530
|
+
requestsPerDay: z21.number().min(1).max(1e4).default(1e3)
|
|
3728
3531
|
}).optional(),
|
|
3729
|
-
metadata:
|
|
3730
|
-
clientIP:
|
|
3731
|
-
userAgent:
|
|
3732
|
-
createdFrom:
|
|
3532
|
+
metadata: z21.object({
|
|
3533
|
+
clientIP: z21.string().optional(),
|
|
3534
|
+
userAgent: z21.string().optional(),
|
|
3535
|
+
createdFrom: z21.enum(["dashboard", "cli", "api"])
|
|
3733
3536
|
})
|
|
3734
3537
|
});
|
|
3735
3538
|
|
|
3736
3539
|
// ../../b4m-core/packages/services/dist/src/userApiKeyService/revoke.js
|
|
3737
|
-
import { z as
|
|
3738
|
-
var revokeUserApiKeySchema =
|
|
3739
|
-
keyId:
|
|
3740
|
-
reason:
|
|
3540
|
+
import { z as z22 } from "zod";
|
|
3541
|
+
var revokeUserApiKeySchema = z22.object({
|
|
3542
|
+
keyId: z22.string(),
|
|
3543
|
+
reason: z22.string().optional()
|
|
3741
3544
|
});
|
|
3742
3545
|
|
|
3743
3546
|
// ../../b4m-core/packages/services/dist/src/userApiKeyService/rotate.js
|
|
3744
3547
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
3745
3548
|
import bcrypt6 from "bcryptjs";
|
|
3746
|
-
import { z as
|
|
3747
|
-
var rotateUserApiKeySchema =
|
|
3748
|
-
keyId:
|
|
3549
|
+
import { z as z23 } from "zod";
|
|
3550
|
+
var rotateUserApiKeySchema = z23.object({
|
|
3551
|
+
keyId: z23.string()
|
|
3749
3552
|
});
|
|
3750
3553
|
|
|
3751
3554
|
// ../../b4m-core/packages/services/dist/src/userApiKeyService/validate.js
|
|
@@ -3892,29 +3695,29 @@ var EVENT_GROUPS = [
|
|
|
3892
3695
|
];
|
|
3893
3696
|
|
|
3894
3697
|
// ../../b4m-core/packages/services/dist/src/countersService/generateReport.js
|
|
3895
|
-
import { z as
|
|
3698
|
+
import { z as z25 } from "zod";
|
|
3896
3699
|
|
|
3897
3700
|
// ../../b4m-core/packages/services/dist/src/countersService/getAllCounterFrom24Hours.js
|
|
3898
|
-
import { z as
|
|
3701
|
+
import { z as z24 } from "zod";
|
|
3899
3702
|
import dayjs2 from "dayjs";
|
|
3900
|
-
var getCounterTotalsForLast24HoursSchema =
|
|
3901
|
-
date:
|
|
3902
|
-
endDate:
|
|
3703
|
+
var getCounterTotalsForLast24HoursSchema = z24.object({
|
|
3704
|
+
date: z24.string(),
|
|
3705
|
+
endDate: z24.string().optional()
|
|
3903
3706
|
});
|
|
3904
3707
|
|
|
3905
3708
|
// ../../b4m-core/packages/services/dist/src/countersService/generateReport.js
|
|
3906
|
-
var generateDailyReportSchema =
|
|
3907
|
-
date:
|
|
3908
|
-
startDate:
|
|
3909
|
-
endDate:
|
|
3709
|
+
var generateDailyReportSchema = z25.object({
|
|
3710
|
+
date: z25.string(),
|
|
3711
|
+
startDate: z25.string().optional(),
|
|
3712
|
+
endDate: z25.string().optional()
|
|
3910
3713
|
});
|
|
3911
3714
|
|
|
3912
3715
|
// ../../b4m-core/packages/services/dist/src/countersService/incrementUserCounter.js
|
|
3913
|
-
import { z as
|
|
3914
|
-
var incrementUserCounterSchema =
|
|
3915
|
-
action:
|
|
3916
|
-
increment:
|
|
3917
|
-
metadata:
|
|
3716
|
+
import { z as z26 } from "zod";
|
|
3717
|
+
var incrementUserCounterSchema = z26.object({
|
|
3718
|
+
action: z26.string(),
|
|
3719
|
+
increment: z26.coerce.number().default(1).optional(),
|
|
3720
|
+
metadata: z26.record(z26.unknown()).optional()
|
|
3918
3721
|
});
|
|
3919
3722
|
|
|
3920
3723
|
// ../../b4m-core/packages/services/dist/src/countersService/sendSlackReport.js
|
|
@@ -3935,42 +3738,42 @@ import yauzl from "yauzl";
|
|
|
3935
3738
|
import axios3 from "axios";
|
|
3936
3739
|
|
|
3937
3740
|
// ../../b4m-core/packages/services/dist/src/importHistoryService/importOpenaiHistory.js
|
|
3938
|
-
import { z as
|
|
3741
|
+
import { z as z27 } from "zod";
|
|
3939
3742
|
import last from "lodash/last.js";
|
|
3940
|
-
var epochDate = () =>
|
|
3941
|
-
var openaiConversationSchema =
|
|
3942
|
-
id:
|
|
3943
|
-
title:
|
|
3743
|
+
var epochDate = () => z27.preprocess((val) => new Date(Number(val) * 1e3), z27.date());
|
|
3744
|
+
var openaiConversationSchema = z27.object({
|
|
3745
|
+
id: z27.string(),
|
|
3746
|
+
title: z27.string(),
|
|
3944
3747
|
create_time: epochDate(),
|
|
3945
3748
|
update_time: epochDate().nullable(),
|
|
3946
|
-
mapping:
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
id:
|
|
3950
|
-
parent:
|
|
3951
|
-
children:
|
|
3952
|
-
message:
|
|
3953
|
-
id:
|
|
3749
|
+
mapping: z27.record(
|
|
3750
|
+
z27.string(),
|
|
3751
|
+
z27.object({
|
|
3752
|
+
id: z27.string(),
|
|
3753
|
+
parent: z27.string().nullable(),
|
|
3754
|
+
children: z27.array(z27.string()),
|
|
3755
|
+
message: z27.object({
|
|
3756
|
+
id: z27.string(),
|
|
3954
3757
|
create_time: epochDate(),
|
|
3955
3758
|
update_time: epochDate().nullable(),
|
|
3956
|
-
author:
|
|
3957
|
-
role:
|
|
3958
|
-
name:
|
|
3959
|
-
metadata:
|
|
3759
|
+
author: z27.object({
|
|
3760
|
+
role: z27.string(),
|
|
3761
|
+
name: z27.string().nullable(),
|
|
3762
|
+
metadata: z27.any()
|
|
3960
3763
|
// Accept any metadata structure
|
|
3961
3764
|
}).passthrough(),
|
|
3962
3765
|
// Allow extra fields in author
|
|
3963
|
-
content:
|
|
3964
|
-
content_type:
|
|
3965
|
-
parts:
|
|
3766
|
+
content: z27.object({
|
|
3767
|
+
content_type: z27.string(),
|
|
3768
|
+
parts: z27.array(z27.any()).optional()
|
|
3966
3769
|
// Accept any type in parts array (strings, objects, etc.)
|
|
3967
3770
|
}).passthrough(),
|
|
3968
3771
|
// Allow extra fields in content
|
|
3969
|
-
status:
|
|
3970
|
-
end_turn:
|
|
3971
|
-
metadata:
|
|
3772
|
+
status: z27.string(),
|
|
3773
|
+
end_turn: z27.boolean().nullable(),
|
|
3774
|
+
metadata: z27.any(),
|
|
3972
3775
|
// Accept any metadata structure since it varies widely
|
|
3973
|
-
recipient:
|
|
3776
|
+
recipient: z27.string()
|
|
3974
3777
|
}).passthrough().nullable()
|
|
3975
3778
|
}).passthrough()
|
|
3976
3779
|
// Allow extra fields in mapping node
|
|
@@ -3978,38 +3781,38 @@ var openaiConversationSchema = z28.object({
|
|
|
3978
3781
|
}).passthrough();
|
|
3979
3782
|
|
|
3980
3783
|
// ../../b4m-core/packages/services/dist/src/importHistoryService/importClaudeHistory.js
|
|
3981
|
-
import { z as
|
|
3982
|
-
var claudeChatMessageSchema =
|
|
3983
|
-
uuid:
|
|
3984
|
-
text:
|
|
3985
|
-
content:
|
|
3986
|
-
|
|
3987
|
-
type:
|
|
3784
|
+
import { z as z28 } from "zod";
|
|
3785
|
+
var claudeChatMessageSchema = z28.object({
|
|
3786
|
+
uuid: z28.string().uuid(),
|
|
3787
|
+
text: z28.string(),
|
|
3788
|
+
content: z28.array(
|
|
3789
|
+
z28.object({
|
|
3790
|
+
type: z28.string(),
|
|
3988
3791
|
// Accept any type: "text", "image", "tool_result", etc.
|
|
3989
|
-
text:
|
|
3792
|
+
text: z28.string().optional()
|
|
3990
3793
|
// Make text optional since tool_result may not have it
|
|
3991
3794
|
}).passthrough()
|
|
3992
3795
|
// Allow all other fields
|
|
3993
3796
|
),
|
|
3994
|
-
sender:
|
|
3995
|
-
created_at:
|
|
3996
|
-
updated_at:
|
|
3997
|
-
attachments:
|
|
3797
|
+
sender: z28.enum(["human", "assistant"]),
|
|
3798
|
+
created_at: z28.coerce.date(),
|
|
3799
|
+
updated_at: z28.coerce.date(),
|
|
3800
|
+
attachments: z28.array(z28.any()),
|
|
3998
3801
|
// Accept any attachment structure
|
|
3999
|
-
files:
|
|
3802
|
+
files: z28.array(z28.any())
|
|
4000
3803
|
// Accept any file structure
|
|
4001
3804
|
}).passthrough();
|
|
4002
|
-
var claudeConversationSchema =
|
|
4003
|
-
uuid:
|
|
4004
|
-
name:
|
|
4005
|
-
summary:
|
|
3805
|
+
var claudeConversationSchema = z28.object({
|
|
3806
|
+
uuid: z28.string().uuid(),
|
|
3807
|
+
name: z28.string(),
|
|
3808
|
+
summary: z28.string().optional(),
|
|
4006
3809
|
// Summary field is optional
|
|
4007
|
-
created_at:
|
|
4008
|
-
updated_at:
|
|
4009
|
-
account:
|
|
4010
|
-
uuid:
|
|
3810
|
+
created_at: z28.coerce.date(),
|
|
3811
|
+
updated_at: z28.coerce.date(),
|
|
3812
|
+
account: z28.object({
|
|
3813
|
+
uuid: z28.string().uuid()
|
|
4011
3814
|
}),
|
|
4012
|
-
chat_messages:
|
|
3815
|
+
chat_messages: z28.array(claudeChatMessageSchema)
|
|
4013
3816
|
}).passthrough();
|
|
4014
3817
|
|
|
4015
3818
|
// ../../b4m-core/packages/services/dist/src/importHistoryService/index.js
|
|
@@ -4020,357 +3823,357 @@ var ImportSource;
|
|
|
4020
3823
|
})(ImportSource || (ImportSource = {}));
|
|
4021
3824
|
|
|
4022
3825
|
// ../../b4m-core/packages/services/dist/src/sessionService/create.js
|
|
4023
|
-
import { z as
|
|
4024
|
-
var createSessionParametersSchema =
|
|
4025
|
-
name:
|
|
4026
|
-
knowledgeIds:
|
|
4027
|
-
artifactIds:
|
|
4028
|
-
agentIds:
|
|
4029
|
-
tags:
|
|
4030
|
-
summary:
|
|
4031
|
-
summaryAt:
|
|
4032
|
-
clonedSourceId:
|
|
4033
|
-
forkedSourceId:
|
|
4034
|
-
projectId:
|
|
4035
|
-
lastUsedModel:
|
|
3826
|
+
import { z as z29 } from "zod";
|
|
3827
|
+
var createSessionParametersSchema = z29.object({
|
|
3828
|
+
name: z29.string(),
|
|
3829
|
+
knowledgeIds: z29.array(z29.string()).optional(),
|
|
3830
|
+
artifactIds: z29.array(z29.string()).optional(),
|
|
3831
|
+
agentIds: z29.array(z29.string()).optional(),
|
|
3832
|
+
tags: z29.array(z29.object({ name: z29.string(), strength: z29.number() })).optional(),
|
|
3833
|
+
summary: z29.string().optional(),
|
|
3834
|
+
summaryAt: z29.date().optional(),
|
|
3835
|
+
clonedSourceId: z29.string().optional().nullable(),
|
|
3836
|
+
forkedSourceId: z29.string().optional().nullable(),
|
|
3837
|
+
projectId: z29.string().optional(),
|
|
3838
|
+
lastUsedModel: z29.string().optional().nullable()
|
|
4036
3839
|
});
|
|
4037
3840
|
|
|
4038
3841
|
// ../../b4m-core/packages/services/dist/src/sessionService/delete.js
|
|
4039
|
-
import { z as
|
|
4040
|
-
var deleteSessionSchema =
|
|
4041
|
-
id:
|
|
3842
|
+
import { z as z30 } from "zod";
|
|
3843
|
+
var deleteSessionSchema = z30.object({
|
|
3844
|
+
id: z30.string()
|
|
4042
3845
|
});
|
|
4043
3846
|
|
|
4044
3847
|
// ../../b4m-core/packages/services/dist/src/sessionService/sumarize.js
|
|
4045
|
-
import { z as
|
|
4046
|
-
var sumarizeSessionSchema =
|
|
4047
|
-
id:
|
|
3848
|
+
import { z as z31 } from "zod";
|
|
3849
|
+
var sumarizeSessionSchema = z31.object({
|
|
3850
|
+
id: z31.string()
|
|
4048
3851
|
});
|
|
4049
3852
|
|
|
4050
3853
|
// ../../b4m-core/packages/services/dist/src/projectService/create.js
|
|
4051
|
-
import { z as
|
|
4052
|
-
var createProjectSchema =
|
|
4053
|
-
name:
|
|
4054
|
-
description:
|
|
4055
|
-
sessionIds:
|
|
4056
|
-
fileIds:
|
|
3854
|
+
import { z as z32 } from "zod";
|
|
3855
|
+
var createProjectSchema = z32.object({
|
|
3856
|
+
name: z32.string().min(1),
|
|
3857
|
+
description: z32.string().min(1),
|
|
3858
|
+
sessionIds: z32.array(z32.string()).optional(),
|
|
3859
|
+
fileIds: z32.array(z32.string()).optional()
|
|
4057
3860
|
});
|
|
4058
3861
|
|
|
4059
3862
|
// ../../b4m-core/packages/services/dist/src/projectService/search.js
|
|
4060
|
-
import { z as
|
|
4061
|
-
var searchProjectsSchema =
|
|
4062
|
-
search:
|
|
4063
|
-
filters:
|
|
4064
|
-
favorite:
|
|
4065
|
-
scope:
|
|
3863
|
+
import { z as z33 } from "zod";
|
|
3864
|
+
var searchProjectsSchema = z33.object({
|
|
3865
|
+
search: z33.string().optional(),
|
|
3866
|
+
filters: z33.object({
|
|
3867
|
+
favorite: z33.coerce.boolean().optional(),
|
|
3868
|
+
scope: z33.record(z33.any()).optional()
|
|
4066
3869
|
}).optional(),
|
|
4067
|
-
pagination:
|
|
4068
|
-
page:
|
|
4069
|
-
limit:
|
|
3870
|
+
pagination: z33.object({
|
|
3871
|
+
page: z33.coerce.number().optional(),
|
|
3872
|
+
limit: z33.coerce.number().optional()
|
|
4070
3873
|
}).optional(),
|
|
4071
|
-
orderBy:
|
|
4072
|
-
by:
|
|
4073
|
-
direction:
|
|
3874
|
+
orderBy: z33.object({
|
|
3875
|
+
by: z33.enum(["createdAt", "updatedAt"]).optional(),
|
|
3876
|
+
direction: z33.enum(["asc", "desc"]).optional()
|
|
4074
3877
|
}).optional()
|
|
4075
3878
|
});
|
|
4076
3879
|
|
|
4077
3880
|
// ../../b4m-core/packages/services/dist/src/projectService/addSessions.js
|
|
4078
|
-
import { z as
|
|
3881
|
+
import { z as z44 } from "zod";
|
|
4079
3882
|
import uniq2 from "lodash/uniq.js";
|
|
4080
3883
|
|
|
4081
3884
|
// ../../b4m-core/packages/services/dist/src/sharingService/accept.js
|
|
4082
|
-
import { z as
|
|
4083
|
-
var acceptInviteSchema =
|
|
4084
|
-
id:
|
|
3885
|
+
import { z as z34 } from "zod";
|
|
3886
|
+
var acceptInviteSchema = z34.object({
|
|
3887
|
+
id: z34.string()
|
|
4085
3888
|
});
|
|
4086
3889
|
|
|
4087
3890
|
// ../../b4m-core/packages/services/dist/src/sharingService/cancel.js
|
|
4088
|
-
import { z as
|
|
4089
|
-
var cancelInviteSchema =
|
|
4090
|
-
id:
|
|
4091
|
-
type:
|
|
4092
|
-
email:
|
|
3891
|
+
import { z as z35 } from "zod";
|
|
3892
|
+
var cancelInviteSchema = z35.object({
|
|
3893
|
+
id: z35.string(),
|
|
3894
|
+
type: z35.nativeEnum(InviteType),
|
|
3895
|
+
email: z35.string().email().optional()
|
|
4093
3896
|
});
|
|
4094
3897
|
|
|
4095
3898
|
// ../../b4m-core/packages/services/dist/src/sharingService/cancelOwnDocument.js
|
|
4096
|
-
import { z as
|
|
4097
|
-
var cancelOwnDocumentInvitesSchema =
|
|
4098
|
-
documentId:
|
|
4099
|
-
type:
|
|
3899
|
+
import { z as z36 } from "zod";
|
|
3900
|
+
var cancelOwnDocumentInvitesSchema = z36.object({
|
|
3901
|
+
documentId: z36.string(),
|
|
3902
|
+
type: z36.nativeEnum(InviteType)
|
|
4100
3903
|
});
|
|
4101
3904
|
|
|
4102
3905
|
// ../../b4m-core/packages/services/dist/src/sharingService/create.js
|
|
4103
|
-
import { z as
|
|
3906
|
+
import { z as z37 } from "zod";
|
|
4104
3907
|
var defaultExpiration = () => new Date((/* @__PURE__ */ new Date()).getFullYear() + 100, (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate());
|
|
4105
3908
|
var DEFAULT_AVAILABLE = 1;
|
|
4106
|
-
var createInviteSchema =
|
|
4107
|
-
id:
|
|
4108
|
-
type:
|
|
4109
|
-
permissions:
|
|
4110
|
-
recipients:
|
|
4111
|
-
description:
|
|
4112
|
-
expiresAt:
|
|
4113
|
-
available:
|
|
3909
|
+
var createInviteSchema = z37.object({
|
|
3910
|
+
id: z37.string(),
|
|
3911
|
+
type: z37.nativeEnum(InviteType),
|
|
3912
|
+
permissions: z37.array(z37.nativeEnum(Permission)),
|
|
3913
|
+
recipients: z37.string().array().optional(),
|
|
3914
|
+
description: z37.string().optional(),
|
|
3915
|
+
expiresAt: z37.date().optional().default(defaultExpiration()),
|
|
3916
|
+
available: z37.number().optional().default(DEFAULT_AVAILABLE)
|
|
4114
3917
|
});
|
|
4115
3918
|
|
|
4116
3919
|
// ../../b4m-core/packages/services/dist/src/sharingService/get.js
|
|
4117
|
-
import { z as
|
|
4118
|
-
var getInviteSchema =
|
|
4119
|
-
id:
|
|
4120
|
-
withUsername:
|
|
3920
|
+
import { z as z38 } from "zod";
|
|
3921
|
+
var getInviteSchema = z38.object({
|
|
3922
|
+
id: z38.string(),
|
|
3923
|
+
withUsername: z38.boolean().optional()
|
|
4121
3924
|
});
|
|
4122
3925
|
|
|
4123
3926
|
// ../../b4m-core/packages/services/dist/src/sharingService/listByDocumentIdAndType.js
|
|
4124
|
-
import { z as
|
|
4125
|
-
var listInviteByDocumentIdAndTypeSchema =
|
|
4126
|
-
documentId:
|
|
4127
|
-
type:
|
|
3927
|
+
import { z as z39 } from "zod";
|
|
3928
|
+
var listInviteByDocumentIdAndTypeSchema = z39.object({
|
|
3929
|
+
documentId: z39.string(),
|
|
3930
|
+
type: z39.nativeEnum(InviteType)
|
|
4128
3931
|
});
|
|
4129
3932
|
|
|
4130
3933
|
// ../../b4m-core/packages/services/dist/src/sharingService/listOwnPending.js
|
|
4131
|
-
import { z as
|
|
4132
|
-
var listOwnPendingInvitesSchema =
|
|
4133
|
-
limit:
|
|
4134
|
-
page:
|
|
3934
|
+
import { z as z40 } from "zod";
|
|
3935
|
+
var listOwnPendingInvitesSchema = z40.object({
|
|
3936
|
+
limit: z40.number().min(1).max(100).default(20),
|
|
3937
|
+
page: z40.number().min(1).default(1)
|
|
4135
3938
|
});
|
|
4136
3939
|
|
|
4137
3940
|
// ../../b4m-core/packages/services/dist/src/sharingService/refuse.js
|
|
4138
|
-
import { z as
|
|
4139
|
-
var refuseInviteSchema =
|
|
4140
|
-
id:
|
|
3941
|
+
import { z as z41 } from "zod";
|
|
3942
|
+
var refuseInviteSchema = z41.object({
|
|
3943
|
+
id: z41.string()
|
|
4141
3944
|
});
|
|
4142
3945
|
|
|
4143
3946
|
// ../../b4m-core/packages/services/dist/src/sharingService/revoke.js
|
|
4144
|
-
import { z as
|
|
4145
|
-
var revokeSharingSchema =
|
|
4146
|
-
id:
|
|
4147
|
-
type:
|
|
4148
|
-
userId:
|
|
4149
|
-
projectId:
|
|
3947
|
+
import { z as z42 } from "zod";
|
|
3948
|
+
var revokeSharingSchema = z42.object({
|
|
3949
|
+
id: z42.string(),
|
|
3950
|
+
type: z42.enum(["files", "sessions", "projects"]),
|
|
3951
|
+
userId: z42.string(),
|
|
3952
|
+
projectId: z42.string().optional()
|
|
4150
3953
|
});
|
|
4151
3954
|
|
|
4152
3955
|
// ../../b4m-core/packages/services/dist/src/projectService/addFiles.js
|
|
4153
|
-
import { z as
|
|
3956
|
+
import { z as z43 } from "zod";
|
|
4154
3957
|
import uniq from "lodash/uniq.js";
|
|
4155
|
-
var addFilesProjectSchema =
|
|
4156
|
-
projectId:
|
|
4157
|
-
fileIds:
|
|
3958
|
+
var addFilesProjectSchema = z43.object({
|
|
3959
|
+
projectId: z43.string().nonempty(),
|
|
3960
|
+
fileIds: z43.array(z43.string().nonempty())
|
|
4158
3961
|
});
|
|
4159
3962
|
|
|
4160
3963
|
// ../../b4m-core/packages/services/dist/src/projectService/addSessions.js
|
|
4161
|
-
var addSessionsProjectSchema =
|
|
4162
|
-
projectId:
|
|
4163
|
-
sessionIds:
|
|
3964
|
+
var addSessionsProjectSchema = z44.object({
|
|
3965
|
+
projectId: z44.string().nonempty(),
|
|
3966
|
+
sessionIds: z44.array(z44.string().nonempty())
|
|
4164
3967
|
});
|
|
4165
3968
|
|
|
4166
3969
|
// ../../b4m-core/packages/services/dist/src/projectService/get.js
|
|
4167
|
-
import { z as
|
|
4168
|
-
var getProjectSchema =
|
|
4169
|
-
id:
|
|
3970
|
+
import { z as z45 } from "zod";
|
|
3971
|
+
var getProjectSchema = z45.object({
|
|
3972
|
+
id: z45.string()
|
|
4170
3973
|
});
|
|
4171
3974
|
|
|
4172
3975
|
// ../../b4m-core/packages/services/dist/src/projectService/update.js
|
|
4173
|
-
import { z as
|
|
4174
|
-
var updateProjectSchema =
|
|
4175
|
-
id:
|
|
4176
|
-
name:
|
|
4177
|
-
description:
|
|
3976
|
+
import { z as z46 } from "zod";
|
|
3977
|
+
var updateProjectSchema = z46.object({
|
|
3978
|
+
id: z46.string(),
|
|
3979
|
+
name: z46.string().optional(),
|
|
3980
|
+
description: z46.string().optional()
|
|
4178
3981
|
});
|
|
4179
3982
|
|
|
4180
3983
|
// ../../b4m-core/packages/services/dist/src/projectService/delete.js
|
|
4181
|
-
import { z as
|
|
4182
|
-
var deleteProjectSchema =
|
|
4183
|
-
id:
|
|
3984
|
+
import { z as z47 } from "zod";
|
|
3985
|
+
var deleteProjectSchema = z47.object({
|
|
3986
|
+
id: z47.string()
|
|
4184
3987
|
});
|
|
4185
3988
|
|
|
4186
3989
|
// ../../b4m-core/packages/services/dist/src/projectService/removeFiles.js
|
|
3990
|
+
import { z as z48 } from "zod";
|
|
3991
|
+
var removeProjectFilesSchema = z48.object({
|
|
3992
|
+
projectId: z48.string(),
|
|
3993
|
+
fileIds: z48.array(z48.string())
|
|
3994
|
+
});
|
|
3995
|
+
|
|
3996
|
+
// ../../b4m-core/packages/services/dist/src/projectService/removeSessions.js
|
|
4187
3997
|
import { z as z49 } from "zod";
|
|
4188
|
-
var
|
|
3998
|
+
var removeProjectSessionsSchema = z49.object({
|
|
4189
3999
|
projectId: z49.string(),
|
|
4190
|
-
|
|
4000
|
+
sessionIds: z49.array(z49.string())
|
|
4191
4001
|
});
|
|
4192
4002
|
|
|
4193
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4003
|
+
// ../../b4m-core/packages/services/dist/src/projectService/listSessions.js
|
|
4194
4004
|
import { z as z50 } from "zod";
|
|
4195
|
-
var
|
|
4196
|
-
projectId: z50.string()
|
|
4197
|
-
sessionIds: z50.array(z50.string())
|
|
4005
|
+
var listProjectSessionsSchema = z50.object({
|
|
4006
|
+
projectId: z50.string()
|
|
4198
4007
|
});
|
|
4199
4008
|
|
|
4200
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4009
|
+
// ../../b4m-core/packages/services/dist/src/projectService/listFiles.js
|
|
4201
4010
|
import { z as z51 } from "zod";
|
|
4202
|
-
var
|
|
4011
|
+
var listProjectFilesSchema = z51.object({
|
|
4203
4012
|
projectId: z51.string()
|
|
4204
4013
|
});
|
|
4205
4014
|
|
|
4206
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4015
|
+
// ../../b4m-core/packages/services/dist/src/projectService/listInvites.js
|
|
4207
4016
|
import { z as z52 } from "zod";
|
|
4208
|
-
var
|
|
4209
|
-
|
|
4017
|
+
var listProjectInvitesParamsSchema = z52.object({
|
|
4018
|
+
id: z52.string(),
|
|
4019
|
+
statuses: z52.string().optional().default(""),
|
|
4020
|
+
limit: z52.coerce.number().optional().default(10),
|
|
4021
|
+
page: z52.coerce.number().optional().default(1)
|
|
4210
4022
|
});
|
|
4211
4023
|
|
|
4212
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4024
|
+
// ../../b4m-core/packages/services/dist/src/projectService/addSystemPrompts.js
|
|
4213
4025
|
import { z as z53 } from "zod";
|
|
4214
|
-
var
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
limit: z53.coerce.number().optional().default(10),
|
|
4218
|
-
page: z53.coerce.number().optional().default(1)
|
|
4026
|
+
var addSystemPromptsSchema = z53.object({
|
|
4027
|
+
projectId: z53.string(),
|
|
4028
|
+
fileIds: z53.array(z53.string())
|
|
4219
4029
|
});
|
|
4220
4030
|
|
|
4221
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4031
|
+
// ../../b4m-core/packages/services/dist/src/projectService/toggleSystemPrompt.js
|
|
4222
4032
|
import { z as z54 } from "zod";
|
|
4223
|
-
var
|
|
4033
|
+
var toggleSystemPromptSchema = z54.object({
|
|
4224
4034
|
projectId: z54.string(),
|
|
4225
|
-
|
|
4035
|
+
fileId: z54.string()
|
|
4226
4036
|
});
|
|
4227
4037
|
|
|
4228
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4038
|
+
// ../../b4m-core/packages/services/dist/src/projectService/removeSystemPrompt.js
|
|
4229
4039
|
import { z as z55 } from "zod";
|
|
4230
|
-
var
|
|
4040
|
+
var removeSystemPromptSchema = z55.object({
|
|
4231
4041
|
projectId: z55.string(),
|
|
4232
4042
|
fileId: z55.string()
|
|
4233
4043
|
});
|
|
4234
4044
|
|
|
4235
|
-
// ../../b4m-core/packages/services/dist/src/projectService/removeSystemPrompt.js
|
|
4236
|
-
import { z as z56 } from "zod";
|
|
4237
|
-
var removeSystemPromptSchema = z56.object({
|
|
4238
|
-
projectId: z56.string(),
|
|
4239
|
-
fileId: z56.string()
|
|
4240
|
-
});
|
|
4241
|
-
|
|
4242
4045
|
// ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
|
|
4243
|
-
import { z as
|
|
4046
|
+
import { z as z58 } from "zod";
|
|
4244
4047
|
|
|
4245
4048
|
// ../../b4m-core/packages/services/dist/src/favoriteService/create.js
|
|
4246
|
-
import { z as
|
|
4247
|
-
var createFavoriteParametersSchema =
|
|
4248
|
-
documentId:
|
|
4249
|
-
documentType:
|
|
4049
|
+
import { z as z56 } from "zod";
|
|
4050
|
+
var createFavoriteParametersSchema = z56.object({
|
|
4051
|
+
documentId: z56.string(),
|
|
4052
|
+
documentType: z56.nativeEnum(FavoriteDocumentType)
|
|
4250
4053
|
});
|
|
4251
4054
|
|
|
4252
4055
|
// ../../b4m-core/packages/services/dist/src/favoriteService/delete.js
|
|
4253
|
-
import { z as
|
|
4254
|
-
var deleteFavoriteParametersSchema =
|
|
4255
|
-
documentId:
|
|
4256
|
-
documentType:
|
|
4056
|
+
import { z as z57 } from "zod";
|
|
4057
|
+
var deleteFavoriteParametersSchema = z57.object({
|
|
4058
|
+
documentId: z57.string(),
|
|
4059
|
+
documentType: z57.nativeEnum(FavoriteDocumentType)
|
|
4257
4060
|
});
|
|
4258
4061
|
|
|
4259
4062
|
// ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
|
|
4260
|
-
var addFavoriteParametersSchema =
|
|
4261
|
-
projectId:
|
|
4063
|
+
var addFavoriteParametersSchema = z58.object({
|
|
4064
|
+
projectId: z58.string()
|
|
4262
4065
|
});
|
|
4263
4066
|
|
|
4264
4067
|
// ../../b4m-core/packages/services/dist/src/projectService/deleteFavorite.js
|
|
4265
|
-
import { z as
|
|
4266
|
-
var deleteFavoriteParametersSchema2 =
|
|
4267
|
-
projectId:
|
|
4068
|
+
import { z as z59 } from "zod";
|
|
4069
|
+
var deleteFavoriteParametersSchema2 = z59.object({
|
|
4070
|
+
projectId: z59.string()
|
|
4268
4071
|
});
|
|
4269
4072
|
|
|
4270
4073
|
// ../../b4m-core/packages/services/dist/src/projectService/removeNonExistentFiles.js
|
|
4271
|
-
import { z as
|
|
4272
|
-
var removeNonExistentFilesSchema =
|
|
4273
|
-
projectId:
|
|
4074
|
+
import { z as z60 } from "zod";
|
|
4075
|
+
var removeNonExistentFilesSchema = z60.object({
|
|
4076
|
+
projectId: z60.string()
|
|
4274
4077
|
});
|
|
4275
4078
|
|
|
4276
4079
|
// ../../b4m-core/packages/services/dist/src/projectService/leaveProject.js
|
|
4277
|
-
import { z as
|
|
4278
|
-
var leaveProjectParamsSchema =
|
|
4279
|
-
id:
|
|
4280
|
-
userIdToRemove:
|
|
4080
|
+
import { z as z61 } from "zod";
|
|
4081
|
+
var leaveProjectParamsSchema = z61.object({
|
|
4082
|
+
id: z61.string(),
|
|
4083
|
+
userIdToRemove: z61.string().optional()
|
|
4281
4084
|
// Optional: if provided, this is a removal by owner
|
|
4282
4085
|
});
|
|
4283
4086
|
|
|
4284
4087
|
// ../../b4m-core/packages/services/dist/src/sessionService/update.js
|
|
4285
4088
|
import uniq3 from "lodash/uniq.js";
|
|
4286
4089
|
import isEqual from "lodash/isEqual.js";
|
|
4287
|
-
import { z as
|
|
4288
|
-
var updateSessionParamtersSchema =
|
|
4289
|
-
id:
|
|
4290
|
-
name:
|
|
4291
|
-
knowledgeIds:
|
|
4292
|
-
artifactIds:
|
|
4293
|
-
tags:
|
|
4294
|
-
lastUsedModel:
|
|
4090
|
+
import { z as z62 } from "zod";
|
|
4091
|
+
var updateSessionParamtersSchema = z62.object({
|
|
4092
|
+
id: z62.string(),
|
|
4093
|
+
name: z62.string().optional(),
|
|
4094
|
+
knowledgeIds: z62.array(z62.string()).optional(),
|
|
4095
|
+
artifactIds: z62.array(z62.string()).optional(),
|
|
4096
|
+
tags: z62.array(z62.object({ name: z62.string(), strength: z62.number() })).optional(),
|
|
4097
|
+
lastUsedModel: z62.string().optional()
|
|
4295
4098
|
});
|
|
4296
4099
|
|
|
4297
4100
|
// ../../b4m-core/packages/services/dist/src/sessionService/clone.js
|
|
4298
|
-
import { z as
|
|
4299
|
-
var cloneSessionSchema =
|
|
4300
|
-
id:
|
|
4101
|
+
import { z as z63 } from "zod";
|
|
4102
|
+
var cloneSessionSchema = z63.object({
|
|
4103
|
+
id: z63.string()
|
|
4301
4104
|
});
|
|
4302
4105
|
|
|
4303
4106
|
// ../../b4m-core/packages/services/dist/src/sessionService/fork.js
|
|
4107
|
+
import { z as z64 } from "zod";
|
|
4108
|
+
var forkSessionSchema = z64.object({
|
|
4109
|
+
sessionId: z64.string(),
|
|
4110
|
+
messageId: z64.string()
|
|
4111
|
+
});
|
|
4112
|
+
|
|
4113
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/snip.js
|
|
4304
4114
|
import { z as z65 } from "zod";
|
|
4305
|
-
var
|
|
4115
|
+
var snipSessionSchema = z65.object({
|
|
4306
4116
|
sessionId: z65.string(),
|
|
4307
4117
|
messageId: z65.string()
|
|
4308
4118
|
});
|
|
4309
4119
|
|
|
4310
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/
|
|
4120
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/get.js
|
|
4311
4121
|
import { z as z66 } from "zod";
|
|
4312
|
-
var
|
|
4313
|
-
|
|
4314
|
-
messageId: z66.string()
|
|
4122
|
+
var getSessionSchema = z66.object({
|
|
4123
|
+
id: z66.string()
|
|
4315
4124
|
});
|
|
4316
4125
|
|
|
4317
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/
|
|
4126
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/deleteMessage.js
|
|
4318
4127
|
import { z as z67 } from "zod";
|
|
4319
|
-
var
|
|
4320
|
-
|
|
4128
|
+
var deleteSessionMessageSchema = z67.object({
|
|
4129
|
+
sessionId: z67.string(),
|
|
4130
|
+
messageId: z67.string()
|
|
4321
4131
|
});
|
|
4322
4132
|
|
|
4323
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/
|
|
4133
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/addFavorite.js
|
|
4324
4134
|
import { z as z68 } from "zod";
|
|
4325
|
-
var
|
|
4326
|
-
sessionId: z68.string()
|
|
4327
|
-
messageId: z68.string()
|
|
4135
|
+
var addFavoriteParametersSchema2 = z68.object({
|
|
4136
|
+
sessionId: z68.string()
|
|
4328
4137
|
});
|
|
4329
4138
|
|
|
4330
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/
|
|
4139
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/deleteFavorite.js
|
|
4331
4140
|
import { z as z69 } from "zod";
|
|
4332
|
-
var
|
|
4141
|
+
var deleteFavoriteParametersSchema3 = z69.object({
|
|
4333
4142
|
sessionId: z69.string()
|
|
4334
4143
|
});
|
|
4335
4144
|
|
|
4336
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/deleteFavorite.js
|
|
4337
|
-
import { z as z70 } from "zod";
|
|
4338
|
-
var deleteFavoriteParametersSchema3 = z70.object({
|
|
4339
|
-
sessionId: z70.string()
|
|
4340
|
-
});
|
|
4341
|
-
|
|
4342
4145
|
// ../../b4m-core/packages/services/dist/src/sessionService/autoName.js
|
|
4343
|
-
import { z as
|
|
4344
|
-
var autoNameParameterSchema =
|
|
4345
|
-
sessionId:
|
|
4146
|
+
import { z as z70 } from "zod";
|
|
4147
|
+
var autoNameParameterSchema = z70.object({
|
|
4148
|
+
sessionId: z70.string(),
|
|
4346
4149
|
/** The maximum number of words to include in the title */
|
|
4347
|
-
maxWords:
|
|
4150
|
+
maxWords: z70.number().optional()
|
|
4348
4151
|
});
|
|
4349
4152
|
|
|
4350
4153
|
// ../../b4m-core/packages/services/dist/src/organizationService/search.js
|
|
4351
|
-
import { z as
|
|
4352
|
-
var searchSchema2 =
|
|
4154
|
+
import { z as z71 } from "zod";
|
|
4155
|
+
var searchSchema2 = z71.object({
|
|
4353
4156
|
/**
|
|
4354
4157
|
* Text search query (searches in name and description)
|
|
4355
4158
|
*/
|
|
4356
|
-
query:
|
|
4159
|
+
query: z71.string().optional(),
|
|
4357
4160
|
/**
|
|
4358
4161
|
* Filter by personal organizations
|
|
4359
4162
|
*/
|
|
4360
|
-
filters:
|
|
4361
|
-
personal:
|
|
4362
|
-
userId:
|
|
4163
|
+
filters: z71.object({
|
|
4164
|
+
personal: z71.union([z71.enum(["true", "false"]).transform((val) => val === "true"), z71.boolean()]).optional(),
|
|
4165
|
+
userId: z71.string().optional()
|
|
4363
4166
|
}).default({}),
|
|
4364
|
-
pagination:
|
|
4365
|
-
page:
|
|
4366
|
-
limit:
|
|
4167
|
+
pagination: z71.object({
|
|
4168
|
+
page: z71.coerce.number().int().positive().default(1),
|
|
4169
|
+
limit: z71.coerce.number().int().positive().max(100).default(10)
|
|
4367
4170
|
}).default({
|
|
4368
4171
|
page: 1,
|
|
4369
4172
|
limit: 10
|
|
4370
4173
|
}),
|
|
4371
|
-
orderBy:
|
|
4372
|
-
field:
|
|
4373
|
-
direction:
|
|
4174
|
+
orderBy: z71.object({
|
|
4175
|
+
field: z71.enum(["name", "createdAt", "updatedAt"]).default("name"),
|
|
4176
|
+
direction: z71.enum(["asc", "desc"]).default("asc")
|
|
4374
4177
|
}).default({
|
|
4375
4178
|
field: "name",
|
|
4376
4179
|
direction: "asc"
|
|
@@ -4378,357 +4181,357 @@ var searchSchema2 = z72.object({
|
|
|
4378
4181
|
});
|
|
4379
4182
|
|
|
4380
4183
|
// ../../b4m-core/packages/services/dist/src/organizationService/get.js
|
|
4381
|
-
import { z as
|
|
4382
|
-
var getSchema =
|
|
4184
|
+
import { z as z72 } from "zod";
|
|
4185
|
+
var getSchema = z72.object({
|
|
4383
4186
|
/**
|
|
4384
4187
|
* Organization ID
|
|
4385
4188
|
*/
|
|
4386
|
-
id:
|
|
4189
|
+
id: z72.string().min(1)
|
|
4387
4190
|
});
|
|
4388
4191
|
|
|
4389
4192
|
// ../../b4m-core/packages/services/dist/src/organizationService/addMember.js
|
|
4390
|
-
import { z as
|
|
4391
|
-
var addMemberSchema =
|
|
4392
|
-
userId:
|
|
4393
|
-
email:
|
|
4394
|
-
organizationId:
|
|
4395
|
-
force:
|
|
4193
|
+
import { z as z73 } from "zod";
|
|
4194
|
+
var addMemberSchema = z73.object({
|
|
4195
|
+
userId: z73.string().optional(),
|
|
4196
|
+
email: z73.string().optional(),
|
|
4197
|
+
organizationId: z73.string(),
|
|
4198
|
+
force: z73.boolean().optional()
|
|
4396
4199
|
// If true, add the user to the organization even if it's at full capacity
|
|
4397
4200
|
});
|
|
4398
4201
|
|
|
4399
4202
|
// ../../b4m-core/packages/services/dist/src/organizationService/getUsers.js
|
|
4400
|
-
import { z as
|
|
4401
|
-
var getUsersSchema =
|
|
4402
|
-
id:
|
|
4203
|
+
import { z as z74 } from "zod";
|
|
4204
|
+
var getUsersSchema = z74.object({
|
|
4205
|
+
id: z74.string()
|
|
4403
4206
|
});
|
|
4404
4207
|
|
|
4405
4208
|
// ../../b4m-core/packages/services/dist/src/organizationService/create.js
|
|
4406
|
-
import { z as
|
|
4407
|
-
var createSchema =
|
|
4408
|
-
name:
|
|
4409
|
-
personal:
|
|
4410
|
-
seats:
|
|
4411
|
-
stripeCustomerId:
|
|
4412
|
-
billingOwnerId:
|
|
4209
|
+
import { z as z75 } from "zod";
|
|
4210
|
+
var createSchema = z75.object({
|
|
4211
|
+
name: z75.string(),
|
|
4212
|
+
personal: z75.boolean().default(false),
|
|
4213
|
+
seats: z75.number().default(1),
|
|
4214
|
+
stripeCustomerId: z75.string().nullable(),
|
|
4215
|
+
billingOwnerId: z75.string().optional(),
|
|
4413
4216
|
// Optional billing owner (defaults to user if not provided)
|
|
4414
|
-
managerId:
|
|
4217
|
+
managerId: z75.string().optional()
|
|
4415
4218
|
// Optional team manager
|
|
4416
4219
|
});
|
|
4417
4220
|
|
|
4418
4221
|
// ../../b4m-core/packages/services/dist/src/organizationService/update.js
|
|
4419
|
-
import { z as
|
|
4420
|
-
var updateSchema =
|
|
4421
|
-
id:
|
|
4422
|
-
name:
|
|
4423
|
-
description:
|
|
4424
|
-
billingContact:
|
|
4425
|
-
currentCredits:
|
|
4426
|
-
systemPrompt:
|
|
4222
|
+
import { z as z76 } from "zod";
|
|
4223
|
+
var updateSchema = z76.object({
|
|
4224
|
+
id: z76.string(),
|
|
4225
|
+
name: z76.string().optional(),
|
|
4226
|
+
description: z76.string().optional(),
|
|
4227
|
+
billingContact: z76.string().optional(),
|
|
4228
|
+
currentCredits: z76.coerce.number().optional(),
|
|
4229
|
+
systemPrompt: z76.string().max(1e4).optional()
|
|
4427
4230
|
// ~2500 tokens
|
|
4428
4231
|
});
|
|
4429
4232
|
|
|
4430
4233
|
// ../../b4m-core/packages/services/dist/src/organizationService/delete.js
|
|
4431
|
-
import { z as
|
|
4432
|
-
var deleteSchema =
|
|
4234
|
+
import { z as z77 } from "zod";
|
|
4235
|
+
var deleteSchema = z77.object({
|
|
4433
4236
|
/**
|
|
4434
4237
|
* Organization ID
|
|
4435
4238
|
*/
|
|
4436
|
-
id:
|
|
4239
|
+
id: z77.string().min(1)
|
|
4437
4240
|
});
|
|
4438
4241
|
|
|
4439
4242
|
// ../../b4m-core/packages/services/dist/src/organizationService/listPendingUsers.js
|
|
4440
|
-
import { z as
|
|
4441
|
-
var listPendingUsersSchema =
|
|
4442
|
-
organizationId:
|
|
4243
|
+
import { z as z78 } from "zod";
|
|
4244
|
+
var listPendingUsersSchema = z78.object({
|
|
4245
|
+
organizationId: z78.string()
|
|
4443
4246
|
});
|
|
4444
4247
|
|
|
4445
4248
|
// ../../b4m-core/packages/services/dist/src/organizationService/revokeAccess.js
|
|
4446
|
-
import { z as
|
|
4447
|
-
var revokeAccessSchema =
|
|
4448
|
-
id:
|
|
4449
|
-
userId:
|
|
4249
|
+
import { z as z79 } from "zod";
|
|
4250
|
+
var revokeAccessSchema = z79.object({
|
|
4251
|
+
id: z79.string(),
|
|
4252
|
+
userId: z79.string()
|
|
4450
4253
|
});
|
|
4451
4254
|
|
|
4452
4255
|
// ../../b4m-core/packages/services/dist/src/organizationService/leave.js
|
|
4453
|
-
import { z as
|
|
4454
|
-
var organizationLeaveSchema =
|
|
4455
|
-
id:
|
|
4256
|
+
import { z as z80 } from "zod";
|
|
4257
|
+
var organizationLeaveSchema = z80.object({
|
|
4258
|
+
id: z80.string()
|
|
4456
4259
|
});
|
|
4457
4260
|
|
|
4458
4261
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/create.js
|
|
4459
|
-
import { z as
|
|
4460
|
-
var createApiKeySchema =
|
|
4461
|
-
apiKey:
|
|
4462
|
-
description:
|
|
4463
|
-
isActive:
|
|
4464
|
-
type:
|
|
4465
|
-
expireDays:
|
|
4262
|
+
import { z as z81 } from "zod";
|
|
4263
|
+
var createApiKeySchema = z81.object({
|
|
4264
|
+
apiKey: z81.string().min(6),
|
|
4265
|
+
description: z81.string().optional().default(""),
|
|
4266
|
+
isActive: z81.boolean().optional().default(true),
|
|
4267
|
+
type: z81.nativeEnum(ApiKeyType),
|
|
4268
|
+
expireDays: z81.number().min(1).max(365).default(90)
|
|
4466
4269
|
// Default 90-day expiration
|
|
4467
4270
|
});
|
|
4468
4271
|
|
|
4469
4272
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/set.js
|
|
4470
|
-
import { z as
|
|
4471
|
-
var setApiKeySchema =
|
|
4472
|
-
id:
|
|
4473
|
-
type:
|
|
4273
|
+
import { z as z82 } from "zod";
|
|
4274
|
+
var setApiKeySchema = z82.object({
|
|
4275
|
+
id: z82.string(),
|
|
4276
|
+
type: z82.nativeEnum(ApiKeyType)
|
|
4474
4277
|
});
|
|
4475
4278
|
|
|
4476
4279
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/delete.js
|
|
4477
|
-
import { z as
|
|
4478
|
-
var deleteApiKeySchema =
|
|
4479
|
-
id:
|
|
4280
|
+
import { z as z83 } from "zod";
|
|
4281
|
+
var deleteApiKeySchema = z83.object({
|
|
4282
|
+
id: z83.string()
|
|
4480
4283
|
});
|
|
4481
4284
|
|
|
4482
4285
|
// ../../b4m-core/packages/services/dist/src/fabFileService/get.js
|
|
4483
|
-
import { z as
|
|
4484
|
-
var getFabFileSchema =
|
|
4485
|
-
id:
|
|
4286
|
+
import { z as z84 } from "zod";
|
|
4287
|
+
var getFabFileSchema = z84.object({
|
|
4288
|
+
id: z84.string()
|
|
4486
4289
|
});
|
|
4487
4290
|
|
|
4488
4291
|
// ../../b4m-core/packages/services/dist/src/fabFileService/list.js
|
|
4489
|
-
import { z as
|
|
4490
|
-
var listFabFilesSchema =
|
|
4491
|
-
ids:
|
|
4292
|
+
import { z as z85 } from "zod";
|
|
4293
|
+
var listFabFilesSchema = z85.object({
|
|
4294
|
+
ids: z85.array(z85.string()).optional()
|
|
4492
4295
|
});
|
|
4493
4296
|
|
|
4494
4297
|
// ../../b4m-core/packages/services/dist/src/fabFileService/update.js
|
|
4495
4298
|
import mime from "mime-types";
|
|
4496
4299
|
import { v4 as uuidv42 } from "uuid";
|
|
4497
|
-
import { z as
|
|
4498
|
-
var updateFabFileSchema =
|
|
4499
|
-
id:
|
|
4500
|
-
fileName:
|
|
4501
|
-
mimeType:
|
|
4502
|
-
fileContent:
|
|
4503
|
-
type:
|
|
4504
|
-
system:
|
|
4505
|
-
systemPriority:
|
|
4506
|
-
sessionId:
|
|
4507
|
-
notes:
|
|
4508
|
-
primaryTag:
|
|
4509
|
-
tags:
|
|
4510
|
-
name:
|
|
4511
|
-
strength:
|
|
4300
|
+
import { z as z86 } from "zod";
|
|
4301
|
+
var updateFabFileSchema = z86.object({
|
|
4302
|
+
id: z86.string(),
|
|
4303
|
+
fileName: z86.string().optional(),
|
|
4304
|
+
mimeType: z86.string().optional(),
|
|
4305
|
+
fileContent: z86.string().optional(),
|
|
4306
|
+
type: z86.nativeEnum(KnowledgeType).optional(),
|
|
4307
|
+
system: z86.boolean().optional(),
|
|
4308
|
+
systemPriority: z86.number().min(0).max(999).optional(),
|
|
4309
|
+
sessionId: z86.string().optional(),
|
|
4310
|
+
notes: z86.string().optional(),
|
|
4311
|
+
primaryTag: z86.string().optional(),
|
|
4312
|
+
tags: z86.array(z86.object({
|
|
4313
|
+
name: z86.string(),
|
|
4314
|
+
strength: z86.number()
|
|
4512
4315
|
})).optional(),
|
|
4513
|
-
error:
|
|
4316
|
+
error: z86.string().nullable().optional()
|
|
4514
4317
|
});
|
|
4515
4318
|
|
|
4516
4319
|
// ../../b4m-core/packages/services/dist/src/fabFileService/delete.js
|
|
4517
|
-
import { z as
|
|
4518
|
-
var deleteFabFileSchema =
|
|
4519
|
-
id:
|
|
4320
|
+
import { z as z87 } from "zod";
|
|
4321
|
+
var deleteFabFileSchema = z87.object({
|
|
4322
|
+
id: z87.string()
|
|
4520
4323
|
});
|
|
4521
4324
|
|
|
4522
4325
|
// ../../b4m-core/packages/services/dist/src/fabFileService/chunk.js
|
|
4523
|
-
import { z as
|
|
4524
|
-
var chunkFileSchema =
|
|
4525
|
-
fabFileId:
|
|
4526
|
-
embeddingModel:
|
|
4326
|
+
import { z as z88 } from "zod";
|
|
4327
|
+
var chunkFileSchema = z88.object({
|
|
4328
|
+
fabFileId: z88.string(),
|
|
4329
|
+
embeddingModel: z88.string()
|
|
4527
4330
|
});
|
|
4528
4331
|
|
|
4529
4332
|
// ../../b4m-core/packages/services/dist/src/fabFileService/vectorize.js
|
|
4530
|
-
import { z as
|
|
4531
|
-
var vectorizeFabFileChunkSchema =
|
|
4532
|
-
fabFileId:
|
|
4533
|
-
chunkId:
|
|
4333
|
+
import { z as z89 } from "zod";
|
|
4334
|
+
var vectorizeFabFileChunkSchema = z89.object({
|
|
4335
|
+
fabFileId: z89.string(),
|
|
4336
|
+
chunkId: z89.string()
|
|
4534
4337
|
});
|
|
4535
4338
|
|
|
4536
4339
|
// ../../b4m-core/packages/services/dist/src/fabFileService/listBySession.js
|
|
4537
|
-
import { z as
|
|
4538
|
-
var listFabFilesBySessionSchema =
|
|
4539
|
-
sessionId:
|
|
4340
|
+
import { z as z90 } from "zod";
|
|
4341
|
+
var listFabFilesBySessionSchema = z90.object({
|
|
4342
|
+
sessionId: z90.string()
|
|
4540
4343
|
});
|
|
4541
4344
|
|
|
4542
4345
|
// ../../b4m-core/packages/services/dist/src/fabFileService/listByQuest.js
|
|
4543
|
-
import { z as
|
|
4544
|
-
var listFabFilesByQuestSchema =
|
|
4545
|
-
questId:
|
|
4346
|
+
import { z as z91 } from "zod";
|
|
4347
|
+
var listFabFilesByQuestSchema = z91.object({
|
|
4348
|
+
questId: z91.string()
|
|
4546
4349
|
});
|
|
4547
4350
|
|
|
4548
4351
|
// ../../b4m-core/packages/services/dist/src/fabFileService/createByUrl.js
|
|
4549
|
-
import { z as
|
|
4550
|
-
var createFabFileByUrlSchema =
|
|
4551
|
-
url:
|
|
4352
|
+
import { z as z92 } from "zod";
|
|
4353
|
+
var createFabFileByUrlSchema = z92.object({
|
|
4354
|
+
url: z92.string().regex(/^(?!https?:\/\/(drive|docs)\.google\.com\/(?:file\/d\/|open\?id=|uc\?id=|document\/d\/|spreadsheets\/d\/|presentation\/d\/|forms\/d\/|drive\/folders\/)([a-zA-Z0-9_-]{10,})).+/)
|
|
4552
4355
|
});
|
|
4553
4356
|
|
|
4554
4357
|
// ../../b4m-core/packages/services/dist/src/fabFileService/search.js
|
|
4555
|
-
import { z as
|
|
4556
|
-
var searchFabFilesSchema =
|
|
4557
|
-
search:
|
|
4558
|
-
filters:
|
|
4559
|
-
tags:
|
|
4560
|
-
type:
|
|
4561
|
-
shared:
|
|
4358
|
+
import { z as z93 } from "zod";
|
|
4359
|
+
var searchFabFilesSchema = z93.object({
|
|
4360
|
+
search: z93.string().optional(),
|
|
4361
|
+
filters: z93.object({
|
|
4362
|
+
tags: z93.array(z93.string()).optional(),
|
|
4363
|
+
type: z93.enum(["text", "pdf", "url", "image", "excel", "word", "json", "csv", "markdown", "code"]).optional(),
|
|
4364
|
+
shared: z93.coerce.boolean().optional(),
|
|
4562
4365
|
// Indicates if the user is searching for shared files
|
|
4563
|
-
curated:
|
|
4366
|
+
curated: z93.coerce.boolean().optional(),
|
|
4564
4367
|
// Indicates if the user is searching for curated notebook files
|
|
4565
|
-
projectId:
|
|
4566
|
-
ids:
|
|
4368
|
+
projectId: z93.string().optional(),
|
|
4369
|
+
ids: z93.array(z93.string()).optional()
|
|
4567
4370
|
// Add support for filtering by IDs
|
|
4568
4371
|
}).optional(),
|
|
4569
|
-
pagination:
|
|
4570
|
-
page:
|
|
4571
|
-
limit:
|
|
4372
|
+
pagination: z93.object({
|
|
4373
|
+
page: z93.coerce.number(),
|
|
4374
|
+
limit: z93.coerce.number()
|
|
4572
4375
|
}).optional(),
|
|
4573
|
-
order:
|
|
4574
|
-
by:
|
|
4575
|
-
direction:
|
|
4376
|
+
order: z93.object({
|
|
4377
|
+
by: z93.enum(["createdAt", "fileName", "fileSize"]),
|
|
4378
|
+
direction: z93.enum(["asc", "desc"])
|
|
4576
4379
|
}).optional(),
|
|
4577
|
-
options:
|
|
4578
|
-
includeShared:
|
|
4380
|
+
options: z93.object({
|
|
4381
|
+
includeShared: z93.coerce.boolean().optional()
|
|
4579
4382
|
}).optional()
|
|
4580
4383
|
});
|
|
4581
4384
|
|
|
4582
4385
|
// ../../b4m-core/packages/services/dist/src/fabFileService/addFavorite.js
|
|
4583
|
-
import { z as
|
|
4584
|
-
var addFavoriteParametersSchema3 =
|
|
4585
|
-
fileId:
|
|
4386
|
+
import { z as z94 } from "zod";
|
|
4387
|
+
var addFavoriteParametersSchema3 = z94.object({
|
|
4388
|
+
fileId: z94.string()
|
|
4586
4389
|
});
|
|
4587
4390
|
|
|
4588
4391
|
// ../../b4m-core/packages/services/dist/src/fabFileService/deleteFavorite.js
|
|
4589
|
-
import { z as
|
|
4590
|
-
var deleteFavoriteParametersSchema4 =
|
|
4591
|
-
fileId:
|
|
4392
|
+
import { z as z95 } from "zod";
|
|
4393
|
+
var deleteFavoriteParametersSchema4 = z95.object({
|
|
4394
|
+
fileId: z95.string()
|
|
4592
4395
|
});
|
|
4593
4396
|
|
|
4594
4397
|
// ../../b4m-core/packages/services/dist/src/fabFileService/toggleTags.js
|
|
4595
|
-
import { z as
|
|
4596
|
-
var fabFileToggleTagsSchema =
|
|
4597
|
-
ids:
|
|
4598
|
-
tags:
|
|
4398
|
+
import { z as z96 } from "zod";
|
|
4399
|
+
var fabFileToggleTagsSchema = z96.object({
|
|
4400
|
+
ids: z96.array(z96.string()),
|
|
4401
|
+
tags: z96.array(z96.string())
|
|
4599
4402
|
});
|
|
4600
4403
|
|
|
4601
4404
|
// ../../b4m-core/packages/services/dist/src/fabFileService/edit.js
|
|
4602
|
-
import { z as
|
|
4405
|
+
import { z as z97 } from "zod";
|
|
4603
4406
|
import { diffLines } from "diff";
|
|
4604
|
-
var editFabFileSchema =
|
|
4605
|
-
id:
|
|
4606
|
-
instruction:
|
|
4607
|
-
selection:
|
|
4608
|
-
start:
|
|
4609
|
-
end:
|
|
4407
|
+
var editFabFileSchema = z97.object({
|
|
4408
|
+
id: z97.string(),
|
|
4409
|
+
instruction: z97.string(),
|
|
4410
|
+
selection: z97.object({
|
|
4411
|
+
start: z97.number(),
|
|
4412
|
+
end: z97.number()
|
|
4610
4413
|
}).optional(),
|
|
4611
|
-
preserveFormatting:
|
|
4612
|
-
applyImmediately:
|
|
4414
|
+
preserveFormatting: z97.boolean().optional().default(true),
|
|
4415
|
+
applyImmediately: z97.boolean().optional().default(false)
|
|
4613
4416
|
});
|
|
4614
4417
|
|
|
4615
4418
|
// ../../b4m-core/packages/services/dist/src/fabFileService/applyEdit.js
|
|
4616
4419
|
import mime2 from "mime-types";
|
|
4617
4420
|
import { v4 as uuidv43 } from "uuid";
|
|
4618
|
-
import { z as
|
|
4619
|
-
var applyEditSchema =
|
|
4620
|
-
id:
|
|
4621
|
-
modifiedContent:
|
|
4622
|
-
createBackup:
|
|
4421
|
+
import { z as z98 } from "zod";
|
|
4422
|
+
var applyEditSchema = z98.object({
|
|
4423
|
+
id: z98.string(),
|
|
4424
|
+
modifiedContent: z98.string(),
|
|
4425
|
+
createBackup: z98.boolean().optional().default(true)
|
|
4623
4426
|
});
|
|
4624
4427
|
|
|
4625
4428
|
// ../../b4m-core/packages/services/dist/src/friendshipService/respondToFriendRequest.js
|
|
4626
|
-
import { z as
|
|
4627
|
-
var respondToFriendRequestSchema =
|
|
4628
|
-
id:
|
|
4429
|
+
import { z as z99 } from "zod";
|
|
4430
|
+
var respondToFriendRequestSchema = z99.object({
|
|
4431
|
+
id: z99.string(),
|
|
4629
4432
|
/** The user ID of the recipient of the friend request */
|
|
4630
|
-
userId:
|
|
4631
|
-
accept:
|
|
4433
|
+
userId: z99.string(),
|
|
4434
|
+
accept: z99.boolean()
|
|
4632
4435
|
});
|
|
4633
4436
|
|
|
4634
4437
|
// ../../b4m-core/packages/services/dist/src/friendshipService/unfriend.js
|
|
4635
|
-
import { z as
|
|
4636
|
-
var unfriendSchema =
|
|
4637
|
-
friendshipId:
|
|
4438
|
+
import { z as z100 } from "zod";
|
|
4439
|
+
var unfriendSchema = z100.object({
|
|
4440
|
+
friendshipId: z100.string(),
|
|
4638
4441
|
/** The user ID of the user who wants to unfriend the other user */
|
|
4639
|
-
userId:
|
|
4442
|
+
userId: z100.string()
|
|
4640
4443
|
});
|
|
4641
4444
|
|
|
4642
4445
|
// ../../b4m-core/packages/services/dist/src/friendshipService/list.js
|
|
4643
|
-
import { z as
|
|
4644
|
-
var listFriendsSchema =
|
|
4645
|
-
userId:
|
|
4446
|
+
import { z as z101 } from "zod";
|
|
4447
|
+
var listFriendsSchema = z101.object({
|
|
4448
|
+
userId: z101.string()
|
|
4646
4449
|
});
|
|
4647
|
-
var listPendingFriendRequestsSchema =
|
|
4648
|
-
userId:
|
|
4450
|
+
var listPendingFriendRequestsSchema = z101.object({
|
|
4451
|
+
userId: z101.string()
|
|
4649
4452
|
});
|
|
4650
4453
|
|
|
4651
4454
|
// ../../b4m-core/packages/services/dist/src/adminService/loginAs.js
|
|
4652
|
-
import { z as
|
|
4653
|
-
var loginAsSchema =
|
|
4654
|
-
targetUserId:
|
|
4455
|
+
import { z as z102 } from "zod";
|
|
4456
|
+
var loginAsSchema = z102.object({
|
|
4457
|
+
targetUserId: z102.string()
|
|
4655
4458
|
});
|
|
4656
4459
|
|
|
4657
4460
|
// ../../b4m-core/packages/services/dist/src/cacheService/get.js
|
|
4658
|
-
import { z as
|
|
4659
|
-
var getParamsSchema =
|
|
4660
|
-
key:
|
|
4461
|
+
import { z as z103 } from "zod";
|
|
4462
|
+
var getParamsSchema = z103.object({
|
|
4463
|
+
key: z103.string()
|
|
4661
4464
|
});
|
|
4662
4465
|
|
|
4663
4466
|
// ../../b4m-core/packages/services/dist/src/cacheService/set.js
|
|
4664
|
-
import { z as
|
|
4665
|
-
var setParamsSchema =
|
|
4666
|
-
key:
|
|
4667
|
-
value:
|
|
4467
|
+
import { z as z104 } from "zod";
|
|
4468
|
+
var setParamsSchema = z104.object({
|
|
4469
|
+
key: z104.string(),
|
|
4470
|
+
value: z104.any(),
|
|
4668
4471
|
/**
|
|
4669
4472
|
* Time to live in milliseconds
|
|
4670
4473
|
*/
|
|
4671
|
-
ttl:
|
|
4672
|
-
recache:
|
|
4474
|
+
ttl: z104.number(),
|
|
4475
|
+
recache: z104.boolean().optional()
|
|
4673
4476
|
});
|
|
4674
4477
|
|
|
4675
4478
|
// ../../b4m-core/packages/services/dist/src/cacheService/ttl.js
|
|
4676
|
-
import { z as
|
|
4677
|
-
var ttlParamsSchema =
|
|
4678
|
-
key:
|
|
4479
|
+
import { z as z105 } from "zod";
|
|
4480
|
+
var ttlParamsSchema = z105.object({
|
|
4481
|
+
key: z105.string()
|
|
4679
4482
|
});
|
|
4680
4483
|
|
|
4681
4484
|
// ../../b4m-core/packages/services/dist/src/cacheService/weeklyReports.js
|
|
4682
|
-
import { z as
|
|
4485
|
+
import { z as z106 } from "zod";
|
|
4683
4486
|
import dayjs3 from "dayjs";
|
|
4684
|
-
var weeklyReportSchema =
|
|
4685
|
-
startDate:
|
|
4686
|
-
endDate:
|
|
4687
|
-
report:
|
|
4688
|
-
aiInsights:
|
|
4487
|
+
var weeklyReportSchema = z106.object({
|
|
4488
|
+
startDate: z106.string(),
|
|
4489
|
+
endDate: z106.string(),
|
|
4490
|
+
report: z106.string(),
|
|
4491
|
+
aiInsights: z106.string().nullable()
|
|
4689
4492
|
});
|
|
4690
4493
|
|
|
4691
4494
|
// ../../b4m-core/packages/services/dist/src/embeddingCacheService/generateCacheKey.js
|
|
4692
4495
|
import crypto2 from "crypto";
|
|
4693
4496
|
|
|
4694
4497
|
// ../../b4m-core/packages/services/dist/src/researchAgentService/create.js
|
|
4498
|
+
import { z as z107 } from "zod";
|
|
4499
|
+
var researchAgentCreateSchema = z107.object({
|
|
4500
|
+
name: z107.string().min(1),
|
|
4501
|
+
description: z107.string().min(1)
|
|
4502
|
+
});
|
|
4503
|
+
|
|
4504
|
+
// ../../b4m-core/packages/services/dist/src/researchAgentService/update.js
|
|
4695
4505
|
import { z as z108 } from "zod";
|
|
4696
|
-
var
|
|
4506
|
+
var researchAgentUpdateSchema = z108.object({
|
|
4507
|
+
id: z108.string(),
|
|
4697
4508
|
name: z108.string().min(1),
|
|
4698
4509
|
description: z108.string().min(1)
|
|
4699
4510
|
});
|
|
4700
4511
|
|
|
4701
|
-
// ../../b4m-core/packages/services/dist/src/researchAgentService/
|
|
4512
|
+
// ../../b4m-core/packages/services/dist/src/researchAgentService/remove.js
|
|
4702
4513
|
import { z as z109 } from "zod";
|
|
4703
|
-
var
|
|
4704
|
-
id: z109.string()
|
|
4705
|
-
name: z109.string().min(1),
|
|
4706
|
-
description: z109.string().min(1)
|
|
4514
|
+
var researchAgentRemoveSchema = z109.object({
|
|
4515
|
+
id: z109.string()
|
|
4707
4516
|
});
|
|
4708
4517
|
|
|
4709
|
-
// ../../b4m-core/packages/services/dist/src/researchAgentService/
|
|
4518
|
+
// ../../b4m-core/packages/services/dist/src/researchAgentService/get.js
|
|
4710
4519
|
import { z as z110 } from "zod";
|
|
4711
|
-
var
|
|
4520
|
+
var researchAgentGetSchema = z110.object({
|
|
4712
4521
|
id: z110.string()
|
|
4713
4522
|
});
|
|
4714
4523
|
|
|
4715
|
-
// ../../b4m-core/packages/services/dist/src/researchAgentService/get.js
|
|
4716
|
-
import { z as z111 } from "zod";
|
|
4717
|
-
var researchAgentGetSchema = z111.object({
|
|
4718
|
-
id: z111.string()
|
|
4719
|
-
});
|
|
4720
|
-
|
|
4721
4524
|
// ../../b4m-core/packages/services/dist/src/researchAgentService/listFiles.js
|
|
4722
|
-
import { z as
|
|
4723
|
-
var researchAgentListFilesSchema =
|
|
4525
|
+
import { z as z111 } from "zod";
|
|
4526
|
+
var researchAgentListFilesSchema = z111.object({
|
|
4724
4527
|
/**
|
|
4725
4528
|
* The ID of the research agent
|
|
4726
4529
|
*/
|
|
4727
|
-
id:
|
|
4530
|
+
id: z111.string()
|
|
4728
4531
|
});
|
|
4729
4532
|
|
|
4730
4533
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/process.js
|
|
4731
|
-
import { z as
|
|
4534
|
+
import { z as z112 } from "zod";
|
|
4732
4535
|
|
|
4733
4536
|
// ../../b4m-core/packages/services/dist/src/lib/turndown.js
|
|
4734
4537
|
import turndown from "turndown";
|
|
@@ -5119,316 +4922,316 @@ var deepResearchTool = {
|
|
|
5119
4922
|
};
|
|
5120
4923
|
|
|
5121
4924
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/process.js
|
|
5122
|
-
var ResearchTaskProcessSchema =
|
|
5123
|
-
id:
|
|
4925
|
+
var ResearchTaskProcessSchema = z112.object({
|
|
4926
|
+
id: z112.string()
|
|
5124
4927
|
});
|
|
5125
4928
|
|
|
5126
4929
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/create.js
|
|
5127
|
-
import { z as
|
|
5128
|
-
var researchTaskCreateSchema =
|
|
5129
|
-
researchAgentId:
|
|
5130
|
-
title:
|
|
5131
|
-
description:
|
|
5132
|
-
prompt:
|
|
5133
|
-
type:
|
|
5134
|
-
executionType:
|
|
5135
|
-
fileTagId:
|
|
5136
|
-
autoGeneratedTag:
|
|
5137
|
-
name:
|
|
5138
|
-
icon:
|
|
5139
|
-
color:
|
|
4930
|
+
import { z as z113 } from "zod";
|
|
4931
|
+
var researchTaskCreateSchema = z113.object({
|
|
4932
|
+
researchAgentId: z113.string(),
|
|
4933
|
+
title: z113.string().max(100),
|
|
4934
|
+
description: z113.string().max(500),
|
|
4935
|
+
prompt: z113.string().max(500).optional(),
|
|
4936
|
+
type: z113.nativeEnum(ResearchTaskType),
|
|
4937
|
+
executionType: z113.nativeEnum(ResearchTaskExecutionType).default(ResearchTaskExecutionType.ON_DEMAND),
|
|
4938
|
+
fileTagId: z113.string().optional(),
|
|
4939
|
+
autoGeneratedTag: z113.object({
|
|
4940
|
+
name: z113.string(),
|
|
4941
|
+
icon: z113.string(),
|
|
4942
|
+
color: z113.string()
|
|
5140
4943
|
}).optional()
|
|
5141
4944
|
});
|
|
5142
4945
|
var researchTaskScrapeCreateSchema = researchTaskCreateSchema.extend({
|
|
5143
|
-
urls:
|
|
5144
|
-
canDiscoverLinks:
|
|
4946
|
+
urls: z113.array(z113.string().url()).min(1),
|
|
4947
|
+
canDiscoverLinks: z113.boolean()
|
|
5145
4948
|
});
|
|
5146
4949
|
var researchTaskPeriodicCreateSchema = researchTaskCreateSchema.extend({
|
|
5147
|
-
executionPeriodicStartAt:
|
|
5148
|
-
executionPeriodicEndAt:
|
|
5149
|
-
executionPeriodicFrequency:
|
|
4950
|
+
executionPeriodicStartAt: z113.coerce.date(),
|
|
4951
|
+
executionPeriodicEndAt: z113.coerce.date(),
|
|
4952
|
+
executionPeriodicFrequency: z113.nativeEnum(ResearchTaskPeriodicFrequencyType)
|
|
5150
4953
|
});
|
|
5151
4954
|
var researchTaskScheduledCreateSchema = researchTaskCreateSchema.extend({
|
|
5152
|
-
executionScheduledAt:
|
|
4955
|
+
executionScheduledAt: z113.coerce.date()
|
|
5153
4956
|
});
|
|
5154
4957
|
var researchTaskDeepResearchCreateSchema = researchTaskCreateSchema.extend({
|
|
5155
|
-
maxDepth:
|
|
4958
|
+
maxDepth: z113.number().min(1).max(10).optional()
|
|
5156
4959
|
});
|
|
5157
4960
|
|
|
5158
4961
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/search.js
|
|
5159
|
-
import { z as
|
|
5160
|
-
var searchResearchTasksSchema =
|
|
5161
|
-
search:
|
|
4962
|
+
import { z as z114 } from "zod";
|
|
4963
|
+
var searchResearchTasksSchema = z114.object({
|
|
4964
|
+
search: z114.string().optional(),
|
|
5162
4965
|
// ADD FILTERS SCHEMA HERE
|
|
5163
4966
|
// filters: z
|
|
5164
4967
|
// .object({
|
|
5165
4968
|
// userId: z.string().optional(),
|
|
5166
4969
|
// })
|
|
5167
4970
|
// .optional(),
|
|
5168
|
-
pagination:
|
|
5169
|
-
page:
|
|
5170
|
-
limit:
|
|
4971
|
+
pagination: z114.object({
|
|
4972
|
+
page: z114.coerce.number().optional(),
|
|
4973
|
+
limit: z114.coerce.number().optional()
|
|
5171
4974
|
}).optional(),
|
|
5172
|
-
orderBy:
|
|
5173
|
-
by:
|
|
5174
|
-
direction:
|
|
4975
|
+
orderBy: z114.object({
|
|
4976
|
+
by: z114.enum(["createdAt", "updatedAt"]).optional(),
|
|
4977
|
+
direction: z114.enum(["asc", "desc"]).optional()
|
|
5175
4978
|
}).optional()
|
|
5176
4979
|
});
|
|
5177
4980
|
|
|
5178
4981
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/get.js
|
|
5179
|
-
import { z as
|
|
5180
|
-
var getResearchTaskSchema =
|
|
5181
|
-
id:
|
|
4982
|
+
import { z as z115 } from "zod";
|
|
4983
|
+
var getResearchTaskSchema = z115.object({
|
|
4984
|
+
id: z115.string().min(1)
|
|
5182
4985
|
});
|
|
5183
4986
|
|
|
5184
4987
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/update.js
|
|
5185
|
-
import { z as
|
|
5186
|
-
var updateResearchTaskSchema =
|
|
5187
|
-
id:
|
|
5188
|
-
title:
|
|
5189
|
-
description:
|
|
5190
|
-
type:
|
|
4988
|
+
import { z as z116 } from "zod";
|
|
4989
|
+
var updateResearchTaskSchema = z116.object({
|
|
4990
|
+
id: z116.string(),
|
|
4991
|
+
title: z116.string(),
|
|
4992
|
+
description: z116.string(),
|
|
4993
|
+
type: z116.nativeEnum(ResearchTaskType)
|
|
5191
4994
|
});
|
|
5192
4995
|
var researchTaskScrapeUpdateSchema = updateResearchTaskSchema.extend({
|
|
5193
|
-
urls:
|
|
5194
|
-
canDiscoverLinks:
|
|
4996
|
+
urls: z116.array(z116.string().url()).min(1),
|
|
4997
|
+
canDiscoverLinks: z116.boolean()
|
|
5195
4998
|
});
|
|
5196
4999
|
|
|
5197
5000
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/listByAgentId.js
|
|
5198
|
-
import { z as
|
|
5199
|
-
var listByAgentIdSchema =
|
|
5200
|
-
researchAgentId:
|
|
5001
|
+
import { z as z117 } from "zod";
|
|
5002
|
+
var listByAgentIdSchema = z117.object({
|
|
5003
|
+
researchAgentId: z117.string()
|
|
5201
5004
|
});
|
|
5202
5005
|
|
|
5203
5006
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/remove.js
|
|
5204
|
-
import { z as
|
|
5205
|
-
var researchTaskRemoveSchema =
|
|
5206
|
-
id:
|
|
5007
|
+
import { z as z118 } from "zod";
|
|
5008
|
+
var researchTaskRemoveSchema = z118.object({
|
|
5009
|
+
id: z118.string().min(1)
|
|
5207
5010
|
});
|
|
5208
5011
|
|
|
5209
5012
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/retry.js
|
|
5210
|
-
import { z as
|
|
5211
|
-
var researchTaskRetrySchema =
|
|
5212
|
-
id:
|
|
5213
|
-
userId:
|
|
5013
|
+
import { z as z119 } from "zod";
|
|
5014
|
+
var researchTaskRetrySchema = z119.object({
|
|
5015
|
+
id: z119.string(),
|
|
5016
|
+
userId: z119.string()
|
|
5214
5017
|
});
|
|
5215
5018
|
|
|
5216
5019
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/processDiscoveredLinks.js
|
|
5217
5020
|
import axios4 from "axios";
|
|
5218
|
-
import { z as
|
|
5021
|
+
import { z as z120 } from "zod";
|
|
5219
5022
|
import plimit from "p-limit";
|
|
5220
5023
|
import pLimit2 from "p-limit";
|
|
5221
|
-
var researchTaskProcessDiscoveredLinksSchema =
|
|
5222
|
-
id:
|
|
5024
|
+
var researchTaskProcessDiscoveredLinksSchema = z120.object({
|
|
5025
|
+
id: z120.string()
|
|
5223
5026
|
});
|
|
5224
5027
|
|
|
5225
5028
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/downloadRelevantLinks.js
|
|
5226
|
-
import { z as
|
|
5029
|
+
import { z as z121 } from "zod";
|
|
5227
5030
|
import plimit2 from "p-limit";
|
|
5228
5031
|
import axios5 from "axios";
|
|
5229
5032
|
import { fileTypeFromBuffer } from "file-type";
|
|
5230
|
-
var researchTaskDownloadRelevantLinksSchema =
|
|
5231
|
-
id:
|
|
5033
|
+
var researchTaskDownloadRelevantLinksSchema = z121.object({
|
|
5034
|
+
id: z121.string()
|
|
5232
5035
|
});
|
|
5233
5036
|
|
|
5234
5037
|
// ../../b4m-core/packages/services/dist/src/researchData/remove.js
|
|
5235
|
-
import { z as
|
|
5236
|
-
var researchDataRemoveSchema =
|
|
5237
|
-
id:
|
|
5238
|
-
researchAgentId:
|
|
5038
|
+
import { z as z122 } from "zod";
|
|
5039
|
+
var researchDataRemoveSchema = z122.object({
|
|
5040
|
+
id: z122.string(),
|
|
5041
|
+
researchAgentId: z122.string()
|
|
5239
5042
|
});
|
|
5240
5043
|
|
|
5241
5044
|
// ../../b4m-core/packages/services/dist/src/taskSchedulerService/create.js
|
|
5242
|
-
import { z as
|
|
5243
|
-
var researchTaskPayload =
|
|
5244
|
-
id:
|
|
5245
|
-
userId:
|
|
5045
|
+
import { z as z123 } from "zod";
|
|
5046
|
+
var researchTaskPayload = z123.object({
|
|
5047
|
+
id: z123.string(),
|
|
5048
|
+
userId: z123.string()
|
|
5246
5049
|
});
|
|
5247
|
-
var customTaskPayload =
|
|
5248
|
-
test:
|
|
5050
|
+
var customTaskPayload = z123.object({
|
|
5051
|
+
test: z123.string()
|
|
5249
5052
|
});
|
|
5250
|
-
var taskSchedulerCreate =
|
|
5251
|
-
|
|
5252
|
-
handler:
|
|
5053
|
+
var taskSchedulerCreate = z123.discriminatedUnion("handler", [
|
|
5054
|
+
z123.object({
|
|
5055
|
+
handler: z123.literal(TaskScheduleHandler.RESEARCH_TASK_PROCESS),
|
|
5253
5056
|
payload: researchTaskPayload,
|
|
5254
|
-
processDate:
|
|
5057
|
+
processDate: z123.date()
|
|
5255
5058
|
}),
|
|
5256
|
-
|
|
5257
|
-
handler:
|
|
5059
|
+
z123.object({
|
|
5060
|
+
handler: z123.literal(TaskScheduleHandler.CUSTOM_TASK_PROCESS),
|
|
5258
5061
|
payload: customTaskPayload,
|
|
5259
|
-
processDate:
|
|
5062
|
+
processDate: z123.date()
|
|
5260
5063
|
})
|
|
5261
5064
|
]);
|
|
5262
5065
|
|
|
5263
5066
|
// ../../b4m-core/packages/services/dist/src/tagService/createFileTag.js
|
|
5067
|
+
import { z as z124 } from "zod";
|
|
5068
|
+
var tagCreateFileTagSchema = z124.object({
|
|
5069
|
+
name: z124.string(),
|
|
5070
|
+
icon: z124.string().optional(),
|
|
5071
|
+
color: z124.string().optional(),
|
|
5072
|
+
description: z124.string().optional()
|
|
5073
|
+
});
|
|
5074
|
+
|
|
5075
|
+
// ../../b4m-core/packages/services/dist/src/tagService/create.js
|
|
5264
5076
|
import { z as z125 } from "zod";
|
|
5265
|
-
var
|
|
5077
|
+
var tagCreateSchema = z125.object({
|
|
5266
5078
|
name: z125.string(),
|
|
5267
5079
|
icon: z125.string().optional(),
|
|
5080
|
+
description: z125.string().optional(),
|
|
5268
5081
|
color: z125.string().optional(),
|
|
5269
|
-
|
|
5082
|
+
type: z125.nativeEnum(TagType)
|
|
5270
5083
|
});
|
|
5271
5084
|
|
|
5272
|
-
// ../../b4m-core/packages/services/dist/src/tagService/
|
|
5085
|
+
// ../../b4m-core/packages/services/dist/src/tagService/update.js
|
|
5273
5086
|
import { z as z126 } from "zod";
|
|
5274
|
-
var
|
|
5275
|
-
|
|
5087
|
+
var tagUpdateSchema = z126.object({
|
|
5088
|
+
id: z126.string(),
|
|
5089
|
+
name: z126.string().optional(),
|
|
5276
5090
|
icon: z126.string().optional(),
|
|
5277
5091
|
description: z126.string().optional(),
|
|
5278
|
-
color: z126.string().optional()
|
|
5279
|
-
type: z126.nativeEnum(TagType)
|
|
5280
|
-
});
|
|
5281
|
-
|
|
5282
|
-
// ../../b4m-core/packages/services/dist/src/tagService/update.js
|
|
5283
|
-
import { z as z127 } from "zod";
|
|
5284
|
-
var tagUpdateSchema = z127.object({
|
|
5285
|
-
id: z127.string(),
|
|
5286
|
-
name: z127.string().optional(),
|
|
5287
|
-
icon: z127.string().optional(),
|
|
5288
|
-
description: z127.string().optional(),
|
|
5289
|
-
color: z127.string().optional()
|
|
5092
|
+
color: z126.string().optional()
|
|
5290
5093
|
});
|
|
5291
5094
|
|
|
5292
5095
|
// ../../b4m-core/packages/services/dist/src/tagService/remove.js
|
|
5293
|
-
import { z as
|
|
5294
|
-
var tagRemoveSchema =
|
|
5295
|
-
id:
|
|
5096
|
+
import { z as z127 } from "zod";
|
|
5097
|
+
var tagRemoveSchema = z127.object({
|
|
5098
|
+
id: z127.string()
|
|
5296
5099
|
});
|
|
5297
5100
|
|
|
5298
5101
|
// ../../b4m-core/packages/services/dist/src/artifactService/create.js
|
|
5299
|
-
import { z as
|
|
5300
|
-
var createArtifactSchema =
|
|
5301
|
-
id:
|
|
5102
|
+
import { z as z128 } from "zod";
|
|
5103
|
+
var createArtifactSchema = z128.object({
|
|
5104
|
+
id: z128.string().optional(),
|
|
5302
5105
|
// Allow custom ID for AI-generated artifacts
|
|
5303
|
-
type:
|
|
5304
|
-
title:
|
|
5305
|
-
description:
|
|
5306
|
-
content:
|
|
5307
|
-
projectId:
|
|
5308
|
-
organizationId:
|
|
5309
|
-
visibility:
|
|
5310
|
-
tags:
|
|
5311
|
-
versionTag:
|
|
5312
|
-
sourceQuestId:
|
|
5313
|
-
sessionId:
|
|
5314
|
-
parentArtifactId:
|
|
5315
|
-
permissions:
|
|
5316
|
-
canRead:
|
|
5317
|
-
canWrite:
|
|
5318
|
-
canDelete:
|
|
5319
|
-
isPublic:
|
|
5320
|
-
inheritFromProject:
|
|
5106
|
+
type: z128.enum(["mermaid", "recharts", "python", "react", "html", "svg", "code", "quest", "file", "questmaster"]),
|
|
5107
|
+
title: z128.string().min(1).max(255),
|
|
5108
|
+
description: z128.string().max(1e3).optional(),
|
|
5109
|
+
content: z128.string().min(1),
|
|
5110
|
+
projectId: z128.string().optional(),
|
|
5111
|
+
organizationId: z128.string().optional(),
|
|
5112
|
+
visibility: z128.enum(["private", "project", "organization", "public"]).default("private"),
|
|
5113
|
+
tags: z128.array(z128.string().max(50)).max(20).default([]),
|
|
5114
|
+
versionTag: z128.string().max(100).optional(),
|
|
5115
|
+
sourceQuestId: z128.string().optional(),
|
|
5116
|
+
sessionId: z128.string().optional(),
|
|
5117
|
+
parentArtifactId: z128.string().optional(),
|
|
5118
|
+
permissions: z128.object({
|
|
5119
|
+
canRead: z128.array(z128.string()).default([]),
|
|
5120
|
+
canWrite: z128.array(z128.string()).default([]),
|
|
5121
|
+
canDelete: z128.array(z128.string()).default([]),
|
|
5122
|
+
isPublic: z128.boolean().default(false),
|
|
5123
|
+
inheritFromProject: z128.boolean().default(true)
|
|
5321
5124
|
}).optional(),
|
|
5322
|
-
metadata:
|
|
5125
|
+
metadata: z128.record(z128.unknown()).default({})
|
|
5323
5126
|
});
|
|
5324
5127
|
|
|
5325
5128
|
// ../../b4m-core/packages/services/dist/src/artifactService/get.js
|
|
5326
|
-
import { z as
|
|
5327
|
-
var getArtifactSchema =
|
|
5328
|
-
id:
|
|
5329
|
-
includeContent:
|
|
5330
|
-
includeVersions:
|
|
5331
|
-
version:
|
|
5129
|
+
import { z as z129 } from "zod";
|
|
5130
|
+
var getArtifactSchema = z129.object({
|
|
5131
|
+
id: z129.string(),
|
|
5132
|
+
includeContent: z129.boolean().default(false),
|
|
5133
|
+
includeVersions: z129.boolean().default(false),
|
|
5134
|
+
version: z129.number().optional()
|
|
5332
5135
|
});
|
|
5333
5136
|
|
|
5334
5137
|
// ../../b4m-core/packages/services/dist/src/artifactService/list.js
|
|
5335
|
-
import { z as
|
|
5336
|
-
var listArtifactsSchema =
|
|
5337
|
-
type:
|
|
5338
|
-
status:
|
|
5339
|
-
visibility:
|
|
5340
|
-
projectId:
|
|
5341
|
-
sessionId:
|
|
5342
|
-
tags:
|
|
5343
|
-
search:
|
|
5344
|
-
limit:
|
|
5345
|
-
offset:
|
|
5346
|
-
sortBy:
|
|
5347
|
-
sortOrder:
|
|
5348
|
-
includeDeleted:
|
|
5138
|
+
import { z as z130 } from "zod";
|
|
5139
|
+
var listArtifactsSchema = z130.object({
|
|
5140
|
+
type: z130.string().optional(),
|
|
5141
|
+
status: z130.enum(["draft", "review", "published", "archived"]).optional(),
|
|
5142
|
+
visibility: z130.enum(["private", "project", "organization", "public"]).optional(),
|
|
5143
|
+
projectId: z130.string().optional(),
|
|
5144
|
+
sessionId: z130.string().optional(),
|
|
5145
|
+
tags: z130.array(z130.string()).optional(),
|
|
5146
|
+
search: z130.string().optional(),
|
|
5147
|
+
limit: z130.number().min(1).max(100).default(20),
|
|
5148
|
+
offset: z130.number().min(0).default(0),
|
|
5149
|
+
sortBy: z130.enum(["createdAt", "updatedAt", "title", "type"]).default("updatedAt"),
|
|
5150
|
+
sortOrder: z130.enum(["asc", "desc"]).default("desc"),
|
|
5151
|
+
includeDeleted: z130.boolean().default(false)
|
|
5349
5152
|
});
|
|
5350
5153
|
|
|
5351
5154
|
// ../../b4m-core/packages/services/dist/src/artifactService/update.js
|
|
5352
|
-
import { z as
|
|
5353
|
-
var updateArtifactSchema =
|
|
5354
|
-
id:
|
|
5355
|
-
title:
|
|
5356
|
-
description:
|
|
5357
|
-
content:
|
|
5358
|
-
visibility:
|
|
5359
|
-
status:
|
|
5360
|
-
tags:
|
|
5361
|
-
versionTag:
|
|
5362
|
-
permissions:
|
|
5363
|
-
canRead:
|
|
5364
|
-
canWrite:
|
|
5365
|
-
canDelete:
|
|
5366
|
-
isPublic:
|
|
5367
|
-
inheritFromProject:
|
|
5155
|
+
import { z as z131 } from "zod";
|
|
5156
|
+
var updateArtifactSchema = z131.object({
|
|
5157
|
+
id: z131.string(),
|
|
5158
|
+
title: z131.string().min(1).max(255).optional(),
|
|
5159
|
+
description: z131.string().max(1e3).optional(),
|
|
5160
|
+
content: z131.string().optional(),
|
|
5161
|
+
visibility: z131.enum(["private", "project", "organization", "public"]).optional(),
|
|
5162
|
+
status: z131.enum(["draft", "review", "published", "archived"]).optional(),
|
|
5163
|
+
tags: z131.array(z131.string().max(50)).max(20).optional(),
|
|
5164
|
+
versionTag: z131.string().max(100).optional(),
|
|
5165
|
+
permissions: z131.object({
|
|
5166
|
+
canRead: z131.array(z131.string()).optional(),
|
|
5167
|
+
canWrite: z131.array(z131.string()).optional(),
|
|
5168
|
+
canDelete: z131.array(z131.string()).optional(),
|
|
5169
|
+
isPublic: z131.boolean().optional(),
|
|
5170
|
+
inheritFromProject: z131.boolean().optional()
|
|
5368
5171
|
}).optional(),
|
|
5369
|
-
metadata:
|
|
5370
|
-
changes:
|
|
5371
|
-
changeDescription:
|
|
5372
|
-
createNewVersion:
|
|
5373
|
-
versionMessage:
|
|
5172
|
+
metadata: z131.record(z131.unknown()).optional(),
|
|
5173
|
+
changes: z131.array(z131.string()).optional(),
|
|
5174
|
+
changeDescription: z131.string().max(1e3).optional(),
|
|
5175
|
+
createNewVersion: z131.boolean().optional(),
|
|
5176
|
+
versionMessage: z131.string().max(500).optional()
|
|
5374
5177
|
});
|
|
5375
5178
|
|
|
5376
5179
|
// ../../b4m-core/packages/services/dist/src/artifactService/delete.js
|
|
5377
|
-
import { z as
|
|
5378
|
-
var deleteArtifactSchema =
|
|
5379
|
-
id:
|
|
5380
|
-
hardDelete:
|
|
5180
|
+
import { z as z132 } from "zod";
|
|
5181
|
+
var deleteArtifactSchema = z132.object({
|
|
5182
|
+
id: z132.string(),
|
|
5183
|
+
hardDelete: z132.boolean().default(false)
|
|
5381
5184
|
// For future implementation
|
|
5382
5185
|
});
|
|
5383
5186
|
|
|
5384
5187
|
// ../../b4m-core/packages/services/dist/src/questMasterService/create.js
|
|
5385
|
-
import { z as
|
|
5386
|
-
var questSchema =
|
|
5387
|
-
id:
|
|
5388
|
-
title:
|
|
5389
|
-
description:
|
|
5390
|
-
status:
|
|
5391
|
-
order:
|
|
5392
|
-
dependencies:
|
|
5393
|
-
estimatedTime:
|
|
5394
|
-
});
|
|
5395
|
-
var questResourceSchema =
|
|
5396
|
-
title:
|
|
5397
|
-
url:
|
|
5398
|
-
type:
|
|
5399
|
-
});
|
|
5400
|
-
var createQuestMasterSchema =
|
|
5401
|
-
title:
|
|
5402
|
-
description:
|
|
5403
|
-
goal:
|
|
5404
|
-
complexity:
|
|
5405
|
-
estimatedTotalTime:
|
|
5406
|
-
prerequisites:
|
|
5407
|
-
quests:
|
|
5408
|
-
resources:
|
|
5409
|
-
projectId:
|
|
5410
|
-
organizationId:
|
|
5411
|
-
visibility:
|
|
5412
|
-
tags:
|
|
5413
|
-
permissions:
|
|
5414
|
-
canRead:
|
|
5415
|
-
canWrite:
|
|
5416
|
-
canDelete:
|
|
5417
|
-
isPublic:
|
|
5418
|
-
inheritFromProject:
|
|
5188
|
+
import { z as z133 } from "zod";
|
|
5189
|
+
var questSchema = z133.object({
|
|
5190
|
+
id: z133.string(),
|
|
5191
|
+
title: z133.string().min(1).max(255),
|
|
5192
|
+
description: z133.string().max(MAX_DESCRIPTION_LENGTH),
|
|
5193
|
+
status: z133.enum(["not_started", "in_progress", "completed", "blocked"]).default("not_started"),
|
|
5194
|
+
order: z133.number().min(0),
|
|
5195
|
+
dependencies: z133.array(z133.string()).default([]),
|
|
5196
|
+
estimatedTime: z133.string().optional()
|
|
5197
|
+
});
|
|
5198
|
+
var questResourceSchema = z133.object({
|
|
5199
|
+
title: z133.string().min(1).max(255),
|
|
5200
|
+
url: z133.string().url(),
|
|
5201
|
+
type: z133.enum(["documentation", "tutorial", "reference", "example"])
|
|
5202
|
+
});
|
|
5203
|
+
var createQuestMasterSchema = z133.object({
|
|
5204
|
+
title: z133.string().min(1).max(255),
|
|
5205
|
+
description: z133.string().max(MAX_DESCRIPTION_LENGTH).optional(),
|
|
5206
|
+
goal: z133.string().min(1).max(MAX_GOAL_LENGTH),
|
|
5207
|
+
complexity: z133.enum(["beginner", "intermediate", "advanced", "expert"]),
|
|
5208
|
+
estimatedTotalTime: z133.string().optional(),
|
|
5209
|
+
prerequisites: z133.array(z133.string().max(200)).default([]),
|
|
5210
|
+
quests: z133.array(questSchema).min(1),
|
|
5211
|
+
resources: z133.array(questResourceSchema).default([]),
|
|
5212
|
+
projectId: z133.string().optional(),
|
|
5213
|
+
organizationId: z133.string().optional(),
|
|
5214
|
+
visibility: z133.enum(["private", "project", "organization", "public"]).default("private"),
|
|
5215
|
+
tags: z133.array(z133.string().max(MAX_TAG_LENGTH)).max(20).default([]),
|
|
5216
|
+
permissions: z133.object({
|
|
5217
|
+
canRead: z133.array(z133.string()).default([]),
|
|
5218
|
+
canWrite: z133.array(z133.string()).default([]),
|
|
5219
|
+
canDelete: z133.array(z133.string()).default([]),
|
|
5220
|
+
isPublic: z133.boolean().default(false),
|
|
5221
|
+
inheritFromProject: z133.boolean().default(true)
|
|
5419
5222
|
}).optional(),
|
|
5420
|
-
sourceQuestId:
|
|
5421
|
-
sessionId:
|
|
5422
|
-
metadata:
|
|
5223
|
+
sourceQuestId: z133.string().optional(),
|
|
5224
|
+
sessionId: z133.string().optional(),
|
|
5225
|
+
metadata: z133.record(z133.unknown()).default({})
|
|
5423
5226
|
});
|
|
5424
5227
|
|
|
5425
5228
|
// ../../b4m-core/packages/services/dist/src/questMasterService/updateQuestStatus.js
|
|
5426
|
-
import { z as
|
|
5427
|
-
var updateQuestStatusSchema =
|
|
5428
|
-
artifactId:
|
|
5429
|
-
questId:
|
|
5430
|
-
status:
|
|
5431
|
-
completionNote:
|
|
5229
|
+
import { z as z134 } from "zod";
|
|
5230
|
+
var updateQuestStatusSchema = z134.object({
|
|
5231
|
+
artifactId: z134.string(),
|
|
5232
|
+
questId: z134.string(),
|
|
5233
|
+
status: z134.enum(["not_started", "in_progress", "completed", "blocked"]),
|
|
5234
|
+
completionNote: z134.string().max(500).optional()
|
|
5432
5235
|
});
|
|
5433
5236
|
|
|
5434
5237
|
// ../../b4m-core/packages/services/dist/src/dataLakeService/opensearchClient.js
|
|
@@ -5448,63 +5251,63 @@ import { v4 as uuidv44 } from "uuid";
|
|
|
5448
5251
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
5449
5252
|
|
|
5450
5253
|
// ../../b4m-core/packages/services/dist/src/emailIngestionService/types.js
|
|
5451
|
-
import { z as
|
|
5452
|
-
var processIngestedEmailOptionsSchema =
|
|
5453
|
-
platformDomain:
|
|
5454
|
-
isNewsletter:
|
|
5254
|
+
import { z as z135 } from "zod";
|
|
5255
|
+
var processIngestedEmailOptionsSchema = z135.object({
|
|
5256
|
+
platformDomain: z135.string().optional(),
|
|
5257
|
+
isNewsletter: z135.boolean().optional()
|
|
5455
5258
|
}).optional();
|
|
5456
|
-
var emailAttachmentSchema =
|
|
5457
|
-
filename:
|
|
5458
|
-
contentType:
|
|
5459
|
-
contentDisposition:
|
|
5460
|
-
size:
|
|
5461
|
-
content:
|
|
5462
|
-
related:
|
|
5463
|
-
});
|
|
5464
|
-
var parsedEmailObjectSchema =
|
|
5465
|
-
messageId:
|
|
5466
|
-
inReplyTo:
|
|
5467
|
-
references:
|
|
5468
|
-
from:
|
|
5259
|
+
var emailAttachmentSchema = z135.object({
|
|
5260
|
+
filename: z135.string().optional(),
|
|
5261
|
+
contentType: z135.string().optional(),
|
|
5262
|
+
contentDisposition: z135.string().optional(),
|
|
5263
|
+
size: z135.number().min(0),
|
|
5264
|
+
content: z135.instanceof(Buffer),
|
|
5265
|
+
related: z135.boolean().optional()
|
|
5266
|
+
});
|
|
5267
|
+
var parsedEmailObjectSchema = z135.object({
|
|
5268
|
+
messageId: z135.string().optional(),
|
|
5269
|
+
inReplyTo: z135.string().optional(),
|
|
5270
|
+
references: z135.union([z135.string(), z135.array(z135.string())]).optional(),
|
|
5271
|
+
from: z135.any().optional(),
|
|
5469
5272
|
// Complex email address object
|
|
5470
|
-
to:
|
|
5471
|
-
cc:
|
|
5472
|
-
bcc:
|
|
5473
|
-
subject:
|
|
5474
|
-
date:
|
|
5475
|
-
text:
|
|
5476
|
-
html:
|
|
5477
|
-
attachments:
|
|
5478
|
-
});
|
|
5479
|
-
var processIngestedEmailSchema =
|
|
5273
|
+
to: z135.any().optional(),
|
|
5274
|
+
cc: z135.any().optional(),
|
|
5275
|
+
bcc: z135.any().optional(),
|
|
5276
|
+
subject: z135.string().optional(),
|
|
5277
|
+
date: z135.date().optional(),
|
|
5278
|
+
text: z135.string().optional(),
|
|
5279
|
+
html: z135.string().optional(),
|
|
5280
|
+
attachments: z135.array(emailAttachmentSchema).optional()
|
|
5281
|
+
});
|
|
5282
|
+
var processIngestedEmailSchema = z135.object({
|
|
5480
5283
|
parsedEmail: parsedEmailObjectSchema,
|
|
5481
|
-
rawEmailS3Key:
|
|
5284
|
+
rawEmailS3Key: z135.string().min(1, "rawEmailS3Key cannot be empty"),
|
|
5482
5285
|
options: processIngestedEmailOptionsSchema
|
|
5483
5286
|
});
|
|
5484
5287
|
|
|
5485
5288
|
// ../../b4m-core/packages/services/dist/src/emailAnalysisService/types.js
|
|
5486
|
-
import { z as
|
|
5487
|
-
var llmAnalysisResponseSchema =
|
|
5488
|
-
summary:
|
|
5489
|
-
entities:
|
|
5490
|
-
companies:
|
|
5491
|
-
people:
|
|
5492
|
-
products:
|
|
5493
|
-
technologies:
|
|
5289
|
+
import { z as z136 } from "zod";
|
|
5290
|
+
var llmAnalysisResponseSchema = z136.object({
|
|
5291
|
+
summary: z136.string().min(1, "Summary cannot be empty"),
|
|
5292
|
+
entities: z136.object({
|
|
5293
|
+
companies: z136.array(z136.string()).default([]),
|
|
5294
|
+
people: z136.array(z136.string()).default([]),
|
|
5295
|
+
products: z136.array(z136.string()).default([]),
|
|
5296
|
+
technologies: z136.array(z136.string()).default([])
|
|
5494
5297
|
}),
|
|
5495
|
-
sentiment:
|
|
5496
|
-
actionItems:
|
|
5497
|
-
description:
|
|
5498
|
-
deadline:
|
|
5298
|
+
sentiment: z136.enum(["positive", "neutral", "negative", "urgent"]),
|
|
5299
|
+
actionItems: z136.array(z136.object({
|
|
5300
|
+
description: z136.string(),
|
|
5301
|
+
deadline: z136.string().optional()
|
|
5499
5302
|
// ISO date string from LLM
|
|
5500
5303
|
})).default([]),
|
|
5501
|
-
privacyRecommendation:
|
|
5502
|
-
embargoDetected:
|
|
5503
|
-
suggestedTags:
|
|
5304
|
+
privacyRecommendation: z136.enum(["public", "team", "private"]),
|
|
5305
|
+
embargoDetected: z136.boolean().default(false),
|
|
5306
|
+
suggestedTags: z136.array(z136.string()).default([])
|
|
5504
5307
|
});
|
|
5505
5308
|
|
|
5506
5309
|
// ../../b4m-core/packages/services/dist/src/llm/ChatCompletion.js
|
|
5507
|
-
import { z as
|
|
5310
|
+
import { z as z138 } from "zod";
|
|
5508
5311
|
|
|
5509
5312
|
// ../../b4m-core/packages/services/dist/src/llm/ChatCompletionInvoke.js
|
|
5510
5313
|
import { fromZodError } from "zod-validation-error";
|
|
@@ -6695,17 +6498,17 @@ var rechartsTool = {
|
|
|
6695
6498
|
};
|
|
6696
6499
|
|
|
6697
6500
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/editFile/index.js
|
|
6698
|
-
import { z as
|
|
6501
|
+
import { z as z137 } from "zod";
|
|
6699
6502
|
import { diffLines as diffLines2 } from "diff";
|
|
6700
|
-
var editFileSchema =
|
|
6701
|
-
fileId:
|
|
6702
|
-
instruction:
|
|
6703
|
-
selection:
|
|
6704
|
-
start:
|
|
6705
|
-
end:
|
|
6503
|
+
var editFileSchema = z137.object({
|
|
6504
|
+
fileId: z137.string().describe("The ID of the file to edit"),
|
|
6505
|
+
instruction: z137.string().describe("Natural language instruction describing the changes to make"),
|
|
6506
|
+
selection: z137.object({
|
|
6507
|
+
start: z137.number().describe("Starting character position of the selection"),
|
|
6508
|
+
end: z137.number().describe("Ending character position of the selection")
|
|
6706
6509
|
}).optional().describe("Optional selection range to edit within the file"),
|
|
6707
|
-
preserveFormatting:
|
|
6708
|
-
returnDiff:
|
|
6510
|
+
preserveFormatting: z137.boolean().optional().default(true).describe("Whether to preserve the original formatting style"),
|
|
6511
|
+
returnDiff: z137.boolean().optional().default(true).describe("Whether to return a diff of the changes")
|
|
6709
6512
|
});
|
|
6710
6513
|
function generateSimpleDiff(original, modified) {
|
|
6711
6514
|
const differences = diffLines2(original, modified);
|
|
@@ -10022,131 +9825,131 @@ var DISABLE_SERVER_THROTTLING = process.env.DISABLE_SERVER_THROTTLING === "true"
|
|
|
10022
9825
|
var questSaveMutex = new Mutex();
|
|
10023
9826
|
|
|
10024
9827
|
// ../../b4m-core/packages/services/dist/src/llm/ChatCompletion.js
|
|
10025
|
-
var QuestStartBodySchema =
|
|
10026
|
-
userId:
|
|
10027
|
-
sessionId:
|
|
10028
|
-
questId:
|
|
10029
|
-
message:
|
|
10030
|
-
messageFileIds:
|
|
10031
|
-
historyCount:
|
|
10032
|
-
fabFileIds:
|
|
9828
|
+
var QuestStartBodySchema = z138.object({
|
|
9829
|
+
userId: z138.string(),
|
|
9830
|
+
sessionId: z138.string(),
|
|
9831
|
+
questId: z138.string(),
|
|
9832
|
+
message: z138.string(),
|
|
9833
|
+
messageFileIds: z138.array(z138.string()),
|
|
9834
|
+
historyCount: z138.number(),
|
|
9835
|
+
fabFileIds: z138.array(z138.string()),
|
|
10033
9836
|
params: ChatCompletionCreateInputSchema,
|
|
10034
9837
|
dashboardParams: DashboardParamsSchema.optional(),
|
|
10035
|
-
enableQuestMaster:
|
|
10036
|
-
enableMementos:
|
|
10037
|
-
enableArtifacts:
|
|
10038
|
-
enableAgents:
|
|
9838
|
+
enableQuestMaster: z138.boolean().optional(),
|
|
9839
|
+
enableMementos: z138.boolean().optional(),
|
|
9840
|
+
enableArtifacts: z138.boolean().optional(),
|
|
9841
|
+
enableAgents: z138.boolean().optional(),
|
|
10039
9842
|
promptMeta: PromptMetaZodSchema,
|
|
10040
|
-
tools:
|
|
10041
|
-
mcpServers:
|
|
10042
|
-
projectId:
|
|
10043
|
-
organizationId:
|
|
9843
|
+
tools: z138.array(z138.union([b4mLLMTools, z138.string()])).optional(),
|
|
9844
|
+
mcpServers: z138.array(z138.string()).optional(),
|
|
9845
|
+
projectId: z138.string().optional(),
|
|
9846
|
+
organizationId: z138.string().nullable().optional(),
|
|
10044
9847
|
questMaster: QuestMasterParamsSchema.optional(),
|
|
10045
|
-
toolPromptId:
|
|
9848
|
+
toolPromptId: z138.string().optional(),
|
|
10046
9849
|
researchMode: ResearchModeParamsSchema.optional(),
|
|
10047
|
-
fallbackModel:
|
|
10048
|
-
embeddingModel:
|
|
10049
|
-
queryComplexity:
|
|
9850
|
+
fallbackModel: z138.string().optional(),
|
|
9851
|
+
embeddingModel: z138.string().optional(),
|
|
9852
|
+
queryComplexity: z138.string(),
|
|
10050
9853
|
imageConfig: GenerateImageToolCallSchema.optional(),
|
|
10051
|
-
deepResearchConfig:
|
|
10052
|
-
maxDepth:
|
|
10053
|
-
duration:
|
|
9854
|
+
deepResearchConfig: z138.object({
|
|
9855
|
+
maxDepth: z138.number().optional(),
|
|
9856
|
+
duration: z138.number().optional(),
|
|
10054
9857
|
// Note: searchers are passed via ToolContext and not through this API schema
|
|
10055
|
-
searchers:
|
|
9858
|
+
searchers: z138.array(z138.any()).optional()
|
|
10056
9859
|
}).optional(),
|
|
10057
|
-
extraContextMessages:
|
|
10058
|
-
role:
|
|
10059
|
-
content:
|
|
10060
|
-
fabFileIds:
|
|
9860
|
+
extraContextMessages: z138.array(z138.object({
|
|
9861
|
+
role: z138.enum(["user", "assistant", "system", "function", "tool"]),
|
|
9862
|
+
content: z138.union([z138.string(), z138.array(z138.any())]),
|
|
9863
|
+
fabFileIds: z138.array(z138.string()).optional()
|
|
10061
9864
|
})).optional(),
|
|
10062
9865
|
/** User's timezone (IANA format, e.g., "America/New_York") */
|
|
10063
|
-
timezone:
|
|
9866
|
+
timezone: z138.string().optional()
|
|
10064
9867
|
});
|
|
10065
9868
|
|
|
10066
9869
|
// ../../b4m-core/packages/services/dist/src/llm/ImageGeneration.js
|
|
10067
9870
|
import axios8 from "axios";
|
|
10068
9871
|
import { fileTypeFromBuffer as fileTypeFromBuffer4 } from "file-type";
|
|
10069
9872
|
import { v4 as uuidv47 } from "uuid";
|
|
10070
|
-
import { z as
|
|
9873
|
+
import { z as z139 } from "zod";
|
|
10071
9874
|
import { fromZodError as fromZodError2 } from "zod-validation-error";
|
|
10072
9875
|
var ImageGenerationBodySchema = OpenAIImageGenerationInput.extend({
|
|
10073
|
-
sessionId:
|
|
10074
|
-
questId:
|
|
10075
|
-
userId:
|
|
10076
|
-
prompt:
|
|
10077
|
-
safety_tolerance:
|
|
10078
|
-
prompt_upsampling:
|
|
10079
|
-
seed:
|
|
10080
|
-
output_format:
|
|
10081
|
-
width:
|
|
10082
|
-
height:
|
|
10083
|
-
aspect_ratio:
|
|
10084
|
-
fabFileIds:
|
|
9876
|
+
sessionId: z139.string(),
|
|
9877
|
+
questId: z139.string(),
|
|
9878
|
+
userId: z139.string(),
|
|
9879
|
+
prompt: z139.string(),
|
|
9880
|
+
safety_tolerance: z139.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
|
|
9881
|
+
prompt_upsampling: z139.boolean().optional().default(false),
|
|
9882
|
+
seed: z139.number().nullable().optional(),
|
|
9883
|
+
output_format: z139.enum(["jpeg", "png"]).nullable().optional().default("png"),
|
|
9884
|
+
width: z139.number().optional(),
|
|
9885
|
+
height: z139.number().optional(),
|
|
9886
|
+
aspect_ratio: z139.string().optional(),
|
|
9887
|
+
fabFileIds: z139.array(z139.string()).optional()
|
|
10085
9888
|
});
|
|
10086
9889
|
|
|
10087
9890
|
// ../../b4m-core/packages/services/dist/src/llm/VideoGeneration.js
|
|
10088
9891
|
import axios9 from "axios";
|
|
10089
9892
|
import { v4 as uuidv48 } from "uuid";
|
|
10090
|
-
import { z as
|
|
9893
|
+
import { z as z140 } from "zod";
|
|
10091
9894
|
import { fromZodError as fromZodError3 } from "zod-validation-error";
|
|
10092
|
-
var VideoGenerationBodySchema =
|
|
10093
|
-
sessionId:
|
|
10094
|
-
questId:
|
|
10095
|
-
userId:
|
|
10096
|
-
prompt:
|
|
10097
|
-
model:
|
|
10098
|
-
seconds:
|
|
10099
|
-
size:
|
|
9895
|
+
var VideoGenerationBodySchema = z140.object({
|
|
9896
|
+
sessionId: z140.string(),
|
|
9897
|
+
questId: z140.string(),
|
|
9898
|
+
userId: z140.string(),
|
|
9899
|
+
prompt: z140.string(),
|
|
9900
|
+
model: z140.nativeEnum(VideoModels).default(VideoModels.SORA_2),
|
|
9901
|
+
seconds: z140.union([z140.literal(4), z140.literal(8), z140.literal(12)]).default(4),
|
|
9902
|
+
size: z140.enum(["720x1280", "1280x720", "1024x1792", "1792x1024"]).default(VIDEO_SIZE_CONSTRAINTS.SORA.defaultSize)
|
|
10100
9903
|
});
|
|
10101
9904
|
|
|
10102
9905
|
// ../../b4m-core/packages/services/dist/src/llm/ImageEdit.js
|
|
10103
9906
|
import axios10 from "axios";
|
|
10104
9907
|
import { fileTypeFromBuffer as fileTypeFromBuffer5 } from "file-type";
|
|
10105
9908
|
import { v4 as uuidv49 } from "uuid";
|
|
10106
|
-
import { z as
|
|
9909
|
+
import { z as z141 } from "zod";
|
|
10107
9910
|
import { fromZodError as fromZodError4 } from "zod-validation-error";
|
|
10108
9911
|
var ImageEditBodySchema = OpenAIImageGenerationInput.extend({
|
|
10109
|
-
sessionId:
|
|
10110
|
-
questId:
|
|
10111
|
-
userId:
|
|
10112
|
-
prompt:
|
|
10113
|
-
safety_tolerance:
|
|
10114
|
-
prompt_upsampling:
|
|
10115
|
-
seed:
|
|
10116
|
-
output_format:
|
|
10117
|
-
width:
|
|
10118
|
-
height:
|
|
10119
|
-
aspect_ratio:
|
|
10120
|
-
size:
|
|
10121
|
-
fabFileIds:
|
|
10122
|
-
image:
|
|
9912
|
+
sessionId: z141.string(),
|
|
9913
|
+
questId: z141.string(),
|
|
9914
|
+
userId: z141.string(),
|
|
9915
|
+
prompt: z141.string(),
|
|
9916
|
+
safety_tolerance: z141.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
|
|
9917
|
+
prompt_upsampling: z141.boolean().optional().default(false),
|
|
9918
|
+
seed: z141.number().nullable().optional(),
|
|
9919
|
+
output_format: z141.enum(["jpeg", "png"]).optional().default("png"),
|
|
9920
|
+
width: z141.number().optional(),
|
|
9921
|
+
height: z141.number().optional(),
|
|
9922
|
+
aspect_ratio: z141.string().optional(),
|
|
9923
|
+
size: z141.string().optional(),
|
|
9924
|
+
fabFileIds: z141.array(z141.string()).optional(),
|
|
9925
|
+
image: z141.string()
|
|
10123
9926
|
});
|
|
10124
9927
|
|
|
10125
9928
|
// ../../b4m-core/packages/services/dist/src/llm/refineText.js
|
|
10126
|
-
import { z as
|
|
10127
|
-
var refineTextLLMSchema =
|
|
10128
|
-
text:
|
|
10129
|
-
context:
|
|
9929
|
+
import { z as z142 } from "zod";
|
|
9930
|
+
var refineTextLLMSchema = z142.object({
|
|
9931
|
+
text: z142.string(),
|
|
9932
|
+
context: z142.string().optional()
|
|
10130
9933
|
// tone: z.enum(['formal', 'informal', 'neutral']).optional(),
|
|
10131
9934
|
// style: z.enum(['technical', 'creative', 'academic', 'business', 'narrative']).optional(),
|
|
10132
9935
|
});
|
|
10133
9936
|
|
|
10134
9937
|
// ../../b4m-core/packages/services/dist/src/llm/MementoEvaluationService.js
|
|
10135
|
-
import { z as
|
|
10136
|
-
var SingleMementoEvalSchema =
|
|
10137
|
-
importance:
|
|
9938
|
+
import { z as z143 } from "zod";
|
|
9939
|
+
var SingleMementoEvalSchema = z143.object({
|
|
9940
|
+
importance: z143.number().min(1).max(10),
|
|
10138
9941
|
// 1-10 scale for personal info importance
|
|
10139
|
-
summary:
|
|
10140
|
-
tags:
|
|
9942
|
+
summary: z143.string(),
|
|
9943
|
+
tags: z143.array(z143.string()).optional()
|
|
10141
9944
|
});
|
|
10142
|
-
var MementoEvalResponseSchema =
|
|
10143
|
-
isPersonal:
|
|
10144
|
-
mementos:
|
|
9945
|
+
var MementoEvalResponseSchema = z143.object({
|
|
9946
|
+
isPersonal: z143.boolean(),
|
|
9947
|
+
mementos: z143.array(SingleMementoEvalSchema).optional()
|
|
10145
9948
|
// Array of distinct personal information
|
|
10146
9949
|
});
|
|
10147
9950
|
|
|
10148
9951
|
// ../../b4m-core/packages/services/dist/src/llm/SmallLLMService.js
|
|
10149
|
-
import { z as
|
|
9952
|
+
import { z as z144 } from "zod";
|
|
10150
9953
|
|
|
10151
9954
|
// ../../b4m-core/packages/services/dist/src/auth/AccessTokenGeneratorService.js
|
|
10152
9955
|
import jwt2 from "jsonwebtoken";
|
|
@@ -10681,7 +10484,7 @@ function buildHookContext(params) {
|
|
|
10681
10484
|
}
|
|
10682
10485
|
|
|
10683
10486
|
// src/agents/types.ts
|
|
10684
|
-
import { z as
|
|
10487
|
+
import { z as z145 } from "zod";
|
|
10685
10488
|
var HookBlockedError = class extends Error {
|
|
10686
10489
|
constructor(toolName, reason) {
|
|
10687
10490
|
super(`Hook blocked execution of ${toolName}: ${reason || "No reason provided"}`);
|
|
@@ -10693,39 +10496,39 @@ var ALWAYS_DENIED_FOR_AGENTS = [
|
|
|
10693
10496
|
"agent_delegate"
|
|
10694
10497
|
// No agent chaining
|
|
10695
10498
|
];
|
|
10696
|
-
var CommandHookSchema =
|
|
10697
|
-
type:
|
|
10698
|
-
command:
|
|
10699
|
-
timeout:
|
|
10700
|
-
});
|
|
10701
|
-
var PromptHookSchema =
|
|
10702
|
-
type:
|
|
10703
|
-
prompt:
|
|
10704
|
-
timeout:
|
|
10705
|
-
});
|
|
10706
|
-
var HookDefinitionSchema =
|
|
10707
|
-
var HookMatcherSchema =
|
|
10708
|
-
matcher:
|
|
10709
|
-
hooks:
|
|
10710
|
-
});
|
|
10711
|
-
var AgentHooksSchema =
|
|
10712
|
-
PreToolUse:
|
|
10713
|
-
PostToolUse:
|
|
10714
|
-
PostToolUseFailure:
|
|
10715
|
-
Stop:
|
|
10499
|
+
var CommandHookSchema = z145.object({
|
|
10500
|
+
type: z145.literal("command"),
|
|
10501
|
+
command: z145.string().min(1, "Command is required for command hooks"),
|
|
10502
|
+
timeout: z145.number().optional()
|
|
10503
|
+
});
|
|
10504
|
+
var PromptHookSchema = z145.object({
|
|
10505
|
+
type: z145.literal("prompt"),
|
|
10506
|
+
prompt: z145.string().min(1, "Prompt is required for prompt hooks"),
|
|
10507
|
+
timeout: z145.number().optional()
|
|
10508
|
+
});
|
|
10509
|
+
var HookDefinitionSchema = z145.discriminatedUnion("type", [CommandHookSchema, PromptHookSchema]);
|
|
10510
|
+
var HookMatcherSchema = z145.object({
|
|
10511
|
+
matcher: z145.string().optional(),
|
|
10512
|
+
hooks: z145.array(HookDefinitionSchema)
|
|
10513
|
+
});
|
|
10514
|
+
var AgentHooksSchema = z145.object({
|
|
10515
|
+
PreToolUse: z145.array(HookMatcherSchema).optional(),
|
|
10516
|
+
PostToolUse: z145.array(HookMatcherSchema).optional(),
|
|
10517
|
+
PostToolUseFailure: z145.array(HookMatcherSchema).optional(),
|
|
10518
|
+
Stop: z145.array(HookMatcherSchema).optional()
|
|
10716
10519
|
}).optional();
|
|
10717
|
-
var AgentFrontmatterSchema =
|
|
10718
|
-
description:
|
|
10719
|
-
model:
|
|
10720
|
-
"allowed-tools":
|
|
10721
|
-
"denied-tools":
|
|
10722
|
-
"max-iterations":
|
|
10723
|
-
quick:
|
|
10724
|
-
medium:
|
|
10725
|
-
very_thorough:
|
|
10520
|
+
var AgentFrontmatterSchema = z145.object({
|
|
10521
|
+
description: z145.string().min(1, "Agent description is required"),
|
|
10522
|
+
model: z145.string().optional(),
|
|
10523
|
+
"allowed-tools": z145.array(z145.string()).optional(),
|
|
10524
|
+
"denied-tools": z145.array(z145.string()).optional(),
|
|
10525
|
+
"max-iterations": z145.object({
|
|
10526
|
+
quick: z145.number().int().positive().optional(),
|
|
10527
|
+
medium: z145.number().int().positive().optional(),
|
|
10528
|
+
very_thorough: z145.number().int().positive().optional()
|
|
10726
10529
|
}).optional(),
|
|
10727
|
-
"default-thoroughness":
|
|
10728
|
-
variables:
|
|
10530
|
+
"default-thoroughness": z145.enum(["quick", "medium", "very_thorough"]).optional(),
|
|
10531
|
+
variables: z145.record(z145.string()).optional(),
|
|
10729
10532
|
hooks: AgentHooksSchema
|
|
10730
10533
|
});
|
|
10731
10534
|
var DEFAULT_MAX_ITERATIONS = {
|
|
@@ -11036,6 +10839,67 @@ function generateCliTools(userId, llm, model, permissionManager, showPermissionP
|
|
|
11036
10839
|
return { tools: tools2, agentContext };
|
|
11037
10840
|
}
|
|
11038
10841
|
|
|
10842
|
+
// src/config/toolSafety.ts
|
|
10843
|
+
import { z as z146 } from "zod";
|
|
10844
|
+
var ToolCategorySchema = z146.enum([
|
|
10845
|
+
"auto_approve",
|
|
10846
|
+
// Safe tools that run automatically without permission
|
|
10847
|
+
"prompt_always",
|
|
10848
|
+
// Dangerous tools that ALWAYS require permission (cannot be trusted)
|
|
10849
|
+
"prompt_default"
|
|
10850
|
+
// Tools that prompt by default but can be trusted
|
|
10851
|
+
]);
|
|
10852
|
+
var ToolSafetyConfigSchema = z146.object({
|
|
10853
|
+
categories: z146.record(z146.string(), ToolCategorySchema),
|
|
10854
|
+
trustedTools: z146.array(z146.string())
|
|
10855
|
+
});
|
|
10856
|
+
var DEFAULT_TOOL_CATEGORIES = {
|
|
10857
|
+
// ===== AUTO APPROVE (Safe tools) =====
|
|
10858
|
+
// These tools have no side effects and are always safe to execute
|
|
10859
|
+
math_evaluate: "auto_approve",
|
|
10860
|
+
current_datetime: "auto_approve",
|
|
10861
|
+
dice_roll: "auto_approve",
|
|
10862
|
+
prompt_enhancement: "auto_approve",
|
|
10863
|
+
weather_info: "prompt_default",
|
|
10864
|
+
// ===== PROMPT ALWAYS (Dangerous tools) =====
|
|
10865
|
+
// These tools can modify files, execute code, or have other dangerous side effects
|
|
10866
|
+
// They ALWAYS require permission and cannot be trusted automatically
|
|
10867
|
+
edit_file: "prompt_always",
|
|
10868
|
+
edit_local_file: "prompt_always",
|
|
10869
|
+
create_file: "prompt_always",
|
|
10870
|
+
delete_file: "prompt_always",
|
|
10871
|
+
shell_execute: "prompt_always",
|
|
10872
|
+
bash_execute: "prompt_always",
|
|
10873
|
+
git_commit: "prompt_always",
|
|
10874
|
+
git_push: "prompt_always",
|
|
10875
|
+
// ===== PROMPT DEFAULT (Repository read tools) =====
|
|
10876
|
+
// These tools read from the repository but don't modify anything
|
|
10877
|
+
// Users can trust them if they want to avoid prompts
|
|
10878
|
+
web_search: "prompt_default",
|
|
10879
|
+
deep_research: "prompt_default",
|
|
10880
|
+
file_read: "prompt_default",
|
|
10881
|
+
grep_search: "prompt_default",
|
|
10882
|
+
glob_files: "prompt_default",
|
|
10883
|
+
get_file_tree: "prompt_default",
|
|
10884
|
+
git_status: "prompt_default",
|
|
10885
|
+
git_diff: "prompt_default",
|
|
10886
|
+
git_log: "prompt_default",
|
|
10887
|
+
git_branch: "prompt_default"
|
|
10888
|
+
};
|
|
10889
|
+
function getToolCategory(toolName, customCategories) {
|
|
10890
|
+
if (customCategories && toolName in customCategories) {
|
|
10891
|
+
return customCategories[toolName];
|
|
10892
|
+
}
|
|
10893
|
+
if (toolName in DEFAULT_TOOL_CATEGORIES) {
|
|
10894
|
+
return DEFAULT_TOOL_CATEGORIES[toolName];
|
|
10895
|
+
}
|
|
10896
|
+
return "prompt_default";
|
|
10897
|
+
}
|
|
10898
|
+
function canTrustTool(toolName, customCategories) {
|
|
10899
|
+
const category = getToolCategory(toolName, customCategories);
|
|
10900
|
+
return category !== "prompt_always";
|
|
10901
|
+
}
|
|
10902
|
+
|
|
11039
10903
|
// src/utils/PermissionManager.ts
|
|
11040
10904
|
var PermissionManager = class {
|
|
11041
10905
|
constructor(trustedTools = [], customCategories, deniedTools) {
|
|
@@ -12448,7 +12312,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
12448
12312
|
// package.json
|
|
12449
12313
|
var package_default = {
|
|
12450
12314
|
name: "@bike4mind/cli",
|
|
12451
|
-
version: "0.2.21-feat-
|
|
12315
|
+
version: "0.2.21-feat-cli-skill-frontmatter-spec.18206+7f8510398",
|
|
12452
12316
|
type: "module",
|
|
12453
12317
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
12454
12318
|
license: "UNLICENSED",
|
|
@@ -12492,7 +12356,6 @@ var package_default = {
|
|
|
12492
12356
|
"@anthropic-ai/sdk": "^0.71.2",
|
|
12493
12357
|
"@aws-sdk/client-apigatewaymanagementapi": "3.654.0",
|
|
12494
12358
|
"@aws-sdk/client-bedrock-runtime": "3.654.0",
|
|
12495
|
-
"@aws-sdk/client-cloudwatch": "3.654.0",
|
|
12496
12359
|
"@aws-sdk/client-lambda": "3.654.0",
|
|
12497
12360
|
"@aws-sdk/client-s3": "3.654.0",
|
|
12498
12361
|
"@aws-sdk/client-sqs": "3.654.0",
|
|
@@ -12556,10 +12419,10 @@ var package_default = {
|
|
|
12556
12419
|
},
|
|
12557
12420
|
devDependencies: {
|
|
12558
12421
|
"@bike4mind/agents": "0.1.0",
|
|
12559
|
-
"@bike4mind/common": "2.45.1-feat-
|
|
12560
|
-
"@bike4mind/mcp": "1.25.1-feat-
|
|
12561
|
-
"@bike4mind/services": "2.43.1-feat-
|
|
12562
|
-
"@bike4mind/utils": "2.3.1-feat-
|
|
12422
|
+
"@bike4mind/common": "2.45.1-feat-cli-skill-frontmatter-spec.18206+7f8510398",
|
|
12423
|
+
"@bike4mind/mcp": "1.25.1-feat-cli-skill-frontmatter-spec.18206+7f8510398",
|
|
12424
|
+
"@bike4mind/services": "2.43.1-feat-cli-skill-frontmatter-spec.18206+7f8510398",
|
|
12425
|
+
"@bike4mind/utils": "2.3.1-feat-cli-skill-frontmatter-spec.18206+7f8510398",
|
|
12563
12426
|
"@types/better-sqlite3": "^7.6.13",
|
|
12564
12427
|
"@types/diff": "^5.0.9",
|
|
12565
12428
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -12576,7 +12439,7 @@ var package_default = {
|
|
|
12576
12439
|
optionalDependencies: {
|
|
12577
12440
|
"@vscode/ripgrep": "^1.17.0"
|
|
12578
12441
|
},
|
|
12579
|
-
gitHead: "
|
|
12442
|
+
gitHead: "7f851039810b3200a4885d4c254f6d600d0a1ab5"
|
|
12580
12443
|
};
|
|
12581
12444
|
|
|
12582
12445
|
// src/config/constants.ts
|
|
@@ -12635,12 +12498,13 @@ var SubagentOrchestrator = class {
|
|
|
12635
12498
|
* @returns Agent result with summary
|
|
12636
12499
|
*/
|
|
12637
12500
|
async delegateToAgent(options) {
|
|
12638
|
-
const { task, agentName, thoroughness, variables, parentSessionId } = options;
|
|
12501
|
+
const { task, agentName, thoroughness, variables, parentSessionId, model, allowedTools } = options;
|
|
12639
12502
|
const agentDef = this.deps.agentStore.getAgent(agentName);
|
|
12640
12503
|
if (!agentDef) {
|
|
12641
12504
|
const available = this.deps.agentStore.getAgentNames().join(", ");
|
|
12642
12505
|
throw new Error(`Unknown agent: "${agentName}". Available agents: ${available}`);
|
|
12643
12506
|
}
|
|
12507
|
+
const effectiveModel = model || agentDef.model;
|
|
12644
12508
|
const effectiveThoroughness = thoroughness || agentDef.defaultThoroughness;
|
|
12645
12509
|
const maxIterations = agentDef.maxIterations[effectiveThoroughness];
|
|
12646
12510
|
const effectiveVariables = {
|
|
@@ -12648,8 +12512,9 @@ var SubagentOrchestrator = class {
|
|
|
12648
12512
|
...variables
|
|
12649
12513
|
};
|
|
12650
12514
|
const systemPrompt = this.substituteVariables(agentDef.systemPrompt, task, effectiveVariables);
|
|
12515
|
+
const effectiveAllowedTools = allowedTools || agentDef.allowedTools;
|
|
12651
12516
|
const toolFilter = {
|
|
12652
|
-
allowedTools:
|
|
12517
|
+
allowedTools: effectiveAllowedTools,
|
|
12653
12518
|
deniedTools: [...agentDef.deniedTools || [], ...ALWAYS_DENIED_FOR_AGENTS]
|
|
12654
12519
|
};
|
|
12655
12520
|
const agentContext = {
|
|
@@ -12659,7 +12524,7 @@ var SubagentOrchestrator = class {
|
|
|
12659
12524
|
const { tools: allTools, agentContext: updatedContext } = generateCliTools(
|
|
12660
12525
|
this.deps.userId,
|
|
12661
12526
|
this.deps.llm,
|
|
12662
|
-
|
|
12527
|
+
effectiveModel,
|
|
12663
12528
|
this.deps.permissionManager,
|
|
12664
12529
|
this.deps.showPermissionPrompt,
|
|
12665
12530
|
agentContext,
|
|
@@ -12680,7 +12545,7 @@ var SubagentOrchestrator = class {
|
|
|
12680
12545
|
userId: this.deps.userId,
|
|
12681
12546
|
logger: this.deps.logger,
|
|
12682
12547
|
llm: this.deps.llm,
|
|
12683
|
-
model:
|
|
12548
|
+
model: effectiveModel,
|
|
12684
12549
|
tools: hookedTools,
|
|
12685
12550
|
maxIterations,
|
|
12686
12551
|
systemPrompt
|
|
@@ -12693,9 +12558,7 @@ var SubagentOrchestrator = class {
|
|
|
12693
12558
|
let result;
|
|
12694
12559
|
try {
|
|
12695
12560
|
result = await agent.run(task, {
|
|
12696
|
-
maxIterations
|
|
12697
|
-
parallelExecution: this.deps.enableParallelToolExecution === true,
|
|
12698
|
-
isReadOnlyTool
|
|
12561
|
+
maxIterations
|
|
12699
12562
|
});
|
|
12700
12563
|
} catch (error) {
|
|
12701
12564
|
if (error instanceof HookBlockedError) {
|
|
@@ -13245,6 +13108,39 @@ function createTodoStore(onUpdate) {
|
|
|
13245
13108
|
}
|
|
13246
13109
|
|
|
13247
13110
|
// src/tools/skillTool.ts
|
|
13111
|
+
import { exec } from "child_process";
|
|
13112
|
+
import { promisify as promisify2 } from "util";
|
|
13113
|
+
var execAsync = promisify2(exec);
|
|
13114
|
+
async function executeHook(script, context) {
|
|
13115
|
+
try {
|
|
13116
|
+
const env = {
|
|
13117
|
+
...process.env,
|
|
13118
|
+
SKILL_NAME: context.skillName,
|
|
13119
|
+
SKILL_ARGS: context.args,
|
|
13120
|
+
SKILL_RESULT: context.result || "",
|
|
13121
|
+
SKILL_ERROR: context.error || ""
|
|
13122
|
+
};
|
|
13123
|
+
const { stdout, stderr } = await execAsync(script, {
|
|
13124
|
+
env,
|
|
13125
|
+
timeout: 3e4,
|
|
13126
|
+
// 30 second timeout for hooks
|
|
13127
|
+
cwd: process.cwd()
|
|
13128
|
+
});
|
|
13129
|
+
return { success: true, output: stdout || stderr };
|
|
13130
|
+
} catch (error) {
|
|
13131
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
13132
|
+
return { success: false, output: `Hook failed: ${message}` };
|
|
13133
|
+
}
|
|
13134
|
+
}
|
|
13135
|
+
function parseAgentConfig(agent) {
|
|
13136
|
+
if (!agent) {
|
|
13137
|
+
return { name: "general-purpose", thoroughness: void 0 };
|
|
13138
|
+
}
|
|
13139
|
+
if (typeof agent === "string") {
|
|
13140
|
+
return { name: agent, thoroughness: void 0 };
|
|
13141
|
+
}
|
|
13142
|
+
return { name: agent.type, thoroughness: agent.thoroughness };
|
|
13143
|
+
}
|
|
13248
13144
|
function parseArguments(argsString) {
|
|
13249
13145
|
const args = [];
|
|
13250
13146
|
let current = "";
|
|
@@ -13272,7 +13168,8 @@ function parseArguments(argsString) {
|
|
|
13272
13168
|
}
|
|
13273
13169
|
return args;
|
|
13274
13170
|
}
|
|
13275
|
-
function createSkillTool(
|
|
13171
|
+
function createSkillTool(deps) {
|
|
13172
|
+
const { customCommandStore } = deps;
|
|
13276
13173
|
return {
|
|
13277
13174
|
toolFn: async (args) => {
|
|
13278
13175
|
const params = args;
|
|
@@ -13280,27 +13177,94 @@ function createSkillTool(customCommandStore) {
|
|
|
13280
13177
|
throw new Error("skill: skill parameter is required");
|
|
13281
13178
|
}
|
|
13282
13179
|
const skillName = params.skill.replace(/^\//, "");
|
|
13180
|
+
const argsString = params.args || "";
|
|
13283
13181
|
const command = customCommandStore.getCommand(skillName);
|
|
13284
13182
|
if (!command) {
|
|
13285
13183
|
const available = customCommandStore.getAllCommands().map((c) => c.name).join(", ");
|
|
13286
13184
|
throw new Error(`skill: "${skillName}" not found. Available skills: ${available || "none"}`);
|
|
13287
13185
|
}
|
|
13288
|
-
|
|
13289
|
-
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13186
|
+
if (command.hooks?.["pre-invoke"]) {
|
|
13187
|
+
const hookResult = await executeHook(command.hooks["pre-invoke"], {
|
|
13188
|
+
skillName,
|
|
13189
|
+
args: argsString
|
|
13190
|
+
});
|
|
13191
|
+
if (!hookResult.success) {
|
|
13192
|
+
throw new Error(`Pre-invoke hook failed: ${hookResult.output}`);
|
|
13193
|
+
}
|
|
13194
|
+
}
|
|
13195
|
+
try {
|
|
13196
|
+
const argsArray = params.args ? parseArguments(params.args) : [];
|
|
13197
|
+
let expandedBody = substituteArguments(command.body, argsArray);
|
|
13198
|
+
const processed = await processFileReferences(expandedBody);
|
|
13199
|
+
expandedBody = processed.content;
|
|
13200
|
+
if (processed.errors.length > 0) {
|
|
13201
|
+
expandedBody += `
|
|
13294
13202
|
|
|
13295
13203
|
**File reference errors:**
|
|
13296
13204
|
${processed.errors.map((e) => `- ${e}`).join("\n")}`;
|
|
13297
|
-
|
|
13298
|
-
|
|
13205
|
+
}
|
|
13206
|
+
let result;
|
|
13207
|
+
const needsFork = command.context === "fork" || Boolean(command.allowedTools?.length) || Boolean(command.model);
|
|
13208
|
+
if (needsFork) {
|
|
13209
|
+
const { subagentOrchestrator, sessionId } = deps;
|
|
13210
|
+
if (!subagentOrchestrator || !sessionId) {
|
|
13211
|
+
const missing = !subagentOrchestrator ? "subagentOrchestrator" : "sessionId";
|
|
13212
|
+
throw new Error(`Skill "${skillName}" requires forked context but ${missing} is not available`);
|
|
13213
|
+
}
|
|
13214
|
+
if (command.context !== "fork" && (command.allowedTools?.length || command.model)) {
|
|
13215
|
+
const reasons = [];
|
|
13216
|
+
if (command.allowedTools?.length) reasons.push("allowed-tools");
|
|
13217
|
+
if (command.model) reasons.push("model");
|
|
13218
|
+
console.log(`\u26A1 Skill "/${skillName}" auto-upgraded to fork context (uses: ${reasons.join(", ")})`);
|
|
13219
|
+
}
|
|
13220
|
+
const agentConfig = parseAgentConfig(command.agent);
|
|
13221
|
+
const agentResult = await subagentOrchestrator.delegateToAgent({
|
|
13222
|
+
task: expandedBody,
|
|
13223
|
+
agentName: agentConfig.name,
|
|
13224
|
+
thoroughness: agentConfig.thoroughness || command.thoroughness,
|
|
13225
|
+
variables: command.variables,
|
|
13226
|
+
parentSessionId: sessionId,
|
|
13227
|
+
// Pass skill-level overrides
|
|
13228
|
+
model: command.model,
|
|
13229
|
+
allowedTools: command.allowedTools
|
|
13230
|
+
});
|
|
13231
|
+
const agentName = agentConfig.name;
|
|
13232
|
+
result = `## Skill Executed: /${skillName} (via ${agentName} agent)
|
|
13233
|
+
|
|
13234
|
+
${agentResult.summary}`;
|
|
13235
|
+
} else {
|
|
13236
|
+
result = `## Skill Loaded: /${skillName}
|
|
13299
13237
|
|
|
13300
13238
|
${expandedBody}
|
|
13301
13239
|
|
|
13302
13240
|
---
|
|
13303
13241
|
*Follow the instructions above. This skill was invoked programmatically.*`;
|
|
13242
|
+
}
|
|
13243
|
+
if (command.hooks?.["post-invoke"]) {
|
|
13244
|
+
const hookResult = await executeHook(command.hooks["post-invoke"], {
|
|
13245
|
+
skillName,
|
|
13246
|
+
args: argsString,
|
|
13247
|
+
result
|
|
13248
|
+
});
|
|
13249
|
+
if (!hookResult.success) {
|
|
13250
|
+
console.warn(`Post-invoke hook warning: ${hookResult.output}`);
|
|
13251
|
+
}
|
|
13252
|
+
}
|
|
13253
|
+
return result;
|
|
13254
|
+
} catch (error) {
|
|
13255
|
+
if (command.hooks?.["on-error"]) {
|
|
13256
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
13257
|
+
const hookResult = await executeHook(command.hooks["on-error"], {
|
|
13258
|
+
skillName,
|
|
13259
|
+
args: argsString,
|
|
13260
|
+
error: errorMessage
|
|
13261
|
+
});
|
|
13262
|
+
if (hookResult.output) {
|
|
13263
|
+
console.warn(`On-error hook output: ${hookResult.output}`);
|
|
13264
|
+
}
|
|
13265
|
+
}
|
|
13266
|
+
throw error;
|
|
13267
|
+
}
|
|
13304
13268
|
},
|
|
13305
13269
|
toolSchema: {
|
|
13306
13270
|
name: "skill",
|
|
@@ -13345,9 +13309,14 @@ ${expandedBody}
|
|
|
13345
13309
|
}
|
|
13346
13310
|
|
|
13347
13311
|
// src/core/skillsPrompt.ts
|
|
13312
|
+
function getSkillDisplayName(cmd) {
|
|
13313
|
+
return cmd.displayName || cmd.name;
|
|
13314
|
+
}
|
|
13348
13315
|
function formatSkillEntry(cmd) {
|
|
13316
|
+
const displayName = getSkillDisplayName(cmd);
|
|
13349
13317
|
const argHint = cmd.argumentHint ? ` ${cmd.argumentHint}` : "";
|
|
13350
|
-
|
|
13318
|
+
const nameDisplay = cmd.displayName && cmd.displayName !== cmd.name ? `**${displayName}** (\`${cmd.name}\`)` : `**${cmd.name}**`;
|
|
13319
|
+
return `- ${nameDisplay}${argHint}: ${cmd.description}
|
|
13351
13320
|
`;
|
|
13352
13321
|
}
|
|
13353
13322
|
function formatSkillGroup(heading, commands) {
|
|
@@ -13358,12 +13327,16 @@ function formatSkillGroup(heading, commands) {
|
|
|
13358
13327
|
### ${heading}
|
|
13359
13328
|
${commands.map(formatSkillEntry).join("")}`;
|
|
13360
13329
|
}
|
|
13330
|
+
function filterAIVisibleSkills(commands) {
|
|
13331
|
+
return commands.filter((cmd) => !cmd.disableModelInvocation);
|
|
13332
|
+
}
|
|
13361
13333
|
function buildSkillsPromptSection(commands) {
|
|
13362
|
-
|
|
13334
|
+
const visibleCommands = filterAIVisibleSkills(commands);
|
|
13335
|
+
if (visibleCommands.length === 0) {
|
|
13363
13336
|
return "";
|
|
13364
13337
|
}
|
|
13365
|
-
const projectSkills =
|
|
13366
|
-
const globalSkills =
|
|
13338
|
+
const projectSkills = visibleCommands.filter((c) => c.source === "project");
|
|
13339
|
+
const globalSkills = visibleCommands.filter((c) => c.source === "global");
|
|
13367
13340
|
return `
|
|
13368
13341
|
|
|
13369
13342
|
## Available Skills
|
|
@@ -13652,14 +13625,17 @@ function CliApp() {
|
|
|
13652
13625
|
showPermissionPrompt: promptFn,
|
|
13653
13626
|
configStore: state.configStore,
|
|
13654
13627
|
apiClient,
|
|
13655
|
-
agentStore
|
|
13656
|
-
enableParallelToolExecution: config.preferences.enableParallelToolExecution === true
|
|
13628
|
+
agentStore
|
|
13657
13629
|
});
|
|
13658
13630
|
const agentDelegateTool = createAgentDelegateTool(orchestrator, agentStore, newSession.id);
|
|
13659
13631
|
const todoStore = createTodoStore();
|
|
13660
13632
|
const writeTodosTool = createWriteTodosTool(todoStore);
|
|
13661
13633
|
const enableSkillTool = config.preferences.enableSkillTool !== false;
|
|
13662
|
-
const skillTool = enableSkillTool ? createSkillTool(
|
|
13634
|
+
const skillTool = enableSkillTool ? createSkillTool({
|
|
13635
|
+
customCommandStore: state.customCommandStore,
|
|
13636
|
+
subagentOrchestrator: orchestrator,
|
|
13637
|
+
sessionId: newSession.id
|
|
13638
|
+
}) : null;
|
|
13663
13639
|
const cliTools = [agentDelegateTool, writeTodosTool];
|
|
13664
13640
|
if (skillTool) {
|
|
13665
13641
|
cliTools.push(skillTool);
|
|
@@ -13847,12 +13823,9 @@ ${contextResult.mergedContent}` : "";
|
|
|
13847
13823
|
role: msg.role,
|
|
13848
13824
|
content: msg.content
|
|
13849
13825
|
}));
|
|
13850
|
-
const cliConfig = await state.configStore.get();
|
|
13851
13826
|
const result = await state.agent.run(messageContent, {
|
|
13852
13827
|
previousMessages: previousMessages.length > 0 ? previousMessages : void 0,
|
|
13853
|
-
signal: abortController.signal
|
|
13854
|
-
parallelExecution: cliConfig.preferences.enableParallelToolExecution === true,
|
|
13855
|
-
isReadOnlyTool
|
|
13828
|
+
signal: abortController.signal
|
|
13856
13829
|
});
|
|
13857
13830
|
const permissionDenied = result.finalAnswer.startsWith("Permission denied for tool");
|
|
13858
13831
|
if (permissionDenied) {
|
|
@@ -14022,12 +13995,9 @@ ${contextResult.mergedContent}` : "";
|
|
|
14022
13995
|
role: msg.role,
|
|
14023
13996
|
content: msg.content
|
|
14024
13997
|
}));
|
|
14025
|
-
const cliConfig = await state.configStore.get();
|
|
14026
13998
|
const result = await state.agent.run(messageContent, {
|
|
14027
13999
|
previousMessages: previousMessages.length > 0 ? previousMessages : void 0,
|
|
14028
|
-
signal: abortController.signal
|
|
14029
|
-
parallelExecution: cliConfig.preferences.enableParallelToolExecution === true,
|
|
14030
|
-
isReadOnlyTool
|
|
14000
|
+
signal: abortController.signal
|
|
14031
14001
|
});
|
|
14032
14002
|
const permissionDenied = result.finalAnswer.startsWith("Permission denied for tool");
|
|
14033
14003
|
if (permissionDenied) {
|
|
@@ -14230,17 +14200,18 @@ ${output}` : output.trim() || "(no output)",
|
|
|
14230
14200
|
}
|
|
14231
14201
|
const displayMessage = `/${command}${args.length > 0 ? " " + args.join(" ") : ""}`;
|
|
14232
14202
|
if (customCommand.agent && state.orchestrator && state.agentStore) {
|
|
14233
|
-
|
|
14203
|
+
const agentName = typeof customCommand.agent === "string" ? customCommand.agent : customCommand.agent.type;
|
|
14204
|
+
if (!state.agentStore.hasAgent(agentName)) {
|
|
14234
14205
|
const available = state.agentStore.getAgentNames().join(", ");
|
|
14235
|
-
console.error(`\u274C Unknown agent "${
|
|
14206
|
+
console.error(`\u274C Unknown agent "${agentName}" specified in command.`);
|
|
14236
14207
|
console.error(` Available agents: ${available}`);
|
|
14237
14208
|
return;
|
|
14238
14209
|
}
|
|
14239
|
-
console.log(`\u{1F916} Delegating to ${
|
|
14210
|
+
console.log(`\u{1F916} Delegating to ${agentName} agent...
|
|
14240
14211
|
`);
|
|
14241
14212
|
const result = await state.orchestrator.delegateToAgent({
|
|
14242
14213
|
task: substitutedBody,
|
|
14243
|
-
agentName
|
|
14214
|
+
agentName,
|
|
14244
14215
|
thoroughness: customCommand.thoroughness,
|
|
14245
14216
|
variables: customCommand.variables,
|
|
14246
14217
|
parentSessionId: state.session?.id || "unknown"
|