zeitlich 0.2.1 → 0.2.3
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/README.md +36 -33
- package/dist/index.cjs +445 -385
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -42
- package/dist/index.d.ts +25 -42
- package/dist/index.js +415 -362
- package/dist/index.js.map +1 -1
- package/dist/{workflow-CCoHnc3B.d.cts → workflow-D-2vp4Pq.d.cts} +456 -253
- package/dist/{workflow-CCoHnc3B.d.ts → workflow-D-2vp4Pq.d.ts} +456 -253
- package/dist/workflow.cjs +339 -272
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +4 -3
- package/dist/workflow.d.ts +4 -3
- package/dist/workflow.js +315 -252
- package/dist/workflow.js.map +1 -1
- package/package.json +3 -2
- package/src/activities.ts +1 -14
- package/src/index.ts +17 -11
- package/src/lib/session.ts +69 -86
- package/src/lib/state-manager.ts +9 -2
- package/src/lib/thread-manager.ts +45 -37
- package/src/lib/tool-router.ts +338 -116
- package/src/lib/types.ts +110 -28
- package/src/tools/ask-user-question/handler.ts +6 -6
- package/src/tools/ask-user-question/tool.ts +3 -2
- package/src/tools/bash/bash.test.ts +32 -32
- package/src/tools/bash/handler.ts +9 -9
- package/src/tools/bash/tool.ts +3 -2
- package/src/tools/edit/handler.ts +78 -123
- package/src/tools/edit/tool.ts +3 -2
- package/src/tools/glob/handler.ts +17 -48
- package/src/tools/glob/tool.ts +3 -2
- package/src/tools/grep/tool.ts +3 -2
- package/src/tools/{read → read-file}/tool.ts +3 -2
- package/src/tools/task/handler.ts +19 -9
- package/src/tools/task/tool.ts +3 -10
- package/src/tools/task-create/handler.ts +11 -20
- package/src/tools/task-create/tool.ts +3 -2
- package/src/tools/task-get/handler.ts +9 -14
- package/src/tools/task-get/tool.ts +3 -2
- package/src/tools/task-list/handler.ts +7 -12
- package/src/tools/task-list/tool.ts +3 -2
- package/src/tools/task-update/handler.ts +9 -16
- package/src/tools/task-update/tool.ts +3 -2
- package/src/tools/{write → write-file}/tool.ts +5 -6
- package/src/workflow.ts +25 -19
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { A as AgentResponse, a as ActivityToolHandler, b as
|
|
2
|
-
export { c as AGENT_HANDLER_NAMES, d as AgentFile, e as AgentState, f as AgentStateManager, g as AgentStatus, h as AppendToolResultFn,
|
|
1
|
+
import { A as AgentResponse, a as ActivityToolHandler, b as AskUserQuestionArgs, G as GlobArgs, F as FileEditArgs, B as BashArgs } from './workflow-D-2vp4Pq.cjs';
|
|
2
|
+
export { c as AGENT_HANDLER_NAMES, d as AgentFile, e as AgentState, f as AgentStateManager, g as AgentStatus, h as AppendToolResultFn, i as BaseAgentState, j as BaseThreadManager, k as FileReadArgs, l as FileWriteArgs, m as GrepArgs, I as InferToolResults, J as JsonPrimitive, n as JsonSerializable, o as JsonValue, P as ParsedToolCall, p as ParsedToolCallUnion, q as PostToolUseFailureHook, r as PostToolUseFailureHookContext, s as PostToolUseFailureHookResult, t as PostToolUseHook, u as PostToolUseHookContext, v as PreToolUseHook, w as PreToolUseHookContext, x as PreToolUseHookResult, y as ProcessToolCallsContext, R as RawToolCall, z as RunAgentActivity, C as RunAgentConfig, S as SessionEndHook, D as SessionEndHookContext, E as SessionExitReason, H as SessionLifecycleHooks, K as SessionStartHook, L as SessionStartHookContext, M as SubagentConfig, N as SubagentHooks, O as SubagentInput, T as TaskArgs, Q as TaskCreateArgs, U as TaskGetArgs, V as TaskHandlerResult, W as TaskListArgs, X as TaskStatus, Y as TaskUpdateArgs, Z as ThreadManager, _ as ThreadManagerConfig, $ 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 ZeitlichAgentConfig, ah as ZeitlichSession, ai as ZeitlichSharedActivities, aj as askUserQuestionTool, ak as bashTool, al as createAgentStateManager, am as createBashToolDescription, an as createSession, ao as createSharedActivities, ap as createTaskCreateHandler, aq as createTaskGetHandler, ar as createTaskListHandler, as as createTaskTool, at as createTaskUpdateHandler, au as createThreadManager, av as createToolRouter, aw as defineSubagent, ax as defineTool, ay as editTool, az as getStateQuery, aA as globTool, aB as grepTool, aC as hasNoOtherToolCalls, aD as isTerminalStatus, aE as proxyDefaultThreadOps, aF as readTool, aG as taskCreateTool, aH as taskGetTool, aI as taskListTool, aJ as taskUpdateTool, aK as withAutoAppend, aL as writeTool } from './workflow-D-2vp4Pq.cjs';
|
|
3
3
|
import { SimplePlugin } from '@temporalio/plugin';
|
|
4
4
|
import Redis from 'ioredis';
|
|
5
5
|
import { WorkflowClient } from '@temporalio/client';
|
|
6
6
|
import { BaseChatModel, BaseChatModelCallOptions, BindToolsInput } from '@langchain/core/language_models/chat_models';
|
|
7
7
|
import { StoredMessage } from '@langchain/core/messages';
|
|
8
|
-
import { IFileSystem } from 'just-bash';
|
|
8
|
+
import { IFileSystem, BashOptions } from 'just-bash';
|
|
9
|
+
import '@temporalio/workflow';
|
|
9
10
|
import 'zod';
|
|
11
|
+
import '@temporalio/common';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Options for the Zeitlich plugin
|
|
@@ -53,9 +55,9 @@ declare function invokeModel({ redis, model, client, config: { threadId, agentNa
|
|
|
53
55
|
}): Promise<AgentResponse>;
|
|
54
56
|
|
|
55
57
|
/**
|
|
56
|
-
*
|
|
58
|
+
* Creates handler for user interaction tool - creates AI messages for display.
|
|
57
59
|
*/
|
|
58
|
-
declare const
|
|
60
|
+
declare const createAskUserQuestionHandler: () => ActivityToolHandler<AskUserQuestionArgs, {
|
|
59
61
|
chatMessages: StoredMessage[];
|
|
60
62
|
}>;
|
|
61
63
|
|
|
@@ -66,19 +68,12 @@ interface GlobResult {
|
|
|
66
68
|
files: string[];
|
|
67
69
|
}
|
|
68
70
|
/**
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
interface GlobHandlerResponse {
|
|
72
|
-
content: string;
|
|
73
|
-
result: GlobResult;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Glob handler that searches within the scoped file tree.
|
|
71
|
+
* Creates a glob handler that searches within the scoped file tree.
|
|
77
72
|
*
|
|
78
|
-
* @param
|
|
79
|
-
* @
|
|
73
|
+
* @param fs - File system implementation for I/O operations
|
|
74
|
+
* @returns An ActivityToolHandler for glob tool calls
|
|
80
75
|
*/
|
|
81
|
-
declare function
|
|
76
|
+
declare function createGlobHandler(fs: IFileSystem): ActivityToolHandler<GlobArgs, GlobResult>;
|
|
82
77
|
|
|
83
78
|
/**
|
|
84
79
|
* Result of an edit operation
|
|
@@ -89,33 +84,21 @@ interface EditResult {
|
|
|
89
84
|
replacements: number;
|
|
90
85
|
}
|
|
91
86
|
/**
|
|
92
|
-
*
|
|
93
|
-
*/
|
|
94
|
-
interface EditHandlerResponse {
|
|
95
|
-
content: string;
|
|
96
|
-
result: EditResult;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Options for edit handler
|
|
100
|
-
*/
|
|
101
|
-
interface EditHandlerOptions {
|
|
102
|
-
/**
|
|
103
|
-
* Set of file paths that have been read in this session.
|
|
104
|
-
* Required for enforcing read-before-write policy.
|
|
105
|
-
*/
|
|
106
|
-
readFiles: Set<string>;
|
|
107
|
-
/**
|
|
108
|
-
* If true, skip the read-before-write check (not recommended)
|
|
109
|
-
*/
|
|
110
|
-
skipReadCheck?: boolean;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Edit handler that edits files within the scoped file tree.
|
|
87
|
+
* Creates an edit handler that edits files within the scoped file tree.
|
|
114
88
|
*
|
|
115
|
-
* @param
|
|
116
|
-
* @
|
|
89
|
+
* @param fs - File system implementation for I/O operations
|
|
90
|
+
* @returns An ActivityToolHandler for edit tool calls
|
|
117
91
|
*/
|
|
118
|
-
declare function
|
|
92
|
+
declare function createEditHandler(fs: IFileSystem): ActivityToolHandler<FileEditArgs, EditResult>;
|
|
93
|
+
|
|
94
|
+
type BashExecOut = {
|
|
95
|
+
exitCode: number;
|
|
96
|
+
stderr: string;
|
|
97
|
+
stdout: string;
|
|
98
|
+
};
|
|
99
|
+
/** BashOptions with `fs` required */
|
|
100
|
+
type BashToolOptions = Required<Pick<BashOptions, "fs">> & Omit<BashOptions, "fs">;
|
|
101
|
+
declare const createBashHandler: (bashOptions: BashToolOptions) => ActivityToolHandler<BashArgs, BashExecOut | null>;
|
|
119
102
|
|
|
120
103
|
declare const toTree: (fs: IFileSystem, opts?: {
|
|
121
104
|
dir?: string;
|
|
@@ -125,4 +108,4 @@ declare const toTree: (fs: IFileSystem, opts?: {
|
|
|
125
108
|
sort?: boolean;
|
|
126
109
|
}) => Promise<string>;
|
|
127
110
|
|
|
128
|
-
export { ActivityToolHandler, AgentResponse,
|
|
111
|
+
export { ActivityToolHandler, AgentResponse, AskUserQuestionArgs, BashArgs, FileEditArgs, GlobArgs, type InvokeModelConfig, ZeitlichPlugin, type ZeitlichPluginOptions, createAskUserQuestionHandler, createBashHandler, createEditHandler, createGlobHandler, invokeModel, toTree };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { A as AgentResponse, a as ActivityToolHandler, b as
|
|
2
|
-
export { c as AGENT_HANDLER_NAMES, d as AgentFile, e as AgentState, f as AgentStateManager, g as AgentStatus, h as AppendToolResultFn,
|
|
1
|
+
import { A as AgentResponse, a as ActivityToolHandler, b as AskUserQuestionArgs, G as GlobArgs, F as FileEditArgs, B as BashArgs } from './workflow-D-2vp4Pq.js';
|
|
2
|
+
export { c as AGENT_HANDLER_NAMES, d as AgentFile, e as AgentState, f as AgentStateManager, g as AgentStatus, h as AppendToolResultFn, i as BaseAgentState, j as BaseThreadManager, k as FileReadArgs, l as FileWriteArgs, m as GrepArgs, I as InferToolResults, J as JsonPrimitive, n as JsonSerializable, o as JsonValue, P as ParsedToolCall, p as ParsedToolCallUnion, q as PostToolUseFailureHook, r as PostToolUseFailureHookContext, s as PostToolUseFailureHookResult, t as PostToolUseHook, u as PostToolUseHookContext, v as PreToolUseHook, w as PreToolUseHookContext, x as PreToolUseHookResult, y as ProcessToolCallsContext, R as RawToolCall, z as RunAgentActivity, C as RunAgentConfig, S as SessionEndHook, D as SessionEndHookContext, E as SessionExitReason, H as SessionLifecycleHooks, K as SessionStartHook, L as SessionStartHookContext, M as SubagentConfig, N as SubagentHooks, O as SubagentInput, T as TaskArgs, Q as TaskCreateArgs, U as TaskGetArgs, V as TaskHandlerResult, W as TaskListArgs, X as TaskStatus, Y as TaskUpdateArgs, Z as ThreadManager, _ as ThreadManagerConfig, $ 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 ZeitlichAgentConfig, ah as ZeitlichSession, ai as ZeitlichSharedActivities, aj as askUserQuestionTool, ak as bashTool, al as createAgentStateManager, am as createBashToolDescription, an as createSession, ao as createSharedActivities, ap as createTaskCreateHandler, aq as createTaskGetHandler, ar as createTaskListHandler, as as createTaskTool, at as createTaskUpdateHandler, au as createThreadManager, av as createToolRouter, aw as defineSubagent, ax as defineTool, ay as editTool, az as getStateQuery, aA as globTool, aB as grepTool, aC as hasNoOtherToolCalls, aD as isTerminalStatus, aE as proxyDefaultThreadOps, aF as readTool, aG as taskCreateTool, aH as taskGetTool, aI as taskListTool, aJ as taskUpdateTool, aK as withAutoAppend, aL as writeTool } from './workflow-D-2vp4Pq.js';
|
|
3
3
|
import { SimplePlugin } from '@temporalio/plugin';
|
|
4
4
|
import Redis from 'ioredis';
|
|
5
5
|
import { WorkflowClient } from '@temporalio/client';
|
|
6
6
|
import { BaseChatModel, BaseChatModelCallOptions, BindToolsInput } from '@langchain/core/language_models/chat_models';
|
|
7
7
|
import { StoredMessage } from '@langchain/core/messages';
|
|
8
|
-
import { IFileSystem } from 'just-bash';
|
|
8
|
+
import { IFileSystem, BashOptions } from 'just-bash';
|
|
9
|
+
import '@temporalio/workflow';
|
|
9
10
|
import 'zod';
|
|
11
|
+
import '@temporalio/common';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Options for the Zeitlich plugin
|
|
@@ -53,9 +55,9 @@ declare function invokeModel({ redis, model, client, config: { threadId, agentNa
|
|
|
53
55
|
}): Promise<AgentResponse>;
|
|
54
56
|
|
|
55
57
|
/**
|
|
56
|
-
*
|
|
58
|
+
* Creates handler for user interaction tool - creates AI messages for display.
|
|
57
59
|
*/
|
|
58
|
-
declare const
|
|
60
|
+
declare const createAskUserQuestionHandler: () => ActivityToolHandler<AskUserQuestionArgs, {
|
|
59
61
|
chatMessages: StoredMessage[];
|
|
60
62
|
}>;
|
|
61
63
|
|
|
@@ -66,19 +68,12 @@ interface GlobResult {
|
|
|
66
68
|
files: string[];
|
|
67
69
|
}
|
|
68
70
|
/**
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
interface GlobHandlerResponse {
|
|
72
|
-
content: string;
|
|
73
|
-
result: GlobResult;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Glob handler that searches within the scoped file tree.
|
|
71
|
+
* Creates a glob handler that searches within the scoped file tree.
|
|
77
72
|
*
|
|
78
|
-
* @param
|
|
79
|
-
* @
|
|
73
|
+
* @param fs - File system implementation for I/O operations
|
|
74
|
+
* @returns An ActivityToolHandler for glob tool calls
|
|
80
75
|
*/
|
|
81
|
-
declare function
|
|
76
|
+
declare function createGlobHandler(fs: IFileSystem): ActivityToolHandler<GlobArgs, GlobResult>;
|
|
82
77
|
|
|
83
78
|
/**
|
|
84
79
|
* Result of an edit operation
|
|
@@ -89,33 +84,21 @@ interface EditResult {
|
|
|
89
84
|
replacements: number;
|
|
90
85
|
}
|
|
91
86
|
/**
|
|
92
|
-
*
|
|
93
|
-
*/
|
|
94
|
-
interface EditHandlerResponse {
|
|
95
|
-
content: string;
|
|
96
|
-
result: EditResult;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Options for edit handler
|
|
100
|
-
*/
|
|
101
|
-
interface EditHandlerOptions {
|
|
102
|
-
/**
|
|
103
|
-
* Set of file paths that have been read in this session.
|
|
104
|
-
* Required for enforcing read-before-write policy.
|
|
105
|
-
*/
|
|
106
|
-
readFiles: Set<string>;
|
|
107
|
-
/**
|
|
108
|
-
* If true, skip the read-before-write check (not recommended)
|
|
109
|
-
*/
|
|
110
|
-
skipReadCheck?: boolean;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Edit handler that edits files within the scoped file tree.
|
|
87
|
+
* Creates an edit handler that edits files within the scoped file tree.
|
|
114
88
|
*
|
|
115
|
-
* @param
|
|
116
|
-
* @
|
|
89
|
+
* @param fs - File system implementation for I/O operations
|
|
90
|
+
* @returns An ActivityToolHandler for edit tool calls
|
|
117
91
|
*/
|
|
118
|
-
declare function
|
|
92
|
+
declare function createEditHandler(fs: IFileSystem): ActivityToolHandler<FileEditArgs, EditResult>;
|
|
93
|
+
|
|
94
|
+
type BashExecOut = {
|
|
95
|
+
exitCode: number;
|
|
96
|
+
stderr: string;
|
|
97
|
+
stdout: string;
|
|
98
|
+
};
|
|
99
|
+
/** BashOptions with `fs` required */
|
|
100
|
+
type BashToolOptions = Required<Pick<BashOptions, "fs">> & Omit<BashOptions, "fs">;
|
|
101
|
+
declare const createBashHandler: (bashOptions: BashToolOptions) => ActivityToolHandler<BashArgs, BashExecOut | null>;
|
|
119
102
|
|
|
120
103
|
declare const toTree: (fs: IFileSystem, opts?: {
|
|
121
104
|
dir?: string;
|
|
@@ -125,4 +108,4 @@ declare const toTree: (fs: IFileSystem, opts?: {
|
|
|
125
108
|
sort?: boolean;
|
|
126
109
|
}) => Promise<string>;
|
|
127
110
|
|
|
128
|
-
export { ActivityToolHandler, AgentResponse,
|
|
111
|
+
export { ActivityToolHandler, AgentResponse, AskUserQuestionArgs, BashArgs, FileEditArgs, GlobArgs, type InvokeModelConfig, ZeitlichPlugin, type ZeitlichPluginOptions, createAskUserQuestionHandler, createBashHandler, createEditHandler, createGlobHandler, invokeModel, toTree };
|