eve 0.17.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/src/chunks/{use-eve-agent-BEOUv37s.js → use-eve-agent-Bh1NmXO9.js} +8 -5
  3. package/dist/src/chunks/{use-eve-agent-C25KOe9i.js → use-eve-agent-Dvy_Wjvq.js} +8 -5
  4. package/dist/src/cli/dev/tui/tui.d.ts +2 -0
  5. package/dist/src/cli/dev/tui/tui.js +1 -1
  6. package/dist/src/cli/dev/url-target.d.ts +14 -0
  7. package/dist/src/cli/dev/url-target.js +1 -0
  8. package/dist/src/cli/run.js +3 -3
  9. package/dist/src/client/client.js +1 -1
  10. package/dist/src/compiled/.vendor-stamp.json +3 -3
  11. package/dist/src/compiled/@workflow/core/classify-error.d.ts +15 -0
  12. package/dist/src/compiled/@workflow/core/index.js +2 -2
  13. package/dist/src/compiled/@workflow/core/runtime.js +27 -27
  14. package/dist/src/compiled/@workflow/core/serialization.d.ts +12 -3
  15. package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +10 -0
  16. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  17. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  18. package/dist/src/compiled/_chunks/workflow/{attribute-changes-DUxG-Gic.js → attribute-changes-zAifvEhb.js} +1 -1
  19. package/dist/src/compiled/_chunks/workflow/{resume-hook-CUCPW67D.js → resume-hook-C15uJ2ik.js} +1 -1
  20. package/dist/src/compiled/_chunks/workflow/run-BJUPZ0Ni.js +1 -0
  21. package/dist/src/compiled/_chunks/workflow/{sleep-Dxuzj5to.js → sleep-C8B-TYir.js} +1 -1
  22. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  23. package/dist/src/execution/remote-agent-dispatch.js +1 -1
  24. package/dist/src/execution/subagent-invocation.d.ts +20 -5
  25. package/dist/src/execution/subagent-invocation.js +2 -2
  26. package/dist/src/execution/subagent-tool.d.ts +7 -0
  27. package/dist/src/execution/subagent-tool.js +1 -1
  28. package/dist/src/internal/application/package.js +1 -1
  29. package/dist/src/internal/http/basic-auth.d.ts +1 -0
  30. package/dist/src/internal/http/basic-auth.js +1 -0
  31. package/dist/src/services/dev-client/client-options.d.ts +5 -1
  32. package/dist/src/services/dev-client/client-options.js +1 -1
  33. package/dist/src/setup/scaffold/create/project.js +1 -1
  34. package/dist/src/svelte/index.js +1 -1
  35. package/dist/src/svelte/use-eve-agent.js +1 -1
  36. package/dist/src/vue/index.js +1 -1
  37. package/dist/src/vue/use-eve-agent.js +1 -1
  38. package/docs/guides/dev-tui.md +7 -1
  39. package/docs/reference/cli.md +10 -1
  40. package/package.json +5 -5
  41. package/dist/src/compiled/_chunks/workflow/run-CVlF84yI.js +0 -1
@@ -1 +0,0 @@
1
- import{d as e}from"./dist-FLIfyJ4Y.js";import{C as t,S as n,T as r,b as i,m as a,r as o,w as s,x as c}from"./dist-Dxrjttr2.js";import{A as l,At as u,C as d,Dn as f,Gt as p,It as m,J as h,L as g,Lt as _,Q as v,T as y,Wt as b,Y as x,_n as S,a as C,b as w,en as T,gn as E,hn as D,k as O,kn as k,m as A,n as j,p as M,r as N,s as P,t as F,xn as I,z as L}from"./attribute-changes-DUxG-Gic.js";const R=f();let z=!1;async function B(t,n,r){"use step";return await N(()=>{let i=t?.workflowId;if(!i)throw new s(`'start' received an invalid workflow function. Ensure the Workflow SDK is configured correctly and the function includes a 'use workflow' directive.`,{slug:`start-invalid-workflow-function`});return x(`workflow.start ${e(i)}`,async e=>{e?.setAttributes({...m(i),..._(`start`)});let t=[],a=r??{};Array.isArray(n)?t=n:typeof n==`object`&&(a=n),e?.setAttributes({...u(t.length)});let c=a?.world??await S(),l=await c.getDeploymentId(),d=a.deploymentId??l;d===`latest`&&(c.resolveLatestDeploymentId?d=await c.resolveLatestDeploymentId():(z||(z=!0,L.warn(`deploymentId: 'latest' has no effect in this world and was ignored. It is only supported by worlds with atomic deployments, such as Vercel. The run will target the current deployment.`,{currentDeploymentId:l})),d=l));let f,g;if(d===l)f=!0,g=!0;else if(typeof c.streams?.get!=`function`)f=!1,g=!1;else{let e=A((await P(c,`workflow`,{deploymentId:d,timeout:2e3}).catch(()=>void 0))?.workflowCoreVersion);f=e.framedByteStreams,g=e.supportedFormats.has(T.GZIP)}let y=[],x=`wrun_${R()}`,E=await h(),D=a.specVersion??c.specVersion??2,O=k(D),N=a.allowReservedAttributes===!0,B;if(a.attributes&&Object.keys(a.attributes).length>0){if(D<4)throw new s(`Initial workflow attributes require a World that supports spec version 4 or later.`);for(let[e,t]of Object.entries(a.attributes))if(typeof t!=`string`)throw new s(`Initial workflow attribute ${JSON.stringify(e)} must be a string value.`);let e=F(a.attributes,{allowReservedAttributes:N});B=Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}let H=B?{attributes:B,...N?{allowReservedAttributes:!0}:{}}:{},U=await c.getEncryptionKeyForRun?.(x,{...a,deploymentId:d}),W=U?await I(U):void 0,G=await w(t,x,W,y,globalThis,O,f,g&&D>=5),K={traceCarrier:E,workflowCoreVersion:M,features:{encryption:!!W}},[q,J]=await Promise.allSettled([c.events.create(x,{eventType:`run_created`,specVersion:D,eventData:{deploymentId:d,workflowName:i,input:G,executionContext:K,...H}},{v1Compat:O}),c.queue(C(i),{runId:x,traceCarrier:E,...D>=3?{runInput:{input:G,deploymentId:d,workflowName:i,specVersion:D,executionContext:K,...H}}:{}},{deploymentId:d,specVersion:D})]);if(J.status===`rejected`)throw J.reason;let X=!1;if(q.status===`rejected`){let e=q.reason;if(!o.is(e))if(V(e))X=!0,L.warn(`Run creation event failed, but the run was accepted via the queue. The run_created event will be re-tried async by the runtime.`,{workflowRunId:x,error:e.message});else throw e}else{let e=q.value;if(!e.run)throw new s(`Missing 'run' in server response for 'run_created' event`);if(!O&&e.run.runId!==x)throw new s(`Server returned different runId than requested: expected ${x}, got ${e.run.runId}`)}return j(Promise.all(y),e=>{L.warn(`Background flush of workflow argument streams failed`,{workflowRunId:x,error:e instanceof Error?e.message:String(e)})}),e?.setAttributes({...b(x),...v(d),...q.status===`fulfilled`&&q.value.run?p(q.value.run.status):{}}),new Y(x,{resilientStart:X})})})}function V(e){return!!(a.is(e)||r.is(e)&&e.status&&e.status>=500)}const H=e=>Array.isArray(e)?e:[e];async function U(e,t,n={}){try{let r=await e.runs.get(t,{resolveData:`all`}),i=await e.getEncryptionKeyForRun?.(r),a=i?await I(i):void 0,o=H(await O(r.input,t,a,globalThis)),s=n.specVersion??r.specVersion??1,c=n.deploymentId??r.deploymentId;return(await B({workflowId:r.workflowName},o,{deploymentId:c,world:e,specVersion:s})).runId}catch(e){throw Error(`Failed to recreate run from ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function W(e,t){try{let n=(await e.runs.get(t,{resolveData:`none`})).specVersion??1,r=k(n),i={eventType:`run_cancelled`,specVersion:n};await e.events.create(t,i,{v1Compat:r})}catch(e){throw Error(`Failed to cancel run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function G(e,t){try{let n=await e.runs.get(t,{resolveData:`none`});await e.queue(C(n.workflowName),{runId:t},{deploymentId:n.deploymentId,specVersion:n.specVersion??1})}catch(e){throw Error(`Failed to re-enqueue run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function K(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`}),i=k(r.specVersion),a=[],s=null;do{let n=await e.events.list({runId:t,pagination:{limit:1e3,...s?{cursor:s}:{}},resolveData:`none`});a.push(...n.data),s=n.hasMore?n.cursor:null}while(s);let c=a.filter(e=>e.eventType===`wait_created`),l=new Set(a.filter(e=>e.eventType===`wait_completed`).map(e=>e.correlationId)),u=c.filter(e=>!l.has(e.correlationId));if(n?.correlationIds&&n.correlationIds.length>0){let e=new Set(n.correlationIds);u=u.filter(t=>t.correlationId&&e.has(t.correlationId))}let d=[],f=0;for(let n of u){if(!n.correlationId)continue;let a=i?{eventType:`wait_completed`,correlationId:n.correlationId}:{eventType:`wait_completed`,correlationId:n.correlationId,specVersion:r.specVersion,eventData:{resumeAt:n.eventData.resumeAt}};try{await e.events.create(t,a,{v1Compat:i}),f++}catch(e){o.is(e)?f++:d.push(e instanceof Error?e:Error(String(e)))}}if(f>0&&await e.queue(C(r.workflowName),{runId:t},{deploymentId:r.deploymentId,specVersion:r.specVersion??1}),d.length>0)throw AggregateError(d,`Failed to complete ${d.length}/${u.length} pending wait(s) for run ${t}`);return{stoppedCount:f}}catch(e){throw e instanceof AggregateError?e:Error(`Failed to wake up run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function q(e,t,n,r){try{return await e.streams.get(t,n,r?.startIndex)}catch(e){throw Error(`Failed to read stream ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function J(e,t){try{return await e.streams.list(t)}catch(e){throw Error(`Failed to list streams for run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}var Y=class e{static[E](e){return{runId:e.runId,resilientStart:e.#r}}static[D](t){return new e(t.runId,{resilientStart:t.resilientStart})}runId;#e;get#t(){return this.#e||=S(),this.#e}#n=null;#r=!1;constructor(e,t){this.runId=e,this.#r=t?.resilientStart??!1}#i(){return this.#n||=(async()=>{let e=await this.#t,t=await e.runs.get(this.runId),n=await e.getEncryptionKeyForRun?.(t);return n?await I(n):void 0})(),this.#n}#a(){return()=>this.#i()}async wakeUp(e){"use step";return K(await this.#t,this.runId,e)}async cancel(){"use step";await(await this.#t).events.create(this.runId,{eventType:`run_cancelled`,specVersion:5})}get exists(){"use step";return this.#t.then(e=>e.runs.get(this.runId,{resolveData:`none`}).then(()=>!0).catch(e=>{if(t.is(e))return!1;throw e}))}get status(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.status))}get returnValue(){"use step";return this.#o()}get workflowName(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.workflowName))}get createdAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.createdAt))}get startedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.startedAt))}get completedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.completedAt))}get readable(){return this.getReadable()}getReadable(e={}){"use step";let{ops:t=[],global:n=globalThis,startIndex:r,namespace:i}=e,a=g(this.runId,i),o=this.#a(),s=d(n,t,this.runId,o).ReadableStream({name:a,startIndex:r}),c=this.#t,l=this.runId;return Object.assign(s,{getTailIndex:async()=>(await(await c).streams.getInfo(l,a)).tailIndex})}async#o(){let e=await this.#t,r=0,a=this.#r?3:0,o=[1e3,3e3,6e3];for(;;)try{let t=await e.runs.get(this.runId);if(t.status===`completed`){let e=await this.#i();return await l(t.output,this.runId,e)}if(t.status===`cancelled`)throw new i(this.runId);if(t.status===`failed`){let e=await this.#i(),n;try{n=await y(t.error,this.runId,e)}catch{n=Error(`Failed to hydrate workflow run error`)}throw new c(this.runId,n,{errorCode:t.errorCode})}throw new n(this.runId,t.status)}catch(e){if(n.is(e)){await new Promise(e=>setTimeout(e,1e3));continue}if(t.is(e)&&r<a){let e=o[r];r++,await new Promise(t=>setTimeout(t,e));continue}throw e}}};function X(e){return new Y(e)}export{q as a,K as c,J as i,B as l,X as n,U as o,W as r,G as s,Y as t};