@polka-codes/core 0.9.89 → 0.9.91

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/index.js CHANGED
@@ -126,14 +126,47 @@ function computeRateLimitBackoffSeconds(count, baseSeconds = 2, capSeconds = 60)
126
126
  }
127
127
 
128
128
  // src/config.ts
129
- import { z as z2 } from "zod";
129
+ import { z as z3 } from "zod";
130
130
 
131
- // src/config/memory.ts
131
+ // src/config/base.ts
132
132
  import { z } from "zod";
133
- var memoryConfigSchema = z.object({
134
- enabled: z.boolean().optional().default(true),
135
- type: z.enum(["sqlite", "memory"]).optional().default("sqlite"),
136
- path: z.string().optional().default("~/.config/polka-codes/memory.sqlite")
133
+ var baseModelConfigSchema = z.object({
134
+ provider: z.string().optional(),
135
+ model: z.string().optional(),
136
+ parameters: z.record(z.string(), z.unknown()).optional()
137
+ });
138
+ var baseApprovalConfigSchema = z.object({
139
+ level: z.enum(["none", "destructive", "commits", "all"]).optional(),
140
+ autoApprove: z.boolean().optional(),
141
+ maxCost: z.number().positive().optional()
142
+ });
143
+ var providerConfigSchema = z.object({
144
+ apiKey: z.string().optional(),
145
+ defaultModel: z.string().optional(),
146
+ defaultParameters: z.record(z.string(), z.unknown()).optional(),
147
+ location: z.string().optional(),
148
+ project: z.string().optional(),
149
+ keyFile: z.string().optional(),
150
+ baseUrl: z.string().optional(),
151
+ name: z.string().optional()
152
+ });
153
+ var modelConfigSchema = baseModelConfigSchema.extend({
154
+ budget: z.number().positive().optional(),
155
+ rules: z.union([z.string(), z.array(z.string()).optional()]).optional()
156
+ });
157
+ var toolConfigSchema = z.union([
158
+ z.boolean(),
159
+ // Simple enable/disable
160
+ baseModelConfigSchema
161
+ // Model override for this tool
162
+ ]);
163
+
164
+ // src/config/memory.ts
165
+ import { z as z2 } from "zod";
166
+ var memoryConfigSchema = z2.object({
167
+ enabled: z2.boolean().optional().default(true),
168
+ type: z2.enum(["sqlite", "memory"]).optional().default("sqlite"),
169
+ path: z2.string().optional().default("~/.config/polka-codes/memory.sqlite")
137
170
  }).strict().optional();
138
171
  var DEFAULT_MEMORY_CONFIG = {
139
172
  enabled: true,
@@ -142,170 +175,191 @@ var DEFAULT_MEMORY_CONFIG = {
142
175
  };
143
176
  function resolveHomePath(path) {
144
177
  if (path.startsWith("~")) {
145
- return `${process.env.HOME}${path.slice(1)}`;
178
+ const home = process.env.HOME || process.env.USERPROFILE || ".";
179
+ if (home === ".") {
180
+ throw new Error("Cannot resolve home directory: HOME and USERPROFILE environment variables are not set");
181
+ }
182
+ return `${home}${path.slice(1)}`;
146
183
  }
147
184
  return path;
148
185
  }
149
186
 
150
187
  // src/config.ts
151
- var ruleSchema = z2.union([
152
- z2.string(),
153
- z2.object({ path: z2.string() }).strict(),
154
- z2.object({ url: z2.string() }).strict(),
155
- z2.object({
156
- repo: z2.string(),
157
- path: z2.string(),
158
- tag: z2.string().optional(),
159
- commit: z2.string().optional(),
160
- branch: z2.string().optional()
188
+ var ruleSchema = z3.union([
189
+ z3.string(),
190
+ z3.object({ path: z3.string() }).strict(),
191
+ z3.object({ url: z3.string() }).strict(),
192
+ z3.object({
193
+ repo: z3.string(),
194
+ path: z3.string(),
195
+ tag: z3.string().optional(),
196
+ commit: z3.string().optional(),
197
+ branch: z3.string().optional()
161
198
  }).strict()
162
199
  ]);
163
- var providerConfigSchema = z2.object({
164
- apiKey: z2.string().optional(),
165
- defaultModel: z2.string().optional(),
166
- defaultParameters: z2.record(z2.string(), z2.any()).optional(),
167
- location: z2.string().optional(),
168
- project: z2.string().optional(),
169
- keyFile: z2.string().optional(),
170
- baseUrl: z2.string().optional(),
171
- name: z2.string().optional()
172
- // For OpenAI-compatible providers
173
- });
174
- var providerModelSchema = z2.object({
175
- provider: z2.string().optional(),
176
- model: z2.string().optional(),
177
- parameters: z2.record(z2.string(), z2.any()).optional(),
178
- budget: z2.number().positive().optional(),
179
- rules: z2.array(ruleSchema).optional().or(z2.string()).optional()
200
+ var providerModelSchema = z3.object({
201
+ provider: z3.string().optional(),
202
+ model: z3.string().optional(),
203
+ parameters: z3.record(z3.string(), z3.unknown()).optional(),
204
+ budget: z3.number().positive().optional(),
205
+ rules: z3.array(ruleSchema).optional().or(z3.string()).optional()
180
206
  });
181
- var scriptSchema = z2.union([
207
+ var scriptSchema = z3.union([
182
208
  // Type 1: Simple shell command (backward compatible)
183
- z2.string(),
209
+ z3.string(),
184
210
  // Type 2: Object with command and description (backward compatible)
185
- z2.object({
186
- command: z2.string(),
187
- description: z2.string()
211
+ z3.object({
212
+ command: z3.string(),
213
+ description: z3.string()
188
214
  }).strict(),
189
215
  // Type 3: Reference to dynamic workflow YAML
190
- z2.object({
191
- workflow: z2.string(),
216
+ z3.object({
217
+ workflow: z3.string(),
192
218
  // Path to .yml workflow file
193
- description: z2.string().optional(),
194
- input: z2.record(z2.string(), z2.any()).optional()
219
+ description: z3.string().optional(),
220
+ input: z3.record(z3.string(), z3.unknown()).optional()
195
221
  // Default workflow input
196
222
  }).strict(),
197
223
  // Type 4: TypeScript script file (NEW)
198
- z2.object({
199
- script: z2.string(),
224
+ z3.object({
225
+ script: z3.string(),
200
226
  // Path to .ts file
201
- description: z2.string().optional(),
202
- permissions: z2.object({
203
- fs: z2.enum(["read", "write", "none"]).optional(),
204
- network: z2.boolean().optional(),
205
- subprocess: z2.boolean().optional()
227
+ description: z3.string().optional(),
228
+ permissions: z3.object({
229
+ fs: z3.enum(["read", "write", "none"]).optional(),
230
+ network: z3.boolean().optional(),
231
+ subprocess: z3.boolean().optional()
206
232
  }).optional(),
207
- timeout: z2.number().int().positive().max(36e5).optional(),
233
+ timeout: z3.number().int().positive().max(36e5).optional(),
208
234
  // Max 1 hour in milliseconds
209
- memory: z2.number().int().positive().min(64).max(8192).optional()
235
+ memory: z3.number().int().positive().min(64).max(8192).optional()
210
236
  // 64MB-8GB in MB
211
237
  }).strict()
212
238
  ]);
213
- var mcpServerConfigSchema = z2.object({
214
- command: z2.string(),
215
- args: z2.array(z2.string()).optional(),
216
- env: z2.record(z2.string(), z2.string()).optional(),
217
- tools: z2.record(
218
- z2.string(),
219
- z2.boolean().or(
220
- z2.object({
221
- provider: z2.string().optional(),
222
- model: z2.string().optional(),
223
- parameters: z2.record(z2.string(), z2.unknown()).optional()
239
+ var mcpServerConfigSchema = z3.object({
240
+ command: z3.string(),
241
+ args: z3.array(z3.string()).optional(),
242
+ env: z3.record(z3.string(), z3.string()).optional(),
243
+ tools: z3.record(
244
+ z3.string(),
245
+ z3.boolean().or(
246
+ z3.object({
247
+ provider: z3.string().optional(),
248
+ model: z3.string().optional(),
249
+ parameters: z3.record(z3.string(), z3.unknown()).optional()
224
250
  }).strict()
225
251
  )
226
252
  ).optional()
227
253
  }).strict();
228
- var agentContinuousImprovementSchema = z2.object({
229
- sleepTimeOnNoTasks: z2.number().int().optional(),
230
- sleepTimeBetweenTasks: z2.number().int().optional(),
231
- maxCycles: z2.number().int().optional()
254
+ var agentContinuousImprovementSchema = z3.object({
255
+ sleepTimeOnNoTasks: z3.number().int().optional(),
256
+ sleepTimeBetweenTasks: z3.number().int().optional(),
257
+ maxCycles: z3.number().int().optional()
232
258
  }).strict().optional();
233
- var agentDiscoverySchema = z2.object({
234
- enabledStrategies: z2.array(z2.string()).optional(),
235
- cacheTime: z2.number().int().optional(),
236
- checkChanges: z2.boolean().optional()
259
+ var agentDiscoverySchema = z3.object({
260
+ enabledStrategies: z3.array(z3.string()).optional(),
261
+ cacheTime: z3.number().int().optional(),
262
+ checkChanges: z3.boolean().optional()
237
263
  }).strict().optional();
238
- var agentSafetySchema = z2.object({
239
- enabledChecks: z2.array(z2.string()).optional(),
240
- blockDestructive: z2.boolean().optional(),
241
- maxFileSize: z2.number().int().optional()
264
+ var agentSafetySchema = z3.object({
265
+ enabledChecks: z3.array(z3.string()).optional(),
266
+ blockDestructive: z3.boolean().optional(),
267
+ maxFileSize: z3.number().int().optional()
242
268
  }).strict().optional();
243
- var agentHealthCheckSchema = z2.object({
244
- enabled: z2.boolean().optional(),
245
- interval: z2.number().int().optional()
269
+ var agentHealthCheckSchema = z3.object({
270
+ enabled: z3.boolean().optional(),
271
+ interval: z3.number().int().optional()
246
272
  }).strict().optional();
247
- var agentApprovalSchema = z2.object({
248
- level: z2.enum(["none", "destructive", "commits", "all"]).optional(),
249
- autoApproveSafeTasks: z2.boolean().optional(),
250
- maxAutoApprovalCost: z2.number().optional()
273
+ var agentApprovalSchema = z3.object({
274
+ level: z3.enum(["none", "destructive", "commits", "all"]).optional(),
275
+ autoApproveSafeTasks: z3.boolean().optional(),
276
+ maxAutoApprovalCost: z3.number().optional()
251
277
  }).strict().optional();
252
- var agentSchema = z2.object({
253
- preset: z2.string().optional(),
254
- strategy: z2.enum(["goal-directed", "continuous-improvement"]).optional(),
255
- continueOnCompletion: z2.boolean().optional(),
256
- maxIterations: z2.number().int().optional(),
257
- timeout: z2.number().int().optional(),
258
- requireApprovalFor: z2.enum(["none", "destructive", "commits", "all"]).optional(),
259
- autoApproveSafeTasks: z2.boolean().optional(),
260
- maxAutoApprovalCost: z2.number().optional(),
261
- pauseOnError: z2.boolean().optional(),
262
- workingBranch: z2.string().optional(),
263
- destructiveOperations: z2.array(z2.string()).optional(),
264
- maxConcurrency: z2.number().int().optional(),
265
- autoSaveInterval: z2.number().int().optional(),
266
- workingDir: z2.string().optional(),
278
+ var agentSchema = z3.object({
279
+ preset: z3.string().optional(),
280
+ strategy: z3.enum(["goal-directed", "continuous-improvement"]).optional(),
281
+ continueOnCompletion: z3.boolean().optional(),
282
+ maxIterations: z3.number().int().optional(),
283
+ timeout: z3.number().int().optional(),
284
+ requireApprovalFor: z3.enum(["none", "destructive", "commits", "all"]).optional(),
285
+ autoApproveSafeTasks: z3.boolean().optional(),
286
+ maxAutoApprovalCost: z3.number().optional(),
287
+ pauseOnError: z3.boolean().optional(),
288
+ workingBranch: z3.string().optional(),
289
+ destructiveOperations: z3.array(z3.string()).optional(),
290
+ maxConcurrency: z3.number().int().optional(),
291
+ autoSaveInterval: z3.number().int().optional(),
292
+ workingDir: z3.string().optional(),
267
293
  continuousImprovement: agentContinuousImprovementSchema,
268
294
  discovery: agentDiscoverySchema,
269
295
  safety: agentSafetySchema,
270
296
  healthCheck: agentHealthCheckSchema,
271
297
  approval: agentApprovalSchema
272
298
  }).strict().optional();
273
- var configSchema = z2.object({
274
- prices: z2.record(
275
- z2.string(),
299
+ var configSchema = z3.object({
300
+ prices: z3.record(
301
+ z3.string(),
276
302
  // provider
277
- z2.record(
278
- z2.string(),
303
+ z3.record(
304
+ z3.string(),
279
305
  // model
280
- z2.object({
281
- inputPrice: z2.number().optional(),
282
- outputPrice: z2.number().optional(),
283
- cacheWritesPrice: z2.number().optional(),
284
- cacheReadsPrice: z2.number().optional()
306
+ z3.object({
307
+ inputPrice: z3.number().optional(),
308
+ outputPrice: z3.number().optional(),
309
+ cacheWritesPrice: z3.number().optional(),
310
+ cacheReadsPrice: z3.number().optional()
285
311
  })
286
312
  )
287
313
  ).optional(),
288
- providers: z2.record(z2.string(), providerConfigSchema).optional(),
289
- defaultProvider: z2.string().optional(),
290
- defaultModel: z2.string().optional(),
291
- defaultParameters: z2.record(z2.string(), z2.any()).optional(),
292
- maxMessageCount: z2.number().int().positive().optional(),
293
- budget: z2.number().positive().optional(),
294
- retryCount: z2.number().int().min(0).optional(),
295
- requestTimeoutSeconds: z2.number().int().positive().optional(),
296
- summaryThreshold: z2.number().int().positive().optional(),
297
- scripts: z2.record(z2.string(), scriptSchema).optional(),
298
- commands: z2.record(z2.string(), providerModelSchema).optional(),
299
- tools: z2.object({
300
- search: providerModelSchema.or(z2.boolean()).optional()
314
+ providers: z3.record(z3.string(), providerConfigSchema).optional(),
315
+ defaultProvider: z3.string().optional(),
316
+ defaultModel: z3.string().optional(),
317
+ defaultParameters: z3.record(z3.string(), z3.unknown()).optional(),
318
+ maxMessageCount: z3.number().int().positive().optional(),
319
+ budget: z3.number().positive().optional(),
320
+ retryCount: z3.number().int().min(0).optional(),
321
+ requestTimeoutSeconds: z3.number().int().positive().optional(),
322
+ summaryThreshold: z3.number().int().positive().optional(),
323
+ scripts: z3.record(z3.string(), scriptSchema).optional(),
324
+ commands: z3.record(z3.string(), providerModelSchema).optional(),
325
+ tools: z3.object({
326
+ search: providerModelSchema.or(z3.boolean()).optional()
301
327
  }).optional(),
302
- mcpServers: z2.record(z2.string(), mcpServerConfigSchema).optional(),
303
- rules: z2.array(ruleSchema).optional().or(z2.string()).optional(),
304
- excludeFiles: z2.array(z2.string()).optional(),
328
+ mcpServers: z3.record(z3.string(), mcpServerConfigSchema).optional(),
329
+ rules: z3.array(ruleSchema).optional().or(z3.string()).optional(),
330
+ excludeFiles: z3.array(z3.string()).optional(),
305
331
  agent: agentSchema,
306
332
  memory: memoryConfigSchema
307
333
  }).strict().nullish();
308
334
 
335
+ // src/errors/base.ts
336
+ var BaseError = class extends Error {
337
+ constructor(name, message, cause) {
338
+ super(message);
339
+ this.name = name;
340
+ this.cause = cause;
341
+ this.name = name;
342
+ if (cause) {
343
+ this.cause = cause;
344
+ }
345
+ if (Error.captureStackTrace) {
346
+ Error.captureStackTrace(this, this.constructor);
347
+ }
348
+ }
349
+ };
350
+ function createErrorClass(name, template) {
351
+ class NamedError extends BaseError {
352
+ constructor(...args) {
353
+ const message = template(args);
354
+ const lastArg = args[args.length - 1];
355
+ const cause = lastArg instanceof Error ? lastArg : void 0;
356
+ super(name, message, cause);
357
+ }
358
+ }
359
+ Object.defineProperty(NamedError, "name", { value: name });
360
+ return NamedError;
361
+ }
362
+
309
363
  // src/fs/node-provider.ts
310
364
  import { existsSync } from "fs";
311
365
  import { readdir, readFile, stat } from "fs/promises";
@@ -406,11 +460,11 @@ import { parse } from "yaml";
406
460
  import { ZodError } from "zod";
407
461
 
408
462
  // src/skills/types.ts
409
- import { z as z3 } from "zod";
410
- var skillMetadataSchema = z3.object({
411
- name: z3.string().regex(/^[a-z0-9-]+$/, "Skill name must be lowercase letters, numbers, and hyphens").max(64, "Skill name must be at most 64 characters"),
412
- description: z3.string().max(1024, "Description must be at most 1024 characters"),
413
- allowedTools: z3.array(z3.string()).optional()
463
+ import { z as z4 } from "zod";
464
+ var skillMetadataSchema = z4.object({
465
+ name: z4.string().regex(/^[a-z0-9-]+$/, "Skill name must be lowercase letters, numbers, and hyphens").max(64, "Skill name must be at most 64 characters"),
466
+ description: z4.string().max(1024, "Description must be at most 1024 characters"),
467
+ allowedTools: z4.array(z4.string()).optional()
414
468
  });
415
469
  var SkillDiscoveryError = class extends Error {
416
470
  constructor(message, path) {
@@ -824,19 +878,19 @@ function getSkillStats(skill) {
824
878
  }
825
879
 
826
880
  // src/skills/tools/listSkills.ts
827
- import { z as z4 } from "zod";
828
- var ListSkillsInputSchema = z4.object({
829
- filter: z4.string().optional().describe("Optional filter string to match against skill names and descriptions")
881
+ import { z as z5 } from "zod";
882
+ var ListSkillsInputSchema = z5.object({
883
+ filter: z5.string().optional().describe("Optional filter string to match against skill names and descriptions")
830
884
  });
831
- var ListSkillsOutputSchema = z4.object({
832
- skills: z4.array(
833
- z4.object({
834
- name: z4.string(),
835
- description: z4.string(),
836
- source: z4.enum(["personal", "project", "plugin"])
885
+ var ListSkillsOutputSchema = z5.object({
886
+ skills: z5.array(
887
+ z5.object({
888
+ name: z5.string(),
889
+ description: z5.string(),
890
+ source: z5.enum(["personal", "project", "plugin"])
837
891
  })
838
892
  ),
839
- total: z4.number()
893
+ total: z5.number()
840
894
  });
841
895
  async function listSkills(input, context) {
842
896
  const { filter } = input;
@@ -862,20 +916,20 @@ var listSkillsToolInfo = {
862
916
  };
863
917
 
864
918
  // src/skills/tools/loadSkill.ts
865
- import { z as z5 } from "zod";
866
- var LoadSkillInputSchema = z5.object({
867
- skillName: z5.string().describe("The name of the skill to load")
919
+ import { z as z6 } from "zod";
920
+ var LoadSkillInputSchema = z6.object({
921
+ skillName: z6.string().describe("The name of the skill to load")
868
922
  });
869
- var LoadSkillOutputSchema = z5.object({
870
- success: z5.boolean(),
871
- skill: z5.object({
872
- name: z5.string(),
873
- description: z5.string(),
874
- content: z5.string(),
875
- availableFiles: z5.array(z5.string())
923
+ var LoadSkillOutputSchema = z6.object({
924
+ success: z6.boolean(),
925
+ skill: z6.object({
926
+ name: z6.string(),
927
+ description: z6.string(),
928
+ content: z6.string(),
929
+ availableFiles: z6.array(z6.string())
876
930
  }).optional(),
877
- error: z5.string().optional(),
878
- warnings: z5.array(z5.string()).optional()
931
+ error: z6.string().optional(),
932
+ warnings: z6.array(z6.string()).optional()
879
933
  });
880
934
  async function loadSkill(input, context) {
881
935
  const { skillName } = input;
@@ -924,15 +978,15 @@ var loadSkillToolInfo = {
924
978
  };
925
979
 
926
980
  // src/skills/tools/readSkillFile.ts
927
- import { z as z6 } from "zod";
928
- var ReadSkillFileInputSchema = z6.object({
929
- skillName: z6.string().describe("The name of the skill"),
930
- filename: z6.string().describe('The name of the file to read (e.g., "reference.md", "scripts/helper.py")')
981
+ import { z as z7 } from "zod";
982
+ var ReadSkillFileInputSchema = z7.object({
983
+ skillName: z7.string().describe("The name of the skill"),
984
+ filename: z7.string().describe('The name of the file to read (e.g., "reference.md", "scripts/helper.py")')
931
985
  });
932
- var ReadSkillFileOutputSchema = z6.object({
933
- success: z6.boolean(),
934
- content: z6.string().optional(),
935
- error: z6.string().optional()
986
+ var ReadSkillFileOutputSchema = z7.object({
987
+ success: z7.boolean(),
988
+ content: z7.string().optional(),
989
+ error: z7.string().optional()
936
990
  });
937
991
  async function readSkillFile(input, context) {
938
992
  const { skillName, filename } = input;
@@ -970,16 +1024,16 @@ var readSkillFileToolInfo = {
970
1024
  };
971
1025
 
972
1026
  // src/tools/askFollowupQuestion.ts
973
- import { z as z7 } from "zod";
974
- var questionObject = z7.object({
975
- prompt: z7.string().describe("The text of the question.").meta({ usageValue: "question text here" }),
976
- options: z7.array(z7.string()).default([]).describe("Ordered list of suggested answers (omit if none).").meta({ usageValue: "suggested answer here" })
1027
+ import { z as z8 } from "zod";
1028
+ var questionObject = z8.object({
1029
+ prompt: z8.string().describe("The text of the question.").meta({ usageValue: "question text here" }),
1030
+ options: z8.array(z8.string()).default([]).describe("Ordered list of suggested answers (omit if none).").meta({ usageValue: "suggested answer here" })
977
1031
  });
978
1032
  var toolInfo = {
979
1033
  name: "askFollowupQuestion",
980
1034
  description: "Call this when vital details are missing. Pose each follow-up as one direct, unambiguous question. If it speeds the reply, add up to five short, mutually-exclusive answer options. Group any related questions in the same call to avoid a back-and-forth chain.",
981
- parameters: z7.object({
982
- questions: z7.array(questionObject).describe("One or more follow-up questions you need answered before you can continue.").meta({ usageValue: "questions here" })
1035
+ parameters: z8.object({
1036
+ questions: z8.array(questionObject).describe("One or more follow-up questions you need answered before you can continue.").meta({ usageValue: "questions here" })
983
1037
  }).meta({
984
1038
  examples: [
985
1039
  {
@@ -1067,7 +1121,7 @@ var askFollowupQuestion_default = {
1067
1121
  };
1068
1122
 
1069
1123
  // src/tools/executeCommand.ts
1070
- import { z as z8 } from "zod";
1124
+ import { z as z9 } from "zod";
1071
1125
 
1072
1126
  // src/tools/response-builders.ts
1073
1127
  function createSuccessResponse(value, type = "text") {
@@ -1122,9 +1176,9 @@ function createFileElement(tagName, path, content, attrs) {
1122
1176
  var toolInfo2 = {
1123
1177
  name: "executeCommand",
1124
1178
  description: "Run a single CLI command. The command is always executed in the project-root working directory (regardless of earlier commands). Prefer one-off shell commands over wrapper scripts for flexibility. **IMPORTANT**: After an `execute_command` call, you MUST stop and NOT allowed to make further tool calls in the same message.",
1125
- parameters: z8.object({
1126
- command: z8.string().describe("The exact command to run (valid for the current OS). It must be correctly formatted and free of harmful instructions.").meta({ usageValue: "your-command-here" }),
1127
- requiresApproval: z8.preprocess(preprocessBoolean, z8.boolean().optional().default(false)).describe(
1179
+ parameters: z9.object({
1180
+ command: z9.string().describe("The exact command to run (valid for the current OS). It must be correctly formatted and free of harmful instructions.").meta({ usageValue: "your-command-here" }),
1181
+ requiresApproval: z9.preprocess(preprocessBoolean, z9.boolean().optional().default(false)).describe(
1128
1182
  "Set to `true` for commands that install/uninstall software, modify or delete files, change system settings, perform network operations, or have other side effects. Use `false` for safe, read-only, or purely local development actions (e.g., listing files, make a build, running tests)."
1129
1183
  ).meta({ usageValue: "true | false" })
1130
1184
  }).meta({
@@ -1195,16 +1249,16 @@ var executeCommand_default = {
1195
1249
  };
1196
1250
 
1197
1251
  // src/tools/fetchUrl.ts
1198
- import { z as z9 } from "zod";
1252
+ import { z as z10 } from "zod";
1199
1253
  var toolInfo3 = {
1200
1254
  name: "fetchUrl",
1201
1255
  description: "Fetch the content located at one or more HTTP(S) URLs and return it in Markdown format. This works for standard web pages as well as raw files (e.g. README.md, source code) hosted on platforms like GitHub.",
1202
- parameters: z9.object({
1203
- url: z9.preprocess((val) => {
1256
+ parameters: z10.object({
1257
+ url: z10.preprocess((val) => {
1204
1258
  if (!val) return [];
1205
1259
  const values = Array.isArray(val) ? val : [val];
1206
1260
  return values.flatMap((i) => typeof i === "string" ? i.split(",") : []).filter((s) => s.length > 0);
1207
- }, z9.array(z9.string())).describe("One or more URLs to fetch, separated by commas if multiple.").meta({ usageValue: "url" })
1261
+ }, z10.array(z10.string())).describe("One or more URLs to fetch, separated by commas if multiple.").meta({ usageValue: "url" })
1208
1262
  }).meta({
1209
1263
  examples: [
1210
1264
  {
@@ -1273,15 +1327,15 @@ var fetchUrl_default = {
1273
1327
  };
1274
1328
 
1275
1329
  // src/tools/listFiles.ts
1276
- import { z as z10 } from "zod";
1330
+ import { z as z11 } from "zod";
1277
1331
  var toolInfo4 = {
1278
1332
  name: "listFiles",
1279
1333
  description: "Request to list files and directories within the specified directory. If recursive is true, it will list all files and directories recursively. If recursive is false or not provided, it will only list the top-level contents. Do not use this tool to confirm the existence of files you may have created, as the user will let you know if the files were created successfully or not.",
1280
- parameters: z10.object({
1281
- path: z10.string().describe("The path of the directory to list contents for (relative to the current working directory)").meta({ usageValue: "Directory path here" }),
1282
- maxCount: z10.coerce.number().optional().default(2e3).describe("The maximum number of files to list. Default to 2000").meta({ usageValue: "Maximum number of files to list (optional)" }),
1283
- recursive: z10.preprocess(preprocessBoolean, z10.boolean().optional().default(true)).describe("Whether to list files recursively. Use true for recursive listing, false or omit for top-level only.").meta({ usageValue: "true or false (optional)" }),
1284
- includeIgnored: z10.preprocess(preprocessBoolean, z10.boolean().optional().default(false)).describe("Whether to include ignored files. Use true to include files ignored by .gitignore.").meta({ usageValue: "true or false (optional)" })
1334
+ parameters: z11.object({
1335
+ path: z11.string().describe("The path of the directory to list contents for (relative to the current working directory)").meta({ usageValue: "Directory path here" }),
1336
+ maxCount: z11.coerce.number().optional().default(2e3).describe("The maximum number of files to list. Default to 2000").meta({ usageValue: "Maximum number of files to list (optional)" }),
1337
+ recursive: z11.preprocess(preprocessBoolean, z11.boolean().optional().default(true)).describe("Whether to list files recursively. Use true for recursive listing, false or omit for top-level only.").meta({ usageValue: "true or false (optional)" }),
1338
+ includeIgnored: z11.preprocess(preprocessBoolean, z11.boolean().optional().default(false)).describe("Whether to include ignored files. Use true to include files ignored by .gitignore.").meta({ usageValue: "true or false (optional)" })
1285
1339
  }).meta({
1286
1340
  examples: [
1287
1341
  {
@@ -1379,12 +1433,12 @@ var MockProvider = class {
1379
1433
  };
1380
1434
 
1381
1435
  // src/tools/readBinaryFile.ts
1382
- import { z as z11 } from "zod";
1436
+ import { z as z12 } from "zod";
1383
1437
  var toolInfo5 = {
1384
1438
  name: "readBinaryFile",
1385
1439
  description: "Read a binary file from a URL or local path. Use file:// prefix to access local files. This can be used to access non-text files such as PDFs or images.",
1386
- parameters: z11.object({
1387
- url: z11.string().describe("The URL or local path of the file to read.")
1440
+ parameters: z12.object({
1441
+ url: z12.string().describe("The URL or local path of the file to read.")
1388
1442
  })
1389
1443
  };
1390
1444
  var handler5 = async (provider, args) => {
@@ -1431,7 +1485,7 @@ var readBinaryFile_default = {
1431
1485
  };
1432
1486
 
1433
1487
  // src/tools/readFile.ts
1434
- import { z as z12 } from "zod";
1488
+ import { z as z13 } from "zod";
1435
1489
  var toolInfo6 = {
1436
1490
  name: "readFile",
1437
1491
  description: `Request to read the contents of one or multiple files at the specified paths.
@@ -1457,17 +1511,17 @@ Features:
1457
1511
  IMPORTANT:
1458
1512
  - Line numbers are included for easy reference
1459
1513
  - Use offset/limit for large files to read specific sections`,
1460
- parameters: z12.object({
1461
- path: z12.preprocess((val) => {
1514
+ parameters: z13.object({
1515
+ path: z13.preprocess((val) => {
1462
1516
  if (!val) return [];
1463
1517
  if (Array.isArray(val)) {
1464
1518
  return val.filter((s) => typeof s === "string" && s.length > 0);
1465
1519
  }
1466
1520
  return val.split(",").filter((s) => s.length > 0);
1467
- }, z12.array(z12.string())).describe("The path of the file to read").meta({ usageValue: "Comma separated paths here" }),
1468
- offset: z12.number().optional().describe("Skip first N lines (for partial file reading)").meta({ usageValue: "100" }),
1469
- limit: z12.number().optional().describe("Read at most N lines (for partial file reading)").meta({ usageValue: "50" }),
1470
- includeIgnored: z12.preprocess(preprocessBoolean, z12.boolean().nullish().default(false)).describe("Whether to include ignored files. Use true to include files ignored by .gitignore.").meta({ usageValue: "true or false (optional)" })
1521
+ }, z13.array(z13.string())).describe("The path of the file to read").meta({ usageValue: "Comma separated paths here" }),
1522
+ offset: z13.number().optional().describe("Skip first N lines (for partial file reading)").meta({ usageValue: "100" }),
1523
+ limit: z13.number().optional().describe("Read at most N lines (for partial file reading)").meta({ usageValue: "50" }),
1524
+ includeIgnored: z13.preprocess(preprocessBoolean, z13.boolean().nullish().default(false)).describe("Whether to include ignored files. Use true to include files ignored by .gitignore.").meta({ usageValue: "true or false (optional)" })
1471
1525
  }).meta({
1472
1526
  examples: [
1473
1527
  {
@@ -1543,12 +1597,12 @@ var readFile_default = {
1543
1597
  };
1544
1598
 
1545
1599
  // src/tools/removeFile.ts
1546
- import { z as z13 } from "zod";
1600
+ import { z as z14 } from "zod";
1547
1601
  var toolInfo7 = {
1548
1602
  name: "removeFile",
1549
1603
  description: "Request to remove a file at the specified path.",
1550
- parameters: z13.object({
1551
- path: z13.string().describe("The path of the file to remove").meta({ usageValue: "File path here" })
1604
+ parameters: z14.object({
1605
+ path: z14.string().describe("The path of the file to remove").meta({ usageValue: "File path here" })
1552
1606
  }).meta({
1553
1607
  examples: [
1554
1608
  {
@@ -1590,13 +1644,13 @@ var removeFile_default = {
1590
1644
  };
1591
1645
 
1592
1646
  // src/tools/renameFile.ts
1593
- import { z as z14 } from "zod";
1647
+ import { z as z15 } from "zod";
1594
1648
  var toolInfo8 = {
1595
1649
  name: "renameFile",
1596
1650
  description: "Request to rename a file from source path to target path.",
1597
- parameters: z14.object({
1598
- source_path: z14.string().describe("The current path of the file").meta({ usageValue: "Source file path here" }),
1599
- target_path: z14.string().describe("The new path for the file").meta({ usageValue: "Target file path here" })
1651
+ parameters: z15.object({
1652
+ source_path: z15.string().describe("The current path of the file").meta({ usageValue: "Source file path here" }),
1653
+ target_path: z15.string().describe("The new path for the file").meta({ usageValue: "Target file path here" })
1600
1654
  }).meta({
1601
1655
  examples: [
1602
1656
  {
@@ -1635,7 +1689,7 @@ var renameFile_default = {
1635
1689
  };
1636
1690
 
1637
1691
  // src/tools/replaceInFile.ts
1638
- import { z as z15 } from "zod";
1692
+ import { z as z16 } from "zod";
1639
1693
 
1640
1694
  // src/tools/utils/replaceInFile.ts
1641
1695
  var replaceInFile = (fileContent, diff) => {
@@ -1768,9 +1822,9 @@ IMPORTANT CONSTRAINTS:
1768
1822
  - SEARCH text must match file content exactly
1769
1823
  - Each block is independent (doesn't affect other blocks)
1770
1824
  - Cannot use for appending or inserting without SEARCH context`,
1771
- parameters: z15.object({
1772
- path: z15.string().describe("The path of the file to modify").meta({ usageValue: "File path here" }),
1773
- diff: z15.string().describe(
1825
+ parameters: z16.object({
1826
+ path: z16.string().describe("The path of the file to modify").meta({ usageValue: "File path here" }),
1827
+ diff: z16.string().describe(
1774
1828
  `One or more SEARCH/REPLACE blocks following this exact format:
1775
1829
  \`\`\`
1776
1830
  <<<<<<< SEARCH
@@ -1956,12 +2010,12 @@ var replaceInFile_default = {
1956
2010
  };
1957
2011
 
1958
2012
  // src/tools/search.ts
1959
- import { z as z16 } from "zod";
2013
+ import { z as z17 } from "zod";
1960
2014
  var toolInfo10 = {
1961
2015
  name: "search",
1962
2016
  description: "Search the web for information using Google Search. Use this tool to find current information, facts, news, documentation, or research that is not available in your training data. Returns comprehensive search results with relevant content extracted from the web.",
1963
- parameters: z16.object({
1964
- query: z16.string().describe("The query to search for").meta({ usageValue: "Your search query here" })
2017
+ parameters: z17.object({
2018
+ query: z17.string().describe("The query to search for").meta({ usageValue: "Your search query here" })
1965
2019
  }).meta({
1966
2020
  examples: [
1967
2021
  {
@@ -2011,18 +2065,18 @@ var search_default = {
2011
2065
  };
2012
2066
 
2013
2067
  // src/tools/searchFiles.ts
2014
- import { z as z17 } from "zod";
2068
+ import { z as z18 } from "zod";
2015
2069
  var toolInfo11 = {
2016
2070
  name: "searchFiles",
2017
2071
  description: "Request to perform a regex search across files in a specified directory, outputting context-rich results that include surrounding lines. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.",
2018
- parameters: z17.object({
2019
- path: z17.string().describe(
2072
+ parameters: z18.object({
2073
+ path: z18.string().describe(
2020
2074
  "The path of the directory to search in (relative to the current working directory). This directory will be recursively searched."
2021
2075
  ).meta({ usageValue: "Directory path here" }),
2022
- regex: z17.string().describe("The regular expression pattern to search for. Uses Rust regex syntax.").meta({
2076
+ regex: z18.string().describe("The regular expression pattern to search for. Uses Rust regex syntax.").meta({
2023
2077
  usageValue: "Your regex pattern here"
2024
2078
  }),
2025
- filePattern: z17.string().optional().describe(
2079
+ filePattern: z18.string().optional().describe(
2026
2080
  'Comma-separated glob pattern to filter files (e.g., "*.ts" for TypeScript files or "*.ts,*.js" for both TypeScript and JavaScript files). If not provided, it will search all files (*).'
2027
2081
  ).meta({
2028
2082
  usageValue: "file pattern here (optional)"
@@ -2092,20 +2146,20 @@ var searchFiles_default = {
2092
2146
  };
2093
2147
 
2094
2148
  // src/tools/todo.ts
2095
- import { z as z18 } from "zod";
2096
- var TodoStatus = z18.enum(["open", "completed", "closed"]);
2097
- var TodoItemSchema = z18.object({
2098
- id: z18.string(),
2099
- title: z18.string(),
2100
- description: z18.string(),
2149
+ import { z as z19 } from "zod";
2150
+ var TodoStatus = z19.enum(["open", "completed", "closed"]);
2151
+ var TodoItemSchema = z19.object({
2152
+ id: z19.string(),
2153
+ title: z19.string(),
2154
+ description: z19.string(),
2101
2155
  status: TodoStatus
2102
2156
  });
2103
- var UpdateTodoItemInputSchema = z18.object({
2104
- operation: z18.enum(["add", "update"]),
2105
- id: z18.string().nullish(),
2106
- parentId: z18.string().nullish(),
2107
- title: z18.string().nullish(),
2108
- description: z18.string().nullish(),
2157
+ var UpdateTodoItemInputSchema = z19.object({
2158
+ operation: z19.enum(["add", "update"]),
2159
+ id: z19.string().nullish(),
2160
+ parentId: z19.string().nullish(),
2161
+ title: z19.string().nullish(),
2162
+ description: z19.string().nullish(),
2109
2163
  status: TodoStatus.nullish()
2110
2164
  }).superRefine((data, ctx) => {
2111
2165
  if (data.operation === "add") {
@@ -2126,12 +2180,12 @@ var UpdateTodoItemInputSchema = z18.object({
2126
2180
  }
2127
2181
  }
2128
2182
  });
2129
- var UpdateTodoItemOutputSchema = z18.object({
2130
- id: z18.string()
2183
+ var UpdateTodoItemOutputSchema = z19.object({
2184
+ id: z19.string()
2131
2185
  });
2132
2186
 
2133
2187
  // src/tools/writeToFile.ts
2134
- import { z as z19 } from "zod";
2188
+ import { z as z20 } from "zod";
2135
2189
  var toolInfo12 = {
2136
2190
  name: "writeToFile",
2137
2191
  description: `Request to write content to a file at the specified path.
@@ -2155,9 +2209,9 @@ IMPORTANT CONSTRAINT:
2155
2209
  - Always provide COMPLETE intended content (no omissions)
2156
2210
  - Ensure no incorrect escape sequences (&lt;, &gt;, &amp;)
2157
2211
  - Ensure no unwanted CDATA tags in content`,
2158
- parameters: z19.object({
2159
- path: z19.string().describe("The path of the file to write to").meta({ usageValue: "File path here" }),
2160
- content: z19.string().describe(
2212
+ parameters: z20.object({
2213
+ path: z20.string().describe("The path of the file to write to").meta({ usageValue: "File path here" }),
2214
+ content: z20.string().describe(
2161
2215
  "The content to write to the file. ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions. You MUST include ALL parts of the file, even if they haven't been modified."
2162
2216
  ).meta({ usageValue: "Your file content here" })
2163
2217
  }).meta({
@@ -2360,9 +2414,22 @@ var UsageMeter = class {
2360
2414
  }
2361
2415
  };
2362
2416
 
2417
+ // src/utils/merge.ts
2418
+ function deepMerge(base, override, deepPaths) {
2419
+ const result = { ...base, ...override };
2420
+ for (const path of deepPaths) {
2421
+ const baseValue = base[path];
2422
+ const overrideValue = override[path];
2423
+ if (typeof baseValue === "object" && baseValue !== null && !Array.isArray(baseValue) && typeof overrideValue === "object" && overrideValue !== null && !Array.isArray(overrideValue)) {
2424
+ result[path] = { ...baseValue, ...overrideValue };
2425
+ }
2426
+ }
2427
+ return result;
2428
+ }
2429
+
2363
2430
  // src/workflow/agent.workflow.ts
2364
2431
  import { jsonSchema } from "ai";
2365
- import { toJSONSchema, z as z20 } from "zod";
2432
+ import { toJSONSchema, z as z21 } from "zod";
2366
2433
 
2367
2434
  // src/workflow/types.ts
2368
2435
  var TaskEventKind = /* @__PURE__ */ ((TaskEventKind2) => {
@@ -2446,7 +2513,7 @@ var agentWorkflow = async (input, { step, tools, logger }) => {
2446
2513
  }
2447
2514
  const validated = input.outputSchema.safeParse(parsed.data);
2448
2515
  if (!validated.success) {
2449
- const errorMessage = `Output validation failed. Error: ${z20.prettifyError(validated.error)}. Please correct the output.`;
2516
+ const errorMessage = `Output validation failed. Error: ${z21.prettifyError(validated.error)}. Please correct the output.`;
2450
2517
  nextMessage = [{ role: "user", content: errorMessage }];
2451
2518
  continue;
2452
2519
  }
@@ -2528,63 +2595,63 @@ var agentWorkflow = async (input, { step, tools, logger }) => {
2528
2595
 
2529
2596
  // src/workflow/dynamic.ts
2530
2597
  import { parse as parse2 } from "yaml";
2531
- import { z as z22 } from "zod";
2598
+ import { z as z23 } from "zod";
2532
2599
 
2533
2600
  // src/workflow/dynamic-types.ts
2534
- import { z as z21 } from "zod";
2535
- var WorkflowInputDefinitionSchema = z21.object({
2536
- id: z21.string(),
2537
- description: z21.string().nullish(),
2538
- default: z21.any().nullish()
2601
+ import { z as z22 } from "zod";
2602
+ var WorkflowInputDefinitionSchema = z22.object({
2603
+ id: z22.string(),
2604
+ description: z22.string().nullish(),
2605
+ default: z22.unknown().nullish()
2539
2606
  });
2540
- var WorkflowStepDefinitionSchema = z21.object({
2541
- id: z21.string(),
2542
- tools: z21.array(z21.string()).nullish(),
2543
- task: z21.string(),
2544
- output: z21.string().nullish(),
2545
- expected_outcome: z21.string().nullish(),
2607
+ var WorkflowStepDefinitionSchema = z22.object({
2608
+ id: z22.string(),
2609
+ tools: z22.array(z22.string()).nullish(),
2610
+ task: z22.string(),
2611
+ output: z22.string().nullish(),
2612
+ expected_outcome: z22.string().nullish(),
2546
2613
  /**
2547
2614
  * Optional JSON schema or other metadata for future structured outputs.
2548
2615
  * Not interpreted by core today.
2549
2616
  */
2550
- outputSchema: z21.any().nullish(),
2617
+ outputSchema: z22.unknown().nullish(),
2551
2618
  /**
2552
2619
  * Optional timeout in milliseconds. Step execution will be aborted if it exceeds this duration.
2553
2620
  */
2554
- timeout: z21.number().positive().nullish()
2621
+ timeout: z22.number().positive().nullish()
2555
2622
  });
2556
- var WhileLoopStepSchema = z21.object({
2557
- id: z21.string(),
2558
- while: z21.object({
2559
- condition: z21.string().describe("JavaScript expression that evaluates to true/false"),
2560
- steps: z21.array(z21.lazy(() => WorkflowControlFlowStepSchema))
2623
+ var WhileLoopStepSchema = z22.object({
2624
+ id: z22.string(),
2625
+ while: z22.object({
2626
+ condition: z22.string().describe("JavaScript expression that evaluates to true/false"),
2627
+ steps: z22.array(z22.lazy(() => WorkflowControlFlowStepSchema))
2561
2628
  }),
2562
- output: z21.string().nullish()
2629
+ output: z22.string().nullish()
2563
2630
  });
2564
- var IfElseStepSchema = z21.object({
2565
- id: z21.string(),
2566
- if: z21.object({
2567
- condition: z21.string().describe("JavaScript expression that evaluates to true/false"),
2568
- thenBranch: z21.array(z21.lazy(() => WorkflowControlFlowStepSchema)),
2569
- elseBranch: z21.array(z21.lazy(() => WorkflowControlFlowStepSchema)).optional()
2631
+ var IfElseStepSchema = z22.object({
2632
+ id: z22.string(),
2633
+ if: z22.object({
2634
+ condition: z22.string().describe("JavaScript expression that evaluates to true/false"),
2635
+ thenBranch: z22.array(z22.lazy(() => WorkflowControlFlowStepSchema)),
2636
+ elseBranch: z22.array(z22.lazy(() => WorkflowControlFlowStepSchema)).optional()
2570
2637
  }),
2571
- output: z21.string().nullish()
2638
+ output: z22.string().nullish()
2572
2639
  });
2573
- var BreakStepSchema = z21.object({
2574
- break: z21.literal(true)
2640
+ var BreakStepSchema = z22.object({
2641
+ break: z22.literal(true)
2575
2642
  });
2576
- var ContinueStepSchema = z21.object({
2577
- continue: z21.literal(true)
2643
+ var ContinueStepSchema = z22.object({
2644
+ continue: z22.literal(true)
2578
2645
  });
2579
- var TryCatchStepSchema = z21.object({
2580
- id: z21.string(),
2581
- try: z21.object({
2582
- trySteps: z21.array(z21.lazy(() => WorkflowControlFlowStepSchema)),
2583
- catchSteps: z21.array(z21.lazy(() => WorkflowControlFlowStepSchema))
2646
+ var TryCatchStepSchema = z22.object({
2647
+ id: z22.string(),
2648
+ try: z22.object({
2649
+ trySteps: z22.array(z22.lazy(() => WorkflowControlFlowStepSchema)),
2650
+ catchSteps: z22.array(z22.lazy(() => WorkflowControlFlowStepSchema))
2584
2651
  }),
2585
- output: z21.string().nullish()
2652
+ output: z22.string().nullish()
2586
2653
  });
2587
- var WorkflowControlFlowStepSchema = z21.union([
2654
+ var WorkflowControlFlowStepSchema = z22.union([
2588
2655
  WorkflowStepDefinitionSchema,
2589
2656
  WhileLoopStepSchema,
2590
2657
  IfElseStepSchema,
@@ -2592,14 +2659,14 @@ var WorkflowControlFlowStepSchema = z21.union([
2592
2659
  ContinueStepSchema,
2593
2660
  TryCatchStepSchema
2594
2661
  ]);
2595
- var WorkflowDefinitionSchema = z21.object({
2596
- task: z21.string(),
2597
- inputs: z21.array(WorkflowInputDefinitionSchema).nullish(),
2598
- steps: z21.array(WorkflowControlFlowStepSchema),
2599
- output: z21.string().nullish()
2662
+ var WorkflowDefinitionSchema = z22.object({
2663
+ task: z22.string(),
2664
+ inputs: z22.array(WorkflowInputDefinitionSchema).nullish(),
2665
+ steps: z22.array(WorkflowControlFlowStepSchema),
2666
+ output: z22.string().nullish()
2600
2667
  });
2601
- var WorkflowFileSchema = z21.object({
2602
- workflows: z21.record(z21.string(), WorkflowDefinitionSchema)
2668
+ var WorkflowFileSchema = z22.object({
2669
+ workflows: z22.record(z22.string(), WorkflowDefinitionSchema)
2603
2670
  });
2604
2671
 
2605
2672
  // src/workflow/dynamic.ts
@@ -2608,26 +2675,26 @@ function convertJsonSchemaToZod(schema) {
2608
2675
  if (schema.enum) {
2609
2676
  const enumValues = schema.enum;
2610
2677
  if (enumValues.length === 0) {
2611
- return z22.never();
2678
+ return z23.never();
2612
2679
  }
2613
2680
  if (enumValues.every((v) => typeof v === "string")) {
2614
- return z22.enum(enumValues);
2681
+ return z23.enum(enumValues);
2615
2682
  }
2616
- const literals = enumValues.map((v) => z22.literal(v));
2683
+ const literals = enumValues.map((v) => z23.literal(v));
2617
2684
  if (literals.length === 1) {
2618
2685
  return literals[0];
2619
2686
  }
2620
- return z22.union([literals[0], literals[1], ...literals.slice(2)]);
2687
+ return z23.union([literals[0], literals[1], ...literals.slice(2)]);
2621
2688
  }
2622
2689
  if (Array.isArray(schema.type)) {
2623
2690
  const types = schema.type;
2624
2691
  if (types.includes("null") && types.length === 2) {
2625
2692
  const nonNullType = types.find((t) => t !== "null");
2626
- if (nonNullType === "string") return z22.string().nullable();
2627
- if (nonNullType === "number") return z22.number().nullable();
2693
+ if (nonNullType === "string") return z23.string().nullable();
2694
+ if (nonNullType === "number") return z23.number().nullable();
2628
2695
  if (nonNullType === "integer")
2629
- return z22.number().refine((val) => Number.isInteger(val)).nullable();
2630
- if (nonNullType === "boolean") return z22.boolean().nullable();
2696
+ return z23.number().refine((val) => Number.isInteger(val)).nullable();
2697
+ if (nonNullType === "boolean") return z23.boolean().nullable();
2631
2698
  if (nonNullType === "object") {
2632
2699
  const shape = {};
2633
2700
  if (schema.properties) {
@@ -2637,24 +2704,24 @@ function convertJsonSchemaToZod(schema) {
2637
2704
  shape[propName] = isRequired ? propZod : propZod.optional();
2638
2705
  }
2639
2706
  }
2640
- return z22.object(shape).nullable();
2707
+ return z23.object(shape).nullable();
2641
2708
  }
2642
- if (nonNullType === "array") return z22.array(z22.any()).nullable();
2709
+ if (nonNullType === "array") return z23.array(z23.any()).nullable();
2643
2710
  }
2644
- return z22.any();
2711
+ return z23.any();
2645
2712
  }
2646
2713
  const type = schema.type;
2647
2714
  switch (type) {
2648
2715
  case "string":
2649
- return z22.string();
2716
+ return z23.string();
2650
2717
  case "number":
2651
- return z22.number();
2718
+ return z23.number();
2652
2719
  case "integer":
2653
- return z22.number().refine((val) => Number.isInteger(val), { message: "Expected an integer" });
2720
+ return z23.number().refine((val) => Number.isInteger(val), { message: "Expected an integer" });
2654
2721
  case "boolean":
2655
- return z22.boolean();
2722
+ return z23.boolean();
2656
2723
  case "null":
2657
- return z22.null();
2724
+ return z23.null();
2658
2725
  case "object": {
2659
2726
  const shape = {};
2660
2727
  if (schema.properties) {
@@ -2665,23 +2732,23 @@ function convertJsonSchemaToZod(schema) {
2665
2732
  }
2666
2733
  }
2667
2734
  if (schema.additionalProperties === true) {
2668
- return z22.object(shape).passthrough();
2735
+ return z23.object(shape).passthrough();
2669
2736
  }
2670
2737
  if (typeof schema.additionalProperties === "object") {
2671
2738
  const additionalSchema = convertJsonSchemaToZod(schema.additionalProperties);
2672
- return z22.intersection(z22.object(shape), z22.record(z22.string(), additionalSchema));
2739
+ return z23.intersection(z23.object(shape), z23.record(z23.string(), additionalSchema));
2673
2740
  }
2674
- return z22.object(shape);
2741
+ return z23.object(shape);
2675
2742
  }
2676
2743
  case "array": {
2677
2744
  if (!schema.items) {
2678
- return z22.array(z22.any());
2745
+ return z23.array(z23.any());
2679
2746
  }
2680
2747
  const itemSchema = convertJsonSchemaToZod(schema.items);
2681
- return z22.array(itemSchema);
2748
+ return z23.array(itemSchema);
2682
2749
  }
2683
2750
  default:
2684
- return z22.any();
2751
+ return z23.any();
2685
2752
  }
2686
2753
  }
2687
2754
  var TOOL_GROUPS = {
@@ -2752,7 +2819,7 @@ function parseDynamicWorkflowDefinition(source) {
2752
2819
  const raw = parse2(source);
2753
2820
  const validated = WorkflowFileSchema.safeParse(raw);
2754
2821
  if (!validated.success) {
2755
- return { success: false, error: z22.prettifyError(validated.error) };
2822
+ return { success: false, error: z23.prettifyError(validated.error) };
2756
2823
  }
2757
2824
  const validation = validateWorkflowFile(validated.data);
2758
2825
  if (!validation.success) {
@@ -3045,9 +3112,9 @@ async function executeStepWithAgent(stepDef, workflowId, input, state, context,
3045
3112
  toolsForAgent.push({
3046
3113
  name: "runWorkflow",
3047
3114
  description: "Run a named sub-workflow defined in the current workflow file.",
3048
- parameters: z22.object({
3049
- workflowId: z22.string().describe("Sub-workflow id to run"),
3050
- input: z22.any().nullish().describe("Optional input object for the sub-workflow")
3115
+ parameters: z23.object({
3116
+ workflowId: z23.string().describe("Sub-workflow id to run"),
3117
+ input: z23.any().nullish().describe("Optional input object for the sub-workflow")
3051
3118
  }),
3052
3119
  handler: async () => {
3053
3120
  return { success: false, message: { type: "error-text", value: "runWorkflow is virtual." } };
@@ -3647,6 +3714,7 @@ var makeStepFn = () => {
3647
3714
  };
3648
3715
  };
3649
3716
  export {
3717
+ BaseError,
3650
3718
  BreakStepSchema,
3651
3719
  ContinueStepSchema,
3652
3720
  DEFAULT_MEMORY_CONFIG,
@@ -3683,15 +3751,19 @@ export {
3683
3751
  WorkflowStepDefinitionSchema,
3684
3752
  agentWorkflow,
3685
3753
  askFollowupQuestion_default as askFollowupQuestion,
3754
+ baseApprovalConfigSchema,
3755
+ baseModelConfigSchema,
3686
3756
  computeRateLimitBackoffSeconds,
3687
3757
  configSchema,
3688
3758
  convertJsonSchemaToZod,
3689
3759
  createContext,
3690
3760
  createDynamicWorkflow,
3761
+ createErrorClass,
3691
3762
  createErrorResponse,
3692
3763
  createProviderErrorResponse,
3693
3764
  createSuccessResponse,
3694
3765
  createValidationErrorResponse,
3766
+ deepMerge,
3695
3767
  executeCommand_default as executeCommand,
3696
3768
  fetchUrl_default as fetchUrl,
3697
3769
  fromJsonModelMessage,
@@ -3704,6 +3776,7 @@ export {
3704
3776
  makeStepFn,
3705
3777
  mcpServerConfigSchema,
3706
3778
  memoryConfigSchema,
3779
+ modelConfigSchema,
3707
3780
  parseDynamicWorkflowDefinition,
3708
3781
  parseJsonFromMarkdown,
3709
3782
  providerConfigSchema,
@@ -3724,6 +3797,7 @@ export {
3724
3797
  searchFiles_default as searchFiles,
3725
3798
  skillMetadataSchema,
3726
3799
  toJsonModelMessage,
3800
+ toolConfigSchema,
3727
3801
  validateSkillMetadata,
3728
3802
  validateSkillReferences,
3729
3803
  validateSkillSecurity,