@@ -94,6 +94,8 @@ export async function fetchRunKey(
9494 options ?: {
9595 /** Auth token (from config). Falls back to OIDC or VERCEL_TOKEN. */
9696 token ?: string ;
97+ /** Team ID for team-scoped API requests. */
98+ teamId ?: string ;
9799 }
98100) : Promise < Uint8Array | undefined > {
99101 // Authenticate via provided token (CLI/config), OIDC token (runtime),
@@ -107,6 +109,9 @@ export async function fetchRunKey(
107109 }
108110
109111 const params = new URLSearchParams ( { projectId, runId } ) ;
112+ if ( options ?. teamId ) {
113+ params . set ( 'teamId' , options . teamId ) ;
114+ }
110115 const response = await fetch (
111116 `https://api.vercel.com/v1/workflow/run-key/${ deploymentId } ?${ params } ` ,
112117 {
@@ -143,11 +148,13 @@ export async function fetchRunKey(
143148 * - Fetching it from the Vercel API when the run belongs to a different deployment
144149 *
145150 * @param projectId - Vercel project ID for HKDF context isolation
151+ * @param teamId - Optional team ID for team-scoped API requests
146152 * @param token - Optional auth token from config
147153 * @returns The `getEncryptionKeyForRun` function, or `undefined` if no projectId
148154 */
149155export function createGetEncryptionKeyForRun (
150156 projectId : string | undefined ,
157+ teamId ?: string ,
151158 token ?: string
152159) : World [ 'getEncryptionKeyForRun' ] {
153160 if ( ! projectId ) return undefined ;
@@ -188,6 +195,6 @@ export function createGetEncryptionKeyForRun(
188195 // raw deployment key never leaves the API boundary.
189196 // Covers cross-deployment resumeHook() (OIDC auth) and o11y
190197 // tooling reading data from other deployments (VERCEL_TOKEN).
191- return fetchRunKey ( deploymentId , projectId , runId , { token } ) ;
198+ return fetchRunKey ( deploymentId , projectId , runId , { token, teamId } ) ;
192199 } ;
193200}
0 commit comments