@makaio/framework 1.0.0-dev-1789118938035 → 1.0.0-dev-1789138982585

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 (37) hide show
  1. package/dist/.makaio-build.json +2 -2
  2. package/dist/artifact-BPK_ywFP.mjs +1 -0
  3. package/dist/bus/index.mjs +4 -4
  4. package/dist/contracts/adapter/index.d.mts +1 -1
  5. package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
  6. package/dist/contracts/artifact/index.d.mts +2 -2
  7. package/dist/contracts/artifact/index.mjs +1 -1
  8. package/dist/contracts/capabilities/index.d.mts +1 -1
  9. package/dist/contracts/client/index.d.mts +1 -1
  10. package/dist/contracts/extension/index.d.mts +2 -2
  11. package/dist/contracts/index.d.mts +12 -12
  12. package/dist/contracts/index.mjs +1 -1
  13. package/dist/contracts/materialization/index.d.mts +1 -1
  14. package/dist/contracts/worker/index.d.mts +1 -1
  15. package/dist/contracts/worker/index.mjs +1 -1
  16. package/dist/contracts/workflow/index.d.mts +1 -1
  17. package/dist/contracts/workflow/index.mjs +1 -1
  18. package/dist/{index-C7XS5mvZ.d.mts → index-BGg5g9cK.d.mts} +98 -3
  19. package/dist/{index-BFnIC2b0.d.mts → index-BXPMLk9W.d.mts} +36 -36
  20. package/dist/{index-WhgPewY4.d.mts → index-DcfuHw2O.d.mts} +6 -6
  21. package/dist/{index-D__FyAg62.d.mts → index-H2NL2OwF2.d.mts} +7 -7
  22. package/dist/{index-Den1hqEo.d.mts → index-it0mr4vE.d.mts} +2 -2
  23. package/dist/{index-l_yo-7aV.d.mts → index-ohUp4w1P.d.mts} +45 -45
  24. package/dist/package.json +1 -1
  25. package/dist/{schemas-Dt1YwXLN.d.mts → schemas-BhOepTL5.d.mts} +2 -2
  26. package/dist/services/index.d.mts +3 -3
  27. package/dist/services/settings/namespace.d.mts +2 -2
  28. package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
  29. package/dist/services/subagent-template/index.d.mts +1 -1
  30. package/dist/services/subagent-template/schemas.d.mts +1 -1
  31. package/dist/{session-lineage-DQLXk5jZ.d.mts → session-lineage-CoNs4WZy.d.mts} +1 -1
  32. package/dist/{view-builder--qgYM35J.d.mts → view-builder-ADC1ng2t.d.mts} +1 -1
  33. package/dist/{worker-nbwkoIfH.mjs → worker-CaRR3V7o.mjs} +1 -1
  34. package/dist/{workflow-Ba8qlWwV.mjs → workflow-BD7Pw5JY.mjs} +1 -1
  35. package/dist/workflow-engine/index.d.mts +39 -39
  36. package/package.json +1 -1
  37. package/dist/artifact-B9wVswQv.mjs +0 -1
@@ -836,8 +836,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
836
836
  completed: "completed";
837
837
  cancelled: "cancelled";
838
838
  failed: "failed";
839
- running: "running";
840
839
  paused: "paused";
840
+ running: "running";
841
841
  finalizing: "finalizing";
842
842
  }>;
843
843
  inputs: z.ZodType<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue>>;
@@ -878,8 +878,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
878
878
  completed: "completed";
879
879
  cancelled: "cancelled";
880
880
  failed: "failed";
881
- running: "running";
882
881
  paused: "paused";
882
+ running: "running";
883
883
  finalizing: "finalizing";
884
884
  }>;
885
885
  inputs: z.ZodType<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue>>;
@@ -927,8 +927,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
927
927
  completed: "completed";
928
928
  cancelled: "cancelled";
929
929
  failed: "failed";
930
- running: "running";
931
930
  paused: "paused";
931
+ running: "running";
932
932
  finalizing: "finalizing";
933
933
  }>;
934
934
  inputs: z.ZodType<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue>>;
@@ -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">;
@@ -1182,10 +1182,10 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1182
1182
  frameId: z.ZodString;
1183
1183
  nodeId: z.ZodString;
1184
1184
  nodeType: z.ZodEnum<{
1185
+ sequence: "sequence";
1185
1186
  station: "station";
1186
1187
  "delegate-agent": "delegate-agent";
1187
1188
  "delegate-role": "delegate-role";
1188
- sequence: "sequence";
1189
1189
  parallel: "parallel";
1190
1190
  gate: "gate";
1191
1191
  iterate: "iterate";
@@ -1227,10 +1227,10 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1227
1227
  frameId: z.ZodString;
1228
1228
  nodeId: z.ZodString;
1229
1229
  nodeType: z.ZodEnum<{
1230
+ sequence: "sequence";
1230
1231
  station: "station";
1231
1232
  "delegate-agent": "delegate-agent";
1232
1233
  "delegate-role": "delegate-role";
1233
- sequence: "sequence";
1234
1234
  parallel: "parallel";
1235
1235
  gate: "gate";
1236
1236
  iterate: "iterate";
@@ -1267,8 +1267,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1267
1267
  completed: "completed";
1268
1268
  cancelled: "cancelled";
1269
1269
  failed: "failed";
1270
- running: "running";
1271
1270
  paused: "paused";
1271
+ running: "running";
1272
1272
  finalizing: "finalizing";
1273
1273
  }>>;
1274
1274
  error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1464,8 +1464,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1464
1464
  completed: "completed";
1465
1465
  cancelled: "cancelled";
1466
1466
  failed: "failed";
1467
- running: "running";
1468
1467
  paused: "paused";
1468
+ running: "running";
1469
1469
  finalizing: "finalizing";
1470
1470
  }>>;
1471
1471
  artifactRef: z.ZodOptional<z.ZodObject<{
@@ -1488,8 +1488,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1488
1488
  completed: "completed";
1489
1489
  cancelled: "cancelled";
1490
1490
  failed: "failed";
1491
- running: "running";
1492
1491
  paused: "paused";
1492
+ running: "running";
1493
1493
  finalizing: "finalizing";
1494
1494
  }>;
1495
1495
  inputs: z.ZodType<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue>>;
@@ -1541,8 +1541,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1541
1541
  completed: "completed";
1542
1542
  cancelled: "cancelled";
1543
1543
  failed: "failed";
1544
- running: "running";
1545
1544
  paused: "paused";
1545
+ running: "running";
1546
1546
  finalizing: "finalizing";
1547
1547
  }>;
1548
1548
  inputs: z.ZodType<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue>>;
@@ -1585,10 +1585,10 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1585
1585
  frameId: z.ZodString;
1586
1586
  nodeId: z.ZodString;
1587
1587
  nodeType: z.ZodEnum<{
1588
+ sequence: "sequence";
1588
1589
  station: "station";
1589
1590
  "delegate-agent": "delegate-agent";
1590
1591
  "delegate-role": "delegate-role";
1591
- sequence: "sequence";
1592
1592
  parallel: "parallel";
1593
1593
  gate: "gate";
1594
1594
  iterate: "iterate";
@@ -1631,10 +1631,10 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1631
1631
  frameId: z.ZodString;
1632
1632
  nodeId: z.ZodString;
1633
1633
  nodeType: z.ZodEnum<{
1634
+ sequence: "sequence";
1634
1635
  station: "station";
1635
1636
  "delegate-agent": "delegate-agent";
1636
1637
  "delegate-role": "delegate-role";
1637
- sequence: "sequence";
1638
1638
  parallel: "parallel";
1639
1639
  gate: "gate";
1640
1640
  iterate: "iterate";
@@ -1674,10 +1674,10 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
1674
1674
  frameId: z.ZodString;
1675
1675
  nodeId: z.ZodString;
1676
1676
  nodeType: z.ZodEnum<{
1677
+ sequence: "sequence";
1677
1678
  station: "station";
1678
1679
  "delegate-agent": "delegate-agent";
1679
1680
  "delegate-role": "delegate-role";
1680
- sequence: "sequence";
1681
1681
  parallel: "parallel";
1682
1682
  gate: "gate";
1683
1683
  iterate: "iterate";
@@ -2208,8 +2208,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
2208
2208
  "exit-and-resume": "exit-and-resume";
2209
2209
  }>>;
2210
2210
  terminalAuthority: z.ZodOptional<z.ZodEnum<{
2211
- authority: "authority";
2212
2211
  worker: "worker";
2212
+ authority: "authority";
2213
2213
  }>>;
2214
2214
  materializationSpec: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2215
2215
  kind: z.ZodLiteral<"local-directory">;
@@ -2395,8 +2395,8 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
2395
2395
  "exit-and-resume": "exit-and-resume";
2396
2396
  }>>;
2397
2397
  terminalAuthority: z.ZodOptional<z.ZodEnum<{
2398
- authority: "authority";
2399
2398
  worker: "worker";
2399
+ authority: "authority";
2400
2400
  }>>;
2401
2401
  materializationSpec: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2402
2402
  kind: z.ZodLiteral<"local-directory">;
@@ -3058,7 +3058,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
3058
3058
  tableName: "workflow_executions";
3059
3059
  dataType: "string";
3060
3060
  columnType: "SQLiteText";
3061
- data: "pending" | "completed" | "cancelled" | "failed" | "running" | "paused" | "finalizing";
3061
+ data: "pending" | "completed" | "cancelled" | "failed" | "paused" | "running" | "finalizing";
3062
3062
  driverParam: string;
3063
3063
  notNull: true;
3064
3064
  hasDefault: false;
@@ -3327,7 +3327,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
3327
3327
  tableName: "workflow_execution_frames";
3328
3328
  dataType: "string";
3329
3329
  columnType: "SQLiteText";
3330
- data: "station" | "delegate-agent" | "delegate-role" | "sequence" | "parallel" | "gate" | "iterate" | "iterate-chain" | "loop";
3330
+ data: "sequence" | "station" | "delegate-agent" | "delegate-role" | "parallel" | "gate" | "iterate" | "iterate-chain" | "loop";
3331
3331
  driverParam: string;
3332
3332
  notNull: true;
3333
3333
  hasDefault: false;
@@ -3340,7 +3340,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
3340
3340
  generated: undefined;
3341
3341
  }, {}, {
3342
3342
  length: number | undefined;
3343
- $type: "station" | "delegate-agent" | "delegate-role" | "sequence" | "parallel" | "gate" | "iterate" | "iterate-chain" | "loop";
3343
+ $type: "sequence" | "station" | "delegate-agent" | "delegate-role" | "parallel" | "gate" | "iterate" | "iterate-chain" | "loop";
3344
3344
  }>;
3345
3345
  path: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
3346
3346
  name: string;
@@ -4795,7 +4795,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
4795
4795
  tableName: "workflow_run_contexts";
4796
4796
  dataType: "string";
4797
4797
  columnType: "SQLiteText";
4798
- data: "authority" | "worker" | undefined;
4798
+ data: "worker" | "authority" | undefined;
4799
4799
  driverParam: string;
4800
4800
  notNull: false;
4801
4801
  hasDefault: false;
@@ -4808,7 +4808,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
4808
4808
  generated: undefined;
4809
4809
  }, {}, {
4810
4810
  length: number | undefined;
4811
- $type: "authority" | "worker" | undefined;
4811
+ $type: "worker" | "authority" | undefined;
4812
4812
  }>;
4813
4813
  materializationSpec: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
4814
4814
  name: string;
@@ -4918,7 +4918,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
4918
4918
  tableName: "worklog_summaries";
4919
4919
  dataType: "string";
4920
4920
  columnType: "SQLiteText";
4921
- data: "pending" | "completed" | "cancelled" | "failed" | "running" | "paused" | "finalizing";
4921
+ data: "pending" | "completed" | "cancelled" | "failed" | "paused" | "running" | "finalizing";
4922
4922
  driverParam: string;
4923
4923
  notNull: true;
4924
4924
  hasDefault: false;
@@ -5141,7 +5141,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
5141
5141
  tableName: "worklog_frame_entries";
5142
5142
  dataType: "string";
5143
5143
  columnType: "SQLiteText";
5144
- data: "station" | "delegate-agent" | "delegate-role" | "sequence" | "parallel" | "gate" | "iterate" | "iterate-chain" | "loop";
5144
+ data: "sequence" | "station" | "delegate-agent" | "delegate-role" | "parallel" | "gate" | "iterate" | "iterate-chain" | "loop";
5145
5145
  driverParam: string;
5146
5146
  notNull: true;
5147
5147
  hasDefault: false;
@@ -5154,7 +5154,7 @@ declare const WorkflowStorageNamespace: _$_makaio_storage_core0.StorageNamespace
5154
5154
  generated: undefined;
5155
5155
  }, {}, {
5156
5156
  length: number | undefined;
5157
- $type: "station" | "delegate-agent" | "delegate-role" | "sequence" | "parallel" | "gate" | "iterate" | "iterate-chain" | "loop";
5157
+ $type: "sequence" | "station" | "delegate-agent" | "delegate-role" | "parallel" | "gate" | "iterate" | "iterate-chain" | "loop";
5158
5158
  }>;
5159
5159
  path: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
5160
5160
  name: string;
@@ -6459,8 +6459,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
6459
6459
  completed: "completed";
6460
6460
  cancelled: "cancelled";
6461
6461
  failed: "failed";
6462
- running: "running";
6463
6462
  paused: "paused";
6463
+ running: "running";
6464
6464
  finalizing: "finalizing";
6465
6465
  }>;
6466
6466
  inputs: z.ZodType<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue>>;
@@ -6501,8 +6501,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
6501
6501
  completed: "completed";
6502
6502
  cancelled: "cancelled";
6503
6503
  failed: "failed";
6504
- running: "running";
6505
6504
  paused: "paused";
6505
+ running: "running";
6506
6506
  finalizing: "finalizing";
6507
6507
  }>;
6508
6508
  inputs: z.ZodType<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue>>;
@@ -6550,8 +6550,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
6550
6550
  completed: "completed";
6551
6551
  cancelled: "cancelled";
6552
6552
  failed: "failed";
6553
- running: "running";
6554
6553
  paused: "paused";
6554
+ running: "running";
6555
6555
  finalizing: "finalizing";
6556
6556
  }>;
6557
6557
  inputs: z.ZodType<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue>>;
@@ -6736,8 +6736,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
6736
6736
  "exit-and-resume": "exit-and-resume";
6737
6737
  }>>;
6738
6738
  terminalAuthority: z.ZodOptional<z.ZodEnum<{
6739
- authority: "authority";
6740
6739
  worker: "worker";
6740
+ authority: "authority";
6741
6741
  }>>;
6742
6742
  materializationSpec: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
6743
6743
  kind: z.ZodLiteral<"local-directory">;
@@ -6805,10 +6805,10 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
6805
6805
  frameId: z.ZodString;
6806
6806
  nodeId: z.ZodString;
6807
6807
  nodeType: z.ZodEnum<{
6808
+ sequence: "sequence";
6808
6809
  station: "station";
6809
6810
  "delegate-agent": "delegate-agent";
6810
6811
  "delegate-role": "delegate-role";
6811
- sequence: "sequence";
6812
6812
  parallel: "parallel";
6813
6813
  gate: "gate";
6814
6814
  iterate: "iterate";
@@ -6850,10 +6850,10 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
6850
6850
  frameId: z.ZodString;
6851
6851
  nodeId: z.ZodString;
6852
6852
  nodeType: z.ZodEnum<{
6853
+ sequence: "sequence";
6853
6854
  station: "station";
6854
6855
  "delegate-agent": "delegate-agent";
6855
6856
  "delegate-role": "delegate-role";
6856
- sequence: "sequence";
6857
6857
  parallel: "parallel";
6858
6858
  gate: "gate";
6859
6859
  iterate: "iterate";
@@ -6890,8 +6890,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
6890
6890
  completed: "completed";
6891
6891
  cancelled: "cancelled";
6892
6892
  failed: "failed";
6893
- running: "running";
6894
6893
  paused: "paused";
6894
+ running: "running";
6895
6895
  finalizing: "finalizing";
6896
6896
  }>>;
6897
6897
  error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -7087,8 +7087,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7087
7087
  completed: "completed";
7088
7088
  cancelled: "cancelled";
7089
7089
  failed: "failed";
7090
- running: "running";
7091
7090
  paused: "paused";
7091
+ running: "running";
7092
7092
  finalizing: "finalizing";
7093
7093
  }>>;
7094
7094
  artifactRef: z.ZodOptional<z.ZodObject<{
@@ -7111,8 +7111,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7111
7111
  completed: "completed";
7112
7112
  cancelled: "cancelled";
7113
7113
  failed: "failed";
7114
- running: "running";
7115
7114
  paused: "paused";
7115
+ running: "running";
7116
7116
  finalizing: "finalizing";
7117
7117
  }>;
7118
7118
  inputs: z.ZodType<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue>>;
@@ -7164,8 +7164,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7164
7164
  completed: "completed";
7165
7165
  cancelled: "cancelled";
7166
7166
  failed: "failed";
7167
- running: "running";
7168
7167
  paused: "paused";
7168
+ running: "running";
7169
7169
  finalizing: "finalizing";
7170
7170
  }>;
7171
7171
  inputs: z.ZodType<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, _$_makaio_contracts0.JsonValue>>;
@@ -7208,10 +7208,10 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7208
7208
  frameId: z.ZodString;
7209
7209
  nodeId: z.ZodString;
7210
7210
  nodeType: z.ZodEnum<{
7211
+ sequence: "sequence";
7211
7212
  station: "station";
7212
7213
  "delegate-agent": "delegate-agent";
7213
7214
  "delegate-role": "delegate-role";
7214
- sequence: "sequence";
7215
7215
  parallel: "parallel";
7216
7216
  gate: "gate";
7217
7217
  iterate: "iterate";
@@ -7254,10 +7254,10 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7254
7254
  frameId: z.ZodString;
7255
7255
  nodeId: z.ZodString;
7256
7256
  nodeType: z.ZodEnum<{
7257
+ sequence: "sequence";
7257
7258
  station: "station";
7258
7259
  "delegate-agent": "delegate-agent";
7259
7260
  "delegate-role": "delegate-role";
7260
- sequence: "sequence";
7261
7261
  parallel: "parallel";
7262
7262
  gate: "gate";
7263
7263
  iterate: "iterate";
@@ -7297,10 +7297,10 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7297
7297
  frameId: z.ZodString;
7298
7298
  nodeId: z.ZodString;
7299
7299
  nodeType: z.ZodEnum<{
7300
+ sequence: "sequence";
7300
7301
  station: "station";
7301
7302
  "delegate-agent": "delegate-agent";
7302
7303
  "delegate-role": "delegate-role";
7303
- sequence: "sequence";
7304
7304
  parallel: "parallel";
7305
7305
  gate: "gate";
7306
7306
  iterate: "iterate";
@@ -7831,8 +7831,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
7831
7831
  "exit-and-resume": "exit-and-resume";
7832
7832
  }>>;
7833
7833
  terminalAuthority: z.ZodOptional<z.ZodEnum<{
7834
- authority: "authority";
7835
7834
  worker: "worker";
7835
+ authority: "authority";
7836
7836
  }>>;
7837
7837
  materializationSpec: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
7838
7838
  kind: z.ZodLiteral<"local-directory">;
@@ -8018,8 +8018,8 @@ declare const WorkflowStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
8018
8018
  "exit-and-resume": "exit-and-resume";
8019
8019
  }>>;
8020
8020
  terminalAuthority: z.ZodOptional<z.ZodEnum<{
8021
- authority: "authority";
8022
8021
  worker: "worker";
8022
+ authority: "authority";
8023
8023
  }>>;
8024
8024
  materializationSpec: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
8025
8025
  kind: z.ZodLiteral<"local-directory">;
@@ -8379,7 +8379,7 @@ declare const worklogFrameEntriesDual: _$_makaio_storage_drizzle0.DualTable<"wor
8379
8379
  /** Unique frame identifier within the execution. */frameId: _$_makaio_storage_drizzle0.DualBuilder<_$drizzle_orm0.IsPrimaryKey<_$drizzle_orm0.NotNull<_$drizzle_orm_sqlite_core0.SQLiteTextBuilderInitial<"frame_id", [string, ...string[]], number | undefined>>>, _$drizzle_orm0.IsPrimaryKey<_$drizzle_orm0.NotNull<_$drizzle_orm_pg_core0.PgTextBuilderInitial<"frame_id", [string, ...string[]]>>>>; /** Execution this frame belongs to. */
8380
8380
  executionId: _$_makaio_storage_drizzle0.DualBuilder<_$drizzle_orm0.NotNull<_$drizzle_orm_sqlite_core0.SQLiteTextBuilderInitial<"execution_id", [string, ...string[]], number | undefined>>, _$drizzle_orm0.NotNull<_$drizzle_orm_pg_core0.PgTextBuilderInitial<"execution_id", [string, ...string[]]>>>; /** Node identifier from the workflow definition. */
8381
8381
  nodeId: _$_makaio_storage_drizzle0.DualBuilder<_$drizzle_orm0.NotNull<_$drizzle_orm_sqlite_core0.SQLiteTextBuilderInitial<"node_id", [string, ...string[]], number | undefined>>, _$drizzle_orm0.NotNull<_$drizzle_orm_pg_core0.PgTextBuilderInitial<"node_id", [string, ...string[]]>>>; /** Node type discriminant. */
8382
- nodeType: _$_makaio_storage_drizzle0.DualBuilder<_$drizzle_orm0.$Type<_$drizzle_orm0.NotNull<_$drizzle_orm_sqlite_core0.SQLiteTextBuilderInitial<"node_type", [string, ...string[]], number | undefined>>, "station" | "delegate-agent" | "delegate-role" | "sequence" | "parallel" | "gate" | "iterate" | "iterate-chain" | "loop">, _$drizzle_orm0.$Type<_$drizzle_orm0.NotNull<_$drizzle_orm_pg_core0.PgTextBuilderInitial<"node_type", [string, ...string[]]>>, "station" | "delegate-agent" | "delegate-role" | "sequence" | "parallel" | "gate" | "iterate" | "iterate-chain" | "loop">>;
8382
+ nodeType: _$_makaio_storage_drizzle0.DualBuilder<_$drizzle_orm0.$Type<_$drizzle_orm0.NotNull<_$drizzle_orm_sqlite_core0.SQLiteTextBuilderInitial<"node_type", [string, ...string[]], number | undefined>>, "sequence" | "station" | "delegate-agent" | "delegate-role" | "parallel" | "gate" | "iterate" | "iterate-chain" | "loop">, _$drizzle_orm0.$Type<_$drizzle_orm0.NotNull<_$drizzle_orm_pg_core0.PgTextBuilderInitial<"node_type", [string, ...string[]]>>, "sequence" | "station" | "delegate-agent" | "delegate-role" | "parallel" | "gate" | "iterate" | "iterate-chain" | "loop">>;
8383
8383
  /**
8384
8384
  * Ordered path of frame IDs from the root frame to this frame (inclusive).
8385
8385
  * Stored as a JSON array for tree correlation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makaio/framework",
3
- "version": "1.0.0-dev-1789118938035",
3
+ "version": "1.0.0-dev-1789138982585",
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{o as t,s as n}from"./json-value-DM-EjTC1.mjs";import{C as r,a as i,b as a,c as o,d as s,i as c,l,n as ee,p as u,r as te,t as ne,w as d,x as re}from"./schemas-BhkprYU1.mjs";import{a as f,g as ie,l as ae,p as oe,s as p,t as m}from"./kind-registration-CyMf-vey.mjs";import{t as se}from"./zod-json-schema-DGWHUOK0.mjs";import{t as ce}from"./ajv-Dz-0DD7m.mjs";import{t as le}from"./2020-DvDj4r_K.mjs";import{t as ue}from"./dist-DMIaE8sg.mjs";import{z as h}from"zod";import{createBusNamespace as de}from"@makaio/framework/core";const g=h.strictObject({evidence:r}),_=h.strictObject({kind:h.literal(`text`),text:h.string()}),[fe,pe,me]=r.options,v=h.union([fe.pick({source:!0,location:!0}).extend({content:_}),pe.pick({source:!0,location:!0}).extend({content:_}),me.pick({source:!0,location:!0}).extend({content:_})]);function y(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function b(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function he(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 ge(e,t,n){if(e[`x-makaio-value-type`]!==`evidence/v1`)return;let i=r.safeParse(t);if(!i.success)throw Error(`Invalid schema-declared evidence at ${n}`);return{evidence:i.data,dataPath:n}}function _e(e,t,n,r){if(typeof t.$ref!=`string`)return!1;if(r)return!0;let i=he(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`||_e(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 ve=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=he(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=ge(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 ee=this.visitPatterns(a,o,s,`${n}/${t}`,r),u=y(e.additionalProperties);!c&&!ee&&u&&this.visit(u,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 ye(e,t,n){return new ve(e,n.matchesSchema).extract(t)}function be(e){let{dataSchema:t,hooks:n,...r}=e,i={$schema:`https://json-schema.org/draft/2020-12/schema`,...se(t)};oe(i);let a=f.parse({...r,dataSchema:i});if(a.kind!==e.kind)throw Error(`Artifact kind identifiers must not contain surrounding whitespace`);let o=h.fromJSONSchema(a.dataSchema),s=h.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)=>{try{ie(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 xe=e(ce(),1),Se=e(le(),1),Ce=e(ue(),1);function we(e){let t={allErrors:!0,strict:!1,strictSchema:!0},n=e.dataSchema.$schema===`https://json-schema.org/draft/2020-12/schema`?new Se.default(t):new xe.default(t);return(0,Ce.default)(n),n.addKeyword({keyword:re,schemaType:`string`,valid:!0}),n.compile(e.dataSchema)}function Te(e){return e.replace(/~1/gu,`/`).replace(/~0/gu,`~`)}function Ee(e){let t=e.instancePath.split(`/`).slice(1).map(Te),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 De(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 Oe=t.array();function ke(e){if(e.keyword!==`enum`)return;let t=Oe.safeParse(e.params.allowedValues);return t.success?t.data:void 0}function Ae(e){return(e??[]).map(e=>{let t=De(e),n=ke(e);return{path:Ee(e),reason:e.message??`violates ${e.keyword}`,...t===void 0?{}:{expectedType:t},...n===void 0?{}:{allowedValues:n}}})}function je(e){return we(e)}function Me(e){let t=we(e);return e=>t(e)?{valid:!0}:{valid:!1,issues:Ae(t.errors)}}function Ne(e){return{hooks:[...e.hooks]}}const Pe=[`inline`,`summary`,`link`,`omit`],C=h.string().min(1),w=h.object({kinds:h.array(h.string().min(1)).optional(),hint:C.optional(),depth:h.number().int().min(1).max(20).optional(),nested:h.lazy(()=>T).optional()}),T=h.record(h.string().min(1),w);function E(e){return JSON.stringify([e.kind,e.id,e.revision])}const D=h.enum([`not-selected`,`not-found`,`depth-exceeded`,`unsupported-ref-class`,`cycle-detected`]),O=h.object({target:l,sourceRef:d,relationType:h.string().min(1),hint:C,status:h.enum([`resolved`,`unresolved`]),reason:D.optional()}).superRefine((e,t)=>{e.status===`unresolved`&&e.reason===void 0&&t.addIssue({code:h.ZodIssueCode.custom,path:[`reason`],message:`reason is required for unresolved artifact context refs`}),e.status===`resolved`&&e.reason!==void 0&&t.addIssue({code:h.ZodIssueCode.custom,path:[`reason`],message:`reason must be omitted for resolved artifact context refs`}),e.status===`resolved`&&e.target.refClass!==`artifact`&&t.addIssue({code:h.ZodIssueCode.custom,path:[`target`],message:`resolved artifact context refs must target an artifact revision`})}),k=h.object({rootRef:d,refs:h.array(O),resolved:h.array(s)}).superRefine((e,t)=>{let n=new Set(e.resolved.map(E));n.has(E(e.rootRef))||t.addIssue({code:h.ZodIssueCode.custom,path:[`resolved`],message:`resolved artifact context wire payloads must include the root artifact revision`}),e.refs.forEach((e,r)=>{n.has(E(e.sourceRef))||t.addIssue({code:h.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(E(e.target))||t.addIssue({code:h.ZodIssueCode.custom,path:[`refs`,r,`target`],message:`resolved artifact context refs must have a matching revision in resolved`}))})});function Fe(e){let t=k.parse(e),n=new Map(t.resolved.map(e=>[M(e),e])),r=new Map;for(let e of t.refs){let t=M(e.sourceRef),n=r.get(t);n||(n=[],r.set(t,n)),n.push(e)}let i=n.get(M(t.rootRef));if(!i)throw Error(`Resolved artifact context is missing root artifact '${M(t.rootRef)}'`);let a=Ie(t.rootRef,i,`inline`,r,n);return{root:a,flatten(){let e=[];return j(a,e),e}}}function Ie(e,t,n,r,i){return{status:`resolved`,ref:e,artifact:t,hint:n,children:A(e,r,i,new Set([M(e)]))}}function Le(e,t,n,r,i,a,o){let s=M(e),c=new Set(o);return c.add(s),{status:`resolved`,ref:e,artifact:t,relation:n,hint:r,children:A(e,i,a,c)}}function A(e,t,n,r){return(t.get(M(e))??[]).map(e=>{if(e.status===`unresolved`)return{status:`unresolved`,target:e.target,relation:e.relationType,hint:e.hint,reason:e.reason};if(e.target.refClass!==`artifact`)throw Error(`Resolved artifact context refs must target an artifact revision`);let i=M(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,hint:e.hint,reason:`cycle-detected`}:Le(e.target,a,e.relationType,e.hint,t,n,r)})}function j(e,t){if(e.status!==`unresolved`){t.push(e.artifact);for(let n of e.children)j(n,t)}}function M(e){return JSON.stringify([e.kind,e.id,e.revision])}const N=[`$set`,`$unset`,`$push`,`$pull`],P=`[A-Za-z_$][A-Za-z0-9_$]*`,F=`[A-Za-z_$][A-Za-z0-9_$-]*`,Re=`(?:0|[1-9][0-9]*)`,ze=`(?:${`\\$\\[${P}\\]`}|${Re}|${F})`,Be=RegExp(`^${F}(?:\\.${ze})*$`),Ve=RegExp(`^${P}(?:\\.${F})*$`),He=RegExp(`^${Re}$`),Ue=RegExp(`^\\$\\[(${P})\\]$`),I=h.string().regex(Be,`Expected a data-relative path of object properties, array positions, or $[filter] placeholders`);function L(e){let t=Ue.exec(e);return t?.[1]===void 0?He.test(e)?{kind:`index`,index:Number(e)}:{kind:`property`,name:e}:{kind:`filter`,placeholder:t[1]}}function We(e){return e.split(`.`).map(L)}function Ge(e){return We(e).flatMap(e=>e.kind===`filter`?[e.placeholder]:[])}const Ke=n(h.record(h.string().regex(Ve,`Expected a filter key of the form name or name.field.path`),t),{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 qe(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 R(e,t){return n(h.record(I,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 Je=h.literal(!0),Ye=h.strictObject({$set:R(`$set`,t).optional(),$unset:R(`$unset`,Je).optional(),$push:R(`$push`,t).optional(),$pull:R(`$pull`,t).optional(),arrayFilters:h.array(Ke).optional()});function Xe(e){return N.flatMap(t=>Object.entries(e[t]??{}).map(([e,n])=>({operator:t,path:e,value:n})))}function Ze(e,t){let n=Xe(e);if(n.length===0){t.addIssue({code:`custom`,message:`Declare at least one of ${N.join(`, `)}`});return}let r=new Map;(e.arrayFilters??[]).forEach((e,n)=>{let i=qe(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 Ge(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 Qe=Ye.superRefine(Ze),$e=h.strictObject({kind:d.shape.kind,id:d.shape.id}),et=h.strictObject({ref:$e,baseRevision:d.shape.revision,patch:Qe,dryRun:h.boolean().optional(),statusPath:u.optional()}),tt=[`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`,`HOST_FAILED`],nt=h.strictObject({path:h.string(),reason:h.string().min(1),expectedType:h.string().min(1).optional(),allowedValues:h.array(t).optional()}),rt=h.strictObject({code:h.enum(tt),message:h.string().min(1),operator:h.enum(N).optional(),path:I.optional(),currentRevision:d.shape.revision.optional(),issues:h.array(nt).optional(),repair:h.string().min(1)}).superRefine((e,t)=>{e.code===`BASE_REVISION_CONFLICT`&&e.currentRevision===void 0&&t.addIssue({code:h.ZodIssueCode.custom,message:`A BASE_REVISION_CONFLICT must name the revision the artifact carries.`,path:[`currentRevision`]})}),it=h.strictObject({operator:h.enum(N),path:I,matched:h.number().int().positive()}),at=h.strictObject({ok:h.literal(!0),base:d,operations:h.array(it).min(1)}),ot=at.extend({dryRun:h.literal(!0)}),st=at.extend({dryRun:h.literal(!1),artifact:d}),ct=h.discriminatedUnion(`dryRun`,[ot,st]),lt=h.strictObject({ok:h.literal(!1),error:rt}),ut=h.union([ct,lt]),z=d.pick({kind:!0,id:!0}),B=h.number().int().positive(),V=B,H={knowledge:`valid`,commitment:`proposed`,interaction:`open`},U=h.discriminatedUnion(`category`,[h.strictObject({category:h.literal(`knowledge`),state:h.enum(m.knowledge),version:V}),h.strictObject({category:h.literal(`commitment`),state:h.enum(m.commitment),version:V}),h.strictObject({category:h.literal(`interaction`),state:h.enum(m.interaction),version:V})]).superRefine((e,t)=>{e.version===1&&e.state!==H[e.category]&&t.addIssue({code:`custom`,path:[`state`],message:`Lifecycle version 1 is reserved for the category initial state`})}),W=h.union([U,h.strictObject({category:h.literal(`record`)})]),G=h.string().trim().min(1),dt=h.strictObject({kind:G,ref:G}),K=h.discriminatedUnion(`kind`,[h.strictObject({kind:h.literal(`revision-assessment`),assessedRevision:d.shape.revision,source:dt.optional()}),h.strictObject({kind:h.literal(`handover`),source:dt})]),ft={artifact:z,expectedVersion:V,state:p,situation:K,reason:G.optional()},q=h.strictObject(ft),pt=h.strictObject({...ft,actor:ne}),mt={valid:[`retired`],retired:[],proposed:[`decided`],decided:[`fulfilled`,`revoked`],fulfilled:[],revoked:[],open:[`resolved`,`closed-without-resolution`],resolved:[],"closed-without-resolution":[]};function J(e,t){return mt[e].includes(t)}const ht={artifact:z,lifecycle:U,actor:ne,timestamp:h.number().int().nonnegative(),observedRevision:d.shape.revision},gt=h.strictObject({...ht,operation:h.literal(`initialized`)}).superRefine((e,t)=>{(e.lifecycle.version!==1||e.lifecycle.state!==H[e.lifecycle.category])&&t.addIssue({code:`custom`,path:[`lifecycle`],message:`Initialization requires the category initial state and version 1`})}),Y=h.strictObject({...ht,operation:h.literal(`transitioned`),previousState:p,situation:K,reason:q.shape.reason}).superRefine((e,t)=>{(!J(e.previousState,e.lifecycle.state)||e.lifecycle.version<=1)&&t.addIssue({code:`custom`,path:[`lifecycle`],message:`History requires a category-compatible transition after initialization`}),e.lifecycle.state===`retired`&&!e.reason&&t.addIssue({code:`custom`,path:[`reason`],message:`Retiring knowledge requires a reason`}),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`})}),_t=h.discriminatedUnion(`operation`,[gt,Y]),X=h.discriminatedUnion(`reason`,[h.strictObject({reason:h.literal(`lifecycle-version-conflict`),expectedVersion:V,current:U,requestedState:p}),h.strictObject({reason:h.literal(`content-basis-conflict`),assessedRevision:d.shape.revision,currentRevision:d.shape.revision}),h.strictObject({reason:h.literal(`invalid-transition`),current:W,requestedState:p}),h.strictObject({reason:h.literal(`precondition-failed`),current:U,requestedState:p})]),Z=`artifact-lifecycle-rejected`;var Q=class extends Error{code=Z;data;constructor(e,t){super(e),this.name=`ArtifactLifecycleError`,this.data=X.parse(t)}};function vt(e){return e===`record`?{category:`record`}:U.parse({category:e,state:H[e],version:1})}function yt(e){let t=W.parse(e.current),n=d.shape.revision.parse(e.currentRevision),r=pt.parse(e.command);if(t.category===`record`)throw new Q(`Record artifacts do not have a lifecycle`,{reason:`invalid-transition`,current:t,requestedState:r.state});if(r.expectedVersion!==t.version)throw new Q(`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 Q(`Assessed content revision is no longer current`,{reason:`content-basis-conflict`,assessedRevision:r.situation.assessedRevision,currentRevision:n});if(!J(t.state,r.state))throw new Q(`Artifact lifecycle transition is not allowed`,{reason:`invalid-transition`,current:t,requestedState:r.state});if(r.state===`retired`&&!r.reason)throw new Q(`Retiring knowledge requires a reason`,{reason:`precondition-failed`,current:t,requestedState:r.state});return U.parse({...t,state:r.state,version:t.version+1})}const bt=h.strictObject({artifact:z}),xt=h.strictObject({lifecycle:W}),St=h.strictObject({artifact:z,afterVersion:B.optional(),limit:h.number().int().min(1).max(100).default(50)}),Ct=h.strictObject({entries:h.array(_t).max(100),nextCursor:B.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`})}),$=h.strictObject({entry:Y}),wt=$,Tt=h.strictObject({code:h.literal(Z),message:h.string().min(1),data:X});function Et(e){return{code:e.code,message:e.message,data:e.data}}function Dt(e,t){switch(t.reason){case`content-basis-conflict`:return At(e,t);case`lifecycle-version-conflict`:return[...Ot(e,t),...kt(e,t)];case`invalid-transition`:case`precondition-failed`:return[...Ot(e,t),...jt(e,t)]}}function Ot(e,t){return t.requestedState===e.state?[]:[{path:[`requestedState`],message:`Rejection requestedState must match the rejected transition`}]}function kt(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 At(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 jt(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=J(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 Mt=h.strictObject({transition:q,error:Tt}).superRefine(({transition:e,error:t},n)=>{for(let r of Dt(e,t.data))n.addIssue({code:`custom`,path:[`error`,`data`,...r.path],message:r.message})}),Nt={"lifecycle.get":{request:bt,response:xt},"lifecycle.history":{request:St,response:Ct},"lifecycle.transition":{request:q,response:$},"lifecycle.committed":wt,"lifecycle.rejected":Mt},Pt={...Nt,"kind.register":{request:f,response:h.object({registered:h.boolean()})},"kind.list":{request:h.object({kind:h.string().min(1).optional()}),response:h.object({kinds:h.array(f)})},"relation-type.register":{request:a,response:h.object({registered:h.boolean()})},"relation-type.list":{request:h.object({type:h.string().min(1).optional()}),response:h.object({relationTypes:h.array(a)})},create:{request:s.omit({id:!0,revision:!0,timestamp:!0}).extend({id:d.shape.id.optional()}),response:h.object({artifact:s})},revise:{request:h.object({previous:d,statusPath:u.optional(),revision:s.omit({id:!0,revision:!0,timestamp:!0})}),response:h.object({artifact:s})},patch:{request:et,response:ut},resolve:{request:h.object({ref:d}),response:h.object({artifact:s.nullable()})},query:{request:i,response:h.object({artifacts:h.array(s)})},compare:{request:ee,response:te},"evidence.resolve":{request:g,response:v},resolveContext:{request:h.object({ref:d,selectors:T.optional(),maxDepth:h.number().int().min(1).max(20).default(5)}),response:h.object({context:k})},created:h.object({artifact:s}),revised:h.object({previous:d,artifact:s}),"relation.added":h.object({artifact:d,relation:o}),"observation.added":h.object({artifact:d,observation:c}),"status.changed":h.object({artifact:d,path:h.string().min(1),previous:h.unknown().optional(),current:h.unknown().optional()}),"kind.changed":h.object({kind:h.string().min(1),schemaVersion:ae})},Ft=de(`artifact`,Pt),It=Ft.subjects;export{k as $,tt as A,st as B,pt as C,yt as D,B as E,rt as F,qe as G,ut as H,lt as I,L as J,Xe as K,nt as L,Ke as M,Qe as N,vt as O,ot as P,D as Q,it as R,U as S,Y as T,ct as U,et as V,$e as W,Fe as X,We as Y,O as Z,_t as _,Tt as a,Me as at,X as b,St as c,ye as ct,Nt as d,Pe as et,$ as f,Q as g,W as h,wt as i,Ne as it,N as j,J as k,Ct as l,g as lt,Z as m,Pt as n,C as nt,bt as o,je as ot,Et as p,Ge as q,It as r,T as rt,xt as s,be as st,Ft as t,w as tt,Mt as u,v as ut,z as v,q as w,K as x,gt as y,I as z};