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.
@@ -1,4 +1,4 @@
1
- export { b as AGENT_HANDLER_NAMES, a as ActivityToolHandler, c as AgentConfig, d as AgentFile, A as AgentResponse, e as AgentState, f as AgentStateManager, g as AgentStatus, h as AppendToolResultFn, i as AskUserQuestionArgs, j as BaseAgentState, B as BashArgs, F as FileEditArgs, l as FileReadArgs, m as FileWriteArgs, G as GlobArgs, n as GrepArgs, I as InferToolResults, J as JsonPrimitive, o as JsonSerializable, p as JsonValue, P as ParsedToolCall, q as ParsedToolCallUnion, r as PostToolUseFailureHook, s as PostToolUseFailureHookContext, t as PostToolUseFailureHookResult, u as PostToolUseHook, v as PostToolUseHookContext, w as PreToolUseHook, x as PreToolUseHookContext, y as PreToolUseHookResult, z as ProcessToolCallsContext, R as RawToolCall, C as RunAgentActivity, D as RunAgentConfig, S as SessionEndHook, E as SessionEndHookContext, H as SessionExitReason, K as SessionLifecycleHooks, L as SessionStartHook, M as SessionStartHookContext, N as SubagentArgs, O as SubagentConfig, Q as SubagentHooks, T as SubagentInput, U as TaskCreateArgs, V as TaskGetArgs, W as TaskListArgs, X as TaskStatus, Y as TaskUpdateArgs, $ as ThreadOps, a0 as ToolArgs, a1 as ToolCallResult, a2 as ToolCallResultUnion, a3 as ToolDefinition, a4 as ToolHandler, a5 as ToolHandlerContext, a6 as ToolHandlerResponse, a7 as ToolHooks, a8 as ToolMap, a9 as ToolMessageContent, aa as ToolNames, ab as ToolResult, ac as ToolResultConfig, ad as ToolRouter, ae as ToolWithHandler, af as WorkflowTask, ag as ZeitlichSession, ah as ZeitlichSharedActivities, ai as askUserQuestionTool, aj as bashTool, ak as createAgentStateManager, al as createAskUserQuestionHandler, am as createBashToolDescription, an as createSession, ap as createSubagentTool, aq as createTaskCreateHandler, ar as createTaskGetHandler, as as createTaskListHandler, at as createTaskUpdateHandler, av as createToolRouter, aw as defineSubagent, ax as defineTool, ay as editTool, az as globTool, aA as grepTool, aB as hasNoOtherToolCalls, aC as isTerminalStatus, aD as proxyDefaultThreadOps, aE as readTool, aF as taskCreateTool, aG as taskGetTool, aH as taskListTool, aI as taskUpdateTool, aK as writeTool } from './workflow-BdAuMMjY.js';
1
+ export { b as AGENT_HANDLER_NAMES, a as ActivityToolHandler, c as AgentConfig, d as AgentFile, A as AgentResponse, e as AgentState, f as AgentStateManager, g as AgentStatus, h as AppendToolResultFn, i as AskUserQuestionArgs, j as BaseAgentState, B as BashArgs, F as FileEditArgs, l as FileReadArgs, m as FileWriteArgs, G as GlobArgs, n as GrepArgs, I as InferToolResults, J as JsonPrimitive, o as JsonSerializable, p as JsonValue, P as ParsedToolCall, q as ParsedToolCallUnion, r as PostToolUseFailureHook, s as PostToolUseFailureHookContext, t as PostToolUseFailureHookResult, u as PostToolUseHook, v as PostToolUseHookContext, w as PreToolUseHook, x as PreToolUseHookContext, y as PreToolUseHookResult, z as ProcessToolCallsContext, R as RawToolCall, C as RunAgentActivity, D as RunAgentConfig, S as SessionEndHook, E as SessionEndHookContext, H as SessionExitReason, K as SessionLifecycleHooks, L as SessionStartHook, M as SessionStartHookContext, N as SubagentArgs, O as SubagentConfig, Q as SubagentHooks, T as SubagentInput, U as TaskCreateArgs, V as TaskGetArgs, W as TaskListArgs, X as TaskStatus, Y as TaskUpdateArgs, $ as ThreadOps, a0 as ToolArgs, a1 as ToolCallResult, a2 as ToolCallResultUnion, a3 as ToolDefinition, a4 as ToolHandler, a5 as ToolHandlerContext, a6 as ToolHandlerResponse, a7 as ToolHooks, a8 as ToolMap, a9 as ToolMessageContent, aa as ToolNames, ab as ToolResult, ac as ToolResultConfig, ad as ToolRouter, ae as ToolWithHandler, af as WorkflowTask, ag as ZeitlichSession, ah as ZeitlichSharedActivities, ai as askUserQuestionTool, aj as bashTool, ak as createAgentStateManager, al as createAskUserQuestionHandler, am as createBashToolDescription, an as createSession, ap as createSubagentTool, aq as createTaskCreateHandler, ar as createTaskGetHandler, as as createTaskListHandler, at as createTaskUpdateHandler, av as createToolRouter, aw as defineSubagent, ax as defineTool, ay as editTool, az as globTool, aA as grepTool, aB as hasNoOtherToolCalls, aC as isTerminalStatus, aD as proxyDefaultThreadOps, aE as readFileTool, aF as taskCreateTool, aG as taskGetTool, aH as taskListTool, aI as taskUpdateTool, aK as writeFileTool } from './workflow-C2ShwjC7.js';
2
2
  import '@temporalio/workflow';
3
3
  import 'ioredis';
4
4
  import '@langchain/core/messages';
package/dist/workflow.js CHANGED
@@ -2,18 +2,18 @@ import { setHandler, defineUpdate, condition, proxyActivities, defineQuery, uuid
2
2
  import z13, { z } from 'zod';
3
3
 
4
4
  // src/lib/session.ts
5
- var SUBAGENT_TOOL = "Subagent";
5
+ var SUBAGENT_TOOL_NAME = "Subagent";
6
6
  function buildSubagentDescription(subagents) {
7
7
  const subagentList = subagents.map((s) => `- **${s.agentName}**: ${s.description}`).join("\n");
8
8
  return `Launch a new agent to handle complex tasks autonomously.
9
9
 
10
- The ${SUBAGENT_TOOL} tool launches specialized agents (subprocesses) that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.
10
+ 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.
11
11
 
12
12
  Available agent types:
13
13
 
14
14
  ${subagentList}
15
15
 
16
- When using the ${SUBAGENT_TOOL} tool, you must specify a subagent parameter to select which agent type to use.
16
+ When using the ${SUBAGENT_TOOL_NAME} tool, you must specify a subagent parameter to select which agent type to use.
17
17
 
18
18
  Usage notes:
19
19
 
@@ -32,7 +32,7 @@ function createSubagentTool(subagents) {
32
32
  }
33
33
  const names = subagents.map((s) => s.agentName);
34
34
  return {
35
- name: SUBAGENT_TOOL,
35
+ name: SUBAGENT_TOOL_NAME,
36
36
  description: buildSubagentDescription(subagents),
37
37
  schema: z13.object({
38
38
  subagent: z13.enum(names).describe("The type of subagent to launch"),
@@ -85,7 +85,7 @@ function createToolRouter(options) {
85
85
  if (s.hooks) subagentHooksMap.set(s.agentName, s.hooks);
86
86
  }
87
87
  const resolveSubagentName = (args) => args.subagent;
88
- toolMap.set("Subagent", {
88
+ toolMap.set(SUBAGENT_TOOL_NAME, {
89
89
  ...createSubagentTool(options.subagents),
90
90
  handler: createSubagentHandler(options.subagents),
91
91
  ...subagentHooksMap.size > 0 && {
@@ -278,13 +278,19 @@ function createToolRouter(options) {
278
278
  return Array.from(toolMap.entries()).filter(([, tool]) => isEnabled(tool)).map(([name]) => name);
279
279
  },
280
280
  getToolDefinitions() {
281
- return Array.from(toolMap).filter(([, tool]) => isEnabled(tool)).map(([name, tool]) => ({
282
- name,
283
- description: tool.description,
284
- schema: tool.schema,
285
- strict: tool.strict,
286
- max_uses: tool.max_uses
287
- }));
281
+ const activeSubagents = options.subagents?.filter((subagent) => isEnabled(subagent)) ?? [];
282
+ return [
283
+ ...Array.from(toolMap).filter(
284
+ ([, tool]) => isEnabled(tool) && tool.name !== SUBAGENT_TOOL_NAME
285
+ ).map(([name, tool]) => ({
286
+ name,
287
+ description: tool.description,
288
+ schema: tool.schema,
289
+ strict: tool.strict,
290
+ max_uses: tool.max_uses
291
+ })),
292
+ ...activeSubagents.length > 0 ? [createSubagentTool(activeSubagents)] : []
293
+ ];
288
294
  },
289
295
  // --- Methods for processing tool calls ---
290
296
  async processToolCalls(toolCalls, context) {
@@ -753,7 +759,7 @@ Examples:
753
759
  }),
754
760
  strict: true
755
761
  };
756
- var readTool = {
762
+ var readFileTool = {
757
763
  name: "FileRead",
758
764
  description: `Read file contents with optional pagination.
759
765
 
@@ -776,22 +782,21 @@ The tool returns the file content in an appropriate format:
776
782
  }),
777
783
  strict: true
778
784
  };
779
- var writeTool = {
785
+ var writeFileTool = {
780
786
  name: "FileWrite",
781
787
  description: `Create or overwrite a file with new content.
782
788
 
783
789
  Usage:
784
- - Provide the absolute path to the file
785
790
  - The file will be created if it doesn't exist
786
791
  - If the file exists, it will be completely overwritten
787
792
 
788
793
  IMPORTANT:
789
794
  - You must read the file first (in this session) before writing to it
790
795
  - This is an atomic write operation - the entire file is replaced
791
- - Path must be absolute (e.g., "/docs/readme.md", not "docs/readme.md")
796
+ - Path must be relative to the root of the file system (e.g., "docs/readme.md", not "/docs/readme.md")
792
797
  `,
793
798
  schema: z.object({
794
- file_path: z.string().describe("The absolute path to the file to write"),
799
+ file_path: z.string().describe("The path to the file to write"),
795
800
  content: z.string().describe("The content to write to the file")
796
801
  }),
797
802
  strict: true
@@ -1053,13 +1058,13 @@ Usage notes:
1053
1058
  };
1054
1059
 
1055
1060
  // src/tools/ask-user-question/handler.ts
1056
- var createAskUserQuestionHandler = () => (args) => {
1061
+ var createAskUserQuestionHandler = () => async (args) => {
1057
1062
  return {
1058
1063
  toolResponse: "Question submitted",
1059
1064
  data: { questions: args.questions }
1060
1065
  };
1061
1066
  };
1062
1067
 
1063
- export { AGENT_HANDLER_NAMES, askUserQuestionTool, bashTool, createAgentStateManager, createAskUserQuestionHandler, createBashToolDescription, createSession, createSubagentTool, createTaskCreateHandler, createTaskGetHandler, createTaskListHandler, createTaskUpdateHandler, createToolRouter, defineSubagent, defineTool, editTool, globTool, grepTool, hasNoOtherToolCalls, isTerminalStatus, proxyDefaultThreadOps, readTool, taskCreateTool, taskGetTool, taskListTool, taskUpdateTool, writeTool };
1068
+ export { AGENT_HANDLER_NAMES, askUserQuestionTool, bashTool, createAgentStateManager, createAskUserQuestionHandler, createBashToolDescription, createSession, createSubagentTool, createTaskCreateHandler, createTaskGetHandler, createTaskListHandler, createTaskUpdateHandler, createToolRouter, defineSubagent, defineTool, editTool, globTool, grepTool, hasNoOtherToolCalls, isTerminalStatus, proxyDefaultThreadOps, readFileTool, taskCreateTool, taskGetTool, taskListTool, taskUpdateTool, writeFileTool };
1064
1069
  //# sourceMappingURL=workflow.js.map
1065
1070
  //# sourceMappingURL=workflow.js.map