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(t,n){"use step";if(t.length===0)return;let r=globalThis,i=r[Symbol.for(`WORKFLOW_STEP_CONTEXT_STORAGE`)]?.getStore?.(),a=typeof i?.stepMetadata?.attempt==`number`?i.stepMetadata.attempt:3,o=r[Symbol.for(`@workflow/world//cache`)];if(typeof o?.runs?.experimentalSetAttributes!=`function`){if(r[EVE_UNSUPPORTED_WORLD_WARNED]!==!0){r[EVE_UNSUPPORTED_WORLD_WARNED]=!0;let t=o?.name===void 0?``:` (${o.name})`;console.warn(`[eve] setAttributes: the current world implementation${t} 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 e=i?.workflowMetadata?.workflowRunId;if(e===void 0)throw Error(`__builtin_set_attributes: no workflow run id available in step context`);await o.runs.experimentalSetAttributes(e,t,n)}catch(e){if(a<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};