@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.
Files changed (129) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/agent/index.cjs +8 -8
  3. package/dist/agent/index.js +1 -1
  4. package/dist/{chunk-Z3XVFOTH.js → chunk-64LMKFD3.js} +4 -4
  5. package/dist/{chunk-Z3XVFOTH.js.map → chunk-64LMKFD3.js.map} +1 -1
  6. package/dist/{chunk-WBJMSOYD.cjs → chunk-66462UTX.cjs} +192 -140
  7. package/dist/chunk-66462UTX.cjs.map +1 -0
  8. package/dist/{chunk-N2FELMHU.cjs → chunk-BKUNHQZ4.cjs} +57 -24
  9. package/dist/chunk-BKUNHQZ4.cjs.map +1 -0
  10. package/dist/{chunk-DXTYXWYM.cjs → chunk-C6YO523J.cjs} +7 -7
  11. package/dist/{chunk-DXTYXWYM.cjs.map → chunk-C6YO523J.cjs.map} +1 -1
  12. package/dist/{chunk-OZFBUMI3.cjs → chunk-EZWVMAC6.cjs} +7 -7
  13. package/dist/{chunk-OZFBUMI3.cjs.map → chunk-EZWVMAC6.cjs.map} +1 -1
  14. package/dist/{chunk-ACEGVEZF.js → chunk-H4C5NORS.js} +66 -46
  15. package/dist/chunk-H4C5NORS.js.map +1 -0
  16. package/dist/{chunk-5VWOGZLE.js → chunk-HKD4NSHR.js} +49 -16
  17. package/dist/chunk-HKD4NSHR.js.map +1 -0
  18. package/dist/{chunk-3CXWVB55.cjs → chunk-IKS5Z56O.cjs} +39 -36
  19. package/dist/{chunk-3CXWVB55.cjs.map → chunk-IKS5Z56O.cjs.map} +1 -1
  20. package/dist/{chunk-YETWOFQL.js → chunk-KPIJA2R5.js} +21 -31
  21. package/dist/chunk-KPIJA2R5.js.map +1 -0
  22. package/dist/{chunk-XSRROONT.cjs → chunk-LMNHODU4.cjs} +5 -5
  23. package/dist/{chunk-XSRROONT.cjs.map → chunk-LMNHODU4.cjs.map} +1 -1
  24. package/dist/{chunk-ZZCLGEMJ.js → chunk-NVRAVZZM.js} +192 -139
  25. package/dist/chunk-NVRAVZZM.js.map +1 -0
  26. package/dist/{chunk-6FHHT22W.cjs → chunk-O7II2PSR.cjs} +44 -44
  27. package/dist/{chunk-6FHHT22W.cjs.map → chunk-O7II2PSR.cjs.map} +1 -1
  28. package/dist/{chunk-ARMHYWF5.js → chunk-QT56V3PE.js} +4 -4
  29. package/dist/{chunk-ARMHYWF5.js.map → chunk-QT56V3PE.js.map} +1 -1
  30. package/dist/{chunk-TV4DA7RI.cjs → chunk-RIPKI7ON.cjs} +21 -31
  31. package/dist/chunk-RIPKI7ON.cjs.map +1 -0
  32. package/dist/{chunk-5BEYS33K.js → chunk-RQGER4J4.js} +3 -3
  33. package/dist/{chunk-5BEYS33K.js.map → chunk-RQGER4J4.js.map} +1 -1
  34. package/dist/{chunk-REH5FX2O.js → chunk-SFICZTYL.js} +28 -25
  35. package/dist/chunk-SFICZTYL.js.map +1 -0
  36. package/dist/{chunk-CEYA6FNF.js → chunk-SJUNV5AS.js} +3 -3
  37. package/dist/{chunk-CEYA6FNF.js.map → chunk-SJUNV5AS.js.map} +1 -1
  38. package/dist/{chunk-ETSBNSRY.cjs → chunk-TO7IB5JE.cjs} +17 -9
  39. package/dist/chunk-TO7IB5JE.cjs.map +1 -0
  40. package/dist/{chunk-QGVPEZ5T.js → chunk-UJRSZGKO.js} +16 -8
  41. package/dist/chunk-UJRSZGKO.js.map +1 -0
  42. package/dist/{chunk-RFTFSXJY.cjs → chunk-YSFYUEEG.cjs} +72 -52
  43. package/dist/chunk-YSFYUEEG.cjs.map +1 -0
  44. package/dist/docs/README.md +1 -1
  45. package/dist/docs/SKILL.md +1 -1
  46. package/dist/docs/SOURCE_MAP.json +271 -271
  47. package/dist/docs/agents/01-overview.md +2 -2
  48. package/dist/docs/evals/01-overview.md +5 -5
  49. package/dist/docs/mcp/01-overview.md +2 -2
  50. package/dist/docs/observability/01-overview.md +1 -1
  51. package/dist/docs/observability/03-overview.md +3 -3
  52. package/dist/docs/rag/01-overview.md +1 -1
  53. package/dist/docs/tools-mcp/01-mcp-overview.md +2 -2
  54. package/dist/docs/voice/01-overview.md +1 -1
  55. package/dist/docs/workflows/01-overview.md +5 -5
  56. package/dist/docs/workspace/01-overview.md +32 -29
  57. package/dist/docs/workspace/02-filesystem.md +13 -0
  58. package/dist/docs/workspace/03-sandbox.md +11 -4
  59. package/dist/docs/workspace/05-search.md +1 -1
  60. package/dist/docs/workspace/06-reference.md +304 -12
  61. package/dist/evals/index.cjs +20 -20
  62. package/dist/evals/index.js +3 -3
  63. package/dist/evals/scoreTraces/index.cjs +5 -5
  64. package/dist/evals/scoreTraces/index.js +2 -2
  65. package/dist/index.cjs +2 -2
  66. package/dist/index.js +1 -1
  67. package/dist/llm/index.cjs +9 -9
  68. package/dist/llm/index.js +2 -2
  69. package/dist/llm/model/provider-types.generated.d.ts +6 -2
  70. package/dist/loop/index.cjs +12 -12
  71. package/dist/loop/index.js +1 -1
  72. package/dist/loop/network/index.d.ts.map +1 -1
  73. package/dist/mastra/index.cjs +2 -2
  74. package/dist/mastra/index.d.ts +3 -3
  75. package/dist/mastra/index.d.ts.map +1 -1
  76. package/dist/mastra/index.js +1 -1
  77. package/dist/memory/index.cjs +11 -11
  78. package/dist/memory/index.js +1 -1
  79. package/dist/processors/index.cjs +40 -40
  80. package/dist/processors/index.js +1 -1
  81. package/dist/provider-registry-JZ6QRIVL.cjs +40 -0
  82. package/dist/{provider-registry-63ZEAPKK.cjs.map → provider-registry-JZ6QRIVL.cjs.map} +1 -1
  83. package/dist/provider-registry-SQTJTKSM.js +3 -0
  84. package/dist/{provider-registry-4RA5NQGH.js.map → provider-registry-SQTJTKSM.js.map} +1 -1
  85. package/dist/provider-registry.json +14 -6
  86. package/dist/relevance/index.cjs +3 -3
  87. package/dist/relevance/index.js +1 -1
  88. package/dist/storage/constants.cjs +16 -16
  89. package/dist/storage/constants.d.ts.map +1 -1
  90. package/dist/storage/constants.js +1 -1
  91. package/dist/storage/domains/agents/base.d.ts +17 -23
  92. package/dist/storage/domains/agents/base.d.ts.map +1 -1
  93. package/dist/storage/domains/agents/inmemory.d.ts +1 -1
  94. package/dist/storage/domains/agents/inmemory.d.ts.map +1 -1
  95. package/dist/storage/index.cjs +101 -101
  96. package/dist/storage/index.js +2 -2
  97. package/dist/storage/types.d.ts +53 -37
  98. package/dist/storage/types.d.ts.map +1 -1
  99. package/dist/stream/index.cjs +8 -8
  100. package/dist/stream/index.js +1 -1
  101. package/dist/tool-loop-agent/index.cjs +4 -4
  102. package/dist/tool-loop-agent/index.js +1 -1
  103. package/dist/vector/index.cjs +7 -7
  104. package/dist/vector/index.js +1 -1
  105. package/dist/workflows/evented/index.cjs +10 -10
  106. package/dist/workflows/evented/index.js +1 -1
  107. package/dist/workflows/index.cjs +24 -24
  108. package/dist/workflows/index.js +1 -1
  109. package/dist/workspace/index.cjs +32 -32
  110. package/dist/workspace/index.js +1 -1
  111. package/dist/workspace/skills/schemas.d.ts +17 -47
  112. package/dist/workspace/skills/schemas.d.ts.map +1 -1
  113. package/dist/workspace/skills/types.d.ts +4 -4
  114. package/dist/workspace/skills/types.d.ts.map +1 -1
  115. package/package.json +4 -4
  116. package/src/llm/model/provider-types.generated.d.ts +6 -2
  117. package/dist/chunk-5VWOGZLE.js.map +0 -1
  118. package/dist/chunk-ACEGVEZF.js.map +0 -1
  119. package/dist/chunk-ETSBNSRY.cjs.map +0 -1
  120. package/dist/chunk-N2FELMHU.cjs.map +0 -1
  121. package/dist/chunk-QGVPEZ5T.js.map +0 -1
  122. package/dist/chunk-REH5FX2O.js.map +0 -1
  123. package/dist/chunk-RFTFSXJY.cjs.map +0 -1
  124. package/dist/chunk-TV4DA7RI.cjs.map +0 -1
  125. package/dist/chunk-WBJMSOYD.cjs.map +0 -1
  126. package/dist/chunk-YETWOFQL.js.map +0 -1
  127. package/dist/chunk-ZZCLGEMJ.js.map +0 -1
  128. package/dist/provider-registry-4RA5NQGH.js +0 -3
  129. package/dist/provider-registry-63ZEAPKK.cjs +0 -40
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkIIZF4W7B_cjs = require('./chunk-IIZF4W7B.cjs');
4
- var z = require('zod');
5
4
  var fs2 = require('fs/promises');
6
5
  var nodePath = require('path');
7
6
  var fs = require('fs');
@@ -9,6 +8,7 @@ var matter = require('gray-matter');
9
8
  var childProcess = require('child_process');
10
9
  var crypto = require('crypto');
11
10
  var os = require('os');
11
+ var zod = require('zod');
12
12
 
13
13
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
14
 
@@ -30,7 +30,6 @@ function _interopNamespace(e) {
30
30
  return Object.freeze(n);
31
31
  }
32
32
 
33
- var z__default = /*#__PURE__*/_interopDefault(z);
34
33
  var fs2__namespace = /*#__PURE__*/_interopNamespace(fs2);
35
34
  var nodePath__namespace = /*#__PURE__*/_interopNamespace(nodePath);
36
35
  var matter__default = /*#__PURE__*/_interopDefault(matter);
@@ -858,6 +857,8 @@ var SearchEngine = class {
858
857
  };
859
858
  }
860
859
  };
860
+
861
+ // src/workspace/skills/schemas.ts
861
862
  var SKILL_LIMITS = {
862
863
  /** Recommended max tokens for instructions */
863
864
  MAX_INSTRUCTION_TOKENS: 5e3,
@@ -866,34 +867,77 @@ var SKILL_LIMITS = {
866
867
  /** Max characters for name field */
867
868
  MAX_NAME_LENGTH: 64,
868
869
  /** Max characters for description field */
869
- MAX_DESCRIPTION_LENGTH: 1024,
870
- /** Max characters for compatibility field */
871
- MAX_COMPATIBILITY_LENGTH: 500
872
- };
873
- var SkillNameSchema = z__default.default.string().min(1, "Skill name cannot be empty").max(SKILL_LIMITS.MAX_NAME_LENGTH, `Skill name must be ${SKILL_LIMITS.MAX_NAME_LENGTH} characters or less`).regex(/^[a-z0-9-]+$/, "Skill name must contain only lowercase letters, numbers, and hyphens").refine((name) => !name.startsWith("-") && !name.endsWith("-"), {
874
- message: "Skill name must not start or end with a hyphen"
875
- }).refine((name) => !name.includes("--"), {
876
- message: "Skill name must not contain consecutive hyphens"
877
- }).describe("Skill name (1-64 chars, lowercase letters/numbers/hyphens only, must match directory name)");
878
- var SkillDescriptionSchema = z__default.default.string().min(1, "Skill description cannot be empty").max(
879
- SKILL_LIMITS.MAX_DESCRIPTION_LENGTH,
880
- `Skill description must be ${SKILL_LIMITS.MAX_DESCRIPTION_LENGTH} characters or less`
881
- ).refine((desc) => desc.trim().length > 0, {
882
- message: "Skill description cannot be only whitespace"
883
- }).describe("Description of what the skill does and when to use it (1-1024 characters)");
884
- var SkillCompatibilitySchema = z__default.default.string().max(
885
- SKILL_LIMITS.MAX_COMPATIBILITY_LENGTH,
886
- `Compatibility field must be ${SKILL_LIMITS.MAX_COMPATIBILITY_LENGTH} characters or less`
887
- ).optional().describe("Environment requirements or compatibility notes (max 500 chars)");
888
- var SkillLicenseSchema = z__default.default.string().optional().describe('License for the skill (e.g., "Apache-2.0", "MIT")');
889
- var SkillMetadataFieldSchema = z__default.default.record(z__default.default.string()).optional().describe("Arbitrary key-value metadata (e.g., author, version)");
890
- var SkillMetadataSchema = z__default.default.object({
891
- name: SkillNameSchema,
892
- description: SkillDescriptionSchema,
893
- license: SkillLicenseSchema,
894
- compatibility: SkillCompatibilitySchema,
895
- metadata: SkillMetadataFieldSchema
896
- });
870
+ MAX_DESCRIPTION_LENGTH: 1024};
871
+ function validateSkillName(name) {
872
+ const errors = [];
873
+ const fieldPath = "name";
874
+ if (typeof name !== "string") {
875
+ errors.push(`${fieldPath}: Expected string, received ${typeof name}`);
876
+ return errors;
877
+ }
878
+ if (name.length === 0) {
879
+ errors.push(`${fieldPath}: Skill name cannot be empty`);
880
+ return errors;
881
+ }
882
+ if (name.length > SKILL_LIMITS.MAX_NAME_LENGTH) {
883
+ errors.push(`${fieldPath}: Skill name must be ${SKILL_LIMITS.MAX_NAME_LENGTH} characters or less`);
884
+ }
885
+ if (!/^[a-z0-9-]+$/.test(name)) {
886
+ errors.push(`${fieldPath}: Skill name must contain only lowercase letters, numbers, and hyphens`);
887
+ }
888
+ if (name.startsWith("-") || name.endsWith("-")) {
889
+ errors.push(`${fieldPath}: Skill name must not start or end with a hyphen`);
890
+ }
891
+ if (name.includes("--")) {
892
+ errors.push(`${fieldPath}: Skill name must not contain consecutive hyphens`);
893
+ }
894
+ return errors;
895
+ }
896
+ function validateSkillDescription(description) {
897
+ const errors = [];
898
+ const fieldPath = "description";
899
+ if (typeof description !== "string") {
900
+ errors.push(`${fieldPath}: Expected string, received ${typeof description}`);
901
+ return errors;
902
+ }
903
+ if (description.length === 0) {
904
+ errors.push(`${fieldPath}: Skill description cannot be empty`);
905
+ return errors;
906
+ }
907
+ if (description.length > SKILL_LIMITS.MAX_DESCRIPTION_LENGTH) {
908
+ errors.push(`${fieldPath}: Skill description must be ${SKILL_LIMITS.MAX_DESCRIPTION_LENGTH} characters or less`);
909
+ }
910
+ if (description.trim().length === 0) {
911
+ errors.push(`${fieldPath}: Skill description cannot be only whitespace`);
912
+ }
913
+ return errors;
914
+ }
915
+ function validateSkillLicense(license) {
916
+ const errors = [];
917
+ const fieldPath = "license";
918
+ if (license === void 0 || license === null) {
919
+ return errors;
920
+ }
921
+ if (typeof license !== "string") {
922
+ errors.push(`${fieldPath}: Expected string, received ${typeof license}`);
923
+ }
924
+ return errors;
925
+ }
926
+ function validateSkillCompatibility(_compatibility) {
927
+ return [];
928
+ }
929
+ function validateSkillMetadataField(metadata) {
930
+ const errors = [];
931
+ const fieldPath = "metadata";
932
+ if (metadata === void 0 || metadata === null) {
933
+ return errors;
934
+ }
935
+ if (typeof metadata !== "object" || Array.isArray(metadata)) {
936
+ errors.push(`${fieldPath}: Expected object, received ${Array.isArray(metadata) ? "array" : typeof metadata}`);
937
+ return errors;
938
+ }
939
+ return errors;
940
+ }
897
941
  function estimateTokens(text) {
898
942
  const words = text.split(/\s+/).filter(Boolean).length;
899
943
  return Math.ceil(words * 1.3);
@@ -904,12 +948,20 @@ function countLines(text) {
904
948
  function validateSkillMetadata(metadata, dirName, instructions) {
905
949
  const errors = [];
906
950
  const warnings = [];
907
- const result = SkillMetadataSchema.safeParse(metadata);
908
- if (!result.success) {
909
- errors.push(...result.error.errors.map((err) => `${err.path.join(".")}: ${err.message}`));
951
+ if (typeof metadata !== "object" || metadata === null || Array.isArray(metadata)) {
952
+ errors.push(
953
+ `Expected object, received ${metadata === null ? "null" : Array.isArray(metadata) ? "array" : typeof metadata}`
954
+ );
955
+ return { valid: false, errors, warnings };
910
956
  }
911
- if (dirName && result.success && result.data.name !== dirName) {
912
- errors.push(`Skill name "${result.data.name}" must match directory name "${dirName}"`);
957
+ const data = metadata;
958
+ errors.push(...validateSkillName(data.name));
959
+ errors.push(...validateSkillDescription(data.description));
960
+ errors.push(...validateSkillLicense(data.license));
961
+ errors.push(...validateSkillCompatibility());
962
+ errors.push(...validateSkillMetadataField(data.metadata));
963
+ if (dirName && typeof data.name === "string" && data.name !== dirName) {
964
+ errors.push(`Skill name "${data.name}" must match directory name "${dirName}"`);
913
965
  }
914
966
  if (instructions) {
915
967
  const lineCount = countLines(instructions);
@@ -3254,22 +3306,22 @@ function createWorkspaceTools(workspace) {
3254
3306
  id: WORKSPACE_TOOLS.FILESYSTEM.READ_FILE,
3255
3307
  description: "Read the contents of a file from the workspace filesystem. Supports reading specific line ranges using offset/limit parameters.",
3256
3308
  requireApproval: readFileConfig.requireApproval,
3257
- inputSchema: z.z.object({
3258
- path: z.z.string().describe('The path to the file to read (e.g., "/data/config.json")'),
3259
- encoding: z.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."),
3260
- offset: z.z.number().optional().describe("Line number to start reading from (1-indexed). If omitted, starts from line 1."),
3261
- limit: z.z.number().optional().describe("Maximum number of lines to read. If omitted, reads to the end of the file."),
3262
- showLineNumbers: z.z.boolean().optional().default(true).describe("Whether to prefix each line with its line number (default: true)")
3309
+ inputSchema: zod.z.object({
3310
+ path: zod.z.string().describe('The path to the file to read (e.g., "/data/config.json")'),
3311
+ encoding: zod.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."),
3312
+ offset: zod.z.number().optional().describe("Line number to start reading from (1-indexed). If omitted, starts from line 1."),
3313
+ limit: zod.z.number().optional().describe("Maximum number of lines to read. If omitted, reads to the end of the file."),
3314
+ showLineNumbers: zod.z.boolean().optional().default(true).describe("Whether to prefix each line with its line number (default: true)")
3263
3315
  }),
3264
- outputSchema: z.z.object({
3265
- content: z.z.string().describe("The file contents (with optional line number prefixes)"),
3266
- size: z.z.number().describe("The file size in bytes"),
3267
- path: z.z.string().describe("The full path to the file"),
3268
- lines: z.z.object({
3269
- start: z.z.number().describe("First line number returned"),
3270
- end: z.z.number().describe("Last line number returned")
3316
+ outputSchema: zod.z.object({
3317
+ content: zod.z.string().describe("The file contents (with optional line number prefixes)"),
3318
+ size: zod.z.number().describe("The file size in bytes"),
3319
+ path: zod.z.string().describe("The full path to the file"),
3320
+ lines: zod.z.object({
3321
+ start: zod.z.number().describe("First line number returned"),
3322
+ end: zod.z.number().describe("Last line number returned")
3271
3323
  }).optional().describe("Line range information (when offset/limit used)"),
3272
- totalLines: z.z.number().optional().describe("Total number of lines in the file")
3324
+ totalLines: zod.z.number().optional().describe("Total number of lines in the file")
3273
3325
  }),
3274
3326
  execute: async ({ path: path4, encoding, offset, limit, showLineNumbers }) => {
3275
3327
  const effectiveEncoding = encoding ?? "utf-8";
@@ -3316,15 +3368,15 @@ function createWorkspaceTools(workspace) {
3316
3368
  id: WORKSPACE_TOOLS.FILESYSTEM.WRITE_FILE,
3317
3369
  description: "Write content to a file in the workspace filesystem. Creates parent directories if needed.",
3318
3370
  requireApproval: writeFileConfig.requireApproval,
3319
- inputSchema: z.z.object({
3320
- path: z.z.string().describe('The path where to write the file (e.g., "/data/output.txt")'),
3321
- content: z.z.string().describe("The content to write to the file"),
3322
- overwrite: z.z.boolean().optional().default(true).describe("Whether to overwrite the file if it already exists")
3371
+ inputSchema: zod.z.object({
3372
+ path: zod.z.string().describe('The path where to write the file (e.g., "/data/output.txt")'),
3373
+ content: zod.z.string().describe("The content to write to the file"),
3374
+ overwrite: zod.z.boolean().optional().default(true).describe("Whether to overwrite the file if it already exists")
3323
3375
  }),
3324
- outputSchema: z.z.object({
3325
- success: z.z.boolean(),
3326
- path: z.z.string().describe("The path where the file was written"),
3327
- size: z.z.number().describe("The size of the written content in bytes")
3376
+ outputSchema: zod.z.object({
3377
+ success: zod.z.boolean(),
3378
+ path: zod.z.string().describe("The path where the file was written"),
3379
+ size: zod.z.number().describe("The size of the written content in bytes")
3328
3380
  }),
3329
3381
  execute: async ({ path: path4, content, overwrite }) => {
3330
3382
  if (readTracker && writeFileConfig.requireReadBeforeWrite) {
@@ -3357,17 +3409,17 @@ function createWorkspaceTools(workspace) {
3357
3409
  id: WORKSPACE_TOOLS.FILESYSTEM.EDIT_FILE,
3358
3410
  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.",
3359
3411
  requireApproval: editFileConfig.requireApproval,
3360
- inputSchema: z.z.object({
3361
- path: z.z.string().describe("The path to the file to edit"),
3362
- old_string: z.z.string().describe("The exact text to find and replace. Must be unique in the file."),
3363
- new_string: z.z.string().describe("The text to replace old_string with"),
3364
- replace_all: z.z.boolean().optional().default(false).describe("If true, replace all occurrences. If false (default), old_string must be unique.")
3412
+ inputSchema: zod.z.object({
3413
+ path: zod.z.string().describe("The path to the file to edit"),
3414
+ old_string: zod.z.string().describe("The exact text to find and replace. Must be unique in the file."),
3415
+ new_string: zod.z.string().describe("The text to replace old_string with"),
3416
+ replace_all: zod.z.boolean().optional().default(false).describe("If true, replace all occurrences. If false (default), old_string must be unique.")
3365
3417
  }),
3366
- outputSchema: z.z.object({
3367
- success: z.z.boolean(),
3368
- path: z.z.string().describe("The path to the edited file"),
3369
- replacements: z.z.number().describe("Number of replacements made"),
3370
- error: z.z.string().optional().describe("Error message if the edit failed")
3418
+ outputSchema: zod.z.object({
3419
+ success: zod.z.boolean(),
3420
+ path: zod.z.string().describe("The path to the edited file"),
3421
+ replacements: zod.z.number().describe("Number of replacements made"),
3422
+ error: zod.z.string().optional().describe("Error message if the edit failed")
3371
3423
  }),
3372
3424
  execute: async ({ path: path4, old_string, new_string, replace_all }) => {
3373
3425
  try {
@@ -3437,26 +3489,26 @@ Examples:
3437
3489
  - Directories only: { path: "/", dirsOnly: true }
3438
3490
  - Exclude node_modules: { path: "/", exclude: "node_modules" }`,
3439
3491
  requireApproval: listFilesConfig.requireApproval,
3440
- inputSchema: z.z.object({
3441
- path: z.z.string().default("/").describe("Directory path to list"),
3442
- maxDepth: z.z.number().optional().default(3).describe("Maximum depth to descend (default: 3). Similar to tree -L flag."),
3443
- showHidden: z.z.boolean().optional().default(false).describe('Show hidden files starting with "." (default: false). Similar to tree -a flag.'),
3444
- dirsOnly: z.z.boolean().optional().default(false).describe("List directories only, no files (default: false). Similar to tree -d flag."),
3445
- exclude: z.z.string().optional().describe('Pattern to exclude (e.g., "node_modules"). Similar to tree -I flag.'),
3446
- extension: z.z.string().optional().describe('Filter by file extension (e.g., ".ts"). Similar to tree -P flag.')
3492
+ inputSchema: zod.z.object({
3493
+ path: zod.z.string().default("/").describe("Directory path to list"),
3494
+ maxDepth: zod.z.number().optional().default(3).describe("Maximum depth to descend (default: 3). Similar to tree -L flag."),
3495
+ showHidden: zod.z.boolean().optional().default(false).describe('Show hidden files starting with "." (default: false). Similar to tree -a flag.'),
3496
+ dirsOnly: zod.z.boolean().optional().default(false).describe("List directories only, no files (default: false). Similar to tree -d flag."),
3497
+ exclude: zod.z.string().optional().describe('Pattern to exclude (e.g., "node_modules"). Similar to tree -I flag.'),
3498
+ extension: zod.z.string().optional().describe('Filter by file extension (e.g., ".ts"). Similar to tree -P flag.')
3447
3499
  }),
3448
- outputSchema: z.z.object({
3449
- tree: z.z.string().describe("Tree-style directory listing"),
3450
- summary: z.z.string().describe('Summary of directories and files (e.g., "3 directories, 12 files")'),
3451
- metadata: z.z.object({
3452
- workspace: z.z.object({
3453
- id: z.z.string().optional(),
3454
- name: z.z.string().optional()
3500
+ outputSchema: zod.z.object({
3501
+ tree: zod.z.string().describe("Tree-style directory listing"),
3502
+ summary: zod.z.string().describe('Summary of directories and files (e.g., "3 directories, 12 files")'),
3503
+ metadata: zod.z.object({
3504
+ workspace: zod.z.object({
3505
+ id: zod.z.string().optional(),
3506
+ name: zod.z.string().optional()
3455
3507
  }).optional(),
3456
- filesystem: z.z.object({
3457
- id: z.z.string().optional(),
3458
- name: z.z.string().optional(),
3459
- provider: z.z.string().optional()
3508
+ filesystem: zod.z.object({
3509
+ id: zod.z.string().optional(),
3510
+ name: zod.z.string().optional(),
3511
+ provider: zod.z.string().optional()
3460
3512
  }).optional()
3461
3513
  }).optional().describe("Metadata about the workspace and filesystem")
3462
3514
  }),
@@ -3494,15 +3546,15 @@ Examples:
3494
3546
  id: WORKSPACE_TOOLS.FILESYSTEM.DELETE,
3495
3547
  description: "Delete a file or directory from the workspace filesystem",
3496
3548
  requireApproval: deleteConfig.requireApproval,
3497
- inputSchema: z.z.object({
3498
- path: z.z.string().describe("The path to the file or directory to delete"),
3499
- recursive: z.z.boolean().optional().default(false).describe(
3549
+ inputSchema: zod.z.object({
3550
+ path: zod.z.string().describe("The path to the file or directory to delete"),
3551
+ recursive: zod.z.boolean().optional().default(false).describe(
3500
3552
  "If true, delete directories and their contents recursively. Required for non-empty directories."
3501
3553
  )
3502
3554
  }),
3503
- outputSchema: z.z.object({
3504
- success: z.z.boolean(),
3505
- path: z.z.string()
3555
+ outputSchema: zod.z.object({
3556
+ success: zod.z.boolean(),
3557
+ path: zod.z.string()
3506
3558
  }),
3507
3559
  execute: async ({ path: path4, recursive }) => {
3508
3560
  const stat3 = await workspace.filesystem.stat(path4);
@@ -3521,14 +3573,14 @@ Examples:
3521
3573
  id: WORKSPACE_TOOLS.FILESYSTEM.FILE_STAT,
3522
3574
  description: "Get file or directory metadata from the workspace. Returns existence, type, size, and modification time.",
3523
3575
  requireApproval: fileStatConfig.requireApproval,
3524
- inputSchema: z.z.object({
3525
- path: z.z.string().describe("The path to check")
3576
+ inputSchema: zod.z.object({
3577
+ path: zod.z.string().describe("The path to check")
3526
3578
  }),
3527
- outputSchema: z.z.object({
3528
- exists: z.z.boolean().describe("Whether the path exists"),
3529
- type: z.z.enum(["file", "directory", "none"]).describe("The type of the path if it exists"),
3530
- size: z.z.number().optional().describe("Size in bytes (for files)"),
3531
- modifiedAt: z.z.string().optional().describe("Last modification time (ISO string)")
3579
+ outputSchema: zod.z.object({
3580
+ exists: zod.z.boolean().describe("Whether the path exists"),
3581
+ type: zod.z.enum(["file", "directory", "none"]).describe("The type of the path if it exists"),
3582
+ size: zod.z.number().optional().describe("Size in bytes (for files)"),
3583
+ modifiedAt: zod.z.string().optional().describe("Last modification time (ISO string)")
3532
3584
  }),
3533
3585
  execute: async ({ path: path4 }) => {
3534
3586
  try {
@@ -3554,13 +3606,13 @@ Examples:
3554
3606
  id: WORKSPACE_TOOLS.FILESYSTEM.MKDIR,
3555
3607
  description: "Create a directory in the workspace filesystem",
3556
3608
  requireApproval: mkdirConfig.requireApproval,
3557
- inputSchema: z.z.object({
3558
- path: z.z.string().describe("The path of the directory to create"),
3559
- recursive: z.z.boolean().optional().default(true).describe("Whether to create parent directories if they do not exist")
3609
+ inputSchema: zod.z.object({
3610
+ path: zod.z.string().describe("The path of the directory to create"),
3611
+ recursive: zod.z.boolean().optional().default(true).describe("Whether to create parent directories if they do not exist")
3560
3612
  }),
3561
- outputSchema: z.z.object({
3562
- success: z.z.boolean(),
3563
- path: z.z.string()
3613
+ outputSchema: zod.z.object({
3614
+ success: zod.z.boolean(),
3615
+ path: zod.z.string()
3564
3616
  }),
3565
3617
  execute: async ({ path: path4, recursive }) => {
3566
3618
  await workspace.filesystem.mkdir(path4, { recursive });
@@ -3576,26 +3628,26 @@ Examples:
3576
3628
  id: WORKSPACE_TOOLS.SEARCH.SEARCH,
3577
3629
  description: "Search indexed content in the workspace. Supports keyword (BM25), semantic (vector), and hybrid search modes.",
3578
3630
  requireApproval: searchConfig.requireApproval,
3579
- inputSchema: z.z.object({
3580
- query: z.z.string().describe("The search query string"),
3581
- topK: z.z.number().optional().default(5).describe("Maximum number of results to return"),
3582
- mode: z.z.enum(["bm25", "vector", "hybrid"]).optional().describe("Search mode: bm25 for keyword search, vector for semantic search, hybrid for both combined"),
3583
- minScore: z.z.number().optional().describe("Minimum score threshold (0-1 for normalized scores)")
3631
+ inputSchema: zod.z.object({
3632
+ query: zod.z.string().describe("The search query string"),
3633
+ topK: zod.z.number().optional().default(5).describe("Maximum number of results to return"),
3634
+ mode: zod.z.enum(["bm25", "vector", "hybrid"]).optional().describe("Search mode: bm25 for keyword search, vector for semantic search, hybrid for both combined"),
3635
+ minScore: zod.z.number().optional().describe("Minimum score threshold (0-1 for normalized scores)")
3584
3636
  }),
3585
- outputSchema: z.z.object({
3586
- results: z.z.array(
3587
- z.z.object({
3588
- id: z.z.string().describe("Document/file path"),
3589
- content: z.z.string().describe("The matching content"),
3590
- score: z.z.number().describe("Relevance score"),
3591
- lineRange: z.z.object({
3592
- start: z.z.number(),
3593
- end: z.z.number()
3637
+ outputSchema: zod.z.object({
3638
+ results: zod.z.array(
3639
+ zod.z.object({
3640
+ id: zod.z.string().describe("Document/file path"),
3641
+ content: zod.z.string().describe("The matching content"),
3642
+ score: zod.z.number().describe("Relevance score"),
3643
+ lineRange: zod.z.object({
3644
+ start: zod.z.number(),
3645
+ end: zod.z.number()
3594
3646
  }).optional().describe("Line range where query terms were found")
3595
3647
  })
3596
3648
  ),
3597
- count: z.z.number().describe("Number of results returned"),
3598
- mode: z.z.string().describe("The search mode that was used")
3649
+ count: zod.z.number().describe("Number of results returned"),
3650
+ mode: zod.z.string().describe("The search mode that was used")
3599
3651
  }),
3600
3652
  execute: async ({ query, topK, mode, minScore }) => {
3601
3653
  const results = await workspace.search(query, {
@@ -3622,14 +3674,14 @@ Examples:
3622
3674
  id: WORKSPACE_TOOLS.SEARCH.INDEX,
3623
3675
  description: "Index content for search. The path becomes the document ID in search results.",
3624
3676
  requireApproval: indexConfig.requireApproval,
3625
- inputSchema: z.z.object({
3626
- path: z.z.string().describe("The document ID/path for search results"),
3627
- content: z.z.string().describe("The text content to index"),
3628
- metadata: z.z.record(z.z.unknown()).optional().describe("Optional metadata to store with the document")
3677
+ inputSchema: zod.z.object({
3678
+ path: zod.z.string().describe("The document ID/path for search results"),
3679
+ content: zod.z.string().describe("The text content to index"),
3680
+ metadata: zod.z.record(zod.z.unknown()).optional().describe("Optional metadata to store with the document")
3629
3681
  }),
3630
- outputSchema: z.z.object({
3631
- success: z.z.boolean(),
3632
- path: z.z.string().describe("The indexed document ID")
3682
+ outputSchema: zod.z.object({
3683
+ success: zod.z.boolean(),
3684
+ path: zod.z.string().describe("The indexed document ID")
3633
3685
  }),
3634
3686
  execute: async ({ path: path4, content, metadata }) => {
3635
3687
  await workspace.index(path4, content, { metadata });
@@ -3647,20 +3699,20 @@ Examples:
3647
3699
  id: WORKSPACE_TOOLS.SANDBOX.EXECUTE_COMMAND,
3648
3700
  description: `Execute a shell command in the workspace sandbox. The output (stdout/stderr) is displayed to the user automatically in the tool result. ${pathInfo}`,
3649
3701
  requireApproval: executeCommandConfig.requireApproval,
3650
- inputSchema: z.z.object({
3651
- command: z.z.string().describe('The command to execute (e.g., "ls", "npm", "python")'),
3652
- args: z.z.array(z.z.string()).nullish().default([]).describe("Arguments to pass to the command"),
3653
- timeout: z.z.number().nullish().default(3e4).describe(
3702
+ inputSchema: zod.z.object({
3703
+ command: zod.z.string().describe('The command to execute (e.g., "ls", "npm", "python")'),
3704
+ args: zod.z.array(zod.z.string()).nullish().default([]).describe("Arguments to pass to the command"),
3705
+ timeout: zod.z.number().nullish().default(3e4).describe(
3654
3706
  "Maximum execution time in milliseconds. Default is 30000 (30 seconds). Example: 60000 for 1 minute."
3655
3707
  ),
3656
- cwd: z.z.string().nullish().describe("Working directory for the command")
3708
+ cwd: zod.z.string().nullish().describe("Working directory for the command")
3657
3709
  }),
3658
- outputSchema: z.z.object({
3659
- success: z.z.boolean().describe("Whether the command executed successfully (exit code 0)"),
3660
- stdout: z.z.string().describe("Standard output from the command"),
3661
- stderr: z.z.string().describe("Standard error output"),
3662
- exitCode: z.z.number().describe("Exit code (0 = success)"),
3663
- executionTimeMs: z.z.number().describe("How long the execution took in milliseconds")
3710
+ outputSchema: zod.z.object({
3711
+ success: zod.z.boolean().describe("Whether the command executed successfully (exit code 0)"),
3712
+ stdout: zod.z.string().describe("Standard output from the command"),
3713
+ stderr: zod.z.string().describe("Standard error output"),
3714
+ exitCode: zod.z.number().describe("Exit code (0 = success)"),
3715
+ executionTimeMs: zod.z.number().describe("How long the execution took in milliseconds")
3664
3716
  }),
3665
3717
  execute: async ({ command, args, timeout, cwd }, context) => {
3666
3718
  const getExecutionMetadata = () => ({
@@ -3761,5 +3813,5 @@ exports.extractLines = extractLines;
3761
3813
  exports.getRecommendedIsolation = getRecommendedIsolation;
3762
3814
  exports.isIsolationAvailable = isIsolationAvailable;
3763
3815
  exports.resolveToolConfig = resolveToolConfig;
3764
- //# sourceMappingURL=chunk-WBJMSOYD.cjs.map
3765
- //# sourceMappingURL=chunk-WBJMSOYD.cjs.map
3816
+ //# sourceMappingURL=chunk-66462UTX.cjs.map
3817
+ //# sourceMappingURL=chunk-66462UTX.cjs.map