zeitlich 0.2.37 → 0.2.38
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/dist/{activities-Bb-nAjwQ.d.ts → activities-BKhMtKDd.d.ts} +4 -2
- package/dist/{activities-vkI4_3CC.d.cts → activities-CDcwkRZs.d.cts} +4 -2
- package/dist/adapters/sandbox/bedrock/index.cjs +3 -3
- package/dist/adapters/sandbox/bedrock/index.cjs.map +1 -1
- package/dist/adapters/sandbox/bedrock/index.d.cts +6 -6
- package/dist/adapters/sandbox/bedrock/index.d.ts +6 -6
- package/dist/adapters/sandbox/bedrock/index.js +3 -3
- package/dist/adapters/sandbox/bedrock/index.js.map +1 -1
- package/dist/adapters/sandbox/bedrock/workflow.d.cts +2 -2
- package/dist/adapters/sandbox/bedrock/workflow.d.ts +2 -2
- package/dist/adapters/sandbox/daytona/index.cjs +3 -3
- package/dist/adapters/sandbox/daytona/index.cjs.map +1 -1
- package/dist/adapters/sandbox/daytona/index.d.cts +4 -4
- package/dist/adapters/sandbox/daytona/index.d.ts +4 -4
- package/dist/adapters/sandbox/daytona/index.js +3 -3
- package/dist/adapters/sandbox/daytona/index.js.map +1 -1
- package/dist/adapters/sandbox/daytona/workflow.d.cts +1 -1
- package/dist/adapters/sandbox/daytona/workflow.d.ts +1 -1
- package/dist/adapters/sandbox/e2b/index.cjs +26 -14
- package/dist/adapters/sandbox/e2b/index.cjs.map +1 -1
- package/dist/adapters/sandbox/e2b/index.d.cts +24 -4
- package/dist/adapters/sandbox/e2b/index.d.ts +24 -4
- package/dist/adapters/sandbox/e2b/index.js +26 -14
- package/dist/adapters/sandbox/e2b/index.js.map +1 -1
- package/dist/adapters/sandbox/e2b/workflow.d.cts +1 -1
- package/dist/adapters/sandbox/e2b/workflow.d.ts +1 -1
- package/dist/adapters/sandbox/inmemory/index.cjs +3 -3
- package/dist/adapters/sandbox/inmemory/index.cjs.map +1 -1
- package/dist/adapters/sandbox/inmemory/index.d.cts +4 -4
- package/dist/adapters/sandbox/inmemory/index.d.ts +4 -4
- package/dist/adapters/sandbox/inmemory/index.js +3 -3
- package/dist/adapters/sandbox/inmemory/index.js.map +1 -1
- package/dist/adapters/sandbox/inmemory/workflow.d.cts +1 -1
- package/dist/adapters/sandbox/inmemory/workflow.d.ts +1 -1
- package/dist/adapters/thread/anthropic/index.cjs +23 -3
- package/dist/adapters/thread/anthropic/index.cjs.map +1 -1
- package/dist/adapters/thread/anthropic/index.d.cts +5 -5
- package/dist/adapters/thread/anthropic/index.d.ts +5 -5
- package/dist/adapters/thread/anthropic/index.js +23 -3
- package/dist/adapters/thread/anthropic/index.js.map +1 -1
- package/dist/adapters/thread/anthropic/workflow.cjs +2 -1
- package/dist/adapters/thread/anthropic/workflow.cjs.map +1 -1
- package/dist/adapters/thread/anthropic/workflow.d.cts +5 -5
- package/dist/adapters/thread/anthropic/workflow.d.ts +5 -5
- package/dist/adapters/thread/anthropic/workflow.js +2 -1
- package/dist/adapters/thread/anthropic/workflow.js.map +1 -1
- package/dist/adapters/thread/google-genai/index.cjs +27 -3
- 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 +27 -3
- package/dist/adapters/thread/google-genai/index.js.map +1 -1
- package/dist/adapters/thread/google-genai/workflow.cjs +2 -1
- package/dist/adapters/thread/google-genai/workflow.cjs.map +1 -1
- package/dist/adapters/thread/google-genai/workflow.d.cts +5 -5
- package/dist/adapters/thread/google-genai/workflow.d.ts +5 -5
- package/dist/adapters/thread/google-genai/workflow.js +2 -1
- package/dist/adapters/thread/google-genai/workflow.js.map +1 -1
- package/dist/adapters/thread/langchain/index.cjs +23 -3
- package/dist/adapters/thread/langchain/index.cjs.map +1 -1
- package/dist/adapters/thread/langchain/index.d.cts +5 -5
- package/dist/adapters/thread/langchain/index.d.ts +5 -5
- package/dist/adapters/thread/langchain/index.js +23 -3
- package/dist/adapters/thread/langchain/index.js.map +1 -1
- package/dist/adapters/thread/langchain/workflow.cjs +2 -1
- package/dist/adapters/thread/langchain/workflow.cjs.map +1 -1
- package/dist/adapters/thread/langchain/workflow.d.cts +5 -5
- package/dist/adapters/thread/langchain/workflow.d.ts +5 -5
- package/dist/adapters/thread/langchain/workflow.js +2 -1
- package/dist/adapters/thread/langchain/workflow.js.map +1 -1
- package/dist/index.cjs +120 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +121 -31
- package/dist/index.js.map +1 -1
- package/dist/{proxy-0smGKvx8.d.ts → proxy-CUlKSvZS.d.ts} +1 -1
- package/dist/{proxy-DEtowJyd.d.cts → proxy-D_3x7RN4.d.cts} +1 -1
- package/dist/{thread-manager-C-C4pI2z.d.ts → thread-manager-CVu7o2cs.d.ts} +4 -2
- package/dist/{thread-manager-D4vgzYrh.d.cts → thread-manager-HSwyh28L.d.cts} +4 -2
- package/dist/{thread-manager-3fszQih4.d.ts → thread-manager-c1gPopAG.d.ts} +4 -2
- package/dist/{thread-manager-CzYln2OC.d.cts → thread-manager-wGi-LqIP.d.cts} +4 -2
- package/dist/{types-B37hKoWA.d.ts → types-BH_IRryz.d.ts} +10 -1
- package/dist/{types-D08CXPh8.d.cts → types-BaOw4hKI.d.cts} +10 -1
- package/dist/{types-CPKDl-y_.d.ts → types-C06FwR96.d.cts} +59 -4
- package/dist/{types-CNuWnvy9.d.ts → types-DAsQ21Rt.d.ts} +1 -1
- package/dist/{types-BO7Yju20.d.cts → types-DNr31FzL.d.ts} +59 -4
- package/dist/{types-DWEUmYAJ.d.cts → types-lm8tMNJQ.d.cts} +1 -1
- package/dist/{types-tQL9njTu.d.cts → types-yx0LzPGn.d.cts} +21 -7
- package/dist/{types-tQL9njTu.d.ts → types-yx0LzPGn.d.ts} +21 -7
- package/dist/{workflow-CjXHbZZc.d.ts → workflow-CSCkpwAL.d.ts} +2 -2
- package/dist/{workflow-Do_lzJpT.d.cts → workflow-DuvMZ8Vm.d.cts} +2 -2
- package/dist/workflow.cjs +94 -18
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +3 -3
- package/dist/workflow.d.ts +3 -3
- package/dist/workflow.js +95 -19
- package/dist/workflow.js.map +1 -1
- package/package.json +2 -2
- package/src/adapters/sandbox/bedrock/index.ts +12 -3
- package/src/adapters/sandbox/daytona/index.ts +12 -3
- package/src/adapters/sandbox/e2b/index.ts +36 -14
- package/src/adapters/sandbox/e2b/types.ts +16 -0
- package/src/adapters/sandbox/inmemory/index.ts +12 -3
- package/src/adapters/thread/anthropic/activities.ts +9 -0
- package/src/adapters/thread/anthropic/model-invoker.ts +3 -1
- package/src/adapters/thread/anthropic/thread-manager.ts +3 -0
- package/src/adapters/thread/google-genai/activities.ts +13 -0
- package/src/adapters/thread/google-genai/model-invoker.ts +3 -1
- package/src/adapters/thread/google-genai/thread-manager.ts +3 -0
- package/src/adapters/thread/langchain/activities.ts +9 -0
- package/src/adapters/thread/langchain/model-invoker.ts +2 -1
- package/src/adapters/thread/langchain/thread-manager.ts +3 -0
- package/src/lib/lifecycle.ts +11 -4
- package/src/lib/model/types.ts +10 -0
- package/src/lib/sandbox/manager.ts +26 -18
- package/src/lib/sandbox/types.ts +27 -7
- package/src/lib/session/session-edge-cases.integration.test.ts +265 -1
- package/src/lib/session/session.integration.test.ts +22 -1
- package/src/lib/session/session.ts +61 -7
- package/src/lib/session/types.ts +12 -0
- package/src/lib/subagent/subagent.integration.test.ts +100 -104
- package/src/lib/thread/manager.ts +18 -0
- package/src/lib/thread/proxy.ts +1 -0
- package/src/lib/thread/types.ts +9 -0
- package/src/lib/tool-router/index.ts +2 -0
- package/src/lib/tool-router/router-edge-cases.integration.test.ts +92 -0
- package/src/lib/tool-router/router.integration.test.ts +12 -0
- package/src/lib/tool-router/router.ts +89 -16
- package/src/lib/tool-router/types.ts +34 -1
- package/src/workflow.ts +2 -0
package/dist/workflow.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as AskUserQuestionArgs, B as BashArgs, F as FileEditArgs, a as FileReadArgs, b as FileWriteArgs, G as GlobArgs, 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-
|
|
2
|
-
export { c as ActivityToolHandler, l as AgentConfig, m as AgentFile, A as AgentResponse, n as AgentState, o as AgentStateManager, p as AgentStatus, q as AppendToolResultFn, B as BaseAgentState, r as FileEntry, F as FileEntryMetadata, i as FileResolver, H as Hooks, I as InferToolResults, s as JsonPrimitive, t as JsonSerializable, J as JsonValue, 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, k as PrefixedVirtualFsOps, Q as ProcessToolCallsContext, U as RawToolCall, R as RouterContext,
|
|
3
|
-
export { h as ExecOptions, E as ExecResult, P as PrefixedSandboxOps, S as Sandbox, c as SandboxCapabilities, d as SandboxCreateOptions, e as SandboxCreateResult, D as SandboxDirentEntry, F as SandboxFileStat, a as SandboxFileSystem, i as SandboxNotFoundError, j as SandboxNotSupportedError, g as SandboxOps, b as SandboxProvider, f as SandboxSnapshot } from './types-
|
|
1
|
+
export { A as AskUserQuestionArgs, B as BashArgs, F as FileEditArgs, a as FileReadArgs, b as FileWriteArgs, G as GlobArgs, 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-DuvMZ8Vm.cjs';
|
|
2
|
+
export { c as ActivityToolHandler, l as AgentConfig, m as AgentFile, A as AgentResponse, n as AgentState, o as AgentStateManager, p as AgentStatus, q as AppendToolResultFn, B as BaseAgentState, r as FileEntry, F as FileEntryMetadata, i as FileResolver, H as Hooks, I as InferToolResults, s as JsonPrimitive, t as JsonSerializable, J as JsonValue, 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, k as PrefixedVirtualFsOps, Q as ProcessToolCallsContext, U as ProcessToolCallsResult, W as RawToolCall, X as RewindSignal, R as RouterContext, Y as RunAgentActivity, e as RunAgentConfig, Z as SandboxInit, _ as SandboxShutdown, S as ScopedPrefix, $ as SerializableToolDefinition, a0 as SessionConfig, a1 as SessionEndHook, a2 as SessionEndHookContext, a3 as SessionExitReason, a4 as SessionResult, a5 as SessionStartHook, a6 as SessionStartHookContext, h as Skill, g as SkillMetadata, f as SkillProvider, a7 as SubagentConfig, a8 as SubagentDefinition, a9 as SubagentFnResult, aa as SubagentHandlerResponse, ab as SubagentHooks, ac as SubagentSandboxConfig, ad as SubagentSandboxShutdown, ae as SubagentSessionInput, af as SubagentWorkflow, ag as SubagentWorkflowInput, ah as TaskStatus, ai as ThreadInit, T as ThreadOps, aj as TokenUsage, ak as ToolArgs, al as ToolCallResult, am as ToolCallResultUnion, an as ToolDefinition, ao as ToolHandler, b as ToolHandlerResponse, ap as ToolHooks, aq as ToolMap, ar as ToolNames, as as ToolResult, d as ToolResultConfig, at as ToolRouter, au as ToolRouterHooks, av as ToolWithHandler, j as TreeMutation, ax as VirtualFileTree, ay as VirtualFsOps, az as VirtualFsState, aA as WorkflowTask, aB as ZeitlichSession, aC as isTerminalStatus } from './types-C06FwR96.cjs';
|
|
3
|
+
export { h as ExecOptions, E as ExecResult, P as PrefixedSandboxOps, S as Sandbox, c as SandboxCapabilities, d as SandboxCreateOptions, e as SandboxCreateResult, D as SandboxDirentEntry, F as SandboxFileStat, a as SandboxFileSystem, i as SandboxNotFoundError, j as SandboxNotSupportedError, g as SandboxOps, b as SandboxProvider, f as SandboxSnapshot } from './types-yx0LzPGn.cjs';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '@temporalio/workflow';
|
|
6
6
|
import '@temporalio/common';
|
package/dist/workflow.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as AskUserQuestionArgs, B as BashArgs, F as FileEditArgs, a as FileReadArgs, b as FileWriteArgs, G as GlobArgs, 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-
|
|
2
|
-
export { c as ActivityToolHandler, l as AgentConfig, m as AgentFile, A as AgentResponse, n as AgentState, o as AgentStateManager, p as AgentStatus, q as AppendToolResultFn, B as BaseAgentState, r as FileEntry, F as FileEntryMetadata, i as FileResolver, H as Hooks, I as InferToolResults, s as JsonPrimitive, t as JsonSerializable, J as JsonValue, 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, k as PrefixedVirtualFsOps, Q as ProcessToolCallsContext, U as RawToolCall, R as RouterContext,
|
|
3
|
-
export { h as ExecOptions, E as ExecResult, P as PrefixedSandboxOps, S as Sandbox, c as SandboxCapabilities, d as SandboxCreateOptions, e as SandboxCreateResult, D as SandboxDirentEntry, F as SandboxFileStat, a as SandboxFileSystem, i as SandboxNotFoundError, j as SandboxNotSupportedError, g as SandboxOps, b as SandboxProvider, f as SandboxSnapshot } from './types-
|
|
1
|
+
export { A as AskUserQuestionArgs, B as BashArgs, F as FileEditArgs, a as FileReadArgs, b as FileWriteArgs, G as GlobArgs, 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-CSCkpwAL.js';
|
|
2
|
+
export { c as ActivityToolHandler, l as AgentConfig, m as AgentFile, A as AgentResponse, n as AgentState, o as AgentStateManager, p as AgentStatus, q as AppendToolResultFn, B as BaseAgentState, r as FileEntry, F as FileEntryMetadata, i as FileResolver, H as Hooks, I as InferToolResults, s as JsonPrimitive, t as JsonSerializable, J as JsonValue, 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, k as PrefixedVirtualFsOps, Q as ProcessToolCallsContext, U as ProcessToolCallsResult, W as RawToolCall, X as RewindSignal, R as RouterContext, Y as RunAgentActivity, e as RunAgentConfig, Z as SandboxInit, _ as SandboxShutdown, S as ScopedPrefix, $ as SerializableToolDefinition, a0 as SessionConfig, a1 as SessionEndHook, a2 as SessionEndHookContext, a3 as SessionExitReason, a4 as SessionResult, a5 as SessionStartHook, a6 as SessionStartHookContext, h as Skill, g as SkillMetadata, f as SkillProvider, a7 as SubagentConfig, a8 as SubagentDefinition, a9 as SubagentFnResult, aa as SubagentHandlerResponse, ab as SubagentHooks, ac as SubagentSandboxConfig, ad as SubagentSandboxShutdown, ae as SubagentSessionInput, af as SubagentWorkflow, ag as SubagentWorkflowInput, ah as TaskStatus, ai as ThreadInit, T as ThreadOps, aj as TokenUsage, ak as ToolArgs, al as ToolCallResult, am as ToolCallResultUnion, an as ToolDefinition, ao as ToolHandler, b as ToolHandlerResponse, ap as ToolHooks, aq as ToolMap, ar as ToolNames, as as ToolResult, d as ToolResultConfig, at as ToolRouter, au as ToolRouterHooks, av as ToolWithHandler, j as TreeMutation, ax as VirtualFileTree, ay as VirtualFsOps, az as VirtualFsState, aA as WorkflowTask, aB as ZeitlichSession, aC as isTerminalStatus } from './types-DNr31FzL.js';
|
|
3
|
+
export { h as ExecOptions, E as ExecResult, P as PrefixedSandboxOps, S as Sandbox, c as SandboxCapabilities, d as SandboxCreateOptions, e as SandboxCreateResult, D as SandboxDirentEntry, F as SandboxFileStat, a as SandboxFileSystem, i as SandboxNotFoundError, j as SandboxNotSupportedError, g as SandboxOps, b as SandboxProvider, f as SandboxSnapshot } from './types-yx0LzPGn.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '@temporalio/workflow';
|
|
6
6
|
import '@temporalio/common';
|
package/dist/workflow.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineSignal, uuid4, setHandler, defineUpdate, ApplicationFailure, log, condition, defineQuery, proxySinks, workflowInfo, proxyActivities, getExternalWorkflowHandle, executeChild } from '@temporalio/workflow';
|
|
1
|
+
import { defineSignal, CancellationScope, isCancellation, uuid4, setHandler, defineUpdate, ApplicationFailure, log, condition, defineQuery, proxySinks, workflowInfo, proxyActivities, getExternalWorkflowHandle, executeChild } from '@temporalio/workflow';
|
|
2
2
|
import z14, { z } from 'zod';
|
|
3
3
|
import { ApplicationFailure as ApplicationFailure$1 } from '@temporalio/common';
|
|
4
4
|
|
|
@@ -107,7 +107,7 @@ function createToolRouter(options) {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
async function processToolCall(toolCall, turn, sandboxId) {
|
|
110
|
+
async function processToolCall(toolCall, turn, sandboxId, onRewindRequested) {
|
|
111
111
|
const startTime = Date.now();
|
|
112
112
|
const tool = toolMap.get(toolCall.name);
|
|
113
113
|
const preResult = await runPreHooks(toolCall, tool, turn);
|
|
@@ -122,7 +122,7 @@ function createToolRouter(options) {
|
|
|
122
122
|
reason: "Skipped by PreToolUse hook"
|
|
123
123
|
})
|
|
124
124
|
});
|
|
125
|
-
return
|
|
125
|
+
return { kind: "skipped" };
|
|
126
126
|
}
|
|
127
127
|
const effectiveArgs = preResult.args;
|
|
128
128
|
log.debug("tool call dispatched", {
|
|
@@ -134,6 +134,7 @@ function createToolRouter(options) {
|
|
|
134
134
|
let content;
|
|
135
135
|
let resultAppended = false;
|
|
136
136
|
let metadata;
|
|
137
|
+
let rewindRequested = false;
|
|
137
138
|
try {
|
|
138
139
|
if (tool) {
|
|
139
140
|
const routerContext = {
|
|
@@ -151,11 +152,15 @@ function createToolRouter(options) {
|
|
|
151
152
|
content = response.toolResponse;
|
|
152
153
|
resultAppended = response.resultAppended === true;
|
|
153
154
|
metadata = response.metadata;
|
|
155
|
+
rewindRequested = response.rewind === true;
|
|
154
156
|
} else {
|
|
155
157
|
result = { error: `Unknown tool: ${toolCall.name}` };
|
|
156
158
|
content = JSON.stringify(result, null, 2);
|
|
157
159
|
}
|
|
158
160
|
} catch (error) {
|
|
161
|
+
if (isCancellation(error)) {
|
|
162
|
+
throw error;
|
|
163
|
+
}
|
|
159
164
|
log.warn("tool call failed", {
|
|
160
165
|
toolName: toolCall.name,
|
|
161
166
|
toolCallId: toolCall.id,
|
|
@@ -173,6 +178,15 @@ function createToolRouter(options) {
|
|
|
173
178
|
result = recovery.result;
|
|
174
179
|
content = recovery.content;
|
|
175
180
|
}
|
|
181
|
+
if (rewindRequested) {
|
|
182
|
+
const signal = {
|
|
183
|
+
toolCallId: toolCall.id,
|
|
184
|
+
toolName: toolCall.name
|
|
185
|
+
};
|
|
186
|
+
log.info("tool requested rewind", { ...signal });
|
|
187
|
+
onRewindRequested?.(signal);
|
|
188
|
+
return { kind: "rewind", signal };
|
|
189
|
+
}
|
|
176
190
|
if (!resultAppended) {
|
|
177
191
|
const config = {
|
|
178
192
|
threadId: options.threadId,
|
|
@@ -209,7 +223,7 @@ function createToolRouter(options) {
|
|
|
209
223
|
turn,
|
|
210
224
|
durationMs
|
|
211
225
|
);
|
|
212
|
-
return toolResult;
|
|
226
|
+
return { kind: "result", value: toolResult };
|
|
213
227
|
}
|
|
214
228
|
return {
|
|
215
229
|
hasTools() {
|
|
@@ -244,27 +258,59 @@ function createToolRouter(options) {
|
|
|
244
258
|
}));
|
|
245
259
|
},
|
|
246
260
|
async processToolCalls(toolCalls, context) {
|
|
261
|
+
const attachRewind = (arr, rewind) => {
|
|
262
|
+
if (rewind) {
|
|
263
|
+
arr.rewind = rewind;
|
|
264
|
+
}
|
|
265
|
+
return arr;
|
|
266
|
+
};
|
|
247
267
|
if (toolCalls.length === 0) {
|
|
248
|
-
return [];
|
|
268
|
+
return attachRewind([], void 0);
|
|
249
269
|
}
|
|
250
270
|
const turn = context?.turn ?? 0;
|
|
251
271
|
const sandboxId = context?.sandboxId;
|
|
272
|
+
let rewindSignal;
|
|
252
273
|
if (options.parallel) {
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
274
|
+
const scope = new CancellationScope({ cancellable: true });
|
|
275
|
+
const onRewindRequested = (signal) => {
|
|
276
|
+
if (!rewindSignal) {
|
|
277
|
+
rewindSignal = signal;
|
|
278
|
+
scope.cancel();
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
const outcomes = await scope.run(
|
|
282
|
+
async () => Promise.allSettled(
|
|
283
|
+
toolCalls.map(
|
|
284
|
+
(tc) => processToolCall(tc, turn, sandboxId, onRewindRequested)
|
|
285
|
+
)
|
|
286
|
+
)
|
|
258
287
|
);
|
|
288
|
+
const results2 = [];
|
|
289
|
+
for (const outcome of outcomes) {
|
|
290
|
+
if (outcome.status === "rejected") {
|
|
291
|
+
if (isCancellation(outcome.reason)) {
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
throw outcome.reason;
|
|
295
|
+
}
|
|
296
|
+
if (outcome.value.kind === "result") {
|
|
297
|
+
results2.push(outcome.value.value);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return attachRewind(results2, rewindSignal);
|
|
259
301
|
}
|
|
260
302
|
const results = [];
|
|
261
303
|
for (const toolCall of toolCalls) {
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
264
|
-
|
|
304
|
+
const outcome = await processToolCall(toolCall, turn, sandboxId);
|
|
305
|
+
if (outcome.kind === "rewind") {
|
|
306
|
+
rewindSignal = outcome.signal;
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
if (outcome.kind === "result") {
|
|
310
|
+
results.push(outcome.value);
|
|
265
311
|
}
|
|
266
312
|
}
|
|
267
|
-
return results;
|
|
313
|
+
return attachRewind(results, rewindSignal);
|
|
268
314
|
},
|
|
269
315
|
async processToolCallsByName(toolCalls, toolName, handler, context) {
|
|
270
316
|
const matchingCalls = toolCalls.filter((tc) => tc.name === toolName);
|
|
@@ -861,7 +907,8 @@ async function createSession({
|
|
|
861
907
|
initializeThread,
|
|
862
908
|
appendSystemMessage,
|
|
863
909
|
appendAgentMessage,
|
|
864
|
-
forkThread
|
|
910
|
+
forkThread,
|
|
911
|
+
truncateThread
|
|
865
912
|
} = threadOps;
|
|
866
913
|
const plugins = [];
|
|
867
914
|
let destroySubagentSandboxes;
|
|
@@ -955,8 +1002,10 @@ async function createSession({
|
|
|
955
1002
|
nonRetryable: true
|
|
956
1003
|
});
|
|
957
1004
|
}
|
|
1005
|
+
const forkInit = sandboxInit;
|
|
958
1006
|
sandboxId = await sandboxOps.forkSandbox(
|
|
959
|
-
|
|
1007
|
+
forkInit.sandboxId,
|
|
1008
|
+
forkInit.options
|
|
960
1009
|
);
|
|
961
1010
|
sandboxOwned = true;
|
|
962
1011
|
} else if (sandboxMode === "from-snapshot") {
|
|
@@ -966,8 +1015,11 @@ async function createSession({
|
|
|
966
1015
|
nonRetryable: true
|
|
967
1016
|
});
|
|
968
1017
|
}
|
|
969
|
-
const
|
|
970
|
-
sandboxId = await sandboxOps.restoreSandbox(
|
|
1018
|
+
const restoreInit = sandboxInit;
|
|
1019
|
+
sandboxId = await sandboxOps.restoreSandbox(
|
|
1020
|
+
restoreInit.snapshot,
|
|
1021
|
+
restoreInit.options
|
|
1022
|
+
);
|
|
971
1023
|
sandboxOwned = true;
|
|
972
1024
|
} else if (sandboxOps) {
|
|
973
1025
|
const skillFiles = skills ? collectSkillFiles(skills) : void 0;
|
|
@@ -1056,12 +1108,18 @@ async function createSession({
|
|
|
1056
1108
|
const currentTurn = stateManager.getTurns();
|
|
1057
1109
|
log.debug("turn started", { agentName, threadId, turn: currentTurn });
|
|
1058
1110
|
stateManager.setTools(toolRouter.getToolDefinitions());
|
|
1059
|
-
const {
|
|
1111
|
+
const {
|
|
1112
|
+
message,
|
|
1113
|
+
rawToolCalls,
|
|
1114
|
+
usage,
|
|
1115
|
+
threadLengthAtCall
|
|
1116
|
+
} = await runAgent({
|
|
1060
1117
|
threadId,
|
|
1061
1118
|
threadKey,
|
|
1062
1119
|
agentName,
|
|
1063
1120
|
metadata
|
|
1064
1121
|
});
|
|
1122
|
+
const preAssistantLength = threadLengthAtCall;
|
|
1065
1123
|
await appendAgentMessage(threadId, uuid4(), message, threadKey);
|
|
1066
1124
|
if (usage) {
|
|
1067
1125
|
stateManager.updateUsage(usage);
|
|
@@ -1107,6 +1165,24 @@ async function createSession({
|
|
|
1107
1165
|
stateManager.updateUsage(result.usage);
|
|
1108
1166
|
}
|
|
1109
1167
|
}
|
|
1168
|
+
const rewind = toolCallResults.rewind;
|
|
1169
|
+
if (rewind) {
|
|
1170
|
+
log.info("rewinding turn", {
|
|
1171
|
+
agentName,
|
|
1172
|
+
threadId,
|
|
1173
|
+
turn: currentTurn,
|
|
1174
|
+
toolCallId: rewind.toolCallId,
|
|
1175
|
+
toolName: rewind.toolName
|
|
1176
|
+
});
|
|
1177
|
+
if (preAssistantLength === void 0) {
|
|
1178
|
+
throw ApplicationFailure.create({
|
|
1179
|
+
message: "Rewind requested but runAgent did not report `threadLengthAtCall`; the adapter must populate it to support rewinds.",
|
|
1180
|
+
nonRetryable: true
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
await truncateThread(threadId, preAssistantLength, threadKey);
|
|
1184
|
+
continue;
|
|
1185
|
+
}
|
|
1110
1186
|
if (stateManager.getStatus() === "WAITING_FOR_INPUT") {
|
|
1111
1187
|
const conditionMet = await condition(
|
|
1112
1188
|
() => stateManager.getStatus() === "RUNNING",
|