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.
- package/dist/index.cjs +25 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +24 -19
- package/dist/index.js.map +1 -1
- package/dist/{workflow-BdAuMMjY.d.cts → workflow-C2ShwjC7.d.cts} +6 -6
- package/dist/{workflow-BdAuMMjY.d.ts → workflow-C2ShwjC7.d.ts} +6 -6
- package/dist/workflow.cjs +25 -20
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +1 -1
- package/dist/workflow.d.ts +1 -1
- package/dist/workflow.js +24 -19
- package/dist/workflow.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/tool-router.ts +22 -12
- package/src/tools/ask-user-question/handler.ts +3 -3
- package/src/tools/read-file/tool.ts +2 -2
- package/src/tools/subagent/tool.ts +4 -4
- package/src/tools/write-file/tool.ts +4 -5
- package/src/workflow.ts +2 -2
package/dist/workflow.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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 ${
|
|
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 ${
|
|
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:
|
|
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(
|
|
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
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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
|