zeitlich 0.2.40 → 0.2.41

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 (64) hide show
  1. package/README.md +12 -1
  2. package/dist/{activities-CULxRzJ1.d.ts → activities-D_g13S3y.d.ts} +2 -2
  3. package/dist/{activities-CvUrG3YG.d.cts → activities-qUflxmfS.d.cts} +2 -2
  4. package/dist/adapters/sandbox/e2b/index.cjs +12 -3
  5. package/dist/adapters/sandbox/e2b/index.cjs.map +1 -1
  6. package/dist/adapters/sandbox/e2b/index.d.cts +35 -2
  7. package/dist/adapters/sandbox/e2b/index.d.ts +35 -2
  8. package/dist/adapters/sandbox/e2b/index.js +13 -4
  9. package/dist/adapters/sandbox/e2b/index.js.map +1 -1
  10. package/dist/adapters/thread/anthropic/index.d.cts +5 -5
  11. package/dist/adapters/thread/anthropic/index.d.ts +5 -5
  12. package/dist/adapters/thread/anthropic/workflow.d.cts +5 -5
  13. package/dist/adapters/thread/anthropic/workflow.d.ts +5 -5
  14. package/dist/adapters/thread/google-genai/index.d.cts +5 -5
  15. package/dist/adapters/thread/google-genai/index.d.ts +5 -5
  16. package/dist/adapters/thread/google-genai/workflow.d.cts +5 -5
  17. package/dist/adapters/thread/google-genai/workflow.d.ts +5 -5
  18. package/dist/adapters/thread/langchain/index.d.cts +5 -5
  19. package/dist/adapters/thread/langchain/index.d.ts +5 -5
  20. package/dist/adapters/thread/langchain/workflow.d.cts +5 -5
  21. package/dist/adapters/thread/langchain/workflow.d.ts +5 -5
  22. package/dist/index.cjs +92 -49
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +35 -9
  25. package/dist/index.d.ts +35 -9
  26. package/dist/index.js +93 -50
  27. package/dist/index.js.map +1 -1
  28. package/dist/{proxy-wZufFfBh.d.ts → proxy-BbcgoXg1.d.ts} +1 -1
  29. package/dist/{proxy-5EbwzaY4.d.cts → proxy-D7mvDEO6.d.cts} +1 -1
  30. package/dist/{thread-manager-BqBAIsED.d.ts → thread-manager-CTXPCu9W.d.ts} +2 -2
  31. package/dist/{thread-manager-BNiIt5r8.d.ts → thread-manager-Dqstsw4i.d.ts} +2 -2
  32. package/dist/{thread-manager-BoN5DOvG.d.cts → thread-manager-DrWfVjlj.d.cts} +2 -2
  33. package/dist/{thread-manager-DF8WuCRs.d.cts → thread-manager-cLhDhRRc.d.cts} +2 -2
  34. package/dist/{types-DeQH84C_.d.ts → types-BqTmyH31.d.ts} +42 -3
  35. package/dist/{types-CuISs0Ub.d.cts → types-CdvcmXb6.d.cts} +1 -1
  36. package/dist/{types-C7OoY7h8.d.ts → types-CjF1_Idx.d.ts} +1 -1
  37. package/dist/{types-Cn2r3ol3.d.cts → types-DjaQKUJx.d.cts} +42 -3
  38. package/dist/{workflow-DhplIN65.d.cts → workflow-CuqxgS6X.d.cts} +1 -1
  39. package/dist/{workflow-C2MZZj5K.d.ts → workflow-N1MNDoul.d.ts} +1 -1
  40. package/dist/workflow.cjs +39 -31
  41. package/dist/workflow.cjs.map +1 -1
  42. package/dist/workflow.d.cts +3 -3
  43. package/dist/workflow.d.ts +3 -3
  44. package/dist/workflow.js +40 -32
  45. package/dist/workflow.js.map +1 -1
  46. package/package.json +15 -6
  47. package/src/adapters/sandbox/e2b/README.md +81 -0
  48. package/src/adapters/sandbox/e2b/index.ts +32 -5
  49. package/src/adapters/sandbox/e2b/keep-alive.test.ts +115 -0
  50. package/src/adapters/sandbox/e2b/types.ts +34 -2
  51. package/src/index.ts +1 -1
  52. package/src/lib/session/session.integration.test.ts +58 -0
  53. package/src/lib/session/session.ts +12 -15
  54. package/src/lib/session/types.ts +8 -3
  55. package/src/lib/subagent/subagent.integration.test.ts +2 -0
  56. package/src/lib/subagent/types.ts +8 -0
  57. package/src/lib/subagent/workflow.ts +11 -1
  58. package/src/lib/tool-router/auto-append-sandbox.integration.test.ts +158 -0
  59. package/src/lib/tool-router/index.ts +1 -1
  60. package/src/lib/tool-router/with-sandbox.ts +45 -2
  61. package/src/lib/virtual-fs/filesystem.ts +41 -16
  62. package/src/lib/virtual-fs/types.ts +19 -0
  63. package/src/lib/virtual-fs/virtual-fs.test.ts +204 -1
  64. package/src/tools/read-file/handler.test.ts +83 -0
package/dist/index.d.cts CHANGED
@@ -1,16 +1,16 @@
1
- import { B as BashArgs, F as FileEditArgs, G as GlobArgs, a as FileReadArgs, b as FileWriteArgs } from './workflow-DhplIN65.cjs';
2
- export { A as AskUserQuestionArgs, D as DEFAULT_SUBAGENT_WORKFLOW_RUN_TIMEOUT, c as FileTreeAccessor, 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-DhplIN65.cjs';
3
- import { R as RouterContext, e as ToolResultConfig, d as ActivityToolHandler, J as JsonValue, c as ToolHandlerResponse, B as BaseAgentState, f as RunAgentConfig, g as SkillProvider, h as SkillMetadata, i as Skill, F as FileEntryMetadata, j as FileResolver, V as VirtualFsContext, k as TreeMutation, l as PrefixedVirtualFsOps } from './types-Cn2r3ol3.cjs';
4
- export { m as AgentConfig, n as AgentFile, A as AgentResponse, o as AgentState, p as AgentStateManager, q as AgentStatus, r as AppendToolResultFn, s as FileEntry, H as Hooks, I as InferToolResults, t as JsonPrimitive, u as JsonSerializable, 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, U as ProcessToolCallsContext, W as ProcessToolCallsResult, X as RawToolCall, Y as RewindSignal, Z as RunAgentActivity, _ as SandboxInit, $ as SandboxShutdown, S as ScopedPrefix, a0 as SerializableToolDefinition, a1 as SessionConfig, a2 as SessionEndHook, a3 as SessionEndHookContext, a4 as SessionExitReason, a5 as SessionResult, a6 as SessionStartHook, a7 as SessionStartHookContext, a8 as SubagentChildWorkflowOptions, a9 as SubagentConfig, aa as SubagentDefinition, ab as SubagentFnResult, ac as SubagentHandlerResponse, ad as SubagentHooks, ae as SubagentSandboxConfig, af as SubagentSandboxShutdown, ag as SubagentSessionInput, ah as SubagentWorkflow, ai as SubagentWorkflowInput, aj as TaskStatus, ak as ThreadInit, T as ThreadOps, al as TokenUsage, am as ToolArgs, an as ToolCallResult, ao as ToolCallResultUnion, ap as ToolDefinition, aq as ToolHandler, ar as ToolHooks, as as ToolMap, at as ToolNames, au as ToolResult, av as ToolRouter, aw as ToolRouterHooks, ax as ToolWithHandler, ay as VirtualFileSystem, az as VirtualFileTree, aA as VirtualFsOps, aB as VirtualFsState, aC as WorkflowTask, aD as ZeitlichSession, aE as isTerminalStatus } from './types-Cn2r3ol3.cjs';
1
+ import { B as BashArgs, F as FileEditArgs, G as GlobArgs, a as FileReadArgs, b as FileWriteArgs } from './workflow-CuqxgS6X.cjs';
2
+ export { A as AskUserQuestionArgs, D as DEFAULT_SUBAGENT_WORKFLOW_RUN_TIMEOUT, c as FileTreeAccessor, 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-CuqxgS6X.cjs';
3
+ import { R as RouterContext, e as ToolResultConfig, d as ActivityToolHandler, J as JsonValue, c as ToolHandlerResponse, B as BaseAgentState, f as RunAgentConfig, g as SkillProvider, h as SkillMetadata, i as Skill, F as FileEntryMetadata, j as FileResolver, V as VirtualFsContext, k as TreeMutation, l as PrefixedVirtualFsOps } from './types-DjaQKUJx.cjs';
4
+ export { m as AgentConfig, n as AgentFile, A as AgentResponse, o as AgentState, p as AgentStateManager, q as AgentStatus, r as AppendToolResultFn, s as FileEntry, H as Hooks, I as InferToolResults, t as JsonPrimitive, u as JsonSerializable, 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, U as ProcessToolCallsContext, W as ProcessToolCallsResult, X as RawToolCall, Y as RewindSignal, Z as RunAgentActivity, _ as SandboxInit, $ as SandboxShutdown, S as ScopedPrefix, a0 as SerializableToolDefinition, a1 as SessionConfig, a2 as SessionEndHook, a3 as SessionEndHookContext, a4 as SessionExitReason, a5 as SessionResult, a6 as SessionStartHook, a7 as SessionStartHookContext, a8 as SubagentChildWorkflowOptions, a9 as SubagentConfig, aa as SubagentDefinition, ab as SubagentFnResult, ac as SubagentHandlerResponse, ad as SubagentHooks, ae as SubagentSandboxConfig, af as SubagentSandboxShutdown, ag as SubagentSessionInput, ah as SubagentWorkflow, ai as SubagentWorkflowInput, aj as TaskStatus, ak as ThreadInit, T as ThreadOps, al as TokenUsage, am as ToolArgs, an as ToolCallResult, ao as ToolCallResultUnion, ap as ToolDefinition, aq as ToolHandler, ar as ToolHooks, as as ToolMap, at as ToolNames, au as ToolResult, av as ToolRouter, aw as ToolRouterHooks, ax as ToolWithHandler, ay as VirtualFileSystem, az as VirtualFileTree, aA as VirtualFsOps, aB as VirtualFsState, aC as WorkflowTask, aD as ZeitlichSession, aE as isTerminalStatus } from './types-DjaQKUJx.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-yx0LzPGn.cjs';
6
6
  export { h as ExecOptions, c as SandboxCapabilities, e as SandboxCreateResult, i as SandboxNotFoundError, j as SandboxNotSupportedError, g as SandboxOps } from './types-yx0LzPGn.cjs';
7
7
  import { WorkflowClient } from '@temporalio/client';
8
- import { a as ThreadManagerConfig, B as BaseThreadManager } from './types-CuISs0Ub.cjs';
9
- export { P as ProviderThreadManager } from './types-CuISs0Ub.cjs';
8
+ import { a as ThreadManagerConfig, B as BaseThreadManager } from './types-CdvcmXb6.cjs';
9
+ export { P as ProviderThreadManager } from './types-CdvcmXb6.cjs';
10
10
  import 'zod';
11
11
  import '@temporalio/workflow';
12
- import '@temporalio/common';
13
12
  import '@temporalio/common/lib/interfaces';
13
+ import '@temporalio/common';
14
14
  import 'ioredis';
15
15
 
16
16
  /**
@@ -42,6 +42,32 @@ import 'ioredis';
42
42
  */
43
43
  declare function withAutoAppend<TArgs, TResult, TContext extends RouterContext = RouterContext, TToolResponse = unknown>(threadHandler: (id: string, config: ToolResultConfig) => Promise<void>, handler: ActivityToolHandler<TArgs, TResult, TContext, TToolResponse>): ActivityToolHandler<TArgs, TResult, TContext>;
44
44
 
45
+ /**
46
+ * Options for {@link withSandbox}.
47
+ */
48
+ interface WithSandboxOptions {
49
+ /**
50
+ * If `true`, a {@link SandboxNotFoundError} thrown by `manager.getSandbox`
51
+ * is translated into a structured tool-handler response (instead of
52
+ * propagating). This lets the agent return a graceful error to the model
53
+ * rather than crashing the workflow when the backing sandbox has been
54
+ * killed mid-run (e.g. because the E2B `timeoutMs` lifetime elapsed).
55
+ *
56
+ * Off by default to preserve the existing contract for callers that rely
57
+ * on the error bubbling out. New callers should generally enable this in
58
+ * combination with the E2B `keepAliveMs` provider option.
59
+ *
60
+ * @default false
61
+ */
62
+ translateSandboxNotFound?: boolean;
63
+ /**
64
+ * Custom tool response returned to the agent when the backing sandbox
65
+ * is not found and `translateSandboxNotFound` is `true`. Defaults to a
66
+ * generic English message. Use this to localize, match agent persona,
67
+ * or give the model more specific recovery instructions.
68
+ */
69
+ sandboxNotFoundToolResponse?: string;
70
+ }
45
71
  /**
46
72
  * Extended router context with a resolved {@link Sandbox} instance.
47
73
  *
@@ -95,7 +121,7 @@ declare function withSandbox<TArgs, TResult, TSandbox extends Sandbox = Sandbox,
95
121
  }, handler: (args: TArgs, context: RouterContext & {
96
122
  sandbox: TSandbox;
97
123
  sandboxId: string;
98
- }) => Promise<ToolHandlerResponse<TResult, TToolResponse>>): ActivityToolHandler<TArgs, TResult | null, RouterContext, TToolResponse | string>;
124
+ }) => Promise<ToolHandlerResponse<TResult, TToolResponse>>, options?: WithSandboxOptions): ActivityToolHandler<TArgs, TResult | null, RouterContext, TToolResponse | string>;
99
125
 
100
126
  /**
101
127
  * Safely retrieve Temporal activity heartbeat and cancellation signal.
@@ -518,4 +544,4 @@ declare const toTree: (fs: SandboxFileSystem, opts?: {
518
544
  sort?: boolean;
519
545
  }) => Promise<string>;
520
546
 
521
- 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 };
547
+ 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, type WithSandboxOptions, bashHandler, createRunAgentActivity, createThreadManager, createVirtualFsActivities, editHandler, getActivityContext, globHandler, queryParentWorkflowState, readFileHandler, toTree, withAutoAppend, withParentWorkflowState, withSandbox, withVirtualFs, writeFileHandler };
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
- import { B as BashArgs, F as FileEditArgs, G as GlobArgs, a as FileReadArgs, b as FileWriteArgs } from './workflow-C2MZZj5K.js';
2
- export { A as AskUserQuestionArgs, D as DEFAULT_SUBAGENT_WORKFLOW_RUN_TIMEOUT, c as FileTreeAccessor, 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-C2MZZj5K.js';
3
- import { R as RouterContext, e as ToolResultConfig, d as ActivityToolHandler, J as JsonValue, c as ToolHandlerResponse, B as BaseAgentState, f as RunAgentConfig, g as SkillProvider, h as SkillMetadata, i as Skill, F as FileEntryMetadata, j as FileResolver, V as VirtualFsContext, k as TreeMutation, l as PrefixedVirtualFsOps } from './types-DeQH84C_.js';
4
- export { m as AgentConfig, n as AgentFile, A as AgentResponse, o as AgentState, p as AgentStateManager, q as AgentStatus, r as AppendToolResultFn, s as FileEntry, H as Hooks, I as InferToolResults, t as JsonPrimitive, u as JsonSerializable, 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, U as ProcessToolCallsContext, W as ProcessToolCallsResult, X as RawToolCall, Y as RewindSignal, Z as RunAgentActivity, _ as SandboxInit, $ as SandboxShutdown, S as ScopedPrefix, a0 as SerializableToolDefinition, a1 as SessionConfig, a2 as SessionEndHook, a3 as SessionEndHookContext, a4 as SessionExitReason, a5 as SessionResult, a6 as SessionStartHook, a7 as SessionStartHookContext, a8 as SubagentChildWorkflowOptions, a9 as SubagentConfig, aa as SubagentDefinition, ab as SubagentFnResult, ac as SubagentHandlerResponse, ad as SubagentHooks, ae as SubagentSandboxConfig, af as SubagentSandboxShutdown, ag as SubagentSessionInput, ah as SubagentWorkflow, ai as SubagentWorkflowInput, aj as TaskStatus, ak as ThreadInit, T as ThreadOps, al as TokenUsage, am as ToolArgs, an as ToolCallResult, ao as ToolCallResultUnion, ap as ToolDefinition, aq as ToolHandler, ar as ToolHooks, as as ToolMap, at as ToolNames, au as ToolResult, av as ToolRouter, aw as ToolRouterHooks, ax as ToolWithHandler, ay as VirtualFileSystem, az as VirtualFileTree, aA as VirtualFsOps, aB as VirtualFsState, aC as WorkflowTask, aD as ZeitlichSession, aE as isTerminalStatus } from './types-DeQH84C_.js';
1
+ import { B as BashArgs, F as FileEditArgs, G as GlobArgs, a as FileReadArgs, b as FileWriteArgs } from './workflow-N1MNDoul.js';
2
+ export { A as AskUserQuestionArgs, D as DEFAULT_SUBAGENT_WORKFLOW_RUN_TIMEOUT, c as FileTreeAccessor, 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-N1MNDoul.js';
3
+ import { R as RouterContext, e as ToolResultConfig, d as ActivityToolHandler, J as JsonValue, c as ToolHandlerResponse, B as BaseAgentState, f as RunAgentConfig, g as SkillProvider, h as SkillMetadata, i as Skill, F as FileEntryMetadata, j as FileResolver, V as VirtualFsContext, k as TreeMutation, l as PrefixedVirtualFsOps } from './types-BqTmyH31.js';
4
+ export { m as AgentConfig, n as AgentFile, A as AgentResponse, o as AgentState, p as AgentStateManager, q as AgentStatus, r as AppendToolResultFn, s as FileEntry, H as Hooks, I as InferToolResults, t as JsonPrimitive, u as JsonSerializable, 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, U as ProcessToolCallsContext, W as ProcessToolCallsResult, X as RawToolCall, Y as RewindSignal, Z as RunAgentActivity, _ as SandboxInit, $ as SandboxShutdown, S as ScopedPrefix, a0 as SerializableToolDefinition, a1 as SessionConfig, a2 as SessionEndHook, a3 as SessionEndHookContext, a4 as SessionExitReason, a5 as SessionResult, a6 as SessionStartHook, a7 as SessionStartHookContext, a8 as SubagentChildWorkflowOptions, a9 as SubagentConfig, aa as SubagentDefinition, ab as SubagentFnResult, ac as SubagentHandlerResponse, ad as SubagentHooks, ae as SubagentSandboxConfig, af as SubagentSandboxShutdown, ag as SubagentSessionInput, ah as SubagentWorkflow, ai as SubagentWorkflowInput, aj as TaskStatus, ak as ThreadInit, T as ThreadOps, al as TokenUsage, am as ToolArgs, an as ToolCallResult, ao as ToolCallResultUnion, ap as ToolDefinition, aq as ToolHandler, ar as ToolHooks, as as ToolMap, at as ToolNames, au as ToolResult, av as ToolRouter, aw as ToolRouterHooks, ax as ToolWithHandler, ay as VirtualFileSystem, az as VirtualFileTree, aA as VirtualFsOps, aB as VirtualFsState, aC as WorkflowTask, aD as ZeitlichSession, aE as isTerminalStatus } from './types-BqTmyH31.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-yx0LzPGn.js';
6
6
  export { h as ExecOptions, c as SandboxCapabilities, e as SandboxCreateResult, i as SandboxNotFoundError, j as SandboxNotSupportedError, g as SandboxOps } from './types-yx0LzPGn.js';
7
7
  import { WorkflowClient } from '@temporalio/client';
8
- import { a as ThreadManagerConfig, B as BaseThreadManager } from './types-C7OoY7h8.js';
9
- export { P as ProviderThreadManager } from './types-C7OoY7h8.js';
8
+ import { a as ThreadManagerConfig, B as BaseThreadManager } from './types-CjF1_Idx.js';
9
+ export { P as ProviderThreadManager } from './types-CjF1_Idx.js';
10
10
  import 'zod';
11
11
  import '@temporalio/workflow';
12
- import '@temporalio/common';
13
12
  import '@temporalio/common/lib/interfaces';
13
+ import '@temporalio/common';
14
14
  import 'ioredis';
15
15
 
16
16
  /**
@@ -42,6 +42,32 @@ import 'ioredis';
42
42
  */
43
43
  declare function withAutoAppend<TArgs, TResult, TContext extends RouterContext = RouterContext, TToolResponse = unknown>(threadHandler: (id: string, config: ToolResultConfig) => Promise<void>, handler: ActivityToolHandler<TArgs, TResult, TContext, TToolResponse>): ActivityToolHandler<TArgs, TResult, TContext>;
44
44
 
45
+ /**
46
+ * Options for {@link withSandbox}.
47
+ */
48
+ interface WithSandboxOptions {
49
+ /**
50
+ * If `true`, a {@link SandboxNotFoundError} thrown by `manager.getSandbox`
51
+ * is translated into a structured tool-handler response (instead of
52
+ * propagating). This lets the agent return a graceful error to the model
53
+ * rather than crashing the workflow when the backing sandbox has been
54
+ * killed mid-run (e.g. because the E2B `timeoutMs` lifetime elapsed).
55
+ *
56
+ * Off by default to preserve the existing contract for callers that rely
57
+ * on the error bubbling out. New callers should generally enable this in
58
+ * combination with the E2B `keepAliveMs` provider option.
59
+ *
60
+ * @default false
61
+ */
62
+ translateSandboxNotFound?: boolean;
63
+ /**
64
+ * Custom tool response returned to the agent when the backing sandbox
65
+ * is not found and `translateSandboxNotFound` is `true`. Defaults to a
66
+ * generic English message. Use this to localize, match agent persona,
67
+ * or give the model more specific recovery instructions.
68
+ */
69
+ sandboxNotFoundToolResponse?: string;
70
+ }
45
71
  /**
46
72
  * Extended router context with a resolved {@link Sandbox} instance.
47
73
  *
@@ -95,7 +121,7 @@ declare function withSandbox<TArgs, TResult, TSandbox extends Sandbox = Sandbox,
95
121
  }, handler: (args: TArgs, context: RouterContext & {
96
122
  sandbox: TSandbox;
97
123
  sandboxId: string;
98
- }) => Promise<ToolHandlerResponse<TResult, TToolResponse>>): ActivityToolHandler<TArgs, TResult | null, RouterContext, TToolResponse | string>;
124
+ }) => Promise<ToolHandlerResponse<TResult, TToolResponse>>, options?: WithSandboxOptions): ActivityToolHandler<TArgs, TResult | null, RouterContext, TToolResponse | string>;
99
125
 
100
126
  /**
101
127
  * Safely retrieve Temporal activity heartbeat and cancellation signal.
@@ -518,4 +544,4 @@ declare const toTree: (fs: SandboxFileSystem, opts?: {
518
544
  sort?: boolean;
519
545
  }) => Promise<string>;
520
546
 
521
- 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 };
547
+ 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, type WithSandboxOptions, bashHandler, createRunAgentActivity, createThreadManager, createVirtualFsActivities, editHandler, getActivityContext, globHandler, queryParentWorkflowState, readFileHandler, toTree, withAutoAppend, withParentWorkflowState, withSandbox, withVirtualFs, writeFileHandler };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineSignal, CancellationScope, isCancellation, 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, defineQuery, condition, proxySinks, workflowInfo, proxyActivities, getExternalWorkflowHandle, executeChild } from '@temporalio/workflow';
2
2
  import z14, { z } from 'zod';
3
3
  import { randomUUID, randomFillSync } from 'crypto';
4
4
  import { ApplicationFailure as ApplicationFailure$1 } from '@temporalio/common';
@@ -951,7 +951,6 @@ async function createSession({
951
951
  processToolsInParallel = true,
952
952
  hooks = {},
953
953
  appendSystemPrompt = true,
954
- waitForInputTimeout = "48h",
955
954
  threadKey,
956
955
  sandboxOps,
957
956
  thread: threadInit,
@@ -1134,12 +1133,23 @@ async function createSession({
1134
1133
  path,
1135
1134
  size: content.length,
1136
1135
  mtime: (/* @__PURE__ */ new Date()).toISOString(),
1137
- metadata: {}
1136
+ metadata: {},
1137
+ // Carry the content directly on the entry so any handler that
1138
+ // constructs a VirtualFileSystem from `fileTree` can read it
1139
+ // without needing to also wire up `inlineFiles` from state.
1140
+ inlineContent: content
1138
1141
  }))
1139
1142
  ] : result.fileTree;
1140
1143
  stateManager.mergeUpdate({
1141
1144
  fileTree,
1142
1145
  virtualFsCtx: virtualFsConfig.ctx,
1146
+ // `inlineFiles` is still the source of truth at read time:
1147
+ // VirtualFileSystem checks the inlineFiles map first and only
1148
+ // falls through to entry.inlineContent. Embedding the content on
1149
+ // the entry is the migration target so that handlers building a
1150
+ // VirtualFileSystem from `fileTree` alone (without forwarding
1151
+ // `inlineFiles` from state) can read skill resources. Until a
1152
+ // follow-up drops `inlineFiles`, both fields are populated.
1143
1153
  ...skillFiles && { inlineFiles: skillFiles }
1144
1154
  });
1145
1155
  }
@@ -1265,18 +1275,6 @@ async function createSession({
1265
1275
  continue;
1266
1276
  }
1267
1277
  assistantId = void 0;
1268
- if (stateManager.getStatus() === "WAITING_FOR_INPUT") {
1269
- const conditionMet = await condition(
1270
- () => stateManager.getStatus() === "RUNNING",
1271
- waitForInputTimeout
1272
- );
1273
- if (!conditionMet) {
1274
- stateManager.cancel();
1275
- exitReason = "cancelled";
1276
- await condition(() => false, "2s");
1277
- break;
1278
- }
1279
- }
1280
1278
  }
1281
1279
  if (stateManager.getTurns() >= maxTurns && stateManager.isRunning()) {
1282
1280
  exitReason = "max_turns";
@@ -1350,7 +1348,8 @@ async function createSession({
1350
1348
  onSessionExit({
1351
1349
  ...sandboxId && { sandboxId },
1352
1350
  ...exitSnapshot && { snapshot: exitSnapshot },
1353
- threadId
1351
+ threadId,
1352
+ usage: stateManager.getTotalUsage()
1354
1353
  });
1355
1354
  }
1356
1355
  return {
@@ -1638,9 +1637,24 @@ function withAutoAppend(threadHandler, handler) {
1638
1637
  };
1639
1638
  };
1640
1639
  }
1640
+ var SandboxNotSupportedError = class extends ApplicationFailure$1 {
1641
+ constructor(operation) {
1642
+ super(
1643
+ `Sandbox does not support: ${operation}`,
1644
+ "SandboxNotSupportedError",
1645
+ true
1646
+ );
1647
+ }
1648
+ };
1649
+ var SandboxNotFoundError = class extends ApplicationFailure$1 {
1650
+ constructor(sandboxId) {
1651
+ super(`Sandbox not found: ${sandboxId}`, "SandboxNotFoundError", true);
1652
+ }
1653
+ };
1641
1654
 
1642
1655
  // src/lib/tool-router/with-sandbox.ts
1643
- function withSandbox(manager, handler) {
1656
+ function withSandbox(manager, handler, options) {
1657
+ const translateSandboxNotFound = options?.translateSandboxNotFound ?? false;
1644
1658
  return async (args, context) => {
1645
1659
  if (!context.sandboxId) {
1646
1660
  return {
@@ -1648,7 +1662,18 @@ function withSandbox(manager, handler) {
1648
1662
  data: null
1649
1663
  };
1650
1664
  }
1651
- const sandbox = await manager.getSandbox(context.sandboxId);
1665
+ let sandbox;
1666
+ try {
1667
+ sandbox = await manager.getSandbox(context.sandboxId);
1668
+ } catch (err) {
1669
+ if (translateSandboxNotFound && err instanceof SandboxNotFoundError) {
1670
+ return {
1671
+ toolResponse: options?.sandboxNotFoundToolResponse ?? `Error: the execution environment for the ${context.toolName} tool is no longer available, so this tool call could not be completed.`,
1672
+ data: null
1673
+ };
1674
+ }
1675
+ throw err;
1676
+ }
1652
1677
  return handler(args, { ...context, sandbox, sandboxId: context.sandboxId });
1653
1678
  };
1654
1679
  }
@@ -1680,6 +1705,7 @@ function defineSubagentWorkflow(config, fn) {
1680
1705
  let capturedSnapshot;
1681
1706
  let capturedBaseSnapshot;
1682
1707
  let capturedThreadId;
1708
+ let capturedUsage;
1683
1709
  const sessionInput = {
1684
1710
  agentName: config.name,
1685
1711
  sandboxShutdown: effectiveShutdown,
@@ -1696,10 +1722,17 @@ function defineSubagentWorkflow(config, fn) {
1696
1722
  });
1697
1723
  }
1698
1724
  },
1699
- onSessionExit: ({ sandboxId, snapshot, threadId }) => {
1725
+ onSessionExit: ({ sandboxId, snapshot, threadId, usage }) => {
1700
1726
  capturedSandboxId = sandboxId;
1701
1727
  capturedSnapshot = snapshot;
1702
1728
  capturedThreadId = threadId;
1729
+ capturedUsage = {
1730
+ inputTokens: usage.totalInputTokens,
1731
+ outputTokens: usage.totalOutputTokens,
1732
+ cachedWriteTokens: usage.totalCachedWriteTokens,
1733
+ cachedReadTokens: usage.totalCachedReadTokens,
1734
+ reasonTokens: usage.totalReasonTokens
1735
+ };
1703
1736
  }
1704
1737
  };
1705
1738
  const result = await fn(prompt, sessionInput, context ?? {});
@@ -1710,7 +1743,8 @@ function defineSubagentWorkflow(config, fn) {
1710
1743
  ...capturedSnapshot !== void 0 && { snapshot: capturedSnapshot },
1711
1744
  ...capturedBaseSnapshot !== void 0 && {
1712
1745
  baseSnapshot: capturedBaseSnapshot
1713
- }
1746
+ },
1747
+ ...capturedUsage !== void 0 && { usage: capturedUsage }
1714
1748
  };
1715
1749
  };
1716
1750
  Object.defineProperty(workflow, "name", { value: config.name });
@@ -1794,20 +1828,6 @@ function proxyRunAgent(scope, options) {
1794
1828
  );
1795
1829
  return acts[name];
1796
1830
  }
1797
- var SandboxNotSupportedError = class extends ApplicationFailure$1 {
1798
- constructor(operation) {
1799
- super(
1800
- `Sandbox does not support: ${operation}`,
1801
- "SandboxNotSupportedError",
1802
- true
1803
- );
1804
- }
1805
- };
1806
- var SandboxNotFoundError = class extends ApplicationFailure$1 {
1807
- constructor(sandboxId) {
1808
- super(`Sandbox not found: ${sandboxId}`, "SandboxNotFoundError", true);
1809
- }
1810
- };
1811
1831
 
1812
1832
  // src/lib/virtual-fs/mutations.ts
1813
1833
  function applyVirtualTreeMutations(stateManager, mutations) {
@@ -2920,7 +2940,7 @@ var VirtualFileSystem = class {
2920
2940
  if (inline !== void 0) return inline;
2921
2941
  const entry = this.entries.get(norm);
2922
2942
  if (!entry) throw new Error(`ENOENT: no such file: ${path}`);
2923
- return this.resolver.readFile(entry.id, this.ctx, entry.metadata);
2943
+ return this.readEntryContent(entry);
2924
2944
  }
2925
2945
  async readFileBuffer(path) {
2926
2946
  const norm = normalisePath(path, this.workspaceBase);
@@ -2928,8 +2948,23 @@ var VirtualFileSystem = class {
2928
2948
  if (inline !== void 0) return new TextEncoder().encode(inline);
2929
2949
  const entry = this.entries.get(norm);
2930
2950
  if (!entry) throw new Error(`ENOENT: no such file: ${path}`);
2951
+ if (entry.inlineContent !== void 0) {
2952
+ return new TextEncoder().encode(entry.inlineContent);
2953
+ }
2931
2954
  return this.resolver.readFileBuffer(entry.id, this.ctx, entry.metadata);
2932
2955
  }
2956
+ /**
2957
+ * Resolve the string content for an entry, preferring inline content
2958
+ * carried on the entry itself before consulting the resolver. Used by
2959
+ * `readFile`, `appendFile`, and `cp` so all read paths agree on the
2960
+ * lookup precedence.
2961
+ */
2962
+ readEntryContent(entry) {
2963
+ if (entry.inlineContent !== void 0) {
2964
+ return Promise.resolve(entry.inlineContent);
2965
+ }
2966
+ return this.resolver.readFile(entry.id, this.ctx, entry.metadata);
2967
+ }
2933
2968
  // --------------------------------------------------------------------------
2934
2969
  // Metadata operations — pure, resolved from the tree
2935
2970
  // --------------------------------------------------------------------------
@@ -3001,6 +3036,11 @@ var VirtualFileSystem = class {
3001
3036
  const norm = normalisePath(path, this.workspaceBase);
3002
3037
  const existing = this.entries.get(norm);
3003
3038
  if (existing) {
3039
+ if (existing.inlineContent !== void 0) {
3040
+ throw new Error(
3041
+ `EROFS: cannot write to inline (read-only) entry: ${path}`
3042
+ );
3043
+ }
3004
3044
  await this.resolver.writeFile(
3005
3045
  existing.id,
3006
3046
  content,
@@ -3029,11 +3069,12 @@ var VirtualFileSystem = class {
3029
3069
  if (!existing) {
3030
3070
  return this.writeFile(path, content);
3031
3071
  }
3032
- const current = await this.resolver.readFile(
3033
- existing.id,
3034
- this.ctx,
3035
- existing.metadata
3036
- );
3072
+ if (existing.inlineContent !== void 0) {
3073
+ throw new Error(
3074
+ `EROFS: cannot append to inline (read-only) entry: ${path}`
3075
+ );
3076
+ }
3077
+ const current = await this.readEntryContent(existing);
3037
3078
  const appended = typeof content === "string" ? current + content : current + new TextDecoder().decode(content);
3038
3079
  await this.resolver.writeFile(
3039
3080
  existing.id,
@@ -3068,6 +3109,11 @@ var VirtualFileSystem = class {
3068
3109
  const norm = normalisePath(path, this.workspaceBase);
3069
3110
  const entry = this.entries.get(norm);
3070
3111
  if (entry) {
3112
+ if (entry.inlineContent !== void 0) {
3113
+ throw new Error(
3114
+ `EROFS: cannot remove inline (read-only) entry: ${path}`
3115
+ );
3116
+ }
3071
3117
  await this.resolver.deleteFile(entry.id, this.ctx, entry.metadata);
3072
3118
  this.entries.delete(norm);
3073
3119
  this.mutations.push({ type: "remove", path: norm });
@@ -3080,6 +3126,11 @@ var VirtualFileSystem = class {
3080
3126
  const prefix = norm === "/" ? "/" : norm + "/";
3081
3127
  for (const [p, e] of this.entries) {
3082
3128
  if (p.startsWith(prefix)) {
3129
+ if (e.inlineContent !== void 0) {
3130
+ throw new Error(
3131
+ `EROFS: cannot remove inline (read-only) entry: ${p}`
3132
+ );
3133
+ }
3083
3134
  await this.resolver.deleteFile(e.id, this.ctx, e.metadata);
3084
3135
  this.entries.delete(p);
3085
3136
  this.mutations.push({ type: "remove", path: p });
@@ -3100,11 +3151,7 @@ var VirtualFileSystem = class {
3100
3151
  const normDest = normalisePath(dest, this.workspaceBase);
3101
3152
  const entry = this.entries.get(normSrc);
3102
3153
  if (entry) {
3103
- const content = await this.resolver.readFile(
3104
- entry.id,
3105
- this.ctx,
3106
- entry.metadata
3107
- );
3154
+ const content = await this.readEntryContent(entry);
3108
3155
  await this.writeFile(normDest, content);
3109
3156
  return;
3110
3157
  }
@@ -3118,11 +3165,7 @@ var VirtualFileSystem = class {
3118
3165
  for (const [p, e] of this.entries) {
3119
3166
  if (p.startsWith(prefix)) {
3120
3167
  const relative = p.slice(normSrc.length);
3121
- const content = await this.resolver.readFile(
3122
- e.id,
3123
- this.ctx,
3124
- e.metadata
3125
- );
3168
+ const content = await this.readEntryContent(e);
3126
3169
  await this.writeFile(normDest + relative, content);
3127
3170
  }
3128
3171
  }