@hardkas/artifacts 0.5.5-alpha → 0.6.1-alpha

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 (3) hide show
  1. package/dist/index.d.ts +392 -33
  2. package/dist/index.js +341 -80
  3. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { ArtifactType, NetworkId, ExecutionMode, ContentHash, WorkflowId, ArtifactId, LineageId, EventSequence, TxId, KaspaAddress, CorruptionCode, CorruptionSeverity, EventEnvelope } from '@hardkas/core';
1
+ import { ArtifactType, NetworkId, ExecutionMode, ContentHash, WorkflowId, ArtifactId, LineageId, EventSequence, TxId, KaspaAddress, CorruptionCode, CorruptionSeverity, EventEnvelope, RuntimeContext } from '@hardkas/core';
2
2
  import { z } from 'zod';
3
3
  import { TxOutput, Utxo, TxPlan as TxPlan$1 } from '@hardkas/tx-builder';
4
4
 
5
- declare const HARDKAS_VERSION = "0.5.5-alpha";
5
+ declare const HARDKAS_VERSION: string;
6
6
  declare const ARTIFACT_SCHEMAS: {
7
7
  readonly LOCALNET_STATE: "hardkas.localnetState.v1";
8
8
  readonly REAL_ACCOUNT_STORE: "hardkas.realAccountStore.v1";
@@ -19,6 +19,7 @@ type HardkasArtifactSchema = typeof ARTIFACT_SCHEMAS[keyof typeof ARTIFACT_SCHEM
19
19
  type HardkasArtifactMode = "simulated" | "node" | "rpc" | "l2-rpc" | "real";
20
20
 
21
21
  declare const ARTIFACT_VERSION = "1.0.0-alpha";
22
+ type DraftArtifact<TFinal, THashFields extends keyof TFinal> = Omit<TFinal, THashFields> & Partial<Pick<TFinal, THashFields>>;
22
23
  declare const ArtifactLineageSchema: z.ZodObject<{
23
24
  artifactId: z.ZodString;
24
25
  lineageId: z.ZodString;
@@ -43,7 +44,7 @@ declare const BaseArtifactSchema: z.ZodObject<{
43
44
  hardkasVersion: z.ZodString;
44
45
  version: z.ZodLiteral<"1.0.0-alpha">;
45
46
  hashVersion: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
46
- networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
47
+ networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
47
48
  mode: z.ZodEnum<["simulated", "real", "readonly"]>;
48
49
  contentHash: z.ZodOptional<z.ZodString>;
49
50
  createdAt: z.ZodString;
@@ -70,7 +71,7 @@ declare const BaseArtifactSchema: z.ZodObject<{
70
71
  schema: string;
71
72
  hardkasVersion: string;
72
73
  version: "1.0.0-alpha";
73
- networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
74
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
74
75
  mode: "simulated" | "real" | "readonly";
75
76
  createdAt: string;
76
77
  hashVersion?: string | number | undefined;
@@ -86,7 +87,7 @@ declare const BaseArtifactSchema: z.ZodObject<{
86
87
  schema: string;
87
88
  hardkasVersion: string;
88
89
  version: "1.0.0-alpha";
89
- networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
90
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
90
91
  mode: "simulated" | "real" | "readonly";
91
92
  createdAt: string;
92
93
  hashVersion?: string | number | undefined;
@@ -139,7 +140,7 @@ declare const TxPlanSchema: z.ZodObject<{
139
140
  }>>;
140
141
  } & {
141
142
  schema: z.ZodLiteral<"hardkas.txPlan">;
142
- networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
143
+ networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
143
144
  mode: z.ZodEnum<["simulated", "real", "readonly"]>;
144
145
  planId: z.ZodString;
145
146
  from: z.ZodObject<{
@@ -221,7 +222,7 @@ declare const TxPlanSchema: z.ZodObject<{
221
222
  schema: "hardkas.txPlan";
222
223
  hardkasVersion: string;
223
224
  version: "1.0.0-alpha";
224
- networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
225
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
225
226
  mode: "simulated" | "real" | "readonly";
226
227
  createdAt: string;
227
228
  planId: string;
@@ -267,7 +268,7 @@ declare const TxPlanSchema: z.ZodObject<{
267
268
  schema: "hardkas.txPlan";
268
269
  hardkasVersion: string;
269
270
  version: "1.0.0-alpha";
270
- networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
271
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
271
272
  mode: "simulated" | "real" | "readonly";
272
273
  createdAt: string;
273
274
  planId: string;
@@ -381,7 +382,7 @@ declare const SnapshotSchema: z.ZodObject<{
381
382
  hardkasVersion: z.ZodString;
382
383
  version: z.ZodLiteral<"1.0.0-alpha">;
383
384
  hashVersion: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
384
- networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
385
+ networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
385
386
  mode: z.ZodEnum<["simulated", "real", "readonly"]>;
386
387
  contentHash: z.ZodOptional<z.ZodString>;
387
388
  createdAt: z.ZodString;
@@ -444,7 +445,7 @@ declare const SnapshotSchema: z.ZodObject<{
444
445
  schema: "hardkas.snapshot";
445
446
  hardkasVersion: string;
446
447
  version: "1.0.0-alpha";
447
- networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
448
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
448
449
  mode: "simulated" | "real" | "readonly";
449
450
  createdAt: string;
450
451
  daaScore: string;
@@ -476,7 +477,7 @@ declare const SnapshotSchema: z.ZodObject<{
476
477
  schema: "hardkas.snapshot";
477
478
  hardkasVersion: string;
478
479
  version: "1.0.0-alpha";
479
- networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
480
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
480
481
  mode: "simulated" | "real" | "readonly";
481
482
  createdAt: string;
482
483
  daaScore: string;
@@ -535,7 +536,7 @@ declare const TxReceiptSchema: z.ZodObject<{
535
536
  txId: z.ZodString;
536
537
  status: z.ZodEnum<["pending", "submitted", "accepted", "confirmed", "failed"]>;
537
538
  mode: z.ZodEnum<["simulated", "real", "readonly"]>;
538
- networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
539
+ networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
539
540
  from: z.ZodObject<{
540
541
  address: z.ZodString;
541
542
  accountName: z.ZodOptional<z.ZodString>;
@@ -624,13 +625,14 @@ declare const TxReceiptSchema: z.ZodObject<{
624
625
  tracePath: z.ZodOptional<z.ZodString>;
625
626
  rpcUrl: z.ZodOptional<z.ZodString>;
626
627
  sourceSignedId: z.ZodOptional<z.ZodString>;
628
+ errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
627
629
  metadata: z.ZodOptional<z.ZodAny>;
628
630
  }, "strip", z.ZodTypeAny, {
629
631
  status: "pending" | "submitted" | "accepted" | "confirmed" | "failed";
630
632
  schema: "hardkas.txReceipt";
631
633
  hardkasVersion: string;
632
634
  version: "1.0.0-alpha";
633
- networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
635
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
634
636
  mode: "simulated" | "real" | "readonly";
635
637
  createdAt: string;
636
638
  from: {
@@ -681,13 +683,14 @@ declare const TxReceiptSchema: z.ZodObject<{
681
683
  } | undefined;
682
684
  tracePath?: string | undefined;
683
685
  sourceSignedId?: string | undefined;
686
+ errors?: string[] | undefined;
684
687
  metadata?: any;
685
688
  }, {
686
689
  status: "pending" | "submitted" | "accepted" | "confirmed" | "failed";
687
690
  schema: "hardkas.txReceipt";
688
691
  hardkasVersion: string;
689
692
  version: "1.0.0-alpha";
690
- networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
693
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
691
694
  mode: "simulated" | "real" | "readonly";
692
695
  createdAt: string;
693
696
  from: {
@@ -738,6 +741,7 @@ declare const TxReceiptSchema: z.ZodObject<{
738
741
  } | undefined;
739
742
  tracePath?: string | undefined;
740
743
  sourceSignedId?: string | undefined;
744
+ errors?: string[] | undefined;
741
745
  metadata?: any;
742
746
  }>;
743
747
  declare const SignedTxSchema: z.ZodObject<{
@@ -770,7 +774,7 @@ declare const SignedTxSchema: z.ZodObject<{
770
774
  status: z.ZodLiteral<"signed">;
771
775
  signedId: z.ZodString;
772
776
  sourcePlanId: z.ZodString;
773
- networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
777
+ networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
774
778
  mode: z.ZodEnum<["simulated", "real", "readonly"]>;
775
779
  from: z.ZodObject<{
776
780
  address: z.ZodString;
@@ -816,7 +820,7 @@ declare const SignedTxSchema: z.ZodObject<{
816
820
  schema: "hardkas.signedTx";
817
821
  hardkasVersion: string;
818
822
  version: "1.0.0-alpha";
819
- networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
823
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
820
824
  mode: "simulated" | "real" | "readonly";
821
825
  createdAt: string;
822
826
  from: {
@@ -852,7 +856,7 @@ declare const SignedTxSchema: z.ZodObject<{
852
856
  schema: "hardkas.signedTx";
853
857
  hardkasVersion: string;
854
858
  version: "1.0.0-alpha";
855
- networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
859
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
856
860
  mode: "simulated" | "real" | "readonly";
857
861
  createdAt: string;
858
862
  from: {
@@ -912,7 +916,7 @@ declare const TxTraceSchema: z.ZodObject<{
912
916
  } & {
913
917
  schema: z.ZodLiteral<"hardkas.txTrace">;
914
918
  txId: z.ZodString;
915
- networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
919
+ networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
916
920
  mode: z.ZodEnum<["simulated", "real", "readonly"]>;
917
921
  steps: z.ZodArray<z.ZodObject<{
918
922
  phase: z.ZodString;
@@ -982,7 +986,7 @@ declare const TxTraceSchema: z.ZodObject<{
982
986
  schema: "hardkas.txTrace";
983
987
  hardkasVersion: string;
984
988
  version: "1.0.0-alpha";
985
- networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
989
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
986
990
  mode: "simulated" | "real" | "readonly";
987
991
  createdAt: string;
988
992
  txId: string;
@@ -1019,7 +1023,7 @@ declare const TxTraceSchema: z.ZodObject<{
1019
1023
  schema: "hardkas.txTrace";
1020
1024
  hardkasVersion: string;
1021
1025
  version: "1.0.0-alpha";
1022
- networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
1026
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
1023
1027
  mode: "simulated" | "real" | "readonly";
1024
1028
  createdAt: string;
1025
1029
  txId: string;
@@ -1053,12 +1057,218 @@ declare const TxTraceSchema: z.ZodObject<{
1053
1057
  nonSelectedContext?: boolean | undefined;
1054
1058
  } | undefined;
1055
1059
  }>;
1060
+ declare const WorkflowSchema: z.ZodObject<{
1061
+ hardkasVersion: z.ZodString;
1062
+ version: z.ZodLiteral<"1.0.0-alpha">;
1063
+ hashVersion: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
1064
+ networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
1065
+ mode: z.ZodEnum<["simulated", "real", "readonly"]>;
1066
+ contentHash: z.ZodOptional<z.ZodString>;
1067
+ createdAt: z.ZodString;
1068
+ lineage: z.ZodOptional<z.ZodObject<{
1069
+ artifactId: z.ZodString;
1070
+ lineageId: z.ZodString;
1071
+ parentArtifactId: z.ZodOptional<z.ZodString>;
1072
+ rootArtifactId: z.ZodString;
1073
+ sequence: z.ZodOptional<z.ZodNumber>;
1074
+ }, "strip", z.ZodTypeAny, {
1075
+ artifactId: string;
1076
+ lineageId: string;
1077
+ rootArtifactId: string;
1078
+ parentArtifactId?: string | undefined;
1079
+ sequence?: number | undefined;
1080
+ }, {
1081
+ artifactId: string;
1082
+ lineageId: string;
1083
+ rootArtifactId: string;
1084
+ parentArtifactId?: string | undefined;
1085
+ sequence?: number | undefined;
1086
+ }>>;
1087
+ } & {
1088
+ schema: z.ZodLiteral<"hardkas.workflow.v1">;
1089
+ workflowId: z.ZodString;
1090
+ status: z.ZodEnum<["pending", "running", "completed", "failed"]>;
1091
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1092
+ steps: z.ZodArray<z.ZodObject<{
1093
+ type: z.ZodString;
1094
+ status: z.ZodEnum<["pending", "success", "failed", "skipped"]>;
1095
+ startedAt: z.ZodOptional<z.ZodString>;
1096
+ completedAt: z.ZodOptional<z.ZodString>;
1097
+ producedArtifactId: z.ZodOptional<z.ZodString>;
1098
+ error: z.ZodOptional<z.ZodString>;
1099
+ }, "strip", z.ZodTypeAny, {
1100
+ type: string;
1101
+ status: "pending" | "failed" | "success" | "skipped";
1102
+ startedAt?: string | undefined;
1103
+ completedAt?: string | undefined;
1104
+ producedArtifactId?: string | undefined;
1105
+ error?: string | undefined;
1106
+ }, {
1107
+ type: string;
1108
+ status: "pending" | "failed" | "success" | "skipped";
1109
+ startedAt?: string | undefined;
1110
+ completedAt?: string | undefined;
1111
+ producedArtifactId?: string | undefined;
1112
+ error?: string | undefined;
1113
+ }>, "many">;
1114
+ parentArtifacts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1115
+ producedArtifacts: z.ZodArray<z.ZodString, "many">;
1116
+ generationRange: z.ZodOptional<z.ZodObject<{
1117
+ start: z.ZodOptional<z.ZodString>;
1118
+ end: z.ZodOptional<z.ZodString>;
1119
+ }, "strip", z.ZodTypeAny, {
1120
+ start?: string | undefined;
1121
+ end?: string | undefined;
1122
+ }, {
1123
+ start?: string | undefined;
1124
+ end?: string | undefined;
1125
+ }>>;
1126
+ policy: z.ZodOptional<z.ZodObject<{
1127
+ allowNetwork: z.ZodBoolean;
1128
+ allowMainnet: z.ZodBoolean;
1129
+ allowExternalWallet: z.ZodBoolean;
1130
+ requireDryRun: z.ZodBoolean;
1131
+ }, "strip", z.ZodTypeAny, {
1132
+ allowNetwork: boolean;
1133
+ allowMainnet: boolean;
1134
+ allowExternalWallet: boolean;
1135
+ requireDryRun: boolean;
1136
+ }, {
1137
+ allowNetwork: boolean;
1138
+ allowMainnet: boolean;
1139
+ allowExternalWallet: boolean;
1140
+ requireDryRun: boolean;
1141
+ }>>;
1142
+ generationId: z.ZodOptional<z.ZodString>;
1143
+ replayResult: z.ZodOptional<z.ZodObject<{
1144
+ verified: z.ZodBoolean;
1145
+ stateHash: z.ZodOptional<z.ZodString>;
1146
+ }, "strip", z.ZodTypeAny, {
1147
+ verified: boolean;
1148
+ stateHash?: string | undefined;
1149
+ }, {
1150
+ verified: boolean;
1151
+ stateHash?: string | undefined;
1152
+ }>>;
1153
+ errorEnvelope: z.ZodOptional<z.ZodObject<{
1154
+ code: z.ZodString;
1155
+ message: z.ZodString;
1156
+ redacted: z.ZodBoolean;
1157
+ }, "strip", z.ZodTypeAny, {
1158
+ code: string;
1159
+ message: string;
1160
+ redacted: boolean;
1161
+ }, {
1162
+ code: string;
1163
+ message: string;
1164
+ redacted: boolean;
1165
+ }>>;
1166
+ }, "strip", z.ZodTypeAny, {
1167
+ status: "pending" | "failed" | "running" | "completed";
1168
+ schema: "hardkas.workflow.v1";
1169
+ hardkasVersion: string;
1170
+ version: "1.0.0-alpha";
1171
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
1172
+ mode: "simulated" | "real" | "readonly";
1173
+ createdAt: string;
1174
+ steps: {
1175
+ type: string;
1176
+ status: "pending" | "failed" | "success" | "skipped";
1177
+ startedAt?: string | undefined;
1178
+ completedAt?: string | undefined;
1179
+ producedArtifactId?: string | undefined;
1180
+ error?: string | undefined;
1181
+ }[];
1182
+ workflowId: string;
1183
+ producedArtifacts: string[];
1184
+ hashVersion?: string | number | undefined;
1185
+ contentHash?: string | undefined;
1186
+ lineage?: {
1187
+ artifactId: string;
1188
+ lineageId: string;
1189
+ rootArtifactId: string;
1190
+ parentArtifactId?: string | undefined;
1191
+ sequence?: number | undefined;
1192
+ } | undefined;
1193
+ inputs?: Record<string, any> | undefined;
1194
+ parentArtifacts?: string[] | undefined;
1195
+ generationRange?: {
1196
+ start?: string | undefined;
1197
+ end?: string | undefined;
1198
+ } | undefined;
1199
+ policy?: {
1200
+ allowNetwork: boolean;
1201
+ allowMainnet: boolean;
1202
+ allowExternalWallet: boolean;
1203
+ requireDryRun: boolean;
1204
+ } | undefined;
1205
+ generationId?: string | undefined;
1206
+ replayResult?: {
1207
+ verified: boolean;
1208
+ stateHash?: string | undefined;
1209
+ } | undefined;
1210
+ errorEnvelope?: {
1211
+ code: string;
1212
+ message: string;
1213
+ redacted: boolean;
1214
+ } | undefined;
1215
+ }, {
1216
+ status: "pending" | "failed" | "running" | "completed";
1217
+ schema: "hardkas.workflow.v1";
1218
+ hardkasVersion: string;
1219
+ version: "1.0.0-alpha";
1220
+ networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
1221
+ mode: "simulated" | "real" | "readonly";
1222
+ createdAt: string;
1223
+ steps: {
1224
+ type: string;
1225
+ status: "pending" | "failed" | "success" | "skipped";
1226
+ startedAt?: string | undefined;
1227
+ completedAt?: string | undefined;
1228
+ producedArtifactId?: string | undefined;
1229
+ error?: string | undefined;
1230
+ }[];
1231
+ workflowId: string;
1232
+ producedArtifacts: string[];
1233
+ hashVersion?: string | number | undefined;
1234
+ contentHash?: string | undefined;
1235
+ lineage?: {
1236
+ artifactId: string;
1237
+ lineageId: string;
1238
+ rootArtifactId: string;
1239
+ parentArtifactId?: string | undefined;
1240
+ sequence?: number | undefined;
1241
+ } | undefined;
1242
+ inputs?: Record<string, any> | undefined;
1243
+ parentArtifacts?: string[] | undefined;
1244
+ generationRange?: {
1245
+ start?: string | undefined;
1246
+ end?: string | undefined;
1247
+ } | undefined;
1248
+ policy?: {
1249
+ allowNetwork: boolean;
1250
+ allowMainnet: boolean;
1251
+ allowExternalWallet: boolean;
1252
+ requireDryRun: boolean;
1253
+ } | undefined;
1254
+ generationId?: string | undefined;
1255
+ replayResult?: {
1256
+ verified: boolean;
1257
+ stateHash?: string | undefined;
1258
+ } | undefined;
1259
+ errorEnvelope?: {
1260
+ code: string;
1261
+ message: string;
1262
+ redacted: boolean;
1263
+ } | undefined;
1264
+ }>;
1056
1265
  type TxPlan = z.infer<typeof TxPlanSchema>;
1057
1266
  type Snapshot = z.infer<typeof SnapshotSchema>;
1058
1267
  type TxReceipt = z.infer<typeof TxReceiptSchema>;
1059
1268
  type SignedTx = z.infer<typeof SignedTxSchema>;
1060
1269
  type TxTrace = z.infer<typeof TxTraceSchema>;
1061
1270
  type DagContext$1 = z.infer<typeof DagContextSchema>;
1271
+ type Workflow = z.infer<typeof WorkflowSchema>;
1062
1272
 
1063
1273
  interface ArtifactValidationResult {
1064
1274
  ok: boolean;
@@ -1133,10 +1343,10 @@ declare function validateIgraSignedTxArtifact(value: unknown): ArtifactValidatio
1133
1343
  declare function assertValidIgraSignedTxArtifact(value: unknown): asserts value is IgraSignedTxArtifact;
1134
1344
  declare function validateIgraTxReceiptArtifact(value: unknown): ArtifactValidationResult;
1135
1345
  declare function assertValidIgraTxReceiptArtifact(value: unknown): asserts value is IgraTxReceiptArtifact;
1136
- declare function assertDecimalBigIntString(value: any, field: string, errors: string[]): void;
1137
- declare function assertHexData(value: any, field: string, errors: string[]): void;
1138
- declare function assertEvmAddress(value: any, field: string, errors: string[]): void;
1139
- declare function assertEvmTxHash(value: any, field: string, errors: string[]): void;
1346
+ declare function assertDecimalBigIntString(value: unknown, field: string, errors: string[]): void;
1347
+ declare function assertHexData(value: unknown, field: string, errors: string[]): void;
1348
+ declare function assertEvmAddress(value: unknown, field: string, errors: string[]): void;
1349
+ declare function assertEvmTxHash(value: unknown, field: string, errors: string[]): void;
1140
1350
  declare function createIgraPlanId(hash: string): string;
1141
1351
  declare function createIgraSignedId(hash: string): string;
1142
1352
  declare function createIgraDeployPlanId(hash: string): string;
@@ -1386,6 +1596,41 @@ interface TxTraceArtifact extends BaseArtifact<"txTrace"> {
1386
1596
  dagContext?: DagContext | undefined;
1387
1597
  }
1388
1598
 
1599
+ interface WorkflowArtifact extends BaseArtifact<"workflow.v1"> {
1600
+ workflowId: WorkflowId;
1601
+ status: "pending" | "running" | "completed" | "failed";
1602
+ inputs?: Record<string, any>;
1603
+ steps: Array<{
1604
+ type: string;
1605
+ status: "pending" | "success" | "failed" | "skipped";
1606
+ startedAt?: string;
1607
+ completedAt?: string;
1608
+ producedArtifactId?: string;
1609
+ error?: string;
1610
+ }>;
1611
+ parentArtifacts?: string[];
1612
+ producedArtifacts: string[];
1613
+ generationRange?: {
1614
+ start?: string;
1615
+ end?: string;
1616
+ };
1617
+ policy?: {
1618
+ allowNetwork: boolean;
1619
+ allowMainnet: boolean;
1620
+ allowExternalWallet: boolean;
1621
+ requireDryRun: boolean;
1622
+ };
1623
+ generationId?: string;
1624
+ replayResult?: {
1625
+ verified: boolean;
1626
+ stateHash?: string;
1627
+ };
1628
+ errorEnvelope?: {
1629
+ code: string;
1630
+ message: string;
1631
+ redacted: boolean;
1632
+ };
1633
+ }
1389
1634
  interface DeploymentRecord extends HardkasArtifactBase {
1390
1635
  schema: "hardkas.deployment.v1";
1391
1636
  /** Human-readable label (e.g., "initial-funding", "vault-covenant-v1") */
@@ -1444,12 +1689,12 @@ declare const CURRENT_HASH_VERSION = 3;
1444
1689
  * Excludes fields in SEMANTIC_EXCLUSIONS during serialization.
1445
1690
  * Skips keys with undefined values (matching JSON.stringify behavior).
1446
1691
  */
1447
- declare function canonicalStringify(obj: any, version?: number): string;
1692
+ declare function canonicalStringify(obj: unknown, version?: number): string;
1448
1693
  /**
1449
1694
  * Calculates a SHA-256 hash of the canonical JSON representation.
1450
1695
  * Always excludes fields in SEMANTIC_EXCLUSIONS from the calculation.
1451
1696
  */
1452
- declare function calculateContentHash(obj: any, version?: number): string;
1697
+ declare function calculateContentHash(obj: unknown, version?: number): string;
1453
1698
 
1454
1699
  interface Clock {
1455
1700
  now(): number;
@@ -1629,16 +1874,129 @@ declare class InvariantWatcher {
1629
1874
  private emitViolation;
1630
1875
  }
1631
1876
 
1877
+ /**
1878
+ * Represents the payload of any HardKAS artifact in its raw (parsed JSON) form.
1879
+ * The migration engine operates on this untyped representation to support
1880
+ * artifacts across schema versions.
1881
+ */
1882
+ type ArtifactPayload = Record<string, unknown>;
1883
+ /**
1884
+ * A single versioned migration step that transforms an artifact payload
1885
+ * from one schema version to the next.
1886
+ */
1887
+ interface MigrationStep {
1888
+ /** Source version string (e.g., "0.1.0", "1.0.0-alpha") */
1889
+ readonly fromVersion: string;
1890
+ /** Target version string */
1891
+ readonly toVersion: string;
1892
+ /** Human-readable description of what this migration does */
1893
+ readonly description: string;
1894
+ /**
1895
+ * Transform function. Receives a shallow clone of the artifact payload
1896
+ * and returns the migrated payload. MUST NOT mutate the input.
1897
+ */
1898
+ transform(artifact: ArtifactPayload): ArtifactPayload;
1899
+ }
1900
+ /**
1901
+ * Result of a migration operation.
1902
+ */
1903
+ interface MigrationResult {
1904
+ /** The migrated artifact payload */
1905
+ artifact: ArtifactPayload;
1906
+ /** Whether any migration was actually applied */
1907
+ migrated: boolean;
1908
+ /** The original content hash (before migration), preserved for lineage */
1909
+ originalContentHash: string | undefined;
1910
+ /** Ordered list of migration steps that were applied */
1911
+ appliedSteps: ReadonlyArray<{
1912
+ fromVersion: string;
1913
+ toVersion: string;
1914
+ description: string;
1915
+ }>;
1916
+ }
1917
+ /**
1918
+ * Registers a migration step in the global registry.
1919
+ * Steps should be registered in chronological order (oldest → newest).
1920
+ *
1921
+ * @param step - The migration step to register
1922
+ */
1923
+ declare function registerMigrationStep(step: MigrationStep): void;
1924
+ /**
1925
+ * Returns all registered migration steps (read-only copy).
1926
+ */
1927
+ declare function getRegisteredMigrationSteps(): ReadonlyArray<MigrationStep>;
1928
+ /**
1929
+ * Determines the version of an artifact based on its `version` field,
1930
+ * falling back to heuristics for truly legacy artifacts.
1931
+ */
1932
+ declare function detectArtifactVersion(artifact: ArtifactPayload): string;
1933
+ /**
1934
+ * Resolves the ordered list of migration steps needed to go from
1935
+ * `fromVersion` to `toVersion`.
1936
+ *
1937
+ * Uses a simple BFS/chain walk through the migration registry.
1938
+ * Returns an empty array if no migration path exists or if the artifact
1939
+ * is already at the target version.
1940
+ *
1941
+ * @param fromVersion - The current artifact version
1942
+ * @param toVersion - The desired target version
1943
+ * @returns Ordered array of migration steps, or empty if no path or already current
1944
+ */
1945
+ declare function getMigrationPath(fromVersion: string, toVersion: string): ReadonlyArray<MigrationStep>;
1946
+ /**
1947
+ * Checks whether a migration path exists from the artifact's current
1948
+ * version to the target version.
1949
+ *
1950
+ * @param artifact - The artifact payload to check
1951
+ * @param targetVersion - The desired target version (defaults to ARTIFACT_VERSION)
1952
+ * @returns `true` if a migration path exists or the artifact is already at the target version
1953
+ */
1954
+ declare function canMigrate(artifact: ArtifactPayload, targetVersion?: string): boolean;
1955
+ /**
1956
+ * Migrates an artifact payload from its current schema version to the
1957
+ * specified target version.
1958
+ *
1959
+ * **Identity Preservation:**
1960
+ * - The original `contentHash` is preserved as `originalContentHash`
1961
+ * - The `lineage.rootArtifactId` is NEVER modified
1962
+ * - A new `contentHash` is computed after migration using `CURRENT_HASH_VERSION`
1963
+ *
1964
+ * **Non-Destructive:**
1965
+ * - The input artifact object is never mutated
1966
+ * - The canonical artifact file on disk is never modified
1967
+ * - Migration produces a new in-memory representation only
1968
+ *
1969
+ * @param artifact - The artifact payload to migrate
1970
+ * @param targetVersion - The desired target version (defaults to ARTIFACT_VERSION)
1971
+ * @returns MigrationResult with the migrated artifact and metadata
1972
+ * @throws Error if no migration path exists
1973
+ *
1974
+ * @example
1975
+ * ```typescript
1976
+ * const result = migrateArtifactPayload(legacyArtifact);
1977
+ * if (result.migrated) {
1978
+ * console.log(`Migrated from ${result.appliedSteps[0].fromVersion}`);
1979
+ * console.log(`Original hash preserved: ${result.originalContentHash}`);
1980
+ * }
1981
+ * ```
1982
+ */
1983
+ declare function migrateArtifactPayload(artifact: ArtifactPayload, targetVersion?: string): MigrationResult;
1632
1984
  /**
1633
1985
  * Migrates a v1 artifact to canonical format by updating the schema, version,
1634
1986
  * and calculating the contentHash.
1987
+ *
1988
+ * @deprecated Use `migrateArtifactPayload()` instead. This function is retained
1989
+ * for backward compatibility with existing callers.
1990
+ *
1991
+ * @param v1Artifact - The legacy v1 artifact to migrate
1992
+ * @returns The migrated artifact in canonical format
1635
1993
  */
1636
- declare function migrateToCanonical(v1Artifact: any): any;
1994
+ declare function migrateToCanonical(v1Artifact: ArtifactPayload): ArtifactPayload;
1637
1995
 
1638
- declare const bigIntReplacer: (_key: string, value: any) => any;
1996
+ declare const bigIntReplacer: (_key: string, value: unknown) => unknown;
1639
1997
  declare function writeArtifact(filePath: string, artifact: unknown): Promise<void>;
1640
1998
  declare function getDefaultReceiptPath(txId: string, cwd?: string): string;
1641
- declare function readArtifact(filePath: string): Promise<any>;
1999
+ declare function readArtifact(filePath: string): Promise<unknown>;
1642
2000
  declare function readTxPlanArtifact(filePath: string): Promise<TxPlan>;
1643
2001
  declare function readSignedTxArtifact(filePath: string): Promise<SignedTx>;
1644
2002
  declare function readTxReceiptArtifact(filePath: string): Promise<TxReceipt>;
@@ -1688,6 +2046,7 @@ interface CreateTxPlanArtifactOptions {
1688
2046
  amountSompi: bigint;
1689
2047
  plan: TxPlan$1;
1690
2048
  rpcUrl?: string;
2049
+ ctx: RuntimeContext;
1691
2050
  }
1692
2051
  /**
1693
2052
  * Creates a canonical TxPlan artifact from a TxBuilder plan.
@@ -1697,11 +2056,11 @@ declare function createTxPlanArtifact(options: CreateTxPlanArtifactOptions): TxP
1697
2056
  /**
1698
2057
  * Creates a canonical simulated signed transaction artifact.
1699
2058
  */
1700
- declare function createSimulatedSignedTxArtifact(plan: TxPlan, payload: string): SignedTx;
2059
+ declare function createSimulatedSignedTxArtifact(plan: TxPlan, payload: string, ctx: RuntimeContext): SignedTx;
1701
2060
  /**
1702
2061
  * Creates a canonical simulated receipt.
1703
2062
  */
1704
- declare function createSimulatedTxReceipt(plan: TxPlan, txId: string, extra?: {
2063
+ declare function createSimulatedTxReceipt(plan: TxPlan, txId: string, ctx: RuntimeContext, extra?: {
1705
2064
  spentUtxoIds?: string[];
1706
2065
  createdUtxoIds?: string[];
1707
2066
  daaScore?: string;
@@ -1766,7 +2125,7 @@ interface ArtifactExplanation {
1766
2125
  /**
1767
2126
  * Generates a deep operational explanation of a HardKAS artifact.
1768
2127
  */
1769
- declare function explainArtifact(artifact: any): Promise<ArtifactExplanation>;
2128
+ declare function explainArtifact(artifactUnknown: unknown): Promise<ArtifactExplanation>;
1770
2129
 
1771
2130
  declare function getDefaultL2ReceiptsDir(cwd?: string): string;
1772
2131
  declare function getL2ReceiptPath(txHash: string, options?: {
@@ -1854,4 +2213,4 @@ declare function listDeployments(rootDir: string, networkId?: string): Promise<D
1854
2213
  declare function updateDeployment(rootDir: string, networkId: string, label: string, update: Partial<DeploymentRecord>): Promise<DeploymentRecord>;
1855
2214
  declare function deleteDeployment(rootDir: string, networkId: string, label: string): Promise<boolean>;
1856
2215
 
1857
- export { ARTIFACT_SCHEMAS, ARTIFACT_VERSION, AccountRefSchema, type ArtifactDiff, type ArtifactExplanation, ArtifactLineageSchema, type ArtifactLookup, type ArtifactValidationResult, type ArtifactVerificationResult, type AssumptionLevel, type BaseArtifact, BaseArtifactSchema, BasicCorrelationInvariant, BasicLineageInvariant, CURRENT_HASH_VERSION, type Clock, type CreateTxPlanArtifactOptions, type DagContext, DagContextSchema, type DeploymentIndex, type DeploymentRecord, type DeploymentSummary, type DiffEntry, type FeeAuditResult, HARDKAS_VERSION, type HardkasArtifactBase, type HardkasArtifactMode, type HardkasArtifactSchema, HashInvariant, type IgraSignedTxArtifact, type IgraTxPlanArtifact, type IgraTxReceiptArtifact, type IgraTxRequestArtifact, type Invariant, type InvariantContext, type InvariantViolation, InvariantWatcher, LifecycleInvariant, type LineageOptions, type LineageValidationResult, LocalnetUtxoSchemaV2, NetworkInvariant, ReplayInvariant, SEMANTIC_EXCLUSIONS, SchemaInvariant, type SignedTx, type SignedTxArtifact, type SignedTxArtifactV1, SignedTxSchema, type Snapshot, type SnapshotArtifact, SnapshotSchema, type TxOutputArtifact, type TxPlan, type TxPlanArtifact, type TxPlanArtifactV1, TxPlanSchema, type TxReceipt, type TxReceiptArtifact, type TxReceiptArtifactV1, TxReceiptSchema, type TxTrace, type TxTraceArtifact, type TxTraceArtifactV1, TxTraceSchema, type UtxoArtifact, type VerificationContext, type VerificationIssue, type VerificationSeverity, type WatcherOptions, assertDecimalBigIntString, assertEvmAddress, assertEvmTxHash, assertHexData, assertValidIgraSignedTxArtifact, assertValidIgraTxPlanArtifact, assertValidIgraTxReceiptArtifact, assertValidSignedTxArtifact, assertValidTxPlanArtifact, assertValidTxReceiptArtifact, bigIntReplacer, calculateContentHash, canonicalStringify, createDeploymentRecord, createIgraDeployPlanId, createIgraPlanId, createIgraSignedId, createSimulatedSignedTxArtifact, createSimulatedTxReceipt, createTxPlanArtifact, defaultClock, deleteDeployment, diffArtifacts, explainArtifact, formatSignedTxArtifact, formatTxPlanArtifact, formatTxReceiptArtifact, getBroadcastableSignedTransaction, getDefaultL2ReceiptsDir, getDefaultReceiptPath, getL2ReceiptPath, isIgraTxPlanArtifact, listDeployments, listIgraTxReceiptArtifacts, loadDeployment, loadIgraTxReceiptArtifact, migrateToCanonical, readArtifact, readSignedTxArtifact, readTxPlanArtifact, readTxReceiptArtifact, recomputeMass, saveDeployment, saveIgraTxReceiptArtifact, sortUtxosByOutpoint, txOutputFromArtifact, txOutputToArtifact, updateDeployment, updateDeploymentStatus, utxoFromArtifact, utxoToArtifact, validateArtifact, validateIgraSignedTxArtifact, validateIgraTxPlanArtifact, validateIgraTxReceiptArtifact, validateSignedTxArtifact, validateTxPlanArtifact, validateTxReceiptArtifact, verifyArtifact, verifyArtifactFile, verifyArtifactIntegrity, verifyArtifactReplay, verifyArtifactSemantics, verifyFeeSemantics, verifyLineage, writeArtifact };
2216
+ export { ARTIFACT_SCHEMAS, ARTIFACT_VERSION, AccountRefSchema, type ArtifactDiff, type ArtifactExplanation, ArtifactLineageSchema, type ArtifactLookup, type ArtifactPayload, type ArtifactValidationResult, type ArtifactVerificationResult, type AssumptionLevel, type BaseArtifact, BaseArtifactSchema, BasicCorrelationInvariant, BasicLineageInvariant, CURRENT_HASH_VERSION, type Clock, type CreateTxPlanArtifactOptions, type DagContext, DagContextSchema, type DeploymentIndex, type DeploymentRecord, type DeploymentSummary, type DiffEntry, type DraftArtifact, type FeeAuditResult, HARDKAS_VERSION, type HardkasArtifactBase, type HardkasArtifactMode, type HardkasArtifactSchema, HashInvariant, type IgraSignedTxArtifact, type IgraTxPlanArtifact, type IgraTxReceiptArtifact, type IgraTxRequestArtifact, type Invariant, type InvariantContext, type InvariantViolation, InvariantWatcher, LifecycleInvariant, type LineageOptions, type LineageValidationResult, LocalnetUtxoSchemaV2, type MigrationResult, type MigrationStep, NetworkInvariant, ReplayInvariant, SEMANTIC_EXCLUSIONS, SchemaInvariant, type SignedTx, type SignedTxArtifact, type SignedTxArtifactV1, SignedTxSchema, type Snapshot, type SnapshotArtifact, SnapshotSchema, type TxOutputArtifact, type TxPlan, type TxPlanArtifact, type TxPlanArtifactV1, TxPlanSchema, type TxReceipt, type TxReceiptArtifact, type TxReceiptArtifactV1, TxReceiptSchema, type TxTrace, type TxTraceArtifact, type TxTraceArtifactV1, TxTraceSchema, type UtxoArtifact, type VerificationContext, type VerificationIssue, type VerificationSeverity, type WatcherOptions, type Workflow, type WorkflowArtifact, WorkflowSchema, assertDecimalBigIntString, assertEvmAddress, assertEvmTxHash, assertHexData, assertValidIgraSignedTxArtifact, assertValidIgraTxPlanArtifact, assertValidIgraTxReceiptArtifact, assertValidSignedTxArtifact, assertValidTxPlanArtifact, assertValidTxReceiptArtifact, bigIntReplacer, calculateContentHash, canMigrate, canonicalStringify, createDeploymentRecord, createIgraDeployPlanId, createIgraPlanId, createIgraSignedId, createSimulatedSignedTxArtifact, createSimulatedTxReceipt, createTxPlanArtifact, defaultClock, deleteDeployment, detectArtifactVersion, diffArtifacts, explainArtifact, formatSignedTxArtifact, formatTxPlanArtifact, formatTxReceiptArtifact, getBroadcastableSignedTransaction, getDefaultL2ReceiptsDir, getDefaultReceiptPath, getL2ReceiptPath, getMigrationPath, getRegisteredMigrationSteps, isIgraTxPlanArtifact, listDeployments, listIgraTxReceiptArtifacts, loadDeployment, loadIgraTxReceiptArtifact, migrateArtifactPayload, migrateToCanonical, readArtifact, readSignedTxArtifact, readTxPlanArtifact, readTxReceiptArtifact, recomputeMass, registerMigrationStep, saveDeployment, saveIgraTxReceiptArtifact, sortUtxosByOutpoint, txOutputFromArtifact, txOutputToArtifact, updateDeployment, updateDeploymentStatus, utxoFromArtifact, utxoToArtifact, validateArtifact, validateIgraSignedTxArtifact, validateIgraTxPlanArtifact, validateIgraTxReceiptArtifact, validateSignedTxArtifact, validateTxPlanArtifact, validateTxReceiptArtifact, verifyArtifact, verifyArtifactFile, verifyArtifactIntegrity, verifyArtifactReplay, verifyArtifactSemantics, verifyFeeSemantics, verifyLineage, writeArtifact };