zeitlich 0.2.2 → 0.2.4
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 +34 -31
- package/dist/index.cjs +330 -399
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -43
- package/dist/index.d.ts +24 -43
- package/dist/index.js +301 -373
- package/dist/index.js.map +1 -1
- package/dist/{workflow-BQf5EfNN.d.cts → workflow-PjeURKw4.d.cts} +265 -258
- package/dist/{workflow-BQf5EfNN.d.ts → workflow-PjeURKw4.d.ts} +265 -258
- package/dist/workflow.cjs +223 -281
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +2 -3
- package/dist/workflow.d.ts +2 -3
- package/dist/workflow.js +198 -258
- package/dist/workflow.js.map +1 -1
- package/package.json +3 -2
- package/src/activities.ts +0 -32
- package/src/index.ts +14 -11
- package/src/lib/model-invoker.ts +7 -1
- package/src/lib/session.ts +54 -109
- package/src/lib/thread-manager.ts +45 -37
- package/src/lib/tool-router.ts +148 -108
- package/src/lib/types.ts +35 -26
- package/src/tools/ask-user-question/handler.ts +5 -5
- package/src/tools/ask-user-question/tool.ts +3 -2
- package/src/tools/bash/bash.test.ts +12 -12
- package/src/tools/bash/handler.ts +5 -5
- 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 → subagent}/handler.ts +18 -31
- package/src/tools/{task → subagent}/tool.ts +13 -20
- package/src/tools/task-create/handler.ts +5 -11
- package/src/tools/task-create/tool.ts +3 -2
- package/src/tools/task-get/handler.ts +5 -10
- package/src/tools/task-get/tool.ts +3 -2
- package/src/tools/task-list/handler.ts +5 -10
- package/src/tools/task-list/tool.ts +3 -2
- package/src/tools/task-update/handler.ts +5 -12
- package/src/tools/task-update/tool.ts +3 -2
- package/src/tools/{write → write-file}/tool.ts +5 -6
- package/src/workflow.ts +24 -21
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +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-PjeURKw4.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 SubagentArgs, N as SubagentConfig, O as SubagentHooks, Q as SubagentInput, T as TaskCreateArgs, U as TaskGetArgs, V as TaskListArgs, W as TaskStatus, X as TaskUpdateArgs, Y as ThreadManager, Z as ThreadManagerConfig, _ as ThreadOps, $ as ToolArgs, a0 as ToolCallResult, a1 as ToolCallResultUnion, a2 as ToolDefinition, a3 as ToolHandler, a4 as ToolHandlerContext, a5 as ToolHandlerResponse, a6 as ToolHooks, a7 as ToolMap, a8 as ToolMessageContent, a9 as ToolNames, aa as ToolResult, ab as ToolResultConfig, ac as ToolRouter, ad as ToolWithHandler, ae as WorkflowTask, af as ZeitlichAgentConfig, ag as ZeitlichSession, ah as ZeitlichSharedActivities, ai as askUserQuestionTool, aj as bashTool, ak as createAgentStateManager, al as createBashToolDescription, am as createSession, an as createSharedActivities, ao as createSubagentTool, ap as createTaskCreateHandler, aq as createTaskGetHandler, ar as createTaskListHandler, as as createTaskUpdateHandler, at as createThreadManager, au as createToolRouter, av as defineSubagent, aw as defineTool, ax as editTool, ay as getStateQuery, 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, aJ as withAutoAppend, aK as writeTool } from './workflow-PjeURKw4.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';
|
|
10
11
|
import '@temporalio/common';
|
|
11
|
-
import '@temporalio/workflow';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Options for the Zeitlich plugin
|
|
@@ -55,9 +55,9 @@ declare function invokeModel({ redis, model, client, config: { threadId, agentNa
|
|
|
55
55
|
}): Promise<AgentResponse>;
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Creates handler for user interaction tool - creates AI messages for display.
|
|
59
59
|
*/
|
|
60
|
-
declare const
|
|
60
|
+
declare const createAskUserQuestionHandler: () => ActivityToolHandler<AskUserQuestionArgs, {
|
|
61
61
|
chatMessages: StoredMessage[];
|
|
62
62
|
}>;
|
|
63
63
|
|
|
@@ -68,19 +68,12 @@ interface GlobResult {
|
|
|
68
68
|
files: string[];
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
*/
|
|
73
|
-
interface GlobHandlerResponse {
|
|
74
|
-
toolResponse: string;
|
|
75
|
-
data: GlobResult;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Glob handler that searches within the scoped file tree.
|
|
71
|
+
* Creates a glob handler that searches within the scoped file tree.
|
|
79
72
|
*
|
|
80
|
-
* @param
|
|
81
|
-
* @
|
|
73
|
+
* @param fs - File system implementation for I/O operations
|
|
74
|
+
* @returns An ActivityToolHandler for glob tool calls
|
|
82
75
|
*/
|
|
83
|
-
declare function
|
|
76
|
+
declare function createGlobHandler(fs: IFileSystem): ActivityToolHandler<GlobArgs, GlobResult>;
|
|
84
77
|
|
|
85
78
|
/**
|
|
86
79
|
* Result of an edit operation
|
|
@@ -91,33 +84,21 @@ interface EditResult {
|
|
|
91
84
|
replacements: number;
|
|
92
85
|
}
|
|
93
86
|
/**
|
|
94
|
-
*
|
|
95
|
-
*/
|
|
96
|
-
interface EditHandlerResponse {
|
|
97
|
-
toolResponse: string;
|
|
98
|
-
data: EditResult;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Options for edit handler
|
|
102
|
-
*/
|
|
103
|
-
interface EditHandlerOptions {
|
|
104
|
-
/**
|
|
105
|
-
* Set of file paths that have been read in this session.
|
|
106
|
-
* Required for enforcing read-before-write policy.
|
|
107
|
-
*/
|
|
108
|
-
readFiles: Set<string>;
|
|
109
|
-
/**
|
|
110
|
-
* If true, skip the read-before-write check (not recommended)
|
|
111
|
-
*/
|
|
112
|
-
skipReadCheck?: boolean;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Edit handler that edits files within the scoped file tree.
|
|
87
|
+
* Creates an edit handler that edits files within the scoped file tree.
|
|
116
88
|
*
|
|
117
|
-
* @param
|
|
118
|
-
* @
|
|
89
|
+
* @param fs - File system implementation for I/O operations
|
|
90
|
+
* @returns An ActivityToolHandler for edit tool calls
|
|
119
91
|
*/
|
|
120
|
-
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>;
|
|
121
102
|
|
|
122
103
|
declare const toTree: (fs: IFileSystem, opts?: {
|
|
123
104
|
dir?: string;
|
|
@@ -127,4 +108,4 @@ declare const toTree: (fs: IFileSystem, opts?: {
|
|
|
127
108
|
sort?: boolean;
|
|
128
109
|
}) => Promise<string>;
|
|
129
110
|
|
|
130
|
-
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,14 +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-PjeURKw4.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 SubagentArgs, N as SubagentConfig, O as SubagentHooks, Q as SubagentInput, T as TaskCreateArgs, U as TaskGetArgs, V as TaskListArgs, W as TaskStatus, X as TaskUpdateArgs, Y as ThreadManager, Z as ThreadManagerConfig, _ as ThreadOps, $ as ToolArgs, a0 as ToolCallResult, a1 as ToolCallResultUnion, a2 as ToolDefinition, a3 as ToolHandler, a4 as ToolHandlerContext, a5 as ToolHandlerResponse, a6 as ToolHooks, a7 as ToolMap, a8 as ToolMessageContent, a9 as ToolNames, aa as ToolResult, ab as ToolResultConfig, ac as ToolRouter, ad as ToolWithHandler, ae as WorkflowTask, af as ZeitlichAgentConfig, ag as ZeitlichSession, ah as ZeitlichSharedActivities, ai as askUserQuestionTool, aj as bashTool, ak as createAgentStateManager, al as createBashToolDescription, am as createSession, an as createSharedActivities, ao as createSubagentTool, ap as createTaskCreateHandler, aq as createTaskGetHandler, ar as createTaskListHandler, as as createTaskUpdateHandler, at as createThreadManager, au as createToolRouter, av as defineSubagent, aw as defineTool, ax as editTool, ay as getStateQuery, 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, aJ as withAutoAppend, aK as writeTool } from './workflow-PjeURKw4.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';
|
|
10
11
|
import '@temporalio/common';
|
|
11
|
-
import '@temporalio/workflow';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Options for the Zeitlich plugin
|
|
@@ -55,9 +55,9 @@ declare function invokeModel({ redis, model, client, config: { threadId, agentNa
|
|
|
55
55
|
}): Promise<AgentResponse>;
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Creates handler for user interaction tool - creates AI messages for display.
|
|
59
59
|
*/
|
|
60
|
-
declare const
|
|
60
|
+
declare const createAskUserQuestionHandler: () => ActivityToolHandler<AskUserQuestionArgs, {
|
|
61
61
|
chatMessages: StoredMessage[];
|
|
62
62
|
}>;
|
|
63
63
|
|
|
@@ -68,19 +68,12 @@ interface GlobResult {
|
|
|
68
68
|
files: string[];
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
*/
|
|
73
|
-
interface GlobHandlerResponse {
|
|
74
|
-
toolResponse: string;
|
|
75
|
-
data: GlobResult;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Glob handler that searches within the scoped file tree.
|
|
71
|
+
* Creates a glob handler that searches within the scoped file tree.
|
|
79
72
|
*
|
|
80
|
-
* @param
|
|
81
|
-
* @
|
|
73
|
+
* @param fs - File system implementation for I/O operations
|
|
74
|
+
* @returns An ActivityToolHandler for glob tool calls
|
|
82
75
|
*/
|
|
83
|
-
declare function
|
|
76
|
+
declare function createGlobHandler(fs: IFileSystem): ActivityToolHandler<GlobArgs, GlobResult>;
|
|
84
77
|
|
|
85
78
|
/**
|
|
86
79
|
* Result of an edit operation
|
|
@@ -91,33 +84,21 @@ interface EditResult {
|
|
|
91
84
|
replacements: number;
|
|
92
85
|
}
|
|
93
86
|
/**
|
|
94
|
-
*
|
|
95
|
-
*/
|
|
96
|
-
interface EditHandlerResponse {
|
|
97
|
-
toolResponse: string;
|
|
98
|
-
data: EditResult;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Options for edit handler
|
|
102
|
-
*/
|
|
103
|
-
interface EditHandlerOptions {
|
|
104
|
-
/**
|
|
105
|
-
* Set of file paths that have been read in this session.
|
|
106
|
-
* Required for enforcing read-before-write policy.
|
|
107
|
-
*/
|
|
108
|
-
readFiles: Set<string>;
|
|
109
|
-
/**
|
|
110
|
-
* If true, skip the read-before-write check (not recommended)
|
|
111
|
-
*/
|
|
112
|
-
skipReadCheck?: boolean;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Edit handler that edits files within the scoped file tree.
|
|
87
|
+
* Creates an edit handler that edits files within the scoped file tree.
|
|
116
88
|
*
|
|
117
|
-
* @param
|
|
118
|
-
* @
|
|
89
|
+
* @param fs - File system implementation for I/O operations
|
|
90
|
+
* @returns An ActivityToolHandler for edit tool calls
|
|
119
91
|
*/
|
|
120
|
-
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>;
|
|
121
102
|
|
|
122
103
|
declare const toTree: (fs: IFileSystem, opts?: {
|
|
123
104
|
dir?: string;
|
|
@@ -127,4 +108,4 @@ declare const toTree: (fs: IFileSystem, opts?: {
|
|
|
127
108
|
sort?: boolean;
|
|
128
109
|
}) => Promise<string>;
|
|
129
110
|
|
|
130
|
-
export { ActivityToolHandler, AgentResponse,
|
|
111
|
+
export { ActivityToolHandler, AgentResponse, AskUserQuestionArgs, BashArgs, FileEditArgs, GlobArgs, type InvokeModelConfig, ZeitlichPlugin, type ZeitlichPluginOptions, createAskUserQuestionHandler, createBashHandler, createEditHandler, createGlobHandler, invokeModel, toTree };
|