zeitlich 0.2.2 → 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 +34 -31
- package/dist/index.cjs +305 -361
- 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 +277 -336
- package/dist/index.js.map +1 -1
- package/dist/{workflow-BQf5EfNN.d.cts → workflow-D-2vp4Pq.d.cts} +265 -241
- package/dist/{workflow-BQf5EfNN.d.ts → workflow-D-2vp4Pq.d.ts} +265 -241
- package/dist/workflow.cjs +206 -253
- 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 +182 -231
- package/dist/workflow.js.map +1 -1
- package/package.json +3 -2
- package/src/activities.ts +1 -14
- package/src/index.ts +14 -11
- package/src/lib/session.ts +56 -99
- package/src/lib/thread-manager.ts +45 -37
- package/src/lib/tool-router.ts +143 -103
- package/src/lib/types.ts +32 -25
- 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/handler.ts +2 -2
- package/src/tools/task/tool.ts +2 -9
- 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 +23 -19
|
@@ -2,27 +2,22 @@ import type {
|
|
|
2
2
|
AgentStateManager,
|
|
3
3
|
JsonSerializable,
|
|
4
4
|
} from "../../lib/state-manager";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ToolHandler } from "../../lib/tool-router";
|
|
6
6
|
import type { WorkflowTask } from "../../lib/types";
|
|
7
|
-
import type {
|
|
7
|
+
import type { TaskListArgs } from "./tool";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Creates a TaskList handler that returns all tasks.
|
|
11
11
|
*
|
|
12
12
|
* @param stateManager - State manager containing tasks state
|
|
13
|
-
* @returns A tool
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* const handler = createTaskListHandler(stateManager);
|
|
13
|
+
* @returns A ToolHandler for TaskList tool calls
|
|
17
14
|
*/
|
|
18
15
|
export function createTaskListHandler<
|
|
19
16
|
TCustom extends JsonSerializable<TCustom>,
|
|
20
17
|
>(
|
|
21
18
|
stateManager: AgentStateManager<TCustom>
|
|
22
|
-
):
|
|
23
|
-
return (
|
|
24
|
-
_args: TaskListToolSchemaType
|
|
25
|
-
): ToolHandlerResponse<WorkflowTask[]> => {
|
|
19
|
+
): ToolHandler<TaskListArgs, WorkflowTask[]> {
|
|
20
|
+
return () => {
|
|
26
21
|
const taskList = stateManager.getTasks();
|
|
27
22
|
|
|
28
23
|
return {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
+
import type { ToolDefinition } from "../../lib/tool-router";
|
|
2
3
|
|
|
3
4
|
export const taskListTool = {
|
|
4
5
|
name: "TaskList" as const,
|
|
5
6
|
description: `List all tasks with current state.`,
|
|
6
7
|
schema: z.object({}),
|
|
7
|
-
};
|
|
8
|
+
} satisfies ToolDefinition;
|
|
8
9
|
|
|
9
|
-
export type
|
|
10
|
+
export type TaskListArgs = z.infer<typeof taskListTool.schema>;
|
|
@@ -2,29 +2,22 @@ import type {
|
|
|
2
2
|
AgentStateManager,
|
|
3
3
|
JsonSerializable,
|
|
4
4
|
} from "../../lib/state-manager";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ToolHandler } from "../../lib/tool-router";
|
|
6
6
|
import type { WorkflowTask } from "../../lib/types";
|
|
7
|
-
import type {
|
|
7
|
+
import type { TaskUpdateArgs } from "./tool";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Creates a TaskUpdate handler that modifies task status and dependencies.
|
|
11
11
|
*
|
|
12
12
|
* @param stateManager - State manager containing tasks state
|
|
13
|
-
* @returns A tool
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* const handler = createTaskUpdateHandler(stateManager);
|
|
13
|
+
* @returns A ToolHandler for TaskUpdate tool calls
|
|
17
14
|
*/
|
|
18
15
|
export function createTaskUpdateHandler<
|
|
19
16
|
TCustom extends JsonSerializable<TCustom>,
|
|
20
17
|
>(
|
|
21
18
|
stateManager: AgentStateManager<TCustom>
|
|
22
|
-
):
|
|
23
|
-
args
|
|
24
|
-
) => ToolHandlerResponse<WorkflowTask | null> {
|
|
25
|
-
return (
|
|
26
|
-
args: TaskUpdateToolSchemaType
|
|
27
|
-
): ToolHandlerResponse<WorkflowTask | null> => {
|
|
19
|
+
): ToolHandler<TaskUpdateArgs, WorkflowTask | null> {
|
|
20
|
+
return (args) => {
|
|
28
21
|
const task = stateManager.getTask(args.taskId);
|
|
29
22
|
|
|
30
23
|
if (!task) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
+
import type { ToolDefinition } from "../../lib/tool-router";
|
|
2
3
|
|
|
3
4
|
export const taskUpdateTool = {
|
|
4
5
|
name: "TaskUpdate" as const,
|
|
@@ -15,6 +16,6 @@ export const taskUpdateTool = {
|
|
|
15
16
|
.array(z.string())
|
|
16
17
|
.describe("The IDs of the tasks that this task is blocking"),
|
|
17
18
|
}),
|
|
18
|
-
};
|
|
19
|
+
} satisfies ToolDefinition;
|
|
19
20
|
|
|
20
|
-
export type
|
|
21
|
+
export type TaskUpdateArgs = z.infer<typeof taskUpdateTool.schema>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import type { ToolDefinition } from "../../lib/tool-router";
|
|
2
3
|
|
|
3
4
|
export const writeTool = {
|
|
4
5
|
name: "FileWrite" as const,
|
|
5
6
|
description: `Create or overwrite a file with new content.
|
|
6
7
|
|
|
7
8
|
Usage:
|
|
8
|
-
- Provide the absolute
|
|
9
|
+
- Provide the absolute path to the file
|
|
9
10
|
- The file will be created if it doesn't exist
|
|
10
11
|
- If the file exists, it will be completely overwritten
|
|
11
12
|
|
|
@@ -15,12 +16,10 @@ IMPORTANT:
|
|
|
15
16
|
- Path must be absolute (e.g., "/docs/readme.md", not "docs/readme.md")
|
|
16
17
|
`,
|
|
17
18
|
schema: z.object({
|
|
18
|
-
file_path: z
|
|
19
|
-
.string()
|
|
20
|
-
.describe("The absolute virtual path to the file to write"),
|
|
19
|
+
file_path: z.string().describe("The absolute path to the file to write"),
|
|
21
20
|
content: z.string().describe("The content to write to the file"),
|
|
22
21
|
}),
|
|
23
22
|
strict: true,
|
|
24
|
-
};
|
|
23
|
+
} satisfies ToolDefinition;
|
|
25
24
|
|
|
26
|
-
export type
|
|
25
|
+
export type FileWriteArgs = z.infer<typeof writeTool.schema>;
|
package/src/workflow.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
// Session
|
|
19
|
-
export { createSession } from "./lib/session";
|
|
19
|
+
export { createSession, proxyDefaultThreadOps } from "./lib/session";
|
|
20
20
|
export type { ZeitlichSession, SessionLifecycleHooks } from "./lib/session";
|
|
21
21
|
|
|
22
22
|
// State management
|
|
@@ -33,7 +33,12 @@ export type {
|
|
|
33
33
|
} from "./lib/state-manager";
|
|
34
34
|
|
|
35
35
|
// Tool router (includes registry functionality)
|
|
36
|
-
export {
|
|
36
|
+
export {
|
|
37
|
+
createToolRouter,
|
|
38
|
+
hasNoOtherToolCalls,
|
|
39
|
+
defineTool,
|
|
40
|
+
defineSubagent,
|
|
41
|
+
} from "./lib/tool-router";
|
|
37
42
|
export type {
|
|
38
43
|
// Tool definition types
|
|
39
44
|
ToolDefinition,
|
|
@@ -68,6 +73,7 @@ export type {
|
|
|
68
73
|
BaseAgentState,
|
|
69
74
|
AgentFile,
|
|
70
75
|
AgentResponse,
|
|
76
|
+
ThreadOps,
|
|
71
77
|
ZeitlichAgentConfig,
|
|
72
78
|
RunAgentConfig,
|
|
73
79
|
RunAgentActivity,
|
|
@@ -96,10 +102,7 @@ export { isTerminalStatus } from "./lib/types";
|
|
|
96
102
|
|
|
97
103
|
// Subagent support
|
|
98
104
|
export { createTaskTool } from "./tools/task/tool";
|
|
99
|
-
export type {
|
|
100
|
-
TaskToolSchemaType,
|
|
101
|
-
GenericTaskToolSchemaType,
|
|
102
|
-
} from "./tools/task/tool";
|
|
105
|
+
export type { TaskArgs } from "./tools/task/tool";
|
|
103
106
|
export type { TaskHandlerResult } from "./tools/task/handler";
|
|
104
107
|
|
|
105
108
|
// Activity type interfaces (types only, no runtime code)
|
|
@@ -108,33 +111,34 @@ export type { ZeitlichSharedActivities } from "./activities";
|
|
|
108
111
|
|
|
109
112
|
// Tool definitions (schemas only - no handlers)
|
|
110
113
|
export { askUserQuestionTool } from "./tools/ask-user-question/tool";
|
|
111
|
-
export type {
|
|
114
|
+
export type { AskUserQuestionArgs } from "./tools/ask-user-question/tool";
|
|
112
115
|
export { globTool } from "./tools/glob/tool";
|
|
113
|
-
export type {
|
|
116
|
+
export type { GlobArgs } from "./tools/glob/tool";
|
|
114
117
|
export { grepTool } from "./tools/grep/tool";
|
|
115
|
-
export type {
|
|
116
|
-
export { readTool } from "./tools/read/tool";
|
|
117
|
-
export type {
|
|
118
|
-
export { writeTool } from "./tools/write/tool";
|
|
119
|
-
export type {
|
|
118
|
+
export type { GrepArgs } from "./tools/grep/tool";
|
|
119
|
+
export { readTool } from "./tools/read-file/tool";
|
|
120
|
+
export type { FileReadArgs } from "./tools/read-file/tool";
|
|
121
|
+
export { writeTool } from "./tools/write-file/tool";
|
|
122
|
+
export type { FileWriteArgs } from "./tools/write-file/tool";
|
|
120
123
|
export { editTool } from "./tools/edit/tool";
|
|
121
|
-
export type {
|
|
124
|
+
export type { FileEditArgs } from "./tools/edit/tool";
|
|
122
125
|
|
|
123
126
|
// Workflow task tools (state-only, no activities needed)
|
|
124
127
|
export { taskCreateTool } from "./tools/task-create/tool";
|
|
125
|
-
export type {
|
|
128
|
+
export type { TaskCreateArgs } from "./tools/task-create/tool";
|
|
126
129
|
export { createTaskCreateHandler } from "./tools/task-create/handler";
|
|
127
130
|
|
|
128
131
|
export { taskGetTool } from "./tools/task-get/tool";
|
|
129
|
-
export type {
|
|
132
|
+
export type { TaskGetArgs } from "./tools/task-get/tool";
|
|
130
133
|
export { createTaskGetHandler } from "./tools/task-get/handler";
|
|
131
134
|
|
|
132
135
|
export { taskListTool } from "./tools/task-list/tool";
|
|
136
|
+
export type { TaskListArgs } from "./tools/task-list/tool";
|
|
133
137
|
export { createTaskListHandler } from "./tools/task-list/handler";
|
|
134
138
|
|
|
135
139
|
export { taskUpdateTool } from "./tools/task-update/tool";
|
|
136
|
-
export type {
|
|
140
|
+
export type { TaskUpdateArgs } from "./tools/task-update/tool";
|
|
137
141
|
export { createTaskUpdateHandler } from "./tools/task-update/handler";
|
|
138
142
|
|
|
139
|
-
export { bashTool } from "./tools/bash/tool";
|
|
140
|
-
export type {
|
|
143
|
+
export { bashTool, createBashToolDescription } from "./tools/bash/tool";
|
|
144
|
+
export type { BashArgs } from "./tools/bash/tool";
|