zeitlich 0.2.8 → 0.2.9

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.
@@ -1074,7 +1074,7 @@ declare const grepTool: {
1074
1074
  };
1075
1075
  type GrepArgs = z$1.infer<typeof grepTool.schema>;
1076
1076
 
1077
- declare const readTool: {
1077
+ declare const readFileTool: {
1078
1078
  name: "FileRead";
1079
1079
  description: string;
1080
1080
  schema: z$1.ZodObject<{
@@ -1084,9 +1084,9 @@ declare const readTool: {
1084
1084
  }, z$1.core.$strip>;
1085
1085
  strict: true;
1086
1086
  };
1087
- type FileReadArgs = z$1.infer<typeof readTool.schema>;
1087
+ type FileReadArgs = z$1.infer<typeof readFileTool.schema>;
1088
1088
 
1089
- declare const writeTool: {
1089
+ declare const writeFileTool: {
1090
1090
  name: "FileWrite";
1091
1091
  description: string;
1092
1092
  schema: z$1.ZodObject<{
@@ -1095,7 +1095,7 @@ declare const writeTool: {
1095
1095
  }, z$1.core.$strip>;
1096
1096
  strict: true;
1097
1097
  };
1098
- type FileWriteArgs = z$1.infer<typeof writeTool.schema>;
1098
+ type FileWriteArgs = z$1.infer<typeof writeFileTool.schema>;
1099
1099
 
1100
1100
  declare const editTool: {
1101
1101
  name: "FileEdit";
@@ -1220,7 +1220,7 @@ type AskUserQuestionArgs = z.infer<typeof askUserQuestionTool.schema>;
1220
1220
  /**
1221
1221
  * Creates handler for user interaction tool - creates AI messages for display.
1222
1222
  */
1223
- declare const createAskUserQuestionHandler: () => ToolHandler<AskUserQuestionArgs, {
1223
+ declare const createAskUserQuestionHandler: () => ActivityToolHandler<AskUserQuestionArgs, {
1224
1224
  questions: {
1225
1225
  question: string;
1226
1226
  header: string;
@@ -1232,4 +1232,4 @@ declare const createAskUserQuestionHandler: () => ToolHandler<AskUserQuestionArg
1232
1232
  }[];
1233
1233
  }>;
1234
1234
 
1235
- export { type ThreadOps as $, type AgentResponse as A, type BashArgs as B, type RunAgentActivity as C, type RunAgentConfig as D, type SessionEndHookContext as E, type FileEditArgs as F, type GlobArgs as G, type SessionExitReason as H, type InferToolResults as I, type JsonPrimitive as J, type SessionLifecycleHooks as K, type SessionStartHook as L, type SessionStartHookContext as M, type SubagentArgs as N, type SubagentConfig as O, type ParsedToolCall as P, type SubagentHooks as Q, type RawToolCall as R, type SessionEndHook as S, type SubagentInput as T, type TaskCreateArgs as U, type TaskGetArgs as V, type TaskListArgs as W, type TaskStatus as X, type TaskUpdateArgs as Y, type ThreadManager as Z, type ThreadManagerConfig as _, type ActivityToolHandler as a, type ToolArgs as a0, type ToolCallResult as a1, type ToolCallResultUnion as a2, type ToolDefinition as a3, type ToolHandler as a4, type ToolHandlerContext as a5, type ToolHandlerResponse as a6, type ToolHooks as a7, type ToolMap as a8, type ToolMessageContent as a9, grepTool as aA, hasNoOtherToolCalls as aB, isTerminalStatus as aC, proxyDefaultThreadOps as aD, readTool as aE, taskCreateTool as aF, taskGetTool as aG, taskListTool as aH, taskUpdateTool as aI, withAutoAppend as aJ, writeTool as aK, type ToolNames as aa, type ToolResult as ab, type ToolResultConfig as ac, type ToolRouter as ad, type ToolWithHandler as ae, type WorkflowTask as af, type ZeitlichSession as ag, type ZeitlichSharedActivities as ah, askUserQuestionTool as ai, bashTool as aj, createAgentStateManager as ak, createAskUserQuestionHandler as al, createBashToolDescription as am, createSession as an, createSharedActivities as ao, createSubagentTool as ap, createTaskCreateHandler as aq, createTaskGetHandler as ar, createTaskListHandler as as, createTaskUpdateHandler as at, createThreadManager as au, createToolRouter as av, defineSubagent as aw, defineTool as ax, editTool as ay, globTool as az, AGENT_HANDLER_NAMES as b, type AgentConfig as c, type AgentFile as d, type AgentState as e, type AgentStateManager as f, type AgentStatus as g, type AppendToolResultFn as h, type AskUserQuestionArgs as i, type BaseAgentState as j, type BaseThreadManager as k, type FileReadArgs as l, type FileWriteArgs as m, type GrepArgs as n, type JsonSerializable as o, type JsonValue as p, type ParsedToolCallUnion as q, type PostToolUseFailureHook as r, type PostToolUseFailureHookContext as s, type PostToolUseFailureHookResult as t, type PostToolUseHook as u, type PostToolUseHookContext as v, type PreToolUseHook as w, type PreToolUseHookContext as x, type PreToolUseHookResult as y, type ProcessToolCallsContext as z };
1235
+ export { type ThreadOps as $, type AgentResponse as A, type BashArgs as B, type RunAgentActivity as C, type RunAgentConfig as D, type SessionEndHookContext as E, type FileEditArgs as F, type GlobArgs as G, type SessionExitReason as H, type InferToolResults as I, type JsonPrimitive as J, type SessionLifecycleHooks as K, type SessionStartHook as L, type SessionStartHookContext as M, type SubagentArgs as N, type SubagentConfig as O, type ParsedToolCall as P, type SubagentHooks as Q, type RawToolCall as R, type SessionEndHook as S, type SubagentInput as T, type TaskCreateArgs as U, type TaskGetArgs as V, type TaskListArgs as W, type TaskStatus as X, type TaskUpdateArgs as Y, type ThreadManager as Z, type ThreadManagerConfig as _, type ActivityToolHandler as a, type ToolArgs as a0, type ToolCallResult as a1, type ToolCallResultUnion as a2, type ToolDefinition as a3, type ToolHandler as a4, type ToolHandlerContext as a5, type ToolHandlerResponse as a6, type ToolHooks as a7, type ToolMap as a8, type ToolMessageContent as a9, grepTool as aA, hasNoOtherToolCalls as aB, isTerminalStatus as aC, proxyDefaultThreadOps as aD, readFileTool as aE, taskCreateTool as aF, taskGetTool as aG, taskListTool as aH, taskUpdateTool as aI, withAutoAppend as aJ, writeFileTool as aK, type ToolNames as aa, type ToolResult as ab, type ToolResultConfig as ac, type ToolRouter as ad, type ToolWithHandler as ae, type WorkflowTask as af, type ZeitlichSession as ag, type ZeitlichSharedActivities as ah, askUserQuestionTool as ai, bashTool as aj, createAgentStateManager as ak, createAskUserQuestionHandler as al, createBashToolDescription as am, createSession as an, createSharedActivities as ao, createSubagentTool as ap, createTaskCreateHandler as aq, createTaskGetHandler as ar, createTaskListHandler as as, createTaskUpdateHandler as at, createThreadManager as au, createToolRouter as av, defineSubagent as aw, defineTool as ax, editTool as ay, globTool as az, AGENT_HANDLER_NAMES as b, type AgentConfig as c, type AgentFile as d, type AgentState as e, type AgentStateManager as f, type AgentStatus as g, type AppendToolResultFn as h, type AskUserQuestionArgs as i, type BaseAgentState as j, type BaseThreadManager as k, type FileReadArgs as l, type FileWriteArgs as m, type GrepArgs as n, type JsonSerializable as o, type JsonValue as p, type ParsedToolCallUnion as q, type PostToolUseFailureHook as r, type PostToolUseFailureHookContext as s, type PostToolUseFailureHookResult as t, type PostToolUseHook as u, type PostToolUseHookContext as v, type PreToolUseHook as w, type PreToolUseHookContext as x, type PreToolUseHookResult as y, type ProcessToolCallsContext as z };
@@ -1074,7 +1074,7 @@ declare const grepTool: {
1074
1074
  };
1075
1075
  type GrepArgs = z$1.infer<typeof grepTool.schema>;
1076
1076
 
1077
- declare const readTool: {
1077
+ declare const readFileTool: {
1078
1078
  name: "FileRead";
1079
1079
  description: string;
1080
1080
  schema: z$1.ZodObject<{
@@ -1084,9 +1084,9 @@ declare const readTool: {
1084
1084
  }, z$1.core.$strip>;
1085
1085
  strict: true;
1086
1086
  };
1087
- type FileReadArgs = z$1.infer<typeof readTool.schema>;
1087
+ type FileReadArgs = z$1.infer<typeof readFileTool.schema>;
1088
1088
 
1089
- declare const writeTool: {
1089
+ declare const writeFileTool: {
1090
1090
  name: "FileWrite";
1091
1091
  description: string;
1092
1092
  schema: z$1.ZodObject<{
@@ -1095,7 +1095,7 @@ declare const writeTool: {
1095
1095
  }, z$1.core.$strip>;
1096
1096
  strict: true;
1097
1097
  };
1098
- type FileWriteArgs = z$1.infer<typeof writeTool.schema>;
1098
+ type FileWriteArgs = z$1.infer<typeof writeFileTool.schema>;
1099
1099
 
1100
1100
  declare const editTool: {
1101
1101
  name: "FileEdit";
@@ -1220,7 +1220,7 @@ type AskUserQuestionArgs = z.infer<typeof askUserQuestionTool.schema>;
1220
1220
  /**
1221
1221
  * Creates handler for user interaction tool - creates AI messages for display.
1222
1222
  */
1223
- declare const createAskUserQuestionHandler: () => ToolHandler<AskUserQuestionArgs, {
1223
+ declare const createAskUserQuestionHandler: () => ActivityToolHandler<AskUserQuestionArgs, {
1224
1224
  questions: {
1225
1225
  question: string;
1226
1226
  header: string;
@@ -1232,4 +1232,4 @@ declare const createAskUserQuestionHandler: () => ToolHandler<AskUserQuestionArg
1232
1232
  }[];
1233
1233
  }>;
1234
1234
 
1235
- export { type ThreadOps as $, type AgentResponse as A, type BashArgs as B, type RunAgentActivity as C, type RunAgentConfig as D, type SessionEndHookContext as E, type FileEditArgs as F, type GlobArgs as G, type SessionExitReason as H, type InferToolResults as I, type JsonPrimitive as J, type SessionLifecycleHooks as K, type SessionStartHook as L, type SessionStartHookContext as M, type SubagentArgs as N, type SubagentConfig as O, type ParsedToolCall as P, type SubagentHooks as Q, type RawToolCall as R, type SessionEndHook as S, type SubagentInput as T, type TaskCreateArgs as U, type TaskGetArgs as V, type TaskListArgs as W, type TaskStatus as X, type TaskUpdateArgs as Y, type ThreadManager as Z, type ThreadManagerConfig as _, type ActivityToolHandler as a, type ToolArgs as a0, type ToolCallResult as a1, type ToolCallResultUnion as a2, type ToolDefinition as a3, type ToolHandler as a4, type ToolHandlerContext as a5, type ToolHandlerResponse as a6, type ToolHooks as a7, type ToolMap as a8, type ToolMessageContent as a9, grepTool as aA, hasNoOtherToolCalls as aB, isTerminalStatus as aC, proxyDefaultThreadOps as aD, readTool as aE, taskCreateTool as aF, taskGetTool as aG, taskListTool as aH, taskUpdateTool as aI, withAutoAppend as aJ, writeTool as aK, type ToolNames as aa, type ToolResult as ab, type ToolResultConfig as ac, type ToolRouter as ad, type ToolWithHandler as ae, type WorkflowTask as af, type ZeitlichSession as ag, type ZeitlichSharedActivities as ah, askUserQuestionTool as ai, bashTool as aj, createAgentStateManager as ak, createAskUserQuestionHandler as al, createBashToolDescription as am, createSession as an, createSharedActivities as ao, createSubagentTool as ap, createTaskCreateHandler as aq, createTaskGetHandler as ar, createTaskListHandler as as, createTaskUpdateHandler as at, createThreadManager as au, createToolRouter as av, defineSubagent as aw, defineTool as ax, editTool as ay, globTool as az, AGENT_HANDLER_NAMES as b, type AgentConfig as c, type AgentFile as d, type AgentState as e, type AgentStateManager as f, type AgentStatus as g, type AppendToolResultFn as h, type AskUserQuestionArgs as i, type BaseAgentState as j, type BaseThreadManager as k, type FileReadArgs as l, type FileWriteArgs as m, type GrepArgs as n, type JsonSerializable as o, type JsonValue as p, type ParsedToolCallUnion as q, type PostToolUseFailureHook as r, type PostToolUseFailureHookContext as s, type PostToolUseFailureHookResult as t, type PostToolUseHook as u, type PostToolUseHookContext as v, type PreToolUseHook as w, type PreToolUseHookContext as x, type PreToolUseHookResult as y, type ProcessToolCallsContext as z };
1235
+ export { type ThreadOps as $, type AgentResponse as A, type BashArgs as B, type RunAgentActivity as C, type RunAgentConfig as D, type SessionEndHookContext as E, type FileEditArgs as F, type GlobArgs as G, type SessionExitReason as H, type InferToolResults as I, type JsonPrimitive as J, type SessionLifecycleHooks as K, type SessionStartHook as L, type SessionStartHookContext as M, type SubagentArgs as N, type SubagentConfig as O, type ParsedToolCall as P, type SubagentHooks as Q, type RawToolCall as R, type SessionEndHook as S, type SubagentInput as T, type TaskCreateArgs as U, type TaskGetArgs as V, type TaskListArgs as W, type TaskStatus as X, type TaskUpdateArgs as Y, type ThreadManager as Z, type ThreadManagerConfig as _, type ActivityToolHandler as a, type ToolArgs as a0, type ToolCallResult as a1, type ToolCallResultUnion as a2, type ToolDefinition as a3, type ToolHandler as a4, type ToolHandlerContext as a5, type ToolHandlerResponse as a6, type ToolHooks as a7, type ToolMap as a8, type ToolMessageContent as a9, grepTool as aA, hasNoOtherToolCalls as aB, isTerminalStatus as aC, proxyDefaultThreadOps as aD, readFileTool as aE, taskCreateTool as aF, taskGetTool as aG, taskListTool as aH, taskUpdateTool as aI, withAutoAppend as aJ, writeFileTool as aK, type ToolNames as aa, type ToolResult as ab, type ToolResultConfig as ac, type ToolRouter as ad, type ToolWithHandler as ae, type WorkflowTask as af, type ZeitlichSession as ag, type ZeitlichSharedActivities as ah, askUserQuestionTool as ai, bashTool as aj, createAgentStateManager as ak, createAskUserQuestionHandler as al, createBashToolDescription as am, createSession as an, createSharedActivities as ao, createSubagentTool as ap, createTaskCreateHandler as aq, createTaskGetHandler as ar, createTaskListHandler as as, createTaskUpdateHandler as at, createThreadManager as au, createToolRouter as av, defineSubagent as aw, defineTool as ax, editTool as ay, globTool as az, AGENT_HANDLER_NAMES as b, type AgentConfig as c, type AgentFile as d, type AgentState as e, type AgentStateManager as f, type AgentStatus as g, type AppendToolResultFn as h, type AskUserQuestionArgs as i, type BaseAgentState as j, type BaseThreadManager as k, type FileReadArgs as l, type FileWriteArgs as m, type GrepArgs as n, type JsonSerializable as o, type JsonValue as p, type ParsedToolCallUnion as q, type PostToolUseFailureHook as r, type PostToolUseFailureHookContext as s, type PostToolUseFailureHookResult as t, type PostToolUseHook as u, type PostToolUseHookContext as v, type PreToolUseHook as w, type PreToolUseHookContext as x, type PreToolUseHookResult as y, type ProcessToolCallsContext as z };
package/dist/workflow.cjs CHANGED
@@ -8,18 +8,18 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
  var z13__default = /*#__PURE__*/_interopDefault(z13);
9
9
 
10
10
  // src/lib/session.ts
11
- var SUBAGENT_TOOL = "Subagent";
11
+ var SUBAGENT_TOOL_NAME = "Subagent";
12
12
  function buildSubagentDescription(subagents) {
13
13
  const subagentList = subagents.map((s) => `- **${s.agentName}**: ${s.description}`).join("\n");
14
14
  return `Launch a new agent to handle complex tasks autonomously.
15
15
 
16
- The ${SUBAGENT_TOOL} tool launches specialized agents (subprocesses) that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.
16
+ The ${SUBAGENT_TOOL_NAME} tool launches specialized agents (subprocesses) that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.
17
17
 
18
18
  Available agent types:
19
19
 
20
20
  ${subagentList}
21
21
 
22
- When using the ${SUBAGENT_TOOL} tool, you must specify a subagent parameter to select which agent type to use.
22
+ When using the ${SUBAGENT_TOOL_NAME} tool, you must specify a subagent parameter to select which agent type to use.
23
23
 
24
24
  Usage notes:
25
25
 
@@ -38,7 +38,7 @@ function createSubagentTool(subagents) {
38
38
  }
39
39
  const names = subagents.map((s) => s.agentName);
40
40
  return {
41
- name: SUBAGENT_TOOL,
41
+ name: SUBAGENT_TOOL_NAME,
42
42
  description: buildSubagentDescription(subagents),
43
43
  schema: z13__default.default.object({
44
44
  subagent: z13__default.default.enum(names).describe("The type of subagent to launch"),
@@ -91,7 +91,7 @@ function createToolRouter(options) {
91
91
  if (s.hooks) subagentHooksMap.set(s.agentName, s.hooks);
92
92
  }
93
93
  const resolveSubagentName = (args) => args.subagent;
94
- toolMap.set("Subagent", {
94
+ toolMap.set(SUBAGENT_TOOL_NAME, {
95
95
  ...createSubagentTool(options.subagents),
96
96
  handler: createSubagentHandler(options.subagents),
97
97
  ...subagentHooksMap.size > 0 && {
@@ -284,13 +284,19 @@ function createToolRouter(options) {
284
284
  return Array.from(toolMap.entries()).filter(([, tool]) => isEnabled(tool)).map(([name]) => name);
285
285
  },
286
286
  getToolDefinitions() {
287
- return Array.from(toolMap).filter(([, tool]) => isEnabled(tool)).map(([name, tool]) => ({
288
- name,
289
- description: tool.description,
290
- schema: tool.schema,
291
- strict: tool.strict,
292
- max_uses: tool.max_uses
293
- }));
287
+ const activeSubagents = options.subagents?.filter((subagent) => isEnabled(subagent)) ?? [];
288
+ return [
289
+ ...Array.from(toolMap).filter(
290
+ ([, tool]) => isEnabled(tool) && tool.name !== SUBAGENT_TOOL_NAME
291
+ ).map(([name, tool]) => ({
292
+ name,
293
+ description: tool.description,
294
+ schema: tool.schema,
295
+ strict: tool.strict,
296
+ max_uses: tool.max_uses
297
+ })),
298
+ ...activeSubagents.length > 0 ? [createSubagentTool(activeSubagents)] : []
299
+ ];
294
300
  },
295
301
  // --- Methods for processing tool calls ---
296
302
  async processToolCalls(toolCalls, context) {
@@ -759,7 +765,7 @@ Examples:
759
765
  }),
760
766
  strict: true
761
767
  };
762
- var readTool = {
768
+ var readFileTool = {
763
769
  name: "FileRead",
764
770
  description: `Read file contents with optional pagination.
765
771
 
@@ -782,22 +788,21 @@ The tool returns the file content in an appropriate format:
782
788
  }),
783
789
  strict: true
784
790
  };
785
- var writeTool = {
791
+ var writeFileTool = {
786
792
  name: "FileWrite",
787
793
  description: `Create or overwrite a file with new content.
788
794
 
789
795
  Usage:
790
- - Provide the absolute path to the file
791
796
  - The file will be created if it doesn't exist
792
797
  - If the file exists, it will be completely overwritten
793
798
 
794
799
  IMPORTANT:
795
800
  - You must read the file first (in this session) before writing to it
796
801
  - This is an atomic write operation - the entire file is replaced
797
- - Path must be absolute (e.g., "/docs/readme.md", not "docs/readme.md")
802
+ - Path must be relative to the root of the file system (e.g., "docs/readme.md", not "/docs/readme.md")
798
803
  `,
799
804
  schema: z13.z.object({
800
- file_path: z13.z.string().describe("The absolute path to the file to write"),
805
+ file_path: z13.z.string().describe("The path to the file to write"),
801
806
  content: z13.z.string().describe("The content to write to the file")
802
807
  }),
803
808
  strict: true
@@ -1059,7 +1064,7 @@ Usage notes:
1059
1064
  };
1060
1065
 
1061
1066
  // src/tools/ask-user-question/handler.ts
1062
- var createAskUserQuestionHandler = () => (args) => {
1067
+ var createAskUserQuestionHandler = () => async (args) => {
1063
1068
  return {
1064
1069
  toolResponse: "Question submitted",
1065
1070
  data: { questions: args.questions }
@@ -1087,11 +1092,11 @@ exports.grepTool = grepTool;
1087
1092
  exports.hasNoOtherToolCalls = hasNoOtherToolCalls;
1088
1093
  exports.isTerminalStatus = isTerminalStatus;
1089
1094
  exports.proxyDefaultThreadOps = proxyDefaultThreadOps;
1090
- exports.readTool = readTool;
1095
+ exports.readFileTool = readFileTool;
1091
1096
  exports.taskCreateTool = taskCreateTool;
1092
1097
  exports.taskGetTool = taskGetTool;
1093
1098
  exports.taskListTool = taskListTool;
1094
1099
  exports.taskUpdateTool = taskUpdateTool;
1095
- exports.writeTool = writeTool;
1100
+ exports.writeFileTool = writeFileTool;
1096
1101
  //# sourceMappingURL=workflow.cjs.map
1097
1102
  //# sourceMappingURL=workflow.cjs.map