File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " @inngest/agent-kit " : patch
3+ ---
4+
5+ Support multiple ` AsyncContext ` shapes following an update in ` inngest@3.45.0 `
Original file line number Diff line number Diff line change 1- import { type Inngest } from "inngest" ;
2- import { type InngestFunction , isInngestFunction } from "inngest" ;
3- import { getAsyncCtx , type AsyncContext } from "inngest/experimental" ;
1+ import { type Inngest , type InngestFunction , isInngestFunction } from "inngest" ;
2+ import { type AsyncContext , getAsyncCtx } from "inngest/experimental" ;
43import { type ZodType , ZodObject } from "zod" ;
54
65export type MaybePromise < T > = T | Promise < T > ;
@@ -35,9 +34,15 @@ export const stringifyError = (e: unknown): string => {
3534export const getStepTools = async ( ) : Promise <
3635 AsyncContext [ "ctx" ] [ "step" ] | undefined
3736> => {
37+ // The shape of the experimental async context changed across versions.
38+ // This is now stable, but we support both shapes here for compatibility.
3839 const asyncCtx = await getAsyncCtx ( ) ;
3940
40- return asyncCtx ?. ctx . step ;
41+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
42+ const ctx = asyncCtx ?. ctx || ( asyncCtx as any ) ?. execution ?. ctx ;
43+
44+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access
45+ return ctx ?. step ;
4146} ;
4247
4348export const isInngestFn = ( fn : unknown ) : fn is InngestFunction . Any => {
You can’t perform that action at this time.
0 commit comments