zeitlich 0.2.41 → 0.2.42

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 (119) hide show
  1. package/dist/{activities-qUflxmfS.d.cts → activities-Coafq5zr.d.cts} +2 -2
  2. package/dist/{activities-D_g13S3y.d.ts → activities-CrN-ghLo.d.ts} +2 -2
  3. package/dist/adapters/sandbox/daytona/index.cjs +4 -23
  4. package/dist/adapters/sandbox/daytona/index.cjs.map +1 -1
  5. package/dist/adapters/sandbox/daytona/index.d.cts +18 -86
  6. package/dist/adapters/sandbox/daytona/index.d.ts +18 -86
  7. package/dist/adapters/sandbox/daytona/index.js +4 -23
  8. package/dist/adapters/sandbox/daytona/index.js.map +1 -1
  9. package/dist/adapters/sandbox/daytona/workflow.cjs +1 -7
  10. package/dist/adapters/sandbox/daytona/workflow.cjs.map +1 -1
  11. package/dist/adapters/sandbox/daytona/workflow.d.cts +9 -2
  12. package/dist/adapters/sandbox/daytona/workflow.d.ts +9 -2
  13. package/dist/adapters/sandbox/daytona/workflow.js +1 -7
  14. package/dist/adapters/sandbox/daytona/workflow.js.map +1 -1
  15. package/dist/adapters/sandbox/e2b/index.cjs +9 -0
  16. package/dist/adapters/sandbox/e2b/index.cjs.map +1 -1
  17. package/dist/adapters/sandbox/e2b/index.d.cts +13 -5
  18. package/dist/adapters/sandbox/e2b/index.d.ts +13 -5
  19. package/dist/adapters/sandbox/e2b/index.js +9 -1
  20. package/dist/adapters/sandbox/e2b/index.js.map +1 -1
  21. package/dist/adapters/sandbox/e2b/workflow.cjs.map +1 -1
  22. package/dist/adapters/sandbox/e2b/workflow.d.cts +4 -2
  23. package/dist/adapters/sandbox/e2b/workflow.d.ts +4 -2
  24. package/dist/adapters/sandbox/e2b/workflow.js.map +1 -1
  25. package/dist/adapters/sandbox/inmemory/index.cjs +11 -0
  26. package/dist/adapters/sandbox/inmemory/index.cjs.map +1 -1
  27. package/dist/adapters/sandbox/inmemory/index.d.cts +11 -3
  28. package/dist/adapters/sandbox/inmemory/index.d.ts +11 -3
  29. package/dist/adapters/sandbox/inmemory/index.js +11 -1
  30. package/dist/adapters/sandbox/inmemory/index.js.map +1 -1
  31. package/dist/adapters/sandbox/inmemory/workflow.cjs.map +1 -1
  32. package/dist/adapters/sandbox/inmemory/workflow.d.cts +4 -2
  33. package/dist/adapters/sandbox/inmemory/workflow.d.ts +4 -2
  34. package/dist/adapters/sandbox/inmemory/workflow.js.map +1 -1
  35. package/dist/adapters/thread/anthropic/index.cjs.map +1 -1
  36. package/dist/adapters/thread/anthropic/index.d.cts +5 -5
  37. package/dist/adapters/thread/anthropic/index.d.ts +5 -5
  38. package/dist/adapters/thread/anthropic/index.js.map +1 -1
  39. package/dist/adapters/thread/anthropic/workflow.d.cts +5 -5
  40. package/dist/adapters/thread/anthropic/workflow.d.ts +5 -5
  41. package/dist/adapters/thread/google-genai/index.cjs.map +1 -1
  42. package/dist/adapters/thread/google-genai/index.d.cts +5 -5
  43. package/dist/adapters/thread/google-genai/index.d.ts +5 -5
  44. package/dist/adapters/thread/google-genai/index.js.map +1 -1
  45. package/dist/adapters/thread/google-genai/workflow.d.cts +5 -5
  46. package/dist/adapters/thread/google-genai/workflow.d.ts +5 -5
  47. package/dist/adapters/thread/langchain/index.cjs.map +1 -1
  48. package/dist/adapters/thread/langchain/index.d.cts +5 -5
  49. package/dist/adapters/thread/langchain/index.d.ts +5 -5
  50. package/dist/adapters/thread/langchain/index.js.map +1 -1
  51. package/dist/adapters/thread/langchain/workflow.d.cts +5 -5
  52. package/dist/adapters/thread/langchain/workflow.d.ts +5 -5
  53. package/dist/index.cjs +224 -70
  54. package/dist/index.cjs.map +1 -1
  55. package/dist/index.d.cts +66 -16
  56. package/dist/index.d.ts +66 -16
  57. package/dist/index.js +224 -70
  58. package/dist/index.js.map +1 -1
  59. package/dist/{proxy-D7mvDEO6.d.cts → proxy-Bf7uI-Hw.d.cts} +1 -1
  60. package/dist/{proxy-BbcgoXg1.d.ts → proxy-COqA95FW.d.ts} +1 -1
  61. package/dist/{thread-manager-CTXPCu9W.d.ts → thread-manager-BhkOyQ1I.d.ts} +2 -2
  62. package/dist/{thread-manager-Dqstsw4i.d.ts → thread-manager-Bi1XlbpJ.d.ts} +2 -2
  63. package/dist/{thread-manager-cLhDhRRc.d.cts → thread-manager-BsLO3Fgc.d.cts} +2 -2
  64. package/dist/{thread-manager-DrWfVjlj.d.cts → thread-manager-wRVVBFgj.d.cts} +2 -2
  65. package/dist/{types-CjF1_Idx.d.ts → types-BkX4HLzi.d.ts} +1 -1
  66. package/dist/{types-CdvcmXb6.d.cts → types-C66-BVBr.d.cts} +1 -1
  67. package/dist/types-CJ7tCdl6.d.cts +266 -0
  68. package/dist/types-CJ7tCdl6.d.ts +266 -0
  69. package/dist/{types-DjaQKUJx.d.cts → types-CdALEF3z.d.cts} +300 -20
  70. package/dist/{types-BqTmyH31.d.ts → types-ChAy_jSP.d.ts} +300 -20
  71. package/dist/types-CjY93AWZ.d.cts +84 -0
  72. package/dist/types-gVa5XCWD.d.ts +84 -0
  73. package/dist/{workflow-N1MNDoul.d.ts → workflow-BwT5EybR.d.ts} +7 -6
  74. package/dist/{workflow-CuqxgS6X.d.cts → workflow-DMmiaw6w.d.cts} +7 -6
  75. package/dist/workflow.cjs +99 -46
  76. package/dist/workflow.cjs.map +1 -1
  77. package/dist/workflow.d.cts +4 -4
  78. package/dist/workflow.d.ts +4 -4
  79. package/dist/workflow.js +99 -46
  80. package/dist/workflow.js.map +1 -1
  81. package/package.json +7 -32
  82. package/src/adapters/sandbox/daytona/index.ts +25 -48
  83. package/src/adapters/sandbox/daytona/proxy.ts +7 -8
  84. package/src/adapters/sandbox/e2b/index.ts +21 -6
  85. package/src/adapters/sandbox/e2b/proxy.ts +3 -2
  86. package/src/adapters/sandbox/inmemory/index.ts +21 -1
  87. package/src/adapters/sandbox/inmemory/proxy.ts +7 -3
  88. package/src/lib/activity.ts +5 -0
  89. package/src/lib/sandbox/capability-types.test.ts +859 -0
  90. package/src/lib/sandbox/index.ts +1 -0
  91. package/src/lib/sandbox/manager.ts +187 -31
  92. package/src/lib/sandbox/types.ts +189 -46
  93. package/src/lib/session/index.ts +1 -0
  94. package/src/lib/session/session.ts +97 -35
  95. package/src/lib/session/types.ts +181 -5
  96. package/src/lib/subagent/handler.ts +66 -43
  97. package/src/lib/subagent/types.ts +484 -16
  98. package/src/workflow.ts +3 -0
  99. package/tsup.config.ts +0 -4
  100. package/dist/adapters/sandbox/bedrock/index.cjs +0 -457
  101. package/dist/adapters/sandbox/bedrock/index.cjs.map +0 -1
  102. package/dist/adapters/sandbox/bedrock/index.d.cts +0 -25
  103. package/dist/adapters/sandbox/bedrock/index.d.ts +0 -25
  104. package/dist/adapters/sandbox/bedrock/index.js +0 -454
  105. package/dist/adapters/sandbox/bedrock/index.js.map +0 -1
  106. package/dist/adapters/sandbox/bedrock/workflow.cjs +0 -36
  107. package/dist/adapters/sandbox/bedrock/workflow.cjs.map +0 -1
  108. package/dist/adapters/sandbox/bedrock/workflow.d.cts +0 -29
  109. package/dist/adapters/sandbox/bedrock/workflow.d.ts +0 -29
  110. package/dist/adapters/sandbox/bedrock/workflow.js +0 -34
  111. package/dist/adapters/sandbox/bedrock/workflow.js.map +0 -1
  112. package/dist/types-DAsQ21Rt.d.ts +0 -74
  113. package/dist/types-lm8tMNJQ.d.cts +0 -74
  114. package/dist/types-yx0LzPGn.d.cts +0 -173
  115. package/dist/types-yx0LzPGn.d.ts +0 -173
  116. package/src/adapters/sandbox/bedrock/filesystem.ts +0 -340
  117. package/src/adapters/sandbox/bedrock/index.ts +0 -274
  118. package/src/adapters/sandbox/bedrock/proxy.ts +0 -59
  119. package/src/adapters/sandbox/bedrock/types.ts +0 -24
@@ -1,7 +1,7 @@
1
1
  import { ActivityFunctionWithOptions, QueryDefinition, ChildWorkflowOptions, ActivityInterfaceFor } from '@temporalio/workflow';
2
2
  import { UpdateDefinition } from '@temporalio/common/lib/interfaces';
3
3
  import { z } from 'zod';
4
- import { f as SandboxSnapshot, a as SandboxFileSystem, F as FileStat, D as DirentEntry, d as SandboxCreateOptions, g as SandboxOps } from './types-yx0LzPGn.js';
4
+ import { g as SandboxSnapshot, c as SandboxFileSystem, F as FileStat, D as DirentEntry, a as SandboxCreateOptions, S as SandboxOps, h as SandboxCapability } from './types-CJ7tCdl6.js';
5
5
 
6
6
  /**
7
7
  * A tool definition with a name, description, and Zod schema for arguments.
@@ -996,6 +996,212 @@ type SubagentDefinition<TResult extends z.ZodType = z.ZodType, TContext extends
996
996
  };
997
997
  /** Context value or factory — resolved at invocation time when a function is provided */
998
998
  type SubagentContext = Record<string, unknown> | (() => Record<string, unknown>);
999
+ /** Shutdown classes that the runtime treats equivalently for cap purposes. */
1000
+ type _ShutdownPauseLike = "pause" | "pause-until-parent-close";
1001
+ type _ShutdownKeepLike = "keep" | "keep-until-parent-close";
1002
+ /**
1003
+ * Caps the child session's sandbox-init dispatch invokes for a given
1004
+ * `(mode, shutdown)`. Mirror of `src/lib/session/session.ts:230-314`.
1005
+ */
1006
+ type _ChildModeCaps<Mode, Shutdown> = (Mode extends "fork" ? "fork" : never) | (Mode extends "from-snapshot" ? "restore" : never) | (Mode extends "continue" ? Shutdown extends "pause-until-parent-close" ? "resume" : never : never);
1007
+ /**
1008
+ * Caps the child session's exit dispatch invokes for a given `shutdown`.
1009
+ * Only fires when `sandboxOwned` is true (mode != "inherit"). Mirror of
1010
+ * `src/lib/session/session.ts:598-615`.
1011
+ */
1012
+ type _ChildShutdownCaps<Mode, Shutdown> = Mode extends "inherit" ? never : (Shutdown extends _ShutdownPauseLike ? "pause" : never) | (Shutdown extends "snapshot" ? "snapshot" : never);
1013
+ /**
1014
+ * Caps captured on entry for `mode: "new"` + `shutdown: "snapshot"`
1015
+ * (the seeding-base-snapshot path). Mirror of
1016
+ * `src/lib/session/session.ts:316-317`.
1017
+ */
1018
+ type _ChildSeedCaps<Mode, Shutdown> = Mode extends "new" ? Shutdown extends "snapshot" ? "snapshot" : never : never;
1019
+ /**
1020
+ * Total caps a single child-session invocation calls for the specific
1021
+ * `(mode, shutdown)` pair the parent passes. The proxy field's required
1022
+ * cap union is the union of this across every `(mode, shutdown)` the
1023
+ * runtime might inject for the given config.
1024
+ */
1025
+ type _ChildSessionCaps<Mode, Shutdown> = _ChildModeCaps<Mode, Shutdown> | _ChildShutdownCaps<Mode, Shutdown> | _ChildSeedCaps<Mode, Shutdown>;
1026
+ /**
1027
+ * Resolves the user's `shutdown` value through the auto-injection rules
1028
+ * for `(source: "own", continuation: "continue")`. Mirror of
1029
+ * `src/lib/subagent/handler.ts:373-389`:
1030
+ *
1031
+ * - `pause` / `pause-until-parent-close` / `keep` / `keep-until-parent-close`
1032
+ * → propagate (`alreadySurvives = true`).
1033
+ * - everything else (undefined, "destroy", "snapshot") → injected
1034
+ * `"pause"` (subsequent calls) or `"pause-until-parent-close"`
1035
+ * (creator first call). Type-level: union both.
1036
+ */
1037
+ type _ContinueShutdown<S> = S extends _ShutdownPauseLike | _ShutdownKeepLike ? S : "pause" | "pause-until-parent-close";
1038
+ /**
1039
+ * Resolves the user's `shutdown` value through the auto-injection rules
1040
+ * for `(source: "own", continuation: "fork", init: "once")`. Same shape
1041
+ * as `_ContinueShutdown` because both are `mustSurvive` paths.
1042
+ */
1043
+ type _ForkOnceShutdown<S> = _ContinueShutdown<S>;
1044
+ /**
1045
+ * Modes the child session may be invoked under for `(source: "own",
1046
+ * continuation: "continue")`. First call has no `baseSandboxId` (mode
1047
+ * "new"); subsequent calls reuse it (mode "continue"). The type takes
1048
+ * the union — the matrix can't tell first vs. subsequent statically.
1049
+ */
1050
+ type _OwnContinueModes = "new" | "continue";
1051
+ /**
1052
+ * Modes the child session may be invoked under for `(source: "own",
1053
+ * continuation: "fork")`. Same first-vs-subsequent shape as continue.
1054
+ */
1055
+ type _OwnForkModes = "new" | "fork";
1056
+ /**
1057
+ * Modes the child session may be invoked under for `(source: "own",
1058
+ * continuation: "snapshot")`. First call (no base snapshot yet) uses
1059
+ * "new"; subsequent calls (or `init: "once"` after the first creator
1060
+ * publishes a base) use "from-snapshot".
1061
+ */
1062
+ type _OwnSnapshotModes = "new" | "from-snapshot";
1063
+ /**
1064
+ * Caps required on a subagent's `proxy` for the parent's own gated
1065
+ * calls. The parent only ever calls `destroySandbox` (base) and
1066
+ * `deleteSandboxSnapshot` (`continuation: "snapshot"` cleanup).
1067
+ */
1068
+ type _ParentLocalCaps<C> = C extends {
1069
+ continuation: "snapshot";
1070
+ } ? "snapshot" : never;
1071
+ /**
1072
+ * **SSOT type.** The full cap union a subagent's `proxy` must expose,
1073
+ * derived from `(source, continuation, init, shutdown)`.
1074
+ *
1075
+ * The shape mirrors the rows of the runtime decision table in
1076
+ * `resolveSubagentLifecycle` (`src/lib/subagent/handler.ts`): each
1077
+ * branch here corresponds to exactly one runtime branch, and adding a
1078
+ * new runtime branch requires adding a matching branch here. The
1079
+ * `(adapter × continuation × shutdown × init × source)` matrix in
1080
+ * `src/lib/sandbox/capability-types.test.ts` enforces agreement.
1081
+ */
1082
+ type SubagentRequiredCaps<C> = C extends "none" ? never : C extends {
1083
+ source: "inherit";
1084
+ continuation: "continue";
1085
+ } ? never : C extends {
1086
+ source: "inherit";
1087
+ continuation: "fork";
1088
+ } ? "fork" | _ChildSessionCaps<"fork", C extends {
1089
+ shutdown: infer S;
1090
+ } ? S : "destroy"> | _ParentLocalCaps<C> : C extends {
1091
+ source: "own";
1092
+ continuation: "snapshot";
1093
+ } ? _ChildSessionCaps<_OwnSnapshotModes, "snapshot"> | _ParentLocalCaps<C> : C extends {
1094
+ source: "own";
1095
+ continuation: "continue";
1096
+ } ? _ChildSessionCaps<_OwnContinueModes, _ContinueShutdown<C extends {
1097
+ shutdown: infer S;
1098
+ } ? S : undefined>> | _ParentLocalCaps<C> : C extends {
1099
+ source: "own";
1100
+ continuation: "fork";
1101
+ init?: infer I;
1102
+ } ? "fork" | _ChildSessionCaps<_OwnForkModes, I extends "once" ? _ForkOnceShutdown<C extends {
1103
+ shutdown: infer S;
1104
+ } ? S : undefined> : C extends {
1105
+ shutdown: infer S;
1106
+ } ? S extends undefined ? "destroy" : S : "destroy"> | _ParentLocalCaps<C> : never;
1107
+ /**
1108
+ * Backwards-compatible alias retained for external callers that imported
1109
+ * the old name. Resolves through the SSOT against a synthetic
1110
+ * `{ source: "own", continuation: C }` config.
1111
+ *
1112
+ * @deprecated Use `SubagentRequiredCaps<C>` against the full subagent
1113
+ * sandbox config — `continuation` alone misses `shutdown` and `init`,
1114
+ * which is why the previous mapping under-rejected `fork`+`pause` and
1115
+ * `continue`+auto-injected pause.
1116
+ */
1117
+ type SubagentContinuationCaps<C extends SubagentContinuation> = C extends "snapshot" ? "snapshot" | "restore" : C extends "fork" ? "fork" : never;
1118
+ /** Continuation values supported when `source` is `"inherit"`. */
1119
+ type InheritContinuation = "continue" | "fork";
1120
+ /** Continuation values supported when `source` is `"own"`. */
1121
+ type OwnContinuation = "continue" | "fork" | "snapshot";
1122
+ /** Union of every continuation value across both sources. */
1123
+ type SubagentContinuation = InheritContinuation | OwnContinuation;
1124
+ /**
1125
+ * Caps required on a subagent's `proxy` when `source: "inherit"`,
1126
+ * threaded through the SSOT.
1127
+ *
1128
+ * The `inherit` source has no `init` field, and the `shutdown` field
1129
+ * is the user's literal (or `"destroy"` if omitted). We don't have a
1130
+ * way to detect "omitted" in the field type itself, so this row
1131
+ * resolves the user's `S | undefined` directly — `undefined` is treated
1132
+ * as `"destroy"` to match the runtime default in
1133
+ * `src/lib/subagent/handler.ts:469`.
1134
+ */
1135
+ type _InheritCaps<C extends InheritContinuation, S> = SubagentRequiredCaps<{
1136
+ source: "inherit";
1137
+ continuation: C;
1138
+ shutdown: S extends undefined ? "destroy" : S;
1139
+ }>;
1140
+ /**
1141
+ * Variants for `source: "inherit"`. Continuation × shutdown-presence ×
1142
+ * shutdown-literal all distribute, with omitted vs. specified
1143
+ * `shutdown` encoded as separate variants — for the same reason
1144
+ * `OwnVariant` does (forbid TS from matching a permissive cell when
1145
+ * the user omits the field).
1146
+ */
1147
+ type InheritVariant<TOptions extends SandboxCreateOptions> = InheritContinuation extends infer C ? C extends InheritContinuation ? ({
1148
+ _s: undefined;
1149
+ shutdown?: never;
1150
+ } | (SubagentSandboxShutdown extends infer SL ? SL extends SubagentSandboxShutdown ? {
1151
+ _s: SL;
1152
+ shutdown: SL;
1153
+ } : never : never)) extends infer S ? S extends {
1154
+ _s: SubagentSandboxShutdown | undefined;
1155
+ shutdown?: SubagentSandboxShutdown;
1156
+ } ? Omit<S, "_s"> & {
1157
+ source: "inherit";
1158
+ continuation: C;
1159
+ proxy: (scope: string) => SandboxOps<TOptions, unknown, _InheritCaps<C, S["_s"]> & SandboxCapability>;
1160
+ } : never : never : never : never;
1161
+ type _OwnCaps<C extends OwnContinuation, I extends "per-call" | "once" | undefined, S> = SubagentRequiredCaps<{
1162
+ source: "own";
1163
+ continuation: C;
1164
+ init: I extends undefined ? "per-call" : I;
1165
+ shutdown: S;
1166
+ }>;
1167
+ /**
1168
+ * Variants for `source: "own"`. Continuation × init-presence × shutdown-
1169
+ * presence × shutdown-literal all distribute, so each cell gets its
1170
+ * own variant with a precisely-typed `proxy`.
1171
+ *
1172
+ * Critical: omitted vs. specified `init` / `shutdown` are encoded as
1173
+ * *separate* variants. The omitted variant uses `init?: never` /
1174
+ * `shutdown?: never` so the field is forbidden when the user doesn't
1175
+ * write one — without this, TS would infer `field?: undefined` and
1176
+ * happily match an unrelated permissive variant whose caps don't
1177
+ * cover the auto-injection.
1178
+ */
1179
+ type OwnVariant<TOptions extends SandboxCreateOptions> = OwnContinuation extends infer C ? C extends OwnContinuation ? ({
1180
+ _i: undefined;
1181
+ init?: never;
1182
+ } | {
1183
+ _i: "per-call";
1184
+ init: "per-call";
1185
+ } | {
1186
+ _i: "once";
1187
+ init: "once";
1188
+ }) extends infer I ? I extends {
1189
+ _i: "per-call" | "once" | undefined;
1190
+ init?: "per-call" | "once";
1191
+ } ? ({
1192
+ _s: undefined;
1193
+ shutdown?: never;
1194
+ } | (SubagentSandboxShutdown extends infer SL ? SL extends SubagentSandboxShutdown ? {
1195
+ _s: SL;
1196
+ shutdown: SL;
1197
+ } : never : never)) extends infer S ? S extends {
1198
+ _s: SubagentSandboxShutdown | undefined;
1199
+ shutdown?: SubagentSandboxShutdown;
1200
+ } ? Omit<I, "_i"> & Omit<S, "_s"> & {
1201
+ source: "own";
1202
+ continuation: C;
1203
+ proxy: (scope: string) => SandboxOps<TOptions, unknown, _OwnCaps<C, I["_i"], S["_s"]> & SandboxCapability>;
1204
+ } : never : never : never : never : never : never;
999
1205
  /**
1000
1206
  * Sandbox configuration for a subagent.
1001
1207
  *
@@ -1013,19 +1219,20 @@ type SubagentContext = Record<string, unknown> | (() => Record<string, unknown>)
1013
1219
  * `scope = agentName`, so the returned proxy resolves to the same activity
1014
1220
  * prefix the child session uses. The parent uses it to destroy lingering
1015
1221
  * sandboxes and delete stored snapshots at shutdown.
1222
+ *
1223
+ * The `proxy` field's required `TCaps` is derived from
1224
+ * {@link SubagentRequiredCaps} — the SSOT that mirrors
1225
+ * `resolveSubagentLifecycle` in the handler. It folds in `shutdown` and
1226
+ * `init` (including the handler's auto-injected `"pause"` /
1227
+ * `"pause-until-parent-close"` overrides), so any `(adapter, source,
1228
+ * continuation, init, shutdown)` cell that can't execute at runtime
1229
+ * fails to typecheck at the `defineSubagent` site.
1230
+ *
1231
+ * `TOptions` defaults to {@link SandboxCreateOptions} so the wide,
1232
+ * un-parameterised `SubagentSandboxConfig` keeps working for callers
1233
+ * that don't need adapter-specific options.
1016
1234
  */
1017
- type SubagentSandboxConfig = "none" | {
1018
- source: "inherit";
1019
- continuation: "continue" | "fork";
1020
- shutdown?: SubagentSandboxShutdown;
1021
- proxy: (scope: string) => SandboxOps;
1022
- } | {
1023
- source: "own";
1024
- init?: "per-call" | "once";
1025
- continuation: "continue" | "fork" | "snapshot";
1026
- shutdown?: SubagentSandboxShutdown;
1027
- proxy: (scope: string) => SandboxOps;
1028
- };
1235
+ type SubagentSandboxConfig<TOptions extends SandboxCreateOptions = SandboxCreateOptions> = "none" | InheritVariant<TOptions> | OwnVariant<TOptions>;
1029
1236
  /**
1030
1237
  * Configuration for a subagent that can be spawned by the parent workflow.
1031
1238
  *
@@ -1349,14 +1556,74 @@ type ScopedPrefix<TScope extends string, TAdapter extends string> = TScope exten
1349
1556
  type PrefixedThreadOps<TPrefix extends string, TContent = string> = {
1350
1557
  [K in keyof ThreadOps<TContent> as `${TPrefix}${Capitalize<K & string>}`]: ThreadOps<TContent>[K];
1351
1558
  };
1559
+ /**
1560
+ * Caps the session's sandbox-init dispatch may invoke for a given
1561
+ * `(mode, shutdown)`. Mirror of `src/lib/session/session.ts:241-313`.
1562
+ *
1563
+ * The conditional branches are written non-distributively (each cap
1564
+ * checked against the input `M` / `S` rather than over a union) so
1565
+ * that the *omitted* case (defaults: M = "new", S = "destroy") flows
1566
+ * through to `never`, not to "I don't know, assume everything."
1567
+ */
1568
+ type _SessionInitCaps<M, S> = (M extends "fork" ? "fork" : never) | (M extends "from-snapshot" ? "restore" : never) | (M extends "continue" ? S extends "pause-until-parent-close" ? "resume" : never : never);
1569
+ /**
1570
+ * Caps the session's exit dispatch may invoke. `"inherit"` mode keeps
1571
+ * `sandboxOwned = false` so exit-shutdown caps NEVER fire — mirror of
1572
+ * `src/lib/session/session.ts:598-615`.
1573
+ */
1574
+ type _SessionExitCaps<M, S> = M extends "inherit" ? never : (S extends "snapshot" ? "snapshot" : never) | (S extends "pause" | "pause-until-parent-close" ? "pause" : never);
1575
+ /**
1576
+ * Cap captured on entry for `mode: "new"` + `shutdown: "snapshot"` (the
1577
+ * seeding-base-snapshot path). Mirror of
1578
+ * `src/lib/session/session.ts:316-317`.
1579
+ */
1580
+ type _SessionSeedCaps<M, S> = M extends "new" ? S extends "snapshot" ? "snapshot" : never : never;
1581
+ /**
1582
+ * Resolves an omitted `sandbox` field to the runtime default
1583
+ * `{ mode: "new" }`, and an omitted `sandboxShutdown` field to the
1584
+ * runtime default `"destroy"`. The two `_Resolve…` helpers are the
1585
+ * sole bridge between "user didn't set the field" and the SSOT below
1586
+ * — keeping the defaults out of the conditional table itself.
1587
+ */
1588
+ type _ResolveInit<TInit> = [TInit] extends [undefined] ? {
1589
+ mode: "new";
1590
+ } : Exclude<TInit, undefined> extends infer Defined ? undefined extends TInit ? Defined | {
1591
+ mode: "new";
1592
+ } : Defined : never;
1593
+ type _ResolveShutdown<TShutdown> = [TShutdown] extends [undefined] ? "destroy" : Exclude<TShutdown, undefined> extends infer Defined ? undefined extends TShutdown ? Defined | "destroy" : Defined : never;
1594
+ /**
1595
+ * Sandbox capabilities a session actually invokes on its
1596
+ * `sandboxOps`, derived from the literal types of the surrounding
1597
+ * `sandbox` and `sandboxShutdown` fields.
1598
+ *
1599
+ * `TInit` / `TShutdown` default to `undefined` so an un-parameterised
1600
+ * `SessionRequiredCaps` resolves to the caps the runtime *defaults*
1601
+ * (`{ mode: "new" }` + `"destroy"`) actually require — i.e.
1602
+ * `never`. This lets a narrow adapter (e.g. `proxyDaytonaSandboxOps`)
1603
+ * satisfy `sandboxOps?: SandboxOps<…, SessionRequiredCaps<…>>` when
1604
+ * the caller doesn't pin literals, matching what's runtime-safe.
1605
+ *
1606
+ * Pin literals via `as const` or by ascribing `SessionConfig<…, TInit,
1607
+ * TShutdown>` to tighten the requirement on a per-call basis.
1608
+ */
1609
+ type SessionRequiredCaps<TInit extends SandboxInit | undefined = undefined, TShutdown extends SubagentSandboxShutdown | undefined = undefined> = _ResolveInit<TInit> extends infer M ? _ResolveShutdown<TShutdown> extends infer S ? M extends {
1610
+ mode: infer Mode;
1611
+ } ? S extends SubagentSandboxShutdown ? _SessionInitCaps<Mode, S> | _SessionExitCaps<Mode, S> | _SessionSeedCaps<Mode, S> : never : never : never : never;
1352
1612
  /**
1353
1613
  * Configuration for a Zeitlich agent session.
1354
1614
  *
1355
1615
  * @typeParam T - Tool map
1356
1616
  * @typeParam M - SDK-native message type returned by the model invoker
1357
1617
  * @typeParam TContent - SDK-native content type for human messages (defaults to `string`)
1358
- */
1359
- interface SessionConfig<T extends ToolMap, M = unknown, TContent = string> {
1618
+ * @typeParam TInit - Literal type of `sandbox` (a {@link SandboxInit}
1619
+ * variant or `undefined`). Defaults to the wide union; pin it via
1620
+ * `as const` on the call site to narrow the cap requirement on
1621
+ * `sandboxOps`.
1622
+ * @typeParam TShutdown - Literal type of `sandboxShutdown`. Defaults
1623
+ * to the wide union; pin it via `as const` on the call site to
1624
+ * narrow the cap requirement on `sandboxOps`.
1625
+ */
1626
+ interface SessionConfig<T extends ToolMap, M = unknown, TContent = string, TInit extends SandboxInit | undefined = SandboxInit | undefined, TShutdown extends SubagentSandboxShutdown | undefined = SubagentSandboxShutdown | undefined> {
1360
1627
  /** The name of the agent, should be unique within the workflows */
1361
1628
  agentName: string;
1362
1629
  /** Metadata for the session */
@@ -1401,8 +1668,21 @@ interface SessionConfig<T extends ToolMap, M = unknown, TContent = string> {
1401
1668
  * same adapter instance.
1402
1669
  */
1403
1670
  threadKey?: string;
1404
- /** Sandbox lifecycle operations (optional — omit for agents that don't need a sandbox) */
1405
- sandboxOps?: SandboxOps;
1671
+ /**
1672
+ * Sandbox lifecycle operations (optional — omit for agents that don't
1673
+ * need a sandbox).
1674
+ *
1675
+ * The `TCaps` argument is derived from {@link SessionRequiredCaps}
1676
+ * over the literal types of the surrounding `sandbox` and
1677
+ * `sandboxShutdown` fields. With the default wide
1678
+ * `TInit` / `TShutdown`, this resolves to the full
1679
+ * {@link SandboxCapability} union (current behaviour). When the
1680
+ * caller pins those literals via `as const`, the cap requirement
1681
+ * tightens so a narrow adapter (e.g. Daytona's
1682
+ * `SandboxOps<…, never>`) can satisfy combinations that don't need
1683
+ * a gated method.
1684
+ */
1685
+ sandboxOps?: SandboxOps<SandboxCreateOptions, unknown, SessionRequiredCaps<TInit, TShutdown> & SandboxCapability>;
1406
1686
  /**
1407
1687
  * Sandbox initialization strategy.
1408
1688
  *
@@ -1413,14 +1693,14 @@ interface SessionConfig<T extends ToolMap, M = unknown, TContent = string> {
1413
1693
  *
1414
1694
  * When omitted and `sandboxOps` is provided, defaults to `{ mode: "new" }`.
1415
1695
  */
1416
- sandbox?: SandboxInit;
1696
+ sandbox?: TInit;
1417
1697
  /**
1418
1698
  * What to do with the sandbox when this session exits.
1419
1699
  *
1420
1700
  * Defaults to `"destroy"` when omitted.
1421
1701
  * Has no effect when the sandbox is inherited (`sandbox.mode === "inherit"`).
1422
1702
  */
1423
- sandboxShutdown?: SubagentSandboxShutdown;
1703
+ sandboxShutdown?: TShutdown;
1424
1704
  /**
1425
1705
  * Called as soon as the sandbox is created (or resumed/forked), before the
1426
1706
  * agent loop starts. Useful for signalling sandbox readiness to a parent.
@@ -1494,4 +1774,4 @@ interface ZeitlichSession<M = unknown, HasSandbox extends boolean = boolean> {
1494
1774
  }): Promise<SessionResult<M, T, HasSandbox>>;
1495
1775
  }
1496
1776
 
1497
- export { type SandboxShutdown as $, type AgentResponse as A, type BaseAgentState as B, type PostToolUseFailureHookContext as C, type PostToolUseFailureHookResult as D, type PostToolUseHook as E, type FileEntryMetadata as F, type PostToolUseHookContext as G, type Hooks as H, type InferToolResults as I, type JsonValue as J, type PreHumanMessageAppendHook as K, type PreHumanMessageAppendHookContext as L, type ModelInvokerConfig as M, type PreToolUseHook as N, type PreToolUseHookContext as O, type PersistedThreadState as P, type PreToolUseHookResult as Q, type RouterContext as R, type ScopedPrefix as S, type ThreadOps as T, type ProcessToolCallsContext as U, type VirtualFsContext as V, type ProcessToolCallsResult as W, type RawToolCall as X, type RewindSignal as Y, type RunAgentActivity as Z, type SandboxInit as _, type ModelInvoker as a, type SerializableToolDefinition as a0, type SessionConfig as a1, type SessionEndHook as a2, type SessionEndHookContext as a3, type SessionExitReason as a4, type SessionResult as a5, type SessionStartHook as a6, type SessionStartHookContext as a7, type SubagentChildWorkflowOptions as a8, type SubagentConfig as a9, type VirtualFsOps as aA, type VirtualFsState as aB, type WorkflowTask as aC, type ZeitlichSession as aD, isTerminalStatus as aE, type ToolRouterOptions as aF, type SubagentDefinition as aa, type SubagentFnResult as ab, type SubagentHandlerResponse as ac, type SubagentHooks as ad, type SubagentSandboxConfig as ae, type SubagentSandboxShutdown as af, type SubagentSessionInput as ag, type SubagentWorkflow as ah, type SubagentWorkflowInput as ai, type TaskStatus as aj, type ThreadInit as ak, type TokenUsage as al, type ToolArgs as am, type ToolCallResult as an, type ToolCallResultUnion as ao, type ToolDefinition as ap, type ToolHandler as aq, type ToolHooks as ar, type ToolMap as as, type ToolNames as at, type ToolResult as au, type ToolRouter as av, type ToolRouterHooks as aw, type ToolWithHandler as ax, VirtualFileSystem as ay, type VirtualFileTree as az, type PrefixedThreadOps as b, type ToolHandlerResponse as c, type ActivityToolHandler as d, type ToolResultConfig as e, type RunAgentConfig as f, type SkillProvider as g, type SkillMetadata as h, type Skill as i, type FileResolver as j, type TreeMutation as k, type PrefixedVirtualFsOps as l, type AgentConfig as m, type AgentFile as n, type AgentState as o, type AgentStateManager as p, type AgentStatus as q, type AppendToolResultFn as r, type FileEntry as s, type JsonPrimitive as t, type JsonSerializable as u, type ParsedToolCall as v, type ParsedToolCallUnion as w, type PostHumanMessageAppendHook as x, type PostHumanMessageAppendHookContext as y, type PostToolUseFailureHook as z };
1777
+ export { type SandboxShutdown as $, type AgentResponse as A, type BaseAgentState as B, type PostToolUseFailureHookContext as C, type PostToolUseFailureHookResult as D, type PostToolUseHook as E, type FileEntryMetadata as F, type PostToolUseHookContext as G, type Hooks as H, type InferToolResults as I, type JsonValue as J, type PreHumanMessageAppendHook as K, type PreHumanMessageAppendHookContext as L, type ModelInvokerConfig as M, type PreToolUseHook as N, type PreToolUseHookContext as O, type PersistedThreadState as P, type PreToolUseHookResult as Q, type RouterContext as R, type ScopedPrefix as S, type ThreadOps as T, type ProcessToolCallsContext as U, type VirtualFsContext as V, type ProcessToolCallsResult as W, type RawToolCall as X, type RewindSignal as Y, type RunAgentActivity as Z, type SandboxInit as _, type ModelInvoker as a, type SerializableToolDefinition as a0, type SessionConfig as a1, type SessionEndHook as a2, type SessionEndHookContext as a3, type SessionExitReason as a4, type SessionRequiredCaps as a5, type SessionResult as a6, type SessionStartHook as a7, type SessionStartHookContext as a8, type SubagentChildWorkflowOptions as a9, VirtualFileSystem as aA, type VirtualFileTree as aB, type VirtualFsOps as aC, type VirtualFsState as aD, type WorkflowTask as aE, type ZeitlichSession as aF, isTerminalStatus as aG, type ToolRouterOptions as aH, type SubagentConfig as aa, type SubagentContinuationCaps as ab, type SubagentDefinition as ac, type SubagentFnResult as ad, type SubagentHandlerResponse as ae, type SubagentHooks as af, type SubagentSandboxConfig as ag, type SubagentSandboxShutdown as ah, type SubagentSessionInput as ai, type SubagentWorkflow as aj, type SubagentWorkflowInput as ak, type TaskStatus as al, type ThreadInit as am, type TokenUsage as an, type ToolArgs as ao, type ToolCallResult as ap, type ToolCallResultUnion as aq, type ToolDefinition as ar, type ToolHandler as as, type ToolHooks as at, type ToolMap as au, type ToolNames as av, type ToolResult as aw, type ToolRouter as ax, type ToolRouterHooks as ay, type ToolWithHandler as az, type PrefixedThreadOps as b, type ToolHandlerResponse as c, type ActivityToolHandler as d, type ToolResultConfig as e, type RunAgentConfig as f, type SkillProvider as g, type SkillMetadata as h, type Skill as i, type FileResolver as j, type TreeMutation as k, type PrefixedVirtualFsOps as l, type AgentConfig as m, type AgentFile as n, type AgentState as o, type AgentStateManager as p, type AgentStatus as q, type AppendToolResultFn as r, type FileEntry as s, type JsonPrimitive as t, type JsonSerializable as u, type ParsedToolCall as v, type ParsedToolCallUnion as w, type PostHumanMessageAppendHook as x, type PostHumanMessageAppendHookContext as y, type PostToolUseFailureHook as z };
@@ -0,0 +1,84 @@
1
+ import { c as SandboxFileSystem, F as FileStat, D as DirentEntry, b as Sandbox$1, a as SandboxCreateOptions } from './types-CJ7tCdl6.cjs';
2
+ import { Sandbox } from '@daytonaio/sdk';
3
+
4
+ /**
5
+ * {@link SandboxFileSystem} backed by a Daytona SDK sandbox.
6
+ *
7
+ * Maps zeitlich's filesystem interface to Daytona's `sandbox.fs` and
8
+ * `sandbox.process` APIs. Operations that have no direct Daytona equivalent
9
+ * (e.g. `appendFile`, `cp`) are composed from primitives.
10
+ */
11
+ declare class DaytonaSandboxFileSystem implements SandboxFileSystem {
12
+ private sandbox;
13
+ readonly workspaceBase: string;
14
+ constructor(sandbox: Sandbox, workspaceBase?: string);
15
+ private normalisePath;
16
+ private ensureParentDirs;
17
+ readFile(path: string): Promise<string>;
18
+ readFileBuffer(path: string): Promise<Uint8Array>;
19
+ writeFile(path: string, content: string | Uint8Array): Promise<void>;
20
+ writeFiles(files: {
21
+ path: string;
22
+ content: string | Uint8Array;
23
+ }[]): Promise<void>;
24
+ appendFile(path: string, content: string | Uint8Array): Promise<void>;
25
+ exists(path: string): Promise<boolean>;
26
+ stat(path: string): Promise<FileStat>;
27
+ mkdir(path: string, _options?: {
28
+ recursive?: boolean;
29
+ }): Promise<void>;
30
+ readdir(path: string): Promise<string[]>;
31
+ readdirWithFileTypes(path: string): Promise<DirentEntry[]>;
32
+ rm(path: string, options?: {
33
+ recursive?: boolean;
34
+ force?: boolean;
35
+ }): Promise<void>;
36
+ cp(src: string, dest: string, options?: {
37
+ recursive?: boolean;
38
+ }): Promise<void>;
39
+ mv(src: string, dest: string): Promise<void>;
40
+ readlink(_path: string): Promise<string>;
41
+ resolvePath(base: string, path: string): string;
42
+ }
43
+
44
+ /**
45
+ * A Daytona-backed {@link Sandbox} with its typed filesystem.
46
+ */
47
+ type DaytonaSandbox = Sandbox$1 & {
48
+ fs: DaytonaSandboxFileSystem;
49
+ };
50
+ interface DaytonaSandboxConfig {
51
+ apiKey?: string;
52
+ apiUrl?: string;
53
+ target?: string;
54
+ /** Default base path for resolving relative filesystem paths. */
55
+ workspaceBase?: string;
56
+ }
57
+ interface DaytonaSandboxCreateOptions extends SandboxCreateOptions {
58
+ /** Programming language runtime. Defaults to "python". */
59
+ language?: string;
60
+ /** Daytona snapshot name to create the sandbox from. */
61
+ snapshot?: string;
62
+ /** Custom Docker image to use. */
63
+ image?: string;
64
+ /** Resource allocation. */
65
+ resources?: {
66
+ cpu?: number;
67
+ memory?: number;
68
+ disk?: number;
69
+ };
70
+ /** Auto-stop interval in minutes (0 = disabled). Default 15. */
71
+ autoStopInterval?: number;
72
+ /** Auto-archive interval in minutes (0 = max interval). Default 7 days. */
73
+ autoArchiveInterval?: number;
74
+ /** Auto-delete interval in minutes (negative = disabled). */
75
+ autoDeleteInterval?: number;
76
+ /** Custom labels for the sandbox. */
77
+ labels?: Record<string, string>;
78
+ /** Timeout in seconds for sandbox creation. Default 60. */
79
+ timeout?: number;
80
+ /** Base path for resolving relative filesystem paths in this sandbox. */
81
+ workspaceBase?: string;
82
+ }
83
+
84
+ export { type DaytonaSandboxCreateOptions as D, type DaytonaSandbox as a, type DaytonaSandboxConfig as b, DaytonaSandboxFileSystem as c };
@@ -0,0 +1,84 @@
1
+ import { c as SandboxFileSystem, F as FileStat, D as DirentEntry, b as Sandbox$1, a as SandboxCreateOptions } from './types-CJ7tCdl6.js';
2
+ import { Sandbox } from '@daytonaio/sdk';
3
+
4
+ /**
5
+ * {@link SandboxFileSystem} backed by a Daytona SDK sandbox.
6
+ *
7
+ * Maps zeitlich's filesystem interface to Daytona's `sandbox.fs` and
8
+ * `sandbox.process` APIs. Operations that have no direct Daytona equivalent
9
+ * (e.g. `appendFile`, `cp`) are composed from primitives.
10
+ */
11
+ declare class DaytonaSandboxFileSystem implements SandboxFileSystem {
12
+ private sandbox;
13
+ readonly workspaceBase: string;
14
+ constructor(sandbox: Sandbox, workspaceBase?: string);
15
+ private normalisePath;
16
+ private ensureParentDirs;
17
+ readFile(path: string): Promise<string>;
18
+ readFileBuffer(path: string): Promise<Uint8Array>;
19
+ writeFile(path: string, content: string | Uint8Array): Promise<void>;
20
+ writeFiles(files: {
21
+ path: string;
22
+ content: string | Uint8Array;
23
+ }[]): Promise<void>;
24
+ appendFile(path: string, content: string | Uint8Array): Promise<void>;
25
+ exists(path: string): Promise<boolean>;
26
+ stat(path: string): Promise<FileStat>;
27
+ mkdir(path: string, _options?: {
28
+ recursive?: boolean;
29
+ }): Promise<void>;
30
+ readdir(path: string): Promise<string[]>;
31
+ readdirWithFileTypes(path: string): Promise<DirentEntry[]>;
32
+ rm(path: string, options?: {
33
+ recursive?: boolean;
34
+ force?: boolean;
35
+ }): Promise<void>;
36
+ cp(src: string, dest: string, options?: {
37
+ recursive?: boolean;
38
+ }): Promise<void>;
39
+ mv(src: string, dest: string): Promise<void>;
40
+ readlink(_path: string): Promise<string>;
41
+ resolvePath(base: string, path: string): string;
42
+ }
43
+
44
+ /**
45
+ * A Daytona-backed {@link Sandbox} with its typed filesystem.
46
+ */
47
+ type DaytonaSandbox = Sandbox$1 & {
48
+ fs: DaytonaSandboxFileSystem;
49
+ };
50
+ interface DaytonaSandboxConfig {
51
+ apiKey?: string;
52
+ apiUrl?: string;
53
+ target?: string;
54
+ /** Default base path for resolving relative filesystem paths. */
55
+ workspaceBase?: string;
56
+ }
57
+ interface DaytonaSandboxCreateOptions extends SandboxCreateOptions {
58
+ /** Programming language runtime. Defaults to "python". */
59
+ language?: string;
60
+ /** Daytona snapshot name to create the sandbox from. */
61
+ snapshot?: string;
62
+ /** Custom Docker image to use. */
63
+ image?: string;
64
+ /** Resource allocation. */
65
+ resources?: {
66
+ cpu?: number;
67
+ memory?: number;
68
+ disk?: number;
69
+ };
70
+ /** Auto-stop interval in minutes (0 = disabled). Default 15. */
71
+ autoStopInterval?: number;
72
+ /** Auto-archive interval in minutes (0 = max interval). Default 7 days. */
73
+ autoArchiveInterval?: number;
74
+ /** Auto-delete interval in minutes (negative = disabled). */
75
+ autoDeleteInterval?: number;
76
+ /** Custom labels for the sandbox. */
77
+ labels?: Record<string, string>;
78
+ /** Timeout in seconds for sandbox creation. Default 60. */
79
+ timeout?: number;
80
+ /** Base path for resolving relative filesystem paths in this sandbox. */
81
+ workspaceBase?: string;
82
+ }
83
+
84
+ export { type DaytonaSandboxCreateOptions as D, type DaytonaSandbox as a, type DaytonaSandboxConfig as b, DaytonaSandboxFileSystem as c };
@@ -1,6 +1,7 @@
1
- import { as as ToolMap, a1 as SessionConfig, aD as ZeitlichSession, $ as SandboxShutdown, ak as ThreadInit, _ as SandboxInit, u as JsonSerializable, B as BaseAgentState, p as AgentStateManager, aF as ToolRouterOptions, av as ToolRouter, R as RouterContext, J as JsonValue, ax as ToolWithHandler, w as ParsedToolCallUnion, at as ToolNames, aa as SubagentDefinition, ad as SubagentHooks, ae as SubagentSandboxConfig, a9 as SubagentConfig, af as SubagentSandboxShutdown, ag as SubagentSessionInput, ab as SubagentFnResult, a6 as SessionStartHook, a2 as SessionEndHook, E as PostToolUseHook, z as PostToolUseFailureHook, a4 as SessionExitReason, al as TokenUsage, f as RunAgentConfig, A as AgentResponse, F as FileEntryMetadata, az as VirtualFileTree, k as TreeMutation, s as FileEntry, aA as VirtualFsOps, h as SkillMetadata, i as Skill, c as ToolHandlerResponse, aq as ToolHandler, aC as WorkflowTask, d as ActivityToolHandler } from './types-BqTmyH31.js';
2
- import { g as SandboxOps } from './types-yx0LzPGn.js';
1
+ import { au as ToolMap, _ as SandboxInit, ah as SubagentSandboxShutdown, a1 as SessionConfig, aF as ZeitlichSession, $ as SandboxShutdown, am as ThreadInit, u as JsonSerializable, B as BaseAgentState, p as AgentStateManager, aH as ToolRouterOptions, ax as ToolRouter, R as RouterContext, J as JsonValue, az as ToolWithHandler, w as ParsedToolCallUnion, av as ToolNames, ac as SubagentDefinition, af as SubagentHooks, ag as SubagentSandboxConfig, aa as SubagentConfig, ai as SubagentSessionInput, ad as SubagentFnResult, a7 as SessionStartHook, a2 as SessionEndHook, E as PostToolUseHook, z as PostToolUseFailureHook, a4 as SessionExitReason, an as TokenUsage, f as RunAgentConfig, A as AgentResponse, F as FileEntryMetadata, aB as VirtualFileTree, k as TreeMutation, s as FileEntry, aC as VirtualFsOps, h as SkillMetadata, i as Skill, c as ToolHandlerResponse, as as ToolHandler, aE as WorkflowTask, d as ActivityToolHandler } from './types-ChAy_jSP.js';
3
2
  import z$1, { z } from 'zod';
3
+ import './types-CJ7tCdl6.js';
4
+ import { Duration } from '@temporalio/common';
4
5
  import { Sinks, proxyActivities } from '@temporalio/workflow';
5
6
 
6
7
  /**
@@ -34,10 +35,10 @@ import { Sinks, proxyActivities } from '@temporalio/workflow';
34
35
  * const { finalMessage, exitReason } = await session.runSession({ stateManager });
35
36
  * ```
36
37
  */
37
- declare function createSession<T extends ToolMap, M = unknown, TContent = string>(config: SessionConfig<T, M, TContent> & {
38
- sandboxOps: SandboxOps;
38
+ declare function createSession<T extends ToolMap, M = unknown, TContent = string, TInit extends SandboxInit | undefined = undefined, TShutdown extends SubagentSandboxShutdown | undefined = undefined>(config: SessionConfig<T, M, TContent, TInit, TShutdown> & {
39
+ sandboxOps: NonNullable<SessionConfig<T, M, TContent, TInit, TShutdown>["sandboxOps"]>;
39
40
  }): Promise<ZeitlichSession<M, true>>;
40
- declare function createSession<T extends ToolMap, M = unknown, TContent = string>(config: SessionConfig<T, M, TContent>): Promise<ZeitlichSession<M, false>>;
41
+ declare function createSession<T extends ToolMap, M = unknown, TContent = string, TInit extends SandboxInit | undefined = undefined, TShutdown extends SubagentSandboxShutdown | undefined = undefined>(config: SessionConfig<T, M, TContent, TInit, TShutdown>): Promise<ZeitlichSession<M, false>>;
41
42
 
42
43
  /**
43
44
  * Session config fields derived from a main workflow input, ready to spread
@@ -270,7 +271,7 @@ type SubagentArgs = {
270
271
  * still catching hangs; agents that legitimately need longer should set an
271
272
  * explicit `workflowOptions.workflowRunTimeout`.
272
273
  */
273
- declare const DEFAULT_SUBAGENT_WORKFLOW_RUN_TIMEOUT = "1h";
274
+ declare const DEFAULT_SUBAGENT_WORKFLOW_RUN_TIMEOUT: Duration;
274
275
 
275
276
  /**
276
277
  * Creates a `SubagentConfig` from a `SubagentDefinition` (returned by `defineSubagentWorkflow`).
@@ -1,6 +1,7 @@
1
- import { as as ToolMap, a1 as SessionConfig, aD as ZeitlichSession, $ as SandboxShutdown, ak as ThreadInit, _ as SandboxInit, u as JsonSerializable, B as BaseAgentState, p as AgentStateManager, aF as ToolRouterOptions, av as ToolRouter, R as RouterContext, J as JsonValue, ax as ToolWithHandler, w as ParsedToolCallUnion, at as ToolNames, aa as SubagentDefinition, ad as SubagentHooks, ae as SubagentSandboxConfig, a9 as SubagentConfig, af as SubagentSandboxShutdown, ag as SubagentSessionInput, ab as SubagentFnResult, a6 as SessionStartHook, a2 as SessionEndHook, E as PostToolUseHook, z as PostToolUseFailureHook, a4 as SessionExitReason, al as TokenUsage, f as RunAgentConfig, A as AgentResponse, F as FileEntryMetadata, az as VirtualFileTree, k as TreeMutation, s as FileEntry, aA as VirtualFsOps, h as SkillMetadata, i as Skill, c as ToolHandlerResponse, aq as ToolHandler, aC as WorkflowTask, d as ActivityToolHandler } from './types-DjaQKUJx.cjs';
2
- import { g as SandboxOps } from './types-yx0LzPGn.cjs';
1
+ import { au as ToolMap, _ as SandboxInit, ah as SubagentSandboxShutdown, a1 as SessionConfig, aF as ZeitlichSession, $ as SandboxShutdown, am as ThreadInit, u as JsonSerializable, B as BaseAgentState, p as AgentStateManager, aH as ToolRouterOptions, ax as ToolRouter, R as RouterContext, J as JsonValue, az as ToolWithHandler, w as ParsedToolCallUnion, av as ToolNames, ac as SubagentDefinition, af as SubagentHooks, ag as SubagentSandboxConfig, aa as SubagentConfig, ai as SubagentSessionInput, ad as SubagentFnResult, a7 as SessionStartHook, a2 as SessionEndHook, E as PostToolUseHook, z as PostToolUseFailureHook, a4 as SessionExitReason, an as TokenUsage, f as RunAgentConfig, A as AgentResponse, F as FileEntryMetadata, aB as VirtualFileTree, k as TreeMutation, s as FileEntry, aC as VirtualFsOps, h as SkillMetadata, i as Skill, c as ToolHandlerResponse, as as ToolHandler, aE as WorkflowTask, d as ActivityToolHandler } from './types-CdALEF3z.cjs';
3
2
  import z$1, { z } from 'zod';
3
+ import './types-CJ7tCdl6.cjs';
4
+ import { Duration } from '@temporalio/common';
4
5
  import { Sinks, proxyActivities } from '@temporalio/workflow';
5
6
 
6
7
  /**
@@ -34,10 +35,10 @@ import { Sinks, proxyActivities } from '@temporalio/workflow';
34
35
  * const { finalMessage, exitReason } = await session.runSession({ stateManager });
35
36
  * ```
36
37
  */
37
- declare function createSession<T extends ToolMap, M = unknown, TContent = string>(config: SessionConfig<T, M, TContent> & {
38
- sandboxOps: SandboxOps;
38
+ declare function createSession<T extends ToolMap, M = unknown, TContent = string, TInit extends SandboxInit | undefined = undefined, TShutdown extends SubagentSandboxShutdown | undefined = undefined>(config: SessionConfig<T, M, TContent, TInit, TShutdown> & {
39
+ sandboxOps: NonNullable<SessionConfig<T, M, TContent, TInit, TShutdown>["sandboxOps"]>;
39
40
  }): Promise<ZeitlichSession<M, true>>;
40
- declare function createSession<T extends ToolMap, M = unknown, TContent = string>(config: SessionConfig<T, M, TContent>): Promise<ZeitlichSession<M, false>>;
41
+ declare function createSession<T extends ToolMap, M = unknown, TContent = string, TInit extends SandboxInit | undefined = undefined, TShutdown extends SubagentSandboxShutdown | undefined = undefined>(config: SessionConfig<T, M, TContent, TInit, TShutdown>): Promise<ZeitlichSession<M, false>>;
41
42
 
42
43
  /**
43
44
  * Session config fields derived from a main workflow input, ready to spread
@@ -270,7 +271,7 @@ type SubagentArgs = {
270
271
  * still catching hangs; agents that legitimately need longer should set an
271
272
  * explicit `workflowOptions.workflowRunTimeout`.
272
273
  */
273
- declare const DEFAULT_SUBAGENT_WORKFLOW_RUN_TIMEOUT = "1h";
274
+ declare const DEFAULT_SUBAGENT_WORKFLOW_RUN_TIMEOUT: Duration;
274
275
 
275
276
  /**
276
277
  * Creates a `SubagentConfig` from a `SubagentDefinition` (returned by `defineSubagentWorkflow`).