@codemation/core 0.6.0 → 0.8.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 +31 -0
- package/dist/{EngineRuntimeRegistration.types-Dm129RJ6.d.ts → EngineRuntimeRegistration.types-BP6tsaNP.d.ts} +4 -2
- package/dist/{EngineWorkflowRunnerService-Bf88QtwB.d.cts → EngineWorkflowRunnerService-DzOCa1BW.d.cts} +4 -2
- package/dist/{InMemoryRunDataFactory-Dyl4p2s8.d.cts → InMemoryRunDataFactory-1iz7_SnO.d.cts} +27 -7
- package/dist/{workflowActivationPolicy-6V3OJD3N.cjs → InMemoryRunEventBusRegistry-B0_C4OnP.cjs} +1 -16
- package/dist/InMemoryRunEventBusRegistry-B0_C4OnP.cjs.map +1 -0
- package/dist/{workflowActivationPolicy-Td9HTOuD.js → InMemoryRunEventBusRegistry-C2U83Hmv.js} +2 -11
- package/dist/InMemoryRunEventBusRegistry-C2U83Hmv.js.map +1 -0
- package/dist/{RunIntentService-BDiodxhf.d.ts → RunIntentService-BqhmdoA1.d.ts} +258 -21
- package/dist/{RunIntentService-B1Y3v1H6.d.cts → RunIntentService-S-1lW-gS.d.cts} +209 -5
- package/dist/bootstrap/index.cjs +4 -2
- package/dist/bootstrap/index.d.cts +26 -7
- package/dist/bootstrap/index.d.ts +4 -4
- package/dist/bootstrap/index.js +3 -3
- package/dist/{bootstrap-DVL2ue5v.cjs → bootstrap-BaN6hZ5I.cjs} +7 -4
- package/dist/bootstrap-BaN6hZ5I.cjs.map +1 -0
- package/dist/{bootstrap-DdeiJ8cd.js → bootstrap-d_BMaDT4.js} +7 -4
- package/dist/bootstrap-d_BMaDT4.js.map +1 -0
- package/dist/{index-C2af8ssM.d.ts → index-CVs9rVhl.d.ts} +44 -13
- package/dist/index.cjs +59 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -22
- package/dist/index.d.ts +3 -3
- package/dist/index.js +33 -75
- package/dist/index.js.map +1 -1
- package/dist/{runtime-7Xh9z3dw.js → runtime-DUW6tIJ1.js} +454 -64
- package/dist/runtime-DUW6tIJ1.js.map +1 -0
- package/dist/{runtime-DVBwxFvX.cjs → runtime-Dvo2ru5A.cjs} +589 -73
- package/dist/runtime-Dvo2ru5A.cjs.map +1 -0
- package/dist/testing.cjs +6 -6
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +3 -3
- package/package.json +1 -1
- package/src/ai/AgentConfigInspectorFactory.ts +2 -2
- package/src/ai/AgentMessageConfigNormalizerFactory.ts +3 -3
- package/src/ai/AiHost.ts +4 -2
- package/src/ai/CallableToolConfig.ts +28 -3
- package/src/authoring/defineNode.types.ts +35 -9
- package/src/authoring/index.ts +1 -0
- package/src/bootstrap/index.ts +6 -1
- package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +4 -3
- package/src/bootstrap/runtime/EngineRuntimeRegistration.types.ts +3 -0
- package/src/contracts/CodemationTelemetryAttributeNames.ts +12 -0
- package/src/contracts/CodemationTelemetryMetricNames.ts +7 -0
- package/src/contracts/CostCatalogContract.ts +16 -0
- package/src/contracts/CostTrackingTelemetryContract.ts +47 -0
- package/src/contracts/GenAiTelemetryAttributeNames.ts +10 -0
- package/src/contracts/NoOpCostTrackingTelemetry.ts +16 -0
- package/src/contracts/NoOpCostTrackingTelemetryFactory.ts +9 -0
- package/src/contracts/NoOpExecutionTelemetry.ts +26 -0
- package/src/contracts/NoOpExecutionTelemetryFactory.ts +16 -0
- package/src/contracts/NoOpNodeExecutionTelemetry.ts +15 -0
- package/src/contracts/NoOpTelemetryArtifactReference.ts +9 -0
- package/src/contracts/NoOpTelemetrySpanScope.ts +22 -0
- package/src/contracts/index.ts +3 -1
- package/src/contracts/{itemValue.ts → itemExpr.ts} +31 -32
- package/src/contracts/params.ts +10 -0
- package/src/contracts/runTypes.ts +4 -1
- package/src/contracts/runtimeTypes.ts +7 -0
- package/src/contracts/telemetryTypes.ts +105 -0
- package/src/contracts/workflowTypes.ts +20 -2
- package/src/events/EventPublishingWorkflowExecutionRepository.ts +1 -1
- package/src/execution/CatalogBackedCostTrackingTelemetry.ts +81 -0
- package/src/execution/CatalogBackedCostTrackingTelemetryFactory.ts +12 -0
- package/src/execution/DefaultExecutionContextFactory.ts +23 -0
- package/src/execution/ExecutionTelemetryCostTrackingDecoratorFactory.ts +84 -0
- package/src/execution/{ItemValueResolver.ts → ItemExprResolver.ts} +5 -5
- package/src/execution/NodeActivationRequestComposer.ts +1 -0
- package/src/execution/NodeExecutionSnapshotFactory.ts +2 -0
- package/src/execution/NodeExecutor.ts +6 -6
- package/src/execution/StaticCostCatalog.ts +22 -0
- package/src/execution/WorkflowRunExecutionContextFactory.ts +2 -0
- package/src/execution/index.ts +5 -1
- package/src/index.ts +1 -1
- package/src/orchestration/NodeExecutionRequestHandlerService.ts +1 -0
- package/src/orchestration/RunContinuationService.ts +4 -0
- package/src/orchestration/RunStartService.ts +2 -0
- package/src/policies/storage/RunPolicySnapshotFactory.ts +9 -0
- package/src/runStorage/InMemoryRunData.ts +9 -5
- package/src/runStorage/InMemoryWorkflowExecutionRepository.ts +4 -2
- package/src/types/index.ts +7 -1
- package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +1 -1
- package/dist/bootstrap-DVL2ue5v.cjs.map +0 -1
- package/dist/bootstrap-DdeiJ8cd.js.map +0 -1
- package/dist/runtime-7Xh9z3dw.js.map +0 -1
- package/dist/runtime-DVBwxFvX.cjs.map +0 -1
- package/dist/workflowActivationPolicy-6V3OJD3N.cjs.map +0 -1
- package/dist/workflowActivationPolicy-Td9HTOuD.js.map +0 -1
|
@@ -138,43 +138,43 @@ function chatModel(options = {}) {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
//#endregion
|
|
141
|
-
//#region src/contracts/
|
|
142
|
-
const
|
|
143
|
-
function
|
|
141
|
+
//#region src/contracts/itemExpr.ts
|
|
142
|
+
const ITEM_EXPR_BRAND = Symbol.for("codemation.itemExpr");
|
|
143
|
+
function itemExpr(fn) {
|
|
144
144
|
return {
|
|
145
|
-
[
|
|
145
|
+
[ITEM_EXPR_BRAND]: true,
|
|
146
146
|
fn
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function isItemExpr(value) {
|
|
150
150
|
if (typeof value !== "object" || value === null) return false;
|
|
151
151
|
const v = value;
|
|
152
|
-
if (v[
|
|
152
|
+
if (v[ITEM_EXPR_BRAND] === true) return true;
|
|
153
153
|
const keys = Object.keys(v);
|
|
154
154
|
if (keys.length === 1 && keys[0] === "fn" && typeof v.fn === "function") return true;
|
|
155
|
-
for (const sym of Object.getOwnPropertySymbols(v)) if (sym.description === "codemation.
|
|
155
|
+
for (const sym of Object.getOwnPropertySymbols(v)) if (sym.description === "codemation.itemExpr" && v[sym] === true) return true;
|
|
156
156
|
return false;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
if (
|
|
158
|
+
function containsItemExprInUnknown(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
159
|
+
if (isItemExpr(value)) return true;
|
|
160
160
|
if (value === null || typeof value !== "object") return false;
|
|
161
161
|
if (seen.has(value)) return false;
|
|
162
162
|
seen.add(value);
|
|
163
|
-
if (Array.isArray(value)) return value.some((entry) =>
|
|
164
|
-
for (const entry of Object.values(value)) if (
|
|
163
|
+
if (Array.isArray(value)) return value.some((entry) => containsItemExprInUnknown(entry, seen));
|
|
164
|
+
for (const entry of Object.values(value)) if (containsItemExprInUnknown(entry, seen)) return true;
|
|
165
165
|
return false;
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
|
-
* Deep-resolves {@link
|
|
168
|
+
* Deep-resolves {@link itemExpr} leaves. Returns a new graph (does not mutate the original config object).
|
|
169
169
|
*/
|
|
170
|
-
async function
|
|
171
|
-
if (
|
|
170
|
+
async function resolveItemExprsInUnknown(value, args, seen = /* @__PURE__ */ new WeakSet()) {
|
|
171
|
+
if (isItemExpr(value)) return await Promise.resolve(value.fn(args));
|
|
172
172
|
if (value === null || typeof value !== "object") return value;
|
|
173
173
|
if (seen.has(value)) return value;
|
|
174
174
|
seen.add(value);
|
|
175
175
|
if (Array.isArray(value)) {
|
|
176
176
|
const out$1 = [];
|
|
177
|
-
for (let i = 0; i < value.length; i++) out$1.push(await
|
|
177
|
+
for (let i = 0; i < value.length; i++) out$1.push(await resolveItemExprsInUnknown(value[i], args, seen));
|
|
178
178
|
return out$1;
|
|
179
179
|
}
|
|
180
180
|
const rec = value;
|
|
@@ -182,14 +182,14 @@ async function resolveItemValuesInUnknown(value, args, seen = /* @__PURE__ */ ne
|
|
|
182
182
|
const proto = Object.getPrototypeOf(value);
|
|
183
183
|
if (proto !== Object.prototype && proto !== null && entries.length === 0) return value;
|
|
184
184
|
const out = Object.create(proto);
|
|
185
|
-
for (const [k, v] of entries) out[k] = await
|
|
185
|
+
for (const [k, v] of entries) out[k] = await resolveItemExprsInUnknown(v, args, seen);
|
|
186
186
|
return out;
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
|
-
* Clones runnable config (best-effort) so per-item {@link
|
|
189
|
+
* Clones runnable config (best-effort) so per-item {@link itemExpr} resolution never mutates shared instances.
|
|
190
190
|
*/
|
|
191
|
-
async function
|
|
192
|
-
const
|
|
191
|
+
async function resolveItemExprsForExecution(config, nodeCtx, item, itemIndex, items) {
|
|
192
|
+
const exprArgs = {
|
|
193
193
|
item,
|
|
194
194
|
itemIndex,
|
|
195
195
|
items,
|
|
@@ -201,8 +201,8 @@ async function resolveItemValuesForExecution(config, nodeCtx, item, itemIndex, i
|
|
|
201
201
|
data: nodeCtx.data
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
|
-
if (!
|
|
205
|
-
return await
|
|
204
|
+
if (!containsItemExprInUnknown(config)) return;
|
|
205
|
+
return await resolveItemExprsInUnknown(config, exprArgs);
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
//#endregion
|
|
@@ -535,7 +535,8 @@ var NodeExecutionSnapshotFactory = class {
|
|
|
535
535
|
error: {
|
|
536
536
|
message: args.error.message,
|
|
537
537
|
name: args.error.name,
|
|
538
|
-
stack: args.error.stack
|
|
538
|
+
stack: args.error.stack,
|
|
539
|
+
details: args.error.details
|
|
539
540
|
}
|
|
540
541
|
};
|
|
541
542
|
}
|
|
@@ -809,14 +810,324 @@ var DefaultAsyncSleeper = class {
|
|
|
809
810
|
}
|
|
810
811
|
};
|
|
811
812
|
|
|
813
|
+
//#endregion
|
|
814
|
+
//#region src/contracts/emitPorts.ts
|
|
815
|
+
const EMIT_PORTS_BRAND = Symbol.for("codemation.emitPorts");
|
|
816
|
+
function emitPorts(ports) {
|
|
817
|
+
return {
|
|
818
|
+
[EMIT_PORTS_BRAND]: true,
|
|
819
|
+
ports
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
function isPortsEmission(value) {
|
|
823
|
+
return typeof value === "object" && value !== null && EMIT_PORTS_BRAND in value && value[EMIT_PORTS_BRAND] === true;
|
|
824
|
+
}
|
|
825
|
+
function isUnbrandedPortsEmissionShape(value) {
|
|
826
|
+
return typeof value === "object" && value !== null && "ports" in value && !isPortsEmission(value);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
//#endregion
|
|
830
|
+
//#region src/contracts/NoRetryPolicy.ts
|
|
831
|
+
var NoRetryPolicy = class {
|
|
832
|
+
kind = "none";
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/contracts/RetryPolicy.ts
|
|
837
|
+
var RetryPolicy = class {
|
|
838
|
+
kind = "fixed";
|
|
839
|
+
constructor(maxAttempts, delayMs) {
|
|
840
|
+
this.maxAttempts = maxAttempts;
|
|
841
|
+
this.delayMs = delayMs;
|
|
842
|
+
if (!Number.isFinite(maxAttempts) || maxAttempts < 1 || !Number.isInteger(maxAttempts)) throw new Error(`RetryPolicy.maxAttempts must be a positive integer, got ${maxAttempts}`);
|
|
843
|
+
if (!Number.isFinite(delayMs) || delayMs < 0) throw new Error(`RetryPolicy.delayMs must be a non-negative finite number, got ${delayMs}`);
|
|
844
|
+
}
|
|
845
|
+
/** Default for HTTP-style transient failures: 3 tries, 1s between attempts. */
|
|
846
|
+
static defaultForHttp = {
|
|
847
|
+
kind: "fixed",
|
|
848
|
+
maxAttempts: 3,
|
|
849
|
+
delayMs: 1e3
|
|
850
|
+
};
|
|
851
|
+
/** Default for LLM / agent calls: 3 tries, 2s fixed backoff. */
|
|
852
|
+
static defaultForAiAgent = {
|
|
853
|
+
kind: "fixed",
|
|
854
|
+
maxAttempts: 3,
|
|
855
|
+
delayMs: 2e3
|
|
856
|
+
};
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
//#endregion
|
|
860
|
+
//#region src/contracts/ExpRetryPolicy.ts
|
|
861
|
+
var ExpRetryPolicy = class {
|
|
862
|
+
kind = "exponential";
|
|
863
|
+
constructor(maxAttempts, initialDelayMs, multiplier, maxDelayMs, jitter) {
|
|
864
|
+
this.maxAttempts = maxAttempts;
|
|
865
|
+
this.initialDelayMs = initialDelayMs;
|
|
866
|
+
this.multiplier = multiplier;
|
|
867
|
+
this.maxDelayMs = maxDelayMs;
|
|
868
|
+
this.jitter = jitter;
|
|
869
|
+
if (!Number.isFinite(maxAttempts) || maxAttempts < 1 || !Number.isInteger(maxAttempts)) throw new Error(`ExpRetryPolicy.maxAttempts must be a positive integer, got ${maxAttempts}`);
|
|
870
|
+
if (!Number.isFinite(initialDelayMs) || initialDelayMs < 0) throw new Error(`ExpRetryPolicy.initialDelayMs must be a non-negative finite number, got ${initialDelayMs}`);
|
|
871
|
+
if (!Number.isFinite(multiplier) || multiplier < 1) throw new Error(`ExpRetryPolicy.multiplier must be >= 1, got ${multiplier}`);
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
//#endregion
|
|
876
|
+
//#region src/contracts/credentialTypes.ts
|
|
877
|
+
var CredentialUnboundError = class CredentialUnboundError extends Error {
|
|
878
|
+
constructor(bindingKey, acceptedTypes = []) {
|
|
879
|
+
super(CredentialUnboundError.createMessage(bindingKey, acceptedTypes));
|
|
880
|
+
this.bindingKey = bindingKey;
|
|
881
|
+
this.acceptedTypes = acceptedTypes;
|
|
882
|
+
this.name = "CredentialUnboundError";
|
|
883
|
+
}
|
|
884
|
+
static createMessage(bindingKey, acceptedTypes) {
|
|
885
|
+
const acceptedTypesSuffix = acceptedTypes.length > 0 ? ` Accepted credential types: ${acceptedTypes.join(", ")}.` : "";
|
|
886
|
+
return `Credential slot "${bindingKey.slotKey}" is not bound for workflow ${bindingKey.workflowId} node ${bindingKey.nodeId}.${acceptedTypesSuffix}`;
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
//#endregion
|
|
891
|
+
//#region src/contracts/CostTrackingTelemetryContract.ts
|
|
892
|
+
const CostTrackingTelemetryMetricNames = {
|
|
893
|
+
usage: "codemation.cost.usage",
|
|
894
|
+
estimatedCost: "codemation.cost.estimated"
|
|
895
|
+
};
|
|
896
|
+
const CostTrackingTelemetryAttributeNames = {
|
|
897
|
+
component: "cost.component",
|
|
898
|
+
provider: "cost.provider",
|
|
899
|
+
operation: "cost.operation",
|
|
900
|
+
pricingKey: "cost.pricing_key",
|
|
901
|
+
usageUnit: "cost.usage_unit",
|
|
902
|
+
currency: "cost.currency",
|
|
903
|
+
currencyScale: "cost.currency_scale",
|
|
904
|
+
estimateKind: "cost.estimate_kind"
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
//#endregion
|
|
908
|
+
//#region src/contracts/NoOpCostTrackingTelemetry.ts
|
|
909
|
+
var NoOpCostTrackingTelemetry = class {
|
|
910
|
+
async captureUsage(_) {}
|
|
911
|
+
forScope(_) {
|
|
912
|
+
return this;
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
//#endregion
|
|
917
|
+
//#region src/contracts/NoOpCostTrackingTelemetryFactory.ts
|
|
918
|
+
var NoOpCostTrackingTelemetryFactory = class {
|
|
919
|
+
create(_) {
|
|
920
|
+
return new NoOpCostTrackingTelemetry();
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
//#endregion
|
|
925
|
+
//#region src/contracts/NoOpTelemetryArtifactReference.ts
|
|
926
|
+
var NoOpTelemetryArtifactReference = class {
|
|
927
|
+
static value = {
|
|
928
|
+
artifactId: "telemetry-artifact-noop",
|
|
929
|
+
traceId: void 0,
|
|
930
|
+
spanId: void 0
|
|
931
|
+
};
|
|
932
|
+
};
|
|
933
|
+
|
|
934
|
+
//#endregion
|
|
935
|
+
//#region src/contracts/NoOpTelemetrySpanScope.ts
|
|
936
|
+
var NoOpTelemetrySpanScope = class {
|
|
937
|
+
static value = {
|
|
938
|
+
traceId: "00000000000000000000000000000000",
|
|
939
|
+
spanId: "0000000000000000",
|
|
940
|
+
addSpanEvent(_) {},
|
|
941
|
+
recordMetric(_) {},
|
|
942
|
+
attachArtifact(_) {
|
|
943
|
+
return NoOpTelemetryArtifactReference.value;
|
|
944
|
+
},
|
|
945
|
+
end(_ = {}) {}
|
|
946
|
+
};
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
//#endregion
|
|
950
|
+
//#region src/contracts/NoOpNodeExecutionTelemetry.ts
|
|
951
|
+
var NoOpNodeExecutionTelemetry = class NoOpNodeExecutionTelemetry {
|
|
952
|
+
static value = {
|
|
953
|
+
...NoOpTelemetrySpanScope.value,
|
|
954
|
+
forNode(_) {
|
|
955
|
+
return NoOpNodeExecutionTelemetry.value;
|
|
956
|
+
},
|
|
957
|
+
startChildSpan(_) {
|
|
958
|
+
return NoOpTelemetrySpanScope.value;
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
//#endregion
|
|
964
|
+
//#region src/contracts/NoOpExecutionTelemetry.ts
|
|
965
|
+
var NoOpExecutionTelemetry = class {
|
|
966
|
+
static value = {
|
|
967
|
+
traceId: "00000000000000000000000000000000",
|
|
968
|
+
spanId: "0000000000000000",
|
|
969
|
+
addSpanEvent(_) {},
|
|
970
|
+
recordMetric(_) {},
|
|
971
|
+
attachArtifact(_) {
|
|
972
|
+
return NoOpTelemetryArtifactReference.value;
|
|
973
|
+
},
|
|
974
|
+
forNode(_) {
|
|
975
|
+
return NoOpNodeExecutionTelemetry.value;
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
//#endregion
|
|
981
|
+
//#region src/contracts/NoOpExecutionTelemetryFactory.ts
|
|
982
|
+
var NoOpExecutionTelemetryFactory = class {
|
|
983
|
+
create(_) {
|
|
984
|
+
return NoOpExecutionTelemetry.value;
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
//#endregion
|
|
989
|
+
//#region src/contracts/CodemationTelemetryAttributeNames.ts
|
|
990
|
+
var CodemationTelemetryAttributeNames = class {
|
|
991
|
+
static workflowId = "codemation.workflow.id";
|
|
992
|
+
static runId = "codemation.run.id";
|
|
993
|
+
static nodeId = "codemation.node.id";
|
|
994
|
+
static activationId = "codemation.activation.id";
|
|
995
|
+
static nodeType = "codemation.node.type";
|
|
996
|
+
static nodeRole = "codemation.node.role";
|
|
997
|
+
static workflowFolder = "codemation.workflow.folder";
|
|
998
|
+
static connectionInvocationId = "codemation.connection.invocation_id";
|
|
999
|
+
static toolName = "codemation.tool.name";
|
|
1000
|
+
static traceParentRunId = "codemation.parent.run.id";
|
|
1001
|
+
};
|
|
1002
|
+
|
|
1003
|
+
//#endregion
|
|
1004
|
+
//#region src/contracts/GenAiTelemetryAttributeNames.ts
|
|
1005
|
+
var GenAiTelemetryAttributeNames = class {
|
|
1006
|
+
static operationName = "gen_ai.operation.name";
|
|
1007
|
+
static requestModel = "gen_ai.request.model";
|
|
1008
|
+
static usageInputTokens = "gen_ai.usage.input_tokens";
|
|
1009
|
+
static usageOutputTokens = "gen_ai.usage.output_tokens";
|
|
1010
|
+
static usageTotalTokens = "gen_ai.usage.total_tokens";
|
|
1011
|
+
static usageCacheReadInputTokens = "gen_ai.usage.cache_read.input_tokens";
|
|
1012
|
+
static usageCacheCreationInputTokens = "gen_ai.usage.cache_creation.input_tokens";
|
|
1013
|
+
static usageReasoningTokens = "codemation.gen_ai.usage.reasoning_tokens";
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
//#endregion
|
|
1017
|
+
//#region src/contracts/CodemationTelemetryMetricNames.ts
|
|
1018
|
+
var CodemationTelemetryMetricNames = class {
|
|
1019
|
+
static agentTurns = "codemation.ai.turns";
|
|
1020
|
+
static agentToolCalls = "codemation.ai.tool_calls";
|
|
1021
|
+
static gmailMessagesEmitted = "codemation.gmail.messages_emitted";
|
|
1022
|
+
static gmailAttachments = "codemation.gmail.attachments";
|
|
1023
|
+
static gmailAttachmentBytes = "codemation.gmail.attachment_bytes";
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
|
+
//#endregion
|
|
1027
|
+
//#region src/contracts/runFinishedAtFactory.ts
|
|
1028
|
+
/** Derives workflow end time from persisted run root or node snapshots for run listings. */
|
|
1029
|
+
var RunFinishedAtFactory = class {
|
|
1030
|
+
static resolveIso(state) {
|
|
1031
|
+
if (state.finishedAt && state.status !== "running" && state.status !== "pending") return state.finishedAt;
|
|
1032
|
+
if (state.status === "running" || state.status === "pending") return;
|
|
1033
|
+
let max;
|
|
1034
|
+
for (const snap of Object.values(state.nodeSnapshotsByNodeId)) if (snap?.finishedAt && (!max || snap.finishedAt > max)) max = snap.finishedAt;
|
|
1035
|
+
return max;
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
//#endregion
|
|
1040
|
+
//#region src/contracts/workflowTypes.ts
|
|
1041
|
+
function nodeRef(nodeId) {
|
|
1042
|
+
return nodeId;
|
|
1043
|
+
}
|
|
1044
|
+
const branchRef = (index) => `$${index}`;
|
|
1045
|
+
|
|
1046
|
+
//#endregion
|
|
1047
|
+
//#region src/contracts/workflowActivationPolicy.ts
|
|
1048
|
+
/** Default for tests and harnesses: every workflow is treated as active (legacy behavior). */
|
|
1049
|
+
var AllWorkflowsActiveWorkflowActivationPolicy = class {
|
|
1050
|
+
isActive(_workflowId) {
|
|
1051
|
+
return true;
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1055
|
+
//#endregion
|
|
1056
|
+
//#region src/execution/ExecutionTelemetryCostTrackingDecoratorFactory.ts
|
|
1057
|
+
var ExecutionTelemetryCostTrackingDecoratorFactory = class {
|
|
1058
|
+
decorateExecutionTelemetry(args) {
|
|
1059
|
+
return {
|
|
1060
|
+
traceId: args.telemetry.traceId,
|
|
1061
|
+
spanId: args.telemetry.spanId,
|
|
1062
|
+
costTracking: args.costTracking,
|
|
1063
|
+
addSpanEvent: (event) => args.telemetry.addSpanEvent(event),
|
|
1064
|
+
recordMetric: (metric) => args.telemetry.recordMetric(metric),
|
|
1065
|
+
attachArtifact: (artifact) => args.telemetry.attachArtifact(artifact),
|
|
1066
|
+
forNode: (nodeArgs) => {
|
|
1067
|
+
const nodeTelemetry = args.telemetry.forNode(nodeArgs);
|
|
1068
|
+
return this.decorateNodeExecutionTelemetry({
|
|
1069
|
+
telemetry: nodeTelemetry,
|
|
1070
|
+
costTracking: args.costTracking.forScope(nodeTelemetry)
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
decorateNodeExecutionTelemetry(args) {
|
|
1076
|
+
return {
|
|
1077
|
+
traceId: args.telemetry.traceId,
|
|
1078
|
+
spanId: args.telemetry.spanId,
|
|
1079
|
+
costTracking: args.costTracking,
|
|
1080
|
+
addSpanEvent: (event) => args.telemetry.addSpanEvent(event),
|
|
1081
|
+
recordMetric: (metric) => args.telemetry.recordMetric(metric),
|
|
1082
|
+
attachArtifact: (artifact) => args.telemetry.attachArtifact(artifact),
|
|
1083
|
+
end: (endArgs) => args.telemetry.end(endArgs),
|
|
1084
|
+
startChildSpan: (spanArgs) => this.decorateTelemetrySpanScope({
|
|
1085
|
+
scope: args.telemetry.startChildSpan(spanArgs),
|
|
1086
|
+
costTracking: args.costTracking
|
|
1087
|
+
}),
|
|
1088
|
+
forNode: (nodeArgs) => {
|
|
1089
|
+
const nodeTelemetry = args.telemetry.forNode(nodeArgs);
|
|
1090
|
+
return this.decorateNodeExecutionTelemetry({
|
|
1091
|
+
telemetry: nodeTelemetry,
|
|
1092
|
+
costTracking: args.costTracking.forScope(nodeTelemetry)
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
decorateTelemetrySpanScope(args) {
|
|
1098
|
+
return {
|
|
1099
|
+
traceId: args.scope.traceId,
|
|
1100
|
+
spanId: args.scope.spanId,
|
|
1101
|
+
costTracking: args.costTracking.forScope(args.scope),
|
|
1102
|
+
addSpanEvent: (event) => args.scope.addSpanEvent(event),
|
|
1103
|
+
recordMetric: (metric) => args.scope.recordMetric(metric),
|
|
1104
|
+
attachArtifact: (artifact) => args.scope.attachArtifact(artifact),
|
|
1105
|
+
end: (endArgs) => args.scope.end(endArgs)
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
|
|
812
1110
|
//#endregion
|
|
813
1111
|
//#region src/execution/DefaultExecutionContextFactory.ts
|
|
814
1112
|
var DefaultExecutionContextFactory = class {
|
|
815
|
-
|
|
1113
|
+
telemetryDecoratorFactory = new ExecutionTelemetryCostTrackingDecoratorFactory();
|
|
1114
|
+
constructor(binaryStorage = new UnavailableBinaryStorage(), telemetryFactory = new NoOpExecutionTelemetryFactory(), costTrackingFactory = new NoOpCostTrackingTelemetryFactory(), currentDate = () => /* @__PURE__ */ new Date()) {
|
|
816
1115
|
this.binaryStorage = binaryStorage;
|
|
1116
|
+
this.telemetryFactory = telemetryFactory;
|
|
1117
|
+
this.costTrackingFactory = costTrackingFactory;
|
|
817
1118
|
this.currentDate = currentDate;
|
|
818
1119
|
}
|
|
819
1120
|
create(args) {
|
|
1121
|
+
const baseTelemetry = args.telemetry ?? this.telemetryFactory.create({
|
|
1122
|
+
runId: args.runId,
|
|
1123
|
+
workflowId: args.workflowId,
|
|
1124
|
+
parent: args.parent,
|
|
1125
|
+
policySnapshot: args.policySnapshot
|
|
1126
|
+
});
|
|
1127
|
+
const telemetry = this.telemetryDecoratorFactory.decorateExecutionTelemetry({
|
|
1128
|
+
telemetry: baseTelemetry,
|
|
1129
|
+
costTracking: baseTelemetry.costTracking ?? this.costTrackingFactory.create({ telemetry: baseTelemetry })
|
|
1130
|
+
});
|
|
820
1131
|
return {
|
|
821
1132
|
runId: args.runId,
|
|
822
1133
|
workflowId: args.workflowId,
|
|
@@ -827,12 +1138,84 @@ var DefaultExecutionContextFactory = class {
|
|
|
827
1138
|
now: this.currentDate,
|
|
828
1139
|
data: args.data,
|
|
829
1140
|
nodeState: args.nodeState,
|
|
1141
|
+
telemetry,
|
|
830
1142
|
binary: new DefaultExecutionBinaryService(this.binaryStorage, args.workflowId, args.runId, this.currentDate),
|
|
831
1143
|
getCredential: args.getCredential
|
|
832
1144
|
};
|
|
833
1145
|
}
|
|
834
1146
|
};
|
|
835
1147
|
|
|
1148
|
+
//#endregion
|
|
1149
|
+
//#region src/execution/CatalogBackedCostTrackingTelemetry.ts
|
|
1150
|
+
var CatalogBackedCostTrackingTelemetry = class CatalogBackedCostTrackingTelemetry {
|
|
1151
|
+
constructor(currentScope, costCatalog) {
|
|
1152
|
+
this.currentScope = currentScope;
|
|
1153
|
+
this.costCatalog = costCatalog;
|
|
1154
|
+
}
|
|
1155
|
+
async captureUsage(args) {
|
|
1156
|
+
const usageAttributes = this.createUsageAttributes(args);
|
|
1157
|
+
await this.currentScope.recordMetric({
|
|
1158
|
+
name: CostTrackingTelemetryMetricNames.usage,
|
|
1159
|
+
value: args.quantity,
|
|
1160
|
+
unit: args.usageUnit,
|
|
1161
|
+
attributes: usageAttributes
|
|
1162
|
+
});
|
|
1163
|
+
const catalogEntry = this.costCatalog.findEntry(args);
|
|
1164
|
+
if (!catalogEntry) return;
|
|
1165
|
+
const estimatedAmountMinor = Math.round(args.quantity * catalogEntry.pricePerUnitMinor);
|
|
1166
|
+
const costAttributes = this.createCostAttributes(args, catalogEntry.currency, catalogEntry.currencyScale);
|
|
1167
|
+
await this.currentScope.recordMetric({
|
|
1168
|
+
name: CostTrackingTelemetryMetricNames.estimatedCost,
|
|
1169
|
+
value: estimatedAmountMinor,
|
|
1170
|
+
unit: catalogEntry.currency,
|
|
1171
|
+
attributes: costAttributes
|
|
1172
|
+
});
|
|
1173
|
+
return {
|
|
1174
|
+
currency: catalogEntry.currency,
|
|
1175
|
+
currencyScale: catalogEntry.currencyScale,
|
|
1176
|
+
estimatedAmountMinor,
|
|
1177
|
+
estimateKind: "catalog"
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
forScope(scope) {
|
|
1181
|
+
return new CatalogBackedCostTrackingTelemetry(scope, this.costCatalog);
|
|
1182
|
+
}
|
|
1183
|
+
createUsageAttributes(args) {
|
|
1184
|
+
return {
|
|
1185
|
+
...args.attributes,
|
|
1186
|
+
[CostTrackingTelemetryAttributeNames.component]: args.component,
|
|
1187
|
+
[CostTrackingTelemetryAttributeNames.provider]: args.provider,
|
|
1188
|
+
[CostTrackingTelemetryAttributeNames.operation]: args.operation,
|
|
1189
|
+
[CostTrackingTelemetryAttributeNames.pricingKey]: args.pricingKey,
|
|
1190
|
+
[CostTrackingTelemetryAttributeNames.usageUnit]: args.usageUnit
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
createCostAttributes(args, currency, currencyScale) {
|
|
1194
|
+
return {
|
|
1195
|
+
...args.attributes,
|
|
1196
|
+
[CostTrackingTelemetryAttributeNames.component]: args.component,
|
|
1197
|
+
[CostTrackingTelemetryAttributeNames.provider]: args.provider,
|
|
1198
|
+
[CostTrackingTelemetryAttributeNames.operation]: args.operation,
|
|
1199
|
+
[CostTrackingTelemetryAttributeNames.pricingKey]: args.pricingKey,
|
|
1200
|
+
[CostTrackingTelemetryAttributeNames.usageUnit]: args.usageUnit,
|
|
1201
|
+
[CostTrackingTelemetryAttributeNames.currency]: currency,
|
|
1202
|
+
[CostTrackingTelemetryAttributeNames.currencyScale]: currencyScale,
|
|
1203
|
+
[CostTrackingTelemetryAttributeNames.estimateKind]: "catalog"
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
|
|
1208
|
+
//#endregion
|
|
1209
|
+
//#region src/execution/CatalogBackedCostTrackingTelemetryFactory.ts
|
|
1210
|
+
var CatalogBackedCostTrackingTelemetryFactory = class {
|
|
1211
|
+
constructor(costCatalog) {
|
|
1212
|
+
this.costCatalog = costCatalog;
|
|
1213
|
+
}
|
|
1214
|
+
create(args) {
|
|
1215
|
+
return new CatalogBackedCostTrackingTelemetry(args.telemetry, this.costCatalog);
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
|
|
836
1219
|
//#endregion
|
|
837
1220
|
//#region src/execution/InProcessRetryRunner.ts
|
|
838
1221
|
var InProcessRetryRunner = class InProcessRetryRunner {
|
|
@@ -914,14 +1297,14 @@ var InProcessRetryRunner = class InProcessRetryRunner {
|
|
|
914
1297
|
};
|
|
915
1298
|
|
|
916
1299
|
//#endregion
|
|
917
|
-
//#region src/execution/
|
|
1300
|
+
//#region src/execution/ItemExprResolver.ts
|
|
918
1301
|
/**
|
|
919
|
-
* Resolves {@link import("../contracts/
|
|
1302
|
+
* Resolves {@link import("../contracts/itemExpr").ItemExpr} leaves on runnable config before {@link RunnableNode.execute}.
|
|
920
1303
|
*/
|
|
921
|
-
var
|
|
1304
|
+
var ItemExprResolver = class {
|
|
922
1305
|
async resolveConfigForItem(ctx, item, itemIndex, items) {
|
|
923
|
-
if (!ctx) throw new Error("
|
|
924
|
-
const resolvedConfig = await
|
|
1306
|
+
if (!ctx) throw new Error("ItemExprResolver.resolveConfigForItem: ctx is required");
|
|
1307
|
+
const resolvedConfig = await resolveItemExprsForExecution(ctx.config, ctx, item, itemIndex, items);
|
|
925
1308
|
const merged = resolvedConfig !== void 0 && resolvedConfig !== null ? resolvedConfig : ctx.config;
|
|
926
1309
|
if (merged === void 0 || merged === null) return ctx;
|
|
927
1310
|
return {
|
|
@@ -931,22 +1314,6 @@ var ItemValueResolver = class {
|
|
|
931
1314
|
}
|
|
932
1315
|
};
|
|
933
1316
|
|
|
934
|
-
//#endregion
|
|
935
|
-
//#region src/contracts/emitPorts.ts
|
|
936
|
-
const EMIT_PORTS_BRAND = Symbol.for("codemation.emitPorts");
|
|
937
|
-
function emitPorts(ports) {
|
|
938
|
-
return {
|
|
939
|
-
[EMIT_PORTS_BRAND]: true,
|
|
940
|
-
ports
|
|
941
|
-
};
|
|
942
|
-
}
|
|
943
|
-
function isPortsEmission(value) {
|
|
944
|
-
return typeof value === "object" && value !== null && EMIT_PORTS_BRAND in value && value[EMIT_PORTS_BRAND] === true;
|
|
945
|
-
}
|
|
946
|
-
function isUnbrandedPortsEmissionShape(value) {
|
|
947
|
-
return typeof value === "object" && value !== null && "ports" in value && !isPortsEmission(value);
|
|
948
|
-
}
|
|
949
|
-
|
|
950
1317
|
//#endregion
|
|
951
1318
|
//#region src/execution/NodeOutputNormalizer.ts
|
|
952
1319
|
var NodeOutputNormalizer = class {
|
|
@@ -1090,6 +1457,10 @@ var NodeActivationRequestComposer = class {
|
|
|
1090
1457
|
nodeId: definition.id,
|
|
1091
1458
|
activationId,
|
|
1092
1459
|
config: definition.config,
|
|
1460
|
+
telemetry: args.base.telemetry.forNode({
|
|
1461
|
+
nodeId: definition.id,
|
|
1462
|
+
activationId
|
|
1463
|
+
}),
|
|
1093
1464
|
binary: args.base.binary.forNode({
|
|
1094
1465
|
nodeId: definition.id,
|
|
1095
1466
|
activationId
|
|
@@ -1104,12 +1475,12 @@ var NodeActivationRequestComposer = class {
|
|
|
1104
1475
|
var NodeExecutor = class {
|
|
1105
1476
|
fanInMerger = new FanInMergeByOriginMerger();
|
|
1106
1477
|
outputNormalizer = new NodeOutputNormalizer();
|
|
1107
|
-
|
|
1478
|
+
itemExprResolver;
|
|
1108
1479
|
outputBehaviorResolver;
|
|
1109
|
-
constructor(nodeInstanceFactory, retryRunner,
|
|
1480
|
+
constructor(nodeInstanceFactory, retryRunner, itemExprResolver, outputBehaviorResolver) {
|
|
1110
1481
|
this.nodeInstanceFactory = nodeInstanceFactory;
|
|
1111
1482
|
this.retryRunner = retryRunner;
|
|
1112
|
-
this.
|
|
1483
|
+
this.itemExprResolver = itemExprResolver ?? new ItemExprResolver();
|
|
1113
1484
|
this.outputBehaviorResolver = outputBehaviorResolver ?? new RunnableOutputBehaviorResolver();
|
|
1114
1485
|
}
|
|
1115
1486
|
async execute(request) {
|
|
@@ -1180,7 +1551,7 @@ var NodeExecutor = class {
|
|
|
1180
1551
|
const syntheticItem = { json: {} };
|
|
1181
1552
|
const parsed = inputSchema.parse(syntheticItem.json);
|
|
1182
1553
|
const runnableCtx = request.ctx;
|
|
1183
|
-
const resolvedCtx = await this.
|
|
1554
|
+
const resolvedCtx = await this.itemExprResolver.resolveConfigForItem(runnableCtx, syntheticItem, 0, inputBatch);
|
|
1184
1555
|
const args = {
|
|
1185
1556
|
input: parsed,
|
|
1186
1557
|
item: syntheticItem,
|
|
@@ -1201,7 +1572,7 @@ var NodeExecutor = class {
|
|
|
1201
1572
|
this.assertItemJsonNotTopLevelArray(request.nodeId, item);
|
|
1202
1573
|
const parsed = inputSchema.parse(item.json);
|
|
1203
1574
|
const runnableCtx = request.ctx;
|
|
1204
|
-
const resolvedCtx = await this.
|
|
1575
|
+
const resolvedCtx = await this.itemExprResolver.resolveConfigForItem(runnableCtx, item, i, inputBatch);
|
|
1205
1576
|
const ctx = this.pickExecutionContext(runnableCtx, resolvedCtx);
|
|
1206
1577
|
const args = {
|
|
1207
1578
|
input: parsed,
|
|
@@ -1886,6 +2257,7 @@ var WorkflowRunExecutionContextFactory = class {
|
|
|
1886
2257
|
runId: args.runId,
|
|
1887
2258
|
workflowId: args.workflowId,
|
|
1888
2259
|
parent: args.parent,
|
|
2260
|
+
policySnapshot: args.policySnapshot,
|
|
1889
2261
|
subworkflowDepth: args.subworkflowDepth,
|
|
1890
2262
|
engineMaxNodeActivations: args.engineMaxNodeActivations,
|
|
1891
2263
|
engineMaxSubworkflowDepth: args.engineMaxSubworkflowDepth,
|
|
@@ -1896,6 +2268,24 @@ var WorkflowRunExecutionContextFactory = class {
|
|
|
1896
2268
|
}
|
|
1897
2269
|
};
|
|
1898
2270
|
|
|
2271
|
+
//#endregion
|
|
2272
|
+
//#region src/execution/StaticCostCatalog.ts
|
|
2273
|
+
var StaticCostCatalog = class {
|
|
2274
|
+
entriesByKey;
|
|
2275
|
+
constructor(entries) {
|
|
2276
|
+
this.entriesByKey = new Map(entries.map((entry) => [this.createKeyFromEntry(entry), entry]));
|
|
2277
|
+
}
|
|
2278
|
+
findEntry(args) {
|
|
2279
|
+
return this.entriesByKey.get(this.createKeyFromUsage(args));
|
|
2280
|
+
}
|
|
2281
|
+
createKeyFromEntry(entry) {
|
|
2282
|
+
return `${entry.component}::${entry.provider}::${entry.operation}::${entry.pricingKey}::${entry.usageUnit}`;
|
|
2283
|
+
}
|
|
2284
|
+
createKeyFromUsage(args) {
|
|
2285
|
+
return `${args.component}::${args.provider}::${args.operation}::${args.pricingKey}::${args.usageUnit}`;
|
|
2286
|
+
}
|
|
2287
|
+
};
|
|
2288
|
+
|
|
1899
2289
|
//#endregion
|
|
1900
2290
|
//#region src/planning/WorkflowTopologyPlanner.ts
|
|
1901
2291
|
var WorkflowTopology = class WorkflowTopology {
|
|
@@ -2035,6 +2425,7 @@ var RunContinuationService = class {
|
|
|
2035
2425
|
workflowId: state.workflowId,
|
|
2036
2426
|
nodeId: args.nodeId,
|
|
2037
2427
|
parent: state.parent,
|
|
2428
|
+
policySnapshot: state.policySnapshot,
|
|
2038
2429
|
subworkflowDepth: state.executionOptions?.subworkflowDepth ?? 0,
|
|
2039
2430
|
engineMaxNodeActivations: limits.engineMaxNodeActivations,
|
|
2040
2431
|
engineMaxSubworkflowDepth: limits.engineMaxSubworkflowDepth,
|
|
@@ -2555,6 +2946,7 @@ var RunContinuationService = class {
|
|
|
2555
2946
|
workflowId: args.state.workflowId,
|
|
2556
2947
|
nodeId: nextDefinition.id,
|
|
2557
2948
|
parent: args.state.parent,
|
|
2949
|
+
policySnapshot: args.state.policySnapshot,
|
|
2558
2950
|
subworkflowDepth: args.state.executionOptions?.subworkflowDepth ?? 0,
|
|
2559
2951
|
engineMaxNodeActivations: webhookLimits.engineMaxNodeActivations,
|
|
2560
2952
|
engineMaxSubworkflowDepth: webhookLimits.engineMaxSubworkflowDepth,
|
|
@@ -2645,6 +3037,7 @@ var RunContinuationService = class {
|
|
|
2645
3037
|
workflowId: state.workflowId,
|
|
2646
3038
|
nodeId,
|
|
2647
3039
|
parent: state.parent,
|
|
3040
|
+
policySnapshot: state.policySnapshot,
|
|
2648
3041
|
subworkflowDepth: state.executionOptions?.subworkflowDepth ?? 0,
|
|
2649
3042
|
engineMaxNodeActivations: limits.engineMaxNodeActivations,
|
|
2650
3043
|
engineMaxSubworkflowDepth: limits.engineMaxSubworkflowDepth,
|
|
@@ -2658,6 +3051,10 @@ var RunContinuationService = class {
|
|
|
2658
3051
|
nodeId,
|
|
2659
3052
|
activationId,
|
|
2660
3053
|
config: def.config,
|
|
3054
|
+
telemetry: base.telemetry.forNode({
|
|
3055
|
+
nodeId,
|
|
3056
|
+
activationId
|
|
3057
|
+
}),
|
|
2661
3058
|
binary: base.binary.forNode({
|
|
2662
3059
|
nodeId,
|
|
2663
3060
|
activationId
|
|
@@ -3026,6 +3423,9 @@ var RunPolicySnapshotFactory = class {
|
|
|
3026
3423
|
return {
|
|
3027
3424
|
retentionSeconds: prune?.runDataRetentionSeconds ?? defaults?.retentionSeconds,
|
|
3028
3425
|
binaryRetentionSeconds: prune?.binaryRetentionSeconds ?? defaults?.binaryRetentionSeconds,
|
|
3426
|
+
telemetrySpanRetentionSeconds: prune?.telemetrySpanRetentionSeconds ?? defaults?.telemetrySpanRetentionSeconds,
|
|
3427
|
+
telemetryArtifactRetentionSeconds: prune?.telemetryArtifactRetentionSeconds ?? defaults?.telemetryArtifactRetentionSeconds,
|
|
3428
|
+
telemetryMetricRetentionSeconds: prune?.telemetryMetricRetentionSeconds ?? defaults?.telemetryMetricRetentionSeconds,
|
|
3029
3429
|
storagePolicy: typeof workflow.storagePolicy === "string" ? workflow.storagePolicy : defaults?.storagePolicy ?? "ALL"
|
|
3030
3430
|
};
|
|
3031
3431
|
}
|
|
@@ -3073,6 +3473,7 @@ var RunStartService = class {
|
|
|
3073
3473
|
workflowId: workflow.id,
|
|
3074
3474
|
nodeId: startAt,
|
|
3075
3475
|
parent,
|
|
3476
|
+
policySnapshot,
|
|
3076
3477
|
subworkflowDepth: mergedExecutionOptions.subworkflowDepth ?? 0,
|
|
3077
3478
|
engineMaxNodeActivations: mergedExecutionOptions.maxNodeActivations,
|
|
3078
3479
|
engineMaxSubworkflowDepth: mergedExecutionOptions.maxSubworkflowDepth,
|
|
@@ -3171,6 +3572,7 @@ var RunStartService = class {
|
|
|
3171
3572
|
workflowId: request.workflow.id,
|
|
3172
3573
|
nodeId: WorkflowExecutableNodeClassifierFactory.create(request.workflow).firstExecutableNodeIdInDefinitionOrder(request.workflow) ?? "unknown_node",
|
|
3173
3574
|
parent: request.parent,
|
|
3575
|
+
policySnapshot,
|
|
3174
3576
|
subworkflowDepth: mergedExecutionOptions.subworkflowDepth ?? 0,
|
|
3175
3577
|
engineMaxNodeActivations: mergedExecutionOptions.maxNodeActivations,
|
|
3176
3578
|
engineMaxSubworkflowDepth: mergedExecutionOptions.maxSubworkflowDepth,
|
|
@@ -3823,19 +4225,6 @@ var InMemoryRunDataFactory = class {
|
|
|
3823
4225
|
}
|
|
3824
4226
|
};
|
|
3825
4227
|
|
|
3826
|
-
//#endregion
|
|
3827
|
-
//#region src/contracts/runFinishedAtFactory.ts
|
|
3828
|
-
/** Derives workflow end time from persisted run root or node snapshots for run listings. */
|
|
3829
|
-
var RunFinishedAtFactory = class {
|
|
3830
|
-
static resolveIso(state) {
|
|
3831
|
-
if (state.finishedAt && state.status !== "running" && state.status !== "pending") return state.finishedAt;
|
|
3832
|
-
if (state.status === "running" || state.status === "pending") return;
|
|
3833
|
-
let max;
|
|
3834
|
-
for (const snap of Object.values(state.nodeSnapshotsByNodeId)) if (snap?.finishedAt && (!max || snap.finishedAt > max)) max = snap.finishedAt;
|
|
3835
|
-
return max;
|
|
3836
|
-
}
|
|
3837
|
-
};
|
|
3838
|
-
|
|
3839
4228
|
//#endregion
|
|
3840
4229
|
//#region src/orchestration/NodeExecutionRequestHandlerService.ts
|
|
3841
4230
|
var NodeExecutionRequestHandlerService = class {
|
|
@@ -3870,6 +4259,7 @@ var NodeExecutionRequestHandlerService = class {
|
|
|
3870
4259
|
workflowId: state.workflowId,
|
|
3871
4260
|
nodeId: request.nodeId,
|
|
3872
4261
|
parent: resolvedParent,
|
|
4262
|
+
policySnapshot: state.policySnapshot,
|
|
3873
4263
|
subworkflowDepth: state.executionOptions?.subworkflowDepth ?? 0,
|
|
3874
4264
|
engineMaxNodeActivations: limits.engineMaxNodeActivations,
|
|
3875
4265
|
engineMaxSubworkflowDepth: limits.engineMaxSubworkflowDepth,
|
|
@@ -4880,5 +5270,5 @@ var WorkflowRepositoryWebhookTriggerMatcherFactory = class {
|
|
|
4880
5270
|
};
|
|
4881
5271
|
|
|
4882
5272
|
//#endregion
|
|
4883
|
-
export {
|
|
4884
|
-
//# sourceMappingURL=runtime-
|
|
5273
|
+
export { CostTrackingTelemetryMetricNames as $, NodeExecutor as A, inject as At, nodeRef as B, StaticCostCatalog as C, tool as Ct, PersistedWorkflowTokenRegistry as D, PersistedRuntimeTypeNameResolver as Dt, WorkflowSnapshotCodec as E, StackTraceCallSitePathResolver as Et, InProcessRetryRunner as F, predicateAwareClassFactory as Ft, NoOpExecutionTelemetryFactory as G, CodemationTelemetryMetricNames as H, CatalogBackedCostTrackingTelemetryFactory as I, registry as It, NoOpTelemetrySpanScope as J, NoOpExecutionTelemetry as K, DefaultExecutionContextFactory as L, singleton as Lt, RunnableOutputBehaviorResolver as M, injectable as Mt, NodeOutputNormalizer as N, instanceCachingFactory as Nt, MissingRuntimeTriggerToken as O, container$1 as Ot, ItemExprResolver as P, instancePerContainerCachingFactory as Pt, CostTrackingTelemetryAttributeNames as Q, AllWorkflowsActiveWorkflowActivationPolicy as R, CoreTokens as Rt, RunPolicySnapshotFactory as S, node as St, NodeInstanceFactory as T, PersistedRuntimeTypeMetadataStore as Tt, GenAiTelemetryAttributeNames as U, RunFinishedAtFactory as V, CodemationTelemetryAttributeNames as W, NoOpCostTrackingTelemetryFactory as X, NoOpTelemetryArtifactReference as Y, NoOpCostTrackingTelemetry as Z, LocalOnlyScheduler as _, itemExpr as _t, InMemoryLiveWorkflowRepository as a, isPortsEmission as at, DefaultDrivingScheduler as b, chatModel as bt, EngineFactory as c, CredentialResolverFactory as ct, InMemoryBinaryStorage as d, UnavailableBinaryStorage as dt, CredentialUnboundError as et, WorkflowStoragePolicyEvaluator as f, NodeEventPublisher as ft, EngineExecutionLimitsPolicy as g, isItemExpr as gt, ENGINE_EXECUTION_LIMITS_DEFAULTS as h, ConnectionNodeIdFactory as ht, RunIntentService as i, emitPorts as it, InProcessRetryRunnerFactory as j, injectAll as jt, NodeExecutorFactory as k, delay as kt, Engine as l, getOriginIndexFromItem as lt, RunTerminalPersistenceCoordinator as m, WorkflowExecutableNodeClassifier as mt, WorkflowRepositoryWebhookTriggerMatcher as n, RetryPolicy as nt, EngineWorkflowRunnerServiceFactory as o, isUnbrandedPortsEmissionShape as ot, WorkflowPolicyErrorServices as p, WorkflowExecutableNodeClassifierFactory as pt, NoOpNodeExecutionTelemetry as q, RunIntentServiceFactory as r, NoRetryPolicy as rt, EngineWorkflowRunnerService as s, DefaultAsyncSleeper as st, WorkflowRepositoryWebhookTriggerMatcherFactory as t, ExpRetryPolicy as tt, InMemoryRunDataFactory as u, DefaultExecutionBinaryService as ut, InlineDrivingScheduler as v, resolveItemExprsForExecution as vt, NodeInstanceFactoryFactory as w, InjectableRuntimeDecoratorComposer as wt, ConfigDrivenOffloadPolicy as x, getPersistedRuntimeTypeMetadata as xt, HintOnlyOffloadPolicy as y, resolveItemExprsInUnknown as yt, branchRef as z };
|
|
5274
|
+
//# sourceMappingURL=runtime-DUW6tIJ1.js.map
|