@makaio/framework 1.0.0-dev-1790783144258 → 1.0.0-dev-1791396836202

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 (94) hide show
  1. package/dist/.makaio-build.json +2 -2
  2. package/dist/adapters/claude/index.d.mts +20 -20
  3. package/dist/artifact-BbNQHNDL.mjs +1 -0
  4. package/dist/bus/index.mjs +1 -1
  5. package/dist/bus-CtT6XeB_.mjs +9 -0
  6. package/dist/contracts/adapter/index.d.mts +1 -1
  7. package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
  8. package/dist/contracts/artifact/index.d.mts +3 -3
  9. package/dist/contracts/artifact/index.mjs +1 -1
  10. package/dist/contracts/automation-trigger/index.d.mts +1 -1
  11. package/dist/contracts/capabilities/index.d.mts +1 -1
  12. package/dist/contracts/client/index.d.mts +2 -2
  13. package/dist/contracts/extension/index.d.mts +4 -4
  14. package/dist/contracts/harness/index.d.mts +1 -1
  15. package/dist/contracts/index.d.mts +58 -58
  16. package/dist/contracts/index.mjs +1 -1
  17. package/dist/contracts/materialization/index.d.mts +2 -2
  18. package/dist/contracts/materialization/index.mjs +1 -1
  19. package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
  20. package/dist/contracts/reaction/index.d.mts +1 -1
  21. package/dist/contracts/worker/index.d.mts +1 -1
  22. package/dist/contracts/worker/index.mjs +1 -1
  23. package/dist/contracts/workflow/index.d.mts +2 -2
  24. package/dist/contracts/workflow/index.mjs +1 -1
  25. package/dist/{contribution-CsDOPiDo.d.mts → contribution-CCVRsaNB.d.mts} +1 -1
  26. package/dist/{extension-context-BY9o1ITm.d.mts → extension-context-BWrjVPXR.d.mts} +3 -3
  27. package/dist/{framework-packages-blqho6Nk.mjs → framework-packages-CdpSqDeo.mjs} +1 -1
  28. package/dist/{hook-responses-Xxq6QAL2.d.mts → hook-responses-v6EA_7WC.d.mts} +1 -1
  29. package/dist/{index-D9Ome4qp.d.mts → index-BXaNt9GP.d.mts} +1 -1
  30. package/dist/{index-DWWP2cUb.d.mts → index-Bt6KIvVk.d.mts} +1 -1
  31. package/dist/{index-PymaxRkQ2.d.mts → index-CFet5T7v2.d.mts} +6 -6
  32. package/dist/{index-VG-C-ZHN.d.mts → index-CgcMrxhm.d.mts} +16 -16
  33. package/dist/{index-Dnc0PaTv2.d.mts → index-ChwEMUbc2.d.mts} +12 -12
  34. package/dist/{index-OA1A-NWE.d.mts → index-CjM6Fi-N.d.mts} +1 -1
  35. package/dist/{index-DMFFSC7x.d.mts → index-Cxx1aoPR.d.mts} +1 -1
  36. package/dist/{index-D_Zdnh0U.d.mts → index-D5eIy_qx.d.mts} +7 -7
  37. package/dist/{index-CDezXPm9.d.mts → index-DBkmFhrn.d.mts} +411 -289
  38. package/dist/{index-C9X6ei7S.d.mts → index-DneUbrTU.d.mts} +4 -4
  39. package/dist/{index-CnVhfLrY.d.mts → index-DnsMV2xK.d.mts} +57 -57
  40. package/dist/{index-Fmdwbgei.d.mts → index-HsD17NLG.d.mts} +1 -1
  41. package/dist/{index-BrnOW7-5.d.mts → index-Rd9Teoza.d.mts} +1 -1
  42. package/dist/{index-Fo4ALycy.d.mts → index-y6zuCdvH.d.mts} +26 -26
  43. package/dist/kernel/extension/index.d.mts +2 -2
  44. package/dist/kernel/index.d.mts +2 -2
  45. package/dist/kernel/observability/index.d.mts +1 -1
  46. package/dist/{materialization-BzSgnv2R.mjs → materialization-C1qlFBV2.mjs} +1 -1
  47. package/dist/{namespace-BH9U2C1O.d.mts → namespace-ChJ-C9m_.d.mts} +2 -2
  48. package/dist/package.json +1 -1
  49. package/dist/packages-BOM7wECe.mjs +1 -0
  50. package/dist/{packages-Fy4a6vQy.d.mts → packages-g6BtlUF9.d.mts} +9 -6
  51. package/dist/{schemas-JPaSXxNr.d.mts → schemas-BBMHnFq8.d.mts} +4 -4
  52. package/dist/{schemas-CEc_v3dl.d.mts → schemas-DKaUrczB.d.mts} +2 -2
  53. package/dist/{schemas-DyTbvDp-.d.mts → schemas-DnrIc9g7.d.mts} +50 -11
  54. package/dist/{schemas-BYEgjPst2.d.mts → schemas-DrrpHMbF2.d.mts} +7 -7
  55. package/dist/{schemas-CiJpGURT.d.mts → schemas-Y3EJu698.d.mts} +2 -2
  56. package/dist/{schemas-BvDsO8Is.mjs → schemas-uNzmiLso.mjs} +1 -1
  57. package/dist/services/context-rules/index.d.mts +3 -3
  58. package/dist/services/execution-target/index.d.mts +2 -2
  59. package/dist/services/execution-target/namespace.d.mts +1 -1
  60. package/dist/services/execution-target/schemas.d.mts +1 -1
  61. package/dist/services/filesystem/namespace.d.mts +6 -6
  62. package/dist/services/filesystem/schemas.d.mts +3 -3
  63. package/dist/services/git/namespace.d.mts +2 -2
  64. package/dist/services/git/schemas.d.mts +2 -2
  65. package/dist/services/index.d.mts +18 -18
  66. package/dist/services/index.mjs +1 -1
  67. package/dist/services/materialization/index.d.mts +1 -1
  68. package/dist/services/materialization/index.mjs +1 -1
  69. package/dist/services/preferences/index.d.mts +2 -2
  70. package/dist/services/preferences/schemas.d.mts +1 -1
  71. package/dist/services/preferences/storage-namespace.d.mts +2 -2
  72. package/dist/services/session/handlers/index.d.mts +1 -1
  73. package/dist/services/session/index.d.mts +2 -2
  74. package/dist/services/settings/namespace.d.mts +2 -2
  75. package/dist/services/subagent-template/index.d.mts +1 -1
  76. package/dist/services/subagent-template/schemas.d.mts +1 -1
  77. package/dist/services/tools/index.mjs +1 -1
  78. package/dist/services/workflow-transitions/index.mjs +1 -1
  79. package/dist/{session-lineage-DZr5w2-z.d.mts → session-lineage-Bjh0Ccu7.d.mts} +1 -1
  80. package/dist/{storage-namespace-Cl8qtHDu.d.mts → storage-namespace-DoxNJ9Cg.d.mts} +10 -10
  81. package/dist/{tools-Cbuj-ClQ.mjs → tools-EK2HiPee.mjs} +1 -1
  82. package/dist/{transition-CzxHvafT.d.mts → transition-yohyGRmc.d.mts} +1 -1
  83. package/dist/ui-kernel/index.d.mts +4 -4
  84. package/dist/ui-kernel/pages/namespace.d.mts +4 -4
  85. package/dist/ui-kernel/pages/schemas.d.mts +1 -1
  86. package/dist/{view-builder-BLdSezFD.d.mts → view-builder-BjVjGZAI.d.mts} +2 -2
  87. package/dist/{worker-toBnRJ0A.mjs → worker-DulBFC0P.mjs} +1 -1
  88. package/dist/{workflow-BDDB6EJi.mjs → workflow-Dvv_8Xu6.mjs} +1 -1
  89. package/dist/workflow-engine/index.d.mts +31 -31
  90. package/dist/{workflow-transitions-CvT6P03B.mjs → workflow-transitions-ztq90FUj.mjs} +1 -1
  91. package/package.json +1 -1
  92. package/dist/artifact-XE82Q2bH.mjs +0 -1
  93. package/dist/bus-B-ksy7YX.mjs +0 -9
  94. package/dist/packages-CZ2x-Ver.mjs +0 -1
@@ -1113,8 +1113,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1113
1113
  "exit-and-resume": "exit-and-resume";
1114
1114
  }>>;
1115
1115
  terminalAuthority: z.ZodOptional<z.ZodEnum<{
1116
- authority: "authority";
1117
1116
  worker: "worker";
1117
+ authority: "authority";
1118
1118
  }>>;
1119
1119
  materializationSpec: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1120
1120
  kind: z.ZodLiteral<"local-directory">;
@@ -1604,8 +1604,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1604
1604
  cancelled: "cancelled";
1605
1605
  failed: "failed";
1606
1606
  running: "running";
1607
- skipped: "skipped";
1608
1607
  waiting: "waiting";
1608
+ skipped: "skipped";
1609
1609
  }>;
1610
1610
  attempt: z.ZodDefault<z.ZodNumber>;
1611
1611
  iteration: z.ZodOptional<z.ZodNumber>;
@@ -1650,8 +1650,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1650
1650
  cancelled: "cancelled";
1651
1651
  failed: "failed";
1652
1652
  running: "running";
1653
- skipped: "skipped";
1654
1653
  waiting: "waiting";
1654
+ skipped: "skipped";
1655
1655
  }>;
1656
1656
  attempt: z.ZodDefault<z.ZodNumber>;
1657
1657
  iteration: z.ZodOptional<z.ZodNumber>;
@@ -1693,8 +1693,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1693
1693
  cancelled: "cancelled";
1694
1694
  failed: "failed";
1695
1695
  running: "running";
1696
- skipped: "skipped";
1697
1696
  waiting: "waiting";
1697
+ skipped: "skipped";
1698
1698
  }>;
1699
1699
  attempt: z.ZodDefault<z.ZodNumber>;
1700
1700
  iteration: z.ZodOptional<z.ZodNumber>;
@@ -1722,8 +1722,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1722
1722
  status: z.ZodEnum<{
1723
1723
  cancelled: "cancelled";
1724
1724
  rejected: "rejected";
1725
- resumed: "resumed";
1726
1725
  waiting: "waiting";
1726
+ resumed: "resumed";
1727
1727
  "timed-out": "timed-out";
1728
1728
  }>;
1729
1729
  autoAction: z.ZodEnum<{
@@ -1857,8 +1857,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1857
1857
  status: z.ZodEnum<{
1858
1858
  cancelled: "cancelled";
1859
1859
  rejected: "rejected";
1860
- resumed: "resumed";
1861
1860
  waiting: "waiting";
1861
+ resumed: "resumed";
1862
1862
  "timed-out": "timed-out";
1863
1863
  }>;
1864
1864
  autoAction: z.ZodEnum<{
@@ -1882,8 +1882,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1882
1882
  status: z.ZodOptional<z.ZodEnum<{
1883
1883
  cancelled: "cancelled";
1884
1884
  rejected: "rejected";
1885
- resumed: "resumed";
1886
1885
  waiting: "waiting";
1886
+ resumed: "resumed";
1887
1887
  "timed-out": "timed-out";
1888
1888
  }>>;
1889
1889
  limit: z.ZodDefault<z.ZodNumber>;
@@ -1899,8 +1899,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1899
1899
  status: z.ZodEnum<{
1900
1900
  cancelled: "cancelled";
1901
1901
  rejected: "rejected";
1902
- resumed: "resumed";
1903
1902
  waiting: "waiting";
1903
+ resumed: "resumed";
1904
1904
  "timed-out": "timed-out";
1905
1905
  }>;
1906
1906
  autoAction: z.ZodEnum<{
@@ -1935,8 +1935,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1935
1935
  status: z.ZodEnum<{
1936
1936
  cancelled: "cancelled";
1937
1937
  rejected: "rejected";
1938
- resumed: "resumed";
1939
1938
  waiting: "waiting";
1939
+ resumed: "resumed";
1940
1940
  "timed-out": "timed-out";
1941
1941
  }>;
1942
1942
  autoAction: z.ZodEnum<{
@@ -2215,8 +2215,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
2215
2215
  "exit-and-resume": "exit-and-resume";
2216
2216
  }>>;
2217
2217
  terminalAuthority: z.ZodOptional<z.ZodEnum<{
2218
- authority: "authority";
2219
2218
  worker: "worker";
2219
+ authority: "authority";
2220
2220
  }>>;
2221
2221
  materializationSpec: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2222
2222
  kind: z.ZodLiteral<"local-directory">;
@@ -2402,8 +2402,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
2402
2402
  "exit-and-resume": "exit-and-resume";
2403
2403
  }>>;
2404
2404
  terminalAuthority: z.ZodOptional<z.ZodEnum<{
2405
- authority: "authority";
2406
2405
  worker: "worker";
2406
+ authority: "authority";
2407
2407
  }>>;
2408
2408
  materializationSpec: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2409
2409
  kind: z.ZodLiteral<"local-directory">;
@@ -3392,7 +3392,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
3392
3392
  tableName: "workflow_execution_frames";
3393
3393
  dataType: "string";
3394
3394
  columnType: "SQLiteText";
3395
- data: "pending" | "completed" | "cancelled" | "failed" | "running" | "skipped" | "waiting";
3395
+ data: "pending" | "completed" | "cancelled" | "failed" | "running" | "waiting" | "skipped";
3396
3396
  driverParam: string;
3397
3397
  notNull: true;
3398
3398
  hasDefault: true;
@@ -3405,7 +3405,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
3405
3405
  generated: undefined;
3406
3406
  }, {}, {
3407
3407
  length: number | undefined;
3408
- $type: "pending" | "completed" | "cancelled" | "failed" | "running" | "skipped" | "waiting";
3408
+ $type: "pending" | "completed" | "cancelled" | "failed" | "running" | "waiting" | "skipped";
3409
3409
  }>;
3410
3410
  attempt: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
3411
3411
  name: string;
@@ -3694,7 +3694,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
3694
3694
  tableName: "workflow_gate_instances";
3695
3695
  dataType: "string";
3696
3696
  columnType: "SQLiteText";
3697
- data: "cancelled" | "rejected" | "resumed" | "waiting" | "timed-out";
3697
+ data: "cancelled" | "rejected" | "waiting" | "resumed" | "timed-out";
3698
3698
  driverParam: string;
3699
3699
  notNull: true;
3700
3700
  hasDefault: true;
@@ -3707,7 +3707,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
3707
3707
  generated: undefined;
3708
3708
  }, {}, {
3709
3709
  length: number | undefined;
3710
- $type: "cancelled" | "rejected" | "resumed" | "waiting" | "timed-out";
3710
+ $type: "cancelled" | "rejected" | "waiting" | "resumed" | "timed-out";
3711
3711
  }>;
3712
3712
  autoAction: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
3713
3713
  name: "auto_action";
@@ -4821,7 +4821,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
4821
4821
  tableName: "workflow_run_contexts";
4822
4822
  dataType: "string";
4823
4823
  columnType: "SQLiteText";
4824
- data: "authority" | "worker" | undefined;
4824
+ data: "worker" | "authority" | undefined;
4825
4825
  driverParam: string;
4826
4826
  notNull: false;
4827
4827
  hasDefault: false;
@@ -4834,7 +4834,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
4834
4834
  generated: undefined;
4835
4835
  }, {}, {
4836
4836
  length: number | undefined;
4837
- $type: "authority" | "worker" | undefined;
4837
+ $type: "worker" | "authority" | undefined;
4838
4838
  }>;
4839
4839
  materializationSpec: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
4840
4840
  name: string;
@@ -5206,7 +5206,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
5206
5206
  tableName: "worklog_frame_entries";
5207
5207
  dataType: "string";
5208
5208
  columnType: "SQLiteText";
5209
- data: "pending" | "completed" | "cancelled" | "failed" | "running" | "skipped" | "waiting";
5209
+ data: "pending" | "completed" | "cancelled" | "failed" | "running" | "waiting" | "skipped";
5210
5210
  driverParam: string;
5211
5211
  notNull: true;
5212
5212
  hasDefault: false;
@@ -5640,7 +5640,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
5640
5640
  tableName: "worklog_gate_events";
5641
5641
  dataType: "string";
5642
5642
  columnType: "SQLiteText";
5643
- data: "cancelled" | "rejected" | "resumed" | "waiting" | "timed-out";
5643
+ data: "cancelled" | "rejected" | "waiting" | "resumed" | "timed-out";
5644
5644
  driverParam: string;
5645
5645
  notNull: true;
5646
5646
  hasDefault: false;
@@ -5653,7 +5653,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
5653
5653
  generated: undefined;
5654
5654
  }, {}, {
5655
5655
  length: number | undefined;
5656
- $type: "cancelled" | "rejected" | "resumed" | "waiting" | "timed-out";
5656
+ $type: "cancelled" | "rejected" | "waiting" | "resumed" | "timed-out";
5657
5657
  }>;
5658
5658
  prompt: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
5659
5659
  name: "prompt";
@@ -6762,8 +6762,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
6762
6762
  "exit-and-resume": "exit-and-resume";
6763
6763
  }>>;
6764
6764
  terminalAuthority: z.ZodOptional<z.ZodEnum<{
6765
- authority: "authority";
6766
6765
  worker: "worker";
6766
+ authority: "authority";
6767
6767
  }>>;
6768
6768
  materializationSpec: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
6769
6769
  kind: z.ZodLiteral<"local-directory">;
@@ -7253,8 +7253,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7253
7253
  cancelled: "cancelled";
7254
7254
  failed: "failed";
7255
7255
  running: "running";
7256
- skipped: "skipped";
7257
7256
  waiting: "waiting";
7257
+ skipped: "skipped";
7258
7258
  }>;
7259
7259
  attempt: z.ZodDefault<z.ZodNumber>;
7260
7260
  iteration: z.ZodOptional<z.ZodNumber>;
@@ -7299,8 +7299,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7299
7299
  cancelled: "cancelled";
7300
7300
  failed: "failed";
7301
7301
  running: "running";
7302
- skipped: "skipped";
7303
7302
  waiting: "waiting";
7303
+ skipped: "skipped";
7304
7304
  }>;
7305
7305
  attempt: z.ZodDefault<z.ZodNumber>;
7306
7306
  iteration: z.ZodOptional<z.ZodNumber>;
@@ -7342,8 +7342,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7342
7342
  cancelled: "cancelled";
7343
7343
  failed: "failed";
7344
7344
  running: "running";
7345
- skipped: "skipped";
7346
7345
  waiting: "waiting";
7346
+ skipped: "skipped";
7347
7347
  }>;
7348
7348
  attempt: z.ZodDefault<z.ZodNumber>;
7349
7349
  iteration: z.ZodOptional<z.ZodNumber>;
@@ -7371,8 +7371,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7371
7371
  status: z.ZodEnum<{
7372
7372
  cancelled: "cancelled";
7373
7373
  rejected: "rejected";
7374
- resumed: "resumed";
7375
7374
  waiting: "waiting";
7375
+ resumed: "resumed";
7376
7376
  "timed-out": "timed-out";
7377
7377
  }>;
7378
7378
  autoAction: z.ZodEnum<{
@@ -7506,8 +7506,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7506
7506
  status: z.ZodEnum<{
7507
7507
  cancelled: "cancelled";
7508
7508
  rejected: "rejected";
7509
- resumed: "resumed";
7510
7509
  waiting: "waiting";
7510
+ resumed: "resumed";
7511
7511
  "timed-out": "timed-out";
7512
7512
  }>;
7513
7513
  autoAction: z.ZodEnum<{
@@ -7531,8 +7531,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7531
7531
  status: z.ZodOptional<z.ZodEnum<{
7532
7532
  cancelled: "cancelled";
7533
7533
  rejected: "rejected";
7534
- resumed: "resumed";
7535
7534
  waiting: "waiting";
7535
+ resumed: "resumed";
7536
7536
  "timed-out": "timed-out";
7537
7537
  }>>;
7538
7538
  limit: z.ZodDefault<z.ZodNumber>;
@@ -7548,8 +7548,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7548
7548
  status: z.ZodEnum<{
7549
7549
  cancelled: "cancelled";
7550
7550
  rejected: "rejected";
7551
- resumed: "resumed";
7552
7551
  waiting: "waiting";
7552
+ resumed: "resumed";
7553
7553
  "timed-out": "timed-out";
7554
7554
  }>;
7555
7555
  autoAction: z.ZodEnum<{
@@ -7584,8 +7584,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7584
7584
  status: z.ZodEnum<{
7585
7585
  cancelled: "cancelled";
7586
7586
  rejected: "rejected";
7587
- resumed: "resumed";
7588
7587
  waiting: "waiting";
7588
+ resumed: "resumed";
7589
7589
  "timed-out": "timed-out";
7590
7590
  }>;
7591
7591
  autoAction: z.ZodEnum<{
@@ -7864,8 +7864,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7864
7864
  "exit-and-resume": "exit-and-resume";
7865
7865
  }>>;
7866
7866
  terminalAuthority: z.ZodOptional<z.ZodEnum<{
7867
- authority: "authority";
7868
7867
  worker: "worker";
7868
+ authority: "authority";
7869
7869
  }>>;
7870
7870
  materializationSpec: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
7871
7871
  kind: z.ZodLiteral<"local-directory">;
@@ -8051,8 +8051,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
8051
8051
  "exit-and-resume": "exit-and-resume";
8052
8052
  }>>;
8053
8053
  terminalAuthority: z.ZodOptional<z.ZodEnum<{
8054
- authority: "authority";
8055
8054
  worker: "worker";
8055
+ authority: "authority";
8056
8056
  }>>;
8057
8057
  materializationSpec: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
8058
8058
  kind: z.ZodLiteral<"local-directory">;
@@ -1 +1 @@
1
- import{u as e}from"./framework-packages-blqho6Nk.mjs";function t(){let t=new Map;return{filter:e=>!!(e.transitionRules?.rules?.length||e.transitionActions?.actions),async processActivated(i,a,o){let s=o.getService(e);if(!s)throw Error(`TransitionContributionProcessor: TransitionPipelineService is not available — ensure '${e.name}' is started before extensions with transitionRules or transitionActions.`);let c=a.transitionRules?.rules??[],l=a.transitionActions?.actions,u=c.length>0,d=l!==void 0;u&&n(i,c),d&&r(i,l);let f=!1,p=!1;try{u&&(s.ruleRegistry.register(i,c),f=!0),d&&(s.actionRegistry.register(i,l),p=!0)}catch(e){throw f&&s.ruleRegistry.deregister(i),p&&s.actionRegistry.deregister(i),e}t.set(i,()=>{u&&s.ruleRegistry.deregister(i),d&&s.actionRegistry.deregister(i)})},async processStopped(e){let n=t.get(e);if(n){try{n()}catch(t){console.error(`[TransitionContributionProcessor] Deregister error for "${e}":`,t)}t.delete(e)}}}}function n(e,t){let n=`${e}.`;for(let e of t)if(!e.id.startsWith(n))throw Error(`TransitionContributionProcessor: rule '${e.id}' must be namespaced by extension '${n}'`)}function r(e,t){let n=`${e}.`;for(let e of Object.keys(t))if(!e.startsWith(n))throw Error(`TransitionContributionProcessor: action type '${e}' must be namespaced by extension '${n}'`)}export{t};
1
+ import{u as e}from"./framework-packages-CdpSqDeo.mjs";function t(){let t=new Map;return{filter:e=>!!(e.transitionRules?.rules?.length||e.transitionActions?.actions),async processActivated(i,a,o){let s=o.getService(e);if(!s)throw Error(`TransitionContributionProcessor: TransitionPipelineService is not available — ensure '${e.name}' is started before extensions with transitionRules or transitionActions.`);let c=a.transitionRules?.rules??[],l=a.transitionActions?.actions,u=c.length>0,d=l!==void 0;u&&n(i,c),d&&r(i,l);let f=!1,p=!1;try{u&&(s.ruleRegistry.register(i,c),f=!0),d&&(s.actionRegistry.register(i,l),p=!0)}catch(e){throw f&&s.ruleRegistry.deregister(i),p&&s.actionRegistry.deregister(i),e}t.set(i,()=>{u&&s.ruleRegistry.deregister(i),d&&s.actionRegistry.deregister(i)})},async processStopped(e){let n=t.get(e);if(n){try{n()}catch(t){console.error(`[TransitionContributionProcessor] Deregister error for "${e}":`,t)}t.delete(e)}}}}function n(e,t){let n=`${e}.`;for(let e of t)if(!e.id.startsWith(n))throw Error(`TransitionContributionProcessor: rule '${e.id}' must be namespaced by extension '${n}'`)}function r(e,t){let n=`${e}.`;for(let e of Object.keys(t))if(!e.startsWith(n))throw Error(`TransitionContributionProcessor: action type '${e}' must be namespaced by extension '${n}'`)}export{t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makaio/framework",
3
- "version": "1.0.0-dev-1790783144258",
3
+ "version": "1.0.0-dev-1791396836202",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/makaio-ai/makaio-framework.git",
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-DTipWd-i.mjs";import{n as t,o as n,s as r}from"./json-value-DM-EjTC1.mjs";import{C as i,_ as a,a as o,b as s,c,d as l,i as u,l as d,n as ee,p as te,r as ne,t as re,u as ie,w as f,x as ae,y as oe}from"./schemas-BvDsO8Is.mjs";import{C as se,M as ce,a as p,d as m,h as le,k as ue,r as de,s as h,t as g,x as fe}from"./kind-registration-CdjmVxY_.mjs";import{t as pe}from"./zod-json-schema-ZUmGtQhT.mjs";import{t as me}from"./ajv-Cvnmw2yn.mjs";import{t as he}from"./2020-CRfgqanb.mjs";import{t as ge}from"./dist-onY7e-pd.mjs";import{z as _}from"zod";import{createBusNamespace as _e}from"@makaio/framework/core";const ve=_.strictObject({evidence:i}),v=_.strictObject({kind:_.literal(`text`),text:_.string()}),[ye,be,xe]=i.options,Se=_.union([ye.pick({source:!0,location:!0}).extend({content:v}),be.pick({source:!0,location:!0}).extend({content:v}),xe.pick({source:!0,location:!0}).extend({content:v})]);function y(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function b(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function Ce(e,t){if(t===`#`)return{node:e,pointer:``};if(!t.startsWith(`#/`))return;let n;try{n=decodeURIComponent(t.slice(1))}catch{return}let r=e;for(let e of n.slice(1).split(`/`)){let t=e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if(Array.isArray(r)){if(!/^(0|[1-9]\d*)$/.test(t)||Number(t)>=r.length)return;r=r[Number(t)]}else{let e=y(r);if(!e||!Object.hasOwn(e,t))return;r=e[t]}}let i=typeof r==`boolean`?r:y(r);return i===void 0?void 0:{node:i,pointer:n}}function x(e,t){if(t===``)return!1;let n=e;for(let e of t.slice(1).split(`/`)){let t=e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if(n=Array.isArray(n)?n[Number(t)]:y(n)?.[t],typeof y(n)?.$id==`string`)return!0}return!1}function we(e,t,n){if(e[`x-makaio-value-type`]!==`evidence/v1`)return;let r=i.safeParse(t);if(!r.success)throw Error(`Invalid schema-declared evidence at ${n}`);return{evidence:r.data,dataPath:n}}function Te(e,t,n,r){if(typeof t.$ref!=`string`)return!1;if(r)return!0;let i=Ce(e,t.$ref);return i===void 0?!0:typeof i.node!=`boolean`&&S(e,i.node,n,x(e,i.pointer))}function S(e,t,n=new WeakSet,r=!1){let i=y(t);if(!i||n.has(i))return!1;n.add(i);let a=r||i!==e&&typeof i.$id==`string`;if(i[`x-makaio-value-type`]===`evidence/v1`||typeof i.$dynamicRef==`string`||Te(e,i,n,a)||[`additionalItems`,`additionalProperties`,`contains`,`else`,`if`,`items`,`then`,`unevaluatedItems`,`unevaluatedProperties`].some(t=>S(e,i[t],n,a))||[`allOf`,`anyOf`,`oneOf`,`prefixItems`].some(t=>Array.isArray(i[t])&&i[t].some(t=>S(e,t,n,a)))||Array.isArray(i.items)&&i.items.some(t=>S(e,t,n,a)))return!0;for(let t of[`dependentSchemas`,`dependencies`,`patternProperties`,`properties`]){let r=y(i[t]);if(r&&Object.values(r).some(t=>S(e,t,n,a)))return!0}return!1}var Ee=class{dataSchema;matchesSchema;occurrences=new Map;visited=new WeakMap;constructor(e,t){this.dataSchema=e,this.matchesSchema=t}extract(e){return this.visit(this.dataSchema,e,`/data`),[...this.occurrences.values()]}visit(e,t,n,r=``){let i=this.visited.get(e)??new Set;if(i.has(n))return;if(i.add(n),this.visited.set(e,i),typeof e.$dynamicRef==`string`)throw Error(`Evidence discovery does not support active $dynamicRef at ${n}`);if(typeof e.$ref==`string`){if(x(this.dataSchema,r))throw Error(`Evidence discovery does not support local $ref inside nested $id resource at ${n}`);let i=Ce(this.dataSchema,e.$ref);if(i===void 0)throw Error(`Cannot resolve local schema reference ${e.$ref} at ${n}`);if(typeof i.node!=`boolean`&&this.visit(i.node,t,n,i.pointer),this.dataSchema.$schema!==`https://json-schema.org/draft/2020-12/schema`)return}let a=we(e,t,n);if(a){this.occurrences.set(n,a);return}this.visitCombiners(e,t,n,r),this.visitConditional(e,t,n,r),this.visitDependencies(e,t,n,r),this.assertSupportedApplicators(e,n,r),Array.isArray(t)?this.visitArray(e,t,n,r):typeof t==`object`&&t&&this.visitObject(e,t,n,r)}visitCombiners(e,t,n,r){for(let i of[`allOf`,`anyOf`,`oneOf`]){let a=e[i];if(Array.isArray(a))for(let[e,o]of a.entries()){let a=y(o),s=`${r}/${i}/${e}`;a&&(i===`allOf`||this.matchesSchema(this.dataSchema,s,t))&&this.visit(a,t,n,s)}}}visitConditional(e,t,n,r){let i=typeof e.if==`boolean`?e.if:y(e.if);if(i===void 0)return;let a=`${r}/if`,o=this.matchesSchema(this.dataSchema,a,t);o&&typeof i!=`boolean`&&this.visit(i,t,n,a);let s=o?`then`:`else`,c=y(e[s]);c&&this.visit(c,t,n,`${r}/${s}`)}visitDependencies(e,t,n,r){if(!(typeof t!=`object`||!t||Array.isArray(t)))for(let i of[`dependentSchemas`,`dependencies`]){let a=y(e[i]);if(a)for(let[e,o]of Object.entries(a)){let a=y(o);Object.hasOwn(t,e)&&a&&this.visit(a,t,n,`${r}/${i}/${b(e)}`)}}}assertSupportedApplicators(e,t,n){for(let r of[`unevaluatedProperties`,`unevaluatedItems`])if(S(this.dataSchema,e[r],void 0,x(this.dataSchema,n)))throw Error(`Evidence under unsupported ${r} applicator at ${t}`)}visitArray(e,t,n,r){let i=Array.isArray(e.prefixItems),a=i?e.prefixItems:Array.isArray(e.items)?e.items:[];a.forEach((e,a)=>{let o=y(e),s=i?`prefixItems`:`items`;o&&a<t.length&&this.visit(o,t[a],`${n}/${a}`,`${r}/${s}/${a}`)});let o=Array.isArray(e.items)?y(e.additionalItems):y(e.items);if(o){let i=Array.isArray(e.items)?`additionalItems`:`items`;t.slice(a.length).forEach((e,t)=>this.visit(o,e,`${n}/${a.length+t}`,`${r}/${i}`))}this.visitContains(e,t,n,r)}visitContains(e,t,n,r){let i=y(e.contains);if(!i)return;let a=`${r}/contains`;t.forEach((e,t)=>{this.matchesSchema(this.dataSchema,a,e)&&this.visit(i,e,`${n}/${t}`,a)})}visitObject(e,t,n,r){let i=y(e.properties),a=y(e.patternProperties);for(let[o,s]of Object.entries(t)){let t=b(o),c=i!==void 0&&Object.hasOwn(i,o),l=y(i?.[o]);l&&this.visit(l,s,`${n}/${t}`,`${r}/properties/${t}`);let u=this.visitPatterns(a,o,s,`${n}/${t}`,r),d=y(e.additionalProperties);!c&&!u&&d&&this.visit(d,s,`${n}/${t}`,`${r}/additionalProperties`)}}visitPatterns(e,t,n,r,i){let a=!1;for(let[o,s]of Object.entries(e??{})){if(!new RegExp(o,`u`).test(t))continue;a=!0;let e=y(s);e&&this.visit(e,n,r,`${i}/patternProperties/${b(o)}`)}return a}};function De(e,t,n){return new Ee(e,n.matchesSchema).extract(t)}function Oe(e){let{dataSchema:t,hooks:n,...r}=e,i={$schema:`https://json-schema.org/draft/2020-12/schema`,...pe(t)};ue(i);let a=p.parse({...r,dataSchema:i});if(a.kind!==e.kind)throw Error(`Artifact kind identifiers must not contain surrounding whitespace`);let o=_.fromJSONSchema(a.dataSchema),s=_.unknown().superRefine((e,t)=>{let n=o.safeParse(e);if(!n.success)for(let e of n.error.issues)t.addIssue({code:`custom`,path:e.path,message:e.message})}).pipe(t).superRefine((e,t)=>{Object.hasOwn(e,`slug`)&&t.addIssue({code:`custom`,path:[fe],message:se});try{ce(e,a.titlePath)}catch(e){t.addIssue({code:`custom`,path:a.titlePath.split(`.`),message:e instanceof Error?e.message:`Artifact title must be a nonblank string`})}});return{...structuredClone(a),kind:e.kind,schemaVersion:e.schemaVersion,dataSchema:s,...n?{hooks:n}:{},toRegistration:()=>structuredClone(a)}}var ke=e(me(),1),Ae=e(he(),1),je=e(ge(),1);function C(e){let t={allErrors:!0,strict:!1,strictSchema:!0},n=e.dataSchema.$schema===`https://json-schema.org/draft/2020-12/schema`?new Ae.default(t):new ke.default(t);return(0,je.default)(n),n.addKeyword({keyword:ae,schemaType:`string`,valid:!0}),n.compile(e.dataSchema)}function Me(e){return e.replace(/~1/gu,`/`).replace(/~0/gu,`~`)}function Ne(e){let t=e.instancePath.split(`/`).slice(1).map(Me),n=e.keyword===`required`?e.params.missingProperty:e.params.additionalProperty;return typeof n==`string`&&(e.keyword===`required`||e.keyword===`additionalProperties`)&&t.push(n),t.join(`.`)}function Pe(e){if(e.keyword!==`type`)return;let t=e.params.type;if(typeof t==`string`)return t;if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t.join(` | `)}const Fe=n.array();function Ie(e){if(e.keyword!==`enum`)return;let t=Fe.safeParse(e.params.allowedValues);return t.success?t.data:void 0}function Le(e){return(e??[]).map(e=>{let t=Pe(e),n=Ie(e);return{path:Ne(e),reason:e.message??`violates ${e.keyword}`,...t===void 0?{}:{expectedType:t},...n===void 0?{}:{allowedValues:n}}})}function w(e){return typeof e==`object`&&!!e&&Object.hasOwn(e,`slug`)}const Re={path:fe,reason:se};function ze(e){let t=C(e);return e=>t(e)&&!w(e)}function Be(e){let t=C(e);return e=>{let n=t(e)?[]:Le(t.errors);return w(e)&&n.push(Re),n.length===0?{valid:!0}:{valid:!1,issues:n}}}function Ve(e){return{hooks:[...e.hooks]}}const He=[`inline`,`summary`,`link`,`omit`],Ue=[`outbound`,`inbound`],T=_.string().min(1),E=_.enum(Ue),We=_.object({kinds:_.array(_.string().min(1)).optional(),hint:T.optional(),depth:_.number().int().min(1).max(20).optional(),nested:_.lazy(()=>D).optional(),direction:E.optional()}),D=_.record(_.string().min(1),We);function O(e){return JSON.stringify([e.kind,e.id,e.revision])}const Ge=_.enum([`not-selected`,`not-found`,`depth-exceeded`,`unsupported-ref-class`,`cycle-detected`]),Ke=_.object({target:d,sourceRef:f,relationType:_.string().min(1),sourceLocalId:c.shape.sourceLocalId,direction:E.optional(),hint:T,status:_.enum([`resolved`,`unresolved`]),reason:Ge.optional()}).superRefine((e,t)=>{e.status===`unresolved`&&e.reason===void 0&&t.addIssue({code:_.ZodIssueCode.custom,path:[`reason`],message:`reason is required for unresolved artifact context refs`}),e.status===`resolved`&&e.reason!==void 0&&t.addIssue({code:_.ZodIssueCode.custom,path:[`reason`],message:`reason must be omitted for resolved artifact context refs`}),e.status===`resolved`&&e.target.refClass!==`artifact`&&t.addIssue({code:_.ZodIssueCode.custom,path:[`target`],message:`resolved artifact context refs must target an artifact revision`})}),k=_.object({rootRef:f,refs:_.array(Ke),resolved:_.array(l)}).superRefine((e,t)=>{let n=new Set(e.resolved.map(O));n.has(O(e.rootRef))||t.addIssue({code:_.ZodIssueCode.custom,path:[`resolved`],message:`resolved artifact context wire payloads must include the root artifact revision`}),e.refs.forEach((e,r)=>{n.has(O(e.sourceRef))||t.addIssue({code:_.ZodIssueCode.custom,path:[`refs`,r,`sourceRef`],message:`artifact context ref sources must have a matching revision in resolved`}),!(e.status!==`resolved`||e.target.refClass!==`artifact`)&&(n.has(O(e.target))||t.addIssue({code:_.ZodIssueCode.custom,path:[`refs`,r,`target`],message:`resolved artifact context refs must have a matching revision in resolved`}))})});function qe(e){let t=k.parse(e),n=new Map(t.resolved.map(e=>[O(e),e])),r=new Map;for(let e of t.refs){let t=O(e.sourceRef),n=r.get(t);n||(n=[],r.set(t,n)),n.push(e)}let i=n.get(O(t.rootRef));if(!i)throw Error(`Resolved artifact context is missing root artifact '${O(t.rootRef)}'`);let a=Je(t.rootRef,i,`inline`,r,n);return{root:a,flatten(){let e=[];return Ze(a,e),e}}}function Je(e,t,n,r,i){return{status:`resolved`,ref:e,artifact:t,hint:n,children:Xe(e,r,i,new Set([O(e)]))}}function Ye(e,t,n,r,i,a,o,s,c){let l=O(e),u=new Set(c);return u.add(l),{status:`resolved`,ref:e,artifact:t,relation:n,sourceLocalId:r,direction:i,hint:a,children:Xe(e,o,s,u)}}function Xe(e,t,n,r){return(t.get(O(e))??[]).map(e=>{if(e.status===`unresolved`)return{status:`unresolved`,target:e.target,relation:e.relationType,sourceLocalId:e.sourceLocalId,direction:e.direction,hint:e.hint,reason:e.reason};if(e.target.refClass!==`artifact`)throw Error(`Resolved artifact context refs must target an artifact revision`);let i=O(e.target),a=n.get(i);if(!a)throw Error(`Resolved artifact context is missing target artifact '${i}'`);return r.has(i)?{status:`unresolved`,target:e.target,relation:e.relationType,sourceLocalId:e.sourceLocalId,direction:e.direction,hint:e.hint,reason:`cycle-detected`}:Ye(e.target,a,e.relationType,e.sourceLocalId,e.direction,e.hint,t,n,r)})}function Ze(e,t){if(e.status!==`unresolved`){t.push(e.artifact);for(let n of e.children)Ze(n,t)}}const A=[`$set`,`$unset`,`$push`,`$pull`],j=`[A-Za-z_$][A-Za-z0-9_$]*`,M=`[A-Za-z_$][A-Za-z0-9_$-]*`,Qe=`(?:0|[1-9][0-9]*)`,$e=`(?:${`\\$\\[${j}\\]`}|${Qe}|${M})`,et=RegExp(`^${M}(?:\\.${$e})*$`),tt=RegExp(`^${j}(?:\\.${M})*$`),nt=RegExp(`^${Qe}$`),rt=RegExp(`^\\$\\[(${j})\\]$`),N=_.string().regex(et,`Expected a data-relative path of object properties, array positions, or $[filter] placeholders`);function it(e){let t=rt.exec(e);return t?.[1]===void 0?nt.test(e)?{kind:`index`,index:Number(e)}:{kind:`property`,name:e}:{kind:`filter`,placeholder:t[1]}}function at(e){return e.split(`.`).map(it)}function ot(e){return at(e).flatMap(e=>e.kind===`filter`?[e.placeholder]:[])}const st=r(_.record(_.string().regex(tt,`Expected a filter key of the form name or name.field.path`),n),{prototypeKey:`an array filter cannot compare a __proto__ key, which JSON transport drops`,nonPlainObject:`an array filter must be a plain object of comparison keys`,symbolKey:`an array filter cannot carry symbol-keyed comparisons`,nonEnumerableKey:`an array filter cannot carry non-enumerable comparison keys`,extraArrayKey:`an array filter must be a plain object, not an array`});function ct(e){let t=new Set(Object.keys(e).map(e=>e.split(`.`)[0]));if(t.size!==1)return;let[n]=t;return n!==void 0&&n.length>0?n:void 0}function P(e,t){return r(_.record(N,t),{prototypeKey:`${e} cannot address __proto__, which JSON transport drops`,nonPlainObject:`${e} must be a plain object of path instructions`,symbolKey:`${e} cannot carry symbol-keyed instructions`,nonEnumerableKey:`${e} cannot carry non-enumerable instructions`,extraArrayKey:`${e} must be a plain object, not an array`})}const lt=_.literal(!0),ut=_.strictObject({$set:P(`$set`,n).optional(),$unset:P(`$unset`,lt).optional(),$push:P(`$push`,n).optional(),$pull:P(`$pull`,n).optional(),arrayFilters:_.array(st).optional()});function F(e){return A.flatMap(t=>Object.entries(e[t]??{}).map(([e,n])=>({operator:t,path:e,value:n})))}function dt(e,t){let n=F(e),r=new Map;(e.arrayFilters??[]).forEach((e,n)=>{let i=ct(e);if(i===void 0){t.addIssue({code:`custom`,path:[`arrayFilters`,n],message:`An array filter must bind exactly one placeholder name across all of its keys`});return}if(r.has(i)){t.addIssue({code:`custom`,path:[`arrayFilters`,n],message:`Array filter placeholder ${i} is already bound by another filter`});return}r.set(i,n)});let i=new Set;for(let{operator:e,path:a}of n)for(let n of ot(a))i.add(n),r.has(n)||t.addIssue({code:`custom`,path:[e,a],message:`Path uses placeholder $[${n}] without a matching entry in arrayFilters`});for(let[e,n]of r)i.has(e)||t.addIssue({code:`custom`,path:[`arrayFilters`,n],message:`Array filter binds placeholder ${e}, which no path uses`})}const ft=ut.superRefine(dt).superRefine((e,t)=>{F(e).length===0&&t.addIssue({code:`custom`,message:`Declare at least one of ${A.join(`, `)}`})}),pt=ut.superRefine(dt),mt=_.strictObject({kind:f.shape.kind,id:f.shape.id}),ht=_.strictObject({ref:mt,baseRevision:f.shape.revision,patch:pt,dryRun:_.boolean().optional(),schemaVersion:m.optional().describe(`Target schema version for the patched revision; defaults to the base revision's. Use it to migrate an artifact left at an older version by a kind bump.`),statusPath:te.optional(),representations:ie.strict().nullable().optional().describe(`Rendering hints (markdown, summary, plaintext) for the new revision. Omit to keep the previous revision's hints. An object replaces all of them, it does not merge: send every hint you want to keep. null clears them.`)}).superRefine((e,t)=>{e.schemaVersion===void 0&&F(e.patch).length===0&&t.addIssue({code:`custom`,path:[`patch`],message:`Declare at least one of ${A.join(`, `)}, or name a schemaVersion to migrate a payload that already fits`})}),gt=[`ARTIFACT_NOT_FOUND`,`BASE_REVISION_CONFLICT`,`KIND_NOT_REGISTERED`,`SCHEMA_VERSION_MISMATCH`,`PATH_NOT_DECLARED`,`PATH_NOT_RESOLVABLE`,`TARGET_NOT_A_COLLECTION`,`UNSUPPORTED_TARGET`,`NO_MATCH`,`SCHEMA_VALIDATION_FAILED`,`PAYLOAD_INVARIANT_FAILED`,`NO_CHANGE`,`STORE_REJECTED`,`HOST_FAILED`],_t=_.strictObject({path:_.string(),reason:_.string().min(1),expectedType:_.string().min(1).optional(),allowedValues:_.array(n).optional()}),vt=_.strictObject({code:_.enum(gt),message:_.string().min(1),operator:_.enum(A).optional(),path:N.optional(),currentRevision:f.shape.revision.optional(),issues:_.array(_t).optional(),repair:_.string().min(1)}).superRefine((e,t)=>{e.code===`BASE_REVISION_CONFLICT`&&e.currentRevision===void 0&&t.addIssue({code:_.ZodIssueCode.custom,message:`A BASE_REVISION_CONFLICT must name the revision the artifact carries.`,path:[`currentRevision`]})}),yt=_.strictObject({operator:_.enum(A),path:N,matched:_.number().int().positive()}),bt=_.strictObject({from:m,to:m}).refine(e=>e.to>e.from,{path:[`to`],message:`A migration moves the artifact forward to a newer schema version`}),xt=_.strictObject({ok:_.literal(!0),base:f,operations:_.array(yt),migration:bt.optional()});function St(e,t){e.operations.length===0&&e.migration===void 0&&t.addIssue({code:`custom`,path:[`operations`],message:`A success without a migration must report at least one applied instruction`})}const Ct=xt.extend({dryRun:_.literal(!0)}).superRefine(St),wt=xt.extend({dryRun:_.literal(!1),artifact:f}).superRefine(St),Tt=_.discriminatedUnion(`dryRun`,[Ct,wt]),Et=_.strictObject({ok:_.literal(!1),error:vt}),Dt=_.union([Tt,Et]),Ot=_.object({ref:oe}),kt=_.union([_.strictObject({ok:_.literal(!0),ref:oe,areaPath:de,part:t}),_.strictObject({ok:_.literal(!1),error:le})]),I=f.pick({kind:!0,id:!0}),L=_.number().int().positive(),R=L,z={knowledge:`valid`,commitment:`proposed`,interaction:`open`},B=_.discriminatedUnion(`category`,[_.strictObject({category:_.literal(`knowledge`),state:_.enum(g.knowledge),version:R}),_.strictObject({category:_.literal(`commitment`),state:_.enum(g.commitment),version:R}),_.strictObject({category:_.literal(`interaction`),state:_.enum(g.interaction),version:R})]).superRefine((e,t)=>{e.version===1&&e.state!==z[e.category]&&t.addIssue({code:`custom`,path:[`state`],message:`Lifecycle version 1 is reserved for the category initial state`})}),V=_.union([B,_.strictObject({category:_.literal(`record`)})]),H=_.string().trim().min(1),At=_.strictObject({kind:H,ref:H}),U=_.discriminatedUnion(`kind`,[_.strictObject({kind:_.literal(`revision-assessment`),assessedRevision:f.shape.revision,source:At.optional()}),_.strictObject({kind:_.literal(`handover`),source:At})]),jt={artifact:I,expectedVersion:R,state:h,situation:U,reason:H.optional()},W=_.strictObject(jt),Mt=_.strictObject({...jt,actor:re}),Nt={valid:[`retired`],retired:[`valid`],proposed:[`decided`],decided:[`fulfilled`,`revoked`],fulfilled:[],revoked:[],open:[`resolved`,`closed-without-resolution`],resolved:[],"closed-without-resolution":[]};function G(e,t){return Nt[e].includes(t)}const Pt={artifact:I,lifecycle:B,actor:re,timestamp:_.number().int().nonnegative(),observedRevision:f.shape.revision},Ft=_.strictObject({...Pt,operation:_.literal(`initialized`)}).superRefine((e,t)=>{(e.lifecycle.version!==1||e.lifecycle.state!==z[e.lifecycle.category])&&t.addIssue({code:`custom`,path:[`lifecycle`],message:`Initialization requires the category initial state and version 1`})});function It(e,t){return t===`retired`||e===`retired`&&t===`valid`}const Lt=`Retiring or reinstating knowledge requires a reason`,K=_.strictObject({...Pt,operation:_.literal(`transitioned`),previousState:h,situation:U,reason:W.shape.reason}).superRefine((e,t)=>{(!G(e.previousState,e.lifecycle.state)||e.lifecycle.version<=1)&&t.addIssue({code:`custom`,path:[`lifecycle`],message:`History requires a category-compatible transition after initialization`}),It(e.previousState,e.lifecycle.state)&&!e.reason&&t.addIssue({code:`custom`,path:[`reason`],message:Lt}),e.situation.kind===`revision-assessment`&&e.situation.assessedRevision!==e.observedRevision&&t.addIssue({code:`custom`,path:[`situation`],message:`An assessment cannot authorize a different observed content revision`})}),Rt=_.discriminatedUnion(`operation`,[Ft,K]),q=_.discriminatedUnion(`reason`,[_.strictObject({reason:_.literal(`lifecycle-version-conflict`),expectedVersion:R,current:B,requestedState:h}),_.strictObject({reason:_.literal(`content-basis-conflict`),assessedRevision:f.shape.revision,currentRevision:f.shape.revision}),_.strictObject({reason:_.literal(`invalid-transition`),current:V,requestedState:h}),_.strictObject({reason:_.literal(`precondition-failed`),current:B,requestedState:h})]),J=`artifact-lifecycle-rejected`;var Y=class extends Error{code=J;data;constructor(e,t){super(e),this.name=`ArtifactLifecycleError`,this.data=q.parse(t)}};function zt(e){return e===`record`?{category:`record`}:B.parse({category:e,state:z[e],version:1})}function Bt(e){let t=V.parse(e.current),n=f.shape.revision.parse(e.currentRevision),r=Mt.parse(e.command);if(t.category===`record`)throw new Y(`Record artifacts do not have a lifecycle`,{reason:`invalid-transition`,current:t,requestedState:r.state});if(r.expectedVersion!==t.version)throw new Y(`Artifact lifecycle changed since the supplied baseline`,{reason:`lifecycle-version-conflict`,expectedVersion:r.expectedVersion,current:t,requestedState:r.state});if(r.situation.kind===`revision-assessment`&&r.situation.assessedRevision!==n)throw new Y(`Assessed content revision is no longer current`,{reason:`content-basis-conflict`,assessedRevision:r.situation.assessedRevision,currentRevision:n});if(!G(t.state,r.state))throw new Y(`Artifact lifecycle transition is not allowed`,{reason:`invalid-transition`,current:t,requestedState:r.state});if(It(t.state,r.state)&&!r.reason)throw new Y(Lt,{reason:`precondition-failed`,current:t,requestedState:r.state});return B.parse({...t,state:r.state,version:t.version+1})}const Vt=_.strictObject({artifact:I}),Ht=_.strictObject({lifecycle:V}),Ut=_.strictObject({artifact:I,afterVersion:L.optional(),limit:_.number().int().min(1).max(100).default(50)}),Wt=_.strictObject({entries:_.array(Rt).max(100),nextCursor:L.optional()}).superRefine(({entries:e,nextCursor:t},n)=>{let r=e[0],i;for(let[t,a]of e.entries()){let e=a.artifact.kind===r?.artifact.kind&&a.artifact.id===r?.artifact.id,o=i===void 0||a.lifecycle.version===i.lifecycle.version+1,s=i===void 0||a.operation===`transitioned`&&a.lifecycle.category===i.lifecycle.category&&a.previousState===i.lifecycle.state;if(!e||!o||!s){n.addIssue({code:`custom`,path:[`entries`,t],message:`History pages contain one artifact in contiguous ascending, state-linked order`});break}i=a}t!==void 0&&t!==i?.lifecycle.version&&n.addIssue({code:`custom`,path:[`nextCursor`],message:`nextCursor must equal the last returned lifecycle version`})}),X=_.strictObject({entry:K}),Gt=X,Kt=_.strictObject({code:_.literal(J),message:_.string().min(1),data:q});function qt(e){return{code:e.code,message:e.message,data:e.data}}function Jt(e,t){switch(t.reason){case`content-basis-conflict`:return Xt(e,t);case`lifecycle-version-conflict`:return[...Z(e,t),...Yt(e,t)];case`invalid-transition`:case`precondition-failed`:return[...Z(e,t),...Zt(e,t)]}}function Z(e,t){return t.requestedState===e.state?[]:[{path:[`requestedState`],message:`Rejection requestedState must match the rejected transition`}]}function Yt(e,t){let n=[];return t.expectedVersion!==e.expectedVersion&&n.push({path:[`expectedVersion`],message:`Version conflict baseline must match the rejected transition`}),t.current.version===e.expectedVersion&&n.push({path:[`current`,`version`],message:`Version conflict requires a current version different from the supplied baseline`}),n}function Xt(e,t){let n=[];return(e.situation.kind!==`revision-assessment`||t.assessedRevision!==e.situation.assessedRevision)&&n.push({path:[`assessedRevision`],message:`Content conflict must identify the rejected revision assessment`}),t.currentRevision===t.assessedRevision&&n.push({path:[`currentRevision`],message:`Content conflict requires a current revision different from the assessed revision`}),n}function Zt(e,t){if(t.current.category===`record`)return[];let n=[];t.current.version!==e.expectedVersion&&n.push({path:[`current`,`version`],message:`A rejection after the version check must report the supplied baseline version`});let r=G(t.current.state,t.requestedState);return t.reason===`invalid-transition`&&r&&n.push({path:[`reason`],message:`invalid-transition requires a transition the lifecycle matrix disallows`}),t.reason===`precondition-failed`&&!r&&n.push({path:[`reason`],message:`precondition-failed requires a transition the lifecycle matrix allows`}),n}const Qt=_.strictObject({transition:W,error:Kt}).superRefine(({transition:e,error:t},n)=>{for(let r of Jt(e,t.data))n.addIssue({code:`custom`,path:[`error`,`data`,...r.path],message:r.message})}),$t={"lifecycle.get":{request:Vt,response:Ht},"lifecycle.history":{request:Ut,response:Wt},"lifecycle.transition":{request:W,response:X},"lifecycle.committed":Gt,"lifecycle.rejected":Qt},en=l.omit({id:!0,slug:!0,revision:!0,timestamp:!0}),tn={...$t,"kind.register":{request:p,response:_.object({registered:_.boolean()})},"kind.list":{request:_.object({kind:_.string().min(1).optional()}),response:_.object({kinds:_.array(p)})},"relation-type.register":{request:s,response:_.object({registered:_.boolean()})},"relation-type.list":{request:_.object({type:_.string().min(1).optional()}),response:_.object({relationTypes:_.array(s)})},create:{request:en.extend({id:f.shape.id.optional(),slug:l.shape.slug.optional()}),response:_.object({artifact:l})},revise:{request:_.object({previous:f,statusPath:te.optional(),revision:en}),response:_.object({artifact:l})},patch:{request:ht,response:Dt},resolve:{request:_.object({ref:f}),response:_.object({artifact:l.nullable()})},resolvePart:{request:Ot,response:kt},query:{request:o,response:_.object({artifacts:_.array(l)})},compare:{request:ee,response:ne},"evidence.resolve":{request:ve,response:Se},resolveContext:{request:_.object({ref:f,selectors:D.optional(),maxDepth:_.number().int().min(1).max(20).default(5)}),response:_.object({context:k})},created:_.object({artifact:l}),revised:_.object({previous:f,artifact:l}),"relation.added":_.object({artifact:f,relation:c}),"observation.added":_.object({artifact:f,observation:u}),"status.changed":_.object({artifact:f,path:_.string().min(1),previous:_.unknown().optional(),current:_.unknown().optional()}),"kind.changed":_.object({kind:_.string().min(1),schemaVersion:m})},nn=_e(`artifact`,tn),rn=nn.subjects,an=_.discriminatedUnion(`refClass`,[f.omit({revision:!0}),a]);function Q(e){if(e.refClass===`artifact`)return{refClass:`artifact`,kind:e.kind,id:e.id};if(e.refClass===`entity`)return{refClass:`entity`,entityType:e.entityType,id:e.id}}function $(e){return e.refClass===`artifact`?JSON.stringify([`artifact`,e.kind,e.id]):JSON.stringify([`entity`,e.entityType,e.id])}function on(e){return e.refClass===`artifact`?`artifact:${e.kind}/${e.id}`:`entity:${e.entityType}/${e.id}`}const sn=[`relation-target`,`data`];function cn(e,t){if(!e||e.length===0)return{ok:!0,rules:[]};let n=[];for(let[r,i]of e.entries()){for(let[e,a]of i.by.entries())(!sn.includes(a.kind)||!t.includes(a.kind))&&n.push({ruleIndex:r,selectorIndex:e,capability:a.kind,message:`rule #${r}, selector #${e}: '${a.kind}' selectors are not supported`});i.lifecycleStates!==void 0&&!t.includes(`lifecycle-states`)&&n.push({ruleIndex:r,capability:`lifecycle-states`,message:`rule #${r}: lifecycleStates is declared but 'lifecycle-states' is not a supported capability`})}return n.length>0?{ok:!1,issues:n}:{ok:!0,rules:e}}function ln(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n||Array.isArray(n)||!Object.hasOwn(n,e))return;n=Reflect.get(n,e)}return{value:n}}function un(e,t,n,r){let{path:i}=e,a=ln(t,i);if(a===void 0||a.value===null||a.value===void 0)return{ruleIndex:n,selectorIndex:r,reason:`missing-value`,dataPath:i,message:`rule #${n}, selector #${r}, data path '${i}': no value found`};let{value:o}=a;return typeof o!=`string`&&typeof o!=`number`&&typeof o!=`boolean`?{ruleIndex:n,selectorIndex:r,reason:`unsupported-value-type`,dataPath:i,message:`rule #${n}, selector #${r}, data path '${i}': value must be a scalar (string, number, or boolean)`}:{path:i,value:o}}function dn(e,t,n,r,i){if(e.kind===`data`)return un(e,n,r,i);let{relationType:a}=e,o=t.filter(e=>e.type===a&&e.sourceLocalId===void 0),s=new Set,c,l;for(let e of o){let t=Q(e.target);if(t===void 0){l=e.target.refClass;break}s.add($(t)),c=t}return l===void 0?c===void 0?{ruleIndex:r,selectorIndex:i,reason:`missing-target`,relationType:a,message:`rule #${r}, selector #${i}, relation '${a}': no relations of this type found`}:s.size>1?{ruleIndex:r,selectorIndex:i,reason:`ambiguous-target`,relationType:a,message:`rule #${r}, selector #${i}, relation '${a}': ${s.size} distinct targets; expected exactly one`}:{type:a,target:c}:{ruleIndex:r,selectorIndex:i,reason:`unsupported-target`,relationType:a,message:`rule #${r}, selector #${i}, relation '${a}': found a relation with refClass '${l}'; only artifact and entity targets are supported`}}function fn(e){return`target`in e?[`relation-target`,e.type,$(e.target)]:[`data`,e.path,e.value]}function pn(e,t,n){let r=[],i=[];for(let[a,o]of e.entries()){let e=o.by.map((e,r)=>dn(e,t,n,a,r)),s=e.filter(e=>`reason`in e);if(s.length>0){i.push(...s);continue}let c=e.filter(e=>!(`reason`in e)),l=JSON.stringify(c.map(e=>fn(e)));r.push({rule:o,ruleIndex:a,parts:c,serialized:l})}return{keys:r,issues:i}}function mn(e){return e.parts.map(e=>`target`in e?`${e.type} → ${on(e.target)}`:`${e.path} → ${JSON.stringify(e.value)}`).join(`; `)}function hn(e,t,n){let r=[];for(let[i,a]of(e??[]).entries()){if(!gn(a,n))continue;let e=_n(a,t);e<a.minItems&&r.push({index:i,requirement:a,reason:`below-min-items`,count:e}),a.maxItems!==void 0&&e>a.maxItems&&r.push({index:i,requirement:a,reason:`above-max-items`,count:e})}return r}function gn(e,t){return e.when===void 0?!0:ln(t,e.when.path)?.value===e.when.equals}function _n(e,t){let n=new Set;for(let r of t){if(r.sourceLocalId!==void 0||r.type!==e.relationType)continue;let t=Q(r.target);t?.refClass===`artifact`&&(e.targetKinds?.length&&!e.targetKinds.includes(t.kind)||n.add($(t)))}return n.size}export{Dt as $,B as A,gt as B,V as C,ve as Ct,Ft as D,I as E,Bt as F,vt as G,st as H,zt as I,bt as J,Et as K,G as L,W as M,K as N,q as O,L as P,ht as Q,Ot as R,J as S,De as St,Rt as T,ft as U,A as V,Ct as W,N as X,yt as Y,wt as Z,Wt as _,D as _t,an as a,it as at,X as b,ze as bt,$ as c,Ke as ct,rn as d,O as dt,Tt as et,Gt as f,Ue as ft,Ut as g,T as gt,Ht as h,We as ht,mn as i,ot as it,Mt as j,U as k,nn as l,Ge as lt,Vt as m,E as mt,cn as n,ct as nt,Q as o,at as ot,Kt as p,He as pt,_t as q,pn as r,F as rt,on as s,qe as st,hn as t,mt as tt,tn as u,k as ut,Qt as v,Ve as vt,Y as w,Se as wt,qt as x,Oe as xt,$t as y,Be as yt,kt as z};