import { i as hydrateReadStateFromSessionAsync } from "./read-state-BFqpQRc5.js";
//#region src/restate/awakeable.ts
/**
* Mint an awakeable that resolves with the resumer's payload, or `null`
* when `timeoutMs` elapses first. The id is journal-stable (send it
* out-of-band as usual); the timeout is a durable `ctx.sleep`, so a
* parked invocation suspends instead of holding a worker.
*
* Timeout surfaces as `null` — a resumer that resolves `undefined` is
* indistinguishable from a timeout, so resolve a concrete payload.
*
* ```ts
* // waitBackground for a durable host, in three lines:
* const { id, promise } = awakeableWithTimeout<TaskExitInfo>(ctx, { timeoutMs, promises: RestatePromise })
* await registerExitResumer(taskId, id) // runner → ctx.resolveAwakeable(id, info)
* return await promise                  // TaskExitInfo, or null on timeout
* ```
*/
function awakeableWithTimeout(ctx, options = {}) {
	const awakeable = ctx.awakeable();
	const timeoutMs = options.timeoutMs;
	if (typeof timeoutMs !== "number" || !Number.isFinite(timeoutMs) || timeoutMs <= 0) return awakeable;
	const timer = ctx.sleep(timeoutMs);
	const raced = options.promises ? options.promises.race([awakeable.promise, timer]) : Promise.race([awakeable.promise, timer]);
	return {
		id: awakeable.id,
		promise: raced.then((value) => value === void 0 ? null : value)
	};
}
//#endregion
//#region src/restate/awakeable-tool.ts
/**
* Build a `ToolDef` that parks on a Restate awakeable until an external
* resumer resolves it. See the module doc for the replay contract.
*
* Do NOT additionally wrap the returned tool in `restateTool` — the
* journal discipline is already internal, and an outer `ctx.run` would
* illegally nest the suspension point inside a journaled closure.
*/
function restateAwakeableTool(options) {
	const { name, description, inputSchema, ctx, notify, toResult } = options;
	const runOpts = options.runOptions ?? { maxRetryAttempts: 1 };
	let seq = 0;
	const execute = async (input, toolCtx) => {
		seq += 1;
		const awakeable = ctx.awakeable();
		const marker = await ctx.run(`awakeable-${name}-${seq}-notify`, async () => {
			await notify({
				awakeableId: awakeable.id,
				input,
				toolCtx
			});
			return {
				notified: true,
				awakeableId: awakeable.id
			};
		}, runOpts);
		if (marker.awakeableId !== awakeable.id) throw new Error(`restateAwakeableTool(${name}): journal drift — broadcast marker carries awakeable "${marker.awakeableId}" but this replay minted "${awakeable.id}". The journal and the code path no longer line up; refusing to park on an unreachable awakeable.`);
		const value = await awakeable.promise;
		if (toResult) return toResult(value, input);
		return typeof value === "string" ? value : JSON.stringify(value);
	};
	return {
		spec: {
			name,
			description,
			inputSchema
		},
		...options.isConcurrencySafe !== void 0 ? { isConcurrencySafe: options.isConcurrencySafe } : {},
		execute,
		durableExecute: execute
	};
}
//#endregion
//#region src/restate/errors.ts
/**
* Restate control-flow errors must escape the agent loop. If they are turned
* into model-visible tool results, the runtime can retry/suspend incorrectly.
*
* Kept structural so `zidane/restate` does not need to import the SDK at
* runtime just to recognize the common error shapes.
*/
function shouldRethrowRestateControlError(error) {
	if (!(error instanceof Error)) return false;
	const codeValue = Reflect.get(error, "code");
	if ((typeof codeValue === "number" ? codeValue : void 0) === 599) return true;
	const name = error.name;
	if (name === "TerminalError" || name === "TimeoutError" || name === "CancelledError" || name === "SuspendedError") return true;
	const ctorName = error.constructor?.name;
	const serializedCtorNameValue = Reflect.get(error, "constructorName");
	const serializedCtorName = typeof serializedCtorNameValue === "string" ? serializedCtorNameValue : void 0;
	if (ctorName === "TerminalError" || ctorName === "TimeoutError" || ctorName === "CancelledError" || ctorName === "SuspendedError" || serializedCtorName === "TerminalError" || serializedCtorName === "TimeoutError" || serializedCtorName === "CancelledError" || serializedCtorName === "SuspendedError") return true;
	return typeof name === "string" && name.toLowerCase().includes("suspend");
}
//#endregion
//#region src/restate/behavior.ts
/**
* Conservative behavior defaults for agents running inside Restate.
*
* The helper is opt-in and returns a plain AgentBehavior object, so callers can
* spread or override it without changing non-Restate harness defaults.
*
* `disableBackgroundTasks: 'non-durable'` is capability-aware: background
* tasks stay enabled for execution contexts whose
* `capabilities.detachedTasks` is `'durable'` (tasks live on a remote
* runner and survive worker crashes) and are disabled for everything
* else (host-local processes don't survive process death). Hosts on
* plain `ProcessContext` see the same effective behavior as the old
* blanket `true`.
*/
function restateBehavior(overrides = {}) {
	return {
		maxConcurrentTools: 1,
		disableBackgroundTasks: "non-durable",
		cache: true,
		shouldRethrowToolError: shouldRethrowRestateControlError,
		...overrides
	};
}
//#endregion
//#region src/restate/clock.ts
/**
* Wrap a Restate context's `date.now()` + `rand.uuidv4()` into the
* {@link AgentClock} shape Zidane consumes for journaled metadata.
*
* The returned clock is a thin live view onto `ctx` — each call hits
* the SDK afresh. No caching, no closure-captured values. Restate's
* journal handles determinism on its end.
*/
function restateClock(ctx) {
	return {
		now: () => ctx.date.now(),
		randomUUID: () => ctx.rand.uuidv4()
	};
}
//#endregion
//#region src/restate/parallel.ts
/**
* Tool batch scheduler for Restate-backed agents.
*
* It preserves unsafe-tool barriers and emits results in model submission
* order. Safe fleets are started in submission order, capped by
* `maxConcurrentTools`, and joined via the supplied durable `all()`.
*/
function restateToolBatchExecutor(options) {
	return async (ctx) => {
		const results = [];
		const { toolCalls } = ctx;
		const fillRemaining = (from, factory) => {
			for (let i = from; i < toolCalls.length; i++) results[i] = factory(i);
			return results;
		};
		for (let i = 0; i < toolCalls.length;) {
			if (ctx.signal.aborted) return fillRemaining(i, ctx.interruptedResult);
			if (ctx.steeringQueue.length > 0) return fillRemaining(i, ctx.skippedResult);
			if (!ctx.isConcurrencySafe(i)) {
				results[i] = await ctx.execute(i);
				i += 1;
				continue;
			}
			const start = i;
			const fleet = [];
			while (i < toolCalls.length && ctx.isConcurrencySafe(i) && fleet.length < ctx.maxConcurrentTools) {
				fleet.push(i);
				i += 1;
			}
			const fleetResults = fleet.every((index) => ctx.canExecuteDurably(index)) ? await ctx.executeDurable(fleet, async (values) => {
				return await options.promises.all(values);
			}) : await executeSequential(ctx, fleet);
			for (let offset = 0; offset < fleetResults.length; offset++) results[start + offset] = fleetResults[offset];
		}
		return results;
	};
}
async function executeSequential(ctx, indices) {
	const results = [];
	for (const index of indices) {
		if (ctx.signal.aborted) {
			results.push(ctx.interruptedResult(index));
			continue;
		}
		if (ctx.steeringQueue.length > 0) {
			results.push(ctx.skippedResult(index));
			continue;
		}
		results.push(await ctx.execute(index));
	}
	return results;
}
//#endregion
//#region src/restate/provider.ts
/**
* Wrap a Zidane `Provider` so its `stream()` method journals each turn's
* response inside `ctx.run`. All other Provider methods (`formatTools`,
* `userMessage`, `toolResultsMessage`, `classifyError`, …) pass through
* unchanged — they're pure functions over already-deterministic inputs.
*/
function restateProvider(inner, ctx, options = {}) {
	const runOpts = options.runOptions ?? (options.streamCallbacks === "suppress" ? { maxRetryAttempts: 3 } : { maxRetryAttempts: 1 });
	const nameFor = options.entryName ?? ((seq) => `llm-call-${seq}`);
	let seq = 0;
	return {
		...inner,
		stream(streamOpts, callbacks) {
			seq += 1;
			const durableCallbacks = options.streamCallbacks === "suppress" ? suppressStreamingCallbacks(callbacks) : callbacks;
			return ctx.run(nameFor(seq, streamOpts), () => {
				options.replayTracker?.markLive();
				return inner.stream(streamOpts, durableCallbacks);
			}, runOpts);
		}
	};
}
function suppressStreamingCallbacks(callbacks) {
	return {
		...callbacks,
		onText: () => {},
		onThinking: void 0,
		onServerToolUse: void 0,
		onServerToolResult: void 0
	};
}
//#endregion
//#region src/restate/replay.ts
/**
* Create a per-invocation replay tracker. Pass it to `restateProvider`
* / `restateTool` / `wrapAgentTools` via their `replayTracker` option;
* consume it via `isReplaying()` / `onLive()` / {@link replayAwareAbort}.
*/
function createReplayTracker(options = {}) {
	let live = false;
	let callbacks = [];
	return {
		isReplaying: () => !live,
		markLive: () => {
			if (live) return;
			live = true;
			const pending = callbacks;
			callbacks = [];
			for (const cb of pending) try {
				cb();
			} catch (err) {
				if (process.env.ZIDANE_DEBUG) process.stderr.write(`[zidane/restate] onLive callback threw: ${err instanceof Error ? err.message : String(err)}\n`);
			}
			if (options.hooks) Promise.resolve(options.hooks.callHook("replay:done", {})).catch((err) => {
				if (process.env.ZIDANE_DEBUG) process.stderr.write(`[zidane/restate] replay:done hook rejected: ${err instanceof Error ? err.message : String(err)}\n`);
			});
		},
		onLive: (cb) => {
			if (live) {
				cb();
				return () => {};
			}
			callbacks.push(cb);
			return () => {
				const idx = callbacks.indexOf(cb);
				if (idx >= 0) callbacks.splice(idx, 1);
			};
		}
	};
}
/**
* Wrap an abort function so it defers during journal replay.
*
* Live invocation → `abort()` runs immediately, exactly like calling
* `agent.abort()` directly. Replaying invocation → the abort is queued
* and applied at the first live boundary (the start of the first
* non-journaled provider stream or tool body), where the resulting
* `AgentAbortedError` + host catch-arm journaling append to the journal
* instead of forking it mid-replay. Multiple calls during replay
* collapse into one queued abort.
*/
function replayAwareAbort(tracker, abort) {
	let queued = false;
	return () => {
		if (!tracker.isReplaying()) {
			abort();
			return;
		}
		if (queued) return;
		queued = true;
		tracker.onLive(abort);
	};
}
//#endregion
//#region src/restate/session.ts
const KEY_DATA = "session-data";
const KEY_TURNS = "session-turns";
const KEY_RUNS = "session-runs";
/**
* Construct a `SessionStore` backed by the bound virtual-object's K/V
* state. The store is single-tenant — every method ignores the
* `sessionId` argument because the virtual object is already keyed by
* `ctx.key`. Calling `appendTurns('other-id', …)` writes to the
* CURRENT object's state, not the one named in the argument. Bind one
* virtual-object key per session and the contract holds.
*/
function restateSessionStore(ctx) {
	let nextTurnSeq;
	async function generateTurnId() {
		if (nextTurnSeq === void 0) nextTurnSeq = (await ctx.get(KEY_TURNS) ?? []).length;
		nextTurnSeq += 1;
		return `turn_${nextTurnSeq}`;
	}
	return {
		/**
		* Turn ids are deterministic from the persisted turn count. Random ids
		* are replay-stable only when the whole handler replays from the same
		* point; restarting from an arbitrary journal step can shift the RNG
		* sequence before a state write.
		*/
		generateTurnId,
		async load(_sessionId) {
			const header = await ctx.get(KEY_DATA);
			const turns = sanitizeTurnsForState(await ctx.get(KEY_TURNS) ?? []);
			const runs = sanitizeRunsForState(await ctx.get(KEY_RUNS) ?? []);
			if (!header) {
				if (turns.length === 0 && runs.length === 0) return null;
				return {
					id: _sessionId,
					turns,
					runs,
					status: inferStatus(runs),
					metadata: {},
					createdAt: inferCreatedAt(turns, runs),
					updatedAt: inferUpdatedAt(turns, runs)
				};
			}
			return {
				...header,
				turns,
				runs
			};
		},
		async save(session) {
			const { turns, runs, ...header } = session;
			const prior = await ctx.get(KEY_DATA);
			const now = await ctx.date.now();
			ctx.set(KEY_DATA, {
				...header,
				createdAt: prior?.createdAt ?? now,
				updatedAt: now
			});
			ctx.set(KEY_TURNS, sanitizeTurnsForState(turns));
			ctx.set(KEY_RUNS, sanitizeRunsForState(runs));
		},
		async delete(_sessionId) {
			ctx.clear(KEY_DATA);
			ctx.clear(KEY_TURNS);
			ctx.clear(KEY_RUNS);
		},
		/**
		* Always empty — virtual objects don't support cross-key
		* enumeration. Maintain a separate index handler if discovery
		* matters.
		*/
		async list() {
			return [];
		},
		async appendTurns(_sessionId, turns) {
			const existing = sanitizeTurnsForState(await ctx.get(KEY_TURNS) ?? []);
			ctx.set(KEY_TURNS, [...existing, ...sanitizeTurnsForState(turns)]);
		},
		async getTurns(_sessionId, from = 0, limit) {
			return sanitizeTurnsForState(await ctx.get(KEY_TURNS) ?? []).slice(from, limit !== void 0 ? from + limit : void 0);
		},
		async updateRun(_sessionId, run) {
			const runs = sanitizeRunsForState(await ctx.get(KEY_RUNS) ?? []);
			const idx = runs.findIndex((r) => r.id === run.id);
			const next = [...runs];
			if (idx >= 0) next[idx] = sanitizeRunForState(run);
			else next.push(sanitizeRunForState(run));
			ctx.set(KEY_RUNS, next);
		},
		async updateStatus(_sessionId, status) {
			const header = await ctx.get(KEY_DATA);
			const now = await ctx.date.now();
			if (header) ctx.set(KEY_DATA, {
				...header,
				status,
				updatedAt: now
			});
			else ctx.set(KEY_DATA, {
				id: _sessionId,
				status,
				metadata: {},
				createdAt: now,
				updatedAt: now
			});
		}
	};
}
function sanitizeTurnsForState(turns) {
	return turns.map(sanitizeTurnForState);
}
function sanitizeTurnForState(turn) {
	if (!turn.usage || turn.usage.timeToFirstTokenMs === void 0) return turn;
	const { timeToFirstTokenMs: _timeToFirstTokenMs, ...usage } = turn.usage;
	return {
		...turn,
		usage
	};
}
function sanitizeRunsForState(runs) {
	return runs.map(sanitizeRunForState);
}
function sanitizeRunForState(run) {
	if (!run.turnUsage?.some((usage) => usage.timeToFirstTokenMs !== void 0)) return run;
	return {
		...run,
		turnUsage: run.turnUsage.map((usage) => {
			if (usage.timeToFirstTokenMs === void 0) return usage;
			const { timeToFirstTokenMs: _timeToFirstTokenMs, ...stableUsage } = usage;
			return stableUsage;
		})
	};
}
function inferStatus(runs) {
	if (runs.some((run) => run.status === "running")) return "running";
	if (runs.some((run) => run.status === "error")) return "error";
	if (runs.some((run) => run.status === "completed")) return "completed";
	return "idle";
}
function inferCreatedAt(turns, runs) {
	return minDefined([...turns.map((turn) => turn.createdAt), ...runs.map((run) => run.startedAt)]) ?? 0;
}
function inferUpdatedAt(turns, runs) {
	return maxDefined([...turns.map((turn) => turn.createdAt), ...runs.map((run) => run.endedAt ?? run.startedAt)]) ?? inferCreatedAt(turns, runs);
}
function minDefined(values) {
	let min;
	for (const value of values) if (min === void 0 || value < min) min = value;
	return min;
}
function maxDefined(values) {
	let max;
	for (const value of values) if (max === void 0 || value > max) max = value;
	return max;
}
//#endregion
//#region src/restate/tool.ts
const SHELL_BACKGROUND_DISABLED_MESSAGE = "shell error: background mode is disabled for Restate-backed agents. Fall back to foreground (drop `run_in_background`).";
const HYDRATED_READ_STATE_SESSIONS = /* @__PURE__ */ new WeakSet();
/**
* Wrap a single `ToolDef` so its `execute` runs inside `ctx.run`. The
* tool's `spec` and `isConcurrencySafe` pass through unchanged.
*/
function restateTool(inner, ctx, options = {}) {
	const runOpts = options.runOptions ?? { maxRetryAttempts: 1 };
	const nameFor = options.entryName ?? ((seq, name) => `tool-${name}-${seq}`);
	const canonicalName = inner.spec.name;
	const shellBackgroundDisabled = (options.disableShellBackground ?? options.detachedTasks !== "durable") && canonicalName === "shell";
	const durableStart = options.durableStart;
	if (durableStart && !durableStart.attach && !durableStart.wait) throw new Error(`restateTool(${canonicalName}): durableStart needs an \`attach\` (in-journal wait) or a \`wait\` (awakeable park) phase`);
	let seq = 0;
	const hydrateOnce = async (toolCtx) => {
		if (toolCtx.session && !HYDRATED_READ_STATE_SESSIONS.has(toolCtx.session)) {
			HYDRATED_READ_STATE_SESSIONS.add(toolCtx.session);
			await hydrateReadStateFromSessionAsync(toolCtx.session, toolCtx.handle.cwd, {
				defaultLineNumbers: toolCtx.behavior?.readLineNumbers ?? true,
				readFileForHash: async (path) => {
					try {
						return await toolCtx.execution.readFile(toolCtx.handle, path);
					} catch {
						return null;
					}
				}
			});
		}
	};
	const executeDurably = (input, toolCtx) => {
		seq += 1;
		return ctx.run(nameFor(seq, canonicalName, input), async () => {
			options.replayTracker?.markLive();
			await hydrateOnce(toolCtx);
			if (shellBackgroundDisabled && input.run_in_background === true) return SHELL_BACKGROUND_DISABLED_MESSAGE;
			return inner.execute(input, toolCtx);
		}, runOpts);
	};
	const executeTwoPhase = async (input, toolCtx) => {
		const start = durableStart;
		seq += 1;
		const entry = nameFor(seq, canonicalName, input);
		const token = await ctx.run(`${entry}-start`, async () => {
			options.replayTracker?.markLive();
			await hydrateOnce(toolCtx);
			return start.start(input, toolCtx);
		}, runOpts);
		const onAbort = start.onAbort;
		const signal = toolCtx.signal;
		let fired = false;
		const fireAbortCleanup = () => {
			if (fired || !onAbort) return;
			fired = true;
			Promise.resolve(onAbort(token, input, toolCtx)).catch((err) => {
				if (process.env.ZIDANE_DEBUG) process.stderr.write(`[zidane/restate] durableStart onAbort threw: ${err instanceof Error ? err.message : String(err)}\n`);
			});
		};
		const wait = start.wait;
		if (wait) {
			if (wait.inline?.(token, input, toolCtx)) {
				if (!onAbort || !signal) return await ctx.run(entry, () => {
					options.replayTracker?.markLive();
					return wait.result(token, null, input, toolCtx);
				}, runOpts);
				if (signal.aborted) fireAbortCleanup();
				else signal.addEventListener("abort", fireAbortCleanup, { once: true });
				try {
					return await ctx.run(entry, () => {
						options.replayTracker?.markLive();
						return wait.result(token, null, input, toolCtx);
					}, runOpts);
				} finally {
					signal.removeEventListener("abort", fireAbortCleanup);
				}
			}
			if (signal?.aborted) {
				fireAbortCleanup();
				throw new Error(`${canonicalName}: aborted before durable wait registration`);
			}
			signal?.addEventListener("abort", fireAbortCleanup, { once: true });
			try {
				const timeoutMs = typeof wait.timeoutMs === "function" ? wait.timeoutMs(input, toolCtx) : wait.timeoutMs;
				const awakeable = awakeableWithTimeout(ctx, {
					...timeoutMs !== void 0 ? { timeoutMs } : {},
					...wait.promises ? { promises: wait.promises } : {}
				});
				const marker = await ctx.run(`${entry}-register`, async () => {
					options.replayTracker?.markLive();
					await wait.register(token, awakeable.id, input, toolCtx);
					return {
						registered: true,
						awakeableId: awakeable.id
					};
				}, runOpts);
				if (marker.awakeableId !== awakeable.id) throw new Error(`restateTool(${canonicalName}): journal drift — registration marker carries awakeable "${marker.awakeableId}" but this replay minted "${awakeable.id}". Refusing to park on an unreachable awakeable.`);
				const resumed = await parkWithSignal(awakeable.promise, signal, canonicalName);
				return await ctx.run(entry, () => {
					options.replayTracker?.markLive();
					return wait.result(token, resumed, input, toolCtx);
				}, runOpts);
			} finally {
				signal?.removeEventListener("abort", fireAbortCleanup);
			}
		}
		const attach = () => ctx.run(entry, () => {
			options.replayTracker?.markLive();
			return start.attach(token, input, toolCtx);
		}, runOpts);
		if (!onAbort || !signal) return attach();
		if (signal.aborted) {
			fireAbortCleanup();
			return attach();
		}
		signal.addEventListener("abort", fireAbortCleanup, { once: true });
		try {
			return await attach();
		} finally {
			signal.removeEventListener("abort", fireAbortCleanup);
		}
	};
	if (durableStart) {
		const { durableExecute: _dropped, ...rest } = inner;
		return {
			...rest,
			spec: shellBackgroundDisabled ? withoutShellBackgroundInput(inner.spec) : inner.spec,
			execute: executeTwoPhase
		};
	}
	return {
		...inner,
		spec: shellBackgroundDisabled ? withoutShellBackgroundInput(inner.spec) : inner.spec,
		execute: executeDurably,
		durableExecute: executeDurably
	};
}
/**
* Park on `promise`, but stop waiting when the per-call abort signal
* fires (run abort, `cancelTool`, sibling-cascade cancel) — a deliberate
* abort means nobody will consume the result, and like `onAbort` it
* implies no replay is coming, so the native (non-journaled) race is
* replay-safe. The underlying awakeable stays registered; a late
* resolution lands on a completed invocation and is dropped by the
* runtime.
*/
function parkWithSignal(promise, signal, name) {
	if (!signal) return promise;
	if (signal.aborted) return Promise.reject(/* @__PURE__ */ new Error(`${name}: aborted while parked on durable wait`));
	return new Promise((resolve, reject) => {
		const onAbortEvt = () => reject(/* @__PURE__ */ new Error(`${name}: aborted while parked on durable wait`));
		signal.addEventListener("abort", onAbortEvt, { once: true });
		promise.then((value) => {
			signal.removeEventListener("abort", onAbortEvt);
			resolve(value);
		}, (err) => {
			signal.removeEventListener("abort", onAbortEvt);
			reject(err instanceof Error ? err : new Error(String(err)));
		});
	});
}
function withoutShellBackgroundInput(spec) {
	const inputSchema = spec.inputSchema;
	const properties = isRecord(inputSchema.properties) ? inputSchema.properties : void 0;
	if (!properties || !Object.hasOwn(properties, "run_in_background")) return spec;
	const { run_in_background: _runInBackground, ...nextProperties } = properties;
	const required = Array.isArray(inputSchema.required) ? inputSchema.required.filter((name) => name !== "run_in_background") : inputSchema.required;
	return {
		...spec,
		description: stripShellBackgroundDescription(spec.description),
		inputSchema: {
			...inputSchema,
			properties: nextProperties,
			...required !== inputSchema.required ? { required } : {}
		}
	};
}
function stripShellBackgroundDescription(description) {
	return description.split("\n").filter((line) => !line.includes("run_in_background") && !line.includes("<task-notification>") && !line.includes("background task")).join("\n").replace(/\n{3,}/g, "\n\n").trim();
}
function isRecord(value) {
	return typeof value === "object" && value !== null && !Array.isArray(value);
}
/**
* Wrap an entire tool map at once — convenience for the common case of
* "journal every tool the agent has". Pass-through for tools whose
* names are listed in `opts.exclude` (e.g. fully-deterministic local
* helpers where journaling is pure overhead).
*
* The returned map is a fresh object; the input is untouched.
*/
function wrapAgentTools(tools, ctx, opts = {}) {
	const excludeSet = new Set(opts.exclude ?? []);
	const skipWaitTask = opts.detachedTasks === "durable";
	const wrapped = {};
	for (const [name, def] of Object.entries(tools)) wrapped[name] = excludeSet.has(name) || skipWaitTask && def.spec.name === "wait_task" ? def : restateTool(def, ctx, opts);
	return wrapped;
}
//#endregion
export { awakeableWithTimeout, createReplayTracker, replayAwareAbort, restateAwakeableTool, restateBehavior, restateClock, restateProvider, restateSessionStore, restateTool, restateToolBatchExecutor, shouldRethrowRestateControlError, wrapAgentTools };

//# sourceMappingURL=restate.js.map