zeitlich 0.2.22 → 0.2.23

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 (101) hide show
  1. package/README.md +242 -59
  2. package/dist/adapters/sandbox/daytona/index.cjs +4 -1
  3. package/dist/adapters/sandbox/daytona/index.cjs.map +1 -1
  4. package/dist/adapters/sandbox/daytona/index.d.cts +2 -1
  5. package/dist/adapters/sandbox/daytona/index.d.ts +2 -1
  6. package/dist/adapters/sandbox/daytona/index.js +4 -1
  7. package/dist/adapters/sandbox/daytona/index.js.map +1 -1
  8. package/dist/adapters/sandbox/daytona/workflow.cjs +1 -0
  9. package/dist/adapters/sandbox/daytona/workflow.cjs.map +1 -1
  10. package/dist/adapters/sandbox/daytona/workflow.d.cts +1 -1
  11. package/dist/adapters/sandbox/daytona/workflow.d.ts +1 -1
  12. package/dist/adapters/sandbox/daytona/workflow.js +1 -0
  13. package/dist/adapters/sandbox/daytona/workflow.js.map +1 -1
  14. package/dist/adapters/sandbox/inmemory/index.cjs +16 -2
  15. package/dist/adapters/sandbox/inmemory/index.cjs.map +1 -1
  16. package/dist/adapters/sandbox/inmemory/index.d.cts +3 -2
  17. package/dist/adapters/sandbox/inmemory/index.d.ts +3 -2
  18. package/dist/adapters/sandbox/inmemory/index.js +16 -2
  19. package/dist/adapters/sandbox/inmemory/index.js.map +1 -1
  20. package/dist/adapters/sandbox/inmemory/workflow.cjs +1 -0
  21. package/dist/adapters/sandbox/inmemory/workflow.cjs.map +1 -1
  22. package/dist/adapters/sandbox/inmemory/workflow.d.cts +1 -1
  23. package/dist/adapters/sandbox/inmemory/workflow.d.ts +1 -1
  24. package/dist/adapters/sandbox/inmemory/workflow.js +1 -0
  25. package/dist/adapters/sandbox/inmemory/workflow.js.map +1 -1
  26. package/dist/adapters/sandbox/virtual/index.cjs +33 -9
  27. package/dist/adapters/sandbox/virtual/index.cjs.map +1 -1
  28. package/dist/adapters/sandbox/virtual/index.d.cts +6 -5
  29. package/dist/adapters/sandbox/virtual/index.d.ts +6 -5
  30. package/dist/adapters/sandbox/virtual/index.js +33 -9
  31. package/dist/adapters/sandbox/virtual/index.js.map +1 -1
  32. package/dist/adapters/sandbox/virtual/workflow.cjs +1 -0
  33. package/dist/adapters/sandbox/virtual/workflow.cjs.map +1 -1
  34. package/dist/adapters/sandbox/virtual/workflow.d.cts +3 -3
  35. package/dist/adapters/sandbox/virtual/workflow.d.ts +3 -3
  36. package/dist/adapters/sandbox/virtual/workflow.js +1 -0
  37. package/dist/adapters/sandbox/virtual/workflow.js.map +1 -1
  38. package/dist/adapters/thread/google-genai/index.d.cts +3 -3
  39. package/dist/adapters/thread/google-genai/index.d.ts +3 -3
  40. package/dist/adapters/thread/google-genai/workflow.d.cts +3 -3
  41. package/dist/adapters/thread/google-genai/workflow.d.ts +3 -3
  42. package/dist/adapters/thread/langchain/index.d.cts +3 -3
  43. package/dist/adapters/thread/langchain/index.d.ts +3 -3
  44. package/dist/adapters/thread/langchain/workflow.d.cts +3 -3
  45. package/dist/adapters/thread/langchain/workflow.d.ts +3 -3
  46. package/dist/index.cjs +247 -57
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.cts +9 -8
  49. package/dist/index.d.ts +9 -8
  50. package/dist/index.js +245 -55
  51. package/dist/index.js.map +1 -1
  52. package/dist/{queries-Bw6WEPMw.d.cts → queries-DModcWRy.d.cts} +1 -1
  53. package/dist/{queries-C27raDaB.d.ts → queries-byD0jr1Y.d.ts} +1 -1
  54. package/dist/{types-ClsHhtwL.d.cts → types-B50pBPEV.d.ts} +159 -35
  55. package/dist/{types-YbL7JpEA.d.cts → types-Bll19FZJ.d.cts} +7 -0
  56. package/dist/{types-YbL7JpEA.d.ts → types-Bll19FZJ.d.ts} +7 -0
  57. package/dist/{types-BJ8itUAl.d.cts → types-BuXdFhaZ.d.cts} +6 -6
  58. package/dist/{types-HBosetv3.d.cts → types-ChAMwU3q.d.cts} +2 -0
  59. package/dist/{types-HBosetv3.d.ts → types-ChAMwU3q.d.ts} +2 -0
  60. package/dist/{types-C5bkx6kQ.d.ts → types-DQW8l7pY.d.cts} +159 -35
  61. package/dist/{types-ENYCKFBk.d.ts → types-GZ76HZSj.d.ts} +6 -6
  62. package/dist/workflow.cjs +241 -57
  63. package/dist/workflow.cjs.map +1 -1
  64. package/dist/workflow.d.cts +49 -32
  65. package/dist/workflow.d.ts +49 -32
  66. package/dist/workflow.js +239 -55
  67. package/dist/workflow.js.map +1 -1
  68. package/package.json +2 -2
  69. package/src/adapters/sandbox/daytona/filesystem.ts +1 -1
  70. package/src/adapters/sandbox/daytona/index.ts +4 -0
  71. package/src/adapters/sandbox/daytona/proxy.ts +4 -3
  72. package/src/adapters/sandbox/e2b/index.ts +5 -0
  73. package/src/adapters/sandbox/inmemory/index.ts +24 -4
  74. package/src/adapters/sandbox/inmemory/proxy.ts +2 -2
  75. package/src/adapters/sandbox/virtual/filesystem.ts +41 -17
  76. package/src/adapters/sandbox/virtual/provider.ts +4 -0
  77. package/src/adapters/sandbox/virtual/proxy.ts +1 -0
  78. package/src/adapters/sandbox/virtual/types.ts +9 -4
  79. package/src/lib/lifecycle.ts +57 -0
  80. package/src/lib/sandbox/manager.ts +13 -1
  81. package/src/lib/sandbox/types.ts +13 -4
  82. package/src/lib/session/index.ts +1 -0
  83. package/src/lib/session/session-edge-cases.integration.test.ts +447 -33
  84. package/src/lib/session/session.integration.test.ts +52 -32
  85. package/src/lib/session/session.ts +107 -33
  86. package/src/lib/session/types.ts +55 -16
  87. package/src/lib/subagent/define.ts +5 -4
  88. package/src/lib/subagent/handler.ts +139 -14
  89. package/src/lib/subagent/index.ts +3 -0
  90. package/src/lib/subagent/register.ts +10 -3
  91. package/src/lib/subagent/signals.ts +8 -0
  92. package/src/lib/subagent/subagent.integration.test.ts +853 -150
  93. package/src/lib/subagent/tool.ts +2 -2
  94. package/src/lib/subagent/types.ts +77 -19
  95. package/src/lib/subagent/workflow.ts +83 -12
  96. package/src/lib/tool-router/router.integration.test.ts +137 -4
  97. package/src/lib/tool-router/router.ts +13 -3
  98. package/src/lib/tool-router/types.ts +7 -0
  99. package/src/lib/workflow.test.ts +89 -21
  100. package/src/lib/workflow.ts +33 -18
  101. package/src/workflow.ts +6 -1
@@ -1,7 +1,7 @@
1
1
  import { Duration } from '@temporalio/common';
2
- import { a as ToolMap, b as ToolRouterHooks, M as MessageContent, S as SessionExitReason, c as ToolHandlerResponse, P as PreToolUseHookResult, d as PostToolUseFailureHookResult, e as RawToolCall, f as TokenUsage, B as BaseAgentState, g as RunAgentConfig, h as AgentStatus, W as WorkflowTask, i as ToolDefinition, j as ToolResultConfig, k as ToolCallResultUnion, I as InferToolResults } from './types-YbL7JpEA.js';
2
+ import { a as ToolMap, b as ToolRouterHooks, M as MessageContent, S as SessionExitReason, c as ToolHandlerResponse, P as PreToolUseHookResult, d as PostToolUseFailureHookResult, e as RawToolCall, f as TokenUsage, B as BaseAgentState, g as RunAgentConfig, h as AgentStatus, W as WorkflowTask, i as ToolDefinition, j as ToolResultConfig, k as ToolCallResultUnion, I as InferToolResults } from './types-Bll19FZJ.cjs';
3
3
  import { z } from 'zod';
4
- import { g as SandboxOps } from './types-HBosetv3.js';
4
+ import { g as SandboxOps } from './types-ChAMwU3q.cjs';
5
5
  import { QueryDefinition, ActivityInterfaceFor } from '@temporalio/workflow';
6
6
  import { UpdateDefinition } from '@temporalio/common/lib/interfaces';
7
7
 
@@ -69,19 +69,80 @@ interface Hooks<T extends ToolMap, TResult = unknown> extends ToolRouterHooks<T,
69
69
  onSessionEnd?: SessionEndHook;
70
70
  }
71
71
 
72
+ /**
73
+ * Thread initialization strategy.
74
+ *
75
+ * - `"new"` — start a fresh thread (optionally specify its ID).
76
+ * - `"continue"` — append directly to an existing thread in-place.
77
+ * - `"fork"` — copy all messages from an existing thread into a new one and
78
+ * continue there.
79
+ */
80
+ type ThreadInit = {
81
+ mode: "new";
82
+ threadId?: string;
83
+ } | {
84
+ mode: "continue";
85
+ threadId: string;
86
+ } | {
87
+ mode: "fork";
88
+ threadId: string;
89
+ };
90
+ /**
91
+ * Sandbox initialization strategy.
92
+ *
93
+ * - `"new"` — create a fresh sandbox.
94
+ * - `"continue"` — resume a previously-paused sandbox (this session takes
95
+ * ownership and the shutdown policy applies on exit).
96
+ * - `"fork"` — fork from an existing (or paused) sandbox; a new sandbox is
97
+ * created and owned by this session.
98
+ * - `"inherit"` — use a sandbox owned by someone else (e.g. a parent agent).
99
+ * The session will **not** manage its lifecycle on exit.
100
+ */
101
+ type SandboxInit = {
102
+ mode: "new";
103
+ } | {
104
+ mode: "continue";
105
+ sandboxId: string;
106
+ } | {
107
+ mode: "fork";
108
+ sandboxId: string;
109
+ } | {
110
+ mode: "inherit";
111
+ sandboxId: string;
112
+ };
113
+ /**
114
+ * What to do with the sandbox when the session exits.
115
+ *
116
+ * - `"destroy"` — tear down the sandbox entirely.
117
+ * - `"pause"` — pause the sandbox so it can be resumed later.
118
+ * - `"keep"` — leave the sandbox running (no-op on exit).
119
+ */
120
+ type SandboxShutdown = "destroy" | "pause" | "keep";
121
+ /**
122
+ * Extended shutdown options available to subagent workflows.
123
+ *
124
+ * Includes all base {@link SandboxShutdown} values plus:
125
+ * - `"pause-until-parent-close"` — pause the sandbox on exit, then wait for
126
+ * the parent workflow to signal when to destroy it.
127
+ */
128
+ type SubagentSandboxShutdown = SandboxShutdown | "pause-until-parent-close";
129
+
72
130
  /** ToolHandlerResponse with threadId required (subagents must always surface their thread) */
73
131
  type SubagentHandlerResponse<TResult = null> = ToolHandlerResponse<TResult> & {
74
132
  threadId: string;
133
+ sandboxId?: string;
75
134
  };
76
135
  /**
77
136
  * Raw workflow input fields passed from parent to child workflow.
78
137
  * `defineSubagentWorkflow` maps this into `SubagentSessionInput`.
79
138
  */
80
139
  interface SubagentWorkflowInput {
81
- /** Thread ID from parent for continuation */
82
- previousThreadId?: string;
83
- /** Sandbox ID inherited from parent */
84
- sandboxId?: string;
140
+ /** Thread initialization strategy forwarded from the parent */
141
+ thread?: ThreadInit;
142
+ /** Sandbox initialization strategy forwarded from the parent */
143
+ sandbox?: SandboxInit;
144
+ /** Sandbox shutdown override from the parent (takes precedence over workflow default) */
145
+ sandboxShutdown?: SubagentSandboxShutdown;
85
146
  }
86
147
  type SubagentWorkflow<TResult extends z.ZodType = z.ZodType> = (prompt: string, workflowInput: SubagentWorkflowInput, context?: Record<string, unknown>) => Promise<SubagentHandlerResponse<z.infer<TResult> | null>>;
87
148
  /**
@@ -95,6 +156,21 @@ type SubagentDefinition<TResult extends z.ZodType = z.ZodType, TContext extends
95
156
  };
96
157
  /** Context value or factory — resolved at invocation time when a function is provided */
97
158
  type SubagentContext = Record<string, unknown> | (() => Record<string, unknown>);
159
+ /**
160
+ * Sandbox configuration for a subagent.
161
+ *
162
+ * String shorthands:
163
+ * - `"none"` — no sandbox (default).
164
+ * - `"inherit"` — reuse the parent's sandbox (shared filesystem/exec).
165
+ * - `"own"` — the child creates and owns its own sandbox (shutdown defaults to `"destroy"`).
166
+ *
167
+ * Object form (only for `source: "own"`):
168
+ * - `{ source: "own", shutdown?: SubagentSandboxShutdown }` — own sandbox with explicit shutdown policy.
169
+ */
170
+ type SubagentSandboxConfig = "none" | "inherit" | "own" | {
171
+ source: "own";
172
+ shutdown?: SubagentSandboxShutdown;
173
+ };
98
174
  /**
99
175
  * Configuration for a subagent that can be spawned by the parent workflow.
100
176
  *
@@ -108,23 +184,34 @@ interface SubagentConfig<TResult extends z.ZodType = z.ZodType> {
108
184
  /** Whether this subagent is available (default: true). Disabled subagents are excluded from the Subagent tool. */
109
185
  enabled?: boolean | (() => boolean);
110
186
  /** Temporal workflow function or type name (used with executeChild) */
111
- workflow: string | SubagentWorkflow<TResult>;
187
+ workflow: SubagentWorkflow<TResult>;
112
188
  /** Optional task queue - defaults to parent's queue if not specified */
113
189
  taskQueue?: string;
114
190
  /** Optional Zod schema to validate the child workflow's result. If omitted, result is passed through as-is. */
115
191
  resultSchema?: TResult;
116
192
  /** Optional context passed to the subagent — a static object or a function evaluated at invocation time */
117
193
  context?: SubagentContext;
118
- /** Allow the parent agent to pass a threadId for this subagent to continue (default: false) */
119
- allowThreadContinuation?: boolean;
120
194
  /** Per-subagent lifecycle hooks */
121
195
  hooks?: SubagentHooks;
196
+ /**
197
+ * Thread mode for this subagent.
198
+ *
199
+ * - `"new"` (default) — always start a fresh thread.
200
+ * - `"fork"` — the parent can pass a `threadId`; messages are copied into
201
+ * a new thread and the subagent continues there.
202
+ * - `"continue"` — the parent can pass a `threadId`; the subagent appends
203
+ * directly to the existing thread in-place.
204
+ */
205
+ thread?: "new" | "fork" | "continue";
122
206
  /**
123
207
  * Sandbox strategy for this subagent.
124
- * - `'inherit'` (default): reuse the parent's sandbox (shared filesystem/exec).
125
- * - `'own'`: the child creates and owns its own sandbox.
208
+ *
209
+ * String shorthands: `"none"` (default) | `"inherit"` | `"own"`.
210
+ * Object form: `{ source: "own", shutdown?: SubagentSandboxShutdown }`.
211
+ *
212
+ * @see {@link SubagentSandboxConfig}
126
213
  */
127
- sandbox?: "inherit" | "own";
214
+ sandbox?: SubagentSandboxConfig;
128
215
  }
129
216
  /**
130
217
  * Per-subagent lifecycle hooks - defined on a SubagentConfig.
@@ -144,6 +231,8 @@ interface SubagentHooks<TArgs = unknown, TResult = unknown> {
144
231
  threadId: string;
145
232
  turn: number;
146
233
  durationMs: number;
234
+ /** Unvalidated metadata from the child workflow (e.g. infrastructure state) */
235
+ metadata?: Record<string, unknown>;
147
236
  }) => void | Promise<void>;
148
237
  /** Called when this subagent execution fails */
149
238
  onExecutionFailure?: (ctx: {
@@ -153,18 +242,31 @@ interface SubagentHooks<TArgs = unknown, TResult = unknown> {
153
242
  turn: number;
154
243
  }) => PostToolUseFailureHookResult | Promise<PostToolUseFailureHookResult>;
155
244
  }
245
+ /**
246
+ * Extended response from the subagent `fn` — includes optional cleanup callbacks
247
+ * stripped before signaling the parent.
248
+ *
249
+ * When `TSandboxShutdown` is `"pause-until-parent-close"`, both `destroySandbox`
250
+ * and `sandboxId` become required so the parent can coordinate cleanup.
251
+ */
252
+ type SubagentFnResult<TResult = null, TSandboxShutdown extends SubagentSandboxShutdown = SubagentSandboxShutdown> = SubagentHandlerResponse<TResult> & (TSandboxShutdown extends "pause-until-parent-close" ? {
253
+ destroySandbox: () => Promise<void>;
254
+ sandboxId: string;
255
+ } : {
256
+ destroySandbox?: () => Promise<void>;
257
+ });
156
258
  /**
157
259
  * Session config fields passed from parent to child workflow.
158
260
  */
159
261
  interface SubagentSessionInput {
160
262
  /** Agent name — spread directly into `createSession` */
161
263
  agentName: string;
162
- /** Thread ID to continue from */
163
- threadId?: string;
164
- /** Whether to continue an existing thread */
165
- continueThread?: boolean;
166
- /** Sandbox ID inherited from the parent agent */
167
- sandboxId?: string;
264
+ /** Thread initialization strategy */
265
+ thread?: ThreadInit;
266
+ /** Sandbox initialization strategy */
267
+ sandbox?: SandboxInit;
268
+ /** Sandbox shutdown policy (default: "destroy") */
269
+ sandboxShutdown?: SubagentSandboxShutdown;
168
270
  }
169
271
 
170
272
  /**
@@ -384,8 +486,6 @@ type PrefixedThreadOps<TPrefix extends string> = {
384
486
  interface SessionConfig<T extends ToolMap, M = unknown> {
385
487
  /** The name of the agent, should be unique within the workflows */
386
488
  agentName: string;
387
- /** The thread ID to use for the session (defaults to a short generated ID) */
388
- threadId?: string;
389
489
  /** Metadata for the session */
390
490
  metadata?: Record<string, unknown>;
391
491
  /** Whether to append the system prompt as message to the thread */
@@ -411,28 +511,52 @@ interface SessionConfig<T extends ToolMap, M = unknown> {
411
511
  * Returns MessageContent array for the initial HumanMessage.
412
512
  */
413
513
  buildContextMessage: () => MessageContent | Promise<MessageContent>;
414
- /** When true, skip thread initialization and system prompt — append only the new human message to the existing thread. */
415
- continueThread?: boolean;
416
514
  /** How long to wait for input before cancelling the workflow */
417
515
  waitForInputTimeout?: Duration;
516
+ /**
517
+ * Thread initialization strategy (default: `{ mode: "new" }`).
518
+ *
519
+ * - `{ mode: "new" }` — start a fresh thread.
520
+ * - `{ mode: "new", threadId: "..." }` — start a fresh thread with a specific ID.
521
+ * - `{ mode: "continue", threadId: "..." }` — append to an existing thread in-place.
522
+ * - `{ mode: "fork", threadId: "..." }` — fork an existing thread and continue in the copy.
523
+ */
524
+ thread?: ThreadInit;
418
525
  /** Sandbox lifecycle operations (optional — omit for agents that don't need a sandbox) */
419
- sandbox?: SandboxOps;
526
+ sandboxOps?: SandboxOps;
420
527
  /**
421
- * Pre-existing sandbox ID to reuse (e.g. inherited from a parent agent).
422
- * When set, the session skips `createSandbox` and will not destroy the
423
- * sandbox on exit (the owner is responsible for cleanup).
528
+ * Sandbox initialization strategy.
529
+ *
530
+ * - `{ mode: "new" }` create a fresh sandbox.
531
+ * - `{ mode: "continue", sandboxId: "..." }` — resume a paused sandbox (session owns it).
532
+ * - `{ mode: "fork", sandboxId: "..." }` — fork from an existing sandbox.
533
+ * - `{ mode: "inherit", sandboxId: "..." }` — use a parent's sandbox without ownership.
534
+ *
535
+ * When omitted and `sandboxOps` is provided, defaults to `{ mode: "new" }`.
424
536
  */
425
- sandboxId?: string;
537
+ sandbox?: SandboxInit;
538
+ /**
539
+ * What to do with the sandbox when this session exits.
540
+ *
541
+ * Defaults to `"destroy"` when omitted.
542
+ * Has no effect when the sandbox is inherited (`sandbox.mode === "inherit"`).
543
+ */
544
+ sandboxShutdown?: SubagentSandboxShutdown;
426
545
  }
427
- interface ZeitlichSession<M = unknown> {
546
+ type SessionResult<M, TState extends JsonSerializable<TState>, HasSandbox extends boolean = boolean> = {
547
+ threadId: string;
548
+ finalMessage: M | null;
549
+ exitReason: SessionExitReason;
550
+ usage: ReturnType<AgentStateManager<TState>["getTotalUsage"]>;
551
+ } & (HasSandbox extends true ? {
552
+ sandboxId: string;
553
+ } : {
554
+ sandboxId?: undefined;
555
+ });
556
+ interface ZeitlichSession<M = unknown, HasSandbox extends boolean = boolean> {
428
557
  runSession<T extends JsonSerializable<T>>(args: {
429
558
  stateManager: AgentStateManager<T>;
430
- }): Promise<{
431
- threadId: string;
432
- finalMessage: M | null;
433
- exitReason: SessionExitReason;
434
- usage: ReturnType<AgentStateManager<T>["getTotalUsage"]>;
435
- }>;
559
+ }): Promise<SessionResult<M, T, HasSandbox>>;
436
560
  }
437
561
 
438
- export type { AgentResponse as A, Hooks as H, JsonPrimitive as J, ModelInvoker as M, PrefixedThreadOps as P, RunAgentActivity as R, ScopedPrefix as S, ThreadOps as T, ZeitlichSession as Z, ModelInvokerConfig as a, SkillProvider as b, SkillMetadata as c, Skill as d, AgentState as e, AgentStateManager as f, JsonSerializable as g, JsonValue as h, PostHumanMessageAppendHook as i, PostHumanMessageAppendHookContext as j, PreHumanMessageAppendHook as k, PreHumanMessageAppendHookContext as l, SessionConfig as m, SessionEndHook as n, SessionEndHookContext as o, SessionStartHook as p, SessionStartHookContext as q, SubagentConfig as r, SubagentDefinition as s, SubagentHandlerResponse as t, SubagentHooks as u, SubagentSessionInput as v, SubagentWorkflow as w, SubagentWorkflowInput as x };
562
+ export type { AgentResponse as A, SubagentSandboxShutdown as B, SubagentSessionInput as C, SubagentWorkflow as D, SubagentWorkflowInput as E, ThreadInit as F, Hooks as H, JsonPrimitive as J, ModelInvoker as M, PrefixedThreadOps as P, RunAgentActivity as R, ScopedPrefix as S, ThreadOps as T, ZeitlichSession as Z, ModelInvokerConfig as a, SkillProvider as b, SkillMetadata as c, Skill as d, AgentState as e, AgentStateManager as f, JsonSerializable as g, JsonValue as h, PostHumanMessageAppendHook as i, PostHumanMessageAppendHookContext as j, PreHumanMessageAppendHook as k, PreHumanMessageAppendHookContext as l, SandboxInit as m, SandboxShutdown as n, SessionConfig as o, SessionEndHook as p, SessionEndHookContext as q, SessionResult as r, SessionStartHook as s, SessionStartHookContext as t, SubagentConfig as u, SubagentDefinition as v, SubagentFnResult as w, SubagentHandlerResponse as x, SubagentHooks as y, SubagentSandboxConfig as z };
@@ -1,5 +1,5 @@
1
- import { a as SandboxFileSystem, F as FileStat, D as DirentEntry, S as Sandbox, d as SandboxCreateOptions } from './types-HBosetv3.js';
2
- import { R as RouterContext } from './types-YbL7JpEA.js';
1
+ import { a as SandboxFileSystem, F as FileStat, D as DirentEntry, S as Sandbox, d as SandboxCreateOptions } from './types-ChAMwU3q.js';
2
+ import { R as RouterContext } from './types-Bll19FZJ.js';
3
3
 
4
4
  /**
5
5
  * Ephemeral {@link SandboxFileSystem} backed by a {@link FileResolver}.
@@ -82,11 +82,11 @@ type TreeMutation<TMeta = FileEntryMetadata> = {
82
82
  */
83
83
  interface FileResolver<TCtx = unknown, TMeta = FileEntryMetadata> {
84
84
  resolveEntries(ctx: TCtx): Promise<FileEntry<TMeta>[]>;
85
- readFile(id: string, ctx: TCtx): Promise<string>;
86
- readFileBuffer(id: string, ctx: TCtx): Promise<Uint8Array>;
87
- writeFile(id: string, content: string | Uint8Array, ctx: TCtx): Promise<void>;
85
+ readFile(id: string, ctx: TCtx, metadata: TMeta): Promise<string>;
86
+ readFileBuffer(id: string, ctx: TCtx, metadata: TMeta): Promise<Uint8Array>;
87
+ writeFile(id: string, content: string | Uint8Array, ctx: TCtx, metadata: TMeta): Promise<void>;
88
88
  createFile(path: string, content: string | Uint8Array, ctx: TCtx): Promise<FileEntry<TMeta>>;
89
- deleteFile(id: string, ctx: TCtx): Promise<void>;
89
+ deleteFile(id: string, ctx: TCtx, metadata: TMeta): Promise<void>;
90
90
  }
91
91
  /**
92
92
  * Options for {@link VirtualSandboxProvider.create}.