yaml-flow 4.0.0 → 5.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.
Files changed (95) hide show
  1. package/browser/board-livegraph-runtime.js +1453 -0
  2. package/browser/board-livegraph-runtime.js.map +1 -0
  3. package/browser/card-compute.js +36 -17
  4. package/browser/live-cards.js +848 -109
  5. package/browser/live-cards.schema.json +46 -21
  6. package/dist/board-livegraph-runtime/index.cjs +1448 -0
  7. package/dist/board-livegraph-runtime/index.cjs.map +1 -0
  8. package/dist/board-livegraph-runtime/index.d.cts +101 -0
  9. package/dist/board-livegraph-runtime/index.d.ts +101 -0
  10. package/dist/board-livegraph-runtime/index.js +1441 -0
  11. package/dist/board-livegraph-runtime/index.js.map +1 -0
  12. package/dist/card-compute/index.cjs +159 -44
  13. package/dist/card-compute/index.cjs.map +1 -1
  14. package/dist/card-compute/index.d.cts +36 -11
  15. package/dist/card-compute/index.d.ts +36 -11
  16. package/dist/card-compute/index.js +156 -44
  17. package/dist/card-compute/index.js.map +1 -1
  18. package/dist/cli/board-live-cards-cli.cjs +476 -105
  19. package/dist/cli/board-live-cards-cli.cjs.map +1 -1
  20. package/dist/cli/board-live-cards-cli.d.cts +8 -16
  21. package/dist/cli/board-live-cards-cli.d.ts +8 -16
  22. package/dist/cli/board-live-cards-cli.js +476 -106
  23. package/dist/cli/board-live-cards-cli.js.map +1 -1
  24. package/dist/continuous-event-graph/index.cjs +74 -33
  25. package/dist/continuous-event-graph/index.cjs.map +1 -1
  26. package/dist/continuous-event-graph/index.d.cts +7 -23
  27. package/dist/continuous-event-graph/index.d.ts +7 -23
  28. package/dist/continuous-event-graph/index.js +73 -32
  29. package/dist/continuous-event-graph/index.js.map +1 -1
  30. package/dist/index.cjs +1440 -56
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +21 -3
  33. package/dist/index.d.ts +21 -3
  34. package/dist/index.js +1434 -56
  35. package/dist/index.js.map +1 -1
  36. package/dist/journal-DRfJiheM.d.cts +28 -0
  37. package/dist/journal-NLYuqege.d.ts +28 -0
  38. package/dist/{journal-B_2JnBMF.d.ts → live-cards-bridge-Or7fdEJV.d.ts} +5 -32
  39. package/dist/{journal-BJDjWb5Q.d.cts → live-cards-bridge-vGJ6tMzN.d.cts} +5 -32
  40. package/dist/schedule-CMcZe5Ny.d.ts +21 -0
  41. package/dist/schedule-CiucyCan.d.cts +21 -0
  42. package/examples/browser/boards/portfolio-tracker/cards/holdings-table.json +1 -1
  43. package/examples/browser/boards/portfolio-tracker/cards/portfolio-form.json +3 -3
  44. package/examples/browser/boards/portfolio-tracker/cards/portfolio-value.json +1 -1
  45. package/examples/browser/boards/portfolio-tracker/cards/price-fetch.json +3 -3
  46. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-task-executor.cjs +96 -0
  47. package/examples/browser/boards/portfolio-tracker/portfolio-tracker.js +33 -5
  48. package/examples/browser/livecards-browser/index.html +37 -684
  49. package/examples/cli/step-machine-cli/portfolio-tracker/cards/holdings-table.json +1 -1
  50. package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +3 -3
  51. package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +1 -1
  52. package/examples/cli/step-machine-cli/portfolio-tracker/cards/price-fetch.json +3 -3
  53. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +2 -2
  54. package/examples/example-board/board.yaml +23 -0
  55. package/examples/example-board/bootstrap_payload.json +1 -0
  56. package/examples/example-board/cards/card-chain-region-alert.json +39 -0
  57. package/examples/example-board/cards/card-chain-region-totals.json +26 -0
  58. package/examples/example-board/cards/card-chain-top-region.json +24 -0
  59. package/examples/example-board/cards/card-ex-actions.json +32 -0
  60. package/examples/example-board/cards/card-ex-chart.json +30 -0
  61. package/examples/example-board/cards/card-ex-filter.json +36 -0
  62. package/examples/example-board/cards/card-ex-filtered-by-preference.json +59 -0
  63. package/examples/example-board/cards/card-ex-form.json +91 -0
  64. package/examples/example-board/cards/card-ex-list.json +22 -0
  65. package/examples/example-board/cards/card-ex-markdown.json +17 -0
  66. package/examples/example-board/cards/card-ex-metric.json +19 -0
  67. package/examples/example-board/cards/card-ex-narrative.json +36 -0
  68. package/examples/example-board/cards/card-ex-source-http.json +28 -0
  69. package/examples/example-board/cards/card-ex-source.json +21 -0
  70. package/examples/example-board/cards/card-ex-status.json +35 -0
  71. package/examples/example-board/cards/card-ex-table.json +30 -0
  72. package/examples/example-board/cards/card-ex-todo.json +29 -0
  73. package/examples/example-board/demo-chat-handler.js +69 -0
  74. package/examples/example-board/demo-server.js +87 -0
  75. package/examples/example-board/demo-shell-browser.html +806 -0
  76. package/examples/example-board/demo-shell-with-server.html +280 -0
  77. package/examples/example-board/demo-shell.html +62 -0
  78. package/examples/example-board/demo-task-executor.js +255 -0
  79. package/examples/example-board/mock.db +15 -0
  80. package/examples/example-board/reusable-board-runtime-client.js +265 -0
  81. package/examples/example-board/reusable-runtime-artifacts-adapter.js +233 -0
  82. package/examples/example-board/reusable-server-runtime.js +1284 -0
  83. package/examples/index.html +16 -9
  84. package/examples/npm-libs/continuous-event-graph/live-cards-board.ts +17 -17
  85. package/examples/npm-libs/continuous-event-graph/live-portfolio-dashboard.ts +23 -23
  86. package/examples/step-machine-cli/portfolio-tracker/cards/holdings-table.json +1 -1
  87. package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +3 -3
  88. package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +1 -1
  89. package/examples/step-machine-cli/portfolio-tracker/cards/price-fetch.json +1 -1
  90. package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker-task-executor.cjs +96 -0
  91. package/package.json +16 -2
  92. package/schema/card-runtime.schema.json +25 -0
  93. package/schema/live-cards.schema.json +46 -21
  94. package/browser/ingest-board.js +0 -296
  95. package/examples/ingest.js +0 -733
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import addFormats from 'ajv-formats';
2
- import { createHash } from 'crypto';
3
2
  import { exec, execFile } from 'child_process';
4
- import jsonata from 'jsonata';
3
+ import jsonata2 from 'jsonata';
5
4
 
6
5
  var __create = Object.create;
7
6
  var __defProp = Object.defineProperty;
@@ -6414,6 +6413,814 @@ var require_ajv = __commonJS({
6414
6413
  }
6415
6414
  });
6416
6415
 
6416
+ // node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js
6417
+ var require_dynamicAnchor = __commonJS({
6418
+ "node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js"(exports$1) {
6419
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6420
+ exports$1.dynamicAnchor = void 0;
6421
+ var codegen_1 = require_codegen();
6422
+ var names_1 = require_names();
6423
+ var compile_1 = require_compile();
6424
+ var ref_1 = require_ref();
6425
+ var def = {
6426
+ keyword: "$dynamicAnchor",
6427
+ schemaType: "string",
6428
+ code: (cxt) => dynamicAnchor(cxt, cxt.schema)
6429
+ };
6430
+ function dynamicAnchor(cxt, anchor) {
6431
+ const { gen, it } = cxt;
6432
+ it.schemaEnv.root.dynamicAnchors[anchor] = true;
6433
+ const v = (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`;
6434
+ const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt);
6435
+ gen.if((0, codegen_1._)`!${v}`, () => gen.assign(v, validate));
6436
+ }
6437
+ exports$1.dynamicAnchor = dynamicAnchor;
6438
+ function _getValidate(cxt) {
6439
+ const { schemaEnv, schema, self } = cxt.it;
6440
+ const { root, baseId, localRefs, meta } = schemaEnv.root;
6441
+ const { schemaId } = self.opts;
6442
+ const sch = new compile_1.SchemaEnv({ schema, schemaId, root, baseId, localRefs, meta });
6443
+ compile_1.compileSchema.call(self, sch);
6444
+ return (0, ref_1.getValidate)(cxt, sch);
6445
+ }
6446
+ exports$1.default = def;
6447
+ }
6448
+ });
6449
+
6450
+ // node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js
6451
+ var require_dynamicRef = __commonJS({
6452
+ "node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js"(exports$1) {
6453
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6454
+ exports$1.dynamicRef = void 0;
6455
+ var codegen_1 = require_codegen();
6456
+ var names_1 = require_names();
6457
+ var ref_1 = require_ref();
6458
+ var def = {
6459
+ keyword: "$dynamicRef",
6460
+ schemaType: "string",
6461
+ code: (cxt) => dynamicRef(cxt, cxt.schema)
6462
+ };
6463
+ function dynamicRef(cxt, ref) {
6464
+ const { gen, keyword, it } = cxt;
6465
+ if (ref[0] !== "#")
6466
+ throw new Error(`"${keyword}" only supports hash fragment reference`);
6467
+ const anchor = ref.slice(1);
6468
+ if (it.allErrors) {
6469
+ _dynamicRef();
6470
+ } else {
6471
+ const valid = gen.let("valid", false);
6472
+ _dynamicRef(valid);
6473
+ cxt.ok(valid);
6474
+ }
6475
+ function _dynamicRef(valid) {
6476
+ if (it.schemaEnv.root.dynamicAnchors[anchor]) {
6477
+ const v = gen.let("_v", (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`);
6478
+ gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid));
6479
+ } else {
6480
+ _callRef(it.validateName, valid)();
6481
+ }
6482
+ }
6483
+ function _callRef(validate, valid) {
6484
+ return valid ? () => gen.block(() => {
6485
+ (0, ref_1.callRef)(cxt, validate);
6486
+ gen.let(valid, true);
6487
+ }) : () => (0, ref_1.callRef)(cxt, validate);
6488
+ }
6489
+ }
6490
+ exports$1.dynamicRef = dynamicRef;
6491
+ exports$1.default = def;
6492
+ }
6493
+ });
6494
+
6495
+ // node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js
6496
+ var require_recursiveAnchor = __commonJS({
6497
+ "node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js"(exports$1) {
6498
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6499
+ var dynamicAnchor_1 = require_dynamicAnchor();
6500
+ var util_1 = require_util();
6501
+ var def = {
6502
+ keyword: "$recursiveAnchor",
6503
+ schemaType: "boolean",
6504
+ code(cxt) {
6505
+ if (cxt.schema)
6506
+ (0, dynamicAnchor_1.dynamicAnchor)(cxt, "");
6507
+ else
6508
+ (0, util_1.checkStrictMode)(cxt.it, "$recursiveAnchor: false is ignored");
6509
+ }
6510
+ };
6511
+ exports$1.default = def;
6512
+ }
6513
+ });
6514
+
6515
+ // node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js
6516
+ var require_recursiveRef = __commonJS({
6517
+ "node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js"(exports$1) {
6518
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6519
+ var dynamicRef_1 = require_dynamicRef();
6520
+ var def = {
6521
+ keyword: "$recursiveRef",
6522
+ schemaType: "string",
6523
+ code: (cxt) => (0, dynamicRef_1.dynamicRef)(cxt, cxt.schema)
6524
+ };
6525
+ exports$1.default = def;
6526
+ }
6527
+ });
6528
+
6529
+ // node_modules/ajv/dist/vocabularies/dynamic/index.js
6530
+ var require_dynamic = __commonJS({
6531
+ "node_modules/ajv/dist/vocabularies/dynamic/index.js"(exports$1) {
6532
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6533
+ var dynamicAnchor_1 = require_dynamicAnchor();
6534
+ var dynamicRef_1 = require_dynamicRef();
6535
+ var recursiveAnchor_1 = require_recursiveAnchor();
6536
+ var recursiveRef_1 = require_recursiveRef();
6537
+ var dynamic = [dynamicAnchor_1.default, dynamicRef_1.default, recursiveAnchor_1.default, recursiveRef_1.default];
6538
+ exports$1.default = dynamic;
6539
+ }
6540
+ });
6541
+
6542
+ // node_modules/ajv/dist/vocabularies/validation/dependentRequired.js
6543
+ var require_dependentRequired = __commonJS({
6544
+ "node_modules/ajv/dist/vocabularies/validation/dependentRequired.js"(exports$1) {
6545
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6546
+ var dependencies_1 = require_dependencies();
6547
+ var def = {
6548
+ keyword: "dependentRequired",
6549
+ type: "object",
6550
+ schemaType: "object",
6551
+ error: dependencies_1.error,
6552
+ code: (cxt) => (0, dependencies_1.validatePropertyDeps)(cxt)
6553
+ };
6554
+ exports$1.default = def;
6555
+ }
6556
+ });
6557
+
6558
+ // node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js
6559
+ var require_dependentSchemas = __commonJS({
6560
+ "node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js"(exports$1) {
6561
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6562
+ var dependencies_1 = require_dependencies();
6563
+ var def = {
6564
+ keyword: "dependentSchemas",
6565
+ type: "object",
6566
+ schemaType: "object",
6567
+ code: (cxt) => (0, dependencies_1.validateSchemaDeps)(cxt)
6568
+ };
6569
+ exports$1.default = def;
6570
+ }
6571
+ });
6572
+
6573
+ // node_modules/ajv/dist/vocabularies/validation/limitContains.js
6574
+ var require_limitContains = __commonJS({
6575
+ "node_modules/ajv/dist/vocabularies/validation/limitContains.js"(exports$1) {
6576
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6577
+ var util_1 = require_util();
6578
+ var def = {
6579
+ keyword: ["maxContains", "minContains"],
6580
+ type: "array",
6581
+ schemaType: "number",
6582
+ code({ keyword, parentSchema, it }) {
6583
+ if (parentSchema.contains === void 0) {
6584
+ (0, util_1.checkStrictMode)(it, `"${keyword}" without "contains" is ignored`);
6585
+ }
6586
+ }
6587
+ };
6588
+ exports$1.default = def;
6589
+ }
6590
+ });
6591
+
6592
+ // node_modules/ajv/dist/vocabularies/next.js
6593
+ var require_next = __commonJS({
6594
+ "node_modules/ajv/dist/vocabularies/next.js"(exports$1) {
6595
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6596
+ var dependentRequired_1 = require_dependentRequired();
6597
+ var dependentSchemas_1 = require_dependentSchemas();
6598
+ var limitContains_1 = require_limitContains();
6599
+ var next2 = [dependentRequired_1.default, dependentSchemas_1.default, limitContains_1.default];
6600
+ exports$1.default = next2;
6601
+ }
6602
+ });
6603
+
6604
+ // node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js
6605
+ var require_unevaluatedProperties = __commonJS({
6606
+ "node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js"(exports$1) {
6607
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6608
+ var codegen_1 = require_codegen();
6609
+ var util_1 = require_util();
6610
+ var names_1 = require_names();
6611
+ var error = {
6612
+ message: "must NOT have unevaluated properties",
6613
+ params: ({ params }) => (0, codegen_1._)`{unevaluatedProperty: ${params.unevaluatedProperty}}`
6614
+ };
6615
+ var def = {
6616
+ keyword: "unevaluatedProperties",
6617
+ type: "object",
6618
+ schemaType: ["boolean", "object"],
6619
+ trackErrors: true,
6620
+ error,
6621
+ code(cxt) {
6622
+ const { gen, schema, data, errsCount, it } = cxt;
6623
+ if (!errsCount)
6624
+ throw new Error("ajv implementation error");
6625
+ const { allErrors, props } = it;
6626
+ if (props instanceof codegen_1.Name) {
6627
+ gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key))));
6628
+ } else if (props !== true) {
6629
+ gen.forIn("key", data, (key) => props === void 0 ? unevaluatedPropCode(key) : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)));
6630
+ }
6631
+ it.props = true;
6632
+ cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
6633
+ function unevaluatedPropCode(key) {
6634
+ if (schema === false) {
6635
+ cxt.setParams({ unevaluatedProperty: key });
6636
+ cxt.error();
6637
+ if (!allErrors)
6638
+ gen.break();
6639
+ return;
6640
+ }
6641
+ if (!(0, util_1.alwaysValidSchema)(it, schema)) {
6642
+ const valid = gen.name("valid");
6643
+ cxt.subschema({
6644
+ keyword: "unevaluatedProperties",
6645
+ dataProp: key,
6646
+ dataPropType: util_1.Type.Str
6647
+ }, valid);
6648
+ if (!allErrors)
6649
+ gen.if((0, codegen_1.not)(valid), () => gen.break());
6650
+ }
6651
+ }
6652
+ function unevaluatedDynamic(evaluatedProps, key) {
6653
+ return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key}]`;
6654
+ }
6655
+ function unevaluatedStatic(evaluatedProps, key) {
6656
+ const ps = [];
6657
+ for (const p in evaluatedProps) {
6658
+ if (evaluatedProps[p] === true)
6659
+ ps.push((0, codegen_1._)`${key} !== ${p}`);
6660
+ }
6661
+ return (0, codegen_1.and)(...ps);
6662
+ }
6663
+ }
6664
+ };
6665
+ exports$1.default = def;
6666
+ }
6667
+ });
6668
+
6669
+ // node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js
6670
+ var require_unevaluatedItems = __commonJS({
6671
+ "node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js"(exports$1) {
6672
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6673
+ var codegen_1 = require_codegen();
6674
+ var util_1 = require_util();
6675
+ var error = {
6676
+ message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
6677
+ params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
6678
+ };
6679
+ var def = {
6680
+ keyword: "unevaluatedItems",
6681
+ type: "array",
6682
+ schemaType: ["boolean", "object"],
6683
+ error,
6684
+ code(cxt) {
6685
+ const { gen, schema, data, it } = cxt;
6686
+ const items = it.items || 0;
6687
+ if (items === true)
6688
+ return;
6689
+ const len = gen.const("len", (0, codegen_1._)`${data}.length`);
6690
+ if (schema === false) {
6691
+ cxt.setParams({ len: items });
6692
+ cxt.fail((0, codegen_1._)`${len} > ${items}`);
6693
+ } else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
6694
+ const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items}`);
6695
+ gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items));
6696
+ cxt.ok(valid);
6697
+ }
6698
+ it.items = true;
6699
+ function validateItems(valid, from) {
6700
+ gen.forRange("i", from, len, (i) => {
6701
+ cxt.subschema({ keyword: "unevaluatedItems", dataProp: i, dataPropType: util_1.Type.Num }, valid);
6702
+ if (!it.allErrors)
6703
+ gen.if((0, codegen_1.not)(valid), () => gen.break());
6704
+ });
6705
+ }
6706
+ }
6707
+ };
6708
+ exports$1.default = def;
6709
+ }
6710
+ });
6711
+
6712
+ // node_modules/ajv/dist/vocabularies/unevaluated/index.js
6713
+ var require_unevaluated = __commonJS({
6714
+ "node_modules/ajv/dist/vocabularies/unevaluated/index.js"(exports$1) {
6715
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6716
+ var unevaluatedProperties_1 = require_unevaluatedProperties();
6717
+ var unevaluatedItems_1 = require_unevaluatedItems();
6718
+ var unevaluated = [unevaluatedProperties_1.default, unevaluatedItems_1.default];
6719
+ exports$1.default = unevaluated;
6720
+ }
6721
+ });
6722
+
6723
+ // node_modules/ajv/dist/vocabularies/draft2020.js
6724
+ var require_draft2020 = __commonJS({
6725
+ "node_modules/ajv/dist/vocabularies/draft2020.js"(exports$1) {
6726
+ Object.defineProperty(exports$1, "__esModule", { value: true });
6727
+ var core_1 = require_core2();
6728
+ var validation_1 = require_validation();
6729
+ var applicator_1 = require_applicator();
6730
+ var dynamic_1 = require_dynamic();
6731
+ var next_1 = require_next();
6732
+ var unevaluated_1 = require_unevaluated();
6733
+ var format_1 = require_format2();
6734
+ var metadata_1 = require_metadata();
6735
+ var draft2020Vocabularies = [
6736
+ dynamic_1.default,
6737
+ core_1.default,
6738
+ validation_1.default,
6739
+ (0, applicator_1.default)(true),
6740
+ format_1.default,
6741
+ metadata_1.metadataVocabulary,
6742
+ metadata_1.contentVocabulary,
6743
+ next_1.default,
6744
+ unevaluated_1.default
6745
+ ];
6746
+ exports$1.default = draft2020Vocabularies;
6747
+ }
6748
+ });
6749
+
6750
+ // node_modules/ajv/dist/refs/json-schema-2020-12/schema.json
6751
+ var require_schema = __commonJS({
6752
+ "node_modules/ajv/dist/refs/json-schema-2020-12/schema.json"(exports$1, module) {
6753
+ module.exports = {
6754
+ $schema: "https://json-schema.org/draft/2020-12/schema",
6755
+ $id: "https://json-schema.org/draft/2020-12/schema",
6756
+ $vocabulary: {
6757
+ "https://json-schema.org/draft/2020-12/vocab/core": true,
6758
+ "https://json-schema.org/draft/2020-12/vocab/applicator": true,
6759
+ "https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
6760
+ "https://json-schema.org/draft/2020-12/vocab/validation": true,
6761
+ "https://json-schema.org/draft/2020-12/vocab/meta-data": true,
6762
+ "https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
6763
+ "https://json-schema.org/draft/2020-12/vocab/content": true
6764
+ },
6765
+ $dynamicAnchor: "meta",
6766
+ title: "Core and Validation specifications meta-schema",
6767
+ allOf: [
6768
+ { $ref: "meta/core" },
6769
+ { $ref: "meta/applicator" },
6770
+ { $ref: "meta/unevaluated" },
6771
+ { $ref: "meta/validation" },
6772
+ { $ref: "meta/meta-data" },
6773
+ { $ref: "meta/format-annotation" },
6774
+ { $ref: "meta/content" }
6775
+ ],
6776
+ type: ["object", "boolean"],
6777
+ $comment: "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",
6778
+ properties: {
6779
+ definitions: {
6780
+ $comment: '"definitions" has been replaced by "$defs".',
6781
+ type: "object",
6782
+ additionalProperties: { $dynamicRef: "#meta" },
6783
+ deprecated: true,
6784
+ default: {}
6785
+ },
6786
+ dependencies: {
6787
+ $comment: '"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',
6788
+ type: "object",
6789
+ additionalProperties: {
6790
+ anyOf: [{ $dynamicRef: "#meta" }, { $ref: "meta/validation#/$defs/stringArray" }]
6791
+ },
6792
+ deprecated: true,
6793
+ default: {}
6794
+ },
6795
+ $recursiveAnchor: {
6796
+ $comment: '"$recursiveAnchor" has been replaced by "$dynamicAnchor".',
6797
+ $ref: "meta/core#/$defs/anchorString",
6798
+ deprecated: true
6799
+ },
6800
+ $recursiveRef: {
6801
+ $comment: '"$recursiveRef" has been replaced by "$dynamicRef".',
6802
+ $ref: "meta/core#/$defs/uriReferenceString",
6803
+ deprecated: true
6804
+ }
6805
+ }
6806
+ };
6807
+ }
6808
+ });
6809
+
6810
+ // node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json
6811
+ var require_applicator2 = __commonJS({
6812
+ "node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json"(exports$1, module) {
6813
+ module.exports = {
6814
+ $schema: "https://json-schema.org/draft/2020-12/schema",
6815
+ $id: "https://json-schema.org/draft/2020-12/meta/applicator",
6816
+ $vocabulary: {
6817
+ "https://json-schema.org/draft/2020-12/vocab/applicator": true
6818
+ },
6819
+ $dynamicAnchor: "meta",
6820
+ title: "Applicator vocabulary meta-schema",
6821
+ type: ["object", "boolean"],
6822
+ properties: {
6823
+ prefixItems: { $ref: "#/$defs/schemaArray" },
6824
+ items: { $dynamicRef: "#meta" },
6825
+ contains: { $dynamicRef: "#meta" },
6826
+ additionalProperties: { $dynamicRef: "#meta" },
6827
+ properties: {
6828
+ type: "object",
6829
+ additionalProperties: { $dynamicRef: "#meta" },
6830
+ default: {}
6831
+ },
6832
+ patternProperties: {
6833
+ type: "object",
6834
+ additionalProperties: { $dynamicRef: "#meta" },
6835
+ propertyNames: { format: "regex" },
6836
+ default: {}
6837
+ },
6838
+ dependentSchemas: {
6839
+ type: "object",
6840
+ additionalProperties: { $dynamicRef: "#meta" },
6841
+ default: {}
6842
+ },
6843
+ propertyNames: { $dynamicRef: "#meta" },
6844
+ if: { $dynamicRef: "#meta" },
6845
+ then: { $dynamicRef: "#meta" },
6846
+ else: { $dynamicRef: "#meta" },
6847
+ allOf: { $ref: "#/$defs/schemaArray" },
6848
+ anyOf: { $ref: "#/$defs/schemaArray" },
6849
+ oneOf: { $ref: "#/$defs/schemaArray" },
6850
+ not: { $dynamicRef: "#meta" }
6851
+ },
6852
+ $defs: {
6853
+ schemaArray: {
6854
+ type: "array",
6855
+ minItems: 1,
6856
+ items: { $dynamicRef: "#meta" }
6857
+ }
6858
+ }
6859
+ };
6860
+ }
6861
+ });
6862
+
6863
+ // node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json
6864
+ var require_unevaluated2 = __commonJS({
6865
+ "node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json"(exports$1, module) {
6866
+ module.exports = {
6867
+ $schema: "https://json-schema.org/draft/2020-12/schema",
6868
+ $id: "https://json-schema.org/draft/2020-12/meta/unevaluated",
6869
+ $vocabulary: {
6870
+ "https://json-schema.org/draft/2020-12/vocab/unevaluated": true
6871
+ },
6872
+ $dynamicAnchor: "meta",
6873
+ title: "Unevaluated applicator vocabulary meta-schema",
6874
+ type: ["object", "boolean"],
6875
+ properties: {
6876
+ unevaluatedItems: { $dynamicRef: "#meta" },
6877
+ unevaluatedProperties: { $dynamicRef: "#meta" }
6878
+ }
6879
+ };
6880
+ }
6881
+ });
6882
+
6883
+ // node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json
6884
+ var require_content = __commonJS({
6885
+ "node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json"(exports$1, module) {
6886
+ module.exports = {
6887
+ $schema: "https://json-schema.org/draft/2020-12/schema",
6888
+ $id: "https://json-schema.org/draft/2020-12/meta/content",
6889
+ $vocabulary: {
6890
+ "https://json-schema.org/draft/2020-12/vocab/content": true
6891
+ },
6892
+ $dynamicAnchor: "meta",
6893
+ title: "Content vocabulary meta-schema",
6894
+ type: ["object", "boolean"],
6895
+ properties: {
6896
+ contentEncoding: { type: "string" },
6897
+ contentMediaType: { type: "string" },
6898
+ contentSchema: { $dynamicRef: "#meta" }
6899
+ }
6900
+ };
6901
+ }
6902
+ });
6903
+
6904
+ // node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json
6905
+ var require_core3 = __commonJS({
6906
+ "node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json"(exports$1, module) {
6907
+ module.exports = {
6908
+ $schema: "https://json-schema.org/draft/2020-12/schema",
6909
+ $id: "https://json-schema.org/draft/2020-12/meta/core",
6910
+ $vocabulary: {
6911
+ "https://json-schema.org/draft/2020-12/vocab/core": true
6912
+ },
6913
+ $dynamicAnchor: "meta",
6914
+ title: "Core vocabulary meta-schema",
6915
+ type: ["object", "boolean"],
6916
+ properties: {
6917
+ $id: {
6918
+ $ref: "#/$defs/uriReferenceString",
6919
+ $comment: "Non-empty fragments not allowed.",
6920
+ pattern: "^[^#]*#?$"
6921
+ },
6922
+ $schema: { $ref: "#/$defs/uriString" },
6923
+ $ref: { $ref: "#/$defs/uriReferenceString" },
6924
+ $anchor: { $ref: "#/$defs/anchorString" },
6925
+ $dynamicRef: { $ref: "#/$defs/uriReferenceString" },
6926
+ $dynamicAnchor: { $ref: "#/$defs/anchorString" },
6927
+ $vocabulary: {
6928
+ type: "object",
6929
+ propertyNames: { $ref: "#/$defs/uriString" },
6930
+ additionalProperties: {
6931
+ type: "boolean"
6932
+ }
6933
+ },
6934
+ $comment: {
6935
+ type: "string"
6936
+ },
6937
+ $defs: {
6938
+ type: "object",
6939
+ additionalProperties: { $dynamicRef: "#meta" }
6940
+ }
6941
+ },
6942
+ $defs: {
6943
+ anchorString: {
6944
+ type: "string",
6945
+ pattern: "^[A-Za-z_][-A-Za-z0-9._]*$"
6946
+ },
6947
+ uriString: {
6948
+ type: "string",
6949
+ format: "uri"
6950
+ },
6951
+ uriReferenceString: {
6952
+ type: "string",
6953
+ format: "uri-reference"
6954
+ }
6955
+ }
6956
+ };
6957
+ }
6958
+ });
6959
+
6960
+ // node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json
6961
+ var require_format_annotation = __commonJS({
6962
+ "node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json"(exports$1, module) {
6963
+ module.exports = {
6964
+ $schema: "https://json-schema.org/draft/2020-12/schema",
6965
+ $id: "https://json-schema.org/draft/2020-12/meta/format-annotation",
6966
+ $vocabulary: {
6967
+ "https://json-schema.org/draft/2020-12/vocab/format-annotation": true
6968
+ },
6969
+ $dynamicAnchor: "meta",
6970
+ title: "Format vocabulary meta-schema for annotation results",
6971
+ type: ["object", "boolean"],
6972
+ properties: {
6973
+ format: { type: "string" }
6974
+ }
6975
+ };
6976
+ }
6977
+ });
6978
+
6979
+ // node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json
6980
+ var require_meta_data = __commonJS({
6981
+ "node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json"(exports$1, module) {
6982
+ module.exports = {
6983
+ $schema: "https://json-schema.org/draft/2020-12/schema",
6984
+ $id: "https://json-schema.org/draft/2020-12/meta/meta-data",
6985
+ $vocabulary: {
6986
+ "https://json-schema.org/draft/2020-12/vocab/meta-data": true
6987
+ },
6988
+ $dynamicAnchor: "meta",
6989
+ title: "Meta-data vocabulary meta-schema",
6990
+ type: ["object", "boolean"],
6991
+ properties: {
6992
+ title: {
6993
+ type: "string"
6994
+ },
6995
+ description: {
6996
+ type: "string"
6997
+ },
6998
+ default: true,
6999
+ deprecated: {
7000
+ type: "boolean",
7001
+ default: false
7002
+ },
7003
+ readOnly: {
7004
+ type: "boolean",
7005
+ default: false
7006
+ },
7007
+ writeOnly: {
7008
+ type: "boolean",
7009
+ default: false
7010
+ },
7011
+ examples: {
7012
+ type: "array",
7013
+ items: true
7014
+ }
7015
+ }
7016
+ };
7017
+ }
7018
+ });
7019
+
7020
+ // node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json
7021
+ var require_validation2 = __commonJS({
7022
+ "node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json"(exports$1, module) {
7023
+ module.exports = {
7024
+ $schema: "https://json-schema.org/draft/2020-12/schema",
7025
+ $id: "https://json-schema.org/draft/2020-12/meta/validation",
7026
+ $vocabulary: {
7027
+ "https://json-schema.org/draft/2020-12/vocab/validation": true
7028
+ },
7029
+ $dynamicAnchor: "meta",
7030
+ title: "Validation vocabulary meta-schema",
7031
+ type: ["object", "boolean"],
7032
+ properties: {
7033
+ type: {
7034
+ anyOf: [
7035
+ { $ref: "#/$defs/simpleTypes" },
7036
+ {
7037
+ type: "array",
7038
+ items: { $ref: "#/$defs/simpleTypes" },
7039
+ minItems: 1,
7040
+ uniqueItems: true
7041
+ }
7042
+ ]
7043
+ },
7044
+ const: true,
7045
+ enum: {
7046
+ type: "array",
7047
+ items: true
7048
+ },
7049
+ multipleOf: {
7050
+ type: "number",
7051
+ exclusiveMinimum: 0
7052
+ },
7053
+ maximum: {
7054
+ type: "number"
7055
+ },
7056
+ exclusiveMaximum: {
7057
+ type: "number"
7058
+ },
7059
+ minimum: {
7060
+ type: "number"
7061
+ },
7062
+ exclusiveMinimum: {
7063
+ type: "number"
7064
+ },
7065
+ maxLength: { $ref: "#/$defs/nonNegativeInteger" },
7066
+ minLength: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
7067
+ pattern: {
7068
+ type: "string",
7069
+ format: "regex"
7070
+ },
7071
+ maxItems: { $ref: "#/$defs/nonNegativeInteger" },
7072
+ minItems: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
7073
+ uniqueItems: {
7074
+ type: "boolean",
7075
+ default: false
7076
+ },
7077
+ maxContains: { $ref: "#/$defs/nonNegativeInteger" },
7078
+ minContains: {
7079
+ $ref: "#/$defs/nonNegativeInteger",
7080
+ default: 1
7081
+ },
7082
+ maxProperties: { $ref: "#/$defs/nonNegativeInteger" },
7083
+ minProperties: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
7084
+ required: { $ref: "#/$defs/stringArray" },
7085
+ dependentRequired: {
7086
+ type: "object",
7087
+ additionalProperties: {
7088
+ $ref: "#/$defs/stringArray"
7089
+ }
7090
+ }
7091
+ },
7092
+ $defs: {
7093
+ nonNegativeInteger: {
7094
+ type: "integer",
7095
+ minimum: 0
7096
+ },
7097
+ nonNegativeIntegerDefault0: {
7098
+ $ref: "#/$defs/nonNegativeInteger",
7099
+ default: 0
7100
+ },
7101
+ simpleTypes: {
7102
+ enum: ["array", "boolean", "integer", "null", "number", "object", "string"]
7103
+ },
7104
+ stringArray: {
7105
+ type: "array",
7106
+ items: { type: "string" },
7107
+ uniqueItems: true,
7108
+ default: []
7109
+ }
7110
+ }
7111
+ };
7112
+ }
7113
+ });
7114
+
7115
+ // node_modules/ajv/dist/refs/json-schema-2020-12/index.js
7116
+ var require_json_schema_2020_12 = __commonJS({
7117
+ "node_modules/ajv/dist/refs/json-schema-2020-12/index.js"(exports$1) {
7118
+ Object.defineProperty(exports$1, "__esModule", { value: true });
7119
+ var metaSchema = require_schema();
7120
+ var applicator = require_applicator2();
7121
+ var unevaluated = require_unevaluated2();
7122
+ var content = require_content();
7123
+ var core = require_core3();
7124
+ var format = require_format_annotation();
7125
+ var metadata = require_meta_data();
7126
+ var validation = require_validation2();
7127
+ var META_SUPPORT_DATA = ["/properties"];
7128
+ function addMetaSchema2020($data) {
7129
+ [
7130
+ metaSchema,
7131
+ applicator,
7132
+ unevaluated,
7133
+ content,
7134
+ core,
7135
+ with$data(this, format),
7136
+ metadata,
7137
+ with$data(this, validation)
7138
+ ].forEach((sch) => this.addMetaSchema(sch, void 0, false));
7139
+ return this;
7140
+ function with$data(ajv, sch) {
7141
+ return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch;
7142
+ }
7143
+ }
7144
+ exports$1.default = addMetaSchema2020;
7145
+ }
7146
+ });
7147
+
7148
+ // node_modules/ajv/dist/2020.js
7149
+ var require__ = __commonJS({
7150
+ "node_modules/ajv/dist/2020.js"(exports$1, module) {
7151
+ Object.defineProperty(exports$1, "__esModule", { value: true });
7152
+ exports$1.MissingRefError = exports$1.ValidationError = exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = exports$1.Ajv2020 = void 0;
7153
+ var core_1 = require_core();
7154
+ var draft2020_1 = require_draft2020();
7155
+ var discriminator_1 = require_discriminator();
7156
+ var json_schema_2020_12_1 = require_json_schema_2020_12();
7157
+ var META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema";
7158
+ var Ajv20202 = class extends core_1.default {
7159
+ constructor(opts = {}) {
7160
+ super({
7161
+ ...opts,
7162
+ dynamicRef: true,
7163
+ next: true,
7164
+ unevaluated: true
7165
+ });
7166
+ }
7167
+ _addVocabularies() {
7168
+ super._addVocabularies();
7169
+ draft2020_1.default.forEach((v) => this.addVocabulary(v));
7170
+ if (this.opts.discriminator)
7171
+ this.addKeyword(discriminator_1.default);
7172
+ }
7173
+ _addDefaultMetaSchema() {
7174
+ super._addDefaultMetaSchema();
7175
+ const { $data, meta } = this.opts;
7176
+ if (!meta)
7177
+ return;
7178
+ json_schema_2020_12_1.default.call(this, $data);
7179
+ this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
7180
+ }
7181
+ defaultMeta() {
7182
+ return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : void 0);
7183
+ }
7184
+ };
7185
+ exports$1.Ajv2020 = Ajv20202;
7186
+ module.exports = exports$1 = Ajv20202;
7187
+ module.exports.Ajv2020 = Ajv20202;
7188
+ Object.defineProperty(exports$1, "__esModule", { value: true });
7189
+ exports$1.default = Ajv20202;
7190
+ var validate_1 = require_validate();
7191
+ Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function() {
7192
+ return validate_1.KeywordCxt;
7193
+ } });
7194
+ var codegen_1 = require_codegen();
7195
+ Object.defineProperty(exports$1, "_", { enumerable: true, get: function() {
7196
+ return codegen_1._;
7197
+ } });
7198
+ Object.defineProperty(exports$1, "str", { enumerable: true, get: function() {
7199
+ return codegen_1.str;
7200
+ } });
7201
+ Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function() {
7202
+ return codegen_1.stringify;
7203
+ } });
7204
+ Object.defineProperty(exports$1, "nil", { enumerable: true, get: function() {
7205
+ return codegen_1.nil;
7206
+ } });
7207
+ Object.defineProperty(exports$1, "Name", { enumerable: true, get: function() {
7208
+ return codegen_1.Name;
7209
+ } });
7210
+ Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function() {
7211
+ return codegen_1.CodeGen;
7212
+ } });
7213
+ var validation_error_1 = require_validation_error();
7214
+ Object.defineProperty(exports$1, "ValidationError", { enumerable: true, get: function() {
7215
+ return validation_error_1.default;
7216
+ } });
7217
+ var ref_error_1 = require_ref_error();
7218
+ Object.defineProperty(exports$1, "MissingRefError", { enumerable: true, get: function() {
7219
+ return ref_error_1.default;
7220
+ } });
7221
+ }
7222
+ });
7223
+
6417
7224
  // src/step-machine/reducer.ts
6418
7225
  function applyStepResult(flow, state, stepName, stepResult) {
6419
7226
  const stepConfig = flow.steps[stepName];
@@ -10064,9 +10871,11 @@ var MemoryJournal = class {
10064
10871
  return this.buffer.length;
10065
10872
  }
10066
10873
  };
10874
+
10875
+ // src/continuous-event-graph/reactive.ts
10067
10876
  function computeDataHash(data) {
10068
10877
  const json = stableStringify(data);
10069
- return createHash("sha256").update(json).digest("hex").slice(0, 16);
10878
+ return fnv1a64Hex(json);
10070
10879
  }
10071
10880
  function stableStringify(value) {
10072
10881
  if (value === null || value === void 0 || typeof value !== "object") {
@@ -10079,13 +10888,49 @@ function stableStringify(value) {
10079
10888
  const keys = Object.keys(obj).sort();
10080
10889
  return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
10081
10890
  }
10891
+ function fnv1a64Hex(input) {
10892
+ let hash = 0xcbf29ce484222325n;
10893
+ const prime = 0x100000001b3n;
10894
+ const mod = 0xffffffffffffffffn;
10895
+ for (let i = 0; i < input.length; i++) {
10896
+ hash ^= BigInt(input.charCodeAt(i));
10897
+ hash = hash * prime & mod;
10898
+ }
10899
+ return hash.toString(16).padStart(16, "0");
10900
+ }
10901
+ function base64UrlEncode(input) {
10902
+ if (typeof Buffer !== "undefined") {
10903
+ return Buffer.from(input, "utf8").toString("base64url");
10904
+ }
10905
+ if (typeof btoa === "function") {
10906
+ const bytes = new TextEncoder().encode(input);
10907
+ let binary = "";
10908
+ for (const b of bytes) binary += String.fromCharCode(b);
10909
+ return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
10910
+ }
10911
+ throw new Error("No base64 encoder available in this runtime");
10912
+ }
10913
+ function base64UrlDecode(input) {
10914
+ if (typeof Buffer !== "undefined") {
10915
+ return Buffer.from(input, "base64url").toString("utf8");
10916
+ }
10917
+ if (typeof atob === "function") {
10918
+ const base64 = input.replace(/-/g, "+").replace(/_/g, "/");
10919
+ const padded = base64 + "=".repeat((4 - base64.length % 4) % 4);
10920
+ const binary = atob(padded);
10921
+ const bytes = new Uint8Array(binary.length);
10922
+ for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
10923
+ return new TextDecoder().decode(bytes);
10924
+ }
10925
+ throw new Error("No base64 decoder available in this runtime");
10926
+ }
10082
10927
  function encodeCallbackToken(taskName) {
10083
10928
  const payload = JSON.stringify({ t: taskName, n: Date.now().toString(36) + Math.random().toString(36).slice(2, 6) });
10084
- return Buffer.from(payload).toString("base64url");
10929
+ return base64UrlEncode(payload);
10085
10930
  }
10086
10931
  function decodeCallbackToken(token) {
10087
10932
  try {
10088
- const payload = JSON.parse(Buffer.from(token, "base64url").toString());
10933
+ const payload = JSON.parse(base64UrlDecode(token));
10089
10934
  if (typeof payload?.t === "string") return { taskName: payload.t };
10090
10935
  return null;
10091
10936
  } catch {
@@ -10695,13 +11540,11 @@ function createNoopHandler(getResolve, staticData) {
10695
11540
  var live_cards_schema_default = {
10696
11541
  $schema: "http://json-schema.org/draft-07/schema#",
10697
11542
  $id: "https://nsreehari.github.io/boards/live-cards.schema.json",
10698
- title: "LiveCards Node Schema",
10699
- description: "Schema for Card and ExternalSource nodes in the LiveCards Board/Canvas engine",
10700
11543
  definitions: {
10701
11544
  bind_ref: {
10702
- description: "A state path reference, e.g. 'state.raw_quotes' or 'requires.upstream'",
11545
+ description: "A card data path reference, e.g. 'card_data.raw_quotes' or 'requires.upstream'",
10703
11546
  type: "string",
10704
- pattern: "^(state|requires|computed_values)\\."
11547
+ pattern: "^(card_data|requires|fetched_sources|computed_values)(\\.|$)"
10705
11548
  },
10706
11549
  bind_or_literal: {
10707
11550
  description: "A literal value or a bind reference object",
@@ -10770,7 +11613,7 @@ var live_cards_schema_default = {
10770
11613
  ]
10771
11614
  },
10772
11615
  input: {
10773
- description: "state.path, literal, array of inputs, or nested compute_expr",
11616
+ description: "card_data.path, literal, array of inputs, or nested compute_expr",
10774
11617
  oneOf: [
10775
11618
  { type: "string" },
10776
11619
  { type: "number" },
@@ -10806,18 +11649,18 @@ var live_cards_schema_default = {
10806
11649
  required: ["bindTo", "src"],
10807
11650
  properties: {
10808
11651
  bindTo: { type: "string", description: "Token name published downstream" },
10809
- src: { type: "string", description: "Path to read value from (state.*, requires.*, computed_values.*)" }
11652
+ src: { type: "string", description: "Path to read value from (card_data.*, requires.*, fetched_sources.*, computed_values.*)" }
10810
11653
  }
10811
11654
  },
10812
- description: "Explicit bindings exposing computed/state values downstream as named tokens"
11655
+ description: "Explicit bindings exposing computed or card_data values downstream as named tokens"
10813
11656
  },
10814
11657
  compute_step: {
10815
- description: "A single ordered compute step: reads state.*/requires.*/computed_values.*, writes to computed_values[bindTo]",
11658
+ description: "A single ordered compute step: reads card_data.*/requires.*/computed_values.*, writes to computed_values[bindTo]",
10816
11659
  type: "object",
10817
11660
  required: ["bindTo", "expr"],
10818
11661
  properties: {
10819
11662
  bindTo: { type: "string", description: "Key in computed_values to write result" },
10820
- expr: { type: "string", description: "JSONata expression evaluated against { state, requires, sources, computed_values }" }
11663
+ expr: { type: "string", description: "JSONata expression evaluated against { card_data, requires, fetched_sources, computed_values }" }
10821
11664
  }
10822
11665
  },
10823
11666
  source_def: {
@@ -10826,7 +11669,7 @@ var live_cards_schema_default = {
10826
11669
  required: ["bindTo"],
10827
11670
  additionalProperties: true,
10828
11671
  properties: {
10829
- bindTo: { type: "string", description: "Key under sources.* available in compute expressions" },
11672
+ bindTo: { type: "string", description: "Key under fetched_sources.* available in compute expressions" },
10830
11673
  outputFile: { type: "string", description: "Board-relative path the executor writes its JSON result to. Presence of this file signals delivery." },
10831
11674
  optionalForCompletionGating: { type: "boolean", default: false, description: "When true this source does not gate card completion. Default false when absent, so sources are completion-gating by default." },
10832
11675
  timeout: { type: "integer", minimum: 0, default: 12e4, description: "Executor/script timeout in ms. Default: 120 000 (2 min)." },
@@ -10854,19 +11697,17 @@ var live_cards_schema_default = {
10854
11697
  "text",
10855
11698
  "markdown",
10856
11699
  "custom",
10857
- "file-upload",
10858
- "chat",
10859
11700
  "actions"
10860
11701
  ]
10861
11702
  },
10862
11703
  label: { type: "string", description: "Heading above this element" },
10863
11704
  className: { type: "string", description: "Bootstrap grid class, e.g. 'col-12 col-md-6'" },
10864
- visible: { type: "string", description: "state path \u2014 element shown only if truthy" },
11705
+ visible: { type: "string", description: "card_data/requires/fetched_sources/computed_values path \u2014 element shown only if truthy" },
10865
11706
  data: {
10866
11707
  type: "object",
10867
11708
  properties: {
10868
- bind: { $ref: "#/definitions/bind_ref", description: "state path to read data from" },
10869
- writeTo: { $ref: "#/definitions/bind_ref", description: "state path for user input (form, filter, todo, notes)" },
11709
+ bind: { $ref: "#/definitions/bind_ref", description: "card_data/requires/fetched_sources/computed_values path to read data from" },
11710
+ writeTo: { $ref: "#/definitions/bind_ref", description: "card_data path for user input (form, filter, todo, notes)" },
10870
11711
  columns: { type: "array", items: { type: "string" }, description: "table: visible columns" },
10871
11712
  maxRows: { type: "integer", description: "table/list: max rows to display" },
10872
11713
  sortable: { type: "boolean", default: true, description: "table: enable click-to-sort" },
@@ -10899,7 +11740,7 @@ var live_cards_schema_default = {
10899
11740
  label: { type: "string" },
10900
11741
  style: { type: "string", description: "Bootstrap button variant, e.g. 'success', 'outline-danger'" },
10901
11742
  size: { type: "string", default: "sm" },
10902
- disabled: { oneOf: [{ type: "boolean" }, { type: "string", description: "state path \u2014 truthy = disabled" }] }
11743
+ disabled: { oneOf: [{ type: "boolean" }, { type: "string", description: "card_data/requires/fetched_sources/computed_values path \u2014 truthy = disabled" }] }
10903
11744
  }
10904
11745
  }
10905
11746
  }
@@ -10959,14 +11800,39 @@ var live_cards_schema_default = {
10959
11800
  provides: { $ref: "#/definitions/provides" },
10960
11801
  meta: { $ref: "#/definitions/meta" },
10961
11802
  view: { $ref: "#/definitions/view" },
10962
- state: {
11803
+ card_data: {
10963
11804
  type: "object",
10964
- additionalProperties: true,
11805
+ description: "Authored card data supplied in the card definition",
10965
11806
  properties: {
10966
- status: { enum: ["fresh", "stale", "loading", "error"] },
10967
- lastRun: { type: "string", format: "date-time" },
10968
- error: { type: "string" }
10969
- }
11807
+ files: {
11808
+ type: "array",
11809
+ description: "Optional uploaded-file metadata maintained by host handlers. Stored name is normalized and serial-prefixed (for example 001-my_file.pdf).",
11810
+ items: {
11811
+ type: "object",
11812
+ required: ["name", "stored_name"],
11813
+ properties: {
11814
+ name: { type: "string", minLength: 1 },
11815
+ stored_name: {
11816
+ type: "string",
11817
+ minLength: 5,
11818
+ maxLength: 32,
11819
+ pattern: "^[0-9]{3,}-[a-z0-9._-]+$"
11820
+ },
11821
+ size: {
11822
+ oneOf: [
11823
+ { type: "integer", minimum: 0 },
11824
+ { type: "null" }
11825
+ ]
11826
+ },
11827
+ mime_type: { type: "string" },
11828
+ path: { type: "string", pattern: "^[^\\s]+/files/[0-9]{3,}-[a-z0-9._-]+$" },
11829
+ uploaded_at: { type: "string", format: "date-time" }
11830
+ },
11831
+ additionalProperties: false
11832
+ }
11833
+ }
11834
+ },
11835
+ additionalProperties: true
10970
11836
  },
10971
11837
  sources: {
10972
11838
  type: "array",
@@ -10975,7 +11841,7 @@ var live_cards_schema_default = {
10975
11841
  },
10976
11842
  compute: {
10977
11843
  type: "array",
10978
- description: "Ordered array of compute steps. Each reads state.*/requires.*/sources.*/computed_values.* and writes to ephemeral computed_values[bindTo].",
11844
+ description: "Ordered array of compute steps. Each reads card_data.*/requires.*/fetched_sources.*/computed_values.* and writes to ephemeral computed_values[bindTo].",
10979
11845
  items: { $ref: "#/definitions/compute_step" }
10980
11846
  }
10981
11847
  }
@@ -10984,6 +11850,57 @@ var live_cards_schema_default = {
10984
11850
  // src/card-compute/schema-validator.ts
10985
11851
  var import_ajv3 = __toESM(require_ajv());
10986
11852
  var _compiled3 = null;
11853
+ var NAMESPACE_REFERENCE_RE = /\b(card_data|requires|fetched_sources|computed_values|sources)\b/g;
11854
+ var ROOT_PATH_NAMESPACE_RE = /^\s*(card_data|requires|fetched_sources|computed_values|sources)(\.|$)/;
11855
+ function referencedNamespaces(expression) {
11856
+ const namespaces = /* @__PURE__ */ new Set();
11857
+ let match;
11858
+ NAMESPACE_REFERENCE_RE.lastIndex = 0;
11859
+ while ((match = NAMESPACE_REFERENCE_RE.exec(expression)) !== null) {
11860
+ namespaces.add(match[1]);
11861
+ }
11862
+ return namespaces;
11863
+ }
11864
+ function parseRootPathNamespace(pathValue) {
11865
+ const match = ROOT_PATH_NAMESPACE_RE.exec(pathValue);
11866
+ return match ? match[1] : null;
11867
+ }
11868
+ function validateJsonataExprWithNamespaces(expr, path, allowedNamespaces, errors) {
11869
+ try {
11870
+ jsonata2(expr);
11871
+ } catch (err) {
11872
+ const message = err instanceof Error ? err.message : String(err);
11873
+ errors.push(`${path}: invalid JSONata expression (${message})`);
11874
+ return;
11875
+ }
11876
+ const usedNamespaces = referencedNamespaces(expr);
11877
+ for (const namespace of usedNamespaces) {
11878
+ if (!allowedNamespaces.has(namespace)) {
11879
+ errors.push(`${path}: disallowed namespace "${namespace}" in expression`);
11880
+ }
11881
+ }
11882
+ }
11883
+ function walkViewPathReferences(value, path, errors) {
11884
+ if (Array.isArray(value)) {
11885
+ value.forEach((entry, index) => {
11886
+ walkViewPathReferences(entry, `${path}/${index}`, errors);
11887
+ });
11888
+ return;
11889
+ }
11890
+ if (typeof value === "string") {
11891
+ const rootNamespace = parseRootPathNamespace(value);
11892
+ if (!rootNamespace) return;
11893
+ if (!(/* @__PURE__ */ new Set(["card_data", "requires", "fetched_sources", "computed_values"])).has(rootNamespace)) {
11894
+ errors.push(`${path}: disallowed namespace "${rootNamespace}" in view reference`);
11895
+ }
11896
+ return;
11897
+ }
11898
+ if (!value || typeof value !== "object") return;
11899
+ const record = value;
11900
+ for (const [key, next2] of Object.entries(record)) {
11901
+ walkViewPathReferences(next2, `${path}/${key}`, errors);
11902
+ }
11903
+ }
10987
11904
  function getValidator3() {
10988
11905
  if (_compiled3) return _compiled3;
10989
11906
  const ajv = new import_ajv3.default({ allErrors: true });
@@ -11001,6 +11918,42 @@ function validateLiveCardSchema(node) {
11001
11918
  });
11002
11919
  return { ok: false, errors };
11003
11920
  }
11921
+ function validateLiveCardRuntimeExpressions(node) {
11922
+ const errors = [];
11923
+ if (!node || typeof node !== "object" || Array.isArray(node)) {
11924
+ return { ok: true, errors: [] };
11925
+ }
11926
+ const asRecord = node;
11927
+ const compute = asRecord.compute;
11928
+ if (Array.isArray(compute)) {
11929
+ compute.forEach((step, i) => {
11930
+ if (!step || typeof step !== "object" || Array.isArray(step)) return;
11931
+ const expr = step.expr;
11932
+ if (typeof expr !== "string" || expr.trim().length === 0) return;
11933
+ validateJsonataExprWithNamespaces(
11934
+ expr,
11935
+ `/compute/${i}/expr`,
11936
+ /* @__PURE__ */ new Set(["card_data", "requires", "fetched_sources", "computed_values"]),
11937
+ errors
11938
+ );
11939
+ });
11940
+ }
11941
+ const view = asRecord.view;
11942
+ if (view && typeof view === "object" && !Array.isArray(view)) {
11943
+ walkViewPathReferences(view, "/view", errors);
11944
+ }
11945
+ return { ok: errors.length === 0, errors };
11946
+ }
11947
+ function validateLiveCard(node) {
11948
+ return validateLiveCardDefinition(node);
11949
+ }
11950
+ function validateLiveCardDefinition(node) {
11951
+ const schema = validateLiveCardSchema(node);
11952
+ if (!schema.ok) return schema;
11953
+ const runtime = validateLiveCardRuntimeExpressions(node);
11954
+ if (!runtime.ok) return { ok: false, errors: runtime.errors };
11955
+ return { ok: true, errors: [] };
11956
+ }
11004
11957
 
11005
11958
  // src/card-compute/index.ts
11006
11959
  function deepGet(obj, path) {
@@ -11024,18 +11977,18 @@ function deepSet(obj, path, value) {
11024
11977
  }
11025
11978
  async function run(node, options) {
11026
11979
  if (!node?.compute?.length) return node;
11027
- if (!node.state) node.state = {};
11980
+ if (!node.card_data) node.card_data = {};
11028
11981
  node.computed_values = {};
11029
11982
  node._sourcesData = options?.sourcesData ?? {};
11030
11983
  const ctx = {
11031
- state: node.state,
11984
+ card_data: node.card_data,
11032
11985
  requires: node.requires ?? {},
11033
- sources: node._sourcesData,
11986
+ fetched_sources: node._sourcesData,
11034
11987
  computed_values: node.computed_values
11035
11988
  };
11036
11989
  for (const step of node.compute) {
11037
11990
  try {
11038
- const val = await jsonata(step.expr).evaluate(ctx);
11991
+ const val = await jsonata2(step.expr).evaluate(ctx);
11039
11992
  deepSet(node.computed_values, step.bindTo, val);
11040
11993
  ctx.computed_values = node.computed_values;
11041
11994
  } catch (err) {
@@ -11046,16 +11999,16 @@ async function run(node, options) {
11046
11999
  }
11047
12000
  async function evalExpr(expr, node) {
11048
12001
  const ctx = {
11049
- state: node.state ?? {},
12002
+ card_data: node.card_data ?? {},
11050
12003
  requires: node.requires ?? {},
11051
- sources: node._sourcesData ?? {},
12004
+ fetched_sources: node._sourcesData ?? {},
11052
12005
  computed_values: node.computed_values ?? {}
11053
12006
  };
11054
- return jsonata(expr).evaluate(ctx);
12007
+ return jsonata2(expr).evaluate(ctx);
11055
12008
  }
11056
12009
  function resolve(node, path) {
11057
- if (path.startsWith("sources.")) {
11058
- return deepGet(node._sourcesData ?? {}, path.slice("sources.".length));
12010
+ if (path.startsWith("fetched_sources.")) {
12011
+ return deepGet(node._sourcesData ?? {}, path.slice("fetched_sources.".length));
11059
12012
  }
11060
12013
  return deepGet(node, path);
11061
12014
  }
@@ -11075,8 +12028,7 @@ var VALID_ELEMENT_KINDS = /* @__PURE__ */ new Set([
11075
12028
  "markdown",
11076
12029
  "custom"
11077
12030
  ]);
11078
- var VALID_STATUSES = /* @__PURE__ */ new Set(["fresh", "stale", "loading", "error"]);
11079
- var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "state", "compute", "sources"]);
12031
+ var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "card_data", "compute", "sources"]);
11080
12032
  function validateNode(node) {
11081
12033
  const errors = [];
11082
12034
  if (!node || typeof node !== "object" || Array.isArray(node)) {
@@ -11087,13 +12039,8 @@ function validateNode(node) {
11087
12039
  for (const key of Object.keys(n)) {
11088
12040
  if (!ALLOWED_KEYS.has(key)) errors.push(`Unknown top-level key: "${key}"`);
11089
12041
  }
11090
- if (n.state == null || typeof n.state !== "object" || Array.isArray(n.state)) {
11091
- errors.push("state: required, must be an object");
11092
- } else {
11093
- const state = n.state;
11094
- if (state.status != null && !VALID_STATUSES.has(state.status)) {
11095
- errors.push(`state.status: must be one of: ${[...VALID_STATUSES].join(", ")}`);
11096
- }
12042
+ if (n.card_data == null || typeof n.card_data !== "object" || Array.isArray(n.card_data)) {
12043
+ errors.push("card_data: required, must be an object");
11097
12044
  }
11098
12045
  if (n.meta != null) {
11099
12046
  if (typeof n.meta !== "object" || Array.isArray(n.meta)) {
@@ -11182,11 +12129,21 @@ function validateNode(node) {
11182
12129
  }
11183
12130
  return { ok: errors.length === 0, errors };
11184
12131
  }
12132
+ function enrichSources(sources, context) {
12133
+ if (!sources || sources.length === 0) return [];
12134
+ return sources.map((src) => ({
12135
+ ...src,
12136
+ _requires: context.requires ?? {},
12137
+ _sourcesData: context.sourcesData ?? {},
12138
+ _computed_values: context.computed_values ?? {}
12139
+ }));
12140
+ }
11185
12141
  var CardCompute = {
11186
12142
  run,
11187
12143
  eval: evalExpr,
11188
12144
  resolve,
11189
- validate: validateNode
12145
+ validate: validateNode,
12146
+ enrichSources
11190
12147
  };
11191
12148
 
11192
12149
  // src/continuous-event-graph/live-cards-bridge.ts
@@ -11222,7 +12179,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
11222
12179
  const allTokens = /* @__PURE__ */ new Set();
11223
12180
  const tokenToCardId = /* @__PURE__ */ new Map();
11224
12181
  for (const card of cards) {
11225
- for (const binding of card.provides ?? [{ bindTo: card.id, src: `state.${card.id}` }]) {
12182
+ for (const binding of card.provides ?? [{ bindTo: card.id, src: "card_data" }]) {
11226
12183
  allTokens.add(binding.bindTo);
11227
12184
  tokenToCardId.set(binding.bindTo, card.id);
11228
12185
  }
@@ -11236,7 +12193,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
11236
12193
  }
11237
12194
  tasks[card.id] = {
11238
12195
  requires: requires.length > 0 ? requires : void 0,
11239
- provides: (card.provides ?? [{ bindTo: card.id, src: `state.${card.id}` }]).map((p) => p.bindTo),
12196
+ provides: (card.provides ?? [{ bindTo: card.id, src: "card_data" }]).map((p) => p.bindTo),
11240
12197
  taskHandlers: [card.id],
11241
12198
  description: card.meta?.title ?? card.id
11242
12199
  };
@@ -11288,9 +12245,9 @@ function buildSourceHandler(card, sourceHandlers, defaultSourceHandler, sharedSt
11288
12245
  };
11289
12246
  }
11290
12247
  return async (input) => {
11291
- const state = { ...card.state };
11292
- sharedState.set(card.id, state);
11293
- getResolve()(input.callbackToken, state);
12248
+ const data = { ...card.card_data };
12249
+ sharedState.set(card.id, data);
12250
+ getResolve()(input.callbackToken, data);
11294
12251
  return "task-initiated";
11295
12252
  };
11296
12253
  }
@@ -11313,7 +12270,7 @@ function buildCardHandler(card, cardHandlers, sharedState, _cardMap, tokenToCard
11313
12270
  }
11314
12271
  const computeNode = {
11315
12272
  id: card.id,
11316
- state: { ...card.state },
12273
+ card_data: { ...card.card_data },
11317
12274
  requires: requiresData,
11318
12275
  compute: card.compute
11319
12276
  };
@@ -11325,15 +12282,252 @@ function buildCardHandler(card, cardHandlers, sharedState, _cardMap, tokenToCard
11325
12282
  resultData[bindTo] = CardCompute.resolve(computeNode, src);
11326
12283
  }
11327
12284
  } else {
11328
- resultData = { ...computeNode.state, ...computeNode.computed_values };
12285
+ resultData = { ...computeNode.card_data, ...computeNode.computed_values };
11329
12286
  }
11330
- const resultState = { ...computeNode.state, ...computeNode.computed_values };
12287
+ const resultState = { ...computeNode.card_data, ...computeNode.computed_values };
11331
12288
  sharedState.set(card.id, resultState);
11332
12289
  getResolve()(input.callbackToken, resultData);
11333
12290
  return "task-initiated";
11334
12291
  };
11335
12292
  }
11336
12293
 
12294
+ // src/board-livegraph-runtime/index.ts
12295
+ function deepClone(value) {
12296
+ return JSON.parse(JSON.stringify(value));
12297
+ }
12298
+ function toTaskConfig(card) {
12299
+ const provides = card.provides && card.provides.length > 0 ? card.provides.map((p) => p.bindTo) : [card.id];
12300
+ return {
12301
+ requires: card.requires && card.requires.length > 0 ? [...card.requires] : void 0,
12302
+ provides,
12303
+ taskHandlers: [card.id],
12304
+ description: card.meta?.title ?? card.id
12305
+ };
12306
+ }
12307
+ function buildTokenProviders(cards) {
12308
+ const tokenToCardId = /* @__PURE__ */ new Map();
12309
+ for (const [cardId, card] of cards.entries()) {
12310
+ const bindings = card.provides && card.provides.length > 0 ? card.provides : [{ bindTo: cardId, src: "card_data" }];
12311
+ for (const binding of bindings) tokenToCardId.set(binding.bindTo, cardId);
12312
+ }
12313
+ return tokenToCardId;
12314
+ }
12315
+ function validateRequires(cards, changedCardId) {
12316
+ const tokenProviders = buildTokenProviders(cards);
12317
+ const card = cards.get(changedCardId);
12318
+ if (!card) return;
12319
+ for (const req of card.requires ?? []) {
12320
+ if (!tokenProviders.has(req)) {
12321
+ throw new Error(`Card "${changedCardId}" requires token "${req}" but no card provides it`);
12322
+ }
12323
+ }
12324
+ }
12325
+ function createBoardLiveGraphRuntime(input, options = {}) {
12326
+ const boardMeta = Array.isArray(input) ? {} : {
12327
+ id: input.id,
12328
+ title: input.title,
12329
+ mode: input.mode,
12330
+ positions: input.positions,
12331
+ settings: input.settings
12332
+ };
12333
+ const initialCards = Array.isArray(input) ? input : input.nodes;
12334
+ const cards = /* @__PURE__ */ new Map();
12335
+ for (const card of initialCards) {
12336
+ if (cards.has(card.id)) throw new Error(`Duplicate card ID: "${card.id}"`);
12337
+ cards.set(card.id, deepClone(card));
12338
+ }
12339
+ const listeners = /* @__PURE__ */ new Set();
12340
+ const taskExecutor = options.taskExecutor;
12341
+ const sourceAdapters = options.sourceAdapters ?? {};
12342
+ const defaultSourceAdapter = options.defaultSourceAdapter;
12343
+ let graphRef = null;
12344
+ const notifyListeners = (events, graph2) => {
12345
+ const update = {
12346
+ events,
12347
+ graph: graph2,
12348
+ nodes: getRenderableNodes()
12349
+ };
12350
+ for (const listener of listeners) listener(update);
12351
+ };
12352
+ const makeHandler = (cardId) => {
12353
+ return async (inputArgs) => {
12354
+ const card = cards.get(cardId);
12355
+ if (!card) return "task-initiate-failure";
12356
+ const requiresData = {};
12357
+ for (const token of card.requires ?? []) {
12358
+ const upstream = inputArgs.state[token];
12359
+ if (!upstream || typeof upstream !== "object") continue;
12360
+ const providesData2 = upstream.provides_data;
12361
+ if (!providesData2 || typeof providesData2 !== "object") continue;
12362
+ if (!Object.prototype.hasOwnProperty.call(providesData2, token)) continue;
12363
+ requiresData[token] = providesData2[token];
12364
+ }
12365
+ const sourcesData = {};
12366
+ if (card.sources && card.sources.length > 0) {
12367
+ const adapter = sourceAdapters[cardId] ?? defaultSourceAdapter;
12368
+ const fetched = taskExecutor ? await taskExecutor({ card, input: inputArgs }) : adapter ? await adapter({ card, input: inputArgs }) : void 0;
12369
+ if (fetched && typeof fetched === "object") {
12370
+ for (const src of card.sources) {
12371
+ if (Object.prototype.hasOwnProperty.call(fetched, src.bindTo)) {
12372
+ sourcesData[src.bindTo] = fetched[src.bindTo];
12373
+ } else if (card.sources.length === 1) {
12374
+ sourcesData[src.bindTo] = fetched;
12375
+ }
12376
+ }
12377
+ }
12378
+ }
12379
+ const computeNode = {
12380
+ id: card.id,
12381
+ card_data: deepClone(card.card_data ?? {}),
12382
+ requires: requiresData,
12383
+ sources: card.sources,
12384
+ compute: card.compute
12385
+ };
12386
+ computeNode._sourcesData = sourcesData;
12387
+ if (computeNode.compute && computeNode.compute.length > 0) {
12388
+ await CardCompute.run(computeNode, { sourcesData });
12389
+ }
12390
+ const providesData = {};
12391
+ if (card.provides && card.provides.length > 0) {
12392
+ for (const { bindTo, src } of card.provides) {
12393
+ providesData[bindTo] = CardCompute.resolve(computeNode, src);
12394
+ }
12395
+ } else {
12396
+ providesData[card.id] = {
12397
+ ...computeNode.card_data ?? {},
12398
+ ...computeNode.computed_values ?? {},
12399
+ ...computeNode._sourcesData ?? {}
12400
+ };
12401
+ }
12402
+ const resultData = {
12403
+ provides_data: providesData,
12404
+ card_data: computeNode.card_data ?? {},
12405
+ computed_values: computeNode.computed_values ?? {},
12406
+ fetched_sources: sourcesData,
12407
+ requires: requiresData
12408
+ };
12409
+ graphRef?.resolveCallback(inputArgs.callbackToken, resultData);
12410
+ return "task-initiated";
12411
+ };
12412
+ };
12413
+ const tasks = {};
12414
+ const handlers = {};
12415
+ for (const [cardId, card] of cards.entries()) {
12416
+ validateRequires(cards, cardId);
12417
+ tasks[cardId] = toTaskConfig(card);
12418
+ handlers[cardId] = makeHandler(cardId);
12419
+ }
12420
+ const config = {
12421
+ id: boardMeta.id ?? `browser-board-${Date.now()}`,
12422
+ settings: {
12423
+ completion: "manual",
12424
+ execution_mode: "eligibility-mode",
12425
+ ...boardMeta.settings ?? {},
12426
+ ...options.graphSettings ?? {}
12427
+ },
12428
+ tasks
12429
+ };
12430
+ const userOnDrain = options.reactiveOptions?.onDrain;
12431
+ const graph = createReactiveGraph(
12432
+ config,
12433
+ {
12434
+ ...options.reactiveOptions ?? {},
12435
+ handlers,
12436
+ onDrain: (events, live, scheduleResult) => {
12437
+ userOnDrain?.(events, live, scheduleResult);
12438
+ notifyListeners(events, live);
12439
+ }
12440
+ },
12441
+ options.executionId
12442
+ );
12443
+ graphRef = graph;
12444
+ function getRenderableNodes() {
12445
+ const live = graph.getState();
12446
+ const out = [];
12447
+ for (const [cardId, baseCard] of cards.entries()) {
12448
+ const data = live.state.tasks[cardId]?.data;
12449
+ const runtimeState = live.state.tasks[cardId];
12450
+ const mergedCardData = {
12451
+ ...baseCard.card_data ?? {},
12452
+ ...data && typeof data.card_data === "object" ? data.card_data : {}
12453
+ };
12454
+ const cardStatus = runtimeState?.status === "running" ? "loading" : runtimeState?.status;
12455
+ const cardDataForView = {
12456
+ ...mergedCardData,
12457
+ ...cardStatus ? { status: cardStatus } : {},
12458
+ ...runtimeState?.lastUpdated ? { lastRun: runtimeState.lastUpdated } : {},
12459
+ ...runtimeState?.status === "failed" && runtimeState.error ? { error: runtimeState.error } : {}
12460
+ };
12461
+ out.push({
12462
+ id: cardId,
12463
+ card: deepClone(baseCard),
12464
+ card_data: cardDataForView,
12465
+ fetched_sources: data && typeof data.fetched_sources === "object" ? deepClone(data.fetched_sources) : {},
12466
+ requires: data && typeof data.requires === "object" ? deepClone(data.requires) : {},
12467
+ computed_values: data && typeof data.computed_values === "object" ? deepClone(data.computed_values) : {},
12468
+ runtime_state: runtimeState ? deepClone(runtimeState) : {}
12469
+ });
12470
+ }
12471
+ return out;
12472
+ }
12473
+ const runtime = {
12474
+ getGraph: () => graph,
12475
+ getState: () => graph.getState(),
12476
+ getSchedule: () => graph.getSchedule(),
12477
+ getNodes: () => getRenderableNodes(),
12478
+ getBoard: () => ({
12479
+ ...boardMeta,
12480
+ nodes: getRenderableNodes()
12481
+ }),
12482
+ subscribe(listener) {
12483
+ listeners.add(listener);
12484
+ listener({ events: [], graph: graph.getState(), nodes: getRenderableNodes() });
12485
+ return () => listeners.delete(listener);
12486
+ },
12487
+ addCard(card) {
12488
+ if (cards.has(card.id)) throw new Error(`Card "${card.id}" already exists`);
12489
+ cards.set(card.id, deepClone(card));
12490
+ validateRequires(cards, card.id);
12491
+ graph.registerHandler(card.id, makeHandler(card.id));
12492
+ graph.addNode(card.id, toTaskConfig(card));
12493
+ },
12494
+ upsertCard(card) {
12495
+ cards.set(card.id, deepClone(card));
12496
+ validateRequires(cards, card.id);
12497
+ graph.registerHandler(card.id, makeHandler(card.id));
12498
+ graph.addNode(card.id, toTaskConfig(card));
12499
+ },
12500
+ removeCard(cardId) {
12501
+ cards.delete(cardId);
12502
+ graph.unregisterHandler(cardId);
12503
+ graph.removeNode(cardId);
12504
+ },
12505
+ patchCardState(cardId, patch) {
12506
+ const card = cards.get(cardId);
12507
+ if (!card) throw new Error(`Card "${cardId}" not found`);
12508
+ card.card_data = { ...card.card_data ?? {}, ...patch };
12509
+ graph.retrigger(cardId);
12510
+ },
12511
+ retrigger(cardId) {
12512
+ graph.retrigger(cardId);
12513
+ },
12514
+ retriggerAll() {
12515
+ graph.retriggerAll(Array.from(cards.keys()));
12516
+ },
12517
+ push(event) {
12518
+ graph.push(event);
12519
+ },
12520
+ pushAll(events) {
12521
+ graph.pushAll(events);
12522
+ },
12523
+ dispose() {
12524
+ listeners.clear();
12525
+ graph.dispose();
12526
+ }
12527
+ };
12528
+ return runtime;
12529
+ }
12530
+
11337
12531
  // src/inference/core.ts
11338
12532
  var DEFAULT_THRESHOLD = 0.5;
11339
12533
  var DEFAULT_SYSTEM_PROMPT = `You are a workflow completion analyzer. Given a graph of tasks with their current states, evidence, and inference hints, determine which tasks appear to be completed based on the available evidence.
@@ -11585,6 +12779,190 @@ function createHttpAdapter(opts) {
11585
12779
  };
11586
12780
  }
11587
12781
 
11588
- export { COMPLETION_STRATEGIES, CONFLICT_STRATEGIES, CardCompute, DEFAULTS, EXECUTION_MODES, EXECUTION_STATUS, FileStore, StepMachine as FlowEngine, LocalStorageStore, MemoryJournal, MemoryStore, StepMachine, TASK_STATUS, addDynamicTask, addNode, addProvides, addRequires, apply, applyAll, applyEvent, applyEvents, applyInferences, applyStepResult, batch, buildInferencePrompt, checkCircuitBreaker, computeAvailableOutputs, computeStepInput, createCallbackHandler, createCliAdapter, createDefaultGraphEngineStore, createStepMachine as createEngine, createFireAndForgetHandler, createHttpAdapter, createInitialExecutionState, createInitialState, createLiveGraph, createNoopHandler, createReactiveGraph, createScriptHandler, createShellHandler, createStepMachine, createWebhookHandler, detectStuckState, disableNode, drainTokens, enableNode, exportGraphConfig, exportGraphConfigToFile, extractReturnData, flowToMermaid, getAllTasks, getCandidateTasks, getDownstream, getMaxExecutions, getNode, getProvides, getRefreshStrategy, getRequires, getTask, getUnreachableNodes, getUnreachableTokens, getUpstream, graphToMermaid, hasTask, inferAndApply, inferCompletions, injectTokens, inspect, isExecutionComplete, isNonActiveTask, isRerunnable, isTaskCompleted, isTaskRunning, liveCardsToReactiveGraph, loadGraphConfig, loadStepFlow, mutateGraph, next, planExecution, removeNode, removeProvides, removeRequires, resetNode, resolveConfigTemplates, resolveVariables, restore, schedule, snapshot, validateFlowSchema, validateGraph, validateGraphConfig, validateGraphSchema, validateLiveCardSchema, validateLiveGraph, validateReactiveGraph, validateStepFlowConfig };
12782
+ // schema/board-status.schema.json
12783
+ var board_status_schema_default = {
12784
+ $schema: "https://json-schema.org/draft/2020-12/schema",
12785
+ $id: "https://yaml-flow.dev/schema/board-status.schema.json",
12786
+ title: "Board Status Object",
12787
+ type: "object",
12788
+ additionalProperties: false,
12789
+ required: ["schema_version", "meta", "summary", "cards"],
12790
+ properties: {
12791
+ schema_version: {
12792
+ type: "string",
12793
+ const: "v1"
12794
+ },
12795
+ meta: {
12796
+ type: "object",
12797
+ additionalProperties: false,
12798
+ required: ["board"],
12799
+ properties: {
12800
+ board: {
12801
+ type: "object",
12802
+ additionalProperties: false,
12803
+ required: ["path"],
12804
+ properties: {
12805
+ path: { type: "string" }
12806
+ }
12807
+ }
12808
+ }
12809
+ },
12810
+ summary: {
12811
+ type: "object",
12812
+ additionalProperties: false,
12813
+ required: ["card_count", "completed", "eligible", "pending", "blocked", "unresolved"],
12814
+ properties: {
12815
+ card_count: { type: "integer", minimum: 0 },
12816
+ completed: { type: "integer", minimum: 0 },
12817
+ eligible: { type: "integer", minimum: 0 },
12818
+ pending: { type: "integer", minimum: 0 },
12819
+ blocked: { type: "integer", minimum: 0 },
12820
+ unresolved: { type: "integer", minimum: 0 },
12821
+ failed: { type: "integer", minimum: 0 },
12822
+ in_progress: { type: "integer", minimum: 0 },
12823
+ orphan_cards: { type: "integer", minimum: 0 },
12824
+ topology: {
12825
+ type: "object",
12826
+ additionalProperties: false,
12827
+ required: ["edge_count", "max_fan_out_card", "max_fan_out"],
12828
+ properties: {
12829
+ edge_count: { type: "integer", minimum: 0 },
12830
+ max_fan_out_card: { type: ["string", "null"] },
12831
+ max_fan_out: { type: "integer", minimum: 0 }
12832
+ }
12833
+ }
12834
+ }
12835
+ },
12836
+ cards: {
12837
+ type: "array",
12838
+ items: {
12839
+ type: "object",
12840
+ additionalProperties: false,
12841
+ required: [
12842
+ "name",
12843
+ "status",
12844
+ "requires",
12845
+ "requires_satisfied",
12846
+ "requires_missing",
12847
+ "provides_declared",
12848
+ "provides_runtime",
12849
+ "blocked_by",
12850
+ "unblocks",
12851
+ "runtime"
12852
+ ],
12853
+ properties: {
12854
+ name: { type: "string" },
12855
+ status: { type: "string" },
12856
+ error: {
12857
+ type: "object",
12858
+ additionalProperties: false,
12859
+ required: ["message"],
12860
+ properties: {
12861
+ message: { type: "string" },
12862
+ code: { type: "string" },
12863
+ at: { type: ["string", "null"] },
12864
+ source: { type: "string" }
12865
+ }
12866
+ },
12867
+ requires: { type: "array", items: { type: "string" } },
12868
+ requires_satisfied: { type: "array", items: { type: "string" } },
12869
+ requires_missing: { type: "array", items: { type: "string" } },
12870
+ provides_declared: { type: "array", items: { type: "string" } },
12871
+ provides_runtime: { type: "array", items: { type: "string" } },
12872
+ blocked_by: { type: "array", items: { type: "string" } },
12873
+ unblocks: { type: "array", items: { type: "string" } },
12874
+ runtime: {
12875
+ type: "object",
12876
+ additionalProperties: false,
12877
+ required: [
12878
+ "attempt_count",
12879
+ "restart_count",
12880
+ "in_progress_since",
12881
+ "last_transition_at",
12882
+ "last_completed_at",
12883
+ "last_restarted_at",
12884
+ "status_age_ms"
12885
+ ],
12886
+ properties: {
12887
+ attempt_count: { type: "integer", minimum: 0 },
12888
+ restart_count: { type: "integer", minimum: 0 },
12889
+ in_progress_since: { type: ["string", "null"] },
12890
+ last_transition_at: { type: ["string", "null"] },
12891
+ last_completed_at: { type: ["string", "null"] },
12892
+ last_restarted_at: { type: ["string", "null"] },
12893
+ status_age_ms: { type: ["integer", "null"], minimum: 0 }
12894
+ }
12895
+ }
12896
+ }
12897
+ }
12898
+ }
12899
+ }
12900
+ };
12901
+
12902
+ // schema/card-runtime.schema.json
12903
+ var card_runtime_schema_default = {
12904
+ $schema: "https://json-schema.org/draft/2020-12/schema",
12905
+ $id: "https://yaml-flow.dev/schema/card-runtime.schema.json",
12906
+ title: "Card Runtime Computed Artifact",
12907
+ description: "Published per-card runtime artifact written to runtime-out/cards/<card-id>.computed.json. Contains only values produced by the compute step.",
12908
+ type: "object",
12909
+ required: ["schema_version", "card_id", "computed_values"],
12910
+ additionalProperties: false,
12911
+ properties: {
12912
+ schema_version: {
12913
+ type: "string",
12914
+ const: "v1",
12915
+ description: "Artifact schema version."
12916
+ },
12917
+ card_id: {
12918
+ type: "string",
12919
+ description: "The ID of the card this artifact belongs to."
12920
+ },
12921
+ computed_values: {
12922
+ type: "object",
12923
+ description: "Key/value map of outputs produced by the card's JSONata compute steps.",
12924
+ additionalProperties: true
12925
+ }
12926
+ }
12927
+ };
12928
+
12929
+ // src/runtime-artifacts/schema-validator.ts
12930
+ var import__ = __toESM(require__());
12931
+ var boardStatusValidator = null;
12932
+ var cardRuntimeValidator = null;
12933
+ function createAjv() {
12934
+ const ajv = new import__.default({ allErrors: true, strict: false });
12935
+ addFormats(ajv);
12936
+ return ajv;
12937
+ }
12938
+ function toValidationResult(validate) {
12939
+ const errors = (validate.errors ?? []).map((error) => {
12940
+ const instancePath = error.instancePath || "/";
12941
+ return `${instancePath}: ${error.message ?? "unknown error"}`;
12942
+ });
12943
+ return { ok: false, errors };
12944
+ }
12945
+ function getBoardStatusValidator() {
12946
+ if (boardStatusValidator) return boardStatusValidator;
12947
+ boardStatusValidator = createAjv().compile(board_status_schema_default);
12948
+ return boardStatusValidator;
12949
+ }
12950
+ function getCardRuntimeValidator() {
12951
+ if (cardRuntimeValidator) return cardRuntimeValidator;
12952
+ cardRuntimeValidator = createAjv().compile(card_runtime_schema_default);
12953
+ return cardRuntimeValidator;
12954
+ }
12955
+ function validateBoardStatusSchema(statusObject) {
12956
+ const validate = getBoardStatusValidator();
12957
+ if (validate(statusObject)) return { ok: true, errors: [] };
12958
+ return toValidationResult(validate);
12959
+ }
12960
+ function validateCardRuntimeSchema(cardRuntimeObject) {
12961
+ const validate = getCardRuntimeValidator();
12962
+ if (validate(cardRuntimeObject)) return { ok: true, errors: [] };
12963
+ return toValidationResult(validate);
12964
+ }
12965
+
12966
+ export { COMPLETION_STRATEGIES, CONFLICT_STRATEGIES, CardCompute, DEFAULTS, EXECUTION_MODES, EXECUTION_STATUS, FileStore, StepMachine as FlowEngine, LocalStorageStore, MemoryJournal, MemoryStore, StepMachine, TASK_STATUS, addDynamicTask, addNode, addProvides, addRequires, apply, applyAll, applyEvent, applyEvents, applyInferences, applyStepResult, batch, buildInferencePrompt, checkCircuitBreaker, computeAvailableOutputs, computeStepInput, createBoardLiveGraphRuntime, createCallbackHandler, createCliAdapter, createDefaultGraphEngineStore, createStepMachine as createEngine, createFireAndForgetHandler, createHttpAdapter, createInitialExecutionState, createInitialState, createLiveGraph, createNoopHandler, createReactiveGraph, createScriptHandler, createShellHandler, createStepMachine, createWebhookHandler, detectStuckState, disableNode, drainTokens, enableNode, exportGraphConfig, exportGraphConfigToFile, extractReturnData, flowToMermaid, getAllTasks, getCandidateTasks, getDownstream, getMaxExecutions, getNode, getProvides, getRefreshStrategy, getRequires, getTask, getUnreachableNodes, getUnreachableTokens, getUpstream, graphToMermaid, hasTask, inferAndApply, inferCompletions, injectTokens, inspect, isExecutionComplete, isNonActiveTask, isRerunnable, isTaskCompleted, isTaskRunning, liveCardsToReactiveGraph, loadGraphConfig, loadStepFlow, mutateGraph, next, planExecution, removeNode, removeProvides, removeRequires, resetNode, resolveConfigTemplates, resolveVariables, restore, schedule, snapshot, validateBoardStatusSchema, validateCardRuntimeSchema, validateFlowSchema, validateGraph, validateGraphConfig, validateGraphSchema, validateLiveCard, validateLiveCardDefinition, validateLiveCardRuntimeExpressions, validateLiveCardSchema, validateLiveGraph, validateReactiveGraph, validateStepFlowConfig };
11589
12967
  //# sourceMappingURL=index.js.map
11590
12968
  //# sourceMappingURL=index.js.map