zeitlich 0.1.0
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/LICENSE +21 -0
- package/README.md +494 -0
- package/dist/index.d.mts +152 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.js +1623 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1582 -0
- package/dist/index.mjs.map +1 -0
- package/dist/workflow-DeVGEXSc.d.mts +1201 -0
- package/dist/workflow-DeVGEXSc.d.ts +1201 -0
- package/dist/workflow.d.mts +4 -0
- package/dist/workflow.d.ts +4 -0
- package/dist/workflow.js +762 -0
- package/dist/workflow.js.map +1 -0
- package/dist/workflow.mjs +734 -0
- package/dist/workflow.mjs.map +1 -0
- package/package.json +92 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { T as ToolDefinition, I as InvocationConfig, A as AgentResponse, a as ActivityToolHandler, b as AskUserQuestionToolSchemaType, F as FileSystemProvider, c as FileNode, G as GlobToolSchemaType, d as GrepToolSchemaType, e as GrepMatch, R as ReadToolSchemaType, f as FileContent, W as WriteToolSchemaType, E as EditToolSchemaType } from './workflow-DeVGEXSc.js';
|
|
2
|
+
export { g as AGENT_HANDLER_NAMES, h as AgentFile, i as AgentState, j as AgentStateManager, k as AgentStateManagerConfig, l as AgentStatus, m as AppendToolResultFn, B as BackendConfig, n as BaseAgentState, o as BaseFileSystemProvider, C as CompositeFileSystemProvider, p as FileResolver, q as FileSystemToolsConfig, r as FileTreeRenderOptions, s as GenericTaskToolSchemaType, t as GrepOptions, u as InMemoryFileSystemProvider, J as JsonPrimitive, v as JsonSerializable, w as JsonValue, P as ParsedToolCall, x as ParsedToolCallUnion, y as PostToolUseFailureHook, z as PostToolUseFailureHookContext, D as PostToolUseFailureHookResult, H as PostToolUseHook, K as PostToolUseHookContext, L as PreToolUseHook, M as PreToolUseHookContext, N as PreToolUseHookResult, O as ProcessToolCallsContext, Q as PromptManager, S as PromptManagerConfig, U as RawToolCall, V as RunAgentActivity, X as RunAgentConfig, Y as SessionEndHook, Z as SessionEndHookContext, _ as SessionExitReason, $ as SessionHooks, a0 as SessionLifecycleHooks, a1 as SessionStartHook, a2 as SessionStartHookContext, a3 as SubagentConfig, a4 as SubagentInput, a5 as SubagentSupportConfig, a6 as SubagentSupportResult, a7 as TaskHandlerResult, a8 as TaskToolSchemaType, a9 as ToolCallResult, aa as ToolCallResultUnion, ab as ToolHandler, ac as ToolHandlerMap, ad as ToolHandlerResponse, ae as ToolMap, af as ToolMessageContent, ag as ToolNames, ah as ToolRegistry, ai as ToolResultConfig, aj as ToolRouter, ak as ToolRouterHooks, al as ToolRouterOptions, am as ZeitlichAgentConfig, an as ZeitlichSession, ao as ZeitlichSharedActivities, ap as askUserQuestionTool, aq as buildFileTreePrompt, ar as createAgentStateManager, as as createPromptManager, at as createSession, au as createSharedActivities, av as createTaskHandler, aw as createTaskTool, ax as createToolRegistry, ay as createToolRouter, az as editTool, aA as fileContentToMessageContent, aB as findNodeByPath, aC as flattenFileTree, aD as globTool, aE as grepTool, aF as hasNoOtherToolCalls, aG as hasTaskTool, aH as isPathInScope, aI as isTerminalStatus, aJ as readTool, aK as withSubagentSupport, aL as writeTool } from './workflow-DeVGEXSc.js';
|
|
3
|
+
import { SimplePlugin } from '@temporalio/plugin';
|
|
4
|
+
import Redis from 'ioredis';
|
|
5
|
+
import { BaseChatModel, BaseChatModelCallOptions, BindToolsInput } from '@langchain/core/language_models/chat_models';
|
|
6
|
+
import { StoredMessage, ContentBlock } from '@langchain/core/messages';
|
|
7
|
+
import 'zod';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Options for the Zeitlich plugin
|
|
11
|
+
*
|
|
12
|
+
* @experimental The Zeitlich plugin is an experimental feature; APIs may change without notice.
|
|
13
|
+
*/
|
|
14
|
+
interface ZeitlichPluginOptions {
|
|
15
|
+
redis: Redis;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A Temporal plugin that integrates Zeitlich for use in workflows.
|
|
19
|
+
* This plugin creates shared activities for thread management.
|
|
20
|
+
* Workflow-specific activities (like runAgent) should be created separately.
|
|
21
|
+
*
|
|
22
|
+
* @experimental The Zeitlich plugin is an experimental feature; APIs may change without notice.
|
|
23
|
+
*/
|
|
24
|
+
declare class ZeitlichPlugin extends SimplePlugin {
|
|
25
|
+
constructor(options: ZeitlichPluginOptions);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Configuration for invoking the model
|
|
30
|
+
*/
|
|
31
|
+
interface InvokeModelConfig {
|
|
32
|
+
threadId: string;
|
|
33
|
+
agentName: string;
|
|
34
|
+
tools: ToolDefinition[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Core model invocation logic - shared utility for workflow-specific activities
|
|
38
|
+
*
|
|
39
|
+
* @param redis - Redis client for thread management
|
|
40
|
+
* @param config - Model invocation configuration
|
|
41
|
+
* @param model - Pre-instantiated LangChain chat model
|
|
42
|
+
* @param invocationConfig - Per-invocation configuration (system prompt, etc.)
|
|
43
|
+
* @returns Agent response with message and metadata
|
|
44
|
+
*/
|
|
45
|
+
declare function invokeModel(redis: Redis, { threadId, agentName, tools }: InvokeModelConfig, model: BaseChatModel<BaseChatModelCallOptions & {
|
|
46
|
+
tools?: BindToolsInput;
|
|
47
|
+
}>, { systemPrompt }: InvocationConfig): Promise<AgentResponse>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Handle user interaction tool result - creates AI messages for display.
|
|
51
|
+
*/
|
|
52
|
+
declare const handleAskUserQuestionToolResult: ActivityToolHandler<AskUserQuestionToolSchemaType, {
|
|
53
|
+
chatMessages: StoredMessage[];
|
|
54
|
+
}>;
|
|
55
|
+
|
|
56
|
+
interface GlobHandlerConfig {
|
|
57
|
+
provider: FileSystemProvider;
|
|
58
|
+
scopedNodes: FileNode[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a glob handler that searches within the scoped file tree.
|
|
62
|
+
*/
|
|
63
|
+
declare function createGlobHandler(config: GlobHandlerConfig): (args: GlobToolSchemaType) => Promise<{
|
|
64
|
+
content: string;
|
|
65
|
+
result: {
|
|
66
|
+
files: FileNode[];
|
|
67
|
+
};
|
|
68
|
+
}>;
|
|
69
|
+
|
|
70
|
+
interface GrepHandlerConfig {
|
|
71
|
+
provider: FileSystemProvider;
|
|
72
|
+
scopedNodes: FileNode[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create a grep handler that searches within the scoped file tree.
|
|
76
|
+
*/
|
|
77
|
+
declare function createGrepHandler(config: GrepHandlerConfig): (args: GrepToolSchemaType) => Promise<{
|
|
78
|
+
content: string;
|
|
79
|
+
result: {
|
|
80
|
+
matches: GrepMatch[];
|
|
81
|
+
};
|
|
82
|
+
}>;
|
|
83
|
+
|
|
84
|
+
interface ReadHandlerConfig {
|
|
85
|
+
provider: FileSystemProvider;
|
|
86
|
+
scopedNodes: FileNode[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Create a read handler that reads files within the scoped file tree.
|
|
90
|
+
*/
|
|
91
|
+
declare function createReadHandler(config: ReadHandlerConfig): (args: ReadToolSchemaType) => Promise<{
|
|
92
|
+
content: ContentBlock[];
|
|
93
|
+
result: {
|
|
94
|
+
path: string;
|
|
95
|
+
content: FileContent;
|
|
96
|
+
};
|
|
97
|
+
}>;
|
|
98
|
+
|
|
99
|
+
interface WriteHandlerConfig {
|
|
100
|
+
provider: FileSystemProvider;
|
|
101
|
+
scopedNodes: FileNode[];
|
|
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
|
+
interface WriteResult {
|
|
113
|
+
path: string;
|
|
114
|
+
success: boolean;
|
|
115
|
+
created: boolean;
|
|
116
|
+
bytesWritten: number;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Create a write handler that writes files within the scoped file tree.
|
|
120
|
+
*/
|
|
121
|
+
declare function createWriteHandler(config: WriteHandlerConfig): (args: WriteToolSchemaType) => Promise<{
|
|
122
|
+
content: string;
|
|
123
|
+
result: WriteResult;
|
|
124
|
+
}>;
|
|
125
|
+
|
|
126
|
+
interface EditHandlerConfig {
|
|
127
|
+
provider: FileSystemProvider;
|
|
128
|
+
scopedNodes: FileNode[];
|
|
129
|
+
/**
|
|
130
|
+
* Set of file paths that have been read in this session.
|
|
131
|
+
* Required for enforcing read-before-write policy.
|
|
132
|
+
*/
|
|
133
|
+
readFiles: Set<string>;
|
|
134
|
+
/**
|
|
135
|
+
* If true, skip the read-before-write check (not recommended)
|
|
136
|
+
*/
|
|
137
|
+
skipReadCheck?: boolean;
|
|
138
|
+
}
|
|
139
|
+
interface EditResult {
|
|
140
|
+
path: string;
|
|
141
|
+
success: boolean;
|
|
142
|
+
replacements: number;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Create an edit handler that edits files within the scoped file tree.
|
|
146
|
+
*/
|
|
147
|
+
declare function createEditHandler(config: EditHandlerConfig): (args: EditToolSchemaType) => Promise<{
|
|
148
|
+
content: string;
|
|
149
|
+
result: EditResult;
|
|
150
|
+
}>;
|
|
151
|
+
|
|
152
|
+
export { ActivityToolHandler, AgentResponse, AskUserQuestionToolSchemaType, type EditHandlerConfig, type EditResult, EditToolSchemaType, FileContent, FileNode, FileSystemProvider, type GlobHandlerConfig, GlobToolSchemaType, type GrepHandlerConfig, GrepMatch, GrepToolSchemaType, InvocationConfig, type InvokeModelConfig, type ReadHandlerConfig, ReadToolSchemaType, ToolDefinition, type WriteHandlerConfig, type WriteResult, WriteToolSchemaType, ZeitlichPlugin, type ZeitlichPluginOptions, createEditHandler, createGlobHandler, createGrepHandler, createReadHandler, createWriteHandler, handleAskUserQuestionToolResult, invokeModel };
|