@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
|
@@ -165,43 +165,43 @@ function chatModel(options = {}) {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
//#endregion
|
|
168
|
-
//#region src/contracts/
|
|
169
|
-
const
|
|
170
|
-
function
|
|
168
|
+
//#region src/contracts/itemExpr.ts
|
|
169
|
+
const ITEM_EXPR_BRAND = Symbol.for("codemation.itemExpr");
|
|
170
|
+
function itemExpr(fn) {
|
|
171
171
|
return {
|
|
172
|
-
[
|
|
172
|
+
[ITEM_EXPR_BRAND]: true,
|
|
173
173
|
fn
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function isItemExpr(value) {
|
|
177
177
|
if (typeof value !== "object" || value === null) return false;
|
|
178
178
|
const v = value;
|
|
179
|
-
if (v[
|
|
179
|
+
if (v[ITEM_EXPR_BRAND] === true) return true;
|
|
180
180
|
const keys = Object.keys(v);
|
|
181
181
|
if (keys.length === 1 && keys[0] === "fn" && typeof v.fn === "function") return true;
|
|
182
|
-
for (const sym of Object.getOwnPropertySymbols(v)) if (sym.description === "codemation.
|
|
182
|
+
for (const sym of Object.getOwnPropertySymbols(v)) if (sym.description === "codemation.itemExpr" && v[sym] === true) return true;
|
|
183
183
|
return false;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
if (
|
|
185
|
+
function containsItemExprInUnknown(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
186
|
+
if (isItemExpr(value)) return true;
|
|
187
187
|
if (value === null || typeof value !== "object") return false;
|
|
188
188
|
if (seen.has(value)) return false;
|
|
189
189
|
seen.add(value);
|
|
190
|
-
if (Array.isArray(value)) return value.some((entry) =>
|
|
191
|
-
for (const entry of Object.values(value)) if (
|
|
190
|
+
if (Array.isArray(value)) return value.some((entry) => containsItemExprInUnknown(entry, seen));
|
|
191
|
+
for (const entry of Object.values(value)) if (containsItemExprInUnknown(entry, seen)) return true;
|
|
192
192
|
return false;
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
|
-
* Deep-resolves {@link
|
|
195
|
+
* Deep-resolves {@link itemExpr} leaves. Returns a new graph (does not mutate the original config object).
|
|
196
196
|
*/
|
|
197
|
-
async function
|
|
198
|
-
if (
|
|
197
|
+
async function resolveItemExprsInUnknown(value, args, seen = /* @__PURE__ */ new WeakSet()) {
|
|
198
|
+
if (isItemExpr(value)) return await Promise.resolve(value.fn(args));
|
|
199
199
|
if (value === null || typeof value !== "object") return value;
|
|
200
200
|
if (seen.has(value)) return value;
|
|
201
201
|
seen.add(value);
|
|
202
202
|
if (Array.isArray(value)) {
|
|
203
203
|
const out$1 = [];
|
|
204
|
-
for (let i = 0; i < value.length; i++) out$1.push(await
|
|
204
|
+
for (let i = 0; i < value.length; i++) out$1.push(await resolveItemExprsInUnknown(value[i], args, seen));
|
|
205
205
|
return out$1;
|
|
206
206
|
}
|
|
207
207
|
const rec = value;
|
|
@@ -209,14 +209,14 @@ async function resolveItemValuesInUnknown(value, args, seen = /* @__PURE__ */ ne
|
|
|
209
209
|
const proto = Object.getPrototypeOf(value);
|
|
210
210
|
if (proto !== Object.prototype && proto !== null && entries.length === 0) return value;
|
|
211
211
|
const out = Object.create(proto);
|
|
212
|
-
for (const [k, v] of entries) out[k] = await
|
|
212
|
+
for (const [k, v] of entries) out[k] = await resolveItemExprsInUnknown(v, args, seen);
|
|
213
213
|
return out;
|
|
214
214
|
}
|
|
215
215
|
/**
|
|
216
|
-
* Clones runnable config (best-effort) so per-item {@link
|
|
216
|
+
* Clones runnable config (best-effort) so per-item {@link itemExpr} resolution never mutates shared instances.
|
|
217
217
|
*/
|
|
218
|
-
async function
|
|
219
|
-
const
|
|
218
|
+
async function resolveItemExprsForExecution(config, nodeCtx, item, itemIndex, items) {
|
|
219
|
+
const exprArgs = {
|
|
220
220
|
item,
|
|
221
221
|
itemIndex,
|
|
222
222
|
items,
|
|
@@ -228,8 +228,8 @@ async function resolveItemValuesForExecution(config, nodeCtx, item, itemIndex, i
|
|
|
228
228
|
data: nodeCtx.data
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
|
-
if (!
|
|
232
|
-
return await
|
|
231
|
+
if (!containsItemExprInUnknown(config)) return;
|
|
232
|
+
return await resolveItemExprsInUnknown(config, exprArgs);
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
//#endregion
|
|
@@ -562,7 +562,8 @@ var NodeExecutionSnapshotFactory = class {
|
|
|
562
562
|
error: {
|
|
563
563
|
message: args.error.message,
|
|
564
564
|
name: args.error.name,
|
|
565
|
-
stack: args.error.stack
|
|
565
|
+
stack: args.error.stack,
|
|
566
|
+
details: args.error.details
|
|
566
567
|
}
|
|
567
568
|
};
|
|
568
569
|
}
|
|
@@ -836,14 +837,324 @@ var DefaultAsyncSleeper = class {
|
|
|
836
837
|
}
|
|
837
838
|
};
|
|
838
839
|
|
|
840
|
+
//#endregion
|
|
841
|
+
//#region src/contracts/emitPorts.ts
|
|
842
|
+
const EMIT_PORTS_BRAND = Symbol.for("codemation.emitPorts");
|
|
843
|
+
function emitPorts(ports) {
|
|
844
|
+
return {
|
|
845
|
+
[EMIT_PORTS_BRAND]: true,
|
|
846
|
+
ports
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
function isPortsEmission(value) {
|
|
850
|
+
return typeof value === "object" && value !== null && EMIT_PORTS_BRAND in value && value[EMIT_PORTS_BRAND] === true;
|
|
851
|
+
}
|
|
852
|
+
function isUnbrandedPortsEmissionShape(value) {
|
|
853
|
+
return typeof value === "object" && value !== null && "ports" in value && !isPortsEmission(value);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
//#endregion
|
|
857
|
+
//#region src/contracts/NoRetryPolicy.ts
|
|
858
|
+
var NoRetryPolicy = class {
|
|
859
|
+
kind = "none";
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
//#endregion
|
|
863
|
+
//#region src/contracts/RetryPolicy.ts
|
|
864
|
+
var RetryPolicy = class {
|
|
865
|
+
kind = "fixed";
|
|
866
|
+
constructor(maxAttempts, delayMs) {
|
|
867
|
+
this.maxAttempts = maxAttempts;
|
|
868
|
+
this.delayMs = delayMs;
|
|
869
|
+
if (!Number.isFinite(maxAttempts) || maxAttempts < 1 || !Number.isInteger(maxAttempts)) throw new Error(`RetryPolicy.maxAttempts must be a positive integer, got ${maxAttempts}`);
|
|
870
|
+
if (!Number.isFinite(delayMs) || delayMs < 0) throw new Error(`RetryPolicy.delayMs must be a non-negative finite number, got ${delayMs}`);
|
|
871
|
+
}
|
|
872
|
+
/** Default for HTTP-style transient failures: 3 tries, 1s between attempts. */
|
|
873
|
+
static defaultForHttp = {
|
|
874
|
+
kind: "fixed",
|
|
875
|
+
maxAttempts: 3,
|
|
876
|
+
delayMs: 1e3
|
|
877
|
+
};
|
|
878
|
+
/** Default for LLM / agent calls: 3 tries, 2s fixed backoff. */
|
|
879
|
+
static defaultForAiAgent = {
|
|
880
|
+
kind: "fixed",
|
|
881
|
+
maxAttempts: 3,
|
|
882
|
+
delayMs: 2e3
|
|
883
|
+
};
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
//#endregion
|
|
887
|
+
//#region src/contracts/ExpRetryPolicy.ts
|
|
888
|
+
var ExpRetryPolicy = class {
|
|
889
|
+
kind = "exponential";
|
|
890
|
+
constructor(maxAttempts, initialDelayMs, multiplier, maxDelayMs, jitter) {
|
|
891
|
+
this.maxAttempts = maxAttempts;
|
|
892
|
+
this.initialDelayMs = initialDelayMs;
|
|
893
|
+
this.multiplier = multiplier;
|
|
894
|
+
this.maxDelayMs = maxDelayMs;
|
|
895
|
+
this.jitter = jitter;
|
|
896
|
+
if (!Number.isFinite(maxAttempts) || maxAttempts < 1 || !Number.isInteger(maxAttempts)) throw new Error(`ExpRetryPolicy.maxAttempts must be a positive integer, got ${maxAttempts}`);
|
|
897
|
+
if (!Number.isFinite(initialDelayMs) || initialDelayMs < 0) throw new Error(`ExpRetryPolicy.initialDelayMs must be a non-negative finite number, got ${initialDelayMs}`);
|
|
898
|
+
if (!Number.isFinite(multiplier) || multiplier < 1) throw new Error(`ExpRetryPolicy.multiplier must be >= 1, got ${multiplier}`);
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
//#endregion
|
|
903
|
+
//#region src/contracts/credentialTypes.ts
|
|
904
|
+
var CredentialUnboundError = class CredentialUnboundError extends Error {
|
|
905
|
+
constructor(bindingKey, acceptedTypes = []) {
|
|
906
|
+
super(CredentialUnboundError.createMessage(bindingKey, acceptedTypes));
|
|
907
|
+
this.bindingKey = bindingKey;
|
|
908
|
+
this.acceptedTypes = acceptedTypes;
|
|
909
|
+
this.name = "CredentialUnboundError";
|
|
910
|
+
}
|
|
911
|
+
static createMessage(bindingKey, acceptedTypes) {
|
|
912
|
+
const acceptedTypesSuffix = acceptedTypes.length > 0 ? ` Accepted credential types: ${acceptedTypes.join(", ")}.` : "";
|
|
913
|
+
return `Credential slot "${bindingKey.slotKey}" is not bound for workflow ${bindingKey.workflowId} node ${bindingKey.nodeId}.${acceptedTypesSuffix}`;
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
//#endregion
|
|
918
|
+
//#region src/contracts/CostTrackingTelemetryContract.ts
|
|
919
|
+
const CostTrackingTelemetryMetricNames = {
|
|
920
|
+
usage: "codemation.cost.usage",
|
|
921
|
+
estimatedCost: "codemation.cost.estimated"
|
|
922
|
+
};
|
|
923
|
+
const CostTrackingTelemetryAttributeNames = {
|
|
924
|
+
component: "cost.component",
|
|
925
|
+
provider: "cost.provider",
|
|
926
|
+
operation: "cost.operation",
|
|
927
|
+
pricingKey: "cost.pricing_key",
|
|
928
|
+
usageUnit: "cost.usage_unit",
|
|
929
|
+
currency: "cost.currency",
|
|
930
|
+
currencyScale: "cost.currency_scale",
|
|
931
|
+
estimateKind: "cost.estimate_kind"
|
|
932
|
+
};
|
|
933
|
+
|
|
934
|
+
//#endregion
|
|
935
|
+
//#region src/contracts/NoOpCostTrackingTelemetry.ts
|
|
936
|
+
var NoOpCostTrackingTelemetry = class {
|
|
937
|
+
async captureUsage(_) {}
|
|
938
|
+
forScope(_) {
|
|
939
|
+
return this;
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
//#endregion
|
|
944
|
+
//#region src/contracts/NoOpCostTrackingTelemetryFactory.ts
|
|
945
|
+
var NoOpCostTrackingTelemetryFactory = class {
|
|
946
|
+
create(_) {
|
|
947
|
+
return new NoOpCostTrackingTelemetry();
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
//#endregion
|
|
952
|
+
//#region src/contracts/NoOpTelemetryArtifactReference.ts
|
|
953
|
+
var NoOpTelemetryArtifactReference = class {
|
|
954
|
+
static value = {
|
|
955
|
+
artifactId: "telemetry-artifact-noop",
|
|
956
|
+
traceId: void 0,
|
|
957
|
+
spanId: void 0
|
|
958
|
+
};
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
//#endregion
|
|
962
|
+
//#region src/contracts/NoOpTelemetrySpanScope.ts
|
|
963
|
+
var NoOpTelemetrySpanScope = class {
|
|
964
|
+
static value = {
|
|
965
|
+
traceId: "00000000000000000000000000000000",
|
|
966
|
+
spanId: "0000000000000000",
|
|
967
|
+
addSpanEvent(_) {},
|
|
968
|
+
recordMetric(_) {},
|
|
969
|
+
attachArtifact(_) {
|
|
970
|
+
return NoOpTelemetryArtifactReference.value;
|
|
971
|
+
},
|
|
972
|
+
end(_ = {}) {}
|
|
973
|
+
};
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
//#endregion
|
|
977
|
+
//#region src/contracts/NoOpNodeExecutionTelemetry.ts
|
|
978
|
+
var NoOpNodeExecutionTelemetry = class NoOpNodeExecutionTelemetry {
|
|
979
|
+
static value = {
|
|
980
|
+
...NoOpTelemetrySpanScope.value,
|
|
981
|
+
forNode(_) {
|
|
982
|
+
return NoOpNodeExecutionTelemetry.value;
|
|
983
|
+
},
|
|
984
|
+
startChildSpan(_) {
|
|
985
|
+
return NoOpTelemetrySpanScope.value;
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
//#endregion
|
|
991
|
+
//#region src/contracts/NoOpExecutionTelemetry.ts
|
|
992
|
+
var NoOpExecutionTelemetry = class {
|
|
993
|
+
static value = {
|
|
994
|
+
traceId: "00000000000000000000000000000000",
|
|
995
|
+
spanId: "0000000000000000",
|
|
996
|
+
addSpanEvent(_) {},
|
|
997
|
+
recordMetric(_) {},
|
|
998
|
+
attachArtifact(_) {
|
|
999
|
+
return NoOpTelemetryArtifactReference.value;
|
|
1000
|
+
},
|
|
1001
|
+
forNode(_) {
|
|
1002
|
+
return NoOpNodeExecutionTelemetry.value;
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
};
|
|
1006
|
+
|
|
1007
|
+
//#endregion
|
|
1008
|
+
//#region src/contracts/NoOpExecutionTelemetryFactory.ts
|
|
1009
|
+
var NoOpExecutionTelemetryFactory = class {
|
|
1010
|
+
create(_) {
|
|
1011
|
+
return NoOpExecutionTelemetry.value;
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
//#endregion
|
|
1016
|
+
//#region src/contracts/CodemationTelemetryAttributeNames.ts
|
|
1017
|
+
var CodemationTelemetryAttributeNames = class {
|
|
1018
|
+
static workflowId = "codemation.workflow.id";
|
|
1019
|
+
static runId = "codemation.run.id";
|
|
1020
|
+
static nodeId = "codemation.node.id";
|
|
1021
|
+
static activationId = "codemation.activation.id";
|
|
1022
|
+
static nodeType = "codemation.node.type";
|
|
1023
|
+
static nodeRole = "codemation.node.role";
|
|
1024
|
+
static workflowFolder = "codemation.workflow.folder";
|
|
1025
|
+
static connectionInvocationId = "codemation.connection.invocation_id";
|
|
1026
|
+
static toolName = "codemation.tool.name";
|
|
1027
|
+
static traceParentRunId = "codemation.parent.run.id";
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
//#endregion
|
|
1031
|
+
//#region src/contracts/GenAiTelemetryAttributeNames.ts
|
|
1032
|
+
var GenAiTelemetryAttributeNames = class {
|
|
1033
|
+
static operationName = "gen_ai.operation.name";
|
|
1034
|
+
static requestModel = "gen_ai.request.model";
|
|
1035
|
+
static usageInputTokens = "gen_ai.usage.input_tokens";
|
|
1036
|
+
static usageOutputTokens = "gen_ai.usage.output_tokens";
|
|
1037
|
+
static usageTotalTokens = "gen_ai.usage.total_tokens";
|
|
1038
|
+
static usageCacheReadInputTokens = "gen_ai.usage.cache_read.input_tokens";
|
|
1039
|
+
static usageCacheCreationInputTokens = "gen_ai.usage.cache_creation.input_tokens";
|
|
1040
|
+
static usageReasoningTokens = "codemation.gen_ai.usage.reasoning_tokens";
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
//#endregion
|
|
1044
|
+
//#region src/contracts/CodemationTelemetryMetricNames.ts
|
|
1045
|
+
var CodemationTelemetryMetricNames = class {
|
|
1046
|
+
static agentTurns = "codemation.ai.turns";
|
|
1047
|
+
static agentToolCalls = "codemation.ai.tool_calls";
|
|
1048
|
+
static gmailMessagesEmitted = "codemation.gmail.messages_emitted";
|
|
1049
|
+
static gmailAttachments = "codemation.gmail.attachments";
|
|
1050
|
+
static gmailAttachmentBytes = "codemation.gmail.attachment_bytes";
|
|
1051
|
+
};
|
|
1052
|
+
|
|
1053
|
+
//#endregion
|
|
1054
|
+
//#region src/contracts/runFinishedAtFactory.ts
|
|
1055
|
+
/** Derives workflow end time from persisted run root or node snapshots for run listings. */
|
|
1056
|
+
var RunFinishedAtFactory = class {
|
|
1057
|
+
static resolveIso(state) {
|
|
1058
|
+
if (state.finishedAt && state.status !== "running" && state.status !== "pending") return state.finishedAt;
|
|
1059
|
+
if (state.status === "running" || state.status === "pending") return;
|
|
1060
|
+
let max;
|
|
1061
|
+
for (const snap of Object.values(state.nodeSnapshotsByNodeId)) if (snap?.finishedAt && (!max || snap.finishedAt > max)) max = snap.finishedAt;
|
|
1062
|
+
return max;
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
//#endregion
|
|
1067
|
+
//#region src/contracts/workflowTypes.ts
|
|
1068
|
+
function nodeRef(nodeId) {
|
|
1069
|
+
return nodeId;
|
|
1070
|
+
}
|
|
1071
|
+
const branchRef = (index) => `$${index}`;
|
|
1072
|
+
|
|
1073
|
+
//#endregion
|
|
1074
|
+
//#region src/contracts/workflowActivationPolicy.ts
|
|
1075
|
+
/** Default for tests and harnesses: every workflow is treated as active (legacy behavior). */
|
|
1076
|
+
var AllWorkflowsActiveWorkflowActivationPolicy = class {
|
|
1077
|
+
isActive(_workflowId) {
|
|
1078
|
+
return true;
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
|
|
1082
|
+
//#endregion
|
|
1083
|
+
//#region src/execution/ExecutionTelemetryCostTrackingDecoratorFactory.ts
|
|
1084
|
+
var ExecutionTelemetryCostTrackingDecoratorFactory = class {
|
|
1085
|
+
decorateExecutionTelemetry(args) {
|
|
1086
|
+
return {
|
|
1087
|
+
traceId: args.telemetry.traceId,
|
|
1088
|
+
spanId: args.telemetry.spanId,
|
|
1089
|
+
costTracking: args.costTracking,
|
|
1090
|
+
addSpanEvent: (event) => args.telemetry.addSpanEvent(event),
|
|
1091
|
+
recordMetric: (metric) => args.telemetry.recordMetric(metric),
|
|
1092
|
+
attachArtifact: (artifact) => args.telemetry.attachArtifact(artifact),
|
|
1093
|
+
forNode: (nodeArgs) => {
|
|
1094
|
+
const nodeTelemetry = args.telemetry.forNode(nodeArgs);
|
|
1095
|
+
return this.decorateNodeExecutionTelemetry({
|
|
1096
|
+
telemetry: nodeTelemetry,
|
|
1097
|
+
costTracking: args.costTracking.forScope(nodeTelemetry)
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
decorateNodeExecutionTelemetry(args) {
|
|
1103
|
+
return {
|
|
1104
|
+
traceId: args.telemetry.traceId,
|
|
1105
|
+
spanId: args.telemetry.spanId,
|
|
1106
|
+
costTracking: args.costTracking,
|
|
1107
|
+
addSpanEvent: (event) => args.telemetry.addSpanEvent(event),
|
|
1108
|
+
recordMetric: (metric) => args.telemetry.recordMetric(metric),
|
|
1109
|
+
attachArtifact: (artifact) => args.telemetry.attachArtifact(artifact),
|
|
1110
|
+
end: (endArgs) => args.telemetry.end(endArgs),
|
|
1111
|
+
startChildSpan: (spanArgs) => this.decorateTelemetrySpanScope({
|
|
1112
|
+
scope: args.telemetry.startChildSpan(spanArgs),
|
|
1113
|
+
costTracking: args.costTracking
|
|
1114
|
+
}),
|
|
1115
|
+
forNode: (nodeArgs) => {
|
|
1116
|
+
const nodeTelemetry = args.telemetry.forNode(nodeArgs);
|
|
1117
|
+
return this.decorateNodeExecutionTelemetry({
|
|
1118
|
+
telemetry: nodeTelemetry,
|
|
1119
|
+
costTracking: args.costTracking.forScope(nodeTelemetry)
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
decorateTelemetrySpanScope(args) {
|
|
1125
|
+
return {
|
|
1126
|
+
traceId: args.scope.traceId,
|
|
1127
|
+
spanId: args.scope.spanId,
|
|
1128
|
+
costTracking: args.costTracking.forScope(args.scope),
|
|
1129
|
+
addSpanEvent: (event) => args.scope.addSpanEvent(event),
|
|
1130
|
+
recordMetric: (metric) => args.scope.recordMetric(metric),
|
|
1131
|
+
attachArtifact: (artifact) => args.scope.attachArtifact(artifact),
|
|
1132
|
+
end: (endArgs) => args.scope.end(endArgs)
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
};
|
|
1136
|
+
|
|
839
1137
|
//#endregion
|
|
840
1138
|
//#region src/execution/DefaultExecutionContextFactory.ts
|
|
841
1139
|
var DefaultExecutionContextFactory = class {
|
|
842
|
-
|
|
1140
|
+
telemetryDecoratorFactory = new ExecutionTelemetryCostTrackingDecoratorFactory();
|
|
1141
|
+
constructor(binaryStorage = new UnavailableBinaryStorage(), telemetryFactory = new NoOpExecutionTelemetryFactory(), costTrackingFactory = new NoOpCostTrackingTelemetryFactory(), currentDate = () => /* @__PURE__ */ new Date()) {
|
|
843
1142
|
this.binaryStorage = binaryStorage;
|
|
1143
|
+
this.telemetryFactory = telemetryFactory;
|
|
1144
|
+
this.costTrackingFactory = costTrackingFactory;
|
|
844
1145
|
this.currentDate = currentDate;
|
|
845
1146
|
}
|
|
846
1147
|
create(args) {
|
|
1148
|
+
const baseTelemetry = args.telemetry ?? this.telemetryFactory.create({
|
|
1149
|
+
runId: args.runId,
|
|
1150
|
+
workflowId: args.workflowId,
|
|
1151
|
+
parent: args.parent,
|
|
1152
|
+
policySnapshot: args.policySnapshot
|
|
1153
|
+
});
|
|
1154
|
+
const telemetry = this.telemetryDecoratorFactory.decorateExecutionTelemetry({
|
|
1155
|
+
telemetry: baseTelemetry,
|
|
1156
|
+
costTracking: baseTelemetry.costTracking ?? this.costTrackingFactory.create({ telemetry: baseTelemetry })
|
|
1157
|
+
});
|
|
847
1158
|
return {
|
|
848
1159
|
runId: args.runId,
|
|
849
1160
|
workflowId: args.workflowId,
|
|
@@ -854,12 +1165,84 @@ var DefaultExecutionContextFactory = class {
|
|
|
854
1165
|
now: this.currentDate,
|
|
855
1166
|
data: args.data,
|
|
856
1167
|
nodeState: args.nodeState,
|
|
1168
|
+
telemetry,
|
|
857
1169
|
binary: new DefaultExecutionBinaryService(this.binaryStorage, args.workflowId, args.runId, this.currentDate),
|
|
858
1170
|
getCredential: args.getCredential
|
|
859
1171
|
};
|
|
860
1172
|
}
|
|
861
1173
|
};
|
|
862
1174
|
|
|
1175
|
+
//#endregion
|
|
1176
|
+
//#region src/execution/CatalogBackedCostTrackingTelemetry.ts
|
|
1177
|
+
var CatalogBackedCostTrackingTelemetry = class CatalogBackedCostTrackingTelemetry {
|
|
1178
|
+
constructor(currentScope, costCatalog) {
|
|
1179
|
+
this.currentScope = currentScope;
|
|
1180
|
+
this.costCatalog = costCatalog;
|
|
1181
|
+
}
|
|
1182
|
+
async captureUsage(args) {
|
|
1183
|
+
const usageAttributes = this.createUsageAttributes(args);
|
|
1184
|
+
await this.currentScope.recordMetric({
|
|
1185
|
+
name: CostTrackingTelemetryMetricNames.usage,
|
|
1186
|
+
value: args.quantity,
|
|
1187
|
+
unit: args.usageUnit,
|
|
1188
|
+
attributes: usageAttributes
|
|
1189
|
+
});
|
|
1190
|
+
const catalogEntry = this.costCatalog.findEntry(args);
|
|
1191
|
+
if (!catalogEntry) return;
|
|
1192
|
+
const estimatedAmountMinor = Math.round(args.quantity * catalogEntry.pricePerUnitMinor);
|
|
1193
|
+
const costAttributes = this.createCostAttributes(args, catalogEntry.currency, catalogEntry.currencyScale);
|
|
1194
|
+
await this.currentScope.recordMetric({
|
|
1195
|
+
name: CostTrackingTelemetryMetricNames.estimatedCost,
|
|
1196
|
+
value: estimatedAmountMinor,
|
|
1197
|
+
unit: catalogEntry.currency,
|
|
1198
|
+
attributes: costAttributes
|
|
1199
|
+
});
|
|
1200
|
+
return {
|
|
1201
|
+
currency: catalogEntry.currency,
|
|
1202
|
+
currencyScale: catalogEntry.currencyScale,
|
|
1203
|
+
estimatedAmountMinor,
|
|
1204
|
+
estimateKind: "catalog"
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
forScope(scope) {
|
|
1208
|
+
return new CatalogBackedCostTrackingTelemetry(scope, this.costCatalog);
|
|
1209
|
+
}
|
|
1210
|
+
createUsageAttributes(args) {
|
|
1211
|
+
return {
|
|
1212
|
+
...args.attributes,
|
|
1213
|
+
[CostTrackingTelemetryAttributeNames.component]: args.component,
|
|
1214
|
+
[CostTrackingTelemetryAttributeNames.provider]: args.provider,
|
|
1215
|
+
[CostTrackingTelemetryAttributeNames.operation]: args.operation,
|
|
1216
|
+
[CostTrackingTelemetryAttributeNames.pricingKey]: args.pricingKey,
|
|
1217
|
+
[CostTrackingTelemetryAttributeNames.usageUnit]: args.usageUnit
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
createCostAttributes(args, currency, currencyScale) {
|
|
1221
|
+
return {
|
|
1222
|
+
...args.attributes,
|
|
1223
|
+
[CostTrackingTelemetryAttributeNames.component]: args.component,
|
|
1224
|
+
[CostTrackingTelemetryAttributeNames.provider]: args.provider,
|
|
1225
|
+
[CostTrackingTelemetryAttributeNames.operation]: args.operation,
|
|
1226
|
+
[CostTrackingTelemetryAttributeNames.pricingKey]: args.pricingKey,
|
|
1227
|
+
[CostTrackingTelemetryAttributeNames.usageUnit]: args.usageUnit,
|
|
1228
|
+
[CostTrackingTelemetryAttributeNames.currency]: currency,
|
|
1229
|
+
[CostTrackingTelemetryAttributeNames.currencyScale]: currencyScale,
|
|
1230
|
+
[CostTrackingTelemetryAttributeNames.estimateKind]: "catalog"
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1234
|
+
|
|
1235
|
+
//#endregion
|
|
1236
|
+
//#region src/execution/CatalogBackedCostTrackingTelemetryFactory.ts
|
|
1237
|
+
var CatalogBackedCostTrackingTelemetryFactory = class {
|
|
1238
|
+
constructor(costCatalog) {
|
|
1239
|
+
this.costCatalog = costCatalog;
|
|
1240
|
+
}
|
|
1241
|
+
create(args) {
|
|
1242
|
+
return new CatalogBackedCostTrackingTelemetry(args.telemetry, this.costCatalog);
|
|
1243
|
+
}
|
|
1244
|
+
};
|
|
1245
|
+
|
|
863
1246
|
//#endregion
|
|
864
1247
|
//#region src/execution/InProcessRetryRunner.ts
|
|
865
1248
|
var InProcessRetryRunner = class InProcessRetryRunner {
|
|
@@ -941,14 +1324,14 @@ var InProcessRetryRunner = class InProcessRetryRunner {
|
|
|
941
1324
|
};
|
|
942
1325
|
|
|
943
1326
|
//#endregion
|
|
944
|
-
//#region src/execution/
|
|
1327
|
+
//#region src/execution/ItemExprResolver.ts
|
|
945
1328
|
/**
|
|
946
|
-
* Resolves {@link import("../contracts/
|
|
1329
|
+
* Resolves {@link import("../contracts/itemExpr").ItemExpr} leaves on runnable config before {@link RunnableNode.execute}.
|
|
947
1330
|
*/
|
|
948
|
-
var
|
|
1331
|
+
var ItemExprResolver = class {
|
|
949
1332
|
async resolveConfigForItem(ctx, item, itemIndex, items) {
|
|
950
|
-
if (!ctx) throw new Error("
|
|
951
|
-
const resolvedConfig = await
|
|
1333
|
+
if (!ctx) throw new Error("ItemExprResolver.resolveConfigForItem: ctx is required");
|
|
1334
|
+
const resolvedConfig = await resolveItemExprsForExecution(ctx.config, ctx, item, itemIndex, items);
|
|
952
1335
|
const merged = resolvedConfig !== void 0 && resolvedConfig !== null ? resolvedConfig : ctx.config;
|
|
953
1336
|
if (merged === void 0 || merged === null) return ctx;
|
|
954
1337
|
return {
|
|
@@ -958,22 +1341,6 @@ var ItemValueResolver = class {
|
|
|
958
1341
|
}
|
|
959
1342
|
};
|
|
960
1343
|
|
|
961
|
-
//#endregion
|
|
962
|
-
//#region src/contracts/emitPorts.ts
|
|
963
|
-
const EMIT_PORTS_BRAND = Symbol.for("codemation.emitPorts");
|
|
964
|
-
function emitPorts(ports) {
|
|
965
|
-
return {
|
|
966
|
-
[EMIT_PORTS_BRAND]: true,
|
|
967
|
-
ports
|
|
968
|
-
};
|
|
969
|
-
}
|
|
970
|
-
function isPortsEmission(value) {
|
|
971
|
-
return typeof value === "object" && value !== null && EMIT_PORTS_BRAND in value && value[EMIT_PORTS_BRAND] === true;
|
|
972
|
-
}
|
|
973
|
-
function isUnbrandedPortsEmissionShape(value) {
|
|
974
|
-
return typeof value === "object" && value !== null && "ports" in value && !isPortsEmission(value);
|
|
975
|
-
}
|
|
976
|
-
|
|
977
1344
|
//#endregion
|
|
978
1345
|
//#region src/execution/NodeOutputNormalizer.ts
|
|
979
1346
|
var NodeOutputNormalizer = class {
|
|
@@ -1117,6 +1484,10 @@ var NodeActivationRequestComposer = class {
|
|
|
1117
1484
|
nodeId: definition.id,
|
|
1118
1485
|
activationId,
|
|
1119
1486
|
config: definition.config,
|
|
1487
|
+
telemetry: args.base.telemetry.forNode({
|
|
1488
|
+
nodeId: definition.id,
|
|
1489
|
+
activationId
|
|
1490
|
+
}),
|
|
1120
1491
|
binary: args.base.binary.forNode({
|
|
1121
1492
|
nodeId: definition.id,
|
|
1122
1493
|
activationId
|
|
@@ -1131,12 +1502,12 @@ var NodeActivationRequestComposer = class {
|
|
|
1131
1502
|
var NodeExecutor = class {
|
|
1132
1503
|
fanInMerger = new FanInMergeByOriginMerger();
|
|
1133
1504
|
outputNormalizer = new NodeOutputNormalizer();
|
|
1134
|
-
|
|
1505
|
+
itemExprResolver;
|
|
1135
1506
|
outputBehaviorResolver;
|
|
1136
|
-
constructor(nodeInstanceFactory, retryRunner,
|
|
1507
|
+
constructor(nodeInstanceFactory, retryRunner, itemExprResolver, outputBehaviorResolver) {
|
|
1137
1508
|
this.nodeInstanceFactory = nodeInstanceFactory;
|
|
1138
1509
|
this.retryRunner = retryRunner;
|
|
1139
|
-
this.
|
|
1510
|
+
this.itemExprResolver = itemExprResolver ?? new ItemExprResolver();
|
|
1140
1511
|
this.outputBehaviorResolver = outputBehaviorResolver ?? new RunnableOutputBehaviorResolver();
|
|
1141
1512
|
}
|
|
1142
1513
|
async execute(request) {
|
|
@@ -1207,7 +1578,7 @@ var NodeExecutor = class {
|
|
|
1207
1578
|
const syntheticItem = { json: {} };
|
|
1208
1579
|
const parsed = inputSchema.parse(syntheticItem.json);
|
|
1209
1580
|
const runnableCtx = request.ctx;
|
|
1210
|
-
const resolvedCtx = await this.
|
|
1581
|
+
const resolvedCtx = await this.itemExprResolver.resolveConfigForItem(runnableCtx, syntheticItem, 0, inputBatch);
|
|
1211
1582
|
const args = {
|
|
1212
1583
|
input: parsed,
|
|
1213
1584
|
item: syntheticItem,
|
|
@@ -1228,7 +1599,7 @@ var NodeExecutor = class {
|
|
|
1228
1599
|
this.assertItemJsonNotTopLevelArray(request.nodeId, item);
|
|
1229
1600
|
const parsed = inputSchema.parse(item.json);
|
|
1230
1601
|
const runnableCtx = request.ctx;
|
|
1231
|
-
const resolvedCtx = await this.
|
|
1602
|
+
const resolvedCtx = await this.itemExprResolver.resolveConfigForItem(runnableCtx, item, i, inputBatch);
|
|
1232
1603
|
const ctx = this.pickExecutionContext(runnableCtx, resolvedCtx);
|
|
1233
1604
|
const args = {
|
|
1234
1605
|
input: parsed,
|
|
@@ -1913,6 +2284,7 @@ var WorkflowRunExecutionContextFactory = class {
|
|
|
1913
2284
|
runId: args.runId,
|
|
1914
2285
|
workflowId: args.workflowId,
|
|
1915
2286
|
parent: args.parent,
|
|
2287
|
+
policySnapshot: args.policySnapshot,
|
|
1916
2288
|
subworkflowDepth: args.subworkflowDepth,
|
|
1917
2289
|
engineMaxNodeActivations: args.engineMaxNodeActivations,
|
|
1918
2290
|
engineMaxSubworkflowDepth: args.engineMaxSubworkflowDepth,
|
|
@@ -1923,6 +2295,24 @@ var WorkflowRunExecutionContextFactory = class {
|
|
|
1923
2295
|
}
|
|
1924
2296
|
};
|
|
1925
2297
|
|
|
2298
|
+
//#endregion
|
|
2299
|
+
//#region src/execution/StaticCostCatalog.ts
|
|
2300
|
+
var StaticCostCatalog = class {
|
|
2301
|
+
entriesByKey;
|
|
2302
|
+
constructor(entries) {
|
|
2303
|
+
this.entriesByKey = new Map(entries.map((entry) => [this.createKeyFromEntry(entry), entry]));
|
|
2304
|
+
}
|
|
2305
|
+
findEntry(args) {
|
|
2306
|
+
return this.entriesByKey.get(this.createKeyFromUsage(args));
|
|
2307
|
+
}
|
|
2308
|
+
createKeyFromEntry(entry) {
|
|
2309
|
+
return `${entry.component}::${entry.provider}::${entry.operation}::${entry.pricingKey}::${entry.usageUnit}`;
|
|
2310
|
+
}
|
|
2311
|
+
createKeyFromUsage(args) {
|
|
2312
|
+
return `${args.component}::${args.provider}::${args.operation}::${args.pricingKey}::${args.usageUnit}`;
|
|
2313
|
+
}
|
|
2314
|
+
};
|
|
2315
|
+
|
|
1926
2316
|
//#endregion
|
|
1927
2317
|
//#region src/planning/WorkflowTopologyPlanner.ts
|
|
1928
2318
|
var WorkflowTopology = class WorkflowTopology {
|
|
@@ -2062,6 +2452,7 @@ var RunContinuationService = class {
|
|
|
2062
2452
|
workflowId: state.workflowId,
|
|
2063
2453
|
nodeId: args.nodeId,
|
|
2064
2454
|
parent: state.parent,
|
|
2455
|
+
policySnapshot: state.policySnapshot,
|
|
2065
2456
|
subworkflowDepth: state.executionOptions?.subworkflowDepth ?? 0,
|
|
2066
2457
|
engineMaxNodeActivations: limits.engineMaxNodeActivations,
|
|
2067
2458
|
engineMaxSubworkflowDepth: limits.engineMaxSubworkflowDepth,
|
|
@@ -2582,6 +2973,7 @@ var RunContinuationService = class {
|
|
|
2582
2973
|
workflowId: args.state.workflowId,
|
|
2583
2974
|
nodeId: nextDefinition.id,
|
|
2584
2975
|
parent: args.state.parent,
|
|
2976
|
+
policySnapshot: args.state.policySnapshot,
|
|
2585
2977
|
subworkflowDepth: args.state.executionOptions?.subworkflowDepth ?? 0,
|
|
2586
2978
|
engineMaxNodeActivations: webhookLimits.engineMaxNodeActivations,
|
|
2587
2979
|
engineMaxSubworkflowDepth: webhookLimits.engineMaxSubworkflowDepth,
|
|
@@ -2672,6 +3064,7 @@ var RunContinuationService = class {
|
|
|
2672
3064
|
workflowId: state.workflowId,
|
|
2673
3065
|
nodeId,
|
|
2674
3066
|
parent: state.parent,
|
|
3067
|
+
policySnapshot: state.policySnapshot,
|
|
2675
3068
|
subworkflowDepth: state.executionOptions?.subworkflowDepth ?? 0,
|
|
2676
3069
|
engineMaxNodeActivations: limits.engineMaxNodeActivations,
|
|
2677
3070
|
engineMaxSubworkflowDepth: limits.engineMaxSubworkflowDepth,
|
|
@@ -2685,6 +3078,10 @@ var RunContinuationService = class {
|
|
|
2685
3078
|
nodeId,
|
|
2686
3079
|
activationId,
|
|
2687
3080
|
config: def.config,
|
|
3081
|
+
telemetry: base.telemetry.forNode({
|
|
3082
|
+
nodeId,
|
|
3083
|
+
activationId
|
|
3084
|
+
}),
|
|
2688
3085
|
binary: base.binary.forNode({
|
|
2689
3086
|
nodeId,
|
|
2690
3087
|
activationId
|
|
@@ -3053,6 +3450,9 @@ var RunPolicySnapshotFactory = class {
|
|
|
3053
3450
|
return {
|
|
3054
3451
|
retentionSeconds: prune?.runDataRetentionSeconds ?? defaults?.retentionSeconds,
|
|
3055
3452
|
binaryRetentionSeconds: prune?.binaryRetentionSeconds ?? defaults?.binaryRetentionSeconds,
|
|
3453
|
+
telemetrySpanRetentionSeconds: prune?.telemetrySpanRetentionSeconds ?? defaults?.telemetrySpanRetentionSeconds,
|
|
3454
|
+
telemetryArtifactRetentionSeconds: prune?.telemetryArtifactRetentionSeconds ?? defaults?.telemetryArtifactRetentionSeconds,
|
|
3455
|
+
telemetryMetricRetentionSeconds: prune?.telemetryMetricRetentionSeconds ?? defaults?.telemetryMetricRetentionSeconds,
|
|
3056
3456
|
storagePolicy: typeof workflow.storagePolicy === "string" ? workflow.storagePolicy : defaults?.storagePolicy ?? "ALL"
|
|
3057
3457
|
};
|
|
3058
3458
|
}
|
|
@@ -3100,6 +3500,7 @@ var RunStartService = class {
|
|
|
3100
3500
|
workflowId: workflow.id,
|
|
3101
3501
|
nodeId: startAt,
|
|
3102
3502
|
parent,
|
|
3503
|
+
policySnapshot,
|
|
3103
3504
|
subworkflowDepth: mergedExecutionOptions.subworkflowDepth ?? 0,
|
|
3104
3505
|
engineMaxNodeActivations: mergedExecutionOptions.maxNodeActivations,
|
|
3105
3506
|
engineMaxSubworkflowDepth: mergedExecutionOptions.maxSubworkflowDepth,
|
|
@@ -3198,6 +3599,7 @@ var RunStartService = class {
|
|
|
3198
3599
|
workflowId: request.workflow.id,
|
|
3199
3600
|
nodeId: WorkflowExecutableNodeClassifierFactory.create(request.workflow).firstExecutableNodeIdInDefinitionOrder(request.workflow) ?? "unknown_node",
|
|
3200
3601
|
parent: request.parent,
|
|
3602
|
+
policySnapshot,
|
|
3201
3603
|
subworkflowDepth: mergedExecutionOptions.subworkflowDepth ?? 0,
|
|
3202
3604
|
engineMaxNodeActivations: mergedExecutionOptions.maxNodeActivations,
|
|
3203
3605
|
engineMaxSubworkflowDepth: mergedExecutionOptions.maxSubworkflowDepth,
|
|
@@ -3850,19 +4252,6 @@ var InMemoryRunDataFactory = class {
|
|
|
3850
4252
|
}
|
|
3851
4253
|
};
|
|
3852
4254
|
|
|
3853
|
-
//#endregion
|
|
3854
|
-
//#region src/contracts/runFinishedAtFactory.ts
|
|
3855
|
-
/** Derives workflow end time from persisted run root or node snapshots for run listings. */
|
|
3856
|
-
var RunFinishedAtFactory = class {
|
|
3857
|
-
static resolveIso(state) {
|
|
3858
|
-
if (state.finishedAt && state.status !== "running" && state.status !== "pending") return state.finishedAt;
|
|
3859
|
-
if (state.status === "running" || state.status === "pending") return;
|
|
3860
|
-
let max;
|
|
3861
|
-
for (const snap of Object.values(state.nodeSnapshotsByNodeId)) if (snap?.finishedAt && (!max || snap.finishedAt > max)) max = snap.finishedAt;
|
|
3862
|
-
return max;
|
|
3863
|
-
}
|
|
3864
|
-
};
|
|
3865
|
-
|
|
3866
4255
|
//#endregion
|
|
3867
4256
|
//#region src/orchestration/NodeExecutionRequestHandlerService.ts
|
|
3868
4257
|
var NodeExecutionRequestHandlerService = class {
|
|
@@ -3897,6 +4286,7 @@ var NodeExecutionRequestHandlerService = class {
|
|
|
3897
4286
|
workflowId: state.workflowId,
|
|
3898
4287
|
nodeId: request.nodeId,
|
|
3899
4288
|
parent: resolvedParent,
|
|
4289
|
+
policySnapshot: state.policySnapshot,
|
|
3900
4290
|
subworkflowDepth: state.executionOptions?.subworkflowDepth ?? 0,
|
|
3901
4291
|
engineMaxNodeActivations: limits.engineMaxNodeActivations,
|
|
3902
4292
|
engineMaxSubworkflowDepth: limits.engineMaxSubworkflowDepth,
|
|
@@ -4907,6 +5297,30 @@ var WorkflowRepositoryWebhookTriggerMatcherFactory = class {
|
|
|
4907
5297
|
};
|
|
4908
5298
|
|
|
4909
5299
|
//#endregion
|
|
5300
|
+
Object.defineProperty(exports, 'AllWorkflowsActiveWorkflowActivationPolicy', {
|
|
5301
|
+
enumerable: true,
|
|
5302
|
+
get: function () {
|
|
5303
|
+
return AllWorkflowsActiveWorkflowActivationPolicy;
|
|
5304
|
+
}
|
|
5305
|
+
});
|
|
5306
|
+
Object.defineProperty(exports, 'CatalogBackedCostTrackingTelemetryFactory', {
|
|
5307
|
+
enumerable: true,
|
|
5308
|
+
get: function () {
|
|
5309
|
+
return CatalogBackedCostTrackingTelemetryFactory;
|
|
5310
|
+
}
|
|
5311
|
+
});
|
|
5312
|
+
Object.defineProperty(exports, 'CodemationTelemetryAttributeNames', {
|
|
5313
|
+
enumerable: true,
|
|
5314
|
+
get: function () {
|
|
5315
|
+
return CodemationTelemetryAttributeNames;
|
|
5316
|
+
}
|
|
5317
|
+
});
|
|
5318
|
+
Object.defineProperty(exports, 'CodemationTelemetryMetricNames', {
|
|
5319
|
+
enumerable: true,
|
|
5320
|
+
get: function () {
|
|
5321
|
+
return CodemationTelemetryMetricNames;
|
|
5322
|
+
}
|
|
5323
|
+
});
|
|
4910
5324
|
Object.defineProperty(exports, 'ConfigDrivenOffloadPolicy', {
|
|
4911
5325
|
enumerable: true,
|
|
4912
5326
|
get: function () {
|
|
@@ -4925,12 +5339,30 @@ Object.defineProperty(exports, 'CoreTokens', {
|
|
|
4925
5339
|
return CoreTokens;
|
|
4926
5340
|
}
|
|
4927
5341
|
});
|
|
5342
|
+
Object.defineProperty(exports, 'CostTrackingTelemetryAttributeNames', {
|
|
5343
|
+
enumerable: true,
|
|
5344
|
+
get: function () {
|
|
5345
|
+
return CostTrackingTelemetryAttributeNames;
|
|
5346
|
+
}
|
|
5347
|
+
});
|
|
5348
|
+
Object.defineProperty(exports, 'CostTrackingTelemetryMetricNames', {
|
|
5349
|
+
enumerable: true,
|
|
5350
|
+
get: function () {
|
|
5351
|
+
return CostTrackingTelemetryMetricNames;
|
|
5352
|
+
}
|
|
5353
|
+
});
|
|
4928
5354
|
Object.defineProperty(exports, 'CredentialResolverFactory', {
|
|
4929
5355
|
enumerable: true,
|
|
4930
5356
|
get: function () {
|
|
4931
5357
|
return CredentialResolverFactory;
|
|
4932
5358
|
}
|
|
4933
5359
|
});
|
|
5360
|
+
Object.defineProperty(exports, 'CredentialUnboundError', {
|
|
5361
|
+
enumerable: true,
|
|
5362
|
+
get: function () {
|
|
5363
|
+
return CredentialUnboundError;
|
|
5364
|
+
}
|
|
5365
|
+
});
|
|
4934
5366
|
Object.defineProperty(exports, 'DefaultAsyncSleeper', {
|
|
4935
5367
|
enumerable: true,
|
|
4936
5368
|
get: function () {
|
|
@@ -4991,6 +5423,18 @@ Object.defineProperty(exports, 'EngineWorkflowRunnerServiceFactory', {
|
|
|
4991
5423
|
return EngineWorkflowRunnerServiceFactory;
|
|
4992
5424
|
}
|
|
4993
5425
|
});
|
|
5426
|
+
Object.defineProperty(exports, 'ExpRetryPolicy', {
|
|
5427
|
+
enumerable: true,
|
|
5428
|
+
get: function () {
|
|
5429
|
+
return ExpRetryPolicy;
|
|
5430
|
+
}
|
|
5431
|
+
});
|
|
5432
|
+
Object.defineProperty(exports, 'GenAiTelemetryAttributeNames', {
|
|
5433
|
+
enumerable: true,
|
|
5434
|
+
get: function () {
|
|
5435
|
+
return GenAiTelemetryAttributeNames;
|
|
5436
|
+
}
|
|
5437
|
+
});
|
|
4994
5438
|
Object.defineProperty(exports, 'HintOnlyOffloadPolicy', {
|
|
4995
5439
|
enumerable: true,
|
|
4996
5440
|
get: function () {
|
|
@@ -5039,10 +5483,10 @@ Object.defineProperty(exports, 'InlineDrivingScheduler', {
|
|
|
5039
5483
|
return InlineDrivingScheduler;
|
|
5040
5484
|
}
|
|
5041
5485
|
});
|
|
5042
|
-
Object.defineProperty(exports, '
|
|
5486
|
+
Object.defineProperty(exports, 'ItemExprResolver', {
|
|
5043
5487
|
enumerable: true,
|
|
5044
5488
|
get: function () {
|
|
5045
|
-
return
|
|
5489
|
+
return ItemExprResolver;
|
|
5046
5490
|
}
|
|
5047
5491
|
});
|
|
5048
5492
|
Object.defineProperty(exports, 'LocalOnlyScheduler', {
|
|
@@ -5057,6 +5501,54 @@ Object.defineProperty(exports, 'MissingRuntimeTriggerToken', {
|
|
|
5057
5501
|
return MissingRuntimeTriggerToken;
|
|
5058
5502
|
}
|
|
5059
5503
|
});
|
|
5504
|
+
Object.defineProperty(exports, 'NoOpCostTrackingTelemetry', {
|
|
5505
|
+
enumerable: true,
|
|
5506
|
+
get: function () {
|
|
5507
|
+
return NoOpCostTrackingTelemetry;
|
|
5508
|
+
}
|
|
5509
|
+
});
|
|
5510
|
+
Object.defineProperty(exports, 'NoOpCostTrackingTelemetryFactory', {
|
|
5511
|
+
enumerable: true,
|
|
5512
|
+
get: function () {
|
|
5513
|
+
return NoOpCostTrackingTelemetryFactory;
|
|
5514
|
+
}
|
|
5515
|
+
});
|
|
5516
|
+
Object.defineProperty(exports, 'NoOpExecutionTelemetry', {
|
|
5517
|
+
enumerable: true,
|
|
5518
|
+
get: function () {
|
|
5519
|
+
return NoOpExecutionTelemetry;
|
|
5520
|
+
}
|
|
5521
|
+
});
|
|
5522
|
+
Object.defineProperty(exports, 'NoOpExecutionTelemetryFactory', {
|
|
5523
|
+
enumerable: true,
|
|
5524
|
+
get: function () {
|
|
5525
|
+
return NoOpExecutionTelemetryFactory;
|
|
5526
|
+
}
|
|
5527
|
+
});
|
|
5528
|
+
Object.defineProperty(exports, 'NoOpNodeExecutionTelemetry', {
|
|
5529
|
+
enumerable: true,
|
|
5530
|
+
get: function () {
|
|
5531
|
+
return NoOpNodeExecutionTelemetry;
|
|
5532
|
+
}
|
|
5533
|
+
});
|
|
5534
|
+
Object.defineProperty(exports, 'NoOpTelemetryArtifactReference', {
|
|
5535
|
+
enumerable: true,
|
|
5536
|
+
get: function () {
|
|
5537
|
+
return NoOpTelemetryArtifactReference;
|
|
5538
|
+
}
|
|
5539
|
+
});
|
|
5540
|
+
Object.defineProperty(exports, 'NoOpTelemetrySpanScope', {
|
|
5541
|
+
enumerable: true,
|
|
5542
|
+
get: function () {
|
|
5543
|
+
return NoOpTelemetrySpanScope;
|
|
5544
|
+
}
|
|
5545
|
+
});
|
|
5546
|
+
Object.defineProperty(exports, 'NoRetryPolicy', {
|
|
5547
|
+
enumerable: true,
|
|
5548
|
+
get: function () {
|
|
5549
|
+
return NoRetryPolicy;
|
|
5550
|
+
}
|
|
5551
|
+
});
|
|
5060
5552
|
Object.defineProperty(exports, 'NodeEventPublisher', {
|
|
5061
5553
|
enumerable: true,
|
|
5062
5554
|
get: function () {
|
|
@@ -5111,6 +5603,12 @@ Object.defineProperty(exports, 'PersistedWorkflowTokenRegistry', {
|
|
|
5111
5603
|
return PersistedWorkflowTokenRegistry;
|
|
5112
5604
|
}
|
|
5113
5605
|
});
|
|
5606
|
+
Object.defineProperty(exports, 'RetryPolicy', {
|
|
5607
|
+
enumerable: true,
|
|
5608
|
+
get: function () {
|
|
5609
|
+
return RetryPolicy;
|
|
5610
|
+
}
|
|
5611
|
+
});
|
|
5114
5612
|
Object.defineProperty(exports, 'RunFinishedAtFactory', {
|
|
5115
5613
|
enumerable: true,
|
|
5116
5614
|
get: function () {
|
|
@@ -5153,6 +5651,12 @@ Object.defineProperty(exports, 'StackTraceCallSitePathResolver', {
|
|
|
5153
5651
|
return StackTraceCallSitePathResolver;
|
|
5154
5652
|
}
|
|
5155
5653
|
});
|
|
5654
|
+
Object.defineProperty(exports, 'StaticCostCatalog', {
|
|
5655
|
+
enumerable: true,
|
|
5656
|
+
get: function () {
|
|
5657
|
+
return StaticCostCatalog;
|
|
5658
|
+
}
|
|
5659
|
+
});
|
|
5156
5660
|
Object.defineProperty(exports, 'UnavailableBinaryStorage', {
|
|
5157
5661
|
enumerable: true,
|
|
5158
5662
|
get: function () {
|
|
@@ -5207,6 +5711,12 @@ Object.defineProperty(exports, '__toESM', {
|
|
|
5207
5711
|
return __toESM;
|
|
5208
5712
|
}
|
|
5209
5713
|
});
|
|
5714
|
+
Object.defineProperty(exports, 'branchRef', {
|
|
5715
|
+
enumerable: true,
|
|
5716
|
+
get: function () {
|
|
5717
|
+
return branchRef;
|
|
5718
|
+
}
|
|
5719
|
+
});
|
|
5210
5720
|
Object.defineProperty(exports, 'chatModel', {
|
|
5211
5721
|
enumerable: true,
|
|
5212
5722
|
get: function () {
|
|
@@ -5231,10 +5741,10 @@ Object.defineProperty(exports, 'getPersistedRuntimeTypeMetadata', {
|
|
|
5231
5741
|
return getPersistedRuntimeTypeMetadata;
|
|
5232
5742
|
}
|
|
5233
5743
|
});
|
|
5234
|
-
Object.defineProperty(exports, '
|
|
5744
|
+
Object.defineProperty(exports, 'isItemExpr', {
|
|
5235
5745
|
enumerable: true,
|
|
5236
5746
|
get: function () {
|
|
5237
|
-
return
|
|
5747
|
+
return isItemExpr;
|
|
5238
5748
|
}
|
|
5239
5749
|
});
|
|
5240
5750
|
Object.defineProperty(exports, 'isPortsEmission', {
|
|
@@ -5249,10 +5759,10 @@ Object.defineProperty(exports, 'isUnbrandedPortsEmissionShape', {
|
|
|
5249
5759
|
return isUnbrandedPortsEmissionShape;
|
|
5250
5760
|
}
|
|
5251
5761
|
});
|
|
5252
|
-
Object.defineProperty(exports, '
|
|
5762
|
+
Object.defineProperty(exports, 'itemExpr', {
|
|
5253
5763
|
enumerable: true,
|
|
5254
5764
|
get: function () {
|
|
5255
|
-
return
|
|
5765
|
+
return itemExpr;
|
|
5256
5766
|
}
|
|
5257
5767
|
});
|
|
5258
5768
|
Object.defineProperty(exports, 'node', {
|
|
@@ -5261,16 +5771,22 @@ Object.defineProperty(exports, 'node', {
|
|
|
5261
5771
|
return node;
|
|
5262
5772
|
}
|
|
5263
5773
|
});
|
|
5264
|
-
Object.defineProperty(exports, '
|
|
5774
|
+
Object.defineProperty(exports, 'nodeRef', {
|
|
5775
|
+
enumerable: true,
|
|
5776
|
+
get: function () {
|
|
5777
|
+
return nodeRef;
|
|
5778
|
+
}
|
|
5779
|
+
});
|
|
5780
|
+
Object.defineProperty(exports, 'resolveItemExprsForExecution', {
|
|
5265
5781
|
enumerable: true,
|
|
5266
5782
|
get: function () {
|
|
5267
|
-
return
|
|
5783
|
+
return resolveItemExprsForExecution;
|
|
5268
5784
|
}
|
|
5269
5785
|
});
|
|
5270
|
-
Object.defineProperty(exports, '
|
|
5786
|
+
Object.defineProperty(exports, 'resolveItemExprsInUnknown', {
|
|
5271
5787
|
enumerable: true,
|
|
5272
5788
|
get: function () {
|
|
5273
|
-
return
|
|
5789
|
+
return resolveItemExprsInUnknown;
|
|
5274
5790
|
}
|
|
5275
5791
|
});
|
|
5276
5792
|
Object.defineProperty(exports, 'tool', {
|
|
@@ -5279,4 +5795,4 @@ Object.defineProperty(exports, 'tool', {
|
|
|
5279
5795
|
return tool;
|
|
5280
5796
|
}
|
|
5281
5797
|
});
|
|
5282
|
-
//# sourceMappingURL=runtime-
|
|
5798
|
+
//# sourceMappingURL=runtime-Dvo2ru5A.cjs.map
|