@mastra/core 1.1.0-alpha.0 → 1.1.0-alpha.1
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/CHANGELOG.md +26 -0
- package/dist/agent/index.cjs +8 -8
- package/dist/agent/index.js +1 -1
- package/dist/{chunk-Z3XVFOTH.js → chunk-64LMKFD3.js} +4 -4
- package/dist/{chunk-Z3XVFOTH.js.map → chunk-64LMKFD3.js.map} +1 -1
- package/dist/{chunk-WBJMSOYD.cjs → chunk-66462UTX.cjs} +192 -140
- package/dist/chunk-66462UTX.cjs.map +1 -0
- package/dist/{chunk-N2FELMHU.cjs → chunk-BKUNHQZ4.cjs} +57 -24
- package/dist/chunk-BKUNHQZ4.cjs.map +1 -0
- package/dist/{chunk-DXTYXWYM.cjs → chunk-C6YO523J.cjs} +7 -7
- package/dist/{chunk-DXTYXWYM.cjs.map → chunk-C6YO523J.cjs.map} +1 -1
- package/dist/{chunk-OZFBUMI3.cjs → chunk-EZWVMAC6.cjs} +7 -7
- package/dist/{chunk-OZFBUMI3.cjs.map → chunk-EZWVMAC6.cjs.map} +1 -1
- package/dist/{chunk-ACEGVEZF.js → chunk-H4C5NORS.js} +66 -46
- package/dist/chunk-H4C5NORS.js.map +1 -0
- package/dist/{chunk-5VWOGZLE.js → chunk-HKD4NSHR.js} +49 -16
- package/dist/chunk-HKD4NSHR.js.map +1 -0
- package/dist/{chunk-3CXWVB55.cjs → chunk-IKS5Z56O.cjs} +39 -36
- package/dist/{chunk-3CXWVB55.cjs.map → chunk-IKS5Z56O.cjs.map} +1 -1
- package/dist/{chunk-YETWOFQL.js → chunk-KPIJA2R5.js} +21 -31
- package/dist/chunk-KPIJA2R5.js.map +1 -0
- package/dist/{chunk-XSRROONT.cjs → chunk-LMNHODU4.cjs} +5 -5
- package/dist/{chunk-XSRROONT.cjs.map → chunk-LMNHODU4.cjs.map} +1 -1
- package/dist/{chunk-ZZCLGEMJ.js → chunk-NVRAVZZM.js} +192 -139
- package/dist/chunk-NVRAVZZM.js.map +1 -0
- package/dist/{chunk-6FHHT22W.cjs → chunk-O7II2PSR.cjs} +44 -44
- package/dist/{chunk-6FHHT22W.cjs.map → chunk-O7II2PSR.cjs.map} +1 -1
- package/dist/{chunk-ARMHYWF5.js → chunk-QT56V3PE.js} +4 -4
- package/dist/{chunk-ARMHYWF5.js.map → chunk-QT56V3PE.js.map} +1 -1
- package/dist/{chunk-TV4DA7RI.cjs → chunk-RIPKI7ON.cjs} +21 -31
- package/dist/chunk-RIPKI7ON.cjs.map +1 -0
- package/dist/{chunk-5BEYS33K.js → chunk-RQGER4J4.js} +3 -3
- package/dist/{chunk-5BEYS33K.js.map → chunk-RQGER4J4.js.map} +1 -1
- package/dist/{chunk-REH5FX2O.js → chunk-SFICZTYL.js} +28 -25
- package/dist/chunk-SFICZTYL.js.map +1 -0
- package/dist/{chunk-CEYA6FNF.js → chunk-SJUNV5AS.js} +3 -3
- package/dist/{chunk-CEYA6FNF.js.map → chunk-SJUNV5AS.js.map} +1 -1
- package/dist/{chunk-ETSBNSRY.cjs → chunk-TO7IB5JE.cjs} +17 -9
- package/dist/chunk-TO7IB5JE.cjs.map +1 -0
- package/dist/{chunk-QGVPEZ5T.js → chunk-UJRSZGKO.js} +16 -8
- package/dist/chunk-UJRSZGKO.js.map +1 -0
- package/dist/{chunk-RFTFSXJY.cjs → chunk-YSFYUEEG.cjs} +72 -52
- package/dist/chunk-YSFYUEEG.cjs.map +1 -0
- package/dist/docs/README.md +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/SOURCE_MAP.json +271 -271
- package/dist/docs/agents/01-overview.md +2 -2
- package/dist/docs/evals/01-overview.md +5 -5
- package/dist/docs/mcp/01-overview.md +2 -2
- package/dist/docs/observability/01-overview.md +1 -1
- package/dist/docs/observability/03-overview.md +3 -3
- package/dist/docs/rag/01-overview.md +1 -1
- package/dist/docs/tools-mcp/01-mcp-overview.md +2 -2
- package/dist/docs/voice/01-overview.md +1 -1
- package/dist/docs/workflows/01-overview.md +5 -5
- package/dist/docs/workspace/01-overview.md +32 -29
- package/dist/docs/workspace/02-filesystem.md +13 -0
- package/dist/docs/workspace/03-sandbox.md +11 -4
- package/dist/docs/workspace/05-search.md +1 -1
- package/dist/docs/workspace/06-reference.md +304 -12
- package/dist/evals/index.cjs +20 -20
- package/dist/evals/index.js +3 -3
- package/dist/evals/scoreTraces/index.cjs +5 -5
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/llm/index.cjs +9 -9
- package/dist/llm/index.js +2 -2
- package/dist/llm/model/provider-types.generated.d.ts +6 -2
- package/dist/loop/index.cjs +12 -12
- package/dist/loop/index.js +1 -1
- package/dist/loop/network/index.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts +3 -3
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +11 -11
- package/dist/memory/index.js +1 -1
- package/dist/processors/index.cjs +40 -40
- package/dist/processors/index.js +1 -1
- package/dist/provider-registry-JZ6QRIVL.cjs +40 -0
- package/dist/{provider-registry-63ZEAPKK.cjs.map → provider-registry-JZ6QRIVL.cjs.map} +1 -1
- package/dist/provider-registry-SQTJTKSM.js +3 -0
- package/dist/{provider-registry-4RA5NQGH.js.map → provider-registry-SQTJTKSM.js.map} +1 -1
- package/dist/provider-registry.json +14 -6
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/storage/constants.cjs +16 -16
- package/dist/storage/constants.d.ts.map +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/agents/base.d.ts +17 -23
- package/dist/storage/domains/agents/base.d.ts.map +1 -1
- package/dist/storage/domains/agents/inmemory.d.ts +1 -1
- package/dist/storage/domains/agents/inmemory.d.ts.map +1 -1
- package/dist/storage/index.cjs +101 -101
- package/dist/storage/index.js +2 -2
- package/dist/storage/types.d.ts +53 -37
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/stream/index.cjs +8 -8
- package/dist/stream/index.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/vector/index.cjs +7 -7
- package/dist/vector/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +24 -24
- package/dist/workflows/index.js +1 -1
- package/dist/workspace/index.cjs +32 -32
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/skills/schemas.d.ts +17 -47
- package/dist/workspace/skills/schemas.d.ts.map +1 -1
- package/dist/workspace/skills/types.d.ts +4 -4
- package/dist/workspace/skills/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/llm/model/provider-types.generated.d.ts +6 -2
- package/dist/chunk-5VWOGZLE.js.map +0 -1
- package/dist/chunk-ACEGVEZF.js.map +0 -1
- package/dist/chunk-ETSBNSRY.cjs.map +0 -1
- package/dist/chunk-N2FELMHU.cjs.map +0 -1
- package/dist/chunk-QGVPEZ5T.js.map +0 -1
- package/dist/chunk-REH5FX2O.js.map +0 -1
- package/dist/chunk-RFTFSXJY.cjs.map +0 -1
- package/dist/chunk-TV4DA7RI.cjs.map +0 -1
- package/dist/chunk-WBJMSOYD.cjs.map +0 -1
- package/dist/chunk-YETWOFQL.js.map +0 -1
- package/dist/chunk-ZZCLGEMJ.js.map +0 -1
- package/dist/provider-registry-4RA5NQGH.js +0 -3
- package/dist/provider-registry-63ZEAPKK.cjs +0 -40
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createTool } from './chunk-IW3BNL7A.js';
|
|
2
|
-
import z, { z as z$1 } from 'zod';
|
|
3
2
|
import * as fs2 from 'fs/promises';
|
|
4
3
|
import * as nodePath from 'path';
|
|
5
4
|
import { constants } from 'fs';
|
|
@@ -9,6 +8,7 @@ import { execFileSync } from 'child_process';
|
|
|
9
8
|
import * as crypto from 'crypto';
|
|
10
9
|
import * as os from 'os';
|
|
11
10
|
import os__default from 'os';
|
|
11
|
+
import { z } from 'zod';
|
|
12
12
|
|
|
13
13
|
// src/workspace/errors.ts
|
|
14
14
|
var WorkspaceError = class extends Error {
|
|
@@ -830,6 +830,8 @@ var SearchEngine = class {
|
|
|
830
830
|
};
|
|
831
831
|
}
|
|
832
832
|
};
|
|
833
|
+
|
|
834
|
+
// src/workspace/skills/schemas.ts
|
|
833
835
|
var SKILL_LIMITS = {
|
|
834
836
|
/** Recommended max tokens for instructions */
|
|
835
837
|
MAX_INSTRUCTION_TOKENS: 5e3,
|
|
@@ -838,34 +840,77 @@ var SKILL_LIMITS = {
|
|
|
838
840
|
/** Max characters for name field */
|
|
839
841
|
MAX_NAME_LENGTH: 64,
|
|
840
842
|
/** Max characters for description field */
|
|
841
|
-
MAX_DESCRIPTION_LENGTH: 1024
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
843
|
+
MAX_DESCRIPTION_LENGTH: 1024};
|
|
844
|
+
function validateSkillName(name) {
|
|
845
|
+
const errors = [];
|
|
846
|
+
const fieldPath = "name";
|
|
847
|
+
if (typeof name !== "string") {
|
|
848
|
+
errors.push(`${fieldPath}: Expected string, received ${typeof name}`);
|
|
849
|
+
return errors;
|
|
850
|
+
}
|
|
851
|
+
if (name.length === 0) {
|
|
852
|
+
errors.push(`${fieldPath}: Skill name cannot be empty`);
|
|
853
|
+
return errors;
|
|
854
|
+
}
|
|
855
|
+
if (name.length > SKILL_LIMITS.MAX_NAME_LENGTH) {
|
|
856
|
+
errors.push(`${fieldPath}: Skill name must be ${SKILL_LIMITS.MAX_NAME_LENGTH} characters or less`);
|
|
857
|
+
}
|
|
858
|
+
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
859
|
+
errors.push(`${fieldPath}: Skill name must contain only lowercase letters, numbers, and hyphens`);
|
|
860
|
+
}
|
|
861
|
+
if (name.startsWith("-") || name.endsWith("-")) {
|
|
862
|
+
errors.push(`${fieldPath}: Skill name must not start or end with a hyphen`);
|
|
863
|
+
}
|
|
864
|
+
if (name.includes("--")) {
|
|
865
|
+
errors.push(`${fieldPath}: Skill name must not contain consecutive hyphens`);
|
|
866
|
+
}
|
|
867
|
+
return errors;
|
|
868
|
+
}
|
|
869
|
+
function validateSkillDescription(description) {
|
|
870
|
+
const errors = [];
|
|
871
|
+
const fieldPath = "description";
|
|
872
|
+
if (typeof description !== "string") {
|
|
873
|
+
errors.push(`${fieldPath}: Expected string, received ${typeof description}`);
|
|
874
|
+
return errors;
|
|
875
|
+
}
|
|
876
|
+
if (description.length === 0) {
|
|
877
|
+
errors.push(`${fieldPath}: Skill description cannot be empty`);
|
|
878
|
+
return errors;
|
|
879
|
+
}
|
|
880
|
+
if (description.length > SKILL_LIMITS.MAX_DESCRIPTION_LENGTH) {
|
|
881
|
+
errors.push(`${fieldPath}: Skill description must be ${SKILL_LIMITS.MAX_DESCRIPTION_LENGTH} characters or less`);
|
|
882
|
+
}
|
|
883
|
+
if (description.trim().length === 0) {
|
|
884
|
+
errors.push(`${fieldPath}: Skill description cannot be only whitespace`);
|
|
885
|
+
}
|
|
886
|
+
return errors;
|
|
887
|
+
}
|
|
888
|
+
function validateSkillLicense(license) {
|
|
889
|
+
const errors = [];
|
|
890
|
+
const fieldPath = "license";
|
|
891
|
+
if (license === void 0 || license === null) {
|
|
892
|
+
return errors;
|
|
893
|
+
}
|
|
894
|
+
if (typeof license !== "string") {
|
|
895
|
+
errors.push(`${fieldPath}: Expected string, received ${typeof license}`);
|
|
896
|
+
}
|
|
897
|
+
return errors;
|
|
898
|
+
}
|
|
899
|
+
function validateSkillCompatibility(_compatibility) {
|
|
900
|
+
return [];
|
|
901
|
+
}
|
|
902
|
+
function validateSkillMetadataField(metadata) {
|
|
903
|
+
const errors = [];
|
|
904
|
+
const fieldPath = "metadata";
|
|
905
|
+
if (metadata === void 0 || metadata === null) {
|
|
906
|
+
return errors;
|
|
907
|
+
}
|
|
908
|
+
if (typeof metadata !== "object" || Array.isArray(metadata)) {
|
|
909
|
+
errors.push(`${fieldPath}: Expected object, received ${Array.isArray(metadata) ? "array" : typeof metadata}`);
|
|
910
|
+
return errors;
|
|
911
|
+
}
|
|
912
|
+
return errors;
|
|
913
|
+
}
|
|
869
914
|
function estimateTokens(text) {
|
|
870
915
|
const words = text.split(/\s+/).filter(Boolean).length;
|
|
871
916
|
return Math.ceil(words * 1.3);
|
|
@@ -876,12 +921,20 @@ function countLines(text) {
|
|
|
876
921
|
function validateSkillMetadata(metadata, dirName, instructions) {
|
|
877
922
|
const errors = [];
|
|
878
923
|
const warnings = [];
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
924
|
+
if (typeof metadata !== "object" || metadata === null || Array.isArray(metadata)) {
|
|
925
|
+
errors.push(
|
|
926
|
+
`Expected object, received ${metadata === null ? "null" : Array.isArray(metadata) ? "array" : typeof metadata}`
|
|
927
|
+
);
|
|
928
|
+
return { valid: false, errors, warnings };
|
|
882
929
|
}
|
|
883
|
-
|
|
884
|
-
|
|
930
|
+
const data = metadata;
|
|
931
|
+
errors.push(...validateSkillName(data.name));
|
|
932
|
+
errors.push(...validateSkillDescription(data.description));
|
|
933
|
+
errors.push(...validateSkillLicense(data.license));
|
|
934
|
+
errors.push(...validateSkillCompatibility());
|
|
935
|
+
errors.push(...validateSkillMetadataField(data.metadata));
|
|
936
|
+
if (dirName && typeof data.name === "string" && data.name !== dirName) {
|
|
937
|
+
errors.push(`Skill name "${data.name}" must match directory name "${dirName}"`);
|
|
885
938
|
}
|
|
886
939
|
if (instructions) {
|
|
887
940
|
const lineCount = countLines(instructions);
|
|
@@ -3226,22 +3279,22 @@ function createWorkspaceTools(workspace) {
|
|
|
3226
3279
|
id: WORKSPACE_TOOLS.FILESYSTEM.READ_FILE,
|
|
3227
3280
|
description: "Read the contents of a file from the workspace filesystem. Supports reading specific line ranges using offset/limit parameters.",
|
|
3228
3281
|
requireApproval: readFileConfig.requireApproval,
|
|
3229
|
-
inputSchema: z
|
|
3230
|
-
path: z
|
|
3231
|
-
encoding: z
|
|
3232
|
-
offset: z
|
|
3233
|
-
limit: z
|
|
3234
|
-
showLineNumbers: z
|
|
3282
|
+
inputSchema: z.object({
|
|
3283
|
+
path: z.string().describe('The path to the file to read (e.g., "/data/config.json")'),
|
|
3284
|
+
encoding: z.enum(["utf-8", "utf8", "base64", "hex", "binary"]).optional().describe("The encoding to use when reading the file. Defaults to utf-8 for text files."),
|
|
3285
|
+
offset: z.number().optional().describe("Line number to start reading from (1-indexed). If omitted, starts from line 1."),
|
|
3286
|
+
limit: z.number().optional().describe("Maximum number of lines to read. If omitted, reads to the end of the file."),
|
|
3287
|
+
showLineNumbers: z.boolean().optional().default(true).describe("Whether to prefix each line with its line number (default: true)")
|
|
3235
3288
|
}),
|
|
3236
|
-
outputSchema: z
|
|
3237
|
-
content: z
|
|
3238
|
-
size: z
|
|
3239
|
-
path: z
|
|
3240
|
-
lines: z
|
|
3241
|
-
start: z
|
|
3242
|
-
end: z
|
|
3289
|
+
outputSchema: z.object({
|
|
3290
|
+
content: z.string().describe("The file contents (with optional line number prefixes)"),
|
|
3291
|
+
size: z.number().describe("The file size in bytes"),
|
|
3292
|
+
path: z.string().describe("The full path to the file"),
|
|
3293
|
+
lines: z.object({
|
|
3294
|
+
start: z.number().describe("First line number returned"),
|
|
3295
|
+
end: z.number().describe("Last line number returned")
|
|
3243
3296
|
}).optional().describe("Line range information (when offset/limit used)"),
|
|
3244
|
-
totalLines: z
|
|
3297
|
+
totalLines: z.number().optional().describe("Total number of lines in the file")
|
|
3245
3298
|
}),
|
|
3246
3299
|
execute: async ({ path: path4, encoding, offset, limit, showLineNumbers }) => {
|
|
3247
3300
|
const effectiveEncoding = encoding ?? "utf-8";
|
|
@@ -3288,15 +3341,15 @@ function createWorkspaceTools(workspace) {
|
|
|
3288
3341
|
id: WORKSPACE_TOOLS.FILESYSTEM.WRITE_FILE,
|
|
3289
3342
|
description: "Write content to a file in the workspace filesystem. Creates parent directories if needed.",
|
|
3290
3343
|
requireApproval: writeFileConfig.requireApproval,
|
|
3291
|
-
inputSchema: z
|
|
3292
|
-
path: z
|
|
3293
|
-
content: z
|
|
3294
|
-
overwrite: z
|
|
3344
|
+
inputSchema: z.object({
|
|
3345
|
+
path: z.string().describe('The path where to write the file (e.g., "/data/output.txt")'),
|
|
3346
|
+
content: z.string().describe("The content to write to the file"),
|
|
3347
|
+
overwrite: z.boolean().optional().default(true).describe("Whether to overwrite the file if it already exists")
|
|
3295
3348
|
}),
|
|
3296
|
-
outputSchema: z
|
|
3297
|
-
success: z
|
|
3298
|
-
path: z
|
|
3299
|
-
size: z
|
|
3349
|
+
outputSchema: z.object({
|
|
3350
|
+
success: z.boolean(),
|
|
3351
|
+
path: z.string().describe("The path where the file was written"),
|
|
3352
|
+
size: z.number().describe("The size of the written content in bytes")
|
|
3300
3353
|
}),
|
|
3301
3354
|
execute: async ({ path: path4, content, overwrite }) => {
|
|
3302
3355
|
if (readTracker && writeFileConfig.requireReadBeforeWrite) {
|
|
@@ -3329,17 +3382,17 @@ function createWorkspaceTools(workspace) {
|
|
|
3329
3382
|
id: WORKSPACE_TOOLS.FILESYSTEM.EDIT_FILE,
|
|
3330
3383
|
description: "Edit a file by replacing specific text. The old_string must match exactly and be unique in the file (unless using replace_all). You should read the file first to ensure you have the exact text to replace.",
|
|
3331
3384
|
requireApproval: editFileConfig.requireApproval,
|
|
3332
|
-
inputSchema: z
|
|
3333
|
-
path: z
|
|
3334
|
-
old_string: z
|
|
3335
|
-
new_string: z
|
|
3336
|
-
replace_all: z
|
|
3385
|
+
inputSchema: z.object({
|
|
3386
|
+
path: z.string().describe("The path to the file to edit"),
|
|
3387
|
+
old_string: z.string().describe("The exact text to find and replace. Must be unique in the file."),
|
|
3388
|
+
new_string: z.string().describe("The text to replace old_string with"),
|
|
3389
|
+
replace_all: z.boolean().optional().default(false).describe("If true, replace all occurrences. If false (default), old_string must be unique.")
|
|
3337
3390
|
}),
|
|
3338
|
-
outputSchema: z
|
|
3339
|
-
success: z
|
|
3340
|
-
path: z
|
|
3341
|
-
replacements: z
|
|
3342
|
-
error: z
|
|
3391
|
+
outputSchema: z.object({
|
|
3392
|
+
success: z.boolean(),
|
|
3393
|
+
path: z.string().describe("The path to the edited file"),
|
|
3394
|
+
replacements: z.number().describe("Number of replacements made"),
|
|
3395
|
+
error: z.string().optional().describe("Error message if the edit failed")
|
|
3343
3396
|
}),
|
|
3344
3397
|
execute: async ({ path: path4, old_string, new_string, replace_all }) => {
|
|
3345
3398
|
try {
|
|
@@ -3409,26 +3462,26 @@ Examples:
|
|
|
3409
3462
|
- Directories only: { path: "/", dirsOnly: true }
|
|
3410
3463
|
- Exclude node_modules: { path: "/", exclude: "node_modules" }`,
|
|
3411
3464
|
requireApproval: listFilesConfig.requireApproval,
|
|
3412
|
-
inputSchema: z
|
|
3413
|
-
path: z
|
|
3414
|
-
maxDepth: z
|
|
3415
|
-
showHidden: z
|
|
3416
|
-
dirsOnly: z
|
|
3417
|
-
exclude: z
|
|
3418
|
-
extension: z
|
|
3465
|
+
inputSchema: z.object({
|
|
3466
|
+
path: z.string().default("/").describe("Directory path to list"),
|
|
3467
|
+
maxDepth: z.number().optional().default(3).describe("Maximum depth to descend (default: 3). Similar to tree -L flag."),
|
|
3468
|
+
showHidden: z.boolean().optional().default(false).describe('Show hidden files starting with "." (default: false). Similar to tree -a flag.'),
|
|
3469
|
+
dirsOnly: z.boolean().optional().default(false).describe("List directories only, no files (default: false). Similar to tree -d flag."),
|
|
3470
|
+
exclude: z.string().optional().describe('Pattern to exclude (e.g., "node_modules"). Similar to tree -I flag.'),
|
|
3471
|
+
extension: z.string().optional().describe('Filter by file extension (e.g., ".ts"). Similar to tree -P flag.')
|
|
3419
3472
|
}),
|
|
3420
|
-
outputSchema: z
|
|
3421
|
-
tree: z
|
|
3422
|
-
summary: z
|
|
3423
|
-
metadata: z
|
|
3424
|
-
workspace: z
|
|
3425
|
-
id: z
|
|
3426
|
-
name: z
|
|
3473
|
+
outputSchema: z.object({
|
|
3474
|
+
tree: z.string().describe("Tree-style directory listing"),
|
|
3475
|
+
summary: z.string().describe('Summary of directories and files (e.g., "3 directories, 12 files")'),
|
|
3476
|
+
metadata: z.object({
|
|
3477
|
+
workspace: z.object({
|
|
3478
|
+
id: z.string().optional(),
|
|
3479
|
+
name: z.string().optional()
|
|
3427
3480
|
}).optional(),
|
|
3428
|
-
filesystem: z
|
|
3429
|
-
id: z
|
|
3430
|
-
name: z
|
|
3431
|
-
provider: z
|
|
3481
|
+
filesystem: z.object({
|
|
3482
|
+
id: z.string().optional(),
|
|
3483
|
+
name: z.string().optional(),
|
|
3484
|
+
provider: z.string().optional()
|
|
3432
3485
|
}).optional()
|
|
3433
3486
|
}).optional().describe("Metadata about the workspace and filesystem")
|
|
3434
3487
|
}),
|
|
@@ -3466,15 +3519,15 @@ Examples:
|
|
|
3466
3519
|
id: WORKSPACE_TOOLS.FILESYSTEM.DELETE,
|
|
3467
3520
|
description: "Delete a file or directory from the workspace filesystem",
|
|
3468
3521
|
requireApproval: deleteConfig.requireApproval,
|
|
3469
|
-
inputSchema: z
|
|
3470
|
-
path: z
|
|
3471
|
-
recursive: z
|
|
3522
|
+
inputSchema: z.object({
|
|
3523
|
+
path: z.string().describe("The path to the file or directory to delete"),
|
|
3524
|
+
recursive: z.boolean().optional().default(false).describe(
|
|
3472
3525
|
"If true, delete directories and their contents recursively. Required for non-empty directories."
|
|
3473
3526
|
)
|
|
3474
3527
|
}),
|
|
3475
|
-
outputSchema: z
|
|
3476
|
-
success: z
|
|
3477
|
-
path: z
|
|
3528
|
+
outputSchema: z.object({
|
|
3529
|
+
success: z.boolean(),
|
|
3530
|
+
path: z.string()
|
|
3478
3531
|
}),
|
|
3479
3532
|
execute: async ({ path: path4, recursive }) => {
|
|
3480
3533
|
const stat3 = await workspace.filesystem.stat(path4);
|
|
@@ -3493,14 +3546,14 @@ Examples:
|
|
|
3493
3546
|
id: WORKSPACE_TOOLS.FILESYSTEM.FILE_STAT,
|
|
3494
3547
|
description: "Get file or directory metadata from the workspace. Returns existence, type, size, and modification time.",
|
|
3495
3548
|
requireApproval: fileStatConfig.requireApproval,
|
|
3496
|
-
inputSchema: z
|
|
3497
|
-
path: z
|
|
3549
|
+
inputSchema: z.object({
|
|
3550
|
+
path: z.string().describe("The path to check")
|
|
3498
3551
|
}),
|
|
3499
|
-
outputSchema: z
|
|
3500
|
-
exists: z
|
|
3501
|
-
type: z
|
|
3502
|
-
size: z
|
|
3503
|
-
modifiedAt: z
|
|
3552
|
+
outputSchema: z.object({
|
|
3553
|
+
exists: z.boolean().describe("Whether the path exists"),
|
|
3554
|
+
type: z.enum(["file", "directory", "none"]).describe("The type of the path if it exists"),
|
|
3555
|
+
size: z.number().optional().describe("Size in bytes (for files)"),
|
|
3556
|
+
modifiedAt: z.string().optional().describe("Last modification time (ISO string)")
|
|
3504
3557
|
}),
|
|
3505
3558
|
execute: async ({ path: path4 }) => {
|
|
3506
3559
|
try {
|
|
@@ -3526,13 +3579,13 @@ Examples:
|
|
|
3526
3579
|
id: WORKSPACE_TOOLS.FILESYSTEM.MKDIR,
|
|
3527
3580
|
description: "Create a directory in the workspace filesystem",
|
|
3528
3581
|
requireApproval: mkdirConfig.requireApproval,
|
|
3529
|
-
inputSchema: z
|
|
3530
|
-
path: z
|
|
3531
|
-
recursive: z
|
|
3582
|
+
inputSchema: z.object({
|
|
3583
|
+
path: z.string().describe("The path of the directory to create"),
|
|
3584
|
+
recursive: z.boolean().optional().default(true).describe("Whether to create parent directories if they do not exist")
|
|
3532
3585
|
}),
|
|
3533
|
-
outputSchema: z
|
|
3534
|
-
success: z
|
|
3535
|
-
path: z
|
|
3586
|
+
outputSchema: z.object({
|
|
3587
|
+
success: z.boolean(),
|
|
3588
|
+
path: z.string()
|
|
3536
3589
|
}),
|
|
3537
3590
|
execute: async ({ path: path4, recursive }) => {
|
|
3538
3591
|
await workspace.filesystem.mkdir(path4, { recursive });
|
|
@@ -3548,26 +3601,26 @@ Examples:
|
|
|
3548
3601
|
id: WORKSPACE_TOOLS.SEARCH.SEARCH,
|
|
3549
3602
|
description: "Search indexed content in the workspace. Supports keyword (BM25), semantic (vector), and hybrid search modes.",
|
|
3550
3603
|
requireApproval: searchConfig.requireApproval,
|
|
3551
|
-
inputSchema: z
|
|
3552
|
-
query: z
|
|
3553
|
-
topK: z
|
|
3554
|
-
mode: z
|
|
3555
|
-
minScore: z
|
|
3604
|
+
inputSchema: z.object({
|
|
3605
|
+
query: z.string().describe("The search query string"),
|
|
3606
|
+
topK: z.number().optional().default(5).describe("Maximum number of results to return"),
|
|
3607
|
+
mode: z.enum(["bm25", "vector", "hybrid"]).optional().describe("Search mode: bm25 for keyword search, vector for semantic search, hybrid for both combined"),
|
|
3608
|
+
minScore: z.number().optional().describe("Minimum score threshold (0-1 for normalized scores)")
|
|
3556
3609
|
}),
|
|
3557
|
-
outputSchema: z
|
|
3558
|
-
results: z
|
|
3559
|
-
z
|
|
3560
|
-
id: z
|
|
3561
|
-
content: z
|
|
3562
|
-
score: z
|
|
3563
|
-
lineRange: z
|
|
3564
|
-
start: z
|
|
3565
|
-
end: z
|
|
3610
|
+
outputSchema: z.object({
|
|
3611
|
+
results: z.array(
|
|
3612
|
+
z.object({
|
|
3613
|
+
id: z.string().describe("Document/file path"),
|
|
3614
|
+
content: z.string().describe("The matching content"),
|
|
3615
|
+
score: z.number().describe("Relevance score"),
|
|
3616
|
+
lineRange: z.object({
|
|
3617
|
+
start: z.number(),
|
|
3618
|
+
end: z.number()
|
|
3566
3619
|
}).optional().describe("Line range where query terms were found")
|
|
3567
3620
|
})
|
|
3568
3621
|
),
|
|
3569
|
-
count: z
|
|
3570
|
-
mode: z
|
|
3622
|
+
count: z.number().describe("Number of results returned"),
|
|
3623
|
+
mode: z.string().describe("The search mode that was used")
|
|
3571
3624
|
}),
|
|
3572
3625
|
execute: async ({ query, topK, mode, minScore }) => {
|
|
3573
3626
|
const results = await workspace.search(query, {
|
|
@@ -3594,14 +3647,14 @@ Examples:
|
|
|
3594
3647
|
id: WORKSPACE_TOOLS.SEARCH.INDEX,
|
|
3595
3648
|
description: "Index content for search. The path becomes the document ID in search results.",
|
|
3596
3649
|
requireApproval: indexConfig.requireApproval,
|
|
3597
|
-
inputSchema: z
|
|
3598
|
-
path: z
|
|
3599
|
-
content: z
|
|
3600
|
-
metadata: z
|
|
3650
|
+
inputSchema: z.object({
|
|
3651
|
+
path: z.string().describe("The document ID/path for search results"),
|
|
3652
|
+
content: z.string().describe("The text content to index"),
|
|
3653
|
+
metadata: z.record(z.unknown()).optional().describe("Optional metadata to store with the document")
|
|
3601
3654
|
}),
|
|
3602
|
-
outputSchema: z
|
|
3603
|
-
success: z
|
|
3604
|
-
path: z
|
|
3655
|
+
outputSchema: z.object({
|
|
3656
|
+
success: z.boolean(),
|
|
3657
|
+
path: z.string().describe("The indexed document ID")
|
|
3605
3658
|
}),
|
|
3606
3659
|
execute: async ({ path: path4, content, metadata }) => {
|
|
3607
3660
|
await workspace.index(path4, content, { metadata });
|
|
@@ -3619,20 +3672,20 @@ Examples:
|
|
|
3619
3672
|
id: WORKSPACE_TOOLS.SANDBOX.EXECUTE_COMMAND,
|
|
3620
3673
|
description: `Execute a shell command in the workspace sandbox. The output (stdout/stderr) is displayed to the user automatically in the tool result. ${pathInfo}`,
|
|
3621
3674
|
requireApproval: executeCommandConfig.requireApproval,
|
|
3622
|
-
inputSchema: z
|
|
3623
|
-
command: z
|
|
3624
|
-
args: z
|
|
3625
|
-
timeout: z
|
|
3675
|
+
inputSchema: z.object({
|
|
3676
|
+
command: z.string().describe('The command to execute (e.g., "ls", "npm", "python")'),
|
|
3677
|
+
args: z.array(z.string()).nullish().default([]).describe("Arguments to pass to the command"),
|
|
3678
|
+
timeout: z.number().nullish().default(3e4).describe(
|
|
3626
3679
|
"Maximum execution time in milliseconds. Default is 30000 (30 seconds). Example: 60000 for 1 minute."
|
|
3627
3680
|
),
|
|
3628
|
-
cwd: z
|
|
3681
|
+
cwd: z.string().nullish().describe("Working directory for the command")
|
|
3629
3682
|
}),
|
|
3630
|
-
outputSchema: z
|
|
3631
|
-
success: z
|
|
3632
|
-
stdout: z
|
|
3633
|
-
stderr: z
|
|
3634
|
-
exitCode: z
|
|
3635
|
-
executionTimeMs: z
|
|
3683
|
+
outputSchema: z.object({
|
|
3684
|
+
success: z.boolean().describe("Whether the command executed successfully (exit code 0)"),
|
|
3685
|
+
stdout: z.string().describe("Standard output from the command"),
|
|
3686
|
+
stderr: z.string().describe("Standard error output"),
|
|
3687
|
+
exitCode: z.number().describe("Exit code (0 = success)"),
|
|
3688
|
+
executionTimeMs: z.number().describe("How long the execution took in milliseconds")
|
|
3636
3689
|
}),
|
|
3637
3690
|
execute: async ({ command, args, timeout, cwd }, context) => {
|
|
3638
3691
|
const getExecutionMetadata = () => ({
|
|
@@ -3702,5 +3755,5 @@ Examples:
|
|
|
3702
3755
|
}
|
|
3703
3756
|
|
|
3704
3757
|
export { DirectoryNotEmptyError, DirectoryNotFoundError, FileExistsError, FileNotFoundError, FileReadRequiredError, FilesystemError, FilesystemNotAvailableError, IsDirectoryError, IsolationUnavailableError, LocalFilesystem, LocalSandbox, NotDirectoryError, PermissionError, SandboxError, SandboxExecutionError, SandboxFeatureNotSupportedError, SandboxNotAvailableError, SandboxNotReadyError, SandboxTimeoutError, SearchNotAvailableError, WORKSPACE_TOOLS, WORKSPACE_TOOLS_PREFIX, Workspace, WorkspaceError, WorkspaceNotReadyError, WorkspaceReadOnlyError, createWorkspaceTools, detectIsolation, extractLines, getRecommendedIsolation, isIsolationAvailable, resolveToolConfig };
|
|
3705
|
-
//# sourceMappingURL=chunk-
|
|
3706
|
-
//# sourceMappingURL=chunk-
|
|
3758
|
+
//# sourceMappingURL=chunk-NVRAVZZM.js.map
|
|
3759
|
+
//# sourceMappingURL=chunk-NVRAVZZM.js.map
|