@codemation/core 0.13.1 → 0.14.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 +110 -0
- package/dist/{CostCatalogContract-Dxq1BTyi.d.cts → CostCatalogContract-B9aYIqJu.d.cts} +2 -2
- package/dist/{EngineRuntimeRegistration.types-CqcTWexS.d.cts → EngineRuntimeRegistration.types-BYAmGMdS.d.cts} +3 -3
- package/dist/{EngineRuntimeRegistration.types-Cr75cSfL.d.ts → EngineRuntimeRegistration.types-CVLI8DsJ.d.ts} +2 -2
- package/dist/{InMemoryRunDataFactory-Csy2evr_.d.cts → InMemoryRunDataFactory-C3rIszrW.d.cts} +4 -2
- package/dist/{ItemsInputNormalizer-57EdA1ad.cjs → ItemsInputNormalizer-B9SdLG24.cjs} +2 -2
- package/dist/{ItemsInputNormalizer-57EdA1ad.cjs.map → ItemsInputNormalizer-B9SdLG24.cjs.map} +1 -1
- package/dist/{ItemsInputNormalizer-BkSvmfAW.js → ItemsInputNormalizer-CZEODg94.js} +2 -2
- package/dist/{ItemsInputNormalizer-BkSvmfAW.js.map → ItemsInputNormalizer-CZEODg94.js.map} +1 -1
- package/dist/{ItemsInputNormalizer-BWtlwdVI.d.ts → ItemsInputNormalizer-DoOawd9R.d.ts} +10 -2
- package/dist/{ItemsInputNormalizer-pLrWwUAP.d.cts → ItemsInputNormalizer-UCpn7luX.d.cts} +11 -3
- package/dist/{RunIntentService-BitgkKaT.d.cts → RunIntentService-0f3ICjAz.d.cts} +2 -2
- package/dist/{RunIntentService-DYpqfu6D.d.ts → RunIntentService-Dx_HHxDX.d.ts} +2 -2
- package/dist/{agentMcpTypes-DGIwk6Ue.d.cts → agentMcpTypes-B11B3Hd-.d.cts} +8 -1
- package/dist/bootstrap/index.cjs +3 -3
- package/dist/bootstrap/index.d.cts +5 -5
- package/dist/bootstrap/index.d.ts +5 -5
- package/dist/bootstrap/index.js +3 -3
- package/dist/{bootstrap-UDyH8OfK.cjs → bootstrap-Be0LB0nh.cjs} +3 -3
- package/dist/{bootstrap-UDyH8OfK.cjs.map → bootstrap-Be0LB0nh.cjs.map} +1 -1
- package/dist/{bootstrap-DB3jpo8F.js → bootstrap-pSQdsMfa.js} +3 -3
- package/dist/{bootstrap-DB3jpo8F.js.map → bootstrap-pSQdsMfa.js.map} +1 -1
- package/dist/browser.cjs +2 -2
- package/dist/browser.d.cts +3 -3
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +2 -2
- package/dist/contracts.d.cts +4 -4
- package/dist/contracts.d.ts +1 -1
- package/dist/{di-D9Mv3kF3.js → di-CEV6wTc4.js} +6 -5
- package/dist/di-CEV6wTc4.js.map +1 -0
- package/dist/{di-C-2ep8NZ.cjs → di-DhwtDRgs.cjs} +6 -5
- package/dist/di-DhwtDRgs.cjs.map +1 -0
- package/dist/{executionPersistenceContracts-CN9d7AnL.d.cts → executionPersistenceContracts-CX9Ql8N1.d.cts} +2 -2
- package/dist/{index-rllWL4r-.d.ts → index-CbJdbIHe.d.ts} +93 -6
- package/dist/{index-C2P-fOAx.d.ts → index-uPnD9EE6.d.ts} +51 -11
- package/dist/index.cjs +20 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +135 -16
- package/dist/index.d.ts +5 -5
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/{params-DRUr0F5v.d.cts → params-Dwl10Ws9.d.cts} +3 -4
- package/dist/{runtime-iHBN1jyD.js → runtime-CSunvf7A.js} +112 -15
- package/dist/runtime-CSunvf7A.js.map +1 -0
- package/dist/{runtime-rrH8-Ouq.cjs → runtime-n2tqRwaf.cjs} +117 -14
- package/dist/runtime-n2tqRwaf.cjs.map +1 -0
- package/dist/testing.cjs +3 -3
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +3 -3
- package/package.json +1 -1
- package/src/ai/AiHost.ts +7 -0
- package/src/ai/NodeBackedToolConfig.ts +2 -0
- package/src/authoring/defineNode.types.ts +18 -7
- package/src/authoring/definePollingTrigger.types.ts +20 -5
- package/src/authoring/index.ts +1 -0
- package/src/authoring/nodeBaseOptions.types.ts +18 -0
- package/src/contracts/itemExpr.ts +15 -11
- package/src/contracts/workflowTypes.ts +7 -0
- package/src/contracts/workspaceFileTypes.ts +42 -2
- package/src/execution/NodeOutputNormalizer.ts +8 -1
- package/src/execution/RunnableOutputBehaviorResolver.ts +12 -0
- package/src/index.ts +10 -2
- package/src/workflow/dsl/ChainCursorResolver.ts +13 -0
- package/src/workflow/dsl/WhenBuilder.ts +66 -2
- package/src/workflow/dsl/workflowBuilderTypes.ts +29 -0
- package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +1 -0
- package/dist/di-C-2ep8NZ.cjs.map +0 -1
- package/dist/di-D9Mv3kF3.js.map +0 -1
- package/dist/runtime-iHBN1jyD.js.map +0 -1
- package/dist/runtime-rrH8-Ouq.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as ConnectionNodeIdFactory, _ as CredentialUnboundError, a as injectable, g as SuspensionRequest, h as BINARY_DEFAULT_MAX_BYTES, v as NodeIterationIdFactory, w as resolveItemExprsForExecution, x as AgentConfigInspector, y as AgentConnectionNodeCollector } from "./di-
|
|
1
|
+
import { E as ConnectionNodeIdFactory, _ as CredentialUnboundError, a as injectable, g as SuspensionRequest, h as BINARY_DEFAULT_MAX_BYTES, v as NodeIterationIdFactory, w as resolveItemExprsForExecution, x as AgentConfigInspector, y as AgentConnectionNodeCollector } from "./di-CEV6wTc4.js";
|
|
2
2
|
import { ZodError, z } from "zod";
|
|
3
3
|
import { ReadableStream } from "node:stream/web";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
@@ -206,9 +206,13 @@ function defineNode(options) {
|
|
|
206
206
|
icon = options.icon;
|
|
207
207
|
inputSchema = options.inputSchema;
|
|
208
208
|
keepBinaries = options.keepBinaries ?? false;
|
|
209
|
-
|
|
209
|
+
id;
|
|
210
|
+
description;
|
|
211
|
+
constructor(name, config, idOrOptions) {
|
|
210
212
|
this.name = name;
|
|
211
|
-
|
|
213
|
+
const resolved = typeof idOrOptions === "string" ? { id: idOrOptions } : idOrOptions;
|
|
214
|
+
this.id = resolved?.id;
|
|
215
|
+
this.description = resolved?.description;
|
|
212
216
|
this.config = config;
|
|
213
217
|
}
|
|
214
218
|
config;
|
|
@@ -224,8 +228,8 @@ function defineNode(options) {
|
|
|
224
228
|
key: options.key,
|
|
225
229
|
title: options.title,
|
|
226
230
|
description: options.description,
|
|
227
|
-
create(config, name = options.title,
|
|
228
|
-
return new DefinedRunnableNodeConfig(name, config,
|
|
231
|
+
create(config, name = options.title, idOrOptions) {
|
|
232
|
+
return new DefinedRunnableNodeConfig(name, config, idOrOptions);
|
|
229
233
|
},
|
|
230
234
|
register(context) {
|
|
231
235
|
context.registerNode(DefinedNodeRuntime);
|
|
@@ -255,9 +259,13 @@ function defineBatchNode(options) {
|
|
|
255
259
|
kind = "node";
|
|
256
260
|
type = DefinedNodeRuntime;
|
|
257
261
|
icon = options.icon;
|
|
258
|
-
|
|
262
|
+
id;
|
|
263
|
+
description;
|
|
264
|
+
constructor(name, config, idOrOptions) {
|
|
259
265
|
this.name = name;
|
|
260
|
-
|
|
266
|
+
const resolved = typeof idOrOptions === "string" ? { id: idOrOptions } : idOrOptions;
|
|
267
|
+
this.id = resolved?.id;
|
|
268
|
+
this.description = resolved?.description;
|
|
261
269
|
this.config = config;
|
|
262
270
|
}
|
|
263
271
|
config;
|
|
@@ -273,8 +281,8 @@ function defineBatchNode(options) {
|
|
|
273
281
|
key: options.key,
|
|
274
282
|
title: options.title,
|
|
275
283
|
description: options.description,
|
|
276
|
-
create(config, name = options.title,
|
|
277
|
-
return new DefinedRunnableNodeConfig(name, config,
|
|
284
|
+
create(config, name = options.title, idOrOptions) {
|
|
285
|
+
return new DefinedRunnableNodeConfig(name, config, idOrOptions);
|
|
278
286
|
},
|
|
279
287
|
register(context) {
|
|
280
288
|
context.registerNode(DefinedNodeRuntime);
|
|
@@ -441,10 +449,13 @@ async function handleResume(item, resumeContext, decisionSchema, resolvedPredica
|
|
|
441
449
|
//#endregion
|
|
442
450
|
//#region src/workflow/dsl/WhenBuilder.ts
|
|
443
451
|
var WhenBuilder = class WhenBuilder {
|
|
444
|
-
|
|
452
|
+
/** Tail endpoint of the arm this builder added (set by addBranch). */
|
|
453
|
+
armEndpoint;
|
|
454
|
+
constructor(wf, from, branchPort, priorEndpoints = []) {
|
|
445
455
|
this.wf = wf;
|
|
446
456
|
this.from = from;
|
|
447
457
|
this.branchPort = branchPort;
|
|
458
|
+
this.priorEndpoints = priorEndpoints;
|
|
448
459
|
}
|
|
449
460
|
addBranch(steps) {
|
|
450
461
|
const created = [];
|
|
@@ -465,20 +476,84 @@ var WhenBuilder = class WhenBuilder {
|
|
|
465
476
|
return nodeId ? { nodeId } : { nodeId: r };
|
|
466
477
|
});
|
|
467
478
|
}
|
|
479
|
+
this.armEndpoint = prev ? {
|
|
480
|
+
node: prev,
|
|
481
|
+
output: "main",
|
|
482
|
+
inputPortHint: this.branchPort
|
|
483
|
+
} : {
|
|
484
|
+
node: this.from,
|
|
485
|
+
output: this.branchPort,
|
|
486
|
+
inputPortHint: this.branchPort
|
|
487
|
+
};
|
|
468
488
|
return this;
|
|
469
489
|
}
|
|
470
490
|
when = (branch, steps, ...more) => {
|
|
471
491
|
const list = Array.isArray(steps) ? steps : [steps, ...more];
|
|
472
492
|
const port = branch ? "true" : "false";
|
|
473
|
-
const b = new WhenBuilder(this.wf, this.from, port);
|
|
493
|
+
const b = new WhenBuilder(this.wf, this.from, port, this.accumulatedEndpoints);
|
|
474
494
|
b.addBranch(list);
|
|
475
495
|
return b;
|
|
476
496
|
};
|
|
497
|
+
/**
|
|
498
|
+
* Continue the trunk after a boolean `.when(...)` branch chain, auto-merging EVERY branch
|
|
499
|
+
* tail accumulated across the chain into the next node — the same fan-in the object form
|
|
500
|
+
* produces. Typed as `ChainCursor<TCurrentJson>` (the pre-branch item type): boolean arms
|
|
501
|
+
* carry no output guard so the merged item type is underdetermined — use the object form
|
|
502
|
+
* `.when({ true: [...], false: [...] })` when you need a precise merged type inline.
|
|
503
|
+
*/
|
|
504
|
+
then(config) {
|
|
505
|
+
return this.toCursor().then(config);
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Chainable human-approval step after a boolean `.when(...)` branch chain — merges every
|
|
509
|
+
* branch tail into the approval node. Mirrors `ChainCursor.humanApproval`.
|
|
510
|
+
*/
|
|
511
|
+
humanApproval(node$1, config, metadata) {
|
|
512
|
+
return this.toCursor().humanApproval(node$1, config, metadata);
|
|
513
|
+
}
|
|
477
514
|
build() {
|
|
478
515
|
return this.wf.build();
|
|
479
516
|
}
|
|
517
|
+
/** Endpoints of every arm added so far in this chain (prior arms + this one). */
|
|
518
|
+
get accumulatedEndpoints() {
|
|
519
|
+
return this.armEndpoint ? [...this.priorEndpoints, this.armEndpoint] : this.priorEndpoints;
|
|
520
|
+
}
|
|
521
|
+
toCursor() {
|
|
522
|
+
return new ChainCursor(this.wf, this.accumulatedEndpoints);
|
|
523
|
+
}
|
|
480
524
|
};
|
|
481
525
|
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region src/workflow/dsl/workflowBuilderTypes.ts
|
|
528
|
+
/**
|
|
529
|
+
* Flags a node's config so its output is MERGED onto `item.json` (shallow, output-wins) instead of
|
|
530
|
+
* replacing it — the config-level twin of {@link ChainCursor.thenMerge}.
|
|
531
|
+
*
|
|
532
|
+
* Unlike `.thenMerge` (a cursor method that only works on the trunk), `mergeForward` operates on a
|
|
533
|
+
* bare config, so it is usable in ANY position — including inside a `.when({ true: [...] })` branch
|
|
534
|
+
* arm, where the steps are a flat array of configs (not a cursor). Wrap a payload-REPLACING node
|
|
535
|
+
* (e.g. an extractor) in `mergeForward(node.create(...))` so prior fields survive into the next step.
|
|
536
|
+
*
|
|
537
|
+
* The OUTPUT type becomes `TIn & TOut` (the intersection), mirroring `.thenMerge`'s return type at
|
|
538
|
+
* the config level — so the next step in the branch array sees both the prior fields and the node's
|
|
539
|
+
* output. The INPUT type stays `TIn` (the node still receives the pre-merge item).
|
|
540
|
+
*
|
|
541
|
+
* @example
|
|
542
|
+
* ```ts
|
|
543
|
+
* workflow
|
|
544
|
+
* .trigger(...)
|
|
545
|
+
* .when({
|
|
546
|
+
* true: [mergeForward(extractor.create(...))], // output merges onto item.json; { a } survives
|
|
547
|
+
* false: [...],
|
|
548
|
+
* })
|
|
549
|
+
* .build();
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
function mergeForward(config) {
|
|
553
|
+
config.mergeJson = true;
|
|
554
|
+
return config;
|
|
555
|
+
}
|
|
556
|
+
|
|
482
557
|
//#endregion
|
|
483
558
|
//#region src/workflow/dsl/ChainCursorResolver.ts
|
|
484
559
|
var ChainCursor = class ChainCursor {
|
|
@@ -496,6 +571,15 @@ var ChainCursor = class ChainCursor {
|
|
|
496
571
|
...inputPortHint ? { inputPortHint } : {}
|
|
497
572
|
}]);
|
|
498
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* Append a step whose output is MERGED onto `item.json` (shallow, output-wins) instead of
|
|
576
|
+
* replacing it — so earlier fields (e.g. trigger metadata) survive a transform/OCR/extraction
|
|
577
|
+
* node. Use for any node in a pipeline where you need data from before it.
|
|
578
|
+
*/
|
|
579
|
+
thenMerge(config) {
|
|
580
|
+
mergeForward(config);
|
|
581
|
+
return this.then(config);
|
|
582
|
+
}
|
|
499
583
|
thenIntoInputHints(config) {
|
|
500
584
|
const next = this.wf.add(config);
|
|
501
585
|
for (const e of this.endpoints) this.wf.connect(e.node, next, e.output, e.inputPortHint ?? "in");
|
|
@@ -2085,10 +2169,16 @@ var NodeOutputNormalizer = class {
|
|
|
2085
2169
|
isItemLike(value) {
|
|
2086
2170
|
return typeof value === "object" && value !== null && "json" in value;
|
|
2087
2171
|
}
|
|
2172
|
+
isPlainJsonObject(value) {
|
|
2173
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2174
|
+
}
|
|
2088
2175
|
applyOutput(baseItem, next, behavior) {
|
|
2089
2176
|
const explicitBinary = next.binary;
|
|
2090
2177
|
return {
|
|
2091
|
-
json: next.json
|
|
2178
|
+
json: behavior.mergeJson && this.isPlainJsonObject(baseItem.json) && this.isPlainJsonObject(next.json) ? {
|
|
2179
|
+
...baseItem.json,
|
|
2180
|
+
...next.json
|
|
2181
|
+
} : next.json,
|
|
2092
2182
|
...explicitBinary !== void 0 ? { binary: explicitBinary } : behavior.keepBinaries && baseItem.binary ? { binary: baseItem.binary } : {},
|
|
2093
2183
|
...next.meta ? { meta: next.meta } : {},
|
|
2094
2184
|
...next.paired ? { paired: next.paired } : {}
|
|
@@ -2100,11 +2190,17 @@ var NodeOutputNormalizer = class {
|
|
|
2100
2190
|
//#region src/execution/RunnableOutputBehaviorResolver.ts
|
|
2101
2191
|
var RunnableOutputBehaviorResolver = class {
|
|
2102
2192
|
resolve(config) {
|
|
2103
|
-
return {
|
|
2193
|
+
return {
|
|
2194
|
+
keepBinaries: this.isKeepBinariesEnabled(config),
|
|
2195
|
+
mergeJson: this.isMergeJsonEnabled(config)
|
|
2196
|
+
};
|
|
2104
2197
|
}
|
|
2105
2198
|
isKeepBinariesEnabled(config) {
|
|
2106
2199
|
return config.keepBinaries === true;
|
|
2107
2200
|
}
|
|
2201
|
+
isMergeJsonEnabled(config) {
|
|
2202
|
+
return config.mergeJson === true;
|
|
2203
|
+
}
|
|
2108
2204
|
};
|
|
2109
2205
|
|
|
2110
2206
|
//#endregion
|
|
@@ -2643,6 +2739,7 @@ var WorkflowSnapshotCodec = class {
|
|
|
2643
2739
|
name: config.name,
|
|
2644
2740
|
id: config.id,
|
|
2645
2741
|
icon: config.icon,
|
|
2742
|
+
description: config.description,
|
|
2646
2743
|
execution: config.execution
|
|
2647
2744
|
};
|
|
2648
2745
|
this.injectTokenIds(fallback, config);
|
|
@@ -6582,5 +6679,5 @@ var WorkflowRepositoryWebhookTriggerMatcherFactory = class {
|
|
|
6582
6679
|
};
|
|
6583
6680
|
|
|
6584
6681
|
//#endregion
|
|
6585
|
-
export { CostTrackingTelemetryAttributeNames as $, PersistedWorkflowTokenRegistry as A,
|
|
6586
|
-
//# sourceMappingURL=runtime-
|
|
6682
|
+
export { CostTrackingTelemetryAttributeNames as $, PersistedWorkflowTokenRegistry as A, getPersistedRuntimeTypeMetadata as At, CatalogBackedCostTrackingTelemetryFactory as B, HitlWorkspaceIdToken as Bt, DefaultDrivingScheduler as C, mergeForward as Ct, NodeInstanceFactoryFactory as D, defineBatchNode as Dt, StaticCostCatalog as E, isHumanApprovalNode as Et, InProcessRetryRunnerFactory as F, StackTraceCallSitePathResolver as Ft, AllWorkflowsActiveWorkflowActivationPolicy as G, CodemationTelemetryMetricNames as H, RunnableOutputBehaviorResolver as I, PersistedRuntimeTypeNameResolver as It, NoOpNodeExecutionTelemetry as J, NoOpExecutionTelemetryFactory as K, NodeOutputNormalizer as L, DefinedNodeRegistry as Lt, NodeExecutorFactory as M, tool as Mt, NodeExecutor as N, InjectableRuntimeDecoratorComposer as Nt, NodeInstanceFactory as O, defineNode as Ot, RunSuspendedError as P, PersistedRuntimeTypeMetadataStore as Pt, NoOpCostTrackingTelemetry as Q, ItemExprResolver as R, HitlResumeTokenSignerToken as Rt, HintOnlyOffloadPolicy as S, ChainCursor as St, RunPolicySnapshotFactory as T, defineHumanApprovalNode as Tt, GenAiTelemetryAttributeNames as U, DefaultExecutionContextFactory as V, HumanTaskStoreToken as Vt, CodemationTelemetryAttributeNames as W, NoOpTelemetryArtifactReference as X, NoOpTelemetrySpanScope as Y, NoOpCostTrackingTelemetryFactory as Z, RunTerminalPersistenceCoordinator as _, WorkflowExecutableNodeClassifier as _t, InMemoryLiveWorkflowRepository as a, isPortsEmission as at, LocalOnlyScheduler as b, WorkflowDefinitionError as bt, EngineFactory as c, CredentialResolverFactory as ct, PollingTriggerRuntime as d, DefaultExecutionBinaryService as dt, CostTrackingTelemetryMetricNames as et, PollingTriggerDedupWindow as f, UnavailableBinaryStorage as ft, WorkflowPolicyErrorServices as g, WorkflowExecutableNodeClassifierFactory as gt, WorkflowStoragePolicyEvaluator as h, DefaultWorkflowGraphFactory as ht, RunIntentService as i, emitPorts as it, MissingRuntimeTriggerToken as j, node as jt, WorkflowSnapshotCodec as k, chatModel as kt, Engine as l, getOriginIndexFromItem as lt, InMemoryBinaryStorage as m, ConnectionInvocationEventPublisher as mt, WorkflowRepositoryWebhookTriggerMatcher as n, RetryPolicy as nt, EngineWorkflowRunnerServiceFactory as o, isUnbrandedPortsEmissionShape as ot, InMemoryRunDataFactory as p, NodeEventPublisher as pt, NoOpExecutionTelemetry as q, RunIntentServiceFactory as r, NoRetryPolicy as rt, EngineWorkflowRunnerService as s, DefaultAsyncSleeper as st, WorkflowRepositoryWebhookTriggerMatcherFactory as t, ExpRetryPolicy as tt, NoOpPollingTriggerLogger as u, ChildExecutionScopeFactory as ut, ENGINE_EXECUTION_LIMITS_DEFAULTS as v, ConnectionInvocationIdFactory as vt, ConfigDrivenOffloadPolicy as w, WhenBuilder as wt, InlineDrivingScheduler as x, NodeIdSlugifier as xt, EngineExecutionLimitsPolicy as y, WorkflowBuilder as yt, InProcessRetryRunner as z, HitlTimeoutJobSchedulerToken as zt };
|
|
6683
|
+
//# sourceMappingURL=runtime-CSunvf7A.js.map
|