zeitlich 0.2.42 → 0.2.44

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.
Files changed (58) hide show
  1. package/dist/{activities-CrN-ghLo.d.ts → activities-CPIB2v2C.d.ts} +4 -4
  2. package/dist/{activities-Coafq5zr.d.cts → activities-DnmNOnq4.d.cts} +4 -4
  3. package/dist/adapters/sandbox/daytona/index.d.cts +2 -2
  4. package/dist/adapters/sandbox/daytona/index.d.ts +2 -2
  5. package/dist/adapters/sandbox/daytona/workflow.d.cts +1 -1
  6. package/dist/adapters/sandbox/daytona/workflow.d.ts +1 -1
  7. package/dist/adapters/sandbox/e2b/index.d.cts +1 -1
  8. package/dist/adapters/sandbox/e2b/index.d.ts +1 -1
  9. package/dist/adapters/thread/anthropic/index.d.cts +4 -4
  10. package/dist/adapters/thread/anthropic/index.d.ts +4 -4
  11. package/dist/adapters/thread/anthropic/workflow.d.cts +4 -4
  12. package/dist/adapters/thread/anthropic/workflow.d.ts +4 -4
  13. package/dist/adapters/thread/google-genai/index.d.cts +4 -4
  14. package/dist/adapters/thread/google-genai/index.d.ts +4 -4
  15. package/dist/adapters/thread/google-genai/workflow.d.cts +4 -4
  16. package/dist/adapters/thread/google-genai/workflow.d.ts +4 -4
  17. package/dist/adapters/thread/langchain/index.cjs +11 -11
  18. package/dist/adapters/thread/langchain/index.cjs.map +1 -1
  19. package/dist/adapters/thread/langchain/index.d.cts +4 -4
  20. package/dist/adapters/thread/langchain/index.d.ts +4 -4
  21. package/dist/adapters/thread/langchain/index.js +8 -12
  22. package/dist/adapters/thread/langchain/index.js.map +1 -1
  23. package/dist/adapters/thread/langchain/workflow.d.cts +4 -4
  24. package/dist/adapters/thread/langchain/workflow.d.ts +4 -4
  25. package/dist/index.cjs +73 -50
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +6 -6
  28. package/dist/index.d.ts +6 -6
  29. package/dist/index.js +73 -51
  30. package/dist/index.js.map +1 -1
  31. package/dist/{proxy-COqA95FW.d.ts → proxy-B7Xi1znZ.d.ts} +1 -1
  32. package/dist/{proxy-Bf7uI-Hw.d.cts → proxy-DTnc5rqT.d.cts} +1 -1
  33. package/dist/{thread-manager-Bi1XlbpJ.d.ts → thread-manager-BAv340mi.d.ts} +3 -3
  34. package/dist/{thread-manager-wRVVBFgj.d.cts → thread-manager-BWv6ZXI3.d.cts} +4 -4
  35. package/dist/{thread-manager-BsLO3Fgc.d.cts → thread-manager-BlX2TwRN.d.cts} +3 -3
  36. package/dist/{thread-manager-BhkOyQ1I.d.ts → thread-manager-D2xorI-J.d.ts} +4 -4
  37. package/dist/{types-CdALEF3z.d.cts → types-4Wmk-wRq.d.cts} +1 -1
  38. package/dist/{types-CjY93AWZ.d.cts → types-C90VoEpt.d.cts} +1 -1
  39. package/dist/{types-BkX4HLzi.d.ts → types-Clhqautb.d.ts} +1 -1
  40. package/dist/{types-ChAy_jSP.d.ts → types-DKsCdAtQ.d.ts} +1 -1
  41. package/dist/{types-C66-BVBr.d.cts → types-DRJt1TMi.d.cts} +1 -1
  42. package/dist/{types-gVa5XCWD.d.ts → types-DpFD8ofR.d.ts} +1 -1
  43. package/dist/{workflow-BwT5EybR.d.ts → workflow-D32TRMr-.d.ts} +2 -2
  44. package/dist/{workflow-DMmiaw6w.d.cts → workflow-XVt0ww8K.d.cts} +2 -2
  45. package/dist/workflow.cjs +65 -39
  46. package/dist/workflow.cjs.map +1 -1
  47. package/dist/workflow.d.cts +2 -2
  48. package/dist/workflow.d.ts +2 -2
  49. package/dist/workflow.js +65 -39
  50. package/dist/workflow.js.map +1 -1
  51. package/package.json +1 -1
  52. package/src/lib/.env +1 -0
  53. package/src/lib/session/session-edge-cases.integration.test.ts +16 -10
  54. package/src/lib/session/session.ts +54 -40
  55. package/src/lib/state/manager.integration.test.ts +27 -0
  56. package/src/lib/state/manager.ts +39 -1
  57. package/src/lib/subagent/workflow.ts +2 -2
  58. package/src/tools/bash/.env +1 -0
@@ -1,5 +1,5 @@
1
- export { A as AskUserQuestionArgs, B as BashArgs, D as DEFAULT_SUBAGENT_WORKFLOW_RUN_TIMEOUT, 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 THREAD_TTL_SECONDS, g as TaskCreateArgs, h as TaskGetArgs, i as TaskListArgs, j as TaskUpdateArgs, k as ToolExecutedEvent, l as TurnCompletedEvent, W as WorkflowConfig, m as WorkflowInput, n as WorkflowSessionInput, Z as ZeitlichObservabilitySinks, o as applyVirtualTreeMutations, p as askUserQuestionTool, q as bashTool, r as composeHooks, s as createAgentStateManager, t as createAskUserQuestionHandler, u as createBashToolDescription, v as createObservabilityHooks, w as createReadSkillHandler, x as createReadSkillTool, y as createSession, z as createTaskCreateHandler, C as createTaskGetHandler, E as createTaskListHandler, H as createTaskUpdateHandler, I as createToolRouter, J as defineSubagent, K as defineSubagentWorkflow, L as defineTool, M as defineWorkflow, N as editTool, P as filesWithMimeType, Q as formatVirtualFileTree, U as getShortId, V as getThreadListKey, X as getThreadMetaKey, Y as globTool, _ as grepTool, $ as hasDirectory, a0 as hasFileWithMimeType, a1 as hasNoOtherToolCalls, a2 as parseSkillFile, a3 as proxyRunAgent, a4 as proxyVirtualFsOps, a5 as readFileTool, a6 as taskCreateTool, a7 as taskGetTool, a8 as taskListTool, a9 as taskUpdateTool, aa as writeFileTool } from './workflow-DMmiaw6w.cjs';
2
- export { d as ActivityToolHandler, m as AgentConfig, n as AgentFile, A as AgentResponse, o as AgentState, p as AgentStateManager, q as AgentStatus, r as AppendToolResultFn, B as BaseAgentState, s as FileEntry, F as FileEntryMetadata, j as FileResolver, H as Hooks, I as InferToolResults, t as JsonPrimitive, u as JsonSerializable, J as JsonValue, a as ModelInvoker, M as ModelInvokerConfig, v as ParsedToolCall, w as ParsedToolCallUnion, P as PersistedThreadState, x as PostHumanMessageAppendHook, y as PostHumanMessageAppendHookContext, z as PostToolUseFailureHook, C as PostToolUseFailureHookContext, D as PostToolUseFailureHookResult, E as PostToolUseHook, G as PostToolUseHookContext, K as PreHumanMessageAppendHook, L as PreHumanMessageAppendHookContext, N as PreToolUseHook, O as PreToolUseHookContext, Q as PreToolUseHookResult, b as PrefixedThreadOps, l as PrefixedVirtualFsOps, U as ProcessToolCallsContext, W as ProcessToolCallsResult, X as RawToolCall, Y as RewindSignal, R as RouterContext, Z as RunAgentActivity, f as RunAgentConfig, _ as SandboxInit, $ as SandboxShutdown, S as ScopedPrefix, a0 as SerializableToolDefinition, a1 as SessionConfig, a2 as SessionEndHook, a3 as SessionEndHookContext, a4 as SessionExitReason, a5 as SessionRequiredCaps, a6 as SessionResult, a7 as SessionStartHook, a8 as SessionStartHookContext, i as Skill, h as SkillMetadata, g as SkillProvider, a9 as SubagentChildWorkflowOptions, aa as SubagentConfig, ab as SubagentContinuationCaps, ac as SubagentDefinition, ad as SubagentFnResult, ae as SubagentHandlerResponse, af as SubagentHooks, ag as SubagentSandboxConfig, ah as SubagentSandboxShutdown, ai as SubagentSessionInput, aj as SubagentWorkflow, ak as SubagentWorkflowInput, al as TaskStatus, am as ThreadInit, T as ThreadOps, an as TokenUsage, ao as ToolArgs, ap as ToolCallResult, aq as ToolCallResultUnion, ar as ToolDefinition, as as ToolHandler, c as ToolHandlerResponse, at as ToolHooks, au as ToolMap, av as ToolNames, aw as ToolResult, e as ToolResultConfig, ax as ToolRouter, ay as ToolRouterHooks, az as ToolWithHandler, k as TreeMutation, aB as VirtualFileTree, aC as VirtualFsOps, aD as VirtualFsState, aE as WorkflowTask, aF as ZeitlichSession, aG as isTerminalStatus } from './types-CdALEF3z.cjs';
1
+ export { a9 as AskUserQuestionArgs, B as BashArgs, D as DEFAULT_SUBAGENT_WORKFLOW_RUN_TIMEOUT, F as FileEditArgs, a as FileReadArgs, b as FileWriteArgs, G as GlobArgs, M as GrepArgs, O as ObservabilityHooks, R as ReadSkillArgs, s as SessionEndedEvent, S as SessionStartedEvent, E as SubagentArgs, T as THREAD_TTL_SECONDS, V as TaskCreateArgs, _ as TaskGetArgs, a1 as TaskListArgs, a4 as TaskUpdateArgs, u as ToolExecutedEvent, t as TurnCompletedEvent, W as WorkflowConfig, f as WorkflowInput, g as WorkflowSessionInput, Z as ZeitlichObservabilitySinks, w as applyVirtualTreeMutations, a8 as askUserQuestionTool, a6 as bashTool, r as composeHooks, k as createAgentStateManager, aa as createAskUserQuestionHandler, a7 as createBashToolDescription, q as createObservabilityHooks, J as createReadSkillHandler, I as createReadSkillTool, d as createSession, X as createTaskCreateHandler, $ as createTaskGetHandler, a2 as createTaskListHandler, a5 as createTaskUpdateHandler, l as createToolRouter, o as defineSubagent, p as defineSubagentWorkflow, n as defineTool, e as defineWorkflow, Q as editTool, z as filesWithMimeType, x as formatVirtualFileTree, h as getShortId, i as getThreadListKey, j as getThreadMetaKey, K as globTool, L as grepTool, A as hasDirectory, y as hasFileWithMimeType, m as hasNoOtherToolCalls, H as parseSkillFile, v as proxyRunAgent, C as proxyVirtualFsOps, N as readFileTool, U as taskCreateTool, Y as taskGetTool, a0 as taskListTool, a3 as taskUpdateTool, P as writeFileTool } from './workflow-XVt0ww8K.cjs';
2
+ export { d as ActivityToolHandler, al as AgentConfig, ak as AgentFile, A as AgentResponse, u as AgentState, v as AgentStateManager, aj as AgentStatus, a5 as AppendToolResultFn, B as BaseAgentState, aD as FileEntry, F as FileEntryMetadata, j as FileResolver, a9 as Hooks, W as InferToolResults, x as JsonPrimitive, w as JsonSerializable, J as JsonValue, a as ModelInvoker, M as ModelInvokerConfig, G as ParsedToolCall, H as ParsedToolCallUnion, P as PersistedThreadState, ag as PostHumanMessageAppendHook, ah as PostHumanMessageAppendHookContext, a1 as PostToolUseFailureHook, a2 as PostToolUseFailureHookContext, a3 as PostToolUseFailureHookResult, $ as PostToolUseHook, a0 as PostToolUseHookContext, ae as PreHumanMessageAppendHook, af as PreHumanMessageAppendHookContext, X as PreToolUseHook, Y as PreToolUseHookContext, _ as PreToolUseHookResult, b as PrefixedThreadOps, l as PrefixedVirtualFsOps, a6 as ProcessToolCallsContext, a7 as ProcessToolCallsResult, E as RawToolCall, a8 as RewindSignal, R as RouterContext, ar as RunAgentActivity, f as RunAgentConfig, r as SandboxInit, s as SandboxShutdown, S as ScopedPrefix, an as SerializableToolDefinition, o as SessionConfig, ac as SessionEndHook, ad as SessionEndHookContext, am as SessionExitReason, p as SessionRequiredCaps, n as SessionResult, aa as SessionStartHook, ab as SessionStartHookContext, i as Skill, h as SkillMetadata, g as SkillProvider, at as SubagentChildWorkflowOptions, as as SubagentConfig, az as SubagentContinuationCaps, au as SubagentDefinition, av as SubagentFnResult, ax as SubagentHandlerResponse, aw as SubagentHooks, ay as SubagentSandboxConfig, t as SubagentSandboxShutdown, aC as SubagentSessionInput, aA as SubagentWorkflow, aB as SubagentWorkflowInput, ao as TaskStatus, q as ThreadInit, T as ThreadOps, ai as TokenUsage, N as ToolArgs, Q as ToolCallResult, U as ToolCallResultUnion, y as ToolDefinition, L as ToolHandler, c as ToolHandlerResponse, a4 as ToolHooks, C as ToolMap, D as ToolNames, O as ToolResult, e as ToolResultConfig, I as ToolRouter, K as ToolRouterHooks, z as ToolWithHandler, k as TreeMutation, aE as VirtualFileTree, aF as VirtualFsOps, aG as VirtualFsState, ap as WorkflowTask, Z as ZeitlichSession, aq as isTerminalStatus } from './types-4Wmk-wRq.cjs';
3
3
  export { i as ExecOptions, E as ExecResult, P as PrefixedSandboxOps, b as Sandbox, e as SandboxCapabilities, h as SandboxCapability, a as SandboxCreateOptions, f as SandboxCreateResult, D as SandboxDirentEntry, F as SandboxFileStat, c as SandboxFileSystem, j as SandboxNotFoundError, k as SandboxNotSupportedError, S as SandboxOps, d as SandboxProvider, g as SandboxSnapshot } from './types-CJ7tCdl6.cjs';
4
4
  import 'zod';
5
5
  import '@temporalio/common';
@@ -1,5 +1,5 @@
1
- export { A as AskUserQuestionArgs, B as BashArgs, D as DEFAULT_SUBAGENT_WORKFLOW_RUN_TIMEOUT, 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 THREAD_TTL_SECONDS, g as TaskCreateArgs, h as TaskGetArgs, i as TaskListArgs, j as TaskUpdateArgs, k as ToolExecutedEvent, l as TurnCompletedEvent, W as WorkflowConfig, m as WorkflowInput, n as WorkflowSessionInput, Z as ZeitlichObservabilitySinks, o as applyVirtualTreeMutations, p as askUserQuestionTool, q as bashTool, r as composeHooks, s as createAgentStateManager, t as createAskUserQuestionHandler, u as createBashToolDescription, v as createObservabilityHooks, w as createReadSkillHandler, x as createReadSkillTool, y as createSession, z as createTaskCreateHandler, C as createTaskGetHandler, E as createTaskListHandler, H as createTaskUpdateHandler, I as createToolRouter, J as defineSubagent, K as defineSubagentWorkflow, L as defineTool, M as defineWorkflow, N as editTool, P as filesWithMimeType, Q as formatVirtualFileTree, U as getShortId, V as getThreadListKey, X as getThreadMetaKey, Y as globTool, _ as grepTool, $ as hasDirectory, a0 as hasFileWithMimeType, a1 as hasNoOtherToolCalls, a2 as parseSkillFile, a3 as proxyRunAgent, a4 as proxyVirtualFsOps, a5 as readFileTool, a6 as taskCreateTool, a7 as taskGetTool, a8 as taskListTool, a9 as taskUpdateTool, aa as writeFileTool } from './workflow-BwT5EybR.js';
2
- export { d as ActivityToolHandler, m as AgentConfig, n as AgentFile, A as AgentResponse, o as AgentState, p as AgentStateManager, q as AgentStatus, r as AppendToolResultFn, B as BaseAgentState, s as FileEntry, F as FileEntryMetadata, j as FileResolver, H as Hooks, I as InferToolResults, t as JsonPrimitive, u as JsonSerializable, J as JsonValue, a as ModelInvoker, M as ModelInvokerConfig, v as ParsedToolCall, w as ParsedToolCallUnion, P as PersistedThreadState, x as PostHumanMessageAppendHook, y as PostHumanMessageAppendHookContext, z as PostToolUseFailureHook, C as PostToolUseFailureHookContext, D as PostToolUseFailureHookResult, E as PostToolUseHook, G as PostToolUseHookContext, K as PreHumanMessageAppendHook, L as PreHumanMessageAppendHookContext, N as PreToolUseHook, O as PreToolUseHookContext, Q as PreToolUseHookResult, b as PrefixedThreadOps, l as PrefixedVirtualFsOps, U as ProcessToolCallsContext, W as ProcessToolCallsResult, X as RawToolCall, Y as RewindSignal, R as RouterContext, Z as RunAgentActivity, f as RunAgentConfig, _ as SandboxInit, $ as SandboxShutdown, S as ScopedPrefix, a0 as SerializableToolDefinition, a1 as SessionConfig, a2 as SessionEndHook, a3 as SessionEndHookContext, a4 as SessionExitReason, a5 as SessionRequiredCaps, a6 as SessionResult, a7 as SessionStartHook, a8 as SessionStartHookContext, i as Skill, h as SkillMetadata, g as SkillProvider, a9 as SubagentChildWorkflowOptions, aa as SubagentConfig, ab as SubagentContinuationCaps, ac as SubagentDefinition, ad as SubagentFnResult, ae as SubagentHandlerResponse, af as SubagentHooks, ag as SubagentSandboxConfig, ah as SubagentSandboxShutdown, ai as SubagentSessionInput, aj as SubagentWorkflow, ak as SubagentWorkflowInput, al as TaskStatus, am as ThreadInit, T as ThreadOps, an as TokenUsage, ao as ToolArgs, ap as ToolCallResult, aq as ToolCallResultUnion, ar as ToolDefinition, as as ToolHandler, c as ToolHandlerResponse, at as ToolHooks, au as ToolMap, av as ToolNames, aw as ToolResult, e as ToolResultConfig, ax as ToolRouter, ay as ToolRouterHooks, az as ToolWithHandler, k as TreeMutation, aB as VirtualFileTree, aC as VirtualFsOps, aD as VirtualFsState, aE as WorkflowTask, aF as ZeitlichSession, aG as isTerminalStatus } from './types-ChAy_jSP.js';
1
+ export { a9 as AskUserQuestionArgs, B as BashArgs, D as DEFAULT_SUBAGENT_WORKFLOW_RUN_TIMEOUT, F as FileEditArgs, a as FileReadArgs, b as FileWriteArgs, G as GlobArgs, M as GrepArgs, O as ObservabilityHooks, R as ReadSkillArgs, s as SessionEndedEvent, S as SessionStartedEvent, E as SubagentArgs, T as THREAD_TTL_SECONDS, V as TaskCreateArgs, _ as TaskGetArgs, a1 as TaskListArgs, a4 as TaskUpdateArgs, u as ToolExecutedEvent, t as TurnCompletedEvent, W as WorkflowConfig, f as WorkflowInput, g as WorkflowSessionInput, Z as ZeitlichObservabilitySinks, w as applyVirtualTreeMutations, a8 as askUserQuestionTool, a6 as bashTool, r as composeHooks, k as createAgentStateManager, aa as createAskUserQuestionHandler, a7 as createBashToolDescription, q as createObservabilityHooks, J as createReadSkillHandler, I as createReadSkillTool, d as createSession, X as createTaskCreateHandler, $ as createTaskGetHandler, a2 as createTaskListHandler, a5 as createTaskUpdateHandler, l as createToolRouter, o as defineSubagent, p as defineSubagentWorkflow, n as defineTool, e as defineWorkflow, Q as editTool, z as filesWithMimeType, x as formatVirtualFileTree, h as getShortId, i as getThreadListKey, j as getThreadMetaKey, K as globTool, L as grepTool, A as hasDirectory, y as hasFileWithMimeType, m as hasNoOtherToolCalls, H as parseSkillFile, v as proxyRunAgent, C as proxyVirtualFsOps, N as readFileTool, U as taskCreateTool, Y as taskGetTool, a0 as taskListTool, a3 as taskUpdateTool, P as writeFileTool } from './workflow-D32TRMr-.js';
2
+ export { d as ActivityToolHandler, al as AgentConfig, ak as AgentFile, A as AgentResponse, u as AgentState, v as AgentStateManager, aj as AgentStatus, a5 as AppendToolResultFn, B as BaseAgentState, aD as FileEntry, F as FileEntryMetadata, j as FileResolver, a9 as Hooks, W as InferToolResults, x as JsonPrimitive, w as JsonSerializable, J as JsonValue, a as ModelInvoker, M as ModelInvokerConfig, G as ParsedToolCall, H as ParsedToolCallUnion, P as PersistedThreadState, ag as PostHumanMessageAppendHook, ah as PostHumanMessageAppendHookContext, a1 as PostToolUseFailureHook, a2 as PostToolUseFailureHookContext, a3 as PostToolUseFailureHookResult, $ as PostToolUseHook, a0 as PostToolUseHookContext, ae as PreHumanMessageAppendHook, af as PreHumanMessageAppendHookContext, X as PreToolUseHook, Y as PreToolUseHookContext, _ as PreToolUseHookResult, b as PrefixedThreadOps, l as PrefixedVirtualFsOps, a6 as ProcessToolCallsContext, a7 as ProcessToolCallsResult, E as RawToolCall, a8 as RewindSignal, R as RouterContext, ar as RunAgentActivity, f as RunAgentConfig, r as SandboxInit, s as SandboxShutdown, S as ScopedPrefix, an as SerializableToolDefinition, o as SessionConfig, ac as SessionEndHook, ad as SessionEndHookContext, am as SessionExitReason, p as SessionRequiredCaps, n as SessionResult, aa as SessionStartHook, ab as SessionStartHookContext, i as Skill, h as SkillMetadata, g as SkillProvider, at as SubagentChildWorkflowOptions, as as SubagentConfig, az as SubagentContinuationCaps, au as SubagentDefinition, av as SubagentFnResult, ax as SubagentHandlerResponse, aw as SubagentHooks, ay as SubagentSandboxConfig, t as SubagentSandboxShutdown, aC as SubagentSessionInput, aA as SubagentWorkflow, aB as SubagentWorkflowInput, ao as TaskStatus, q as ThreadInit, T as ThreadOps, ai as TokenUsage, N as ToolArgs, Q as ToolCallResult, U as ToolCallResultUnion, y as ToolDefinition, L as ToolHandler, c as ToolHandlerResponse, a4 as ToolHooks, C as ToolMap, D as ToolNames, O as ToolResult, e as ToolResultConfig, I as ToolRouter, K as ToolRouterHooks, z as ToolWithHandler, k as TreeMutation, aE as VirtualFileTree, aF as VirtualFsOps, aG as VirtualFsState, ap as WorkflowTask, Z as ZeitlichSession, aq as isTerminalStatus } from './types-DKsCdAtQ.js';
3
3
  export { i as ExecOptions, E as ExecResult, P as PrefixedSandboxOps, b as Sandbox, e as SandboxCapabilities, h as SandboxCapability, a as SandboxCreateOptions, f as SandboxCreateResult, D as SandboxDirentEntry, F as SandboxFileStat, c as SandboxFileSystem, j as SandboxNotFoundError, k as SandboxNotSupportedError, S as SandboxOps, d as SandboxProvider, g as SandboxSnapshot } from './types-CJ7tCdl6.js';
4
4
  import 'zod';
5
5
  import '@temporalio/common';
package/dist/workflow.js CHANGED
@@ -1166,42 +1166,6 @@ async function createSession(config) {
1166
1166
  ...baseSnapshot && { baseSnapshot }
1167
1167
  });
1168
1168
  }
1169
- if (virtualFsConfig) {
1170
- if (!virtualFsOps) {
1171
- throw ApplicationFailure.create({
1172
- message: "No virtualFsOps provided \u2014 cannot resolve file tree",
1173
- nonRetryable: true
1174
- });
1175
- }
1176
- const result = await virtualFsOps.resolveFileTree(virtualFsConfig.ctx);
1177
- const skillFiles = skills ? collectSkillFiles(skills) : void 0;
1178
- const fileTree = skillFiles ? [
1179
- ...result.fileTree,
1180
- ...Object.entries(skillFiles).map(([path, content]) => ({
1181
- id: `skill:${path}`,
1182
- path,
1183
- size: content.length,
1184
- mtime: (/* @__PURE__ */ new Date()).toISOString(),
1185
- metadata: {},
1186
- // Carry the content directly on the entry so any handler that
1187
- // constructs a VirtualFileSystem from `fileTree` can read it
1188
- // without needing to also wire up `inlineFiles` from state.
1189
- inlineContent: content
1190
- }))
1191
- ] : result.fileTree;
1192
- stateManager.mergeUpdate({
1193
- fileTree,
1194
- virtualFsCtx: virtualFsConfig.ctx,
1195
- // `inlineFiles` is still the source of truth at read time:
1196
- // VirtualFileSystem checks the inlineFiles map first and only
1197
- // falls through to entry.inlineContent. Embedding the content on
1198
- // the entry is the migration target so that handlers building a
1199
- // VirtualFileSystem from `fileTree` alone (without forwarding
1200
- // `inlineFiles` from state) can read skill resources. Until a
1201
- // follow-up drops `inlineFiles`, both fields are populated.
1202
- ...skillFiles && { inlineFiles: skillFiles }
1203
- });
1204
- }
1205
1169
  if (hooks.onSessionStart) {
1206
1170
  await hooks.onSessionStart({
1207
1171
  threadId,
@@ -1244,6 +1208,42 @@ async function createSession(config) {
1244
1208
  await initializeThread(threadId, threadKey);
1245
1209
  }
1246
1210
  }
1211
+ if (virtualFsConfig) {
1212
+ if (!virtualFsOps) {
1213
+ throw ApplicationFailure.create({
1214
+ message: "No virtualFsOps provided \u2014 cannot resolve file tree",
1215
+ nonRetryable: true
1216
+ });
1217
+ }
1218
+ const result = await virtualFsOps.resolveFileTree(virtualFsConfig.ctx);
1219
+ const skillFiles = skills ? collectSkillFiles(skills) : void 0;
1220
+ const fileTree = skillFiles ? [
1221
+ ...result.fileTree,
1222
+ ...Object.entries(skillFiles).map(([path, content]) => ({
1223
+ id: `skill:${path}`,
1224
+ path,
1225
+ size: content.length,
1226
+ mtime: (/* @__PURE__ */ new Date()).toISOString(),
1227
+ metadata: {},
1228
+ // Carry the content directly on the entry so any handler that
1229
+ // constructs a VirtualFileSystem from `fileTree` can read it
1230
+ // without needing to also wire up `inlineFiles` from state.
1231
+ inlineContent: content
1232
+ }))
1233
+ ] : result.fileTree;
1234
+ stateManager.mergeUpdate({
1235
+ fileTree,
1236
+ virtualFsCtx: virtualFsConfig.ctx,
1237
+ // `inlineFiles` is still the source of truth at read time:
1238
+ // VirtualFileSystem checks the inlineFiles map first and only
1239
+ // falls through to entry.inlineContent. Embedding the content on
1240
+ // the entry is the migration target so that handlers building a
1241
+ // VirtualFileSystem from `fileTree` alone (without forwarding
1242
+ // `inlineFiles` from state) can read skill resources. Until a
1243
+ // follow-up drops `inlineFiles`, both fields are populated.
1244
+ ...skillFiles && { inlineFiles: skillFiles }
1245
+ });
1246
+ }
1247
1247
  await appendHumanMessage(
1248
1248
  threadId,
1249
1249
  uuid4(),
@@ -1332,6 +1332,9 @@ async function createSession(config) {
1332
1332
  threadId,
1333
1333
  maxTurns
1334
1334
  });
1335
+ } else if (stateManager.getStatus() === "WAITING_FOR_INPUT") {
1336
+ exitReason = "waiting_for_input";
1337
+ log.info("session waiting for input", { agentName, threadId });
1335
1338
  }
1336
1339
  } catch (error) {
1337
1340
  exitReason = "failed";
@@ -1442,6 +1445,22 @@ function getThreadMetaKey(threadKey, threadId) {
1442
1445
  function isTerminalStatus(status) {
1443
1446
  return status === "COMPLETED" || status === "FAILED" || status === "CANCELLED";
1444
1447
  }
1448
+ var RESERVED_STATE_KEYS = [
1449
+ "status",
1450
+ "version",
1451
+ "turns",
1452
+ "tasks",
1453
+ "tools",
1454
+ "systemPrompt",
1455
+ "fileTree",
1456
+ "inlineFiles",
1457
+ "virtualFsCtx",
1458
+ "totalInputTokens",
1459
+ "totalOutputTokens",
1460
+ "totalReasonTokens",
1461
+ "cachedWriteTokens",
1462
+ "cachedReadTokens"
1463
+ ];
1445
1464
  function createAgentStateManager({
1446
1465
  initialState
1447
1466
  }) {
@@ -1595,9 +1614,16 @@ function createAgentStateManager({
1595
1614
  return deleted;
1596
1615
  },
1597
1616
  getPersistedSlice() {
1617
+ const source = customState;
1618
+ const custom2 = {};
1619
+ const reserved = new Set(RESERVED_STATE_KEYS);
1620
+ for (const [key, value] of Object.entries(source)) {
1621
+ if (reserved.has(key)) continue;
1622
+ custom2[key] = value;
1623
+ }
1598
1624
  return {
1599
1625
  tasks: Array.from(tasks.entries()),
1600
- custom: { ...customState }
1626
+ custom: custom2
1601
1627
  };
1602
1628
  },
1603
1629
  updateUsage(usage) {
@@ -1693,14 +1719,14 @@ function defineSubagentWorkflow(config, fn) {
1693
1719
  };
1694
1720
  const result = await fn(prompt, sessionInput, context ?? {});
1695
1721
  return {
1696
- ...result,
1697
1722
  ...capturedThreadId !== void 0 && { threadId: capturedThreadId },
1698
1723
  ...capturedSandboxId !== void 0 && { sandboxId: capturedSandboxId },
1699
1724
  ...capturedSnapshot !== void 0 && { snapshot: capturedSnapshot },
1700
1725
  ...capturedBaseSnapshot !== void 0 && {
1701
1726
  baseSnapshot: capturedBaseSnapshot
1702
1727
  },
1703
- ...capturedUsage !== void 0 && { usage: capturedUsage }
1728
+ ...capturedUsage !== void 0 && { usage: capturedUsage },
1729
+ ...result
1704
1730
  };
1705
1731
  };
1706
1732
  Object.defineProperty(workflow, "name", { value: config.name });