zeitlich 0.2.0 → 0.2.2

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/workflow.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var workflow = require('@temporalio/workflow');
4
- var z4 = require('zod');
4
+ var z5 = require('zod');
5
5
 
6
6
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
7
 
8
- var z4__default = /*#__PURE__*/_interopDefault(z4);
8
+ var z5__default = /*#__PURE__*/_interopDefault(z5);
9
9
 
10
10
  // src/lib/session.ts
11
11
  var TASK_TOOL = "Task";
@@ -40,10 +40,10 @@ function createTaskTool(subagents) {
40
40
  return {
41
41
  name: TASK_TOOL,
42
42
  description: buildTaskDescription(subagents),
43
- schema: z4__default.default.object({
44
- subagent: z4__default.default.enum(names).describe("The type of subagent to launch"),
45
- description: z4__default.default.string().describe("A short (3-5 word) description of the task"),
46
- prompt: z4__default.default.string().describe("The task for the agent to perform")
43
+ schema: z5__default.default.object({
44
+ subagent: z5__default.default.enum(names).describe("The type of subagent to launch"),
45
+ description: z5__default.default.string().describe("A short (3-5 word) description of the task"),
46
+ prompt: z5__default.default.string().describe("The task for the agent to perform")
47
47
  })
48
48
  };
49
49
  }
@@ -57,16 +57,21 @@ function createTaskHandler(subagents) {
57
57
  );
58
58
  }
59
59
  const childWorkflowId = `${parentWorkflowId}-${args.subagent}-${workflow.uuid4()}`;
60
- const childResult = await workflow.executeChild(config.workflowType, {
60
+ const input = {
61
+ prompt: args.prompt,
62
+ ...config.context && { context: config.context }
63
+ };
64
+ const childOpts = {
61
65
  workflowId: childWorkflowId,
62
- args: [{ prompt: args.prompt }],
66
+ args: [input],
63
67
  taskQueue: config.taskQueue ?? parentTaskQueue
64
- });
68
+ };
69
+ const childResult = typeof config.workflow === "string" ? await workflow.executeChild(config.workflow, childOpts) : await workflow.executeChild(config.workflow, childOpts);
65
70
  const validated = config.resultSchema ? config.resultSchema.parse(childResult) : childResult;
66
- const content = typeof validated === "string" ? validated : JSON.stringify(validated, null, 2);
71
+ const toolResponse = typeof validated === "string" ? validated : JSON.stringify(validated, null, 2);
67
72
  return {
68
- content,
69
- result: {
73
+ toolResponse,
74
+ data: {
70
75
  result: validated,
71
76
  childWorkflowId
72
77
  }
@@ -75,12 +80,28 @@ function createTaskHandler(subagents) {
75
80
  }
76
81
  var createBashToolDescription = ({
77
82
  fileTree
78
- }) => `tool to execute bash commands, the file tree is: ${fileTree}`;
83
+ }) => `Execute shell commands in a bash environment.
84
+
85
+ Use this tool to:
86
+ - Run shell commands (ls, cat, grep, find, etc.)
87
+ - Execute scripts and chain commands with pipes (|) or logical operators (&&, ||)
88
+ - Inspect files and directories
89
+
90
+ Current file tree:
91
+ ${fileTree}`;
79
92
  var bashTool = {
80
93
  name: "Bash",
81
- description: "tool to execute bash commands",
82
- schema: z4__default.default.object({
83
- command: z4__default.default.string().describe("stringified command to be executed inside the Bash")
94
+ description: `Execute shell commands in a sandboxed bash environment.
95
+
96
+ Use this tool to:
97
+ - Run shell commands (ls, cat, grep, find, etc.)
98
+ - Execute scripts and chain commands with pipes (|) or logical operators (&&, ||)
99
+ - Inspect files and directories
100
+ `,
101
+ schema: z5__default.default.object({
102
+ command: z5__default.default.string().describe(
103
+ "The bash command to execute. Can include pipes (|), redirects (>, >>), logical operators (&&, ||), and shell features like command substitution $(...)."
104
+ )
84
105
  }),
85
106
  strict: true
86
107
  };
@@ -125,17 +146,17 @@ var taskCreateTool = {
125
146
  - Include enough detail in the description for another agent to understand and complete the task
126
147
  - After creating tasks, use TaskUpdate to set up dependencies (blocks/blockedBy) if needed
127
148
  - Check TaskList first to avoid creating duplicate tasks`,
128
- schema: z4__default.default.object({
129
- subject: z4__default.default.string().describe(
149
+ schema: z5__default.default.object({
150
+ subject: z5__default.default.string().describe(
130
151
  'A brief, actionable title in imperative form (e.g., "Fix authentication bug in login flow")'
131
152
  ),
132
- description: z4__default.default.string().describe(
153
+ description: z5__default.default.string().describe(
133
154
  "Detailed description of what needs to be done, including context and acceptance criteria"
134
155
  ),
135
- activeForm: z4__default.default.string().describe(
156
+ activeForm: z5__default.default.string().describe(
136
157
  'Present continuous form shown in spinner when task is in_progress (e.g., "Fixing authentication bug"). This is displayed to the user while you work on the task.'
137
158
  ),
138
- metadata: z4__default.default.record(z4__default.default.string(), z4__default.default.string()).describe("Arbitrary key-value pairs for tracking")
159
+ metadata: z5__default.default.record(z5__default.default.string(), z5__default.default.string()).describe("Arbitrary key-value pairs for tracking")
139
160
  })
140
161
  };
141
162
 
@@ -159,9 +180,30 @@ function createToolRouter(options) {
159
180
  toolMap.set(tool.name, tool);
160
181
  }
161
182
  if (options.subagents) {
183
+ const subagentHooksMap = /* @__PURE__ */ new Map();
184
+ for (const s of options.subagents) {
185
+ if (s.hooks) subagentHooksMap.set(s.name, s.hooks);
186
+ }
187
+ const resolveSubagentName = (args) => args.subagent;
162
188
  toolMap.set("Task", {
163
189
  ...createTaskTool(options.subagents),
164
- handler: createTaskHandler(options.subagents)
190
+ handler: createTaskHandler(options.subagents),
191
+ ...subagentHooksMap.size > 0 && {
192
+ hooks: {
193
+ onPreToolUse: async (ctx) => {
194
+ const hooks = subagentHooksMap.get(resolveSubagentName(ctx.args));
195
+ return hooks?.onPreExecution?.(ctx) ?? {};
196
+ },
197
+ onPostToolUse: async (ctx) => {
198
+ const hooks = subagentHooksMap.get(resolveSubagentName(ctx.args));
199
+ await hooks?.onPostExecution?.(ctx);
200
+ },
201
+ onPostToolUseFailure: async (ctx) => {
202
+ const hooks = subagentHooksMap.get(resolveSubagentName(ctx.args));
203
+ return hooks?.onExecutionFailure?.(ctx) ?? {};
204
+ }
205
+ }
206
+ }
165
207
  });
166
208
  }
167
209
  if (options.buildInTools) {
@@ -184,6 +226,8 @@ function createToolRouter(options) {
184
226
  }
185
227
  async function processToolCall(toolCall, turn, handlerContext) {
186
228
  const startTime = Date.now();
229
+ const tool = toolMap.get(toolCall.name);
230
+ const toolHooks = tool?.hooks;
187
231
  let effectiveArgs = toolCall.args;
188
232
  if (options.hooks?.onPreToolUse) {
189
233
  const preResult = await options.hooks.onPreToolUse({
@@ -206,7 +250,27 @@ function createToolRouter(options) {
206
250
  effectiveArgs = preResult.modifiedArgs;
207
251
  }
208
252
  }
209
- const tool = toolMap.get(toolCall.name);
253
+ if (toolHooks?.onPreToolUse) {
254
+ const preResult = await toolHooks.onPreToolUse({
255
+ args: effectiveArgs,
256
+ threadId: options.threadId,
257
+ turn
258
+ });
259
+ if (preResult?.skip) {
260
+ await appendToolResult({
261
+ threadId: options.threadId,
262
+ toolCallId: toolCall.id,
263
+ content: JSON.stringify({
264
+ skipped: true,
265
+ reason: "Skipped by tool PreToolUse hook"
266
+ })
267
+ });
268
+ return null;
269
+ }
270
+ if (preResult?.modifiedArgs !== void 0) {
271
+ effectiveArgs = preResult.modifiedArgs;
272
+ }
273
+ }
210
274
  let result;
211
275
  let content;
212
276
  try {
@@ -215,30 +279,50 @@ function createToolRouter(options) {
215
279
  effectiveArgs,
216
280
  handlerContext ?? {}
217
281
  );
218
- result = response.result;
219
- content = response.content;
282
+ result = response.data;
283
+ content = response.toolResponse;
220
284
  } else {
221
285
  result = { error: `Unknown tool: ${toolCall.name}` };
222
286
  content = JSON.stringify(result, null, 2);
223
287
  }
224
288
  } catch (error) {
225
- if (options.hooks?.onPostToolUseFailure) {
289
+ const err = error instanceof Error ? error : new Error(String(error));
290
+ let recovered = false;
291
+ if (toolHooks?.onPostToolUseFailure) {
292
+ const failureResult = await toolHooks.onPostToolUseFailure({
293
+ args: effectiveArgs,
294
+ error: err,
295
+ threadId: options.threadId,
296
+ turn
297
+ });
298
+ if (failureResult?.fallbackContent !== void 0) {
299
+ content = failureResult.fallbackContent;
300
+ result = { error: String(error), recovered: true };
301
+ recovered = true;
302
+ } else if (failureResult?.suppress) {
303
+ content = JSON.stringify({ error: String(error), suppressed: true });
304
+ result = { error: String(error), suppressed: true };
305
+ recovered = true;
306
+ }
307
+ }
308
+ if (!recovered && options.hooks?.onPostToolUseFailure) {
226
309
  const failureResult = await options.hooks.onPostToolUseFailure({
227
310
  toolCall,
228
- error: error instanceof Error ? error : new Error(String(error)),
311
+ error: err,
229
312
  threadId: options.threadId,
230
313
  turn
231
314
  });
232
315
  if (failureResult?.fallbackContent !== void 0) {
233
316
  content = failureResult.fallbackContent;
234
317
  result = { error: String(error), recovered: true };
318
+ recovered = true;
235
319
  } else if (failureResult?.suppress) {
236
320
  content = JSON.stringify({ error: String(error), suppressed: true });
237
321
  result = { error: String(error), suppressed: true };
238
- } else {
239
- throw error;
322
+ recovered = true;
240
323
  }
241
- } else {
324
+ }
325
+ if (!recovered) {
242
326
  throw error;
243
327
  }
244
328
  }
@@ -250,10 +334,19 @@ function createToolRouter(options) {
250
334
  const toolResult = {
251
335
  toolCallId: toolCall.id,
252
336
  name: toolCall.name,
253
- result
337
+ data: result
254
338
  };
339
+ const durationMs = Date.now() - startTime;
340
+ if (toolHooks?.onPostToolUse) {
341
+ await toolHooks.onPostToolUse({
342
+ args: effectiveArgs,
343
+ result,
344
+ threadId: options.threadId,
345
+ turn,
346
+ durationMs
347
+ });
348
+ }
255
349
  if (options.hooks?.onPostToolUse) {
256
- const durationMs = Date.now() - startTime;
257
350
  await options.hooks.onPostToolUse({
258
351
  toolCall,
259
352
  result: toolResult,
@@ -334,12 +427,12 @@ function createToolRouter(options) {
334
427
  await appendToolResult({
335
428
  threadId: options.threadId,
336
429
  toolCallId: toolCall.id,
337
- content: response.content
430
+ content: response.toolResponse
338
431
  });
339
432
  return {
340
433
  toolCallId: toolCall.id,
341
434
  name: toolCall.name,
342
- result: response.result
435
+ data: response.data ?? null
343
436
  };
344
437
  };
345
438
  if (options.parallel) {
@@ -365,6 +458,12 @@ function createToolRouter(options) {
365
458
  }
366
459
  };
367
460
  }
461
+ function defineTool(tool) {
462
+ return tool;
463
+ }
464
+ function defineSubagent(config) {
465
+ return config;
466
+ }
368
467
  function hasNoOtherToolCalls(toolCalls, excludeName) {
369
468
  return toolCalls.filter((tc) => tc.name !== excludeName).length === 0;
370
469
  }
@@ -469,17 +568,47 @@ var createSession = async ({
469
568
  return message;
470
569
  }
471
570
  const rawToolCalls = await parseToolCalls(message);
472
- const parsedToolCalls = rawToolCalls.filter((tc) => tc.name !== "Task").map((tc) => toolRouter.parseToolCall(tc));
473
- const taskToolCalls = subagents && subagents.length > 0 ? rawToolCalls.filter((tc) => tc.name === "Task").map((tc) => {
474
- const parsedArgs = createTaskTool(subagents).schema.parse(
475
- tc.args
476
- );
477
- return {
478
- id: tc.id ?? "",
479
- name: tc.name,
480
- args: parsedArgs
481
- };
482
- }) : [];
571
+ const parsedToolCalls = [];
572
+ for (const tc of rawToolCalls.filter(
573
+ (tc2) => tc2.name !== "Task"
574
+ )) {
575
+ try {
576
+ parsedToolCalls.push(toolRouter.parseToolCall(tc));
577
+ } catch (error) {
578
+ await appendToolResult({
579
+ threadId,
580
+ toolCallId: tc.id ?? "",
581
+ content: JSON.stringify({
582
+ error: `Invalid tool call for "${tc.name}": ${error instanceof Error ? error.message : String(error)}`
583
+ })
584
+ });
585
+ }
586
+ }
587
+ const taskToolCalls = [];
588
+ if (subagents && subagents.length > 0) {
589
+ for (const tc of rawToolCalls.filter(
590
+ (tc2) => tc2.name === "Task"
591
+ )) {
592
+ try {
593
+ const parsedArgs = createTaskTool(subagents).schema.parse(
594
+ tc.args
595
+ );
596
+ taskToolCalls.push({
597
+ id: tc.id ?? "",
598
+ name: tc.name,
599
+ args: parsedArgs
600
+ });
601
+ } catch (error) {
602
+ await appendToolResult({
603
+ threadId,
604
+ toolCallId: tc.id ?? "",
605
+ content: JSON.stringify({
606
+ error: `Invalid tool call for "Task": ${error instanceof Error ? error.message : String(error)}`
607
+ })
608
+ });
609
+ }
610
+ }
611
+ }
483
612
  await toolRouter.processToolCalls(
484
613
  [...parsedToolCalls, ...taskToolCalls],
485
614
  {
@@ -509,8 +638,6 @@ var createSession = async ({
509
638
  function isTerminalStatus(status) {
510
639
  return status === "COMPLETED" || status === "FAILED" || status === "CANCELLED";
511
640
  }
512
-
513
- // src/lib/state-manager.ts
514
641
  var getStateQuery = workflow.defineQuery("getState");
515
642
  function createAgentStateManager(initialState) {
516
643
  let status = initialState?.status ?? "RUNNING";
@@ -605,7 +732,13 @@ function createAgentStateManager(initialState) {
605
732
  version++;
606
733
  },
607
734
  setTools(newTools) {
608
- tools = newTools;
735
+ tools = newTools.map((tool) => ({
736
+ name: tool.name,
737
+ description: tool.description,
738
+ schema: z5.z.toJSONSchema(tool.schema),
739
+ strict: tool.strict,
740
+ max_uses: tool.max_uses
741
+ }));
609
742
  },
610
743
  deleteTask(id) {
611
744
  const deleted = tasks.delete(id);
@@ -636,18 +769,18 @@ Usage notes:
636
769
  * Use multiSelect: true to allow multiple answers to be selected for a question
637
770
  * If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
638
771
  `,
639
- schema: z4__default.default.object({
640
- questions: z4__default.default.array(
641
- z4__default.default.object({
642
- question: z4__default.default.string().describe("The full question text to display"),
643
- header: z4__default.default.string().describe("Short label for the question (max 12 characters)"),
644
- options: z4__default.default.array(
645
- z4__default.default.object({
646
- label: z4__default.default.string(),
647
- description: z4__default.default.string()
772
+ schema: z5__default.default.object({
773
+ questions: z5__default.default.array(
774
+ z5__default.default.object({
775
+ question: z5__default.default.string().describe("The full question text to display"),
776
+ header: z5__default.default.string().describe("Short label for the question (max 12 characters)"),
777
+ options: z5__default.default.array(
778
+ z5__default.default.object({
779
+ label: z5__default.default.string(),
780
+ description: z5__default.default.string()
648
781
  })
649
782
  ).min(0).max(4).describe("Array of 0-4 choices, each with label and description"),
650
- multiSelect: z4__default.default.boolean().describe("If true, users can select multiple options")
783
+ multiSelect: z5__default.default.boolean().describe("If true, users can select multiple options")
651
784
  })
652
785
  )
653
786
  }),
@@ -667,9 +800,9 @@ Examples:
667
800
  - "**/*.test.ts" - Find all test files recursively
668
801
  - "src/**/*.ts" - Find all TypeScript files in src directory
669
802
  `,
670
- schema: z4.z.object({
671
- pattern: z4.z.string().describe("Glob pattern to match files against"),
672
- root: z4.z.string().optional().describe("Optional root directory to search from")
803
+ schema: z5.z.object({
804
+ pattern: z5.z.string().describe("Glob pattern to match files against"),
805
+ root: z5.z.string().optional().describe("Optional root directory to search from")
673
806
  }),
674
807
  strict: true
675
808
  };
@@ -687,13 +820,13 @@ Examples:
687
820
  - Search for function definitions with "function.*handleClick"
688
821
  - Search case-insensitively with ignoreCase: true
689
822
  `,
690
- schema: z4.z.object({
691
- pattern: z4.z.string().describe("Regex pattern to search for in file contents"),
692
- ignoreCase: z4.z.boolean().optional().describe("Case-insensitive search (default: false)"),
693
- maxMatches: z4.z.number().optional().describe("Maximum number of matches to return (default: 50)"),
694
- includePatterns: z4.z.array(z4.z.string()).optional().describe("Glob patterns to include (e.g., ['*.ts', '*.js'])"),
695
- excludePatterns: z4.z.array(z4.z.string()).optional().describe("Glob patterns to exclude (e.g., ['*.test.ts'])"),
696
- contextLines: z4.z.number().optional().describe("Number of context lines to show around matches")
823
+ schema: z5.z.object({
824
+ pattern: z5.z.string().describe("Regex pattern to search for in file contents"),
825
+ ignoreCase: z5.z.boolean().optional().describe("Case-insensitive search (default: false)"),
826
+ maxMatches: z5.z.number().optional().describe("Maximum number of matches to return (default: 50)"),
827
+ includePatterns: z5.z.array(z5.z.string()).optional().describe("Glob patterns to include (e.g., ['*.ts', '*.js'])"),
828
+ excludePatterns: z5.z.array(z5.z.string()).optional().describe("Glob patterns to exclude (e.g., ['*.test.ts'])"),
829
+ contextLines: z5.z.number().optional().describe("Number of context lines to show around matches")
697
830
  }),
698
831
  strict: true
699
832
  };
@@ -711,12 +844,12 @@ The tool returns the file content in an appropriate format:
711
844
  - Images: Base64-encoded image data
712
845
  - PDFs: Extracted text content
713
846
  `,
714
- schema: z4.z.object({
715
- path: z4.z.string().describe("Virtual path to the file to read"),
716
- offset: z4.z.number().optional().describe(
847
+ schema: z5.z.object({
848
+ path: z5.z.string().describe("Virtual path to the file to read"),
849
+ offset: z5.z.number().optional().describe(
717
850
  "Line number to start reading from (1-indexed, for text files)"
718
851
  ),
719
- limit: z4.z.number().optional().describe("Maximum number of lines to read (for text files)")
852
+ limit: z5.z.number().optional().describe("Maximum number of lines to read (for text files)")
720
853
  }),
721
854
  strict: true
722
855
  };
@@ -734,9 +867,9 @@ IMPORTANT:
734
867
  - This is an atomic write operation - the entire file is replaced
735
868
  - Path must be absolute (e.g., "/docs/readme.md", not "docs/readme.md")
736
869
  `,
737
- schema: z4.z.object({
738
- file_path: z4.z.string().describe("The absolute virtual path to the file to write"),
739
- content: z4.z.string().describe("The content to write to the file")
870
+ schema: z5.z.object({
871
+ file_path: z5.z.string().describe("The absolute virtual path to the file to write"),
872
+ content: z5.z.string().describe("The content to write to the file")
740
873
  }),
741
874
  strict: true
742
875
  };
@@ -756,27 +889,22 @@ IMPORTANT:
756
889
  - The operation fails if old_string is not found
757
890
  - old_string and new_string must be different
758
891
  `,
759
- schema: z4.z.object({
760
- file_path: z4.z.string().describe("The absolute virtual path to the file to modify"),
761
- old_string: z4.z.string().describe("The exact text to replace"),
762
- new_string: z4.z.string().describe(
892
+ schema: z5.z.object({
893
+ file_path: z5.z.string().describe("The absolute virtual path to the file to modify"),
894
+ old_string: z5.z.string().describe("The exact text to replace"),
895
+ new_string: z5.z.string().describe(
763
896
  "The text to replace it with (must be different from old_string)"
764
897
  ),
765
- replace_all: z4.z.boolean().optional().describe(
898
+ replace_all: z5.z.boolean().optional().describe(
766
899
  "If true, replace all occurrences of old_string (default: false)"
767
900
  )
768
901
  }),
769
902
  strict: true
770
903
  };
771
-
772
- // src/tools/task-create/handler.ts
773
- function createTaskCreateHandler({
774
- stateManager,
775
- idGenerator
776
- }) {
904
+ function createTaskCreateHandler(stateManager) {
777
905
  return (args) => {
778
906
  const task = {
779
- id: idGenerator(),
907
+ id: workflow.uuid4(),
780
908
  subject: args.subject,
781
909
  description: args.description,
782
910
  activeForm: args.activeForm,
@@ -787,16 +915,16 @@ function createTaskCreateHandler({
787
915
  };
788
916
  stateManager.setTask(task);
789
917
  return {
790
- content: JSON.stringify(task, null, 2),
791
- result: task
918
+ toolResponse: JSON.stringify(task, null, 2),
919
+ data: task
792
920
  };
793
921
  };
794
922
  }
795
923
  var taskGetTool = {
796
924
  name: "TaskGet",
797
925
  description: `Retrieve full task details including dependencies.`,
798
- schema: z4__default.default.object({
799
- taskId: z4__default.default.string().describe("The ID of the task to get")
926
+ schema: z5__default.default.object({
927
+ taskId: z5__default.default.string().describe("The ID of the task to get")
800
928
  })
801
929
  };
802
930
 
@@ -806,20 +934,20 @@ function createTaskGetHandler(stateManager) {
806
934
  const task = stateManager.getTask(args.taskId) ?? null;
807
935
  if (!task) {
808
936
  return {
809
- content: JSON.stringify({ error: `Task not found: ${args.taskId}` }),
810
- result: null
937
+ toolResponse: JSON.stringify({ error: `Task not found: ${args.taskId}` }),
938
+ data: null
811
939
  };
812
940
  }
813
941
  return {
814
- content: JSON.stringify(task, null, 2),
815
- result: task
942
+ toolResponse: JSON.stringify(task, null, 2),
943
+ data: task
816
944
  };
817
945
  };
818
946
  }
819
947
  var taskListTool = {
820
948
  name: "TaskList",
821
949
  description: `List all tasks with current state.`,
822
- schema: z4__default.default.object({})
950
+ schema: z5__default.default.object({})
823
951
  };
824
952
 
825
953
  // src/tools/task-list/handler.ts
@@ -827,19 +955,19 @@ function createTaskListHandler(stateManager) {
827
955
  return (_args) => {
828
956
  const taskList = stateManager.getTasks();
829
957
  return {
830
- content: JSON.stringify(taskList, null, 2),
831
- result: taskList
958
+ toolResponse: JSON.stringify(taskList, null, 2),
959
+ data: taskList
832
960
  };
833
961
  };
834
962
  }
835
963
  var taskUpdateTool = {
836
964
  name: "TaskUpdate",
837
965
  description: `Update status, add blockers, modify details.`,
838
- schema: z4__default.default.object({
839
- taskId: z4__default.default.string().describe("The ID of the task to get"),
840
- status: z4__default.default.enum(["pending", "in_progress", "completed"]).describe("The status of the task"),
841
- addBlockedBy: z4__default.default.array(z4__default.default.string()).describe("The IDs of the tasks that are blocking this task"),
842
- addBlocks: z4__default.default.array(z4__default.default.string()).describe("The IDs of the tasks that this task is blocking")
966
+ schema: z5__default.default.object({
967
+ taskId: z5__default.default.string().describe("The ID of the task to get"),
968
+ status: z5__default.default.enum(["pending", "in_progress", "completed"]).describe("The status of the task"),
969
+ addBlockedBy: z5__default.default.array(z5__default.default.string()).describe("The IDs of the tasks that are blocking this task"),
970
+ addBlocks: z5__default.default.array(z5__default.default.string()).describe("The IDs of the tasks that this task is blocking")
843
971
  })
844
972
  };
845
973
 
@@ -849,8 +977,8 @@ function createTaskUpdateHandler(stateManager) {
849
977
  const task = stateManager.getTask(args.taskId);
850
978
  if (!task) {
851
979
  return {
852
- content: JSON.stringify({ error: `Task not found: ${args.taskId}` }),
853
- result: null
980
+ toolResponse: JSON.stringify({ error: `Task not found: ${args.taskId}` }),
981
+ data: null
854
982
  };
855
983
  }
856
984
  if (args.status) {
@@ -882,8 +1010,8 @@ function createTaskUpdateHandler(stateManager) {
882
1010
  }
883
1011
  stateManager.setTask(task);
884
1012
  return {
885
- content: JSON.stringify(task, null, 2),
886
- result: task
1013
+ toolResponse: JSON.stringify(task, null, 2),
1014
+ data: task
887
1015
  };
888
1016
  };
889
1017
  }
@@ -899,6 +1027,8 @@ exports.createTaskListHandler = createTaskListHandler;
899
1027
  exports.createTaskTool = createTaskTool;
900
1028
  exports.createTaskUpdateHandler = createTaskUpdateHandler;
901
1029
  exports.createToolRouter = createToolRouter;
1030
+ exports.defineSubagent = defineSubagent;
1031
+ exports.defineTool = defineTool;
902
1032
  exports.editTool = editTool;
903
1033
  exports.globTool = globTool;
904
1034
  exports.grepTool = grepTool;