zeitlich 0.2.32 → 0.2.33
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 +11 -10
- package/dist/{activities-FIXVz7DT.d.ts → activities-YBD5BaHh.d.ts} +4 -3
- package/dist/{activities-DA-bQM12.d.cts → activities-fnX8-vhR.d.cts} +4 -3
- package/dist/adapters/thread/anthropic/index.cjs +18 -2
- package/dist/adapters/thread/anthropic/index.cjs.map +1 -1
- package/dist/adapters/thread/anthropic/index.d.cts +7 -6
- package/dist/adapters/thread/anthropic/index.d.ts +7 -6
- package/dist/adapters/thread/anthropic/index.js +18 -2
- package/dist/adapters/thread/anthropic/index.js.map +1 -1
- package/dist/adapters/thread/google-genai/index.cjs +29 -8
- package/dist/adapters/thread/google-genai/index.cjs.map +1 -1
- package/dist/adapters/thread/google-genai/index.d.cts +5 -5
- package/dist/adapters/thread/google-genai/index.d.ts +5 -5
- package/dist/adapters/thread/google-genai/index.js +29 -8
- package/dist/adapters/thread/google-genai/index.js.map +1 -1
- package/dist/adapters/thread/google-genai/workflow.d.cts +1 -1
- package/dist/adapters/thread/google-genai/workflow.d.ts +1 -1
- package/dist/adapters/thread/langchain/index.cjs +42 -23
- package/dist/adapters/thread/langchain/index.cjs.map +1 -1
- package/dist/adapters/thread/langchain/index.d.cts +8 -6
- package/dist/adapters/thread/langchain/index.d.ts +8 -6
- package/dist/adapters/thread/langchain/index.js +42 -23
- package/dist/adapters/thread/langchain/index.js.map +1 -1
- package/dist/index.cjs +34 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -9
- package/dist/index.d.ts +24 -9
- package/dist/index.js +33 -5
- package/dist/index.js.map +1 -1
- package/dist/{workflow-D8wK7TJY.d.ts → workflow-D9nNERvs.d.ts} +30 -2
- package/dist/{workflow-BWKQcz9d.d.cts → workflow-Od9vx5Jk.d.cts} +30 -2
- package/dist/workflow.cjs +18 -0
- 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 +18 -1
- package/dist/workflow.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/thread/anthropic/activities.ts +4 -3
- package/src/adapters/thread/anthropic/model-invoker.ts +15 -5
- package/src/adapters/thread/google-genai/activities.ts +4 -3
- package/src/adapters/thread/google-genai/model-invoker.ts +24 -11
- package/src/adapters/thread/langchain/activities.ts +3 -3
- package/src/adapters/thread/langchain/model-invoker.ts +63 -34
- package/src/index.ts +1 -0
- package/src/lib/activity.ts +36 -9
- package/src/lib/model/helpers.ts +1 -0
- package/src/lib/model/index.ts +1 -0
- package/src/lib/model/proxy.ts +50 -0
- package/src/workflow.ts +3 -0
- package/src/lib/.env +0 -1
- package/src/tools/bash/.env +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BashArgs, F as FileEditArgs, G as GlobArgs, a as FileReadArgs, b as FileWriteArgs } from './workflow-
|
|
2
|
-
export { A as AskUserQuestionArgs, c as FileTreeAccessor, d as GrepArgs, O as ObservabilityHooks, R as ReadSkillArgs, S as SessionEndedEvent, e as SessionStartedEvent, f as SubagentArgs, T as TaskCreateArgs, g as TaskGetArgs, h as TaskListArgs, i as TaskUpdateArgs, j as ToolExecutedEvent, k as TurnCompletedEvent, W as WorkflowConfig, l as WorkflowInput, m as WorkflowSessionInput, Z as ZeitlichObservabilitySinks, n as applyVirtualTreeMutations, o as askUserQuestionTool, p as bashTool, q as composeHooks, r as createAgentStateManager, s as createAskUserQuestionHandler, t as createBashToolDescription, u as createObservabilityHooks, v as createReadSkillHandler, w as createReadSkillTool, x as createSession, y as createTaskCreateHandler, z as createTaskGetHandler, C as createTaskListHandler, D as createTaskUpdateHandler, E as createToolRouter, H as defineSubagent, I as defineSubagentWorkflow, J as defineTool, K as defineWorkflow, L as editTool, M as filesWithMimeType, N as formatVirtualFileTree, P as getShortId, Q as globTool, U as grepTool, V as hasDirectory, X as hasFileWithMimeType, Y as hasNoOtherToolCalls, _ as parseSkillFile, $ as
|
|
1
|
+
import { B as BashArgs, F as FileEditArgs, G as GlobArgs, a as FileReadArgs, b as FileWriteArgs } from './workflow-Od9vx5Jk.cjs';
|
|
2
|
+
export { A as AskUserQuestionArgs, c as FileTreeAccessor, d as GrepArgs, O as ObservabilityHooks, R as ReadSkillArgs, S as SessionEndedEvent, e as SessionStartedEvent, f as SubagentArgs, T as TaskCreateArgs, g as TaskGetArgs, h as TaskListArgs, i as TaskUpdateArgs, j as ToolExecutedEvent, k as TurnCompletedEvent, W as WorkflowConfig, l as WorkflowInput, m as WorkflowSessionInput, Z as ZeitlichObservabilitySinks, n as applyVirtualTreeMutations, o as askUserQuestionTool, p as bashTool, q as composeHooks, r as createAgentStateManager, s as createAskUserQuestionHandler, t as createBashToolDescription, u as createObservabilityHooks, v as createReadSkillHandler, w as createReadSkillTool, x as createSession, y as createTaskCreateHandler, z as createTaskGetHandler, C as createTaskListHandler, D as createTaskUpdateHandler, E as createToolRouter, H as defineSubagent, I as defineSubagentWorkflow, J as defineTool, K as defineWorkflow, L as editTool, M as filesWithMimeType, N as formatVirtualFileTree, P as getShortId, Q as globTool, U as grepTool, V as hasDirectory, X as hasFileWithMimeType, Y as hasNoOtherToolCalls, _ as parseSkillFile, $ as proxyRunAgent, a0 as proxyVirtualFsOps, a1 as readFileTool, a2 as taskCreateTool, a3 as taskGetTool, a4 as taskListTool, a5 as taskUpdateTool, a6 as writeFileTool } from './workflow-Od9vx5Jk.cjs';
|
|
3
3
|
import { R as RouterContext, d as ToolResultConfig, c as ActivityToolHandler, J as JsonValue, b as ToolHandlerResponse, B as BaseAgentState, e as RunAgentConfig, f as SkillProvider, g as SkillMetadata, h as Skill, F as FileEntryMetadata, i as FileResolver, V as VirtualFsContext, j as TreeMutation, k as PrefixedVirtualFsOps } from './types-Bpq5fDI5.cjs';
|
|
4
4
|
export { l as AgentConfig, m as AgentFile, A as AgentResponse, n as AgentState, o as AgentStateManager, p as AgentStatus, q as AppendToolResultFn, r as FileEntry, H as Hooks, I as InferToolResults, s as JsonPrimitive, t as JsonSerializable, a as ModelInvoker, M as ModelInvokerConfig, u as ParsedToolCall, v as ParsedToolCallUnion, w as PostHumanMessageAppendHook, x as PostHumanMessageAppendHookContext, y as PostToolUseFailureHook, z as PostToolUseFailureHookContext, C as PostToolUseFailureHookResult, D as PostToolUseHook, E as PostToolUseHookContext, G as PreHumanMessageAppendHook, K as PreHumanMessageAppendHookContext, L as PreToolUseHook, N as PreToolUseHookContext, O as PreToolUseHookResult, P as PrefixedThreadOps, Q as ProcessToolCallsContext, U as RawToolCall, W as RunAgentActivity, X as SandboxInit, Y as SandboxShutdown, S as ScopedPrefix, Z as SerializableToolDefinition, _ as SessionConfig, $ as SessionEndHook, a0 as SessionEndHookContext, a1 as SessionExitReason, a2 as SessionResult, a3 as SessionStartHook, a4 as SessionStartHookContext, a5 as SubagentConfig, a6 as SubagentDefinition, a7 as SubagentFnResult, a8 as SubagentHandlerResponse, a9 as SubagentHooks, aa as SubagentSandboxConfig, ab as SubagentSandboxShutdown, ac as SubagentSessionInput, ad as SubagentWorkflow, ae as SubagentWorkflowInput, af as TaskStatus, ag as ThreadInit, T as ThreadOps, ah as TokenUsage, ai as ToolArgs, aj as ToolCallResult, ak as ToolCallResultUnion, al as ToolDefinition, am as ToolHandler, an as ToolHooks, ao as ToolMap, ap as ToolNames, aq as ToolResult, ar as ToolRouter, as as ToolRouterHooks, at as ToolWithHandler, au as VirtualFileSystem, av as VirtualFileTree, aw as VirtualFsOps, ax as VirtualFsState, ay as WorkflowTask, az as ZeitlichSession, aA as isTerminalStatus } from './types-Bpq5fDI5.cjs';
|
|
5
5
|
import { S as Sandbox, a as SandboxFileSystem, d as SandboxCreateOptions, b as SandboxProvider, f as SandboxSnapshot, P as PrefixedSandboxOps, F as FileStat, D as DirentEntry, E as ExecResult } from './types-AujBIMMn.cjs';
|
|
@@ -97,27 +97,42 @@ declare function withSandbox<TArgs, TResult, TSandbox extends Sandbox = Sandbox,
|
|
|
97
97
|
sandboxId: string;
|
|
98
98
|
}) => Promise<ToolHandlerResponse<TResult, TToolResponse>>): ActivityToolHandler<TArgs, TResult | null, RouterContext, TToolResponse | string>;
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Safely retrieve Temporal activity heartbeat and cancellation signal.
|
|
102
|
+
* Returns empty object when called outside a Temporal activity (e.g. tests).
|
|
103
|
+
*/
|
|
104
|
+
declare function getActivityContext(): {
|
|
105
|
+
heartbeat?: () => void;
|
|
106
|
+
signal?: AbortSignal;
|
|
107
|
+
};
|
|
100
108
|
/**
|
|
101
109
|
* Query the parent workflow's state from within an activity.
|
|
102
110
|
* Resolves the workflow handle from the current activity context.
|
|
103
111
|
*/
|
|
104
112
|
declare function queryParentWorkflowState<T>(client: WorkflowClient): Promise<T>;
|
|
105
113
|
/**
|
|
106
|
-
* Wraps a handler into a `RunAgentActivity` by auto-fetching
|
|
107
|
-
* workflow's agent state before each invocation.
|
|
114
|
+
* Wraps a handler into a scope-prefixed `RunAgentActivity` by auto-fetching
|
|
115
|
+
* the parent workflow's agent state before each invocation.
|
|
116
|
+
*
|
|
117
|
+
* Returns a `Record` with a single key `run<Scope>` so it can be spread
|
|
118
|
+
* into the activities object alongside adapter activities.
|
|
119
|
+
*
|
|
120
|
+
* @param scope - Workflow scope used to derive the activity name.
|
|
121
|
+
* `"myAgentWorkflow"` produces `{ runMyAgentWorkflow: fn }`.
|
|
108
122
|
*
|
|
109
123
|
* @example
|
|
110
124
|
* ```typescript
|
|
111
125
|
* import { createRunAgentActivity } from 'zeitlich';
|
|
112
|
-
* import { createLangChainModelInvoker } from 'zeitlich/adapters/thread/langchain';
|
|
113
126
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
127
|
+
* return {
|
|
128
|
+
* ...adapter.createActivities("myAgentWorkflow"),
|
|
129
|
+
* ...createRunAgentActivity(client, adapter.invoker, "myAgentWorkflow"),
|
|
130
|
+
* };
|
|
116
131
|
* ```
|
|
117
132
|
*/
|
|
118
133
|
declare function createRunAgentActivity<R, S extends BaseAgentState = BaseAgentState>(client: WorkflowClient, handler: (config: RunAgentConfig & {
|
|
119
134
|
state: S;
|
|
120
|
-
}) => Promise<R
|
|
135
|
+
}) => Promise<R>, scope: string): Record<string, (config: RunAgentConfig) => Promise<R>>;
|
|
121
136
|
/**
|
|
122
137
|
* Context injected into tool handlers created via {@link withParentWorkflowState}.
|
|
123
138
|
*/
|
|
@@ -496,4 +511,4 @@ declare const toTree: (fs: SandboxFileSystem, opts?: {
|
|
|
496
511
|
sort?: boolean;
|
|
497
512
|
}) => Promise<string>;
|
|
498
513
|
|
|
499
|
-
export { ActivityToolHandler, type AgentStateContext, BaseAgentState, BaseThreadManager, BashArgs, ExecResult, FileEditArgs, FileEntryMetadata, FileReadArgs, FileResolver, FileSystemSkillProvider, FileWriteArgs, GlobArgs, JsonValue, NodeFsSandboxFileSystem, type PreCreateHookResult, PrefixedSandboxOps, PrefixedVirtualFsOps, RouterContext, RunAgentConfig, Sandbox, type SandboxContext, SandboxCreateOptions, DirentEntry as SandboxDirentEntry, FileStat as SandboxFileStat, SandboxFileSystem, SandboxManager, type SandboxManagerHooks, SandboxProvider, SandboxSnapshot, Skill, SkillMetadata, SkillProvider, ThreadManagerConfig, ToolHandlerResponse, ToolResultConfig, TreeMutation, VirtualFsContext, bashHandler, createRunAgentActivity, createThreadManager, createVirtualFsActivities, editHandler, globHandler, queryParentWorkflowState, readFileHandler, toTree, withAutoAppend, withParentWorkflowState, withSandbox, withVirtualFs, writeFileHandler };
|
|
514
|
+
export { ActivityToolHandler, type AgentStateContext, BaseAgentState, BaseThreadManager, BashArgs, ExecResult, FileEditArgs, FileEntryMetadata, FileReadArgs, FileResolver, FileSystemSkillProvider, FileWriteArgs, GlobArgs, JsonValue, NodeFsSandboxFileSystem, type PreCreateHookResult, PrefixedSandboxOps, PrefixedVirtualFsOps, RouterContext, RunAgentConfig, Sandbox, type SandboxContext, SandboxCreateOptions, DirentEntry as SandboxDirentEntry, FileStat as SandboxFileStat, SandboxFileSystem, SandboxManager, type SandboxManagerHooks, SandboxProvider, SandboxSnapshot, Skill, SkillMetadata, SkillProvider, ThreadManagerConfig, ToolHandlerResponse, ToolResultConfig, TreeMutation, VirtualFsContext, bashHandler, createRunAgentActivity, createThreadManager, createVirtualFsActivities, editHandler, getActivityContext, globHandler, queryParentWorkflowState, readFileHandler, toTree, withAutoAppend, withParentWorkflowState, withSandbox, withVirtualFs, writeFileHandler };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BashArgs, F as FileEditArgs, G as GlobArgs, a as FileReadArgs, b as FileWriteArgs } from './workflow-
|
|
2
|
-
export { A as AskUserQuestionArgs, c as FileTreeAccessor, d as GrepArgs, O as ObservabilityHooks, R as ReadSkillArgs, S as SessionEndedEvent, e as SessionStartedEvent, f as SubagentArgs, T as TaskCreateArgs, g as TaskGetArgs, h as TaskListArgs, i as TaskUpdateArgs, j as ToolExecutedEvent, k as TurnCompletedEvent, W as WorkflowConfig, l as WorkflowInput, m as WorkflowSessionInput, Z as ZeitlichObservabilitySinks, n as applyVirtualTreeMutations, o as askUserQuestionTool, p as bashTool, q as composeHooks, r as createAgentStateManager, s as createAskUserQuestionHandler, t as createBashToolDescription, u as createObservabilityHooks, v as createReadSkillHandler, w as createReadSkillTool, x as createSession, y as createTaskCreateHandler, z as createTaskGetHandler, C as createTaskListHandler, D as createTaskUpdateHandler, E as createToolRouter, H as defineSubagent, I as defineSubagentWorkflow, J as defineTool, K as defineWorkflow, L as editTool, M as filesWithMimeType, N as formatVirtualFileTree, P as getShortId, Q as globTool, U as grepTool, V as hasDirectory, X as hasFileWithMimeType, Y as hasNoOtherToolCalls, _ as parseSkillFile, $ as
|
|
1
|
+
import { B as BashArgs, F as FileEditArgs, G as GlobArgs, a as FileReadArgs, b as FileWriteArgs } from './workflow-D9nNERvs.js';
|
|
2
|
+
export { A as AskUserQuestionArgs, c as FileTreeAccessor, d as GrepArgs, O as ObservabilityHooks, R as ReadSkillArgs, S as SessionEndedEvent, e as SessionStartedEvent, f as SubagentArgs, T as TaskCreateArgs, g as TaskGetArgs, h as TaskListArgs, i as TaskUpdateArgs, j as ToolExecutedEvent, k as TurnCompletedEvent, W as WorkflowConfig, l as WorkflowInput, m as WorkflowSessionInput, Z as ZeitlichObservabilitySinks, n as applyVirtualTreeMutations, o as askUserQuestionTool, p as bashTool, q as composeHooks, r as createAgentStateManager, s as createAskUserQuestionHandler, t as createBashToolDescription, u as createObservabilityHooks, v as createReadSkillHandler, w as createReadSkillTool, x as createSession, y as createTaskCreateHandler, z as createTaskGetHandler, C as createTaskListHandler, D as createTaskUpdateHandler, E as createToolRouter, H as defineSubagent, I as defineSubagentWorkflow, J as defineTool, K as defineWorkflow, L as editTool, M as filesWithMimeType, N as formatVirtualFileTree, P as getShortId, Q as globTool, U as grepTool, V as hasDirectory, X as hasFileWithMimeType, Y as hasNoOtherToolCalls, _ as parseSkillFile, $ as proxyRunAgent, a0 as proxyVirtualFsOps, a1 as readFileTool, a2 as taskCreateTool, a3 as taskGetTool, a4 as taskListTool, a5 as taskUpdateTool, a6 as writeFileTool } from './workflow-D9nNERvs.js';
|
|
3
3
|
import { R as RouterContext, d as ToolResultConfig, c as ActivityToolHandler, J as JsonValue, b as ToolHandlerResponse, B as BaseAgentState, e as RunAgentConfig, f as SkillProvider, g as SkillMetadata, h as Skill, F as FileEntryMetadata, i as FileResolver, V as VirtualFsContext, j as TreeMutation, k as PrefixedVirtualFsOps } from './types-CheCTLeV.js';
|
|
4
4
|
export { l as AgentConfig, m as AgentFile, A as AgentResponse, n as AgentState, o as AgentStateManager, p as AgentStatus, q as AppendToolResultFn, r as FileEntry, H as Hooks, I as InferToolResults, s as JsonPrimitive, t as JsonSerializable, a as ModelInvoker, M as ModelInvokerConfig, u as ParsedToolCall, v as ParsedToolCallUnion, w as PostHumanMessageAppendHook, x as PostHumanMessageAppendHookContext, y as PostToolUseFailureHook, z as PostToolUseFailureHookContext, C as PostToolUseFailureHookResult, D as PostToolUseHook, E as PostToolUseHookContext, G as PreHumanMessageAppendHook, K as PreHumanMessageAppendHookContext, L as PreToolUseHook, N as PreToolUseHookContext, O as PreToolUseHookResult, P as PrefixedThreadOps, Q as ProcessToolCallsContext, U as RawToolCall, W as RunAgentActivity, X as SandboxInit, Y as SandboxShutdown, S as ScopedPrefix, Z as SerializableToolDefinition, _ as SessionConfig, $ as SessionEndHook, a0 as SessionEndHookContext, a1 as SessionExitReason, a2 as SessionResult, a3 as SessionStartHook, a4 as SessionStartHookContext, a5 as SubagentConfig, a6 as SubagentDefinition, a7 as SubagentFnResult, a8 as SubagentHandlerResponse, a9 as SubagentHooks, aa as SubagentSandboxConfig, ab as SubagentSandboxShutdown, ac as SubagentSessionInput, ad as SubagentWorkflow, ae as SubagentWorkflowInput, af as TaskStatus, ag as ThreadInit, T as ThreadOps, ah as TokenUsage, ai as ToolArgs, aj as ToolCallResult, ak as ToolCallResultUnion, al as ToolDefinition, am as ToolHandler, an as ToolHooks, ao as ToolMap, ap as ToolNames, aq as ToolResult, ar as ToolRouter, as as ToolRouterHooks, at as ToolWithHandler, au as VirtualFileSystem, av as VirtualFileTree, aw as VirtualFsOps, ax as VirtualFsState, ay as WorkflowTask, az as ZeitlichSession, aA as isTerminalStatus } from './types-CheCTLeV.js';
|
|
5
5
|
import { S as Sandbox, a as SandboxFileSystem, d as SandboxCreateOptions, b as SandboxProvider, f as SandboxSnapshot, P as PrefixedSandboxOps, F as FileStat, D as DirentEntry, E as ExecResult } from './types-AujBIMMn.js';
|
|
@@ -97,27 +97,42 @@ declare function withSandbox<TArgs, TResult, TSandbox extends Sandbox = Sandbox,
|
|
|
97
97
|
sandboxId: string;
|
|
98
98
|
}) => Promise<ToolHandlerResponse<TResult, TToolResponse>>): ActivityToolHandler<TArgs, TResult | null, RouterContext, TToolResponse | string>;
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Safely retrieve Temporal activity heartbeat and cancellation signal.
|
|
102
|
+
* Returns empty object when called outside a Temporal activity (e.g. tests).
|
|
103
|
+
*/
|
|
104
|
+
declare function getActivityContext(): {
|
|
105
|
+
heartbeat?: () => void;
|
|
106
|
+
signal?: AbortSignal;
|
|
107
|
+
};
|
|
100
108
|
/**
|
|
101
109
|
* Query the parent workflow's state from within an activity.
|
|
102
110
|
* Resolves the workflow handle from the current activity context.
|
|
103
111
|
*/
|
|
104
112
|
declare function queryParentWorkflowState<T>(client: WorkflowClient): Promise<T>;
|
|
105
113
|
/**
|
|
106
|
-
* Wraps a handler into a `RunAgentActivity` by auto-fetching
|
|
107
|
-
* workflow's agent state before each invocation.
|
|
114
|
+
* Wraps a handler into a scope-prefixed `RunAgentActivity` by auto-fetching
|
|
115
|
+
* the parent workflow's agent state before each invocation.
|
|
116
|
+
*
|
|
117
|
+
* Returns a `Record` with a single key `run<Scope>` so it can be spread
|
|
118
|
+
* into the activities object alongside adapter activities.
|
|
119
|
+
*
|
|
120
|
+
* @param scope - Workflow scope used to derive the activity name.
|
|
121
|
+
* `"myAgentWorkflow"` produces `{ runMyAgentWorkflow: fn }`.
|
|
108
122
|
*
|
|
109
123
|
* @example
|
|
110
124
|
* ```typescript
|
|
111
125
|
* import { createRunAgentActivity } from 'zeitlich';
|
|
112
|
-
* import { createLangChainModelInvoker } from 'zeitlich/adapters/thread/langchain';
|
|
113
126
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
127
|
+
* return {
|
|
128
|
+
* ...adapter.createActivities("myAgentWorkflow"),
|
|
129
|
+
* ...createRunAgentActivity(client, adapter.invoker, "myAgentWorkflow"),
|
|
130
|
+
* };
|
|
116
131
|
* ```
|
|
117
132
|
*/
|
|
118
133
|
declare function createRunAgentActivity<R, S extends BaseAgentState = BaseAgentState>(client: WorkflowClient, handler: (config: RunAgentConfig & {
|
|
119
134
|
state: S;
|
|
120
|
-
}) => Promise<R
|
|
135
|
+
}) => Promise<R>, scope: string): Record<string, (config: RunAgentConfig) => Promise<R>>;
|
|
121
136
|
/**
|
|
122
137
|
* Context injected into tool handlers created via {@link withParentWorkflowState}.
|
|
123
138
|
*/
|
|
@@ -496,4 +511,4 @@ declare const toTree: (fs: SandboxFileSystem, opts?: {
|
|
|
496
511
|
sort?: boolean;
|
|
497
512
|
}) => Promise<string>;
|
|
498
513
|
|
|
499
|
-
export { ActivityToolHandler, type AgentStateContext, BaseAgentState, BaseThreadManager, BashArgs, ExecResult, FileEditArgs, FileEntryMetadata, FileReadArgs, FileResolver, FileSystemSkillProvider, FileWriteArgs, GlobArgs, JsonValue, NodeFsSandboxFileSystem, type PreCreateHookResult, PrefixedSandboxOps, PrefixedVirtualFsOps, RouterContext, RunAgentConfig, Sandbox, type SandboxContext, SandboxCreateOptions, DirentEntry as SandboxDirentEntry, FileStat as SandboxFileStat, SandboxFileSystem, SandboxManager, type SandboxManagerHooks, SandboxProvider, SandboxSnapshot, Skill, SkillMetadata, SkillProvider, ThreadManagerConfig, ToolHandlerResponse, ToolResultConfig, TreeMutation, VirtualFsContext, bashHandler, createRunAgentActivity, createThreadManager, createVirtualFsActivities, editHandler, globHandler, queryParentWorkflowState, readFileHandler, toTree, withAutoAppend, withParentWorkflowState, withSandbox, withVirtualFs, writeFileHandler };
|
|
514
|
+
export { ActivityToolHandler, type AgentStateContext, BaseAgentState, BaseThreadManager, BashArgs, ExecResult, FileEditArgs, FileEntryMetadata, FileReadArgs, FileResolver, FileSystemSkillProvider, FileWriteArgs, GlobArgs, JsonValue, NodeFsSandboxFileSystem, type PreCreateHookResult, PrefixedSandboxOps, PrefixedVirtualFsOps, RouterContext, RunAgentConfig, Sandbox, type SandboxContext, SandboxCreateOptions, DirentEntry as SandboxDirentEntry, FileStat as SandboxFileStat, SandboxFileSystem, SandboxManager, type SandboxManagerHooks, SandboxProvider, SandboxSnapshot, Skill, SkillMetadata, SkillProvider, ThreadManagerConfig, ToolHandlerResponse, ToolResultConfig, TreeMutation, VirtualFsContext, bashHandler, createRunAgentActivity, createThreadManager, createVirtualFsActivities, editHandler, getActivityContext, globHandler, queryParentWorkflowState, readFileHandler, toTree, withAutoAppend, withParentWorkflowState, withSandbox, withVirtualFs, writeFileHandler };
|
package/dist/index.js
CHANGED
|
@@ -1410,6 +1410,23 @@ function composeHooks(...fns) {
|
|
|
1410
1410
|
return lastResult;
|
|
1411
1411
|
};
|
|
1412
1412
|
}
|
|
1413
|
+
function proxyRunAgent(scope, options) {
|
|
1414
|
+
const resolvedScope = scope ?? workflowInfo().workflowType;
|
|
1415
|
+
const name = `run${resolvedScope.charAt(0).toUpperCase()}${resolvedScope.slice(1)}`;
|
|
1416
|
+
const acts = proxyActivities(
|
|
1417
|
+
options ?? {
|
|
1418
|
+
startToCloseTimeout: "10m",
|
|
1419
|
+
heartbeatTimeout: "1m",
|
|
1420
|
+
retry: {
|
|
1421
|
+
maximumAttempts: 3,
|
|
1422
|
+
initialInterval: "10s",
|
|
1423
|
+
maximumInterval: "2m",
|
|
1424
|
+
backoffCoefficient: 3
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
);
|
|
1428
|
+
return acts[name];
|
|
1429
|
+
}
|
|
1413
1430
|
var SandboxNotSupportedError = class extends ApplicationFailure$1 {
|
|
1414
1431
|
constructor(operation) {
|
|
1415
1432
|
super(
|
|
@@ -2166,6 +2183,14 @@ function createThreadManager(config) {
|
|
|
2166
2183
|
}
|
|
2167
2184
|
};
|
|
2168
2185
|
}
|
|
2186
|
+
function getActivityContext() {
|
|
2187
|
+
try {
|
|
2188
|
+
const ctx = Context.current();
|
|
2189
|
+
return { heartbeat: () => ctx.heartbeat(), signal: ctx.cancellationSignal };
|
|
2190
|
+
} catch {
|
|
2191
|
+
return {};
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2169
2194
|
async function queryParentWorkflowState(client) {
|
|
2170
2195
|
const { workflowExecution } = Context.current().info;
|
|
2171
2196
|
const handle = client.getHandle(
|
|
@@ -2174,10 +2199,13 @@ async function queryParentWorkflowState(client) {
|
|
|
2174
2199
|
);
|
|
2175
2200
|
return handle.query("getAgentState");
|
|
2176
2201
|
}
|
|
2177
|
-
function createRunAgentActivity(client, handler) {
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2202
|
+
function createRunAgentActivity(client, handler, scope) {
|
|
2203
|
+
const name = `run${scope.charAt(0).toUpperCase()}${scope.slice(1)}`;
|
|
2204
|
+
return {
|
|
2205
|
+
[name]: async (config) => {
|
|
2206
|
+
const state = await queryParentWorkflowState(client);
|
|
2207
|
+
return handler({ ...config, state });
|
|
2208
|
+
}
|
|
2181
2209
|
};
|
|
2182
2210
|
}
|
|
2183
2211
|
function withParentWorkflowState(client, handler) {
|
|
@@ -2948,6 +2976,6 @@ var toTree = async (fs, opts = {}) => {
|
|
|
2948
2976
|
return base + subtree;
|
|
2949
2977
|
};
|
|
2950
2978
|
|
|
2951
|
-
export { FileSystemSkillProvider, NodeFsSandboxFileSystem, SandboxManager, SandboxNotFoundError, SandboxNotSupportedError, VirtualFileSystem, applyVirtualTreeMutations, askUserQuestionTool, bashHandler, bashTool, composeHooks, createAgentStateManager, createAskUserQuestionHandler, createBashToolDescription, createObservabilityHooks, createReadSkillHandler, createReadSkillTool, createRunAgentActivity, createSession, createTaskCreateHandler, createTaskGetHandler, createTaskListHandler, createTaskUpdateHandler, createThreadManager, createToolRouter, createVirtualFsActivities, defineSubagent, defineSubagentWorkflow, defineTool, defineWorkflow, editHandler, editTool, filesWithMimeType, formatVirtualFileTree, getShortId, globHandler, globTool, grepTool, hasDirectory, hasFileWithMimeType, hasNoOtherToolCalls, isTerminalStatus, parseSkillFile, proxyVirtualFsOps, queryParentWorkflowState, readFileHandler, readFileTool, taskCreateTool, taskGetTool, taskListTool, taskUpdateTool, toTree, withAutoAppend, withParentWorkflowState, withSandbox, withVirtualFs, writeFileHandler, writeFileTool };
|
|
2979
|
+
export { FileSystemSkillProvider, NodeFsSandboxFileSystem, SandboxManager, SandboxNotFoundError, SandboxNotSupportedError, VirtualFileSystem, applyVirtualTreeMutations, askUserQuestionTool, bashHandler, bashTool, composeHooks, createAgentStateManager, createAskUserQuestionHandler, createBashToolDescription, createObservabilityHooks, createReadSkillHandler, createReadSkillTool, createRunAgentActivity, createSession, createTaskCreateHandler, createTaskGetHandler, createTaskListHandler, createTaskUpdateHandler, createThreadManager, createToolRouter, createVirtualFsActivities, defineSubagent, defineSubagentWorkflow, defineTool, defineWorkflow, editHandler, editTool, filesWithMimeType, formatVirtualFileTree, getActivityContext, getShortId, globHandler, globTool, grepTool, hasDirectory, hasFileWithMimeType, hasNoOtherToolCalls, isTerminalStatus, parseSkillFile, proxyRunAgent, proxyVirtualFsOps, queryParentWorkflowState, readFileHandler, readFileTool, taskCreateTool, taskGetTool, taskListTool, taskUpdateTool, toTree, withAutoAppend, withParentWorkflowState, withSandbox, withVirtualFs, writeFileHandler, writeFileTool };
|
|
2952
2980
|
//# sourceMappingURL=index.js.map
|
|
2953
2981
|
//# sourceMappingURL=index.js.map
|