eve 0.70.1 → 0.70.2
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.
- package/CHANGELOG.md +24 -0
- package/dist/src/channel/adapter.js +1 -1
- package/dist/src/channel/channel-operations.js +1 -1
- package/dist/src/channel/resolve-text.d.ts +8 -0
- package/dist/src/channel/resolve-text.js +2 -1
- package/dist/src/cli/banner.d.ts +2 -2
- package/dist/src/cli/banner.js +1 -1
- package/dist/src/cli/commands/init-agent-workspace.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +2 -1
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +2 -2
- package/dist/src/cli/dev/tui/test/mock-terminal.d.ts +7 -1
- package/dist/src/cli/dev/tui/test/mock-terminal.js +4 -3
- package/dist/src/cli/dev/tui/theme.d.ts +1 -1
- package/dist/src/cli/dev/tui/theme.js +1 -1
- package/dist/src/cli/dev/tui/tool-presentation.d.ts +15 -2
- package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
- package/dist/src/cli/dev/tui/transcript-parts.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +7 -7
- package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +1 -1
- package/dist/src/compiled/@vercel/sandbox/index.js +1 -1
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +15 -0
- package/dist/src/compiled/@workflow/core/runtime/dynamic-workflow.d.ts +182 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +7 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/quickjs-assets.generated.d.ts +7 -0
- package/dist/src/compiled/@workflow/core/runtime/quickjs-entrypoint.d.ts +2 -30
- package/dist/src/compiled/@workflow/core/runtime/quickjs-log-view.d.ts +27 -4
- package/dist/src/compiled/@workflow/core/runtime/quickjs-runtime.d.ts +55 -3
- package/dist/src/compiled/@workflow/core/runtime/quickjs-snapshot-codec.d.ts +74 -0
- package/dist/src/compiled/@workflow/core/runtime/start.d.ts +4 -0
- package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +44 -0
- package/dist/src/compiled/@workflow/core/runtime.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +4 -4
- package/dist/src/compiled/@workflow/core/schemas.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/compression.d.ts +27 -2
- package/dist/src/compiled/@workflow/core/serialization/hardened.d.ts +8 -0
- package/dist/src/compiled/@workflow/core/serialization/types.d.ts +1 -0
- package/dist/src/compiled/@workflow/core/serialization.d.ts +48 -0
- package/dist/src/compiled/@workflow/core/serialization.js +1 -1
- package/dist/src/compiled/@workflow/core/set-error-stack.d.ts +12 -0
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +47 -0
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world/events.d.ts +10 -0
- package/dist/src/compiled/@workflow/world/index.d.ts +2 -0
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +127 -0
- package/dist/src/compiled/@workflow/world/queue.d.ts +6 -0
- package/dist/src/compiled/@workflow/world/runs.d.ts +9 -2
- package/dist/src/compiled/@workflow/world/snapshots.d.ts +60 -0
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +19 -17
- package/dist/src/compiled/_chunks/node/undici-B61sz6UT.js +95 -0
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-D721NpZv.js → attribute-changes-VaTKT4K8.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/dist-B7NC1c9-.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{functions-DpZiBxgQ.js → functions-CKkqf9V6.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/helpers-CP9TjeO8.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{logger-D4GJNTk4.js → logger-oqfblE3p.js} +2 -2
- package/dist/src/compiled/_chunks/workflow/resume-hook-yq-NAdBu.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-DYKeqbob.js +32 -0
- package/dist/src/compiled/_chunks/workflow/serialization-APSKphN5.js +3 -0
- package/dist/src/compiled/_chunks/workflow/signal-exit-iIdjQcCK.js +95 -0
- package/dist/src/compiled/_chunks/workflow/sleep-Ba8SExMt.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{token-BhlnqoHM.js → token-BKeK6DmC.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/token-Cv2GYj9A.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{token-util-DaeRTzDa.js → token-util-CddTZ_ef.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{wait-until-3_1djUuL.js → wait-until-Dc9s3yyP.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{wrapper-CzrF_dmI.js → wrapper-Dq4OeGmJ.js} +4 -4
- package/dist/src/compiled/shadcn-registry/index.js +4 -4
- package/dist/src/context/serialize.js +1 -1
- package/dist/src/discover/discover-agent.js +1 -1
- package/dist/src/discover/extension-specifier.d.ts +1 -0
- package/dist/src/discover/extension-specifier.js +1 -1
- package/dist/src/discover/extensions.d.ts +1 -1
- package/dist/src/discover/extensions.js +1 -1
- package/dist/src/discover/project-source.d.ts +5 -0
- package/dist/src/discover/project-source.js +1 -1
- package/dist/src/evals/session.d.ts +1 -0
- package/dist/src/evals/session.js +1 -1
- package/dist/src/evals/types.d.ts +6 -0
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/legacy-session/turn-workflow.js +1 -1
- package/dist/src/execution/proxied-deliver-step.d.ts +11 -0
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/sandbox/read-file.d.ts +8 -1
- package/dist/src/execution/sandbox/read-file.js +3 -3
- package/dist/src/execution/session/active-turn.d.ts +4 -1
- package/dist/src/execution/session/active-turn.js +1 -1
- package/dist/src/execution/session/entry-input.d.ts +23 -5
- package/dist/src/execution/session/entry.js +1 -1
- package/dist/src/execution/session/handoff.d.ts +35 -13
- package/dist/src/execution/session/handoff.js +1 -1
- package/dist/src/execution/session/program.d.ts +16 -3
- package/dist/src/execution/session/program.js +1 -1
- package/dist/src/execution/session/turn-step-types.d.ts +6 -1
- package/dist/src/execution/session/turn-step.js +1 -1
- package/dist/src/execution/session/turn.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +4 -4
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/harness/attachment-staging.d.ts +27 -7
- package/dist/src/harness/attachment-staging.js +1 -1
- package/dist/src/harness/compaction-prompt.js +2 -2
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/messages.js +1 -1
- package/dist/src/harness/token-estimate.d.ts +5 -3
- package/dist/src/harness/token-estimate.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/attachments/media-metadata.d.ts +25 -0
- package/dist/src/internal/attachments/media-metadata.js +1 -0
- package/dist/src/internal/attachments/sandbox-refs.d.ts +12 -7
- package/dist/src/internal/attachments/sandbox-refs.js +1 -1
- package/dist/src/internal/authored-module-loader.js +1 -1
- package/dist/src/internal/bundler/extension-mount-plugin.d.ts +4 -0
- package/dist/src/internal/bundler/extension-mount-plugin.js +1 -1
- package/dist/src/internal/bundler/extension-scope-plugin.js +2 -2
- package/dist/src/internal/input-text.d.ts +12 -0
- package/dist/src/internal/input-text.js +1 -0
- package/dist/src/internal/workflow/vercel-world-defaults.d.ts +1 -1
- package/dist/src/internal/workflow/vercel-world-defaults.js +1 -1
- package/dist/src/public/channels/chat-sdk/input-actions.d.ts +8 -2
- package/dist/src/public/channels/chat-sdk/input-actions.js +4 -1
- package/dist/src/public/channels/github/defaults.js +2 -3
- package/dist/src/public/channels/linear/hitl.js +2 -3
- package/dist/src/public/channels/slack/action-status.d.ts +10 -5
- package/dist/src/public/channels/slack/action-status.js +1 -1
- package/dist/src/public/channels/slack/defaults.js +3 -3
- package/dist/src/public/channels/slack/limits.d.ts +1 -1
- package/dist/src/public/channels/slack/limits.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +11 -9
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/slack/task-card.js +1 -1
- package/dist/src/public/channels/slack/thread-status.d.ts +33 -0
- package/dist/src/public/channels/slack/thread-status.js +1 -0
- package/dist/src/public/channels/twilio/defaults.js +4 -2
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/subagents/hitl-proxy.d.ts +2 -2
- package/dist/src/subagents/hitl-proxy.js +1 -1
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/read-file.d.ts +7 -0
- package/dist/src/tools/provided/read-file.js +2 -2
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/docs/agent-config.md +2 -2
- package/docs/channels/chat-sdk.mdx +1 -1
- package/docs/channels/slack.mdx +21 -15
- package/docs/channels/twilio.mdx +1 -1
- package/docs/concepts/built-in-tools.md +1 -1
- package/docs/concepts/default-harness.md +4 -0
- package/docs/concepts/execution-model-and-durability.mdx +7 -1
- package/docs/concepts/sessions-runs-and-streaming.md +3 -3
- package/docs/evals/cases.mdx +1 -0
- package/docs/extensions.md +5 -3
- package/docs/guides/dev-tui.md +3 -1
- package/docs/guides/dynamic-capabilities.md +1 -1
- package/docs/sandbox/index.mdx +11 -0
- package/docs/tools/overview.mdx +4 -2
- package/package.json +7 -7
- package/dist/src/compiled/_chunks/node/undici-h5GH4RBM.js +0 -95
- package/dist/src/compiled/_chunks/workflow/debug-log-CVPstO1D.js +0 -1
- package/dist/src/compiled/_chunks/workflow/dist-BUFGAKRb.js +0 -1
- package/dist/src/compiled/_chunks/workflow/frames-Dr9fHWdo.js +0 -3
- package/dist/src/compiled/_chunks/workflow/helpers-DkKxg_yn.js +0 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-uTW-jBYz.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-5DmiMN9b.js +0 -1
- package/dist/src/compiled/_chunks/workflow/serialization-CNIYl1D3.js +0 -3
- package/dist/src/compiled/_chunks/workflow/signal-exit-DZKTacNU.js +0 -95
- package/dist/src/compiled/_chunks/workflow/sleep-DFKgN7UG.js +0 -1
- package/dist/src/compiled/_chunks/workflow/token-1wSBbi5N.js +0 -1
- package/dist/src/compiled/_chunks/workflow/token-util-Cm4Ec1Bg.js +0 -1
- package/dist/src/compiled/_chunks/workflow/ws-transport--rYOVIaf.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ht as e}from"./serialization-CNIYl1D3.js";import{i as t}from"./attribute-changes-D721NpZv.js";async function n(r){let i=globalThis[e];return i||t(`sleep()`,`https://workflow-sdk.dev/docs/api-reference/workflow/sleep`,n),i(r)}export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-B_knIduE.js";import{r as t,t as n}from"./token-util-Cm4Ec1Bg.js";var r=e(((e,r)=>{var i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of o(t))!s.call(e,c)&&c!==n&&i(e,c,{get:()=>t[c],enumerable:!(r=a(t,c))||r.enumerable});return e},u=e=>l(i({},`__esModule`,{value:!0}),e),d={};c(d,{refreshToken:()=>m}),r.exports=u(d);var f=t(),p=n();async function m(e){let t=e?.project,n=e?.team;if(!t&&!n){let e=(0,p.findProjectInfo)();t=e.projectId,n=e.teamId}else if(!t||!n){let e=(0,p.findProjectInfo)();t??=e.projectId,n??=e.teamId}if(!t)throw new f.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");let r=(0,p.loadToken)(t);if(!r||(0,p.isExpired)((0,p.getTokenPayload)(r.token),e?.expirationBufferMs)){let i=await(0,p.getVercelToken)({expirationBufferMs:e?.expirationBufferMs});if(r=await(0,p.getVercelOidcToken)(i,t,n),!r)throw new f.VercelOidcTokenError(`Failed to refresh OIDC token`);(0,p.saveToken)(r,t)}process.env.VERCEL_OIDC_TOKEN=r.token}0&&(r.exports={refreshToken:m})}));export default r();export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./rolldown-runtime-B_knIduE.js";var n=t(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{VercelOidcTokenError:()=>u}),t.exports=c(l);var u=class extends Error{constructor(e,t){super(e),this.name=`VercelOidcTokenError`,this.cause=t}toString(){return this.cause?`${this.name}: ${this.message}: ${this.cause}`:`${this.name}: ${this.message}`}};0&&(t.exports={VercelOidcTokenError:u})})),r=t(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>u,RefreshAccessTokenFailedError:()=>d}),t.exports=c(l);var u=class extends Error{constructor(){super(`No authentication found. Please log in with the Vercel CLI (vercel login).`),this.name=`AccessTokenMissingError`}},d=class extends Error{constructor(e){super(`Failed to refresh authentication token.`,{cause:e}),this.name=`RefreshAccessTokenFailedError`}};0&&(t.exports={AccessTokenMissingError:u,RefreshAccessTokenFailedError:d})})),i=t(((t,r)=>{var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of s(t))!l.call(e,i)&&i!==n&&a(e,i,{get:()=>t[i],enumerable:!(r=o(t,i))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:i(c(e)),d(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e)),p=e=>d(a({},`__esModule`,{value:!0}),e),m={};u(m,{findRootDir:()=>y,getUserDataDir:()=>b}),r.exports=p(m);var h=f(e(`path`)),g=f(e(`fs`)),_=f(e(`os`)),v=n();function y(){try{let e=process.cwd();for(;e!==h.default.dirname(e);){let t=h.default.join(e,`.vercel`);if(g.default.existsSync(t))return e;e=h.default.dirname(e)}}catch{throw new v.VercelOidcTokenError(`Token refresh only supported in node server environments`)}return null}function b(){if(process.env.XDG_DATA_HOME)return process.env.XDG_DATA_HOME;switch(_.default.platform()){case`darwin`:return h.default.join(_.default.homedir(),`Library/Application Support`);case`linux`:return h.default.join(_.default.homedir(),`.local/share`);case`win32`:return process.env.LOCALAPPDATA?process.env.LOCALAPPDATA:null;default:return null}}0&&(r.exports={findRootDir:y,getUserDataDir:b})})),a=t(((t,n)=>{var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!l.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:r(c(e)),d(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),p=e=>d(i({},`__esModule`,{value:!0}),e),m={};u(m,{isValidAccessToken:()=>x,readAuthConfig:()=>y,writeAuthConfig:()=>b}),n.exports=p(m);var h=f(e(`fs`)),g=f(e(`path`)),_=s();function v(){let e=(0,_.getVercelDataDir)();if(!e)throw Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);return g.join(e,`auth.json`)}function y(){try{let e=v();if(!h.existsSync(e))return null;let t=h.readFileSync(e,`utf8`);return t?JSON.parse(t):null}catch{return null}}function b(e){let t=v(),n=g.dirname(t);h.existsSync(n)||h.mkdirSync(n,{mode:504,recursive:!0}),h.writeFileSync(t,JSON.stringify(e,null,2),{mode:384})}function x(e,t=0){if(!e.token)return!1;if(typeof e.expiresAt!=`number`)return!0;let n=Math.floor(Date.now()/1e3),r=t/1e3;return e.expiresAt>=n+r}0&&(n.exports={isValidAccessToken:x,readAuthConfig:y,writeAuthConfig:b})})),o=t(((t,n)=>{var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(r({},`__esModule`,{value:!0}),e),u={};s(u,{processTokenResponse:()=>g,refreshTokenRequest:()=>h}),n.exports=l(u);var d=e(`os`);let f=`@vercel/oidc node-${process.version} ${(0,d.platform)()} (${(0,d.arch)()}) ${(0,d.hostname)()}`,p=null;async function m(){if(p)return p;let e=await fetch(`https://vercel.com/.well-known/openid-configuration`,{headers:{"user-agent":f}});if(!e.ok)throw Error(`Failed to discover OAuth endpoints`);let t=await e.json();if(!t||typeof t.token_endpoint!=`string`)throw Error(`Invalid OAuth discovery response`);let n=t.token_endpoint;return p=n,n}async function h(e){let t=await m();return await fetch(t,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":f},body:new URLSearchParams({client_id:`cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp`,grant_type:`refresh_token`,...e})})}async function g(e){let t=await e.json();if(!e.ok){let e=typeof t==`object`&&t&&`error`in t?String(t.error):`Token refresh failed`;return[Error(e)]}return typeof t!=`object`||!t?[Error(`Invalid token response`)]:typeof t.access_token==`string`?t.token_type===`Bearer`?typeof t.expires_in==`number`?[null,t]:[Error(`Missing expires_in in response`)]:[Error(`Invalid token_type in response`)]:[Error(`Missing access_token in response`)]}0&&(n.exports={processTokenResponse:g,refreshTokenRequest:h})})),s=t(((t,s)=>{var c=Object.create,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,f=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,m=(e,t)=>{for(var n in t)l(e,n,{get:t[n],enumerable:!0})},h=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of d(t))!p.call(e,i)&&i!==n&&l(e,i,{get:()=>t[i],enumerable:!(r=u(t,i))||r.enumerable});return e},g=(e,t,n)=>(n=e==null?{}:c(f(e)),h(t||!e||!e.__esModule?l(n,`default`,{value:e,enumerable:!0}):n,e)),_=e=>h(l({},`__esModule`,{value:!0}),e),v={};m(v,{assertVercelOidcTokenResponse:()=>k,findProjectInfo:()=>A,getTokenPayload:()=>N,getVercelDataDir:()=>E,getVercelOidcToken:()=>O,getVercelToken:()=>D,isExpired:()=>P,loadToken:()=>M,saveToken:()=>j}),s.exports=_(v);var y=g(e(`path`)),b=g(e(`fs`)),x=n(),S=i(),C=a(),w=o(),T=r();function E(){let e=(0,S.getUserDataDir)();return e?y.join(e,`com.vercel.cli`):null}async function D(e){let t=(0,C.readAuthConfig)();if(!t?.token)throw new T.AccessTokenMissingError;if((0,C.isValidAccessToken)(t,e?.expirationBufferMs))return t.token;if(!t.refreshToken)throw(0,C.writeAuthConfig)({}),new T.RefreshAccessTokenFailedError(`No refresh token available`);try{let e=await(0,w.refreshTokenRequest)({refresh_token:t.refreshToken}),[n,r]=await(0,w.processTokenResponse)(e);if(n||!r)throw(0,C.writeAuthConfig)({}),new T.RefreshAccessTokenFailedError(n);let i={token:r.access_token,expiresAt:Math.floor(Date.now()/1e3)+r.expires_in};return r.refresh_token&&(i.refreshToken=r.refresh_token),(0,C.writeAuthConfig)(i),i.token}catch(e){throw(0,C.writeAuthConfig)({}),e instanceof T.AccessTokenMissingError||e instanceof T.RefreshAccessTokenFailedError?e:new T.RefreshAccessTokenFailedError(e)}}async function O(e,t,n){let r=`https://api.vercel.com/v1/projects/${t}/token?source=vercel-oidc-refresh${n?`&teamId=${n}`:``}`,i=await fetch(r,{method:`POST`,headers:{Authorization:`Bearer ${e}`}});if(!i.ok)throw new x.VercelOidcTokenError(`Failed to refresh OIDC token: ${i.statusText}`);let a=await i.json();return k(a),a}function k(e){if(!e||typeof e!=`object`)throw TypeError("Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again");if(!(`token`in e)||typeof e.token!=`string`)throw TypeError("Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again")}function A(){let e=(0,S.findRootDir)();if(!e)throw new x.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");let t=y.join(e,`.vercel`,`project.json`);if(!b.existsSync(t))throw new x.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");let n=JSON.parse(b.readFileSync(t,`utf8`));if(typeof n.projectId!=`string`&&typeof n.orgId!=`string`)throw TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");return{projectId:n.projectId,teamId:n.orgId}}function j(e,t){let n=(0,S.getUserDataDir)();if(!n)throw new x.VercelOidcTokenError(`Unable to find user data directory. Please reach out to Vercel support.`);let r=y.join(n,`com.vercel.token`,`${t}.json`),i=JSON.stringify(e);b.mkdirSync(y.dirname(r),{mode:504,recursive:!0}),b.writeFileSync(r,i),b.chmodSync(r,432)}function M(e){let t=(0,S.getUserDataDir)();if(!t)throw new x.VercelOidcTokenError(`Unable to find user data directory. Please reach out to Vercel support.`);let n=y.join(t,`com.vercel.token`,`${e}.json`);if(!b.existsSync(n))return null;let r=JSON.parse(b.readFileSync(n,`utf8`));return k(r),r}function N(e){let t=e.split(`.`);if(t.length!==3)throw new x.VercelOidcTokenError("Invalid token. Please run `vc env pull` and try again");let n=t[1].replace(/-/g,`+`).replace(/_/g,`/`),r=n.padEnd(n.length+(4-n.length%4)%4,`=`);return JSON.parse(Buffer.from(r,`base64`).toString(`utf8`))}function P(e,t=0){return e.exp*1e3<Date.now()+t}0&&(s.exports={assertVercelOidcTokenResponse:k,findProjectInfo:A,getTokenPayload:N,getVercelDataDir:E,getVercelOidcToken:O,getVercelToken:D,isExpired:P,loadToken:M,saveToken:j})}));export{r as n,n as r,s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./debug-log-CVPstO1D.js";import{ht as t}from"./dist-BUFGAKRb.js";import{E as n,I as r,J as i,T as a,U as o,a as s,at as c,d as l,g as u,nt as d,r as f,u as p,v as m,w as h}from"./frames-Dr9fHWdo.js";import{n as g,t as _}from"./wrapper-CzrF_dmI.js";var v=c();g();var y=class extends Error{constructor(e,t){super(e,{cause:t?.cause}),this.name=`WsTransportError`}};function b(e){for(let[t,n]of Object.entries(e))if(t.toLowerCase()===`authorization`)return n;return null}async function x(e){let t=(async function*(){yield e})();for await(let e of f(t))return e;throw Error(`ws-transport: received an empty/unframed message`)}function S(e){if(e.byteLength===0)return`(no message)`;let t=new TextDecoder().decode(e);try{let e=JSON.parse(t);return typeof e.message==`string`?e.message:t}catch{return t}}function C(e){return e instanceof Error?e.message:String(e)}var w=class{wsUrl;getHeaders;connection=null;connecting=null;reconnectAttempts=0;reconnectTimer=null;openCount=0;closed=!1;lastDrainReason=null;needsFreshToken=!1;lastAuthorization=null;constructor(e,t){this.wsUrl=e,this.getHeaders=t}async request(e){if(this.closed)throw new y(`workflow-server events WS channel for ${this.wsUrl} is closed`);let t=await this.ensureConnected(),n=t.nextReqId++,r=e(n),i=u(),a;try{return await new Promise((e,o)=>{t.pending.set(n,{resolve:e,reject:o}),a=setTimeout(()=>{t.pending.delete(n)&&(o(new y(`workflow-server events WS request ${n} to ${this.wsUrl} timed out after ${i}ms with no reply`)),this.failConnection(t,`workflow-server events WS connection to ${this.wsUrl} abandoned after request ${n} timed out`))},i),a.unref?.(),t.ws.send(r,e=>{e&&t.pending.delete(n)&&o(new y(`workflow-server events WS send failed: ${C(e)}`,{cause:e}))})})}finally{a!==void 0&&clearTimeout(a)}}open(){this.closed||(this.openCount++,this.connection===null&&this.connecting===null&&this.ensureConnected().catch(()=>{this.close(`connect failed`)}))}release(e){this.openCount!==0&&(this.openCount--,this.openCount===0&&this.close(e))}close(e){if(this.closed)return;this.closed=!0,this.openCount=0,this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),T.transports.get(this.wsUrl)===this&&T.transports.delete(this.wsUrl);let t=this.connection;this.connection=null,t?.ws.close(1e3,e)}ensureConnected(){let e=this.connection;return e&&e.ws.readyState===_.default.OPEN?Promise.resolve(e):(this.connecting??=this.connectWithSpan().finally(()=>{this.connecting=null}),this.connecting)}async resolveUpgradeHeaders(){let e=this.needsFreshToken,t=await this.getHeaders({forceRefresh:e}),n=b(t);if(e&&n===this.lastAuthorization)throw new y(`workflow-server events WS connection to ${this.wsUrl} drained for auth expiry, but re-resolving the bearer produced the same token. Not reconnecting with a token the server has already rejected; the next event write will retry.`);this.lastAuthorization=n,this.needsFreshToken=!1;let r=new Headers;return await i(r),r.forEach((e,n)=>{t[n]=e}),t}consumeDrainReason(){let e=this.lastDrainReason;this.lastDrainReason=null,e===`auth_expiry`&&(this.needsFreshToken=!0)}connectWithSpan(){return h({method:`GET`,url:this.wsUrl,spanName:`workflow.events.ws.connect`,attributes:{...r(`ws`),...n(`websocket`),...o(this.reconnectAttempts)}},async e=>{try{return await this.connect()}catch(t){throw e?.setAttributes({...a(`TRANSPORT`)}),t instanceof Error&&e?.recordException?.(t),t}})}connect(){return new Promise((e,t)=>{(async()=>{let n;try{let e=await this.resolveUpgradeHeaders(),t=new _.default(this.wsUrl,{headers:e});t.binaryType=`nodebuffer`,n={ws:t,nextReqId:1,pending:new Map}}catch(e){console.error(`world-vercel: ws events transport could not open a connection to ${this.wsUrl}: ${C(e)}`),t(e instanceof y?e:new y(`workflow-server events WS connection to ${this.wsUrl} could not be opened: ${C(e)}`,{cause:e}));return}let{ws:r}=n,i=!1;r.on(`open`,()=>{if(i=!0,this.closed){r.close(1e3,`released while connecting`),t(new y(`workflow-server events WS connection to ${this.wsUrl} was released while connecting`));return}this.connection=n,this.reconnectAttempts=0,e(n)}),r.on(`message`,e=>{this.handleMessage(n,new Uint8Array(e))}),r.on(`error`,e=>{if(console.error(`world-vercel: ws events transport socket error (${this.wsUrl}): ${C(e)}`),!i){t(e);return}r.close()}),r.on(`close`,e=>{this.connection===n&&(this.connection=null),this.consumeDrainReason(),i||t(new y(`workflow-server events WS connection to ${this.wsUrl} closed before opening (code ${e})`)),this.failAllPending(n,new y(`workflow-server events WS connection closed (code ${e})`)),(i||this.reconnectAttempts>0)&&this.scheduleReconnect(e)})})()})}scheduleReconnect(e){if(this.closed||this.connection!==null||this.reconnectTimer!==null)return;if(this.reconnectAttempts>=5){console.error(`world-vercel: ws events transport giving up eager reconnect to ${this.wsUrl} after 5 attempts (last close code ${e}); the next event write will retry.`);return}let t=Math.min(100*2**this.reconnectAttempts,5e3);this.reconnectAttempts++;let n=setTimeout(()=>{this.reconnectTimer=null,this.ensureConnected().catch(()=>{})},t);n.unref?.(),this.reconnectTimer=n}async handleMessage(t,n){let r;try{r=await x(n)}catch(e){let r=`could not decode a ${n.byteLength}-byte reply frame from ${this.wsUrl}: ${C(e)}`;console.error(`world-vercel: ws events transport ${r}`),this.failConnection(t,`workflow-server events WS transport ${r}`);return}if(r.meta.type===`drain`){let t=r.meta.reason===`auth_expiry`?`auth_expiry`:`max_duration`;this.lastDrainReason=t,e(`world-vercel: ws events transport received a drain notice (reason: ${t}, graceMs: ${r.meta.graceMs??`unspecified`}); connection will close soon.`);return}let i=r.meta.reqId;if(i===-1){let e=`received a malformed-frame error from ${this.wsUrl} (reserved reqId -1, status ${String(r.meta.status??`unknown`)}): ${S(r.body)}. The server could not parse a frame this client sent, so the originating write cannot be identified`;console.error(`world-vercel: ws events transport ${e}.`),this.failConnection(t,`workflow-server events WS transport ${e}`);return}if(typeof i!=`number`){let e=`received a reply frame with no numeric reqId from ${this.wsUrl} (type: ${String(r.meta.type??`absent`)})`;console.error(`world-vercel: ws events transport ${e}.`),this.failConnection(t,`workflow-server events WS transport ${e}`);return}let a=t.pending.get(i);if(!a){console.error(`world-vercel: ws events transport received a reply for unknown reqId ${i} from ${this.wsUrl} (already settled, or the request was failed by a send error or its deadline); dropping it.`);return}t.pending.delete(i),a.resolve({meta:r.meta,body:r.body})}failAllPending(e,t){for(let n of e.pending.values())n.reject(t);e.pending.clear()}failConnection(e,t){this.failAllPending(e,new y(t)),this.connection===e&&(this.connection=null),e.ws.close()}};const T=t(`@workflow/world-vercel//wsEventsTransports@${d}`,1,()=>({transports:new Map,loggedWsProxyFallback:!1,loggedWsInUse:!1}));function E(e,t){let n=T.transports.get(e);return n||(n=new w(e,t),T.transports.set(e,n)),n}function D(e,t){let n=new URL(e);return n.protocol=n.protocol===`https:`?`wss:`:`ws:`,n.pathname=`${n.pathname.replace(/\/$/,``)}/websockets/v1/runs/${encodeURIComponent(t)}`,n.toString()}function O(t,n){if(!s())return;let r=A(t,n);if(!r)return;T.loggedWsInUse||(T.loggedWsInUse=!0,e(`world-vercel: using ws events transport (${r}).`));let i=E(r,async({forceRefresh:e})=>{e&&await k();let{headers:t}=await p(n);return m(t)});i.open();let a=!1;return()=>{a||(a=!0,i.release(`invocation complete`))}}async function k(){try{await(0,v.getVercelOidcToken)({expirationBufferMs:864e5})}catch{}}function A(t,n){let{baseUrl:r,usingProxy:i}=l(n);return i?(T.loggedWsProxyFallback||(T.loggedWsProxyFallback=!0,e(`world-vercel: ws events transport unavailable for a World with projectConfig (api-workflow proxy, resolved baseUrl: ${r}) — falling back to HTTP.`)),null):D(r,t)}function j(e,t){let n=A(e,t);if(!n)return null;let r=T.transports.get(n);return r?{transport:r,wsUrl:n}:null}export{O as openWsChannel,j as resolveWsTransport};
|