import{c as e,i as t}from"../../_chunks/workflow/dist-6a3viBXZ.js";import{at as n,g as r,it as i,lt as a,m as o,p as s,s as c,st as l}from"../../_chunks/workflow/symbols-BUTtwS7j.js";import{n as u,t as d}from"../../_chunks/workflow/sleep-Cup6vPoA.js";async function f(e,n={}){let i=u(e,n);if(i.length===0)return;let a=n.allowReservedAttributes===!0,o=globalThis[r];if(!o)throw new t("experimental_setAttributes() called outside a workflow runtime context. It must be called from within a workflow body (`use workflow`).");await o(`__builtin_set_attributes`)(i,a?{allowReservedAttributes:!0}:{})}function p(e){let t=globalThis[s];return t||n(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,p),t(e)}function m(e){let{respondWith:t,token:n,...r}=e??{};if(n!==void 0)throw Error("`createWebhook()` does not accept a `token` option. Webhook tokens are always randomly generated. Use `createHook()` with `resumeHook()` for deterministic token patterns.");let i;t!==void 0&&(i={respondWith:t});let o=p({...r,metadata:i,isWebhook:!0}),{url:s}=a();return o.url=`${s}/.well-known/workflow/v1/webhook/${encodeURIComponent(o.token)}`,o}function h(){function e(t,n){l(`defineHook().resume()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,e)}return{create(e){return p(e)},resume:e}}function g(e={}){let{namespace:t}=e,n=globalThis[o](t);return Object.create(globalThis.WritableStream.prototype,{[c]:{value:n,writable:!1}})}function _(){i(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,_)}function v(){l(`resumeHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,v)}export{t as FatalError,e as RetryableError,p as createHook,m as createWebhook,h as defineHook,f as experimental_setAttributes,_ as getStepMetadata,a as getWorkflowMetadata,g as getWritable,v as resumeHook,d as sleep};