@codemation/core 0.10.2 → 0.11.1
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 +183 -0
- package/dist/CostCatalogContract-DZgcUBE4.d.cts +19 -0
- package/dist/{EngineRuntimeRegistration.types-ClLuY1FG.d.ts → EngineRuntimeRegistration.types-BQbS9_gs.d.ts} +2 -2
- package/dist/{EngineRuntimeRegistration.types-BryWi2mA.d.cts → EngineRuntimeRegistration.types-Cggm5GVY.d.cts} +8 -2
- package/dist/{InMemoryRunDataFactory-DeXNJt1O.d.cts → InMemoryRunDataFactory-C7YItvHG.d.cts} +9 -19
- package/dist/{InMemoryRunEventBusRegistry-sM4z4n_i.js → InMemoryRunEventBusRegistry-Bwunvt1T.js} +1 -1
- package/dist/{InMemoryRunEventBusRegistry-sM4z4n_i.js.map → InMemoryRunEventBusRegistry-Bwunvt1T.js.map} +1 -1
- package/dist/{InMemoryRunEventBusRegistry-VM3OWnHo.cjs → InMemoryRunEventBusRegistry-Sa86VxuV.cjs} +1 -1
- package/dist/{InMemoryRunEventBusRegistry-VM3OWnHo.cjs.map → InMemoryRunEventBusRegistry-Sa86VxuV.cjs.map} +1 -1
- package/dist/ItemsInputNormalizer-C_dpn76M.d.cts +407 -0
- package/dist/ItemsInputNormalizer-CwdOhSAK.cjs +43 -0
- package/dist/ItemsInputNormalizer-CwdOhSAK.cjs.map +1 -0
- package/dist/ItemsInputNormalizer-D-MH8MBs.js +36 -0
- package/dist/ItemsInputNormalizer-D-MH8MBs.js.map +1 -0
- package/dist/ItemsInputNormalizer-_Mfcd3YU.d.ts +321 -0
- package/dist/RunIntentService-BVur7x9n.d.ts +285 -0
- package/dist/RunIntentService-CEF-sFfI.d.cts +206 -0
- package/dist/{RunIntentService-BqNjrksF.d.cts → agentMcpTypes-ZiNbNsEi.d.cts} +1717 -1809
- package/dist/bootstrap/index.cjs +4 -2
- package/dist/bootstrap/index.d.cts +8 -3
- package/dist/bootstrap/index.d.ts +6 -4
- package/dist/bootstrap/index.js +4 -2
- package/dist/{bootstrap-DtjQtuvi.cjs → bootstrap-BxuTFTLB.cjs} +41 -34
- package/dist/bootstrap-BxuTFTLB.cjs.map +1 -0
- package/dist/{bootstrap-BfFKGzyj.js → bootstrap-D_Yyi0wL.js} +9 -2
- package/dist/bootstrap-D_Yyi0wL.js.map +1 -0
- package/dist/browser.cjs +16 -0
- package/dist/browser.d.cts +4 -0
- package/dist/browser.d.ts +3 -0
- package/dist/browser.js +4 -0
- package/dist/contracts-CK0x6w_G.cjs +74 -0
- package/dist/contracts-CK0x6w_G.cjs.map +1 -0
- package/dist/contracts-DXdfTdpW.js +50 -0
- package/dist/contracts-DXdfTdpW.js.map +1 -0
- package/dist/contracts.cjs +6 -0
- package/dist/contracts.d.cts +5 -0
- package/dist/contracts.d.ts +2 -0
- package/dist/contracts.js +3 -0
- package/dist/di-0Wop7z1y.js +376 -0
- package/dist/di-0Wop7z1y.js.map +1 -0
- package/dist/di-BlEKdoZS.cjs +489 -0
- package/dist/di-BlEKdoZS.cjs.map +1 -0
- package/dist/executionPersistenceContracts-BgZMRsTa.d.cts +275 -0
- package/dist/{index-CJQtTY_M.d.ts → index-62Ba9f7D.d.ts} +114 -320
- package/dist/{RunIntentService-CI-F8qQ7.d.ts → index-zWGtEhrf.d.ts} +1811 -1914
- package/dist/index.cjs +76 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -656
- package/dist/index.d.ts +5 -3
- package/dist/index.js +52 -50
- package/dist/index.js.map +1 -1
- package/dist/params-B5SENSzZ.d.cts +44 -0
- package/dist/{runtime-_ywksLa6.cjs → runtime-DBzq5YBi.cjs} +125 -489
- package/dist/runtime-DBzq5YBi.cjs.map +1 -0
- package/dist/{runtime-DbMjpb5d.js → runtime-cxmUkk0l.js} +117 -369
- package/dist/runtime-cxmUkk0l.js.map +1 -0
- package/dist/testing.cjs +23 -21
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +4 -3
- package/dist/testing.d.ts +3 -2
- package/dist/testing.js +5 -3
- package/dist/testing.js.map +1 -1
- package/package.json +12 -17
- package/src/ai/AgentConnectionNodeCollector.ts +47 -5
- package/src/authoring/defineNode.types.ts +21 -1
- package/src/authoring/definePollingTrigger.types.ts +20 -0
- package/src/binaries/UnavailableBinaryStorage.ts +6 -0
- package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +9 -0
- package/src/browser.ts +1 -0
- package/src/contracts/AgentBindError.ts +11 -0
- package/src/contracts/CodemationTelemetryAttributeNames.ts +4 -0
- package/src/contracts/NoOpAgentMcpIntegration.ts +13 -0
- package/src/contracts/agentMcpTypes.ts +64 -0
- package/src/contracts/index.ts +4 -0
- package/src/contracts/mcpTypes.ts +29 -0
- package/src/contracts/runTypes.ts +8 -0
- package/src/contracts/runtimeTypes.ts +4 -0
- package/src/contracts/workflowTypes.ts +21 -0
- package/src/contracts.ts +3 -0
- package/src/credentials/OAuthFlowExecutor.types.ts +45 -0
- package/src/di/CoreTokens.ts +7 -0
- package/src/execution/InProcessRetryRunner.ts +31 -5
- package/src/execution/NodeExecutor.ts +27 -7
- package/src/execution/NodeRunStateWriter.ts +2 -0
- package/src/index.ts +10 -0
- package/src/orchestration/RunContinuationService.ts +6 -2
- package/src/runStorage/InMemoryBinaryStorageRegistry.ts +10 -0
- package/src/scheduler/InlineDrivingScheduler.ts +26 -22
- package/src/types/index.ts +1 -0
- package/src/validation/WorkflowEdgePortError.types.ts +16 -0
- package/src/validation/WorkflowEdgePortValidator.ts +52 -0
- package/src/workflow/definition/ConnectionInvocationIdFactory.ts +4 -3
- package/src/workflow/definition/ConnectionNodeIdFactory.ts +25 -0
- package/src/workflow/definition/NodeIterationIdFactory.ts +5 -3
- package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +42 -10
- package/tsdown.config.ts +1 -1
- package/dist/bootstrap-BfFKGzyj.js.map +0 -1
- package/dist/bootstrap-DtjQtuvi.cjs.map +0 -1
- package/dist/runtime-DbMjpb5d.js.map +0 -1
- package/dist/runtime-_ywksLa6.cjs.map +0 -1
|
@@ -1,61 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
require("reflect-metadata");
|
|
25
|
-
let tsyringe = require("tsyringe");
|
|
26
|
-
tsyringe = __toESM(tsyringe);
|
|
1
|
+
const require_di = require('./di-BlEKdoZS.cjs');
|
|
27
2
|
let zod = require("zod");
|
|
28
|
-
zod = __toESM(zod);
|
|
29
|
-
let node_crypto = require("node:crypto");
|
|
30
|
-
node_crypto = __toESM(node_crypto);
|
|
3
|
+
zod = require_di.__toESM(zod);
|
|
31
4
|
let node_stream_web = require("node:stream/web");
|
|
32
|
-
node_stream_web = __toESM(node_stream_web);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
CredentialSessionService: Symbol.for("codemation.core.CredentialSessionService"),
|
|
38
|
-
CredentialTypeRegistry: Symbol.for("codemation.core.CredentialTypeRegistry"),
|
|
39
|
-
WorkflowRunnerService: Symbol.for("codemation.core.WorkflowRunnerService"),
|
|
40
|
-
LiveWorkflowRepository: Symbol.for("codemation.core.LiveWorkflowRepository"),
|
|
41
|
-
WorkflowRepository: Symbol.for("codemation.core.WorkflowRepository"),
|
|
42
|
-
NodeResolver: Symbol.for("codemation.core.NodeResolver"),
|
|
43
|
-
WorkflowNodeInstanceFactory: Symbol.for("codemation.core.WorkflowNodeInstanceFactory"),
|
|
44
|
-
RunIdFactory: Symbol.for("codemation.core.RunIdFactory"),
|
|
45
|
-
ActivationIdFactory: Symbol.for("codemation.core.ActivationIdFactory"),
|
|
46
|
-
WorkflowExecutionRepository: Symbol.for("codemation.core.WorkflowExecutionRepository"),
|
|
47
|
-
TriggerSetupStateRepository: Symbol.for("codemation.core.TriggerSetupStateRepository"),
|
|
48
|
-
NodeActivationScheduler: Symbol.for("codemation.core.NodeActivationScheduler"),
|
|
49
|
-
RunDataFactory: Symbol.for("codemation.core.RunDataFactory"),
|
|
50
|
-
ExecutionContextFactory: Symbol.for("codemation.core.ExecutionContextFactory"),
|
|
51
|
-
RunEventBus: Symbol.for("codemation.core.RunEventBus"),
|
|
52
|
-
BinaryStorage: Symbol.for("codemation.core.BinaryStorage"),
|
|
53
|
-
WebhookBasePath: Symbol.for("codemation.core.WebhookBasePath"),
|
|
54
|
-
EngineExecutionLimitsPolicy: Symbol.for("codemation.core.EngineExecutionLimitsPolicy"),
|
|
55
|
-
WorkflowActivationPolicy: Symbol.for("codemation.core.WorkflowActivationPolicy")
|
|
56
|
-
};
|
|
5
|
+
node_stream_web = require_di.__toESM(node_stream_web);
|
|
6
|
+
let node_crypto = require("node:crypto");
|
|
7
|
+
node_crypto = require_di.__toESM(node_crypto);
|
|
8
|
+
let tsyringe = require("tsyringe");
|
|
9
|
+
tsyringe = require_di.__toESM(tsyringe);
|
|
57
10
|
|
|
58
|
-
//#endregion
|
|
59
11
|
//#region src/runtime-types/persistedRuntimeTypeModelRegistry.ts
|
|
60
12
|
/** Shared metadata key used to attach persisted runtime-type information to decorated classes. */
|
|
61
13
|
const persistedRuntimeTypeMetadataKey = Symbol.for("codemation.core.persistedRuntimeTypeMetadata");
|
|
@@ -164,248 +116,6 @@ function chatModel(options = {}) {
|
|
|
164
116
|
return InjectableRuntimeDecoratorComposer.compose("chatModel", options, require("url").pathToFileURL(__filename).href);
|
|
165
117
|
}
|
|
166
118
|
|
|
167
|
-
//#endregion
|
|
168
|
-
//#region src/ai/NodeBackedToolConfig.ts
|
|
169
|
-
var NodeBackedToolConfig = class {
|
|
170
|
-
type;
|
|
171
|
-
toolKind = "nodeBacked";
|
|
172
|
-
description;
|
|
173
|
-
presentation;
|
|
174
|
-
inputSchemaValue;
|
|
175
|
-
outputSchemaValue;
|
|
176
|
-
mapInputValue;
|
|
177
|
-
mapOutputValue;
|
|
178
|
-
constructor(name, node$1, options) {
|
|
179
|
-
this.name = name;
|
|
180
|
-
this.node = node$1;
|
|
181
|
-
this.type = node$1.type;
|
|
182
|
-
this.description = options.description;
|
|
183
|
-
this.presentation = options.presentation;
|
|
184
|
-
this.inputSchemaValue = options.inputSchema;
|
|
185
|
-
this.outputSchemaValue = options.outputSchema;
|
|
186
|
-
this.mapInputValue = options.mapInput;
|
|
187
|
-
this.mapOutputValue = options.mapOutput;
|
|
188
|
-
}
|
|
189
|
-
getCredentialRequirements() {
|
|
190
|
-
return this.node.getCredentialRequirements?.() ?? [];
|
|
191
|
-
}
|
|
192
|
-
getInputSchema() {
|
|
193
|
-
return this.inputSchemaValue;
|
|
194
|
-
}
|
|
195
|
-
getOutputSchema() {
|
|
196
|
-
return this.outputSchemaValue;
|
|
197
|
-
}
|
|
198
|
-
toNodeItem(args) {
|
|
199
|
-
const mapped = this.mapInputValue?.(args) ?? args.input;
|
|
200
|
-
if (this.isItem(mapped)) return mapped;
|
|
201
|
-
return { json: mapped };
|
|
202
|
-
}
|
|
203
|
-
toToolOutput(args) {
|
|
204
|
-
const raw = this.mapOutputValue?.(args) ?? this.readDefaultToolOutput(args.outputs);
|
|
205
|
-
return this.outputSchemaValue.parse(raw);
|
|
206
|
-
}
|
|
207
|
-
readDefaultToolOutput(outputs) {
|
|
208
|
-
const firstMainItem = outputs.main?.[0];
|
|
209
|
-
if (!firstMainItem) throw new Error(`Node-backed tool "${this.name}" did not produce a main output item.`);
|
|
210
|
-
return firstMainItem.json;
|
|
211
|
-
}
|
|
212
|
-
isItem(value) {
|
|
213
|
-
return typeof value === "object" && value !== null && "json" in value;
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
//#endregion
|
|
218
|
-
//#region src/contracts/itemExpr.ts
|
|
219
|
-
const ITEM_EXPR_BRAND = Symbol.for("codemation.itemExpr");
|
|
220
|
-
function itemExpr(fn) {
|
|
221
|
-
return {
|
|
222
|
-
[ITEM_EXPR_BRAND]: true,
|
|
223
|
-
fn
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
function isItemExpr(value) {
|
|
227
|
-
if (typeof value !== "object" || value === null) return false;
|
|
228
|
-
const v = value;
|
|
229
|
-
if (v[ITEM_EXPR_BRAND] === true) return true;
|
|
230
|
-
const keys = Object.keys(v);
|
|
231
|
-
if (keys.length === 1 && keys[0] === "fn" && typeof v.fn === "function") return true;
|
|
232
|
-
for (const sym of Object.getOwnPropertySymbols(v)) if (sym.description === "codemation.itemExpr" && v[sym] === true) return true;
|
|
233
|
-
return false;
|
|
234
|
-
}
|
|
235
|
-
function containsItemExprInUnknown(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
236
|
-
if (isItemExpr(value)) return true;
|
|
237
|
-
if (value === null || typeof value !== "object") return false;
|
|
238
|
-
if (seen.has(value)) return false;
|
|
239
|
-
seen.add(value);
|
|
240
|
-
if (Array.isArray(value)) return value.some((entry) => containsItemExprInUnknown(entry, seen));
|
|
241
|
-
for (const entry of Object.values(value)) if (containsItemExprInUnknown(entry, seen)) return true;
|
|
242
|
-
return false;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Deep-resolves {@link itemExpr} leaves. Returns a new graph (does not mutate the original config object).
|
|
246
|
-
*/
|
|
247
|
-
async function resolveItemExprsInUnknown(value, args, seen = /* @__PURE__ */ new WeakSet()) {
|
|
248
|
-
if (isItemExpr(value)) return await Promise.resolve(value.fn(args));
|
|
249
|
-
if (value === null || typeof value !== "object") return value;
|
|
250
|
-
if (seen.has(value)) return value;
|
|
251
|
-
seen.add(value);
|
|
252
|
-
if (Array.isArray(value)) {
|
|
253
|
-
const out$1 = [];
|
|
254
|
-
for (let i = 0; i < value.length; i++) out$1.push(await resolveItemExprsInUnknown(value[i], args, seen));
|
|
255
|
-
return out$1;
|
|
256
|
-
}
|
|
257
|
-
const rec = value;
|
|
258
|
-
const entries = Object.entries(rec);
|
|
259
|
-
const proto = Object.getPrototypeOf(value);
|
|
260
|
-
if (proto !== Object.prototype && proto !== null && entries.length === 0) return value;
|
|
261
|
-
const out = Object.create(proto);
|
|
262
|
-
for (const [k, v] of entries) out[k] = await resolveItemExprsInUnknown(v, args, seen);
|
|
263
|
-
return out;
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Clones runnable config (best-effort) so per-item {@link itemExpr} resolution never mutates shared instances.
|
|
267
|
-
*/
|
|
268
|
-
async function resolveItemExprsForExecution(config, nodeCtx, item, itemIndex, items) {
|
|
269
|
-
const exprArgs = {
|
|
270
|
-
item,
|
|
271
|
-
itemIndex,
|
|
272
|
-
items,
|
|
273
|
-
ctx: {
|
|
274
|
-
runId: nodeCtx.runId,
|
|
275
|
-
workflowId: nodeCtx.workflowId,
|
|
276
|
-
nodeId: nodeCtx.nodeId,
|
|
277
|
-
activationId: nodeCtx.activationId,
|
|
278
|
-
data: nodeCtx.data
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
if (!containsItemExprInUnknown(config)) return;
|
|
282
|
-
return await resolveItemExprsInUnknown(config, exprArgs);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
//#endregion
|
|
286
|
-
//#region src/ai/AgentConfigInspectorFactory.ts
|
|
287
|
-
var AgentConfigInspector = class {
|
|
288
|
-
static isAgentNodeConfig(config) {
|
|
289
|
-
if (!config) return false;
|
|
290
|
-
const candidate = config;
|
|
291
|
-
return !!candidate.chatModel && this.hasCompatibleMessageConfiguration(candidate);
|
|
292
|
-
}
|
|
293
|
-
static hasCompatibleMessageConfiguration(candidate) {
|
|
294
|
-
const messages = candidate.messages;
|
|
295
|
-
if (messages === void 0 || messages === null) return false;
|
|
296
|
-
if (Array.isArray(messages)) return messages.length > 0;
|
|
297
|
-
if (typeof messages === "object") {
|
|
298
|
-
if (isItemExpr(messages)) return true;
|
|
299
|
-
const o = messages;
|
|
300
|
-
return Array.isArray(o.prompt) && o.prompt.length > 0 || typeof o.buildMessages === "function";
|
|
301
|
-
}
|
|
302
|
-
return false;
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
//#endregion
|
|
307
|
-
//#region src/workflow/definition/ConnectionNodeIdFactory.ts
|
|
308
|
-
/**
|
|
309
|
-
* Deterministic ids for workflow connection-owned child nodes (LLM slot, tools, etc.).
|
|
310
|
-
* These are stable across loads.
|
|
311
|
-
*/
|
|
312
|
-
var ConnectionNodeIdFactory = class {
|
|
313
|
-
static connectionSegment = "__conn__";
|
|
314
|
-
static languageModelConnectionNodeId(parentNodeId) {
|
|
315
|
-
return `${parentNodeId}${this.connectionSegment}llm`;
|
|
316
|
-
}
|
|
317
|
-
static toolConnectionNodeId(parentNodeId, toolName) {
|
|
318
|
-
const normalized = this.normalizeToolName(toolName);
|
|
319
|
-
return `${parentNodeId}${this.connectionSegment}tool${this.connectionSegment}${normalized}`;
|
|
320
|
-
}
|
|
321
|
-
static isLanguageModelConnectionNodeId(nodeId) {
|
|
322
|
-
return nodeId.endsWith(`${this.connectionSegment}llm`);
|
|
323
|
-
}
|
|
324
|
-
static isToolConnectionNodeId(nodeId) {
|
|
325
|
-
return nodeId.includes(`${this.connectionSegment}tool${this.connectionSegment}`);
|
|
326
|
-
}
|
|
327
|
-
static parseLanguageModelConnectionNodeId(nodeId) {
|
|
328
|
-
if (!this.isLanguageModelConnectionNodeId(nodeId)) return;
|
|
329
|
-
const suffix = `${this.connectionSegment}llm`;
|
|
330
|
-
const parentNodeId = nodeId.slice(0, -suffix.length);
|
|
331
|
-
return parentNodeId ? { parentNodeId } : void 0;
|
|
332
|
-
}
|
|
333
|
-
static parseToolConnectionNodeId(nodeId) {
|
|
334
|
-
if (!this.isToolConnectionNodeId(nodeId)) return;
|
|
335
|
-
const marker = `${this.connectionSegment}tool${this.connectionSegment}`;
|
|
336
|
-
const idx = nodeId.lastIndexOf(marker);
|
|
337
|
-
if (idx < 0) return;
|
|
338
|
-
const parentNodeId = nodeId.slice(0, idx);
|
|
339
|
-
const normalizedToolName = nodeId.slice(idx + marker.length);
|
|
340
|
-
if (!parentNodeId || !normalizedToolName) return;
|
|
341
|
-
return {
|
|
342
|
-
parentNodeId,
|
|
343
|
-
normalizedToolName
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
/** True when `nodeId` is a connection-owned child of `parentNodeId` (LLM or tool slot). */
|
|
347
|
-
static isConnectionOwnedDescendantOf(parentNodeId, nodeId) {
|
|
348
|
-
return nodeId.startsWith(`${parentNodeId}${this.connectionSegment}`);
|
|
349
|
-
}
|
|
350
|
-
/** Normalizes a tool display name to a stable id segment. */
|
|
351
|
-
static normalizeToolName(toolName) {
|
|
352
|
-
return toolName.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "tool";
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
//#endregion
|
|
357
|
-
//#region src/ai/AgentConnectionNodeCollector.ts
|
|
358
|
-
const AgentConnectionNodeCollector = new class {
|
|
359
|
-
collect(parentNodeId, agentConfig) {
|
|
360
|
-
const collected = [];
|
|
361
|
-
this.collectInto(parentNodeId, agentConfig, collected);
|
|
362
|
-
return collected;
|
|
363
|
-
}
|
|
364
|
-
collectInto(parentNodeId, agentConfig, collected) {
|
|
365
|
-
collected.push({
|
|
366
|
-
nodeId: ConnectionNodeIdFactory.languageModelConnectionNodeId(parentNodeId),
|
|
367
|
-
parentNodeId,
|
|
368
|
-
connectionName: "llm",
|
|
369
|
-
role: "languageModel",
|
|
370
|
-
name: agentConfig.chatModel.presentation?.label ?? agentConfig.chatModel.name,
|
|
371
|
-
typeName: agentConfig.chatModel.name,
|
|
372
|
-
icon: agentConfig.chatModel.presentation?.icon,
|
|
373
|
-
credentialSource: agentConfig.chatModel
|
|
374
|
-
});
|
|
375
|
-
for (const tool$1 of agentConfig.tools ?? []) {
|
|
376
|
-
const toolNodeId = ConnectionNodeIdFactory.toolConnectionNodeId(parentNodeId, tool$1.name);
|
|
377
|
-
const isNestedAgent = this.isNodeBackedAgentTool(tool$1);
|
|
378
|
-
collected.push({
|
|
379
|
-
nodeId: toolNodeId,
|
|
380
|
-
parentNodeId,
|
|
381
|
-
connectionName: "tools",
|
|
382
|
-
role: isNestedAgent ? "nestedAgent" : "tool",
|
|
383
|
-
name: tool$1.presentation?.label ?? tool$1.name,
|
|
384
|
-
typeName: tool$1.name,
|
|
385
|
-
icon: tool$1.presentation?.icon,
|
|
386
|
-
credentialSource: tool$1
|
|
387
|
-
});
|
|
388
|
-
this.collectNestedAgentTools(toolNodeId, tool$1, collected);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
collectNestedAgentTools(toolNodeId, tool$1, collected) {
|
|
392
|
-
if (!this.isNodeBackedAgentTool(tool$1)) return;
|
|
393
|
-
const innerAgent = tool$1 instanceof NodeBackedToolConfig ? tool$1.node : tool$1.node;
|
|
394
|
-
this.collectInto(toolNodeId, innerAgent, collected);
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* After JSON round-trip (persisted snapshots), tools are plain objects — `instanceof NodeBackedToolConfig` fails.
|
|
398
|
-
* Detect node-backed tools structurally via {@link NodeBackedToolConfig#toolKind}.
|
|
399
|
-
*/
|
|
400
|
-
isNodeBackedAgentTool(tool$1) {
|
|
401
|
-
if (tool$1 instanceof NodeBackedToolConfig) return AgentConfigInspector.isAgentNodeConfig(tool$1.node);
|
|
402
|
-
if (!tool$1 || typeof tool$1 !== "object") return false;
|
|
403
|
-
const t = tool$1;
|
|
404
|
-
if (t.toolKind !== "nodeBacked") return false;
|
|
405
|
-
return AgentConfigInspector.isAgentNodeConfig(t.node);
|
|
406
|
-
}
|
|
407
|
-
}();
|
|
408
|
-
|
|
409
119
|
//#endregion
|
|
410
120
|
//#region src/workflow/dsl/WhenBuilder.ts
|
|
411
121
|
var WhenBuilder = class WhenBuilder {
|
|
@@ -643,7 +353,7 @@ var WorkflowBuilder = class {
|
|
|
643
353
|
tokenName,
|
|
644
354
|
label: node$1.name ?? ""
|
|
645
355
|
});
|
|
646
|
-
if (AgentConfigInspector.isAgentNodeConfig(node$1.config)) for (const child of AgentConnectionNodeCollector.collect(node$1.id, node$1.config)) entries.push({
|
|
356
|
+
if (require_di.AgentConfigInspector.isAgentNodeConfig(node$1.config)) for (const child of require_di.AgentConnectionNodeCollector.collect(node$1.id, node$1.config)) entries.push({
|
|
647
357
|
nodeId: child.nodeId,
|
|
648
358
|
tokenName: child.typeName,
|
|
649
359
|
label: child.name
|
|
@@ -682,10 +392,13 @@ var WorkflowBuilder = class {
|
|
|
682
392
|
//#region src/workflow/definition/ConnectionInvocationIdFactory.ts
|
|
683
393
|
/**
|
|
684
394
|
* Unique ids for persisted connection invocation history rows (LLM/tool calls under an owning node).
|
|
395
|
+
*
|
|
396
|
+
* Uses Web Crypto's `randomUUID` so this module is safe in browser-bundle contexts —
|
|
397
|
+
* paired with `NodeIterationIdFactory` which had the same `node:crypto` regression.
|
|
685
398
|
*/
|
|
686
399
|
var ConnectionInvocationIdFactory = class {
|
|
687
400
|
static create() {
|
|
688
|
-
return `cinv_${
|
|
401
|
+
return `cinv_${globalThis.crypto.randomUUID()}`;
|
|
689
402
|
}
|
|
690
403
|
/** Deterministic id for tests when a stable sequence is needed. */
|
|
691
404
|
static createForTest(runId, connectionNodeId, sequence) {
|
|
@@ -693,29 +406,6 @@ var ConnectionInvocationIdFactory = class {
|
|
|
693
406
|
}
|
|
694
407
|
};
|
|
695
408
|
|
|
696
|
-
//#endregion
|
|
697
|
-
//#region src/workflow/definition/NodeIterationIdFactory.ts
|
|
698
|
-
/**
|
|
699
|
-
* Unique ids for one per-item iteration of a runnable node's execute loop.
|
|
700
|
-
*
|
|
701
|
-
* Activations are per-batch (one scheduled execution of a node, possibly with N items).
|
|
702
|
-
* Iterations refine that to one identifier per item-index inside the batch loop, so per-item
|
|
703
|
-
* connection invocations and telemetry can be grouped without time-window heuristics.
|
|
704
|
-
*/
|
|
705
|
-
var NodeIterationIdFactory = class {
|
|
706
|
-
static create() {
|
|
707
|
-
return `iter_${(0, node_crypto.randomUUID)()}`;
|
|
708
|
-
}
|
|
709
|
-
/** Deterministic id for tests when a stable sequence is needed. */
|
|
710
|
-
static createForTest(seed, sequence) {
|
|
711
|
-
return `iter_${seed}_${sequence}`;
|
|
712
|
-
}
|
|
713
|
-
/** Deterministic id derived from a connection node id (for sub-agent / tool-call scopes). */
|
|
714
|
-
static createForConnection(connectionNodeId, sequence) {
|
|
715
|
-
return `iter_${connectionNodeId}_${sequence}`;
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
|
-
|
|
719
409
|
//#endregion
|
|
720
410
|
//#region src/workflow/definition/WorkflowExecutableNodeClassifier.ts
|
|
721
411
|
/**
|
|
@@ -954,6 +644,10 @@ var UnavailableBinaryStorage = class {
|
|
|
954
644
|
return { exists: false };
|
|
955
645
|
}
|
|
956
646
|
async delete() {}
|
|
647
|
+
async deleteMany() {}
|
|
648
|
+
async listByPrefix() {
|
|
649
|
+
return [];
|
|
650
|
+
}
|
|
957
651
|
};
|
|
958
652
|
|
|
959
653
|
//#endregion
|
|
@@ -1455,21 +1149,6 @@ var ExpRetryPolicy = class {
|
|
|
1455
1149
|
}
|
|
1456
1150
|
};
|
|
1457
1151
|
|
|
1458
|
-
//#endregion
|
|
1459
|
-
//#region src/contracts/credentialTypes.ts
|
|
1460
|
-
var CredentialUnboundError = class CredentialUnboundError extends Error {
|
|
1461
|
-
constructor(bindingKey, acceptedTypes = []) {
|
|
1462
|
-
super(CredentialUnboundError.createMessage(bindingKey, acceptedTypes));
|
|
1463
|
-
this.bindingKey = bindingKey;
|
|
1464
|
-
this.acceptedTypes = acceptedTypes;
|
|
1465
|
-
this.name = "CredentialUnboundError";
|
|
1466
|
-
}
|
|
1467
|
-
static createMessage(bindingKey, acceptedTypes) {
|
|
1468
|
-
const acceptedTypesSuffix = acceptedTypes.length > 0 ? ` Accepted credential types: ${acceptedTypes.join(", ")}.` : "";
|
|
1469
|
-
return `Credential slot "${bindingKey.slotKey}" is not bound for workflow ${bindingKey.workflowId} node ${bindingKey.nodeId}.${acceptedTypesSuffix}`;
|
|
1470
|
-
}
|
|
1471
|
-
};
|
|
1472
|
-
|
|
1473
1152
|
//#endregion
|
|
1474
1153
|
//#region src/contracts/CostTrackingTelemetryContract.ts
|
|
1475
1154
|
const CostTrackingTelemetryMetricNames = {
|
|
@@ -1591,19 +1270,6 @@ var NoOpExecutionTelemetryFactory = class {
|
|
|
1591
1270
|
}
|
|
1592
1271
|
};
|
|
1593
1272
|
|
|
1594
|
-
//#endregion
|
|
1595
|
-
//#region src/contracts/runFinishedAtFactory.ts
|
|
1596
|
-
/** Derives workflow end time from persisted run root or node snapshots for run listings. */
|
|
1597
|
-
var RunFinishedAtFactory = class {
|
|
1598
|
-
static resolveIso(state) {
|
|
1599
|
-
if (state.finishedAt && state.status !== "running" && state.status !== "pending") return state.finishedAt;
|
|
1600
|
-
if (state.status === "running" || state.status === "pending") return;
|
|
1601
|
-
let max;
|
|
1602
|
-
for (const snap of Object.values(state.nodeSnapshotsByNodeId)) if (snap?.finishedAt && (!max || snap.finishedAt > max)) max = snap.finishedAt;
|
|
1603
|
-
return max;
|
|
1604
|
-
}
|
|
1605
|
-
};
|
|
1606
|
-
|
|
1607
1273
|
//#endregion
|
|
1608
1274
|
//#region src/contracts/workflowActivationPolicy.ts
|
|
1609
1275
|
/** Default for tests and harnesses: every workflow is treated as active (legacy behavior). */
|
|
@@ -1632,6 +1298,10 @@ var CodemationTelemetryAttributeNames = class {
|
|
|
1632
1298
|
static iterationIndex = "codemation.iteration.index";
|
|
1633
1299
|
/** Set when this span/metric was recorded under a sub-agent triggered by an outer LLM/tool call. */
|
|
1634
1300
|
static parentInvocationId = "codemation.parent.invocation_id";
|
|
1301
|
+
/** MCP server id on spans created for callTool invocations. */
|
|
1302
|
+
static mcpServerId = "mcp.server_id";
|
|
1303
|
+
/** MCP tool name on spans created for callTool invocations. */
|
|
1304
|
+
static mcpToolName = "mcp.tool_name";
|
|
1635
1305
|
};
|
|
1636
1306
|
|
|
1637
1307
|
//#endregion
|
|
@@ -1657,13 +1327,6 @@ var CodemationTelemetryMetricNames = class {
|
|
|
1657
1327
|
static gmailAttachmentBytes = "codemation.gmail.attachment_bytes";
|
|
1658
1328
|
};
|
|
1659
1329
|
|
|
1660
|
-
//#endregion
|
|
1661
|
-
//#region src/contracts/workflowTypes.ts
|
|
1662
|
-
function nodeRef(nodeId) {
|
|
1663
|
-
return nodeId;
|
|
1664
|
-
}
|
|
1665
|
-
const branchRef = (index) => `$${index}`;
|
|
1666
|
-
|
|
1667
1330
|
//#endregion
|
|
1668
1331
|
//#region src/execution/ExecutionTelemetryCostTrackingDecoratorFactory.ts
|
|
1669
1332
|
var ExecutionTelemetryCostTrackingDecoratorFactory = class {
|
|
@@ -1847,18 +1510,21 @@ var CatalogBackedCostTrackingTelemetryFactory = class {
|
|
|
1847
1510
|
|
|
1848
1511
|
//#endregion
|
|
1849
1512
|
//#region src/execution/InProcessRetryRunner.ts
|
|
1513
|
+
/** Maximum permitted retry attempts — workflow-declared values above this are clamped. */
|
|
1514
|
+
const HARD_MAX_RETRY_ATTEMPTS = 10;
|
|
1850
1515
|
var InProcessRetryRunner = class InProcessRetryRunner {
|
|
1851
1516
|
constructor(sleeper) {
|
|
1852
1517
|
this.sleeper = sleeper;
|
|
1853
1518
|
}
|
|
1854
|
-
async run(policy, work) {
|
|
1855
|
-
const spec = InProcessRetryRunner.normalizePolicy(policy);
|
|
1519
|
+
async run(policy, work, shouldRetry, warn) {
|
|
1520
|
+
const spec = InProcessRetryRunner.normalizePolicy(policy, warn);
|
|
1856
1521
|
let lastError;
|
|
1857
1522
|
for (let attempt = 1; attempt <= spec.maxAttempts; attempt++) try {
|
|
1858
1523
|
return await work();
|
|
1859
1524
|
} catch (error) {
|
|
1860
1525
|
lastError = error;
|
|
1861
1526
|
if (attempt >= spec.maxAttempts) break;
|
|
1527
|
+
if (shouldRetry !== void 0 && !shouldRetry(error)) break;
|
|
1862
1528
|
const delayMs = InProcessRetryRunner.delayAfterFailureMs(spec, attempt);
|
|
1863
1529
|
await this.sleeper.sleep(delayMs);
|
|
1864
1530
|
}
|
|
@@ -1873,7 +1539,7 @@ var InProcessRetryRunner = class InProcessRetryRunner {
|
|
|
1873
1539
|
if (spec.maxDelayMs !== void 0 && ms > spec.maxDelayMs) ms = spec.maxDelayMs;
|
|
1874
1540
|
return Math.max(0, Math.floor(ms));
|
|
1875
1541
|
}
|
|
1876
|
-
static normalizePolicy(policy) {
|
|
1542
|
+
static normalizePolicy(policy, warn) {
|
|
1877
1543
|
if (policy === void 0) return {
|
|
1878
1544
|
kind: "none",
|
|
1879
1545
|
maxAttempts: 1
|
|
@@ -1889,17 +1555,19 @@ var InProcessRetryRunner = class InProcessRetryRunner {
|
|
|
1889
1555
|
};
|
|
1890
1556
|
if (kind === "fixed") {
|
|
1891
1557
|
const p = policy;
|
|
1558
|
+
const raw = InProcessRetryRunner.assertPositiveInt(p.maxAttempts, "fixed.maxAttempts");
|
|
1892
1559
|
return {
|
|
1893
1560
|
kind: "fixed",
|
|
1894
|
-
maxAttempts: InProcessRetryRunner.
|
|
1561
|
+
maxAttempts: InProcessRetryRunner.clampMaxAttempts(raw, warn),
|
|
1895
1562
|
delayMs: InProcessRetryRunner.assertNonNegativeFinite(p.delayMs, "fixed.delayMs")
|
|
1896
1563
|
};
|
|
1897
1564
|
}
|
|
1898
1565
|
if (kind === "exponential") {
|
|
1899
1566
|
const p = policy;
|
|
1567
|
+
const raw = InProcessRetryRunner.assertPositiveInt(p.maxAttempts, "exponential.maxAttempts");
|
|
1900
1568
|
return {
|
|
1901
1569
|
kind: "exponential",
|
|
1902
|
-
maxAttempts: InProcessRetryRunner.
|
|
1570
|
+
maxAttempts: InProcessRetryRunner.clampMaxAttempts(raw, warn),
|
|
1903
1571
|
initialDelayMs: InProcessRetryRunner.assertNonNegativeFinite(p.initialDelayMs, "exponential.initialDelayMs"),
|
|
1904
1572
|
multiplier: InProcessRetryRunner.assertMultiplier(p.multiplier),
|
|
1905
1573
|
maxDelayMs: p.maxDelayMs === void 0 ? void 0 : InProcessRetryRunner.assertNonNegativeFinite(p.maxDelayMs, "exponential.maxDelayMs"),
|
|
@@ -1911,6 +1579,13 @@ var InProcessRetryRunner = class InProcessRetryRunner {
|
|
|
1911
1579
|
maxAttempts: 1
|
|
1912
1580
|
};
|
|
1913
1581
|
}
|
|
1582
|
+
static clampMaxAttempts(requested, warn) {
|
|
1583
|
+
if (requested > HARD_MAX_RETRY_ATTEMPTS) {
|
|
1584
|
+
warn?.(`Retry policy maxAttempts (${requested}) exceeds hard ceiling (${HARD_MAX_RETRY_ATTEMPTS}); clamping to ${HARD_MAX_RETRY_ATTEMPTS}.`);
|
|
1585
|
+
return HARD_MAX_RETRY_ATTEMPTS;
|
|
1586
|
+
}
|
|
1587
|
+
return requested;
|
|
1588
|
+
}
|
|
1914
1589
|
static assertPositiveInt(value, label) {
|
|
1915
1590
|
if (typeof value !== "number" || !Number.isFinite(value) || value < 1 || !Number.isInteger(value)) throw new Error(`Retry policy ${label} must be a positive integer`);
|
|
1916
1591
|
return value;
|
|
@@ -1933,7 +1608,7 @@ var InProcessRetryRunner = class InProcessRetryRunner {
|
|
|
1933
1608
|
var ItemExprResolver = class {
|
|
1934
1609
|
async resolveConfigForItem(ctx, item, itemIndex, items) {
|
|
1935
1610
|
if (!ctx) throw new Error("ItemExprResolver.resolveConfigForItem: ctx is required");
|
|
1936
|
-
const resolvedConfig = await resolveItemExprsForExecution(ctx.config, ctx, item, itemIndex, items);
|
|
1611
|
+
const resolvedConfig = await require_di.resolveItemExprsForExecution(ctx.config, ctx, item, itemIndex, items);
|
|
1937
1612
|
const merged = resolvedConfig !== void 0 && resolvedConfig !== null ? resolvedConfig : ctx.config;
|
|
1938
1613
|
if (merged === void 0 || merged === null) return ctx;
|
|
1939
1614
|
return {
|
|
@@ -2113,12 +1788,24 @@ var NodeExecutor = class {
|
|
|
2113
1788
|
this.outputBehaviorResolver = outputBehaviorResolver ?? new RunnableOutputBehaviorResolver();
|
|
2114
1789
|
}
|
|
2115
1790
|
async execute(request) {
|
|
1791
|
+
await this.assertRequiredCredentialsBound(request);
|
|
2116
1792
|
const policy = request.ctx.config.retryPolicy;
|
|
2117
1793
|
return await this.retryRunner.run(policy, async () => {
|
|
2118
1794
|
const nodeInstance = this.nodeInstanceFactory.createByType(request.ctx.config.type);
|
|
2119
1795
|
if (request.kind === "multi") return await this.executeMultiInputActivation(request, nodeInstance);
|
|
2120
1796
|
return await this.executeSingleInputNode(request, nodeInstance);
|
|
2121
|
-
});
|
|
1797
|
+
}, (error) => !this.isCredentialError(error));
|
|
1798
|
+
}
|
|
1799
|
+
async assertRequiredCredentialsBound(request) {
|
|
1800
|
+
if (!request.ctx.getCredential) return;
|
|
1801
|
+
for (const req of request.ctx.config.getCredentialRequirements?.() ?? []) {
|
|
1802
|
+
if (req.optional) continue;
|
|
1803
|
+
await request.ctx.getCredential(req.slotKey);
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
isCredentialError(e) {
|
|
1807
|
+
if (e instanceof require_di.CredentialUnboundError) return true;
|
|
1808
|
+
return (e instanceof Error ? e.cause : void 0) instanceof require_di.CredentialUnboundError;
|
|
2122
1809
|
}
|
|
2123
1810
|
async executeMultiInputActivation(request, node$1) {
|
|
2124
1811
|
const multiInputNode = node$1;
|
|
@@ -2204,7 +1891,7 @@ var NodeExecutor = class {
|
|
|
2204
1891
|
const resolvedCtx = await this.itemExprResolver.resolveConfigForItem(runnableCtx, item, i, inputBatch);
|
|
2205
1892
|
const iterationCtx = {
|
|
2206
1893
|
...this.pickExecutionContext(runnableCtx, resolvedCtx),
|
|
2207
|
-
iterationId: NodeIterationIdFactory.create(),
|
|
1894
|
+
iterationId: require_di.NodeIterationIdFactory.create(),
|
|
2208
1895
|
itemIndex: i
|
|
2209
1896
|
};
|
|
2210
1897
|
const args = {
|
|
@@ -2428,16 +2115,20 @@ var WorkflowSnapshotCodec = class {
|
|
|
2428
2115
|
name: workflow.name,
|
|
2429
2116
|
workflowErrorHandlerConfigured: workflow.workflowErrorHandler !== void 0,
|
|
2430
2117
|
...workflow.connections !== void 0 && workflow.connections.length > 0 ? { connections: workflow.connections } : {},
|
|
2431
|
-
nodes: workflow.nodes.map((node$1) =>
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2118
|
+
nodes: workflow.nodes.map((node$1) => {
|
|
2119
|
+
const inspectorSummaryRows = this.safeInspectorSummary(node$1.config);
|
|
2120
|
+
return {
|
|
2121
|
+
id: node$1.id,
|
|
2122
|
+
kind: node$1.kind,
|
|
2123
|
+
name: node$1.name,
|
|
2124
|
+
nodeTokenId: this.resolveTokenId(node$1.type),
|
|
2125
|
+
configTokenId: this.resolveTokenId(node$1.config.type),
|
|
2126
|
+
tokenName: this.resolveTokenName(node$1.type),
|
|
2127
|
+
configTokenName: this.resolveTokenName(node$1.config.type),
|
|
2128
|
+
config: this.serializeConfig(node$1.config),
|
|
2129
|
+
...inspectorSummaryRows !== void 0 ? { inspectorSummary: inspectorSummaryRows } : {}
|
|
2130
|
+
};
|
|
2131
|
+
}),
|
|
2441
2132
|
edges: workflow.edges.map((edge) => ({
|
|
2442
2133
|
from: {
|
|
2443
2134
|
nodeId: edge.from.nodeId,
|
|
@@ -2477,6 +2168,34 @@ var WorkflowSnapshotCodec = class {
|
|
|
2477
2168
|
return fallback;
|
|
2478
2169
|
}
|
|
2479
2170
|
}
|
|
2171
|
+
/**
|
|
2172
|
+
* Safely call `config.inspectorSummary()` and return a plain JSON-safe array, or undefined.
|
|
2173
|
+
* Returns undefined if the method is absent, throws, or produces no valid rows.
|
|
2174
|
+
*/
|
|
2175
|
+
safeInspectorSummary(config) {
|
|
2176
|
+
const fn = config.inspectorSummary;
|
|
2177
|
+
if (typeof fn !== "function") return void 0;
|
|
2178
|
+
let raw;
|
|
2179
|
+
try {
|
|
2180
|
+
raw = fn.call(config);
|
|
2181
|
+
} catch {
|
|
2182
|
+
return;
|
|
2183
|
+
}
|
|
2184
|
+
if (!Array.isArray(raw)) return void 0;
|
|
2185
|
+
const rows = [];
|
|
2186
|
+
for (const entry of raw) {
|
|
2187
|
+
if (!entry || typeof entry !== "object") continue;
|
|
2188
|
+
const { label, value } = entry;
|
|
2189
|
+
if (typeof label !== "string" || typeof value !== "string") continue;
|
|
2190
|
+
const trimmedLabel = label.trim();
|
|
2191
|
+
if (trimmedLabel.length === 0) continue;
|
|
2192
|
+
rows.push({
|
|
2193
|
+
label: trimmedLabel,
|
|
2194
|
+
value
|
|
2195
|
+
});
|
|
2196
|
+
}
|
|
2197
|
+
return rows.length > 0 ? rows : void 0;
|
|
2198
|
+
}
|
|
2480
2199
|
injectTokenIds(target, source) {
|
|
2481
2200
|
const type = this.asTypeToken(source.type);
|
|
2482
2201
|
if (type) target.tokenId = this.tokenRegistry.getTokenId(type) ?? this.resolveTokenName(type) ?? "unknown";
|
|
@@ -2747,6 +2466,8 @@ var NodeRunStateWriter = class {
|
|
|
2747
2466
|
status: args.status,
|
|
2748
2467
|
managedInput: args.managedInput,
|
|
2749
2468
|
managedOutput: args.managedOutput,
|
|
2469
|
+
statusLabel: args.statusLabel,
|
|
2470
|
+
subjectName: args.subjectName,
|
|
2750
2471
|
error: args.error,
|
|
2751
2472
|
queuedAt: args.queuedAt,
|
|
2752
2473
|
startedAt: args.startedAt,
|
|
@@ -3109,7 +2830,7 @@ var RunContinuationService = class {
|
|
|
3109
2830
|
});
|
|
3110
2831
|
const completedActivations = (state.engineCounters?.completedNodeActivations ?? 0) + 1;
|
|
3111
2832
|
const engineCounters = { completedNodeActivations: completedActivations };
|
|
3112
|
-
const maxNodeActivations = state.executionOptions?.maxNodeActivations ??
|
|
2833
|
+
const maxNodeActivations = state.executionOptions?.maxNodeActivations ?? this.executionLimitsPolicy.createRootExecutionOptions().maxNodeActivations;
|
|
3113
2834
|
if (this.semantics.isStopConditionSatisfied(state.control?.stopCondition, args.nodeId)) {
|
|
3114
2835
|
const completedState = this.persistedRunStateTerminalBuilder.mergeTerminal({
|
|
3115
2836
|
state,
|
|
@@ -3433,7 +3154,7 @@ var RunContinuationService = class {
|
|
|
3433
3154
|
});
|
|
3434
3155
|
const completedActivations = (args.state.engineCounters?.completedNodeActivations ?? 0) + 1;
|
|
3435
3156
|
const engineCounters = { completedNodeActivations: completedActivations };
|
|
3436
|
-
const maxNodeActivations = args.state.executionOptions?.maxNodeActivations ??
|
|
3157
|
+
const maxNodeActivations = args.state.executionOptions?.maxNodeActivations ?? this.executionLimitsPolicy.createRootExecutionOptions().maxNodeActivations;
|
|
3437
3158
|
if (this.semantics.isStopConditionSatisfied(args.state.control?.stopCondition, args.args.nodeId)) {
|
|
3438
3159
|
const completedState = this.persistedRunStateTerminalBuilder.mergeTerminal({
|
|
3439
3160
|
state: args.state,
|
|
@@ -4072,7 +3793,7 @@ var CurrentStateFrontierPlanner = class CurrentStateFrontierPlanner {
|
|
|
4072
3793
|
isRuntimeDescendant(nodeId, descendantNodeIds) {
|
|
4073
3794
|
for (const descendantNodeId of descendantNodeIds) {
|
|
4074
3795
|
if (nodeId === descendantNodeId) return false;
|
|
4075
|
-
if (ConnectionNodeIdFactory.isConnectionOwnedDescendantOf(descendantNodeId, nodeId)) return true;
|
|
3796
|
+
if (require_di.ConnectionNodeIdFactory.isConnectionOwnedDescendantOf(descendantNodeId, nodeId)) return true;
|
|
4076
3797
|
}
|
|
4077
3798
|
return false;
|
|
4078
3799
|
}
|
|
@@ -4662,25 +4383,24 @@ var InlineDrivingScheduler = class {
|
|
|
4662
4383
|
this.scheduledRuns.delete(runId);
|
|
4663
4384
|
try {
|
|
4664
4385
|
const q = this.queuesByRunId.get(runId) ?? [];
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
}
|
|
4682
|
-
await this.resumeAfterExecutionResult(cont, request, outputs ?? {});
|
|
4386
|
+
if (q.length === 0) return;
|
|
4387
|
+
const { request } = q.shift();
|
|
4388
|
+
const cont = this.continuation;
|
|
4389
|
+
if (!cont) throw new Error("InlineDrivingScheduler is missing a continuation (setContinuation was not called)");
|
|
4390
|
+
await cont.markNodeRunning({
|
|
4391
|
+
runId: request.runId,
|
|
4392
|
+
activationId: request.activationId,
|
|
4393
|
+
nodeId: request.nodeId,
|
|
4394
|
+
inputsByPort: request.kind === "multi" ? request.inputsByPort : { in: request.input }
|
|
4395
|
+
});
|
|
4396
|
+
let outputs;
|
|
4397
|
+
try {
|
|
4398
|
+
outputs = await this.nodeExecutor.execute(request);
|
|
4399
|
+
} catch (e) {
|
|
4400
|
+
await this.resumeAfterExecutionError(cont, request, this.asError(e));
|
|
4401
|
+
return;
|
|
4683
4402
|
}
|
|
4403
|
+
await this.resumeAfterExecutionResult(cont, request, outputs ?? {});
|
|
4684
4404
|
} finally {
|
|
4685
4405
|
if ((this.queuesByRunId.get(runId)?.length ?? 0) === 0) this.queuesByRunId.delete(runId);
|
|
4686
4406
|
this.drainingRuns.delete(runId);
|
|
@@ -4690,10 +4410,10 @@ var InlineDrivingScheduler = class {
|
|
|
4690
4410
|
scheduleDrain(runId) {
|
|
4691
4411
|
if (this.drainingRuns.has(runId) || this.scheduledRuns.has(runId)) return;
|
|
4692
4412
|
this.scheduledRuns.add(runId);
|
|
4693
|
-
|
|
4413
|
+
setImmediate(() => {
|
|
4694
4414
|
this.scheduledRuns.delete(runId);
|
|
4695
4415
|
this.drainRun(runId);
|
|
4696
|
-
}
|
|
4416
|
+
});
|
|
4697
4417
|
}
|
|
4698
4418
|
async resumeAfterExecutionResult(continuation, request, outputs) {
|
|
4699
4419
|
try {
|
|
@@ -4943,6 +4663,12 @@ var InMemoryBinaryStorage = class {
|
|
|
4943
4663
|
async delete(storageKey) {
|
|
4944
4664
|
this.values.delete(storageKey);
|
|
4945
4665
|
}
|
|
4666
|
+
async deleteMany(storageKeys) {
|
|
4667
|
+
for (const key of storageKeys) this.values.delete(key);
|
|
4668
|
+
}
|
|
4669
|
+
async listByPrefix(prefix) {
|
|
4670
|
+
return Array.from(this.values.keys()).filter((key) => key.startsWith(prefix));
|
|
4671
|
+
}
|
|
4946
4672
|
};
|
|
4947
4673
|
|
|
4948
4674
|
//#endregion
|
|
@@ -6171,18 +5897,6 @@ var WorkflowRepositoryWebhookTriggerMatcherFactory = class {
|
|
|
6171
5897
|
};
|
|
6172
5898
|
|
|
6173
5899
|
//#endregion
|
|
6174
|
-
Object.defineProperty(exports, 'AgentConfigInspector', {
|
|
6175
|
-
enumerable: true,
|
|
6176
|
-
get: function () {
|
|
6177
|
-
return AgentConfigInspector;
|
|
6178
|
-
}
|
|
6179
|
-
});
|
|
6180
|
-
Object.defineProperty(exports, 'AgentConnectionNodeCollector', {
|
|
6181
|
-
enumerable: true,
|
|
6182
|
-
get: function () {
|
|
6183
|
-
return AgentConnectionNodeCollector;
|
|
6184
|
-
}
|
|
6185
|
-
});
|
|
6186
5900
|
Object.defineProperty(exports, 'AllWorkflowsActiveWorkflowActivationPolicy', {
|
|
6187
5901
|
enumerable: true,
|
|
6188
5902
|
get: function () {
|
|
@@ -6237,18 +5951,6 @@ Object.defineProperty(exports, 'ConnectionInvocationIdFactory', {
|
|
|
6237
5951
|
return ConnectionInvocationIdFactory;
|
|
6238
5952
|
}
|
|
6239
5953
|
});
|
|
6240
|
-
Object.defineProperty(exports, 'ConnectionNodeIdFactory', {
|
|
6241
|
-
enumerable: true,
|
|
6242
|
-
get: function () {
|
|
6243
|
-
return ConnectionNodeIdFactory;
|
|
6244
|
-
}
|
|
6245
|
-
});
|
|
6246
|
-
Object.defineProperty(exports, 'CoreTokens', {
|
|
6247
|
-
enumerable: true,
|
|
6248
|
-
get: function () {
|
|
6249
|
-
return CoreTokens;
|
|
6250
|
-
}
|
|
6251
|
-
});
|
|
6252
5954
|
Object.defineProperty(exports, 'CostTrackingTelemetryAttributeNames', {
|
|
6253
5955
|
enumerable: true,
|
|
6254
5956
|
get: function () {
|
|
@@ -6267,12 +5969,6 @@ Object.defineProperty(exports, 'CredentialResolverFactory', {
|
|
|
6267
5969
|
return CredentialResolverFactory;
|
|
6268
5970
|
}
|
|
6269
5971
|
});
|
|
6270
|
-
Object.defineProperty(exports, 'CredentialUnboundError', {
|
|
6271
|
-
enumerable: true,
|
|
6272
|
-
get: function () {
|
|
6273
|
-
return CredentialUnboundError;
|
|
6274
|
-
}
|
|
6275
|
-
});
|
|
6276
5972
|
Object.defineProperty(exports, 'DefaultAsyncSleeper', {
|
|
6277
5973
|
enumerable: true,
|
|
6278
5974
|
get: function () {
|
|
@@ -6471,12 +6167,6 @@ Object.defineProperty(exports, 'NoRetryPolicy', {
|
|
|
6471
6167
|
return NoRetryPolicy;
|
|
6472
6168
|
}
|
|
6473
6169
|
});
|
|
6474
|
-
Object.defineProperty(exports, 'NodeBackedToolConfig', {
|
|
6475
|
-
enumerable: true,
|
|
6476
|
-
get: function () {
|
|
6477
|
-
return NodeBackedToolConfig;
|
|
6478
|
-
}
|
|
6479
|
-
});
|
|
6480
6170
|
Object.defineProperty(exports, 'NodeEventPublisher', {
|
|
6481
6171
|
enumerable: true,
|
|
6482
6172
|
get: function () {
|
|
@@ -6513,12 +6203,6 @@ Object.defineProperty(exports, 'NodeInstanceFactoryFactory', {
|
|
|
6513
6203
|
return NodeInstanceFactoryFactory;
|
|
6514
6204
|
}
|
|
6515
6205
|
});
|
|
6516
|
-
Object.defineProperty(exports, 'NodeIterationIdFactory', {
|
|
6517
|
-
enumerable: true,
|
|
6518
|
-
get: function () {
|
|
6519
|
-
return NodeIterationIdFactory;
|
|
6520
|
-
}
|
|
6521
|
-
});
|
|
6522
6206
|
Object.defineProperty(exports, 'NodeOutputNormalizer', {
|
|
6523
6207
|
enumerable: true,
|
|
6524
6208
|
get: function () {
|
|
@@ -6561,12 +6245,6 @@ Object.defineProperty(exports, 'RetryPolicy', {
|
|
|
6561
6245
|
return RetryPolicy;
|
|
6562
6246
|
}
|
|
6563
6247
|
});
|
|
6564
|
-
Object.defineProperty(exports, 'RunFinishedAtFactory', {
|
|
6565
|
-
enumerable: true,
|
|
6566
|
-
get: function () {
|
|
6567
|
-
return RunFinishedAtFactory;
|
|
6568
|
-
}
|
|
6569
|
-
});
|
|
6570
6248
|
Object.defineProperty(exports, 'RunIntentService', {
|
|
6571
6249
|
enumerable: true,
|
|
6572
6250
|
get: function () {
|
|
@@ -6675,18 +6353,6 @@ Object.defineProperty(exports, 'WorkflowStoragePolicyEvaluator', {
|
|
|
6675
6353
|
return WorkflowStoragePolicyEvaluator;
|
|
6676
6354
|
}
|
|
6677
6355
|
});
|
|
6678
|
-
Object.defineProperty(exports, '__toESM', {
|
|
6679
|
-
enumerable: true,
|
|
6680
|
-
get: function () {
|
|
6681
|
-
return __toESM;
|
|
6682
|
-
}
|
|
6683
|
-
});
|
|
6684
|
-
Object.defineProperty(exports, 'branchRef', {
|
|
6685
|
-
enumerable: true,
|
|
6686
|
-
get: function () {
|
|
6687
|
-
return branchRef;
|
|
6688
|
-
}
|
|
6689
|
-
});
|
|
6690
6356
|
Object.defineProperty(exports, 'chatModel', {
|
|
6691
6357
|
enumerable: true,
|
|
6692
6358
|
get: function () {
|
|
@@ -6711,12 +6377,6 @@ Object.defineProperty(exports, 'getPersistedRuntimeTypeMetadata', {
|
|
|
6711
6377
|
return getPersistedRuntimeTypeMetadata;
|
|
6712
6378
|
}
|
|
6713
6379
|
});
|
|
6714
|
-
Object.defineProperty(exports, 'isItemExpr', {
|
|
6715
|
-
enumerable: true,
|
|
6716
|
-
get: function () {
|
|
6717
|
-
return isItemExpr;
|
|
6718
|
-
}
|
|
6719
|
-
});
|
|
6720
6380
|
Object.defineProperty(exports, 'isPortsEmission', {
|
|
6721
6381
|
enumerable: true,
|
|
6722
6382
|
get: function () {
|
|
@@ -6729,40 +6389,16 @@ Object.defineProperty(exports, 'isUnbrandedPortsEmissionShape', {
|
|
|
6729
6389
|
return isUnbrandedPortsEmissionShape;
|
|
6730
6390
|
}
|
|
6731
6391
|
});
|
|
6732
|
-
Object.defineProperty(exports, 'itemExpr', {
|
|
6733
|
-
enumerable: true,
|
|
6734
|
-
get: function () {
|
|
6735
|
-
return itemExpr;
|
|
6736
|
-
}
|
|
6737
|
-
});
|
|
6738
6392
|
Object.defineProperty(exports, 'node', {
|
|
6739
6393
|
enumerable: true,
|
|
6740
6394
|
get: function () {
|
|
6741
6395
|
return node;
|
|
6742
6396
|
}
|
|
6743
6397
|
});
|
|
6744
|
-
Object.defineProperty(exports, 'nodeRef', {
|
|
6745
|
-
enumerable: true,
|
|
6746
|
-
get: function () {
|
|
6747
|
-
return nodeRef;
|
|
6748
|
-
}
|
|
6749
|
-
});
|
|
6750
|
-
Object.defineProperty(exports, 'resolveItemExprsForExecution', {
|
|
6751
|
-
enumerable: true,
|
|
6752
|
-
get: function () {
|
|
6753
|
-
return resolveItemExprsForExecution;
|
|
6754
|
-
}
|
|
6755
|
-
});
|
|
6756
|
-
Object.defineProperty(exports, 'resolveItemExprsInUnknown', {
|
|
6757
|
-
enumerable: true,
|
|
6758
|
-
get: function () {
|
|
6759
|
-
return resolveItemExprsInUnknown;
|
|
6760
|
-
}
|
|
6761
|
-
});
|
|
6762
6398
|
Object.defineProperty(exports, 'tool', {
|
|
6763
6399
|
enumerable: true,
|
|
6764
6400
|
get: function () {
|
|
6765
6401
|
return tool;
|
|
6766
6402
|
}
|
|
6767
6403
|
});
|
|
6768
|
-
//# sourceMappingURL=runtime-
|
|
6404
|
+
//# sourceMappingURL=runtime-DBzq5YBi.cjs.map
|