@cadenza.io/core 1.12.0 → 2.0.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/dist/index.d.mts CHANGED
@@ -280,8 +280,8 @@ declare class GraphNode extends SignalEmitter implements Graph {
280
280
  lightExport(): {
281
281
  __id: string;
282
282
  __task: {
283
- __id: string;
284
283
  __name: string;
284
+ __version: number;
285
285
  };
286
286
  __context: {
287
287
  __id: string;
@@ -414,9 +414,9 @@ type TaskFunction = (context: AnyObject, emit: (signal: string, context: AnyObje
414
414
  type TaskResult = boolean | AnyObject | Generator | Promise<any> | void;
415
415
  type ThrottleTagGetter = (context?: AnyObject, task?: Task) => string;
416
416
  declare class Task extends SignalParticipant implements Graph {
417
- id: string;
418
417
  readonly name: string;
419
418
  readonly description: string;
419
+ version: number;
420
420
  concurrency: number;
421
421
  timeout: number;
422
422
  readonly isMeta: boolean;
@@ -468,7 +468,7 @@ declare class Task extends SignalParticipant implements Graph {
468
468
  */
469
469
  constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
470
470
  getTag(context?: AnyObject): string;
471
- setGlobalId(id: string): void;
471
+ setVersion(version: number): void;
472
472
  setTimeout(timeout: number): void;
473
473
  setConcurrency(concurrency: number): void;
474
474
  setProgressWeight(weight: number): void;
@@ -505,7 +505,6 @@ declare class Task extends SignalParticipant implements Graph {
505
505
  doAfter(...tasks: Task[]): this;
506
506
  then(...tasks: Task[]): this;
507
507
  decouple(task: Task): void;
508
- doOnFail(...tasks: Task[]): this;
509
508
  updateProgressWeights(): void;
510
509
  getSubgraphLayers(): Map<number, Set<Task>>;
511
510
  updateLayerFromPredecessors(): void;
@@ -579,8 +578,8 @@ declare class GraphRun {
579
578
  }
580
579
 
581
580
  declare class GraphRoutine extends SignalParticipant {
582
- id: string;
583
581
  readonly name: string;
582
+ version: number;
584
583
  readonly description: string;
585
584
  readonly isMeta: boolean;
586
585
  tasks: Set<Task>;
@@ -592,10 +591,10 @@ declare class GraphRoutine extends SignalParticipant {
592
591
  */
593
592
  forEachTask(callBack: (task: Task) => any): Promise<void>;
594
593
  /**
595
- * Sets global ID.
596
- * @param id The ID.
594
+ * Sets global Version.
595
+ * @param version The Version.
597
596
  */
598
- setGlobalId(id: string): void;
597
+ setVersion(version: number): void;
599
598
  /**
600
599
  * Destroys the routine.
601
600
  */
@@ -603,7 +602,6 @@ declare class GraphRoutine extends SignalParticipant {
603
602
  }
604
603
 
605
604
  declare class GraphRunner extends SignalEmitter {
606
- readonly id: string;
607
605
  currentRun: GraphRun;
608
606
  debug: boolean;
609
607
  verbose: boolean;
@@ -710,18 +708,14 @@ declare class GraphRegistry {
710
708
  tasks: Map<string, Task>;
711
709
  routines: Map<string, GraphRoutine>;
712
710
  registerTask: Task;
713
- updateTaskId: Task;
714
711
  updateTaskInputSchema: Task;
715
712
  updateTaskOutputSchema: Task;
716
- getTaskById: Task;
717
713
  getTaskByName: Task;
718
714
  getTasksByLayer: Task;
719
715
  getAllTasks: Task;
720
716
  doForEachTask: Task;
721
717
  deleteTask: Task;
722
718
  registerRoutine: Task;
723
- updateRoutineId: Task;
724
- getRoutineById: Task;
725
719
  getRoutineByName: Task;
726
720
  getAllRoutines: Task;
727
721
  doForEachRoutine: Task;
package/dist/index.d.ts CHANGED
@@ -280,8 +280,8 @@ declare class GraphNode extends SignalEmitter implements Graph {
280
280
  lightExport(): {
281
281
  __id: string;
282
282
  __task: {
283
- __id: string;
284
283
  __name: string;
284
+ __version: number;
285
285
  };
286
286
  __context: {
287
287
  __id: string;
@@ -414,9 +414,9 @@ type TaskFunction = (context: AnyObject, emit: (signal: string, context: AnyObje
414
414
  type TaskResult = boolean | AnyObject | Generator | Promise<any> | void;
415
415
  type ThrottleTagGetter = (context?: AnyObject, task?: Task) => string;
416
416
  declare class Task extends SignalParticipant implements Graph {
417
- id: string;
418
417
  readonly name: string;
419
418
  readonly description: string;
419
+ version: number;
420
420
  concurrency: number;
421
421
  timeout: number;
422
422
  readonly isMeta: boolean;
@@ -468,7 +468,7 @@ declare class Task extends SignalParticipant implements Graph {
468
468
  */
469
469
  constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
470
470
  getTag(context?: AnyObject): string;
471
- setGlobalId(id: string): void;
471
+ setVersion(version: number): void;
472
472
  setTimeout(timeout: number): void;
473
473
  setConcurrency(concurrency: number): void;
474
474
  setProgressWeight(weight: number): void;
@@ -505,7 +505,6 @@ declare class Task extends SignalParticipant implements Graph {
505
505
  doAfter(...tasks: Task[]): this;
506
506
  then(...tasks: Task[]): this;
507
507
  decouple(task: Task): void;
508
- doOnFail(...tasks: Task[]): this;
509
508
  updateProgressWeights(): void;
510
509
  getSubgraphLayers(): Map<number, Set<Task>>;
511
510
  updateLayerFromPredecessors(): void;
@@ -579,8 +578,8 @@ declare class GraphRun {
579
578
  }
580
579
 
581
580
  declare class GraphRoutine extends SignalParticipant {
582
- id: string;
583
581
  readonly name: string;
582
+ version: number;
584
583
  readonly description: string;
585
584
  readonly isMeta: boolean;
586
585
  tasks: Set<Task>;
@@ -592,10 +591,10 @@ declare class GraphRoutine extends SignalParticipant {
592
591
  */
593
592
  forEachTask(callBack: (task: Task) => any): Promise<void>;
594
593
  /**
595
- * Sets global ID.
596
- * @param id The ID.
594
+ * Sets global Version.
595
+ * @param version The Version.
597
596
  */
598
- setGlobalId(id: string): void;
597
+ setVersion(version: number): void;
599
598
  /**
600
599
  * Destroys the routine.
601
600
  */
@@ -603,7 +602,6 @@ declare class GraphRoutine extends SignalParticipant {
603
602
  }
604
603
 
605
604
  declare class GraphRunner extends SignalEmitter {
606
- readonly id: string;
607
605
  currentRun: GraphRun;
608
606
  debug: boolean;
609
607
  verbose: boolean;
@@ -710,18 +708,14 @@ declare class GraphRegistry {
710
708
  tasks: Map<string, Task>;
711
709
  routines: Map<string, GraphRoutine>;
712
710
  registerTask: Task;
713
- updateTaskId: Task;
714
711
  updateTaskInputSchema: Task;
715
712
  updateTaskOutputSchema: Task;
716
- getTaskById: Task;
717
713
  getTaskByName: Task;
718
714
  getTasksByLayer: Task;
719
715
  getAllTasks: Task;
720
716
  doForEachTask: Task;
721
717
  deleteTask: Task;
722
718
  registerRoutine: Task;
723
- updateRoutineId: Task;
724
- getRoutineById: Task;
725
719
  getRoutineByName: Task;
726
720
  getAllRoutines: Task;
727
721
  doForEachRoutine: Task;
package/dist/index.js CHANGED
@@ -127,7 +127,7 @@ var SignalBroker = class _SignalBroker {
127
127
  this.metaRunner = metaRunner;
128
128
  }
129
129
  init() {
130
- Cadenza.createDebounceMetaTask(
130
+ Cadenza.createMetaTask(
131
131
  "Execute and clear queued signals",
132
132
  () => {
133
133
  for (const [id, signals] of this.emitStacks.entries()) {
@@ -139,12 +139,7 @@ var SignalBroker = class _SignalBroker {
139
139
  }
140
140
  return true;
141
141
  },
142
- "Executes queued signals and clears the stack",
143
- 500,
144
- {
145
- maxWait: 1e4,
146
- leading: true
147
- }
142
+ "Executes queued signals and clears the stack"
148
143
  ).doOn("meta.process_signal_queue_requested").emitsAfter("meta.signal_broker.queue_empty");
149
144
  this.getSignalsTask = Cadenza.createMetaTask("Get signals", (ctx) => {
150
145
  return {
@@ -284,7 +279,7 @@ var SignalBroker = class _SignalBroker {
284
279
  };
285
280
 
286
281
  // src/engine/GraphRunner.ts
287
- var import_uuid6 = require("uuid");
282
+ var import_uuid4 = require("uuid");
288
283
 
289
284
  // src/engine/GraphRun.ts
290
285
  var import_uuid = require("uuid");
@@ -458,11 +453,11 @@ var VueFlowExporter = class {
458
453
  continue;
459
454
  }
460
455
  const tasks = task.getIterator();
461
- const exportedTaskIds = [];
456
+ const exportedTaskNames = [];
462
457
  while (tasks.hasNext()) {
463
458
  const task2 = tasks.next();
464
- if (task2 && !exportedTaskIds.includes(task2.id)) {
465
- exportedTaskIds.push(task2.id);
459
+ if (task2 && !exportedTaskNames.includes(task2.name)) {
460
+ exportedTaskNames.push(task2.name);
466
461
  task2.accept(exporterVisitor);
467
462
  }
468
463
  }
@@ -758,7 +753,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
758
753
  return this.routineExecId === node.routineExecId;
759
754
  }
760
755
  sharesTaskWith(node) {
761
- return this.task.id === node.task.id;
756
+ return this.task.name === node.task.name;
762
757
  }
763
758
  sharesContextWith(node) {
764
759
  return this.context.id === node.context.id;
@@ -798,8 +793,8 @@ var GraphNode = class _GraphNode extends SignalEmitter {
798
793
  routineExecutionId: this.routineExecId,
799
794
  contractId: context.__contractId,
800
795
  context: this.context.export(),
801
- taskId: this.task.id,
802
796
  taskName: this.task.name,
797
+ taskVersion: this.task.version,
803
798
  isMeta: this.isMeta(),
804
799
  isScheduled: true,
805
800
  splitGroupId: this.splitGroupId,
@@ -814,28 +809,19 @@ var GraphNode = class _GraphNode extends SignalEmitter {
814
809
  executionCount: "increment"
815
810
  },
816
811
  filter: {
817
- taskId: this.task.id,
818
- previousTaskId: node.task.id
812
+ taskName: this.task.name,
813
+ taskVersion: this.task.version,
814
+ previousTaskName: node.task.name,
815
+ previousTaskVersion: node.task.version
819
816
  }
820
817
  });
821
- if (node.failed || node.errored) {
822
- this.emitMetricsWithMetadata("meta.node.failed_mapped", {
823
- data: {
824
- executionCount: "increment"
825
- },
826
- filter: {
827
- taskId: this.task.id,
828
- failTaskId: node.task.id
829
- }
830
- });
831
- }
832
818
  });
833
819
  if (((_a = context.__signalEmission) == null ? void 0 : _a.consumed) === false && (!this.isMeta() || this.debug)) {
834
820
  this.emitMetricsWithMetadata("meta.node.consumed_signal", {
835
821
  data: {
836
822
  signalName: context.__signalEmission.signalName,
837
- taskId: this.task.id,
838
823
  taskName: this.task.name,
824
+ taskVersion: this.task.version,
839
825
  taskExecutionId: this.id,
840
826
  consumedAt: formatTimestamp(scheduledAt)
841
827
  }
@@ -987,8 +973,8 @@ var GraphNode = class _GraphNode extends SignalEmitter {
987
973
  const data = { ...ctx };
988
974
  if (!this.task.isHidden) {
989
975
  data.__signalEmission = {
990
- taskId: this.task.id,
991
976
  taskName: this.task.name,
977
+ taskVersion: this.task.version,
992
978
  taskExecutionId: this.id
993
979
  };
994
980
  data.__metadata = {
@@ -1001,8 +987,8 @@ var GraphNode = class _GraphNode extends SignalEmitter {
1001
987
  const data = { ...ctx };
1002
988
  if (!this.task.isHidden) {
1003
989
  data.__signalEmission = {
1004
- taskId: this.task.id,
1005
990
  taskName: this.task.name,
991
+ taskVersion: this.task.version,
1006
992
  taskExecutionId: this.id,
1007
993
  isMetric: true
1008
994
  };
@@ -1324,8 +1310,8 @@ var GraphNode = class _GraphNode extends SignalEmitter {
1324
1310
  return {
1325
1311
  __id: this.id,
1326
1312
  __task: {
1327
- __id: this.task.id,
1328
- __name: this.task.name
1313
+ __name: this.task.name,
1314
+ __version: this.task.version
1329
1315
  },
1330
1316
  __context: this.context.export(),
1331
1317
  __executionTime: this.executionTime,
@@ -1352,9 +1338,6 @@ var GraphNode = class _GraphNode extends SignalEmitter {
1352
1338
  }
1353
1339
  };
1354
1340
 
1355
- // src/graph/definition/GraphRoutine.ts
1356
- var import_uuid4 = require("uuid");
1357
-
1358
1341
  // src/interfaces/SignalParticipant.ts
1359
1342
  var SignalParticipant = class extends SignalEmitter {
1360
1343
  constructor() {
@@ -1479,15 +1462,14 @@ var SignalParticipant = class extends SignalEmitter {
1479
1462
  var GraphRoutine = class extends SignalParticipant {
1480
1463
  constructor(name, tasks, description, isMeta = false) {
1481
1464
  super();
1465
+ this.version = 1;
1482
1466
  this.isMeta = false;
1483
1467
  this.tasks = /* @__PURE__ */ new Set();
1484
- this.id = (0, import_uuid4.v4)();
1485
1468
  this.name = name;
1486
1469
  this.description = description;
1487
1470
  this.isMeta = isMeta;
1488
1471
  this.emit("meta.routine.created", {
1489
1472
  data: {
1490
- uuid: this.id,
1491
1473
  name: this.name,
1492
1474
  description: this.description,
1493
1475
  isMeta: this.isMeta
@@ -1498,8 +1480,10 @@ var GraphRoutine = class extends SignalParticipant {
1498
1480
  this.tasks.add(t);
1499
1481
  this.emit("meta.routine.task_added", {
1500
1482
  data: {
1501
- taskId: t.id,
1502
- routineId: this.id
1483
+ taskName: t.name,
1484
+ taskVersion: t.version,
1485
+ routineName: this.name,
1486
+ routineVersion: this.version
1503
1487
  }
1504
1488
  });
1505
1489
  });
@@ -1518,13 +1502,12 @@ var GraphRoutine = class extends SignalParticipant {
1518
1502
  await Promise.all(promises);
1519
1503
  }
1520
1504
  /**
1521
- * Sets global ID.
1522
- * @param id The ID.
1505
+ * Sets global Version.
1506
+ * @param version The Version.
1523
1507
  */
1524
- setGlobalId(id) {
1525
- const oldId = this.id;
1526
- this.id = id;
1527
- this.emit("meta.routine.global_id_set", { __id: this.id, __oldId: oldId });
1508
+ setVersion(version) {
1509
+ this.version = version;
1510
+ this.emit("meta.routine.global_version_set", { version: this.version });
1528
1511
  }
1529
1512
  // Removed emitsSignals per clarification (routines as listeners only)
1530
1513
  /**
@@ -1534,14 +1517,11 @@ var GraphRoutine = class extends SignalParticipant {
1534
1517
  this.tasks.clear();
1535
1518
  this.emit("meta.routine.destroyed", {
1536
1519
  data: { deleted: true },
1537
- filter: { uuid: this.id }
1520
+ filter: { name: this.name, version: this.version }
1538
1521
  });
1539
1522
  }
1540
1523
  };
1541
1524
 
1542
- // src/graph/definition/Task.ts
1543
- var import_uuid5 = require("uuid");
1544
-
1545
1525
  // src/graph/iterators/TaskIterator.ts
1546
1526
  var TaskIterator = class {
1547
1527
  constructor(task) {
@@ -1600,6 +1580,7 @@ var Task = class extends SignalParticipant {
1600
1580
  */
1601
1581
  constructor(name, task, description = "", concurrency = 0, timeout = 0, register = true, isUnique = false, isMeta = false, isSubMeta = false, isHidden = false, getTagCallback = void 0, inputSchema = void 0, validateInputContext = false, outputSchema = void 0, validateOutputContext = false, retryCount = 0, retryDelay = 0, retryDelayMax = 0, retryDelayFactor = 1) {
1602
1582
  super(isSubMeta || isHidden);
1583
+ this.version = 1;
1603
1584
  this.isMeta = false;
1604
1585
  this.isSubMeta = false;
1605
1586
  this.isHidden = false;
@@ -1623,7 +1604,6 @@ var Task = class extends SignalParticipant {
1623
1604
  this.onFailTasks = /* @__PURE__ */ new Set();
1624
1605
  this.predecessorTasks = /* @__PURE__ */ new Set();
1625
1606
  this.destroyed = false;
1626
- this.id = (0, import_uuid5.v4)();
1627
1607
  this.name = name;
1628
1608
  this.taskFunction = task.bind(this);
1629
1609
  this.description = description;
@@ -1649,7 +1629,6 @@ var Task = class extends SignalParticipant {
1649
1629
  const { __functionString, __getTagCallback } = this.export();
1650
1630
  this.emitWithMetadata("meta.task.created", {
1651
1631
  __task: {
1652
- uuid: this.id,
1653
1632
  name: this.name,
1654
1633
  description: this.description,
1655
1634
  functionString: __functionString,
@@ -1677,14 +1656,12 @@ var Task = class extends SignalParticipant {
1677
1656
  }
1678
1657
  }
1679
1658
  getTag(context) {
1680
- return this.id;
1659
+ return this.name;
1681
1660
  }
1682
- setGlobalId(id) {
1683
- const oldId = this.id;
1684
- this.id = id;
1685
- this.emitWithMetadata("meta.task.global_id_set", {
1686
- __id: this.id,
1687
- __oldId: oldId
1661
+ setVersion(version) {
1662
+ this.version = version;
1663
+ this.emitWithMetadata("meta.task.version_set", {
1664
+ __version: this.version
1688
1665
  });
1689
1666
  }
1690
1667
  setTimeout(timeout) {
@@ -1712,8 +1689,8 @@ var Task = class extends SignalParticipant {
1712
1689
  const data = { ...ctx };
1713
1690
  if (!this.isHidden && !this.isSubMeta) {
1714
1691
  data.__signalEmission = {
1715
- taskId: this.id,
1716
- taskName: this.name
1692
+ taskName: this.name,
1693
+ taskVersion: this.version
1717
1694
  };
1718
1695
  }
1719
1696
  this.emit(signal, data);
@@ -1722,8 +1699,8 @@ var Task = class extends SignalParticipant {
1722
1699
  const data = { ...ctx };
1723
1700
  if (!this.isHidden && !this.isSubMeta) {
1724
1701
  data.__signalEmission = {
1725
- taskId: this.id,
1726
1702
  taskName: this.name,
1703
+ taskVersion: this.version,
1727
1704
  isMetric: true
1728
1705
  };
1729
1706
  }
@@ -1846,8 +1823,8 @@ var Task = class extends SignalParticipant {
1846
1823
  );
1847
1824
  if (!validationResult.valid) {
1848
1825
  this.emitWithMetadata("meta.task.input_validation_failed", {
1849
- __taskId: this.id,
1850
1826
  __taskName: this.name,
1827
+ __taskVersion: this.version,
1851
1828
  __context: context,
1852
1829
  __errors: validationResult.errors
1853
1830
  });
@@ -1868,7 +1845,8 @@ var Task = class extends SignalParticipant {
1868
1845
  );
1869
1846
  if (!validationResult.valid) {
1870
1847
  this.emitWithMetadata("meta.task.outputValidationFailed", {
1871
- __taskId: this.id,
1848
+ __taskName: this.name,
1849
+ __taskVersion: this.version,
1872
1850
  __result: context,
1873
1851
  __errors: validationResult.errors
1874
1852
  });
@@ -1909,8 +1887,10 @@ var Task = class extends SignalParticipant {
1909
1887
  }
1910
1888
  this.emitMetricsWithMetadata("meta.task.relationship_added", {
1911
1889
  data: {
1912
- taskId: this.id,
1913
- predecessorTaskId: pred.id
1890
+ taskName: this.name,
1891
+ taskVersion: this.version,
1892
+ predecessorTaskName: pred.name,
1893
+ predecessorTaskVersion: pred.version
1914
1894
  }
1915
1895
  });
1916
1896
  }
@@ -1929,8 +1909,10 @@ var Task = class extends SignalParticipant {
1929
1909
  }
1930
1910
  this.emitMetricsWithMetadata("meta.task.relationship_added", {
1931
1911
  data: {
1932
- taskId: next.id,
1933
- predecessorTaskId: this.id
1912
+ taskName: next.name,
1913
+ taskVersion: next.version,
1914
+ predecessorTaskName: this.name,
1915
+ predecessorTaskVersion: this.version
1934
1916
  }
1935
1917
  });
1936
1918
  }
@@ -1948,25 +1930,6 @@ var Task = class extends SignalParticipant {
1948
1930
  }
1949
1931
  this.updateLayerFromPredecessors();
1950
1932
  }
1951
- doOnFail(...tasks) {
1952
- for (const task of tasks) {
1953
- if (this.onFailTasks.has(task)) continue;
1954
- this.onFailTasks.add(task);
1955
- task.predecessorTasks.add(this);
1956
- task.updateLayerFromPredecessors();
1957
- if (task.hasCycle()) {
1958
- this.decouple(task);
1959
- throw new Error(`Cycle adding onFail ${task.name} to ${this.name}`);
1960
- }
1961
- this.emitMetricsWithMetadata("meta.task.on_fail_relationship_added", {
1962
- data: {
1963
- taskId: this.id,
1964
- onFailTaskId: task.id
1965
- }
1966
- });
1967
- }
1968
- return this;
1969
- }
1970
1933
  updateProgressWeights() {
1971
1934
  const layers = this.getSubgraphLayers();
1972
1935
  const numLayers = layers.size;
@@ -2006,7 +1969,7 @@ var Task = class extends SignalParticipant {
2006
1969
  data: {
2007
1970
  layerIndex: this.layerIndex
2008
1971
  },
2009
- filter: { uuid: this.id }
1972
+ filter: { name: this.name, version: this.version }
2010
1973
  });
2011
1974
  }
2012
1975
  const queue = Array.from(this.nextTasks);
@@ -2050,12 +2013,11 @@ var Task = class extends SignalParticipant {
2050
2013
  this.destroyed = true;
2051
2014
  this.emitMetricsWithMetadata("meta.task.destroyed", {
2052
2015
  data: { deleted: true },
2053
- filter: { uuid: this.id }
2016
+ filter: { name: this.name, version: this.version }
2054
2017
  });
2055
2018
  }
2056
2019
  export() {
2057
2020
  return {
2058
- __id: this.id,
2059
2021
  __name: this.name,
2060
2022
  __description: this.description,
2061
2023
  __layerIndex: this.layerIndex,
@@ -2075,9 +2037,9 @@ var Task = class extends SignalParticipant {
2075
2037
  __validateInputContext: this.validateInputContext,
2076
2038
  __outputSchema: this.outputContextSchema,
2077
2039
  __validateOutputContext: this.validateOutputContext,
2078
- __nextTasks: Array.from(this.nextTasks).map((t) => t.id),
2079
- __onFailTasks: Array.from(this.onFailTasks).map((t) => t.id),
2080
- __previousTasks: Array.from(this.predecessorTasks).map((t) => t.id)
2040
+ __nextTasks: Array.from(this.nextTasks).map((t) => t.name),
2041
+ __onFailTasks: Array.from(this.onFailTasks).map((t) => t.name),
2042
+ __previousTasks: Array.from(this.predecessorTasks).map((t) => t.name)
2081
2043
  };
2082
2044
  }
2083
2045
  getIterator() {
@@ -2100,8 +2062,8 @@ var GraphRegistry = class _GraphRegistry {
2100
2062
  "Register task",
2101
2063
  (context) => {
2102
2064
  const { __taskInstance } = context;
2103
- if (__taskInstance && !this.tasks.has(__taskInstance.id)) {
2104
- this.tasks.set(__taskInstance.id, __taskInstance);
2065
+ if (__taskInstance && !this.tasks.has(__taskInstance.name)) {
2066
+ this.tasks.set(__taskInstance.name, __taskInstance);
2105
2067
  }
2106
2068
  delete context.__taskInstance;
2107
2069
  return true;
@@ -2113,19 +2075,7 @@ var GraphRegistry = class _GraphRegistry {
2113
2075
  false,
2114
2076
  true
2115
2077
  ).doOn("meta.task.created");
2116
- this.tasks.set(this.registerTask.id, this.registerTask);
2117
- this.updateTaskId = Cadenza.createMetaTask(
2118
- "Update task id",
2119
- (context) => {
2120
- const { __id, __oldId } = context;
2121
- const task = this.tasks.get(__oldId);
2122
- if (!task) return context;
2123
- this.tasks.set(__id, task);
2124
- this.tasks.delete(__oldId);
2125
- return context;
2126
- },
2127
- "Updates task id."
2128
- ).doOn("meta.task.global_id_set");
2078
+ this.tasks.set(this.registerTask.name, this.registerTask);
2129
2079
  this.updateTaskInputSchema = Cadenza.createMetaTask(
2130
2080
  "Update task input schema",
2131
2081
  (context) => {
@@ -2148,14 +2098,6 @@ var GraphRegistry = class _GraphRegistry {
2148
2098
  },
2149
2099
  "Updates task input schema."
2150
2100
  ).doOn("meta.task.output_schema_updated");
2151
- this.getTaskById = Cadenza.createMetaTask(
2152
- "Get task by id",
2153
- (context) => {
2154
- const { __id } = context;
2155
- return { ...context, __task: this.tasks.get(__id) };
2156
- },
2157
- "Gets task by id."
2158
- );
2159
2101
  this.getTaskByName = Cadenza.createMetaTask(
2160
2102
  "Get task by name",
2161
2103
  (context) => {
@@ -2199,8 +2141,8 @@ var GraphRegistry = class _GraphRegistry {
2199
2141
  this.deleteTask = Cadenza.createMetaTask(
2200
2142
  "Delete task",
2201
2143
  (context) => {
2202
- const { __id } = context;
2203
- this.tasks.delete(__id);
2144
+ const { __name } = context;
2145
+ this.tasks.delete(__name);
2204
2146
  return context;
2205
2147
  },
2206
2148
  "Deletes task."
@@ -2209,34 +2151,14 @@ var GraphRegistry = class _GraphRegistry {
2209
2151
  "Register routine",
2210
2152
  (context) => {
2211
2153
  const { __routineInstance } = context;
2212
- if (__routineInstance && !this.routines.has(__routineInstance.id)) {
2213
- this.routines.set(__routineInstance.id, __routineInstance);
2154
+ if (__routineInstance && !this.routines.has(__routineInstance.name)) {
2155
+ this.routines.set(__routineInstance.name, __routineInstance);
2214
2156
  }
2215
2157
  delete context.__routineInstance;
2216
2158
  return true;
2217
2159
  },
2218
2160
  "Registers routine."
2219
2161
  ).doOn("meta.routine.created");
2220
- this.updateRoutineId = Cadenza.createMetaTask(
2221
- "Update routine id",
2222
- (context) => {
2223
- const { __id, __oldId } = context;
2224
- const routine = this.routines.get(__oldId);
2225
- if (!routine) return context;
2226
- this.routines.set(__id, routine);
2227
- this.routines.delete(__oldId);
2228
- return context;
2229
- },
2230
- "Updates routine id."
2231
- ).doOn("meta.routine.global_id_set");
2232
- this.getRoutineById = Cadenza.createMetaTask(
2233
- "Get routine by id",
2234
- (context) => {
2235
- const { __id } = context;
2236
- return { ...context, routine: this.routines.get(__id) };
2237
- },
2238
- "Gets routine by id."
2239
- );
2240
2162
  this.getRoutineByName = Cadenza.createMetaTask(
2241
2163
  "Get routine by name",
2242
2164
  (context) => {
@@ -2271,8 +2193,8 @@ var GraphRegistry = class _GraphRegistry {
2271
2193
  this.deleteRoutine = Cadenza.createMetaTask(
2272
2194
  "Delete routine",
2273
2195
  (context) => {
2274
- const { __id } = context;
2275
- this.routines.delete(__id);
2196
+ const { __name } = context;
2197
+ this.routines.delete(__name);
2276
2198
  return context;
2277
2199
  },
2278
2200
  "Deletes routine."
@@ -2285,7 +2207,6 @@ var GraphRegistry = class _GraphRegistry {
2285
2207
  reset() {
2286
2208
  this.tasks.clear();
2287
2209
  this.routines.clear();
2288
- this.tasks.set(this.registerTask.id, this.registerTask);
2289
2210
  }
2290
2211
  };
2291
2212
 
@@ -2302,7 +2223,6 @@ var GraphRunner = class extends SignalEmitter {
2302
2223
  this.verbose = false;
2303
2224
  this.isRunning = false;
2304
2225
  this.isMeta = false;
2305
- this.id = (0, import_uuid6.v4)();
2306
2226
  this.isMeta = isMeta;
2307
2227
  this.strategy = Cadenza.runStrategy.PARALLEL;
2308
2228
  this.currentRun = new GraphRun(this.strategy);
@@ -2334,13 +2254,13 @@ var GraphRunner = class extends SignalEmitter {
2334
2254
  return;
2335
2255
  }
2336
2256
  let routineName = _tasks.map((t) => t.name).join(" | ");
2257
+ let routineVersion = null;
2337
2258
  let isMeta = _tasks.every((t) => t.isMeta);
2338
- let routineId = null;
2339
2259
  const allTasks = _tasks.flatMap((t) => {
2340
2260
  if (t instanceof GraphRoutine) {
2341
2261
  routineName = t.name;
2262
+ routineVersion = t.version;
2342
2263
  isMeta = t.isMeta;
2343
- routineId = t.id;
2344
2264
  const routineTasks = [];
2345
2265
  t.forEachTask((task) => routineTasks.push(task));
2346
2266
  return routineTasks;
@@ -2350,15 +2270,15 @@ var GraphRunner = class extends SignalEmitter {
2350
2270
  const isSubMeta = allTasks.some((t) => t.isSubMeta) || !!context.__isSubMeta;
2351
2271
  context.__isSubMeta = isSubMeta;
2352
2272
  const ctx = new GraphContext(context || {});
2353
- const routineExecId = (_a = context.__routineExecId) != null ? _a : (0, import_uuid6.v4)();
2273
+ const routineExecId = (_a = context.__routineExecId) != null ? _a : (0, import_uuid4.v4)();
2354
2274
  context.__routineExecId = routineExecId;
2355
2275
  if (!isSubMeta) {
2356
2276
  this.emitMetrics("meta.runner.added_tasks", {
2357
2277
  data: {
2358
2278
  uuid: routineExecId,
2359
2279
  name: routineName,
2280
+ routineVersion,
2360
2281
  isMeta,
2361
- routineId,
2362
2282
  contractId: (_d = (_c = (_b = context.__metadata) == null ? void 0 : _b.__contractId) != null ? _c : context.__contractId) != null ? _d : null,
2363
2283
  context: ctx.export(),
2364
2284
  previousRoutineExecution: (_f = (_e = context.__metadata) == null ? void 0 : _e.__routineExecId) != null ? _f : null,