UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 1.67 kB
async function __builtin_response_array_buffer(){"use step";return await this.arrayBuffer()}async function __builtin_response_json(){"use step";return await this.json()}async function __builtin_response_text(){"use step";return await this.text()}const EVE_UNSUPPORTED_WORLD_WARNED=Symbol.for(`@workflow/setAttributes//unsupportedWorldWarned`);function formatUnknownError(e){return e instanceof Error?e.stack??`${e.name}: ${e.message}`:String(e)}async function __builtin_set_attributes(e,t){"use step";if(e.length===0)return;let n=globalThis,r=n[Symbol.for(`WORKFLOW_STEP_CONTEXT_STORAGE`)]?.getStore?.(),i=typeof r?.stepMetadata?.attempt==`number`?r.stepMetadata.attempt:3,a=n[Symbol.for(`@workflow/world//cache`)];if(typeof a?.runs?.experimentalSetAttributes!=`function`){if(n[EVE_UNSUPPORTED_WORLD_WARNED]!==!0){n[EVE_UNSUPPORTED_WORLD_WARNED]=!0;let e=a?.name===void 0?``:` (${a.name})`;console.warn(`[eve] setAttributes: the current world implementation${e} does not implement experimentalSetAttributes; this call (and any subsequent setAttributes calls in this process) is a no-op. Attributes will become available once the world adapter adds support.`)}return}try{let n=r?.workflowMetadata?.workflowRunId;if(n===void 0)throw Error(`__builtin_set_attributes: no workflow run id available in step context`);await a.runs.experimentalSetAttributes(n,e,t)}catch(e){if(i<3)throw e;console.error(`[eve] setAttributes: failed to post tags after 3 attempts; dropping the internal attribute write. ${formatUnknownError(e)}`)}}__builtin_set_attributes.maxRetries=2;export{__builtin_response_array_buffer,__builtin_response_json,__builtin_response_text,__builtin_set_attributes};