eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 1.97 kB
JavaScript
import{c as e,i as t}from"../../_chunks/workflow/dist-Dxrjttr2.js";import{$n as n,Kt as r,Zt as i,er as a,ir as o,nn as s,nr as c,qt as l,rn as u,t as d,tn as f}from"../../_chunks/workflow/attribute-changes-Bi5DLT8S.js";import{t as p}from"../../_chunks/workflow/sleep-DPjVkRY-.js";import{t as m}from"../../_chunks/workflow/run-XM8dTRAo.js";async function h(e,n={}){let r=d(e,n);if(r.length===0)return;let i=n.allowReservedAttributes===!0,a=globalThis[u];if(!a)throw new t("experimental_setAttributes() called outside a workflow runtime context. It must be called from within a workflow body (`use workflow`).");await a(r,i?{allowReservedAttributes:!0}:{})}l(r,m);function g(e){let t=globalThis[f];return t||a(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,g),t(e)}function _(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 a=g({...r,metadata:i,isWebhook:!0}),{url:s}=o();return a.url=`${s}/.well-known/workflow/v1/webhook/${encodeURIComponent(a.token)}`,a}function v(){function e(t,n){c(`defineHook().resume()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,e)}return{create(e){return g(e)},resume:e}}function y(e={}){let{namespace:t}=e,n=globalThis[s](t);return Object.create(globalThis.WritableStream.prototype,{[i]:{value:n,writable:!1}})}function b(){n(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,b)}function x(){c(`resumeHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,x)}export{t as FatalError,e as RetryableError,g as createHook,_ as createWebhook,v as defineHook,h as experimental_setAttributes,b as getStepMetadata,o as getWorkflowMetadata,y as getWritable,x as resumeHook,p as sleep};