inngest 4.5.1 → 4.6.0
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 +12 -0
- package/api/schema.d.cts +2 -2
- package/api/schema.d.cts.map +1 -1
- package/api/schema.d.ts +2 -2
- package/api/schema.d.ts.map +1 -1
- package/components/Inngest.cjs +3 -0
- package/components/Inngest.cjs.map +1 -1
- package/components/Inngest.d.cts.map +1 -1
- package/components/Inngest.d.ts.map +1 -1
- package/components/Inngest.js +4 -1
- package/components/Inngest.js.map +1 -1
- package/components/InngestFunction.cjs +3 -0
- package/components/InngestFunction.cjs.map +1 -1
- package/components/InngestFunction.d.cts +2 -0
- package/components/InngestFunction.d.cts.map +1 -1
- package/components/InngestFunction.d.ts +2 -0
- package/components/InngestFunction.d.ts.map +1 -1
- package/components/InngestFunction.js +3 -0
- package/components/InngestFunction.js.map +1 -1
- package/components/InngestGroupTools.cjs +2 -2
- package/components/InngestGroupTools.cjs.map +1 -1
- package/components/InngestGroupTools.js +2 -2
- package/components/InngestGroupTools.js.map +1 -1
- package/components/InngestMetadata.cjs.map +1 -1
- package/components/InngestMetadata.d.cts +1 -1
- package/components/InngestMetadata.d.cts.map +1 -1
- package/components/InngestMetadata.d.ts +1 -1
- package/components/InngestMetadata.d.ts.map +1 -1
- package/components/InngestMetadata.js.map +1 -1
- package/components/execution/engine.cjs +15 -0
- package/components/execution/engine.cjs.map +1 -1
- package/components/execution/engine.d.cts +8 -0
- package/components/execution/engine.d.cts.map +1 -1
- package/components/execution/engine.d.ts +8 -0
- package/components/execution/engine.d.ts.map +1 -1
- package/components/execution/engine.js +15 -0
- package/components/execution/engine.js.map +1 -1
- package/components/execution/otel/aiExtractor.cjs +114 -0
- package/components/execution/otel/aiExtractor.cjs.map +1 -0
- package/components/execution/otel/aiExtractor.d.cts +16 -0
- package/components/execution/otel/aiExtractor.d.cts.map +1 -0
- package/components/execution/otel/aiExtractor.d.ts +19 -0
- package/components/execution/otel/aiExtractor.d.ts.map +1 -0
- package/components/execution/otel/aiExtractor.js +111 -0
- package/components/execution/otel/aiExtractor.js.map +1 -0
- package/components/execution/otel/metadataProcessor.cjs +195 -0
- package/components/execution/otel/metadataProcessor.cjs.map +1 -0
- package/components/execution/otel/metadataProcessor.js +193 -0
- package/components/execution/otel/metadataProcessor.js.map +1 -0
- package/components/execution/otel/middleware.cjs +1 -1
- package/components/execution/otel/middleware.d.cts +5 -5
- package/components/execution/otel/middleware.d.ts +5 -5
- package/components/execution/otel/middleware.js +1 -1
- package/components/execution/otel/processor.cjs +1 -1
- package/components/execution/otel/processor.js +1 -1
- package/components/execution/otel/util.cjs.map +1 -1
- package/components/execution/otel/util.js.map +1 -1
- package/package.json +1 -1
- package/types.cjs.map +1 -1
- package/types.d.cts +17 -15
- package/types.d.cts.map +1 -1
- package/types.d.ts +17 -15
- package/types.d.ts.map +1 -1
- package/types.js.map +1 -1
- package/version.cjs +1 -1
- package/version.cjs.map +1 -1
- package/version.d.cts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
|
@@ -5,6 +5,7 @@ import { BasicFoundStep, InngestExecutionFactory, MemoizedOp } from "./InngestEx
|
|
|
5
5
|
import { OutgoingOp } from "../../types.cjs";
|
|
6
6
|
import { StepError } from "../StepError.cjs";
|
|
7
7
|
import { LazyOps } from "./lazyOps.cjs";
|
|
8
|
+
import { AIMetadata } from "./otel/aiExtractor.cjs";
|
|
8
9
|
|
|
9
10
|
//#region src/components/execution/engine.d.ts
|
|
10
11
|
declare namespace engine_d_exports {
|
|
@@ -42,6 +43,13 @@ interface ExecutionState {
|
|
|
42
43
|
* platforms.
|
|
43
44
|
*/
|
|
44
45
|
executingStep?: Readonly<Omit<OutgoingOp, "id">>;
|
|
46
|
+
/**
|
|
47
|
+
* AI metadata accumulated from userland OTel spans that ended while the
|
|
48
|
+
* current step was executing, pushed by the metadata span processor's sink
|
|
49
|
+
* and drained into the step's outgoing op in the step's teardown. Only set
|
|
50
|
+
* while `executingStep` is.
|
|
51
|
+
*/
|
|
52
|
+
executingStepAIMetadata?: AIMetadata;
|
|
45
53
|
/**
|
|
46
54
|
* A map of step IDs to their data, used to fill previously-completed steps
|
|
47
55
|
* with state from the executor.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.cts","names":[],"sources":["../../../src/components/execution/engine.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.d.cts","names":[],"sources":["../../../src/components/execution/engine.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;cAoIa,uBAAuB;;;;UAgzFnB,WAAA;;YACU,cAAc;;;IAjzF5B,KAAA,EAAA,OAAA;EAgzFI,CAAA;EAAW,mBAAA,EAAA;IACD,IAAA,EAAA,OAAA;;kBAIjB,EAAA;IACM,IAAA,EADN,UACM;IAAc,UAAA,EAAd,cAAc,EAAA;IAOzB,eAAU,EAAA,MAAA;EAAA,CAAA;iCACD,EAAA,CAAA,CAAA;yCAA+B,EAAA,CAAA,CAAA;;KADxC,UAAA,GAC0D,QAAnC,MAAd,WAAc,GAAA,QAAA,CAAA;EACpB,IAAA,EADqC,CACrC;AAAW,CAAA,GADgC,WAChC,CAD4C,CAC5C,CAAA,CAAA,EA+BnB,CAAA,MA/BQ,WA+BS,CAAA;AAAc,UAAd,cAAA,CAAc;;;;;;eAoBlB,CAAA,EAdK,QAcL,CAdc,IAcd,CAdmB,UAcnB,EAAA,IAAA,CAAA,CAAA;;;;;;;yBAwDa,CAAA,EA9DE,UA8DF;;;;;WAoDD,EA5GZ,MA4GY,CAAA,MAAA,EA5GG,UA4GH,CAAA;;;AACxB;AAgBkC;;;aA6BjC,EAlJa,MAkJb,CAAA,MAAA,EAAA,OAAA,CAAA;;;;;gBAME,EAAA,MAAA;EAAyB;AAoC7B;;;OAjFiC,EA/FxB,GA+FwB,CAAA,MAAA,EA/FZ,SA+FY,CAAA;;;;;;;;;;;QAlFzB,eAAe;;;;wBAKC;;;;;;;;;;;;;;;0BAkBE;;;;;;;;;;;;;;;8BAgBI;;;;;;;;;;;;;;;;;;;;;2BAwBH;;;;;;WAOhB;;;;aAKE,YAAY,MAAM;;;;;UAiBrB,yBAAA;;;;;;;;;;;;;;;iBA2BD,sBAAA;;;;;;mBAMU;YACP,YAAY;IACpB;;;;cAoCS;eAjFO,eAAa"}
|
|
@@ -5,6 +5,7 @@ import { BasicFoundStep, InngestExecutionFactory, MemoizedOp } from "./InngestEx
|
|
|
5
5
|
import { OutgoingOp } from "../../types.js";
|
|
6
6
|
import { StepError } from "../StepError.js";
|
|
7
7
|
import { LazyOps } from "./lazyOps.js";
|
|
8
|
+
import { AIMetadata } from "./otel/aiExtractor.js";
|
|
8
9
|
|
|
9
10
|
//#region src/components/execution/engine.d.ts
|
|
10
11
|
declare namespace engine_d_exports {
|
|
@@ -42,6 +43,13 @@ interface ExecutionState {
|
|
|
42
43
|
* platforms.
|
|
43
44
|
*/
|
|
44
45
|
executingStep?: Readonly<Omit<OutgoingOp, "id">>;
|
|
46
|
+
/**
|
|
47
|
+
* AI metadata accumulated from userland OTel spans that ended while the
|
|
48
|
+
* current step was executing, pushed by the metadata span processor's sink
|
|
49
|
+
* and drained into the step's outgoing op in the step's teardown. Only set
|
|
50
|
+
* while `executingStep` is.
|
|
51
|
+
*/
|
|
52
|
+
executingStepAIMetadata?: AIMetadata;
|
|
45
53
|
/**
|
|
46
54
|
* A map of step IDs to their data, used to fill previously-completed steps
|
|
47
55
|
* with state from the executor.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","names":[],"sources":["../../../src/components/execution/engine.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.d.ts","names":[],"sources":["../../../src/components/execution/engine.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;cAoIa,uBAAuB;;;;UAgzFnB,WAAA;;YACU,cAAc;;;IAjzF5B,KAAA,EAAA,OAAA;EAgzFI,CAAA;EAAW,mBAAA,EAAA;IACD,IAAA,EAAA,OAAA;;kBAIjB,EAAA;IACM,IAAA,EADN,UACM;IAAc,UAAA,EAAd,cAAc,EAAA;IAOzB,eAAU,EAAA,MAAA;EAAA,CAAA;iCACD,EAAA,CAAA,CAAA;yCAA+B,EAAA,CAAA,CAAA;;KADxC,UAAA,GAC0D,QAAnC,MAAd,WAAc,GAAA,QAAA,CAAA;EACpB,IAAA,EADqC,CACrC;AAAW,CAAA,GADgC,WAChC,CAD4C,CAC5C,CAAA,CAAA,EA+BnB,CAAA,MA/BQ,WA+BS,CAAA;AAAc,UAAd,cAAA,CAAc;;;;;;eAoBlB,CAAA,EAdK,QAcL,CAdc,IAcd,CAdmB,UAcnB,EAAA,IAAA,CAAA,CAAA;;;;;;;yBAwDa,CAAA,EA9DE,UA8DF;;;;;WAoDD,EA5GZ,MA4GY,CAAA,MAAA,EA5GG,UA4GH,CAAA;;;AACxB;AAgBkC;;;aA6BjC,EAlJa,MAkJb,CAAA,MAAA,EAAA,OAAA,CAAA;;;;;gBAME,EAAA,MAAA;EAAyB;AAoC7B;;;OAjFiC,EA/FxB,GA+FwB,CAAA,MAAA,EA/FZ,SA+FY,CAAA;;;;;;;;;;;QAlFzB,eAAe;;;;wBAKC;;;;;;;;;;;;;;;0BAkBE;;;;;;;;;;;;;;;8BAgBI;;;;;;;;;;;;;;;;;;;;;2BAwBH;;;;;;WAOhB;;;;aAKE,YAAY,MAAM;;;;;UAiBrB,yBAAA;;;;;;;;;;;;;;;iBA2BD,sBAAA;;;;;;mBAMU;YACP,YAAY;IACpB;;;;cAoCS;eAjFO,eAAa"}
|
|
@@ -11,6 +11,8 @@ import { isDeferredFunction, isStaleDispatchError } from "../../helpers/marker.j
|
|
|
11
11
|
import { isTemporalDuration } from "../../helpers/temporal.js";
|
|
12
12
|
import { createDeferredPromise, createDeferredPromiseWithStack, createTimeoutPromise, goIntervalTiming, resolveAfterPending, resolveNextTick, retryWithBackoff, runAsPromise } from "../../helpers/promises.js";
|
|
13
13
|
import { getAsyncCtx, getAsyncLocalStorage } from "./als.js";
|
|
14
|
+
import { aggregate, toInngestAIMetadataValues } from "./otel/aiExtractor.js";
|
|
15
|
+
import { metadataSpanProcessor } from "./otel/metadataProcessor.js";
|
|
14
16
|
import { STEP_INDEXING_SUFFIX, createStepTools, experimentStepRunSymbol, getStepOptions } from "../InngestStepTools.js";
|
|
15
17
|
import { UnreachableError } from "../middleware/utils.js";
|
|
16
18
|
import { MiddlewareManager } from "../middleware/manager.js";
|
|
@@ -190,6 +192,14 @@ var InngestExecutionEngine = class extends InngestExecution {
|
|
|
190
192
|
traceparent: this.options.headers[headerKeys.TraceParent],
|
|
191
193
|
tracestate: this.options.headers[headerKeys.TraceState]
|
|
192
194
|
});
|
|
195
|
+
metadataSpanProcessor.declareStartingSpan({
|
|
196
|
+
span,
|
|
197
|
+
traceparent: this.options.headers[headerKeys.TraceParent],
|
|
198
|
+
onAIMetadata: (aiMetadata) => {
|
|
199
|
+
if (!this.state.executingStep) return;
|
|
200
|
+
this.state.executingStepAIMetadata = this.state.executingStepAIMetadata ? aggregate(this.state.executingStepAIMetadata, aiMetadata) : aiMetadata;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
193
203
|
return this._start().then((result) => {
|
|
194
204
|
this.devDebug("result:", result);
|
|
195
205
|
return result;
|
|
@@ -904,6 +914,7 @@ var InngestExecutionEngine = class extends InngestExecution {
|
|
|
904
914
|
};
|
|
905
915
|
this.devDebug(`executing step "${id}"`);
|
|
906
916
|
if (this.rootSpanId && this.options.checkpointingConfig) clientProcessorMap.get(this.options.client)?.declareStepExecution(this.rootSpanId, userland.id ?? "", userland.index ?? 0, hashedId, this.options.data?.attempt ?? 0);
|
|
917
|
+
this.state.executingStepAIMetadata = void 0;
|
|
907
918
|
let interval;
|
|
908
919
|
const actualHandler = () => runAsPromise(fn);
|
|
909
920
|
await this.middlewareManager.onMemoizationEnd();
|
|
@@ -920,6 +931,10 @@ var InngestExecutionEngine = class extends InngestExecution {
|
|
|
920
931
|
this.devDebug(`finished executing step "${id}"`);
|
|
921
932
|
this.state.executingStep = void 0;
|
|
922
933
|
if (this.rootSpanId && this.options.checkpointingConfig) clientProcessorMap.get(this.options.client)?.clearStepExecution(this.rootSpanId);
|
|
934
|
+
const aiMetadata = this.state.executingStepAIMetadata;
|
|
935
|
+
this.state.executingStepAIMetadata = void 0;
|
|
936
|
+
const aiValues = aiMetadata && toInngestAIMetadataValues(aiMetadata);
|
|
937
|
+
if (aiValues) this.addMetadata(id, "inngest.ai", "step", "merge", aiValues);
|
|
923
938
|
if (store?.execution) delete store.execution.executingStep;
|
|
924
939
|
}).then(async ({ resultPromise, interval: _interval }) => {
|
|
925
940
|
interval = _interval;
|